diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..20a0c05d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "love/src/jni/love"] + path = love/src/jni/love + url = https://github.com/love2d/love diff --git a/love/src/jni/love b/love/src/jni/love new file mode 160000 index 00000000..899a220e --- /dev/null +++ b/love/src/jni/love @@ -0,0 +1 @@ +Subproject commit 899a220ef4183809ed86836a9867910b5e751424 diff --git a/love/src/jni/love/.hg_archival.txt b/love/src/jni/love/.hg_archival.txt deleted file mode 100644 index 99118211..00000000 --- a/love/src/jni/love/.hg_archival.txt +++ /dev/null @@ -1,4 +0,0 @@ -repo: d362ae6ab7f5005b8dbc7cba9ce592637de60f99 -node: 55dc225ee239c15eff5751d35ca40252588abd92 -branch: default -tag: 11.2 diff --git a/love/src/jni/love/.hgignore b/love/src/jni/love/.hgignore deleted file mode 100644 index 6ee27a2f..00000000 --- a/love/src/jni/love/.hgignore +++ /dev/null @@ -1,57 +0,0 @@ -glob:extra/reshax/Release/ -glob:extra/reshax/Debug/ -glob:extra/reshax/resources.h -glob:extra/reshax/resources.cpp -glob:*.obj -glob:*.o -glob:*.dirstamp -glob:*.m4 -glob:*.Po -glob:*.lo -glob:*.Plo -glob:*.dll -glob:*.user -glob:*.suo -glob:*/Release* -glob:*/Debug* -glob:*.lib -glob:*.ncb -glob:*.exe -glob:*.bat -glob:platform/xcode/Build -glob:platform/xcode/DerivedData -glob:platform/xcode/ios/include -glob:platform/xcode/ios/libraries -glob:*xcuserdata* -glob:*.DS_Store -glob:*.dylib -glob:*.dmg* -glob:demos -glob:*.orig -glob:.*.swp -glob:autom4te.cache/ -glob:src/.libs/ -glob:*~ -glob:Makefile* -glob:config* -glob:libtool -glob:platform/unix/ar-lib -glob:platform/unix/compile -glob:platform/unix/config.guess -glob:platform/unix/config.sub -glob:platform/unix/debian/changelog -glob:platform/unix/debian/control -glob:platform/unix/debian/rules -glob:platform/unix/depcomp -glob:platform/unix/install-sh -glob:platform/unix/love.desktop -glob:platform/unix/ltmain.sh -glob:platform/unix/missing -glob:.lineno -glob:*.la -glob:*.Tpo -glob:*.rej -glob:*/.deps -glob:stamp-h1 -glob:src/love -glob:src/tags diff --git a/love/src/jni/love/.hgtags b/love/src/jni/love/.hgtags deleted file mode 100644 index 5c3c1f98..00000000 --- a/love/src/jni/love/.hgtags +++ /dev/null @@ -1,15 +0,0 @@ -301312c82b00b1b70ceba066e1fab523be38b60a 0.6.0 -1c05df814086e1c3486423381b4bf52a3b5d4f87 0.6.1 -db7cd0682883ed357adef013a326bbb26de28c98 0.6.2 -9240be0fe0ea1070bc604954ab2e81320e278ad9 0.7.0 -18d79c306466d188919c238d23e50ea705b07c03 0.7.1 -bcca82b60d0f5cd724edbe4ed65db18ab95d4691 0.7.2 -e0f98d53debb62347c6433ca0534a0f77f15f76f 0.8.0 -38c00c788bcb03bda2ad40efebcdfe7a6be85b4a 0.9.0 -8b113c345e97e7bb7e963e5d67451abdfb05cfde 0.9.1 -a5e405cdf14d030b71d09a105086797942ae91a9 0.9.2 -14717f0fb5d96d380c10fe6f41b74b7652c7d836 0.10.0 -3cb3559eebb89803c0b7fa83d51d8e48a2b20b7a 0.10.1 -afc69c4f714534c64e6f8c8660b724b5b736d7f3 0.10.2 -bf8892ecbd07a10453c4bb36aa538b90a2830d2b 11.0 -0ab246b5045d2e697a516fcc0f8b12496a2d5c78 11.1 diff --git a/love/src/jni/love/Android.mk b/love/src/jni/love/Android.mk deleted file mode 100644 index 75b8dbe6..00000000 --- a/love/src/jni/love/Android.mk +++ /dev/null @@ -1,113 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE := liblove -LOCAL_CFLAGS := -fexceptions -g -Dlinux -Dunix \ - -DHAVE_GCC_DESTRUCTOR=1 -DOPT_GENERIC -DREAL_IS_FLOAT \ - -DGL_GLEXT_PROTOTYPES -DLOVE_TURBO_JPEG -DLOVE_NO_DEVIL \ - -DAL_ALEXT_PROTOTYPES - -LOCAL_CPPFLAGS := ${LOCAL_CFLAGS} - -# I don't think there's armeabi-v7a device without NEON instructions in 2018 -LOCAL_ARM_NEON := true - -ifeq ($(IS_ANDROID_21),yes) - # API21 defines socklen_t - LOCAL_CFLAGS += -DHAS_SOCKLEN_T=1 -endif - -LOCAL_C_INCLUDES := \ - ${LOCAL_PATH}/src \ - ${LOCAL_PATH}/src/modules \ - ${LOCAL_PATH}/src/libraries/ \ - ${LOCAL_PATH}/src/libraries/enet/libenet/include \ - ${LOCAL_PATH}/src/libraries/physfs \ - ${LOCAL_PATH}/src/libraries/glslang/glslang/Include - -LOCAL_SRC_FILES := \ - $(filter-out \ - src/modules/graphics/opengl/GLee.* \ - src/libraries/luasocket/libluasocket/wsocket.c \ - ,$(subst $(LOCAL_PATH)/,,\ - $(wildcard ${LOCAL_PATH}/src/love.cpp) \ - $(wildcard ${LOCAL_PATH}/src/common/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/audio/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/audio/null/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/audio/openal/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/data/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/event/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/event/sdl/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/filesystem/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/filesystem/physfs/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/font/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/font/freetype/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/graphics/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/graphics/opengl/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/image/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/image/magpie/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/joystick/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/joystick/sdl/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/keyboard/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/keyboard/sdl/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/love/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/math/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/mouse/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/mouse/sdl/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/physics/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/physics/box2d/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/sound/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/sound/lullaby/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/system/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/system/sdl/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/thread/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/thread/sdl/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/touch/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/touch/sdl/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/timer/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/timer/sdl/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/video/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/video/theora/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/window/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/window/sdl/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/libraries/ddsparse/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/libraries/Box2D/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/libraries/Box2D/Collision/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/libraries/Box2D/Collision/Shapes/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/libraries/Box2D/Common/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/libraries/Box2D/Dynamics/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/libraries/Box2D/Dynamics/Contacts/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/libraries/Box2D/Dynamics/Joints/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/libraries/Box2D/Rope/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/libraries/glad/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/libraries/glslang/glslang/GenericCodeGen/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/libraries/glslang/glslang/MachineIndependent/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/libraries/glslang/glslang/MachineIndependent/preprocessor/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/libraries/glslang/glslang/OSDependent/Unix/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/libraries/glslang/OGLCompilersDLL/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/libraries/glslang/glslang//*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/libraries/enet/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/libraries/enet/libenet/*.c) \ - $(wildcard ${LOCAL_PATH}/src/libraries/lua53/*.c) \ - $(wildcard ${LOCAL_PATH}/src/libraries/luasocket/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/libraries/luautf8/*.c) \ - $(wildcard ${LOCAL_PATH}/src/libraries/luasocket/libluasocket/*.c) \ - $(wildcard ${LOCAL_PATH}/src/libraries/lodepng/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/libraries/lz4/*.c) \ - $(wildcard ${LOCAL_PATH}/src/libraries/noise1234/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/libraries/physfs/*.c) \ - $(wildcard ${LOCAL_PATH}/src/libraries/Wuff/*.c) \ - $(wildcard ${LOCAL_PATH}/src/libraries/xxHash/*.c) \ - )) - -LOCAL_CXXFLAGS := -std=c++11 -LOCAL_SHARED_LIBRARIES := libopenal libmpg123 -LOCAL_STATIC_LIBRARIES := libvorbis libogg libtheora libmodplug libfreetype libluajit SDL2_static - -# $(info liblove: include dirs $(LOCAL_C_INCLUDES)) -# $(info liblove: src files $(LOCAL_SRC_FILES)) - -LOCAL_LDLIBS := -lz -lGLESv1_CM -lGLESv2 -ldl -landroid -LOCAL_LDFLAGS := -Wl,--allow-multiple-definition - -include $(BUILD_SHARED_LIBRARY) diff --git a/love/src/jni/love/CMakeLists.txt b/love/src/jni/love/CMakeLists.txt deleted file mode 100755 index 5a447bc6..00000000 --- a/love/src/jni/love/CMakeLists.txt +++ /dev/null @@ -1,1917 +0,0 @@ -# -# Copyright (c) 2006-2018 LOVE Development Team -# -# This software is provided 'as-is', without any express or implied -# warranty. In no event will the authors be held liable for any damages -# arising from the use of this software. -# -# Permission is granted to anyone to use this software for any purpose, -# including commercial applications, and to alter it and redistribute it -# freely, subject to the following restrictions: -# -# 1. The origin of this software must not be misrepresented; you must not -# claim that you wrote the original software. If you use this software -# in a product, an acknowledgment in the product documentation would be -# appreciated but is not required. -# 2. Altered source versions must be plainly marked as such, and must not be -# misrepresented as being the original software. -# 3. This notice may not be removed or altered from any source distribution. -# - -if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) - # Protip: run cmake like this: cmake -G "" -H. -Bbuild - message(FATAL_ERROR "Prevented in-tree build.") -endif() - -cmake_minimum_required(VERSION 3.1) - -project(love) - -set(LOVE_EXE_NAME love) -set(LOVE_LIB_NAME liblove) - -set(CMAKE_MODULE_PATH "${love_SOURCE_DIR}/extra/cmake" ${CMAKE_MODULE_PATH}) -# Needed for shared libs on Linux. (-fPIC). -set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) - -set (CMAKE_CXX_STANDARD 11) - -if(MSVC) - set(LOVE_CONSOLE_EXE_NAME lovec) -endif() - -if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(LOVE_X64 TRUE) - set(LOVE_TARGET_PLATFORM x64) -else() - set(LOVE_X86 TRUE) - set(LOVE_TARGET_PLATFORM x86) -endif() - -option(LOVE_JIT "Use LuaJIT" TRUE) -option(LOVE_MPG123 "Use mpg123" TRUE) - -if(LOVE_JIT) - if(APPLE) - message(FATAL_ERROR "JIT not supported yet on Mac. Please use -DLOVE_JIT=0.") - endif() - message(STATUS "LuaJIT: Enabled") -else() - message(STATUS "LuaJIT: Disabled") -endif() - -if(NOT LOVE_MPG123) - add_definitions(-DLOVE_NOMPG123) -endif() - -message(STATUS "Target platform: ${LOVE_TARGET_PLATFORM}") - -if(POLICY CMP0072) - cmake_policy(SET CMP0072 NEW) -endif() - -find_package(OpenGL) - -if(MEGA) - # LOVE_MSVC_DLLS contains runtime DLLs that should be bundled with the love - # binary (in e.g. the installer). Example: msvcp140.dll. - set(LOVE_MSVC_DLLS ${MEGA_MSVC_DLLS}) - - # LOVE_INCLUDE_DIRS contains the search directories for #include. It's mostly - # not needed for MEGA builds, since almost all the libraries (except LuaJIT) - # are CMake targets, causing include paths to be added automatically. - set(LOVE_INCLUDE_DIRS) - - if(APPLE) - # Some files do #include , but building with megasource - # requires #include . - add_definitions(-DLOVE_MACOSX_SDL_DIRECT_INCLUDE) - endif () - - # SDL2 links with some DirectX libraries, and we apparently also - # pull those libraries in for linkage because we link with SDL2. - set(LOVE_LINK_DIRS ${SDL_LINK_DIR}) - - set(LOVE_LINK_LIBRARIES - ${OPENGL_gl_LIBRARY} - ${MEGA_FREETYPE} - ${MEGA_LIBOGG} - ${MEGA_LIBVORBISFILE} - ${MEGA_LIBVORBIS} - ${MEGA_LIBTHEORA} - ${MEGA_MODPLUG} - ${MEGA_OPENAL} - ${MEGA_SDL2MAIN} - ${MEGA_SDL2} - ${MEGA_ZLIB} - ) - - # These DLLs are moved next to the love binary in a post-build step to - # love runnable from inside Visual Studio. - # - # LOVE_MOVE_DLLS can contain CMake targets, in which case the target's - # output is assumed to be a DLL, or it can contain paths to actual files. - # We detect whether or not each item is a target, and take the appropriate - # action. - set(LOVE_MOVE_DLLS - ${MEGA_SDL2} - ${MEGA_OPENAL} - ) - - if(LOVE_MPG123) - set(LOVE_LINK_LIBRARIES - ${LOVE_LINK_LIBRARIES} - ${MEGA_MPEG123} - ) - set(LOVE_MOVE_DLLS - ${LOVE_MOVE_DLLS} - ${MEGA_MPEG123} - ) - endif() - - if(LOVE_JIT) - set(LOVE_LUA_LIBRARY ${MEGA_LUAJIT_LIB}) - # LOVE_EXTRA_DLLS are non-runtime DLLs which should be bundled with the - # love binary in installers, etc. It's only needed for external - # (non-CMake) targets, i.e. LuaJIT. - set(LOVE_EXTRA_DLLS ${MEGA_LUAJIT_DLL}) - set(LOVE_EXTRA_DEPENDECIES luajit) - - set(LOVE_INCLUDE_DIRS - ${LOVE_INCLUDE_DIRS} - ${MEGA_LUAJIT_INCLUDE} - ) - set(LOVE_LINK_LIBRARIES - ${LOVE_LINK_LIBRARIES} - ${LOVE_LUA_LIBRARY} - ) - set(LOVE_MOVE_DLLS - ${LOVE_MOVE_DLLS} - ${MEGA_LUAJIT_DLL} - ) - else() - set(LOVE_LUA_LIBRARY ${MEGA_LUA51}) - - set(LOVE_LINK_LIBRARIES - ${LOVE_LINK_LIBRARIES} - ${LOVE_LUA_LIBRARY} - ) - set(LOVE_MOVE_DLLS - ${LOVE_MOVE_DLLS} - ${LOVE_LUA_LIBRARY} - ) - # MEGA_LUA51 is a CMake target, so includes are handled - # automatically. - endif() -else() - if(MSVC) - message(FATAL_ERROR " -It is currently only possible to build with megasource on Windows. -Please see http://bitbucket.org/rude/megasource -") - endif() - - find_package(Freetype REQUIRED) - find_package(ModPlug REQUIRED) - find_package(OpenAL REQUIRED) - find_package(OpenGL REQUIRED) - find_package(SDL2 REQUIRED) - find_package(Theora REQUIRED) - find_package(Vorbis REQUIRED) - find_package(ZLIB REQUIRED) - find_package(Ogg REQUIRED) - - # required for enet - add_definitions(-D HAS_SOCKLEN_T) - - set(LOVE_INCLUDE_DIRS - ${SDL2_INCLUDE_DIR} - ${FREETYPE_INCLUDE_DIRS} - ${VORBIS_INCLUDE_DIR} - ${OPENAL_INCLUDE_DIR} - ${ZLIB_INCLUDE_DIRS} - ${MODPLUG_INCLUDE_DIR} - ${OGG_INCLUDE_DIR} - ${THEORA_INCLUDE_DIR} - ) - - set(LOVE_LINK_LIBRARIES - ${OPENGL_gl_LIBRARY} - ${SDL2_LIBRARY} - ${FREETYPE_LIBRARY} - ${OPENAL_LIBRARY} - ${MODPLUG_LIBRARY} - ${THEORA_LIBRARY} - ${THEORADEC_LIBRARY} - ${VORBISFILE_LIBRARY} - ${LOVE_LUA_LIBRARY} - ${OGG_LIBRARY} - ${ZLIB_LIBRARY} - ) - - if(LOVE_MPG123) - find_package(MPG123 REQUIRED) - set(LOVE_LINK_LIBRARIES - ${LOVE_LINK_LIBRARIES} - ${MPG123_LIBRARY} - ) - set(LOVE_INCLUDE_DIRS - ${LOVE_INCLUDE_DIRS} - ${MPG123_INCLUDE_DIR} - ) - endif() - - if(LOVE_JIT) - find_package(LuaJIT REQUIRED) - set(LOVE_LUA_LIBRARY ${LUAJIT_LIBRARY}) - set(LOVE_LUA_INCLUDE_DIR ${LUAJIT_INCLUDE_DIR}) - else() - find_package(Lua51 REQUIRED) - set(LOVE_LUA_LIBRARY ${LUA_LIBRARY}) - set(LOVE_LUA_INCLUDE_DIR ${LUA_INCLUDE_DIR}) - endif() - - set(LOVE_INCLUDE_DIRS - ${LOVE_INCLUDE_DIRS} - ${LOVE_LUA_INCLUDE_DIR} - ) - set(LOVE_LINK_LIBRARIES - ${LOVE_LINK_LIBRARIES} - ${LOVE_LUA_LIBRARY} - ) - -endif() - -### -### No Megasource-specific stuff beyond this point! -### - -if(MSVC) - set(DISABLE_WARNING_FLAG -W0) -else() - set(DISABLE_WARNING_FLAG -w) -endif() - -function(love_disable_warnings ARG_TARGET) - get_target_property(OLD_FLAGS ${ARG_TARGET} COMPILE_FLAGS) - set(NEW_FLAGS ${DISABLE_WARNING_FLAG}) - if(OLD_FLAGS) - set(NEW_FLAGS "${OLD_FLAGS} ${NEW_FLAGS}") - endif() - set_target_properties(${ARG_TARGET} PROPERTIES COMPILE_FLAGS ${NEW_FLAGS}) -endfunction() - -# -# common -# - -set(LOVE_SRC_COMMON - src/common/b64.cpp - src/common/b64.h - src/common/Color.h - src/common/config.h - src/common/Data.cpp - src/common/Data.h - src/common/delay.cpp - src/common/delay.h - src/common/deprecation.cpp - src/common/deprecation.h - src/common/EnumMap.h - src/common/Exception.cpp - src/common/Exception.h - src/common/halffloat.cpp - src/common/halffloat.h - src/common/int.h - src/common/math.h - src/common/Matrix.cpp - src/common/Matrix.h - src/common/Memoizer.cpp - src/common/Memoizer.h - src/common/memory.cpp - src/common/memory.h - src/common/Module.cpp - src/common/Module.h - src/common/Object.cpp - src/common/Object.h - src/common/Optional.h - src/common/pixelformat.cpp - src/common/pixelformat.h - src/common/Reference.cpp - src/common/Reference.h - src/common/runtime.cpp - src/common/runtime.h - src/common/Stream.cpp - src/common/Stream.h - src/common/StringMap.cpp - src/common/StringMap.h - src/common/types.cpp - src/common/types.h - src/common/utf8.cpp - src/common/utf8.h - src/common/Variant.cpp - src/common/Variant.h - #src/common/Vector.cpp # Vector.cpp is empty. - src/common/Vector.h - src/common/version.h -) - -if (APPLE) - set(LOVE_SRC_COMMON ${LOVE_SRC_COMMON} - src/common/macosx.mm - ) -endif() - -source_group("common" FILES ${LOVE_SRC_COMMON}) - -# -# love.audio -# - -set(LOVE_SRC_MODULE_AUDIO_ROOT - src/modules/audio/Audio.cpp - src/modules/audio/Audio.h - src/modules/audio/Source.cpp - src/modules/audio/Source.h - src/modules/audio/RecordingDevice.cpp - src/modules/audio/RecordingDevice.h - src/modules/audio/Filter.cpp - src/modules/audio/Filter.h - src/modules/audio/Effect.cpp - src/modules/audio/Effect.h - src/modules/audio/wrap_Audio.cpp - src/modules/audio/wrap_Audio.h - src/modules/audio/wrap_Source.cpp - src/modules/audio/wrap_Source.h - src/modules/audio/wrap_RecordingDevice.cpp - src/modules/audio/wrap_RecordingDevice.h -) - -set(LOVE_SRC_MODULE_AUDIO_NULL - src/modules/audio/null/Audio.cpp - src/modules/audio/null/Audio.h - src/modules/audio/null/Source.cpp - src/modules/audio/null/Source.h - src/modules/audio/null/RecordingDevice.cpp - src/modules/audio/null/RecordingDevice.h -) - -set(LOVE_SRC_MODULE_AUDIO_OPENAL - src/modules/audio/openal/Audio.cpp - src/modules/audio/openal/Audio.h - src/modules/audio/openal/Pool.cpp - src/modules/audio/openal/Pool.h - src/modules/audio/openal/Source.cpp - src/modules/audio/openal/Source.h - src/modules/audio/openal/RecordingDevice.cpp - src/modules/audio/openal/RecordingDevice.h - src/modules/audio/openal/Filter.cpp - src/modules/audio/openal/Filter.h - src/modules/audio/openal/Effect.cpp - src/modules/audio/openal/Effect.h -) - -set(LOVE_SRC_MODULE_AUDIO - ${LOVE_SRC_MODULE_AUDIO_ROOT} - ${LOVE_SRC_MODULE_AUDIO_NULL} - ${LOVE_SRC_MODULE_AUDIO_OPENAL} -) - -source_group("modules\\audio" FILES ${LOVE_SRC_MODULE_AUDIO_ROOT}) -source_group("modules\\audio\\null" FILES ${LOVE_SRC_MODULE_AUDIO_NULL}) -source_group("modules\\audio\\openal" FILES ${LOVE_SRC_MODULE_AUDIO_OPENAL}) - -# -# love.data -# - -set(LOVE_SRC_MODULE_DATA - src/modules/data/ByteData.cpp - src/modules/data/ByteData.h - src/modules/data/CompressedData.cpp - src/modules/data/CompressedData.h - src/modules/data/Compressor.cpp - src/modules/data/Compressor.h - src/modules/data/DataModule.cpp - src/modules/data/DataModule.h - src/modules/data/DataView.cpp - src/modules/data/DataView.h - src/modules/data/HashFunction.cpp - src/modules/data/HashFunction.h - src/modules/data/wrap_ByteData.cpp - src/modules/data/wrap_ByteData.h - src/modules/data/wrap_CompressedData.cpp - src/modules/data/wrap_CompressedData.h - src/modules/data/wrap_Data.cpp - src/modules/data/wrap_Data.h - src/modules/data/wrap_DataModule.cpp - src/modules/data/wrap_DataModule.h - src/modules/data/wrap_DataView.cpp - src/modules/data/wrap_DataView.h -) - -source_group("modules\\data" FILES ${LOVE_SRC_MODULE_DATA}) - -# -# love.event -# - -set(LOVE_SRC_MODULE_EVENT_ROOT - src/modules/event/Event.cpp - src/modules/event/Event.h - src/modules/event/wrap_Event.cpp - src/modules/event/wrap_Event.h -) - -set(LOVE_SRC_MODULE_EVENT_SDL - src/modules/event/sdl/Event.cpp - src/modules/event/sdl/Event.h -) - -set(LOVE_SRC_MODULE_EVENT - ${LOVE_SRC_MODULE_EVENT_ROOT} - ${LOVE_SRC_MODULE_EVENT_SDL} -) - -source_group("modules\\event" FILES ${LOVE_SRC_MODULE_EVENT_ROOT}) -source_group("modules\\event\\sdl" FILES ${LOVE_SRC_MODULE_EVENT_SDL}) - -# -# love.filesystem -# - -set(LOVE_SRC_MODULE_FILESYSTEM_ROOT - src/modules/filesystem/DroppedFile.cpp - src/modules/filesystem/DroppedFile.h - src/modules/filesystem/File.cpp - src/modules/filesystem/File.h - src/modules/filesystem/FileData.cpp - src/modules/filesystem/FileData.h - src/modules/filesystem/Filesystem.cpp - src/modules/filesystem/Filesystem.h - src/modules/filesystem/wrap_DroppedFile.cpp - src/modules/filesystem/wrap_DroppedFile.h - src/modules/filesystem/wrap_File.cpp - src/modules/filesystem/wrap_File.h - src/modules/filesystem/wrap_FileData.cpp - src/modules/filesystem/wrap_FileData.h - src/modules/filesystem/wrap_Filesystem.cpp - src/modules/filesystem/wrap_Filesystem.h -) - -set(LOVE_SRC_MODULE_FILESYSTEM_PHYSFS - src/modules/filesystem/physfs/File.cpp - src/modules/filesystem/physfs/File.h - src/modules/filesystem/physfs/Filesystem.cpp - src/modules/filesystem/physfs/Filesystem.h -) - -set(LOVE_SRC_MODULE_FILESYSTEM - ${LOVE_SRC_MODULE_FILESYSTEM_ROOT} - ${LOVE_SRC_MODULE_FILESYSTEM_PHYSFS} -) - -source_group("modules\\filesystem" FILES ${LOVE_SRC_MODULE_FILESYSTEM_ROOT}) -source_group("modules\\filesystem\\physfs" FILES ${LOVE_SRC_MODULE_FILESYSTEM_PHYSFS}) - -# -# love.font -# - -set(LOVE_SRC_MODULE_FONT_ROOT - src/modules/font/BMFontRasterizer.cpp - src/modules/font/BMFontRasterizer.h - src/modules/font/Font.cpp - src/modules/font/Font.h - src/modules/font/GlyphData.cpp - src/modules/font/GlyphData.h - src/modules/font/ImageRasterizer.cpp - src/modules/font/ImageRasterizer.h - src/modules/font/Rasterizer.cpp - src/modules/font/Rasterizer.h - src/modules/font/TrueTypeRasterizer.cpp - src/modules/font/TrueTypeRasterizer.h - src/modules/font/wrap_Font.cpp - src/modules/font/wrap_Font.h - src/modules/font/wrap_GlyphData.cpp - src/modules/font/wrap_GlyphData.h - src/modules/font/wrap_Rasterizer.cpp - src/modules/font/wrap_Rasterizer.h -) - -set(LOVE_SRC_MODULE_FONT_FREETYPE - src/modules/font/freetype/Font.cpp - src/modules/font/freetype/Font.h - src/modules/font/freetype/TrueTypeRasterizer.cpp - src/modules/font/freetype/TrueTypeRasterizer.h -) - -set(LOVE_SRC_MODULE_FONT - ${LOVE_SRC_MODULE_FONT_ROOT} - ${LOVE_SRC_MODULE_FONT_FREETYPE} -) - -source_group("modules\\font" FILES ${LOVE_SRC_MODULE_FONT_ROOT}) -source_group("modules\\font\\freetype" FILES ${LOVE_SRC_MODULE_FONT_FREETYPE}) - -# -# love.graphics -# - -set(LOVE_SRC_MODULE_GRAPHICS_ROOT - src/modules/graphics/Buffer.cpp - src/modules/graphics/Buffer.h - src/modules/graphics/Canvas.cpp - src/modules/graphics/Canvas.h - src/modules/graphics/depthstencil.cpp - src/modules/graphics/depthstencil.h - src/modules/graphics/Deprecations.cpp - src/modules/graphics/Deprecations.h - src/modules/graphics/Drawable.cpp - src/modules/graphics/Drawable.h - src/modules/graphics/Font.cpp - src/modules/graphics/Font.h - src/modules/graphics/Graphics.cpp - src/modules/graphics/Graphics.h - src/modules/graphics/Image.cpp - src/modules/graphics/Image.h - src/modules/graphics/Mesh.cpp - src/modules/graphics/Mesh.h - src/modules/graphics/ParticleSystem.cpp - src/modules/graphics/ParticleSystem.h - src/modules/graphics/Polyline.cpp - src/modules/graphics/Polyline.h - src/modules/graphics/Quad.cpp - src/modules/graphics/Quad.h - src/modules/graphics/Resource.h - src/modules/graphics/Shader.cpp - src/modules/graphics/Shader.h - src/modules/graphics/ShaderStage.cpp - src/modules/graphics/ShaderStage.h - src/modules/graphics/SpriteBatch.cpp - src/modules/graphics/SpriteBatch.h - src/modules/graphics/StreamBuffer.cpp - src/modules/graphics/StreamBuffer.h - src/modules/graphics/Text.cpp - src/modules/graphics/Text.h - src/modules/graphics/Texture.cpp - src/modules/graphics/Texture.h - src/modules/graphics/vertex.cpp - src/modules/graphics/vertex.h - src/modules/graphics/Video.cpp - src/modules/graphics/Video.h - src/modules/graphics/Volatile.cpp - src/modules/graphics/Volatile.h - src/modules/graphics/wrap_Canvas.cpp - src/modules/graphics/wrap_Canvas.h - src/modules/graphics/wrap_Font.cpp - src/modules/graphics/wrap_Font.h - src/modules/graphics/wrap_Graphics.cpp - src/modules/graphics/wrap_Graphics.h - src/modules/graphics/wrap_Image.cpp - src/modules/graphics/wrap_Image.h - src/modules/graphics/wrap_Mesh.cpp - src/modules/graphics/wrap_Mesh.h - src/modules/graphics/wrap_ParticleSystem.cpp - src/modules/graphics/wrap_ParticleSystem.h - src/modules/graphics/wrap_Quad.cpp - src/modules/graphics/wrap_Quad.h - src/modules/graphics/wrap_Shader.cpp - src/modules/graphics/wrap_Shader.h - src/modules/graphics/wrap_SpriteBatch.cpp - src/modules/graphics/wrap_SpriteBatch.h - src/modules/graphics/wrap_Texture.cpp - src/modules/graphics/wrap_Texture.h - src/modules/graphics/wrap_Text.cpp - src/modules/graphics/wrap_Text.h - src/modules/graphics/wrap_Video.cpp - src/modules/graphics/wrap_Video.h -) - -set(LOVE_SRC_MODULE_GRAPHICS_OPENGL - src/modules/graphics/opengl/Buffer.cpp - src/modules/graphics/opengl/Buffer.h - src/modules/graphics/opengl/Canvas.cpp - src/modules/graphics/opengl/Canvas.h - src/modules/graphics/opengl/FenceSync.cpp - src/modules/graphics/opengl/FenceSync.h - src/modules/graphics/opengl/Graphics.cpp - src/modules/graphics/opengl/Graphics.h - src/modules/graphics/opengl/Image.cpp - src/modules/graphics/opengl/Image.h - src/modules/graphics/opengl/OpenGL.cpp - src/modules/graphics/opengl/OpenGL.h - src/modules/graphics/opengl/Shader.cpp - src/modules/graphics/opengl/Shader.h - src/modules/graphics/opengl/ShaderStage.cpp - src/modules/graphics/opengl/ShaderStage.h - src/modules/graphics/opengl/StreamBuffer.cpp - src/modules/graphics/opengl/StreamBuffer.h -) - -set(LOVE_SRC_MODULE_GRAPHICS - ${LOVE_SRC_MODULE_GRAPHICS_ROOT} - ${LOVE_SRC_MODULE_GRAPHICS_OPENGL} -) - -source_group("modules\\graphics" FILES ${LOVE_SRC_MODULE_GRAPHICS_ROOT}) -source_group("modules\\graphics\\opengl" FILES ${LOVE_SRC_MODULE_GRAPHICS_OPENGL}) - -# -# love.image -# - -set(LOVE_SRC_MODULE_IMAGE_ROOT - src/modules/image/CompressedImageData.cpp - src/modules/image/CompressedImageData.h - src/modules/image/CompressedSlice.cpp - src/modules/image/CompressedSlice.h - src/modules/image/FormatHandler.cpp - src/modules/image/FormatHandler.h - src/modules/image/Image.cpp - src/modules/image/Image.h - src/modules/image/ImageData.cpp - src/modules/image/ImageData.h - src/modules/image/ImageDataBase.cpp - src/modules/image/ImageDataBase.h - src/modules/image/wrap_CompressedImageData.cpp - src/modules/image/wrap_CompressedImageData.h - src/modules/image/wrap_Image.cpp - src/modules/image/wrap_Image.h - src/modules/image/wrap_ImageData.cpp - src/modules/image/wrap_ImageData.h -) - -set(LOVE_SRC_MODULE_IMAGE_MAGPIE - src/modules/image/magpie/ASTCHandler.cpp - src/modules/image/magpie/ASTCHandler.h - src/modules/image/magpie/ddsHandler.cpp - src/modules/image/magpie/ddsHandler.h - src/modules/image/magpie/EXRHandler.cpp - src/modules/image/magpie/EXRHandler.h - src/modules/image/magpie/KTXHandler.cpp - src/modules/image/magpie/KTXHandler.h - src/modules/image/magpie/PKMHandler.cpp - src/modules/image/magpie/PKMHandler.h - src/modules/image/magpie/PNGHandler.cpp - src/modules/image/magpie/PNGHandler.h - src/modules/image/magpie/PVRHandler.cpp - src/modules/image/magpie/PVRHandler.h - src/modules/image/magpie/STBHandler.cpp - src/modules/image/magpie/STBHandler.h -) - -set(LOVE_SRC_MODULE_IMAGE - ${LOVE_SRC_MODULE_IMAGE_ROOT} - ${LOVE_SRC_MODULE_IMAGE_MAGPIE} -) - -source_group("modules\\image" FILES ${LOVE_SRC_MODULE_IMAGE_ROOT}) -source_group("modules\\image\\magpie" FILES ${LOVE_SRC_MODULE_IMAGE_MAGPIE}) - -# -# love.joystick -# - -set(LOVE_SRC_MODULE_JOYSTICK_ROOT - src/modules/joystick/Joystick.cpp - src/modules/joystick/Joystick.h - src/modules/joystick/JoystickModule.h - src/modules/joystick/wrap_Joystick.cpp - src/modules/joystick/wrap_Joystick.h - src/modules/joystick/wrap_JoystickModule.cpp - src/modules/joystick/wrap_JoystickModule.h -) - -set(LOVE_SRC_MODULE_JOYSTICK_SDL - src/modules/joystick/sdl/Joystick.cpp - src/modules/joystick/sdl/Joystick.h - src/modules/joystick/sdl/JoystickModule.cpp - src/modules/joystick/sdl/JoystickModule.h -) - -set(LOVE_SRC_MODULE_JOYSTICK - ${LOVE_SRC_MODULE_JOYSTICK_ROOT} - ${LOVE_SRC_MODULE_JOYSTICK_SDL} -) - -source_group("modules\\joystick" FILES ${LOVE_SRC_MODULE_JOYSTICK_ROOT}) -source_group("modules\\joystick\\sdl" FILES ${LOVE_SRC_MODULE_JOYSTICK_SDL}) - -# -# love.keyboard -# - -set(LOVE_SRC_MODULE_KEYBOARD_ROOT - src/modules/keyboard/Keyboard.cpp - src/modules/keyboard/Keyboard.h - src/modules/keyboard/wrap_Keyboard.cpp - src/modules/keyboard/wrap_Keyboard.h -) - -set(LOVE_SRC_MODULE_KEYBOARD_SDL - src/modules/keyboard/sdl/Keyboard.cpp - src/modules/keyboard/sdl/Keyboard.h -) - -set(LOVE_SRC_MODULE_KEYBOARD - ${LOVE_SRC_MODULE_KEYBOARD_ROOT} - ${LOVE_SRC_MODULE_KEYBOARD_SDL} -) - -source_group("modules\\keyboard" FILES ${LOVE_SRC_MODULE_KEYBOARD_ROOT}) -source_group("modules\\keyboard\\sdl" FILES ${LOVE_SRC_MODULE_KEYBOARD_SDL}) - -# -# love.math -# - -set(LOVE_SRC_MODULE_MATH - src/modules/math/BezierCurve.cpp - src/modules/math/BezierCurve.h - src/modules/math/MathModule.cpp - src/modules/math/MathModule.h - src/modules/math/RandomGenerator.cpp - src/modules/math/RandomGenerator.h - src/modules/math/Transform.cpp - src/modules/math/Transform.h - src/modules/math/wrap_BezierCurve.cpp - src/modules/math/wrap_BezierCurve.h - src/modules/math/wrap_Math.cpp - src/modules/math/wrap_Math.h - src/modules/math/wrap_RandomGenerator.cpp - src/modules/math/wrap_RandomGenerator.h - src/modules/math/wrap_Transform.cpp - src/modules/math/wrap_Transform.h -) - -source_group("modules\\math" FILES ${LOVE_SRC_MODULE_MATH}) - -# -# love (module) -# -set(LOVE_SRC_MODULE_LOVE - src/modules/love/love.cpp - src/modules/love/love.h -) - -source_group("modules\\love" FILES ${LOVE_SRC_MODULE_LOVE}) - -# -# love.mouse -# - -set(LOVE_SRC_MODULE_MOUSE_ROOT - src/modules/mouse/Cursor.cpp - src/modules/mouse/Cursor.h - src/modules/mouse/Mouse.h - src/modules/mouse/wrap_Cursor.cpp - src/modules/mouse/wrap_Cursor.h - src/modules/mouse/wrap_Mouse.cpp - src/modules/mouse/wrap_Mouse.h -) - -set(LOVE_SRC_MODULE_MOUSE_SDL - src/modules/mouse/sdl/Cursor.cpp - src/modules/mouse/sdl/Cursor.h - src/modules/mouse/sdl/Mouse.cpp - src/modules/mouse/sdl/Mouse.h -) - -set(LOVE_SRC_MODULE_MOUSE - ${LOVE_SRC_MODULE_MOUSE_ROOT} - ${LOVE_SRC_MODULE_MOUSE_SDL} -) - -source_group("modules\\mouse" FILES ${LOVE_SRC_MODULE_MOUSE_ROOT}) -source_group("modules\\mouse\\sdl" FILES ${LOVE_SRC_MODULE_MOUSE_SDL}) - -# -# love.physics -# - -set(LOVE_SRC_MODULE_PHYSICS_ROOT - src/modules/physics/Body.cpp - src/modules/physics/Body.h - src/modules/physics/Joint.cpp - src/modules/physics/Joint.h - src/modules/physics/Shape.cpp - src/modules/physics/Shape.h -) - -set(LOVE_SRC_MODULE_PHYSICS_BOX2D - src/modules/physics/box2d/Body.cpp - src/modules/physics/box2d/Body.h - src/modules/physics/box2d/ChainShape.cpp - src/modules/physics/box2d/ChainShape.h - src/modules/physics/box2d/CircleShape.cpp - src/modules/physics/box2d/CircleShape.h - src/modules/physics/box2d/Contact.cpp - src/modules/physics/box2d/Contact.h - src/modules/physics/box2d/DistanceJoint.cpp - src/modules/physics/box2d/DistanceJoint.h - src/modules/physics/box2d/EdgeShape.cpp - src/modules/physics/box2d/EdgeShape.h - src/modules/physics/box2d/Fixture.cpp - src/modules/physics/box2d/Fixture.h - src/modules/physics/box2d/FrictionJoint.cpp - src/modules/physics/box2d/FrictionJoint.h - src/modules/physics/box2d/GearJoint.cpp - src/modules/physics/box2d/GearJoint.h - src/modules/physics/box2d/Joint.cpp - src/modules/physics/box2d/Joint.h - src/modules/physics/box2d/MotorJoint.cpp - src/modules/physics/box2d/MotorJoint.h - src/modules/physics/box2d/MouseJoint.cpp - src/modules/physics/box2d/MouseJoint.h - src/modules/physics/box2d/Physics.cpp - src/modules/physics/box2d/Physics.h - src/modules/physics/box2d/PolygonShape.cpp - src/modules/physics/box2d/PolygonShape.h - src/modules/physics/box2d/PrismaticJoint.cpp - src/modules/physics/box2d/PrismaticJoint.h - src/modules/physics/box2d/PulleyJoint.cpp - src/modules/physics/box2d/PulleyJoint.h - src/modules/physics/box2d/RevoluteJoint.cpp - src/modules/physics/box2d/RevoluteJoint.h - src/modules/physics/box2d/RopeJoint.cpp - src/modules/physics/box2d/RopeJoint.h - src/modules/physics/box2d/Shape.cpp - src/modules/physics/box2d/Shape.h - src/modules/physics/box2d/WeldJoint.cpp - src/modules/physics/box2d/WeldJoint.h - src/modules/physics/box2d/WheelJoint.cpp - src/modules/physics/box2d/WheelJoint.h - src/modules/physics/box2d/World.cpp - src/modules/physics/box2d/World.h - src/modules/physics/box2d/wrap_Body.cpp - src/modules/physics/box2d/wrap_Body.h - src/modules/physics/box2d/wrap_ChainShape.cpp - src/modules/physics/box2d/wrap_ChainShape.h - src/modules/physics/box2d/wrap_CircleShape.cpp - src/modules/physics/box2d/wrap_CircleShape.h - src/modules/physics/box2d/wrap_Contact.cpp - src/modules/physics/box2d/wrap_Contact.h - src/modules/physics/box2d/wrap_DistanceJoint.cpp - src/modules/physics/box2d/wrap_DistanceJoint.h - src/modules/physics/box2d/wrap_EdgeShape.cpp - src/modules/physics/box2d/wrap_EdgeShape.h - src/modules/physics/box2d/wrap_Fixture.cpp - src/modules/physics/box2d/wrap_Fixture.h - src/modules/physics/box2d/wrap_FrictionJoint.cpp - src/modules/physics/box2d/wrap_FrictionJoint.h - src/modules/physics/box2d/wrap_GearJoint.cpp - src/modules/physics/box2d/wrap_GearJoint.h - src/modules/physics/box2d/wrap_Joint.cpp - src/modules/physics/box2d/wrap_Joint.h - src/modules/physics/box2d/wrap_MotorJoint.cpp - src/modules/physics/box2d/wrap_MotorJoint.h - src/modules/physics/box2d/wrap_MouseJoint.cpp - src/modules/physics/box2d/wrap_MouseJoint.h - src/modules/physics/box2d/wrap_Physics.cpp - src/modules/physics/box2d/wrap_Physics.h - src/modules/physics/box2d/wrap_PolygonShape.cpp - src/modules/physics/box2d/wrap_PolygonShape.h - src/modules/physics/box2d/wrap_PrismaticJoint.cpp - src/modules/physics/box2d/wrap_PrismaticJoint.h - src/modules/physics/box2d/wrap_PulleyJoint.cpp - src/modules/physics/box2d/wrap_PulleyJoint.h - src/modules/physics/box2d/wrap_RevoluteJoint.cpp - src/modules/physics/box2d/wrap_RevoluteJoint.h - src/modules/physics/box2d/wrap_RopeJoint.cpp - src/modules/physics/box2d/wrap_RopeJoint.h - src/modules/physics/box2d/wrap_Shape.cpp - src/modules/physics/box2d/wrap_Shape.h - src/modules/physics/box2d/wrap_WeldJoint.cpp - src/modules/physics/box2d/wrap_WeldJoint.h - src/modules/physics/box2d/wrap_WheelJoint.cpp - src/modules/physics/box2d/wrap_WheelJoint.h - src/modules/physics/box2d/wrap_World.cpp - src/modules/physics/box2d/wrap_World.h -) - -set(LOVE_SRC_MODULE_PHYSICS - ${LOVE_SRC_MODULE_PHYSICS_ROOT} - ${LOVE_SRC_MODULE_PHYSICS_BOX2D} -) - -source_group("modules\\physics" FILES ${LOVE_SRC_MODULE_PHYSICS_ROOT}) -source_group("modules\\physics\\box2d" FILES ${LOVE_SRC_MODULE_PHYSICS_BOX2D}) - -# -# love.sound -# - -set(LOVE_SRC_MODULE_SOUND_ROOT - src/modules/sound/Decoder.cpp - src/modules/sound/Decoder.h - src/modules/sound/Sound.cpp - src/modules/sound/Sound.h - src/modules/sound/SoundData.cpp - src/modules/sound/SoundData.h - src/modules/sound/wrap_Decoder.cpp - src/modules/sound/wrap_Decoder.h - src/modules/sound/wrap_Sound.cpp - src/modules/sound/wrap_Sound.h - src/modules/sound/wrap_SoundData.cpp - src/modules/sound/wrap_SoundData.h -) - -set(LOVE_SRC_MODULE_SOUND_LULLABY - src/modules/sound/lullaby/FLACDecoder.cpp - src/modules/sound/lullaby/FLACDecoder.h - src/modules/sound/lullaby/GmeDecoder.cpp - src/modules/sound/lullaby/GmeDecoder.h - src/modules/sound/lullaby/ModPlugDecoder.cpp - src/modules/sound/lullaby/ModPlugDecoder.h - src/modules/sound/lullaby/Sound.cpp - src/modules/sound/lullaby/Sound.h - src/modules/sound/lullaby/VorbisDecoder.cpp - src/modules/sound/lullaby/VorbisDecoder.h - src/modules/sound/lullaby/WaveDecoder.cpp - src/modules/sound/lullaby/WaveDecoder.h -) - -if(LOVE_MPG123) - set(LOVE_SRC_MODULE_SOUND_LULLABY - ${LOVE_SRC_MODULE_SOUND_LULLABY} - src/modules/sound/lullaby/Mpg123Decoder.cpp - src/modules/sound/lullaby/Mpg123Decoder.h - ) -endif() - -set(LOVE_SRC_MODULE_SOUND - ${LOVE_SRC_MODULE_SOUND_ROOT} - ${LOVE_SRC_MODULE_SOUND_LULLABY} -) - -source_group("modules\\sound" FILES ${LOVE_SRC_MODULE_SOUND_ROOT}) -source_group("modules\\sound\\lullaby" FILES ${LOVE_SRC_MODULE_SOUND_LULLABY}) - -# -# love.system -# - -set(LOVE_SRC_MODULE_SYSTEM_ROOT - src/modules/system/System.cpp - src/modules/system/System.h - src/modules/system/wrap_System.cpp - src/modules/system/wrap_System.h -) - -set(LOVE_SRC_MODULE_SYSTEM_SDL - src/modules/system/sdl/System.cpp - src/modules/system/sdl/System.h -) - -set(LOVE_SRC_MODULE_SYSTEM - ${LOVE_SRC_MODULE_SYSTEM_ROOT} - ${LOVE_SRC_MODULE_SYSTEM_SDL} -) - -source_group("modules\\system" FILES ${LOVE_SRC_MODULE_SYSTEM_ROOT}) -source_group("modules\\system\\sdl" FILES ${LOVE_SRC_MODULE_SYSTEM_SDL}) - -# -# love.thread -# - -set(LOVE_SRC_MODULE_THREAD_ROOT - src/modules/thread/Channel.cpp - src/modules/thread/Channel.h - src/modules/thread/LuaThread.cpp - src/modules/thread/LuaThread.h - src/modules/thread/Thread.h - src/modules/thread/ThreadModule.cpp - src/modules/thread/ThreadModule.h - src/modules/thread/threads.cpp - src/modules/thread/threads.h - src/modules/thread/wrap_Channel.cpp - src/modules/thread/wrap_Channel.h - src/modules/thread/wrap_LuaThread.cpp - src/modules/thread/wrap_LuaThread.h - src/modules/thread/wrap_ThreadModule.cpp - src/modules/thread/wrap_ThreadModule.h -) - -set(LOVE_SRC_MODULE_THREAD_SDL - src/modules/thread/sdl/Thread.cpp - src/modules/thread/sdl/Thread.h - src/modules/thread/sdl/threads.cpp - src/modules/thread/sdl/threads.h -) - -set(LOVE_SRC_MODULE_THREAD - ${LOVE_SRC_MODULE_THREAD_ROOT} - ${LOVE_SRC_MODULE_THREAD_SDL} -) - -source_group("modules\\thread" FILES ${LOVE_SRC_MODULE_THREAD_ROOT}) -source_group("modules\\thread\\sdl" FILES ${LOVE_SRC_MODULE_THREAD_SDL}) - -# -# love.timer -# - -set(LOVE_SRC_MODULE_TIMER - src/modules/timer/Timer.cpp - src/modules/timer/Timer.h - src/modules/timer/wrap_Timer.cpp - src/modules/timer/wrap_Timer.h -) - -source_group("modules\\timer" FILES ${LOVE_SRC_MODULE_TIMER}) - -# -# love.touch -# - -set(LOVE_SRC_MODULE_TOUCH_ROOT - src/modules/touch/Touch.h - src/modules/touch/wrap_Touch.cpp - src/modules/touch/wrap_Touch.h -) - -set(LOVE_SRC_MODULE_TOUCH_SDL - src/modules/touch/sdl/Touch.cpp - src/modules/touch/sdl/Touch.h -) - -set(LOVE_SRC_MODULE_TOUCH - ${LOVE_SRC_MODULE_TOUCH_ROOT} - ${LOVE_SRC_MODULE_TOUCH_SDL} -) - -source_group("modules\\touch" FILES ${LOVE_SRC_MODULE_TOUCH_ROOT}) -source_group("modules\\touch\\sdl" FILES ${LOVE_SRC_MODULE_TOUCH_SDL}) - -# -# love.video -# - -set(LOVE_SRC_MODULE_VIDEO_ROOT - src/modules/video/Video.h - src/modules/video/VideoStream.cpp - src/modules/video/VideoStream.h - src/modules/video/wrap_Video.cpp - src/modules/video/wrap_Video.h - src/modules/video/wrap_VideoStream.cpp - src/modules/video/wrap_VideoStream.h -) - -set(LOVE_SRC_MODULE_VIDEO_THEORA - src/modules/video/theora/Video.cpp - src/modules/video/theora/Video.h - src/modules/video/theora/OggDemuxer.cpp - src/modules/video/theora/OggDemuxer.h - src/modules/video/theora/TheoraVideoStream.cpp - src/modules/video/theora/TheoraVideoStream.h -) - -set(LOVE_SRC_MODULE_VIDEO - ${LOVE_SRC_MODULE_VIDEO_ROOT} - ${LOVE_SRC_MODULE_VIDEO_THEORA} -) - -source_group("modules\\video" FILES ${LOVE_SRC_MODULE_VIDEO_ROOT}) -source_group("modules\\video\\theora" FILES ${LOVE_SRC_MODULE_VIDEO_THEORA}) - -# -# love.window -# - -set(LOVE_SRC_MODULE_WINDOW_ROOT - src/modules/window/Window.cpp - src/modules/window/Window.h - src/modules/window/wrap_Window.cpp - src/modules/window/wrap_Window.h -) - -set(LOVE_SRC_MODULE_WINDOW_SDL - src/modules/window/sdl/Window.cpp - src/modules/window/sdl/Window.h -) - -set(LOVE_SRC_MODULE_WINDOW - ${LOVE_SRC_MODULE_WINDOW_ROOT} - ${LOVE_SRC_MODULE_WINDOW_SDL} -) - -source_group("modules\\window" FILES ${LOVE_SRC_MODULE_WINDOW_ROOT}) -source_group("modules\\window\\sdl" FILES ${LOVE_SRC_MODULE_WINDOW_SDL}) - -################################### -# Third-party libraries -################################### - -# -# Box2D -# - -set(LOVE_SRC_3P_BOX2D_ROOT - src/libraries/Box2D/Box2D.h -) - -set(LOVE_SRC_3P_BOX2D_COLLISION - src/libraries/Box2D/Collision/b2BroadPhase.cpp - src/libraries/Box2D/Collision/b2BroadPhase.h - src/libraries/Box2D/Collision/b2CollideCircle.cpp - src/libraries/Box2D/Collision/b2CollideEdge.cpp - src/libraries/Box2D/Collision/b2CollidePolygon.cpp - src/libraries/Box2D/Collision/b2Collision.cpp - src/libraries/Box2D/Collision/b2Collision.h - src/libraries/Box2D/Collision/b2Distance.cpp - src/libraries/Box2D/Collision/b2Distance.h - src/libraries/Box2D/Collision/b2DynamicTree.cpp - src/libraries/Box2D/Collision/b2DynamicTree.h - src/libraries/Box2D/Collision/b2TimeOfImpact.cpp - src/libraries/Box2D/Collision/b2TimeOfImpact.h -) - -set(LOVE_SRC_3P_BOX2D_COLLISION_SHAPES - src/libraries/Box2D/Collision/Shapes/b2ChainShape.cpp - src/libraries/Box2D/Collision/Shapes/b2ChainShape.h - src/libraries/Box2D/Collision/Shapes/b2CircleShape.cpp - src/libraries/Box2D/Collision/Shapes/b2CircleShape.h - src/libraries/Box2D/Collision/Shapes/b2EdgeShape.cpp - src/libraries/Box2D/Collision/Shapes/b2EdgeShape.h - src/libraries/Box2D/Collision/Shapes/b2PolygonShape.cpp - src/libraries/Box2D/Collision/Shapes/b2PolygonShape.h - src/libraries/Box2D/Collision/Shapes/b2Shape.h -) - -set(LOVE_SRC_3P_BOX2D_COMMON - src/libraries/Box2D/Common/b2BlockAllocator.cpp - src/libraries/Box2D/Common/b2BlockAllocator.h - src/libraries/Box2D/Common/b2Draw.cpp - src/libraries/Box2D/Common/b2Draw.h - src/libraries/Box2D/Common/b2GrowableStack.h - src/libraries/Box2D/Common/b2Math.cpp - src/libraries/Box2D/Common/b2Math.h - src/libraries/Box2D/Common/b2Settings.cpp - src/libraries/Box2D/Common/b2Settings.h - src/libraries/Box2D/Common/b2StackAllocator.cpp - src/libraries/Box2D/Common/b2StackAllocator.h - src/libraries/Box2D/Common/b2Timer.cpp - src/libraries/Box2D/Common/b2Timer.h -) - -set(LOVE_SRC_3P_BOX2D_DYNAMICS - src/libraries/Box2D/Dynamics/b2Body.cpp - src/libraries/Box2D/Dynamics/b2Body.h - src/libraries/Box2D/Dynamics/b2ContactManager.cpp - src/libraries/Box2D/Dynamics/b2ContactManager.h - src/libraries/Box2D/Dynamics/b2Fixture.cpp - src/libraries/Box2D/Dynamics/b2Fixture.h - src/libraries/Box2D/Dynamics/b2Island.cpp - src/libraries/Box2D/Dynamics/b2Island.h - src/libraries/Box2D/Dynamics/b2TimeStep.h - src/libraries/Box2D/Dynamics/b2World.cpp - src/libraries/Box2D/Dynamics/b2World.h - src/libraries/Box2D/Dynamics/b2WorldCallbacks.cpp - src/libraries/Box2D/Dynamics/b2WorldCallbacks.h -) - -set(LOVE_SRC_3P_BOX2D_DYNAMICS_CONTACTS - src/libraries/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.cpp - src/libraries/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.h - src/libraries/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.cpp - src/libraries/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.h - src/libraries/Box2D/Dynamics/Contacts/b2CircleContact.cpp - src/libraries/Box2D/Dynamics/Contacts/b2CircleContact.h - src/libraries/Box2D/Dynamics/Contacts/b2Contact.cpp - src/libraries/Box2D/Dynamics/Contacts/b2Contact.h - src/libraries/Box2D/Dynamics/Contacts/b2ContactSolver.cpp - src/libraries/Box2D/Dynamics/Contacts/b2ContactSolver.h - src/libraries/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.cpp - src/libraries/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.h - src/libraries/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.cpp - src/libraries/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.h - src/libraries/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.cpp - src/libraries/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.h - src/libraries/Box2D/Dynamics/Contacts/b2PolygonContact.cpp - src/libraries/Box2D/Dynamics/Contacts/b2PolygonContact.h -) - -set(LOVE_SRC_3P_BOX2D_DYNAMICS_JOINTS - src/libraries/Box2D/Dynamics/Joints/b2DistanceJoint.cpp - src/libraries/Box2D/Dynamics/Joints/b2DistanceJoint.h - src/libraries/Box2D/Dynamics/Joints/b2FrictionJoint.cpp - src/libraries/Box2D/Dynamics/Joints/b2FrictionJoint.h - src/libraries/Box2D/Dynamics/Joints/b2GearJoint.cpp - src/libraries/Box2D/Dynamics/Joints/b2GearJoint.h - src/libraries/Box2D/Dynamics/Joints/b2Joint.cpp - src/libraries/Box2D/Dynamics/Joints/b2Joint.h - src/libraries/Box2D/Dynamics/Joints/b2MotorJoint.cpp - src/libraries/Box2D/Dynamics/Joints/b2MotorJoint.h - src/libraries/Box2D/Dynamics/Joints/b2MouseJoint.cpp - src/libraries/Box2D/Dynamics/Joints/b2MouseJoint.h - src/libraries/Box2D/Dynamics/Joints/b2PrismaticJoint.cpp - src/libraries/Box2D/Dynamics/Joints/b2PrismaticJoint.h - src/libraries/Box2D/Dynamics/Joints/b2PulleyJoint.cpp - src/libraries/Box2D/Dynamics/Joints/b2PulleyJoint.h - src/libraries/Box2D/Dynamics/Joints/b2RevoluteJoint.cpp - src/libraries/Box2D/Dynamics/Joints/b2RevoluteJoint.h - src/libraries/Box2D/Dynamics/Joints/b2RopeJoint.cpp - src/libraries/Box2D/Dynamics/Joints/b2RopeJoint.h - src/libraries/Box2D/Dynamics/Joints/b2WeldJoint.cpp - src/libraries/Box2D/Dynamics/Joints/b2WeldJoint.h - src/libraries/Box2D/Dynamics/Joints/b2WheelJoint.cpp - src/libraries/Box2D/Dynamics/Joints/b2WheelJoint.h -) - -set(LOVE_SRC_3P_BOX2D_ROPE - src/libraries/Box2D/Rope/b2Rope.cpp - src/libraries/Box2D/Rope/b2Rope.h -) - -set(LOVE_SRC_3P_BOX2D - ${LOVE_SRC_3P_BOX2D_ROOT} - ${LOVE_SRC_3P_BOX2D_COLLISION} - ${LOVE_SRC_3P_BOX2D_COLLISION_SHAPES} - ${LOVE_SRC_3P_BOX2D_COMMON} - ${LOVE_SRC_3P_BOX2D_DYNAMICS} - ${LOVE_SRC_3P_BOX2D_DYNAMICS_CONTACTS} - ${LOVE_SRC_3P_BOX2D_DYNAMICS_JOINTS} - ${LOVE_SRC_3P_BOX2D_ROPE} -) - -add_library(love_3p_box2d ${LOVE_SRC_3P_BOX2D}) - -# -# ddsparse -# - -set(LOVE_SRC_3P_DDSPARSE - src/libraries/ddsparse/ddsinfo.h - src/libraries/ddsparse/ddsparse.cpp - src/libraries/ddsparse/ddsparse.h -) - -add_library(love_3p_ddsparse ${LOVE_SRC_3P_DDSPARSE}) - -# -# enet -# - -set(LOVE_SRC_3P_ENET_ROOT - src/libraries/enet/enet.cpp - src/libraries/enet/lua-enet.h -) - -set(LOVE_SRC_3P_ENET_LIBENET - src/libraries/enet/libenet/callbacks.c - src/libraries/enet/libenet/compress.c - src/libraries/enet/libenet/host.c - src/libraries/enet/libenet/list.c - src/libraries/enet/libenet/packet.c - src/libraries/enet/libenet/peer.c - src/libraries/enet/libenet/protocol.c - src/libraries/enet/libenet/unix.c - src/libraries/enet/libenet/win32.c -) - -set(LOVE_SRC_3P_ENET_LIBENET_INCLUDE_ENET - src/libraries/enet/libenet/include/enet/enet.h - src/libraries/enet/libenet/include/enet/list.h - src/libraries/enet/libenet/include/enet/protocol.h - src/libraries/enet/libenet/include/enet/time.h - src/libraries/enet/libenet/include/enet/types.h - src/libraries/enet/libenet/include/enet/unix.h - src/libraries/enet/libenet/include/enet/utility.h - src/libraries/enet/libenet/include/enet/win32.h -) - -set(LOVE_SRC_3P_ENET - ${LOVE_SRC_3P_ENET_ROOT} - ${LOVE_SRC_3P_ENET_LIBENET} - ${LOVE_SRC_3P_ENET_LIBENET_INCLUDE_ENET} -) - -add_library(love_3p_enet ${LOVE_SRC_3P_ENET}) -target_link_libraries(love_3p_enet ${LOVE_LUA_LIBRARY}) -target_include_directories(love_3p_enet PUBLIC src/libraries/enet/libenet/include) - -# -# GLAD -# - -set(LOVE_SRC_3P_GLAD - src/libraries/glad/glad.cpp - src/libraries/glad/glad.hpp - src/libraries/glad/gladfuncs.hpp -) - -add_library(love_3p_glad ${LOVE_SRC_3P_GLAD}) - -# -# glslang -# - -set(LOVE_SRC_3P_GLSLANG_GLSLANG_GENERICCODEGEN - src/libraries/glslang/glslang/GenericCodeGen/CodeGen.cpp - src/libraries/glslang/glslang/GenericCodeGen/Link.cpp -) - -set(LOVE_SRC_3P_GLSLANG_GLSLANG_INCLUDE - src/libraries/glslang/glslang/Include/arrays.h - src/libraries/glslang/glslang/Include/BaseTypes.h - src/libraries/glslang/glslang/Include/Common.h - src/libraries/glslang/glslang/Include/ConstantUnion.h - src/libraries/glslang/glslang/Include/InfoSink.h - src/libraries/glslang/glslang/Include/InitializeGlobals.h - src/libraries/glslang/glslang/Include/intermediate.h - src/libraries/glslang/glslang/Include/PoolAlloc.h - src/libraries/glslang/glslang/Include/ResourceLimits.h - src/libraries/glslang/glslang/Include/revision.h - src/libraries/glslang/glslang/Include/ShHandle.h - src/libraries/glslang/glslang/Include/Types.h -) - -set(LOVE_SRC_3P_GLSLANG_GLSLANG_MACHINEINDEPENDENT_PREPROCESSOR - src/libraries/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp - src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpAtom.cpp - src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp - src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpContext.h - src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp - src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp - src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpTokens.h -) - -set(LOVE_SRC_3P_GLSLANG_GLSLANG_MACHINEINDEPENDENT - ${LOVE_SRC_3P_GLSLANG_GLSLANG_MACHINEINDEPENDENT_PREPROCESSOR} - src/libraries/glslang/glslang/MachineIndependent/Constant.cpp - src/libraries/glslang/glslang/MachineIndependent/gl_types.h - src/libraries/glslang/glslang/MachineIndependent/glslang_tab.cpp - src/libraries/glslang/glslang/MachineIndependent/glslang_tab.cpp.h - src/libraries/glslang/glslang/MachineIndependent/InfoSink.cpp - src/libraries/glslang/glslang/MachineIndependent/Initialize.cpp - src/libraries/glslang/glslang/MachineIndependent/Initialize.h - src/libraries/glslang/glslang/MachineIndependent/Intermediate.cpp - src/libraries/glslang/glslang/MachineIndependent/intermOut.cpp - src/libraries/glslang/glslang/MachineIndependent/IntermTraverse.cpp - src/libraries/glslang/glslang/MachineIndependent/iomapper.cpp - src/libraries/glslang/glslang/MachineIndependent/iomapper.h - src/libraries/glslang/glslang/MachineIndependent/limits.cpp - src/libraries/glslang/glslang/MachineIndependent/linkValidate.cpp - src/libraries/glslang/glslang/MachineIndependent/LiveTraverser.h - src/libraries/glslang/glslang/MachineIndependent/localintermediate.h - src/libraries/glslang/glslang/MachineIndependent/parseConst.cpp - src/libraries/glslang/glslang/MachineIndependent/ParseContextBase.cpp - src/libraries/glslang/glslang/MachineIndependent/ParseHelper.cpp - src/libraries/glslang/glslang/MachineIndependent/ParseHelper.h - src/libraries/glslang/glslang/MachineIndependent/parseVersions.h - src/libraries/glslang/glslang/MachineIndependent/PoolAlloc.cpp - src/libraries/glslang/glslang/MachineIndependent/propagateNoContraction.cpp - src/libraries/glslang/glslang/MachineIndependent/propagateNoContraction.h - src/libraries/glslang/glslang/MachineIndependent/reflection.cpp - src/libraries/glslang/glslang/MachineIndependent/reflection.h - src/libraries/glslang/glslang/MachineIndependent/RemoveTree.cpp - src/libraries/glslang/glslang/MachineIndependent/RemoveTree.h - src/libraries/glslang/glslang/MachineIndependent/Scan.cpp - src/libraries/glslang/glslang/MachineIndependent/Scan.h - src/libraries/glslang/glslang/MachineIndependent/ScanContext.h - src/libraries/glslang/glslang/MachineIndependent/ShaderLang.cpp - src/libraries/glslang/glslang/MachineIndependent/SymbolTable.cpp - src/libraries/glslang/glslang/MachineIndependent/SymbolTable.h - src/libraries/glslang/glslang/MachineIndependent/Versions.cpp - src/libraries/glslang/glslang/MachineIndependent/Versions.h -) - -set(LOVE_SRC_3P_GLSLANG_GLSLANG_OSDEPENDENT - src/libraries/glslang/glslang/OSDependent/osinclude.h -) - -if(MSVC) - set(LOVE_SRC_3P_GLSLANG_GLSLANG_OSDEPENDENT - ${LOVE_SRC_3P_GLSLANG_GLSLANG_OSDEPENDENT} - src/libraries/glslang/glslang/OSDependent/Windows/main.cpp - src/libraries/glslang/glslang/OSDependent/Windows/ossource.cpp - ) -else() - set(LOVE_SRC_3P_GLSLANG_GLSLANG_OSDEPENDENT - ${LOVE_SRC_3P_GLSLANG_GLSLANG_OSDEPENDENT} - src/libraries/glslang/glslang/OSDependent/Unix/ossource.cpp - ) -endif() - -set(LOVE_SRC_3P_GLSLANG_GLSLANG_PUBLIC - src/libraries/glslang/glslang/Public/ShaderLang.h -) - -set(LOVE_SRC_3P_GLSLANG_GLSLANG - ${LOVE_SRC_3P_GLSLANG_GLSLANG_GENERICCODEGEN} - ${LOVE_SRC_3P_GLSLANG_GLSLANG_INCLUDE} - ${LOVE_SRC_3P_GLSLANG_GLSLANG_MACHINEINDEPENDENT} - ${LOVE_SRC_3P_GLSLANG_GLSLANG_OSDEPENDENT} - ${LOVE_SRC_3P_GLSLANG_GLSLANG_PUBLIC} -) - -set(LOVE_SRC_3P_GLSLANG_OGLCOMPILERSDLL - src/libraries/glslang/OGLCompilersDLL/InitializeDll.cpp - src/libraries/glslang/OGLCompilersDLL/InitializeDll.h -) - -set(LOVE_SRC_3P_GLSLANG - ${LOVE_SRC_3P_GLSLANG_GLSLANG} - ${LOVE_SRC_3P_GLSLANG_OGLCOMPILERSDLL} -) - -add_library(love_3p_glslang ${LOVE_SRC_3P_GLSLANG}) - -# -# LodePNG -# - -set(LOVE_SRC_3P_LODEPNG - src/libraries/lodepng/lodepng.cpp - src/libraries/lodepng/lodepng.h -) - -add_library(love_3p_lodepng ${LOVE_SRC_3P_LODEPNG}) - -# -# luasocket -# - -set(LOVE_SRC_3P_LUASOCKET_ROOT - src/libraries/luasocket/luasocket.cpp - src/libraries/luasocket/luasocket.h -) - -set(LOVE_SRC_3P_LUASOCKET_LIBLUASOCKET - src/libraries/luasocket/libluasocket/auxiliar.c - src/libraries/luasocket/libluasocket/auxiliar.h - src/libraries/luasocket/libluasocket/buffer.c - src/libraries/luasocket/libluasocket/buffer.h - src/libraries/luasocket/libluasocket/compat.c - src/libraries/luasocket/libluasocket/compat.h - src/libraries/luasocket/libluasocket/except.c - src/libraries/luasocket/libluasocket/except.h - src/libraries/luasocket/libluasocket/ftp.lua.h - src/libraries/luasocket/libluasocket/headers.lua.h - src/libraries/luasocket/libluasocket/http.lua.h - src/libraries/luasocket/libluasocket/inet.c - src/libraries/luasocket/libluasocket/inet.h - src/libraries/luasocket/libluasocket/io.c - src/libraries/luasocket/libluasocket/io.h - src/libraries/luasocket/libluasocket/ltn12.lua.h - src/libraries/luasocket/libluasocket/luasocket.c - src/libraries/luasocket/libluasocket/luasocket.h - src/libraries/luasocket/libluasocket/mbox.lua.h - src/libraries/luasocket/libluasocket/mime.c - src/libraries/luasocket/libluasocket/mime.h - src/libraries/luasocket/libluasocket/mime.lua.h - src/libraries/luasocket/libluasocket/options.c - src/libraries/luasocket/libluasocket/options.h - src/libraries/luasocket/libluasocket/pierror.h - src/libraries/luasocket/libluasocket/select.c - src/libraries/luasocket/libluasocket/select.h - src/libraries/luasocket/libluasocket/smtp.lua.h - src/libraries/luasocket/libluasocket/socket.h - src/libraries/luasocket/libluasocket/socket.lua.h - src/libraries/luasocket/libluasocket/tcp.c - src/libraries/luasocket/libluasocket/tcp.h - src/libraries/luasocket/libluasocket/timeout.c - src/libraries/luasocket/libluasocket/timeout.h - src/libraries/luasocket/libluasocket/tp.lua.h - src/libraries/luasocket/libluasocket/udp.c - src/libraries/luasocket/libluasocket/udp.h - src/libraries/luasocket/libluasocket/url.lua.h -) - -set(LOVE_LINK_L3P_LUASOCKET_LIBLUASOCKET) - -if(MSVC) - set(LOVE_SRC_3P_LUASOCKET_LIBLUASOCKET - ${LOVE_SRC_3P_LUASOCKET_LIBLUASOCKET} - src/libraries/luasocket/libluasocket/wsocket.c - src/libraries/luasocket/libluasocket/wsocket.h - ) - - set(LOVE_LINK_L3P_LUASOCKET_LIBLUASOCKET - ${LOVE_LINK_L3P_LUASOCKET_LIBLUASOCKET} - ws2_32.lib - ) -else() - set(LOVE_SRC_3P_LUASOCKET_LIBLUASOCKET - ${LOVE_SRC_3P_LUASOCKET_LIBLUASOCKET} - src/libraries/luasocket/libluasocket/serial.c - src/libraries/luasocket/libluasocket/unix.c - src/libraries/luasocket/libluasocket/unix.h - src/libraries/luasocket/libluasocket/unixtcp.c - src/libraries/luasocket/libluasocket/unixtcp.h - src/libraries/luasocket/libluasocket/unixudp.c - src/libraries/luasocket/libluasocket/unixudp.h - src/libraries/luasocket/libluasocket/usocket.c - src/libraries/luasocket/libluasocket/usocket.h - ) -endif() - -set(LOVE_SRC_3P_LUASOCKET - ${LOVE_SRC_3P_LUASOCKET_ROOT} - ${LOVE_SRC_3P_LUASOCKET_LIBLUASOCKET} -) - -add_library(love_3p_luasocket ${LOVE_SRC_3P_LUASOCKET}) -target_link_libraries(love_3p_luasocket ${LOVE_LUA_LIBRARY} ${LOVE_LINK_L3P_LUASOCKET_LIBLUASOCKET}) - -# -# APIs from Lua 5.3 -# - -set(LOVE_SRC_3P_LUA53 - src/libraries/lua53/lprefix.h - src/libraries/lua53/lstrlib.c - src/libraries/lua53/lstrlib.h - src/libraries/lua53/lutf8lib.c - src/libraries/lua53/lutf8lib.h -) - -add_library(love_3p_lua53 ${LOVE_SRC_3P_LUA53}) -target_link_libraries(love_3p_lua53 ${LOVE_LUA_LIBRARY}) - -# -# lz4 -# - -set(LOVE_SRC_3P_LZ4 - src/libraries/lz4/lz4.c - src/libraries/lz4/lz4.h - src/libraries/lz4/lz4hc.c - src/libraries/lz4/lz4hc.h - src/libraries/lz4/lz4opt.h -) - -add_library(love_3p_lz4 ${LOVE_SRC_3P_LZ4}) - -# -# noise1234 -# - -set(LOVE_SRC_3P_NOISE1234 - src/libraries/noise1234/noise1234.cpp - src/libraries/noise1234/noise1234.h - src/libraries/noise1234/simplexnoise1234.cpp - src/libraries/noise1234/simplexnoise1234.h -) - -add_library(love_3p_noise1234 ${LOVE_SRC_3P_NOISE1234}) - -# -# physfs -# - -set(LOVE_SRC_3P_PHYSFS - src/libraries/physfs/physfs_archiver_7z.c - src/libraries/physfs/physfs_archiver_dir.c - src/libraries/physfs/physfs_archiver_grp.c - src/libraries/physfs/physfs_archiver_hog.c - src/libraries/physfs/physfs_archiver_iso9660.c - src/libraries/physfs/physfs_archiver_mvl.c - src/libraries/physfs/physfs_archiver_qpak.c - src/libraries/physfs/physfs_archiver_slb.c - src/libraries/physfs/physfs_archiver_unpacked.c - src/libraries/physfs/physfs_archiver_vdf.c - src/libraries/physfs/physfs_archiver_wad.c - src/libraries/physfs/physfs_archiver_zip.c - src/libraries/physfs/physfs_byteorder.c - src/libraries/physfs/physfs_casefolding.h - src/libraries/physfs/physfs_internal.h - src/libraries/physfs/physfs_lzmasdk.h - src/libraries/physfs/physfs_miniz.h - src/libraries/physfs/physfs_platform_haiku.cpp - src/libraries/physfs/physfs_platform_os2.c - src/libraries/physfs/physfs_platform_posix.c - src/libraries/physfs/physfs_platform_qnx.c - src/libraries/physfs/physfs_platform_unix.c - src/libraries/physfs/physfs_platform_windows.c - src/libraries/physfs/physfs_platform_winrt.cpp - src/libraries/physfs/physfs_platforms.h - src/libraries/physfs/physfs_unicode.c - src/libraries/physfs/physfs.c - src/libraries/physfs/physfs.h -) - -if(APPLE) - set(LOVE_SRC_3P_PHYSFS ${LOVE_SRC_3P_PHYSFS} - src/libraries/physfs/physfs_platform_apple.m - ) -endif() - -add_library(love_3p_physfs ${LOVE_SRC_3P_PHYSFS}) - -# -# stb_image -# - -set(LOVE_SRC_3P_STB - src/libraries/stb/stb_image.h -) - -# stb_image has no implementation files of its own. - -# -# tiny exr -# - -set(LOVE_SRC_3P_TINYEXR - src/libraries/tinyexr/tinyexr.h -) - -# tinyexr has no implementation files of its own. - -# -# utf8 -# - -set(LOVE_SRC_3P_UTF8_ROOT src/libraries/utf8/utf8.h) - -set(LOVE_SRC_3P_UTF8_UTF8 - src/libraries/utf8/utf8/checked.h - src/libraries/utf8/utf8/core.h - src/libraries/utf8/utf8/unchecked.h -) - -set(LOVE_SRC_3P_UTF8 - ${LOVE_SRC_3P_UTF8_ROOT} - ${LOVE_SRC_3P_UTF8_UTF8} -) - -# This library is all headers ... so there is no need to -# add_library() here. - -# -# Wuff -# - -set(LOVE_SRC_3P_WUFF - src/libraries/Wuff/wuff.c - src/libraries/Wuff/wuff.h - src/libraries/Wuff/wuff_config.h - src/libraries/Wuff/wuff_convert.c - src/libraries/Wuff/wuff_convert.h - src/libraries/Wuff/wuff_internal.c - src/libraries/Wuff/wuff_internal.h - src/libraries/Wuff/wuff_memory.c -) - -add_library(love_3p_wuff ${LOVE_SRC_3P_WUFF}) - -# -# xxHash -# - -set(LOVE_SRC_3P_XXHASH - src/libraries/xxHash/xxhash.c - src/libraries/xxHash/xxhash.h -) - -add_library(love_3p_xxhash ${LOVE_SRC_3P_XXHASH}) - -set(LOVE_3P - love_3p_box2d - love_3p_ddsparse - love_3p_enet - love_3p_glad - love_3p_glslang - love_3p_lodepng - love_3p_luasocket - love_3p_lua53 - love_3p_lz4 - love_3p_noise1234 - love_3p_physfs - love_3p_wuff - love_3p_xxhash -) - -love_disable_warnings(love_3p_box2d love_3p_enet love_3p_luasocket love_3p_physfs) - -# -# liblove -# -set(LOVE_LIB_SRC - ${LOVE_SRC_COMMON} - # Modules - ${LOVE_SRC_MODULE_AUDIO} - ${LOVE_SRC_MODULE_DATA} - ${LOVE_SRC_MODULE_EVENT} - ${LOVE_SRC_MODULE_FILESYSTEM} - ${LOVE_SRC_MODULE_FONT} - ${LOVE_SRC_MODULE_GRAPHICS} - ${LOVE_SRC_MODULE_IMAGE} - ${LOVE_SRC_MODULE_JOYSTICK} - ${LOVE_SRC_MODULE_KEYBOARD} - ${LOVE_SRC_MODULE_LOVE} - ${LOVE_SRC_MODULE_MATH} - ${LOVE_SRC_MODULE_MOUSE} - ${LOVE_SRC_MODULE_PHYSICS} - ${LOVE_SRC_MODULE_SOUND} - ${LOVE_SRC_MODULE_SYSTEM} - ${LOVE_SRC_MODULE_THREAD} - ${LOVE_SRC_MODULE_TIMER} - ${LOVE_SRC_MODULE_TOUCH} - ${LOVE_SRC_MODULE_VIDEO} - ${LOVE_SRC_MODULE_WINDOW} -) - -include_directories( - src - src/libraries - src/modules - ${LOVE_INCLUDE_DIRS} -) - -link_directories(${LOVE_LINK_DIRS}) - -set(LOVE_RC) - -if(MSVC) - set(LOVE_LINK_LIBRARIES ${LOVE_LINK_LIBRARIES} - ws2_32.lib - winmm.lib - ) - - set(LOVE_RC - extra/windows/love.rc - extra/windows/love.ico - ) -endif() - -add_library(${LOVE_LIB_NAME} SHARED ${LOVE_LIB_SRC} ${LOVE_RC}) -target_link_libraries(${LOVE_LIB_NAME} ${LOVE_LINK_LIBRARIES} ${LOVE_3P}) - -if(LOVE_EXTRA_DEPENDECIES) - add_dependencies(${LOVE_LIB_NAME} ${LOVE_EXTRA_DEPENDECIES}) -endif() - -if(MSVC) - set_target_properties(${LOVE_LIB_NAME} PROPERTIES RELEASE_OUTPUT_NAME "love" PDB_NAME "liblove" IMPORT_PREFIX "lib") - set_target_properties(${LOVE_LIB_NAME} PROPERTIES DEBUG_OUTPUT_NAME "love" PDB_NAME "liblove" IMPORT_PREFIX "lib") -endif() - -# -# love (executable) -# -add_executable(${LOVE_EXE_NAME} WIN32 src/love.cpp ${LOVE_RC}) -target_link_libraries(${LOVE_EXE_NAME} ${LOVE_LIB_NAME}) - -if(MSVC) - add_executable(${LOVE_CONSOLE_EXE_NAME} src/love.cpp ${LOVE_RC}) - target_link_libraries(${LOVE_CONSOLE_EXE_NAME} ${LOVE_LIB_NAME}) -endif() - -function(post_step_move_dll ARG_POST_TARGET ARG_TARGET_OR_FILE) - if(TARGET ${ARG_TARGET_OR_FILE}) - add_custom_command(TARGET ${ARG_POST_TARGET} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy - $ - ${CMAKE_CURRENT_BINARY_DIR}/$/$) - else() - get_filename_component(TEMP_FILENAME ${ARG_TARGET_OR_FILE} NAME) - add_custom_command(TARGET ${ARG_POST_TARGET} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy - ${ARG_TARGET_OR_FILE} - ${CMAKE_CURRENT_BINARY_DIR}/$/${TEMP_FILENAME}) - endif() -endfunction() - -# Add post build steps to move the DLLs next to the binary. Otherwise -# running/debugging the binary will not work from inside VS. -if(LOVE_MOVE_DLLS) - foreach(DLL ${LOVE_MOVE_DLLS}) - post_step_move_dll(love ${DLL}) - endforeach() -endif() - -if (NOT MSVC) - return() -endif() - -################################### -# Version -################################### - -# Extract version.h contents. -file(READ ${CMAKE_CURRENT_SOURCE_DIR}/src/common/version.h LOVE_VERSION_FILE_CONTENTS) - -# Extract one of LOVE_VERSION_MAJOR/MINOR/REV. -function(match_version ARG_STRING OUT_VAR) - string(REGEX MATCH "VERSION_${ARG_STRING} = ([0-9]+);" TMP_VER "${LOVE_VERSION_FILE_CONTENTS}") - string(REGEX MATCH "[0-9]+" TMP_VER "${TMP_VER}") - set(${OUT_VAR} ${TMP_VER} PARENT_SCOPE) -endfunction() - -match_version("MAJOR" LOVE_VERSION_MAJOR) -match_version("MINOR" LOVE_VERSION_MINOR) -match_version("REV" LOVE_VERSION_REV) - -set(LOVE_VERSION_STR "${LOVE_VERSION_MAJOR}.${LOVE_VERSION_MINOR}.${LOVE_VERSION_REV}") - -message(STATUS "Version: ${LOVE_VERSION_STR}") - -################################### -# CPack -################################### -install(TARGETS ${LOVE_EXE_NAME} ${LOVE_CONSOLE_EXE_NAME} ${LOVE_LIB_NAME} RUNTIME DESTINATION .) - -# Extra DLLs. -if(LOVE_EXTRA_DLLS) - foreach(DLL ${LOVE_EXTRA_DLLS}) - get_filename_component(DLL_NAME ${DLL} NAME) - message(STATUS "Extra DLL: ${DLL_NAME}") - endforeach() - install(FILES ${LOVE_EXTRA_DLLS} DESTINATION .) -endif() - -# Dynamic runtime libs. -if(LOVE_MSVC_DLLS) - foreach(DLL ${LOVE_MSVC_DLLS}) - get_filename_component(DLL_NAME ${DLL} NAME) - message(STATUS "Runtime DLL: ${DLL_NAME}") - endforeach() - install(FILES ${LOVE_MSVC_DLLS} DESTINATION .) -endif() - -# Copy a text file from CMAKE_CURRENT_SOURCE_DIR to CMAKE_CURRENT_BINARY_DIR. -# On Windows, this function will convert line endings to CR,LF. -function(copy_text_file ARG_FILE_IN ARG_FILE_OUT) - file(READ ${CMAKE_CURRENT_SOURCE_DIR}/${ARG_FILE_IN} TMP_TXT_CONTENTS) - file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${ARG_FILE_OUT} ${TMP_TXT_CONTENTS}) -endfunction() - -# Text files. -copy_text_file(readme.md readme.txt) -copy_text_file(license.txt license.txt) -copy_text_file(changes.txt changes.txt) - -install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/changes.txt - ${CMAKE_CURRENT_BINARY_DIR}/license.txt - ${CMAKE_CURRENT_BINARY_DIR}/readme.txt - DESTINATION .) - -# Icons -install(FILES - ${CMAKE_CURRENT_SOURCE_DIR}/extra/nsis/love.ico - ${CMAKE_CURRENT_SOURCE_DIR}/extra/nsis/game.ico - DESTINATION .) - -set(CPACK_GENERATOR ZIP NSIS) -set(CPACK_PACKAGE_NAME "love") -set(CPACK_PACKAGE_VENDOR "love2d.org") -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LOVE -- It's awesome") -set(CPACK_PACKAGE_VERSION "${LOVE_VERSION_STR}") -set(CPACK_PACKAGE_VERSION_MAJOR "${LOVE_VERSION_MAJOR}") -set(CPACK_PACKAGE_VERSION_MINOR "${LOVE_VERSION_MINOR}") -set(CPACK_PACKAGE_VERSION_PATCH "${LOVE_VERSION_REV}") -set(CPACK_PACKAGE_INSTALL_DIRECTORY "LOVE") -set(CPACK_PACKAGE_EXECUTABLES "${LOVE_EXE_NAME};LOVE") -set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/readme.md") -set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/license.txt") - -set(CPACK_NSIS_EXECUTABLES_DIRECTORY .) -set(CPACK_NSIS_PACKAGE_NAME "LOVE") -set(CPACK_NSIS_DISPLAY_NAME "LOVE ${LOVE_VERSION_STR}") -set(CPACK_NSIS_MODIFY_PATH OFF) - -if(LOVE_X64) - set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64") -else() - set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES") -endif() - -set(CPACK_NSIS_MENU_LINKS "http://love2d.org/wiki" "Documentation") - -# Some bug somewhere in NSIS requires "\\\\" somewhere in the path, -# according to The Internet. (And sure enough, it does not work -# without it). -set(NSIS_LEFT_BMP "${CMAKE_CURRENT_SOURCE_DIR}/extra/nsis\\\\left.bmp") -set(NSIS_TOP_BMP "${CMAKE_CURRENT_SOURCE_DIR}/extra/nsis\\\\top.bmp") -set(NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}/extra/nsis\\\\love.ico") -set(NSIS_MUI_UNICON "${CMAKE_CURRENT_SOURCE_DIR}/extra/nsis\\\\love.ico") - -set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE " - !define MUI_WELCOMEPAGE_TITLE \\\"LOVE ${LOVE_VERSION_STR} Setup\\\" - !define MUI_WELCOMEFINISHPAGE_BITMAP \\\"${NSIS_LEFT_BMP}\\\" - !define MUI_HEADERIMAGE_BITMAP \\\"${NSIS_TOP_BMP}\\\" - !define MUI_ICON \\\"${NSIS_MUI_ICON}\\\" - !define MUI_UNICON \\\"${NSIS_MUI_UNICON}\\\" -") - -set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " - WriteRegStr HKCR \\\".love\\\" \\\"\\\" \\\"LOVE\\\" - WriteRegStr HKCR \\\"LOVE\\\" \\\"\\\" \\\"LOVE Game File\\\" - WriteRegStr HKCR \\\"LOVE\\\\DefaultIcon\\\" \\\"\\\" \\\"$INSTDIR\\\\game.ico\\\" - WriteRegStr HKCR \\\"LOVE\\\\shell\\\" \\\"\\\" \\\"open\\\" - WriteRegStr HKCR \\\"LOVE\\\\shell\\\\open\\\" \\\"\\\" \\\"Open in LOVE\\\" - WriteRegStr HKCR \\\"LOVE\\\\shell\\\\open\\\\command\\\" \\\"\\\" \\\"$INSTDIR\\\\love.exe $\\\\\\\"%1$\\\\\\\"\\\" - System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' -") - -set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS " - DeleteRegKey HKCR \\\"LOVE\\\" - DeleteRegKey HKCR \\\".love\\\" - System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' -") - -include(CPack) diff --git a/love/src/jni/love/bitbucket-pipelines.yml b/love/src/jni/love/bitbucket-pipelines.yml deleted file mode 100644 index bb506983..00000000 --- a/love/src/jni/love/bitbucket-pipelines.yml +++ /dev/null @@ -1,7 +0,0 @@ -image: mfcula/love-cmake:v1 -pipelines: - default: - - step: - script: - - cmake -G"Ninja" -H. -Bout - - ninja -C out \ No newline at end of file diff --git a/love/src/jni/love/changes.txt b/love/src/jni/love/changes.txt deleted file mode 100644 index 95a96e0d..00000000 --- a/love/src/jni/love/changes.txt +++ /dev/null @@ -1,1286 +0,0 @@ -LOVE 11.2 [Mysterious Mysteries] --------------------------------- - -Released: 2018-11-25 - -* Added Source:setAirAbsorption and Source:getAirAbsorption. -* Added Body:setTransform and Body:getTransform. - -* Improved performance of love.graphics.draw slightly on iOS and Android. - -* Fixed filesystem initialization on Windows 10 update 1809. -* Fixed compatibility with Lua 5.2 and 5.3. -* Fixed the explicit format + Data argument variant of love.data.decompress. -* Fixed love.joystick.setGamepadMapping not being able to change existing mappings. -* Fixed a crash on quit on Linux if a custom cursor is active when quitting. -* Fixed a crash in the Data variant of Shader:send when it's called after love.window.setMode. -* Fixed a love.graphics.setCanvas error message to be less confusing. - -LOVE 11.1 [Mysterious Mysteries] --------------------------------- - -Released: 2018-04-15 - -* Fixed love.graphics.setCanvas failing randomly. -* Fixed love.graphics.clear(colortable) when no Canvas is active. -* Fixed stencil and depth support on older phones. -* Fixed love.event.quit causing crashes and other unexpected behaviour if a Canvas is active. -* Fixed Fixture:getShape crashing when returning a ChainShape. -* Fixed love.joystick.loadJoystickMappings outputting a deprecation warning about love.filesystem.isFile. -* Fixed Source:queue to show the correct argument name in the error message when an invalid data parameter is given. -* Fixed t.console=true causing an error on Windows if lovec.exe is used. - -LOVE 11.0 [Mysterious Mysteries] --------------------------------- - -Released: 2018-04-01 - - * Added Object:release. - * Added Data:clone. - * Added queueable audio sources. - * Added audio input support. - * Added Source filters: low gain, high gain and band pass. - * Added audio effect APIs (reverb, echo, etc.) - * Added variants of SoundData:getSample/setSample which take a channel parameter. - * Added variants of all table-with-fields-returning get* functions, the new variants take an existing table to fill in. - * Added a variant to World:update, which accepts the number of iterations to run. The defaults are now 8 and 3. - * Added Body:isTouching. - * Added RopeJoint:setMaxLength. - * Added a click count argument to love.mousepressed and love.mousereleased. - * Added variants of love.filesystem.mount which accept a Data or FileData object containing zipped data. - * Added love.filesystem.get/setCRequirePath, and use that to find c libraries for require. - * Added variants of File:read and love.filesystem.read which take an enum to determine whether they return a FileData or a string. - * Added love.data module. It includes hex/base64 encoding functions, MD5 and SHA hashing, string packing, compression APIs, and more. - * Added Channel:hasRead, which checks if a message has been read. Takes an id, which Channel:push will now return. - * Added variants of Channel:demand and Channel:supply which take a timeout argument. - * Added Transform objects to love.math. - * Added support for different ImageData formats, including RGBA8 (the default), RGBA16, RGBA16F, and RGBA32F. - * Added the ability to load Radiance HDR, OpenEXR, and 16 bit PNG images. - * Added love.graphics.getImageFormats (replaces love.graphics.getCompressedImageFormats). - * Added the ability to specify a per-object pixel density scale factor when creating Images, Canvases, Fonts, and Videos. Affects drawing. - * Added Texture:getPixelWidth/Height and love.graphics.getPixelWidth/Height. - * Added Texture:getPixelDensity, love.graphics.getPixelDensity, and Font:getPixelDensity. - * Added Texture:getMipmapCount, getFormat, getLayerCount, getDepth, and getTextureType. - * Added Array, Cubemap, and Volume texture types and corresponding Image and Canvas APIs. - * Added love.graphics.getTextureTypes, returns a table with fields indicating support for each texture type. - * Added mipmapping support to Canvases, including both auto-generated mipmaps and manually rendering to a specific mipmap level. - * Added 'stencil8', 'depth24stencil8', 'depth32fstencil8', 'depth16', 'depth24', and 'depth32f' pixel formats for Canvases. - * Added variant of love.graphics.newCanvas which accepts a table of settings. - * Added optional 'readable' boolean field to the table passed into love.graphics.newCanvas. - * Added optional 'depthstencil' field to the table passed into love.graphics.setCanvas, for using a depth/stencil Canvas. - * Added optional 'depth' and 'stencil' boolean fields to the table passed into setCanvas, for enabling depth and stencil buffers if 'depthstencil' isn't used. - * Added shadow sampler support for Canvases. - * Added love.graphics.setDepthMode for using the depth buffer for depth testing/writes. Depth values of rendered objects can only be set via shaders. - * Added love.graphics.setMeshCullMode, for culling back- or front-facing triangles when drawing a Mesh. - * Added love.graphics.setFrontFaceWinding. - * Added variant of love.graphics.getCanvasFormats which takes a 'readable' boolean. - * Added love.graphics.drawLayer and SpriteBatch:add/setLayer for easily drawing layers of Array Textures. - * Added variants of love.graphics.print and printf which take a Font argument. - * Added variants of love.graphics.clear to control how the active depth and stencil buffers are cleared. - * Added love.graphics.applyTransform and love.graphics.replaceTransform. - * Added love.graphics.transformPoint and love.graphics.inverseTransformPoint. - * Added love.graphics.getStackDepth. - * Added love.graphics.flushBatch for manually flushing automatically batched draws. - * Added SpriteBatch:setDrawRange. - * Added per-shader opt in support for the GLSL 3.30 and GLSL ES 3.00 shading languages. - * Added 'void effect()' pixel shader entry point. - * Added love.graphics.validateShader. - * Added Shader:hasUniform. - * Added support for non-square shader uniform matrices on desktop platforms and on mobile GLSL 3. - * Added Shader:send(matrixname, is_column_major, matrix, ...) which specifies how to interpret the matrix table arguments. - * Added Shader:send variants which accept a Data object. - * Added 'borderellipse' and 'borderrectangle' ParticleSystem distributions. - * Added variant of ParticleSystem:setEmissionArea which accepts an area angle and a flag for whether particle directions are relative to the center of the area. - * Added ParticleSystem:set/getAreaSpreadAngle and set/getAreaSpreadIsRelativeDirection. - * Added love.graphics.captureScreenshot (replaces love.graphics.newScreenshot). - * Added 'glsl3', 'instancing', 'fullnpot','pixelshaderhighp', and 'shaderderivatives' graphics features. - * Added 'anisotropy' graphics limit. - * Added Mesh instancing support via love.graphics.drawInstanced and Mesh:attachAttribute. - * Added a Mesh:attachAttribute variant that takes a different target attribute name. - * Added Mesh:detachAttribute. - * Added a variant of Mesh:setVertexMap which accepts a Data object. - * Added love.window.updateMode. - * Added love.window.isMinimized. - * Added love.window.restore. - * Added the ability to prevent love from creating a stencil buffer for the window. - * Added cycle detection to Variant's table serialization, cycles now cause an error, rather than a stack overflow. - * Added love.graphics.newShader File and FileData variants. - * Added a default love.threaderror callback, which raises the error in the main thread. - * Added checks for invalid constants passed to love.keyboard.isDown/isScancodeDown. - * Added deprecation warnings, on by default for non-fused games. - * Added love.filesystem.getInfo. - * Added 'drawcallsbatched' to love.graphics.getStats. - * Added support for header-less DEFLATE to love.data.compress/decompress. - - * Deprecated love.filesystem.exists / isFile / isDirectory / isSymlink / getLastModified / getSize (use getInfo instead). - * Deprecated love.math.compress / decompress (use love.data.compress / decompress instead). - - * - All renamed APIs are formally deprecated rather than completely removed. - * Renamed love.window.getPixelScale to love.window.getDPIScale. - * Renamed love.mouse.hasCursor to love.mouse.isCursorSupported. - * Renamed ParticleSystem:setAreaSpread to ParticleSystem:setEmissionArea. - * Renamed love.errhand to love.errorhandler. - * Renamed Source/SoundData/Decoder:getChannels to getChannelCount. - * Renamed PrismaticJoint/RevoluteJoint:hasLimitsEnabled to areLimitsEnabled. - * Renamed love.audio.getSourceCount to love.audio.getActiveSourceCount. - * Renamed all get[Object]List functions to get[Object]s. - - * Removed the default source type for love.audio.newSource. - * Removed variant of love.filesystem.newFileData which takes base64 data, use love.data.decode instead. - * Removed the no-argument variant of Text:set, use Text:clear instead. - * Removed love.graphics.getCompressedImageFormats, use love.graphics.getImageFormats instead. - * Removed the 'void effects(...)' pixel shader entry point. Use the new 'void effect()' instead. - * Removed Shader:getExternVariable, use Shader:hasUniform instead. - * Removed love.graphics.newScreenshot, use love.graphics.captureScreenshot instead. - * Removed deprecated enet function host:socket_get_address. - * Removed functions deprecated in LÖVE 0.10.2: - * Removed Shader:sendInt, Shader:sendBoolean, Shader:sentFloat, Shader:sendMatrix, and Shader:sendTexture (use Shader:send instead). - * Removed love.window.isCreated (use love.window.isOpen instead). - - * Improved performance when drawing textures, shapes, lines, and points by automatically batching their draw calls together when possible. - * Improved performance of Shader:send when the Shader is not active. - * Improved performance of love.math.randomNormal when LuaJIT's JIT compiler is enabled. - * Improved performance of love.filesystem.lines and File:lines, especially when reading from a file inside a zip/.love. - - * Changed all color values to be in the range 0-1, rather than 0-255. - * Changed high-dpi functionality to require much less code (often none at all) for graphics to appear at the correct sizes and positions. - * Changed love.graphics.print and friends to ignore carriage returns. - * Changed the 'multiply' blend mode to error if not used with the 'premultiplied' blend alpha mode, since the formula only works with that anyway. - * Changed some love.graphics, love.window, and love.event APIs to cause an error if a Canvas is active. - * Changed stenciling functionality with a Canvas active to require stencil=true (or a custom stencil-formatted Canvas) to be set in setCanvas. - * Changed Mesh:setDrawRange to take 'start' and 'count' parameters instead of 'min' and 'max'. - * Changed the 'vsync' field of love.window.setMode and t.window in love.conf. It's now an integer with 0 disabling vsync. - * Changed the audio playback APIs drastically. - * Changed enet to no longer set the 'enet' global, again matching luasocket. - * Changed Source seeking behaviour, all kinds of Sources now behave similarly when seeking past the boundaries. - * Changed love.timer.step, it now returns dt. - * Changed love.run and love.errhand to return a function for their main loop, which gets called until love quits. - - * Updated and improved command line argument handling. - * Updated the boot sequence to show an error instead of the no-game screen, if a nonexistant folder is passed in as the source game directory. - * Updated 'love.exe --version' on Windows to print to the parent console. - * Updated Android print rerouting and JIT compilation disabling to apply inside threads. - * Updated invalid enum value error messages to show a list of the valid enum values. - * Updated Source:seek to work if the Source isn't playing. - * Updated love.event.poll to stop allocating memory unnecessarily. - * Updated love.math.random to have improved numeric distribution. - * Updated love.graphics to support Core Profile OpenGL 3.3+ when available. - * Updated shaders to always expose derivative functions (dFdx, dFdy, fwidth) when available in OpenGL ES. - * Updated shaders to allow using VERTEX and PIXEL in shader code. - * Updated love.graphics.circle/ellipse/arc/rectangle to take transformation scale into account when determining the number of segments to use. - * Updated Font glyph generation to improve antialiasing. - * Updated Canvas:newImageData to return an ImageData with a format that matches the Canvas' as closely as possible. - * Updated love.graphics.newImage to treat file names ending with "@2x", "@3x", etc. as a pixel density scale factor if none is explicitly supplied. - * Updated the error message when bad values are given to love.graphics.line. - * Updated the maximum love.graphics transformation/state stack depth from 64 to 128. - * Updated the default error handler to allow copying the error to the clipboard when the user decides to do so. - * Updated love.filesystem.setRequirePath to support multiple template '?' characters in each path. - * Updated luasocket to version 3.0rc1. - * Updated love.joystick.loadGamepadMappings so it doesn't error when given an empty string. - * Updated love.joystick.setGamepadMapping to use the controller's name for the new mapping when possible. - - * Fixed error in default error handler when the error message contains non UTF-8 bytes. - * Fixed a memory leak when sending love objects to threads which never load that object's module. - * Fixed a memory leak in enet when peer:send fails. - * Fixed os.execute always returning -1 in Linux. - * Fixed the default reference angle for WeldJoint, PrismaticJoint, and RevoluteJoint. - * Fixed Fixture:getShape to reuse the existing internal Fixture-owned shape. - * Fixed MouseJoint:setFrequency to error instead of crashing if a frequency of 0 is set. - * Fixed love.system.set/getClipboardText to error instead of crashing, when a window hasn't been created. - * Fixed Joystick:getGamepadMapping to work with xinput controllers. - * Fixed love.joystick.setGamepadMapping's replacement code. - * Fixed baseline calculation when rendering text. - * Fixed VaryingTexCoords and love_ScreenSize in shaders to be 'highp' in OpenGL ES, when supported. - * Fixed ParticleSystem:setParticleLifetime to error if a negative value is given. - * Fixed Shader:send and Shader:sendColor ignoring the last argument for an array. - * Fixed a crash when love.graphics.pop is called after a love.window.setMode while the transformation stack was not empty. - * Fixed love.window.isMaximized. - * Fixed video playback to work with a wider range of Ogg Theora files. - * Fixed video seeking to be faster. - * Fixed BezierCurves to error instead of hanging in some situations. - * Fixed compilation of luasocket with newer luajit 2.1.0 beta versions. - -LOVE 0.10.2 [Super Toast] -------------------------- - -Released: 2016-10-31 - - * Added lovec.exe in Windows. It is the same as love.exe but built with the Console subsystem, so it always uses or provides a console. - * Added the ability to restart the game via love.event.quit("restart"). - * Added support for passing a table to love.mouse.isDown, love.keyboard.isDown, love.keyboard.isScancodeDown, Joystick:isDown, and Joystick:isGamepadDown. - * Added love.window.isMaximized. - * Added 'shaderswitches' field to the table returned by love.graphics.getStats. - * Added Quad:getTextureDimensions. - * Added 'ellipse' area distribution to ParticleSystems. - * Added support for BC4-7 compressed texture formats in KTX files. - * Added PrismaticJoint:getAxis and WheelJoint:getAxis. - * Added 2-point version of love.physics.newRevoluteJoint. - * Added table variants of Fixture:setCategory and Fixture:setMask. - * Added getNextVertex and getPreviousVertex to ChainShape and EdgeShape. - * Added optional reference angle arguments to RevoluteJoint, PrismaticJoint, and WeldJoint constructors. - * Added RevoluteJoint:getReferenceAngle, PrismaticJoint:getReferenceAngle, and WeldJoint:getReferenceAngle. - - * Deprecated undocumented Shader:sendTexture, Shader:sendMatrix, Shader:sendInt, and Shader:sendFloat functions. - - * Fixed love on iOS 6. - * Fixed os.execute always returning -1 on Linux. - * Fixed the love.lowmemory callback to call collectgarbage() after the callback has fired, instead of before. - * Fixed love.math.noise(nil) to error instead of returning nil. - * Fixed an occasional crash when a Thread ends. - * Fixed a hang at the end of video playback with some video files. - * Fixed the video decoding thread to not do any work when there are no videos to decode. - * Fixed love.graphics.newVideo(file) to no longer error if love.audio is disabled. - * Fixed a rare bug in Source:play for streaming Sources if the associated OpenAL source object was previously used for a static Source. - * Fixed corrupted Font glyphs in rare cases. - * Fixed stencils inside Canvases on some OpenGL ES 2 devices. - * Fixed an OpenGL error in OpenGL ES 3 when multiple render targets are used. - * Fixed love.window.setMode crashing when called with a Canvas active. - * Fixed love.window.maximize to update the reported window dimensions immediately. - * Fixed gamma correction of ImageFonts and BMFonts with colored images. - * Fixed the default shader improperly applying gamma correction to per-vertex colors when gamma correction is requested but not supported on OpenGL ES. - * Fixed text coloring breaking because of an empty string. - * Fixed large burst of particles when dramatically increasing the emission rate of a ParticleSystem. - * Fixed SpriteBatch:setBufferSize to keep old sprite data if it can fit. - * Fixed MouseJoint:getBodies unconditionally erroring. - * Fixed memory leak in Text:set. - * Fixed incorrect kerning caused by using kerning information for the wrong character in some fonts. - * Fixed ImageData:setPixel/getPixel/mapPixel and SoundData:setSample/getSample to properly handle non-integer coordinates. - - * Improved performance of Channel methods by roughly 2x in many cases. - * Improved performance of Shader:send when small numbers of arguments are given. - - * Updated love.filesystem.mount to accept a DroppedFile as the first parameter. - * Updated Shader:send to do type and argument checking based on the specified uniform variable's information instead of the arguments to the function. - * Updated Shader:send to accept a flat table for matrix uniforms. - - -LOVE 0.10.1 [Super Toast] -------------------------- - -Released: 2016-02-14 - - * Added a new love.conf flag t.externalstorage, which determines whether files are saved in internal or external storage on Android devices. - * Added a new variant of love.graphics.arc which can draw different types of arcs ("pie", "open", or "closed"). - * Added "lighten" and "darken" BlendModes. They can only be used with the "premultiplied" BlendAlphaMode. - * Added the "lighten" GraphicsFeature constant. - * Added the ability to avoid clearing specific Canvases when calling love.graphics.clear, if multiple Canvases are active at once via love.graphics.setCanvas. - * Added Text:getDimensions. - * Added optional "collideconnected" argument to love.physics.newMotorJoint. - - * Fixed a Lua error in the no-game screen if the window's height is too small. - * Fixed the default error handler to reset the mouse Cursor. - * Fixed love.filesystem functions crashing when called if liblove is used directly without calling love.filesystem.init. - * Fixed audio on Android to pause when the app is inactive, and resume when the app becomes active again. - * Fixed the Video decoding thread hanging after Video:seek or when a Video finishes. - * Fixed Video:isPlaying to always return false after it finishes playing. - * Fixed RandomGenerator:random crashing if a nil 'self' is used. - * Fixed loading BMFont files which have characters with 0 width or height (a space character, for example). - * Fixed love.graphics.newFont causing crashes if FileData is passed in. - * Fixed love.graphics.clear(colortable) causing crashes on OpenGL ES 2 systems when a Canvas is active. - * Fixed a driver bug on some Android devices which caused all objects to show up as black. - * Fixed a driver bug on Windows with AMD graphics cards where love.graphics.clear would not always work. - * Fixed Shader:sendColor incorrectly converting alpha values from sRGB to linear RGB when gamma-correct rendering is enabled. - * Fixed love.graphics.newMesh(vertices) double-converting colors from sRGB to linear RGB when gamma-correct rendering is enabled. - * Fixed love.graphics.new* crashing when there is no graphics context/window. - - * Updated the Windows executable to prefer the high-powered AMD graphics card on systems which have switchable Intel+AMD GPUs. - * Updated love.touch.getTouches to return the list of IDs in the relative order that the touches initially happened, instead of being in a random order. - * Updated the error messages caused by invalid or bad arguments to ImageData and SoundData methods to be more descriptive. - - -LOVE 0.10.0 [Super Toast] -------------------------- - -Released: 2015-12-22 - - * Added an iOS port. - * Added an Android port. - * Added the flag t.accelerometerjoystick to love.conf. Disables accelerometer-as-joystick functionality on mobile devices when false. - * Added the flag t.gammacorrect to love.conf (replaces t.window.srgb.) Enabling it globally enables gamma-correct rendering, when supported. - * Added video playback support for Ogg Theora videos, via love.graphics.newVideo and Video objects. - * Added love.video module. It is not used for displaying videos on-screen, only decoding them. - * Added love.touch module. Note that it has important differences from the touch implementation in the LÖVE 0.9 Android and iOS ports. - * Added love.touchpressed, love.touchreleased, and love.touchmoved. - * Added love.system.vibrate. - * Added love.filesystem.setRequirePath and love.filesystem.getRequirePath. - * Added an optional program exit argument to love.event.quit. - * Added love.filedropped and love.directorydropped event callback functions. - * Added love.lowmemory event callback function, called when the app is running out of memory on mobile operating systems. - * Added love.textedited event callback function, called when the user is compositing text (e.g. via an IME.) - * Added love.wheelmoved event callback function (replaces "wu" and "wd" constants for love.mousepressed.) - * Added love.mouse.hasCursor. - * Added a boolean argument to love.mousepressed and love.mousereleased indicating whether the button event originated from a touch press. - * Added optional x/y/width/height arguments to love.keyboard.setTextInput. They tell the system where text will show up so on-screen keyboards can avoid that area. - * Added Source:getType (replaces Source:isStatic.) - * Added Source:getDuration and Decoder:getDuration. - * Added an optional string argument containing raw pixel byte data to the width/height variant of love.image.newImageData. - * Added love.graphics.ellipse. - * Added rounded-rectangle support to love.graphics.rectangle. - * Added love.graphics.points (replaces love.graphics.point.) - * Added love.graphics.intersectScissor. - * Added an optional argument to love.graphics.setBlendMode which indicates whether to treat the colors of drawn objects as having pre-multiplied alpha. - * Added love.graphics.getSupported (replaces love.graphics.isSupported.) - * Added love.graphics.getSystemLimits (replaces love.graphics.getSystemLimit.) - * Added love.graphics.stencil and love.graphics.set/getStencilTest (replaces love.graphics.setStencil.) - * Added love.graphics.isActive. - * Added color arguments to love.graphics.clear. It no longer always uses the background color value. - * Added love.graphics.discard. - * Added love.graphics.isGammaCorrect. - * Added the "clampzero" WrapMode. - * Added the ability to specify custom mipmaps when creating an image, via love.graphics.newImage(filename, {mipmaps={mip1, mip2, ...}}) - * Added optional x/y/width/height arguments to Image:refresh and Canvas:newImageData. - * Added Image:getFlags. - * Added one- and two-channel Canvas formats: r8, rg8, r16f, rg16f, r32f, and rg32f. - * Added support for different formats in each Canvas when using multi-canvas rendering. Added the "multicanvasformats" Graphics Feature constant. - * Added support for OpenGL ES 2 and 3. - * Added support for loading ETC, EAC, PVRTC, and ASTC compressed textures on systems that support them. - * Added custom vertex attribute support for Meshes via new variants of love.graphics.newMesh. - * Added Mesh:setVertexAttribute and Mesh:getVertexAttribute. - * Added Mesh:getVertexFormat. - * Added Mesh:flush. - * Added an optional 'startvertex' argument to Mesh:setVertices. - * Added the ability for love.graphics.newMesh and Mesh:setVertices to accept a Data object. - * Added Mesh:setAttributeEnabled and Mesh:isAttributeEnabled. - * Added Mesh:attachAttribute. - * Added SpriteBatch:attachAttribute. - * Added Shader:sendColor. - * Added new shader functions: gammaCorrectColor, gammaToLinear, and linearToGamma. The functions also have 'precise' and 'fast' variants. - * Added Text objects and love.graphics.newText. - * Added per-character color support to love.graphics.print/printf and to Text objects. - * Added BMFont bitmap font file support to love.graphics.newFont and love.font. - * Added kerning support for TrueType/OpenType and BMFont Fonts. - * Added an optional font hinting argument to love.graphics.newFont when loading TrueType fonts. - * Added an optional spacing argument to love.graphics.newImageFont, which applies additional spacing to all rendered glyphs. - * Added Font:setFallbacks. - * Added love.window.maximize. - * Added love.window.close. - * Added love.window.requestAttention. - * Added love.window.setDisplaySleepEnabled and love.window.isDisplaySleepEnabled. - * Added BezierCurve:renderSegment and BezierCurve:removeControlPoint. - * Added BezierCurve:getSegment. - * Added love.math.compress and love.math.decompress. - * Added Channel:performAtomic. - - * Changed love.mousepressed, love.mousereleased, and love.mouse.isDown to use button numbers instead of named button constants. - * Changed love.keypressed to be love.keypressed(key, scancode, isrepeat). - * Changed love.keyreleased to be love.keyreleased(key, scancode). - * Changed Font:getWrap's second return value to be a table containing the text split into lines. - * Changed love.graphics.newImage's optional second argument to be a table of flags (flags are "mipmaps" and "linear".) - * Changed the arguments for the standard variants of love.graphics.newMesh to newMesh(vertices [, drawmode, usage]) and newMesh(vertexcount [, drawmode, usage]). - * Changed ImageData:encode to return a FileData object. ImageData:encode's first parameter is now the format to encode to, and the second parameter is an optional filename to write to. - - * Renamed the "normal" Fullscreen Type to "exclusive". - * Renamed the DistanceModel constants "inverse clamped", "linear clamped", and "exponent clamped" to "inverseclamped", "linearclamped", and "exponentclamped". - * Renamed the "additive", "subtractive", and "multiplicative" BlendModes to "add", "subtract", and "multiply". - * Renamed the KeyConstant and Scancode representing the spacebar from " " to "space". - * Renamed File:eof to File:isEOF. - * Renamed Canvas:getImageData to Canvas:newImageData. - * Renamed love.image's CompressedData type to CompressedImageData. - - * Removed callback variant of love.filesystem.getDirectoryItems. - * Removed the "wu" and "wd" constants for love.mousepressed (replaced by love.wheelmoved.) - * Removed the named mouse button constants (replaced by button numbers.) - * Removed Source:isStatic (replaced by Source:getType.) - * Removed image loading support for all (non-compressed texture) file formats except for PNG, JPEG, TGA, and BMP. - * Removed JPEG encoding support from ImageData:encode. - * Removed love.graphics.point (replaced by love.graphics.points.) - * Removed love.graphics.setPointStyle and love.graphics.getPointStyle. - * Removed love.graphics.isSupported (replaced by love.graphics.getSupported.) - * Removed love.graphics.getSystemLimit (replaced by love.graphics.getSystemLimits.) - * Removed love.graphics.setStencil (replaced by love.graphics.stencil and love.graphics.setStencilTest.) - * Removed the "canvas", "shader", "npot", "subtractive", and "mipmap" Graphics Feature constants (the features always have guaranteed support now.) - * Removed the "multicanvas" Graphics Feature constant (use love.graphics.getSystemLimits instead.) - * Removed the "srgb" Graphics Feature constant (use love.graphics.isGammaCorrect() or love.graphics.getCanvasFormats().srgb instead.) - * Removed the "srgb" flag in love.window.setMode and in the t.window table in love.conf (Replaced by t.gammacorrect.) - * Removed the "premultiplied" blend mode (love.graphics.setBlendMode("alpha", "premultiplied") now does the same thing.) - * Removed Canvas:getPixel (use Canvas:newImageData instead.) - * Removed Canvas:clear (use love.graphics.clear instead.) - * Removed Mesh:getVertices. - * Removed Mesh:setVertexColors and Mesh:hasVertexColors (use Mesh:setAttributeEnabled("VertexColor", enable) instead.) - * Removed functions deprecated in LOVE 0.9.1 and 0.9.2: - * Removed love.graphics.getMaxImageSize and love.graphics.getMaxPointSize (replaced by love.graphics.getSystemLimits.) - * Removed Mesh:set/getImage, SpriteBatch:set/getImage, and ParticleSystem:set/getImage (replaced by set/getTexture.) - * Removed SpriteBatch:bind/unbind. - * Removed Canvas:getFSAA and the "fsaa" flag in love.conf and love.window.setMode (replaced by Canvas:getMSAA and "msaa".) - * Removed the "dxt" and "bc5" Graphics Feature constant (replaced by love.graphics.getCompressedImageFormats.) - * Removed the "hdrcanvas" Graphics Feature constant (replaced by love.graphics.getCanvasFormats.) - * Removed love.window.getWidth/getHeight/getDimensions (use love.graphics.getWidth/getHeight/getDimensions or love.window.getMode instead.) - - * Fixed utf8.char. - * Fixed detection of fused love games. - * Fixed World:getCallbacks and World:getContactFilter when used in coroutines. - * Fixed crashes when objects which store Lua callback functions are garbage collected after being used in coroutines. - * Fixed memory leaks in love.physics if World:destroy is never called. When a World is GCed it now destroys all objects it owns. - * Fixed love.keyboard.getKeyFromScancode crashing when an invalid scancode is given. - * Fixed decoding of 8-bit WAV files. - * Fixed a crash issue when rewinding streaming ogg Sources, when certain versions of libvorbis are used. - * Fixed love.audio.stop() not rewinding streaming Sources. - * Fixed the stencil buffer in Canvases when an unsupported MSAA value is used to create the Canvas. - * Fixed Canvas:renderTo to restore the previous Canvas if an error occurs in the passed function. - * Fixed love.graphics.draw(canvas) to cause an error if that Canvas is the active one. - * Fixed Mesh:getVertexMap to return nil rather than an empty table, if no vertex map has been set. - * Fixed love.graphics.getColorMask. - * Fixed the default offset for particles when ParticleSystem:setQuads or ParticleSystem:setTexture is used. - * Fixed love.graphics.shear resetting all love.graphics transformations. - * Fixed the "add" and "subtract" blend modes to no longer modify the alpha of the Canvas / screen. - - * Improved the performance of World:rayCast and World:queryBoundingBox. - * Improved the performance of love.graphics.line and other line drawing functions, when the "smooth" LineStyle is used. - * Improved the performance of Shader:send when matrices are used. - * Improved the performance of ImageData and SoundData methods when LuaJIT's JIT compiler is enabled, by using efficient FFI code. - * Improved the performance of love.math.noise, love.math.gammaToLinear, love.math.linearToGamma, love.math.random, and RandomGenerator:random when LuaJIT's JIT compiler is enabled. - - * Updated the compatibility warning notice to use a message box and to show the version specified in love.conf. - * Updated the compatibility warning notice to display before main.lua is loaded. - * Updated the __tostring metamethod of love objects to output the pointer value, similar to tostring(table). - * Updated World:setCallbacks, World:setContactFilter, World:queryBoundingBox, and World:rayCast to have improved argument type checking. - * Updated threads to load love.filesystem automatically. - * Updated love.filesystem to enable symlinks by default. - * Updated love.math.setRandomSeed and RandomGenerator:setSeed to produce better results for the first few random() calls. - * Updated love.math.random and RandomGenerator:random to produce slightly better results in general. - * Updated Source methods that deal with spatial audio to error rather than failing silently if the Source isn't mono. - * Updated the 3D and 4D variants of love.math.noise to use Perlin noise rather than Simplex noise, to avoid patent issues. - * Updated ImageFonts to no longer treat separator pixels as spacing. - * Updated the default font to use less memory. - * Updated the behavior of text wrapping with love.graphics.printf and Font:getWrap to work better. - * Updated love.graphics.print and love.graphics.printf to no longer automatically round the x and y position arguments. - * Updated some error messages for love.graphics.newImage to be more descriptive. - * Updated love.graphics color functions to automatically apply love.math.gammaToLinear to color values when gamma-correct rendering is enabled. - * Updated the 'normal' Canvas format to internally use 'srgb' rather than 'rgba8' when gamma-correct rendering is enabled. - * Updated love.graphics.setColor to affect all drawn objects, including ParticleSystems, SpriteBatches, and Meshes. - * Updated the default fullscreen type to be "desktop" rather than "exclusive". - * Updated the minimum runtime system requirements of LOVE to require OpenGL 2.1 or OpenGL ES 2 support. - * Updated the pixel shader effect function so screen_coords.y is 0 at the top of the screen instead of the bottom. - * Updated Images to require setting the mipmaps flag to true on creation in order to use mipmaps. - * Updated Images to allow mipmaps for non-power-of-two sizes. - -LOVE 0.9.2 [Baby Inspector] ---------------------------- - - Released: 2015-02-14 - - * Added Lua 5.3's UTF-8 module (via utf8 = require("utf8")). - * Added Shader:getExternVariable. - * Added several new canvas texture formats. - * Added love.graphics.getCanvasFormats. - * Added love.graphics.getCompressedImageFormats. - * Added ParticleSystem:setQuads. - * Added ParticleSystem:setLinearDamping. - * Added SpriteBatch:flush. - * Added love.graphics.getStats. - * Added "mirroredrepeat" wrap mode. - * Added love.audio.setDopplerScale and love.audio.getDopplerScale. - * Added optional duration argument to Joystick:setVibration. - * Added love.joystick.loadGamepadMappings and love.joystick.saveGamepadMappings. - * Added Joint:setUserData and Joint:getUserData. - * Added Joint:getBodies. - * Added GearJoint:getJoints. - * Added Contact:getFixtures and Body:getContactList. - * Added Body:getWorld. - * Added Body:getJointList. - * Added Body/Contact/Fixture/Joint/World:isDestroyed. - * Added love.mousemoved event callback. - * Added love.mouse.setRelativeMode and love.mouse.getRelativeMode. - * Added Scancode enums, love.keyboard.getKeyFromScancode, and love.keyboard.getScancodeFromKey. - * Added love.window.getDisplayName. - * Added love.window.minimize. - * Added love.window.showMessageBox. - * Added 'refreshrate' field to the table returned by love.window.getMode. - * Added love.window.toPixels and love.window.fromPixels. - * Added love.window.setPosition and love.window.getPosition, and 'x' and 'y' fields to love.window.setMode and t.window in love.conf. - * Added love.filesystem.isSymlink, love.filesystem.setSymlinksEnabled, and love.filesystem.areSymlinksEnabled. - * Added love.filesystem.getRealDirectory. - - * Deprecated SpriteBatch:bind and SpriteBatch:unbind. - * Deprecated all uses of the name 'FSAA' in favor of 'MSAA'. - * Deprecated the 'hdrcanvas' graphics feature enum in favor of getCanvasFormats. - * Deprecated the 'dxt' and 'bc5' graphics feature enums in favor of getCompressedImageFormats. - - * Fixed crashes when love objects are used in multiple threads. - * Fixed love.filesystem.setIdentity breaking in some situations when called multiple times. - * Fixed the default love.filesystem identity when in Fused mode in Windows. - * Fixed love.system.openURL sometimes blocking indefinitely on Linux. - * Fixed love.joystick.setGamepadMapping. - * Fixed the order of vertices in ChainShapes. - * Fixed love.mouse.getPosition returning outdated values if love.mouse.setPosition is used in the same frame. - * Fixed love.graphics.newFont to error when given an invalid size argument. - * Fixed the filename and backtrace given when love.graphics.print errors. - * Fixed a small memory leak if love.graphics.newCanvas errors. - * Fixed shader:getWarnings returning unnecessary information. - * Fixed some cases of noncompliant shader code not properly erroring on some nvidia drivers. - * Fixed a potential crash when Shader objects are garbage collected. - * Fixed a potential small memory leak triggered when love.graphics.newShader errors. - * Fixed love.graphics.newMesh(vertexcount, ...) causing the Mesh to do instanced rendering. - * Fixed Mesh:getVertexMap. - * Fixed Image:refresh generating mipmaps multiple times if mipmap filtering is enabled. - * Fixed Image:setMipmapFilter to not keep bad state around if it errors. - * Fixed Mesh:setDrawRange when the Mesh has a vertex map set. - * Fixed internal detection of the 'position' and 'effect' shader functions. - * Fixed Texture memory leak when Meshes are garbage collected. - * Fixed the default line join mode to be 'miter' instead of an undefined value. - * Fixed the default error handler text size when highdpi mode is enabled on a Retina monitor. - * Fixed the default error handler background color when sRGB mode is enabled for the window. - * Fixed love.window.setMode to fall back to the largest available mode if a width or height greater than the largest supported is specified and fullscreen is used. - * Fixed the state of wireframe mode when love.window.setMode is called. - * Fixed Canvas:getPixel to error if the coordinates are not within the Canvas' size. - * Fixed detection of compressed textures to work regardless of the file's extension. - - * Renamed all cases of FSAA to MSAA. The FSAA names still exist for backward-compatibility. - - * Updated the Windows executable to automatically prefer the higher performance GPU on nvidia Optimus systems. - * Updated the --console command-line argument in Windows to open the console before conf.lua is loaded. - * Updated t.console and the --console command-line argument in Windows to use the existing Console window, if love was launched from one. - * Updated the love executable to verify that the love library's version matches. - * Updated the Lua wrapper code for modules to avoid crashes when the module's instance is created, deleted, and recreated. - * Updated internal code for handling garbage collection of love objects to be more efficient. - * Updated love's initialization code to trigger a Lua error if love.conf has an error in it. - * Updated the paths returned by love.filesystem.getSaveDirectory and friends to strip double-slashes from the string. - * Updated the error message when love.filesystem.write or File:open fails because the directory doesn't exist. - * Updated the error message when love.math.setRandomseed(0) is attempted. - * Updated the error message when invalid UTF-8 strings are used in love functions that expect UTF-8. - * Updated love.physics.newPolygonShape and love.physics.newChainShape to accept a table of vertices. - * Updated love.physics.newChainShape to error if the number of arguments is invalid. - * Updated love.thread.newThread to accept a literal string of code directly. - * Updated love-created threads to use names visible in external debuggers. - * Updated SpriteBatch:unbind to use less VRAM if the SpriteBatch has the static usage hint. - * Updated love.graphics.newImage, love.image.newImageData, etc. to leave less Lua-owned memory around. - * Updated love.graphics.push to accept different stack types to push. Current types are "transform" and "all". - * Updated love shaders to accept GLSL ES precision qualifiers on variables, although they do nothing. - * Updated the error message for love.graphics.newShader to be less cryptic if an invalid filename is given. - * Updated compressed texture loading code to allow BC6 and BC7 compressed textures (if the graphics driver supports them.) - -LOVE 0.9.1 [Baby Inspector] ---------------------------- - - Released: 2014-04-01 - - * Added Source:clone. - * Added blend mode "screen". - * Added ParticleSystem:clone. - * Added ParticleSystem:moveTo, has smoother emitter movement compared to setPosition. - * Added ParticleSystem:setRelativeRotation. - * Added love.graphics.setWireframe for debugging. - * Added Mesh:setDrawRange and Mesh:getDrawRange. - * Added CircleShape:getPoint and CircleShape:setPoint. - * Added Mesh/SpriteBatch/ParticleSystem:setTexture, accepts Canvases and Images. - * Added high-dpi window support for Retina displays in OS X, via the 'highdpi' window flag. - * Added love.window.getPixelScale. - * Added love.graphics.getSystemLimit. - * Added antialiasing support to Canvases. - * Added Canvas:getFSAA. - * Added 'love_ScreenSize' built-in variable in shaders. - * Added love.getVersion. - * Added support for gamma-correct rendering. - * Added love.graphics.isSupported("srgb"). - * Added love.math.gammaToLinear and love.math.linearToGamma. - * Added RandomGenerator:getState and RandomGenerator:setState. - * Added Body:setUserData and Body:getUserData. - * Added some missing obscure key constants. - * Added optional callback function argument to love.filesystem.getDirectoryItems. - * Added love.system.openURL. - - * Deprecated Mesh/SpriteBatch/ParticleSystem:setImage. - * Deprecated love.graphics.getMaxImageSize and love.graphics.getMaxPointSize. - - * Fixed love.graphics.scale with negative values causing incorrect line widths. - * Fixed Joystick:isDown using 0-based button index arguments. - * Fixed Source:setPitch to error when infinity or NaN is given. - * Fixed love.graphics.setCanvas() to restore the proper viewport and scissor rectangles. - * Fixed TrueType font glyphs which request a monochrome bitmap pixel mode. - * Fixed love.graphics.reset causing crashes when called in between love.graphics.push/pop. - * Fixed tab characters ("\t") to display properly with love.graphics.print. - * Fixed love.graphics.isCreated to return false when love.window.setMode fails completely. - * Fixed love.window.setMode to not destroy OpenGL resources before checking whether a fullsceren size is supported. - * Fixed World:getBodyList and World:getJointList causing hard crashes. - * Fixed loading BC4 compressed textures. - * Fixed SoundData objects being initialized with garbage values. - * Fixed 8-bit SoundData samples when used in love.audio Sources. - - * Updated the error text for love.filesystem’s module searchers when require fails. - * Updated the love.filesystem module searchers to be tried after package.preload instead of before. - * Updated love.graphics.newParticleSystem, newSpriteBatch, and newMesh to accept Canvases. - * Updated Canvas drawing code, texture coordinates are no longer flipped vertically. - * Updated Canvas:renderTo to work properly if a Canvas is currently active. - * Updated ParticleSystem:setEmissionRate to accept non-integer numbers. - * Updated Source:play to return a boolean indicating success. - * Updated t.console in conf.lua to create the console before modules are loaded in Windows. - * Updated Mesh vertex maps (index buffers) to use less space in VRAM. - * Updated love.graphics.newMesh and Mesh:setVertices to default the UV parameters to 0,0. - * Updated Fixture:set/getUserData to work in Coroutines. - * Updated fullscreen-desktop and resizable window modes in OS X to use Mac OS 10.7's fullscreen Spaces. - * Updated love.filesystem's C library loader to look in paths added via love.filesystem.mount, in Fused mode. - * Updated the default love.run code to make initial love.math.random calls more random. - -LOVE 0.9.0 [Baby Inspector] ---------------------------- - - Released: 2013-12-13 - - * Added better multiplayer networking support via ENet. - * Added --fused command line argument, to simulate fusing. - * Added liblove. - * Added the ability to have exit values. - * Added exit value of 1 in case of error by default. - * Added basic support for the file:// uri scheme. - * Added love.filesystem.isFused. - * Added love.filesystem.getIdentity. - * Added love.filesystem.append. - * Added love.filesystem.getSize. - * Added love.filesystem.mount and love.filesystem.unmount. - * Added optional file search order parameter to love.filesystem.setIdentity. - * Added File:isOpen and File:getMode. - * Added Fie:setBuffer, File:getBuffer, and File:flush. - * Added textinput event for unicode text input. - * Added love.keyboard.setTextInput and love.keyboard.hasTextInput. - * Added previously internal Rasterizer and GlyphData object methods. - * Added support for UTF-8 ImageFonts. - * Added Font:getAscent/getDescent/getBaseline. - * Added Font:setFilter/getFilter. - * Added Font:hasGlyphs. - * Added angle, scale, and shear parameters to love.graphics.printf. - * Added HDR canvas support. - * Added mipmapping support (has isSupported test). - * Added vertex shader support. - * Added boolean support to Shader:send. - * Added Canvas:getPixel. - * Added blend mode "replace". - * Added line join modes. - * Added Mesh objects, allowing for arbitrary textured polygons. - * Added multiple render target support to love.graphics.setCanvas. - * Added love.graphics.setColorMask. - * Added love.graphics.origin. - * Added love.graphics.getRendererInfo. - * Added love.graphics.getMaxImageSize. - * Added SpriteBatch:getCount and SpriteBatch:getBufferSize. - * Added SpriteBatch:getColor. - * Added ParticleSystem:emit. - * Added ParticleSystem:setInsertMode and ParticleSystem:getInsertMode. - * Added many ParticleSystem getter methods. - * Added DXT compressed texture support via love.image.newCompressedData. - * Added love.image.isCompressed and Image:isCompressed. - * Added Image/Canvas/ImageData:getDimensions. - * Added anisotropic filtering support for Images, Canvases, and Fonts. - * Added Image:refresh. - * Added Image:getData. - * Added SoundData:getDuration and SoundData:getSampleCount. - * Added Source:isPlaying. - * Added Source:setRelative and Source:isRelative. - * Added Source:setCone and Source:getCone. - * Added Source:getChannels. - * Added new Channels API for love.thread. - * Added limited table support to Channel:push. - * Added Thread:getError. - * Added Thread:isRunning. - * Added threaderror event. - * Added love.math module. - * Added a platform-independent (good) random implementation to love.math. - * Added RandomGenerator objects. - * Added BezierCurve objects. - * Added love.math.triangulate and love.math.isConvex. - * Added love.math.noise. - * Added love.timer.getAverageDelta. - * Added Data:getString. - * Added Contact:getChildren. - * Added love.system module. - * Added love.system.getClipboardText and love.system.setClipboardText. - * Added love.system.getOS and love.system.getProcessorCount. - * Added love.window module. - * Added love.window.isVisible. - * Added flags to love.window.setMode. - * Added monitor choosing support to love.window.setMode. - * Added support for resizable, borderless, and non-centered windows. - * Added support for "fullscreen-desktop" mode. - * Added window resize and visible events. - * Added love.window.getDimensions. - * Added love.window.getIcon. - * Added t.window.icon to love.conf. - * Added love.mousefocus and love.window.hasMouseFocus. - * Added custom hardware cursors via love.mouse.newCursor. - * Added love.mouse.setX/setY. - * Added Joystick objects. - * Added love.joystick.getJoystick. - * Added joystick connect and disconnect events. - * Added joystickaxis and joystickhat events. - * Added unified Gamepad API for joysticks which have a similar layout to the Xbox controller. - * Added joystick vibration support, works with most common gamepads. - * OPTIONAL: Added support for Game Music Emu. - - * Fixed fused mode in OS X. - * Fixed printing to the console in Windows before love.load is called. - * Fixed the default love.run to not include the time taken by love.load in the first frame's dt. - * Fixed the error screen not always appearing until the next input event. - * Fixed love.event.clear. - * Fixed love.mouse.setPosition when called in love.load. - * Fixed scaling in several love.physics functions. - * Fixed Box2D exception in World:update. - * Fixed many uncaught Box2D / love.physics exceptions for Bodies and Joints. - * Fixed ChainShape:getPoints running out of Lua stack space and crashing. - * Fixed File:read reading past end of file. - * Fixed love.filesystem.setIdentity not removing read access from old directories. - * Fixed possible memory leak in utf-8 decoder. - * Fixed spacing for the last character in an ImageFont. - * Fixed line wrapping in love.graphics.printf. - * Fixed love.graphics.printf to error if the wrap limit is negative. - * Fixed love.graphics.print truncating strings with embedded zeros. - * Fixed crashes with font drawing on some ATI cards. - * Fixed artifacts when drawing lines at huge scale. - * Fixed Fonts and Canvases ignoring default image filter. - * Fixed scissor boxes when a canvas is set after love.graphics.setScissor is called. - * Fixed love.graphics.getLineWidth returning incorrect values. - * Fixed love.graphics.getColor on some Windows systems. - * Fixed alpha blend mode. - * Fixed multiplicative blend mode. - * Fixed love.graphics.getPointStyle. - * Fixed line numbers in shader errors. - * Fixed Shader:send with Images and Canvases failing sometimes. - * Fixed Shader:send to keep a reference to sent Images and Canvases. - * Fixed crash when binding SpriteBatches multiple times. - * Fixed SpriteBatches with more than 16,384 sprites. - * Fixed particle draw order for ParticleSystems. - * Fixed ParticleSystem:setSizes resetting the size variation. - * Fixed the graphics viewport not matching the window size when using an unsupported fullscreen mode. - * Fixed getMode and friends returning wrong values when using desktop size. - * Fixed keyrepeat settings being lost after (indirect) setMode. - * Fixed the icon being reset after setMode. - * Fixed memory leak in the mp3 decoder. - * Fixed sound issues with some versions of OpenAL soft, by enabling direct channels. - * Fixed 'random' hangs in audio. - * Fixed love.sound.newDecoder not accepting FileData. - * Fixed case (in)sensitivity of sound file extension parsing. - * Fixed looping support in tracker music formats. - * Fixed skipping/looping issues when playing streaming audio Sources. - * Fixed race condition in Source:play. - * Fixed WAVE sound playback. - - * Moved love's startup to modules/love. - * Moved window-related functions from love.graphics to love.window. - - * Renamed love's boot script to 'love.boot', which can be required. - * Renamed love.filesystem.mkdir to love.filesystem.createDirectory. - * Renamed love.filesystem.enumerate to love.filesystem.getDirectoryItems. - * Renamed World:setAllowSleeping to World:setSleepingAllowed. - * Renamed ChainShape:setPrevVertex to ChainShape:setPreviousVertex. - * Renamed Joint:enableMotor to Joint:setMotorEnabled. - * Renamed Joint:enableLimit and Joint:isLimitEnabled to Joint:setLimitsEnabled and Joint:hasLimitsEnabled. - * Renamed t.screen to t.window in love.conf. - * Renamed love.graphics.setCaption to love.window.setTitle. - * Renamed PixelEffect to Shader (but now with vertex shaders). - * Renamed love.graphics.setDefaultImageFilter to love.graphics.setDefaultFilter. - * Renamed ParticleSystem:setSprite to ParticleSystem:setImage. - * Renamed ParticleSystem:setGravity to ParticleSystem:setLinearAcceleration. - * Renamed ParticleSystem:setLifetime/setParticleLife to setEmitter/ParticleLifetime. - * Renamed ParticleSystem:count and all getNum* functions to get*Count. - * Renamed Source:setDistance to Source:setAttenuationDistances. - * Renamed SoundData:getBits and Decoder:getBits to SoundData:getBitDepth and Decoder:getBitDepth. - * Renamed love.mouse.setGrab to love.mouse.setGrabbed. - - * Removed release mode. - * Removed love.keyboard.getKeyRepeat (see love.keyboard.hasKeyRepeat). - * Removed the unicode argument from love.keypressed (see love.textinput). - * Removed love.graphics.drawTest. - * Removed love.graphics.quad/triangle. - * Removed love.graphics.setColorMode. - * Removed love.graphics.newStencil. - * Removed love.graphics.setLine/setPoint. - * Removed love.graphics.drawq (functionality is merged into love.graphics.draw). - * Removed SpriteBatch:addq/setq (functionality is merged into SpriteBatch:add/set). - * Removed Quad:flip. - * Removed ParticleSystem:isFull/isEmpty. - * Removed ParticleSystem:getX/getY. - * Removed love.graphics.checkMode. - * Removed love.joystick.open and friends. - * Removed love.joystick module functions which operated on individual joysticks (see Joystick objects). - * Removed joystick ball support. - * Removed thread names. - * Removed old thread messaging API (see Channels). - * Removed love.timer.getMicroTime. - - * Updated functions which return love objects to re-use the Lua-side object instead of always recreating it. - * Updated the windows console, it now tries to re-use an active one first. - * Updated error handling, error handlers now get resolved when the error occurs. - * Updated order of sleep/present in love.run (now draws, *then* sleeps). - * Updated love.filesystem to try to create the appdata directory if it doesn't exist yet. - * Updated the default filesystem identity to omit file extension. - * Updated love.filesystem.newFile to optionally open the file. - * Updated most love.filesystem functions to return nil, error on internal failure. - * Updated love.keyboard.setKeyRepeat to take a boolean argument instead of numbers. - * Updated love.keypressed's second argument to be a boolean indicating key repeat. - * Updated keyboard key constants for some more modern keyboard keys. - * Updated window code to use adaptive vsync when available, if vsync is enabled. - * updated love.graphics.print's x and y arguments to default to 0. - * Updated the setFilter and setWrap methods, the second argument is now optional. - * Updated Font and ParticleSystem rendering code, now more performant. - * Updated SpriteBatch code, now more performant when adding/setting and (un)binding. - * Updated Canvas code to support more systems. - * Updated Canvas:getImageData and love.graphics.newScreenshot to be more efficient. - * Updated love.graphics.newScreenshot to create a fully opaque image by default. - * Updated error messages when sending bad values to Shaders. - * Updated love.graphics.newParticleSystem to have a default buffer size of 1000. - * Updated ImageData:setPixel to accept a table and default to 255 alpha. - * Updated ImageData:mapPixel, is now more efficient and accepts optional x,y,w,h arguments. - * Updated love.image memory handling, improves errors and thread-safety. - * Updated all love object constructors to optionally accept FileData if they accept a filename. - * Updated allocation for SoundData, it's more efficient and less wasteful. - * Updated SoundData:set/getSample to error for invalid samples. - * Updated Source:set* functions to default z to 0. - * Updated Source:seek to error for negative offsets. - * Updated Thread:start to accept arguments which get passed to the thread. - * Updated love.timer.getFPS to be microsecond-accurate. - * Updated love.timer.getTime to be microsecond-accurate and monotonic. - * Updated Box2D to version 2.3.0. - -LOVE 0.8.0 [Rubber Piggy] -------------------------- - - Released: 2012-04-02 - - * Added release error screen. - * Added alpha to love.graphics.setBackgroundColor. - * Added Canvas:clear(r, g, b, a). - * Added Canvas support to love.graphics.drawq. - * Added Canvas:getWidth and Canvas:getHeight. - * Added love.graphics.arc. - * Added seek and tell to Source objects. - * Added color interpolation to ParticleSystem. - * Added automatic PO2 padding for systems not supporting the OpenGL extension. - * Added UTF-8 support for fonts. - * Added Box2D error handling for some commonly failing functions. - * Added ability for fused release games to have their write dir in appdata. - * Added shear transformation to drawing functions. - * Added origin to font printing. - * Added love.graphics.getMode. - * Added per-sprite colors on SpriteBatches. - * Added PixelEffects. - * Added love.graphics.isSupported. - * Added love.graphics.getCanvas. - * Added love.event.quit. - * Added stencil masks. - * Added alternative SpriteBatch provider, it should work everywhere now. - * Added a loader for binary modules. - * Added Thread:getKeys. - * Added option of fractions for Quads. - * Added PNG, JPEG and GIF support to ImageData:encode. - * Added 64-bit support for Mac OS X. - * Added premultiplied blending mode. - * Added functions to set/get default image filter modes. - * Added SpriteBatch:set. - * Added new events system, with support for custom events and long event names. - * Added sound attenuation by distance. - * Added SpriteBatch:getImage. - * Added combine color mode. - * Added automatic random seeding to love.run. - * Added support for the subtract BlendMode on older graphics cards. - * Added love._os field, which contains the OS the game is running on. - - * Fixed wrapping for single words. - * Fixed tracebacks not showing filenames. - * Fixed love.graphics.push/pop capable of causing overflows/underflows. - * Fixed setScissor on Canvases. - * Fixed several issues with audio, e.g. clicks and pops in mp3s. - * Fixed crashes when bodies were destroyed during collisions. - * Fixed bound SpriteBatches corrupting when drawing. - * Fixed thread-safety issues with ImageData. - * Fixed memory leaks in audio sources. - * Fixed thread's set (previously send) accidentally changing the type. - * Fixed SoundData allocating the wrong number of samples. - * Fixed SpriteBatch support on Intel cards. - * Fixed love.filesystem.lines() leaking. - * Fixed most leaking on unclosed File objects. - * Fixed crashes when operating on non-existent files. - * Fixed a bug where empty files on windows would never reach eof. - * Fixed crash when SoundData runs out of memory. - * Fixed ordering of loaders, love should have priority over lua. - * Fixed several miscellaneous memory leaks. - * Fixed a few cases where strings with \0 in them would not be stored correctly. - * Fixed love's startup time being in the first dt. - * Fixed internal string conversions, they are faster now. - * Fixed (bad) performance of ImageData:paste. - * Fixed love.graphics.toggleFullscreen not maintaining graphics state. - - * Renamed SpriteBatch's lock/unlock to bind/unbind. - * Renamed Framebuffer to Canvas. - * Renamed love.thread.send/receive to set/get. - * Renamed love.graphics.setRenderTarget to setCanvas. - - * Removed canvas auto-clearing. - * Removed EncodedImageData. - * Removed old syntax for require (with extension). - * Removed love.graphics.setFont([file], [size]). - * Removed Thread:kill. - - * Updated love.joystick to be 1-indexed. - * Updated Sources to update more cleanly and control more intuitively. - * Updated font engine. - * Updated line drawing to a custom system. - * Updated love.timer.sleep to use seconds, like the rest of love. - * Updated love.timer to be more accurate. - * Updated love.graphics.circle to have max(10, r) as default for segments. - * Updated ImageData:encode to write to files directly. - * Updated version compatibility system to actually do something. - * Updated love.run's order, events are checked just before update. - * Updated Box2D to version 2.2.1. - -LOVE 0.7.2 [Game Slave] ------------------------ - - Released: 2011-05-04 - - * Added Framebuffer:get/setWrap. - * Added love.event.clear. - * Added support for any number of arguments to love.keyboard.isDown, love.mouse.isDown and love.joystick.isDown. - * Added SpriteBatch:setImage(). - - * Fixed fused games not working. - * Fixed ParticleSystem:setSize ignoring the variation argument. - * Fixed some file-opening exceptions not being caught. - * Fixed files loaded by libmodplug being too loud. - * Fixed paths with periods in them not working. - * Fixed love.graphics.getBlendMode not detecting subtractive and multiplicative blend modes. - * Fixed crash when there was no memory available for newImageData(w, h). - - * Updated PhysicsFS version to 2.0.2 on Windows - * Updated OpenAL Soft version to 1.13 on Windows - * Updated libmodplug version to 0.8.8.1 on Windows - * Updated FreeType version to 2.4.4 on Windows - * Updated libmpg123 version to 1.13.2 on Windows - * Windows binary no longer depends on VC2005 runtime. - * Windows binary no longer depends on SSE2 support. - -LOVE 0.7.1 [Game Slave] ------------------------ - - Released: 2011-02-14 - - * Added source:isPaused() - * Added error when initial window can't be created. - * Added framebuffer filter modes. - * Added love.filesystem.getLastModified. - * Added filter modes for ImageFonts. - * Added dead key support by using "unknown" key with correct unicode value. - * Added 0 width and height in love.conf. (for current desktop resolution) - * Added alpha support when encoding TGA images. - - * Fixed a lot of bugs regarding zero characters in threads. - * Fixed handling of a directory named "love" in current directory. - * Fixed a few unhandled errors in setScissor. - * Fixed a bug where old physics callbacks were never dereferenced. - * Fixed loss of mouse visibility settings on setMode. - * Fixed creation of a framebuffer unbinding current framebuffer. - * Fixed several race conditions in love.thread. - * Fixed 'love .', so it won't use lovedir/. as save dir. - * Fixed setLineHeight. - * Fixed extended ascii and ImageFonts. - * Fixed printf's line wrapping. - * Fixed crash when playing sounds. - * Fixed playback of mp3s with arbitrary sample rates. - * Fixed handling of negative indices in love.joystick. - * Fixed toggleFullscreen. - * Fixed unexpected behaviour with hash tables to love.graphics.line. - * Fixed mouse coordinates being capped after setMode. - * Fixed setFont's error handling on a non-existant file. - * Fixed issue where Windows builds would hard crash on Lua errors - - * Removed custom sample rates for Decoders. - -LOVE 0.7.0 [Game Slave] ------------------------ - - Released: 2010-12-05 - - * Added love.thread. - * Added love.font. - * Added love.graphics.Framebuffer. - * Added Source:play, Source:pause, etc. - * Added Source:isStatic(). - * Added get/setPosition, get/setVelocity, and get/setDirection to Source. - * Added get/setGroupIndex to CircleShape and PolygonShape. - * Added Font:getWrap. - * Added identity field to love.conf. - * Added love.quit callback. - * Added love.focus callback. - * Added extra meter parameter to love.physics.newWorld. - * Added love.graphics.setIcon. - * Added way to make the window desktop resolution. - * Added subtractive and multiplicative blend modes. - * Added body:getAllowSleeping. - * Added shape:getBody. - * Added love.filesystem.FileData for public usage. - * Added base64 support for love.filesystem.FileData. - * Added table support for love.graphics.setColor and love.graphics.setBackgroundColor. - * Added love.graphics.hasFocus(). - * Added ?/init.lua to the loader. - - * Fixed the debug module not being an upvalue of the error handlers. (you can now override debug) - * Fixed some cases when love.audio.pause and friends, were acting on everything, not just the passed Source. - * Fixed setFixedRotation enabling other flags. - * Fixed a bug in the loader (for require). - * Fixed ParticleSystem::setSprite not retaining the new image. - * Fixed setMode removing images settings (wrapping, filters). - * Fixed shape:getBody, it's now exposed for LÖVE usage. - * Fixed DistanceJoint:getType() returning "circle" - it now returns "distance". - * Fixed SpriteBatches being unaffected by setColor - * Fixed the audio bug. - * Fixed invalid FSAA values crashing LÖVE. - * Fixed a bunch of compiler warnings. - * Fixed OS X not properly using UTIs for .love files. - * Fixed the modplug decoder not properly handeling files that fail to load. - * Fixed a memory leak in setFont. - * Fixed bug where errors in threads wouldn't get picked up by demand. - * Fixed part of the bug with newlines when scaling text (rotating still messes up the lines). - * Fixed the bug where newImageFont would try to created ImageData out of ImageData. - * Fixed error handler not resetting the blend mode. - - * Changed fonts, they're now po2 safe. - * Changed the traceback in the error screen. - * Changed font origin to top-left. - * Changed linux save dir location to obey to Freedesktop.org's XDG specs. (~/.local/share/love by default.) - - * Removed font functions from love.graphics. - * Removed love.physics.newWorld(w, h). Use love.physics.newWorld(x1, y1, x2, y2) instead. - -LOVE 0.6.2 [Jiggly Juice] -------------------------- - - Released: 2010-03-06 - - * Fixed a bug causing ImageFonts to cut off some pixels. - * Fixed a bug where filled rectangles were too small. - * Fixed a bug in Image:setFilter where it would switch the parameters. - * Fixed a bug in ImageRasterizer where it wasn't using the data. - * Image filter and wrap modes now use string constants as well. - * Fixed double-transform bug in SpriteBatch. - * Errors are reported on stdout again. - * Another fix for the icons on ubuntu. - -LOVE 0.6.1 [Jiggly Juice] -------------------------- - - Released: 2010-02-07 - - * Added Shape:setGroupIndex and getGroupIndex. - * Added Body:setFixedRotation and Body:getFixedRotation. - * Added Body:setInertia. - * Added CircleShape:getLocalCenter and CircleShape:getWorldCenter. - * Added icons and file associations for the debs. - * Added the demos folder to the Mac OS X DMG. - * It's now possible to run a .love from Resources in Mac OS X, thanks to Steve Johnson. - * Fixed a bug with multiple Sources on the same Music. - * Fixed a bug so the mouse doesn't get crippled when the keyboard is disabled. - * Fixed a bug where love.graphics.rectangle drew a too large rectangle. - * Fixed a bug where memory wouldn't be released correctly. - * Fixed epic physics typo (getRestituion->getRestitution). - * Fixed crash on opening non-existent image. - * The error screen redraws when an event occurs. - * The default love.run() now gracefully handles disabled modules. - * The debian packages should now successfully include icons, file associations, etc, and should give the correct architecture. - * Added support for drawing polylines to love.graphics.line - the syntax is the same as love.graphics.polygon. - * Removed Music and Sound. There are now only sources. - * Improved the stability of love.audio/love.sound. - -LOVE 0.6.0 [Jiggly Juice] -------------------------- - - Released: 2009-12-24 - - * Lost track of 0.6.0 changes a long while ago. Don't trust the list below. - - * Added love.graphics.print()/printf(). - * Added unicode-translated parameter to love.keypressed(). - * Added love.event. - * Added love.filesystem.setIdentity(). - * Added OpenAL dependency. - - * Fixed love.fileystem problems with internal \0 in strings. - * Fixed love.filesystem.mkdir/remove not working when write directory not set. - * Fixed position of Window. - - * Changed parameter order of draws(). - * Changed origin for images to top-left. - * Changed love.filesystem.open to accept mode (removed from love.filesystem.newFile). - * Changed love.filesystem.read() which now returns two parameters (data, length). - * Changed love.filesystem.write() which now takes up to four parameters (file, data, length, mode). - * Changed default color mode to "modulate". - * Changed name of love.color_normal to "replace". - * Changed name of love.blend_normal to "alpha". - * Changed the conf file format. - - * Removed Color object. - * Removed Animation. - * Removed several constants. - * Removed love.graphics.draw() for strings. - * Removed love.system. - * Removed SWIG. - * Removed boost. - * Removed SDL_mixer. - - -LOVE 0.5.0 [Salted Nuts] ------------------------- - - Released: 2009-01-02 - - * Added love.joystick. - * Added network support via LuaSocket. - * Added support for loading of appended .love-file. - - * Added love.filesystem.lines(). - * Added a loader function to enable use of normal require(). - * Added love.filesystem.load(). - * Added love.filesystem.getSaveDirectory() - * Added love.filesystem.getWorkingDirectory() - - * Added optional explicit destruction of Box2D objects. - * Added shape:testSegment(). - * Added love.graphics.screenshot() (.bmp only). - * Added default size (12) to font-related functions. - * Added love.graphics.setFont( filename, size ) - * Added love.graphics.setLineStippe and related functions. - * Added love.graphics.setPointSize and related functions. - - * Changed love.filesystem.read() to accept file name. - * Changed love.filesystem.write() to accept file name. - * Changed love.graphics.triangle() to accept CCW and CW ordering. - - * Fixed love.graphics.read adding bogus characters at the end of string. - * Fixed epic swigfusion bug. - * Fixed love.graphics.getFont so it returns nil if no font is present. - * Fixed bug where love.graphics.getBlendMode() always returns blend_normal. - * Fixed bug which caused error screen to be scissored (when enabled). - * Fixed Body:setAngle to accept degrees like everything else. - - * Cleaned up love::File and love_physfs. - * Cleaned up love::Reference so it stores its reference in _G. - -LOVE 0.4.0 [Taco Beam] ----------------------- - - Released: 2008-08-29 - - * Added love.physics. (YES!) - * Added love.audio.setMode(). - * Added love.audio.setChannels(). - * Added love.graphics.polygon(). - * Added love.graphics.setScissor() and love.graphics.getScissor() to handle scissoring the graphical area. - * Fixed missing constants related to image optimization. - * Fixed memory leak related to love::File (thanks amnesiasoft!). - - -LOVE 0.3.2 [Lemony Fresh] -------------------------- - - Released: 2008-07-04 - - * Added love.graphics.rectangle() - * Added love.graphics.setLineWidth() - * Added love.graphics.setLineStyle() - * Added love.graphics.getLineWidth() - * Added love.graphics.getLineStyle() - * Added love.mouse.getPosition() - * Added love.audio_loop - * Added love.timer.getTime() - * Changed love.graphics.quad() to accept CCW and CW ordering. - * Fixed default color mode bug. - * Fixed line width being applied unnecessarily. - * Fixed line width bug related to fullscreen toggle. - * Fixed music not looping. - -LOVE 0.3.1 [Space Meat] ------------------------ - - Released: 2008-06-21 - - * Fixed segfault related to graphics. - * Fixed wait-forever bug related to audio. - * Fixed error reporting not working across modules. - * Fixed bug where games with a trailing "/" would not start. - * Fixed bug which caused love.timer.sleep to delay for (way) too long. - -LOVE 0.3.0 [Mutant Vermin] --------------------------- - - Released: 2008-06-17 - - * Added ParticleSystem. - * Added visual error reporting. - * Added love.system for game control needs. - * Added input grabbing. - * Added functions in love.graphics for display management. - * Added love.graphics.point(). - * Added functions in love.graphics for getting current color, font, etc. - * Added love.filesystem.enumerate() for getting folder contents. - * Added functions for setting the window caption. - * Added version checking. An error occurs if the game is incompatible. - * Fixed print() :) - * Removed all keyboard shortcuts. - * Save folders are now created only if required. - * On Windows, the new save location is %APPDATA%\LOVE\game - -LOVE 0.2.1 [Impending Doom] ---------------------------- - - Released: 2008-03-29 - - * Added many functions in love.filesystem. - * Added a dedicated save-folder for each game. - * Added timer.sleep. - * Added line heights to font objects. - * Added love.graphics.getWidth/getHeight. - * Added scaling and rotation for text. - * Added variable spacing to ImageFont. - * Added support for variable line quality when drawing primitives. - * Added several functions for drawing sections of images. (love.graphics.draws) - * Added image optimization function and padding function. - * Added love.graphics.getWidth/Height. - - * Split devices up into actual SWIG-modules. This means that: - - Functions are used like this: love.graphics.draw, not love.graphics:draw - - love.objects is no more. Objects are created by an appropriate device. - * How you draw primitives has been altered. - * draw(string, x, y, wrap, align) has become drawf(string, x, y, wrap, align) - - * Changed getFps to getFPS. - * Escape is no more ... enter: Alt+F4. - * love.filesystem.include has been renamed to love.filesystem.require. - * ImageFonts now consider the spacing as well as the glyph size. - * Fixed a massive ImageFont bug which resulted in float-positioning failure. - * Fixed a bug when loading fonts where the specified size doesn't represent the true size of the font. - - * Updated DevIL to version 1.6.8-rc2 (Windows) - * Updated FreeType to freetype-2.3.5-1 (Windows) - * Updated Lua to 5.1.3 (Windows) - * Updated SDL to 1.2.13 (Windows) - * Removed boost::filesystem. - -LOVE 0.2.0 [Mini-Moose] ------------------------ - - Released: 2008-02-06 - - * Added ImageFont - * Added Animation - * Added text formatting functions - * Added setCenter for Image and Animation. - * Added methods for rendering of scaled/rotated sprites. - * Added the drawing of basic shapes. - * Added default font and embedded resources. - * Added Ctrl+R for reload. - * Added blending and color modes. - * Fixed memory usage of Graphics. - * Fixed a bug where the set text color would change the color of any images rendered. - * Fixed CWD bug. - * Fixed titlebar. Game title is now displayed. - - -LOVE 0.1.1 [Santa-Power] ------------------------- - - Initial release! - Released: 2008-01-13 - - * Image loading and rendering. - * Sound loading and playing. - * Font loading and rendering. - * Lua-scriptable games. - * Config files. - * Stuff is loadable from archive files. - * Keyboard, mouse, display, timer, etc. (Basic devices). diff --git a/love/src/jni/love/extra/appveyor/appveyor.yml b/love/src/jni/love/extra/appveyor/appveyor.yml deleted file mode 100644 index e731ca61..00000000 --- a/love/src/jni/love/extra/appveyor/appveyor.yml +++ /dev/null @@ -1,51 +0,0 @@ -version: 11.2.{build} - -image: Visual Studio 2013 - -shallow_clone: true - -environment: - matrix: - - PLATFORM: x86 - VCVARSALL_PLATFORM: x86 - GENERATOR: "Visual Studio 12" - - PLATFORM: x64 - VCVARSALL_PLATFORM: x86_amd64 - GENERATOR: "Visual Studio 12 Win64" - -init: -# Make VS 2013 command line tools available -- call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" %VCVARSALL_PLATFORM% - -install: -# We need to install NSIS to create the packaged installer executable. -- choco install nsis-unicode -y - -# Move all woking directory items except `appveyor.yml` to `love` subdirectory. -- md love -- for /D %%i in (*) do @if "%%i" NEQ "love" @move %%i love\%%i -- for %%i in (*) do @if "%%i" NEQ "appveyor.yml" @move %%i love\%%i -# clone megasource and move into top directory. -- hg clone https://bitbucket.org/rude/megasource megasource -- cd megasource -- for /D %%i in (*) do @move %%i ..\%%i -- for %%i in (*) do @move %%i ..\%%i -- cd .. -# move love source to megasource's libs\love. -- move love libs\love - -before_build: -- cmake -G "%GENERATOR%" -H. -Bbuild - -build_script: -- cmake --build build --target PACKAGE --config Release - -after_build: - -before_test: - -test_script: - -artifacts: -- path: build\*.zip -- path: build\*.exe diff --git a/love/src/jni/love/extra/cmake/FindLuaJIT.cmake b/love/src/jni/love/extra/cmake/FindLuaJIT.cmake deleted file mode 100644 index 14b03b6c..00000000 --- a/love/src/jni/love/extra/cmake/FindLuaJIT.cmake +++ /dev/null @@ -1,25 +0,0 @@ -# Sets the following variables: -# -# LUAJIT_FOUND -# LUAJIT_INCLUDE_DIR -# LUAJIT_LIBRARY - -set(LUAJIT_SEARCH_PATHS - /usr/local - /usr - ) - -find_path(LUAJIT_INCLUDE_DIR - NAMES luajit.h - PATH_SUFFIXES include include/luajit-2.0 include/luajit-2.1 - PATHS ${LUAJIT_SEARCH_PATHS}) - -find_library(LUAJIT_LIBRARY - NAMES luajit-5.1 - PATH_SUFFIXES lib - PATHS ${LUAJIT_SEARCH_PATHS}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(LuaJIT DEFAULT_MSG LUAJIT_LIBRARY LUAJIT_INCLUDE_DIR) - -mark_as_advanced(LUAJIT_INCLUDE_DIR LUAJIT_LIBRARY) diff --git a/love/src/jni/love/extra/cmake/FindMPG123.cmake b/love/src/jni/love/extra/cmake/FindMPG123.cmake deleted file mode 100644 index 6cda993b..00000000 --- a/love/src/jni/love/extra/cmake/FindMPG123.cmake +++ /dev/null @@ -1,25 +0,0 @@ -# Sets the following variables: -# -# MPG123_FOUND -# MPG123_INCLUDE_DIR -# MPG123_LIBRARY - -set(MPG123_SEARCH_PATHS - /usr/local - /usr - ) - -find_path(MPG123_INCLUDE_DIR - NAMES mpg123.h - PATH_SUFFIXES include - PATHS ${MPG123_SEARCH_PATHS}) - -find_library(MPG123_LIBRARY - NAMES mpg123 - PATH_SUFFIXES lib - PATHS ${MPG123_SEARCH_PATHS}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(MPG123 DEFAULT_MSG MPG123_LIBRARY MPG123_INCLUDE_DIR) - -mark_as_advanced(MPG123_INCLUDE_DIR MPG123_LIBRARY) diff --git a/love/src/jni/love/extra/cmake/FindModPlug.cmake b/love/src/jni/love/extra/cmake/FindModPlug.cmake deleted file mode 100644 index 16641d3b..00000000 --- a/love/src/jni/love/extra/cmake/FindModPlug.cmake +++ /dev/null @@ -1,25 +0,0 @@ -# Sets the following variables: -# -# MODPLUG_FOUND -# MODPLUG_INCLUDE_DIR -# MODPLUG_LIBRARY - -set(MODPLUG_SEARCH_PATHS - /usr/local - /usr - ) - -find_path(MODPLUG_INCLUDE_DIR - NAMES libmodplug/modplug.h - PATH_SUFFIXES include - PATHS ${MODPLUG_SEARCH_PATHS}) - -find_library(MODPLUG_LIBRARY - NAMES modplug - PATH_SUFFIXES lib - PATHS ${MODPLUG_SEARCH_PATHS}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(ModPlug DEFAULT_MSG MODPLUG_LIBRARY MODPLUG_INCLUDE_DIR) - -mark_as_advanced(MODPLUG_INCLUDE_DIR MODPLUG_LIBRARY) diff --git a/love/src/jni/love/extra/cmake/FindOgg.cmake b/love/src/jni/love/extra/cmake/FindOgg.cmake deleted file mode 100644 index dc5d55f7..00000000 --- a/love/src/jni/love/extra/cmake/FindOgg.cmake +++ /dev/null @@ -1,25 +0,0 @@ -# Sets the following variables: -# -# OGG_FOUND -# OGG_INCLUDE_DIR -# OGG_LIBRARY - -set(OGG_SEARCH_PATHS - /usr/local - /usr - ) - -find_path(OGG_INCLUDE_DIR - NAMES ogg/ogg.h - PATH_SUFFIXES include - PATHS ${OGG_SEARCH_PATHS}) - -find_library(OGG_LIBRARY - NAMES ogg - PATH_SUFFIXES lib - PATHS ${OGG_SEARCH_PATHS}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Ogg DEFAULT_MSG OGG_LIBRARY OGG_INCLUDE_DIR) - -mark_as_advanced(OGG_INCLUDE_DIR OGG_LIBRARY) diff --git a/love/src/jni/love/extra/cmake/FindOpenAL.cmake b/love/src/jni/love/extra/cmake/FindOpenAL.cmake deleted file mode 100644 index 112beca9..00000000 --- a/love/src/jni/love/extra/cmake/FindOpenAL.cmake +++ /dev/null @@ -1,28 +0,0 @@ -# FindOpenAL.cmake that comes with CMake expects "#include " to be used -# However, we use "#include " - -# Sets the following variables: -# -# OPENAL_FOUND -# OPENAL_INCLUDE_DIR -# OPENAL_LIBRARY - -set(OPENAL_SEARCH_PATHS - /usr/local - /usr - ) - -find_path(OPENAL_INCLUDE_DIR - NAMES AL/al.h - PATH_SUFFIXES include - PATHS ${OPENAL_SEARCH_PATHS}) - -find_library(OPENAL_LIBRARY - NAMES openal - PATH_SUFFIXES lib - PATHS ${OPENAL_SEARCH_PATHS}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(OpenAL DEFAULT_MSG OPENAL_LIBRARY OPENAL_INCLUDE_DIR) - -mark_as_advanced(OPENAL_INCLUDE_DIR OPENAL_LIBRARY) diff --git a/love/src/jni/love/extra/cmake/FindSDL2.cmake b/love/src/jni/love/extra/cmake/FindSDL2.cmake deleted file mode 100644 index 81de07ff..00000000 --- a/love/src/jni/love/extra/cmake/FindSDL2.cmake +++ /dev/null @@ -1,25 +0,0 @@ -# Sets the following variables: -# -# SDL2_FOUND -# SDL2_INCLUDE_DIR -# SDL2_LIBRARY - -set(SDL2_SEARCH_PATHS - /usr/local - /usr - ) - -find_path(SDL2_INCLUDE_DIR - NAMES SDL.h - PATH_SUFFIXES include include/SDL2 - PATHS ${SDL2_SEARCH_PATHS}) - -find_library(SDL2_LIBRARY - NAMES SDL2 - PATH_SUFFIXES lib - PATHS ${SDL2_SEARCH_PATHS}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(SDL2 DEFAULT_MSG SDL2_LIBRARY SDL2_INCLUDE_DIR) - -mark_as_advanced(SDL2_INCLUDE_DIR SDL2_LIBRARY) diff --git a/love/src/jni/love/extra/cmake/FindTheora.cmake b/love/src/jni/love/extra/cmake/FindTheora.cmake deleted file mode 100644 index 4a3804a5..00000000 --- a/love/src/jni/love/extra/cmake/FindTheora.cmake +++ /dev/null @@ -1,31 +0,0 @@ -# Sets the following variables: -# -# THEORA_FOUND -# THEORA_INCLUDE_DIR -# THEORA_LIBRARY -# THEORADEC_LIBRARY - -set(THEORA_SEARCH_PATHS - /usr/local - /usr - ) - -find_path(THEORA_INCLUDE_DIR - NAMES theora/codec.h - PATH_SUFFIXES include - PATHS ${THEORA_SEARCH_PATHS}) - -find_library(THEORA_LIBRARY - NAMES theora - PATH_SUFFIXES lib - PATHS ${THEORA_SEARCH_PATHS}) - -find_library(THEORADEC_LIBRARY - NAMES theoradec - PATH_SUFFIXES lib - PATHS ${THEORA_SEARCH_PATHS}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Theora DEFAULT_MSG THEORA_LIBRARY THEORA_INCLUDE_DIR) - -mark_as_advanced(THEORA_INCLUDE_DIR THEORA_LIBRARY) diff --git a/love/src/jni/love/extra/cmake/FindVorbis.cmake b/love/src/jni/love/extra/cmake/FindVorbis.cmake deleted file mode 100644 index 6a263a4c..00000000 --- a/love/src/jni/love/extra/cmake/FindVorbis.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# Sets the following variables: -# -# VORBIS_FOUND -# VORBIS_INCLUDE_DIR -# VORBIS_LIBRARY -# VORBISFILE_LIBRARY - -set(VORBIS_SEARCH_PATHS - /usr/local - /usr - ) - -find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h - PATH_SUFFIXES include - PATHS ${VORBIS_SEARCH_PATHS}) - -find_library(VORBIS_LIBRARY - NAMES vorbis - PATH_SUFFIXES lib - PATHS ${VORBIS_SEARCH_PATHS}) - -find_library(VORBISFILE_LIBRARY - NAMES vorbisfile - PATH_SUFFIXES lib - PATHS ${VORBIS_SEARCH_PATHS}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Vorbis DEFAULT_MSG VORBIS_LIBRARY VORBISFILE_LIBRARY VORBIS_INCLUDE_DIR) - -mark_as_advanced(VORBIS_INCLUDE_DIR VORBIS_LIBRARY VORBISFILE_LIBRARY) diff --git a/love/src/jni/love/extra/nsis/game.ico b/love/src/jni/love/extra/nsis/game.ico deleted file mode 100644 index ecc5c0d3..00000000 Binary files a/love/src/jni/love/extra/nsis/game.ico and /dev/null differ diff --git a/love/src/jni/love/extra/nsis/left.bmp b/love/src/jni/love/extra/nsis/left.bmp deleted file mode 100644 index 91d5e3a3..00000000 Binary files a/love/src/jni/love/extra/nsis/left.bmp and /dev/null differ diff --git a/love/src/jni/love/extra/nsis/love.ico b/love/src/jni/love/extra/nsis/love.ico deleted file mode 100644 index b703c98b..00000000 Binary files a/love/src/jni/love/extra/nsis/love.ico and /dev/null differ diff --git a/love/src/jni/love/extra/nsis/love.nsi b/love/src/jni/love/extra/nsis/love.nsi deleted file mode 100644 index aa75fd6e..00000000 --- a/love/src/jni/love/extra/nsis/love.nsi +++ /dev/null @@ -1,120 +0,0 @@ -!include "MUI2.nsh" # Modern look, plxz - -Name "LOVE" - -OutFile ${LOVEEXE} - -InstallDir $PROGRAMFILES\LOVE -InstallDirRegKey HKCU "Software\LOVE" "" - -# Graphics -!define MUI_ICON "${LOVEICODIR}\love.ico" -!define MUI_UNICON "${LOVEICODIR}\love.ico" -!define MUI_ABORTWARNING -!define MUI_HEADERIMAGE -!define MUI_HEADERIMAGE_BITMAP "${LOVEICODIR}\top.bmp" # optional -!define MUI_WELCOMEFINISHPAGE_BITMAP "${LOVEICODIR}\left.bmp" -!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${LOVEICODIR}\left.bmp" - -!define MUI_WELCOMEPAGE_TITLE "LÖVE Setup" -!define MUI_WELCOMEPAGE_TEXT "This will install LÖVE, the unquestionably awesome Lua game framework." - -# Pages -!insertmacro MUI_PAGE_WELCOME -!insertmacro MUI_PAGE_LICENSE "${LOVELICDIR}\license.txt" -!insertmacro MUI_PAGE_COMPONENTS -!insertmacro MUI_PAGE_DIRECTORY -!insertmacro MUI_PAGE_INSTFILES - -!insertmacro MUI_UNPAGE_WELCOME -!insertmacro MUI_UNPAGE_CONFIRM -!insertmacro MUI_UNPAGE_INSTFILES - -# Languages -!insertmacro MUI_LANGUAGE "English" - -# Main Program -Section "LOVE" MainProg - - SectionIn RO - SetOutPath $INSTDIR - File "${LOVEBINDIR}\love.exe" - File "${LOVEBINDIR}\DevIL.dll" - File "${LOVEBINDIR}\SDL.dll" - File "${LOVEBINDIR}\OpenAL32.dll" - File "${LOVEBINDIR}\libmpg123.dll" - File "${LOVEBINDIR}\gme.dll" - # File "${LOVEBINDIR}\lua51.dll" - File "${LOVEICODIR}\love.ico" - File "${LOVEICODIR}\game.ico" - - # Uninstaller - WriteUninstaller $INSTDIR\Uninstall.exe - - # Add new start menu items - CreateDirectory "$SMPROGRAMS\LOVE" - CreateShortCut "$SMPROGRAMS\LOVE\LOVE.lnk" "$INSTDIR\love.exe" - CreateShortCut "$SMPROGRAMS\LOVE\Uninstall.lnk" "$INSTDIR\Uninstall.exe" - WriteINIStr "$SMPROGRAMS\LOVE\Documentation.url" "InternetShortcut" "URL" "http://love2d.org/wiki/" - - # Desktop - CreateShortCut "$DESKTOP\LOVE.lnk" "$INSTDIR\love.exe" "" - - # Registry - WriteRegStr HKCU "Software\LOVE" "" $INSTDIR - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LOVE" "DisplayName" "LOVE (remove only)" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LOVE" "UninstallString" "$INSTDIR\Uninstall.exe" - - # love file association - WriteRegStr HKCR ".love" "" "LOVE" - WriteRegStr HKCR "LOVE" "" "LOVE Game File" - WriteRegStr HKCR "LOVE\DefaultIcon" "" "$INSTDIR\game.ico" - WriteRegStr HKCR "LOVE\shell" "" "open" - WriteRegStr HKCR "LOVE\shell\open" "" "Open in LOVE" - WriteRegStr HKCR "LOVE\shell\open\command" "" "$INSTDIR\love.exe $\"%1$\"" - # Refresh shell icons - System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' - -SectionEnd - -# Descriptions -LangString DESC_MainProg ${LANG_ENGLISH} "Main program." - -# Assign language strings to sections -!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN - !insertmacro MUI_DESCRIPTION_TEXT ${MainProg} $(DESC_MainProg) -!insertmacro MUI_FUNCTION_DESCRIPTION_END - -# Uninstall -Section "Uninstall" - Delete $INSTDIR\"DevIL.dll" - Delete $INSTDIR\"SDL.dll" - Delete $INSTDIR\"love.exe" - Delete $INSTDIR\"OpenAL32.dll" - Delete $INSTDIR\"libmpg123.dll" - Delete $INSTDIR\"gme.dll" - # Delete $INSTDIR\"lua51.dll" - Delete $INSTDIR\"game.ico" - Delete $INSTDIR\"love.ico" - RMDir $INSTDIR - - # Start menu - Delete "$SMPROGRAMS\LOVE\LOVE.lnk" - Delete "$SMPROGRAMS\LOVE\Uninstall.lnk" - Delete "$SMPROGRAMS\LOVE\Documentation.url" - RMDir "$SMPROGRAMS\LOVE" - - # Desktop - Delete "$DESKTOP\LOVE.lnk" - - # Uninstall keys - DeleteRegKey /ifempty HKCU "Software\LOVE" - DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\LOVE" - - # love file association - DeleteRegKey HKCR "LOVE" - DeleteRegKey HKCR ".love" - # Refresh shell icons - System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' - -SectionEnd diff --git a/love/src/jni/love/extra/nsis/top.bmp b/love/src/jni/love/extra/nsis/top.bmp deleted file mode 100644 index bec3e05f..00000000 Binary files a/love/src/jni/love/extra/nsis/top.bmp and /dev/null differ diff --git a/love/src/jni/love/extra/reshax/res/knoll1.png b/love/src/jni/love/extra/reshax/res/knoll1.png deleted file mode 100644 index 4a14e38a..00000000 Binary files a/love/src/jni/love/extra/reshax/res/knoll1.png and /dev/null differ diff --git a/love/src/jni/love/extra/reshax/res/planet.png b/love/src/jni/love/extra/reshax/res/planet.png deleted file mode 100644 index 5fac9612..00000000 Binary files a/love/src/jni/love/extra/reshax/res/planet.png and /dev/null differ diff --git a/love/src/jni/love/extra/reshax/res/star1.png b/love/src/jni/love/extra/reshax/res/star1.png deleted file mode 100644 index b7b88084..00000000 Binary files a/love/src/jni/love/extra/reshax/res/star1.png and /dev/null differ diff --git a/love/src/jni/love/extra/resources/Vera.ttf b/love/src/jni/love/extra/resources/Vera.ttf deleted file mode 100644 index 58cd6b5e..00000000 Binary files a/love/src/jni/love/extra/resources/Vera.ttf and /dev/null differ diff --git a/love/src/jni/love/extra/resources/b64.lua b/love/src/jni/love/extra/resources/b64.lua deleted file mode 100644 index 891a0efc..00000000 --- a/love/src/jni/love/extra/resources/b64.lua +++ /dev/null @@ -1,12 +0,0 @@ -function b64(name) - local i = io.popen("base64 " .. name) - local encoded = i:read("*a") - i:close() - - local output = ("local %s =\n%q"):format(name:gsub("%.", "_"), encoded) - return output -end - -for i, v in ipairs(arg) do - print(b64(v)) -end diff --git a/love/src/jni/love/extra/resources/heart.png b/love/src/jni/love/extra/resources/heart.png deleted file mode 100644 index 91c3c423..00000000 Binary files a/love/src/jni/love/extra/resources/heart.png and /dev/null differ diff --git a/love/src/jni/love/extra/resources/pig.png b/love/src/jni/love/extra/resources/pig.png deleted file mode 100644 index a886e69f..00000000 Binary files a/love/src/jni/love/extra/resources/pig.png and /dev/null differ diff --git a/love/src/jni/love/extra/windows/love.ico b/love/src/jni/love/extra/windows/love.ico deleted file mode 100644 index b703c98b..00000000 Binary files a/love/src/jni/love/extra/windows/love.ico and /dev/null differ diff --git a/love/src/jni/love/extra/windows/love.rc b/love/src/jni/love/extra/windows/love.rc deleted file mode 100644 index 66a57118..00000000 Binary files a/love/src/jni/love/extra/windows/love.rc and /dev/null differ diff --git a/love/src/jni/love/license.txt b/love/src/jni/love/license.txt deleted file mode 100644 index 6f32ec69..00000000 --- a/love/src/jni/love/license.txt +++ /dev/null @@ -1,1166 +0,0 @@ -Licensing information -===================== - -This distribution contains code from the following projects (full license text below): - - - LOVE - Website: https://love2d.org/ - License: zlib - Copyright (c) 2006-2018 LOVE Development Team - - - ENet - Website: http://enet.bespin.org/index.html - License: MIT/Expat - Copyright (c) 2002-2016 Lee Salzman - - - GLAD - Website: http://glad.dav1d.de/ - License: MIT/Expat - Copyright (c) 2013 David Herberth, modified by Alex Szpakowski - - - glslang - Website: https://github.com/KhronosGroup/glslang - License: 3-Clause BSD - Copyright (C) 2002-2005 3Dlabs Inc. Ltd. - Copyright (C) 2013-2016 LunarG, Inc. - - - Kepler Project's lua-compat-5.3 - Website: https://github.com/keplerproject/lua-compat-5.3 - License: MIT/Expat - Copyright (c) 2015 Kepler Project. - - - lua-enet - Website: http://leafo.net/lua-enet/ - License: MIT/Expat - Copyright (C) 2011 by Leaf Corcoran - - - LuaJIT - Website: http://luajit.org/ - License: MIT/Expat - LuaJIT is Copyright (c) 2005-2016 Mike Pall - - - Lua's UTF-8 module - Website: https://www.lua.org/ - License: MIT/Expat - Copyright (C) 1994-2015 Lua.org, PUC-Rio, 2015 LOVE Development Team. - - - LuaSocket - Website: http://w3.impa.br/~diego/software/luasocket/home.html - License: MIT/Expat - Copyright (C) 2004-2013 Diego Nehab - - - LZ4 - Website: https://lz4.github.io/lz4/ - License: 2-Clause BSD - Copyright (C) 2011-2015, Yann Collet. - You can contact the author at : - - LZ4 source repository : https://github.com/Cyan4973/lz4 - - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c - - - TinyEXR - Website: https://github.com/syoyo/tinyexr - License: 3-Clause BSD - Copyright (c) 2014 - 2016, Syoyo Fujita - - - UTF8-CPP - Website: https://github.com/nemtrif/utfcpp - License: Unknown, MIT/Expat-like (listed as UTF8-CPP) - Copyright 2006 Nemanja Trifunovic - - - xxHash - Website: https://cyan4973.github.io/xxHash/ - License: 2-Clause BSD - Copyright (C) 2012-2016, Yann Collet. - You can contact the author at : - - xxHash source repository : https://github.com/Cyan4973/xxHash - - - libmpg123 - Website: http://www.mpg123.de/ - Source download: http://sourceforge.net/projects/mpg123/files/latest/download - License: LGPL 2.1 - Copyright (c) 1995-2013 by Michael Hipp and others, free software under the terms of the LGPL v2.1 - Detailed information from the debian project: - Copyright 1995-2016 by the mpg123 project - Copyright 2009-2011 by Malcolm Boczek - Copyright 2008 Christian Weisgerber - Copyright 2006-2007 by Zuxy Meng - Copyright 2000-2002 David Olofson - Copyright 1998 Fabrice Bellard - Copyright 1997 Mikko Tommila - - - OpenAL Soft - Website: http://kcat.strangesoft.net/openal.html - Source download: http://kcat.strangesoft.net/openal.html#download - License: Mixed, licensing information obtained from the debian project - - Alc/backends/opensl.c - License: Apache 2.0 - Copyright 2011 The Android Open Source Project - - examples/alhrtf.c examples/allatency.c examples/alloopback.c examples/alreverb.c examples/alstream.c examples/altonegen.c examples/common/alhelpers.c examples/common/sdl_sound.c utils/openal-info.c - License: MIT/Expat - Copyright © 2010, 2015 Chris Robinson - - examples/alffplay.c - License: unclear, presumed LGPL 2.1 or higher - Copyright © 2003 Fabrice Bellard - Copyright © Martin Bohme - - Alc/bs2b.c OpenAL32/Include/bs2b.h - License: MIT/Expat - Copyright 2005 by Boris Mikhaylov - - cmake/FindALSA.cmake cmake/FindFFmpeg.cmake cmake/FindJACK.cmake cmake/FindSDL2.cmake - License: 3-Clause BSD - Copyright © 2006 Matthias Kretz - Copyright © 2008 Alexander Neundorf - Copyright © 2003-2011 Kitware, Inc. - Copyright © 2009-2011 Philip Lowman - Copyright © 2011 Michael Jansen - Copyright © 2012 Benjamin Eikel - - utils/makehrtf.c (not included in distribution) - License: GPL 2 or higher (2 listed below) - Copyright 2011-2014 Christopher Fitzgerald - - Everything else: - License: LGPL 2.0 or higher (2.1 listed below) - Copyright © 1999-2014 the OpenAL team - Copyright © 2008-2015 Christopher Fitzgerald - Copyright © 2009-2015 Chris Robinson - Copyright © 2013 Anis A. Hireche - Copyright © 2013 Nasca Octavian Paul - Copyright © 2013 Mike Gorchak - Copyright © 2014 Timothy Arceri - -License text -============ - -zlib license - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - - 3. This notice may not be removed or altered from any source - distribution. - -MIT/Expat - 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. - -3-Clause BSD - 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 3Dlabs Inc. Ltd. 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 THE - COPYRIGHT HOLDERS OR CONTRIBUTORS 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. - -2-Clause BSD - 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. - - 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 THE COPYRIGHT - OWNER OR CONTRIBUTORS 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. - -UTF8-CPP - Permission is hereby granted, free of charge, to any person or organization - obtaining a copy of the software and accompanying documentation covered by - this license (the "Software") to use, reproduce, display, distribute, - execute, and transmit the Software, and to prepare derivative works of the - Software, and to permit third-parties to whom the Software is furnished to - do so, all subject to the following: - - The copyright notices in the Software and this entire statement, including - the above license grant, this restriction and the following disclaimer, - must be included in all copies of the Software, in whole or in part, and - all derivative works of the Software, unless such copies or derivative - works are solely in the form of machine-executable object code generated by - a source language processor. - - 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT - SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE - FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - -LGPL 2.1 - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - [This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your - freedom to share and change it. By contrast, the GNU General Public - Licenses are intended to guarantee your freedom to share and change - free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some - specially designated software packages--typically libraries--of the - Free Software Foundation and other authors who decide to use it. You - can use it too, but we suggest you first think carefully about whether - this license or the ordinary General Public License is the better - strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, - not price. Our General Public Licenses are designed to make sure that - you have the freedom to distribute copies of free software (and charge - for this service if you wish); that you receive source code or can get - it if you want it; that you can change the software and use pieces of - it in new free programs; and that you are informed that you can do - these things. - - To protect your rights, we need to make restrictions that forbid - distributors to deny you these rights or to ask you to surrender these - rights. These restrictions translate to certain responsibilities for - you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis - or for a fee, you must give the recipients all the rights that we gave - you. You must make sure that they, too, receive or can get the source - code. If you link other code with the library, you must provide - complete object files to the recipients, so that they can relink them - with the library after making changes to the library and recompiling - it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the - library, and (2) we offer you this license, which gives you legal - permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that - there is no warranty for the free library. Also, if the library is - modified by someone else and passed on, the recipients should know - that what they have is not the original version, so that the original - author's reputation will not be affected by problems that might be - introduced by others. - - Finally, software patents pose a constant threat to the existence of - any free program. We wish to make sure that a company cannot - effectively restrict the users of a free program by obtaining a - restrictive license from a patent holder. Therefore, we insist that - any patent license obtained for a version of the library must be - consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the - ordinary GNU General Public License. This license, the GNU Lesser - General Public License, applies to certain designated libraries, and - is quite different from the ordinary General Public License. We use - this license for certain libraries in order to permit linking those - libraries into non-free programs. - - When a program is linked with a library, whether statically or using - a shared library, the combination of the two is legally speaking a - combined work, a derivative of the original library. The ordinary - General Public License therefore permits such linking only if the - entire combination fits its criteria of freedom. The Lesser General - Public License permits more lax criteria for linking other code with - the library. - - We call this license the "Lesser" General Public License because it - does Less to protect the user's freedom than the ordinary General - Public License. It also provides other free software developers Less - of an advantage over competing non-free programs. These disadvantages - are the reason we use the ordinary General Public License for many - libraries. However, the Lesser license provides advantages in certain - special circumstances. - - For example, on rare occasions, there may be a special need to - encourage the widest possible use of a certain library, so that it becomes - a de-facto standard. To achieve this, non-free programs must be - allowed to use the library. A more frequent case is that a free - library does the same job as widely used non-free libraries. In this - case, there is little to gain by limiting the free library to free - software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free - programs enables a greater number of people to use a large body of - free software. For example, permission to use the GNU C Library in - non-free programs enables many more people to use the whole GNU - operating system, as well as its variant, the GNU/Linux operating - system. - - Although the Lesser General Public License is Less protective of the - users' freedom, it does ensure that the user of a program that is - linked with the Library has the freedom and the wherewithal to run - that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and - modification follow. Pay close attention to the difference between a - "work based on the library" and a "work that uses the library". The - former contains code derived from the library, whereas the latter must - be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other - program which contains a notice placed by the copyright holder or - other authorized party saying it may be distributed under the terms of - this Lesser General Public License (also called "this License"). - Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data - prepared so as to be conveniently linked with application programs - (which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work - which has been distributed under these terms. A "work based on the - Library" means either the Library or any derivative work under - copyright law: that is to say, a work containing the Library or a - portion of it, either verbatim or with modifications and/or translated - straightforwardly into another language. (Hereinafter, translation is - included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for - making modifications to it. For a library, complete source code means - all the source code for all modules it contains, plus any associated - interface definition files, plus the scripts used to control compilation - and installation of the library. - - Activities other than copying, distribution and modification are not - covered by this License; they are outside its scope. The act of - running a program using the Library is not restricted, and output from - such a program is covered only if its contents constitute a work based - on the Library (independent of the use of the Library in a tool for - writing it). Whether that is true depends on what the Library does - and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's - complete source code as you receive it, in any medium, provided that - you conspicuously and appropriately publish on each copy an - appropriate copyright notice and disclaimer of warranty; keep intact - all the notices that refer to this License and to the absence of any - warranty; and distribute a copy of this License along with the - Library. - - You may charge a fee for the physical act of transferring a copy, - and you may at your option offer warranty protection in exchange for a - fee. - - 2. You may modify your copy or copies of the Library or any portion - of it, thus forming a work based on the Library, and copy and - distribute such modifications or work under the terms of Section 1 - above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - - These requirements apply to the modified work as a whole. If - identifiable sections of that work are not derived from the Library, - and can be reasonably considered independent and separate works in - themselves, then this License, and its terms, do not apply to those - sections when you distribute them as separate works. But when you - distribute the same sections as part of a whole which is a work based - on the Library, the distribution of the whole must be on the terms of - this License, whose permissions for other licensees extend to the - entire whole, and thus to each and every part regardless of who wrote - it. - - Thus, it is not the intent of this section to claim rights or contest - your rights to work written entirely by you; rather, the intent is to - exercise the right to control the distribution of derivative or - collective works based on the Library. - - In addition, mere aggregation of another work not based on the Library - with the Library (or with a work based on the Library) on a volume of - a storage or distribution medium does not bring the other work under - the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public - License instead of this License to a given copy of the Library. To do - this, you must alter all the notices that refer to this License, so - that they refer to the ordinary GNU General Public License, version 2, - instead of to this License. (If a newer version than version 2 of the - ordinary GNU General Public License has appeared, then you can specify - that version instead if you wish.) Do not make any other change in - these notices. - - Once this change is made in a given copy, it is irreversible for - that copy, so the ordinary GNU General Public License applies to all - subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of - the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or - derivative of it, under Section 2) in object code or executable form - under the terms of Sections 1 and 2 above provided that you accompany - it with the complete corresponding machine-readable source code, which - must be distributed under the terms of Sections 1 and 2 above on a - medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy - from a designated place, then offering equivalent access to copy the - source code from the same place satisfies the requirement to - distribute the source code, even though third parties are not - compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the - Library, but is designed to work with the Library by being compiled or - linked with it, is called a "work that uses the Library". Such a - work, in isolation, is not a derivative work of the Library, and - therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library - creates an executable that is a derivative of the Library (because it - contains portions of the Library), rather than a "work that uses the - library". The executable is therefore covered by this License. - Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file - that is part of the Library, the object code for the work may be a - derivative work of the Library even though the source code is not. - Whether this is true is especially significant if the work can be - linked without the Library, or if the work is itself a library. The - threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data - structure layouts and accessors, and small macros and small inline - functions (ten lines or less in length), then the use of the object - file is unrestricted, regardless of whether it is legally a derivative - work. (Executables containing this object code plus portions of the - Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may - distribute the object code for the work under the terms of Section 6. - Any executables containing that work also fall under Section 6, - whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or - link a "work that uses the Library" with the Library to produce a - work containing portions of the Library, and distribute that work - under terms of your choice, provided that the terms permit - modification of the work for the customer's own use and reverse - engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the - Library is used in it and that the Library and its use are covered by - this License. You must supply a copy of this License. If the work - during execution displays copyright notices, you must include the - copyright notice for the Library among them, as well as a reference - directing the user to the copy of this License. Also, you must do one - of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the - Library" must include any data and utility programs needed for - reproducing the executable from it. However, as a special exception, - the materials to be distributed need not include anything that is - normally distributed (in either source or binary form) with the major - components (compiler, kernel, and so on) of the operating system on - which the executable runs, unless that component itself accompanies - the executable. - - It may happen that this requirement contradicts the license - restrictions of other proprietary libraries that do not normally - accompany the operating system. Such a contradiction means you cannot - use both them and the Library together in an executable that you - distribute. - - 7. You may place library facilities that are a work based on the - Library side-by-side in a single library together with other library - facilities not covered by this License, and distribute such a combined - library, provided that the separate distribution of the work based on - the Library and of the other library facilities is otherwise - permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute - the Library except as expressly provided under this License. Any - attempt otherwise to copy, modify, sublicense, link with, or - distribute the Library is void, and will automatically terminate your - rights under this License. However, parties who have received copies, - or rights, from you under this License will not have their licenses - terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not - signed it. However, nothing else grants you permission to modify or - distribute the Library or its derivative works. These actions are - prohibited by law if you do not accept this License. Therefore, by - modifying or distributing the Library (or any work based on the - Library), you indicate your acceptance of this License to do so, and - all its terms and conditions for copying, distributing or modifying - the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the - Library), the recipient automatically receives a license from the - original licensor to copy, distribute, link with or modify the Library - subject to these terms and conditions. You may not impose any further - restrictions on the recipients' exercise of the rights granted herein. - You are not responsible for enforcing compliance by third parties with - this License. - - 11. If, as a consequence of a court judgment or allegation of patent - infringement or for any other reason (not limited to patent issues), - conditions are imposed on you (whether by court order, agreement or - otherwise) that contradict the conditions of this License, they do not - excuse you from the conditions of this License. If you cannot - distribute so as to satisfy simultaneously your obligations under this - License and any other pertinent obligations, then as a consequence you - may not distribute the Library at all. For example, if a patent - license would not permit royalty-free redistribution of the Library by - all those who receive copies directly or indirectly through you, then - the only way you could satisfy both it and this License would be to - refrain entirely from distribution of the Library. - - If any portion of this section is held invalid or unenforceable under any - particular circumstance, the balance of the section is intended to apply, - and the section as a whole is intended to apply in other circumstances. - - It is not the purpose of this section to induce you to infringe any - patents or other property right claims or to contest validity of any - such claims; this section has the sole purpose of protecting the - integrity of the free software distribution system which is - implemented by public license practices. Many people have made - generous contributions to the wide range of software distributed - through that system in reliance on consistent application of that - system; it is up to the author/donor to decide if he or she is willing - to distribute software through any other system and a licensee cannot - impose that choice. - - This section is intended to make thoroughly clear what is believed to - be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in - certain countries either by patents or by copyrighted interfaces, the - original copyright holder who places the Library under this License may add - an explicit geographical distribution limitation excluding those countries, - so that distribution is permitted only in or among countries not thus - excluded. In such case, this License incorporates the limitation as if - written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new - versions of the Lesser General Public License from time to time. - Such new versions will be similar in spirit to the present version, - but may differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the Library - specifies a version number of this License which applies to it and - "any later version", you have the option of following the terms and - conditions either of that version or of any later version published by - the Free Software Foundation. If the Library does not specify a - license version number, you may choose any version ever published by - the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free - programs whose distribution conditions are incompatible with these, - write to the author to ask for permission. For software which is - copyrighted by the Free Software Foundation, write to the Free - Software Foundation; we sometimes make exceptions for this. Our - decision will be guided by the two goals of preserving the free status - of all derivatives of our free software and of promoting the sharing - and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO - WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. - EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR - OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY - KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE - LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME - THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN - WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY - AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU - FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR - CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE - LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING - RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A - FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF - SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH - DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest - possible use to the public, we recommend making it free software that - everyone can redistribute and change. You can do so by permitting - redistribution under these terms (or, alternatively, under the terms of the - ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is - safest to attach them to the start of each source file to most effectively - convey the exclusion of warranty; and each file should have at least the - "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - Also add information on how to contact you by electronic and paper mail. - - You should also get your employer (if you work as a programmer) or your - school, if any, to sign a "copyright disclaimer" for the library, if - necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - - That's all there is to it! - -GPL 2 - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your - freedom to share and change it. By contrast, the GNU General Public - License is intended to guarantee your freedom to share and change free - software--to make sure the software is free for all its users. This - General Public License applies to most of the Free Software - Foundation's software and to any other program whose authors commit to - using it. (Some other Free Software Foundation software is covered by - the GNU Lesser General Public License instead.) You can apply it to - your programs, too. - - When we speak of free software, we are referring to freedom, not - price. Our General Public Licenses are designed to make sure that you - have the freedom to distribute copies of free software (and charge for - this service if you wish), that you receive source code or can get it - if you want it, that you can change the software or use pieces of it - in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid - anyone to deny you these rights or to ask you to surrender the rights. - These restrictions translate to certain responsibilities for you if you - distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether - gratis or for a fee, you must give the recipients all the rights that - you have. You must make sure that they, too, receive or can get the - source code. And you must show them these terms so they know their - rights. - - We protect your rights with two steps: (1) copyright the software, and - (2) offer you this license which gives you legal permission to copy, - distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain - that everyone understands that there is no warranty for this free - software. If the software is modified by someone else and passed on, we - want its recipients to know that what they have is not the original, so - that any problems introduced by others will not reflect on the original - authors' reputations. - - Finally, any free program is threatened constantly by software - patents. We wish to avoid the danger that redistributors of a free - program will individually obtain patent licenses, in effect making the - program proprietary. To prevent this, we have made it clear that any - patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and - modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains - a notice placed by the copyright holder saying it may be distributed - under the terms of this General Public License. The "Program", below, - refers to any such program or work, and a "work based on the Program" - means either the Program or any derivative work under copyright law: - that is to say, a work containing the Program or a portion of it, - either verbatim or with modifications and/or translated into another - language. (Hereinafter, translation is included without limitation in - the term "modification".) Each licensee is addressed as "you". - - Activities other than copying, distribution and modification are not - covered by this License; they are outside its scope. The act of - running the Program is not restricted, and the output from the Program - is covered only if its contents constitute a work based on the - Program (independent of having been made by running the Program). - Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's - source code as you receive it, in any medium, provided that you - conspicuously and appropriately publish on each copy an appropriate - copyright notice and disclaimer of warranty; keep intact all the - notices that refer to this License and to the absence of any warranty; - and give any other recipients of the Program a copy of this License - along with the Program. - - You may charge a fee for the physical act of transferring a copy, and - you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion - of it, thus forming a work based on the Program, and copy and - distribute such modifications or work under the terms of Section 1 - above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - - These requirements apply to the modified work as a whole. If - identifiable sections of that work are not derived from the Program, - and can be reasonably considered independent and separate works in - themselves, then this License, and its terms, do not apply to those - sections when you distribute them as separate works. But when you - distribute the same sections as part of a whole which is a work based - on the Program, the distribution of the whole must be on the terms of - this License, whose permissions for other licensees extend to the - entire whole, and thus to each and every part regardless of who wrote it. - - Thus, it is not the intent of this section to claim rights or contest - your rights to work written entirely by you; rather, the intent is to - exercise the right to control the distribution of derivative or - collective works based on the Program. - - In addition, mere aggregation of another work not based on the Program - with the Program (or with a work based on the Program) on a volume of - a storage or distribution medium does not bring the other work under - the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, - under Section 2) in object code or executable form under the terms of - Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - - The source code for a work means the preferred form of the work for - making modifications to it. For an executable work, complete source - code means all the source code for all modules it contains, plus any - associated interface definition files, plus the scripts used to - control compilation and installation of the executable. However, as a - special exception, the source code distributed need not include - anything that is normally distributed (in either source or binary - form) with the major components (compiler, kernel, and so on) of the - operating system on which the executable runs, unless that component - itself accompanies the executable. - - If distribution of executable or object code is made by offering - access to copy from a designated place, then offering equivalent - access to copy the source code from the same place counts as - distribution of the source code, even though third parties are not - compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program - except as expressly provided under this License. Any attempt - otherwise to copy, modify, sublicense or distribute the Program is - void, and will automatically terminate your rights under this License. - However, parties who have received copies, or rights, from you under - this License will not have their licenses terminated so long as such - parties remain in full compliance. - - 5. You are not required to accept this License, since you have not - signed it. However, nothing else grants you permission to modify or - distribute the Program or its derivative works. These actions are - prohibited by law if you do not accept this License. Therefore, by - modifying or distributing the Program (or any work based on the - Program), you indicate your acceptance of this License to do so, and - all its terms and conditions for copying, distributing or modifying - the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the - Program), the recipient automatically receives a license from the - original licensor to copy, distribute or modify the Program subject to - these terms and conditions. You may not impose any further - restrictions on the recipients' exercise of the rights granted herein. - You are not responsible for enforcing compliance by third parties to - this License. - - 7. If, as a consequence of a court judgment or allegation of patent - infringement or for any other reason (not limited to patent issues), - conditions are imposed on you (whether by court order, agreement or - otherwise) that contradict the conditions of this License, they do not - excuse you from the conditions of this License. If you cannot - distribute so as to satisfy simultaneously your obligations under this - License and any other pertinent obligations, then as a consequence you - may not distribute the Program at all. For example, if a patent - license would not permit royalty-free redistribution of the Program by - all those who receive copies directly or indirectly through you, then - the only way you could satisfy both it and this License would be to - refrain entirely from distribution of the Program. - - If any portion of this section is held invalid or unenforceable under - any particular circumstance, the balance of the section is intended to - apply and the section as a whole is intended to apply in other - circumstances. - - It is not the purpose of this section to induce you to infringe any - patents or other property right claims or to contest validity of any - such claims; this section has the sole purpose of protecting the - integrity of the free software distribution system, which is - implemented by public license practices. Many people have made - generous contributions to the wide range of software distributed - through that system in reliance on consistent application of that - system; it is up to the author/donor to decide if he or she is willing - to distribute software through any other system and a licensee cannot - impose that choice. - - This section is intended to make thoroughly clear what is believed to - be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in - certain countries either by patents or by copyrighted interfaces, the - original copyright holder who places the Program under this License - may add an explicit geographical distribution limitation excluding - those countries, so that distribution is permitted only in or among - countries not thus excluded. In such case, this License incorporates - the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions - of the General Public License from time to time. Such new versions will - be similar in spirit to the present version, but may differ in detail to - address new problems or concerns. - - Each version is given a distinguishing version number. If the Program - specifies a version number of this License which applies to it and "any - later version", you have the option of following the terms and conditions - either of that version or of any later version published by the Free - Software Foundation. If the Program does not specify a version number of - this License, you may choose any version ever published by the Free Software - Foundation. - - 10. If you wish to incorporate parts of the Program into other free - programs whose distribution conditions are different, write to the author - to ask for permission. For software which is copyrighted by the Free - Software Foundation, write to the Free Software Foundation; we sometimes - make exceptions for this. Our decision will be guided by the two goals - of preserving the free status of all derivatives of our free software and - of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY - FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN - OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES - PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED - OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS - TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE - PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, - REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING - WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR - REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, - INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING - OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED - TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY - YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest - possible use to the public, the best way to achieve this is to make it - free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest - to attach them to the start of each source file to most effectively - convey the exclusion of warranty; and each file should have at least - the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - Also add information on how to contact you by electronic and paper mail. - - If the program is interactive, make it output a short notice like this - when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - - The hypothetical commands `show w' and `show c' should show the appropriate - parts of the General Public License. Of course, the commands you use may - be called something other than `show w' and `show c'; they could even be - mouse-clicks or menu items--whatever suits your program. - - You should also get your employer (if you work as a programmer) or your - school, if any, to sign a "copyright disclaimer" for the program, if - necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - - This General Public License does not permit incorporating your program into - proprietary programs. If your program is a subroutine library, you may - consider it more useful to permit linking proprietary applications with the - library. If this is what you want to do, use the GNU Lesser General - Public License instead of this License. - -Apache 2.0 - 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: - - You must give any other recipients of the Work or Derivative Works a copy of this License; and - You must cause any modified files to carry prominent notices stating that You changed the files; and - 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 - 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/love/src/jni/love/platform/unix/Makefile.am b/love/src/jni/love/platform/unix/Makefile.am deleted file mode 100644 index f54a08e9..00000000 --- a/love/src/jni/love/platform/unix/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -ACLOCAL_AMFLAGS = -I platform/unix/m4 -SUBDIRS = src -EXTRA_DIST = changes.txt license.txt readme.md \ - platform/unix/love.desktop.in -dist_man1_MANS = platform/unix/love.6 - -applicationsdir=$(datarootdir)/applications -mimeinfodir=$(datarootdir)/mime/packages -pixmapsdir=$(datarootdir)/pixmaps -mimeiconsdir=$(datarootdir)/icons/hicolor/scalable/mimetypes - -applications_DATA = platform/unix/love.desktop -dist_mimeinfo_DATA = platform/unix/love.xml -dist_pixmaps_DATA = platform/unix/love.svg -dist_mimeicons_DATA = platform/unix/application-x-love-game.svg - -platform/unix/love.desktop: platform/unix/love.desktop.in - $(MKDIR_P) platform/unix - rm -f $@ $@.tmp - $(SED) \ - -e "s|@bindir[@]|$(bindir)|" \ - ${srcdir}/$@.in > $@.tmp - chmod a-w $@.tmp - mv $@.tmp $@ diff --git a/love/src/jni/love/platform/unix/application-x-love-game.svg b/love/src/jni/love/platform/unix/application-x-love-game.svg deleted file mode 100644 index a01da96f..00000000 --- a/love/src/jni/love/platform/unix/application-x-love-game.svg +++ /dev/null @@ -1,793 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/love/src/jni/love/platform/unix/automagic b/love/src/jni/love/platform/unix/automagic deleted file mode 100755 index 23acf626..00000000 --- a/love/src/jni/love/platform/unix/automagic +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -log() { - echo "[automagic] " $@ -} - -die() { - log "Fatal: "$@ - exit 1 -} - -if [[ ! -d platform/unix ]]; then - log "Can't find the 'plaform/unix' folder, make sure you run this from the root of the repository." - exit 1 -fi - -AUTOHEADER=${AUTOHEADER:-$(which autoheader)} -AUTOCONF=${AUTOCONF:-$(which autoconf)} -LIBTOOLIZE=${LIBTOOLIZE:-$(which libtoolize)} -ACLOCAL=${ACLOCAL:-$(which aclocal)} -AUTOMAKE=${AUTOMAKE:-$(which automake)} - -[[ -x ${AUTOHEADER} ]] || die "Could not find autoheader. Install autoconf." -[[ -x ${AUTOCONF} ]] || die "Could not find autoconf." -[[ -x ${LIBTOOLIZE} ]] || die "Could not find libtoolize. Install libtool." -[[ -x ${ACLOCAL} ]] || die "Could not find aclocal. Install automake." -[[ -x ${AUTOMAKE} ]] || die "Could not find automake." - -print_errors() { - local output - output="$("$@" 2>&1)" && return 0 - printf "%s\n" "$output" - return 1 -} - -automagic() { - log "Copying files..." - cp platform/unix/configure.ac . - cp platform/unix/Makefile.am . - - log "Running genmodules..." - if ! print_errors bash platform/unix/genmodules "$1"; then - echo "You should be doing this from the root directory of the project." - exit 1 - fi - - log "Running autoheader..." - print_errors ${AUTOHEADER} || return 1 # Gimmie config.h.in - - log "Running libtoolize..." - print_errors ${LIBTOOLIZE} --force || return 1 - - log "Running aclocal..." - print_errors ${ACLOCAL} || return 1 - - log "Running autoconf..." - print_errors ${AUTOCONF} || return 1 - - log "Running automake..." - print_errors ${AUTOMAKE} -a || return 1 -} - -automagic "$@" - -if [[ $? -eq 1 ]]; then - log "Failed, sadface." - log "This is generally a configuration error (I'm looking at you aclocal)" - exit 1 -else - log "Success, carry on configuring." -fi diff --git a/love/src/jni/love/platform/unix/configure.ac b/love/src/jni/love/platform/unix/configure.ac deleted file mode 100644 index 781680c4..00000000 --- a/love/src/jni/love/platform/unix/configure.ac +++ /dev/null @@ -1,140 +0,0 @@ -AC_INIT([love], [11.2]) -AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_AUX_DIR([platform/unix]) -AC_CONFIG_MACRO_DIR([platform/unix/m4]) -AC_CONFIG_SRCDIR([src/love.cpp]) -AM_INIT_AUTOMAKE([foreign -Wall foreign tar-ustar silent-rules]) -AM_SILENT_RULES -AC_PREFIX_DEFAULT([/usr]) -m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) -LT_INIT([disable-static]) -AC_PROG_CC -AC_PROG_CXX -AC_PROG_SED -AC_PROG_MKDIR_P -AC_PROG_OBJCXX -PKG_PROG_PKG_CONFIG -AC_C_BIGENDIAN -AC_LANG([C++]) - -dnl Workaround for old aclocal versions -m4_include([platform/unix/cpp11.m4]) -m4_include([platform/unix/deps.m4]) - -includes= - -AC_DEFUN([LOVE_MSG_ERROR], - [AC_MSG_ERROR([LÖVE needs "$1"[,] please install "$1" with development files and try again])]) - -# C++11 support in cpp11.m4 -ACLOVE_CPP11_TEST - -# Allow people on OSX to use autotools, they need their platform files -AC_ARG_ENABLE([osx], - AC_HELP_STRING([--enable-osx], [Compile platform-specific files for OSX]), [], [enable_osx=no]) -AS_VAR_IF([enable_osx], [no], [], #else - ac_cv_search_glLoadIdentity="-framework OpenGL" - AC_SUBST([LDFLAGS], ["${LDFLAGS} -framework CoreFoundation -framework Cocoa"]) - AC_SUBST([CPPFLAGS], ["${CPPFLAGS} -I../platform/macosx"])) - -# stb_image sse2 override (https://github.com/nothings/stb/issues/280) -AC_ARG_ENABLE([stbi-sse2-override], - AC_HELP_STRING([--enable-stbi-sse2-override], [Force stb_image SSE2 support]), [], [enable_stbi_sse2_override=no]) -AS_VAR_IF([enable_stbi_sse2_override], [no], [], #else - AC_SUBST([CPPFLAGS], ["${CPPFLAGS} -DLOVE_STBI_SSE2_OVERRIDE"])) - -# --with-lua and --with-luaversion -AC_ARG_WITH([lua], [AS_HELP_STRING([--with-lua], [Select the lua implementation])], - [], [with_lua=luajit]) -AC_ARG_WITH([luaversion], [AS_HELP_STRING([--with-luaversion], [Select the lua version])], - [], [with_luaversion=5.1]) - -with_clean_luaversion=`printf ${with_luaversion} | sed 's/\.//g'` - -# Generated sources for enabling/disabling modules -m4_include([configure-modules-pre.ac]) - -# Other features that can be enabled/disabled -AC_ARG_ENABLE([mpg123], AC_HELP_STRING([--disable-mpg123], [Disable mp3 support, for patent-free builds]), [], [enable_mpg123=yes]) -AC_ARG_ENABLE([gme], AC_HELP_STRING([--enable-gme], [Enable GME support, for more chiptuney goodness]), [], [enable_gme=no]) - -# Dependencies we always use -ACLOVE_DEP_LUA -ACLOVE_DEP_SDL2 -ACLOVE_DEP_LIBM -ACLOVE_DEP_ZLIB -ACLOVE_DEP_PTHREAD - -# Conditional dependencies -AS_VAR_IF([enable_module_audio], [yes], [ACLOVE_DEP_OPENAL], []) -AS_VAR_IF([enable_module_font], [yes], [ACLOVE_DEP_FREETYPE2], []) -AS_VAR_IF([enable_module_sound], [yes], [ - ACLOVE_DEP_LIBMODPLUG - ACLOVE_DEP_VORBISFILE -], [enable_mpg123=no]) -AS_VAR_IF([enable_module_video], [yes], [ACLOVE_DEP_THEORA], []) -AS_VAR_IF([enable_gme], [yes], [ACLOVE_DEP_GME], []) -AS_VAR_IF([enable_mpg123], [no], - AC_DEFINE([LOVE_NOMPG123], [], [Build without mpg123]), - [ACLOVE_DEP_MPG123]) - -# Add flags for optional libraries -AC_ARG_ENABLE([library-enet], [ --disable-library-enet Turn off library enet], [], [enable_library_enet=yes]) -AC_ARG_ENABLE([library-luasocket], [ --disable-library-luasocket Turn off library luasocket], [], [enable_library_luasocket=yes]) -AC_ARG_ENABLE([library-lua53], [ --disable-library-lua53 Turn off library lua53 (lua 5.3 backports, required by love.data)], [], [enable_library_lua53=yes]) - -# Select the libraries we need to build, based on the selected modules -AS_VAR_IF([enable_module_filesystem], [yes], [enable_library_physfs=yes], [enable_library_physfs=no]) -AS_VAR_IF([enable_module_physics], [yes], [enable_library_Box2D=yes], [enable_library_Box2D=no]) -AS_VAR_IF([enable_module_image], [yes], [enable_library_ddsparse=yes], [enable_library_ddsparse=no]) -AS_VAR_IF([enable_module_graphics], [yes], [enable_library_glad=yes], [enable_library_glad=no]) -AS_VAR_IF([enable_module_graphics], [yes], [enable_library_glslang=yes], [enable_library_glslang=no]) -AS_VAR_IF([enable_module_image], [yes], [enable_library_lodepng=yes], [enable_library_lodepng=no]) -AS_VAR_IF([enable_module_data], [yes], [enable_library_lua53=yes], []) -AS_VAR_IF([enable_module_math], [yes], [enable_library_lz4=yes], [enable_library_lz4=no]) -AS_VAR_IF([enable_module_math], [yes], [enable_library_noise1234=yes], [enable_library_noise1234=no]) -AS_VAR_IF([enable_module_image], [yes], [enable_library_stb=yes], [enable_library_stb=no]) -AS_VAR_IF([enable_module_image], [yes], [enable_library_tinyexr=yes], [enable_library_tinyexr=no]) -AS_VAR_IF([enable_module_sound], [yes], [enable_library_Wuff=yes], [enable_library_Wuff=no]) -AS_VAR_IF([enable_module_graphics], [yes], [enable_library_xxHash=yes], [enable_library_xxHash=no]) - -# Utf8 is required by both graphics and font, so enable if either is enabled -enable_library_utf8=no -AS_VAR_IF([enable_module_graphics], [yes], [enable_library_utf8=yes], []) -AS_VAR_IF([enable_module_font], [yes], [enable_library_utf8=yes], []) - -# libenet check for socklen_t -ACLOVE_SOCKLEN_T - -# Generated sources for enabling/disabling modules -m4_include([configure-modules-post.ac]) - -# Optionally build the executable (default on) -AC_ARG_ENABLE([exe], - AC_HELP_STRING([--disable-exe], [Disable building of executable launcher]), [], [enable_exe=yes]) - -AS_VAR_IF([enable_exe], [no], [], #else - AC_DEFINE([LOVE_BUILD_EXE], [], [Skip building launcher])) - -AM_CONDITIONAL([LOVE_BUILD_EXE], [test "x$enable_exe" != xno]) -AM_CONDITIONAL([LOVE_NOMPG123], [test "x$enable_mpg123" = xno]) -AM_CONDITIONAL([LOVE_TARGET_OSX], [test "x$enable_osx" != xno]) - -# Automatic script file rebuilding -AC_CHECK_PROGS([LUA_EXECUTABLE], ["${with_lua}${with_luaversion}" "${with_lua}" "lua"], [:]) -AS_VAR_IF([LUA_EXECUTABLE], [:], - [AC_MSG_WARN([Did not find a lua executable, you may need to update the scripts manually if you change them])], []) - -# Set our includes as automake variable -AC_SUBST([LOVE_INCLUDES], ["$includes"]) - -AC_CONFIG_FILES([ - Makefile - src/Makefile - platform/unix/debian/control - platform/unix/debian/changelog - platform/unix/debian/rules -]) -AC_OUTPUT - -chmod 755 platform/unix/debian/rules diff --git a/love/src/jni/love/platform/unix/cpp11.m4 b/love/src/jni/love/platform/unix/cpp11.m4 deleted file mode 100644 index 924c9689..00000000 --- a/love/src/jni/love/platform/unix/cpp11.m4 +++ /dev/null @@ -1,69 +0,0 @@ -AC_DEFUN([ACLOVE_CXX_FLAG_TEST], [ dnl WARNING: NOT REENTRANT - aclove_cxx_flag_test_save_cflags="$CXXFLAGS" - CXXFLAGS="$1" - AC_MSG_CHECKING([whether $CXX supports flag $1]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], - [AC_MSG_RESULT([yes])]; $2, - [AC_MSG_RESULT([no]); $3]) - CXXFLAGS="$aclove_cxx_flag_test_save_cflags" -]) - -AC_DEFUN([ACLOVE_GET_GCC_VERSION], [ - aclove_gcc_version_found="yes" - AC_COMPUTE_INT(aclove_gcc_version_major, __GNUC__,, aclove_gcc_version_found="no") - AC_COMPUTE_INT(aclove_gcc_version_minor, __GNUC_MINOR__,, aclove_gcc_version_found="no") - AC_COMPUTE_INT(aclove_gcc_version_patch, __GNUC_PATCHLEVEL__,, aclove_gcc_version_found="no") -]) - -AC_DEFUN([ACLOVE_GET_CLANG_VERSION], [ - aclove_clang_version_found="yes" - AC_COMPUTE_INT(aclove_clang_version_major, __clang_major__,, aclove_clang_version_found="no") - AC_COMPUTE_INT(aclove_clang_version_minor, __clang_minor__,, aclove_clang_version_found="no") - AC_COMPUTE_INT(aclove_clang_version_patch, __clang_patchlevel__,, aclove_clang_version_found="no") -]) - -AC_DEFUN([ACLOVE_CPP11_TEST_FLAG], [ - aclove_cpp11_test_cxx11name="no" - ACLOVE_CXX_FLAG_TEST([-std=c++0x], aclove_cpp11_test_cxx11name="c++0x", []) - ACLOVE_CXX_FLAG_TEST([-std=c++11], aclove_cpp11_test_cxx11name="c++11", []) - AS_VAR_IF([aclove_cpp11_test_cxx11name], [no], - [AC_MSG_ERROR([LÖVE needs a C++ compiler with C++11 support])], - [CXXFLAGS="$CXXFLAGS -std=$aclove_cpp11_test_cxx11name"]) -]) - -AC_DEFUN([ACLOVE_CPP11_CHECK_VERSION], [ dnl compiler, targetmajor, targetminor, on-failure - aclove_cpp11_check_version_status="no" - AC_MSG_CHECKING([whether $1 version is at least $2.$3]) - AS_IF([test "$aclove_[]$1[]_version_major" -gt $2], aclove_cpp11_check_version_status="yes") - AS_IF([test "$aclove_[]$1[]_version_major" -eq $2 && test "$aclove_[]$1[]_version_minor" -ge $3], aclove_cpp11_check_version_status="yes") - AC_MSG_RESULT([$aclove_cpp11_check_version_status]) - AS_VAR_IF([aclove_cpp11_check_version_status], [no], - [$4]) -]) - -AC_DEFUN([ACLOVE_CPP11_TEST_VERSION_GCC], [ - ACLOVE_CPP11_CHECK_VERSION([gcc], 4, 7, - [AC_MSG_ERROR([LÖVE needs a GCC version of at least 4.7])]) -]) - -AC_DEFUN([ACLOVE_CPP11_TEST_VERSION_CLANG], [ - ACLOVE_CPP11_CHECK_VERSION([clang], 3, 1, - [AC_MSG_ERROR([LÖVE needs a clang version of at least 3.1])]) -]) - -AC_DEFUN([ACLOVE_CPP11_TEST], [ - ACLOVE_CPP11_TEST_FLAG - - ACLOVE_GET_GCC_VERSION - ACLOVE_GET_CLANG_VERSION - - # Since clang also sets gcc headers, check clang after - aclove_cpp11_test_compiler="unknown" - AS_VAR_IF([aclove_gcc_version_found], [yes], aclove_cpp11_test_compiler="gcc") - AS_VAR_IF([aclove_clang_version_found], [yes], aclove_cpp11_test_compiler="clang") - - AS_CASE([$aclove_cpp11_test_compiler], - [gcc], [ACLOVE_CPP11_TEST_VERSION_GCC], - [clang], [ACLOVE_CPP11_TEST_VERSION_CLANG], - [AC_MSG_WARN([Could not determine compiler version])]) -]) diff --git a/love/src/jni/love/platform/unix/debian/changelog.in b/love/src/jni/love/platform/unix/debian/changelog.in deleted file mode 100644 index 1d528841..00000000 --- a/love/src/jni/love/platform/unix/debian/changelog.in +++ /dev/null @@ -1,5 +0,0 @@ -love@LOVE_SUFFIX@ (11.2~pre3458ppa1) trusty; urgency=medium - - * Upstream testing release - - -- Bart van Strien Tue, 10 Jul 2018 19:22:30 +0200 diff --git a/love/src/jni/love/platform/unix/debian/compat b/love/src/jni/love/platform/unix/debian/compat deleted file mode 100644 index ec635144..00000000 --- a/love/src/jni/love/platform/unix/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/love/src/jni/love/platform/unix/debian/control.in b/love/src/jni/love/platform/unix/debian/control.in deleted file mode 100644 index 1f65c293..00000000 --- a/love/src/jni/love/platform/unix/debian/control.in +++ /dev/null @@ -1,51 +0,0 @@ -Source: love@LOVE_SUFFIX@ -Section: games -Priority: extra -Maintainer: Bart van Strien -Build-Depends: debhelper (>= 9), - dh-autoreconf, - pkg-config, - libtool, - g++ (>= 4.7.0), - libfreetype6-dev, - luajit, - libluajit-5.1-dev, - libmodplug-dev, - libmpg123-dev, - libopenal-dev, - libphysfs-dev, - libsdl2-dev (>= 2.0.1), - libogg-dev, - libvorbis-dev, - libtheora-dev, - zlib1g-dev -Standards-Version: 3.9.5 -Homepage: http://love2d.org - -Package: liblove@LOVE_SUFFIX@0 -Section: libs -Architecture: any -Multi-Arch: same -Pre-Depends: ${misc:Pre-Depends} -Depends: ${misc:Depends}, - ${shlibs:Depends} -Description: 2D game engine - runtime - LOVE is a free 2D game engine which enables easy game creation in Lua. - -Package: love@LOVE_SUFFIX@ -Architecture: any -Depends: ${misc:Depends}, - ${shlibs:Depends}, - liblove@LOVE_SUFFIX@0 (= ${binary:Version}) -Description: 2D game engine - LOVE is a free 2D game engine which enables easy game creation in Lua. - -Package: liblove@LOVE_SUFFIX@-dbg -Priority: extra -Section: debug -Architecture: any -Multi-Arch: same -Depends: ${misc:Depends}, - liblove@LOVE_SUFFIX@0 (= ${binary:Version}) -Description: 2D game engine - debug symbols - LOVE is a free 2D game engine which enables easy game creation in Lua. diff --git a/love/src/jni/love/platform/unix/debian/copyright b/love/src/jni/love/platform/unix/debian/copyright deleted file mode 100644 index d41eca42..00000000 --- a/love/src/jni/love/platform/unix/debian/copyright +++ /dev/null @@ -1,27 +0,0 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: LÖVE -Upstream-Contact: Bart van Strien -Source: http://www.love2d.org/ - -Files: * -Copyright: 2006-2018 LOVE Development Team -License: zlib - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - . - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - . - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - . - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - . - 3. This notice may not be removed or altered from any source - distribution. - diff --git a/love/src/jni/love/platform/unix/debian/docs b/love/src/jni/love/platform/unix/debian/docs deleted file mode 100644 index 6f69fe09..00000000 --- a/love/src/jni/love/platform/unix/debian/docs +++ /dev/null @@ -1,2 +0,0 @@ -changes.txt -license.txt diff --git a/love/src/jni/love/platform/unix/debian/liblove-unstable0.docs b/love/src/jni/love/platform/unix/debian/liblove-unstable0.docs deleted file mode 100644 index cdb5f04f..00000000 --- a/love/src/jni/love/platform/unix/debian/liblove-unstable0.docs +++ /dev/null @@ -1 +0,0 @@ -readme.md diff --git a/love/src/jni/love/platform/unix/debian/liblove-unstable0.install b/love/src/jni/love/platform/unix/debian/liblove-unstable0.install deleted file mode 100644 index 0a2119ad..00000000 --- a/love/src/jni/love/platform/unix/debian/liblove-unstable0.install +++ /dev/null @@ -1 +0,0 @@ -usr/lib/*/liblove-unstable-*.so diff --git a/love/src/jni/love/platform/unix/debian/liblove0.docs b/love/src/jni/love/platform/unix/debian/liblove0.docs deleted file mode 100644 index cdb5f04f..00000000 --- a/love/src/jni/love/platform/unix/debian/liblove0.docs +++ /dev/null @@ -1 +0,0 @@ -readme.md diff --git a/love/src/jni/love/platform/unix/debian/liblove0.install b/love/src/jni/love/platform/unix/debian/liblove0.install deleted file mode 100644 index f363129b..00000000 --- a/love/src/jni/love/platform/unix/debian/liblove0.install +++ /dev/null @@ -1 +0,0 @@ -usr/lib/*/liblove-*.so diff --git a/love/src/jni/love/platform/unix/debian/love-unstable.install b/love/src/jni/love/platform/unix/debian/love-unstable.install deleted file mode 100644 index 77ebbd10..00000000 --- a/love/src/jni/love/platform/unix/debian/love-unstable.install +++ /dev/null @@ -1 +0,0 @@ -usr/bin/love-unstable diff --git a/love/src/jni/love/platform/unix/debian/love-unstable.manpages b/love/src/jni/love/platform/unix/debian/love-unstable.manpages deleted file mode 100644 index 31aab155..00000000 --- a/love/src/jni/love/platform/unix/debian/love-unstable.manpages +++ /dev/null @@ -1 +0,0 @@ -platform/unix/love-unstable.6 diff --git a/love/src/jni/love/platform/unix/debian/love.install b/love/src/jni/love/platform/unix/debian/love.install deleted file mode 100644 index 97b36762..00000000 --- a/love/src/jni/love/platform/unix/debian/love.install +++ /dev/null @@ -1,5 +0,0 @@ -usr/bin -usr/share/applications -usr/share/mime -usr/share/pixmaps -usr/share/icons diff --git a/love/src/jni/love/platform/unix/debian/love.manpages b/love/src/jni/love/platform/unix/debian/love.manpages deleted file mode 100644 index 09688d49..00000000 --- a/love/src/jni/love/platform/unix/debian/love.manpages +++ /dev/null @@ -1 +0,0 @@ -platform/unix/love.6 diff --git a/love/src/jni/love/platform/unix/debian/rules.in b/love/src/jni/love/platform/unix/debian/rules.in deleted file mode 100755 index f55809f6..00000000 --- a/love/src/jni/love/platform/unix/debian/rules.in +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/make -f - -commonflags = -Wall -Wno-maybe-uninitialized -Wno-strict-aliasing -CFLAGS += $(commonflags) -CXXFLAGS += $(commonflags) - - -%: - dh $@ --parallel --with autoreconf - -override_dh_auto_clean: - dh_auto_clean - rm -f platform/unix/love-unstable.6 - -override_dh_auto_configure: - dh_auto_configure -- --with-lua=luajit - -override_dh_installdocs: - dh_installdocs --link-doc=liblove@LOVE_SUFFIX@0 - -override_dh_installchangelogs: - dh_installchangelogs changes.txt - -override_dh_installman: - cp -f platform/unix/love.6 platform/unix/love-unstable.6 - dh_installman - -override_dh_strip: - dh_strip -pliblove@LOVE_SUFFIX@0 --dbg-package=liblove@LOVE_SUFFIX@-dbg - dh_strip --remaining-packages - diff --git a/love/src/jni/love/platform/unix/debian/source/format b/love/src/jni/love/platform/unix/debian/source/format deleted file mode 100644 index 89ae9db8..00000000 --- a/love/src/jni/love/platform/unix/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (native) diff --git a/love/src/jni/love/platform/unix/deps.m4 b/love/src/jni/love/platform/unix/deps.m4 deleted file mode 100644 index 42938d96..00000000 --- a/love/src/jni/love/platform/unix/deps.m4 +++ /dev/null @@ -1,77 +0,0 @@ -AC_DEFUN([ACLOVE_DEP_FREETYPE2], [ - PKG_CHECK_MODULES([freetype2], [freetype2], [], [LOVE_MSG_ERROR([FreeType2])])]) - -AC_DEFUN([ACLOVE_DEP_OPENAL], [ - PKG_CHECK_MODULES([openal], [openal], [], [LOVE_MSG_ERROR([OpenAL])])]) - -AC_DEFUN([ACLOVE_DEP_LIBMODPLUG], [ - PKG_CHECK_MODULES([libmodplug], [libmodplug], [], [LOVE_MSG_ERROR([libmodplug])])]) - -AC_DEFUN([ACLOVE_DEP_VORBISFILE], [ - PKG_CHECK_MODULES([vorbisfile], [vorbisfile], [], [LOVE_MSG_ERROR([libvorbis and libvorbisfile])])]) - -AC_DEFUN([ACLOVE_DEP_ZLIB], [ - PKG_CHECK_MODULES([zlib], [zlib], [], [LOVE_MSG_ERROR([zlib])])]) - -AC_DEFUN([ACLOVE_DEP_THEORA], [ - PKG_CHECK_MODULES([theora], [theoradec], [], [LOVE_MSG_ERROR([libtheora])])]) - -AC_DEFUN([ACLOVE_DEP_LIBM], [ - AC_SEARCH_LIBS([sqrt], [m], [], [LOVE_MSG_ERROR([the C math library])])]) - -AC_DEFUN([ACLOVE_DEP_SDL2], [ - AM_PATH_SDL2([], [], [LOVE_MSG_ERROR([SDL 2])])]) - -AC_DEFUN([ACLOVE_DEP_PTHREAD], [ - AC_SEARCH_LIBS([pthread_create], [pthread], [], [LOVE_MSG_ERROR([the POSIX threads library])])]) - -# does not use pkg-config because of the FILE_OFFSET_BITS.. bit -AC_DEFUN([ACLOVE_DEP_MPG123], [ - AC_SEARCH_LIBS([mpg123_open_feed], [mpg123], [], - [LOVE_MSG_ERROR([libmpg123])]) - AC_SEARCH_LIBS([mpg123_seek_64], [mpg123], - AC_SUBST([FILE_OFFSET],[-D_FILE_OFFSET_BITS=64]), - AC_SUBST([FILE_OFFSET],[]))]) - -AC_DEFUN([ACLOVE_DEP_GME], [ - AC_SEARCH_LIBS([gme_open_data], [gme], [], [LOVE_MSG_ERROR([gme])]) - AC_DEFINE([LOVE_SUPPORT_GME], [], [Enable gme]) - AC_CHECK_HEADER([gme/gme.h], [includes="$includes -I/usr/include/gme"], [])]) - -# For enet -AC_DEFUN([ACLOVE_SOCKLEN_T], [ - AC_CHECK_TYPE([socklen_t], [AC_DEFINE([HAS_SOCKLEN_T], [1], [Define if socklen_t exists.] )], , - #include - #include - )]) - -# The lua detection is quite annoying because of distro differences and our version selection code -AC_DEFUN([ACLOVE_DEP_LUA_PKGCONFIG], [ - PKG_CHECK_MODULES([lua], [${with_lua}${with_luaversion}], [aclove_lua_found=yes], - [PKG_CHECK_MODULES([lua], [${with_lua}${with_clean_luaversion}], [aclove_lua_found=yes], - [PKG_CHECK_MODULES([lua], [${with_lua}], [aclove_lua_found=yes], [])])]) - - AS_VAR_IF([aclove_lua_found], [yes], - [ - aclove_luaheaders_found=yes - AC_MSG_CHECKING([for library containing lua_call]) - AC_MSG_RESULT([${lua_LIBS}]) - ], [])]) - -AC_DEFUN([ACLOVE_DEP_LUA_FALLBACK], [ - AC_MSG_WARN([Could not find pkg-config definition for ${with_lua}${with_luaversion} or ${with_lua}${with_clean_luaversion}${with_lua}, falling back to manual detection]) - AC_SEARCH_LIBS([lua_call], ["${with_lua}${with_luaversion}" "${with_lua}"], [aclove_lua_found=yes], - [LOVE_MSG_ERROR([$with_lua])]) - - AC_CHECK_HEADER(["${with_lua}${with_luaversion}/lua.h"], [aclove_luaheaders_found=yes includes="$includes -I/usr/include/${with_lua}${with_luaversion}"], []) - AC_CHECK_HEADER(["${with_lua}/lua.h"], [aclove_luaheaders_found=yes includes="$includes -I/usr/include/${with_lua}"], [])]) - -# First, try pkg-config, then fall back to manual detection if not available. -AC_DEFUN([ACLOVE_DEP_LUA], [ dnl Requires with-lua and with-luaversion - aclove_lua_found=no - aclove_luaheaders_found=no - - ACLOVE_DEP_LUA_PKGCONFIG - AS_VAR_IF([aclove_lua_found], [no], [ACLOVE_DEP_LUA_FALLBACK], []) - AS_VAR_IF([aclove_luaheaders_found], [no], - [AC_MSG_WARN([Could not locate lua headers for ${with_lua}${with_luaversion} or ${with_lua}, you probably need to specify them with CPPFLAGS])], [])]) diff --git a/love/src/jni/love/platform/unix/exclude b/love/src/jni/love/platform/unix/exclude deleted file mode 100644 index a221cf61..00000000 --- a/love/src/jni/love/platform/unix/exclude +++ /dev/null @@ -1,6 +0,0 @@ -\./libraries/luasocket/libluasocket/wsocket.* -\./modules/sound/lullaby/FLACDecoder\..* -\./love\.cpp -\./modules/sound/lullaby/Mpg123Decoder\.cpp -\./modules/sound/lullaby/Mpg123Decoder\.h -\./libraries/glslang/glslang/OSDependent/Windows diff --git a/love/src/jni/love/platform/unix/genmodules b/love/src/jni/love/platform/unix/genmodules deleted file mode 100644 index b757554b..00000000 --- a/love/src/jni/love/platform/unix/genmodules +++ /dev/null @@ -1,165 +0,0 @@ -#!/bin/bash - -love_suffix="$1" -love_amsuffix="$(echo "$love_suffix" | sed 's/\-/_/g' | sed 's/\./_/g')" - -flags=() -upper() -{ - echo "$@" | tr '[:lower:]' '[:upper:]' -} - -sourcefind() -{ - find "$1" $2 -type f \( -iname "*.c" -o -iname "*.cpp" -o -iname "*.h" -o -iname "*.hpp" -o -iname "*.lch" -o -iname "*.lua" \) | awk "{print \"./$prefix\"\$0\" \\\\\"}" | grep -v -f"$LOVEROOT/platform/unix/exclude" | sort -} - -handlemodule() -{ - module="$1" - DEFINENAME="LOVE_MODULE_$(upper "$module")" - printf "$DEFINENAME" -} - -genmodules() -{ - LOVEROOT="$(pwd)" - cd ./src - - printf "liblove${love_amsuffix}_la_SOURCES = \\\\\n" - sourcefind "common" | sed "s/^/ /" - FILES="$(sourcefind "scripts" | sed "s/^/ /")" - printf "${FILES:0:${#FILES}-2}\n\n" - - local -a modulelist=() - local -a liblist=() - - cd ./modules - prefix="modules/" - for module in *; do - flags+=("module-$module") - - FILES="$(sourcefind "$module" | sed "s/^/ /")" - if [[ "x$FILES" != "x" ]]; then - printf "liblove_module_$module = \\\\\n" - printf "${FILES:0:${#FILES}-2}\n\n" - modulelist+=("$module") - fi - - if [[ "$module" = "sound" ]]; then - printf "if !LOVE_NOMPG123\n" - printf "liblove_module_$module += \\\\\n" - printf "\t./modules/sound/lullaby/Mpg123Decoder.cpp \\\\\n" - printf "\t./modules/sound/lullaby/Mpg123Decoder.h\n" - printf "endif\n\n" - fi - done - - cd ../libraries - prefix="libraries/" - for library in *; do - flags+=("library-$library") - FILES="$(sourcefind "$library" | sed "s/^/ /")" - - if [[ ${#FILES} -gt 2 ]]; then - printf "liblove_library_$library = \\\\\n" - printf "${FILES:0:${#FILES}-2}\n\n" - liblist+=("$library") - fi - done - - for module in "${modulelist[@]}"; do - NAME=$(handlemodule "$module") - printf "if $NAME\n" - printf "liblove${love_amsuffix}_la_SOURCES += \$(liblove_module_$module)\n" - printf "endif\n\n" - done - - for library in "${liblist[@]}"; do - NAME="LOVE_LIBRARY_$(upper "$library")" - printf "if $NAME\n" - printf "liblove${love_amsuffix}_la_SOURCES += \$(liblove_library_$library)\n" - printf "endif\n\n" - done - - cd ../.. -} - -genflags() -{ - printf > configure-modules-pre.ac - printf > configure-modules-post.ac - for flag in "${flags[@]}"; do - prettyflag="$(echo "$flag" | sed -e 's/-/ love./' -e 's/-/./g')" - varflag="enable_$(echo "$flag" | sed -e 's/[^a-zA-Z0-9]/_/')" - defineflag="LOVE_ENABLE_$(upper $(echo $flag | sed -e 's/^[^-]*-//' -e 's/-/_/g'))" - amflag="$(upper $(echo love-$flag | sed 's/-/_/g'))" - - # Don't generate an --enable rule for libraries - if [[ "$(echo $flag | sed -e '/^library-/d')" != "" ]]; then - printf "AC_ARG_ENABLE([$flag], [ --disable-$flag Turn off $prettyflag], [], [$varflag=yes])\n" >> configure-modules-pre.ac - fi - - printf "AH_TEMPLATE([$defineflag], [])\n" >> configure-modules-post.ac - printf "if test x\"\$$varflag\" = xyes; then\n" >> configure-modules-post.ac - printf " AC_DEFINE([$defineflag], [])\n" >> configure-modules-post.ac - printf "fi\n" >> configure-modules-post.ac - printf "AM_CONDITIONAL([$amflag], [test x\$$varflag = xyes])\n\n" >> configure-modules-post.ac - done -} - -echo Generating src/Makefile.am ... -inc_current='$(srcdir)' -inc_modules="$inc_current/modules" -inc_libraries="$inc_current/libraries" - -cat > src/Makefile.am << EOF -AM_CPPFLAGS = -I$inc_current -I$inc_modules -I$inc_libraries -I$inc_libraries/enet/libenet/include \$(LOVE_INCLUDES) \$(FILE_OFFSET)\ - \$(SDL_CFLAGS) \$(lua_CFLAGS) \$(freetype2_CFLAGS)\ - \$(openal_CFLAGS) \$(zlib_CFLAGS) \$(libmodplug_CFLAGS)\ - \$(vorbisfile_CFLAGS) \$(theora_CFLAGS) -AUTOMAKE_OPTIONS = subdir-objects -SUBDIRS = -SUFFIXES = .lua .lua.h - -if LOVE_BUILD_EXE -# LÖVE executable -bin_PROGRAMS = love${love_suffix} -#love_LDFLAGS = -love${love_amsuffix}_LDADD = liblove${love_suffix}.la \$(lua_LIBS) -love${love_amsuffix}_SOURCES = love.cpp - -if LOVE_TARGET_OSX -love${love_amsuffix}_LIBTOOLFLAGS = --tag=OBJCXX -love${love_amsuffix}_SOURCES += \\ - ./common/macosx.mm -else -love${love_amsuffix}_LIBTOOLFLAGS = --tag=CXX -endif -endif - -# Compile scripts -.lua.lua.h: - cd ./scripts; \ - \$(LUA_EXECUTABLE) auto.lua \$< - -# libLÖVE -lib_LTLIBRARIES = liblove${love_suffix}.la -liblove${love_amsuffix}_la_LDFLAGS = -module -export-dynamic \$(LDFLAGS) -release \$(PACKAGE_VERSION) -liblove${love_amsuffix}_la_LIBADD = \ - \$(SDL_LIBS) \$(freetype2_LIBS) \$(lua_LIBS)\ - \$(openal_LIBS) \$(zlib_LIBS) \$(libmodplug_LIBS)\ - \$(vorbisfile_LIBS) \$(theora_LIBS) - -EOF - -genmodules >> src/Makefile.am - -echo "src/Makefile.am is updated! ^.^" - -echo "Generating configure-modules.ac" -genflags -cat >> configure-modules-post.ac << EOF -AC_SUBST([LOVE_SUFFIX], [${love_suffix}]) -EOF -echo "configure-modules.ac is updated! ^.^" diff --git a/love/src/jni/love/platform/unix/love.6 b/love/src/jni/love/platform/unix/love.6 deleted file mode 100644 index bc029c92..00000000 --- a/love/src/jni/love/platform/unix/love.6 +++ /dev/null @@ -1,33 +0,0 @@ -.\" (c) 2008-2011 Miriam Ruiz -.\" (c) 2013-2018 Bart van Strien -.\" -.\" This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damagesarising from the use of this software. -.\" -.\" Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: -.\" -.\" 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -.\" -.\" 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -.\" -.\" 3. This notice may not be removed or altered from any source distribution. -.Dd March 31, 2018 -.Dt LOVE 6 -.Os LÖVE 11.2 -.Sh NAME -.Nm love -.Nd 2D game development framework -.Sh SYNOPSIS -.Nm love -.Op Fl Fl fused -.Ar game Ns .love -.Pp -.Nm love -.Fl Fl version -.Sh DESCRIPTION -LÖVE was created to be a user-friendly engine in which simple (or complicated) games could be made without having extensive knowledge of system or graphics functions and without having to dedicate time towards developing the same engine features time and time again. -.Pp -Developed with cross-platform implementation in mind, it utilizes the latest open source libraries to deliver a similar game experience, independent of operating system. -By relying on the Lua scripting language for game-specific programming, it allows even the novice game creator to quickly and efficiently develop an idea into a fully working game. -.Sh SEE ALSO -You can find more information at -.Lk http://love2d.org/ diff --git a/love/src/jni/love/platform/unix/love.desktop.in b/love/src/jni/love/platform/unix/love.desktop.in deleted file mode 100644 index 94c9bb41..00000000 --- a/love/src/jni/love/platform/unix/love.desktop.in +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Name=LÖVE -Comment=The unquestionably awesome 2D game engine -MimeType=application/x-love-game; -Exec=@bindir@/love %f -Type=Application -Categories=Development;Game; -Terminal=false -Icon=love -NoDisplay=true diff --git a/love/src/jni/love/platform/unix/love.svg b/love/src/jni/love/platform/unix/love.svg deleted file mode 100644 index 552ad178..00000000 --- a/love/src/jni/love/platform/unix/love.svg +++ /dev/null @@ -1,962 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/love/src/jni/love/platform/unix/love.xml b/love/src/jni/love/platform/unix/love.xml deleted file mode 100644 index 2ab5ac89..00000000 --- a/love/src/jni/love/platform/unix/love.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - LÖVE game - - - diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/Contents.json b/love/src/jni/love/platform/xcode/Images.xcassets/Contents.json deleted file mode 100644 index da4a164c..00000000 --- a/love/src/jni/love/platform/xcode/Images.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_128x128.png b/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_128x128.png deleted file mode 100644 index 6aaf64d0..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_128x128.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_128x128@2x.png b/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_128x128@2x.png deleted file mode 100644 index bfbccd33..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_128x128@2x.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_16x16.png b/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_16x16.png deleted file mode 100644 index 81b7da9f..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_16x16.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_16x16@2x.png b/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_16x16@2x.png deleted file mode 100644 index e28e79f8..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_16x16@2x.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_256x256.png b/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_256x256.png deleted file mode 100644 index bfbccd33..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_256x256.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_256x256@2x.png b/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_256x256@2x.png deleted file mode 100644 index 28054d71..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_256x256@2x.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_32x32.png b/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_32x32.png deleted file mode 100644 index e28e79f8..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_32x32.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_32x32@2x.png b/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_32x32@2x.png deleted file mode 100644 index 75847d1e..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_32x32@2x.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_512x512.png b/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_512x512.png deleted file mode 100644 index 28054d71..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_512x512.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_512x512@2x.png b/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_512x512@2x.png deleted file mode 100644 index 08683780..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/GameIcon.iconset/icon_512x512@2x.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/1024.png b/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/1024.png deleted file mode 100644 index 6c52a9de..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/1024.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/128.png b/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/128.png deleted file mode 100644 index 82c74bcd..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/128.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/16.png b/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/16.png deleted file mode 100644 index 1b310d3f..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/16.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/256.png b/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/256.png deleted file mode 100644 index cd021215..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/256.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/32.png b/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/32.png deleted file mode 100644 index 5c0890d2..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/32.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/512.png b/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/512.png deleted file mode 100644 index 17915d68..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/512.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/64.png b/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/64.png deleted file mode 100644 index be300b35..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/64.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/Contents.json b/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/Contents.json deleted file mode 100644 index 79b9cdda..00000000 --- a/love/src/jni/love/platform/xcode/Images.xcassets/OS X AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "images" : [ - { - "size" : "16x16", - "idiom" : "mac", - "filename" : "16.png", - "scale" : "1x" - }, - { - "size" : "16x16", - "idiom" : "mac", - "filename" : "32.png", - "scale" : "2x" - }, - { - "size" : "32x32", - "idiom" : "mac", - "filename" : "32.png", - "scale" : "1x" - }, - { - "size" : "32x32", - "idiom" : "mac", - "filename" : "64.png", - "scale" : "2x" - }, - { - "size" : "128x128", - "idiom" : "mac", - "filename" : "128.png", - "scale" : "1x" - }, - { - "size" : "128x128", - "idiom" : "mac", - "filename" : "256.png", - "scale" : "2x" - }, - { - "size" : "256x256", - "idiom" : "mac", - "filename" : "256.png", - "scale" : "1x" - }, - { - "size" : "256x256", - "idiom" : "mac", - "filename" : "512.png", - "scale" : "2x" - }, - { - "size" : "512x512", - "idiom" : "mac", - "filename" : "512.png", - "scale" : "1x" - }, - { - "size" : "512x512", - "idiom" : "mac", - "filename" : "1024.png", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/Contents.json b/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/Contents.json deleted file mode 100644 index 491c8185..00000000 --- a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,154 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "3x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "icon-29pt@1x.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "icon-29pt@2x.png", - "scale" : "2x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "icon-29pt@3x.png", - "scale" : "3x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "icon-40pt@2x.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "icon-40pt@3x.png", - "scale" : "3x" - }, - { - "size" : "57x57", - "idiom" : "iphone", - "filename" : "icon-57pt@1x.png", - "scale" : "1x" - }, - { - "size" : "57x57", - "idiom" : "iphone", - "filename" : "icon-57pt@2x.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "icon-60pt@2x.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "icon-60pt@3x.png", - "scale" : "3x" - }, - { - "idiom" : "ipad", - "size" : "20x20", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "20x20", - "scale" : "2x" - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "icon-29pt@1x.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "icon-29pt@2x.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "icon-40pt@1x.png", - "scale" : "1x" - }, - { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "icon-40pt@2x.png", - "scale" : "2x" - }, - { - "size" : "50x50", - "idiom" : "ipad", - "filename" : "icon-50pt@1x.png", - "scale" : "1x" - }, - { - "size" : "50x50", - "idiom" : "ipad", - "filename" : "icon-50pt@2x.png", - "scale" : "2x" - }, - { - "size" : "72x72", - "idiom" : "ipad", - "filename" : "icon-72pt@1x.png", - "scale" : "1x" - }, - { - "size" : "72x72", - "idiom" : "ipad", - "filename" : "icon-72pt@2x.png", - "scale" : "2x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "icon-76pt@1x.png", - "scale" : "1x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "icon-76pt@2x.png", - "scale" : "2x" - }, - { - "size" : "83.5x83.5", - "idiom" : "ipad", - "filename" : "icon-83.5pt@2x.png", - "scale" : "2x" - }, - { - "idiom" : "ios-marketing", - "size" : "1024x1024", - "filename" : "icon-1024pt@1x.png", - "scale" : "1x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-1024pt@1x.png b/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-1024pt@1x.png deleted file mode 100644 index e8d73b8d..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-1024pt@1x.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-29pt@1x.png b/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-29pt@1x.png deleted file mode 100644 index 8b548ef9..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-29pt@1x.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-29pt@2x.png b/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-29pt@2x.png deleted file mode 100644 index 1fcc4be3..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-29pt@2x.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-29pt@3x.png b/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-29pt@3x.png deleted file mode 100644 index d7a8b600..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-29pt@3x.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-40pt@1x.png b/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-40pt@1x.png deleted file mode 100644 index aa936450..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-40pt@1x.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-40pt@2x.png b/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-40pt@2x.png deleted file mode 100644 index 6705cbfa..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-40pt@2x.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-40pt@3x.png b/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-40pt@3x.png deleted file mode 100644 index 54ca124f..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-40pt@3x.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-50pt@1x.png b/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-50pt@1x.png deleted file mode 100644 index 8b9b1118..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-50pt@1x.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-50pt@2x.png b/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-50pt@2x.png deleted file mode 100644 index 9806b708..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-50pt@2x.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-57pt@1x.png b/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-57pt@1x.png deleted file mode 100644 index 02d7cc98..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-57pt@1x.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-57pt@2x.png b/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-57pt@2x.png deleted file mode 100644 index 68f89850..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-57pt@2x.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-60pt@2x.png b/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-60pt@2x.png deleted file mode 100644 index 54ca124f..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-60pt@2x.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-60pt@3x.png b/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-60pt@3x.png deleted file mode 100644 index c93997c0..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-60pt@3x.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-72pt@1x.png b/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-72pt@1x.png deleted file mode 100644 index a47c6d10..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-72pt@1x.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-72pt@2x.png b/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-72pt@2x.png deleted file mode 100644 index 0850319f..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-72pt@2x.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-76pt@1x.png b/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-76pt@1x.png deleted file mode 100644 index f90a1360..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-76pt@1x.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-76pt@2x.png b/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-76pt@2x.png deleted file mode 100644 index c2cba8cc..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-76pt@2x.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-83.5pt@2x.png b/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-83.5pt@2x.png deleted file mode 100644 index ac90e1bb..00000000 Binary files a/love/src/jni/love/platform/xcode/Images.xcassets/iOS AppIcon.appiconset/icon-83.5pt@2x.png and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/Images.xcassets/iOS LaunchImage.launchimage/Contents.json b/love/src/jni/love/platform/xcode/Images.xcassets/iOS LaunchImage.launchimage/Contents.json deleted file mode 100644 index 3dd8aa5b..00000000 --- a/love/src/jni/love/platform/xcode/Images.xcassets/iOS LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "images" : [ - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "8.0", - "subtype" : "736h", - "scale" : "3x" - }, - { - "orientation" : "landscape", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "8.0", - "subtype" : "736h", - "scale" : "3x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "8.0", - "subtype" : "667h", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "subtype" : "retina4", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "subtype" : "retina4", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/love/src/jni/love/platform/xcode/ios/Launch Screen.xib b/love/src/jni/love/platform/xcode/ios/Launch Screen.xib deleted file mode 100644 index 45fffdbd..00000000 --- a/love/src/jni/love/platform/xcode/ios/Launch Screen.xib +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/love/src/jni/love/platform/xcode/ios/love-ios.plist b/love/src/jni/love/platform/xcode/ios/love-ios.plist deleted file mode 100644 index 3aabf729..00000000 --- a/love/src/jni/love/platform/xcode/ios/love-ios.plist +++ /dev/null @@ -1,102 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleDisplayName - ${PRODUCT_NAME} - CFBundleDocumentTypes - - - CFBundleTypeIconFiles - - LoveDocument.icns - - CFBundleTypeName - LÖVE Project - CFBundleTypeRole - Viewer - LSHandlerRank - Owner - LSItemContentTypes - - org.love2d.love-game - - - - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIcons - - CFBundleIcons~ipad - - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleShortVersionString - 11.2 - CFBundleSignature - ???? - CFBundleVersion - 1.0 - LSRequiresIPhoneOS - - UIFileSharingEnabled - - UILaunchStoryboardName - Launch Screen - UIRequiredDeviceCapabilities - - opengles-2 - - UIStatusBarStyle - UIStatusBarStyleLightContent - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UTExportedTypeDeclarations - - - UTTypeConformsTo - - com.pkware.zip-archive - - UTTypeDescription - LÖVE Project - UTTypeIdentifier - org.love2d.love-game - UTTypeSize320IconFile - LoveDocument - UTTypeSize64IconFile - LoveDocument - UTTypeTagSpecification - - com.apple.ostype - LOVE - public.filename-extension - - love - - public.mime-type - application/x-love-game - - - - - diff --git a/love/src/jni/love/platform/xcode/ios/lovedocument.icns b/love/src/jni/love/platform/xcode/ios/lovedocument.icns deleted file mode 100644 index 1dede26b..00000000 Binary files a/love/src/jni/love/platform/xcode/ios/lovedocument.icns and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/ios/luajit-iOS.sh b/love/src/jni/love/platform/xcode/ios/luajit-iOS.sh deleted file mode 100755 index b8b3e172..00000000 --- a/love/src/jni/love/platform/xcode/ios/luajit-iOS.sh +++ /dev/null @@ -1,52 +0,0 @@ -mkdir -p include/luajit -mkdir -p libraries/luajit - -git clone https://github.com/LuaJIT/LuaJIT.git luajit-git -cd luajit-git -git pull -git checkout v2.1 - -# iOS device binaries - -ISDKP=$(xcrun --sdk iphoneos --show-sdk-path) -ICC=$(xcrun --sdk iphoneos --find clang) - -ISDKF="-arch armv7 -isysroot $ISDKP -mios-version-min=8.0" -make clean -make -j8 HOST_CC="clang -m32 -arch i386" CROSS="$(dirname $ICC)/" TARGET_FLAGS="$ISDKF" TARGET_SYS=iOS -cp src/libluajit.a ../libraries/luajit/libluajit_arm7.a - -ISDKF="-arch arm64 -isysroot $ISDKP -mios-version-min=8.0" -make clean -make -j8 CROSS="$(dirname $ICC)/" TARGET_FLAGS="$ISDKF" TARGET_SYS=iOS -cp src/libluajit.a ../libraries/luajit/libluajit_arm64.a - - -# iOS simulator binaries - -ISDKP=$(xcrun --sdk iphonesimulator --show-sdk-path) -ICC=$(xcrun --sdk iphonesimulator --find clang) - -ISDKF="-arch i386 -isysroot $ISDKP -mios-simulator-version-min=8.0" -make clean -make -j8 HOST_CC="clang -m32 -arch i386" CROSS="$(dirname $ICC)/" TARGET_FLAGS="$ISDKF" TARGET_SYS=iOS -cp src/libluajit.a ../libraries/luajit/libluajit_x86.a - -ISDKF="-arch x86_64 -isysroot $ISDKP -mios-simulator-version-min=8.0" -make clean -make -j8 CROSS="$(dirname $ICC)/" TARGET_FLAGS="$ISDKF" TARGET_SYS=iOS -cp src/libluajit.a ../libraries/luajit/libluajit_x86_64.a - - -# copy includes -cp src/lua.hpp ../include/luajit - -cp src/lauxlib.h ../include/luajit -cp src/lua.h ../include/luajit -cp src/luaconf.h ../include/luajit -cp src/lualib.h ../include/luajit -cp src/luajit.h ../include/luajit - -# combine lib -cd ../libraries/luajit -lipo -create -output libluajit.a libluajit_arm7.a libluajit_arm64.a libluajit_x86.a libluajit_x86_64.a diff --git a/love/src/jni/love/platform/xcode/liblove.xcodeproj/project.pbxproj b/love/src/jni/love/platform/xcode/liblove.xcodeproj/project.pbxproj deleted file mode 100644 index 663a17ed..00000000 --- a/love/src/jni/love/platform/xcode/liblove.xcodeproj/project.pbxproj +++ /dev/null @@ -1,5435 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 217DFBD91D9F6D490055D849 /* auxiliar.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFB9D1D9F6D490055D849 /* auxiliar.c */; }; - 217DFBDA1D9F6D490055D849 /* auxiliar.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFB9E1D9F6D490055D849 /* auxiliar.h */; }; - 217DFBDB1D9F6D490055D849 /* buffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFB9F1D9F6D490055D849 /* buffer.c */; }; - 217DFBDC1D9F6D490055D849 /* buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBA01D9F6D490055D849 /* buffer.h */; }; - 217DFBDD1D9F6D490055D849 /* compat.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBA11D9F6D490055D849 /* compat.c */; }; - 217DFBDE1D9F6D490055D849 /* compat.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBA21D9F6D490055D849 /* compat.h */; }; - 217DFBDF1D9F6D490055D849 /* except.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBA31D9F6D490055D849 /* except.c */; }; - 217DFBE01D9F6D490055D849 /* except.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBA41D9F6D490055D849 /* except.h */; }; - 217DFBE11D9F6D490055D849 /* ftp.lua in Resources */ = {isa = PBXBuildFile; fileRef = 217DFBA51D9F6D490055D849 /* ftp.lua */; }; - 217DFBE21D9F6D490055D849 /* ftp.lua.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBA61D9F6D490055D849 /* ftp.lua.h */; }; - 217DFBE31D9F6D490055D849 /* headers.lua in Resources */ = {isa = PBXBuildFile; fileRef = 217DFBA71D9F6D490055D849 /* headers.lua */; }; - 217DFBE41D9F6D490055D849 /* headers.lua.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBA81D9F6D490055D849 /* headers.lua.h */; }; - 217DFBE51D9F6D490055D849 /* http.lua in Resources */ = {isa = PBXBuildFile; fileRef = 217DFBA91D9F6D490055D849 /* http.lua */; }; - 217DFBE61D9F6D490055D849 /* http.lua.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBAA1D9F6D490055D849 /* http.lua.h */; }; - 217DFBE71D9F6D490055D849 /* inet.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBAB1D9F6D490055D849 /* inet.c */; }; - 217DFBE81D9F6D490055D849 /* inet.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBAC1D9F6D490055D849 /* inet.h */; }; - 217DFBE91D9F6D490055D849 /* io.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBAD1D9F6D490055D849 /* io.c */; }; - 217DFBEA1D9F6D490055D849 /* io.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBAE1D9F6D490055D849 /* io.h */; }; - 217DFBEB1D9F6D490055D849 /* ltn12.lua in Resources */ = {isa = PBXBuildFile; fileRef = 217DFBAF1D9F6D490055D849 /* ltn12.lua */; }; - 217DFBEC1D9F6D490055D849 /* ltn12.lua.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBB01D9F6D490055D849 /* ltn12.lua.h */; }; - 217DFBED1D9F6D490055D849 /* luasocket.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBB11D9F6D490055D849 /* luasocket.c */; }; - 217DFBEE1D9F6D490055D849 /* luasocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBB21D9F6D490055D849 /* luasocket.h */; }; - 217DFBF01D9F6D490055D849 /* mbox.lua in Resources */ = {isa = PBXBuildFile; fileRef = 217DFBB41D9F6D490055D849 /* mbox.lua */; }; - 217DFBF11D9F6D490055D849 /* mbox.lua.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBB51D9F6D490055D849 /* mbox.lua.h */; }; - 217DFBF21D9F6D490055D849 /* mime.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBB61D9F6D490055D849 /* mime.c */; }; - 217DFBF31D9F6D490055D849 /* mime.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBB71D9F6D490055D849 /* mime.h */; }; - 217DFBF41D9F6D490055D849 /* mime.lua in Resources */ = {isa = PBXBuildFile; fileRef = 217DFBB81D9F6D490055D849 /* mime.lua */; }; - 217DFBF51D9F6D490055D849 /* mime.lua.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBB91D9F6D490055D849 /* mime.lua.h */; }; - 217DFBF61D9F6D490055D849 /* options.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBBA1D9F6D490055D849 /* options.c */; }; - 217DFBF71D9F6D490055D849 /* options.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBBB1D9F6D490055D849 /* options.h */; }; - 217DFBF81D9F6D490055D849 /* pierror.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBBC1D9F6D490055D849 /* pierror.h */; }; - 217DFBF91D9F6D490055D849 /* select.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBBD1D9F6D490055D849 /* select.c */; }; - 217DFBFA1D9F6D490055D849 /* select.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBBE1D9F6D490055D849 /* select.h */; }; - 217DFBFB1D9F6D490055D849 /* serial.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBBF1D9F6D490055D849 /* serial.c */; }; - 217DFBFC1D9F6D490055D849 /* smtp.lua in Resources */ = {isa = PBXBuildFile; fileRef = 217DFBC01D9F6D490055D849 /* smtp.lua */; }; - 217DFBFD1D9F6D490055D849 /* smtp.lua.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBC11D9F6D490055D849 /* smtp.lua.h */; }; - 217DFBFE1D9F6D490055D849 /* socket.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBC21D9F6D490055D849 /* socket.h */; }; - 217DFBFF1D9F6D490055D849 /* socket.lua in Resources */ = {isa = PBXBuildFile; fileRef = 217DFBC31D9F6D490055D849 /* socket.lua */; }; - 217DFC001D9F6D490055D849 /* socket.lua.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBC41D9F6D490055D849 /* socket.lua.h */; }; - 217DFC011D9F6D490055D849 /* tcp.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBC51D9F6D490055D849 /* tcp.c */; }; - 217DFC021D9F6D490055D849 /* tcp.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBC61D9F6D490055D849 /* tcp.h */; }; - 217DFC031D9F6D490055D849 /* timeout.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBC71D9F6D490055D849 /* timeout.c */; }; - 217DFC041D9F6D490055D849 /* timeout.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBC81D9F6D490055D849 /* timeout.h */; }; - 217DFC051D9F6D490055D849 /* tp.lua in Resources */ = {isa = PBXBuildFile; fileRef = 217DFBC91D9F6D490055D849 /* tp.lua */; }; - 217DFC061D9F6D490055D849 /* tp.lua.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBCA1D9F6D490055D849 /* tp.lua.h */; }; - 217DFC071D9F6D490055D849 /* udp.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBCB1D9F6D490055D849 /* udp.c */; }; - 217DFC081D9F6D490055D849 /* udp.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBCC1D9F6D490055D849 /* udp.h */; }; - 217DFC091D9F6D490055D849 /* unix.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBCD1D9F6D490055D849 /* unix.c */; }; - 217DFC0A1D9F6D490055D849 /* unix.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBCE1D9F6D490055D849 /* unix.h */; }; - 217DFC0B1D9F6D490055D849 /* unixtcp.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBCF1D9F6D490055D849 /* unixtcp.c */; }; - 217DFC0C1D9F6D490055D849 /* unixtcp.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBD01D9F6D490055D849 /* unixtcp.h */; }; - 217DFC0D1D9F6D490055D849 /* unixudp.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBD11D9F6D490055D849 /* unixudp.c */; }; - 217DFC0E1D9F6D490055D849 /* unixudp.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBD21D9F6D490055D849 /* unixudp.h */; }; - 217DFC0F1D9F6D490055D849 /* url.lua in Resources */ = {isa = PBXBuildFile; fileRef = 217DFBD31D9F6D490055D849 /* url.lua */; }; - 217DFC101D9F6D490055D849 /* url.lua.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBD41D9F6D490055D849 /* url.lua.h */; }; - 217DFC111D9F6D490055D849 /* usocket.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBD51D9F6D490055D849 /* usocket.c */; }; - 217DFC121D9F6D490055D849 /* usocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 217DFBD61D9F6D490055D849 /* usocket.h */; }; - FA0B791B1A958E3B000E1D17 /* b64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B78F71A958E3B000E1D17 /* b64.cpp */; }; - FA0B791C1A958E3B000E1D17 /* b64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B78F71A958E3B000E1D17 /* b64.cpp */; }; - FA0B791D1A958E3B000E1D17 /* b64.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B78F81A958E3B000E1D17 /* b64.h */; }; - FA0B791E1A958E3B000E1D17 /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B78F91A958E3B000E1D17 /* config.h */; }; - FA0B791F1A958E3B000E1D17 /* Data.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B78FA1A958E3B000E1D17 /* Data.h */; }; - FA0B79201A958E3B000E1D17 /* delay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B78FB1A958E3B000E1D17 /* delay.cpp */; }; - FA0B79211A958E3B000E1D17 /* delay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B78FB1A958E3B000E1D17 /* delay.cpp */; }; - FA0B79221A958E3B000E1D17 /* delay.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B78FC1A958E3B000E1D17 /* delay.h */; }; - FA0B79231A958E3B000E1D17 /* EnumMap.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B78FD1A958E3B000E1D17 /* EnumMap.h */; }; - FA0B79241A958E3B000E1D17 /* Exception.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B78FE1A958E3B000E1D17 /* Exception.cpp */; }; - FA0B79251A958E3B000E1D17 /* Exception.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B78FE1A958E3B000E1D17 /* Exception.cpp */; }; - FA0B79261A958E3B000E1D17 /* Exception.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B78FF1A958E3B000E1D17 /* Exception.h */; }; - FA0B79271A958E3B000E1D17 /* int.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79001A958E3B000E1D17 /* int.h */; }; - FA0B79281A958E3B000E1D17 /* math.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79011A958E3B000E1D17 /* math.h */; }; - FA0B79291A958E3B000E1D17 /* Matrix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79021A958E3B000E1D17 /* Matrix.cpp */; }; - FA0B792A1A958E3B000E1D17 /* Matrix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79021A958E3B000E1D17 /* Matrix.cpp */; }; - FA0B792B1A958E3B000E1D17 /* Matrix.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79031A958E3B000E1D17 /* Matrix.h */; }; - FA0B792C1A958E3B000E1D17 /* Memoizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79041A958E3B000E1D17 /* Memoizer.cpp */; }; - FA0B792D1A958E3B000E1D17 /* Memoizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79041A958E3B000E1D17 /* Memoizer.cpp */; }; - FA0B792E1A958E3B000E1D17 /* Memoizer.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79051A958E3B000E1D17 /* Memoizer.h */; }; - FA0B792F1A958E3B000E1D17 /* Module.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79061A958E3B000E1D17 /* Module.cpp */; }; - FA0B79301A958E3B000E1D17 /* Module.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79061A958E3B000E1D17 /* Module.cpp */; }; - FA0B79311A958E3B000E1D17 /* Module.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79071A958E3B000E1D17 /* Module.h */; }; - FA0B79321A958E3B000E1D17 /* Object.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79081A958E3B000E1D17 /* Object.cpp */; }; - FA0B79331A958E3B000E1D17 /* Object.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79081A958E3B000E1D17 /* Object.cpp */; }; - FA0B79341A958E3B000E1D17 /* Object.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79091A958E3B000E1D17 /* Object.h */; }; - FA0B79351A958E3B000E1D17 /* macosx.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B790A1A958E3B000E1D17 /* macosx.h */; }; - FA0B79361A958E3B000E1D17 /* macosx.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA0B790B1A958E3B000E1D17 /* macosx.mm */; }; - FA0B79371A958E3B000E1D17 /* macosx.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA0B790B1A958E3B000E1D17 /* macosx.mm */; }; - FA0B79381A958E3B000E1D17 /* Reference.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B790C1A958E3B000E1D17 /* Reference.cpp */; }; - FA0B79391A958E3B000E1D17 /* Reference.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B790C1A958E3B000E1D17 /* Reference.cpp */; }; - FA0B793A1A958E3B000E1D17 /* Reference.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B790D1A958E3B000E1D17 /* Reference.h */; }; - FA0B793B1A958E3B000E1D17 /* runtime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B790E1A958E3B000E1D17 /* runtime.cpp */; }; - FA0B793C1A958E3B000E1D17 /* runtime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B790E1A958E3B000E1D17 /* runtime.cpp */; }; - FA0B793D1A958E3B000E1D17 /* runtime.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B790F1A958E3B000E1D17 /* runtime.h */; }; - FA0B793E1A958E3B000E1D17 /* StringMap.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79101A958E3B000E1D17 /* StringMap.h */; }; - FA0B793F1A958E3B000E1D17 /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79111A958E3B000E1D17 /* types.h */; }; - FA0B79401A958E3B000E1D17 /* utf8.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79121A958E3B000E1D17 /* utf8.cpp */; }; - FA0B79411A958E3B000E1D17 /* utf8.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79121A958E3B000E1D17 /* utf8.cpp */; }; - FA0B79421A958E3B000E1D17 /* utf8.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79131A958E3B000E1D17 /* utf8.h */; }; - FA0B79431A958E3B000E1D17 /* Variant.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79141A958E3B000E1D17 /* Variant.cpp */; }; - FA0B79441A958E3B000E1D17 /* Variant.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79141A958E3B000E1D17 /* Variant.cpp */; }; - FA0B79451A958E3B000E1D17 /* Variant.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79151A958E3B000E1D17 /* Variant.h */; }; - FA0B79461A958E3B000E1D17 /* Vector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79161A958E3B000E1D17 /* Vector.cpp */; }; - FA0B79471A958E3B000E1D17 /* Vector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79161A958E3B000E1D17 /* Vector.cpp */; }; - FA0B79481A958E3B000E1D17 /* Vector.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79171A958E3B000E1D17 /* Vector.h */; }; - FA0B79491A958E3B000E1D17 /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79181A958E3B000E1D17 /* version.h */; }; - FA0B7A281A958EA3000E1D17 /* Box2D.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B794F1A958EA3000E1D17 /* Box2D.h */; }; - FA0B7A291A958EA3000E1D17 /* b2BroadPhase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79511A958EA3000E1D17 /* b2BroadPhase.cpp */; }; - FA0B7A2A1A958EA3000E1D17 /* b2BroadPhase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79511A958EA3000E1D17 /* b2BroadPhase.cpp */; }; - FA0B7A2B1A958EA3000E1D17 /* b2BroadPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79521A958EA3000E1D17 /* b2BroadPhase.h */; }; - FA0B7A2C1A958EA3000E1D17 /* b2CollideCircle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79531A958EA3000E1D17 /* b2CollideCircle.cpp */; }; - FA0B7A2D1A958EA3000E1D17 /* b2CollideCircle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79531A958EA3000E1D17 /* b2CollideCircle.cpp */; }; - FA0B7A2E1A958EA3000E1D17 /* b2CollideEdge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79541A958EA3000E1D17 /* b2CollideEdge.cpp */; }; - FA0B7A2F1A958EA3000E1D17 /* b2CollideEdge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79541A958EA3000E1D17 /* b2CollideEdge.cpp */; }; - FA0B7A301A958EA3000E1D17 /* b2CollidePolygon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79551A958EA3000E1D17 /* b2CollidePolygon.cpp */; }; - FA0B7A311A958EA3000E1D17 /* b2CollidePolygon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79551A958EA3000E1D17 /* b2CollidePolygon.cpp */; }; - FA0B7A321A958EA3000E1D17 /* b2Collision.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79561A958EA3000E1D17 /* b2Collision.cpp */; }; - FA0B7A331A958EA3000E1D17 /* b2Collision.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79561A958EA3000E1D17 /* b2Collision.cpp */; }; - FA0B7A341A958EA3000E1D17 /* b2Collision.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79571A958EA3000E1D17 /* b2Collision.h */; }; - FA0B7A351A958EA3000E1D17 /* b2Distance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79581A958EA3000E1D17 /* b2Distance.cpp */; }; - FA0B7A361A958EA3000E1D17 /* b2Distance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79581A958EA3000E1D17 /* b2Distance.cpp */; }; - FA0B7A371A958EA3000E1D17 /* b2Distance.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79591A958EA3000E1D17 /* b2Distance.h */; }; - FA0B7A381A958EA3000E1D17 /* b2DynamicTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B795A1A958EA3000E1D17 /* b2DynamicTree.cpp */; }; - FA0B7A391A958EA3000E1D17 /* b2DynamicTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B795A1A958EA3000E1D17 /* b2DynamicTree.cpp */; }; - FA0B7A3A1A958EA3000E1D17 /* b2DynamicTree.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B795B1A958EA3000E1D17 /* b2DynamicTree.h */; }; - FA0B7A3B1A958EA3000E1D17 /* b2TimeOfImpact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B795C1A958EA3000E1D17 /* b2TimeOfImpact.cpp */; }; - FA0B7A3C1A958EA3000E1D17 /* b2TimeOfImpact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B795C1A958EA3000E1D17 /* b2TimeOfImpact.cpp */; }; - FA0B7A3D1A958EA3000E1D17 /* b2TimeOfImpact.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B795D1A958EA3000E1D17 /* b2TimeOfImpact.h */; }; - FA0B7A3E1A958EA3000E1D17 /* b2ChainShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B795F1A958EA3000E1D17 /* b2ChainShape.cpp */; }; - FA0B7A3F1A958EA3000E1D17 /* b2ChainShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B795F1A958EA3000E1D17 /* b2ChainShape.cpp */; }; - FA0B7A401A958EA3000E1D17 /* b2ChainShape.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79601A958EA3000E1D17 /* b2ChainShape.h */; }; - FA0B7A411A958EA3000E1D17 /* b2CircleShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79611A958EA3000E1D17 /* b2CircleShape.cpp */; }; - FA0B7A421A958EA3000E1D17 /* b2CircleShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79611A958EA3000E1D17 /* b2CircleShape.cpp */; }; - FA0B7A431A958EA3000E1D17 /* b2CircleShape.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79621A958EA3000E1D17 /* b2CircleShape.h */; }; - FA0B7A441A958EA3000E1D17 /* b2EdgeShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79631A958EA3000E1D17 /* b2EdgeShape.cpp */; }; - FA0B7A451A958EA3000E1D17 /* b2EdgeShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79631A958EA3000E1D17 /* b2EdgeShape.cpp */; }; - FA0B7A461A958EA3000E1D17 /* b2EdgeShape.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79641A958EA3000E1D17 /* b2EdgeShape.h */; }; - FA0B7A471A958EA3000E1D17 /* b2PolygonShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79651A958EA3000E1D17 /* b2PolygonShape.cpp */; }; - FA0B7A481A958EA3000E1D17 /* b2PolygonShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79651A958EA3000E1D17 /* b2PolygonShape.cpp */; }; - FA0B7A491A958EA3000E1D17 /* b2PolygonShape.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79661A958EA3000E1D17 /* b2PolygonShape.h */; }; - FA0B7A4A1A958EA3000E1D17 /* b2Shape.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79671A958EA3000E1D17 /* b2Shape.h */; }; - FA0B7A4B1A958EA3000E1D17 /* b2BlockAllocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79691A958EA3000E1D17 /* b2BlockAllocator.cpp */; }; - FA0B7A4C1A958EA3000E1D17 /* b2BlockAllocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79691A958EA3000E1D17 /* b2BlockAllocator.cpp */; }; - FA0B7A4D1A958EA3000E1D17 /* b2BlockAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B796A1A958EA3000E1D17 /* b2BlockAllocator.h */; }; - FA0B7A4E1A958EA3000E1D17 /* b2Draw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B796B1A958EA3000E1D17 /* b2Draw.cpp */; }; - FA0B7A4F1A958EA3000E1D17 /* b2Draw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B796B1A958EA3000E1D17 /* b2Draw.cpp */; }; - FA0B7A501A958EA3000E1D17 /* b2Draw.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B796C1A958EA3000E1D17 /* b2Draw.h */; }; - FA0B7A511A958EA3000E1D17 /* b2GrowableStack.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B796D1A958EA3000E1D17 /* b2GrowableStack.h */; }; - FA0B7A521A958EA3000E1D17 /* b2Math.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B796E1A958EA3000E1D17 /* b2Math.cpp */; }; - FA0B7A531A958EA3000E1D17 /* b2Math.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B796E1A958EA3000E1D17 /* b2Math.cpp */; }; - FA0B7A541A958EA3000E1D17 /* b2Math.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B796F1A958EA3000E1D17 /* b2Math.h */; }; - FA0B7A551A958EA3000E1D17 /* b2Settings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79701A958EA3000E1D17 /* b2Settings.cpp */; }; - FA0B7A561A958EA3000E1D17 /* b2Settings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79701A958EA3000E1D17 /* b2Settings.cpp */; }; - FA0B7A571A958EA3000E1D17 /* b2Settings.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79711A958EA3000E1D17 /* b2Settings.h */; }; - FA0B7A581A958EA3000E1D17 /* b2StackAllocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79721A958EA3000E1D17 /* b2StackAllocator.cpp */; }; - FA0B7A591A958EA3000E1D17 /* b2StackAllocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79721A958EA3000E1D17 /* b2StackAllocator.cpp */; }; - FA0B7A5A1A958EA3000E1D17 /* b2StackAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79731A958EA3000E1D17 /* b2StackAllocator.h */; }; - FA0B7A5B1A958EA3000E1D17 /* b2Timer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79741A958EA3000E1D17 /* b2Timer.cpp */; }; - FA0B7A5C1A958EA3000E1D17 /* b2Timer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79741A958EA3000E1D17 /* b2Timer.cpp */; }; - FA0B7A5D1A958EA3000E1D17 /* b2Timer.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79751A958EA3000E1D17 /* b2Timer.h */; }; - FA0B7A5E1A958EA3000E1D17 /* b2Body.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79771A958EA3000E1D17 /* b2Body.cpp */; }; - FA0B7A5F1A958EA3000E1D17 /* b2Body.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79771A958EA3000E1D17 /* b2Body.cpp */; }; - FA0B7A601A958EA3000E1D17 /* b2Body.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79781A958EA3000E1D17 /* b2Body.h */; }; - FA0B7A611A958EA3000E1D17 /* b2ContactManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79791A958EA3000E1D17 /* b2ContactManager.cpp */; }; - FA0B7A621A958EA3000E1D17 /* b2ContactManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79791A958EA3000E1D17 /* b2ContactManager.cpp */; }; - FA0B7A631A958EA3000E1D17 /* b2ContactManager.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B797A1A958EA3000E1D17 /* b2ContactManager.h */; }; - FA0B7A641A958EA3000E1D17 /* b2Fixture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B797B1A958EA3000E1D17 /* b2Fixture.cpp */; }; - FA0B7A651A958EA3000E1D17 /* b2Fixture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B797B1A958EA3000E1D17 /* b2Fixture.cpp */; }; - FA0B7A661A958EA3000E1D17 /* b2Fixture.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B797C1A958EA3000E1D17 /* b2Fixture.h */; }; - FA0B7A671A958EA3000E1D17 /* b2Island.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B797D1A958EA3000E1D17 /* b2Island.cpp */; }; - FA0B7A681A958EA3000E1D17 /* b2Island.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B797D1A958EA3000E1D17 /* b2Island.cpp */; }; - FA0B7A691A958EA3000E1D17 /* b2Island.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B797E1A958EA3000E1D17 /* b2Island.h */; }; - FA0B7A6A1A958EA3000E1D17 /* b2TimeStep.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B797F1A958EA3000E1D17 /* b2TimeStep.h */; }; - FA0B7A6B1A958EA3000E1D17 /* b2World.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79801A958EA3000E1D17 /* b2World.cpp */; }; - FA0B7A6C1A958EA3000E1D17 /* b2World.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79801A958EA3000E1D17 /* b2World.cpp */; }; - FA0B7A6D1A958EA3000E1D17 /* b2World.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79811A958EA3000E1D17 /* b2World.h */; }; - FA0B7A6E1A958EA3000E1D17 /* b2WorldCallbacks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79821A958EA3000E1D17 /* b2WorldCallbacks.cpp */; }; - FA0B7A6F1A958EA3000E1D17 /* b2WorldCallbacks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79821A958EA3000E1D17 /* b2WorldCallbacks.cpp */; }; - FA0B7A701A958EA3000E1D17 /* b2WorldCallbacks.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79831A958EA3000E1D17 /* b2WorldCallbacks.h */; }; - FA0B7A711A958EA3000E1D17 /* b2ChainAndCircleContact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79851A958EA3000E1D17 /* b2ChainAndCircleContact.cpp */; }; - FA0B7A721A958EA3000E1D17 /* b2ChainAndCircleContact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79851A958EA3000E1D17 /* b2ChainAndCircleContact.cpp */; }; - FA0B7A731A958EA3000E1D17 /* b2ChainAndCircleContact.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79861A958EA3000E1D17 /* b2ChainAndCircleContact.h */; }; - FA0B7A741A958EA3000E1D17 /* b2ChainAndPolygonContact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79871A958EA3000E1D17 /* b2ChainAndPolygonContact.cpp */; }; - FA0B7A751A958EA3000E1D17 /* b2ChainAndPolygonContact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79871A958EA3000E1D17 /* b2ChainAndPolygonContact.cpp */; }; - FA0B7A761A958EA3000E1D17 /* b2ChainAndPolygonContact.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79881A958EA3000E1D17 /* b2ChainAndPolygonContact.h */; }; - FA0B7A771A958EA3000E1D17 /* b2CircleContact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79891A958EA3000E1D17 /* b2CircleContact.cpp */; }; - FA0B7A781A958EA3000E1D17 /* b2CircleContact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79891A958EA3000E1D17 /* b2CircleContact.cpp */; }; - FA0B7A791A958EA3000E1D17 /* b2CircleContact.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B798A1A958EA3000E1D17 /* b2CircleContact.h */; }; - FA0B7A7A1A958EA3000E1D17 /* b2Contact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B798B1A958EA3000E1D17 /* b2Contact.cpp */; }; - FA0B7A7B1A958EA3000E1D17 /* b2Contact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B798B1A958EA3000E1D17 /* b2Contact.cpp */; }; - FA0B7A7C1A958EA3000E1D17 /* b2Contact.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B798C1A958EA3000E1D17 /* b2Contact.h */; }; - FA0B7A7D1A958EA3000E1D17 /* b2ContactSolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B798D1A958EA3000E1D17 /* b2ContactSolver.cpp */; }; - FA0B7A7E1A958EA3000E1D17 /* b2ContactSolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B798D1A958EA3000E1D17 /* b2ContactSolver.cpp */; }; - FA0B7A7F1A958EA3000E1D17 /* b2ContactSolver.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B798E1A958EA3000E1D17 /* b2ContactSolver.h */; }; - FA0B7A801A958EA3000E1D17 /* b2EdgeAndCircleContact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B798F1A958EA3000E1D17 /* b2EdgeAndCircleContact.cpp */; }; - FA0B7A811A958EA3000E1D17 /* b2EdgeAndCircleContact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B798F1A958EA3000E1D17 /* b2EdgeAndCircleContact.cpp */; }; - FA0B7A821A958EA3000E1D17 /* b2EdgeAndCircleContact.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79901A958EA3000E1D17 /* b2EdgeAndCircleContact.h */; }; - FA0B7A831A958EA3000E1D17 /* b2EdgeAndPolygonContact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79911A958EA3000E1D17 /* b2EdgeAndPolygonContact.cpp */; }; - FA0B7A841A958EA3000E1D17 /* b2EdgeAndPolygonContact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79911A958EA3000E1D17 /* b2EdgeAndPolygonContact.cpp */; }; - FA0B7A851A958EA3000E1D17 /* b2EdgeAndPolygonContact.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79921A958EA3000E1D17 /* b2EdgeAndPolygonContact.h */; }; - FA0B7A861A958EA3000E1D17 /* b2PolygonAndCircleContact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79931A958EA3000E1D17 /* b2PolygonAndCircleContact.cpp */; }; - FA0B7A871A958EA3000E1D17 /* b2PolygonAndCircleContact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79931A958EA3000E1D17 /* b2PolygonAndCircleContact.cpp */; }; - FA0B7A881A958EA3000E1D17 /* b2PolygonAndCircleContact.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79941A958EA3000E1D17 /* b2PolygonAndCircleContact.h */; }; - FA0B7A891A958EA3000E1D17 /* b2PolygonContact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79951A958EA3000E1D17 /* b2PolygonContact.cpp */; }; - FA0B7A8A1A958EA3000E1D17 /* b2PolygonContact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79951A958EA3000E1D17 /* b2PolygonContact.cpp */; }; - FA0B7A8B1A958EA3000E1D17 /* b2PolygonContact.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79961A958EA3000E1D17 /* b2PolygonContact.h */; }; - FA0B7A8C1A958EA3000E1D17 /* b2DistanceJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79981A958EA3000E1D17 /* b2DistanceJoint.cpp */; }; - FA0B7A8D1A958EA3000E1D17 /* b2DistanceJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79981A958EA3000E1D17 /* b2DistanceJoint.cpp */; }; - FA0B7A8E1A958EA3000E1D17 /* b2DistanceJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79991A958EA3000E1D17 /* b2DistanceJoint.h */; }; - FA0B7A8F1A958EA3000E1D17 /* b2FrictionJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B799A1A958EA3000E1D17 /* b2FrictionJoint.cpp */; }; - FA0B7A901A958EA3000E1D17 /* b2FrictionJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B799A1A958EA3000E1D17 /* b2FrictionJoint.cpp */; }; - FA0B7A911A958EA3000E1D17 /* b2FrictionJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B799B1A958EA3000E1D17 /* b2FrictionJoint.h */; }; - FA0B7A921A958EA3000E1D17 /* b2GearJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B799C1A958EA3000E1D17 /* b2GearJoint.cpp */; }; - FA0B7A931A958EA3000E1D17 /* b2GearJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B799C1A958EA3000E1D17 /* b2GearJoint.cpp */; }; - FA0B7A941A958EA3000E1D17 /* b2GearJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B799D1A958EA3000E1D17 /* b2GearJoint.h */; }; - FA0B7A951A958EA3000E1D17 /* b2Joint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B799E1A958EA3000E1D17 /* b2Joint.cpp */; }; - FA0B7A961A958EA3000E1D17 /* b2Joint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B799E1A958EA3000E1D17 /* b2Joint.cpp */; }; - FA0B7A971A958EA3000E1D17 /* b2Joint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B799F1A958EA3000E1D17 /* b2Joint.h */; }; - FA0B7A981A958EA3000E1D17 /* b2MotorJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79A01A958EA3000E1D17 /* b2MotorJoint.cpp */; }; - FA0B7A991A958EA3000E1D17 /* b2MotorJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79A01A958EA3000E1D17 /* b2MotorJoint.cpp */; }; - FA0B7A9A1A958EA3000E1D17 /* b2MotorJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79A11A958EA3000E1D17 /* b2MotorJoint.h */; }; - FA0B7A9B1A958EA3000E1D17 /* b2MouseJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79A21A958EA3000E1D17 /* b2MouseJoint.cpp */; }; - FA0B7A9C1A958EA3000E1D17 /* b2MouseJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79A21A958EA3000E1D17 /* b2MouseJoint.cpp */; }; - FA0B7A9D1A958EA3000E1D17 /* b2MouseJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79A31A958EA3000E1D17 /* b2MouseJoint.h */; }; - FA0B7A9E1A958EA3000E1D17 /* b2PrismaticJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79A41A958EA3000E1D17 /* b2PrismaticJoint.cpp */; }; - FA0B7A9F1A958EA3000E1D17 /* b2PrismaticJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79A41A958EA3000E1D17 /* b2PrismaticJoint.cpp */; }; - FA0B7AA01A958EA3000E1D17 /* b2PrismaticJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79A51A958EA3000E1D17 /* b2PrismaticJoint.h */; }; - FA0B7AA11A958EA3000E1D17 /* b2PulleyJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79A61A958EA3000E1D17 /* b2PulleyJoint.cpp */; }; - FA0B7AA21A958EA3000E1D17 /* b2PulleyJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79A61A958EA3000E1D17 /* b2PulleyJoint.cpp */; }; - FA0B7AA31A958EA3000E1D17 /* b2PulleyJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79A71A958EA3000E1D17 /* b2PulleyJoint.h */; }; - FA0B7AA41A958EA3000E1D17 /* b2RevoluteJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79A81A958EA3000E1D17 /* b2RevoluteJoint.cpp */; }; - FA0B7AA51A958EA3000E1D17 /* b2RevoluteJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79A81A958EA3000E1D17 /* b2RevoluteJoint.cpp */; }; - FA0B7AA61A958EA3000E1D17 /* b2RevoluteJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79A91A958EA3000E1D17 /* b2RevoluteJoint.h */; }; - FA0B7AA71A958EA3000E1D17 /* b2RopeJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79AA1A958EA3000E1D17 /* b2RopeJoint.cpp */; }; - FA0B7AA81A958EA3000E1D17 /* b2RopeJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79AA1A958EA3000E1D17 /* b2RopeJoint.cpp */; }; - FA0B7AA91A958EA3000E1D17 /* b2RopeJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79AB1A958EA3000E1D17 /* b2RopeJoint.h */; }; - FA0B7AAA1A958EA3000E1D17 /* b2WeldJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79AC1A958EA3000E1D17 /* b2WeldJoint.cpp */; }; - FA0B7AAB1A958EA3000E1D17 /* b2WeldJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79AC1A958EA3000E1D17 /* b2WeldJoint.cpp */; }; - FA0B7AAC1A958EA3000E1D17 /* b2WeldJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79AD1A958EA3000E1D17 /* b2WeldJoint.h */; }; - FA0B7AAD1A958EA3000E1D17 /* b2WheelJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79AE1A958EA3000E1D17 /* b2WheelJoint.cpp */; }; - FA0B7AAE1A958EA3000E1D17 /* b2WheelJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79AE1A958EA3000E1D17 /* b2WheelJoint.cpp */; }; - FA0B7AAF1A958EA3000E1D17 /* b2WheelJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79AF1A958EA3000E1D17 /* b2WheelJoint.h */; }; - FA0B7AB11A958EA3000E1D17 /* b2Rope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79B21A958EA3000E1D17 /* b2Rope.cpp */; }; - FA0B7AB21A958EA3000E1D17 /* b2Rope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79B21A958EA3000E1D17 /* b2Rope.cpp */; }; - FA0B7AB31A958EA3000E1D17 /* b2Rope.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79B31A958EA3000E1D17 /* b2Rope.h */; }; - FA0B7AB41A958EA3000E1D17 /* ddsinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79B51A958EA3000E1D17 /* ddsinfo.h */; }; - FA0B7AB51A958EA3000E1D17 /* ddsparse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79B61A958EA3000E1D17 /* ddsparse.cpp */; }; - FA0B7AB61A958EA3000E1D17 /* ddsparse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79B61A958EA3000E1D17 /* ddsparse.cpp */; }; - FA0B7AB71A958EA3000E1D17 /* ddsparse.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79B71A958EA3000E1D17 /* ddsparse.h */; }; - FA0B7AB81A958EA3000E1D17 /* enet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79B91A958EA3000E1D17 /* enet.cpp */; }; - FA0B7AB91A958EA3000E1D17 /* enet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79B91A958EA3000E1D17 /* enet.cpp */; }; - FA0B7ABA1A958EA3000E1D17 /* callbacks.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79BB1A958EA3000E1D17 /* callbacks.c */; }; - FA0B7ABB1A958EA3000E1D17 /* callbacks.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79BB1A958EA3000E1D17 /* callbacks.c */; }; - FA0B7ABD1A958EA3000E1D17 /* compress.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79BD1A958EA3000E1D17 /* compress.c */; }; - FA0B7ABE1A958EA3000E1D17 /* compress.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79BD1A958EA3000E1D17 /* compress.c */; }; - FA0B7ABF1A958EA3000E1D17 /* host.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79BE1A958EA3000E1D17 /* host.c */; }; - FA0B7AC01A958EA3000E1D17 /* host.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79BE1A958EA3000E1D17 /* host.c */; }; - FA0B7AC11A958EA3000E1D17 /* callbacks.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79C11A958EA3000E1D17 /* callbacks.h */; }; - FA0B7AC21A958EA3000E1D17 /* enet.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79C21A958EA3000E1D17 /* enet.h */; }; - FA0B7AC31A958EA3000E1D17 /* list.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79C31A958EA3000E1D17 /* list.h */; }; - FA0B7AC41A958EA3000E1D17 /* protocol.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79C41A958EA3000E1D17 /* protocol.h */; }; - FA0B7AC51A958EA3000E1D17 /* time.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79C51A958EA3000E1D17 /* time.h */; }; - FA0B7AC61A958EA3000E1D17 /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79C61A958EA3000E1D17 /* types.h */; }; - FA0B7AC71A958EA3000E1D17 /* unix.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79C71A958EA3000E1D17 /* unix.h */; }; - FA0B7AC81A958EA3000E1D17 /* utility.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79C81A958EA3000E1D17 /* utility.h */; }; - FA0B7AC91A958EA3000E1D17 /* win32.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79C91A958EA3000E1D17 /* win32.h */; }; - FA0B7ACB1A958EA3000E1D17 /* list.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79CB1A958EA3000E1D17 /* list.c */; }; - FA0B7ACC1A958EA3000E1D17 /* list.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79CB1A958EA3000E1D17 /* list.c */; }; - FA0B7ACD1A958EA3000E1D17 /* packet.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79CC1A958EA3000E1D17 /* packet.c */; }; - FA0B7ACE1A958EA3000E1D17 /* packet.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79CC1A958EA3000E1D17 /* packet.c */; }; - FA0B7ACF1A958EA3000E1D17 /* peer.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79CD1A958EA3000E1D17 /* peer.c */; }; - FA0B7AD01A958EA3000E1D17 /* peer.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79CD1A958EA3000E1D17 /* peer.c */; }; - FA0B7AD11A958EA3000E1D17 /* protocol.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79CE1A958EA3000E1D17 /* protocol.c */; }; - FA0B7AD21A958EA3000E1D17 /* protocol.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79CE1A958EA3000E1D17 /* protocol.c */; }; - FA0B7AD41A958EA3000E1D17 /* unix.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79D01A958EA3000E1D17 /* unix.c */; }; - FA0B7AD51A958EA3000E1D17 /* unix.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79D01A958EA3000E1D17 /* unix.c */; }; - FA0B7AD61A958EA3000E1D17 /* win32.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79D11A958EA3000E1D17 /* win32.c */; }; - FA0B7AD71A958EA3000E1D17 /* win32.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79D11A958EA3000E1D17 /* win32.c */; }; - FA0B7AD81A958EA3000E1D17 /* lua-enet.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79D21A958EA3000E1D17 /* lua-enet.h */; }; - FA0B7AD91A958EA3000E1D17 /* glad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79D41A958EA3000E1D17 /* glad.cpp */; }; - FA0B7ADA1A958EA3000E1D17 /* glad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79D41A958EA3000E1D17 /* glad.cpp */; }; - FA0B7ADC1A958EA3000E1D17 /* glad.hpp in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79D61A958EA3000E1D17 /* glad.hpp */; }; - FA0B7ADD1A958EA3000E1D17 /* gladfuncs.hpp in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79D71A958EA3000E1D17 /* gladfuncs.hpp */; }; - FA0B7ADE1A958EA3000E1D17 /* lodepng.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79D91A958EA3000E1D17 /* lodepng.cpp */; }; - FA0B7ADF1A958EA3000E1D17 /* lodepng.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B79D91A958EA3000E1D17 /* lodepng.cpp */; }; - FA0B7AE01A958EA3000E1D17 /* lodepng.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B79DA1A958EA3000E1D17 /* lodepng.h */; }; - FA0B7B211A958EA3000E1D17 /* luasocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7A0E1A958EA3000E1D17 /* luasocket.cpp */; }; - FA0B7B221A958EA3000E1D17 /* luasocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7A0E1A958EA3000E1D17 /* luasocket.cpp */; }; - FA0B7B231A958EA3000E1D17 /* luasocket.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7A0F1A958EA3000E1D17 /* luasocket.h */; }; - FA0B7B281A958EA3000E1D17 /* simplexnoise1234.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7A151A958EA3000E1D17 /* simplexnoise1234.cpp */; }; - FA0B7B291A958EA3000E1D17 /* simplexnoise1234.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7A151A958EA3000E1D17 /* simplexnoise1234.cpp */; }; - FA0B7B2A1A958EA3000E1D17 /* simplexnoise1234.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7A161A958EA3000E1D17 /* simplexnoise1234.h */; }; - FA0B7B2B1A958EA3000E1D17 /* stb_image.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7A181A958EA3000E1D17 /* stb_image.h */; }; - FA0B7B2C1A958EA3000E1D17 /* checked.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7A1B1A958EA3000E1D17 /* checked.h */; }; - FA0B7B2D1A958EA3000E1D17 /* core.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7A1C1A958EA3000E1D17 /* core.h */; }; - FA0B7B2E1A958EA3000E1D17 /* unchecked.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7A1D1A958EA3000E1D17 /* unchecked.h */; }; - FA0B7B2F1A958EA3000E1D17 /* utf8.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7A1E1A958EA3000E1D17 /* utf8.h */; }; - FA0B7B301A958EA3000E1D17 /* wuff.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7A201A958EA3000E1D17 /* wuff.c */; }; - FA0B7B311A958EA3000E1D17 /* wuff.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7A201A958EA3000E1D17 /* wuff.c */; }; - FA0B7B321A958EA3000E1D17 /* wuff.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7A211A958EA3000E1D17 /* wuff.h */; }; - FA0B7B331A958EA3000E1D17 /* wuff_config.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7A221A958EA3000E1D17 /* wuff_config.h */; }; - FA0B7B341A958EA3000E1D17 /* wuff_convert.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7A231A958EA3000E1D17 /* wuff_convert.c */; }; - FA0B7B351A958EA3000E1D17 /* wuff_convert.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7A231A958EA3000E1D17 /* wuff_convert.c */; }; - FA0B7B361A958EA3000E1D17 /* wuff_convert.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7A241A958EA3000E1D17 /* wuff_convert.h */; }; - FA0B7B371A958EA3000E1D17 /* wuff_internal.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7A251A958EA3000E1D17 /* wuff_internal.c */; }; - FA0B7B381A958EA3000E1D17 /* wuff_internal.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7A251A958EA3000E1D17 /* wuff_internal.c */; }; - FA0B7B391A958EA3000E1D17 /* wuff_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7A261A958EA3000E1D17 /* wuff_internal.h */; }; - FA0B7B3A1A958EA3000E1D17 /* wuff_memory.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7A271A958EA3000E1D17 /* wuff_memory.c */; }; - FA0B7B3B1A958EA3000E1D17 /* wuff_memory.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7A271A958EA3000E1D17 /* wuff_memory.c */; }; - FA0B7CCD1A95902C000E1D17 /* Audio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B3E1A95902C000E1D17 /* Audio.cpp */; }; - FA0B7CCE1A95902C000E1D17 /* Audio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B3E1A95902C000E1D17 /* Audio.cpp */; }; - FA0B7CCF1A95902C000E1D17 /* Audio.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B3F1A95902C000E1D17 /* Audio.h */; }; - FA0B7CD01A95902C000E1D17 /* Audio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B411A95902C000E1D17 /* Audio.cpp */; }; - FA0B7CD11A95902C000E1D17 /* Audio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B411A95902C000E1D17 /* Audio.cpp */; }; - FA0B7CD21A95902C000E1D17 /* Audio.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B421A95902C000E1D17 /* Audio.h */; }; - FA0B7CD31A95902C000E1D17 /* Source.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B431A95902C000E1D17 /* Source.cpp */; }; - FA0B7CD41A95902C000E1D17 /* Source.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B431A95902C000E1D17 /* Source.cpp */; }; - FA0B7CD51A95902C000E1D17 /* Source.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B441A95902C000E1D17 /* Source.h */; }; - FA0B7CD61A95902C000E1D17 /* Audio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B461A95902C000E1D17 /* Audio.cpp */; }; - FA0B7CD71A95902C000E1D17 /* Audio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B461A95902C000E1D17 /* Audio.cpp */; }; - FA0B7CD81A95902C000E1D17 /* Audio.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B471A95902C000E1D17 /* Audio.h */; }; - FA0B7CD91A95902C000E1D17 /* Pool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B481A95902C000E1D17 /* Pool.cpp */; }; - FA0B7CDA1A95902C000E1D17 /* Pool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B481A95902C000E1D17 /* Pool.cpp */; }; - FA0B7CDB1A95902C000E1D17 /* Pool.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B491A95902C000E1D17 /* Pool.h */; }; - FA0B7CDC1A95902C000E1D17 /* Source.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B4A1A95902C000E1D17 /* Source.cpp */; }; - FA0B7CDD1A95902C000E1D17 /* Source.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B4A1A95902C000E1D17 /* Source.cpp */; }; - FA0B7CDE1A95902C000E1D17 /* Source.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B4B1A95902C000E1D17 /* Source.h */; }; - FA0B7CDF1A95902C000E1D17 /* Source.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B4C1A95902C000E1D17 /* Source.cpp */; }; - FA0B7CE01A95902C000E1D17 /* Source.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B4C1A95902C000E1D17 /* Source.cpp */; }; - FA0B7CE11A95902C000E1D17 /* Source.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B4D1A95902C000E1D17 /* Source.h */; }; - FA0B7CE21A95902C000E1D17 /* wrap_Audio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B4E1A95902C000E1D17 /* wrap_Audio.cpp */; }; - FA0B7CE31A95902C000E1D17 /* wrap_Audio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B4E1A95902C000E1D17 /* wrap_Audio.cpp */; }; - FA0B7CE41A95902C000E1D17 /* wrap_Audio.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B4F1A95902C000E1D17 /* wrap_Audio.h */; }; - FA0B7CE51A95902C000E1D17 /* wrap_Source.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B501A95902C000E1D17 /* wrap_Source.cpp */; }; - FA0B7CE61A95902C000E1D17 /* wrap_Source.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B501A95902C000E1D17 /* wrap_Source.cpp */; }; - FA0B7CE71A95902C000E1D17 /* wrap_Source.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B511A95902C000E1D17 /* wrap_Source.h */; }; - FA0B7CE81A95902C000E1D17 /* Event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B531A95902C000E1D17 /* Event.cpp */; }; - FA0B7CE91A95902C000E1D17 /* Event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B531A95902C000E1D17 /* Event.cpp */; }; - FA0B7CEA1A95902C000E1D17 /* Event.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B541A95902C000E1D17 /* Event.h */; }; - FA0B7CEB1A95902C000E1D17 /* Event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B561A95902C000E1D17 /* Event.cpp */; }; - FA0B7CEC1A95902C000E1D17 /* Event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B561A95902C000E1D17 /* Event.cpp */; }; - FA0B7CED1A95902C000E1D17 /* Event.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B571A95902C000E1D17 /* Event.h */; }; - FA0B7CF11A95902C000E1D17 /* DroppedFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B5B1A95902C000E1D17 /* DroppedFile.cpp */; }; - FA0B7CF21A95902C000E1D17 /* DroppedFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B5B1A95902C000E1D17 /* DroppedFile.cpp */; }; - FA0B7CF31A95902C000E1D17 /* DroppedFile.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B5C1A95902C000E1D17 /* DroppedFile.h */; }; - FA0B7CF41A95902C000E1D17 /* File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B5D1A95902C000E1D17 /* File.cpp */; }; - FA0B7CF51A95902C000E1D17 /* File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B5D1A95902C000E1D17 /* File.cpp */; }; - FA0B7CF61A95902C000E1D17 /* File.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B5E1A95902C000E1D17 /* File.h */; }; - FA0B7CF71A95902C000E1D17 /* FileData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B5F1A95902C000E1D17 /* FileData.cpp */; }; - FA0B7CF81A95902C000E1D17 /* FileData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B5F1A95902C000E1D17 /* FileData.cpp */; }; - FA0B7CF91A95902C000E1D17 /* FileData.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B601A95902C000E1D17 /* FileData.h */; }; - FA0B7CFA1A95902C000E1D17 /* Filesystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B611A95902C000E1D17 /* Filesystem.cpp */; }; - FA0B7CFB1A95902C000E1D17 /* Filesystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B611A95902C000E1D17 /* Filesystem.cpp */; }; - FA0B7CFC1A95902C000E1D17 /* Filesystem.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B621A95902C000E1D17 /* Filesystem.h */; }; - FA0B7CFD1A95902C000E1D17 /* File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B641A95902C000E1D17 /* File.cpp */; }; - FA0B7CFE1A95902C000E1D17 /* File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B641A95902C000E1D17 /* File.cpp */; }; - FA0B7CFF1A95902C000E1D17 /* File.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B651A95902C000E1D17 /* File.h */; }; - FA0B7D001A95902C000E1D17 /* Filesystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B661A95902C000E1D17 /* Filesystem.cpp */; }; - FA0B7D011A95902C000E1D17 /* Filesystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B661A95902C000E1D17 /* Filesystem.cpp */; }; - FA0B7D021A95902C000E1D17 /* Filesystem.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B671A95902C000E1D17 /* Filesystem.h */; }; - FA0B7D031A95902C000E1D17 /* wrap_DroppedFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B681A95902C000E1D17 /* wrap_DroppedFile.cpp */; }; - FA0B7D041A95902C000E1D17 /* wrap_DroppedFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B681A95902C000E1D17 /* wrap_DroppedFile.cpp */; }; - FA0B7D051A95902C000E1D17 /* wrap_DroppedFile.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B691A95902C000E1D17 /* wrap_DroppedFile.h */; }; - FA0B7D061A95902C000E1D17 /* wrap_File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B6A1A95902C000E1D17 /* wrap_File.cpp */; }; - FA0B7D071A95902C000E1D17 /* wrap_File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B6A1A95902C000E1D17 /* wrap_File.cpp */; }; - FA0B7D081A95902C000E1D17 /* wrap_File.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B6B1A95902C000E1D17 /* wrap_File.h */; }; - FA0B7D091A95902C000E1D17 /* wrap_FileData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B6C1A95902C000E1D17 /* wrap_FileData.cpp */; }; - FA0B7D0A1A95902C000E1D17 /* wrap_FileData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B6C1A95902C000E1D17 /* wrap_FileData.cpp */; }; - FA0B7D0B1A95902C000E1D17 /* wrap_FileData.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B6D1A95902C000E1D17 /* wrap_FileData.h */; }; - FA0B7D0C1A95902C000E1D17 /* wrap_Filesystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B6E1A95902C000E1D17 /* wrap_Filesystem.cpp */; }; - FA0B7D0D1A95902C000E1D17 /* wrap_Filesystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B6E1A95902C000E1D17 /* wrap_Filesystem.cpp */; }; - FA0B7D0E1A95902C000E1D17 /* wrap_Filesystem.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B6F1A95902C000E1D17 /* wrap_Filesystem.h */; }; - FA0B7D0F1A95902C000E1D17 /* BMFontRasterizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B711A95902C000E1D17 /* BMFontRasterizer.cpp */; }; - FA0B7D101A95902C000E1D17 /* BMFontRasterizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B711A95902C000E1D17 /* BMFontRasterizer.cpp */; }; - FA0B7D111A95902C000E1D17 /* BMFontRasterizer.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B721A95902C000E1D17 /* BMFontRasterizer.h */; }; - FA0B7D121A95902C000E1D17 /* Font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B731A95902C000E1D17 /* Font.cpp */; }; - FA0B7D131A95902C000E1D17 /* Font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B731A95902C000E1D17 /* Font.cpp */; }; - FA0B7D141A95902C000E1D17 /* Font.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B741A95902C000E1D17 /* Font.h */; }; - FA0B7D151A95902C000E1D17 /* Font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B761A95902C000E1D17 /* Font.cpp */; }; - FA0B7D161A95902C000E1D17 /* Font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B761A95902C000E1D17 /* Font.cpp */; }; - FA0B7D171A95902C000E1D17 /* Font.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B771A95902C000E1D17 /* Font.h */; }; - FA0B7D181A95902C000E1D17 /* TrueTypeRasterizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B781A95902C000E1D17 /* TrueTypeRasterizer.cpp */; }; - FA0B7D191A95902C000E1D17 /* TrueTypeRasterizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B781A95902C000E1D17 /* TrueTypeRasterizer.cpp */; }; - FA0B7D1A1A95902C000E1D17 /* TrueTypeRasterizer.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B791A95902C000E1D17 /* TrueTypeRasterizer.h */; }; - FA0B7D1B1A95902C000E1D17 /* GlyphData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B7A1A95902C000E1D17 /* GlyphData.cpp */; }; - FA0B7D1C1A95902C000E1D17 /* GlyphData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B7A1A95902C000E1D17 /* GlyphData.cpp */; }; - FA0B7D1D1A95902C000E1D17 /* GlyphData.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B7B1A95902C000E1D17 /* GlyphData.h */; }; - FA0B7D1E1A95902C000E1D17 /* ImageRasterizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B7C1A95902C000E1D17 /* ImageRasterizer.cpp */; }; - FA0B7D1F1A95902C000E1D17 /* ImageRasterizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B7C1A95902C000E1D17 /* ImageRasterizer.cpp */; }; - FA0B7D201A95902C000E1D17 /* ImageRasterizer.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B7D1A95902C000E1D17 /* ImageRasterizer.h */; }; - FA0B7D211A95902C000E1D17 /* Rasterizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B7E1A95902C000E1D17 /* Rasterizer.cpp */; }; - FA0B7D221A95902C000E1D17 /* Rasterizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B7E1A95902C000E1D17 /* Rasterizer.cpp */; }; - FA0B7D231A95902C000E1D17 /* Rasterizer.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B7F1A95902C000E1D17 /* Rasterizer.h */; }; - FA0B7D241A95902C000E1D17 /* Vera.ttf.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B801A95902C000E1D17 /* Vera.ttf.h */; }; - FA0B7D251A95902C000E1D17 /* wrap_Font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B811A95902C000E1D17 /* wrap_Font.cpp */; }; - FA0B7D261A95902C000E1D17 /* wrap_Font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B811A95902C000E1D17 /* wrap_Font.cpp */; }; - FA0B7D271A95902C000E1D17 /* wrap_Font.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B821A95902C000E1D17 /* wrap_Font.h */; }; - FA0B7D281A95902C000E1D17 /* wrap_GlyphData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B831A95902C000E1D17 /* wrap_GlyphData.cpp */; }; - FA0B7D291A95902C000E1D17 /* wrap_GlyphData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B831A95902C000E1D17 /* wrap_GlyphData.cpp */; }; - FA0B7D2A1A95902C000E1D17 /* wrap_GlyphData.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B841A95902C000E1D17 /* wrap_GlyphData.h */; }; - FA0B7D2B1A95902C000E1D17 /* wrap_Rasterizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B851A95902C000E1D17 /* wrap_Rasterizer.cpp */; }; - FA0B7D2C1A95902C000E1D17 /* wrap_Rasterizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B851A95902C000E1D17 /* wrap_Rasterizer.cpp */; }; - FA0B7D2D1A95902C000E1D17 /* wrap_Rasterizer.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B861A95902C000E1D17 /* wrap_Rasterizer.h */; }; - FA0B7D2F1A95902C000E1D17 /* Drawable.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B891A95902C000E1D17 /* Drawable.h */; }; - FA0B7D301A95902C000E1D17 /* Graphics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B8A1A95902C000E1D17 /* Graphics.cpp */; }; - FA0B7D311A95902C000E1D17 /* Graphics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B8A1A95902C000E1D17 /* Graphics.cpp */; }; - FA0B7D321A95902C000E1D17 /* Graphics.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B8B1A95902C000E1D17 /* Graphics.h */; }; - FA0B7D331A95902C000E1D17 /* Canvas.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B8D1A95902C000E1D17 /* Canvas.cpp */; }; - FA0B7D341A95902C000E1D17 /* Canvas.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B8D1A95902C000E1D17 /* Canvas.cpp */; }; - FA0B7D351A95902C000E1D17 /* Canvas.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B8E1A95902C000E1D17 /* Canvas.h */; }; - FA0B7D391A95902C000E1D17 /* Graphics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B911A95902C000E1D17 /* Graphics.cpp */; }; - FA0B7D3A1A95902C000E1D17 /* Graphics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B911A95902C000E1D17 /* Graphics.cpp */; }; - FA0B7D3B1A95902C000E1D17 /* Graphics.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B921A95902C000E1D17 /* Graphics.h */; }; - FA0B7D3C1A95902C000E1D17 /* Image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B931A95902C000E1D17 /* Image.cpp */; }; - FA0B7D3D1A95902C000E1D17 /* Image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B931A95902C000E1D17 /* Image.cpp */; }; - FA0B7D3E1A95902C000E1D17 /* Image.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B941A95902C000E1D17 /* Image.h */; }; - FA0B7D421A95902C000E1D17 /* OpenGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B971A95902C000E1D17 /* OpenGL.cpp */; }; - FA0B7D431A95902C000E1D17 /* OpenGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B971A95902C000E1D17 /* OpenGL.cpp */; }; - FA0B7D441A95902C000E1D17 /* OpenGL.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B981A95902C000E1D17 /* OpenGL.h */; }; - FA0B7D481A95902C000E1D17 /* Polyline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B9B1A95902C000E1D17 /* Polyline.cpp */; }; - FA0B7D491A95902C000E1D17 /* Polyline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B9B1A95902C000E1D17 /* Polyline.cpp */; }; - FA0B7D4A1A95902C000E1D17 /* Polyline.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B9C1A95902C000E1D17 /* Polyline.h */; }; - FA0B7D4B1A95902C000E1D17 /* Shader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B9D1A95902C000E1D17 /* Shader.cpp */; }; - FA0B7D4C1A95902C000E1D17 /* Shader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7B9D1A95902C000E1D17 /* Shader.cpp */; }; - FA0B7D4D1A95902C000E1D17 /* Shader.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7B9E1A95902C000E1D17 /* Shader.h */; }; - FA0B7D551A95902C000E1D17 /* Buffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BA41A95902C000E1D17 /* Buffer.cpp */; }; - FA0B7D561A95902C000E1D17 /* Buffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BA41A95902C000E1D17 /* Buffer.cpp */; }; - FA0B7D571A95902C000E1D17 /* Buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BA51A95902C000E1D17 /* Buffer.h */; }; - FA0B7D791A95902C000E1D17 /* Quad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BBC1A95902C000E1D17 /* Quad.cpp */; }; - FA0B7D7A1A95902C000E1D17 /* Quad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BBC1A95902C000E1D17 /* Quad.cpp */; }; - FA0B7D7B1A95902C000E1D17 /* Quad.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BBD1A95902C000E1D17 /* Quad.h */; }; - FA0B7D7C1A95902C000E1D17 /* Texture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BBE1A95902C000E1D17 /* Texture.cpp */; }; - FA0B7D7D1A95902C000E1D17 /* Texture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BBE1A95902C000E1D17 /* Texture.cpp */; }; - FA0B7D7E1A95902C000E1D17 /* Texture.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BBF1A95902C000E1D17 /* Texture.h */; }; - FA0B7D7F1A95902C000E1D17 /* Volatile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BC01A95902C000E1D17 /* Volatile.cpp */; }; - FA0B7D801A95902C000E1D17 /* Volatile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BC01A95902C000E1D17 /* Volatile.cpp */; }; - FA0B7D811A95902C000E1D17 /* Volatile.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BC11A95902C000E1D17 /* Volatile.h */; }; - FA0B7D821A95902C000E1D17 /* CompressedImageData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BC31A95902C000E1D17 /* CompressedImageData.cpp */; }; - FA0B7D831A95902C000E1D17 /* CompressedImageData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BC31A95902C000E1D17 /* CompressedImageData.cpp */; }; - FA0B7D841A95902C000E1D17 /* CompressedImageData.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BC41A95902C000E1D17 /* CompressedImageData.h */; }; - FA0B7D851A95902C000E1D17 /* Image.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BC51A95902C000E1D17 /* Image.h */; }; - FA0B7D861A95902C000E1D17 /* ImageData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BC61A95902C000E1D17 /* ImageData.cpp */; }; - FA0B7D871A95902C000E1D17 /* ImageData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BC61A95902C000E1D17 /* ImageData.cpp */; }; - FA0B7D881A95902C000E1D17 /* ImageData.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BC71A95902C000E1D17 /* ImageData.h */; }; - FA0B7D8D1A95902C000E1D17 /* ddsHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BCC1A95902C000E1D17 /* ddsHandler.cpp */; }; - FA0B7D8E1A95902C000E1D17 /* ddsHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BCC1A95902C000E1D17 /* ddsHandler.cpp */; }; - FA0B7D8F1A95902C000E1D17 /* ddsHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BCD1A95902C000E1D17 /* ddsHandler.h */; }; - FA0B7D9F1A95902C000E1D17 /* KTXHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BD81A95902C000E1D17 /* KTXHandler.cpp */; }; - FA0B7DA01A95902C000E1D17 /* KTXHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BD81A95902C000E1D17 /* KTXHandler.cpp */; }; - FA0B7DA11A95902C000E1D17 /* KTXHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BD91A95902C000E1D17 /* KTXHandler.h */; }; - FA0B7DA21A95902C000E1D17 /* PKMHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BDA1A95902C000E1D17 /* PKMHandler.cpp */; }; - FA0B7DA31A95902C000E1D17 /* PKMHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BDA1A95902C000E1D17 /* PKMHandler.cpp */; }; - FA0B7DA41A95902C000E1D17 /* PKMHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BDB1A95902C000E1D17 /* PKMHandler.h */; }; - FA0B7DA51A95902C000E1D17 /* PNGHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BDC1A95902C000E1D17 /* PNGHandler.cpp */; }; - FA0B7DA61A95902C000E1D17 /* PNGHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BDC1A95902C000E1D17 /* PNGHandler.cpp */; }; - FA0B7DA71A95902C000E1D17 /* PNGHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BDD1A95902C000E1D17 /* PNGHandler.h */; }; - FA0B7DA81A95902C000E1D17 /* PVRHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BDE1A95902C000E1D17 /* PVRHandler.cpp */; }; - FA0B7DA91A95902C000E1D17 /* PVRHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BDE1A95902C000E1D17 /* PVRHandler.cpp */; }; - FA0B7DAA1A95902C000E1D17 /* PVRHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BDF1A95902C000E1D17 /* PVRHandler.h */; }; - FA0B7DAB1A95902C000E1D17 /* STBHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BE01A95902C000E1D17 /* STBHandler.cpp */; }; - FA0B7DAC1A95902C000E1D17 /* STBHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BE01A95902C000E1D17 /* STBHandler.cpp */; }; - FA0B7DAD1A95902C000E1D17 /* STBHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BE11A95902C000E1D17 /* STBHandler.h */; }; - FA0B7DAE1A95902C000E1D17 /* wrap_CompressedImageData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BE21A95902C000E1D17 /* wrap_CompressedImageData.cpp */; }; - FA0B7DAF1A95902C000E1D17 /* wrap_CompressedImageData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BE21A95902C000E1D17 /* wrap_CompressedImageData.cpp */; }; - FA0B7DB01A95902C000E1D17 /* wrap_CompressedImageData.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BE31A95902C000E1D17 /* wrap_CompressedImageData.h */; }; - FA0B7DB11A95902C000E1D17 /* wrap_Image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BE41A95902C000E1D17 /* wrap_Image.cpp */; }; - FA0B7DB21A95902C000E1D17 /* wrap_Image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BE41A95902C000E1D17 /* wrap_Image.cpp */; }; - FA0B7DB31A95902C000E1D17 /* wrap_Image.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BE51A95902C000E1D17 /* wrap_Image.h */; }; - FA0B7DB41A95902C000E1D17 /* wrap_ImageData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BE61A95902C000E1D17 /* wrap_ImageData.cpp */; }; - FA0B7DB51A95902C000E1D17 /* wrap_ImageData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BE61A95902C000E1D17 /* wrap_ImageData.cpp */; }; - FA0B7DB61A95902C000E1D17 /* wrap_ImageData.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BE71A95902C000E1D17 /* wrap_ImageData.h */; }; - FA0B7DB71A95902C000E1D17 /* Joystick.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BE91A95902C000E1D17 /* Joystick.cpp */; }; - FA0B7DB81A95902C000E1D17 /* Joystick.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BE91A95902C000E1D17 /* Joystick.cpp */; }; - FA0B7DB91A95902C000E1D17 /* Joystick.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BEA1A95902C000E1D17 /* Joystick.h */; }; - FA0B7DBA1A95902C000E1D17 /* JoystickModule.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BEB1A95902C000E1D17 /* JoystickModule.h */; }; - FA0B7DBB1A95902C000E1D17 /* Joystick.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BED1A95902C000E1D17 /* Joystick.cpp */; }; - FA0B7DBC1A95902C000E1D17 /* Joystick.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BED1A95902C000E1D17 /* Joystick.cpp */; }; - FA0B7DBD1A95902C000E1D17 /* Joystick.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BEE1A95902C000E1D17 /* Joystick.h */; }; - FA0B7DBE1A95902C000E1D17 /* JoystickModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BEF1A95902C000E1D17 /* JoystickModule.cpp */; }; - FA0B7DBF1A95902C000E1D17 /* JoystickModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BEF1A95902C000E1D17 /* JoystickModule.cpp */; }; - FA0B7DC01A95902C000E1D17 /* JoystickModule.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BF01A95902C000E1D17 /* JoystickModule.h */; }; - FA0B7DC11A95902C000E1D17 /* wrap_Joystick.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BF11A95902C000E1D17 /* wrap_Joystick.cpp */; }; - FA0B7DC21A95902C000E1D17 /* wrap_Joystick.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BF11A95902C000E1D17 /* wrap_Joystick.cpp */; }; - FA0B7DC31A95902C000E1D17 /* wrap_Joystick.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BF21A95902C000E1D17 /* wrap_Joystick.h */; }; - FA0B7DC41A95902C000E1D17 /* wrap_JoystickModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BF31A95902C000E1D17 /* wrap_JoystickModule.cpp */; }; - FA0B7DC51A95902C000E1D17 /* wrap_JoystickModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BF31A95902C000E1D17 /* wrap_JoystickModule.cpp */; }; - FA0B7DC61A95902C000E1D17 /* wrap_JoystickModule.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BF41A95902C000E1D17 /* wrap_JoystickModule.h */; }; - FA0B7DC71A95902C000E1D17 /* Keyboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BF61A95902C000E1D17 /* Keyboard.cpp */; }; - FA0B7DC81A95902C000E1D17 /* Keyboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BF61A95902C000E1D17 /* Keyboard.cpp */; }; - FA0B7DC91A95902C000E1D17 /* Keyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BF71A95902C000E1D17 /* Keyboard.h */; }; - FA0B7DCA1A95902C000E1D17 /* Keyboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BF91A95902C000E1D17 /* Keyboard.cpp */; }; - FA0B7DCB1A95902C000E1D17 /* Keyboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BF91A95902C000E1D17 /* Keyboard.cpp */; }; - FA0B7DCC1A95902C000E1D17 /* Keyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BFA1A95902C000E1D17 /* Keyboard.h */; }; - FA0B7DCD1A95902C000E1D17 /* wrap_Keyboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BFB1A95902C000E1D17 /* wrap_Keyboard.cpp */; }; - FA0B7DCE1A95902C000E1D17 /* wrap_Keyboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BFB1A95902C000E1D17 /* wrap_Keyboard.cpp */; }; - FA0B7DCF1A95902C000E1D17 /* wrap_Keyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BFC1A95902C000E1D17 /* wrap_Keyboard.h */; }; - FA0B7DD01A95902C000E1D17 /* love.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BFE1A95902C000E1D17 /* love.cpp */; }; - FA0B7DD11A95902C000E1D17 /* love.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BFE1A95902C000E1D17 /* love.cpp */; }; - FA0B7DD21A95902C000E1D17 /* love.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BFF1A95902C000E1D17 /* love.h */; }; - FA0B7DD31A95902C000E1D17 /* BezierCurve.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C011A95902C000E1D17 /* BezierCurve.cpp */; }; - FA0B7DD41A95902C000E1D17 /* BezierCurve.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C011A95902C000E1D17 /* BezierCurve.cpp */; }; - FA0B7DD51A95902C000E1D17 /* BezierCurve.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C021A95902C000E1D17 /* BezierCurve.h */; }; - FA0B7DD61A95902C000E1D17 /* MathModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C031A95902C000E1D17 /* MathModule.cpp */; }; - FA0B7DD71A95902C000E1D17 /* MathModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C031A95902C000E1D17 /* MathModule.cpp */; }; - FA0B7DD81A95902C000E1D17 /* MathModule.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C041A95902C000E1D17 /* MathModule.h */; }; - FA0B7DD91A95902C000E1D17 /* RandomGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C051A95902C000E1D17 /* RandomGenerator.cpp */; }; - FA0B7DDA1A95902C000E1D17 /* RandomGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C051A95902C000E1D17 /* RandomGenerator.cpp */; }; - FA0B7DDB1A95902C000E1D17 /* RandomGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C061A95902C000E1D17 /* RandomGenerator.h */; }; - FA0B7DDC1A95902C000E1D17 /* wrap_BezierCurve.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C071A95902C000E1D17 /* wrap_BezierCurve.cpp */; }; - FA0B7DDD1A95902C000E1D17 /* wrap_BezierCurve.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C071A95902C000E1D17 /* wrap_BezierCurve.cpp */; }; - FA0B7DDE1A95902C000E1D17 /* wrap_BezierCurve.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C081A95902C000E1D17 /* wrap_BezierCurve.h */; }; - FA0B7DDF1A95902C000E1D17 /* wrap_Math.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C091A95902C000E1D17 /* wrap_Math.cpp */; }; - FA0B7DE01A95902C000E1D17 /* wrap_Math.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C091A95902C000E1D17 /* wrap_Math.cpp */; }; - FA0B7DE11A95902C000E1D17 /* wrap_Math.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C0A1A95902C000E1D17 /* wrap_Math.h */; }; - FA0B7DE21A95902C000E1D17 /* wrap_RandomGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C0B1A95902C000E1D17 /* wrap_RandomGenerator.cpp */; }; - FA0B7DE31A95902C000E1D17 /* wrap_RandomGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C0B1A95902C000E1D17 /* wrap_RandomGenerator.cpp */; }; - FA0B7DE41A95902C000E1D17 /* wrap_RandomGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C0C1A95902C000E1D17 /* wrap_RandomGenerator.h */; }; - FA0B7DE51A95902C000E1D17 /* Cursor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C0E1A95902C000E1D17 /* Cursor.cpp */; }; - FA0B7DE61A95902C000E1D17 /* Cursor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C0E1A95902C000E1D17 /* Cursor.cpp */; }; - FA0B7DE71A95902C000E1D17 /* Cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C0F1A95902C000E1D17 /* Cursor.h */; }; - FA0B7DEA1A95902C000E1D17 /* Mouse.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C111A95902C000E1D17 /* Mouse.h */; }; - FA0B7DEB1A95902C000E1D17 /* Cursor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C131A95902C000E1D17 /* Cursor.cpp */; }; - FA0B7DEC1A95902C000E1D17 /* Cursor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C131A95902C000E1D17 /* Cursor.cpp */; }; - FA0B7DED1A95902C000E1D17 /* Cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C141A95902C000E1D17 /* Cursor.h */; }; - FA0B7DEE1A95902C000E1D17 /* Mouse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C151A95902C000E1D17 /* Mouse.cpp */; }; - FA0B7DEF1A95902C000E1D17 /* Mouse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C151A95902C000E1D17 /* Mouse.cpp */; }; - FA0B7DF01A95902C000E1D17 /* Mouse.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C161A95902C000E1D17 /* Mouse.h */; }; - FA0B7DF11A95902C000E1D17 /* wrap_Cursor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C171A95902C000E1D17 /* wrap_Cursor.cpp */; }; - FA0B7DF21A95902C000E1D17 /* wrap_Cursor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C171A95902C000E1D17 /* wrap_Cursor.cpp */; }; - FA0B7DF31A95902C000E1D17 /* wrap_Cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C181A95902C000E1D17 /* wrap_Cursor.h */; }; - FA0B7DF41A95902C000E1D17 /* wrap_Mouse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C191A95902C000E1D17 /* wrap_Mouse.cpp */; }; - FA0B7DF51A95902C000E1D17 /* wrap_Mouse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C191A95902C000E1D17 /* wrap_Mouse.cpp */; }; - FA0B7DF61A95902C000E1D17 /* wrap_Mouse.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C1A1A95902C000E1D17 /* wrap_Mouse.h */; }; - FA0B7DF71A95902C000E1D17 /* Body.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C1C1A95902C000E1D17 /* Body.cpp */; }; - FA0B7DF81A95902C000E1D17 /* Body.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C1C1A95902C000E1D17 /* Body.cpp */; }; - FA0B7DF91A95902C000E1D17 /* Body.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C1D1A95902C000E1D17 /* Body.h */; }; - FA0B7DFA1A95902C000E1D17 /* Body.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C1F1A95902C000E1D17 /* Body.cpp */; }; - FA0B7DFB1A95902C000E1D17 /* Body.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C1F1A95902C000E1D17 /* Body.cpp */; }; - FA0B7DFC1A95902C000E1D17 /* Body.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C201A95902C000E1D17 /* Body.h */; }; - FA0B7DFD1A95902C000E1D17 /* ChainShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C211A95902C000E1D17 /* ChainShape.cpp */; }; - FA0B7DFE1A95902C000E1D17 /* ChainShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C211A95902C000E1D17 /* ChainShape.cpp */; }; - FA0B7DFF1A95902C000E1D17 /* ChainShape.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C221A95902C000E1D17 /* ChainShape.h */; }; - FA0B7E001A95902C000E1D17 /* CircleShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C231A95902C000E1D17 /* CircleShape.cpp */; }; - FA0B7E011A95902C000E1D17 /* CircleShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C231A95902C000E1D17 /* CircleShape.cpp */; }; - FA0B7E021A95902C000E1D17 /* CircleShape.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C241A95902C000E1D17 /* CircleShape.h */; }; - FA0B7E031A95902C000E1D17 /* Contact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C251A95902C000E1D17 /* Contact.cpp */; }; - FA0B7E041A95902C000E1D17 /* Contact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C251A95902C000E1D17 /* Contact.cpp */; }; - FA0B7E051A95902C000E1D17 /* Contact.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C261A95902C000E1D17 /* Contact.h */; }; - FA0B7E061A95902C000E1D17 /* DistanceJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C271A95902C000E1D17 /* DistanceJoint.cpp */; }; - FA0B7E071A95902C000E1D17 /* DistanceJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C271A95902C000E1D17 /* DistanceJoint.cpp */; }; - FA0B7E081A95902C000E1D17 /* DistanceJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C281A95902C000E1D17 /* DistanceJoint.h */; }; - FA0B7E091A95902C000E1D17 /* EdgeShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C291A95902C000E1D17 /* EdgeShape.cpp */; }; - FA0B7E0A1A95902C000E1D17 /* EdgeShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C291A95902C000E1D17 /* EdgeShape.cpp */; }; - FA0B7E0B1A95902C000E1D17 /* EdgeShape.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C2A1A95902C000E1D17 /* EdgeShape.h */; }; - FA0B7E0C1A95902C000E1D17 /* Fixture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C2B1A95902C000E1D17 /* Fixture.cpp */; }; - FA0B7E0D1A95902C000E1D17 /* Fixture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C2B1A95902C000E1D17 /* Fixture.cpp */; }; - FA0B7E0E1A95902C000E1D17 /* Fixture.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C2C1A95902C000E1D17 /* Fixture.h */; }; - FA0B7E0F1A95902C000E1D17 /* FrictionJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C2D1A95902C000E1D17 /* FrictionJoint.cpp */; }; - FA0B7E101A95902C000E1D17 /* FrictionJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C2D1A95902C000E1D17 /* FrictionJoint.cpp */; }; - FA0B7E111A95902C000E1D17 /* FrictionJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C2E1A95902C000E1D17 /* FrictionJoint.h */; }; - FA0B7E121A95902C000E1D17 /* GearJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C2F1A95902C000E1D17 /* GearJoint.cpp */; }; - FA0B7E131A95902C000E1D17 /* GearJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C2F1A95902C000E1D17 /* GearJoint.cpp */; }; - FA0B7E141A95902C000E1D17 /* GearJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C301A95902C000E1D17 /* GearJoint.h */; }; - FA0B7E151A95902C000E1D17 /* Joint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C311A95902C000E1D17 /* Joint.cpp */; }; - FA0B7E161A95902C000E1D17 /* Joint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C311A95902C000E1D17 /* Joint.cpp */; }; - FA0B7E171A95902C000E1D17 /* Joint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C321A95902C000E1D17 /* Joint.h */; }; - FA0B7E181A95902C000E1D17 /* MotorJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C331A95902C000E1D17 /* MotorJoint.cpp */; }; - FA0B7E191A95902C000E1D17 /* MotorJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C331A95902C000E1D17 /* MotorJoint.cpp */; }; - FA0B7E1A1A95902C000E1D17 /* MotorJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C341A95902C000E1D17 /* MotorJoint.h */; }; - FA0B7E1B1A95902C000E1D17 /* MouseJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C351A95902C000E1D17 /* MouseJoint.cpp */; }; - FA0B7E1C1A95902C000E1D17 /* MouseJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C351A95902C000E1D17 /* MouseJoint.cpp */; }; - FA0B7E1D1A95902C000E1D17 /* MouseJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C361A95902C000E1D17 /* MouseJoint.h */; }; - FA0B7E1E1A95902C000E1D17 /* Physics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C371A95902C000E1D17 /* Physics.cpp */; }; - FA0B7E1F1A95902C000E1D17 /* Physics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C371A95902C000E1D17 /* Physics.cpp */; }; - FA0B7E201A95902C000E1D17 /* Physics.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C381A95902C000E1D17 /* Physics.h */; }; - FA0B7E211A95902C000E1D17 /* PolygonShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C391A95902C000E1D17 /* PolygonShape.cpp */; }; - FA0B7E221A95902C000E1D17 /* PolygonShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C391A95902C000E1D17 /* PolygonShape.cpp */; }; - FA0B7E231A95902C000E1D17 /* PolygonShape.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C3A1A95902C000E1D17 /* PolygonShape.h */; }; - FA0B7E241A95902C000E1D17 /* PrismaticJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C3B1A95902C000E1D17 /* PrismaticJoint.cpp */; }; - FA0B7E251A95902C000E1D17 /* PrismaticJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C3B1A95902C000E1D17 /* PrismaticJoint.cpp */; }; - FA0B7E261A95902C000E1D17 /* PrismaticJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C3C1A95902C000E1D17 /* PrismaticJoint.h */; }; - FA0B7E271A95902C000E1D17 /* PulleyJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C3D1A95902C000E1D17 /* PulleyJoint.cpp */; }; - FA0B7E281A95902C000E1D17 /* PulleyJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C3D1A95902C000E1D17 /* PulleyJoint.cpp */; }; - FA0B7E291A95902C000E1D17 /* PulleyJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C3E1A95902C000E1D17 /* PulleyJoint.h */; }; - FA0B7E2A1A95902C000E1D17 /* RevoluteJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C3F1A95902C000E1D17 /* RevoluteJoint.cpp */; }; - FA0B7E2B1A95902C000E1D17 /* RevoluteJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C3F1A95902C000E1D17 /* RevoluteJoint.cpp */; }; - FA0B7E2C1A95902C000E1D17 /* RevoluteJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C401A95902C000E1D17 /* RevoluteJoint.h */; }; - FA0B7E2D1A95902C000E1D17 /* RopeJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C411A95902C000E1D17 /* RopeJoint.cpp */; }; - FA0B7E2E1A95902C000E1D17 /* RopeJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C411A95902C000E1D17 /* RopeJoint.cpp */; }; - FA0B7E2F1A95902C000E1D17 /* RopeJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C421A95902C000E1D17 /* RopeJoint.h */; }; - FA0B7E301A95902C000E1D17 /* Shape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C431A95902C000E1D17 /* Shape.cpp */; }; - FA0B7E311A95902C000E1D17 /* Shape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C431A95902C000E1D17 /* Shape.cpp */; }; - FA0B7E321A95902C000E1D17 /* Shape.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C441A95902C000E1D17 /* Shape.h */; }; - FA0B7E331A95902C000E1D17 /* WeldJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C451A95902C000E1D17 /* WeldJoint.cpp */; }; - FA0B7E341A95902C000E1D17 /* WeldJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C451A95902C000E1D17 /* WeldJoint.cpp */; }; - FA0B7E351A95902C000E1D17 /* WeldJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C461A95902C000E1D17 /* WeldJoint.h */; }; - FA0B7E361A95902C000E1D17 /* WheelJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C471A95902C000E1D17 /* WheelJoint.cpp */; }; - FA0B7E371A95902C000E1D17 /* WheelJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C471A95902C000E1D17 /* WheelJoint.cpp */; }; - FA0B7E381A95902C000E1D17 /* WheelJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C481A95902C000E1D17 /* WheelJoint.h */; }; - FA0B7E391A95902C000E1D17 /* World.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C491A95902C000E1D17 /* World.cpp */; }; - FA0B7E3A1A95902C000E1D17 /* World.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C491A95902C000E1D17 /* World.cpp */; }; - FA0B7E3B1A95902C000E1D17 /* World.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C4A1A95902C000E1D17 /* World.h */; }; - FA0B7E3C1A95902C000E1D17 /* wrap_Body.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C4B1A95902C000E1D17 /* wrap_Body.cpp */; }; - FA0B7E3D1A95902C000E1D17 /* wrap_Body.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C4B1A95902C000E1D17 /* wrap_Body.cpp */; }; - FA0B7E3E1A95902C000E1D17 /* wrap_Body.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C4C1A95902C000E1D17 /* wrap_Body.h */; }; - FA0B7E3F1A95902C000E1D17 /* wrap_ChainShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C4D1A95902C000E1D17 /* wrap_ChainShape.cpp */; }; - FA0B7E401A95902C000E1D17 /* wrap_ChainShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C4D1A95902C000E1D17 /* wrap_ChainShape.cpp */; }; - FA0B7E411A95902C000E1D17 /* wrap_ChainShape.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C4E1A95902C000E1D17 /* wrap_ChainShape.h */; }; - FA0B7E421A95902C000E1D17 /* wrap_CircleShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C4F1A95902C000E1D17 /* wrap_CircleShape.cpp */; }; - FA0B7E431A95902C000E1D17 /* wrap_CircleShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C4F1A95902C000E1D17 /* wrap_CircleShape.cpp */; }; - FA0B7E441A95902C000E1D17 /* wrap_CircleShape.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C501A95902C000E1D17 /* wrap_CircleShape.h */; }; - FA0B7E451A95902C000E1D17 /* wrap_Contact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C511A95902C000E1D17 /* wrap_Contact.cpp */; }; - FA0B7E461A95902C000E1D17 /* wrap_Contact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C511A95902C000E1D17 /* wrap_Contact.cpp */; }; - FA0B7E471A95902C000E1D17 /* wrap_Contact.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C521A95902C000E1D17 /* wrap_Contact.h */; }; - FA0B7E481A95902C000E1D17 /* wrap_DistanceJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C531A95902C000E1D17 /* wrap_DistanceJoint.cpp */; }; - FA0B7E491A95902C000E1D17 /* wrap_DistanceJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C531A95902C000E1D17 /* wrap_DistanceJoint.cpp */; }; - FA0B7E4A1A95902C000E1D17 /* wrap_DistanceJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C541A95902C000E1D17 /* wrap_DistanceJoint.h */; }; - FA0B7E4B1A95902C000E1D17 /* wrap_EdgeShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C551A95902C000E1D17 /* wrap_EdgeShape.cpp */; }; - FA0B7E4C1A95902C000E1D17 /* wrap_EdgeShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C551A95902C000E1D17 /* wrap_EdgeShape.cpp */; }; - FA0B7E4D1A95902C000E1D17 /* wrap_EdgeShape.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C561A95902C000E1D17 /* wrap_EdgeShape.h */; }; - FA0B7E4E1A95902C000E1D17 /* wrap_Fixture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C571A95902C000E1D17 /* wrap_Fixture.cpp */; }; - FA0B7E4F1A95902C000E1D17 /* wrap_Fixture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C571A95902C000E1D17 /* wrap_Fixture.cpp */; }; - FA0B7E501A95902C000E1D17 /* wrap_Fixture.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C581A95902C000E1D17 /* wrap_Fixture.h */; }; - FA0B7E511A95902C000E1D17 /* wrap_FrictionJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C591A95902C000E1D17 /* wrap_FrictionJoint.cpp */; }; - FA0B7E521A95902C000E1D17 /* wrap_FrictionJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C591A95902C000E1D17 /* wrap_FrictionJoint.cpp */; }; - FA0B7E531A95902C000E1D17 /* wrap_FrictionJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C5A1A95902C000E1D17 /* wrap_FrictionJoint.h */; }; - FA0B7E541A95902C000E1D17 /* wrap_GearJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C5B1A95902C000E1D17 /* wrap_GearJoint.cpp */; }; - FA0B7E551A95902C000E1D17 /* wrap_GearJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C5B1A95902C000E1D17 /* wrap_GearJoint.cpp */; }; - FA0B7E561A95902C000E1D17 /* wrap_GearJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C5C1A95902C000E1D17 /* wrap_GearJoint.h */; }; - FA0B7E571A95902C000E1D17 /* wrap_Joint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C5D1A95902C000E1D17 /* wrap_Joint.cpp */; }; - FA0B7E581A95902C000E1D17 /* wrap_Joint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C5D1A95902C000E1D17 /* wrap_Joint.cpp */; }; - FA0B7E591A95902C000E1D17 /* wrap_Joint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C5E1A95902C000E1D17 /* wrap_Joint.h */; }; - FA0B7E5A1A95902C000E1D17 /* wrap_MotorJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C5F1A95902C000E1D17 /* wrap_MotorJoint.cpp */; }; - FA0B7E5B1A95902C000E1D17 /* wrap_MotorJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C5F1A95902C000E1D17 /* wrap_MotorJoint.cpp */; }; - FA0B7E5C1A95902C000E1D17 /* wrap_MotorJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C601A95902C000E1D17 /* wrap_MotorJoint.h */; }; - FA0B7E5D1A95902C000E1D17 /* wrap_MouseJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C611A95902C000E1D17 /* wrap_MouseJoint.cpp */; }; - FA0B7E5E1A95902C000E1D17 /* wrap_MouseJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C611A95902C000E1D17 /* wrap_MouseJoint.cpp */; }; - FA0B7E5F1A95902C000E1D17 /* wrap_MouseJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C621A95902C000E1D17 /* wrap_MouseJoint.h */; }; - FA0B7E601A95902C000E1D17 /* wrap_Physics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C631A95902C000E1D17 /* wrap_Physics.cpp */; }; - FA0B7E611A95902C000E1D17 /* wrap_Physics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C631A95902C000E1D17 /* wrap_Physics.cpp */; }; - FA0B7E621A95902C000E1D17 /* wrap_Physics.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C641A95902C000E1D17 /* wrap_Physics.h */; }; - FA0B7E631A95902C000E1D17 /* wrap_PolygonShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C651A95902C000E1D17 /* wrap_PolygonShape.cpp */; }; - FA0B7E641A95902C000E1D17 /* wrap_PolygonShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C651A95902C000E1D17 /* wrap_PolygonShape.cpp */; }; - FA0B7E651A95902C000E1D17 /* wrap_PolygonShape.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C661A95902C000E1D17 /* wrap_PolygonShape.h */; }; - FA0B7E661A95902C000E1D17 /* wrap_PrismaticJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C671A95902C000E1D17 /* wrap_PrismaticJoint.cpp */; }; - FA0B7E671A95902C000E1D17 /* wrap_PrismaticJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C671A95902C000E1D17 /* wrap_PrismaticJoint.cpp */; }; - FA0B7E681A95902C000E1D17 /* wrap_PrismaticJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C681A95902C000E1D17 /* wrap_PrismaticJoint.h */; }; - FA0B7E691A95902C000E1D17 /* wrap_PulleyJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C691A95902C000E1D17 /* wrap_PulleyJoint.cpp */; }; - FA0B7E6A1A95902C000E1D17 /* wrap_PulleyJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C691A95902C000E1D17 /* wrap_PulleyJoint.cpp */; }; - FA0B7E6B1A95902C000E1D17 /* wrap_PulleyJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C6A1A95902C000E1D17 /* wrap_PulleyJoint.h */; }; - FA0B7E6C1A95902C000E1D17 /* wrap_RevoluteJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C6B1A95902C000E1D17 /* wrap_RevoluteJoint.cpp */; }; - FA0B7E6D1A95902C000E1D17 /* wrap_RevoluteJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C6B1A95902C000E1D17 /* wrap_RevoluteJoint.cpp */; }; - FA0B7E6E1A95902C000E1D17 /* wrap_RevoluteJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C6C1A95902C000E1D17 /* wrap_RevoluteJoint.h */; }; - FA0B7E6F1A95902C000E1D17 /* wrap_RopeJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C6D1A95902C000E1D17 /* wrap_RopeJoint.cpp */; }; - FA0B7E701A95902C000E1D17 /* wrap_RopeJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C6D1A95902C000E1D17 /* wrap_RopeJoint.cpp */; }; - FA0B7E711A95902C000E1D17 /* wrap_RopeJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C6E1A95902C000E1D17 /* wrap_RopeJoint.h */; }; - FA0B7E721A95902C000E1D17 /* wrap_Shape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C6F1A95902C000E1D17 /* wrap_Shape.cpp */; }; - FA0B7E731A95902C000E1D17 /* wrap_Shape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C6F1A95902C000E1D17 /* wrap_Shape.cpp */; }; - FA0B7E741A95902C000E1D17 /* wrap_Shape.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C701A95902C000E1D17 /* wrap_Shape.h */; }; - FA0B7E751A95902C000E1D17 /* wrap_WeldJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C711A95902C000E1D17 /* wrap_WeldJoint.cpp */; }; - FA0B7E761A95902C000E1D17 /* wrap_WeldJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C711A95902C000E1D17 /* wrap_WeldJoint.cpp */; }; - FA0B7E771A95902C000E1D17 /* wrap_WeldJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C721A95902C000E1D17 /* wrap_WeldJoint.h */; }; - FA0B7E781A95902C000E1D17 /* wrap_WheelJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C731A95902C000E1D17 /* wrap_WheelJoint.cpp */; }; - FA0B7E791A95902C000E1D17 /* wrap_WheelJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C731A95902C000E1D17 /* wrap_WheelJoint.cpp */; }; - FA0B7E7A1A95902C000E1D17 /* wrap_WheelJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C741A95902C000E1D17 /* wrap_WheelJoint.h */; }; - FA0B7E7B1A95902C000E1D17 /* wrap_World.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C751A95902C000E1D17 /* wrap_World.cpp */; }; - FA0B7E7C1A95902C000E1D17 /* wrap_World.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C751A95902C000E1D17 /* wrap_World.cpp */; }; - FA0B7E7D1A95902C000E1D17 /* wrap_World.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C761A95902C000E1D17 /* wrap_World.h */; }; - FA0B7E7E1A95902C000E1D17 /* Joint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C771A95902C000E1D17 /* Joint.cpp */; }; - FA0B7E7F1A95902C000E1D17 /* Joint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C771A95902C000E1D17 /* Joint.cpp */; }; - FA0B7E801A95902C000E1D17 /* Joint.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C781A95902C000E1D17 /* Joint.h */; }; - FA0B7E811A95902C000E1D17 /* Shape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C791A95902C000E1D17 /* Shape.cpp */; }; - FA0B7E821A95902C000E1D17 /* Shape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C791A95902C000E1D17 /* Shape.cpp */; }; - FA0B7E831A95902C000E1D17 /* Shape.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C7A1A95902C000E1D17 /* Shape.h */; }; - FA0B7E841A95902C000E1D17 /* Decoder.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C7C1A95902C000E1D17 /* Decoder.h */; }; - FA0B7E851A95902C000E1D17 /* CoreAudioDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C7E1A95902C000E1D17 /* CoreAudioDecoder.cpp */; }; - FA0B7E861A95902C000E1D17 /* CoreAudioDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C7E1A95902C000E1D17 /* CoreAudioDecoder.cpp */; }; - FA0B7E871A95902C000E1D17 /* CoreAudioDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C7F1A95902C000E1D17 /* CoreAudioDecoder.h */; }; - FA0B7E881A95902C000E1D17 /* Decoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C801A95902C000E1D17 /* Decoder.cpp */; }; - FA0B7E891A95902C000E1D17 /* Decoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C801A95902C000E1D17 /* Decoder.cpp */; }; - FA0B7E8B1A95902C000E1D17 /* FLACDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C821A95902C000E1D17 /* FLACDecoder.cpp */; }; - FA0B7E8C1A95902C000E1D17 /* FLACDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C821A95902C000E1D17 /* FLACDecoder.cpp */; }; - FA0B7E8D1A95902C000E1D17 /* FLACDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C831A95902C000E1D17 /* FLACDecoder.h */; }; - FA0B7E8E1A95902C000E1D17 /* GmeDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C841A95902C000E1D17 /* GmeDecoder.cpp */; }; - FA0B7E8F1A95902C000E1D17 /* GmeDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C841A95902C000E1D17 /* GmeDecoder.cpp */; }; - FA0B7E901A95902C000E1D17 /* GmeDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C851A95902C000E1D17 /* GmeDecoder.h */; }; - FA0B7E911A95902C000E1D17 /* ModPlugDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C861A95902C000E1D17 /* ModPlugDecoder.cpp */; }; - FA0B7E921A95902C000E1D17 /* ModPlugDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C861A95902C000E1D17 /* ModPlugDecoder.cpp */; }; - FA0B7E931A95902C000E1D17 /* ModPlugDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C871A95902C000E1D17 /* ModPlugDecoder.h */; }; - FA0B7E941A95902C000E1D17 /* Mpg123Decoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C881A95902C000E1D17 /* Mpg123Decoder.cpp */; }; - FA0B7E961A95902C000E1D17 /* Mpg123Decoder.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C891A95902C000E1D17 /* Mpg123Decoder.h */; }; - FA0B7E971A95902C000E1D17 /* Sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C8A1A95902C000E1D17 /* Sound.cpp */; }; - FA0B7E981A95902C000E1D17 /* Sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C8A1A95902C000E1D17 /* Sound.cpp */; }; - FA0B7E991A95902C000E1D17 /* Sound.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C8B1A95902C000E1D17 /* Sound.h */; }; - FA0B7E9A1A95902C000E1D17 /* VorbisDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C8C1A95902C000E1D17 /* VorbisDecoder.cpp */; }; - FA0B7E9B1A95902C000E1D17 /* VorbisDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C8C1A95902C000E1D17 /* VorbisDecoder.cpp */; }; - FA0B7E9C1A95902C000E1D17 /* VorbisDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C8D1A95902C000E1D17 /* VorbisDecoder.h */; }; - FA0B7E9D1A95902C000E1D17 /* WaveDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C8E1A95902C000E1D17 /* WaveDecoder.cpp */; }; - FA0B7E9E1A95902C000E1D17 /* WaveDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C8E1A95902C000E1D17 /* WaveDecoder.cpp */; }; - FA0B7E9F1A95902C000E1D17 /* WaveDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C8F1A95902C000E1D17 /* WaveDecoder.h */; }; - FA0B7EA01A95902C000E1D17 /* Sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C901A95902C000E1D17 /* Sound.cpp */; }; - FA0B7EA11A95902C000E1D17 /* Sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C901A95902C000E1D17 /* Sound.cpp */; }; - FA0B7EA21A95902C000E1D17 /* Sound.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C911A95902C000E1D17 /* Sound.h */; }; - FA0B7EA31A95902C000E1D17 /* SoundData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C921A95902C000E1D17 /* SoundData.cpp */; }; - FA0B7EA41A95902C000E1D17 /* SoundData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C921A95902C000E1D17 /* SoundData.cpp */; }; - FA0B7EA51A95902C000E1D17 /* SoundData.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C931A95902C000E1D17 /* SoundData.h */; }; - FA0B7EA61A95902C000E1D17 /* wrap_Decoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C941A95902C000E1D17 /* wrap_Decoder.cpp */; }; - FA0B7EA71A95902C000E1D17 /* wrap_Decoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C941A95902C000E1D17 /* wrap_Decoder.cpp */; }; - FA0B7EA81A95902C000E1D17 /* wrap_Decoder.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C951A95902C000E1D17 /* wrap_Decoder.h */; }; - FA0B7EA91A95902C000E1D17 /* wrap_Sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C961A95902C000E1D17 /* wrap_Sound.cpp */; }; - FA0B7EAA1A95902C000E1D17 /* wrap_Sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C961A95902C000E1D17 /* wrap_Sound.cpp */; }; - FA0B7EAB1A95902C000E1D17 /* wrap_Sound.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C971A95902C000E1D17 /* wrap_Sound.h */; }; - FA0B7EAC1A95902C000E1D17 /* wrap_SoundData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C981A95902C000E1D17 /* wrap_SoundData.cpp */; }; - FA0B7EAD1A95902C000E1D17 /* wrap_SoundData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C981A95902C000E1D17 /* wrap_SoundData.cpp */; }; - FA0B7EAE1A95902C000E1D17 /* wrap_SoundData.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C991A95902C000E1D17 /* wrap_SoundData.h */; }; - FA0B7EAF1A95902C000E1D17 /* System.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C9C1A95902C000E1D17 /* System.cpp */; }; - FA0B7EB01A95902C000E1D17 /* System.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C9C1A95902C000E1D17 /* System.cpp */; }; - FA0B7EB11A95902C000E1D17 /* System.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C9D1A95902C000E1D17 /* System.h */; }; - FA0B7EB21A95902C000E1D17 /* System.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C9E1A95902C000E1D17 /* System.cpp */; }; - FA0B7EB31A95902C000E1D17 /* System.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C9E1A95902C000E1D17 /* System.cpp */; }; - FA0B7EB41A95902C000E1D17 /* System.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C9F1A95902C000E1D17 /* System.h */; }; - FA0B7EB51A95902C000E1D17 /* wrap_System.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CA01A95902C000E1D17 /* wrap_System.cpp */; }; - FA0B7EB61A95902C000E1D17 /* wrap_System.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CA01A95902C000E1D17 /* wrap_System.cpp */; }; - FA0B7EB71A95902C000E1D17 /* wrap_System.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7CA11A95902C000E1D17 /* wrap_System.h */; }; - FA0B7EB81A95902C000E1D17 /* Channel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CA31A95902C000E1D17 /* Channel.cpp */; }; - FA0B7EB91A95902C000E1D17 /* Channel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CA31A95902C000E1D17 /* Channel.cpp */; }; - FA0B7EBA1A95902C000E1D17 /* Channel.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7CA41A95902C000E1D17 /* Channel.h */; }; - FA0B7EBB1A95902C000E1D17 /* LuaThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CA51A95902C000E1D17 /* LuaThread.cpp */; }; - FA0B7EBC1A95902C000E1D17 /* LuaThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CA51A95902C000E1D17 /* LuaThread.cpp */; }; - FA0B7EBD1A95902C000E1D17 /* LuaThread.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7CA61A95902C000E1D17 /* LuaThread.h */; }; - FA0B7EBE1A95902C000E1D17 /* Thread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CA81A95902C000E1D17 /* Thread.cpp */; }; - FA0B7EBF1A95902C000E1D17 /* Thread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CA81A95902C000E1D17 /* Thread.cpp */; }; - FA0B7EC01A95902C000E1D17 /* Thread.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7CA91A95902C000E1D17 /* Thread.h */; }; - FA0B7EC11A95902C000E1D17 /* threads.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CAA1A95902C000E1D17 /* threads.cpp */; }; - FA0B7EC21A95902C000E1D17 /* threads.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CAA1A95902C000E1D17 /* threads.cpp */; }; - FA0B7EC31A95902C000E1D17 /* threads.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7CAB1A95902C000E1D17 /* threads.h */; }; - FA0B7EC41A95902C000E1D17 /* Thread.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7CAC1A95902C000E1D17 /* Thread.h */; }; - FA0B7EC51A95902C000E1D17 /* ThreadModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CAD1A95902C000E1D17 /* ThreadModule.cpp */; }; - FA0B7EC61A95902C000E1D17 /* ThreadModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CAD1A95902C000E1D17 /* ThreadModule.cpp */; }; - FA0B7EC71A95902C000E1D17 /* ThreadModule.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7CAE1A95902C000E1D17 /* ThreadModule.h */; }; - FA0B7EC81A95902C000E1D17 /* threads.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CAF1A95902C000E1D17 /* threads.cpp */; }; - FA0B7EC91A95902C000E1D17 /* threads.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CAF1A95902C000E1D17 /* threads.cpp */; }; - FA0B7ECA1A95902C000E1D17 /* threads.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7CB01A95902C000E1D17 /* threads.h */; }; - FA0B7ECB1A95902C000E1D17 /* wrap_Channel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CB11A95902C000E1D17 /* wrap_Channel.cpp */; }; - FA0B7ECC1A95902C000E1D17 /* wrap_Channel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CB11A95902C000E1D17 /* wrap_Channel.cpp */; }; - FA0B7ECD1A95902C000E1D17 /* wrap_Channel.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7CB21A95902C000E1D17 /* wrap_Channel.h */; }; - FA0B7ECE1A95902C000E1D17 /* wrap_LuaThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CB31A95902C000E1D17 /* wrap_LuaThread.cpp */; }; - FA0B7ECF1A95902C000E1D17 /* wrap_LuaThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CB31A95902C000E1D17 /* wrap_LuaThread.cpp */; }; - FA0B7ED01A95902C000E1D17 /* wrap_LuaThread.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7CB41A95902C000E1D17 /* wrap_LuaThread.h */; }; - FA0B7ED11A95902C000E1D17 /* wrap_ThreadModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CB51A95902C000E1D17 /* wrap_ThreadModule.cpp */; }; - FA0B7ED21A95902C000E1D17 /* wrap_ThreadModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CB51A95902C000E1D17 /* wrap_ThreadModule.cpp */; }; - FA0B7ED31A95902C000E1D17 /* wrap_ThreadModule.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7CB61A95902C000E1D17 /* wrap_ThreadModule.h */; }; - FA0B7ED71A95902D000E1D17 /* Timer.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7CBB1A95902C000E1D17 /* Timer.h */; }; - FA0B7ED81A95902D000E1D17 /* wrap_Timer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CBC1A95902C000E1D17 /* wrap_Timer.cpp */; }; - FA0B7ED91A95902D000E1D17 /* wrap_Timer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CBC1A95902C000E1D17 /* wrap_Timer.cpp */; }; - FA0B7EDA1A95902D000E1D17 /* wrap_Timer.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7CBD1A95902C000E1D17 /* wrap_Timer.h */; }; - FA0B7EDB1A95902D000E1D17 /* Touch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CC01A95902C000E1D17 /* Touch.cpp */; }; - FA0B7EDC1A95902D000E1D17 /* Touch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CC01A95902C000E1D17 /* Touch.cpp */; }; - FA0B7EDD1A95902D000E1D17 /* Touch.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7CC11A95902C000E1D17 /* Touch.h */; }; - FA0B7EDE1A95902D000E1D17 /* Touch.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7CC21A95902C000E1D17 /* Touch.h */; }; - FA0B7EDF1A95902D000E1D17 /* wrap_Touch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CC31A95902C000E1D17 /* wrap_Touch.cpp */; }; - FA0B7EE01A95902D000E1D17 /* wrap_Touch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CC31A95902C000E1D17 /* wrap_Touch.cpp */; }; - FA0B7EE11A95902D000E1D17 /* wrap_Touch.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7CC41A95902C000E1D17 /* wrap_Touch.h */; }; - FA0B7EE21A95902D000E1D17 /* Window.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CC71A95902C000E1D17 /* Window.cpp */; }; - FA0B7EE31A95902D000E1D17 /* Window.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CC71A95902C000E1D17 /* Window.cpp */; }; - FA0B7EE41A95902D000E1D17 /* Window.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7CC81A95902C000E1D17 /* Window.h */; }; - FA0B7EE51A95902D000E1D17 /* Window.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CC91A95902C000E1D17 /* Window.cpp */; }; - FA0B7EE61A95902D000E1D17 /* Window.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CC91A95902C000E1D17 /* Window.cpp */; }; - FA0B7EE71A95902D000E1D17 /* Window.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7CCA1A95902C000E1D17 /* Window.h */; }; - FA0B7EE81A95902D000E1D17 /* wrap_Window.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CCB1A95902C000E1D17 /* wrap_Window.cpp */; }; - FA0B7EE91A95902D000E1D17 /* wrap_Window.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7CCB1A95902C000E1D17 /* wrap_Window.cpp */; }; - FA0B7EEA1A95902D000E1D17 /* wrap_Window.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7CCC1A95902C000E1D17 /* wrap_Window.h */; }; - FA0B7EF21A959D2C000E1D17 /* ios.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7EF11A959D2C000E1D17 /* ios.mm */; }; - FA1557C01CE90A2C00AFF582 /* tinyexr.h in Headers */ = {isa = PBXBuildFile; fileRef = FA1557BF1CE90A2C00AFF582 /* tinyexr.h */; }; - FA1557C31CE90BD200AFF582 /* EXRHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA1557C11CE90BD200AFF582 /* EXRHandler.cpp */; }; - FA1557C41CE90BD200AFF582 /* EXRHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FA1557C21CE90BD200AFF582 /* EXRHandler.h */; }; - FA1557C51CE90BD900AFF582 /* EXRHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA1557C11CE90BD200AFF582 /* EXRHandler.cpp */; }; - FA1583E21E196180005E603B /* wrap_Shader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA1BA0B51E17043400AA2803 /* wrap_Shader.cpp */; }; - FA15DFAC1F9B8C850042AB22 /* StringMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA15DFAB1F9B8C850042AB22 /* StringMap.cpp */; }; - FA15DFAD1F9B8CBA0042AB22 /* StringMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA15DFAB1F9B8C850042AB22 /* StringMap.cpp */; }; - FA15DFAE1F9B8D360042AB22 /* lutf8lib.c in Sources */ = {isa = PBXBuildFile; fileRef = FAAA3FD61F64B3AD00F89E99 /* lutf8lib.c */; }; - FA15DFAF1F9B8D390042AB22 /* lstrlib.c in Sources */ = {isa = PBXBuildFile; fileRef = FAAA3FD41F64B3AD00F89E99 /* lstrlib.c */; }; - FA15DFB01F9B8D6A0042AB22 /* wrap_Data.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA6A2B651F5F7B6B0074C308 /* wrap_Data.cpp */; }; - FA15DFB11F9B8D820042AB22 /* OggDemuxer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAA54AC91F91660400A8FA7B /* OggDemuxer.cpp */; }; - FA15DFB21F9B8D840042AB22 /* TheoraVideoStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAA54AC81F91660400A8FA7B /* TheoraVideoStream.cpp */; }; - FA1BA09D1E16CFCE00AA2803 /* Font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA1BA09B1E16CFCE00AA2803 /* Font.cpp */; }; - FA1BA09E1E16CFCE00AA2803 /* Font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA1BA09B1E16CFCE00AA2803 /* Font.cpp */; }; - FA1BA09F1E16CFCE00AA2803 /* Font.h in Headers */ = {isa = PBXBuildFile; fileRef = FA1BA09C1E16CFCE00AA2803 /* Font.h */; }; - FA1BA0A21E16D97500AA2803 /* wrap_Font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA1BA0A01E16D97500AA2803 /* wrap_Font.cpp */; }; - FA1BA0A31E16D97500AA2803 /* wrap_Font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA1BA0A01E16D97500AA2803 /* wrap_Font.cpp */; }; - FA1BA0A41E16D97500AA2803 /* wrap_Font.h in Headers */ = {isa = PBXBuildFile; fileRef = FA1BA0A11E16D97500AA2803 /* wrap_Font.h */; }; - FA1BA0A71E16F20600AA2803 /* Canvas.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA1BA0A51E16F20600AA2803 /* Canvas.cpp */; }; - FA1BA0A81E16F20600AA2803 /* Canvas.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA1BA0A51E16F20600AA2803 /* Canvas.cpp */; }; - FA1BA0A91E16F20600AA2803 /* Canvas.h in Headers */ = {isa = PBXBuildFile; fileRef = FA1BA0A61E16F20600AA2803 /* Canvas.h */; }; - FA1BA0AC1E16F9EE00AA2803 /* wrap_Canvas.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA1BA0AA1E16F9EE00AA2803 /* wrap_Canvas.cpp */; }; - FA1BA0AD1E16F9EE00AA2803 /* wrap_Canvas.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA1BA0AA1E16F9EE00AA2803 /* wrap_Canvas.cpp */; }; - FA1BA0AE1E16F9EE00AA2803 /* wrap_Canvas.h in Headers */ = {isa = PBXBuildFile; fileRef = FA1BA0AB1E16F9EE00AA2803 /* wrap_Canvas.h */; }; - FA1BA0B11E16FD0800AA2803 /* Shader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA1BA0AF1E16FD0800AA2803 /* Shader.cpp */; }; - FA1BA0B21E16FD0800AA2803 /* Shader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA1BA0AF1E16FD0800AA2803 /* Shader.cpp */; }; - FA1BA0B31E16FD0800AA2803 /* Shader.h in Headers */ = {isa = PBXBuildFile; fileRef = FA1BA0B01E16FD0800AA2803 /* Shader.h */; }; - FA1BA0B71E17043400AA2803 /* wrap_Shader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA1BA0B51E17043400AA2803 /* wrap_Shader.cpp */; }; - FA1BA0B81E17043400AA2803 /* wrap_Shader.h in Headers */ = {isa = PBXBuildFile; fileRef = FA1BA0B61E17043400AA2803 /* wrap_Shader.h */; }; - FA1E887E1DF363CD00E808AA /* Filter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA1E887C1DF363CD00E808AA /* Filter.cpp */; }; - FA1E887F1DF363CD00E808AA /* Filter.h in Headers */ = {isa = PBXBuildFile; fileRef = FA1E887D1DF363CD00E808AA /* Filter.h */; }; - FA1E88801DF363D400E808AA /* Filter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA1E887C1DF363CD00E808AA /* Filter.cpp */; }; - FA1E88831DF363DB00E808AA /* Filter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA1E88811DF363DB00E808AA /* Filter.cpp */; }; - FA1E88841DF363DB00E808AA /* Filter.h in Headers */ = {isa = PBXBuildFile; fileRef = FA1E88821DF363DB00E808AA /* Filter.h */; }; - FA1E88851DF363E100E808AA /* Filter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA1E88811DF363DB00E808AA /* Filter.cpp */; }; - FA27B39D1B498151008A9DCE /* Video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA27B38A1B498151008A9DCE /* Video.cpp */; }; - FA27B39E1B498151008A9DCE /* Video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA27B38A1B498151008A9DCE /* Video.cpp */; }; - FA27B39F1B498151008A9DCE /* Video.h in Headers */ = {isa = PBXBuildFile; fileRef = FA27B38B1B498151008A9DCE /* Video.h */; }; - FA27B3A91B498151008A9DCE /* Video.h in Headers */ = {isa = PBXBuildFile; fileRef = FA27B3931B498151008A9DCE /* Video.h */; }; - FA27B3AA1B498151008A9DCE /* VideoStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA27B3941B498151008A9DCE /* VideoStream.cpp */; }; - FA27B3AB1B498151008A9DCE /* VideoStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA27B3941B498151008A9DCE /* VideoStream.cpp */; }; - FA27B3AC1B498151008A9DCE /* VideoStream.h in Headers */ = {isa = PBXBuildFile; fileRef = FA27B3951B498151008A9DCE /* VideoStream.h */; }; - FA27B3B31B498151008A9DCE /* wrap_Video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA27B39B1B498151008A9DCE /* wrap_Video.cpp */; }; - FA27B3B41B498151008A9DCE /* wrap_Video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA27B39B1B498151008A9DCE /* wrap_Video.cpp */; }; - FA27B3B51B498151008A9DCE /* wrap_Video.h in Headers */ = {isa = PBXBuildFile; fileRef = FA27B39C1B498151008A9DCE /* wrap_Video.h */; }; - FA27B3C01B4985BF008A9DCE /* wrap_VideoStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA27B3B91B4985BF008A9DCE /* wrap_VideoStream.cpp */; }; - FA27B3C11B4985BF008A9DCE /* wrap_VideoStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA27B3B91B4985BF008A9DCE /* wrap_VideoStream.cpp */; }; - FA27B3C21B4985BF008A9DCE /* wrap_VideoStream.h in Headers */ = {isa = PBXBuildFile; fileRef = FA27B3BA1B4985BF008A9DCE /* wrap_VideoStream.h */; }; - FA27B3C91B498623008A9DCE /* theora.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA27B3C81B498623008A9DCE /* theora.framework */; }; - FA28EBD51E352DB5003446F4 /* FenceSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA28EBD31E352DB5003446F4 /* FenceSync.cpp */; }; - FA28EBD61E352DB5003446F4 /* FenceSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA28EBD31E352DB5003446F4 /* FenceSync.cpp */; }; - FA28EBD71E352DB5003446F4 /* FenceSync.h in Headers */ = {isa = PBXBuildFile; fileRef = FA28EBD41E352DB5003446F4 /* FenceSync.h */; }; - FA29C0051E12355B00268CD8 /* StreamBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA29C0041E12355B00268CD8 /* StreamBuffer.cpp */; }; - FA29C0061E12355B00268CD8 /* StreamBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA29C0041E12355B00268CD8 /* StreamBuffer.cpp */; }; - FA2AF6741DAD64970032B62C /* vertex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA2AF6731DAD64970032B62C /* vertex.cpp */; }; - FA2AF6751DAD64970032B62C /* vertex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA2AF6731DAD64970032B62C /* vertex.cpp */; }; - FA317EBA18F28B6D00B0BCD7 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FA317EB918F28B6D00B0BCD7 /* libz.dylib */; }; - FA3C5E421F8C368C0003C579 /* ShaderStage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA3C5E401F8C368C0003C579 /* ShaderStage.cpp */; }; - FA3C5E431F8C368C0003C579 /* ShaderStage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA3C5E401F8C368C0003C579 /* ShaderStage.cpp */; }; - FA3C5E441F8C368C0003C579 /* ShaderStage.h in Headers */ = {isa = PBXBuildFile; fileRef = FA3C5E411F8C368C0003C579 /* ShaderStage.h */; }; - FA3C5E471F8D80CA0003C579 /* ShaderStage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA3C5E451F8D80CA0003C579 /* ShaderStage.cpp */; }; - FA3C5E481F8D80CA0003C579 /* ShaderStage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA3C5E451F8D80CA0003C579 /* ShaderStage.cpp */; }; - FA3C5E491F8D80CA0003C579 /* ShaderStage.h in Headers */ = {isa = PBXBuildFile; fileRef = FA3C5E461F8D80CA0003C579 /* ShaderStage.h */; }; - FA41A3C81C0A1F950084430C /* ASTCHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA41A3C61C0A1F950084430C /* ASTCHandler.cpp */; }; - FA41A3C91C0A1F950084430C /* ASTCHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA41A3C61C0A1F950084430C /* ASTCHandler.cpp */; }; - FA41A3CA1C0A1F950084430C /* ASTCHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FA41A3C71C0A1F950084430C /* ASTCHandler.h */; }; - FA4B66C91ABBCF1900558F15 /* Timer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA4B66C81ABBCF1900558F15 /* Timer.cpp */; }; - FA4B66CA1ABBCF1900558F15 /* Timer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA4B66C81ABBCF1900558F15 /* Timer.cpp */; }; - FA4F2B791DE0125B00CA37D7 /* xxhash.c in Sources */ = {isa = PBXBuildFile; fileRef = FA4F2B771DE0125B00CA37D7 /* xxhash.c */; }; - FA4F2B7A1DE0125B00CA37D7 /* xxhash.h in Headers */ = {isa = PBXBuildFile; fileRef = FA4F2B781DE0125B00CA37D7 /* xxhash.h */; }; - FA4F2B7B1DE0181B00CA37D7 /* xxhash.c in Sources */ = {isa = PBXBuildFile; fileRef = FA4F2B771DE0125B00CA37D7 /* xxhash.c */; }; - FA4F2BA61DE1E36400CA37D7 /* RecordingDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA4F2BA21DE1E36400CA37D7 /* RecordingDevice.cpp */; }; - FA4F2BA71DE1E36400CA37D7 /* RecordingDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = FA4F2BA31DE1E36400CA37D7 /* RecordingDevice.h */; }; - FA4F2BA81DE1E36400CA37D7 /* wrap_RecordingDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA4F2BA41DE1E36400CA37D7 /* wrap_RecordingDevice.cpp */; }; - FA4F2BA91DE1E36400CA37D7 /* wrap_RecordingDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = FA4F2BA51DE1E36400CA37D7 /* wrap_RecordingDevice.h */; }; - FA4F2BAC1DE1E37000CA37D7 /* RecordingDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA4F2BAA1DE1E37000CA37D7 /* RecordingDevice.cpp */; }; - FA4F2BAD1DE1E37000CA37D7 /* RecordingDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = FA4F2BAB1DE1E37000CA37D7 /* RecordingDevice.h */; }; - FA4F2BB01DE1E37B00CA37D7 /* RecordingDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA4F2BAE1DE1E37B00CA37D7 /* RecordingDevice.cpp */; }; - FA4F2BB11DE1E37B00CA37D7 /* RecordingDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = FA4F2BAF1DE1E37B00CA37D7 /* RecordingDevice.h */; }; - FA4F2BB21DE1E4B400CA37D7 /* RecordingDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA4F2BAE1DE1E37B00CA37D7 /* RecordingDevice.cpp */; }; - FA4F2BB31DE1E4B800CA37D7 /* RecordingDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA4F2BA21DE1E36400CA37D7 /* RecordingDevice.cpp */; }; - FA4F2BB41DE1E4BD00CA37D7 /* RecordingDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA4F2BAA1DE1E37000CA37D7 /* RecordingDevice.cpp */; }; - FA4F2BB51DE1E4C300CA37D7 /* wrap_RecordingDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA4F2BA41DE1E36400CA37D7 /* wrap_RecordingDevice.cpp */; }; - FA4F2BE31DE6650600CA37D7 /* Transform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA4F2BDF1DE6650600CA37D7 /* Transform.cpp */; }; - FA4F2BE41DE6650600CA37D7 /* Transform.h in Headers */ = {isa = PBXBuildFile; fileRef = FA4F2BE01DE6650600CA37D7 /* Transform.h */; }; - FA4F2BE51DE6650600CA37D7 /* wrap_Transform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA4F2BE11DE6650600CA37D7 /* wrap_Transform.cpp */; }; - FA4F2BE61DE6650600CA37D7 /* wrap_Transform.h in Headers */ = {isa = PBXBuildFile; fileRef = FA4F2BE21DE6650600CA37D7 /* wrap_Transform.h */; }; - FA4F2BE71DE6650D00CA37D7 /* Transform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA4F2BDF1DE6650600CA37D7 /* Transform.cpp */; }; - FA4F2BE81DE6651000CA37D7 /* wrap_Transform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA4F2BE11DE6650600CA37D7 /* wrap_Transform.cpp */; }; - FA4F2C031DE936C200CA37D7 /* auxiliar.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFB9D1D9F6D490055D849 /* auxiliar.c */; }; - FA4F2C041DE936C600CA37D7 /* buffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFB9F1D9F6D490055D849 /* buffer.c */; }; - FA4F2C051DE936C900CA37D7 /* compat.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBA11D9F6D490055D849 /* compat.c */; }; - FA4F2C061DE936CD00CA37D7 /* except.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBA31D9F6D490055D849 /* except.c */; }; - FA4F2C071DE936DA00CA37D7 /* inet.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBAB1D9F6D490055D849 /* inet.c */; }; - FA4F2C081DE936DD00CA37D7 /* io.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBAD1D9F6D490055D849 /* io.c */; }; - FA4F2C091DE936E200CA37D7 /* luasocket.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBB11D9F6D490055D849 /* luasocket.c */; }; - FA4F2C0A1DE936E600CA37D7 /* mime.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBB61D9F6D490055D849 /* mime.c */; }; - FA4F2C0B1DE936EA00CA37D7 /* options.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBBA1D9F6D490055D849 /* options.c */; }; - FA4F2C0C1DE936ED00CA37D7 /* select.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBBD1D9F6D490055D849 /* select.c */; }; - FA4F2C0D1DE936F100CA37D7 /* serial.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBBF1D9F6D490055D849 /* serial.c */; }; - FA4F2C0E1DE936FE00CA37D7 /* tcp.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBC51D9F6D490055D849 /* tcp.c */; }; - FA4F2C0F1DE936FE00CA37D7 /* timeout.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBC71D9F6D490055D849 /* timeout.c */; }; - FA4F2C101DE936FE00CA37D7 /* udp.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBCB1D9F6D490055D849 /* udp.c */; }; - FA4F2C111DE936FE00CA37D7 /* unix.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBCD1D9F6D490055D849 /* unix.c */; }; - FA4F2C121DE936FE00CA37D7 /* unixtcp.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBCF1D9F6D490055D849 /* unixtcp.c */; }; - FA4F2C131DE936FE00CA37D7 /* unixudp.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBD11D9F6D490055D849 /* unixudp.c */; }; - FA4F2C141DE936FE00CA37D7 /* usocket.c in Sources */ = {isa = PBXBuildFile; fileRef = 217DFBD51D9F6D490055D849 /* usocket.c */; }; - FA56AA381FAFF02000A43D5F /* memory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA56AA361FAFF02000A43D5F /* memory.cpp */; }; - FA56AA391FAFF02000A43D5F /* memory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA56AA361FAFF02000A43D5F /* memory.cpp */; }; - FA56AA3A1FAFF02000A43D5F /* memory.h in Headers */ = {isa = PBXBuildFile; fileRef = FA56AA371FAFF02000A43D5F /* memory.h */; }; - FA56D9BC1C208A0200D8D3C7 /* libmodplug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FA56D9BA1C2089EE00D8D3C7 /* libmodplug.a */; }; - FA577AB016C7507900860150 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA577A7916C71A1700860150 /* Cocoa.framework */; }; - FA577AC516C7513400860150 /* libmodplug.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA577A8216C71A5300860150 /* libmodplug.framework */; }; - FA577AC716C7513A00860150 /* mpg123.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA577A6F16C719F000860150 /* mpg123.framework */; }; - FA577AC816C7513C00860150 /* ogg.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA577A7116C719F400860150 /* ogg.framework */; }; - FA577ACA16C7514100860150 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA577A7C16C71A2600860150 /* OpenGL.framework */; }; - FA577ACD16C7514C00860150 /* vorbis.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA577A7716C71A0800860150 /* vorbis.framework */; }; - FA57FB981AE1993600F2AD6D /* noise1234.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA57FB961AE1993600F2AD6D /* noise1234.cpp */; }; - FA57FB991AE1993600F2AD6D /* noise1234.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA57FB961AE1993600F2AD6D /* noise1234.cpp */; }; - FA57FB9A1AE1993600F2AD6D /* noise1234.h in Headers */ = {isa = PBXBuildFile; fileRef = FA57FB971AE1993600F2AD6D /* noise1234.h */; }; - FA59A2D31C06481400328DBA /* ParticleSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAE272501C05A15B00A67640 /* ParticleSystem.cpp */; }; - FA59A2D81C0649C200328DBA /* libtheora.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FA59A2D61C0649BB00328DBA /* libtheora.a */; }; - FA5D24B31A96D2EC00C6FC8F /* libogg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FA5D24AB1A96D2EC00C6FC8F /* libogg.a */; }; - FA5D24B51A96D2EC00C6FC8F /* libvorbis.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FA5D24AF1A96D2EC00C6FC8F /* libvorbis.a */; }; - FA5D24CF1A96E68300C6FC8F /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FA5D24CD1A96E63D00C6FC8F /* libSDL2.a */; }; - FA620A321AA2F8DB005DB4C2 /* wrap_Quad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA620A2E1AA2F8DB005DB4C2 /* wrap_Quad.cpp */; }; - FA620A331AA2F8DB005DB4C2 /* wrap_Quad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA620A2E1AA2F8DB005DB4C2 /* wrap_Quad.cpp */; }; - FA620A341AA2F8DB005DB4C2 /* wrap_Quad.h in Headers */ = {isa = PBXBuildFile; fileRef = FA620A2F1AA2F8DB005DB4C2 /* wrap_Quad.h */; }; - FA620A351AA2F8DB005DB4C2 /* wrap_Texture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA620A301AA2F8DB005DB4C2 /* wrap_Texture.cpp */; }; - FA620A361AA2F8DB005DB4C2 /* wrap_Texture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA620A301AA2F8DB005DB4C2 /* wrap_Texture.cpp */; }; - FA620A371AA2F8DB005DB4C2 /* wrap_Texture.h in Headers */ = {isa = PBXBuildFile; fileRef = FA620A311AA2F8DB005DB4C2 /* wrap_Texture.h */; }; - FA620A3A1AA305F6005DB4C2 /* types.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA620A391AA305F6005DB4C2 /* types.cpp */; }; - FA620A3B1AA305F6005DB4C2 /* types.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA620A391AA305F6005DB4C2 /* types.cpp */; }; - FA6A2B661F5F7B6B0074C308 /* wrap_Data.h in Headers */ = {isa = PBXBuildFile; fileRef = FA6A2B641F5F7B6B0074C308 /* wrap_Data.h */; }; - FA6A2B671F5F7B6B0074C308 /* wrap_Data.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA6A2B651F5F7B6B0074C308 /* wrap_Data.cpp */; }; - FA6A2B6A1F5F7F560074C308 /* DataView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA6A2B681F5F7F560074C308 /* DataView.cpp */; }; - FA6A2B6B1F5F7F560074C308 /* DataView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA6A2B681F5F7F560074C308 /* DataView.cpp */; }; - FA6A2B6C1F5F7F560074C308 /* DataView.h in Headers */ = {isa = PBXBuildFile; fileRef = FA6A2B691F5F7F560074C308 /* DataView.h */; }; - FA6A2B6F1F5F845F0074C308 /* wrap_DataView.h in Headers */ = {isa = PBXBuildFile; fileRef = FA6A2B6D1F5F845F0074C308 /* wrap_DataView.h */; }; - FA6A2B701F5F845F0074C308 /* wrap_DataView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA6A2B6E1F5F845F0074C308 /* wrap_DataView.cpp */; }; - FA6A2B711F5F845F0074C308 /* wrap_DataView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA6A2B6E1F5F845F0074C308 /* wrap_DataView.cpp */; }; - FA6A2B741F60B6710074C308 /* ByteData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA6A2B721F60B6710074C308 /* ByteData.cpp */; }; - FA6A2B751F60B6710074C308 /* ByteData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA6A2B721F60B6710074C308 /* ByteData.cpp */; }; - FA6A2B761F60B6710074C308 /* ByteData.h in Headers */ = {isa = PBXBuildFile; fileRef = FA6A2B731F60B6710074C308 /* ByteData.h */; }; - FA6A2B791F60B8250074C308 /* wrap_ByteData.h in Headers */ = {isa = PBXBuildFile; fileRef = FA6A2B771F60B8250074C308 /* wrap_ByteData.h */; }; - FA6A2B7A1F60B8250074C308 /* wrap_ByteData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA6A2B781F60B8250074C308 /* wrap_ByteData.cpp */; }; - FA6A2B7B1F60B8250074C308 /* wrap_ByteData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA6A2B781F60B8250074C308 /* wrap_ByteData.cpp */; }; - FA6BDE5C1F31725300786805 /* Color.h in Headers */ = {isa = PBXBuildFile; fileRef = FA6BDE5B1F31725300786805 /* Color.h */; }; - FA7550A81AEBE276003E311E /* libluajit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FA7550A71AEBE276003E311E /* libluajit.a */; }; - FA76344A1E28722A0066EF9E /* StreamBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA7634481E28722A0066EF9E /* StreamBuffer.cpp */; }; - FA76344B1E28722A0066EF9E /* StreamBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA7634481E28722A0066EF9E /* StreamBuffer.cpp */; }; - FA76344C1E28722A0066EF9E /* StreamBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = FA7634491E28722A0066EF9E /* StreamBuffer.h */; }; - FA8951A21AA2EDF300EC385A /* wrap_Event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA8951A01AA2EDF300EC385A /* wrap_Event.cpp */; }; - FA8951A31AA2EDF300EC385A /* wrap_Event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA8951A01AA2EDF300EC385A /* wrap_Event.cpp */; }; - FA8951A41AA2EDF300EC385A /* wrap_Event.h in Headers */ = {isa = PBXBuildFile; fileRef = FA8951A11AA2EDF300EC385A /* wrap_Event.h */; }; - FA91591E1CF1ED7500A7053F /* halffloat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA91591C1CF1ED7500A7053F /* halffloat.cpp */; }; - FA91591F1CF1ED7500A7053F /* halffloat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA91591C1CF1ED7500A7053F /* halffloat.cpp */; }; - FA9159201CF1ED7500A7053F /* halffloat.h in Headers */ = {isa = PBXBuildFile; fileRef = FA91591D1CF1ED7500A7053F /* halffloat.h */; }; - FA91DA8B1F377C3900C80E33 /* deprecation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA91DA891F377C3900C80E33 /* deprecation.cpp */; }; - FA91DA8C1F377C3900C80E33 /* deprecation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA91DA891F377C3900C80E33 /* deprecation.cpp */; }; - FA91DA8D1F377C3900C80E33 /* deprecation.h in Headers */ = {isa = PBXBuildFile; fileRef = FA91DA8A1F377C3900C80E33 /* deprecation.h */; }; - FA93C4531F315B960087CCD4 /* FormatHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FA93C4501F315B960087CCD4 /* FormatHandler.h */; }; - FA93C4541F315B960087CCD4 /* FormatHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA93C4511F315B960087CCD4 /* FormatHandler.cpp */; }; - FA9B4A0816E1578300074F42 /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA9B4A0716E1578300074F42 /* SDL2.framework */; }; - FA9D53AC1F5307E900125C6B /* Deprecations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA9D53AA1F5307E900125C6B /* Deprecations.cpp */; }; - FA9D53AD1F5307E900125C6B /* Deprecations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA9D53AA1F5307E900125C6B /* Deprecations.cpp */; }; - FA9D53AE1F5307E900125C6B /* Deprecations.h in Headers */ = {isa = PBXBuildFile; fileRef = FA9D53AB1F5307E900125C6B /* Deprecations.h */; }; - FA9D8DD11DEB56C3002CD881 /* pixelformat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA9D8DCF1DEB56C3002CD881 /* pixelformat.cpp */; }; - FA9D8DD21DEB56C3002CD881 /* pixelformat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA9D8DCF1DEB56C3002CD881 /* pixelformat.cpp */; }; - FA9D8DD31DEB56C3002CD881 /* pixelformat.h in Headers */ = {isa = PBXBuildFile; fileRef = FA9D8DD01DEB56C3002CD881 /* pixelformat.h */; }; - FA9D8DD71DEF8411002CD881 /* Data.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA9D8DD41DEF8411002CD881 /* Data.cpp */; }; - FA9D8DD81DEF8411002CD881 /* Data.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA9D8DD41DEF8411002CD881 /* Data.cpp */; }; - FA9D8DD91DEF8411002CD881 /* Stream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA9D8DD51DEF8411002CD881 /* Stream.cpp */; }; - FA9D8DDA1DEF8411002CD881 /* Stream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA9D8DD51DEF8411002CD881 /* Stream.cpp */; }; - FA9D8DDB1DEF8411002CD881 /* Stream.h in Headers */ = {isa = PBXBuildFile; fileRef = FA9D8DD61DEF8411002CD881 /* Stream.h */; }; - FA9D8DDD1DEF842A002CD881 /* Drawable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA9D8DDC1DEF842A002CD881 /* Drawable.cpp */; }; - FA9D8DDE1DEF842A002CD881 /* Drawable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA9D8DDC1DEF842A002CD881 /* Drawable.cpp */; }; - FA9D8DE01DEF843D002CD881 /* Image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA9D8DDF1DEF843D002CD881 /* Image.cpp */; }; - FA9D8DE11DEF843D002CD881 /* Image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA9D8DDF1DEF843D002CD881 /* Image.cpp */; }; - FAA3A9AE1B7D465A00CED060 /* android.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAA3A9AC1B7D465A00CED060 /* android.cpp */; }; - FAA3A9AF1B7D465A00CED060 /* android.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAA3A9AC1B7D465A00CED060 /* android.cpp */; }; - FAA3A9B01B7D465A00CED060 /* android.h in Headers */ = {isa = PBXBuildFile; fileRef = FAA3A9AD1B7D465A00CED060 /* android.h */; }; - FAA54ACA1F91660400A8FA7B /* OggDemuxer.h in Headers */ = {isa = PBXBuildFile; fileRef = FAA54AC61F91660400A8FA7B /* OggDemuxer.h */; }; - FAA54ACB1F91660400A8FA7B /* TheoraVideoStream.h in Headers */ = {isa = PBXBuildFile; fileRef = FAA54AC71F91660400A8FA7B /* TheoraVideoStream.h */; }; - FAA54ACC1F91660400A8FA7B /* TheoraVideoStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAA54AC81F91660400A8FA7B /* TheoraVideoStream.cpp */; }; - FAA54ACD1F91660400A8FA7B /* OggDemuxer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAA54AC91F91660400A8FA7B /* OggDemuxer.cpp */; }; - FAA627CE18E7E1560080752D /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAA627CD18E7E1560080752D /* CoreServices.framework */; }; - FAAA3FD81F64B3AD00F89E99 /* lprefix.h in Headers */ = {isa = PBXBuildFile; fileRef = FAAA3FD31F64B3AD00F89E99 /* lprefix.h */; }; - FAAA3FD91F64B3AD00F89E99 /* lstrlib.c in Sources */ = {isa = PBXBuildFile; fileRef = FAAA3FD41F64B3AD00F89E99 /* lstrlib.c */; }; - FAAA3FDA1F64B3AD00F89E99 /* lstrlib.h in Headers */ = {isa = PBXBuildFile; fileRef = FAAA3FD51F64B3AD00F89E99 /* lstrlib.h */; }; - FAAA3FDB1F64B3AD00F89E99 /* lutf8lib.c in Sources */ = {isa = PBXBuildFile; fileRef = FAAA3FD61F64B3AD00F89E99 /* lutf8lib.c */; }; - FAAA3FDC1F64B3AD00F89E99 /* lutf8lib.h in Headers */ = {isa = PBXBuildFile; fileRef = FAAA3FD71F64B3AD00F89E99 /* lutf8lib.h */; }; - FAAFF04416CB11C700CCDE45 /* OpenAL-Soft.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAAFF04316CB11C700CCDE45 /* OpenAL-Soft.framework */; }; - FAB17BE61ABFAA9000F9BA27 /* lz4.c in Sources */ = {isa = PBXBuildFile; fileRef = FAB17BE41ABFAA9000F9BA27 /* lz4.c */; }; - FAB17BE71ABFAA9000F9BA27 /* lz4.c in Sources */ = {isa = PBXBuildFile; fileRef = FAB17BE41ABFAA9000F9BA27 /* lz4.c */; }; - FAB17BE81ABFAA9000F9BA27 /* lz4.h in Headers */ = {isa = PBXBuildFile; fileRef = FAB17BE51ABFAA9000F9BA27 /* lz4.h */; }; - FAB17BF51ABFC4B100F9BA27 /* lz4hc.c in Sources */ = {isa = PBXBuildFile; fileRef = FAB17BF31ABFC4B100F9BA27 /* lz4hc.c */; }; - FAB17BF61ABFC4B100F9BA27 /* lz4hc.c in Sources */ = {isa = PBXBuildFile; fileRef = FAB17BF31ABFC4B100F9BA27 /* lz4hc.c */; }; - FAB17BF71ABFC4B100F9BA27 /* lz4hc.h in Headers */ = {isa = PBXBuildFile; fileRef = FAB17BF41ABFC4B100F9BA27 /* lz4hc.h */; }; - FAB2D5AA1AABDD8A008224A4 /* TrueTypeRasterizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAB2D5A81AABDD8A008224A4 /* TrueTypeRasterizer.cpp */; }; - FAB2D5AB1AABDD8A008224A4 /* TrueTypeRasterizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAB2D5A81AABDD8A008224A4 /* TrueTypeRasterizer.cpp */; }; - FAB2D5AC1AABDD8A008224A4 /* TrueTypeRasterizer.h in Headers */ = {isa = PBXBuildFile; fileRef = FAB2D5A91AABDD8A008224A4 /* TrueTypeRasterizer.h */; }; - FAC756F51E4F99B400B91289 /* Effect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAC756F31E4F99B400B91289 /* Effect.cpp */; }; - FAC756F61E4F99B400B91289 /* Effect.h in Headers */ = {isa = PBXBuildFile; fileRef = FAC756F41E4F99B400B91289 /* Effect.h */; }; - FAC756F71E4F99BC00B91289 /* Effect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAC756F31E4F99B400B91289 /* Effect.cpp */; }; - FAC756FA1E4F99D200B91289 /* Effect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAC756F81E4F99D200B91289 /* Effect.cpp */; }; - FAC756FB1E4F99D200B91289 /* Effect.h in Headers */ = {isa = PBXBuildFile; fileRef = FAC756F91E4F99D200B91289 /* Effect.h */; }; - FAC756FC1E4F99DB00B91289 /* Effect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAC756F81E4F99D200B91289 /* Effect.cpp */; }; - FAC7CD771FE35E95006A60C7 /* physfs_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = FAC7CD5A1FE35E95006A60C7 /* physfs_internal.h */; }; - FAC7CD781FE35E95006A60C7 /* physfs_platform_qnx.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD5B1FE35E95006A60C7 /* physfs_platform_qnx.c */; }; - FAC7CD791FE35E95006A60C7 /* physfs.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD5C1FE35E95006A60C7 /* physfs.c */; }; - FAC7CD7A1FE35E95006A60C7 /* physfs_archiver_7z.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD5D1FE35E95006A60C7 /* physfs_archiver_7z.c */; }; - FAC7CD7B1FE35E95006A60C7 /* physfs_platform_unix.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD5E1FE35E95006A60C7 /* physfs_platform_unix.c */; }; - FAC7CD7C1FE35E95006A60C7 /* physfs_archiver_slb.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD5F1FE35E95006A60C7 /* physfs_archiver_slb.c */; }; - FAC7CD7D1FE35E95006A60C7 /* physfs_platform_winrt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD601FE35E95006A60C7 /* physfs_platform_winrt.cpp */; }; - FAC7CD7E1FE35E95006A60C7 /* physfs_archiver_mvl.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD611FE35E95006A60C7 /* physfs_archiver_mvl.c */; }; - FAC7CD7F1FE35E95006A60C7 /* physfs_archiver_wad.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD621FE35E95006A60C7 /* physfs_archiver_wad.c */; }; - FAC7CD801FE35E95006A60C7 /* physfs_casefolding.h in Headers */ = {isa = PBXBuildFile; fileRef = FAC7CD631FE35E95006A60C7 /* physfs_casefolding.h */; }; - FAC7CD811FE35E95006A60C7 /* physfs_platform_os2.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD641FE35E95006A60C7 /* physfs_platform_os2.c */; }; - FAC7CD821FE35E95006A60C7 /* physfs_platform_haiku.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD651FE35E95006A60C7 /* physfs_platform_haiku.cpp */; }; - FAC7CD831FE35E95006A60C7 /* physfs_platform_windows.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD661FE35E95006A60C7 /* physfs_platform_windows.c */; }; - FAC7CD841FE35E95006A60C7 /* physfs_archiver_unpacked.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD671FE35E95006A60C7 /* physfs_archiver_unpacked.c */; }; - FAC7CD851FE35E95006A60C7 /* physfs_unicode.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD681FE35E95006A60C7 /* physfs_unicode.c */; }; - FAC7CD861FE35E95006A60C7 /* physfs.h in Headers */ = {isa = PBXBuildFile; fileRef = FAC7CD691FE35E95006A60C7 /* physfs.h */; }; - FAC7CD871FE35E95006A60C7 /* physfs_archiver_vdf.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD6A1FE35E95006A60C7 /* physfs_archiver_vdf.c */; }; - FAC7CD881FE35E95006A60C7 /* physfs_platform_apple.m in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD6B1FE35E95006A60C7 /* physfs_platform_apple.m */; }; - FAC7CD891FE35E95006A60C7 /* physfs_archiver_dir.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD6C1FE35E95006A60C7 /* physfs_archiver_dir.c */; }; - FAC7CD8A1FE35E95006A60C7 /* physfs_byteorder.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD6D1FE35E95006A60C7 /* physfs_byteorder.c */; }; - FAC7CD8B1FE35E95006A60C7 /* physfs_archiver_iso9660.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD6E1FE35E95006A60C7 /* physfs_archiver_iso9660.c */; }; - FAC7CD8C1FE35E95006A60C7 /* physfs_archiver_qpak.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD6F1FE35E95006A60C7 /* physfs_archiver_qpak.c */; }; - FAC7CD8D1FE35E95006A60C7 /* physfs_platforms.h in Headers */ = {isa = PBXBuildFile; fileRef = FAC7CD701FE35E95006A60C7 /* physfs_platforms.h */; }; - FAC7CD8E1FE35E95006A60C7 /* physfs_lzmasdk.h in Headers */ = {isa = PBXBuildFile; fileRef = FAC7CD711FE35E95006A60C7 /* physfs_lzmasdk.h */; }; - FAC7CD8F1FE35E95006A60C7 /* physfs_platform_posix.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD721FE35E95006A60C7 /* physfs_platform_posix.c */; }; - FAC7CD901FE35E95006A60C7 /* physfs_miniz.h in Headers */ = {isa = PBXBuildFile; fileRef = FAC7CD731FE35E95006A60C7 /* physfs_miniz.h */; }; - FAC7CD911FE35E95006A60C7 /* physfs_archiver_grp.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD741FE35E95006A60C7 /* physfs_archiver_grp.c */; }; - FAC7CD921FE35E95006A60C7 /* physfs_archiver_hog.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD751FE35E95006A60C7 /* physfs_archiver_hog.c */; }; - FAC7CD931FE35E95006A60C7 /* physfs_archiver_zip.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD761FE35E95006A60C7 /* physfs_archiver_zip.c */; }; - FAC7CD961FE755B4006A60C7 /* lz4opt.h in Headers */ = {isa = PBXBuildFile; fileRef = FAC7CD951FE755B3006A60C7 /* lz4opt.h */; }; - FACA02EC1F5E396B0084B28F /* CompressedData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FACA02E01F5E396B0084B28F /* CompressedData.cpp */; }; - FACA02ED1F5E396B0084B28F /* CompressedData.h in Headers */ = {isa = PBXBuildFile; fileRef = FACA02E11F5E396B0084B28F /* CompressedData.h */; }; - FACA02EE1F5E396B0084B28F /* Compressor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FACA02E21F5E396B0084B28F /* Compressor.cpp */; }; - FACA02EF1F5E396B0084B28F /* Compressor.h in Headers */ = {isa = PBXBuildFile; fileRef = FACA02E31F5E396B0084B28F /* Compressor.h */; }; - FACA02F01F5E396B0084B28F /* DataModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FACA02E41F5E396B0084B28F /* DataModule.cpp */; }; - FACA02F11F5E396B0084B28F /* DataModule.h in Headers */ = {isa = PBXBuildFile; fileRef = FACA02E51F5E396B0084B28F /* DataModule.h */; }; - FACA02F21F5E396B0084B28F /* HashFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FACA02E61F5E396B0084B28F /* HashFunction.cpp */; }; - FACA02F31F5E396B0084B28F /* HashFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = FACA02E71F5E396B0084B28F /* HashFunction.h */; }; - FACA02F41F5E396B0084B28F /* wrap_CompressedData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FACA02E81F5E396B0084B28F /* wrap_CompressedData.cpp */; }; - FACA02F51F5E396B0084B28F /* wrap_CompressedData.h in Headers */ = {isa = PBXBuildFile; fileRef = FACA02E91F5E396B0084B28F /* wrap_CompressedData.h */; }; - FACA02F61F5E396B0084B28F /* wrap_DataModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FACA02EA1F5E396B0084B28F /* wrap_DataModule.cpp */; }; - FACA02F71F5E396B0084B28F /* wrap_DataModule.h in Headers */ = {isa = PBXBuildFile; fileRef = FACA02EB1F5E396B0084B28F /* wrap_DataModule.h */; }; - FACA02F81F5E39760084B28F /* CompressedData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FACA02E01F5E396B0084B28F /* CompressedData.cpp */; }; - FACA02F91F5E39790084B28F /* Compressor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FACA02E21F5E396B0084B28F /* Compressor.cpp */; }; - FACA02FA1F5E397B0084B28F /* DataModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FACA02E41F5E396B0084B28F /* DataModule.cpp */; }; - FACA02FB1F5E397E0084B28F /* HashFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FACA02E61F5E396B0084B28F /* HashFunction.cpp */; }; - FACA02FC1F5E39810084B28F /* wrap_CompressedData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FACA02E81F5E396B0084B28F /* wrap_CompressedData.cpp */; }; - FACA02FD1F5E39840084B28F /* wrap_DataModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FACA02EA1F5E396B0084B28F /* wrap_DataModule.cpp */; }; - FAD19A171DFF8CA200D5398A /* ImageDataBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAD19A151DFF8CA200D5398A /* ImageDataBase.cpp */; }; - FAD19A181DFF8CA200D5398A /* ImageDataBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAD19A151DFF8CA200D5398A /* ImageDataBase.cpp */; }; - FAD19A191DFF8CA200D5398A /* ImageDataBase.h in Headers */ = {isa = PBXBuildFile; fileRef = FAD19A161DFF8CA200D5398A /* ImageDataBase.h */; }; - FAD43ECC1FF312D800831BB8 /* freetype.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAD43ECB1FF312D800831BB8 /* freetype.framework */; }; - FADF53F81E3C7ACD00012CC0 /* Buffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF53F61E3C7ACD00012CC0 /* Buffer.cpp */; }; - FADF53F91E3C7ACD00012CC0 /* Buffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF53F61E3C7ACD00012CC0 /* Buffer.cpp */; }; - FADF53FA1E3C7ACD00012CC0 /* Buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = FADF53F71E3C7ACD00012CC0 /* Buffer.h */; }; - FADF53FD1E3D74F200012CC0 /* Text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF53FB1E3D74F200012CC0 /* Text.cpp */; }; - FADF53FE1E3D74F200012CC0 /* Text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF53FB1E3D74F200012CC0 /* Text.cpp */; }; - FADF53FF1E3D74F200012CC0 /* Text.h in Headers */ = {isa = PBXBuildFile; fileRef = FADF53FC1E3D74F200012CC0 /* Text.h */; }; - FADF54021E3D77B500012CC0 /* wrap_Text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF54001E3D77B500012CC0 /* wrap_Text.cpp */; }; - FADF54031E3D77B500012CC0 /* wrap_Text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF54001E3D77B500012CC0 /* wrap_Text.cpp */; }; - FADF54041E3D77B500012CC0 /* wrap_Text.h in Headers */ = {isa = PBXBuildFile; fileRef = FADF54011E3D77B500012CC0 /* wrap_Text.h */; }; - FADF54071E3D78F700012CC0 /* Video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF54051E3D78F700012CC0 /* Video.cpp */; }; - FADF54081E3D78F700012CC0 /* Video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF54051E3D78F700012CC0 /* Video.cpp */; }; - FADF54091E3D78F700012CC0 /* Video.h in Headers */ = {isa = PBXBuildFile; fileRef = FADF54061E3D78F700012CC0 /* Video.h */; }; - FADF540D1E3D7CDD00012CC0 /* wrap_Video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF540A1E3D7CDD00012CC0 /* wrap_Video.cpp */; }; - FADF540E1E3D7CDD00012CC0 /* wrap_Video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF540A1E3D7CDD00012CC0 /* wrap_Video.cpp */; }; - FADF540F1E3D7CDD00012CC0 /* wrap_Video.h in Headers */ = {isa = PBXBuildFile; fileRef = FADF540B1E3D7CDD00012CC0 /* wrap_Video.h */; }; - FADF54101E3D7CDD00012CC0 /* wrap_Video.lua in Resources */ = {isa = PBXBuildFile; fileRef = FADF540C1E3D7CDD00012CC0 /* wrap_Video.lua */; }; - FADF54161E3DA08E00012CC0 /* Image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF54141E3DA08E00012CC0 /* Image.cpp */; }; - FADF54171E3DA08E00012CC0 /* Image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF54141E3DA08E00012CC0 /* Image.cpp */; }; - FADF54181E3DA08E00012CC0 /* Image.h in Headers */ = {isa = PBXBuildFile; fileRef = FADF54151E3DA08E00012CC0 /* Image.h */; }; - FADF541B1E3DA46C00012CC0 /* wrap_Image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF54191E3DA46C00012CC0 /* wrap_Image.cpp */; }; - FADF541C1E3DA46C00012CC0 /* wrap_Image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF54191E3DA46C00012CC0 /* wrap_Image.cpp */; }; - FADF541D1E3DA46C00012CC0 /* wrap_Image.h in Headers */ = {isa = PBXBuildFile; fileRef = FADF541A1E3DA46C00012CC0 /* wrap_Image.h */; }; - FADF54201E3DA52C00012CC0 /* wrap_ParticleSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF541E1E3DA52C00012CC0 /* wrap_ParticleSystem.cpp */; }; - FADF54211E3DA52C00012CC0 /* wrap_ParticleSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF541E1E3DA52C00012CC0 /* wrap_ParticleSystem.cpp */; }; - FADF54221E3DA52C00012CC0 /* wrap_ParticleSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = FADF541F1E3DA52C00012CC0 /* wrap_ParticleSystem.h */; }; - FADF54251E3DA5BA00012CC0 /* Mesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF54231E3DA5BA00012CC0 /* Mesh.cpp */; }; - FADF54261E3DA5BA00012CC0 /* Mesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF54231E3DA5BA00012CC0 /* Mesh.cpp */; }; - FADF54271E3DA5BA00012CC0 /* Mesh.h in Headers */ = {isa = PBXBuildFile; fileRef = FADF54241E3DA5BA00012CC0 /* Mesh.h */; }; - FADF542A1E3DAADA00012CC0 /* wrap_Mesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF54281E3DAADA00012CC0 /* wrap_Mesh.cpp */; }; - FADF542B1E3DAADA00012CC0 /* wrap_Mesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF54281E3DAADA00012CC0 /* wrap_Mesh.cpp */; }; - FADF542C1E3DAADA00012CC0 /* wrap_Mesh.h in Headers */ = {isa = PBXBuildFile; fileRef = FADF54291E3DAADA00012CC0 /* wrap_Mesh.h */; }; - FADF542F1E3DABF600012CC0 /* SpriteBatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF542D1E3DABF600012CC0 /* SpriteBatch.cpp */; }; - FADF54301E3DABF600012CC0 /* SpriteBatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF542D1E3DABF600012CC0 /* SpriteBatch.cpp */; }; - FADF54311E3DABF600012CC0 /* SpriteBatch.h in Headers */ = {isa = PBXBuildFile; fileRef = FADF542E1E3DABF600012CC0 /* SpriteBatch.h */; }; - FADF54341E3DAE6E00012CC0 /* wrap_SpriteBatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF54321E3DAE6E00012CC0 /* wrap_SpriteBatch.cpp */; }; - FADF54351E3DAE6E00012CC0 /* wrap_SpriteBatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF54321E3DAE6E00012CC0 /* wrap_SpriteBatch.cpp */; }; - FADF54361E3DAE6E00012CC0 /* wrap_SpriteBatch.h in Headers */ = {isa = PBXBuildFile; fileRef = FADF54331E3DAE6E00012CC0 /* wrap_SpriteBatch.h */; }; - FADF54381E3DAFBA00012CC0 /* wrap_Graphics.lua in Resources */ = {isa = PBXBuildFile; fileRef = FADF54371E3DAFBA00012CC0 /* wrap_Graphics.lua */; }; - FADF543B1E3DAFF700012CC0 /* wrap_Graphics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF54391E3DAFF700012CC0 /* wrap_Graphics.cpp */; }; - FADF543C1E3DAFF700012CC0 /* wrap_Graphics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADF54391E3DAFF700012CC0 /* wrap_Graphics.cpp */; }; - FADF543D1E3DAFF700012CC0 /* wrap_Graphics.h in Headers */ = {isa = PBXBuildFile; fileRef = FADF543A1E3DAFF700012CC0 /* wrap_Graphics.h */; }; - FAE272521C05A15B00A67640 /* ParticleSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAE272501C05A15B00A67640 /* ParticleSystem.cpp */; }; - FAE272531C05A15B00A67640 /* ParticleSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = FAE272511C05A15B00A67640 /* ParticleSystem.h */; }; - FAE64A7F207135AD00BC7981 /* libfreetype.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE64A7D2071359C00BC7981 /* libfreetype.a */; }; - FAE64A802071362A00BC7981 /* physfs_archiver_7z.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD5D1FE35E95006A60C7 /* physfs_archiver_7z.c */; }; - FAE64A812071363100BC7981 /* physfs_archiver_dir.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD6C1FE35E95006A60C7 /* physfs_archiver_dir.c */; }; - FAE64A822071363100BC7981 /* physfs_archiver_grp.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD741FE35E95006A60C7 /* physfs_archiver_grp.c */; }; - FAE64A832071363100BC7981 /* physfs_archiver_hog.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD751FE35E95006A60C7 /* physfs_archiver_hog.c */; }; - FAE64A842071363100BC7981 /* physfs_archiver_iso9660.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD6E1FE35E95006A60C7 /* physfs_archiver_iso9660.c */; }; - FAE64A852071363100BC7981 /* physfs_archiver_mvl.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD611FE35E95006A60C7 /* physfs_archiver_mvl.c */; }; - FAE64A862071363100BC7981 /* physfs_archiver_qpak.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD6F1FE35E95006A60C7 /* physfs_archiver_qpak.c */; }; - FAE64A872071363100BC7981 /* physfs_archiver_slb.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD5F1FE35E95006A60C7 /* physfs_archiver_slb.c */; }; - FAE64A882071363100BC7981 /* physfs_archiver_unpacked.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD671FE35E95006A60C7 /* physfs_archiver_unpacked.c */; }; - FAE64A892071363100BC7981 /* physfs_archiver_vdf.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD6A1FE35E95006A60C7 /* physfs_archiver_vdf.c */; }; - FAE64A8A2071363100BC7981 /* physfs_archiver_wad.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD621FE35E95006A60C7 /* physfs_archiver_wad.c */; }; - FAE64A8B2071363100BC7981 /* physfs_archiver_zip.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD761FE35E95006A60C7 /* physfs_archiver_zip.c */; }; - FAE64A8C2071363100BC7981 /* physfs_byteorder.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD6D1FE35E95006A60C7 /* physfs_byteorder.c */; }; - FAE64A8D2071363500BC7981 /* physfs_platform_apple.m in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD6B1FE35E95006A60C7 /* physfs_platform_apple.m */; }; - FAE64A8E2071363A00BC7981 /* physfs_platform_posix.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD721FE35E95006A60C7 /* physfs_platform_posix.c */; }; - FAE64A8F2071364200BC7981 /* physfs_platform_unix.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD5E1FE35E95006A60C7 /* physfs_platform_unix.c */; }; - FAE64A902071364800BC7981 /* physfs_unicode.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD681FE35E95006A60C7 /* physfs_unicode.c */; }; - FAE64A912071364800BC7981 /* physfs.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD5C1FE35E95006A60C7 /* physfs.c */; }; - FAE64A922071364B00BC7981 /* physfs_platform_winrt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD601FE35E95006A60C7 /* physfs_platform_winrt.cpp */; }; - FAE64A932071365100BC7981 /* physfs_platform_haiku.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD651FE35E95006A60C7 /* physfs_platform_haiku.cpp */; }; - FAE64A942071365100BC7981 /* physfs_platform_os2.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD641FE35E95006A60C7 /* physfs_platform_os2.c */; }; - FAE64A952071365100BC7981 /* physfs_platform_qnx.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD5B1FE35E95006A60C7 /* physfs_platform_qnx.c */; }; - FAE64A962071365100BC7981 /* physfs_platform_windows.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD661FE35E95006A60C7 /* physfs_platform_windows.c */; }; - FAECA1B21F3164700095D008 /* CompressedSlice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAECA1B01F3164700095D008 /* CompressedSlice.cpp */; }; - FAECA1B31F3164700095D008 /* CompressedSlice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAECA1B01F3164700095D008 /* CompressedSlice.cpp */; }; - FAECA1B41F3164700095D008 /* CompressedSlice.h in Headers */ = {isa = PBXBuildFile; fileRef = FAECA1B11F3164700095D008 /* CompressedSlice.h */; }; - FAECA1B51F31648A0095D008 /* FormatHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA93C4511F315B960087CCD4 /* FormatHandler.cpp */; }; - FAF140531E20934C00F898D2 /* CodeGen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FC21E20934C00F898D2 /* CodeGen.cpp */; }; - FAF140541E20934C00F898D2 /* CodeGen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FC21E20934C00F898D2 /* CodeGen.cpp */; }; - FAF140551E20934C00F898D2 /* Link.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FC31E20934C00F898D2 /* Link.cpp */; }; - FAF140561E20934C00F898D2 /* Link.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FC31E20934C00F898D2 /* Link.cpp */; }; - FAF140571E20934C00F898D2 /* arrays.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FC51E20934C00F898D2 /* arrays.h */; }; - FAF140581E20934C00F898D2 /* BaseTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FC61E20934C00F898D2 /* BaseTypes.h */; }; - FAF140591E20934C00F898D2 /* Common.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FC71E20934C00F898D2 /* Common.h */; }; - FAF1405A1E20934C00F898D2 /* ConstantUnion.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FC81E20934C00F898D2 /* ConstantUnion.h */; }; - FAF1405B1E20934C00F898D2 /* InfoSink.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FC91E20934C00F898D2 /* InfoSink.h */; }; - FAF1405C1E20934C00F898D2 /* InitializeGlobals.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FCA1E20934C00F898D2 /* InitializeGlobals.h */; }; - FAF1405D1E20934C00F898D2 /* intermediate.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FCB1E20934C00F898D2 /* intermediate.h */; }; - FAF1405E1E20934C00F898D2 /* PoolAlloc.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FCC1E20934C00F898D2 /* PoolAlloc.h */; }; - FAF1405F1E20934C00F898D2 /* ResourceLimits.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FCD1E20934C00F898D2 /* ResourceLimits.h */; }; - FAF140601E20934C00F898D2 /* revision.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FCE1E20934C00F898D2 /* revision.h */; }; - FAF140621E20934C00F898D2 /* ShHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FD01E20934C00F898D2 /* ShHandle.h */; }; - FAF140631E20934C00F898D2 /* Types.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FD11E20934C00F898D2 /* Types.h */; }; - FAF140641E20934C00F898D2 /* Constant.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FD31E20934C00F898D2 /* Constant.cpp */; }; - FAF140651E20934C00F898D2 /* Constant.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FD31E20934C00F898D2 /* Constant.cpp */; }; - FAF140661E20934C00F898D2 /* gl_types.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FD41E20934C00F898D2 /* gl_types.h */; }; - FAF140691E20934C00F898D2 /* glslang_tab.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FD61E20934C00F898D2 /* glslang_tab.cpp */; }; - FAF1406A1E20934C00F898D2 /* glslang_tab.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FD61E20934C00F898D2 /* glslang_tab.cpp */; }; - FAF1406B1E20934C00F898D2 /* glslang_tab.cpp.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FD71E20934C00F898D2 /* glslang_tab.cpp.h */; }; - FAF1406C1E20934C00F898D2 /* InfoSink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FD81E20934C00F898D2 /* InfoSink.cpp */; }; - FAF1406D1E20934C00F898D2 /* InfoSink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FD81E20934C00F898D2 /* InfoSink.cpp */; }; - FAF1406E1E20934C00F898D2 /* Initialize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FD91E20934C00F898D2 /* Initialize.cpp */; }; - FAF1406F1E20934C00F898D2 /* Initialize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FD91E20934C00F898D2 /* Initialize.cpp */; }; - FAF140701E20934C00F898D2 /* Initialize.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FDA1E20934C00F898D2 /* Initialize.h */; }; - FAF140711E20934C00F898D2 /* Intermediate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FDB1E20934C00F898D2 /* Intermediate.cpp */; }; - FAF140721E20934C00F898D2 /* Intermediate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FDB1E20934C00F898D2 /* Intermediate.cpp */; }; - FAF140731E20934C00F898D2 /* intermOut.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FDC1E20934C00F898D2 /* intermOut.cpp */; }; - FAF140741E20934C00F898D2 /* intermOut.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FDC1E20934C00F898D2 /* intermOut.cpp */; }; - FAF140751E20934C00F898D2 /* IntermTraverse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FDD1E20934C00F898D2 /* IntermTraverse.cpp */; }; - FAF140761E20934C00F898D2 /* IntermTraverse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FDD1E20934C00F898D2 /* IntermTraverse.cpp */; }; - FAF140771E20934C00F898D2 /* iomapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FDE1E20934C00F898D2 /* iomapper.cpp */; }; - FAF140781E20934C00F898D2 /* iomapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FDE1E20934C00F898D2 /* iomapper.cpp */; }; - FAF140791E20934C00F898D2 /* iomapper.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FDF1E20934C00F898D2 /* iomapper.h */; }; - FAF1407A1E20934C00F898D2 /* limits.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FE01E20934C00F898D2 /* limits.cpp */; }; - FAF1407B1E20934C00F898D2 /* limits.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FE01E20934C00F898D2 /* limits.cpp */; }; - FAF1407C1E20934C00F898D2 /* linkValidate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FE11E20934C00F898D2 /* linkValidate.cpp */; }; - FAF1407D1E20934C00F898D2 /* linkValidate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FE11E20934C00F898D2 /* linkValidate.cpp */; }; - FAF1407E1E20934C00F898D2 /* LiveTraverser.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FE21E20934C00F898D2 /* LiveTraverser.h */; }; - FAF1407F1E20934C00F898D2 /* localintermediate.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FE31E20934C00F898D2 /* localintermediate.h */; }; - FAF140801E20934C00F898D2 /* parseConst.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FE41E20934C00F898D2 /* parseConst.cpp */; }; - FAF140811E20934C00F898D2 /* parseConst.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FE41E20934C00F898D2 /* parseConst.cpp */; }; - FAF140821E20934C00F898D2 /* ParseContextBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FE51E20934C00F898D2 /* ParseContextBase.cpp */; }; - FAF140831E20934C00F898D2 /* ParseContextBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FE51E20934C00F898D2 /* ParseContextBase.cpp */; }; - FAF140841E20934C00F898D2 /* ParseHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FE61E20934C00F898D2 /* ParseHelper.cpp */; }; - FAF140851E20934C00F898D2 /* ParseHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FE61E20934C00F898D2 /* ParseHelper.cpp */; }; - FAF140861E20934C00F898D2 /* ParseHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FE71E20934C00F898D2 /* ParseHelper.h */; }; - FAF140871E20934C00F898D2 /* parseVersions.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FE81E20934C00F898D2 /* parseVersions.h */; }; - FAF140881E20934C00F898D2 /* PoolAlloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FE91E20934C00F898D2 /* PoolAlloc.cpp */; }; - FAF140891E20934C00F898D2 /* PoolAlloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FE91E20934C00F898D2 /* PoolAlloc.cpp */; }; - FAF1408A1E20934C00F898D2 /* Pp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FEB1E20934C00F898D2 /* Pp.cpp */; }; - FAF1408B1E20934C00F898D2 /* Pp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FEB1E20934C00F898D2 /* Pp.cpp */; }; - FAF1408C1E20934C00F898D2 /* PpAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FEC1E20934C00F898D2 /* PpAtom.cpp */; }; - FAF1408D1E20934C00F898D2 /* PpAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FEC1E20934C00F898D2 /* PpAtom.cpp */; }; - FAF1408E1E20934C00F898D2 /* PpContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FED1E20934C00F898D2 /* PpContext.cpp */; }; - FAF1408F1E20934C00F898D2 /* PpContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FED1E20934C00F898D2 /* PpContext.cpp */; }; - FAF140901E20934C00F898D2 /* PpContext.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FEE1E20934C00F898D2 /* PpContext.h */; }; - FAF140931E20934C00F898D2 /* PpScanner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FF01E20934C00F898D2 /* PpScanner.cpp */; }; - FAF140941E20934C00F898D2 /* PpScanner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FF01E20934C00F898D2 /* PpScanner.cpp */; }; - FAF140971E20934C00F898D2 /* PpTokens.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FF21E20934C00F898D2 /* PpTokens.cpp */; }; - FAF140981E20934C00F898D2 /* PpTokens.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FF21E20934C00F898D2 /* PpTokens.cpp */; }; - FAF140991E20934C00F898D2 /* PpTokens.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FF31E20934C00F898D2 /* PpTokens.h */; }; - FAF1409A1E20934C00F898D2 /* propagateNoContraction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FF41E20934C00F898D2 /* propagateNoContraction.cpp */; }; - FAF1409B1E20934C00F898D2 /* propagateNoContraction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FF41E20934C00F898D2 /* propagateNoContraction.cpp */; }; - FAF1409C1E20934C00F898D2 /* propagateNoContraction.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FF51E20934C00F898D2 /* propagateNoContraction.h */; }; - FAF1409D1E20934C00F898D2 /* reflection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FF61E20934C00F898D2 /* reflection.cpp */; }; - FAF1409E1E20934C00F898D2 /* reflection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FF61E20934C00F898D2 /* reflection.cpp */; }; - FAF1409F1E20934C00F898D2 /* reflection.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FF71E20934C00F898D2 /* reflection.h */; }; - FAF140A01E20934C00F898D2 /* RemoveTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FF81E20934C00F898D2 /* RemoveTree.cpp */; }; - FAF140A11E20934C00F898D2 /* RemoveTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FF81E20934C00F898D2 /* RemoveTree.cpp */; }; - FAF140A21E20934C00F898D2 /* RemoveTree.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FF91E20934C00F898D2 /* RemoveTree.h */; }; - FAF140A31E20934C00F898D2 /* Scan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FFA1E20934C00F898D2 /* Scan.cpp */; }; - FAF140A41E20934C00F898D2 /* Scan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FFA1E20934C00F898D2 /* Scan.cpp */; }; - FAF140A51E20934C00F898D2 /* Scan.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FFB1E20934C00F898D2 /* Scan.h */; }; - FAF140A61E20934C00F898D2 /* ScanContext.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FFC1E20934C00F898D2 /* ScanContext.h */; }; - FAF140A71E20934C00F898D2 /* ShaderLang.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FFD1E20934C00F898D2 /* ShaderLang.cpp */; }; - FAF140A81E20934C00F898D2 /* ShaderLang.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FFD1E20934C00F898D2 /* ShaderLang.cpp */; }; - FAF140A91E20934C00F898D2 /* SymbolTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FFE1E20934C00F898D2 /* SymbolTable.cpp */; }; - FAF140AA1E20934C00F898D2 /* SymbolTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FFE1E20934C00F898D2 /* SymbolTable.cpp */; }; - FAF140AB1E20934C00F898D2 /* SymbolTable.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF13FFF1E20934C00F898D2 /* SymbolTable.h */; }; - FAF140AC1E20934C00F898D2 /* Versions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF140001E20934C00F898D2 /* Versions.cpp */; }; - FAF140AD1E20934C00F898D2 /* Versions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF140001E20934C00F898D2 /* Versions.cpp */; }; - FAF140AE1E20934C00F898D2 /* Versions.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF140011E20934C00F898D2 /* Versions.h */; }; - FAF140AF1E20934C00F898D2 /* osinclude.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF140031E20934C00F898D2 /* osinclude.h */; }; - FAF140BB1E20934C00F898D2 /* ossource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF140211E20934C00F898D2 /* ossource.cpp */; }; - FAF140BC1E20934C00F898D2 /* ossource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF140211E20934C00F898D2 /* ossource.cpp */; }; - FAF140C41E20934C00F898D2 /* ShaderLang.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF140291E20934C00F898D2 /* ShaderLang.h */; }; - FAF140DB1E20934C00F898D2 /* InitializeDll.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF1403B1E20934C00F898D2 /* InitializeDll.cpp */; }; - FAF140DC1E20934C00F898D2 /* InitializeDll.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF1403B1E20934C00F898D2 /* InitializeDll.cpp */; }; - FAF140DD1E20934C00F898D2 /* InitializeDll.h in Headers */ = {isa = PBXBuildFile; fileRef = FAF1403C1E20934C00F898D2 /* InitializeDll.h */; }; - FAF1889F1E9DBC4B008C1479 /* depthstencil.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF1889E1E9DBC4B008C1479 /* depthstencil.cpp */; }; - FAF188A01E9DBC4B008C1479 /* depthstencil.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF1889E1E9DBC4B008C1479 /* depthstencil.cpp */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - FA0B78DB1A958B90000E1D17 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "include/$(PRODUCT_NAME)"; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 217DFB9D1D9F6D490055D849 /* auxiliar.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = auxiliar.c; sourceTree = ""; }; - 217DFB9E1D9F6D490055D849 /* auxiliar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = auxiliar.h; sourceTree = ""; }; - 217DFB9F1D9F6D490055D849 /* buffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = buffer.c; sourceTree = ""; }; - 217DFBA01D9F6D490055D849 /* buffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = buffer.h; sourceTree = ""; }; - 217DFBA11D9F6D490055D849 /* compat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = compat.c; sourceTree = ""; }; - 217DFBA21D9F6D490055D849 /* compat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compat.h; sourceTree = ""; }; - 217DFBA31D9F6D490055D849 /* except.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = except.c; sourceTree = ""; }; - 217DFBA41D9F6D490055D849 /* except.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = except.h; sourceTree = ""; }; - 217DFBA51D9F6D490055D849 /* ftp.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ftp.lua; sourceTree = ""; }; - 217DFBA61D9F6D490055D849 /* ftp.lua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftp.lua.h; sourceTree = ""; }; - 217DFBA71D9F6D490055D849 /* headers.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = headers.lua; sourceTree = ""; }; - 217DFBA81D9F6D490055D849 /* headers.lua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = headers.lua.h; sourceTree = ""; }; - 217DFBA91D9F6D490055D849 /* http.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = http.lua; sourceTree = ""; }; - 217DFBAA1D9F6D490055D849 /* http.lua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = http.lua.h; sourceTree = ""; }; - 217DFBAB1D9F6D490055D849 /* inet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = inet.c; sourceTree = ""; }; - 217DFBAC1D9F6D490055D849 /* inet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = inet.h; sourceTree = ""; }; - 217DFBAD1D9F6D490055D849 /* io.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = io.c; sourceTree = ""; }; - 217DFBAE1D9F6D490055D849 /* io.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = io.h; sourceTree = ""; }; - 217DFBAF1D9F6D490055D849 /* ltn12.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ltn12.lua; sourceTree = ""; }; - 217DFBB01D9F6D490055D849 /* ltn12.lua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ltn12.lua.h; sourceTree = ""; }; - 217DFBB11D9F6D490055D849 /* luasocket.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = luasocket.c; sourceTree = ""; }; - 217DFBB21D9F6D490055D849 /* luasocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = luasocket.h; sourceTree = ""; }; - 217DFBB41D9F6D490055D849 /* mbox.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mbox.lua; sourceTree = ""; }; - 217DFBB51D9F6D490055D849 /* mbox.lua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mbox.lua.h; sourceTree = ""; }; - 217DFBB61D9F6D490055D849 /* mime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mime.c; sourceTree = ""; }; - 217DFBB71D9F6D490055D849 /* mime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mime.h; sourceTree = ""; }; - 217DFBB81D9F6D490055D849 /* mime.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mime.lua; sourceTree = ""; }; - 217DFBB91D9F6D490055D849 /* mime.lua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mime.lua.h; sourceTree = ""; }; - 217DFBBA1D9F6D490055D849 /* options.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = options.c; sourceTree = ""; }; - 217DFBBB1D9F6D490055D849 /* options.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = options.h; sourceTree = ""; }; - 217DFBBC1D9F6D490055D849 /* pierror.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pierror.h; sourceTree = ""; }; - 217DFBBD1D9F6D490055D849 /* select.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = select.c; sourceTree = ""; }; - 217DFBBE1D9F6D490055D849 /* select.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = select.h; sourceTree = ""; }; - 217DFBBF1D9F6D490055D849 /* serial.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = serial.c; sourceTree = ""; }; - 217DFBC01D9F6D490055D849 /* smtp.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = smtp.lua; sourceTree = ""; }; - 217DFBC11D9F6D490055D849 /* smtp.lua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = smtp.lua.h; sourceTree = ""; }; - 217DFBC21D9F6D490055D849 /* socket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = socket.h; sourceTree = ""; }; - 217DFBC31D9F6D490055D849 /* socket.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = socket.lua; sourceTree = ""; }; - 217DFBC41D9F6D490055D849 /* socket.lua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = socket.lua.h; sourceTree = ""; }; - 217DFBC51D9F6D490055D849 /* tcp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tcp.c; sourceTree = ""; }; - 217DFBC61D9F6D490055D849 /* tcp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tcp.h; sourceTree = ""; }; - 217DFBC71D9F6D490055D849 /* timeout.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = timeout.c; sourceTree = ""; }; - 217DFBC81D9F6D490055D849 /* timeout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = timeout.h; sourceTree = ""; }; - 217DFBC91D9F6D490055D849 /* tp.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tp.lua; sourceTree = ""; }; - 217DFBCA1D9F6D490055D849 /* tp.lua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tp.lua.h; sourceTree = ""; }; - 217DFBCB1D9F6D490055D849 /* udp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = udp.c; sourceTree = ""; }; - 217DFBCC1D9F6D490055D849 /* udp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = udp.h; sourceTree = ""; }; - 217DFBCD1D9F6D490055D849 /* unix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = unix.c; sourceTree = ""; }; - 217DFBCE1D9F6D490055D849 /* unix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unix.h; sourceTree = ""; }; - 217DFBCF1D9F6D490055D849 /* unixtcp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = unixtcp.c; sourceTree = ""; }; - 217DFBD01D9F6D490055D849 /* unixtcp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unixtcp.h; sourceTree = ""; }; - 217DFBD11D9F6D490055D849 /* unixudp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = unixudp.c; sourceTree = ""; }; - 217DFBD21D9F6D490055D849 /* unixudp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unixudp.h; sourceTree = ""; }; - 217DFBD31D9F6D490055D849 /* url.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = url.lua; sourceTree = ""; }; - 217DFBD41D9F6D490055D849 /* url.lua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = url.lua.h; sourceTree = ""; }; - 217DFBD51D9F6D490055D849 /* usocket.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = usocket.c; sourceTree = ""; }; - 217DFBD61D9F6D490055D849 /* usocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = usocket.h; sourceTree = ""; }; - 503971A86B7167A91B670FBA /* boot.lua.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = boot.lua.h; sourceTree = ""; }; - FA08F5AE16C7525600F007B5 /* liblove-macosx.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "liblove-macosx.plist"; path = "macosx/liblove-macosx.plist"; sourceTree = ""; }; - FA0B78DD1A958B90000E1D17 /* liblove.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = liblove.a; sourceTree = BUILT_PRODUCTS_DIR; }; - FA0B78F71A958E3B000E1D17 /* b64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = b64.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; - FA0B78F81A958E3B000E1D17 /* b64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = b64.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - FA0B78F91A958E3B000E1D17 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = ""; }; - FA0B78FA1A958E3B000E1D17 /* Data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Data.h; sourceTree = ""; }; - FA0B78FB1A958E3B000E1D17 /* delay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = delay.cpp; sourceTree = ""; }; - FA0B78FC1A958E3B000E1D17 /* delay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = delay.h; sourceTree = ""; }; - FA0B78FD1A958E3B000E1D17 /* EnumMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EnumMap.h; sourceTree = ""; }; - FA0B78FE1A958E3B000E1D17 /* Exception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Exception.cpp; sourceTree = ""; }; - FA0B78FF1A958E3B000E1D17 /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Exception.h; sourceTree = ""; }; - FA0B79001A958E3B000E1D17 /* int.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = int.h; sourceTree = ""; }; - FA0B79011A958E3B000E1D17 /* math.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = math.h; sourceTree = ""; }; - FA0B79021A958E3B000E1D17 /* Matrix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Matrix.cpp; sourceTree = ""; }; - FA0B79031A958E3B000E1D17 /* Matrix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Matrix.h; sourceTree = ""; }; - FA0B79041A958E3B000E1D17 /* Memoizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Memoizer.cpp; sourceTree = ""; }; - FA0B79051A958E3B000E1D17 /* Memoizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Memoizer.h; sourceTree = ""; }; - FA0B79061A958E3B000E1D17 /* Module.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Module.cpp; sourceTree = ""; }; - FA0B79071A958E3B000E1D17 /* Module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Module.h; sourceTree = ""; }; - FA0B79081A958E3B000E1D17 /* Object.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Object.cpp; sourceTree = ""; }; - FA0B79091A958E3B000E1D17 /* Object.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Object.h; sourceTree = ""; }; - FA0B790A1A958E3B000E1D17 /* macosx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = macosx.h; sourceTree = ""; }; - FA0B790B1A958E3B000E1D17 /* macosx.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = macosx.mm; sourceTree = ""; }; - FA0B790C1A958E3B000E1D17 /* Reference.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Reference.cpp; sourceTree = ""; }; - FA0B790D1A958E3B000E1D17 /* Reference.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Reference.h; sourceTree = ""; }; - FA0B790E1A958E3B000E1D17 /* runtime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = runtime.cpp; sourceTree = ""; }; - FA0B790F1A958E3B000E1D17 /* runtime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = runtime.h; sourceTree = ""; }; - FA0B79101A958E3B000E1D17 /* StringMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringMap.h; sourceTree = ""; }; - FA0B79111A958E3B000E1D17 /* types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = types.h; sourceTree = ""; }; - FA0B79121A958E3B000E1D17 /* utf8.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = utf8.cpp; sourceTree = ""; }; - FA0B79131A958E3B000E1D17 /* utf8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utf8.h; sourceTree = ""; }; - FA0B79141A958E3B000E1D17 /* Variant.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Variant.cpp; sourceTree = ""; }; - FA0B79151A958E3B000E1D17 /* Variant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Variant.h; sourceTree = ""; }; - FA0B79161A958E3B000E1D17 /* Vector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Vector.cpp; sourceTree = ""; }; - FA0B79171A958E3B000E1D17 /* Vector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Vector.h; sourceTree = ""; }; - FA0B79181A958E3B000E1D17 /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = ""; }; - FA0B794F1A958EA3000E1D17 /* Box2D.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Box2D.h; sourceTree = ""; }; - FA0B79511A958EA3000E1D17 /* b2BroadPhase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2BroadPhase.cpp; sourceTree = ""; }; - FA0B79521A958EA3000E1D17 /* b2BroadPhase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2BroadPhase.h; sourceTree = ""; }; - FA0B79531A958EA3000E1D17 /* b2CollideCircle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2CollideCircle.cpp; sourceTree = ""; }; - FA0B79541A958EA3000E1D17 /* b2CollideEdge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2CollideEdge.cpp; sourceTree = ""; }; - FA0B79551A958EA3000E1D17 /* b2CollidePolygon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2CollidePolygon.cpp; sourceTree = ""; }; - FA0B79561A958EA3000E1D17 /* b2Collision.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2Collision.cpp; sourceTree = ""; }; - FA0B79571A958EA3000E1D17 /* b2Collision.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2Collision.h; sourceTree = ""; }; - FA0B79581A958EA3000E1D17 /* b2Distance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2Distance.cpp; sourceTree = ""; }; - FA0B79591A958EA3000E1D17 /* b2Distance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2Distance.h; sourceTree = ""; }; - FA0B795A1A958EA3000E1D17 /* b2DynamicTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2DynamicTree.cpp; sourceTree = ""; }; - FA0B795B1A958EA3000E1D17 /* b2DynamicTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2DynamicTree.h; sourceTree = ""; }; - FA0B795C1A958EA3000E1D17 /* b2TimeOfImpact.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2TimeOfImpact.cpp; sourceTree = ""; }; - FA0B795D1A958EA3000E1D17 /* b2TimeOfImpact.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2TimeOfImpact.h; sourceTree = ""; }; - FA0B795F1A958EA3000E1D17 /* b2ChainShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2ChainShape.cpp; sourceTree = ""; }; - FA0B79601A958EA3000E1D17 /* b2ChainShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2ChainShape.h; sourceTree = ""; }; - FA0B79611A958EA3000E1D17 /* b2CircleShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2CircleShape.cpp; sourceTree = ""; }; - FA0B79621A958EA3000E1D17 /* b2CircleShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2CircleShape.h; sourceTree = ""; }; - FA0B79631A958EA3000E1D17 /* b2EdgeShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2EdgeShape.cpp; sourceTree = ""; }; - FA0B79641A958EA3000E1D17 /* b2EdgeShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2EdgeShape.h; sourceTree = ""; }; - FA0B79651A958EA3000E1D17 /* b2PolygonShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2PolygonShape.cpp; sourceTree = ""; }; - FA0B79661A958EA3000E1D17 /* b2PolygonShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2PolygonShape.h; sourceTree = ""; }; - FA0B79671A958EA3000E1D17 /* b2Shape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2Shape.h; sourceTree = ""; }; - FA0B79691A958EA3000E1D17 /* b2BlockAllocator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2BlockAllocator.cpp; sourceTree = ""; }; - FA0B796A1A958EA3000E1D17 /* b2BlockAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2BlockAllocator.h; sourceTree = ""; }; - FA0B796B1A958EA3000E1D17 /* b2Draw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2Draw.cpp; sourceTree = ""; }; - FA0B796C1A958EA3000E1D17 /* b2Draw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2Draw.h; sourceTree = ""; }; - FA0B796D1A958EA3000E1D17 /* b2GrowableStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2GrowableStack.h; sourceTree = ""; }; - FA0B796E1A958EA3000E1D17 /* b2Math.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2Math.cpp; sourceTree = ""; }; - FA0B796F1A958EA3000E1D17 /* b2Math.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2Math.h; sourceTree = ""; }; - FA0B79701A958EA3000E1D17 /* b2Settings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2Settings.cpp; sourceTree = ""; }; - FA0B79711A958EA3000E1D17 /* b2Settings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2Settings.h; sourceTree = ""; }; - FA0B79721A958EA3000E1D17 /* b2StackAllocator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2StackAllocator.cpp; sourceTree = ""; }; - FA0B79731A958EA3000E1D17 /* b2StackAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2StackAllocator.h; sourceTree = ""; }; - FA0B79741A958EA3000E1D17 /* b2Timer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2Timer.cpp; sourceTree = ""; }; - FA0B79751A958EA3000E1D17 /* b2Timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2Timer.h; sourceTree = ""; }; - FA0B79771A958EA3000E1D17 /* b2Body.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2Body.cpp; sourceTree = ""; }; - FA0B79781A958EA3000E1D17 /* b2Body.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2Body.h; sourceTree = ""; }; - FA0B79791A958EA3000E1D17 /* b2ContactManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2ContactManager.cpp; sourceTree = ""; }; - FA0B797A1A958EA3000E1D17 /* b2ContactManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2ContactManager.h; sourceTree = ""; }; - FA0B797B1A958EA3000E1D17 /* b2Fixture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2Fixture.cpp; sourceTree = ""; }; - FA0B797C1A958EA3000E1D17 /* b2Fixture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2Fixture.h; sourceTree = ""; }; - FA0B797D1A958EA3000E1D17 /* b2Island.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2Island.cpp; sourceTree = ""; }; - FA0B797E1A958EA3000E1D17 /* b2Island.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2Island.h; sourceTree = ""; }; - FA0B797F1A958EA3000E1D17 /* b2TimeStep.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2TimeStep.h; sourceTree = ""; }; - FA0B79801A958EA3000E1D17 /* b2World.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2World.cpp; sourceTree = ""; }; - FA0B79811A958EA3000E1D17 /* b2World.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2World.h; sourceTree = ""; }; - FA0B79821A958EA3000E1D17 /* b2WorldCallbacks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2WorldCallbacks.cpp; sourceTree = ""; }; - FA0B79831A958EA3000E1D17 /* b2WorldCallbacks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2WorldCallbacks.h; sourceTree = ""; }; - FA0B79851A958EA3000E1D17 /* b2ChainAndCircleContact.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2ChainAndCircleContact.cpp; sourceTree = ""; }; - FA0B79861A958EA3000E1D17 /* b2ChainAndCircleContact.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2ChainAndCircleContact.h; sourceTree = ""; }; - FA0B79871A958EA3000E1D17 /* b2ChainAndPolygonContact.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2ChainAndPolygonContact.cpp; sourceTree = ""; }; - FA0B79881A958EA3000E1D17 /* b2ChainAndPolygonContact.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2ChainAndPolygonContact.h; sourceTree = ""; }; - FA0B79891A958EA3000E1D17 /* b2CircleContact.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2CircleContact.cpp; sourceTree = ""; }; - FA0B798A1A958EA3000E1D17 /* b2CircleContact.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2CircleContact.h; sourceTree = ""; }; - FA0B798B1A958EA3000E1D17 /* b2Contact.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2Contact.cpp; sourceTree = ""; }; - FA0B798C1A958EA3000E1D17 /* b2Contact.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2Contact.h; sourceTree = ""; }; - FA0B798D1A958EA3000E1D17 /* b2ContactSolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2ContactSolver.cpp; sourceTree = ""; }; - FA0B798E1A958EA3000E1D17 /* b2ContactSolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2ContactSolver.h; sourceTree = ""; }; - FA0B798F1A958EA3000E1D17 /* b2EdgeAndCircleContact.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2EdgeAndCircleContact.cpp; sourceTree = ""; }; - FA0B79901A958EA3000E1D17 /* b2EdgeAndCircleContact.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2EdgeAndCircleContact.h; sourceTree = ""; }; - FA0B79911A958EA3000E1D17 /* b2EdgeAndPolygonContact.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2EdgeAndPolygonContact.cpp; sourceTree = ""; }; - FA0B79921A958EA3000E1D17 /* b2EdgeAndPolygonContact.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2EdgeAndPolygonContact.h; sourceTree = ""; }; - FA0B79931A958EA3000E1D17 /* b2PolygonAndCircleContact.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2PolygonAndCircleContact.cpp; sourceTree = ""; }; - FA0B79941A958EA3000E1D17 /* b2PolygonAndCircleContact.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2PolygonAndCircleContact.h; sourceTree = ""; }; - FA0B79951A958EA3000E1D17 /* b2PolygonContact.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2PolygonContact.cpp; sourceTree = ""; }; - FA0B79961A958EA3000E1D17 /* b2PolygonContact.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2PolygonContact.h; sourceTree = ""; }; - FA0B79981A958EA3000E1D17 /* b2DistanceJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2DistanceJoint.cpp; sourceTree = ""; }; - FA0B79991A958EA3000E1D17 /* b2DistanceJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2DistanceJoint.h; sourceTree = ""; }; - FA0B799A1A958EA3000E1D17 /* b2FrictionJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2FrictionJoint.cpp; sourceTree = ""; }; - FA0B799B1A958EA3000E1D17 /* b2FrictionJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2FrictionJoint.h; sourceTree = ""; }; - FA0B799C1A958EA3000E1D17 /* b2GearJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2GearJoint.cpp; sourceTree = ""; }; - FA0B799D1A958EA3000E1D17 /* b2GearJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2GearJoint.h; sourceTree = ""; }; - FA0B799E1A958EA3000E1D17 /* b2Joint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2Joint.cpp; sourceTree = ""; }; - FA0B799F1A958EA3000E1D17 /* b2Joint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2Joint.h; sourceTree = ""; }; - FA0B79A01A958EA3000E1D17 /* b2MotorJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2MotorJoint.cpp; sourceTree = ""; }; - FA0B79A11A958EA3000E1D17 /* b2MotorJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2MotorJoint.h; sourceTree = ""; }; - FA0B79A21A958EA3000E1D17 /* b2MouseJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2MouseJoint.cpp; sourceTree = ""; }; - FA0B79A31A958EA3000E1D17 /* b2MouseJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2MouseJoint.h; sourceTree = ""; }; - FA0B79A41A958EA3000E1D17 /* b2PrismaticJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2PrismaticJoint.cpp; sourceTree = ""; }; - FA0B79A51A958EA3000E1D17 /* b2PrismaticJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2PrismaticJoint.h; sourceTree = ""; }; - FA0B79A61A958EA3000E1D17 /* b2PulleyJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2PulleyJoint.cpp; sourceTree = ""; }; - FA0B79A71A958EA3000E1D17 /* b2PulleyJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2PulleyJoint.h; sourceTree = ""; }; - FA0B79A81A958EA3000E1D17 /* b2RevoluteJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2RevoluteJoint.cpp; sourceTree = ""; }; - FA0B79A91A958EA3000E1D17 /* b2RevoluteJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2RevoluteJoint.h; sourceTree = ""; }; - FA0B79AA1A958EA3000E1D17 /* b2RopeJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2RopeJoint.cpp; sourceTree = ""; }; - FA0B79AB1A958EA3000E1D17 /* b2RopeJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2RopeJoint.h; sourceTree = ""; }; - FA0B79AC1A958EA3000E1D17 /* b2WeldJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2WeldJoint.cpp; sourceTree = ""; }; - FA0B79AD1A958EA3000E1D17 /* b2WeldJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2WeldJoint.h; sourceTree = ""; }; - FA0B79AE1A958EA3000E1D17 /* b2WheelJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2WheelJoint.cpp; sourceTree = ""; }; - FA0B79AF1A958EA3000E1D17 /* b2WheelJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2WheelJoint.h; sourceTree = ""; }; - FA0B79B21A958EA3000E1D17 /* b2Rope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2Rope.cpp; sourceTree = ""; }; - FA0B79B31A958EA3000E1D17 /* b2Rope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2Rope.h; sourceTree = ""; }; - FA0B79B51A958EA3000E1D17 /* ddsinfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ddsinfo.h; sourceTree = ""; }; - FA0B79B61A958EA3000E1D17 /* ddsparse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ddsparse.cpp; sourceTree = ""; }; - FA0B79B71A958EA3000E1D17 /* ddsparse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ddsparse.h; sourceTree = ""; }; - FA0B79B91A958EA3000E1D17 /* enet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = enet.cpp; sourceTree = ""; }; - FA0B79BB1A958EA3000E1D17 /* callbacks.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = callbacks.c; sourceTree = ""; }; - FA0B79BD1A958EA3000E1D17 /* compress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = compress.c; sourceTree = ""; }; - FA0B79BE1A958EA3000E1D17 /* host.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = host.c; sourceTree = ""; }; - FA0B79C11A958EA3000E1D17 /* callbacks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = callbacks.h; sourceTree = ""; }; - FA0B79C21A958EA3000E1D17 /* enet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = enet.h; sourceTree = ""; }; - FA0B79C31A958EA3000E1D17 /* list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = list.h; sourceTree = ""; }; - FA0B79C41A958EA3000E1D17 /* protocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = protocol.h; sourceTree = ""; }; - FA0B79C51A958EA3000E1D17 /* time.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = time.h; sourceTree = ""; }; - FA0B79C61A958EA3000E1D17 /* types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = types.h; sourceTree = ""; }; - FA0B79C71A958EA3000E1D17 /* unix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unix.h; sourceTree = ""; }; - FA0B79C81A958EA3000E1D17 /* utility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utility.h; sourceTree = ""; }; - FA0B79C91A958EA3000E1D17 /* win32.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = win32.h; sourceTree = ""; }; - FA0B79CB1A958EA3000E1D17 /* list.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = list.c; sourceTree = ""; }; - FA0B79CC1A958EA3000E1D17 /* packet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = packet.c; sourceTree = ""; }; - FA0B79CD1A958EA3000E1D17 /* peer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = peer.c; sourceTree = ""; }; - FA0B79CE1A958EA3000E1D17 /* protocol.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = protocol.c; sourceTree = ""; }; - FA0B79D01A958EA3000E1D17 /* unix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = unix.c; sourceTree = ""; }; - FA0B79D11A958EA3000E1D17 /* win32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = win32.c; sourceTree = ""; }; - FA0B79D21A958EA3000E1D17 /* lua-enet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "lua-enet.h"; sourceTree = ""; }; - FA0B79D41A958EA3000E1D17 /* glad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glad.cpp; sourceTree = ""; }; - FA0B79D61A958EA3000E1D17 /* glad.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = glad.hpp; sourceTree = ""; }; - FA0B79D71A958EA3000E1D17 /* gladfuncs.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = gladfuncs.hpp; sourceTree = ""; }; - FA0B79D91A958EA3000E1D17 /* lodepng.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lodepng.cpp; sourceTree = ""; }; - FA0B79DA1A958EA3000E1D17 /* lodepng.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lodepng.h; sourceTree = ""; }; - FA0B7A0E1A958EA3000E1D17 /* luasocket.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = luasocket.cpp; sourceTree = ""; }; - FA0B7A0F1A958EA3000E1D17 /* luasocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = luasocket.h; sourceTree = ""; }; - FA0B7A151A958EA3000E1D17 /* simplexnoise1234.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = simplexnoise1234.cpp; sourceTree = ""; }; - FA0B7A161A958EA3000E1D17 /* simplexnoise1234.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = simplexnoise1234.h; sourceTree = ""; }; - FA0B7A181A958EA3000E1D17 /* stb_image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stb_image.h; sourceTree = ""; }; - FA0B7A1B1A958EA3000E1D17 /* checked.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = checked.h; sourceTree = ""; }; - FA0B7A1C1A958EA3000E1D17 /* core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = core.h; sourceTree = ""; }; - FA0B7A1D1A958EA3000E1D17 /* unchecked.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unchecked.h; sourceTree = ""; }; - FA0B7A1E1A958EA3000E1D17 /* utf8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utf8.h; sourceTree = ""; }; - FA0B7A201A958EA3000E1D17 /* wuff.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = wuff.c; sourceTree = ""; }; - FA0B7A211A958EA3000E1D17 /* wuff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wuff.h; sourceTree = ""; }; - FA0B7A221A958EA3000E1D17 /* wuff_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wuff_config.h; sourceTree = ""; }; - FA0B7A231A958EA3000E1D17 /* wuff_convert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = wuff_convert.c; sourceTree = ""; }; - FA0B7A241A958EA3000E1D17 /* wuff_convert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wuff_convert.h; sourceTree = ""; }; - FA0B7A251A958EA3000E1D17 /* wuff_internal.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = wuff_internal.c; sourceTree = ""; }; - FA0B7A261A958EA3000E1D17 /* wuff_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wuff_internal.h; sourceTree = ""; }; - FA0B7A271A958EA3000E1D17 /* wuff_memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = wuff_memory.c; sourceTree = ""; }; - FA0B7B3E1A95902C000E1D17 /* Audio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = Audio.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; - FA0B7B3F1A95902C000E1D17 /* Audio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = Audio.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - FA0B7B411A95902C000E1D17 /* Audio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = Audio.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; - FA0B7B421A95902C000E1D17 /* Audio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = Audio.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - FA0B7B431A95902C000E1D17 /* Source.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Source.cpp; sourceTree = ""; }; - FA0B7B441A95902C000E1D17 /* Source.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Source.h; sourceTree = ""; }; - FA0B7B461A95902C000E1D17 /* Audio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = Audio.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; - FA0B7B471A95902C000E1D17 /* Audio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = Audio.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - FA0B7B481A95902C000E1D17 /* Pool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Pool.cpp; sourceTree = ""; }; - FA0B7B491A95902C000E1D17 /* Pool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pool.h; sourceTree = ""; }; - FA0B7B4A1A95902C000E1D17 /* Source.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Source.cpp; sourceTree = ""; }; - FA0B7B4B1A95902C000E1D17 /* Source.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Source.h; sourceTree = ""; }; - FA0B7B4C1A95902C000E1D17 /* Source.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Source.cpp; sourceTree = ""; }; - FA0B7B4D1A95902C000E1D17 /* Source.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Source.h; sourceTree = ""; }; - FA0B7B4E1A95902C000E1D17 /* wrap_Audio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Audio.cpp; sourceTree = ""; }; - FA0B7B4F1A95902C000E1D17 /* wrap_Audio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Audio.h; sourceTree = ""; }; - FA0B7B501A95902C000E1D17 /* wrap_Source.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Source.cpp; sourceTree = ""; }; - FA0B7B511A95902C000E1D17 /* wrap_Source.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Source.h; sourceTree = ""; }; - FA0B7B531A95902C000E1D17 /* Event.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Event.cpp; sourceTree = ""; }; - FA0B7B541A95902C000E1D17 /* Event.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Event.h; sourceTree = ""; }; - FA0B7B561A95902C000E1D17 /* Event.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Event.cpp; sourceTree = ""; }; - FA0B7B571A95902C000E1D17 /* Event.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Event.h; sourceTree = ""; }; - FA0B7B5B1A95902C000E1D17 /* DroppedFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DroppedFile.cpp; sourceTree = ""; }; - FA0B7B5C1A95902C000E1D17 /* DroppedFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DroppedFile.h; sourceTree = ""; }; - FA0B7B5D1A95902C000E1D17 /* File.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = File.cpp; sourceTree = ""; }; - FA0B7B5E1A95902C000E1D17 /* File.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = File.h; sourceTree = ""; }; - FA0B7B5F1A95902C000E1D17 /* FileData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileData.cpp; sourceTree = ""; }; - FA0B7B601A95902C000E1D17 /* FileData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileData.h; sourceTree = ""; }; - FA0B7B611A95902C000E1D17 /* Filesystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Filesystem.cpp; sourceTree = ""; }; - FA0B7B621A95902C000E1D17 /* Filesystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Filesystem.h; sourceTree = ""; }; - FA0B7B641A95902C000E1D17 /* File.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = File.cpp; sourceTree = ""; }; - FA0B7B651A95902C000E1D17 /* File.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = File.h; sourceTree = ""; }; - FA0B7B661A95902C000E1D17 /* Filesystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Filesystem.cpp; sourceTree = ""; }; - FA0B7B671A95902C000E1D17 /* Filesystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Filesystem.h; sourceTree = ""; }; - FA0B7B681A95902C000E1D17 /* wrap_DroppedFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_DroppedFile.cpp; sourceTree = ""; }; - FA0B7B691A95902C000E1D17 /* wrap_DroppedFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_DroppedFile.h; sourceTree = ""; }; - FA0B7B6A1A95902C000E1D17 /* wrap_File.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_File.cpp; sourceTree = ""; }; - FA0B7B6B1A95902C000E1D17 /* wrap_File.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_File.h; sourceTree = ""; }; - FA0B7B6C1A95902C000E1D17 /* wrap_FileData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_FileData.cpp; sourceTree = ""; }; - FA0B7B6D1A95902C000E1D17 /* wrap_FileData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_FileData.h; sourceTree = ""; }; - FA0B7B6E1A95902C000E1D17 /* wrap_Filesystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Filesystem.cpp; sourceTree = ""; }; - FA0B7B6F1A95902C000E1D17 /* wrap_Filesystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Filesystem.h; sourceTree = ""; }; - FA0B7B711A95902C000E1D17 /* BMFontRasterizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = BMFontRasterizer.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; - FA0B7B721A95902C000E1D17 /* BMFontRasterizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BMFontRasterizer.h; sourceTree = ""; }; - FA0B7B731A95902C000E1D17 /* Font.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Font.cpp; sourceTree = ""; }; - FA0B7B741A95902C000E1D17 /* Font.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Font.h; sourceTree = ""; }; - FA0B7B761A95902C000E1D17 /* Font.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Font.cpp; sourceTree = ""; }; - FA0B7B771A95902C000E1D17 /* Font.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Font.h; sourceTree = ""; }; - FA0B7B781A95902C000E1D17 /* TrueTypeRasterizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TrueTypeRasterizer.cpp; sourceTree = ""; }; - FA0B7B791A95902C000E1D17 /* TrueTypeRasterizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TrueTypeRasterizer.h; sourceTree = ""; }; - FA0B7B7A1A95902C000E1D17 /* GlyphData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GlyphData.cpp; sourceTree = ""; }; - FA0B7B7B1A95902C000E1D17 /* GlyphData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GlyphData.h; sourceTree = ""; }; - FA0B7B7C1A95902C000E1D17 /* ImageRasterizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageRasterizer.cpp; sourceTree = ""; }; - FA0B7B7D1A95902C000E1D17 /* ImageRasterizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageRasterizer.h; sourceTree = ""; }; - FA0B7B7E1A95902C000E1D17 /* Rasterizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Rasterizer.cpp; sourceTree = ""; }; - FA0B7B7F1A95902C000E1D17 /* Rasterizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Rasterizer.h; sourceTree = ""; }; - FA0B7B801A95902C000E1D17 /* Vera.ttf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Vera.ttf.h; sourceTree = ""; }; - FA0B7B811A95902C000E1D17 /* wrap_Font.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Font.cpp; sourceTree = ""; }; - FA0B7B821A95902C000E1D17 /* wrap_Font.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Font.h; sourceTree = ""; }; - FA0B7B831A95902C000E1D17 /* wrap_GlyphData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_GlyphData.cpp; sourceTree = ""; }; - FA0B7B841A95902C000E1D17 /* wrap_GlyphData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_GlyphData.h; sourceTree = ""; }; - FA0B7B851A95902C000E1D17 /* wrap_Rasterizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Rasterizer.cpp; sourceTree = ""; }; - FA0B7B861A95902C000E1D17 /* wrap_Rasterizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Rasterizer.h; sourceTree = ""; }; - FA0B7B891A95902C000E1D17 /* Drawable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Drawable.h; sourceTree = ""; }; - FA0B7B8A1A95902C000E1D17 /* Graphics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = Graphics.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; - FA0B7B8B1A95902C000E1D17 /* Graphics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Graphics.h; sourceTree = ""; }; - FA0B7B8D1A95902C000E1D17 /* Canvas.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = Canvas.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; - FA0B7B8E1A95902C000E1D17 /* Canvas.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Canvas.h; sourceTree = ""; }; - FA0B7B911A95902C000E1D17 /* Graphics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = Graphics.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; - FA0B7B921A95902C000E1D17 /* Graphics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Graphics.h; sourceTree = ""; }; - FA0B7B931A95902C000E1D17 /* Image.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Image.cpp; sourceTree = ""; }; - FA0B7B941A95902C000E1D17 /* Image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Image.h; sourceTree = ""; }; - FA0B7B971A95902C000E1D17 /* OpenGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OpenGL.cpp; sourceTree = ""; }; - FA0B7B981A95902C000E1D17 /* OpenGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenGL.h; sourceTree = ""; }; - FA0B7B9B1A95902C000E1D17 /* Polyline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Polyline.cpp; sourceTree = ""; }; - FA0B7B9C1A95902C000E1D17 /* Polyline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Polyline.h; sourceTree = ""; }; - FA0B7B9D1A95902C000E1D17 /* Shader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Shader.cpp; sourceTree = ""; }; - FA0B7B9E1A95902C000E1D17 /* Shader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Shader.h; sourceTree = ""; }; - FA0B7BA41A95902C000E1D17 /* Buffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Buffer.cpp; sourceTree = ""; }; - FA0B7BA51A95902C000E1D17 /* Buffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Buffer.h; sourceTree = ""; }; - FA0B7BBC1A95902C000E1D17 /* Quad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Quad.cpp; sourceTree = ""; }; - FA0B7BBD1A95902C000E1D17 /* Quad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Quad.h; sourceTree = ""; }; - FA0B7BBE1A95902C000E1D17 /* Texture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = Texture.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; - FA0B7BBF1A95902C000E1D17 /* Texture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Texture.h; sourceTree = ""; }; - FA0B7BC01A95902C000E1D17 /* Volatile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Volatile.cpp; sourceTree = ""; }; - FA0B7BC11A95902C000E1D17 /* Volatile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Volatile.h; sourceTree = ""; }; - FA0B7BC31A95902C000E1D17 /* CompressedImageData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CompressedImageData.cpp; sourceTree = ""; }; - FA0B7BC41A95902C000E1D17 /* CompressedImageData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompressedImageData.h; sourceTree = ""; }; - FA0B7BC51A95902C000E1D17 /* Image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Image.h; sourceTree = ""; }; - FA0B7BC61A95902C000E1D17 /* ImageData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageData.cpp; sourceTree = ""; }; - FA0B7BC71A95902C000E1D17 /* ImageData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageData.h; sourceTree = ""; }; - FA0B7BCC1A95902C000E1D17 /* ddsHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ddsHandler.cpp; sourceTree = ""; }; - FA0B7BCD1A95902C000E1D17 /* ddsHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ddsHandler.h; sourceTree = ""; }; - FA0B7BD81A95902C000E1D17 /* KTXHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KTXHandler.cpp; sourceTree = ""; }; - FA0B7BD91A95902C000E1D17 /* KTXHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KTXHandler.h; sourceTree = ""; }; - FA0B7BDA1A95902C000E1D17 /* PKMHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PKMHandler.cpp; sourceTree = ""; }; - FA0B7BDB1A95902C000E1D17 /* PKMHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PKMHandler.h; sourceTree = ""; }; - FA0B7BDC1A95902C000E1D17 /* PNGHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PNGHandler.cpp; sourceTree = ""; }; - FA0B7BDD1A95902C000E1D17 /* PNGHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNGHandler.h; sourceTree = ""; }; - FA0B7BDE1A95902C000E1D17 /* PVRHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PVRHandler.cpp; sourceTree = ""; }; - FA0B7BDF1A95902C000E1D17 /* PVRHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PVRHandler.h; sourceTree = ""; }; - FA0B7BE01A95902C000E1D17 /* STBHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = STBHandler.cpp; sourceTree = ""; }; - FA0B7BE11A95902C000E1D17 /* STBHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STBHandler.h; sourceTree = ""; }; - FA0B7BE21A95902C000E1D17 /* wrap_CompressedImageData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_CompressedImageData.cpp; sourceTree = ""; }; - FA0B7BE31A95902C000E1D17 /* wrap_CompressedImageData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_CompressedImageData.h; sourceTree = ""; }; - FA0B7BE41A95902C000E1D17 /* wrap_Image.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Image.cpp; sourceTree = ""; }; - FA0B7BE51A95902C000E1D17 /* wrap_Image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Image.h; sourceTree = ""; }; - FA0B7BE61A95902C000E1D17 /* wrap_ImageData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_ImageData.cpp; sourceTree = ""; }; - FA0B7BE71A95902C000E1D17 /* wrap_ImageData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_ImageData.h; sourceTree = ""; }; - FA0B7BE91A95902C000E1D17 /* Joystick.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Joystick.cpp; sourceTree = ""; }; - FA0B7BEA1A95902C000E1D17 /* Joystick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Joystick.h; sourceTree = ""; }; - FA0B7BEB1A95902C000E1D17 /* JoystickModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JoystickModule.h; sourceTree = ""; }; - FA0B7BED1A95902C000E1D17 /* Joystick.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Joystick.cpp; sourceTree = ""; }; - FA0B7BEE1A95902C000E1D17 /* Joystick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Joystick.h; sourceTree = ""; }; - FA0B7BEF1A95902C000E1D17 /* JoystickModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JoystickModule.cpp; sourceTree = ""; }; - FA0B7BF01A95902C000E1D17 /* JoystickModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JoystickModule.h; sourceTree = ""; }; - FA0B7BF11A95902C000E1D17 /* wrap_Joystick.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Joystick.cpp; sourceTree = ""; }; - FA0B7BF21A95902C000E1D17 /* wrap_Joystick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Joystick.h; sourceTree = ""; }; - FA0B7BF31A95902C000E1D17 /* wrap_JoystickModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_JoystickModule.cpp; sourceTree = ""; }; - FA0B7BF41A95902C000E1D17 /* wrap_JoystickModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_JoystickModule.h; sourceTree = ""; }; - FA0B7BF61A95902C000E1D17 /* Keyboard.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Keyboard.cpp; sourceTree = ""; }; - FA0B7BF71A95902C000E1D17 /* Keyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Keyboard.h; sourceTree = ""; }; - FA0B7BF91A95902C000E1D17 /* Keyboard.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Keyboard.cpp; sourceTree = ""; }; - FA0B7BFA1A95902C000E1D17 /* Keyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Keyboard.h; sourceTree = ""; }; - FA0B7BFB1A95902C000E1D17 /* wrap_Keyboard.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Keyboard.cpp; sourceTree = ""; }; - FA0B7BFC1A95902C000E1D17 /* wrap_Keyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Keyboard.h; sourceTree = ""; }; - FA0B7BFE1A95902C000E1D17 /* love.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = love.cpp; sourceTree = ""; }; - FA0B7BFF1A95902C000E1D17 /* love.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = love.h; sourceTree = ""; }; - FA0B7C011A95902C000E1D17 /* BezierCurve.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = BezierCurve.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; - FA0B7C021A95902C000E1D17 /* BezierCurve.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = BezierCurve.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - FA0B7C031A95902C000E1D17 /* MathModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathModule.cpp; sourceTree = ""; }; - FA0B7C041A95902C000E1D17 /* MathModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathModule.h; sourceTree = ""; }; - FA0B7C051A95902C000E1D17 /* RandomGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RandomGenerator.cpp; sourceTree = ""; }; - FA0B7C061A95902C000E1D17 /* RandomGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RandomGenerator.h; sourceTree = ""; }; - FA0B7C071A95902C000E1D17 /* wrap_BezierCurve.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_BezierCurve.cpp; sourceTree = ""; }; - FA0B7C081A95902C000E1D17 /* wrap_BezierCurve.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_BezierCurve.h; sourceTree = ""; }; - FA0B7C091A95902C000E1D17 /* wrap_Math.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Math.cpp; sourceTree = ""; }; - FA0B7C0A1A95902C000E1D17 /* wrap_Math.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Math.h; sourceTree = ""; }; - FA0B7C0B1A95902C000E1D17 /* wrap_RandomGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_RandomGenerator.cpp; sourceTree = ""; }; - FA0B7C0C1A95902C000E1D17 /* wrap_RandomGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_RandomGenerator.h; sourceTree = ""; }; - FA0B7C0E1A95902C000E1D17 /* Cursor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Cursor.cpp; sourceTree = ""; }; - FA0B7C0F1A95902C000E1D17 /* Cursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Cursor.h; sourceTree = ""; }; - FA0B7C111A95902C000E1D17 /* Mouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Mouse.h; sourceTree = ""; }; - FA0B7C131A95902C000E1D17 /* Cursor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Cursor.cpp; sourceTree = ""; }; - FA0B7C141A95902C000E1D17 /* Cursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Cursor.h; sourceTree = ""; }; - FA0B7C151A95902C000E1D17 /* Mouse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Mouse.cpp; sourceTree = ""; }; - FA0B7C161A95902C000E1D17 /* Mouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Mouse.h; sourceTree = ""; }; - FA0B7C171A95902C000E1D17 /* wrap_Cursor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Cursor.cpp; sourceTree = ""; }; - FA0B7C181A95902C000E1D17 /* wrap_Cursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Cursor.h; sourceTree = ""; }; - FA0B7C191A95902C000E1D17 /* wrap_Mouse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Mouse.cpp; sourceTree = ""; }; - FA0B7C1A1A95902C000E1D17 /* wrap_Mouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Mouse.h; sourceTree = ""; }; - FA0B7C1C1A95902C000E1D17 /* Body.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Body.cpp; sourceTree = ""; }; - FA0B7C1D1A95902C000E1D17 /* Body.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Body.h; sourceTree = ""; }; - FA0B7C1F1A95902C000E1D17 /* Body.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Body.cpp; sourceTree = ""; }; - FA0B7C201A95902C000E1D17 /* Body.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Body.h; sourceTree = ""; }; - FA0B7C211A95902C000E1D17 /* ChainShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ChainShape.cpp; sourceTree = ""; }; - FA0B7C221A95902C000E1D17 /* ChainShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChainShape.h; sourceTree = ""; }; - FA0B7C231A95902C000E1D17 /* CircleShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CircleShape.cpp; sourceTree = ""; }; - FA0B7C241A95902C000E1D17 /* CircleShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CircleShape.h; sourceTree = ""; }; - FA0B7C251A95902C000E1D17 /* Contact.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Contact.cpp; sourceTree = ""; }; - FA0B7C261A95902C000E1D17 /* Contact.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Contact.h; sourceTree = ""; }; - FA0B7C271A95902C000E1D17 /* DistanceJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DistanceJoint.cpp; sourceTree = ""; }; - FA0B7C281A95902C000E1D17 /* DistanceJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DistanceJoint.h; sourceTree = ""; }; - FA0B7C291A95902C000E1D17 /* EdgeShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EdgeShape.cpp; sourceTree = ""; }; - FA0B7C2A1A95902C000E1D17 /* EdgeShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EdgeShape.h; sourceTree = ""; }; - FA0B7C2B1A95902C000E1D17 /* Fixture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Fixture.cpp; sourceTree = ""; }; - FA0B7C2C1A95902C000E1D17 /* Fixture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Fixture.h; sourceTree = ""; }; - FA0B7C2D1A95902C000E1D17 /* FrictionJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrictionJoint.cpp; sourceTree = ""; }; - FA0B7C2E1A95902C000E1D17 /* FrictionJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrictionJoint.h; sourceTree = ""; }; - FA0B7C2F1A95902C000E1D17 /* GearJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GearJoint.cpp; sourceTree = ""; }; - FA0B7C301A95902C000E1D17 /* GearJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GearJoint.h; sourceTree = ""; }; - FA0B7C311A95902C000E1D17 /* Joint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Joint.cpp; sourceTree = ""; }; - FA0B7C321A95902C000E1D17 /* Joint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Joint.h; sourceTree = ""; }; - FA0B7C331A95902C000E1D17 /* MotorJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MotorJoint.cpp; sourceTree = ""; }; - FA0B7C341A95902C000E1D17 /* MotorJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MotorJoint.h; sourceTree = ""; }; - FA0B7C351A95902C000E1D17 /* MouseJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseJoint.cpp; sourceTree = ""; }; - FA0B7C361A95902C000E1D17 /* MouseJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MouseJoint.h; sourceTree = ""; }; - FA0B7C371A95902C000E1D17 /* Physics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Physics.cpp; sourceTree = ""; }; - FA0B7C381A95902C000E1D17 /* Physics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Physics.h; sourceTree = ""; }; - FA0B7C391A95902C000E1D17 /* PolygonShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PolygonShape.cpp; sourceTree = ""; }; - FA0B7C3A1A95902C000E1D17 /* PolygonShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PolygonShape.h; sourceTree = ""; }; - FA0B7C3B1A95902C000E1D17 /* PrismaticJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrismaticJoint.cpp; sourceTree = ""; }; - FA0B7C3C1A95902C000E1D17 /* PrismaticJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrismaticJoint.h; sourceTree = ""; }; - FA0B7C3D1A95902C000E1D17 /* PulleyJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PulleyJoint.cpp; sourceTree = ""; }; - FA0B7C3E1A95902C000E1D17 /* PulleyJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PulleyJoint.h; sourceTree = ""; }; - FA0B7C3F1A95902C000E1D17 /* RevoluteJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RevoluteJoint.cpp; sourceTree = ""; }; - FA0B7C401A95902C000E1D17 /* RevoluteJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RevoluteJoint.h; sourceTree = ""; }; - FA0B7C411A95902C000E1D17 /* RopeJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RopeJoint.cpp; sourceTree = ""; }; - FA0B7C421A95902C000E1D17 /* RopeJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RopeJoint.h; sourceTree = ""; }; - FA0B7C431A95902C000E1D17 /* Shape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Shape.cpp; sourceTree = ""; }; - FA0B7C441A95902C000E1D17 /* Shape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Shape.h; sourceTree = ""; }; - FA0B7C451A95902C000E1D17 /* WeldJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WeldJoint.cpp; sourceTree = ""; }; - FA0B7C461A95902C000E1D17 /* WeldJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeldJoint.h; sourceTree = ""; }; - FA0B7C471A95902C000E1D17 /* WheelJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WheelJoint.cpp; sourceTree = ""; }; - FA0B7C481A95902C000E1D17 /* WheelJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WheelJoint.h; sourceTree = ""; }; - FA0B7C491A95902C000E1D17 /* World.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = World.cpp; sourceTree = ""; }; - FA0B7C4A1A95902C000E1D17 /* World.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = World.h; sourceTree = ""; }; - FA0B7C4B1A95902C000E1D17 /* wrap_Body.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Body.cpp; sourceTree = ""; }; - FA0B7C4C1A95902C000E1D17 /* wrap_Body.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Body.h; sourceTree = ""; }; - FA0B7C4D1A95902C000E1D17 /* wrap_ChainShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_ChainShape.cpp; sourceTree = ""; }; - FA0B7C4E1A95902C000E1D17 /* wrap_ChainShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_ChainShape.h; sourceTree = ""; }; - FA0B7C4F1A95902C000E1D17 /* wrap_CircleShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_CircleShape.cpp; sourceTree = ""; }; - FA0B7C501A95902C000E1D17 /* wrap_CircleShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_CircleShape.h; sourceTree = ""; }; - FA0B7C511A95902C000E1D17 /* wrap_Contact.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Contact.cpp; sourceTree = ""; }; - FA0B7C521A95902C000E1D17 /* wrap_Contact.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Contact.h; sourceTree = ""; }; - FA0B7C531A95902C000E1D17 /* wrap_DistanceJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_DistanceJoint.cpp; sourceTree = ""; }; - FA0B7C541A95902C000E1D17 /* wrap_DistanceJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_DistanceJoint.h; sourceTree = ""; }; - FA0B7C551A95902C000E1D17 /* wrap_EdgeShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_EdgeShape.cpp; sourceTree = ""; }; - FA0B7C561A95902C000E1D17 /* wrap_EdgeShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_EdgeShape.h; sourceTree = ""; }; - FA0B7C571A95902C000E1D17 /* wrap_Fixture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Fixture.cpp; sourceTree = ""; }; - FA0B7C581A95902C000E1D17 /* wrap_Fixture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Fixture.h; sourceTree = ""; }; - FA0B7C591A95902C000E1D17 /* wrap_FrictionJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_FrictionJoint.cpp; sourceTree = ""; }; - FA0B7C5A1A95902C000E1D17 /* wrap_FrictionJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_FrictionJoint.h; sourceTree = ""; }; - FA0B7C5B1A95902C000E1D17 /* wrap_GearJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_GearJoint.cpp; sourceTree = ""; }; - FA0B7C5C1A95902C000E1D17 /* wrap_GearJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_GearJoint.h; sourceTree = ""; }; - FA0B7C5D1A95902C000E1D17 /* wrap_Joint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Joint.cpp; sourceTree = ""; }; - FA0B7C5E1A95902C000E1D17 /* wrap_Joint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Joint.h; sourceTree = ""; }; - FA0B7C5F1A95902C000E1D17 /* wrap_MotorJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_MotorJoint.cpp; sourceTree = ""; }; - FA0B7C601A95902C000E1D17 /* wrap_MotorJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_MotorJoint.h; sourceTree = ""; }; - FA0B7C611A95902C000E1D17 /* wrap_MouseJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_MouseJoint.cpp; sourceTree = ""; }; - FA0B7C621A95902C000E1D17 /* wrap_MouseJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_MouseJoint.h; sourceTree = ""; }; - FA0B7C631A95902C000E1D17 /* wrap_Physics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Physics.cpp; sourceTree = ""; }; - FA0B7C641A95902C000E1D17 /* wrap_Physics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Physics.h; sourceTree = ""; }; - FA0B7C651A95902C000E1D17 /* wrap_PolygonShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_PolygonShape.cpp; sourceTree = ""; }; - FA0B7C661A95902C000E1D17 /* wrap_PolygonShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_PolygonShape.h; sourceTree = ""; }; - FA0B7C671A95902C000E1D17 /* wrap_PrismaticJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_PrismaticJoint.cpp; sourceTree = ""; }; - FA0B7C681A95902C000E1D17 /* wrap_PrismaticJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_PrismaticJoint.h; sourceTree = ""; }; - FA0B7C691A95902C000E1D17 /* wrap_PulleyJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_PulleyJoint.cpp; sourceTree = ""; }; - FA0B7C6A1A95902C000E1D17 /* wrap_PulleyJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_PulleyJoint.h; sourceTree = ""; }; - FA0B7C6B1A95902C000E1D17 /* wrap_RevoluteJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_RevoluteJoint.cpp; sourceTree = ""; }; - FA0B7C6C1A95902C000E1D17 /* wrap_RevoluteJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_RevoluteJoint.h; sourceTree = ""; }; - FA0B7C6D1A95902C000E1D17 /* wrap_RopeJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_RopeJoint.cpp; sourceTree = ""; }; - FA0B7C6E1A95902C000E1D17 /* wrap_RopeJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_RopeJoint.h; sourceTree = ""; }; - FA0B7C6F1A95902C000E1D17 /* wrap_Shape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Shape.cpp; sourceTree = ""; }; - FA0B7C701A95902C000E1D17 /* wrap_Shape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Shape.h; sourceTree = ""; }; - FA0B7C711A95902C000E1D17 /* wrap_WeldJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_WeldJoint.cpp; sourceTree = ""; }; - FA0B7C721A95902C000E1D17 /* wrap_WeldJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_WeldJoint.h; sourceTree = ""; }; - FA0B7C731A95902C000E1D17 /* wrap_WheelJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_WheelJoint.cpp; sourceTree = ""; }; - FA0B7C741A95902C000E1D17 /* wrap_WheelJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_WheelJoint.h; sourceTree = ""; }; - FA0B7C751A95902C000E1D17 /* wrap_World.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_World.cpp; sourceTree = ""; }; - FA0B7C761A95902C000E1D17 /* wrap_World.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_World.h; sourceTree = ""; }; - FA0B7C771A95902C000E1D17 /* Joint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Joint.cpp; sourceTree = ""; }; - FA0B7C781A95902C000E1D17 /* Joint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Joint.h; sourceTree = ""; }; - FA0B7C791A95902C000E1D17 /* Shape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Shape.cpp; sourceTree = ""; }; - FA0B7C7A1A95902C000E1D17 /* Shape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Shape.h; sourceTree = ""; }; - FA0B7C7C1A95902C000E1D17 /* Decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decoder.h; sourceTree = ""; }; - FA0B7C7E1A95902C000E1D17 /* CoreAudioDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CoreAudioDecoder.cpp; sourceTree = ""; }; - FA0B7C7F1A95902C000E1D17 /* CoreAudioDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreAudioDecoder.h; sourceTree = ""; }; - FA0B7C801A95902C000E1D17 /* Decoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Decoder.cpp; sourceTree = ""; }; - FA0B7C821A95902C000E1D17 /* FLACDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FLACDecoder.cpp; sourceTree = ""; }; - FA0B7C831A95902C000E1D17 /* FLACDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FLACDecoder.h; sourceTree = ""; }; - FA0B7C841A95902C000E1D17 /* GmeDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GmeDecoder.cpp; sourceTree = ""; }; - FA0B7C851A95902C000E1D17 /* GmeDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GmeDecoder.h; sourceTree = ""; }; - FA0B7C861A95902C000E1D17 /* ModPlugDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ModPlugDecoder.cpp; sourceTree = ""; }; - FA0B7C871A95902C000E1D17 /* ModPlugDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModPlugDecoder.h; sourceTree = ""; }; - FA0B7C881A95902C000E1D17 /* Mpg123Decoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Mpg123Decoder.cpp; sourceTree = ""; }; - FA0B7C891A95902C000E1D17 /* Mpg123Decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Mpg123Decoder.h; sourceTree = ""; }; - FA0B7C8A1A95902C000E1D17 /* Sound.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Sound.cpp; sourceTree = ""; }; - FA0B7C8B1A95902C000E1D17 /* Sound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Sound.h; sourceTree = ""; }; - FA0B7C8C1A95902C000E1D17 /* VorbisDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VorbisDecoder.cpp; sourceTree = ""; }; - FA0B7C8D1A95902C000E1D17 /* VorbisDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VorbisDecoder.h; sourceTree = ""; }; - FA0B7C8E1A95902C000E1D17 /* WaveDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WaveDecoder.cpp; sourceTree = ""; }; - FA0B7C8F1A95902C000E1D17 /* WaveDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WaveDecoder.h; sourceTree = ""; }; - FA0B7C901A95902C000E1D17 /* Sound.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Sound.cpp; sourceTree = ""; }; - FA0B7C911A95902C000E1D17 /* Sound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Sound.h; sourceTree = ""; }; - FA0B7C921A95902C000E1D17 /* SoundData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SoundData.cpp; sourceTree = ""; }; - FA0B7C931A95902C000E1D17 /* SoundData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SoundData.h; sourceTree = ""; }; - FA0B7C941A95902C000E1D17 /* wrap_Decoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Decoder.cpp; sourceTree = ""; }; - FA0B7C951A95902C000E1D17 /* wrap_Decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Decoder.h; sourceTree = ""; }; - FA0B7C961A95902C000E1D17 /* wrap_Sound.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Sound.cpp; sourceTree = ""; }; - FA0B7C971A95902C000E1D17 /* wrap_Sound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Sound.h; sourceTree = ""; }; - FA0B7C981A95902C000E1D17 /* wrap_SoundData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_SoundData.cpp; sourceTree = ""; }; - FA0B7C991A95902C000E1D17 /* wrap_SoundData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_SoundData.h; sourceTree = ""; }; - FA0B7C9C1A95902C000E1D17 /* System.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = System.cpp; sourceTree = ""; }; - FA0B7C9D1A95902C000E1D17 /* System.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = System.h; sourceTree = ""; }; - FA0B7C9E1A95902C000E1D17 /* System.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = System.cpp; sourceTree = ""; }; - FA0B7C9F1A95902C000E1D17 /* System.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = System.h; sourceTree = ""; }; - FA0B7CA01A95902C000E1D17 /* wrap_System.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_System.cpp; sourceTree = ""; }; - FA0B7CA11A95902C000E1D17 /* wrap_System.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_System.h; sourceTree = ""; }; - FA0B7CA31A95902C000E1D17 /* Channel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Channel.cpp; sourceTree = ""; }; - FA0B7CA41A95902C000E1D17 /* Channel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Channel.h; sourceTree = ""; }; - FA0B7CA51A95902C000E1D17 /* LuaThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LuaThread.cpp; sourceTree = ""; }; - FA0B7CA61A95902C000E1D17 /* LuaThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LuaThread.h; sourceTree = ""; }; - FA0B7CA81A95902C000E1D17 /* Thread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Thread.cpp; sourceTree = ""; }; - FA0B7CA91A95902C000E1D17 /* Thread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Thread.h; sourceTree = ""; }; - FA0B7CAA1A95902C000E1D17 /* threads.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = threads.cpp; sourceTree = ""; }; - FA0B7CAB1A95902C000E1D17 /* threads.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = threads.h; sourceTree = ""; }; - FA0B7CAC1A95902C000E1D17 /* Thread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Thread.h; sourceTree = ""; }; - FA0B7CAD1A95902C000E1D17 /* ThreadModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadModule.cpp; sourceTree = ""; }; - FA0B7CAE1A95902C000E1D17 /* ThreadModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadModule.h; sourceTree = ""; }; - FA0B7CAF1A95902C000E1D17 /* threads.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = threads.cpp; sourceTree = ""; }; - FA0B7CB01A95902C000E1D17 /* threads.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = threads.h; sourceTree = ""; }; - FA0B7CB11A95902C000E1D17 /* wrap_Channel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Channel.cpp; sourceTree = ""; }; - FA0B7CB21A95902C000E1D17 /* wrap_Channel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Channel.h; sourceTree = ""; }; - FA0B7CB31A95902C000E1D17 /* wrap_LuaThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_LuaThread.cpp; sourceTree = ""; }; - FA0B7CB41A95902C000E1D17 /* wrap_LuaThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_LuaThread.h; sourceTree = ""; }; - FA0B7CB51A95902C000E1D17 /* wrap_ThreadModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_ThreadModule.cpp; sourceTree = ""; }; - FA0B7CB61A95902C000E1D17 /* wrap_ThreadModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_ThreadModule.h; sourceTree = ""; }; - FA0B7CBB1A95902C000E1D17 /* Timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Timer.h; sourceTree = ""; }; - FA0B7CBC1A95902C000E1D17 /* wrap_Timer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Timer.cpp; sourceTree = ""; }; - FA0B7CBD1A95902C000E1D17 /* wrap_Timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Timer.h; sourceTree = ""; }; - FA0B7CC01A95902C000E1D17 /* Touch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Touch.cpp; sourceTree = ""; }; - FA0B7CC11A95902C000E1D17 /* Touch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Touch.h; sourceTree = ""; }; - FA0B7CC21A95902C000E1D17 /* Touch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Touch.h; sourceTree = ""; }; - FA0B7CC31A95902C000E1D17 /* wrap_Touch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Touch.cpp; sourceTree = ""; }; - FA0B7CC41A95902C000E1D17 /* wrap_Touch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Touch.h; sourceTree = ""; }; - FA0B7CC71A95902C000E1D17 /* Window.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Window.cpp; sourceTree = ""; }; - FA0B7CC81A95902C000E1D17 /* Window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Window.h; sourceTree = ""; }; - FA0B7CC91A95902C000E1D17 /* Window.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Window.cpp; sourceTree = ""; }; - FA0B7CCA1A95902C000E1D17 /* Window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Window.h; sourceTree = ""; }; - FA0B7CCB1A95902C000E1D17 /* wrap_Window.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Window.cpp; sourceTree = ""; }; - FA0B7CCC1A95902C000E1D17 /* wrap_Window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Window.h; sourceTree = ""; }; - FA0B7EF01A959D2C000E1D17 /* ios.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ios.h; sourceTree = ""; }; - FA0B7EF11A959D2C000E1D17 /* ios.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ios.mm; sourceTree = ""; }; - FA10DD7B1F9EC24E00E1FE3D /* Resource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Resource.h; sourceTree = ""; }; - FA1557BF1CE90A2C00AFF582 /* tinyexr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tinyexr.h; sourceTree = ""; }; - FA1557C11CE90BD200AFF582 /* EXRHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EXRHandler.cpp; sourceTree = ""; }; - FA1557C21CE90BD200AFF582 /* EXRHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EXRHandler.h; sourceTree = ""; }; - FA15DFAB1F9B8C850042AB22 /* StringMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringMap.cpp; sourceTree = ""; }; - FA1BA09B1E16CFCE00AA2803 /* Font.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Font.cpp; sourceTree = ""; }; - FA1BA09C1E16CFCE00AA2803 /* Font.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Font.h; sourceTree = ""; }; - FA1BA0A01E16D97500AA2803 /* wrap_Font.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Font.cpp; sourceTree = ""; }; - FA1BA0A11E16D97500AA2803 /* wrap_Font.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Font.h; sourceTree = ""; }; - FA1BA0A51E16F20600AA2803 /* Canvas.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = Canvas.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; - FA1BA0A61E16F20600AA2803 /* Canvas.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = Canvas.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - FA1BA0AA1E16F9EE00AA2803 /* wrap_Canvas.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = wrap_Canvas.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; - FA1BA0AB1E16F9EE00AA2803 /* wrap_Canvas.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Canvas.h; sourceTree = ""; }; - FA1BA0AF1E16FD0800AA2803 /* Shader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Shader.cpp; sourceTree = ""; }; - FA1BA0B01E16FD0800AA2803 /* Shader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Shader.h; sourceTree = ""; }; - FA1BA0B51E17043400AA2803 /* wrap_Shader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Shader.cpp; sourceTree = ""; }; - FA1BA0B61E17043400AA2803 /* wrap_Shader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Shader.h; sourceTree = ""; }; - FA1E887C1DF363CD00E808AA /* Filter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Filter.cpp; sourceTree = ""; }; - FA1E887D1DF363CD00E808AA /* Filter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Filter.h; sourceTree = ""; }; - FA1E88811DF363DB00E808AA /* Filter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Filter.cpp; sourceTree = ""; }; - FA1E88821DF363DB00E808AA /* Filter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Filter.h; sourceTree = ""; }; - FA27B38A1B498151008A9DCE /* Video.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Video.cpp; sourceTree = ""; }; - FA27B38B1B498151008A9DCE /* Video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Video.h; sourceTree = ""; }; - FA27B3931B498151008A9DCE /* Video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Video.h; sourceTree = ""; }; - FA27B3941B498151008A9DCE /* VideoStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VideoStream.cpp; sourceTree = ""; }; - FA27B3951B498151008A9DCE /* VideoStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoStream.h; sourceTree = ""; }; - FA27B39B1B498151008A9DCE /* wrap_Video.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Video.cpp; sourceTree = ""; }; - FA27B39C1B498151008A9DCE /* wrap_Video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Video.h; sourceTree = ""; }; - FA27B3B91B4985BF008A9DCE /* wrap_VideoStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_VideoStream.cpp; sourceTree = ""; }; - FA27B3BA1B4985BF008A9DCE /* wrap_VideoStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_VideoStream.h; sourceTree = ""; }; - FA27B3C81B498623008A9DCE /* theora.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = theora.framework; path = /Library/Frameworks/theora.framework; sourceTree = ""; }; - FA283EDC1B27CFAA00C70067 /* nogame.lua */ = {isa = PBXFileReference; lastKnownFileType = text; path = nogame.lua; sourceTree = ""; }; - FA283EDD1B27CFAA00C70067 /* nogame.lua.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = nogame.lua.h; sourceTree = ""; }; - FA28EBD31E352DB5003446F4 /* FenceSync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FenceSync.cpp; sourceTree = ""; }; - FA28EBD41E352DB5003446F4 /* FenceSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FenceSync.h; sourceTree = ""; }; - FA29C0041E12355B00268CD8 /* StreamBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StreamBuffer.cpp; sourceTree = ""; }; - FA2AF6711DAC76FF0032B62C /* vertex.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vertex.h; sourceTree = ""; }; - FA2AF6721DAD62710032B62C /* StreamBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StreamBuffer.h; sourceTree = ""; }; - FA2AF6731DAD64970032B62C /* vertex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = vertex.cpp; sourceTree = ""; }; - FA2E9BFE1C19E00C0004A1EE /* wrap_RandomGenerator.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = wrap_RandomGenerator.lua; sourceTree = ""; }; - FA317EB918F28B6D00B0BCD7 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; - FA3C5E401F8C368C0003C579 /* ShaderStage.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ShaderStage.cpp; sourceTree = ""; }; - FA3C5E411F8C368C0003C579 /* ShaderStage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ShaderStage.h; sourceTree = ""; }; - FA3C5E451F8D80CA0003C579 /* ShaderStage.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ShaderStage.cpp; sourceTree = ""; }; - FA3C5E461F8D80CA0003C579 /* ShaderStage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ShaderStage.h; sourceTree = ""; }; - FA41A3C61C0A1F950084430C /* ASTCHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = ASTCHandler.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; - FA41A3C71C0A1F950084430C /* ASTCHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = ASTCHandler.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - FA4B66C81ABBCF1900558F15 /* Timer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Timer.cpp; sourceTree = ""; }; - FA4F2B771DE0125B00CA37D7 /* xxhash.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xxhash.c; sourceTree = ""; }; - FA4F2B781DE0125B00CA37D7 /* xxhash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xxhash.h; sourceTree = ""; }; - FA4F2BA21DE1E36400CA37D7 /* RecordingDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RecordingDevice.cpp; sourceTree = ""; }; - FA4F2BA31DE1E36400CA37D7 /* RecordingDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecordingDevice.h; sourceTree = ""; }; - FA4F2BA41DE1E36400CA37D7 /* wrap_RecordingDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_RecordingDevice.cpp; sourceTree = ""; }; - FA4F2BA51DE1E36400CA37D7 /* wrap_RecordingDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_RecordingDevice.h; sourceTree = ""; }; - FA4F2BAA1DE1E37000CA37D7 /* RecordingDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RecordingDevice.cpp; sourceTree = ""; }; - FA4F2BAB1DE1E37000CA37D7 /* RecordingDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecordingDevice.h; sourceTree = ""; }; - FA4F2BAE1DE1E37B00CA37D7 /* RecordingDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RecordingDevice.cpp; sourceTree = ""; }; - FA4F2BAF1DE1E37B00CA37D7 /* RecordingDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecordingDevice.h; sourceTree = ""; }; - FA4F2BDF1DE6650600CA37D7 /* Transform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Transform.cpp; sourceTree = ""; }; - FA4F2BE01DE6650600CA37D7 /* Transform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Transform.h; sourceTree = ""; }; - FA4F2BE11DE6650600CA37D7 /* wrap_Transform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Transform.cpp; sourceTree = ""; }; - FA4F2BE21DE6650600CA37D7 /* wrap_Transform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Transform.h; sourceTree = ""; }; - FA56AA361FAFF02000A43D5F /* memory.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = memory.cpp; sourceTree = ""; }; - FA56AA371FAFF02000A43D5F /* memory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = memory.h; sourceTree = ""; }; - FA56D9BA1C2089EE00D8D3C7 /* libmodplug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libmodplug.a; sourceTree = ""; }; - FA577A6D16C719EA00860150 /* Lua.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Lua.framework; path = /Library/Frameworks/Lua.framework; sourceTree = ""; }; - FA577A6F16C719F000860150 /* mpg123.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = mpg123.framework; path = /Library/Frameworks/mpg123.framework; sourceTree = ""; }; - FA577A7116C719F400860150 /* ogg.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ogg.framework; path = /Library/Frameworks/ogg.framework; sourceTree = ""; }; - FA577A7716C71A0800860150 /* vorbis.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = vorbis.framework; path = /Library/Frameworks/vorbis.framework; sourceTree = ""; }; - FA577A7916C71A1700860150 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; - FA577A7C16C71A2600860150 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; - FA577A8216C71A5300860150 /* libmodplug.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = libmodplug.framework; path = /Library/Frameworks/libmodplug.framework; sourceTree = ""; }; - FA577A8C16C71D3600860150 /* auto.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; lineEnding = 0; path = auto.lua; sourceTree = ""; xcLanguageSpecificationIdentifier = ""; }; - FA577A8D16C71D3600860150 /* boot.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = boot.lua; sourceTree = ""; }; - FA577AAF16C7507900860150 /* love.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = love.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - FA57FB961AE1993600F2AD6D /* noise1234.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = noise1234.cpp; sourceTree = ""; }; - FA57FB971AE1993600F2AD6D /* noise1234.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = noise1234.h; sourceTree = ""; }; - FA59A2D61C0649BB00328DBA /* libtheora.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libtheora.a; sourceTree = ""; }; - FA5D24AB1A96D2EC00C6FC8F /* libogg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libogg.a; sourceTree = ""; }; - FA5D24AF1A96D2EC00C6FC8F /* libvorbis.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libvorbis.a; sourceTree = ""; }; - FA5D24CD1A96E63D00C6FC8F /* libSDL2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libSDL2.a; sourceTree = ""; }; - FA620A2E1AA2F8DB005DB4C2 /* wrap_Quad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Quad.cpp; sourceTree = ""; }; - FA620A2F1AA2F8DB005DB4C2 /* wrap_Quad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Quad.h; sourceTree = ""; }; - FA620A301AA2F8DB005DB4C2 /* wrap_Texture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Texture.cpp; sourceTree = ""; }; - FA620A311AA2F8DB005DB4C2 /* wrap_Texture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Texture.h; sourceTree = ""; }; - FA620A391AA305F6005DB4C2 /* types.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = types.cpp; sourceTree = ""; }; - FA6A2B641F5F7B6B0074C308 /* wrap_Data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Data.h; sourceTree = ""; }; - FA6A2B651F5F7B6B0074C308 /* wrap_Data.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Data.cpp; sourceTree = ""; }; - FA6A2B681F5F7F560074C308 /* DataView.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DataView.cpp; sourceTree = ""; }; - FA6A2B691F5F7F560074C308 /* DataView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DataView.h; sourceTree = ""; }; - FA6A2B6D1F5F845F0074C308 /* wrap_DataView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_DataView.h; sourceTree = ""; }; - FA6A2B6E1F5F845F0074C308 /* wrap_DataView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_DataView.cpp; sourceTree = ""; }; - FA6A2B721F60B6710074C308 /* ByteData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ByteData.cpp; sourceTree = ""; }; - FA6A2B731F60B6710074C308 /* ByteData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ByteData.h; sourceTree = ""; }; - FA6A2B771F60B8250074C308 /* wrap_ByteData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_ByteData.h; sourceTree = ""; }; - FA6A2B781F60B8250074C308 /* wrap_ByteData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_ByteData.cpp; sourceTree = ""; }; - FA6BDE5B1F31725300786805 /* Color.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Color.h; sourceTree = ""; }; - FA7550A71AEBE276003E311E /* libluajit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libluajit.a; sourceTree = ""; }; - FA7634481E28722A0066EF9E /* StreamBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StreamBuffer.cpp; sourceTree = ""; }; - FA7634491E28722A0066EF9E /* StreamBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StreamBuffer.h; sourceTree = ""; }; - FA7DA04C1C16874A0056B200 /* wrap_Math.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = wrap_Math.lua; sourceTree = ""; }; - FA8951A01AA2EDF300EC385A /* wrap_Event.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Event.cpp; sourceTree = ""; }; - FA8951A11AA2EDF300EC385A /* wrap_Event.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Event.h; sourceTree = ""; }; - FA91591C1CF1ED7500A7053F /* halffloat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = halffloat.cpp; sourceTree = ""; }; - FA91591D1CF1ED7500A7053F /* halffloat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = halffloat.h; sourceTree = ""; }; - FA91DA891F377C3900C80E33 /* deprecation.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = deprecation.cpp; sourceTree = ""; }; - FA91DA8A1F377C3900C80E33 /* deprecation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = deprecation.h; sourceTree = ""; }; - FA93C4501F315B960087CCD4 /* FormatHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormatHandler.h; sourceTree = ""; }; - FA93C4511F315B960087CCD4 /* FormatHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormatHandler.cpp; sourceTree = ""; }; - FA9B4A0716E1578300074F42 /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = /Library/Frameworks/SDL2.framework; sourceTree = ""; }; - FA9D53AA1F5307E900125C6B /* Deprecations.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Deprecations.cpp; sourceTree = ""; }; - FA9D53AB1F5307E900125C6B /* Deprecations.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Deprecations.h; sourceTree = ""; }; - FA9D8DCF1DEB56C3002CD881 /* pixelformat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pixelformat.cpp; sourceTree = ""; }; - FA9D8DD01DEB56C3002CD881 /* pixelformat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pixelformat.h; sourceTree = ""; }; - FA9D8DD41DEF8411002CD881 /* Data.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Data.cpp; sourceTree = ""; }; - FA9D8DD51DEF8411002CD881 /* Stream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Stream.cpp; sourceTree = ""; }; - FA9D8DD61DEF8411002CD881 /* Stream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Stream.h; sourceTree = ""; }; - FA9D8DDC1DEF842A002CD881 /* Drawable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Drawable.cpp; sourceTree = ""; }; - FA9D8DDF1DEF843D002CD881 /* Image.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Image.cpp; sourceTree = ""; }; - FAA3A9AC1B7D465A00CED060 /* android.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = android.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; - FAA3A9AD1B7D465A00CED060 /* android.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = android.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - FAA54AC61F91660400A8FA7B /* OggDemuxer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OggDemuxer.h; sourceTree = ""; }; - FAA54AC71F91660400A8FA7B /* TheoraVideoStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TheoraVideoStream.h; sourceTree = ""; }; - FAA54AC81F91660400A8FA7B /* TheoraVideoStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TheoraVideoStream.cpp; sourceTree = ""; }; - FAA54AC91F91660400A8FA7B /* OggDemuxer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OggDemuxer.cpp; sourceTree = ""; }; - FAA627CD18E7E1560080752D /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; }; - FAAA3FD31F64B3AD00F89E99 /* lprefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lprefix.h; sourceTree = ""; }; - FAAA3FD41F64B3AD00F89E99 /* lstrlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lstrlib.c; sourceTree = ""; }; - FAAA3FD51F64B3AD00F89E99 /* lstrlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lstrlib.h; sourceTree = ""; }; - FAAA3FD61F64B3AD00F89E99 /* lutf8lib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lutf8lib.c; sourceTree = ""; }; - FAAA3FD71F64B3AD00F89E99 /* lutf8lib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lutf8lib.h; sourceTree = ""; }; - FAAFF04316CB11C700CCDE45 /* OpenAL-Soft.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "OpenAL-Soft.framework"; path = "/Library/Frameworks/OpenAL-Soft.framework"; sourceTree = ""; }; - FAB17BE41ABFAA9000F9BA27 /* lz4.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lz4.c; sourceTree = ""; }; - FAB17BE51ABFAA9000F9BA27 /* lz4.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lz4.h; sourceTree = ""; }; - FAB17BF31ABFC4B100F9BA27 /* lz4hc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lz4hc.c; sourceTree = ""; }; - FAB17BF41ABFC4B100F9BA27 /* lz4hc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lz4hc.h; sourceTree = ""; }; - FAB2D5A81AABDD8A008224A4 /* TrueTypeRasterizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TrueTypeRasterizer.cpp; sourceTree = ""; }; - FAB2D5A91AABDD8A008224A4 /* TrueTypeRasterizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TrueTypeRasterizer.h; sourceTree = ""; }; - FAC734C11B2E021A00AB460A /* wrap_SoundData.lua */ = {isa = PBXFileReference; lastKnownFileType = text; path = wrap_SoundData.lua; sourceTree = ""; }; - FAC734C21B2E628700AB460A /* wrap_ImageData.lua */ = {isa = PBXFileReference; lastKnownFileType = text; path = wrap_ImageData.lua; sourceTree = ""; }; - FAC756F31E4F99B400B91289 /* Effect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Effect.cpp; sourceTree = ""; }; - FAC756F41E4F99B400B91289 /* Effect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Effect.h; sourceTree = ""; }; - FAC756F81E4F99D200B91289 /* Effect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Effect.cpp; sourceTree = ""; }; - FAC756F91E4F99D200B91289 /* Effect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Effect.h; sourceTree = ""; }; - FAC7CD5A1FE35E95006A60C7 /* physfs_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = physfs_internal.h; sourceTree = ""; }; - FAC7CD5B1FE35E95006A60C7 /* physfs_platform_qnx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = physfs_platform_qnx.c; sourceTree = ""; }; - FAC7CD5C1FE35E95006A60C7 /* physfs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = physfs.c; sourceTree = ""; }; - FAC7CD5D1FE35E95006A60C7 /* physfs_archiver_7z.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = physfs_archiver_7z.c; sourceTree = ""; }; - FAC7CD5E1FE35E95006A60C7 /* physfs_platform_unix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = physfs_platform_unix.c; sourceTree = ""; }; - FAC7CD5F1FE35E95006A60C7 /* physfs_archiver_slb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = physfs_archiver_slb.c; sourceTree = ""; }; - FAC7CD601FE35E95006A60C7 /* physfs_platform_winrt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = physfs_platform_winrt.cpp; sourceTree = ""; }; - FAC7CD611FE35E95006A60C7 /* physfs_archiver_mvl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = physfs_archiver_mvl.c; sourceTree = ""; }; - FAC7CD621FE35E95006A60C7 /* physfs_archiver_wad.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = physfs_archiver_wad.c; sourceTree = ""; }; - FAC7CD631FE35E95006A60C7 /* physfs_casefolding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = physfs_casefolding.h; sourceTree = ""; }; - FAC7CD641FE35E95006A60C7 /* physfs_platform_os2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = physfs_platform_os2.c; sourceTree = ""; }; - FAC7CD651FE35E95006A60C7 /* physfs_platform_haiku.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = physfs_platform_haiku.cpp; sourceTree = ""; }; - FAC7CD661FE35E95006A60C7 /* physfs_platform_windows.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = physfs_platform_windows.c; sourceTree = ""; }; - FAC7CD671FE35E95006A60C7 /* physfs_archiver_unpacked.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = physfs_archiver_unpacked.c; sourceTree = ""; }; - FAC7CD681FE35E95006A60C7 /* physfs_unicode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = physfs_unicode.c; sourceTree = ""; }; - FAC7CD691FE35E95006A60C7 /* physfs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = physfs.h; sourceTree = ""; }; - FAC7CD6A1FE35E95006A60C7 /* physfs_archiver_vdf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = physfs_archiver_vdf.c; sourceTree = ""; }; - FAC7CD6B1FE35E95006A60C7 /* physfs_platform_apple.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = physfs_platform_apple.m; sourceTree = ""; }; - FAC7CD6C1FE35E95006A60C7 /* physfs_archiver_dir.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = physfs_archiver_dir.c; sourceTree = ""; }; - FAC7CD6D1FE35E95006A60C7 /* physfs_byteorder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = physfs_byteorder.c; sourceTree = ""; }; - FAC7CD6E1FE35E95006A60C7 /* physfs_archiver_iso9660.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = physfs_archiver_iso9660.c; sourceTree = ""; }; - FAC7CD6F1FE35E95006A60C7 /* physfs_archiver_qpak.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = physfs_archiver_qpak.c; sourceTree = ""; }; - FAC7CD701FE35E95006A60C7 /* physfs_platforms.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = physfs_platforms.h; sourceTree = ""; }; - FAC7CD711FE35E95006A60C7 /* physfs_lzmasdk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = physfs_lzmasdk.h; sourceTree = ""; }; - FAC7CD721FE35E95006A60C7 /* physfs_platform_posix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = physfs_platform_posix.c; sourceTree = ""; }; - FAC7CD731FE35E95006A60C7 /* physfs_miniz.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = physfs_miniz.h; sourceTree = ""; }; - FAC7CD741FE35E95006A60C7 /* physfs_archiver_grp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = physfs_archiver_grp.c; sourceTree = ""; }; - FAC7CD751FE35E95006A60C7 /* physfs_archiver_hog.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = physfs_archiver_hog.c; sourceTree = ""; }; - FAC7CD761FE35E95006A60C7 /* physfs_archiver_zip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = physfs_archiver_zip.c; sourceTree = ""; }; - FAC7CD951FE755B3006A60C7 /* lz4opt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lz4opt.h; sourceTree = ""; }; - FACA02E01F5E396B0084B28F /* CompressedData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CompressedData.cpp; sourceTree = ""; }; - FACA02E11F5E396B0084B28F /* CompressedData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompressedData.h; sourceTree = ""; }; - FACA02E21F5E396B0084B28F /* Compressor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Compressor.cpp; sourceTree = ""; }; - FACA02E31F5E396B0084B28F /* Compressor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Compressor.h; sourceTree = ""; }; - FACA02E41F5E396B0084B28F /* DataModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DataModule.cpp; sourceTree = ""; }; - FACA02E51F5E396B0084B28F /* DataModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataModule.h; sourceTree = ""; }; - FACA02E61F5E396B0084B28F /* HashFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HashFunction.cpp; sourceTree = ""; }; - FACA02E71F5E396B0084B28F /* HashFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HashFunction.h; sourceTree = ""; }; - FACA02E81F5E396B0084B28F /* wrap_CompressedData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_CompressedData.cpp; sourceTree = ""; }; - FACA02E91F5E396B0084B28F /* wrap_CompressedData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_CompressedData.h; sourceTree = ""; }; - FACA02EA1F5E396B0084B28F /* wrap_DataModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_DataModule.cpp; sourceTree = ""; }; - FACA02EB1F5E396B0084B28F /* wrap_DataModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_DataModule.h; sourceTree = ""; }; - FAD19A151DFF8CA200D5398A /* ImageDataBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageDataBase.cpp; sourceTree = ""; }; - FAD19A161DFF8CA200D5398A /* ImageDataBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageDataBase.h; sourceTree = ""; }; - FAD43ECB1FF312D800831BB8 /* freetype.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = freetype.framework; path = /Library/Frameworks/freetype.framework; sourceTree = ""; }; - FADF53F61E3C7ACD00012CC0 /* Buffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Buffer.cpp; sourceTree = ""; }; - FADF53F71E3C7ACD00012CC0 /* Buffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Buffer.h; sourceTree = ""; }; - FADF53FB1E3D74F200012CC0 /* Text.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Text.cpp; sourceTree = ""; }; - FADF53FC1E3D74F200012CC0 /* Text.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Text.h; sourceTree = ""; }; - FADF54001E3D77B500012CC0 /* wrap_Text.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Text.cpp; sourceTree = ""; }; - FADF54011E3D77B500012CC0 /* wrap_Text.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Text.h; sourceTree = ""; }; - FADF54051E3D78F700012CC0 /* Video.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Video.cpp; sourceTree = ""; }; - FADF54061E3D78F700012CC0 /* Video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Video.h; sourceTree = ""; }; - FADF540A1E3D7CDD00012CC0 /* wrap_Video.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Video.cpp; sourceTree = ""; }; - FADF540B1E3D7CDD00012CC0 /* wrap_Video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Video.h; sourceTree = ""; }; - FADF540C1E3D7CDD00012CC0 /* wrap_Video.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = wrap_Video.lua; sourceTree = ""; }; - FADF54141E3DA08E00012CC0 /* Image.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Image.cpp; sourceTree = ""; }; - FADF54151E3DA08E00012CC0 /* Image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Image.h; sourceTree = ""; }; - FADF54191E3DA46C00012CC0 /* wrap_Image.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Image.cpp; sourceTree = ""; }; - FADF541A1E3DA46C00012CC0 /* wrap_Image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Image.h; sourceTree = ""; }; - FADF541E1E3DA52C00012CC0 /* wrap_ParticleSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_ParticleSystem.cpp; sourceTree = ""; }; - FADF541F1E3DA52C00012CC0 /* wrap_ParticleSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_ParticleSystem.h; sourceTree = ""; }; - FADF54231E3DA5BA00012CC0 /* Mesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Mesh.cpp; sourceTree = ""; }; - FADF54241E3DA5BA00012CC0 /* Mesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Mesh.h; sourceTree = ""; }; - FADF54281E3DAADA00012CC0 /* wrap_Mesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Mesh.cpp; sourceTree = ""; }; - FADF54291E3DAADA00012CC0 /* wrap_Mesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Mesh.h; sourceTree = ""; }; - FADF542D1E3DABF600012CC0 /* SpriteBatch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpriteBatch.cpp; sourceTree = ""; }; - FADF542E1E3DABF600012CC0 /* SpriteBatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpriteBatch.h; sourceTree = ""; }; - FADF54321E3DAE6E00012CC0 /* wrap_SpriteBatch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_SpriteBatch.cpp; sourceTree = ""; }; - FADF54331E3DAE6E00012CC0 /* wrap_SpriteBatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_SpriteBatch.h; sourceTree = ""; }; - FADF54371E3DAFBA00012CC0 /* wrap_Graphics.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = wrap_Graphics.lua; sourceTree = ""; }; - FADF54391E3DAFF700012CC0 /* wrap_Graphics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Graphics.cpp; sourceTree = ""; }; - FADF543A1E3DAFF700012CC0 /* wrap_Graphics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Graphics.h; sourceTree = ""; }; - FAE272501C05A15B00A67640 /* ParticleSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParticleSystem.cpp; sourceTree = ""; }; - FAE272511C05A15B00A67640 /* ParticleSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParticleSystem.h; sourceTree = ""; }; - FAE64A7D2071359C00BC7981 /* libfreetype.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libfreetype.a; sourceTree = ""; }; - FAECA1B01F3164700095D008 /* CompressedSlice.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CompressedSlice.cpp; sourceTree = ""; }; - FAECA1B11F3164700095D008 /* CompressedSlice.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CompressedSlice.h; sourceTree = ""; }; - FAF13FC21E20934C00F898D2 /* CodeGen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CodeGen.cpp; sourceTree = ""; }; - FAF13FC31E20934C00F898D2 /* Link.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Link.cpp; sourceTree = ""; }; - FAF13FC51E20934C00F898D2 /* arrays.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = arrays.h; sourceTree = ""; }; - FAF13FC61E20934C00F898D2 /* BaseTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseTypes.h; sourceTree = ""; }; - FAF13FC71E20934C00F898D2 /* Common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Common.h; sourceTree = ""; }; - FAF13FC81E20934C00F898D2 /* ConstantUnion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConstantUnion.h; sourceTree = ""; }; - FAF13FC91E20934C00F898D2 /* InfoSink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InfoSink.h; sourceTree = ""; }; - FAF13FCA1E20934C00F898D2 /* InitializeGlobals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InitializeGlobals.h; sourceTree = ""; }; - FAF13FCB1E20934C00F898D2 /* intermediate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = intermediate.h; sourceTree = ""; }; - FAF13FCC1E20934C00F898D2 /* PoolAlloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PoolAlloc.h; sourceTree = ""; }; - FAF13FCD1E20934C00F898D2 /* ResourceLimits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLimits.h; sourceTree = ""; }; - FAF13FCE1E20934C00F898D2 /* revision.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = revision.h; sourceTree = ""; }; - FAF13FD01E20934C00F898D2 /* ShHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShHandle.h; sourceTree = ""; }; - FAF13FD11E20934C00F898D2 /* Types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Types.h; sourceTree = ""; }; - FAF13FD31E20934C00F898D2 /* Constant.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Constant.cpp; sourceTree = ""; }; - FAF13FD41E20934C00F898D2 /* gl_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gl_types.h; sourceTree = ""; }; - FAF13FD61E20934C00F898D2 /* glslang_tab.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glslang_tab.cpp; sourceTree = ""; }; - FAF13FD71E20934C00F898D2 /* glslang_tab.cpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glslang_tab.cpp.h; sourceTree = ""; }; - FAF13FD81E20934C00F898D2 /* InfoSink.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InfoSink.cpp; sourceTree = ""; }; - FAF13FD91E20934C00F898D2 /* Initialize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Initialize.cpp; sourceTree = ""; }; - FAF13FDA1E20934C00F898D2 /* Initialize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Initialize.h; sourceTree = ""; }; - FAF13FDB1E20934C00F898D2 /* Intermediate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Intermediate.cpp; sourceTree = ""; }; - FAF13FDC1E20934C00F898D2 /* intermOut.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = intermOut.cpp; sourceTree = ""; }; - FAF13FDD1E20934C00F898D2 /* IntermTraverse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntermTraverse.cpp; sourceTree = ""; }; - FAF13FDE1E20934C00F898D2 /* iomapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = iomapper.cpp; sourceTree = ""; }; - FAF13FDF1E20934C00F898D2 /* iomapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iomapper.h; sourceTree = ""; }; - FAF13FE01E20934C00F898D2 /* limits.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = limits.cpp; sourceTree = ""; }; - FAF13FE11E20934C00F898D2 /* linkValidate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = linkValidate.cpp; sourceTree = ""; }; - FAF13FE21E20934C00F898D2 /* LiveTraverser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LiveTraverser.h; sourceTree = ""; }; - FAF13FE31E20934C00F898D2 /* localintermediate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = localintermediate.h; sourceTree = ""; }; - FAF13FE41E20934C00F898D2 /* parseConst.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = parseConst.cpp; sourceTree = ""; }; - FAF13FE51E20934C00F898D2 /* ParseContextBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParseContextBase.cpp; sourceTree = ""; }; - FAF13FE61E20934C00F898D2 /* ParseHelper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParseHelper.cpp; sourceTree = ""; }; - FAF13FE71E20934C00F898D2 /* ParseHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParseHelper.h; sourceTree = ""; }; - FAF13FE81E20934C00F898D2 /* parseVersions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = parseVersions.h; sourceTree = ""; }; - FAF13FE91E20934C00F898D2 /* PoolAlloc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PoolAlloc.cpp; sourceTree = ""; }; - FAF13FEB1E20934C00F898D2 /* Pp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Pp.cpp; sourceTree = ""; }; - FAF13FEC1E20934C00F898D2 /* PpAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PpAtom.cpp; sourceTree = ""; }; - FAF13FED1E20934C00F898D2 /* PpContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PpContext.cpp; sourceTree = ""; }; - FAF13FEE1E20934C00F898D2 /* PpContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PpContext.h; sourceTree = ""; }; - FAF13FF01E20934C00F898D2 /* PpScanner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PpScanner.cpp; sourceTree = ""; }; - FAF13FF21E20934C00F898D2 /* PpTokens.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PpTokens.cpp; sourceTree = ""; }; - FAF13FF31E20934C00F898D2 /* PpTokens.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PpTokens.h; sourceTree = ""; }; - FAF13FF41E20934C00F898D2 /* propagateNoContraction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = propagateNoContraction.cpp; sourceTree = ""; }; - FAF13FF51E20934C00F898D2 /* propagateNoContraction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = propagateNoContraction.h; sourceTree = ""; }; - FAF13FF61E20934C00F898D2 /* reflection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = reflection.cpp; sourceTree = ""; }; - FAF13FF71E20934C00F898D2 /* reflection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reflection.h; sourceTree = ""; }; - FAF13FF81E20934C00F898D2 /* RemoveTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoveTree.cpp; sourceTree = ""; }; - FAF13FF91E20934C00F898D2 /* RemoveTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoveTree.h; sourceTree = ""; }; - FAF13FFA1E20934C00F898D2 /* Scan.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Scan.cpp; sourceTree = ""; }; - FAF13FFB1E20934C00F898D2 /* Scan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Scan.h; sourceTree = ""; }; - FAF13FFC1E20934C00F898D2 /* ScanContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScanContext.h; sourceTree = ""; }; - FAF13FFD1E20934C00F898D2 /* ShaderLang.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShaderLang.cpp; sourceTree = ""; }; - FAF13FFE1E20934C00F898D2 /* SymbolTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolTable.cpp; sourceTree = ""; }; - FAF13FFF1E20934C00F898D2 /* SymbolTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolTable.h; sourceTree = ""; }; - FAF140001E20934C00F898D2 /* Versions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Versions.cpp; sourceTree = ""; }; - FAF140011E20934C00F898D2 /* Versions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Versions.h; sourceTree = ""; }; - FAF140031E20934C00F898D2 /* osinclude.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = osinclude.h; sourceTree = ""; }; - FAF140211E20934C00F898D2 /* ossource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ossource.cpp; sourceTree = ""; }; - FAF140291E20934C00F898D2 /* ShaderLang.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShaderLang.h; sourceTree = ""; }; - FAF1403B1E20934C00F898D2 /* InitializeDll.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InitializeDll.cpp; sourceTree = ""; }; - FAF1403C1E20934C00F898D2 /* InitializeDll.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InitializeDll.h; sourceTree = ""; }; - FAF1889C1E9DA834008C1479 /* Optional.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Optional.h; sourceTree = ""; }; - FAF1889D1E9DBBC8008C1479 /* depthstencil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = depthstencil.h; sourceTree = ""; }; - FAF1889E1E9DBC4B008C1479 /* depthstencil.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = depthstencil.cpp; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - FA0B78DA1A958B90000E1D17 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA5D24B51A96D2EC00C6FC8F /* libvorbis.a in Frameworks */, - FAE64A7F207135AD00BC7981 /* libfreetype.a in Frameworks */, - FA5D24B31A96D2EC00C6FC8F /* libogg.a in Frameworks */, - FA59A2D81C0649C200328DBA /* libtheora.a in Frameworks */, - FA56D9BC1C208A0200D8D3C7 /* libmodplug.a in Frameworks */, - FA7550A81AEBE276003E311E /* libluajit.a in Frameworks */, - FA5D24CF1A96E68300C6FC8F /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - FA577AAB16C7507900860150 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA27B3C91B498623008A9DCE /* theora.framework in Frameworks */, - FA317EBA18F28B6D00B0BCD7 /* libz.dylib in Frameworks */, - FAA627CE18E7E1560080752D /* CoreServices.framework in Frameworks */, - FA9B4A0816E1578300074F42 /* SDL2.framework in Frameworks */, - FAAFF04416CB11C700CCDE45 /* OpenAL-Soft.framework in Frameworks */, - FAD43ECC1FF312D800831BB8 /* freetype.framework in Frameworks */, - FA577AB016C7507900860150 /* Cocoa.framework in Frameworks */, - FA577AC516C7513400860150 /* libmodplug.framework in Frameworks */, - FA577AC716C7513A00860150 /* mpg123.framework in Frameworks */, - FA577AC816C7513C00860150 /* ogg.framework in Frameworks */, - FA577ACA16C7514100860150 /* OpenGL.framework in Frameworks */, - FA577ACD16C7514C00860150 /* vorbis.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 2F654C0235EB60C744A22507 /* Products */ = { - isa = PBXGroup; - children = ( - FA577AAF16C7507900860150 /* love.framework */, - FA0B78DD1A958B90000E1D17 /* liblove.a */, - ); - name = Products; - sourceTree = ""; - }; - 352E6C5F6F8A681766EB5299 /* scripts */ = { - isa = PBXGroup; - children = ( - FA577A8C16C71D3600860150 /* auto.lua */, - FA577A8D16C71D3600860150 /* boot.lua */, - 503971A86B7167A91B670FBA /* boot.lua.h */, - FA283EDC1B27CFAA00C70067 /* nogame.lua */, - FA283EDD1B27CFAA00C70067 /* nogame.lua.h */, - ); - name = scripts; - path = ../../src/scripts; - sourceTree = ""; - }; - 54067CFB7D564E5764FA17DC /* love */ = { - isa = PBXGroup; - children = ( - FA0B78F61A958E3B000E1D17 /* common */, - FA0B794D1A958EA3000E1D17 /* libraries */, - FA0B7B3C1A95902C000E1D17 /* modules */, - 352E6C5F6F8A681766EB5299 /* scripts */, - FA577A6616C7199700860150 /* Frameworks */, - FA5D24A11A96D24500C6FC8F /* Libraries */, - FA08F5AC16C751BA00F007B5 /* Resources */, - 2F654C0235EB60C744A22507 /* Products */, - ); - name = love; - sourceTree = ""; - usesTabs = 1; - }; - FA08F5AC16C751BA00F007B5 /* Resources */ = { - isa = PBXGroup; - children = ( - FA08F5AE16C7525600F007B5 /* liblove-macosx.plist */, - ); - name = Resources; - sourceTree = ""; - }; - FA0B78F61A958E3B000E1D17 /* common */ = { - isa = PBXGroup; - children = ( - FAA3A9AC1B7D465A00CED060 /* android.cpp */, - FAA3A9AD1B7D465A00CED060 /* android.h */, - FA0B78F71A958E3B000E1D17 /* b64.cpp */, - FA0B78F81A958E3B000E1D17 /* b64.h */, - FA6BDE5B1F31725300786805 /* Color.h */, - FA0B78F91A958E3B000E1D17 /* config.h */, - FA9D8DD41DEF8411002CD881 /* Data.cpp */, - FA0B78FA1A958E3B000E1D17 /* Data.h */, - FA0B78FB1A958E3B000E1D17 /* delay.cpp */, - FA0B78FC1A958E3B000E1D17 /* delay.h */, - FA91DA891F377C3900C80E33 /* deprecation.cpp */, - FA91DA8A1F377C3900C80E33 /* deprecation.h */, - FA0B78FD1A958E3B000E1D17 /* EnumMap.h */, - FA0B78FE1A958E3B000E1D17 /* Exception.cpp */, - FA0B78FF1A958E3B000E1D17 /* Exception.h */, - FA91591C1CF1ED7500A7053F /* halffloat.cpp */, - FA91591D1CF1ED7500A7053F /* halffloat.h */, - FA0B79001A958E3B000E1D17 /* int.h */, - FA0B7EF01A959D2C000E1D17 /* ios.h */, - FA0B7EF11A959D2C000E1D17 /* ios.mm */, - FA0B790A1A958E3B000E1D17 /* macosx.h */, - FA0B790B1A958E3B000E1D17 /* macosx.mm */, - FA0B79011A958E3B000E1D17 /* math.h */, - FA0B79021A958E3B000E1D17 /* Matrix.cpp */, - FA0B79031A958E3B000E1D17 /* Matrix.h */, - FA0B79041A958E3B000E1D17 /* Memoizer.cpp */, - FA0B79051A958E3B000E1D17 /* Memoizer.h */, - FA56AA361FAFF02000A43D5F /* memory.cpp */, - FA56AA371FAFF02000A43D5F /* memory.h */, - FA0B79061A958E3B000E1D17 /* Module.cpp */, - FA0B79071A958E3B000E1D17 /* Module.h */, - FA0B79081A958E3B000E1D17 /* Object.cpp */, - FA0B79091A958E3B000E1D17 /* Object.h */, - FAF1889C1E9DA834008C1479 /* Optional.h */, - FA9D8DCF1DEB56C3002CD881 /* pixelformat.cpp */, - FA9D8DD01DEB56C3002CD881 /* pixelformat.h */, - FA0B790C1A958E3B000E1D17 /* Reference.cpp */, - FA0B790D1A958E3B000E1D17 /* Reference.h */, - FA0B790E1A958E3B000E1D17 /* runtime.cpp */, - FA0B790F1A958E3B000E1D17 /* runtime.h */, - FA9D8DD51DEF8411002CD881 /* Stream.cpp */, - FA9D8DD61DEF8411002CD881 /* Stream.h */, - FA15DFAB1F9B8C850042AB22 /* StringMap.cpp */, - FA0B79101A958E3B000E1D17 /* StringMap.h */, - FA620A391AA305F6005DB4C2 /* types.cpp */, - FA0B79111A958E3B000E1D17 /* types.h */, - FA0B79121A958E3B000E1D17 /* utf8.cpp */, - FA0B79131A958E3B000E1D17 /* utf8.h */, - FA0B79141A958E3B000E1D17 /* Variant.cpp */, - FA0B79151A958E3B000E1D17 /* Variant.h */, - FA0B79161A958E3B000E1D17 /* Vector.cpp */, - FA0B79171A958E3B000E1D17 /* Vector.h */, - FA0B79181A958E3B000E1D17 /* version.h */, - ); - name = common; - path = ../../src/common; - sourceTree = ""; - }; - FA0B794D1A958EA3000E1D17 /* libraries */ = { - isa = PBXGroup; - children = ( - FA0B794E1A958EA3000E1D17 /* Box2D */, - FA0B79B41A958EA3000E1D17 /* ddsparse */, - FA0B79B81A958EA3000E1D17 /* enet */, - FA0B79D31A958EA3000E1D17 /* glad */, - FAF13FBF1E20934C00F898D2 /* glslang */, - FA0B79D81A958EA3000E1D17 /* lodepng */, - FAAA3FD21F64B3AD00F89E99 /* lua53 */, - FA0B79DB1A958EA3000E1D17 /* luasocket */, - FAB17BE31ABFAA9000F9BA27 /* lz4 */, - FA0B7A141A958EA3000E1D17 /* noise1234 */, - FAC7CD591FE35E95006A60C7 /* physfs */, - FA0B7A171A958EA3000E1D17 /* stb */, - FA1557BE1CE90A2C00AFF582 /* tinyexr */, - FA0B7A191A958EA3000E1D17 /* utf8 */, - FA0B7A1F1A958EA3000E1D17 /* Wuff */, - FA4F2B761DE0125B00CA37D7 /* xxHash */, - ); - name = libraries; - path = ../../src/libraries; - sourceTree = ""; - }; - FA0B794E1A958EA3000E1D17 /* Box2D */ = { - isa = PBXGroup; - children = ( - FA0B794F1A958EA3000E1D17 /* Box2D.h */, - FA0B79501A958EA3000E1D17 /* Collision */, - FA0B79681A958EA3000E1D17 /* Common */, - FA0B79761A958EA3000E1D17 /* Dynamics */, - FA0B79B11A958EA3000E1D17 /* Rope */, - ); - path = Box2D; - sourceTree = ""; - }; - FA0B79501A958EA3000E1D17 /* Collision */ = { - isa = PBXGroup; - children = ( - FA0B79511A958EA3000E1D17 /* b2BroadPhase.cpp */, - FA0B79521A958EA3000E1D17 /* b2BroadPhase.h */, - FA0B79531A958EA3000E1D17 /* b2CollideCircle.cpp */, - FA0B79541A958EA3000E1D17 /* b2CollideEdge.cpp */, - FA0B79551A958EA3000E1D17 /* b2CollidePolygon.cpp */, - FA0B79561A958EA3000E1D17 /* b2Collision.cpp */, - FA0B79571A958EA3000E1D17 /* b2Collision.h */, - FA0B79581A958EA3000E1D17 /* b2Distance.cpp */, - FA0B79591A958EA3000E1D17 /* b2Distance.h */, - FA0B795A1A958EA3000E1D17 /* b2DynamicTree.cpp */, - FA0B795B1A958EA3000E1D17 /* b2DynamicTree.h */, - FA0B795C1A958EA3000E1D17 /* b2TimeOfImpact.cpp */, - FA0B795D1A958EA3000E1D17 /* b2TimeOfImpact.h */, - FA0B795E1A958EA3000E1D17 /* Shapes */, - ); - path = Collision; - sourceTree = ""; - }; - FA0B795E1A958EA3000E1D17 /* Shapes */ = { - isa = PBXGroup; - children = ( - FA0B795F1A958EA3000E1D17 /* b2ChainShape.cpp */, - FA0B79601A958EA3000E1D17 /* b2ChainShape.h */, - FA0B79611A958EA3000E1D17 /* b2CircleShape.cpp */, - FA0B79621A958EA3000E1D17 /* b2CircleShape.h */, - FA0B79631A958EA3000E1D17 /* b2EdgeShape.cpp */, - FA0B79641A958EA3000E1D17 /* b2EdgeShape.h */, - FA0B79651A958EA3000E1D17 /* b2PolygonShape.cpp */, - FA0B79661A958EA3000E1D17 /* b2PolygonShape.h */, - FA0B79671A958EA3000E1D17 /* b2Shape.h */, - ); - path = Shapes; - sourceTree = ""; - }; - FA0B79681A958EA3000E1D17 /* Common */ = { - isa = PBXGroup; - children = ( - FA0B79691A958EA3000E1D17 /* b2BlockAllocator.cpp */, - FA0B796A1A958EA3000E1D17 /* b2BlockAllocator.h */, - FA0B796B1A958EA3000E1D17 /* b2Draw.cpp */, - FA0B796C1A958EA3000E1D17 /* b2Draw.h */, - FA0B796D1A958EA3000E1D17 /* b2GrowableStack.h */, - FA0B796E1A958EA3000E1D17 /* b2Math.cpp */, - FA0B796F1A958EA3000E1D17 /* b2Math.h */, - FA0B79701A958EA3000E1D17 /* b2Settings.cpp */, - FA0B79711A958EA3000E1D17 /* b2Settings.h */, - FA0B79721A958EA3000E1D17 /* b2StackAllocator.cpp */, - FA0B79731A958EA3000E1D17 /* b2StackAllocator.h */, - FA0B79741A958EA3000E1D17 /* b2Timer.cpp */, - FA0B79751A958EA3000E1D17 /* b2Timer.h */, - ); - path = Common; - sourceTree = ""; - }; - FA0B79761A958EA3000E1D17 /* Dynamics */ = { - isa = PBXGroup; - children = ( - FA0B79771A958EA3000E1D17 /* b2Body.cpp */, - FA0B79781A958EA3000E1D17 /* b2Body.h */, - FA0B79791A958EA3000E1D17 /* b2ContactManager.cpp */, - FA0B797A1A958EA3000E1D17 /* b2ContactManager.h */, - FA0B797B1A958EA3000E1D17 /* b2Fixture.cpp */, - FA0B797C1A958EA3000E1D17 /* b2Fixture.h */, - FA0B797D1A958EA3000E1D17 /* b2Island.cpp */, - FA0B797E1A958EA3000E1D17 /* b2Island.h */, - FA0B797F1A958EA3000E1D17 /* b2TimeStep.h */, - FA0B79801A958EA3000E1D17 /* b2World.cpp */, - FA0B79811A958EA3000E1D17 /* b2World.h */, - FA0B79821A958EA3000E1D17 /* b2WorldCallbacks.cpp */, - FA0B79831A958EA3000E1D17 /* b2WorldCallbacks.h */, - FA0B79841A958EA3000E1D17 /* Contacts */, - FA0B79971A958EA3000E1D17 /* Joints */, - ); - path = Dynamics; - sourceTree = ""; - }; - FA0B79841A958EA3000E1D17 /* Contacts */ = { - isa = PBXGroup; - children = ( - FA0B79851A958EA3000E1D17 /* b2ChainAndCircleContact.cpp */, - FA0B79861A958EA3000E1D17 /* b2ChainAndCircleContact.h */, - FA0B79871A958EA3000E1D17 /* b2ChainAndPolygonContact.cpp */, - FA0B79881A958EA3000E1D17 /* b2ChainAndPolygonContact.h */, - FA0B79891A958EA3000E1D17 /* b2CircleContact.cpp */, - FA0B798A1A958EA3000E1D17 /* b2CircleContact.h */, - FA0B798B1A958EA3000E1D17 /* b2Contact.cpp */, - FA0B798C1A958EA3000E1D17 /* b2Contact.h */, - FA0B798D1A958EA3000E1D17 /* b2ContactSolver.cpp */, - FA0B798E1A958EA3000E1D17 /* b2ContactSolver.h */, - FA0B798F1A958EA3000E1D17 /* b2EdgeAndCircleContact.cpp */, - FA0B79901A958EA3000E1D17 /* b2EdgeAndCircleContact.h */, - FA0B79911A958EA3000E1D17 /* b2EdgeAndPolygonContact.cpp */, - FA0B79921A958EA3000E1D17 /* b2EdgeAndPolygonContact.h */, - FA0B79931A958EA3000E1D17 /* b2PolygonAndCircleContact.cpp */, - FA0B79941A958EA3000E1D17 /* b2PolygonAndCircleContact.h */, - FA0B79951A958EA3000E1D17 /* b2PolygonContact.cpp */, - FA0B79961A958EA3000E1D17 /* b2PolygonContact.h */, - ); - path = Contacts; - sourceTree = ""; - }; - FA0B79971A958EA3000E1D17 /* Joints */ = { - isa = PBXGroup; - children = ( - FA0B79981A958EA3000E1D17 /* b2DistanceJoint.cpp */, - FA0B79991A958EA3000E1D17 /* b2DistanceJoint.h */, - FA0B799A1A958EA3000E1D17 /* b2FrictionJoint.cpp */, - FA0B799B1A958EA3000E1D17 /* b2FrictionJoint.h */, - FA0B799C1A958EA3000E1D17 /* b2GearJoint.cpp */, - FA0B799D1A958EA3000E1D17 /* b2GearJoint.h */, - FA0B799E1A958EA3000E1D17 /* b2Joint.cpp */, - FA0B799F1A958EA3000E1D17 /* b2Joint.h */, - FA0B79A01A958EA3000E1D17 /* b2MotorJoint.cpp */, - FA0B79A11A958EA3000E1D17 /* b2MotorJoint.h */, - FA0B79A21A958EA3000E1D17 /* b2MouseJoint.cpp */, - FA0B79A31A958EA3000E1D17 /* b2MouseJoint.h */, - FA0B79A41A958EA3000E1D17 /* b2PrismaticJoint.cpp */, - FA0B79A51A958EA3000E1D17 /* b2PrismaticJoint.h */, - FA0B79A61A958EA3000E1D17 /* b2PulleyJoint.cpp */, - FA0B79A71A958EA3000E1D17 /* b2PulleyJoint.h */, - FA0B79A81A958EA3000E1D17 /* b2RevoluteJoint.cpp */, - FA0B79A91A958EA3000E1D17 /* b2RevoluteJoint.h */, - FA0B79AA1A958EA3000E1D17 /* b2RopeJoint.cpp */, - FA0B79AB1A958EA3000E1D17 /* b2RopeJoint.h */, - FA0B79AC1A958EA3000E1D17 /* b2WeldJoint.cpp */, - FA0B79AD1A958EA3000E1D17 /* b2WeldJoint.h */, - FA0B79AE1A958EA3000E1D17 /* b2WheelJoint.cpp */, - FA0B79AF1A958EA3000E1D17 /* b2WheelJoint.h */, - ); - path = Joints; - sourceTree = ""; - }; - FA0B79B11A958EA3000E1D17 /* Rope */ = { - isa = PBXGroup; - children = ( - FA0B79B21A958EA3000E1D17 /* b2Rope.cpp */, - FA0B79B31A958EA3000E1D17 /* b2Rope.h */, - ); - path = Rope; - sourceTree = ""; - }; - FA0B79B41A958EA3000E1D17 /* ddsparse */ = { - isa = PBXGroup; - children = ( - FA0B79B51A958EA3000E1D17 /* ddsinfo.h */, - FA0B79B61A958EA3000E1D17 /* ddsparse.cpp */, - FA0B79B71A958EA3000E1D17 /* ddsparse.h */, - ); - path = ddsparse; - sourceTree = ""; - }; - FA0B79B81A958EA3000E1D17 /* enet */ = { - isa = PBXGroup; - children = ( - FA0B79B91A958EA3000E1D17 /* enet.cpp */, - FA0B79BA1A958EA3000E1D17 /* libenet */, - FA0B79D21A958EA3000E1D17 /* lua-enet.h */, - ); - path = enet; - sourceTree = ""; - }; - FA0B79BA1A958EA3000E1D17 /* libenet */ = { - isa = PBXGroup; - children = ( - FA0B79BB1A958EA3000E1D17 /* callbacks.c */, - FA0B79BD1A958EA3000E1D17 /* compress.c */, - FA0B79BE1A958EA3000E1D17 /* host.c */, - FA0B79BF1A958EA3000E1D17 /* include */, - FA0B79CB1A958EA3000E1D17 /* list.c */, - FA0B79CC1A958EA3000E1D17 /* packet.c */, - FA0B79CD1A958EA3000E1D17 /* peer.c */, - FA0B79CE1A958EA3000E1D17 /* protocol.c */, - FA0B79D01A958EA3000E1D17 /* unix.c */, - FA0B79D11A958EA3000E1D17 /* win32.c */, - ); - path = libenet; - sourceTree = ""; - }; - FA0B79BF1A958EA3000E1D17 /* include */ = { - isa = PBXGroup; - children = ( - FA0B79C01A958EA3000E1D17 /* enet */, - ); - path = include; - sourceTree = ""; - }; - FA0B79C01A958EA3000E1D17 /* enet */ = { - isa = PBXGroup; - children = ( - FA0B79C11A958EA3000E1D17 /* callbacks.h */, - FA0B79C21A958EA3000E1D17 /* enet.h */, - FA0B79C31A958EA3000E1D17 /* list.h */, - FA0B79C41A958EA3000E1D17 /* protocol.h */, - FA0B79C51A958EA3000E1D17 /* time.h */, - FA0B79C61A958EA3000E1D17 /* types.h */, - FA0B79C71A958EA3000E1D17 /* unix.h */, - FA0B79C81A958EA3000E1D17 /* utility.h */, - FA0B79C91A958EA3000E1D17 /* win32.h */, - ); - path = enet; - sourceTree = ""; - }; - FA0B79D31A958EA3000E1D17 /* glad */ = { - isa = PBXGroup; - children = ( - FA0B79D41A958EA3000E1D17 /* glad.cpp */, - FA0B79D61A958EA3000E1D17 /* glad.hpp */, - FA0B79D71A958EA3000E1D17 /* gladfuncs.hpp */, - ); - path = glad; - sourceTree = ""; - }; - FA0B79D81A958EA3000E1D17 /* lodepng */ = { - isa = PBXGroup; - children = ( - FA0B79D91A958EA3000E1D17 /* lodepng.cpp */, - FA0B79DA1A958EA3000E1D17 /* lodepng.h */, - ); - path = lodepng; - sourceTree = ""; - }; - FA0B79DB1A958EA3000E1D17 /* luasocket */ = { - isa = PBXGroup; - children = ( - FA0B79DC1A958EA3000E1D17 /* libluasocket */, - FA0B7A0E1A958EA3000E1D17 /* luasocket.cpp */, - FA0B7A0F1A958EA3000E1D17 /* luasocket.h */, - ); - path = luasocket; - sourceTree = ""; - }; - FA0B79DC1A958EA3000E1D17 /* libluasocket */ = { - isa = PBXGroup; - children = ( - 217DFB9D1D9F6D490055D849 /* auxiliar.c */, - 217DFB9E1D9F6D490055D849 /* auxiliar.h */, - 217DFB9F1D9F6D490055D849 /* buffer.c */, - 217DFBA01D9F6D490055D849 /* buffer.h */, - 217DFBA11D9F6D490055D849 /* compat.c */, - 217DFBA21D9F6D490055D849 /* compat.h */, - 217DFBA31D9F6D490055D849 /* except.c */, - 217DFBA41D9F6D490055D849 /* except.h */, - 217DFBA51D9F6D490055D849 /* ftp.lua */, - 217DFBA61D9F6D490055D849 /* ftp.lua.h */, - 217DFBA71D9F6D490055D849 /* headers.lua */, - 217DFBA81D9F6D490055D849 /* headers.lua.h */, - 217DFBA91D9F6D490055D849 /* http.lua */, - 217DFBAA1D9F6D490055D849 /* http.lua.h */, - 217DFBAB1D9F6D490055D849 /* inet.c */, - 217DFBAC1D9F6D490055D849 /* inet.h */, - 217DFBAD1D9F6D490055D849 /* io.c */, - 217DFBAE1D9F6D490055D849 /* io.h */, - 217DFBAF1D9F6D490055D849 /* ltn12.lua */, - 217DFBB01D9F6D490055D849 /* ltn12.lua.h */, - 217DFBB11D9F6D490055D849 /* luasocket.c */, - 217DFBB21D9F6D490055D849 /* luasocket.h */, - 217DFBB41D9F6D490055D849 /* mbox.lua */, - 217DFBB51D9F6D490055D849 /* mbox.lua.h */, - 217DFBB61D9F6D490055D849 /* mime.c */, - 217DFBB71D9F6D490055D849 /* mime.h */, - 217DFBB81D9F6D490055D849 /* mime.lua */, - 217DFBB91D9F6D490055D849 /* mime.lua.h */, - 217DFBBA1D9F6D490055D849 /* options.c */, - 217DFBBB1D9F6D490055D849 /* options.h */, - 217DFBBC1D9F6D490055D849 /* pierror.h */, - 217DFBBD1D9F6D490055D849 /* select.c */, - 217DFBBE1D9F6D490055D849 /* select.h */, - 217DFBBF1D9F6D490055D849 /* serial.c */, - 217DFBC01D9F6D490055D849 /* smtp.lua */, - 217DFBC11D9F6D490055D849 /* smtp.lua.h */, - 217DFBC21D9F6D490055D849 /* socket.h */, - 217DFBC31D9F6D490055D849 /* socket.lua */, - 217DFBC41D9F6D490055D849 /* socket.lua.h */, - 217DFBC51D9F6D490055D849 /* tcp.c */, - 217DFBC61D9F6D490055D849 /* tcp.h */, - 217DFBC71D9F6D490055D849 /* timeout.c */, - 217DFBC81D9F6D490055D849 /* timeout.h */, - 217DFBC91D9F6D490055D849 /* tp.lua */, - 217DFBCA1D9F6D490055D849 /* tp.lua.h */, - 217DFBCB1D9F6D490055D849 /* udp.c */, - 217DFBCC1D9F6D490055D849 /* udp.h */, - 217DFBCD1D9F6D490055D849 /* unix.c */, - 217DFBCE1D9F6D490055D849 /* unix.h */, - 217DFBCF1D9F6D490055D849 /* unixtcp.c */, - 217DFBD01D9F6D490055D849 /* unixtcp.h */, - 217DFBD11D9F6D490055D849 /* unixudp.c */, - 217DFBD21D9F6D490055D849 /* unixudp.h */, - 217DFBD31D9F6D490055D849 /* url.lua */, - 217DFBD41D9F6D490055D849 /* url.lua.h */, - 217DFBD51D9F6D490055D849 /* usocket.c */, - 217DFBD61D9F6D490055D849 /* usocket.h */, - ); - path = libluasocket; - sourceTree = ""; - }; - FA0B7A141A958EA3000E1D17 /* noise1234 */ = { - isa = PBXGroup; - children = ( - FA57FB961AE1993600F2AD6D /* noise1234.cpp */, - FA57FB971AE1993600F2AD6D /* noise1234.h */, - FA0B7A151A958EA3000E1D17 /* simplexnoise1234.cpp */, - FA0B7A161A958EA3000E1D17 /* simplexnoise1234.h */, - ); - path = noise1234; - sourceTree = ""; - }; - FA0B7A171A958EA3000E1D17 /* stb */ = { - isa = PBXGroup; - children = ( - FA0B7A181A958EA3000E1D17 /* stb_image.h */, - ); - path = stb; - sourceTree = ""; - }; - FA0B7A191A958EA3000E1D17 /* utf8 */ = { - isa = PBXGroup; - children = ( - FA0B7A1A1A958EA3000E1D17 /* utf8 */, - FA0B7A1E1A958EA3000E1D17 /* utf8.h */, - ); - path = utf8; - sourceTree = ""; - }; - FA0B7A1A1A958EA3000E1D17 /* utf8 */ = { - isa = PBXGroup; - children = ( - FA0B7A1B1A958EA3000E1D17 /* checked.h */, - FA0B7A1C1A958EA3000E1D17 /* core.h */, - FA0B7A1D1A958EA3000E1D17 /* unchecked.h */, - ); - path = utf8; - sourceTree = ""; - }; - FA0B7A1F1A958EA3000E1D17 /* Wuff */ = { - isa = PBXGroup; - children = ( - FA0B7A201A958EA3000E1D17 /* wuff.c */, - FA0B7A211A958EA3000E1D17 /* wuff.h */, - FA0B7A221A958EA3000E1D17 /* wuff_config.h */, - FA0B7A231A958EA3000E1D17 /* wuff_convert.c */, - FA0B7A241A958EA3000E1D17 /* wuff_convert.h */, - FA0B7A251A958EA3000E1D17 /* wuff_internal.c */, - FA0B7A261A958EA3000E1D17 /* wuff_internal.h */, - FA0B7A271A958EA3000E1D17 /* wuff_memory.c */, - ); - path = Wuff; - sourceTree = ""; - }; - FA0B7B3C1A95902C000E1D17 /* modules */ = { - isa = PBXGroup; - children = ( - FA0B7B3D1A95902C000E1D17 /* audio */, - FACA02DF1F5E396B0084B28F /* data */, - FA0B7B521A95902C000E1D17 /* event */, - FA0B7B5A1A95902C000E1D17 /* filesystem */, - FA0B7B701A95902C000E1D17 /* font */, - FA0B7B871A95902C000E1D17 /* graphics */, - FA0B7BC21A95902C000E1D17 /* image */, - FA0B7BE81A95902C000E1D17 /* joystick */, - FA0B7BF51A95902C000E1D17 /* keyboard */, - FA0B7BFD1A95902C000E1D17 /* love */, - FA0B7C001A95902C000E1D17 /* math */, - FA0B7C0D1A95902C000E1D17 /* mouse */, - FA0B7C1B1A95902C000E1D17 /* physics */, - FA0B7C7B1A95902C000E1D17 /* sound */, - FA0B7C9A1A95902C000E1D17 /* system */, - FA0B7CA21A95902C000E1D17 /* thread */, - FA0B7CB71A95902C000E1D17 /* timer */, - FA0B7CBE1A95902C000E1D17 /* touch */, - FA27B3881B498151008A9DCE /* video */, - FA0B7CC51A95902C000E1D17 /* window */, - ); - name = modules; - path = ../../src/modules; - sourceTree = ""; - }; - FA0B7B3D1A95902C000E1D17 /* audio */ = { - isa = PBXGroup; - children = ( - FA0B7B3E1A95902C000E1D17 /* Audio.cpp */, - FA0B7B3F1A95902C000E1D17 /* Audio.h */, - FAC756F31E4F99B400B91289 /* Effect.cpp */, - FAC756F41E4F99B400B91289 /* Effect.h */, - FA1E887C1DF363CD00E808AA /* Filter.cpp */, - FA1E887D1DF363CD00E808AA /* Filter.h */, - FA0B7B401A95902C000E1D17 /* null */, - FA0B7B451A95902C000E1D17 /* openal */, - FA4F2BA21DE1E36400CA37D7 /* RecordingDevice.cpp */, - FA4F2BA31DE1E36400CA37D7 /* RecordingDevice.h */, - FA0B7B4C1A95902C000E1D17 /* Source.cpp */, - FA0B7B4D1A95902C000E1D17 /* Source.h */, - FA0B7B4E1A95902C000E1D17 /* wrap_Audio.cpp */, - FA0B7B4F1A95902C000E1D17 /* wrap_Audio.h */, - FA4F2BA41DE1E36400CA37D7 /* wrap_RecordingDevice.cpp */, - FA4F2BA51DE1E36400CA37D7 /* wrap_RecordingDevice.h */, - FA0B7B501A95902C000E1D17 /* wrap_Source.cpp */, - FA0B7B511A95902C000E1D17 /* wrap_Source.h */, - ); - path = audio; - sourceTree = ""; - }; - FA0B7B401A95902C000E1D17 /* null */ = { - isa = PBXGroup; - children = ( - FA0B7B411A95902C000E1D17 /* Audio.cpp */, - FA0B7B421A95902C000E1D17 /* Audio.h */, - FA4F2BAA1DE1E37000CA37D7 /* RecordingDevice.cpp */, - FA4F2BAB1DE1E37000CA37D7 /* RecordingDevice.h */, - FA0B7B431A95902C000E1D17 /* Source.cpp */, - FA0B7B441A95902C000E1D17 /* Source.h */, - ); - path = null; - sourceTree = ""; - }; - FA0B7B451A95902C000E1D17 /* openal */ = { - isa = PBXGroup; - children = ( - FA0B7B461A95902C000E1D17 /* Audio.cpp */, - FA0B7B471A95902C000E1D17 /* Audio.h */, - FAC756F81E4F99D200B91289 /* Effect.cpp */, - FAC756F91E4F99D200B91289 /* Effect.h */, - FA1E88811DF363DB00E808AA /* Filter.cpp */, - FA1E88821DF363DB00E808AA /* Filter.h */, - FA0B7B481A95902C000E1D17 /* Pool.cpp */, - FA0B7B491A95902C000E1D17 /* Pool.h */, - FA4F2BAE1DE1E37B00CA37D7 /* RecordingDevice.cpp */, - FA4F2BAF1DE1E37B00CA37D7 /* RecordingDevice.h */, - FA0B7B4A1A95902C000E1D17 /* Source.cpp */, - FA0B7B4B1A95902C000E1D17 /* Source.h */, - ); - path = openal; - sourceTree = ""; - }; - FA0B7B521A95902C000E1D17 /* event */ = { - isa = PBXGroup; - children = ( - FA0B7B531A95902C000E1D17 /* Event.cpp */, - FA0B7B541A95902C000E1D17 /* Event.h */, - FA0B7B551A95902C000E1D17 /* sdl */, - FA8951A01AA2EDF300EC385A /* wrap_Event.cpp */, - FA8951A11AA2EDF300EC385A /* wrap_Event.h */, - ); - path = event; - sourceTree = ""; - }; - FA0B7B551A95902C000E1D17 /* sdl */ = { - isa = PBXGroup; - children = ( - FA0B7B561A95902C000E1D17 /* Event.cpp */, - FA0B7B571A95902C000E1D17 /* Event.h */, - ); - path = sdl; - sourceTree = ""; - }; - FA0B7B5A1A95902C000E1D17 /* filesystem */ = { - isa = PBXGroup; - children = ( - FA0B7B5B1A95902C000E1D17 /* DroppedFile.cpp */, - FA0B7B5C1A95902C000E1D17 /* DroppedFile.h */, - FA0B7B5D1A95902C000E1D17 /* File.cpp */, - FA0B7B5E1A95902C000E1D17 /* File.h */, - FA0B7B5F1A95902C000E1D17 /* FileData.cpp */, - FA0B7B601A95902C000E1D17 /* FileData.h */, - FA0B7B611A95902C000E1D17 /* Filesystem.cpp */, - FA0B7B621A95902C000E1D17 /* Filesystem.h */, - FA0B7B631A95902C000E1D17 /* physfs */, - FA0B7B681A95902C000E1D17 /* wrap_DroppedFile.cpp */, - FA0B7B691A95902C000E1D17 /* wrap_DroppedFile.h */, - FA0B7B6A1A95902C000E1D17 /* wrap_File.cpp */, - FA0B7B6B1A95902C000E1D17 /* wrap_File.h */, - FA0B7B6C1A95902C000E1D17 /* wrap_FileData.cpp */, - FA0B7B6D1A95902C000E1D17 /* wrap_FileData.h */, - FA0B7B6E1A95902C000E1D17 /* wrap_Filesystem.cpp */, - FA0B7B6F1A95902C000E1D17 /* wrap_Filesystem.h */, - ); - path = filesystem; - sourceTree = ""; - }; - FA0B7B631A95902C000E1D17 /* physfs */ = { - isa = PBXGroup; - children = ( - FA0B7B641A95902C000E1D17 /* File.cpp */, - FA0B7B651A95902C000E1D17 /* File.h */, - FA0B7B661A95902C000E1D17 /* Filesystem.cpp */, - FA0B7B671A95902C000E1D17 /* Filesystem.h */, - ); - path = physfs; - sourceTree = ""; - }; - FA0B7B701A95902C000E1D17 /* font */ = { - isa = PBXGroup; - children = ( - FA0B7B711A95902C000E1D17 /* BMFontRasterizer.cpp */, - FA0B7B721A95902C000E1D17 /* BMFontRasterizer.h */, - FA0B7B731A95902C000E1D17 /* Font.cpp */, - FA0B7B741A95902C000E1D17 /* Font.h */, - FA0B7B751A95902C000E1D17 /* freetype */, - FA0B7B7A1A95902C000E1D17 /* GlyphData.cpp */, - FA0B7B7B1A95902C000E1D17 /* GlyphData.h */, - FA0B7B7C1A95902C000E1D17 /* ImageRasterizer.cpp */, - FA0B7B7D1A95902C000E1D17 /* ImageRasterizer.h */, - FA0B7B7E1A95902C000E1D17 /* Rasterizer.cpp */, - FA0B7B7F1A95902C000E1D17 /* Rasterizer.h */, - FAB2D5A81AABDD8A008224A4 /* TrueTypeRasterizer.cpp */, - FAB2D5A91AABDD8A008224A4 /* TrueTypeRasterizer.h */, - FA0B7B801A95902C000E1D17 /* Vera.ttf.h */, - FA0B7B811A95902C000E1D17 /* wrap_Font.cpp */, - FA0B7B821A95902C000E1D17 /* wrap_Font.h */, - FA0B7B831A95902C000E1D17 /* wrap_GlyphData.cpp */, - FA0B7B841A95902C000E1D17 /* wrap_GlyphData.h */, - FA0B7B851A95902C000E1D17 /* wrap_Rasterizer.cpp */, - FA0B7B861A95902C000E1D17 /* wrap_Rasterizer.h */, - ); - path = font; - sourceTree = ""; - }; - FA0B7B751A95902C000E1D17 /* freetype */ = { - isa = PBXGroup; - children = ( - FA0B7B761A95902C000E1D17 /* Font.cpp */, - FA0B7B771A95902C000E1D17 /* Font.h */, - FA0B7B781A95902C000E1D17 /* TrueTypeRasterizer.cpp */, - FA0B7B791A95902C000E1D17 /* TrueTypeRasterizer.h */, - ); - path = freetype; - sourceTree = ""; - }; - FA0B7B871A95902C000E1D17 /* graphics */ = { - isa = PBXGroup; - children = ( - FADF53F61E3C7ACD00012CC0 /* Buffer.cpp */, - FADF53F71E3C7ACD00012CC0 /* Buffer.h */, - FA1BA0A51E16F20600AA2803 /* Canvas.cpp */, - FA1BA0A61E16F20600AA2803 /* Canvas.h */, - FA9D53AA1F5307E900125C6B /* Deprecations.cpp */, - FA9D53AB1F5307E900125C6B /* Deprecations.h */, - FAF1889E1E9DBC4B008C1479 /* depthstencil.cpp */, - FAF1889D1E9DBBC8008C1479 /* depthstencil.h */, - FA9D8DDC1DEF842A002CD881 /* Drawable.cpp */, - FA0B7B891A95902C000E1D17 /* Drawable.h */, - FA1BA09B1E16CFCE00AA2803 /* Font.cpp */, - FA1BA09C1E16CFCE00AA2803 /* Font.h */, - FA0B7B8A1A95902C000E1D17 /* Graphics.cpp */, - FA0B7B8B1A95902C000E1D17 /* Graphics.h */, - FADF54141E3DA08E00012CC0 /* Image.cpp */, - FADF54151E3DA08E00012CC0 /* Image.h */, - FADF54231E3DA5BA00012CC0 /* Mesh.cpp */, - FADF54241E3DA5BA00012CC0 /* Mesh.h */, - FA0B7B8C1A95902C000E1D17 /* opengl */, - FAE272501C05A15B00A67640 /* ParticleSystem.cpp */, - FAE272511C05A15B00A67640 /* ParticleSystem.h */, - FA0B7B9B1A95902C000E1D17 /* Polyline.cpp */, - FA0B7B9C1A95902C000E1D17 /* Polyline.h */, - FA0B7BBC1A95902C000E1D17 /* Quad.cpp */, - FA0B7BBD1A95902C000E1D17 /* Quad.h */, - FA10DD7B1F9EC24E00E1FE3D /* Resource.h */, - FA1BA0AF1E16FD0800AA2803 /* Shader.cpp */, - FA1BA0B01E16FD0800AA2803 /* Shader.h */, - FA3C5E401F8C368C0003C579 /* ShaderStage.cpp */, - FA3C5E411F8C368C0003C579 /* ShaderStage.h */, - FADF542D1E3DABF600012CC0 /* SpriteBatch.cpp */, - FADF542E1E3DABF600012CC0 /* SpriteBatch.h */, - FA29C0041E12355B00268CD8 /* StreamBuffer.cpp */, - FA2AF6721DAD62710032B62C /* StreamBuffer.h */, - FADF53FB1E3D74F200012CC0 /* Text.cpp */, - FADF53FC1E3D74F200012CC0 /* Text.h */, - FA0B7BBE1A95902C000E1D17 /* Texture.cpp */, - FA0B7BBF1A95902C000E1D17 /* Texture.h */, - FA2AF6731DAD64970032B62C /* vertex.cpp */, - FA2AF6711DAC76FF0032B62C /* vertex.h */, - FADF54051E3D78F700012CC0 /* Video.cpp */, - FADF54061E3D78F700012CC0 /* Video.h */, - FA0B7BC01A95902C000E1D17 /* Volatile.cpp */, - FA0B7BC11A95902C000E1D17 /* Volatile.h */, - FA1BA0AA1E16F9EE00AA2803 /* wrap_Canvas.cpp */, - FA1BA0AB1E16F9EE00AA2803 /* wrap_Canvas.h */, - FA1BA0A01E16D97500AA2803 /* wrap_Font.cpp */, - FA1BA0A11E16D97500AA2803 /* wrap_Font.h */, - FADF54391E3DAFF700012CC0 /* wrap_Graphics.cpp */, - FADF543A1E3DAFF700012CC0 /* wrap_Graphics.h */, - FADF54371E3DAFBA00012CC0 /* wrap_Graphics.lua */, - FADF54191E3DA46C00012CC0 /* wrap_Image.cpp */, - FADF541A1E3DA46C00012CC0 /* wrap_Image.h */, - FADF54281E3DAADA00012CC0 /* wrap_Mesh.cpp */, - FADF54291E3DAADA00012CC0 /* wrap_Mesh.h */, - FADF541E1E3DA52C00012CC0 /* wrap_ParticleSystem.cpp */, - FADF541F1E3DA52C00012CC0 /* wrap_ParticleSystem.h */, - FA620A2E1AA2F8DB005DB4C2 /* wrap_Quad.cpp */, - FA620A2F1AA2F8DB005DB4C2 /* wrap_Quad.h */, - FA1BA0B51E17043400AA2803 /* wrap_Shader.cpp */, - FA1BA0B61E17043400AA2803 /* wrap_Shader.h */, - FADF54321E3DAE6E00012CC0 /* wrap_SpriteBatch.cpp */, - FADF54331E3DAE6E00012CC0 /* wrap_SpriteBatch.h */, - FADF54001E3D77B500012CC0 /* wrap_Text.cpp */, - FADF54011E3D77B500012CC0 /* wrap_Text.h */, - FA620A301AA2F8DB005DB4C2 /* wrap_Texture.cpp */, - FA620A311AA2F8DB005DB4C2 /* wrap_Texture.h */, - FADF540A1E3D7CDD00012CC0 /* wrap_Video.cpp */, - FADF540B1E3D7CDD00012CC0 /* wrap_Video.h */, - FADF540C1E3D7CDD00012CC0 /* wrap_Video.lua */, - ); - path = graphics; - sourceTree = ""; - }; - FA0B7B8C1A95902C000E1D17 /* opengl */ = { - isa = PBXGroup; - children = ( - FA0B7BA41A95902C000E1D17 /* Buffer.cpp */, - FA0B7BA51A95902C000E1D17 /* Buffer.h */, - FA0B7B8D1A95902C000E1D17 /* Canvas.cpp */, - FA0B7B8E1A95902C000E1D17 /* Canvas.h */, - FA28EBD31E352DB5003446F4 /* FenceSync.cpp */, - FA28EBD41E352DB5003446F4 /* FenceSync.h */, - FA0B7B911A95902C000E1D17 /* Graphics.cpp */, - FA0B7B921A95902C000E1D17 /* Graphics.h */, - FA0B7B931A95902C000E1D17 /* Image.cpp */, - FA0B7B941A95902C000E1D17 /* Image.h */, - FA0B7B971A95902C000E1D17 /* OpenGL.cpp */, - FA0B7B981A95902C000E1D17 /* OpenGL.h */, - FA0B7B9D1A95902C000E1D17 /* Shader.cpp */, - FA0B7B9E1A95902C000E1D17 /* Shader.h */, - FA3C5E451F8D80CA0003C579 /* ShaderStage.cpp */, - FA3C5E461F8D80CA0003C579 /* ShaderStage.h */, - FA7634481E28722A0066EF9E /* StreamBuffer.cpp */, - FA7634491E28722A0066EF9E /* StreamBuffer.h */, - ); - path = opengl; - sourceTree = ""; - }; - FA0B7BC21A95902C000E1D17 /* image */ = { - isa = PBXGroup; - children = ( - FA0B7BC31A95902C000E1D17 /* CompressedImageData.cpp */, - FA0B7BC41A95902C000E1D17 /* CompressedImageData.h */, - FAECA1B01F3164700095D008 /* CompressedSlice.cpp */, - FAECA1B11F3164700095D008 /* CompressedSlice.h */, - FA93C4511F315B960087CCD4 /* FormatHandler.cpp */, - FA93C4501F315B960087CCD4 /* FormatHandler.h */, - FA9D8DDF1DEF843D002CD881 /* Image.cpp */, - FA0B7BC51A95902C000E1D17 /* Image.h */, - FA0B7BC61A95902C000E1D17 /* ImageData.cpp */, - FA0B7BC71A95902C000E1D17 /* ImageData.h */, - FAD19A151DFF8CA200D5398A /* ImageDataBase.cpp */, - FAD19A161DFF8CA200D5398A /* ImageDataBase.h */, - FA0B7BC81A95902C000E1D17 /* magpie */, - FA0B7BE21A95902C000E1D17 /* wrap_CompressedImageData.cpp */, - FA0B7BE31A95902C000E1D17 /* wrap_CompressedImageData.h */, - FA0B7BE41A95902C000E1D17 /* wrap_Image.cpp */, - FA0B7BE51A95902C000E1D17 /* wrap_Image.h */, - FA0B7BE61A95902C000E1D17 /* wrap_ImageData.cpp */, - FA0B7BE71A95902C000E1D17 /* wrap_ImageData.h */, - FAC734C21B2E628700AB460A /* wrap_ImageData.lua */, - ); - path = image; - sourceTree = ""; - }; - FA0B7BC81A95902C000E1D17 /* magpie */ = { - isa = PBXGroup; - children = ( - FA41A3C61C0A1F950084430C /* ASTCHandler.cpp */, - FA41A3C71C0A1F950084430C /* ASTCHandler.h */, - FA0B7BCC1A95902C000E1D17 /* ddsHandler.cpp */, - FA0B7BCD1A95902C000E1D17 /* ddsHandler.h */, - FA1557C11CE90BD200AFF582 /* EXRHandler.cpp */, - FA1557C21CE90BD200AFF582 /* EXRHandler.h */, - FA0B7BD81A95902C000E1D17 /* KTXHandler.cpp */, - FA0B7BD91A95902C000E1D17 /* KTXHandler.h */, - FA0B7BDA1A95902C000E1D17 /* PKMHandler.cpp */, - FA0B7BDB1A95902C000E1D17 /* PKMHandler.h */, - FA0B7BDC1A95902C000E1D17 /* PNGHandler.cpp */, - FA0B7BDD1A95902C000E1D17 /* PNGHandler.h */, - FA0B7BDE1A95902C000E1D17 /* PVRHandler.cpp */, - FA0B7BDF1A95902C000E1D17 /* PVRHandler.h */, - FA0B7BE01A95902C000E1D17 /* STBHandler.cpp */, - FA0B7BE11A95902C000E1D17 /* STBHandler.h */, - ); - path = magpie; - sourceTree = ""; - }; - FA0B7BE81A95902C000E1D17 /* joystick */ = { - isa = PBXGroup; - children = ( - FA0B7BE91A95902C000E1D17 /* Joystick.cpp */, - FA0B7BEA1A95902C000E1D17 /* Joystick.h */, - FA0B7BEB1A95902C000E1D17 /* JoystickModule.h */, - FA0B7BEC1A95902C000E1D17 /* sdl */, - FA0B7BF11A95902C000E1D17 /* wrap_Joystick.cpp */, - FA0B7BF21A95902C000E1D17 /* wrap_Joystick.h */, - FA0B7BF31A95902C000E1D17 /* wrap_JoystickModule.cpp */, - FA0B7BF41A95902C000E1D17 /* wrap_JoystickModule.h */, - ); - path = joystick; - sourceTree = ""; - }; - FA0B7BEC1A95902C000E1D17 /* sdl */ = { - isa = PBXGroup; - children = ( - FA0B7BED1A95902C000E1D17 /* Joystick.cpp */, - FA0B7BEE1A95902C000E1D17 /* Joystick.h */, - FA0B7BEF1A95902C000E1D17 /* JoystickModule.cpp */, - FA0B7BF01A95902C000E1D17 /* JoystickModule.h */, - ); - path = sdl; - sourceTree = ""; - }; - FA0B7BF51A95902C000E1D17 /* keyboard */ = { - isa = PBXGroup; - children = ( - FA0B7BF61A95902C000E1D17 /* Keyboard.cpp */, - FA0B7BF71A95902C000E1D17 /* Keyboard.h */, - FA0B7BF81A95902C000E1D17 /* sdl */, - FA0B7BFB1A95902C000E1D17 /* wrap_Keyboard.cpp */, - FA0B7BFC1A95902C000E1D17 /* wrap_Keyboard.h */, - ); - path = keyboard; - sourceTree = ""; - }; - FA0B7BF81A95902C000E1D17 /* sdl */ = { - isa = PBXGroup; - children = ( - FA0B7BF91A95902C000E1D17 /* Keyboard.cpp */, - FA0B7BFA1A95902C000E1D17 /* Keyboard.h */, - ); - path = sdl; - sourceTree = ""; - }; - FA0B7BFD1A95902C000E1D17 /* love */ = { - isa = PBXGroup; - children = ( - FA0B7BFE1A95902C000E1D17 /* love.cpp */, - FA0B7BFF1A95902C000E1D17 /* love.h */, - ); - path = love; - sourceTree = ""; - }; - FA0B7C001A95902C000E1D17 /* math */ = { - isa = PBXGroup; - children = ( - FA0B7C011A95902C000E1D17 /* BezierCurve.cpp */, - FA0B7C021A95902C000E1D17 /* BezierCurve.h */, - FA0B7C031A95902C000E1D17 /* MathModule.cpp */, - FA0B7C041A95902C000E1D17 /* MathModule.h */, - FA0B7C051A95902C000E1D17 /* RandomGenerator.cpp */, - FA0B7C061A95902C000E1D17 /* RandomGenerator.h */, - FA4F2BDF1DE6650600CA37D7 /* Transform.cpp */, - FA4F2BE01DE6650600CA37D7 /* Transform.h */, - FA0B7C071A95902C000E1D17 /* wrap_BezierCurve.cpp */, - FA0B7C081A95902C000E1D17 /* wrap_BezierCurve.h */, - FA0B7C091A95902C000E1D17 /* wrap_Math.cpp */, - FA0B7C0A1A95902C000E1D17 /* wrap_Math.h */, - FA7DA04C1C16874A0056B200 /* wrap_Math.lua */, - FA0B7C0B1A95902C000E1D17 /* wrap_RandomGenerator.cpp */, - FA0B7C0C1A95902C000E1D17 /* wrap_RandomGenerator.h */, - FA2E9BFE1C19E00C0004A1EE /* wrap_RandomGenerator.lua */, - FA4F2BE11DE6650600CA37D7 /* wrap_Transform.cpp */, - FA4F2BE21DE6650600CA37D7 /* wrap_Transform.h */, - ); - path = math; - sourceTree = ""; - }; - FA0B7C0D1A95902C000E1D17 /* mouse */ = { - isa = PBXGroup; - children = ( - FA0B7C0E1A95902C000E1D17 /* Cursor.cpp */, - FA0B7C0F1A95902C000E1D17 /* Cursor.h */, - FA0B7C111A95902C000E1D17 /* Mouse.h */, - FA0B7C121A95902C000E1D17 /* sdl */, - FA0B7C171A95902C000E1D17 /* wrap_Cursor.cpp */, - FA0B7C181A95902C000E1D17 /* wrap_Cursor.h */, - FA0B7C191A95902C000E1D17 /* wrap_Mouse.cpp */, - FA0B7C1A1A95902C000E1D17 /* wrap_Mouse.h */, - ); - path = mouse; - sourceTree = ""; - }; - FA0B7C121A95902C000E1D17 /* sdl */ = { - isa = PBXGroup; - children = ( - FA0B7C131A95902C000E1D17 /* Cursor.cpp */, - FA0B7C141A95902C000E1D17 /* Cursor.h */, - FA0B7C151A95902C000E1D17 /* Mouse.cpp */, - FA0B7C161A95902C000E1D17 /* Mouse.h */, - ); - path = sdl; - sourceTree = ""; - }; - FA0B7C1B1A95902C000E1D17 /* physics */ = { - isa = PBXGroup; - children = ( - FA0B7C1C1A95902C000E1D17 /* Body.cpp */, - FA0B7C1D1A95902C000E1D17 /* Body.h */, - FA0B7C1E1A95902C000E1D17 /* box2d */, - FA0B7C771A95902C000E1D17 /* Joint.cpp */, - FA0B7C781A95902C000E1D17 /* Joint.h */, - FA0B7C791A95902C000E1D17 /* Shape.cpp */, - FA0B7C7A1A95902C000E1D17 /* Shape.h */, - ); - path = physics; - sourceTree = ""; - }; - FA0B7C1E1A95902C000E1D17 /* box2d */ = { - isa = PBXGroup; - children = ( - FA0B7C1F1A95902C000E1D17 /* Body.cpp */, - FA0B7C201A95902C000E1D17 /* Body.h */, - FA0B7C211A95902C000E1D17 /* ChainShape.cpp */, - FA0B7C221A95902C000E1D17 /* ChainShape.h */, - FA0B7C231A95902C000E1D17 /* CircleShape.cpp */, - FA0B7C241A95902C000E1D17 /* CircleShape.h */, - FA0B7C251A95902C000E1D17 /* Contact.cpp */, - FA0B7C261A95902C000E1D17 /* Contact.h */, - FA0B7C271A95902C000E1D17 /* DistanceJoint.cpp */, - FA0B7C281A95902C000E1D17 /* DistanceJoint.h */, - FA0B7C291A95902C000E1D17 /* EdgeShape.cpp */, - FA0B7C2A1A95902C000E1D17 /* EdgeShape.h */, - FA0B7C2B1A95902C000E1D17 /* Fixture.cpp */, - FA0B7C2C1A95902C000E1D17 /* Fixture.h */, - FA0B7C2D1A95902C000E1D17 /* FrictionJoint.cpp */, - FA0B7C2E1A95902C000E1D17 /* FrictionJoint.h */, - FA0B7C2F1A95902C000E1D17 /* GearJoint.cpp */, - FA0B7C301A95902C000E1D17 /* GearJoint.h */, - FA0B7C311A95902C000E1D17 /* Joint.cpp */, - FA0B7C321A95902C000E1D17 /* Joint.h */, - FA0B7C331A95902C000E1D17 /* MotorJoint.cpp */, - FA0B7C341A95902C000E1D17 /* MotorJoint.h */, - FA0B7C351A95902C000E1D17 /* MouseJoint.cpp */, - FA0B7C361A95902C000E1D17 /* MouseJoint.h */, - FA0B7C371A95902C000E1D17 /* Physics.cpp */, - FA0B7C381A95902C000E1D17 /* Physics.h */, - FA0B7C391A95902C000E1D17 /* PolygonShape.cpp */, - FA0B7C3A1A95902C000E1D17 /* PolygonShape.h */, - FA0B7C3B1A95902C000E1D17 /* PrismaticJoint.cpp */, - FA0B7C3C1A95902C000E1D17 /* PrismaticJoint.h */, - FA0B7C3D1A95902C000E1D17 /* PulleyJoint.cpp */, - FA0B7C3E1A95902C000E1D17 /* PulleyJoint.h */, - FA0B7C3F1A95902C000E1D17 /* RevoluteJoint.cpp */, - FA0B7C401A95902C000E1D17 /* RevoluteJoint.h */, - FA0B7C411A95902C000E1D17 /* RopeJoint.cpp */, - FA0B7C421A95902C000E1D17 /* RopeJoint.h */, - FA0B7C431A95902C000E1D17 /* Shape.cpp */, - FA0B7C441A95902C000E1D17 /* Shape.h */, - FA0B7C451A95902C000E1D17 /* WeldJoint.cpp */, - FA0B7C461A95902C000E1D17 /* WeldJoint.h */, - FA0B7C471A95902C000E1D17 /* WheelJoint.cpp */, - FA0B7C481A95902C000E1D17 /* WheelJoint.h */, - FA0B7C491A95902C000E1D17 /* World.cpp */, - FA0B7C4A1A95902C000E1D17 /* World.h */, - FA0B7C4B1A95902C000E1D17 /* wrap_Body.cpp */, - FA0B7C4C1A95902C000E1D17 /* wrap_Body.h */, - FA0B7C4D1A95902C000E1D17 /* wrap_ChainShape.cpp */, - FA0B7C4E1A95902C000E1D17 /* wrap_ChainShape.h */, - FA0B7C4F1A95902C000E1D17 /* wrap_CircleShape.cpp */, - FA0B7C501A95902C000E1D17 /* wrap_CircleShape.h */, - FA0B7C511A95902C000E1D17 /* wrap_Contact.cpp */, - FA0B7C521A95902C000E1D17 /* wrap_Contact.h */, - FA0B7C531A95902C000E1D17 /* wrap_DistanceJoint.cpp */, - FA0B7C541A95902C000E1D17 /* wrap_DistanceJoint.h */, - FA0B7C551A95902C000E1D17 /* wrap_EdgeShape.cpp */, - FA0B7C561A95902C000E1D17 /* wrap_EdgeShape.h */, - FA0B7C571A95902C000E1D17 /* wrap_Fixture.cpp */, - FA0B7C581A95902C000E1D17 /* wrap_Fixture.h */, - FA0B7C591A95902C000E1D17 /* wrap_FrictionJoint.cpp */, - FA0B7C5A1A95902C000E1D17 /* wrap_FrictionJoint.h */, - FA0B7C5B1A95902C000E1D17 /* wrap_GearJoint.cpp */, - FA0B7C5C1A95902C000E1D17 /* wrap_GearJoint.h */, - FA0B7C5D1A95902C000E1D17 /* wrap_Joint.cpp */, - FA0B7C5E1A95902C000E1D17 /* wrap_Joint.h */, - FA0B7C5F1A95902C000E1D17 /* wrap_MotorJoint.cpp */, - FA0B7C601A95902C000E1D17 /* wrap_MotorJoint.h */, - FA0B7C611A95902C000E1D17 /* wrap_MouseJoint.cpp */, - FA0B7C621A95902C000E1D17 /* wrap_MouseJoint.h */, - FA0B7C631A95902C000E1D17 /* wrap_Physics.cpp */, - FA0B7C641A95902C000E1D17 /* wrap_Physics.h */, - FA0B7C651A95902C000E1D17 /* wrap_PolygonShape.cpp */, - FA0B7C661A95902C000E1D17 /* wrap_PolygonShape.h */, - FA0B7C671A95902C000E1D17 /* wrap_PrismaticJoint.cpp */, - FA0B7C681A95902C000E1D17 /* wrap_PrismaticJoint.h */, - FA0B7C691A95902C000E1D17 /* wrap_PulleyJoint.cpp */, - FA0B7C6A1A95902C000E1D17 /* wrap_PulleyJoint.h */, - FA0B7C6B1A95902C000E1D17 /* wrap_RevoluteJoint.cpp */, - FA0B7C6C1A95902C000E1D17 /* wrap_RevoluteJoint.h */, - FA0B7C6D1A95902C000E1D17 /* wrap_RopeJoint.cpp */, - FA0B7C6E1A95902C000E1D17 /* wrap_RopeJoint.h */, - FA0B7C6F1A95902C000E1D17 /* wrap_Shape.cpp */, - FA0B7C701A95902C000E1D17 /* wrap_Shape.h */, - FA0B7C711A95902C000E1D17 /* wrap_WeldJoint.cpp */, - FA0B7C721A95902C000E1D17 /* wrap_WeldJoint.h */, - FA0B7C731A95902C000E1D17 /* wrap_WheelJoint.cpp */, - FA0B7C741A95902C000E1D17 /* wrap_WheelJoint.h */, - FA0B7C751A95902C000E1D17 /* wrap_World.cpp */, - FA0B7C761A95902C000E1D17 /* wrap_World.h */, - ); - path = box2d; - sourceTree = ""; - }; - FA0B7C7B1A95902C000E1D17 /* sound */ = { - isa = PBXGroup; - children = ( - FA0B7C801A95902C000E1D17 /* Decoder.cpp */, - FA0B7C7C1A95902C000E1D17 /* Decoder.h */, - FA0B7C7D1A95902C000E1D17 /* lullaby */, - FA0B7C901A95902C000E1D17 /* Sound.cpp */, - FA0B7C911A95902C000E1D17 /* Sound.h */, - FA0B7C921A95902C000E1D17 /* SoundData.cpp */, - FA0B7C931A95902C000E1D17 /* SoundData.h */, - FA0B7C941A95902C000E1D17 /* wrap_Decoder.cpp */, - FA0B7C951A95902C000E1D17 /* wrap_Decoder.h */, - FA0B7C961A95902C000E1D17 /* wrap_Sound.cpp */, - FA0B7C971A95902C000E1D17 /* wrap_Sound.h */, - FA0B7C981A95902C000E1D17 /* wrap_SoundData.cpp */, - FA0B7C991A95902C000E1D17 /* wrap_SoundData.h */, - FAC734C11B2E021A00AB460A /* wrap_SoundData.lua */, - ); - path = sound; - sourceTree = ""; - }; - FA0B7C7D1A95902C000E1D17 /* lullaby */ = { - isa = PBXGroup; - children = ( - FA0B7C7E1A95902C000E1D17 /* CoreAudioDecoder.cpp */, - FA0B7C7F1A95902C000E1D17 /* CoreAudioDecoder.h */, - FA0B7C821A95902C000E1D17 /* FLACDecoder.cpp */, - FA0B7C831A95902C000E1D17 /* FLACDecoder.h */, - FA0B7C841A95902C000E1D17 /* GmeDecoder.cpp */, - FA0B7C851A95902C000E1D17 /* GmeDecoder.h */, - FA0B7C861A95902C000E1D17 /* ModPlugDecoder.cpp */, - FA0B7C871A95902C000E1D17 /* ModPlugDecoder.h */, - FA0B7C881A95902C000E1D17 /* Mpg123Decoder.cpp */, - FA0B7C891A95902C000E1D17 /* Mpg123Decoder.h */, - FA0B7C8A1A95902C000E1D17 /* Sound.cpp */, - FA0B7C8B1A95902C000E1D17 /* Sound.h */, - FA0B7C8C1A95902C000E1D17 /* VorbisDecoder.cpp */, - FA0B7C8D1A95902C000E1D17 /* VorbisDecoder.h */, - FA0B7C8E1A95902C000E1D17 /* WaveDecoder.cpp */, - FA0B7C8F1A95902C000E1D17 /* WaveDecoder.h */, - ); - path = lullaby; - sourceTree = ""; - }; - FA0B7C9A1A95902C000E1D17 /* system */ = { - isa = PBXGroup; - children = ( - FA0B7C9B1A95902C000E1D17 /* sdl */, - FA0B7C9E1A95902C000E1D17 /* System.cpp */, - FA0B7C9F1A95902C000E1D17 /* System.h */, - FA0B7CA01A95902C000E1D17 /* wrap_System.cpp */, - FA0B7CA11A95902C000E1D17 /* wrap_System.h */, - ); - path = system; - sourceTree = ""; - }; - FA0B7C9B1A95902C000E1D17 /* sdl */ = { - isa = PBXGroup; - children = ( - FA0B7C9C1A95902C000E1D17 /* System.cpp */, - FA0B7C9D1A95902C000E1D17 /* System.h */, - ); - path = sdl; - sourceTree = ""; - }; - FA0B7CA21A95902C000E1D17 /* thread */ = { - isa = PBXGroup; - children = ( - FA0B7CA31A95902C000E1D17 /* Channel.cpp */, - FA0B7CA41A95902C000E1D17 /* Channel.h */, - FA0B7CA51A95902C000E1D17 /* LuaThread.cpp */, - FA0B7CA61A95902C000E1D17 /* LuaThread.h */, - FA0B7CA71A95902C000E1D17 /* sdl */, - FA0B7CAC1A95902C000E1D17 /* Thread.h */, - FA0B7CAD1A95902C000E1D17 /* ThreadModule.cpp */, - FA0B7CAE1A95902C000E1D17 /* ThreadModule.h */, - FA0B7CAF1A95902C000E1D17 /* threads.cpp */, - FA0B7CB01A95902C000E1D17 /* threads.h */, - FA0B7CB11A95902C000E1D17 /* wrap_Channel.cpp */, - FA0B7CB21A95902C000E1D17 /* wrap_Channel.h */, - FA0B7CB31A95902C000E1D17 /* wrap_LuaThread.cpp */, - FA0B7CB41A95902C000E1D17 /* wrap_LuaThread.h */, - FA0B7CB51A95902C000E1D17 /* wrap_ThreadModule.cpp */, - FA0B7CB61A95902C000E1D17 /* wrap_ThreadModule.h */, - ); - path = thread; - sourceTree = ""; - }; - FA0B7CA71A95902C000E1D17 /* sdl */ = { - isa = PBXGroup; - children = ( - FA0B7CA81A95902C000E1D17 /* Thread.cpp */, - FA0B7CA91A95902C000E1D17 /* Thread.h */, - FA0B7CAA1A95902C000E1D17 /* threads.cpp */, - FA0B7CAB1A95902C000E1D17 /* threads.h */, - ); - path = sdl; - sourceTree = ""; - }; - FA0B7CB71A95902C000E1D17 /* timer */ = { - isa = PBXGroup; - children = ( - FA4B66C81ABBCF1900558F15 /* Timer.cpp */, - FA0B7CBB1A95902C000E1D17 /* Timer.h */, - FA0B7CBC1A95902C000E1D17 /* wrap_Timer.cpp */, - FA0B7CBD1A95902C000E1D17 /* wrap_Timer.h */, - ); - path = timer; - sourceTree = ""; - }; - FA0B7CBE1A95902C000E1D17 /* touch */ = { - isa = PBXGroup; - children = ( - FA0B7CBF1A95902C000E1D17 /* sdl */, - FA0B7CC21A95902C000E1D17 /* Touch.h */, - FA0B7CC31A95902C000E1D17 /* wrap_Touch.cpp */, - FA0B7CC41A95902C000E1D17 /* wrap_Touch.h */, - ); - path = touch; - sourceTree = ""; - }; - FA0B7CBF1A95902C000E1D17 /* sdl */ = { - isa = PBXGroup; - children = ( - FA0B7CC01A95902C000E1D17 /* Touch.cpp */, - FA0B7CC11A95902C000E1D17 /* Touch.h */, - ); - path = sdl; - sourceTree = ""; - }; - FA0B7CC51A95902C000E1D17 /* window */ = { - isa = PBXGroup; - children = ( - FA0B7CC61A95902C000E1D17 /* sdl */, - FA0B7CC91A95902C000E1D17 /* Window.cpp */, - FA0B7CCA1A95902C000E1D17 /* Window.h */, - FA0B7CCB1A95902C000E1D17 /* wrap_Window.cpp */, - FA0B7CCC1A95902C000E1D17 /* wrap_Window.h */, - ); - path = window; - sourceTree = ""; - }; - FA0B7CC61A95902C000E1D17 /* sdl */ = { - isa = PBXGroup; - children = ( - FA0B7CC71A95902C000E1D17 /* Window.cpp */, - FA0B7CC81A95902C000E1D17 /* Window.h */, - ); - path = sdl; - sourceTree = ""; - }; - FA0B7EEB1A959125000E1D17 /* macosx */ = { - isa = PBXGroup; - children = ( - FA577A7916C71A1700860150 /* Cocoa.framework */, - FAA627CD18E7E1560080752D /* CoreServices.framework */, - FAD43ECB1FF312D800831BB8 /* freetype.framework */, - FA577A8216C71A5300860150 /* libmodplug.framework */, - FA317EB918F28B6D00B0BCD7 /* libz.dylib */, - FA577A6D16C719EA00860150 /* Lua.framework */, - FA577A6F16C719F000860150 /* mpg123.framework */, - FA577A7116C719F400860150 /* ogg.framework */, - FAAFF04316CB11C700CCDE45 /* OpenAL-Soft.framework */, - FA577A7C16C71A2600860150 /* OpenGL.framework */, - FA9B4A0716E1578300074F42 /* SDL2.framework */, - FA27B3C81B498623008A9DCE /* theora.framework */, - FA577A7716C71A0800860150 /* vorbis.framework */, - ); - name = macosx; - sourceTree = ""; - }; - FA1557BE1CE90A2C00AFF582 /* tinyexr */ = { - isa = PBXGroup; - children = ( - FA1557BF1CE90A2C00AFF582 /* tinyexr.h */, - ); - path = tinyexr; - sourceTree = ""; - }; - FA27B3881B498151008A9DCE /* video */ = { - isa = PBXGroup; - children = ( - FA27B3891B498151008A9DCE /* theora */, - FA27B3931B498151008A9DCE /* Video.h */, - FA27B3941B498151008A9DCE /* VideoStream.cpp */, - FA27B3951B498151008A9DCE /* VideoStream.h */, - FA27B39B1B498151008A9DCE /* wrap_Video.cpp */, - FA27B39C1B498151008A9DCE /* wrap_Video.h */, - FA27B3B91B4985BF008A9DCE /* wrap_VideoStream.cpp */, - FA27B3BA1B4985BF008A9DCE /* wrap_VideoStream.h */, - ); - path = video; - sourceTree = ""; - }; - FA27B3891B498151008A9DCE /* theora */ = { - isa = PBXGroup; - children = ( - FAA54AC91F91660400A8FA7B /* OggDemuxer.cpp */, - FAA54AC61F91660400A8FA7B /* OggDemuxer.h */, - FAA54AC81F91660400A8FA7B /* TheoraVideoStream.cpp */, - FAA54AC71F91660400A8FA7B /* TheoraVideoStream.h */, - FA27B38A1B498151008A9DCE /* Video.cpp */, - FA27B38B1B498151008A9DCE /* Video.h */, - ); - path = theora; - sourceTree = ""; - }; - FA4F2B761DE0125B00CA37D7 /* xxHash */ = { - isa = PBXGroup; - children = ( - FA4F2B771DE0125B00CA37D7 /* xxhash.c */, - FA4F2B781DE0125B00CA37D7 /* xxhash.h */, - ); - path = xxHash; - sourceTree = ""; - }; - FA56D9B91C2089CE00D8D3C7 /* modplug */ = { - isa = PBXGroup; - children = ( - FA56D9BA1C2089EE00D8D3C7 /* libmodplug.a */, - ); - name = modplug; - path = ios/libraries/modplug; - sourceTree = ""; - }; - FA577A6616C7199700860150 /* Frameworks */ = { - isa = PBXGroup; - children = ( - FA0B7EEB1A959125000E1D17 /* macosx */, - ); - name = Frameworks; - sourceTree = ""; - }; - FA59A2D51C0649BB00328DBA /* theora */ = { - isa = PBXGroup; - children = ( - FA59A2D61C0649BB00328DBA /* libtheora.a */, - ); - name = theora; - path = ios/libraries/theora; - sourceTree = ""; - }; - FA5D24A11A96D24500C6FC8F /* Libraries */ = { - isa = PBXGroup; - children = ( - FA5D24A31A96D2C300C6FC8F /* ios */, - ); - name = Libraries; - sourceTree = ""; - }; - FA5D24A31A96D2C300C6FC8F /* ios */ = { - isa = PBXGroup; - children = ( - FA5D24A41A96D2EC00C6FC8F /* freetype */, - FA7550A61AEBE250003E311E /* luajit */, - FA56D9B91C2089CE00D8D3C7 /* modplug */, - FA5D24AA1A96D2EC00C6FC8F /* ogg */, - FA5D24CC1A96E63D00C6FC8F /* SDL2 */, - FA59A2D51C0649BB00328DBA /* theora */, - FA5D24AE1A96D2EC00C6FC8F /* vorbis */, - ); - name = ios; - sourceTree = ""; - }; - FA5D24A41A96D2EC00C6FC8F /* freetype */ = { - isa = PBXGroup; - children = ( - FAE64A7D2071359C00BC7981 /* libfreetype.a */, - ); - name = freetype; - path = ios/libraries/freetype; - sourceTree = ""; - }; - FA5D24AA1A96D2EC00C6FC8F /* ogg */ = { - isa = PBXGroup; - children = ( - FA5D24AB1A96D2EC00C6FC8F /* libogg.a */, - ); - name = ogg; - path = ios/libraries/ogg; - sourceTree = ""; - }; - FA5D24AE1A96D2EC00C6FC8F /* vorbis */ = { - isa = PBXGroup; - children = ( - FA5D24AF1A96D2EC00C6FC8F /* libvorbis.a */, - ); - name = vorbis; - path = ios/libraries/vorbis; - sourceTree = ""; - }; - FA5D24CC1A96E63D00C6FC8F /* SDL2 */ = { - isa = PBXGroup; - children = ( - FA5D24CD1A96E63D00C6FC8F /* libSDL2.a */, - ); - name = SDL2; - path = ios/libraries/SDL2; - sourceTree = ""; - }; - FA7550A61AEBE250003E311E /* luajit */ = { - isa = PBXGroup; - children = ( - FA7550A71AEBE276003E311E /* libluajit.a */, - ); - name = luajit; - path = ios/libraries/luajit; - sourceTree = ""; - }; - FAAA3FD21F64B3AD00F89E99 /* lua53 */ = { - isa = PBXGroup; - children = ( - FAAA3FD31F64B3AD00F89E99 /* lprefix.h */, - FAAA3FD41F64B3AD00F89E99 /* lstrlib.c */, - FAAA3FD51F64B3AD00F89E99 /* lstrlib.h */, - FAAA3FD61F64B3AD00F89E99 /* lutf8lib.c */, - FAAA3FD71F64B3AD00F89E99 /* lutf8lib.h */, - ); - path = lua53; - sourceTree = ""; - }; - FAB17BE31ABFAA9000F9BA27 /* lz4 */ = { - isa = PBXGroup; - children = ( - FAB17BE41ABFAA9000F9BA27 /* lz4.c */, - FAB17BE51ABFAA9000F9BA27 /* lz4.h */, - FAB17BF31ABFC4B100F9BA27 /* lz4hc.c */, - FAB17BF41ABFC4B100F9BA27 /* lz4hc.h */, - FAC7CD951FE755B3006A60C7 /* lz4opt.h */, - ); - path = lz4; - sourceTree = ""; - }; - FAC7CD591FE35E95006A60C7 /* physfs */ = { - isa = PBXGroup; - children = ( - FAC7CD5D1FE35E95006A60C7 /* physfs_archiver_7z.c */, - FAC7CD6C1FE35E95006A60C7 /* physfs_archiver_dir.c */, - FAC7CD741FE35E95006A60C7 /* physfs_archiver_grp.c */, - FAC7CD751FE35E95006A60C7 /* physfs_archiver_hog.c */, - FAC7CD6E1FE35E95006A60C7 /* physfs_archiver_iso9660.c */, - FAC7CD611FE35E95006A60C7 /* physfs_archiver_mvl.c */, - FAC7CD6F1FE35E95006A60C7 /* physfs_archiver_qpak.c */, - FAC7CD5F1FE35E95006A60C7 /* physfs_archiver_slb.c */, - FAC7CD671FE35E95006A60C7 /* physfs_archiver_unpacked.c */, - FAC7CD6A1FE35E95006A60C7 /* physfs_archiver_vdf.c */, - FAC7CD621FE35E95006A60C7 /* physfs_archiver_wad.c */, - FAC7CD761FE35E95006A60C7 /* physfs_archiver_zip.c */, - FAC7CD6D1FE35E95006A60C7 /* physfs_byteorder.c */, - FAC7CD631FE35E95006A60C7 /* physfs_casefolding.h */, - FAC7CD5A1FE35E95006A60C7 /* physfs_internal.h */, - FAC7CD711FE35E95006A60C7 /* physfs_lzmasdk.h */, - FAC7CD731FE35E95006A60C7 /* physfs_miniz.h */, - FAC7CD6B1FE35E95006A60C7 /* physfs_platform_apple.m */, - FAC7CD651FE35E95006A60C7 /* physfs_platform_haiku.cpp */, - FAC7CD641FE35E95006A60C7 /* physfs_platform_os2.c */, - FAC7CD721FE35E95006A60C7 /* physfs_platform_posix.c */, - FAC7CD5B1FE35E95006A60C7 /* physfs_platform_qnx.c */, - FAC7CD5E1FE35E95006A60C7 /* physfs_platform_unix.c */, - FAC7CD661FE35E95006A60C7 /* physfs_platform_windows.c */, - FAC7CD601FE35E95006A60C7 /* physfs_platform_winrt.cpp */, - FAC7CD701FE35E95006A60C7 /* physfs_platforms.h */, - FAC7CD681FE35E95006A60C7 /* physfs_unicode.c */, - FAC7CD5C1FE35E95006A60C7 /* physfs.c */, - FAC7CD691FE35E95006A60C7 /* physfs.h */, - ); - path = physfs; - sourceTree = ""; - }; - FACA02DF1F5E396B0084B28F /* data */ = { - isa = PBXGroup; - children = ( - FA6A2B721F60B6710074C308 /* ByteData.cpp */, - FA6A2B731F60B6710074C308 /* ByteData.h */, - FACA02E01F5E396B0084B28F /* CompressedData.cpp */, - FACA02E11F5E396B0084B28F /* CompressedData.h */, - FACA02E21F5E396B0084B28F /* Compressor.cpp */, - FACA02E31F5E396B0084B28F /* Compressor.h */, - FACA02E41F5E396B0084B28F /* DataModule.cpp */, - FACA02E51F5E396B0084B28F /* DataModule.h */, - FA6A2B681F5F7F560074C308 /* DataView.cpp */, - FA6A2B691F5F7F560074C308 /* DataView.h */, - FACA02E61F5E396B0084B28F /* HashFunction.cpp */, - FACA02E71F5E396B0084B28F /* HashFunction.h */, - FA6A2B781F60B8250074C308 /* wrap_ByteData.cpp */, - FA6A2B771F60B8250074C308 /* wrap_ByteData.h */, - FACA02E81F5E396B0084B28F /* wrap_CompressedData.cpp */, - FACA02E91F5E396B0084B28F /* wrap_CompressedData.h */, - FA6A2B651F5F7B6B0074C308 /* wrap_Data.cpp */, - FA6A2B641F5F7B6B0074C308 /* wrap_Data.h */, - FACA02EA1F5E396B0084B28F /* wrap_DataModule.cpp */, - FACA02EB1F5E396B0084B28F /* wrap_DataModule.h */, - FA6A2B6E1F5F845F0074C308 /* wrap_DataView.cpp */, - FA6A2B6D1F5F845F0074C308 /* wrap_DataView.h */, - ); - path = data; - sourceTree = ""; - }; - FAF13FBF1E20934C00F898D2 /* glslang */ = { - isa = PBXGroup; - children = ( - FAF13FC01E20934C00F898D2 /* glslang */, - FAF1403A1E20934C00F898D2 /* OGLCompilersDLL */, - ); - path = glslang; - sourceTree = ""; - }; - FAF13FC01E20934C00F898D2 /* glslang */ = { - isa = PBXGroup; - children = ( - FAF13FC11E20934C00F898D2 /* GenericCodeGen */, - FAF13FC41E20934C00F898D2 /* Include */, - FAF13FD21E20934C00F898D2 /* MachineIndependent */, - FAF140021E20934C00F898D2 /* OSDependent */, - FAF140281E20934C00F898D2 /* Public */, - ); - path = glslang; - sourceTree = ""; - }; - FAF13FC11E20934C00F898D2 /* GenericCodeGen */ = { - isa = PBXGroup; - children = ( - FAF13FC21E20934C00F898D2 /* CodeGen.cpp */, - FAF13FC31E20934C00F898D2 /* Link.cpp */, - ); - path = GenericCodeGen; - sourceTree = ""; - }; - FAF13FC41E20934C00F898D2 /* Include */ = { - isa = PBXGroup; - children = ( - FAF13FC51E20934C00F898D2 /* arrays.h */, - FAF13FC61E20934C00F898D2 /* BaseTypes.h */, - FAF13FC71E20934C00F898D2 /* Common.h */, - FAF13FC81E20934C00F898D2 /* ConstantUnion.h */, - FAF13FC91E20934C00F898D2 /* InfoSink.h */, - FAF13FCA1E20934C00F898D2 /* InitializeGlobals.h */, - FAF13FCB1E20934C00F898D2 /* intermediate.h */, - FAF13FCC1E20934C00F898D2 /* PoolAlloc.h */, - FAF13FCD1E20934C00F898D2 /* ResourceLimits.h */, - FAF13FCE1E20934C00F898D2 /* revision.h */, - FAF13FD01E20934C00F898D2 /* ShHandle.h */, - FAF13FD11E20934C00F898D2 /* Types.h */, - ); - path = Include; - sourceTree = ""; - }; - FAF13FD21E20934C00F898D2 /* MachineIndependent */ = { - isa = PBXGroup; - children = ( - FAF13FD31E20934C00F898D2 /* Constant.cpp */, - FAF13FD41E20934C00F898D2 /* gl_types.h */, - FAF13FD61E20934C00F898D2 /* glslang_tab.cpp */, - FAF13FD71E20934C00F898D2 /* glslang_tab.cpp.h */, - FAF13FD81E20934C00F898D2 /* InfoSink.cpp */, - FAF13FD91E20934C00F898D2 /* Initialize.cpp */, - FAF13FDA1E20934C00F898D2 /* Initialize.h */, - FAF13FDB1E20934C00F898D2 /* Intermediate.cpp */, - FAF13FDC1E20934C00F898D2 /* intermOut.cpp */, - FAF13FDD1E20934C00F898D2 /* IntermTraverse.cpp */, - FAF13FDE1E20934C00F898D2 /* iomapper.cpp */, - FAF13FDF1E20934C00F898D2 /* iomapper.h */, - FAF13FE01E20934C00F898D2 /* limits.cpp */, - FAF13FE11E20934C00F898D2 /* linkValidate.cpp */, - FAF13FE21E20934C00F898D2 /* LiveTraverser.h */, - FAF13FE31E20934C00F898D2 /* localintermediate.h */, - FAF13FE41E20934C00F898D2 /* parseConst.cpp */, - FAF13FE51E20934C00F898D2 /* ParseContextBase.cpp */, - FAF13FE61E20934C00F898D2 /* ParseHelper.cpp */, - FAF13FE71E20934C00F898D2 /* ParseHelper.h */, - FAF13FE81E20934C00F898D2 /* parseVersions.h */, - FAF13FE91E20934C00F898D2 /* PoolAlloc.cpp */, - FAF13FEA1E20934C00F898D2 /* preprocessor */, - FAF13FF41E20934C00F898D2 /* propagateNoContraction.cpp */, - FAF13FF51E20934C00F898D2 /* propagateNoContraction.h */, - FAF13FF61E20934C00F898D2 /* reflection.cpp */, - FAF13FF71E20934C00F898D2 /* reflection.h */, - FAF13FF81E20934C00F898D2 /* RemoveTree.cpp */, - FAF13FF91E20934C00F898D2 /* RemoveTree.h */, - FAF13FFA1E20934C00F898D2 /* Scan.cpp */, - FAF13FFB1E20934C00F898D2 /* Scan.h */, - FAF13FFC1E20934C00F898D2 /* ScanContext.h */, - FAF13FFD1E20934C00F898D2 /* ShaderLang.cpp */, - FAF13FFE1E20934C00F898D2 /* SymbolTable.cpp */, - FAF13FFF1E20934C00F898D2 /* SymbolTable.h */, - FAF140001E20934C00F898D2 /* Versions.cpp */, - FAF140011E20934C00F898D2 /* Versions.h */, - ); - path = MachineIndependent; - sourceTree = ""; - }; - FAF13FEA1E20934C00F898D2 /* preprocessor */ = { - isa = PBXGroup; - children = ( - FAF13FEB1E20934C00F898D2 /* Pp.cpp */, - FAF13FEC1E20934C00F898D2 /* PpAtom.cpp */, - FAF13FED1E20934C00F898D2 /* PpContext.cpp */, - FAF13FEE1E20934C00F898D2 /* PpContext.h */, - FAF13FF01E20934C00F898D2 /* PpScanner.cpp */, - FAF13FF21E20934C00F898D2 /* PpTokens.cpp */, - FAF13FF31E20934C00F898D2 /* PpTokens.h */, - ); - path = preprocessor; - sourceTree = ""; - }; - FAF140021E20934C00F898D2 /* OSDependent */ = { - isa = PBXGroup; - children = ( - FAF140031E20934C00F898D2 /* osinclude.h */, - FAF140041E20934C00F898D2 /* Unix */, - ); - path = OSDependent; - sourceTree = ""; - }; - FAF140041E20934C00F898D2 /* Unix */ = { - isa = PBXGroup; - children = ( - FAF140211E20934C00F898D2 /* ossource.cpp */, - ); - path = Unix; - sourceTree = ""; - }; - FAF140281E20934C00F898D2 /* Public */ = { - isa = PBXGroup; - children = ( - FAF140291E20934C00F898D2 /* ShaderLang.h */, - ); - path = Public; - sourceTree = ""; - }; - FAF1403A1E20934C00F898D2 /* OGLCompilersDLL */ = { - isa = PBXGroup; - children = ( - FAF1403B1E20934C00F898D2 /* InitializeDll.cpp */, - FAF1403C1E20934C00F898D2 /* InitializeDll.h */, - ); - path = OGLCompilersDLL; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - FA577AAC16C7507900860150 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - FADF54221E3DA52C00012CC0 /* wrap_ParticleSystem.h in Headers */, - 217DFC0A1D9F6D490055D849 /* unix.h in Headers */, - FA0B7D7E1A95902C000E1D17 /* Texture.h in Headers */, - FA0B7E561A95902C000E1D17 /* wrap_GearJoint.h in Headers */, - FAF1409F1E20934C00F898D2 /* reflection.h in Headers */, - FA0B7E1D1A95902C000E1D17 /* MouseJoint.h in Headers */, - FA1BA0B81E17043400AA2803 /* wrap_Shader.h in Headers */, - FA1557C41CE90BD200AFF582 /* EXRHandler.h in Headers */, - FA0B7DC91A95902C000E1D17 /* Keyboard.h in Headers */, - FA0B7D4A1A95902C000E1D17 /* Polyline.h in Headers */, - FAF1405C1E20934C00F898D2 /* InitializeGlobals.h in Headers */, - FA0B7DB31A95902C000E1D17 /* wrap_Image.h in Headers */, - FAF140591E20934C00F898D2 /* Common.h in Headers */, - FA0B7EC31A95902C000E1D17 /* threads.h in Headers */, - FA0B7AC21A958EA3000E1D17 /* enet.h in Headers */, - FA4F2BA71DE1E36400CA37D7 /* RecordingDevice.h in Headers */, - FA0B7E201A95902C000E1D17 /* Physics.h in Headers */, - FAF140791E20934C00F898D2 /* iomapper.h in Headers */, - 217DFBEA1D9F6D490055D849 /* io.h in Headers */, - FA0B79221A958E3B000E1D17 /* delay.h in Headers */, - FA0B79481A958E3B000E1D17 /* Vector.h in Headers */, - FA0B7CCF1A95902C000E1D17 /* Audio.h in Headers */, - FA0B7EC01A95902C000E1D17 /* Thread.h in Headers */, - FA0B7E9C1A95902C000E1D17 /* VorbisDecoder.h in Headers */, - FAC756FB1E4F99D200B91289 /* Effect.h in Headers */, - FAC7CD901FE35E95006A60C7 /* physfs_miniz.h in Headers */, - FA0B791D1A958E3B000E1D17 /* b64.h in Headers */, - FA0B7DC61A95902C000E1D17 /* wrap_JoystickModule.h in Headers */, - FA0B7D201A95902C000E1D17 /* ImageRasterizer.h in Headers */, - FA0B7D241A95902C000E1D17 /* Vera.ttf.h in Headers */, - FADF54311E3DABF600012CC0 /* SpriteBatch.h in Headers */, - FA0B7E5F1A95902C000E1D17 /* wrap_MouseJoint.h in Headers */, - 217DFC0C1D9F6D490055D849 /* unixtcp.h in Headers */, - FA76344C1E28722A0066EF9E /* StreamBuffer.h in Headers */, - FA6A2B761F60B6710074C308 /* ByteData.h in Headers */, - 217DFBF31D9F6D490055D849 /* mime.h in Headers */, - FA0B7B361A958EA3000E1D17 /* wuff_convert.h in Headers */, - FA0B7CDE1A95902C000E1D17 /* Source.h in Headers */, - FA0B7E141A95902C000E1D17 /* GearJoint.h in Headers */, - FA0B7D051A95902C000E1D17 /* wrap_DroppedFile.h in Headers */, - FAAA3FDA1F64B3AD00F89E99 /* lstrlib.h in Headers */, - FA0B7E9F1A95902C000E1D17 /* WaveDecoder.h in Headers */, - FAF140871E20934C00F898D2 /* parseVersions.h in Headers */, - FA0B7AC61A958EA3000E1D17 /* types.h in Headers */, - FA0B7DBD1A95902C000E1D17 /* Joystick.h in Headers */, - FA0B7E901A95902C000E1D17 /* GmeDecoder.h in Headers */, - FA0B7D0E1A95902C000E1D17 /* wrap_Filesystem.h in Headers */, - FA0B7EE41A95902D000E1D17 /* Window.h in Headers */, - FA0B7CFC1A95902C000E1D17 /* Filesystem.h in Headers */, - FA0B7AD81A958EA3000E1D17 /* lua-enet.h in Headers */, - FA0B7A3A1A958EA3000E1D17 /* b2DynamicTree.h in Headers */, - FA0B7D351A95902C000E1D17 /* Canvas.h in Headers */, - FA0B7EBA1A95902C000E1D17 /* Channel.h in Headers */, - FA0B7D3E1A95902C000E1D17 /* Image.h in Headers */, - FA0B7ECA1A95902C000E1D17 /* threads.h in Headers */, - FADF54361E3DAE6E00012CC0 /* wrap_SpriteBatch.h in Headers */, - FA0B7DB01A95902C000E1D17 /* wrap_CompressedImageData.h in Headers */, - FAC7CD8D1FE35E95006A60C7 /* physfs_platforms.h in Headers */, - FA0B7AC11A958EA3000E1D17 /* callbacks.h in Headers */, - FA3C5E491F8D80CA0003C579 /* ShaderStage.h in Headers */, - FA0B7D8F1A95902C000E1D17 /* ddsHandler.h in Headers */, - FAB2D5AC1AABDD8A008224A4 /* TrueTypeRasterizer.h in Headers */, - FAF140C41E20934C00F898D2 /* ShaderLang.h in Headers */, - FA1E887F1DF363CD00E808AA /* Filter.h in Headers */, - FA27B3C21B4985BF008A9DCE /* wrap_VideoStream.h in Headers */, - FA0B7AA31A958EA3000E1D17 /* b2PulleyJoint.h in Headers */, - FAF140621E20934C00F898D2 /* ShHandle.h in Headers */, - FA0B7B2F1A958EA3000E1D17 /* utf8.h in Headers */, - FA0B79231A958E3B000E1D17 /* EnumMap.h in Headers */, - FAF140571E20934C00F898D2 /* arrays.h in Headers */, - FA0B7A371A958EA3000E1D17 /* b2Distance.h in Headers */, - FA0B7E681A95902C000E1D17 /* wrap_PrismaticJoint.h in Headers */, - FA0B7D571A95902C000E1D17 /* Buffer.h in Headers */, - FAF140AB1E20934C00F898D2 /* SymbolTable.h in Headers */, - FA0B7ED71A95902D000E1D17 /* Timer.h in Headers */, - FA0B7AC31A958EA3000E1D17 /* list.h in Headers */, - FA0B7B2D1A958EA3000E1D17 /* core.h in Headers */, - FA1E88841DF363DB00E808AA /* Filter.h in Headers */, - 217DFC061D9F6D490055D849 /* tp.lua.h in Headers */, - FAB17BF71ABFC4B100F9BA27 /* lz4hc.h in Headers */, - FA0B7E831A95902C000E1D17 /* Shape.h in Headers */, - FAE272531C05A15B00A67640 /* ParticleSystem.h in Headers */, - FA6A2B6C1F5F7F560074C308 /* DataView.h in Headers */, - FAF140701E20934C00F898D2 /* Initialize.h in Headers */, - FAAA3FDC1F64B3AD00F89E99 /* lutf8lib.h in Headers */, - FAC7CD801FE35E95006A60C7 /* physfs_casefolding.h in Headers */, - FA1BA09F1E16CFCE00AA2803 /* Font.h in Headers */, - FA0B7EDD1A95902D000E1D17 /* Touch.h in Headers */, - FA0B7EDE1A95902D000E1D17 /* Touch.h in Headers */, - FAC7CD861FE35E95006A60C7 /* physfs.h in Headers */, - FA0B7A541A958EA3000E1D17 /* b2Math.h in Headers */, - 217DFBEE1D9F6D490055D849 /* luasocket.h in Headers */, - FACA02F31F5E396B0084B28F /* HashFunction.h in Headers */, - FA0B7ED01A95902C000E1D17 /* wrap_LuaThread.h in Headers */, - FA9159201CF1ED7500A7053F /* halffloat.h in Headers */, - FA0B7CE41A95902C000E1D17 /* wrap_Audio.h in Headers */, - FA0B7A7F1A958EA3000E1D17 /* b2ContactSolver.h in Headers */, - FADF540F1E3D7CDD00012CC0 /* wrap_Video.h in Headers */, - FAA54ACA1F91660400A8FA7B /* OggDemuxer.h in Headers */, - FA0B79491A958E3B000E1D17 /* version.h in Headers */, - FAF140581E20934C00F898D2 /* BaseTypes.h in Headers */, - FA0B7B2B1A958EA3000E1D17 /* stb_image.h in Headers */, - FAF140AE1E20934C00F898D2 /* Versions.h in Headers */, - FA0B7CD21A95902C000E1D17 /* Audio.h in Headers */, - FA0B79421A958E3B000E1D17 /* utf8.h in Headers */, - FA0B7D171A95902C000E1D17 /* Font.h in Headers */, - FAECA1B41F3164700095D008 /* CompressedSlice.h in Headers */, - FA0B7A6D1A958EA3000E1D17 /* b2World.h in Headers */, - FA0B7EAE1A95902C000E1D17 /* wrap_SoundData.h in Headers */, - FA0B7CFF1A95902C000E1D17 /* File.h in Headers */, - FA0B7AB41A958EA3000E1D17 /* ddsinfo.h in Headers */, - FA0B7DD21A95902C000E1D17 /* love.h in Headers */, - FA6A2B6F1F5F845F0074C308 /* wrap_DataView.h in Headers */, - FAF140861E20934C00F898D2 /* ParseHelper.h in Headers */, - FA0B7CE71A95902C000E1D17 /* wrap_Source.h in Headers */, - FA0B7B231A958EA3000E1D17 /* luasocket.h in Headers */, - FA0B7D1D1A95902C000E1D17 /* GlyphData.h in Headers */, - FAC7CD8E1FE35E95006A60C7 /* physfs_lzmasdk.h in Headers */, - FA0B7B391A958EA3000E1D17 /* wuff_internal.h in Headers */, - FAC7CD771FE35E95006A60C7 /* physfs_internal.h in Headers */, - FA0B7A5A1A958EA3000E1D17 /* b2StackAllocator.h in Headers */, - FA0B7D881A95902C000E1D17 /* ImageData.h in Headers */, - FA0B7A661A958EA3000E1D17 /* b2Fixture.h in Headers */, - FA0B7EE11A95902D000E1D17 /* wrap_Touch.h in Headers */, - FA9D8DDB1DEF8411002CD881 /* Stream.h in Headers */, - FA0B7AA91A958EA3000E1D17 /* b2RopeJoint.h in Headers */, - FACA02F71F5E396B0084B28F /* wrap_DataModule.h in Headers */, - FA56AA3A1FAFF02000A43D5F /* memory.h in Headers */, - FA0B7E441A95902C000E1D17 /* wrap_CircleShape.h in Headers */, - FA0B7EB41A95902C000E1D17 /* System.h in Headers */, - FAF1405A1E20934C00F898D2 /* ConstantUnion.h in Headers */, - FAF140A51E20934C00F898D2 /* Scan.h in Headers */, - FA0B7CE11A95902C000E1D17 /* Source.h in Headers */, - FA1BA0AE1E16F9EE00AA2803 /* wrap_Canvas.h in Headers */, - FAF140901E20934C00F898D2 /* PpContext.h in Headers */, - FA0B7E621A95902C000E1D17 /* wrap_Physics.h in Headers */, - FA0B7DF01A95902C000E1D17 /* Mouse.h in Headers */, - 217DFBDC1D9F6D490055D849 /* buffer.h in Headers */, - FA0B7DAD1A95902C000E1D17 /* STBHandler.h in Headers */, - FA1BA0A41E16D97500AA2803 /* wrap_Font.h in Headers */, - FA0B7DE11A95902C000E1D17 /* wrap_Math.h in Headers */, - FA0B7AAF1A958EA3000E1D17 /* b2WheelJoint.h in Headers */, - FA0B7D1A1A95902C000E1D17 /* TrueTypeRasterizer.h in Headers */, - FA0B7EA81A95902C000E1D17 /* wrap_Decoder.h in Headers */, - FA0B7AC51A958EA3000E1D17 /* time.h in Headers */, - FA0B793E1A958E3B000E1D17 /* StringMap.h in Headers */, - FA0B793A1A958E3B000E1D17 /* Reference.h in Headers */, - FACA02F51F5E396B0084B28F /* wrap_CompressedData.h in Headers */, - FA0B7DCC1A95902C000E1D17 /* Keyboard.h in Headers */, - FA620A341AA2F8DB005DB4C2 /* wrap_Quad.h in Headers */, - FA0B7EA51A95902C000E1D17 /* SoundData.h in Headers */, - FADF54271E3DA5BA00012CC0 /* Mesh.h in Headers */, - FAF1405E1E20934C00F898D2 /* PoolAlloc.h in Headers */, - FA0B7A821A958EA3000E1D17 /* b2EdgeAndCircleContact.h in Headers */, - FA0B79341A958E3B000E1D17 /* Object.h in Headers */, - 217DFBF11D9F6D490055D849 /* mbox.lua.h in Headers */, - FA0B7CEA1A95902C000E1D17 /* Event.h in Headers */, - FA0B7E351A95902C000E1D17 /* WeldJoint.h in Headers */, - FA0B7E2F1A95902C000E1D17 /* RopeJoint.h in Headers */, - FA0B7D141A95902C000E1D17 /* Font.h in Headers */, - FA0B7E591A95902C000E1D17 /* wrap_Joint.h in Headers */, - FA0B79351A958E3B000E1D17 /* macosx.h in Headers */, - FA0B7A631A958EA3000E1D17 /* b2ContactManager.h in Headers */, - FA0B7E771A95902C000E1D17 /* wrap_WeldJoint.h in Headers */, - FA0B7A911A958EA3000E1D17 /* b2FrictionJoint.h in Headers */, - FA0B7E291A95902C000E1D17 /* PulleyJoint.h in Headers */, - FA6BDE5C1F31725300786805 /* Color.h in Headers */, - FA0B7E231A95902C000E1D17 /* PolygonShape.h in Headers */, - FA0B791E1A958E3B000E1D17 /* config.h in Headers */, - FAB17BE81ABFAA9000F9BA27 /* lz4.h in Headers */, - FA0B7E6B1A95902C000E1D17 /* wrap_PulleyJoint.h in Headers */, - FA0B7E051A95902C000E1D17 /* Contact.h in Headers */, - FADF541D1E3DA46C00012CC0 /* wrap_Image.h in Headers */, - FA1BA0A91E16F20600AA2803 /* Canvas.h in Headers */, - FA0B7A691A958EA3000E1D17 /* b2Island.h in Headers */, - FA4F2BE41DE6650600CA37D7 /* Transform.h in Headers */, - FA0B7E0E1A95902C000E1D17 /* Fixture.h in Headers */, - FA0B7A401A958EA3000E1D17 /* b2ChainShape.h in Headers */, - FA6A2B661F5F7B6B0074C308 /* wrap_Data.h in Headers */, - 217DFBE81D9F6D490055D849 /* inet.h in Headers */, - FADF53FA1E3C7ACD00012CC0 /* Buffer.h in Headers */, - FA0B7AA61A958EA3000E1D17 /* b2RevoluteJoint.h in Headers */, - FA0B7EEA1A95902D000E1D17 /* wrap_Window.h in Headers */, - FA1557C01CE90A2C00AFF582 /* tinyexr.h in Headers */, - FA0B7E381A95902C000E1D17 /* WheelJoint.h in Headers */, - FA0B7D851A95902C000E1D17 /* Image.h in Headers */, - FA0B7E7D1A95902C000E1D17 /* wrap_World.h in Headers */, - FA0B7EBD1A95902C000E1D17 /* LuaThread.h in Headers */, - FADF53FF1E3D74F200012CC0 /* Text.h in Headers */, - FA0B7DC01A95902C000E1D17 /* JoystickModule.h in Headers */, - FA0B7E871A95902C000E1D17 /* CoreAudioDecoder.h in Headers */, - FA0B7CD51A95902C000E1D17 /* Source.h in Headers */, - FA0B7A2B1A958EA3000E1D17 /* b2BroadPhase.h in Headers */, - 217DFBFD1D9F6D490055D849 /* smtp.lua.h in Headers */, - FA27B39F1B498151008A9DCE /* Video.h in Headers */, - FA0B7AAC1A958EA3000E1D17 /* b2WeldJoint.h in Headers */, - 217DFC041D9F6D490055D849 /* timeout.h in Headers */, - FA0B7E7A1A95902C000E1D17 /* wrap_WheelJoint.h in Headers */, - FA0B7A791A958EA3000E1D17 /* b2CircleContact.h in Headers */, - FA0B7DD81A95902C000E1D17 /* MathModule.h in Headers */, - FA0B7A341A958EA3000E1D17 /* b2Collision.h in Headers */, - 217DFBDA1D9F6D490055D849 /* auxiliar.h in Headers */, - FA0B7EC71A95902C000E1D17 /* ThreadModule.h in Headers */, - FA4F2BAD1DE1E37000CA37D7 /* RecordingDevice.h in Headers */, - FA0B792B1A958E3B000E1D17 /* Matrix.h in Headers */, - FA0B7DA41A95902C000E1D17 /* PKMHandler.h in Headers */, - FA0B7AC81A958EA3000E1D17 /* utility.h in Headers */, - 217DFC0E1D9F6D490055D849 /* unixudp.h in Headers */, - FA0B791F1A958E3B000E1D17 /* Data.h in Headers */, - 217DFBE41D9F6D490055D849 /* headers.lua.h in Headers */, - FA0B7D021A95902C000E1D17 /* Filesystem.h in Headers */, - FA0B7E471A95902C000E1D17 /* wrap_Contact.h in Headers */, - FA0B7E021A95902C000E1D17 /* CircleShape.h in Headers */, - FA0B7E111A95902C000E1D17 /* FrictionJoint.h in Headers */, - FA0B7AE01A958EA3000E1D17 /* lodepng.h in Headers */, - FA0B7A4D1A958EA3000E1D17 /* b2BlockAllocator.h in Headers */, - FA0B7ECD1A95902C000E1D17 /* wrap_Channel.h in Headers */, - FAF140AF1E20934C00F898D2 /* osinclude.h in Headers */, - FA0B7A431A958EA3000E1D17 /* b2CircleShape.h in Headers */, - FA93C4531F315B960087CCD4 /* FormatHandler.h in Headers */, - FA0B7CD81A95902C000E1D17 /* Audio.h in Headers */, - FA0B7CF61A95902C000E1D17 /* File.h in Headers */, - FA0B7E961A95902C000E1D17 /* Mpg123Decoder.h in Headers */, - FADF54091E3D78F700012CC0 /* Video.h in Headers */, - FAA54ACB1F91660400A8FA7B /* TheoraVideoStream.h in Headers */, - FA0B7DD51A95902C000E1D17 /* BezierCurve.h in Headers */, - FA0B79271A958E3B000E1D17 /* int.h in Headers */, - FA0B7E531A95902C000E1D17 /* wrap_FrictionJoint.h in Headers */, - FA0B7EB71A95902C000E1D17 /* wrap_System.h in Headers */, - FA27B3A91B498151008A9DCE /* Video.h in Headers */, - FAAA3FD81F64B3AD00F89E99 /* lprefix.h in Headers */, - 217DFBFA1D9F6D490055D849 /* select.h in Headers */, - FA0B7DF61A95902C000E1D17 /* wrap_Mouse.h in Headers */, - FAF140661E20934C00F898D2 /* gl_types.h in Headers */, - FA0B7E801A95902C000E1D17 /* Joint.h in Headers */, - FA0B7D2F1A95902C000E1D17 /* Drawable.h in Headers */, - 217DFBE21D9F6D490055D849 /* ftp.lua.h in Headers */, - FA0B7EC41A95902C000E1D17 /* Thread.h in Headers */, - FA0B7DFF1A95902C000E1D17 /* ChainShape.h in Headers */, - FA0B7E4D1A95902C000E1D17 /* wrap_EdgeShape.h in Headers */, - FAF1405F1E20934C00F898D2 /* ResourceLimits.h in Headers */, - FA0B7DDB1A95902C000E1D17 /* RandomGenerator.h in Headers */, - FA0B7E841A95902C000E1D17 /* Decoder.h in Headers */, - FA0B7A601A958EA3000E1D17 /* b2Body.h in Headers */, - FA0B7EAB1A95902C000E1D17 /* wrap_Sound.h in Headers */, - FA0B7B2C1A958EA3000E1D17 /* checked.h in Headers */, - FADF54181E3DA08E00012CC0 /* Image.h in Headers */, - FA0B7D2A1A95902C000E1D17 /* wrap_GlyphData.h in Headers */, - FACA02F11F5E396B0084B28F /* DataModule.h in Headers */, - FA0B7E741A95902C000E1D17 /* wrap_Shape.h in Headers */, - FA0B7A5D1A958EA3000E1D17 /* b2Timer.h in Headers */, - FA91DA8D1F377C3900C80E33 /* deprecation.h in Headers */, - FA0B7A4A1A958EA3000E1D17 /* b2Shape.h in Headers */, - FAF1407F1E20934C00F898D2 /* localintermediate.h in Headers */, - FAF1406B1E20934C00F898D2 /* glslang_tab.cpp.h in Headers */, - 217DFBF71D9F6D490055D849 /* options.h in Headers */, - FA0B7E3B1A95902C000E1D17 /* World.h in Headers */, - FA0B7DC31A95902C000E1D17 /* wrap_Joystick.h in Headers */, - FAF140631E20934C00F898D2 /* Types.h in Headers */, - FA4F2BE61DE6650600CA37D7 /* wrap_Transform.h in Headers */, - FA0B7EE71A95902D000E1D17 /* Window.h in Headers */, - FA0B7E651A95902C000E1D17 /* wrap_PolygonShape.h in Headers */, - FA0B7AC91A958EA3000E1D17 /* win32.h in Headers */, - FA0B7DFC1A95902C000E1D17 /* Body.h in Headers */, - FA1BA0B31E16FD0800AA2803 /* Shader.h in Headers */, - 217DFC101D9F6D490055D849 /* url.lua.h in Headers */, - FAF140DD1E20934C00F898D2 /* InitializeDll.h in Headers */, - FA0B7A941A958EA3000E1D17 /* b2GearJoint.h in Headers */, - FA0B7DF31A95902C000E1D17 /* wrap_Cursor.h in Headers */, - FA0B7A461A958EA3000E1D17 /* b2EdgeShape.h in Headers */, - FA0B7D271A95902C000E1D17 /* wrap_Font.h in Headers */, - FA0B7A761A958EA3000E1D17 /* b2ChainAndPolygonContact.h in Headers */, - FA0B7DAA1A95902C000E1D17 /* PVRHandler.h in Headers */, - FA27B3B51B498151008A9DCE /* wrap_Video.h in Headers */, - FA0B7D7B1A95902C000E1D17 /* Quad.h in Headers */, - FA0B7E261A95902C000E1D17 /* PrismaticJoint.h in Headers */, - FA0B7E991A95902C000E1D17 /* Sound.h in Headers */, - FA0B7D841A95902C000E1D17 /* CompressedImageData.h in Headers */, - FACA02ED1F5E396B0084B28F /* CompressedData.h in Headers */, - FAF1407E1E20934C00F898D2 /* LiveTraverser.h in Headers */, - FA0B7D231A95902C000E1D17 /* Rasterizer.h in Headers */, - FAD19A191DFF8CA200D5398A /* ImageDataBase.h in Headers */, - FA0B7CDB1A95902C000E1D17 /* Pool.h in Headers */, - FA0B7D0B1A95902C000E1D17 /* wrap_FileData.h in Headers */, - FA0B7DF91A95902C000E1D17 /* Body.h in Headers */, - FA0B7DB91A95902C000E1D17 /* Joystick.h in Headers */, - FA4F2BB11DE1E37B00CA37D7 /* RecordingDevice.h in Headers */, - FA0B7E2C1A95902C000E1D17 /* RevoluteJoint.h in Headers */, - FA8951A41AA2EDF300EC385A /* wrap_Event.h in Headers */, - FA0B7B2A1A958EA3000E1D17 /* simplexnoise1234.h in Headers */, - FA9D53AE1F5307E900125C6B /* Deprecations.h in Headers */, - FA0B7ADC1A958EA3000E1D17 /* glad.hpp in Headers */, - FA6A2B791F60B8250074C308 /* wrap_ByteData.h in Headers */, - FA0B7CF91A95902C000E1D17 /* FileData.h in Headers */, - FA0B7DA71A95902C000E1D17 /* PNGHandler.h in Headers */, - FA0B7AC41A958EA3000E1D17 /* protocol.h in Headers */, - FAF140601E20934C00F898D2 /* revision.h in Headers */, - FAF140A21E20934C00F898D2 /* RemoveTree.h in Headers */, - FA0B7A8E1A958EA3000E1D17 /* b2DistanceJoint.h in Headers */, - FA0B7A8B1A958EA3000E1D17 /* b2PolygonContact.h in Headers */, - FA0B7D321A95902C000E1D17 /* Graphics.h in Headers */, - FA0B7E321A95902C000E1D17 /* Shape.h in Headers */, - FA620A371AA2F8DB005DB4C2 /* wrap_Texture.h in Headers */, - FA0B7DBA1A95902C000E1D17 /* JoystickModule.h in Headers */, - FA0B792E1A958E3B000E1D17 /* Memoizer.h in Headers */, - FA0B7A731A958EA3000E1D17 /* b2ChainAndCircleContact.h in Headers */, - FA0B7AA01A958EA3000E1D17 /* b2PrismaticJoint.h in Headers */, - FA0B7DEA1A95902C000E1D17 /* Mouse.h in Headers */, - FA0B7E931A95902C000E1D17 /* ModPlugDecoder.h in Headers */, - FA0B7D111A95902C000E1D17 /* BMFontRasterizer.h in Headers */, - 217DFBE61D9F6D490055D849 /* http.lua.h in Headers */, - FA0B7E3E1A95902C000E1D17 /* wrap_Body.h in Headers */, - FAF140991E20934C00F898D2 /* PpTokens.h in Headers */, - FA0B7A571A958EA3000E1D17 /* b2Settings.h in Headers */, - FAF1405B1E20934C00F898D2 /* InfoSink.h in Headers */, - FA0B7B321A958EA3000E1D17 /* wuff.h in Headers */, - 217DFBF81D9F6D490055D849 /* pierror.h in Headers */, - 217DFC021D9F6D490055D849 /* tcp.h in Headers */, - FA0B7A3D1A958EA3000E1D17 /* b2TimeOfImpact.h in Headers */, - FA3C5E441F8C368C0003C579 /* ShaderStage.h in Headers */, - FA0B79261A958E3B000E1D17 /* Exception.h in Headers */, - FA0B7D4D1A95902C000E1D17 /* Shader.h in Headers */, - FA0B793D1A958E3B000E1D17 /* runtime.h in Headers */, - FA0B7A701A958EA3000E1D17 /* b2WorldCallbacks.h in Headers */, - FA0B7A9D1A958EA3000E1D17 /* b2MouseJoint.h in Headers */, - FA57FB9A1AE1993600F2AD6D /* noise1234.h in Headers */, - FACA02EF1F5E396B0084B28F /* Compressor.h in Headers */, - FA0B7CED1A95902C000E1D17 /* Event.h in Headers */, - FA0B7D811A95902C000E1D17 /* Volatile.h in Headers */, - FA0B7B2E1A958EA3000E1D17 /* unchecked.h in Headers */, - FA0B7D081A95902C000E1D17 /* wrap_File.h in Headers */, - FA0B79451A958E3B000E1D17 /* Variant.h in Headers */, - FA0B7E5C1A95902C000E1D17 /* wrap_MotorJoint.h in Headers */, - FA4F2BA91DE1E36400CA37D7 /* wrap_RecordingDevice.h in Headers */, - FA0B7A7C1A958EA3000E1D17 /* b2Contact.h in Headers */, - FA0B7A881A958EA3000E1D17 /* b2PolygonAndCircleContact.h in Headers */, - FA4F2B7A1DE0125B00CA37D7 /* xxhash.h in Headers */, - FA0B7DDE1A95902C000E1D17 /* wrap_BezierCurve.h in Headers */, - FA0B7DED1A95902C000E1D17 /* Cursor.h in Headers */, - FA0B7E501A95902C000E1D17 /* wrap_Fixture.h in Headers */, - FA28EBD71E352DB5003446F4 /* FenceSync.h in Headers */, - FADF542C1E3DAADA00012CC0 /* wrap_Mesh.h in Headers */, - FAA3A9B01B7D465A00CED060 /* android.h in Headers */, - 217DFBDE1D9F6D490055D849 /* compat.h in Headers */, - FA0B7A491A958EA3000E1D17 /* b2PolygonShape.h in Headers */, - FA0B79281A958E3B000E1D17 /* math.h in Headers */, - 217DFC121D9F6D490055D849 /* usocket.h in Headers */, - FA0B7A9A1A958EA3000E1D17 /* b2MotorJoint.h in Headers */, - 217DFC081D9F6D490055D849 /* udp.h in Headers */, - FA0B7DCF1A95902C000E1D17 /* wrap_Keyboard.h in Headers */, - FA0B7EA21A95902C000E1D17 /* Sound.h in Headers */, - FA0B7B331A958EA3000E1D17 /* wuff_config.h in Headers */, - FA0B7CF31A95902C000E1D17 /* DroppedFile.h in Headers */, - FA0B7D3B1A95902C000E1D17 /* Graphics.h in Headers */, - FA0B7E6E1A95902C000E1D17 /* wrap_RevoluteJoint.h in Headers */, - FA27B3AC1B498151008A9DCE /* VideoStream.h in Headers */, - FA0B7AC71A958EA3000E1D17 /* unix.h in Headers */, - FA0B7E8D1A95902C000E1D17 /* FLACDecoder.h in Headers */, - 217DFC001D9F6D490055D849 /* socket.lua.h in Headers */, - FA0B7A501A958EA3000E1D17 /* b2Draw.h in Headers */, - FA0B7DE71A95902C000E1D17 /* Cursor.h in Headers */, - 217DFBEC1D9F6D490055D849 /* ltn12.lua.h in Headers */, - FA0B7DB61A95902C000E1D17 /* wrap_ImageData.h in Headers */, - FADF543D1E3DAFF700012CC0 /* wrap_Graphics.h in Headers */, - 217DFBFE1D9F6D490055D849 /* socket.h in Headers */, - FA0B7A971A958EA3000E1D17 /* b2Joint.h in Headers */, - FA0B7A851A958EA3000E1D17 /* b2EdgeAndPolygonContact.h in Headers */, - FAF1409C1E20934C00F898D2 /* propagateNoContraction.h in Headers */, - FA0B7D2D1A95902C000E1D17 /* wrap_Rasterizer.h in Headers */, - FA0B7AB71A958EA3000E1D17 /* ddsparse.h in Headers */, - FA0B7DA11A95902C000E1D17 /* KTXHandler.h in Headers */, - 217DFBE01D9F6D490055D849 /* except.h in Headers */, - FA0B79311A958E3B000E1D17 /* Module.h in Headers */, - 217DFBF51D9F6D490055D849 /* mime.lua.h in Headers */, - FAC7CD961FE755B4006A60C7 /* lz4opt.h in Headers */, - FA9D8DD31DEB56C3002CD881 /* pixelformat.h in Headers */, - FAF140A61E20934C00F898D2 /* ScanContext.h in Headers */, - FA0B7E4A1A95902C000E1D17 /* wrap_DistanceJoint.h in Headers */, - FA0B7A6A1A958EA3000E1D17 /* b2TimeStep.h in Headers */, - FA0B7A281A958EA3000E1D17 /* Box2D.h in Headers */, - FA0B7DE41A95902C000E1D17 /* wrap_RandomGenerator.h in Headers */, - FA0B7E0B1A95902C000E1D17 /* EdgeShape.h in Headers */, - FA0B7EDA1A95902D000E1D17 /* wrap_Timer.h in Headers */, - FA0B7EB11A95902C000E1D17 /* System.h in Headers */, - FA0B7E1A1A95902C000E1D17 /* MotorJoint.h in Headers */, - FA0B7D441A95902C000E1D17 /* OpenGL.h in Headers */, - FA0B7E081A95902C000E1D17 /* DistanceJoint.h in Headers */, - FA0B7E711A95902C000E1D17 /* wrap_RopeJoint.h in Headers */, - FA0B7E411A95902C000E1D17 /* wrap_ChainShape.h in Headers */, - FA0B7E171A95902C000E1D17 /* Joint.h in Headers */, - FA0B793F1A958E3B000E1D17 /* types.h in Headers */, - FA0B7AB31A958EA3000E1D17 /* b2Rope.h in Headers */, - FA41A3CA1C0A1F950084430C /* ASTCHandler.h in Headers */, - FADF54041E3D77B500012CC0 /* wrap_Text.h in Headers */, - FA0B7ED31A95902C000E1D17 /* wrap_ThreadModule.h in Headers */, - FA0B7A511A958EA3000E1D17 /* b2GrowableStack.h in Headers */, - FAC756F61E4F99B400B91289 /* Effect.h in Headers */, - FA0B7ADD1A958EA3000E1D17 /* gladfuncs.hpp in Headers */, - FAF1405D1E20934C00F898D2 /* intermediate.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - FA0B78DC1A958B90000E1D17 /* liblove-ios */ = { - isa = PBXNativeTarget; - buildConfigurationList = FA0B78EE1A958B90000E1D17 /* Build configuration list for PBXNativeTarget "liblove-ios" */; - buildPhases = ( - FA0B78D91A958B90000E1D17 /* Sources */, - FA0B78DA1A958B90000E1D17 /* Frameworks */, - FA0B78DB1A958B90000E1D17 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "liblove-ios"; - productName = "liblove-ios"; - productReference = FA0B78DD1A958B90000E1D17 /* liblove.a */; - productType = "com.apple.product-type.library.static"; - }; - FA577AAE16C7507900860150 /* liblove-macosx */ = { - isa = PBXNativeTarget; - buildConfigurationList = FA577ABF16C7507900860150 /* Build configuration list for PBXNativeTarget "liblove-macosx" */; - buildPhases = ( - FA577AAA16C7507900860150 /* Sources */, - FA577AAB16C7507900860150 /* Frameworks */, - FA577AAC16C7507900860150 /* Headers */, - FA577AAD16C7507900860150 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "liblove-macosx"; - productName = love; - productReference = FA577AAF16C7507900860150 /* love.framework */; - productType = "com.apple.product-type.framework"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 08FB7793FE84155DC02AAC07 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 1000; - TargetAttributes = { - FA0B78DC1A958B90000E1D17 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "liblove" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - en, - ); - mainGroup = 54067CFB7D564E5764FA17DC /* love */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - FA577AAE16C7507900860150 /* liblove-macosx */, - FA0B78DC1A958B90000E1D17 /* liblove-ios */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - FA577AAD16C7507900860150 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 217DFC0F1D9F6D490055D849 /* url.lua in Resources */, - FADF54101E3D7CDD00012CC0 /* wrap_Video.lua in Resources */, - 217DFBFC1D9F6D490055D849 /* smtp.lua in Resources */, - FADF54381E3DAFBA00012CC0 /* wrap_Graphics.lua in Resources */, - 217DFBF01D9F6D490055D849 /* mbox.lua in Resources */, - 217DFBE11D9F6D490055D849 /* ftp.lua in Resources */, - 217DFBFF1D9F6D490055D849 /* socket.lua in Resources */, - 217DFC051D9F6D490055D849 /* tp.lua in Resources */, - 217DFBE51D9F6D490055D849 /* http.lua in Resources */, - 217DFBEB1D9F6D490055D849 /* ltn12.lua in Resources */, - 217DFBF41D9F6D490055D849 /* mime.lua in Resources */, - 217DFBE31D9F6D490055D849 /* headers.lua in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - FA0B78D91A958B90000E1D17 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - FA0B7DE01A95902C000E1D17 /* wrap_Math.cpp in Sources */, - FA0B7DA91A95902C000E1D17 /* PVRHandler.cpp in Sources */, - FAE64A842071363100BC7981 /* physfs_archiver_iso9660.c in Sources */, - FA0B7EC61A95902C000E1D17 /* ThreadModule.cpp in Sources */, - FA0B7D2C1A95902C000E1D17 /* wrap_Rasterizer.cpp in Sources */, - FADF54081E3D78F700012CC0 /* Video.cpp in Sources */, - FA9D8DD81DEF8411002CD881 /* Data.cpp in Sources */, - FA0B7E8F1A95902C000E1D17 /* GmeDecoder.cpp in Sources */, - FADF542B1E3DAADA00012CC0 /* wrap_Mesh.cpp in Sources */, - FA0B7CD71A95902C000E1D17 /* Audio.cpp in Sources */, - FA0B7AC01A958EA3000E1D17 /* host.c in Sources */, - FA0B7EB01A95902C000E1D17 /* System.cpp in Sources */, - FA0B7EE31A95902D000E1D17 /* Window.cpp in Sources */, - FA0B7AAB1A958EA3000E1D17 /* b2WeldJoint.cpp in Sources */, - FA0B7EC21A95902C000E1D17 /* threads.cpp in Sources */, - FA4F2C051DE936C900CA37D7 /* compat.c in Sources */, - FA0B79371A958E3B000E1D17 /* macosx.mm in Sources */, - FA4F2BE81DE6651000CA37D7 /* wrap_Transform.cpp in Sources */, - FA0B7D011A95902C000E1D17 /* Filesystem.cpp in Sources */, - FAF140651E20934C00F898D2 /* Constant.cpp in Sources */, - FA0B7ED91A95902D000E1D17 /* wrap_Timer.cpp in Sources */, - FAF1407D1E20934C00F898D2 /* linkValidate.cpp in Sources */, - FAE64A872071363100BC7981 /* physfs_archiver_slb.c in Sources */, - FA0B7DD11A95902C000E1D17 /* love.cpp in Sources */, - FA15DFAF1F9B8D390042AB22 /* lstrlib.c in Sources */, - FA0B7AB61A958EA3000E1D17 /* ddsparse.cpp in Sources */, - FA0B7D221A95902C000E1D17 /* Rasterizer.cpp in Sources */, - FA0B7A4F1A958EA3000E1D17 /* b2Draw.cpp in Sources */, - FAF140BC1E20934C00F898D2 /* ossource.cpp in Sources */, - FA0B7D7D1A95902C000E1D17 /* Texture.cpp in Sources */, - FACA02FB1F5E397E0084B28F /* HashFunction.cpp in Sources */, - FAF140A81E20934C00F898D2 /* ShaderLang.cpp in Sources */, - FA1BA09E1E16CFCE00AA2803 /* Font.cpp in Sources */, - FAE64A8A2071363100BC7981 /* physfs_archiver_wad.c in Sources */, - FA0B7ECC1A95902C000E1D17 /* wrap_Channel.cpp in Sources */, - FA0B7E6D1A95902C000E1D17 /* wrap_RevoluteJoint.cpp in Sources */, - FA0B7A5F1A958EA3000E1D17 /* b2Body.cpp in Sources */, - FADF541C1E3DA46C00012CC0 /* wrap_Image.cpp in Sources */, - FACA02FA1F5E397B0084B28F /* DataModule.cpp in Sources */, - FA0B7E641A95902C000E1D17 /* wrap_PolygonShape.cpp in Sources */, - FA4F2C031DE936C200CA37D7 /* auxiliar.c in Sources */, - FA0B7E731A95902C000E1D17 /* wrap_Shape.cpp in Sources */, - FA0B7CFE1A95902C000E1D17 /* File.cpp in Sources */, - FA3C5E481F8D80CA0003C579 /* ShaderStage.cpp in Sources */, - FA27B39E1B498151008A9DCE /* Video.cpp in Sources */, - FA0B7A751A958EA3000E1D17 /* b2ChainAndPolygonContact.cpp in Sources */, - FA0B7E6A1A95902C000E1D17 /* wrap_PulleyJoint.cpp in Sources */, - FA0B7DB81A95902C000E1D17 /* Joystick.cpp in Sources */, - FA91DA8C1F377C3900C80E33 /* deprecation.cpp in Sources */, - FA6A2B6B1F5F7F560074C308 /* DataView.cpp in Sources */, - FA0B7E401A95902C000E1D17 /* wrap_ChainShape.cpp in Sources */, - FA0B7DEC1A95902C000E1D17 /* Cursor.cpp in Sources */, - FA0B7D871A95902C000E1D17 /* ImageData.cpp in Sources */, - FA0B7E101A95902C000E1D17 /* FrictionJoint.cpp in Sources */, - FAF140741E20934C00F898D2 /* intermOut.cpp in Sources */, - FA620A361AA2F8DB005DB4C2 /* wrap_Texture.cpp in Sources */, - FA0B7D0A1A95902C000E1D17 /* wrap_FileData.cpp in Sources */, - FAF140781E20934C00F898D2 /* iomapper.cpp in Sources */, - FA0B7ABE1A958EA3000E1D17 /* compress.c in Sources */, - FA0B7CF21A95902C000E1D17 /* DroppedFile.cpp in Sources */, - FA4F2C141DE936FE00CA37D7 /* usocket.c in Sources */, - FAF140831E20934C00F898D2 /* ParseContextBase.cpp in Sources */, - FA0B7AD21A958EA3000E1D17 /* protocol.c in Sources */, - FAF140A41E20934C00F898D2 /* Scan.cpp in Sources */, - FA0B7D1F1A95902C000E1D17 /* ImageRasterizer.cpp in Sources */, - FAE64A952071365100BC7981 /* physfs_platform_qnx.c in Sources */, - FA0B7EA41A95902C000E1D17 /* SoundData.cpp in Sources */, - FA0B7D041A95902C000E1D17 /* wrap_DroppedFile.cpp in Sources */, - FAF1406A1E20934C00F898D2 /* glslang_tab.cpp in Sources */, - FA91591F1CF1ED7500A7053F /* halffloat.cpp in Sources */, - FA8951A31AA2EDF300EC385A /* wrap_Event.cpp in Sources */, - FADF540E1E3D7CDD00012CC0 /* wrap_Video.cpp in Sources */, - FA0B7A361A958EA3000E1D17 /* b2Distance.cpp in Sources */, - FA0B7D4C1A95902C000E1D17 /* Shader.cpp in Sources */, - FA0B792A1A958E3B000E1D17 /* Matrix.cpp in Sources */, - FAF140981E20934C00F898D2 /* PpTokens.cpp in Sources */, - FAF140AA1E20934C00F898D2 /* SymbolTable.cpp in Sources */, - FA0B7A8D1A958EA3000E1D17 /* b2DistanceJoint.cpp in Sources */, - FA0B7A841A958EA3000E1D17 /* b2EdgeAndPolygonContact.cpp in Sources */, - FA3C5E431F8C368C0003C579 /* ShaderStage.cpp in Sources */, - FA0B7E191A95902C000E1D17 /* MotorJoint.cpp in Sources */, - FAF1406F1E20934C00F898D2 /* Initialize.cpp in Sources */, - FA0B7E4F1A95902C000E1D17 /* wrap_Fixture.cpp in Sources */, - FA0B7EBF1A95902C000E1D17 /* Thread.cpp in Sources */, - FACA02F91F5E39790084B28F /* Compressor.cpp in Sources */, - FAF140811E20934C00F898D2 /* parseConst.cpp in Sources */, - FA4F2C121DE936FE00CA37D7 /* unixtcp.c in Sources */, - FA0B7EB91A95902C000E1D17 /* Channel.cpp in Sources */, - FAE64A962071365100BC7981 /* physfs_platform_windows.c in Sources */, - FA4B66CA1ABBCF1900558F15 /* Timer.cpp in Sources */, - FA0B7A3F1A958EA3000E1D17 /* b2ChainShape.cpp in Sources */, - FA0B7E921A95902C000E1D17 /* ModPlugDecoder.cpp in Sources */, - FA0B7E521A95902C000E1D17 /* wrap_FrictionJoint.cpp in Sources */, - FADF54351E3DAE6E00012CC0 /* wrap_SpriteBatch.cpp in Sources */, - FA4F2BB51DE1E4C300CA37D7 /* wrap_RecordingDevice.cpp in Sources */, - FA0B7A311A958EA3000E1D17 /* b2CollidePolygon.cpp in Sources */, - FA4F2C111DE936FE00CA37D7 /* unix.c in Sources */, - FA1BA0A31E16D97500AA2803 /* wrap_Font.cpp in Sources */, - FA0B7A931A958EA3000E1D17 /* b2GearJoint.cpp in Sources */, - FA0B7E0D1A95902C000E1D17 /* Fixture.cpp in Sources */, - FADF53FE1E3D74F200012CC0 /* Text.cpp in Sources */, - FA0B7D191A95902C000E1D17 /* TrueTypeRasterizer.cpp in Sources */, - FA0B7CFB1A95902C000E1D17 /* Filesystem.cpp in Sources */, - FA0B7D3D1A95902C000E1D17 /* Image.cpp in Sources */, - FA0B7B351A958EA3000E1D17 /* wuff_convert.c in Sources */, - FAF140941E20934C00F898D2 /* PpScanner.cpp in Sources */, - FA9D53AD1F5307E900125C6B /* Deprecations.cpp in Sources */, - FA0B7E431A95902C000E1D17 /* wrap_CircleShape.cpp in Sources */, - FAE64A912071364800BC7981 /* physfs.c in Sources */, - FAE64A852071363100BC7981 /* physfs_archiver_mvl.c in Sources */, - FA0B7CE61A95902C000E1D17 /* wrap_Source.cpp in Sources */, - FA0B7AA21A958EA3000E1D17 /* b2PulleyJoint.cpp in Sources */, - FA9D8DDE1DEF842A002CD881 /* Drawable.cpp in Sources */, - FA0B7CCE1A95902C000E1D17 /* Audio.cpp in Sources */, - FADF54031E3D77B500012CC0 /* wrap_Text.cpp in Sources */, - FA0B7DCB1A95902C000E1D17 /* Keyboard.cpp in Sources */, - FA0B7A901A958EA3000E1D17 /* b2FrictionJoint.cpp in Sources */, - FA0B7DFB1A95902C000E1D17 /* Body.cpp in Sources */, - FA0B7ED21A95902C000E1D17 /* wrap_ThreadModule.cpp in Sources */, - FADF54261E3DA5BA00012CC0 /* Mesh.cpp in Sources */, - FA0B7EE01A95902D000E1D17 /* wrap_Touch.cpp in Sources */, - FA0B7A3C1A958EA3000E1D17 /* b2TimeOfImpact.cpp in Sources */, - FA4F2C081DE936DD00CA37D7 /* io.c in Sources */, - FA0B7CDD1A95902C000E1D17 /* Source.cpp in Sources */, - FA0B7DC51A95902C000E1D17 /* wrap_JoystickModule.cpp in Sources */, - FA0B7E701A95902C000E1D17 /* wrap_RopeJoint.cpp in Sources */, - FACA02FC1F5E39810084B28F /* wrap_CompressedData.cpp in Sources */, - FAF140AD1E20934C00F898D2 /* Versions.cpp in Sources */, - FA0B7A7B1A958EA3000E1D17 /* b2Contact.cpp in Sources */, - FA0B7A6F1A958EA3000E1D17 /* b2WorldCallbacks.cpp in Sources */, - FA0B793C1A958E3B000E1D17 /* runtime.cpp in Sources */, - FAF140DC1E20934C00F898D2 /* InitializeDll.cpp in Sources */, - FA0B7DBC1A95902C000E1D17 /* Joystick.cpp in Sources */, - FA0B7DAF1A95902C000E1D17 /* wrap_CompressedImageData.cpp in Sources */, - FA0B7A481A958EA3000E1D17 /* b2PolygonShape.cpp in Sources */, - FA0B7A991A958EA3000E1D17 /* b2MotorJoint.cpp in Sources */, - FA0B7AD51A958EA3000E1D17 /* unix.c in Sources */, - FAB17BE71ABFAA9000F9BA27 /* lz4.c in Sources */, - FAE64A902071364800BC7981 /* physfs_unicode.c in Sources */, - FA4F2BE71DE6650D00CA37D7 /* Transform.cpp in Sources */, - FA0B7A531A958EA3000E1D17 /* b2Math.cpp in Sources */, - FAF140A11E20934C00F898D2 /* RemoveTree.cpp in Sources */, - FA0B7CDA1A95902C000E1D17 /* Pool.cpp in Sources */, - FA0B7E161A95902C000E1D17 /* Joint.cpp in Sources */, - FA0B7EE91A95902D000E1D17 /* wrap_Window.cpp in Sources */, - FA1583E21E196180005E603B /* wrap_Shader.cpp in Sources */, - FA0B7AB91A958EA3000E1D17 /* enet.cpp in Sources */, - FA0B7E281A95902C000E1D17 /* PulleyJoint.cpp in Sources */, - FA56AA391FAFF02000A43D5F /* memory.cpp in Sources */, - FA0B7A4C1A958EA3000E1D17 /* b2BlockAllocator.cpp in Sources */, - FAF1409E1E20934C00F898D2 /* reflection.cpp in Sources */, - FA15DFAE1F9B8D360042AB22 /* lutf8lib.c in Sources */, - FAF1408B1E20934C00F898D2 /* Pp.cpp in Sources */, - FA76344B1E28722A0066EF9E /* StreamBuffer.cpp in Sources */, - FA0B7E041A95902C000E1D17 /* Contact.cpp in Sources */, - FA0B7D831A95902C000E1D17 /* CompressedImageData.cpp in Sources */, - FA0B7B311A958EA3000E1D17 /* wuff.c in Sources */, - FA0B7DF21A95902C000E1D17 /* wrap_Cursor.cpp in Sources */, - FA0B7E011A95902C000E1D17 /* CircleShape.cpp in Sources */, - FAE64A8C2071363100BC7981 /* physfs_byteorder.c in Sources */, - FA0B7E461A95902C000E1D17 /* wrap_Contact.cpp in Sources */, - FA0B7D161A95902C000E1D17 /* Font.cpp in Sources */, - FA0B7EB61A95902C000E1D17 /* wrap_System.cpp in Sources */, - FA0B7DAC1A95902C000E1D17 /* STBHandler.cpp in Sources */, - FADF53F91E3C7ACD00012CC0 /* Buffer.cpp in Sources */, - FA0B79301A958E3B000E1D17 /* Module.cpp in Sources */, - FAF1409B1E20934C00F898D2 /* propagateNoContraction.cpp in Sources */, - FA0B7DDA1A95902C000E1D17 /* RandomGenerator.cpp in Sources */, - FA2AF6751DAD64970032B62C /* vertex.cpp in Sources */, - FAF140561E20934C00F898D2 /* Link.cpp in Sources */, - FAF140851E20934C00F898D2 /* ParseHelper.cpp in Sources */, - FA0B7D801A95902C000E1D17 /* Volatile.cpp in Sources */, - FA0B792D1A958E3B000E1D17 /* Memoizer.cpp in Sources */, - FA1BA0B21E16FD0800AA2803 /* Shader.cpp in Sources */, - FA0B7EBC1A95902C000E1D17 /* LuaThread.cpp in Sources */, - FA0B7A871A958EA3000E1D17 /* b2PolygonAndCircleContact.cpp in Sources */, - FA0B7EF21A959D2C000E1D17 /* ios.mm in Sources */, - FAE64A802071362A00BC7981 /* physfs_archiver_7z.c in Sources */, - FA0B7D3A1A95902C000E1D17 /* Graphics.cpp in Sources */, - FA4F2BB21DE1E4B400CA37D7 /* RecordingDevice.cpp in Sources */, - FAE64A922071364B00BC7981 /* physfs_platform_winrt.cpp in Sources */, - FA0B7A2D1A958EA3000E1D17 /* b2CollideCircle.cpp in Sources */, - FA4F2C0F1DE936FE00CA37D7 /* timeout.c in Sources */, - FA59A2D31C06481400328DBA /* ParticleSystem.cpp in Sources */, - FA0B7E131A95902C000E1D17 /* GearJoint.cpp in Sources */, - FA0B7DC21A95902C000E1D17 /* wrap_Joystick.cpp in Sources */, - FA0B7CD41A95902C000E1D17 /* Source.cpp in Sources */, - FAA3A9AF1B7D465A00CED060 /* android.cpp in Sources */, - FAE64A812071363100BC7981 /* physfs_archiver_dir.c in Sources */, - FA0B7CD11A95902C000E1D17 /* Audio.cpp in Sources */, - FA4F2B7B1DE0181B00CA37D7 /* xxhash.c in Sources */, - FA0B7D131A95902C000E1D17 /* Font.cpp in Sources */, - FA0B7EC91A95902C000E1D17 /* threads.cpp in Sources */, - FA0B7A781A958EA3000E1D17 /* b2CircleContact.cpp in Sources */, - FAF1408D1E20934C00F898D2 /* PpAtom.cpp in Sources */, - FA0B7A9C1A958EA3000E1D17 /* b2MouseJoint.cpp in Sources */, - FAF140721E20934C00F898D2 /* Intermediate.cpp in Sources */, - FA41A3C91C0A1F950084430C /* ASTCHandler.cpp in Sources */, - FA0B7E551A95902C000E1D17 /* wrap_GearJoint.cpp in Sources */, - FA0B7E791A95902C000E1D17 /* wrap_WheelJoint.cpp in Sources */, - FA0B7DDD1A95902C000E1D17 /* wrap_BezierCurve.cpp in Sources */, - FA0B7A2A1A958EA3000E1D17 /* b2BroadPhase.cpp in Sources */, - FA0B7A811A958EA3000E1D17 /* b2EdgeAndCircleContact.cpp in Sources */, - FAF188A01E9DBC4B008C1479 /* depthstencil.cpp in Sources */, - FA0B7D071A95902C000E1D17 /* wrap_File.cpp in Sources */, - FA6A2B751F60B6710074C308 /* ByteData.cpp in Sources */, - FAD19A181DFF8CA200D5398A /* ImageDataBase.cpp in Sources */, - FA0B7AD01A958EA3000E1D17 /* peer.c in Sources */, - FA27B3C11B4985BF008A9DCE /* wrap_VideoStream.cpp in Sources */, - FADF54211E3DA52C00012CC0 /* wrap_ParticleSystem.cpp in Sources */, - FA0B791C1A958E3B000E1D17 /* b64.cpp in Sources */, - FA1E88851DF363E100E808AA /* Filter.cpp in Sources */, - FA0B7DA01A95902C000E1D17 /* KTXHandler.cpp in Sources */, - FA0B7A5C1A958EA3000E1D17 /* b2Timer.cpp in Sources */, - FA0B7CEC1A95902C000E1D17 /* Event.cpp in Sources */, - FA27B3AB1B498151008A9DCE /* VideoStream.cpp in Sources */, - FA0B7A7E1A958EA3000E1D17 /* b2ContactSolver.cpp in Sources */, - FA0B7E581A95902C000E1D17 /* wrap_Joint.cpp in Sources */, - FAECA1B51F31648A0095D008 /* FormatHandler.cpp in Sources */, - FA4F2C0A1DE936E600CA37D7 /* mime.c in Sources */, - FA0B7E311A95902C000E1D17 /* Shape.cpp in Sources */, - FA0B7E491A95902C000E1D17 /* wrap_DistanceJoint.cpp in Sources */, - FA0B7A391A958EA3000E1D17 /* b2DynamicTree.cpp in Sources */, - FA4F2C101DE936FE00CA37D7 /* udp.c in Sources */, - FAE64A8F2071364200BC7981 /* physfs_platform_unix.c in Sources */, - FA0B7A681A958EA3000E1D17 /* b2Island.cpp in Sources */, - FA0B7E2B1A95902C000E1D17 /* RevoluteJoint.cpp in Sources */, - FA0B7B291A958EA3000E1D17 /* simplexnoise1234.cpp in Sources */, - FA0B7D261A95902C000E1D17 /* wrap_Font.cpp in Sources */, - FA4F2BB31DE1E4B800CA37D7 /* RecordingDevice.cpp in Sources */, - FA4F2C071DE936DA00CA37D7 /* inet.c in Sources */, - FAE64A8B2071363100BC7981 /* physfs_archiver_zip.c in Sources */, - FA4F2C0B1DE936EA00CA37D7 /* options.c in Sources */, - FA4F2C0D1DE936F100CA37D7 /* serial.c in Sources */, - FA0B7E0A1A95902C000E1D17 /* EdgeShape.cpp in Sources */, - FADF54301E3DABF600012CC0 /* SpriteBatch.cpp in Sources */, - FA0B7CF81A95902C000E1D17 /* FileData.cpp in Sources */, - FA0B7DA61A95902C000E1D17 /* PNGHandler.cpp in Sources */, - FAE64A932071365100BC7981 /* physfs_platform_haiku.cpp in Sources */, - FA0B7E981A95902C000E1D17 /* Sound.cpp in Sources */, - FA0B7E371A95902C000E1D17 /* WheelJoint.cpp in Sources */, - FA0B7A8A1A958EA3000E1D17 /* b2PolygonContact.cpp in Sources */, - FA4F2C0C1DE936ED00CA37D7 /* select.c in Sources */, - FA0B7D8E1A95902C000E1D17 /* ddsHandler.cpp in Sources */, - FA0B7DFE1A95902C000E1D17 /* ChainShape.cpp in Sources */, - FAE64A892071363100BC7981 /* physfs_archiver_vdf.c in Sources */, - FA0B7A451A958EA3000E1D17 /* b2EdgeShape.cpp in Sources */, - FA15DFB21F9B8D840042AB22 /* TheoraVideoStream.cpp in Sources */, - FAF1406D1E20934C00F898D2 /* InfoSink.cpp in Sources */, - FAF1407B1E20934C00F898D2 /* limits.cpp in Sources */, - FA0B7ABB1A958EA3000E1D17 /* callbacks.c in Sources */, - FA0B7A721A958EA3000E1D17 /* b2ChainAndCircleContact.cpp in Sources */, - FA0B7EAA1A95902C000E1D17 /* wrap_Sound.cpp in Sources */, - FA0B79391A958E3B000E1D17 /* Reference.cpp in Sources */, - FA620A331AA2F8DB005DB4C2 /* wrap_Quad.cpp in Sources */, - FA0B7E071A95902C000E1D17 /* DistanceJoint.cpp in Sources */, - FADF543C1E3DAFF700012CC0 /* wrap_Graphics.cpp in Sources */, - FA0B7A331A958EA3000E1D17 /* b2Collision.cpp in Sources */, - FAE64A942071365100BC7981 /* physfs_platform_os2.c in Sources */, - FA0B7E5E1A95902C000E1D17 /* wrap_MouseJoint.cpp in Sources */, - FA0B7B3B1A958EA3000E1D17 /* wuff_memory.c in Sources */, - FA0B79411A958E3B000E1D17 /* utf8.cpp in Sources */, - FAE64A862071363100BC7981 /* physfs_archiver_qpak.c in Sources */, - FA0B7ADF1A958EA3000E1D17 /* lodepng.cpp in Sources */, - FA0B7D341A95902C000E1D17 /* Canvas.cpp in Sources */, - FAF140761E20934C00F898D2 /* IntermTraverse.cpp in Sources */, - FA0B7E8C1A95902C000E1D17 /* FLACDecoder.cpp in Sources */, - FA0B7A421A958EA3000E1D17 /* b2CircleShape.cpp in Sources */, - FA0B7D491A95902C000E1D17 /* Polyline.cpp in Sources */, - FA0B7CE31A95902C000E1D17 /* wrap_Audio.cpp in Sources */, - FA0B7B381A958EA3000E1D17 /* wuff_internal.c in Sources */, - FA0B7DF81A95902C000E1D17 /* Body.cpp in Sources */, - FA4F2BB41DE1E4BD00CA37D7 /* RecordingDevice.cpp in Sources */, - FA0B7DF51A95902C000E1D17 /* wrap_Mouse.cpp in Sources */, - FA0B7E861A95902C000E1D17 /* CoreAudioDecoder.cpp in Sources */, - FA0B7E761A95902C000E1D17 /* wrap_WeldJoint.cpp in Sources */, - FA0B7D561A95902C000E1D17 /* Buffer.cpp in Sources */, - FA0B7A6C1A958EA3000E1D17 /* b2World.cpp in Sources */, - FA1557C51CE90BD900AFF582 /* EXRHandler.cpp in Sources */, - FA57FB991AE1993600F2AD6D /* noise1234.cpp in Sources */, - FA0B7E221A95902C000E1D17 /* PolygonShape.cpp in Sources */, - FA0B7A651A958EA3000E1D17 /* b2Fixture.cpp in Sources */, - FA28EBD61E352DB5003446F4 /* FenceSync.cpp in Sources */, - FA0B7DA31A95902C000E1D17 /* PKMHandler.cpp in Sources */, - FA0B7AB21A958EA3000E1D17 /* b2Rope.cpp in Sources */, - FAB17BF61ABFC4B100F9BA27 /* lz4hc.c in Sources */, - FAF1408F1E20934C00F898D2 /* PpContext.cpp in Sources */, - FA0B7EA71A95902C000E1D17 /* wrap_Decoder.cpp in Sources */, - FA0B7E1C1A95902C000E1D17 /* MouseJoint.cpp in Sources */, - FA29C0061E12355B00268CD8 /* StreamBuffer.cpp in Sources */, - FAE64A882071363100BC7981 /* physfs_archiver_unpacked.c in Sources */, - FA0B7CF51A95902C000E1D17 /* File.cpp in Sources */, - FA0B7E341A95902C000E1D17 /* WeldJoint.cpp in Sources */, - FA4F2C091DE936E200CA37D7 /* luasocket.c in Sources */, - FA9D8DD21DEB56C3002CD881 /* pixelformat.cpp in Sources */, - FA0B7B221A958EA3000E1D17 /* luasocket.cpp in Sources */, - FA0B7D311A95902C000E1D17 /* Graphics.cpp in Sources */, - FA0B7E9E1A95902C000E1D17 /* WaveDecoder.cpp in Sources */, - FA0B7EB31A95902C000E1D17 /* System.cpp in Sources */, - FA0B7D1C1A95902C000E1D17 /* GlyphData.cpp in Sources */, - FA4F2C061DE936CD00CA37D7 /* except.c in Sources */, - FA0B7AAE1A958EA3000E1D17 /* b2WheelJoint.cpp in Sources */, - FA15DFB01F9B8D6A0042AB22 /* wrap_Data.cpp in Sources */, - FA0B7E671A95902C000E1D17 /* wrap_PrismaticJoint.cpp in Sources */, - FA0B7DCE1A95902C000E1D17 /* wrap_Keyboard.cpp in Sources */, - FA0B7EE61A95902D000E1D17 /* Window.cpp in Sources */, - FA0B7E3A1A95902C000E1D17 /* World.cpp in Sources */, - FA0B79471A958E3B000E1D17 /* Vector.cpp in Sources */, - FAE64A832071363100BC7981 /* physfs_archiver_hog.c in Sources */, - FAC756F71E4F99BC00B91289 /* Effect.cpp in Sources */, - FA0B7E7F1A95902C000E1D17 /* Joint.cpp in Sources */, - FA0B7DB21A95902C000E1D17 /* wrap_Image.cpp in Sources */, - FA0B7E891A95902C000E1D17 /* Decoder.cpp in Sources */, - FA0B7A591A958EA3000E1D17 /* b2StackAllocator.cpp in Sources */, - FAECA1B31F3164700095D008 /* CompressedSlice.cpp in Sources */, - FA0B7E3D1A95902C000E1D17 /* wrap_Body.cpp in Sources */, - FA0B7D7A1A95902C000E1D17 /* Quad.cpp in Sources */, - FA620A3B1AA305F6005DB4C2 /* types.cpp in Sources */, - FA0B7DD41A95902C000E1D17 /* BezierCurve.cpp in Sources */, - FA0B7E7C1A95902C000E1D17 /* wrap_World.cpp in Sources */, - FA4F2C0E1DE936FE00CA37D7 /* tcp.c in Sources */, - FA0B7D431A95902C000E1D17 /* OpenGL.cpp in Sources */, - FA0B7DBF1A95902C000E1D17 /* JoystickModule.cpp in Sources */, - FAB2D5AB1AABDD8A008224A4 /* TrueTypeRasterizer.cpp in Sources */, - FA0B7A9F1A958EA3000E1D17 /* b2PrismaticJoint.cpp in Sources */, - FA1BA0AD1E16F9EE00AA2803 /* wrap_Canvas.cpp in Sources */, - FAE64A822071363100BC7981 /* physfs_archiver_grp.c in Sources */, - FA0B79331A958E3B000E1D17 /* Object.cpp in Sources */, - FAE64A8D2071363500BC7981 /* physfs_platform_apple.m in Sources */, - FA0B7E5B1A95902C000E1D17 /* wrap_MotorJoint.cpp in Sources */, - FA0B79441A958E3B000E1D17 /* Variant.cpp in Sources */, - FA9D8DDA1DEF8411002CD881 /* Stream.cpp in Sources */, - FA0B7DD71A95902C000E1D17 /* MathModule.cpp in Sources */, - FAC756FC1E4F99DB00B91289 /* Effect.cpp in Sources */, - FA0B7D101A95902C000E1D17 /* BMFontRasterizer.cpp in Sources */, - FA0B7E9B1A95902C000E1D17 /* VorbisDecoder.cpp in Sources */, - FA0B7E4C1A95902C000E1D17 /* wrap_EdgeShape.cpp in Sources */, - FA0B7E251A95902C000E1D17 /* PrismaticJoint.cpp in Sources */, - FA0B7A561A958EA3000E1D17 /* b2Settings.cpp in Sources */, - FA0B7E611A95902C000E1D17 /* wrap_Physics.cpp in Sources */, - FA4F2C041DE936C600CA37D7 /* buffer.c in Sources */, - FA0B7DC81A95902C000E1D17 /* Keyboard.cpp in Sources */, - FA0B7EAD1A95902C000E1D17 /* wrap_SoundData.cpp in Sources */, - FA0B7E2E1A95902C000E1D17 /* RopeJoint.cpp in Sources */, - FA0B7CE01A95902C000E1D17 /* Source.cpp in Sources */, - FADF54171E3DA08E00012CC0 /* Image.cpp in Sources */, - FA0B7ECF1A95902C000E1D17 /* wrap_LuaThread.cpp in Sources */, - FA1BA0A81E16F20600AA2803 /* Canvas.cpp in Sources */, - FA0B7AA51A958EA3000E1D17 /* b2RevoluteJoint.cpp in Sources */, - FA0B7EA11A95902C000E1D17 /* Sound.cpp in Sources */, - FA0B7DE61A95902C000E1D17 /* Cursor.cpp in Sources */, - FA6A2B711F5F845F0074C308 /* wrap_DataView.cpp in Sources */, - FA0B7EDC1A95902D000E1D17 /* Touch.cpp in Sources */, - FA0B7CE91A95902C000E1D17 /* Event.cpp in Sources */, - FA4F2C131DE936FE00CA37D7 /* unixudp.c in Sources */, - FA9D8DE11DEF843D002CD881 /* Image.cpp in Sources */, - FA0B7A961A958EA3000E1D17 /* b2Joint.cpp in Sources */, - FA0B7A621A958EA3000E1D17 /* b2ContactManager.cpp in Sources */, - FA15DFAD1F9B8CBA0042AB22 /* StringMap.cpp in Sources */, - FA0B7A2F1A958EA3000E1D17 /* b2CollideEdge.cpp in Sources */, - FACA02F81F5E39760084B28F /* CompressedData.cpp in Sources */, - FA0B7ADA1A958EA3000E1D17 /* glad.cpp in Sources */, - FAF140541E20934C00F898D2 /* CodeGen.cpp in Sources */, - FA0B7E1F1A95902C000E1D17 /* Physics.cpp in Sources */, - FA6A2B7B1F60B8250074C308 /* wrap_ByteData.cpp in Sources */, - FA0B7E821A95902C000E1D17 /* Shape.cpp in Sources */, - FA0B7ACE1A958EA3000E1D17 /* packet.c in Sources */, - FAF140891E20934C00F898D2 /* PoolAlloc.cpp in Sources */, - FA27B3B41B498151008A9DCE /* wrap_Video.cpp in Sources */, - FA1E88801DF363D400E808AA /* Filter.cpp in Sources */, - FA0B7AA81A958EA3000E1D17 /* b2RopeJoint.cpp in Sources */, - FA0B7ACC1A958EA3000E1D17 /* list.c in Sources */, - FACA02FD1F5E39840084B28F /* wrap_DataModule.cpp in Sources */, - FA0B7DEF1A95902C000E1D17 /* Mouse.cpp in Sources */, - FA0B79251A958E3B000E1D17 /* Exception.cpp in Sources */, - FA0B7D291A95902C000E1D17 /* wrap_GlyphData.cpp in Sources */, - FA0B7DE31A95902C000E1D17 /* wrap_RandomGenerator.cpp in Sources */, - FAE64A8E2071363A00BC7981 /* physfs_platform_posix.c in Sources */, - FA0B7AD71A958EA3000E1D17 /* win32.c in Sources */, - FA15DFB11F9B8D820042AB22 /* OggDemuxer.cpp in Sources */, - FA0B7D0D1A95902C000E1D17 /* wrap_Filesystem.cpp in Sources */, - FA0B79211A958E3B000E1D17 /* delay.cpp in Sources */, - FA0B7DB51A95902C000E1D17 /* wrap_ImageData.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - FA577AAA16C7507900860150 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 217DFBDD1D9F6D490055D849 /* compat.c in Sources */, - FA0B7DDF1A95902C000E1D17 /* wrap_Math.cpp in Sources */, - FA0B7DA81A95902C000E1D17 /* PVRHandler.cpp in Sources */, - FA0B7EC51A95902C000E1D17 /* ThreadModule.cpp in Sources */, - FADF54071E3D78F700012CC0 /* Video.cpp in Sources */, - 217DFC031D9F6D490055D849 /* timeout.c in Sources */, - FA9D8DD71DEF8411002CD881 /* Data.cpp in Sources */, - FADF542A1E3DAADA00012CC0 /* wrap_Mesh.cpp in Sources */, - FA0B7D2B1A95902C000E1D17 /* wrap_Rasterizer.cpp in Sources */, - FA0B7E8E1A95902C000E1D17 /* GmeDecoder.cpp in Sources */, - FA0B7CD61A95902C000E1D17 /* Audio.cpp in Sources */, - FA3C5E421F8C368C0003C579 /* ShaderStage.cpp in Sources */, - FA0B7A9E1A958EA3000E1D17 /* b2PrismaticJoint.cpp in Sources */, - FA0B7EAF1A95902C000E1D17 /* System.cpp in Sources */, - FA0B7EE21A95902D000E1D17 /* Window.cpp in Sources */, - FA0B791B1A958E3B000E1D17 /* b64.cpp in Sources */, - FA0B7EC11A95902C000E1D17 /* threads.cpp in Sources */, - FA0B79321A958E3B000E1D17 /* Object.cpp in Sources */, - FA0B7D001A95902C000E1D17 /* Filesystem.cpp in Sources */, - FAF140641E20934C00F898D2 /* Constant.cpp in Sources */, - FA0B7ED81A95902D000E1D17 /* wrap_Timer.cpp in Sources */, - FAF1407C1E20934C00F898D2 /* linkValidate.cpp in Sources */, - FA0B7DD01A95902C000E1D17 /* love.cpp in Sources */, - FA0B7A521A958EA3000E1D17 /* b2Math.cpp in Sources */, - FA0B7D211A95902C000E1D17 /* Rasterizer.cpp in Sources */, - FAC7CD7C1FE35E95006A60C7 /* physfs_archiver_slb.c in Sources */, - FAC7CD931FE35E95006A60C7 /* physfs_archiver_zip.c in Sources */, - FA0B7D7C1A95902C000E1D17 /* Texture.cpp in Sources */, - FAF140BB1E20934C00F898D2 /* ossource.cpp in Sources */, - FA0B7ECB1A95902C000E1D17 /* wrap_Channel.cpp in Sources */, - FACA02F21F5E396B0084B28F /* HashFunction.cpp in Sources */, - FAF140A71E20934C00F898D2 /* ShaderLang.cpp in Sources */, - FA1BA09D1E16CFCE00AA2803 /* Font.cpp in Sources */, - FA0B7E6C1A95902C000E1D17 /* wrap_RevoluteJoint.cpp in Sources */, - FA0B7A5E1A958EA3000E1D17 /* b2Body.cpp in Sources */, - FA0B7E631A95902C000E1D17 /* wrap_PolygonShape.cpp in Sources */, - FADF541B1E3DA46C00012CC0 /* wrap_Image.cpp in Sources */, - FAC7CD7B1FE35E95006A60C7 /* physfs_platform_unix.c in Sources */, - FACA02F01F5E396B0084B28F /* DataModule.cpp in Sources */, - FA0B7E721A95902C000E1D17 /* wrap_Shape.cpp in Sources */, - FA0B7CFD1A95902C000E1D17 /* File.cpp in Sources */, - FA4F2BB01DE1E37B00CA37D7 /* RecordingDevice.cpp in Sources */, - FAC7CD911FE35E95006A60C7 /* physfs_archiver_grp.c in Sources */, - FA27B39D1B498151008A9DCE /* Video.cpp in Sources */, - FA15DFAC1F9B8C850042AB22 /* StringMap.cpp in Sources */, - FA4F2BAC1DE1E37000CA37D7 /* RecordingDevice.cpp in Sources */, - FA0B7A2E1A958EA3000E1D17 /* b2CollideEdge.cpp in Sources */, - FA0B7E691A95902C000E1D17 /* wrap_PulleyJoint.cpp in Sources */, - FA0B7DB71A95902C000E1D17 /* Joystick.cpp in Sources */, - FA0B7A321A958EA3000E1D17 /* b2Collision.cpp in Sources */, - FA91DA8B1F377C3900C80E33 /* deprecation.cpp in Sources */, - FA0B7E3F1A95902C000E1D17 /* wrap_ChainShape.cpp in Sources */, - FA0B7DEB1A95902C000E1D17 /* Cursor.cpp in Sources */, - FA0B7D861A95902C000E1D17 /* ImageData.cpp in Sources */, - FA0B7A3E1A958EA3000E1D17 /* b2ChainShape.cpp in Sources */, - FAF140731E20934C00F898D2 /* intermOut.cpp in Sources */, - FA0B7E0F1A95902C000E1D17 /* FrictionJoint.cpp in Sources */, - FA620A351AA2F8DB005DB4C2 /* wrap_Texture.cpp in Sources */, - FAF140771E20934C00F898D2 /* iomapper.cpp in Sources */, - FA0B7D091A95902C000E1D17 /* wrap_FileData.cpp in Sources */, - FA0B7B341A958EA3000E1D17 /* wuff_convert.c in Sources */, - FA0B7CF11A95902C000E1D17 /* DroppedFile.cpp in Sources */, - FAF140821E20934C00F898D2 /* ParseContextBase.cpp in Sources */, - FA0B7D1E1A95902C000E1D17 /* ImageRasterizer.cpp in Sources */, - FAF140A31E20934C00F898D2 /* Scan.cpp in Sources */, - FA0B7EA31A95902C000E1D17 /* SoundData.cpp in Sources */, - FA0B7D031A95902C000E1D17 /* wrap_DroppedFile.cpp in Sources */, - FA0B79291A958E3B000E1D17 /* Matrix.cpp in Sources */, - FA8951A21AA2EDF300EC385A /* wrap_Event.cpp in Sources */, - FAF140691E20934C00F898D2 /* glslang_tab.cpp in Sources */, - FA0B7ABF1A958EA3000E1D17 /* host.c in Sources */, - FA0B7D4B1A95902C000E1D17 /* Shader.cpp in Sources */, - FADF540D1E3D7CDD00012CC0 /* wrap_Video.cpp in Sources */, - FA0B7A581A958EA3000E1D17 /* b2StackAllocator.cpp in Sources */, - FA0B7A301A958EA3000E1D17 /* b2CollidePolygon.cpp in Sources */, - FA0B7A641A958EA3000E1D17 /* b2Fixture.cpp in Sources */, - FAF140971E20934C00F898D2 /* PpTokens.cpp in Sources */, - FAF140A91E20934C00F898D2 /* SymbolTable.cpp in Sources */, - FA0B7E181A95902C000E1D17 /* MotorJoint.cpp in Sources */, - FA0B7E4E1A95902C000E1D17 /* wrap_Fixture.cpp in Sources */, - FA0B7EBE1A95902C000E1D17 /* Thread.cpp in Sources */, - FAC7CD8F1FE35E95006A60C7 /* physfs_platform_posix.c in Sources */, - FAF1406E1E20934C00F898D2 /* Initialize.cpp in Sources */, - FA0B7EB81A95902C000E1D17 /* Channel.cpp in Sources */, - 217DFC091D9F6D490055D849 /* unix.c in Sources */, - FACA02EE1F5E396B0084B28F /* Compressor.cpp in Sources */, - FAF140801E20934C00F898D2 /* parseConst.cpp in Sources */, - FA0B7AB11A958EA3000E1D17 /* b2Rope.cpp in Sources */, - FA4B66C91ABBCF1900558F15 /* Timer.cpp in Sources */, - FA0B7A351A958EA3000E1D17 /* b2Distance.cpp in Sources */, - FA0B7E911A95902C000E1D17 /* ModPlugDecoder.cpp in Sources */, - FA0B7E511A95902C000E1D17 /* wrap_FrictionJoint.cpp in Sources */, - FA0B7AD61A958EA3000E1D17 /* win32.c in Sources */, - FADF54341E3DAE6E00012CC0 /* wrap_SpriteBatch.cpp in Sources */, - FA0B7E0C1A95902C000E1D17 /* Fixture.cpp in Sources */, - FA0B7D181A95902C000E1D17 /* TrueTypeRasterizer.cpp in Sources */, - FA0B7CFA1A95902C000E1D17 /* Filesystem.cpp in Sources */, - FA1BA0A21E16D97500AA2803 /* wrap_Font.cpp in Sources */, - FAC7CD781FE35E95006A60C7 /* physfs_platform_qnx.c in Sources */, - FA0B7D3C1A95902C000E1D17 /* Image.cpp in Sources */, - FA0B7A8C1A958EA3000E1D17 /* b2DistanceJoint.cpp in Sources */, - FADF53FD1E3D74F200012CC0 /* Text.cpp in Sources */, - FA6A2B741F60B6710074C308 /* ByteData.cpp in Sources */, - 217DFBE91D9F6D490055D849 /* io.c in Sources */, - FA0B7E421A95902C000E1D17 /* wrap_CircleShape.cpp in Sources */, - FA0B7CE51A95902C000E1D17 /* wrap_Source.cpp in Sources */, - FAC7CD921FE35E95006A60C7 /* physfs_archiver_hog.c in Sources */, - FA0B792C1A958E3B000E1D17 /* Memoizer.cpp in Sources */, - FAF140931E20934C00F898D2 /* PpScanner.cpp in Sources */, - FA9D53AC1F5307E900125C6B /* Deprecations.cpp in Sources */, - FA0B7CCD1A95902C000E1D17 /* Audio.cpp in Sources */, - FA0B7DCA1A95902C000E1D17 /* Keyboard.cpp in Sources */, - FA0B7AA41A958EA3000E1D17 /* b2RevoluteJoint.cpp in Sources */, - FA9D8DDD1DEF842A002CD881 /* Drawable.cpp in Sources */, - FA0B7DFA1A95902C000E1D17 /* Body.cpp in Sources */, - FADF54021E3D77B500012CC0 /* wrap_Text.cpp in Sources */, - FA0B7ED11A95902C000E1D17 /* wrap_ThreadModule.cpp in Sources */, - FAC7CD7F1FE35E95006A60C7 /* physfs_archiver_wad.c in Sources */, - FA0B7EDF1A95902D000E1D17 /* wrap_Touch.cpp in Sources */, - 217DFBFB1D9F6D490055D849 /* serial.c in Sources */, - FADF54251E3DA5BA00012CC0 /* Mesh.cpp in Sources */, - FA4F2BE51DE6650600CA37D7 /* wrap_Transform.cpp in Sources */, - 217DFC0D1D9F6D490055D849 /* unixudp.c in Sources */, - FA0B7CDC1A95902C000E1D17 /* Source.cpp in Sources */, - FA0B7DC41A95902C000E1D17 /* wrap_JoystickModule.cpp in Sources */, - FA0B7E6F1A95902C000E1D17 /* wrap_RopeJoint.cpp in Sources */, - FA0B7AB51A958EA3000E1D17 /* ddsparse.cpp in Sources */, - FACA02F41F5E396B0084B28F /* wrap_CompressedData.cpp in Sources */, - FAF140AC1E20934C00F898D2 /* Versions.cpp in Sources */, - FA0B7A441A958EA3000E1D17 /* b2EdgeShape.cpp in Sources */, - FA0B79461A958E3B000E1D17 /* Vector.cpp in Sources */, - FAC7CD811FE35E95006A60C7 /* physfs_platform_os2.c in Sources */, - FA0B7DBB1A95902C000E1D17 /* Joystick.cpp in Sources */, - FAF140DB1E20934C00F898D2 /* InitializeDll.cpp in Sources */, - FA0B7DAE1A95902C000E1D17 /* wrap_CompressedImageData.cpp in Sources */, - FA6A2B701F5F845F0074C308 /* wrap_DataView.cpp in Sources */, - FA0B7A6E1A958EA3000E1D17 /* b2WorldCallbacks.cpp in Sources */, - FA0B7A831A958EA3000E1D17 /* b2EdgeAndPolygonContact.cpp in Sources */, - FA0B7AA11A958EA3000E1D17 /* b2PulleyJoint.cpp in Sources */, - FAB17BE61ABFAA9000F9BA27 /* lz4.c in Sources */, - FA0B7B211A958EA3000E1D17 /* luasocket.cpp in Sources */, - FA0B7A5B1A958EA3000E1D17 /* b2Timer.cpp in Sources */, - FA0B7CD91A95902C000E1D17 /* Pool.cpp in Sources */, - FAF140A01E20934C00F898D2 /* RemoveTree.cpp in Sources */, - FA0B7E151A95902C000E1D17 /* Joint.cpp in Sources */, - FA0B7EE81A95902D000E1D17 /* wrap_Window.cpp in Sources */, - FA0B7E271A95902C000E1D17 /* PulleyJoint.cpp in Sources */, - FA1BA0B71E17043400AA2803 /* wrap_Shader.cpp in Sources */, - FA0B7B301A958EA3000E1D17 /* wuff.c in Sources */, - FA56AA381FAFF02000A43D5F /* memory.cpp in Sources */, - FA0B7E031A95902C000E1D17 /* Contact.cpp in Sources */, - FA0B7D821A95902C000E1D17 /* CompressedImageData.cpp in Sources */, - FAF1409D1E20934C00F898D2 /* reflection.cpp in Sources */, - FAAA3FDB1F64B3AD00F89E99 /* lutf8lib.c in Sources */, - FAF1408A1E20934C00F898D2 /* Pp.cpp in Sources */, - FA76344A1E28722A0066EF9E /* StreamBuffer.cpp in Sources */, - FA0B7A7A1A958EA3000E1D17 /* b2Contact.cpp in Sources */, - FA0B7DF11A95902C000E1D17 /* wrap_Cursor.cpp in Sources */, - FA0B7E001A95902C000E1D17 /* CircleShape.cpp in Sources */, - FA0B7E451A95902C000E1D17 /* wrap_Contact.cpp in Sources */, - 217DFBE71D9F6D490055D849 /* inet.c in Sources */, - FA0B7D151A95902C000E1D17 /* Font.cpp in Sources */, - FA0B7EB51A95902C000E1D17 /* wrap_System.cpp in Sources */, - FA0B7DAB1A95902C000E1D17 /* STBHandler.cpp in Sources */, - FA0B7AB81A958EA3000E1D17 /* enet.cpp in Sources */, - FADF53F81E3C7ACD00012CC0 /* Buffer.cpp in Sources */, - FA0B7DD91A95902C000E1D17 /* RandomGenerator.cpp in Sources */, - FAF1409A1E20934C00F898D2 /* propagateNoContraction.cpp in Sources */, - FA0B7A9B1A958EA3000E1D17 /* b2MouseJoint.cpp in Sources */, - FA2AF6741DAD64970032B62C /* vertex.cpp in Sources */, - FAC7CD851FE35E95006A60C7 /* physfs_unicode.c in Sources */, - FA6A2B7A1F60B8250074C308 /* wrap_ByteData.cpp in Sources */, - FAF140551E20934C00F898D2 /* Link.cpp in Sources */, - FAF140841E20934C00F898D2 /* ParseHelper.cpp in Sources */, - FA0B7D7F1A95902C000E1D17 /* Volatile.cpp in Sources */, - FA0B7A3B1A958EA3000E1D17 /* b2TimeOfImpact.cpp in Sources */, - FA1BA0B11E16FD0800AA2803 /* Shader.cpp in Sources */, - 217DFBED1D9F6D490055D849 /* luasocket.c in Sources */, - 217DFC011D9F6D490055D849 /* tcp.c in Sources */, - FA0B7EBB1A95902C000E1D17 /* LuaThread.cpp in Sources */, - FA0B79381A958E3B000E1D17 /* Reference.cpp in Sources */, - FAC7CD881FE35E95006A60C7 /* physfs_platform_apple.m in Sources */, - FA0B7D391A95902C000E1D17 /* Graphics.cpp in Sources */, - FA0B79361A958E3B000E1D17 /* macosx.mm in Sources */, - FA0B7E121A95902C000E1D17 /* GearJoint.cpp in Sources */, - FAE272521C05A15B00A67640 /* ParticleSystem.cpp in Sources */, - FA0B7DC11A95902C000E1D17 /* wrap_Joystick.cpp in Sources */, - FA0B7CD31A95902C000E1D17 /* Source.cpp in Sources */, - FA0B7A411A958EA3000E1D17 /* b2CircleShape.cpp in Sources */, - FA0B7CD01A95902C000E1D17 /* Audio.cpp in Sources */, - FAA3A9AE1B7D465A00CED060 /* android.cpp in Sources */, - FA0B7D121A95902C000E1D17 /* Font.cpp in Sources */, - FA0B7EC81A95902C000E1D17 /* threads.cpp in Sources */, - FAC7CD8B1FE35E95006A60C7 /* physfs_archiver_iso9660.c in Sources */, - 217DFBF91D9F6D490055D849 /* select.c in Sources */, - FA0B7A6B1A958EA3000E1D17 /* b2World.cpp in Sources */, - FAF1408C1E20934C00F898D2 /* PpAtom.cpp in Sources */, - FA0B7A801A958EA3000E1D17 /* b2EdgeAndCircleContact.cpp in Sources */, - FAF140711E20934C00F898D2 /* Intermediate.cpp in Sources */, - FAC7CD7D1FE35E95006A60C7 /* physfs_platform_winrt.cpp in Sources */, - FA0B7E541A95902C000E1D17 /* wrap_GearJoint.cpp in Sources */, - FA41A3C81C0A1F950084430C /* ASTCHandler.cpp in Sources */, - FA0B7E781A95902C000E1D17 /* wrap_WheelJoint.cpp in Sources */, - FA0B7DDC1A95902C000E1D17 /* wrap_BezierCurve.cpp in Sources */, - FA0B7A951A958EA3000E1D17 /* b2Joint.cpp in Sources */, - FA0B7D061A95902C000E1D17 /* wrap_File.cpp in Sources */, - FAF1889F1E9DBC4B008C1479 /* depthstencil.cpp in Sources */, - FAC7CD871FE35E95006A60C7 /* physfs_archiver_vdf.c in Sources */, - FA0B7A4E1A958EA3000E1D17 /* b2Draw.cpp in Sources */, - FAD19A171DFF8CA200D5398A /* ImageDataBase.cpp in Sources */, - FA27B3C01B4985BF008A9DCE /* wrap_VideoStream.cpp in Sources */, - FADF54201E3DA52C00012CC0 /* wrap_ParticleSystem.cpp in Sources */, - FA0B7D9F1A95902C000E1D17 /* KTXHandler.cpp in Sources */, - FA1E88831DF363DB00E808AA /* Filter.cpp in Sources */, - FA0B7A2C1A958EA3000E1D17 /* b2CollideCircle.cpp in Sources */, - FA0B7CEB1A95902C000E1D17 /* Event.cpp in Sources */, - FA1557C31CE90BD200AFF582 /* EXRHandler.cpp in Sources */, - FA27B3AA1B498151008A9DCE /* VideoStream.cpp in Sources */, - FA0B7E571A95902C000E1D17 /* wrap_Joint.cpp in Sources */, - FA0B7E301A95902C000E1D17 /* Shape.cpp in Sources */, - FA93C4541F315B960087CCD4 /* FormatHandler.cpp in Sources */, - FA0B7E481A95902C000E1D17 /* wrap_DistanceJoint.cpp in Sources */, - FA0B7A8F1A958EA3000E1D17 /* b2FrictionJoint.cpp in Sources */, - FA0B792F1A958E3B000E1D17 /* Module.cpp in Sources */, - FA0B7E2A1A95902C000E1D17 /* RevoluteJoint.cpp in Sources */, - FA0B7A711A958EA3000E1D17 /* b2ChainAndCircleContact.cpp in Sources */, - FA0B7D251A95902C000E1D17 /* wrap_Font.cpp in Sources */, - FA0B7E091A95902C000E1D17 /* EdgeShape.cpp in Sources */, - FA0B7CF71A95902C000E1D17 /* FileData.cpp in Sources */, - FAC7CD8C1FE35E95006A60C7 /* physfs_archiver_qpak.c in Sources */, - FA0B7DA51A95902C000E1D17 /* PNGHandler.cpp in Sources */, - FA0B7B371A958EA3000E1D17 /* wuff_internal.c in Sources */, - FA0B7E971A95902C000E1D17 /* Sound.cpp in Sources */, - FA4F2B791DE0125B00CA37D7 /* xxhash.c in Sources */, - FA0B7E361A95902C000E1D17 /* WheelJoint.cpp in Sources */, - FA0B7A471A958EA3000E1D17 /* b2PolygonShape.cpp in Sources */, - FADF542F1E3DABF600012CC0 /* SpriteBatch.cpp in Sources */, - FA0B7D8D1A95902C000E1D17 /* ddsHandler.cpp in Sources */, - FAAA3FD91F64B3AD00F89E99 /* lstrlib.c in Sources */, - FA0B7DFD1A95902C000E1D17 /* ChainShape.cpp in Sources */, - FA0B79201A958E3B000E1D17 /* delay.cpp in Sources */, - FA0B7A4B1A958EA3000E1D17 /* b2BlockAllocator.cpp in Sources */, - FA0B7A551A958EA3000E1D17 /* b2Settings.cpp in Sources */, - FA0B7EA91A95902C000E1D17 /* wrap_Sound.cpp in Sources */, - FA0B7A981A958EA3000E1D17 /* b2MotorJoint.cpp in Sources */, - FA6A2B671F5F7B6B0074C308 /* wrap_Data.cpp in Sources */, - FA0B7E061A95902C000E1D17 /* DistanceJoint.cpp in Sources */, - FA620A321AA2F8DB005DB4C2 /* wrap_Quad.cpp in Sources */, - FA4F2BA61DE1E36400CA37D7 /* RecordingDevice.cpp in Sources */, - FAF1406C1E20934C00F898D2 /* InfoSink.cpp in Sources */, - FAF1407A1E20934C00F898D2 /* limits.cpp in Sources */, - FAC7CD7E1FE35E95006A60C7 /* physfs_archiver_mvl.c in Sources */, - FA0B793B1A958E3B000E1D17 /* runtime.cpp in Sources */, - FA0B7E5D1A95902C000E1D17 /* wrap_MouseJoint.cpp in Sources */, - FA0B7A741A958EA3000E1D17 /* b2ChainAndPolygonContact.cpp in Sources */, - FA0B7AD41A958EA3000E1D17 /* unix.c in Sources */, - FA0B7A771A958EA3000E1D17 /* b2CircleContact.cpp in Sources */, - FADF543B1E3DAFF700012CC0 /* wrap_Graphics.cpp in Sources */, - FA0B7D331A95902C000E1D17 /* Canvas.cpp in Sources */, - FA0B7E941A95902C000E1D17 /* Mpg123Decoder.cpp in Sources */, - FA0B7E8B1A95902C000E1D17 /* FLACDecoder.cpp in Sources */, - FA0B7B3A1A958EA3000E1D17 /* wuff_memory.c in Sources */, - FA0B7A381A958EA3000E1D17 /* b2DynamicTree.cpp in Sources */, - FAECA1B21F3164700095D008 /* CompressedSlice.cpp in Sources */, - FA0B7D481A95902C000E1D17 /* Polyline.cpp in Sources */, - 217DFC111D9F6D490055D849 /* usocket.c in Sources */, - FAC7CD891FE35E95006A60C7 /* physfs_archiver_dir.c in Sources */, - FAF140751E20934C00F898D2 /* IntermTraverse.cpp in Sources */, - FA0B7CE21A95902C000E1D17 /* wrap_Audio.cpp in Sources */, - FA0B7AAA1A958EA3000E1D17 /* b2WeldJoint.cpp in Sources */, - FA0B7DF71A95902C000E1D17 /* Body.cpp in Sources */, - FA0B7DF41A95902C000E1D17 /* wrap_Mouse.cpp in Sources */, - FA0B7E851A95902C000E1D17 /* CoreAudioDecoder.cpp in Sources */, - FA0B7E751A95902C000E1D17 /* wrap_WeldJoint.cpp in Sources */, - FA0B7D551A95902C000E1D17 /* Buffer.cpp in Sources */, - FA57FB981AE1993600F2AD6D /* noise1234.cpp in Sources */, - FA0B7E211A95902C000E1D17 /* PolygonShape.cpp in Sources */, - FA0B7DA21A95902C000E1D17 /* PKMHandler.cpp in Sources */, - FA0B7ABA1A958EA3000E1D17 /* callbacks.c in Sources */, - FAB17BF51ABFC4B100F9BA27 /* lz4hc.c in Sources */, - FA0B7EA61A95902C000E1D17 /* wrap_Decoder.cpp in Sources */, - 217DFBF21D9F6D490055D849 /* mime.c in Sources */, - 217DFBDF1D9F6D490055D849 /* except.c in Sources */, - FA28EBD51E352DB5003446F4 /* FenceSync.cpp in Sources */, - FA0B7E1B1A95902C000E1D17 /* MouseJoint.cpp in Sources */, - FA0B7CF41A95902C000E1D17 /* File.cpp in Sources */, - FAC7CD7A1FE35E95006A60C7 /* physfs_archiver_7z.c in Sources */, - FA0B7E331A95902C000E1D17 /* WeldJoint.cpp in Sources */, - FA0B7D301A95902C000E1D17 /* Graphics.cpp in Sources */, - FAF1408E1E20934C00F898D2 /* PpContext.cpp in Sources */, - FA0B7E9D1A95902C000E1D17 /* WaveDecoder.cpp in Sources */, - FA29C0051E12355B00268CD8 /* StreamBuffer.cpp in Sources */, - FA0B7EB21A95902C000E1D17 /* System.cpp in Sources */, - FA0B7D1B1A95902C000E1D17 /* GlyphData.cpp in Sources */, - FA0B7AD11A958EA3000E1D17 /* protocol.c in Sources */, - FA9D8DD11DEB56C3002CD881 /* pixelformat.cpp in Sources */, - FA0B7E661A95902C000E1D17 /* wrap_PrismaticJoint.cpp in Sources */, - FA0B7DCD1A95902C000E1D17 /* wrap_Keyboard.cpp in Sources */, - FA0B7EE51A95902D000E1D17 /* Window.cpp in Sources */, - FA6A2B6A1F5F7F560074C308 /* DataView.cpp in Sources */, - FA3C5E471F8D80CA0003C579 /* ShaderStage.cpp in Sources */, - FA0B7E391A95902C000E1D17 /* World.cpp in Sources */, - FA0B7ABD1A958EA3000E1D17 /* compress.c in Sources */, - FA0B7ACB1A958EA3000E1D17 /* list.c in Sources */, - FA0B7E7E1A95902C000E1D17 /* Joint.cpp in Sources */, - FA0B7A861A958EA3000E1D17 /* b2PolygonAndCircleContact.cpp in Sources */, - FA0B7DB11A95902C000E1D17 /* wrap_Image.cpp in Sources */, - FAC7CD831FE35E95006A60C7 /* physfs_platform_windows.c in Sources */, - FA0B7E881A95902C000E1D17 /* Decoder.cpp in Sources */, - FA0B7E3C1A95902C000E1D17 /* wrap_Body.cpp in Sources */, - FA0B7D791A95902C000E1D17 /* Quad.cpp in Sources */, - FAC756F51E4F99B400B91289 /* Effect.cpp in Sources */, - FA620A3A1AA305F6005DB4C2 /* types.cpp in Sources */, - FA0B7DD31A95902C000E1D17 /* BezierCurve.cpp in Sources */, - FA91591E1CF1ED7500A7053F /* halffloat.cpp in Sources */, - FA0B7E7B1A95902C000E1D17 /* wrap_World.cpp in Sources */, - FA0B7B281A958EA3000E1D17 /* simplexnoise1234.cpp in Sources */, - FA0B7D421A95902C000E1D17 /* OpenGL.cpp in Sources */, - FA0B7A671A958EA3000E1D17 /* b2Island.cpp in Sources */, - FA0B7DBE1A95902C000E1D17 /* JoystickModule.cpp in Sources */, - FAB2D5AA1AABDD8A008224A4 /* TrueTypeRasterizer.cpp in Sources */, - FA0B7ACD1A958EA3000E1D17 /* packet.c in Sources */, - FA0B7A921A958EA3000E1D17 /* b2GearJoint.cpp in Sources */, - FA0B7E5A1A95902C000E1D17 /* wrap_MotorJoint.cpp in Sources */, - FA0B7AA71A958EA3000E1D17 /* b2RopeJoint.cpp in Sources */, - FA0B7DD61A95902C000E1D17 /* MathModule.cpp in Sources */, - FA1BA0AC1E16F9EE00AA2803 /* wrap_Canvas.cpp in Sources */, - FAC7CD8A1FE35E95006A60C7 /* physfs_byteorder.c in Sources */, - FA0B7D0F1A95902C000E1D17 /* BMFontRasterizer.cpp in Sources */, - FA0B7E9A1A95902C000E1D17 /* VorbisDecoder.cpp in Sources */, - FA0B7E4B1A95902C000E1D17 /* wrap_EdgeShape.cpp in Sources */, - FA9D8DD91DEF8411002CD881 /* Stream.cpp in Sources */, - FA0B7E241A95902C000E1D17 /* PrismaticJoint.cpp in Sources */, - FAC7CD791FE35E95006A60C7 /* physfs.c in Sources */, - FAC756FA1E4F99D200B91289 /* Effect.cpp in Sources */, - FA0B7A7D1A958EA3000E1D17 /* b2ContactSolver.cpp in Sources */, - FA0B7E601A95902C000E1D17 /* wrap_Physics.cpp in Sources */, - FA0B7DC71A95902C000E1D17 /* Keyboard.cpp in Sources */, - 217DFC071D9F6D490055D849 /* udp.c in Sources */, - FA0B7EAC1A95902C000E1D17 /* wrap_SoundData.cpp in Sources */, - FA0B7E2D1A95902C000E1D17 /* RopeJoint.cpp in Sources */, - FA0B7CDF1A95902C000E1D17 /* Source.cpp in Sources */, - FA0B7ECE1A95902C000E1D17 /* wrap_LuaThread.cpp in Sources */, - FA0B79431A958E3B000E1D17 /* Variant.cpp in Sources */, - FA4F2BE31DE6650600CA37D7 /* Transform.cpp in Sources */, - FA0B7EA01A95902C000E1D17 /* Sound.cpp in Sources */, - FA0B7DE51A95902C000E1D17 /* Cursor.cpp in Sources */, - FADF54161E3DA08E00012CC0 /* Image.cpp in Sources */, - FA0B7EDB1A95902D000E1D17 /* Touch.cpp in Sources */, - FA1BA0A71E16F20600AA2803 /* Canvas.cpp in Sources */, - FA0B7CE81A95902C000E1D17 /* Event.cpp in Sources */, - FA0B7ACF1A958EA3000E1D17 /* peer.c in Sources */, - FA0B7ADE1A958EA3000E1D17 /* lodepng.cpp in Sources */, - FA0B7A291A958EA3000E1D17 /* b2BroadPhase.cpp in Sources */, - FA0B7A891A958EA3000E1D17 /* b2PolygonContact.cpp in Sources */, - FA0B7E1E1A95902C000E1D17 /* Physics.cpp in Sources */, - FA9D8DE01DEF843D002CD881 /* Image.cpp in Sources */, - FA0B7E811A95902C000E1D17 /* Shape.cpp in Sources */, - FA4F2BA81DE1E36400CA37D7 /* wrap_RecordingDevice.cpp in Sources */, - FACA02EC1F5E396B0084B28F /* CompressedData.cpp in Sources */, - FAF140531E20934C00F898D2 /* CodeGen.cpp in Sources */, - FA27B3B31B498151008A9DCE /* wrap_Video.cpp in Sources */, - FA0B7A611A958EA3000E1D17 /* b2ContactManager.cpp in Sources */, - 217DFC0B1D9F6D490055D849 /* unixtcp.c in Sources */, - FAF140881E20934C00F898D2 /* PoolAlloc.cpp in Sources */, - FA0B7AAD1A958EA3000E1D17 /* b2WheelJoint.cpp in Sources */, - FA0B7DEE1A95902C000E1D17 /* Mouse.cpp in Sources */, - FAA54ACC1F91660400A8FA7B /* TheoraVideoStream.cpp in Sources */, - FA1E887E1DF363CD00E808AA /* Filter.cpp in Sources */, - FA0B7D281A95902C000E1D17 /* wrap_GlyphData.cpp in Sources */, - FA0B7DE21A95902C000E1D17 /* wrap_RandomGenerator.cpp in Sources */, - FACA02F61F5E396B0084B28F /* wrap_DataModule.cpp in Sources */, - FA0B79401A958E3B000E1D17 /* utf8.cpp in Sources */, - FA0B79241A958E3B000E1D17 /* Exception.cpp in Sources */, - FA0B7D0C1A95902C000E1D17 /* wrap_Filesystem.cpp in Sources */, - FA0B7AD91A958EA3000E1D17 /* glad.cpp in Sources */, - FAC7CD841FE35E95006A60C7 /* physfs_archiver_unpacked.c in Sources */, - 217DFBF61D9F6D490055D849 /* options.c in Sources */, - FAA54ACD1F91660400A8FA7B /* OggDemuxer.cpp in Sources */, - FAC7CD821FE35E95006A60C7 /* physfs_platform_haiku.cpp in Sources */, - 217DFBD91D9F6D490055D849 /* auxiliar.c in Sources */, - 217DFBDB1D9F6D490055D849 /* buffer.c in Sources */, - FA0B7DB41A95902C000E1D17 /* wrap_ImageData.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 10D5479E63C26BB35EB5482E /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = NO; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - DEAD_CODE_STRIPPING = YES; - ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = ""; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 3; - GCC_PREPROCESSOR_DEFINITIONS = LOVE_APPLE_USE_FRAMEWORKS; - GCC_WARN_64_TO_32_BIT_CONVERSION = NO; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; - GCC_WARN_ABOUT_MISSING_NEWLINE = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; - GCC_WARN_SIGN_COMPARE = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_PARAMETER = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/../../src\"", - "\"$(SRCROOT)/../../src/libraries\"", - "\"$(SRCROOT)/../../src/modules\"", - "\"$(SRCROOT)/../../src/libraries/enet/libenet/include\"", - ); - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "@rpath"; - LIBRARY_SEARCH_PATHS = ""; - MACOSX_DEPLOYMENT_TARGET = 10.7; - ONLY_ACTIVE_ARCH = NO; - SDKROOT = macosx; - USE_HEADERMAP = NO; - WARNING_CFLAGS = "-Wall"; - }; - name = Release; - }; - 64274E785071353E1A1D0D4B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = NO; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - FRAMEWORK_SEARCH_PATHS = ""; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - LOVE_APPLE_USE_FRAMEWORKS, - "DEBUG=1", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = NO; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; - GCC_WARN_ABOUT_MISSING_NEWLINE = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; - GCC_WARN_SIGN_COMPARE = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_PARAMETER = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/../../src\"", - "\"$(SRCROOT)/../../src/libraries\"", - "\"$(SRCROOT)/../../src/modules\"", - "\"$(SRCROOT)/../../src/libraries/enet/libenet/include\"", - ); - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "@rpath"; - LIBRARY_SEARCH_PATHS = ""; - MACOSX_DEPLOYMENT_TARGET = 10.7; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - USE_HEADERMAP = NO; - WARNING_CFLAGS = "-Wall"; - }; - name = Debug; - }; - FA0B78EF1A958B90000E1D17 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - GCC_PREPROCESSOR_DEFINITIONS = ( - "$(inherited)", - LOVE_SUPPORT_COREAUDIO, - LOVE_NOMPG123, - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = NO; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - ios/include, - ios/include/luajit, - ios/include/freetype, - ios/include/SDL2, - ios/include/modplug, - ); - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/ios/libraries/freetype", - "$(PROJECT_DIR)/ios/libraries/lua", - "$(PROJECT_DIR)/ios/libraries/ogg", - "$(PROJECT_DIR)/ios/libraries/physfs", - "$(PROJECT_DIR)/ios/libraries/vorbis", - "$(PROJECT_DIR)/ios/libraries/SDL2", - "$(PROJECT_DIR)/ios/libraries/luajit", - "$(PROJECT_DIR)/ios/libraries/theora", - "$(PROJECT_DIR)/ios/libraries/modplug", - ); - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = love; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - FA0B78F01A958B90000E1D17 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - GCC_PREPROCESSOR_DEFINITIONS = ( - "$(inherited)", - LOVE_SUPPORT_COREAUDIO, - LOVE_NOMPG123, - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = NO; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - ios/include, - ios/include/luajit, - ios/include/freetype, - ios/include/SDL2, - ios/include/modplug, - ); - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/ios/libraries/freetype", - "$(PROJECT_DIR)/ios/libraries/lua", - "$(PROJECT_DIR)/ios/libraries/ogg", - "$(PROJECT_DIR)/ios/libraries/physfs", - "$(PROJECT_DIR)/ios/libraries/vorbis", - "$(PROJECT_DIR)/ios/libraries/SDL2", - "$(PROJECT_DIR)/ios/libraries/luajit", - "$(PROJECT_DIR)/ios/libraries/theora", - "$(PROJECT_DIR)/ios/libraries/modplug", - ); - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = love; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - FA0B78F11A958B90000E1D17 /* Distribution */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - GCC_PREPROCESSOR_DEFINITIONS = ( - "$(inherited)", - LOVE_SUPPORT_COREAUDIO, - LOVE_NOMPG123, - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = NO; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - ios/include, - ios/include/luajit, - ios/include/freetype, - ios/include/SDL2, - ios/include/modplug, - ); - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/ios/libraries/freetype", - "$(PROJECT_DIR)/ios/libraries/lua", - "$(PROJECT_DIR)/ios/libraries/ogg", - "$(PROJECT_DIR)/ios/libraries/physfs", - "$(PROJECT_DIR)/ios/libraries/vorbis", - "$(PROJECT_DIR)/ios/libraries/SDL2", - "$(PROJECT_DIR)/ios/libraries/luajit", - "$(PROJECT_DIR)/ios/libraries/theora", - "$(PROJECT_DIR)/ios/libraries/modplug", - ); - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = love; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Distribution; - }; - FA5326C4189719C700F7BBF4 /* Distribution */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = NO; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - DEAD_CODE_STRIPPING = YES; - ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = ""; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 3; - GCC_PREPROCESSOR_DEFINITIONS = LOVE_APPLE_USE_FRAMEWORKS; - GCC_WARN_64_TO_32_BIT_CONVERSION = NO; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; - GCC_WARN_ABOUT_MISSING_NEWLINE = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; - GCC_WARN_SIGN_COMPARE = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_PARAMETER = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/../../src\"", - "\"$(SRCROOT)/../../src/libraries\"", - "\"$(SRCROOT)/../../src/modules\"", - "\"$(SRCROOT)/../../src/libraries/enet/libenet/include\"", - ); - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "@rpath"; - LIBRARY_SEARCH_PATHS = ""; - LLVM_LTO = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; - ONLY_ACTIVE_ARCH = NO; - SDKROOT = macosx; - USE_HEADERMAP = NO; - WARNING_CFLAGS = "-Wall"; - }; - name = Distribution; - }; - FA5326C5189719C700F7BBF4 /* Distribution */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 9.0; - DYLIB_CURRENT_VERSION = 9.0; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/macosx/Frameworks", - /Library/Frameworks, - "$(LOCAL_LIBRARY_DIR)/Frameworks", - "$(PROJECT_DIR)", - ); - FRAMEWORK_VERSION = A; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/macosx/Frameworks/freetype.framework/Headers", - "$(PROJECT_DIR)/macosx/Frameworks/Lua.framework/Headers", - "$(PROJECT_DIR)/macosx/Frameworks/SDL2.framework/Headers", - /Library/Frameworks/freetype.framework/Headers, - /Library/Frameworks/Lua.framework/Headers, - /Library/Frameworks/SDL2.framework/Headers, - ); - INFOPLIST_FILE = "macosx/liblove-macosx.plist"; - LD_DYLIB_INSTALL_NAME = "@rpath/$(EXECUTABLE_PATH)"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/ios/libraries/freetype", - ); - OTHER_LDFLAGS = ( - "-undefined", - dynamic_lookup, - ); - PRODUCT_BUNDLE_IDENTIFIER = "love2d.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = love; - SKIP_INSTALL = YES; - WRAPPER_EXTENSION = framework; - }; - name = Distribution; - }; - FA577AC016C7507900860150 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 9.0; - DYLIB_CURRENT_VERSION = 9.0; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/macosx/Frameworks", - /Library/Frameworks, - "$(LOCAL_LIBRARY_DIR)/Frameworks", - "$(PROJECT_DIR)", - ); - FRAMEWORK_VERSION = A; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/macosx/Frameworks/freetype.framework/Headers", - "$(PROJECT_DIR)/macosx/Frameworks/Lua.framework/Headers", - "$(PROJECT_DIR)/macosx/Frameworks/SDL2.framework/Headers", - /Library/Frameworks/freetype.framework/Headers, - /Library/Frameworks/Lua.framework/Headers, - /Library/Frameworks/SDL2.framework/Headers, - ); - INFOPLIST_FILE = "macosx/liblove-macosx.plist"; - LD_DYLIB_INSTALL_NAME = "@rpath/$(EXECUTABLE_PATH)"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/ios/libraries/freetype", - ); - OTHER_LDFLAGS = ( - "-undefined", - dynamic_lookup, - ); - PRODUCT_BUNDLE_IDENTIFIER = "love2d.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = love; - SKIP_INSTALL = YES; - WRAPPER_EXTENSION = framework; - }; - name = Debug; - }; - FA577AC116C7507900860150 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 9.0; - DYLIB_CURRENT_VERSION = 9.0; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/macosx/Frameworks", - /Library/Frameworks, - "$(LOCAL_LIBRARY_DIR)/Frameworks", - "$(PROJECT_DIR)", - ); - FRAMEWORK_VERSION = A; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/macosx/Frameworks/freetype.framework/Headers", - "$(PROJECT_DIR)/macosx/Frameworks/Lua.framework/Headers", - "$(PROJECT_DIR)/macosx/Frameworks/SDL2.framework/Headers", - /Library/Frameworks/freetype.framework/Headers, - /Library/Frameworks/Lua.framework/Headers, - /Library/Frameworks/SDL2.framework/Headers, - ); - INFOPLIST_FILE = "macosx/liblove-macosx.plist"; - LD_DYLIB_INSTALL_NAME = "@rpath/$(EXECUTABLE_PATH)"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/ios/libraries/freetype", - ); - OTHER_LDFLAGS = ( - "-undefined", - dynamic_lookup, - ); - PRODUCT_BUNDLE_IDENTIFIER = "love2d.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = love; - SKIP_INSTALL = YES; - WRAPPER_EXTENSION = framework; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "liblove" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 64274E785071353E1A1D0D4B /* Debug */, - 10D5479E63C26BB35EB5482E /* Release */, - FA5326C4189719C700F7BBF4 /* Distribution */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - FA0B78EE1A958B90000E1D17 /* Build configuration list for PBXNativeTarget "liblove-ios" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - FA0B78EF1A958B90000E1D17 /* Debug */, - FA0B78F01A958B90000E1D17 /* Release */, - FA0B78F11A958B90000E1D17 /* Distribution */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - FA577ABF16C7507900860150 /* Build configuration list for PBXNativeTarget "liblove-macosx" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - FA577AC016C7507900860150 /* Debug */, - FA577AC116C7507900860150 /* Release */, - FA5326C5189719C700F7BBF4 /* Distribution */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; -/* End XCConfigurationList section */ - }; - rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; -} diff --git a/love/src/jni/love/platform/xcode/liblove.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/love/src/jni/love/platform/xcode/liblove.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index f4e1c8fd..00000000 --- a/love/src/jni/love/platform/xcode/liblove.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/love/src/jni/love/platform/xcode/love.xcodeproj/TemplateIcon.icns b/love/src/jni/love/platform/xcode/love.xcodeproj/TemplateIcon.icns deleted file mode 100644 index 62cb7015..00000000 Binary files a/love/src/jni/love/platform/xcode/love.xcodeproj/TemplateIcon.icns and /dev/null differ diff --git a/love/src/jni/love/platform/xcode/love.xcodeproj/default.pbxuser b/love/src/jni/love/platform/xcode/love.xcodeproj/default.pbxuser deleted file mode 100644 index 347c8dc8..00000000 --- a/love/src/jni/love/platform/xcode/love.xcodeproj/default.pbxuser +++ /dev/null @@ -1,1052 +0,0 @@ -// !$*UTF8*$! -{ - 29B97313FDCFA39411CA2CEA /* Project object */ = { - activeArchitecturePreference = ppc; - activeBuildConfigurationName = Release; - activeExecutable = A93E69C010420A88007D418B /* love */; - activeSDKPreference = macosx10.5; - activeTarget = 8D1107260486CEB800E47090 /* love */; - addToTargets = ( - 8D1107260486CEB800E47090 /* love */, - ); - breakpoints = ( - ); - codeSenseManager = A93E69C410420AA6007D418B /* Code sense */; - executables = ( - A93E69C010420A88007D418B /* love */, - ); - perUserDictionary = { - PBXConfiguration.PBXFileTableDataSource3.PBXBookmarksDataSource = { - PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; - PBXFileTableDataSourceColumnSortingKey = PBXBookmarksDataSource_NameID; - PBXFileTableDataSourceColumnWidthsKey = ( - 200, - 200, - 150.58349609375, - ); - PBXFileTableDataSourceColumnsKey = ( - PBXBookmarksDataSource_LocationID, - PBXBookmarksDataSource_NameID, - PBXBookmarksDataSource_CommentsID, - ); - }; - PBXConfiguration.PBXFileTableDataSource3.PBXErrorsWarningsDataSource = { - PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; - PBXFileTableDataSourceColumnSortingKey = PBXErrorsWarningsDataSource_LocationID; - PBXFileTableDataSourceColumnWidthsKey = ( - 20, - 300, - 193.20849609375, - ); - PBXFileTableDataSourceColumnsKey = ( - PBXErrorsWarningsDataSource_TypeID, - PBXErrorsWarningsDataSource_MessageID, - PBXErrorsWarningsDataSource_LocationID, - ); - }; - PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = { - PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; - PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID; - PBXFileTableDataSourceColumnWidthsKey = ( - 22, - 300, - 191, - ); - PBXFileTableDataSourceColumnsKey = ( - PBXExecutablesDataSource_ActiveFlagID, - PBXExecutablesDataSource_NameID, - PBXExecutablesDataSource_CommentsID, - ); - }; - PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { - PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; - PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_FiletypeID; - PBXFileTableDataSourceColumnWidthsKey = ( - 20, - 341, - 20, - 48, - 43, - 43, - 20, - ); - PBXFileTableDataSourceColumnsKey = ( - PBXFileDataSource_FiletypeID, - PBXFileDataSource_Filename_ColumnID, - PBXFileDataSource_Built_ColumnID, - PBXFileDataSource_ObjectSize_ColumnID, - PBXFileDataSource_Errors_ColumnID, - PBXFileDataSource_Warnings_ColumnID, - PBXFileDataSource_Target_ColumnID, - ); - }; - PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = { - PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; - PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; - PBXFileTableDataSourceColumnWidthsKey = ( - 20, - 301, - 60, - 20, - 48, - 43, - 43, - ); - PBXFileTableDataSourceColumnsKey = ( - PBXFileDataSource_FiletypeID, - PBXFileDataSource_Filename_ColumnID, - PBXTargetDataSource_PrimaryAttribute, - PBXFileDataSource_Built_ColumnID, - PBXFileDataSource_ObjectSize_ColumnID, - PBXFileDataSource_Errors_ColumnID, - PBXFileDataSource_Warnings_ColumnID, - ); - }; - PBXPerProjectTemplateStateSaveDate = 272885036; - PBXWorkspaceStateSaveDate = 272885036; - }; - perUserProjectItems = { - A9D8FBD21043E5320063561F /* PBXTextBookmark */ = A9D8FBD21043E5320063561F /* PBXTextBookmark */; - A9D8FBE01043E5AE0063561F /* PBXTextBookmark */ = A9D8FBE01043E5AE0063561F /* PBXTextBookmark */; - A9D8FBE21043E5AE0063561F /* PBXTextBookmark */ = A9D8FBE21043E5AE0063561F /* PBXTextBookmark */; - A9D8FBE71043E5C10063561F /* PBXTextBookmark */ = A9D8FBE71043E5C10063561F /* PBXTextBookmark */; - A9D8FBE81043E5C10063561F /* PBXTextBookmark */ = A9D8FBE81043E5C10063561F /* PBXTextBookmark */; - A9D8FBE91043E5C10063561F /* PBXTextBookmark */ = A9D8FBE91043E5C10063561F /* PBXTextBookmark */; - A9D8FBEA1043E5C10063561F /* PBXTextBookmark */ = A9D8FBEA1043E5C10063561F /* PBXTextBookmark */; - A9D8FBEB1043E5C10063561F /* PBXTextBookmark */ = A9D8FBEB1043E5C10063561F /* PBXTextBookmark */; - A9D8FBEC1043E5C10063561F /* PBXTextBookmark */ = A9D8FBEC1043E5C10063561F /* PBXTextBookmark */; - A9D8FBED1043E5C10063561F /* PBXTextBookmark */ = A9D8FBED1043E5C10063561F /* PBXTextBookmark */; - A9D8FBFC1043E7C20063561F /* PBXTextBookmark */ = A9D8FBFC1043E7C20063561F /* PBXTextBookmark */; - A9D8FC011043E8770063561F /* PBXTextBookmark */ = A9D8FC011043E8770063561F /* PBXTextBookmark */; - A9D8FC031043E94F0063561F /* PBXTextBookmark */ = A9D8FC031043E94F0063561F /* PBXTextBookmark */; - A9D8FC041043E94F0063561F /* PBXTextBookmark */ = A9D8FC041043E94F0063561F /* PBXTextBookmark */; - A9D8FC051043E94F0063561F /* PBXTextBookmark */ = A9D8FC051043E94F0063561F /* PBXTextBookmark */; - A9D8FC061043E94F0063561F /* PBXTextBookmark */ = A9D8FC061043E94F0063561F /* PBXTextBookmark */; - A9D8FC0D1043EBD30063561F /* PBXTextBookmark */ = A9D8FC0D1043EBD30063561F /* PBXTextBookmark */; - A9D8FC131043EC200063561F /* PBXTextBookmark */ = A9D8FC131043EC200063561F /* PBXTextBookmark */; - A9D8FC1E1043EFA00063561F /* PBXTextBookmark */ = A9D8FC1E1043EFA00063561F /* PBXTextBookmark */; - A9D8FC2010441C030063561F /* PBXTextBookmark */ = A9D8FC2010441C030063561F /* PBXTextBookmark */; - A9D8FC2110441C0F0063561F /* PBXTextBookmark */ = A9D8FC2110441C0F0063561F /* PBXTextBookmark */; - A9D8FC2410441DF10063561F /* PBXTextBookmark */ = A9D8FC2410441DF10063561F /* PBXTextBookmark */; - A9D8FC2510441E590063561F /* PBXTextBookmark */ = A9D8FC2510441E590063561F /* PBXTextBookmark */; - A9D8FC2610441E700063561F /* PBXTextBookmark */ = A9D8FC2610441E700063561F /* PBXTextBookmark */; - A9D8FC2710441E890063561F /* PBXTextBookmark */ = A9D8FC2710441E890063561F /* PBXTextBookmark */; - A9D8FC2910441E9B0063561F /* PBXTextBookmark */ = A9D8FC2910441E9B0063561F /* PBXTextBookmark */; - A9D8FC2F104423D80063561F /* PBXTextBookmark */ = A9D8FC2F104423D80063561F /* PBXTextBookmark */; - A9D8FC30104423D80063561F /* PBXTextBookmark */ = A9D8FC30104423D80063561F /* PBXTextBookmark */; - A9D8FC31104423D80063561F /* PBXTextBookmark */ = A9D8FC31104423D80063561F /* PBXTextBookmark */; - A9D8FC32104423D80063561F /* PBXTextBookmark */ = A9D8FC32104423D80063561F /* PBXTextBookmark */; - A9D8FC36104423F90063561F /* PBXTextBookmark */ = A9D8FC36104423F90063561F /* PBXTextBookmark */; - A9D8FC3D104427770063561F /* PBXTextBookmark */ = A9D8FC3D104427770063561F /* PBXTextBookmark */; - A9D8FC3F104427A10063561F /* PBXTextBookmark */ = A9D8FC3F104427A10063561F /* PBXTextBookmark */; - A9D8FC40104427AE0063561F /* PBXTextBookmark */ = A9D8FC40104427AE0063561F /* PBXTextBookmark */; - A9D8FC421044283D0063561F /* PBXTextBookmark */ = A9D8FC421044283D0063561F /* PBXTextBookmark */; - A9DE83571043CE2800567BA4 = A9DE83571043CE2800567BA4 /* PBXTextBookmark */; - A9DE835A1043CE2800567BA4 = A9DE835A1043CE2800567BA4 /* PBXTextBookmark */; - A9DE83781043CFEF00567BA4 = A9DE83781043CFEF00567BA4 /* PBXTextBookmark */; - A9DE83791043CFEF00567BA4 = A9DE83791043CFEF00567BA4 /* PBXTextBookmark */; - A9DE837A1043CFEF00567BA4 = A9DE837A1043CFEF00567BA4 /* PBXBookmark */; - A9DE837B1043CFEF00567BA4 = A9DE837B1043CFEF00567BA4 /* PBXTextBookmark */; - A9DE837C1043CFEF00567BA4 = A9DE837C1043CFEF00567BA4 /* PBXTextBookmark */; - A9DE85AA1043E49900567BA4 = A9DE85AA1043E49900567BA4 /* PBXTextBookmark */; - }; - sourceControlManager = A93E69C310420AA6007D418B /* Source Control */; - userBuildSettings = { - }; - }; - 8D1107260486CEB800E47090 /* love */ = { - activeExec = 0; - executables = ( - A93E69C010420A88007D418B /* love */, - ); - }; - A9255DEA1043188D00BA1496 /* SDLMain.m */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {762, 5586}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{561, 596}"; - }; - }; - A93E69C010420A88007D418B /* love */ = { - isa = PBXExecutable; - activeArgIndices = ( - ); - argumentStrings = ( - ); - autoAttachOnCrash = 1; - breakpointsEnabled = 0; - configStateDict = { - }; - customDataFormattersEnabled = 1; - debuggerPlugin = GDBDebugging; - disassemblyDisplayState = 0; - dylibVariantSuffix = ""; - enableDebugStr = 1; - environmentEntries = ( - ); - executableSystemSymbolLevel = 0; - executableUserSymbolLevel = 0; - libgmallocEnabled = 0; - name = love; - sourceDirectories = ( - ); - }; - A93E69C310420AA6007D418B /* Source Control */ = { - isa = PBXSourceControlManager; - fallbackIsa = XCSourceControlManager; - isSCMEnabled = 0; - scmConfiguration = { - }; - }; - A93E69C410420AA6007D418B /* Code sense */ = { - isa = PBXCodeSenseManager; - indexTemplatePath = ""; - }; - A93E69DE10420ABF007D418B /* config.h */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {481, 812}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{922, 334}"; - }; - }; - A93E69E110420ABF007D418B /* Exception.h */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {481, 770}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 844}"; - }; - }; - A93E69E610420ABF007D418B /* MemoryData.h */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {481, 910}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{987, 353}"; - }; - }; - A93E69E710420ABF007D418B /* Module.h */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {481, 798}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{1168, 298}"; - }; - }; - A93E69EA10420ABF007D418B /* Reference.cpp */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 742}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 927}"; - }; - }; - A93E69ED10420ABF007D418B /* runtime.h */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {798, 3990}}"; - sepNavSelRange = "{1030, 18}"; - sepNavVisRange = "{9125, 493}"; - }; - }; - A93E69F110420ABF007D418B /* version.h */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {481, 532}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 844}"; - }; - }; - A93E69F710420ABF007D418B /* keeper.lch */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 3094}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 1141}"; - }; - }; - A93E6A0410420ABF007D418B /* auxiliar.c */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 2156}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 765}"; - }; - }; - A93E6A2C10420AC0007D418B /* unix.c */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 5054}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 534}"; - }; - }; - A93E6A3010420AC0007D418B /* usocket.c */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 5250}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 728}"; - }; - }; - A93E6A3110420AC0007D418B /* usocket.h */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1206, 641}}"; - sepNavSelRange = "{601, 0}"; - sepNavVisRange = "{0, 1146}"; - sepNavWindowFrame = "{{15, 4}, {1265, 769}}"; - }; - }; - A93E6A3410420AC0007D418B /* love.cpp */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {606, 2576}}"; - sepNavSelRange = "{4804, 0}"; - sepNavVisRange = "{3953, 397}"; - }; - }; - A93E6A4410420AC0007D418B /* Audio.cpp */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {468, 2590}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 674}"; - }; - }; - A93E6A4510420AC0007D418B /* Audio.h */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {481, 1624}}"; - sepNavSelRange = "{1170, 127}"; - sepNavVisRange = "{1062, 295}"; - }; - }; - A93E6A4710420AC0007D418B /* Music.h */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {481, 1064}}"; - sepNavSelRange = "{1084, 127}"; - sepNavVisRange = "{1065, 229}"; - }; - }; - A93E6A4910420AC0007D418B /* Pool.h */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {481, 1806}}"; - sepNavSelRange = "{1297, 0}"; - sepNavVisRange = "{1139, 229}"; - }; - }; - A93E6A4A10420AC0007D418B /* Sound.cpp */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 1008}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 926}"; - }; - }; - A93E6A4B10420AC0007D418B /* Sound.h */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {481, 980}}"; - sepNavSelRange = "{1242, 0}"; - sepNavVisRange = "{1066, 274}"; - }; - }; - A93E6A4D10420AC0007D418B /* Source.h */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {481, 1190}}"; - sepNavSelRange = "{1243, 0}"; - sepNavVisRange = "{1095, 229}"; - }; - }; - A93E6A5210420AC0007D418B /* wrap_Audio.h */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 798}}"; - sepNavSelRange = "{1721, 64}"; - sepNavVisRange = "{1247, 565}"; - }; - }; - A93E6A5E10420AC1007D418B /* wrap_Event.cpp */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 1260}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 927}"; - }; - }; - A93E6A6B10420AC1007D418B /* wrap_FileData.cpp */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 798}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 908}"; - }; - }; - A93E6A7510420AC2007D418B /* wrap_Font.cpp */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 1064}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 927}"; - }; - }; - A93E6A8910420AC2007D418B /* GLee.c */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 182112}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 847}"; - }; - }; - A93E6A8D10420AC2007D418B /* Graphics.cpp */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {696, 17220}}"; - sepNavSelRange = "{2543, 0}"; - sepNavVisRange = "{2152, 690}"; - }; - }; - A93E6A8E10420AC2007D418B /* Graphics.h */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {481, 7588}}"; - sepNavSelRange = "{2168, 0}"; - sepNavVisRange = "{1975, 342}"; - }; - }; - A93E6A9010420AC2007D418B /* Image.h */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 2002}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{1597, 394}"; - }; - }; - A93E6AB210420AC3007D418B /* wrap_ImageData.cpp */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 1932}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 927}"; - }; - }; - A93E6AB710420AC3007D418B /* Joystick.cpp */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 2968}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 926}"; - }; - }; - A93E6AB910420AC3007D418B /* wrap_Joystick.cpp */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 2366}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 927}"; - }; - }; - A93E6ABE10420AC3007D418B /* Keyboard.cpp */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 812}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 926}"; - }; - }; - A93E6AC510420AC3007D418B /* Mouse.cpp */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 980}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 926}"; - }; - }; - A93E6AC710420AC3007D418B /* wrap_Mouse.cpp */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 1694}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 927}"; - }; - }; - A93E6ACB10420AC3007D418B /* api.c */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {481, 1680}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{1254, 265}"; - }; - }; - A93E6AD710420AC5007D418B /* libtcc.c */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {444, 31906}}"; - sepNavSelRange = "{39418, 40}"; - sepNavVisRange = "{39238, 339}"; - sepNavWindowFrame = "{{15, 4}, {1265, 769}}"; - }; - }; - A93E6AD810420AC5007D418B /* libtcc.h */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 1526}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 299}"; - }; - }; - A93E6AD910420AC5007D418B /* stab.def */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 3332}}"; - sepNavSelRange = "{8422, 0}"; - sepNavVisRange = "{8041, 701}"; - }; - }; - A93E6ADB10420AC5007D418B /* tcc.c */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {498, 7854}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{16939, 512}"; - sepNavWindowFrame = "{{15, 4}, {1265, 769}}"; - }; - }; - A93E6ADC10420AC5007D418B /* tcc.h */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {481, 10990}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{2051, 632}"; - sepNavWindowFrame = "{{15, 4}, {1265, 769}}"; - }; - }; - A93E6ADF10420AC6007D418B /* tccelf.c */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 38388}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 822}"; - }; - }; - A93E6AE210420AC7007D418B /* tccpp.c */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {481, 40502}}"; - sepNavSelRange = "{5078, 31}"; - sepNavVisRange = "{4906, 460}"; - }; - }; - A93E6AE510420AC7007D418B /* Native.cpp */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 2282}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{598, 493}"; - }; - }; - A93E6AE610420AC7007D418B /* Native.h */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 1162}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{844, 283}"; - }; - }; - A93E6AE710420AC7007D418B /* wrap_Native.cpp */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 1792}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 927}"; - }; - }; - A93E6AF010420AC7007D418B /* Contact.h */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {468, 1526}}"; - sepNavSelRange = "{1359, 0}"; - sepNavVisRange = "{1199, 238}"; - }; - }; - A93E6B0810420AC8007D418B /* Shape.cpp */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 2660}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 927}"; - }; - }; - A93E6B1710420AC8007D418B /* b2CircleShape.cpp */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 1568}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 947}"; - }; - }; - A93E6B5810420ACA007D418B /* wrap_GearJoint.cpp */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 854}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 927}"; - }; - }; - A93E6B7010420ACB007D418B /* Signal.cpp */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 896}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 908}"; - }; - }; - A93E6B7110420ACB007D418B /* Signal.h */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 812}}"; - sepNavSelRange = "{1377, 23}"; - sepNavVisRange = "{4, 905}"; - }; - }; - A93E6B7210420ACB007D418B /* wrap_Signal.cpp */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 1106}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 908}"; - }; - }; - A93E6B7910420ACB007D418B /* FLACDecoder.cpp */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 2296}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 908}"; - }; - }; - A93E6B7F10420ACB007D418B /* Sound.cpp */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {618, 1050}}"; - sepNavSelRange = "{1940, 0}"; - sepNavVisRange = "{0, 926}"; - }; - }; - A93E6B9710420ACC007D418B /* boot.lua */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {481, 9702}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 391}"; - }; - }; - A93E6B9810420ACC007D418B /* boot.lua.h */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 9926}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 1228}"; - }; - }; - A9D8FBD21043E5320063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A93E6A8910420AC2007D418B /* GLee.c */; - name = "GLee.c: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 847; - vrLoc = 0; - }; - A9D8FBE01043E5AE0063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - comments = "warning: 'OV_CALLBACKS_DEFAULT' defined but not used"; - fRef = A9D8FBE11043E5AE0063561F /* vorbisfile.h */; - rLen = 1; - rLoc = 55; - rType = 1; - }; - A9D8FBE11043E5AE0063561F /* vorbisfile.h */ = { - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = vorbisfile.h; - path = /opt/local/include/vorbis/vorbisfile.h; - sourceTree = ""; - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 2464}}"; - sepNavSelRange = "{2279, 45}"; - sepNavVisRange = "{1931, 733}"; - }; - }; - A9D8FBE21043E5AE0063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9D8FBE31043E5AE0063561F /* vorbisfile.h */; - name = "vorbisfile.h: 56"; - rLen = 45; - rLoc = 2279; - rType = 0; - vrLen = 629; - vrLoc = 1931; - }; - A9D8FBE31043E5AE0063561F /* vorbisfile.h */ = { - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = vorbisfile.h; - path = /opt/local/include/vorbis/vorbisfile.h; - sourceTree = ""; - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {492, 2618}}"; - sepNavSelRange = "{2279, 45}"; - sepNavVisRange = "{1931, 629}"; - }; - }; - A9D8FBE71043E5C10063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A93E6A8910420AC2007D418B /* GLee.c */; - name = "GLee.c: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 847; - vrLoc = 0; - }; - A9D8FBE81043E5C10063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A93E6B7910420ACB007D418B /* FLACDecoder.cpp */; - name = "FLACDecoder.cpp: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 908; - vrLoc = 0; - }; - A9D8FBE91043E5C10063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A93E6B7F10420ACB007D418B /* Sound.cpp */; - name = "Sound.cpp: 63"; - rLen = 0; - rLoc = 1940; - rType = 0; - vrLen = 926; - vrLoc = 0; - }; - A9D8FBEA1043E5C10063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A93E6A8910420AC2007D418B /* GLee.c */; - name = "GLee.c: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 847; - vrLoc = 0; - }; - A9D8FBEB1043E5C10063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A93E6B7910420ACB007D418B /* FLACDecoder.cpp */; - name = "FLACDecoder.cpp: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 908; - vrLoc = 0; - }; - A9D8FBEC1043E5C10063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A93E6B7F10420ACB007D418B /* Sound.cpp */; - name = "Sound.cpp: 63"; - rLen = 0; - rLoc = 1940; - rType = 0; - vrLen = 926; - vrLoc = 0; - }; - A9D8FBED1043E5C10063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9D8FBE11043E5AE0063561F /* vorbisfile.h */; - name = "vorbisfile.h: 56"; - rLen = 45; - rLoc = 2279; - rType = 0; - vrLen = 733; - vrLoc = 1931; - }; - A9D8FBFC1043E7C20063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9D8FBE11043E5AE0063561F /* vorbisfile.h */; - name = "vorbisfile.h: 56"; - rLen = 45; - rLoc = 2279; - rType = 0; - vrLen = 733; - vrLoc = 1931; - }; - A9D8FC011043E8770063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9D8FBE11043E5AE0063561F /* vorbisfile.h */; - name = "vorbisfile.h: 56"; - rLen = 45; - rLoc = 2279; - rType = 0; - vrLen = 733; - vrLoc = 1931; - }; - A9D8FC031043E94F0063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9D8FBE11043E5AE0063561F /* vorbisfile.h */; - name = "vorbisfile.h: 56"; - rLen = 45; - rLoc = 2279; - rType = 0; - vrLen = 733; - vrLoc = 1931; - }; - A9D8FC041043E94F0063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9255DEA1043188D00BA1496 /* SDLMain.m */; - name = "SDLMain.m: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 604; - vrLoc = 0; - }; - A9D8FC051043E94F0063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9D8FBE11043E5AE0063561F /* vorbisfile.h */; - name = "vorbisfile.h: 56"; - rLen = 45; - rLoc = 2279; - rType = 0; - vrLen = 733; - vrLoc = 1931; - }; - A9D8FC061043E94F0063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9255DEA1043188D00BA1496 /* SDLMain.m */; - name = "SDLMain.m: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 549; - vrLoc = 347; - }; - A9D8FC0D1043EBD30063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9255DEA1043188D00BA1496 /* SDLMain.m */; - name = "SDLMain.m: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 596; - vrLoc = 561; - }; - A9D8FC131043EC200063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9255DEA1043188D00BA1496 /* SDLMain.m */; - name = "SDLMain.m: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 596; - vrLoc = 561; - }; - A9D8FC1E1043EFA00063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9255DEA1043188D00BA1496 /* SDLMain.m */; - name = "SDLMain.m: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 596; - vrLoc = 561; - }; - A9D8FC2010441C030063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9255DEA1043188D00BA1496 /* SDLMain.m */; - name = "SDLMain.m: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 596; - vrLoc = 561; - }; - A9D8FC2110441C0F0063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9255DEA1043188D00BA1496 /* SDLMain.m */; - name = "SDLMain.m: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 596; - vrLoc = 561; - }; - A9D8FC2410441DF10063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9255DEA1043188D00BA1496 /* SDLMain.m */; - name = "SDLMain.m: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 596; - vrLoc = 561; - }; - A9D8FC2510441E590063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9255DEA1043188D00BA1496 /* SDLMain.m */; - name = "SDLMain.m: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 596; - vrLoc = 561; - }; - A9D8FC2610441E700063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9255DEA1043188D00BA1496 /* SDLMain.m */; - name = "SDLMain.m: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 596; - vrLoc = 561; - }; - A9D8FC2710441E890063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9255DEA1043188D00BA1496 /* SDLMain.m */; - name = "SDLMain.m: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 596; - vrLoc = 561; - }; - A9D8FC2910441E9B0063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9255DEA1043188D00BA1496 /* SDLMain.m */; - name = "SDLMain.m: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 596; - vrLoc = 561; - }; - A9D8FC2F104423D80063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9D8FBE31043E5AE0063561F /* vorbisfile.h */; - name = "vorbisfile.h: 56"; - rLen = 45; - rLoc = 2279; - rType = 0; - vrLen = 629; - vrLoc = 1931; - }; - A9D8FC30104423D80063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - comments = "error: 'struct mcontext' has no member named '__ss'"; - fRef = A93E6AD710420AC5007D418B /* libtcc.c */; - rLen = 1; - rLoc = 1480; - rType = 1; - }; - A9D8FC31104423D80063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9D8FBE31043E5AE0063561F /* vorbisfile.h */; - name = "vorbisfile.h: 56"; - rLen = 45; - rLoc = 2279; - rType = 0; - vrLen = 629; - vrLoc = 1931; - }; - A9D8FC32104423D80063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A93E6AD710420AC5007D418B /* libtcc.c */; - name = "libtcc.c: 1481"; - rLen = 40; - rLoc = 39418; - rType = 0; - vrLen = 300; - vrLoc = 39238; - }; - A9D8FC36104423F90063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9255DEA1043188D00BA1496 /* SDLMain.m */; - name = "SDLMain.m: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 596; - vrLoc = 561; - }; - A9D8FC3D104427770063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9255DEA1043188D00BA1496 /* SDLMain.m */; - name = "SDLMain.m: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 596; - vrLoc = 561; - }; - A9D8FC3F104427A10063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9255DEA1043188D00BA1496 /* SDLMain.m */; - name = "SDLMain.m: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 596; - vrLoc = 561; - }; - A9D8FC40104427AE0063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9255DEA1043188D00BA1496 /* SDLMain.m */; - name = "SDLMain.m: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 596; - vrLoc = 561; - }; - A9D8FC421044283D0063561F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9255DEA1043188D00BA1496 /* SDLMain.m */; - name = "SDLMain.m: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 596; - vrLoc = 561; - }; - A9DE83571043CE2800567BA4 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A93E6B7110420ACB007D418B /* Signal.h */; - name = "Signal.h: 52"; - rLen = 23; - rLoc = 1377; - rType = 0; - vrLen = 905; - vrLoc = 4; - }; - A9DE83591043CE2800567BA4 /* Makefile */ = { - isa = PBXFileReference; - lastKnownFileType = sourcecode.make; - name = Makefile; - path = "/Users/bill/Downloads/flac-1.2.1/src/libFLAC++/Makefile"; - sourceTree = ""; - }; - A9DE835A1043CE2800567BA4 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A93E6B7110420ACB007D418B /* Signal.h */; - name = "Signal.h: 52"; - rLen = 23; - rLoc = 1377; - rType = 0; - vrLen = 905; - vrLoc = 4; - }; - A9DE83781043CFEF00567BA4 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9DE83591043CE2800567BA4 /* Makefile */; - name = "Makefile: 608"; - rLen = 0; - rLoc = 18653; - rType = 0; - vrLen = 753; - vrLoc = 233; - }; - A9DE83791043CFEF00567BA4 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A93E6ADF10420AC6007D418B /* tccelf.c */; - name = "tccelf.c: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 822; - vrLoc = 0; - }; - A9DE837A1043CFEF00567BA4 /* PBXBookmark */ = { - isa = PBXBookmark; - fRef = A93E6A8910420AC2007D418B /* GLee.c */; - }; - A9DE837B1043CFEF00567BA4 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A9DE83591043CE2800567BA4 /* Makefile */; - name = "Makefile: 608"; - rLen = 0; - rLoc = 18653; - rType = 0; - vrLen = 753; - vrLoc = 233; - }; - A9DE837C1043CFEF00567BA4 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A93E6ADF10420AC6007D418B /* tccelf.c */; - name = "tccelf.c: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 822; - vrLoc = 0; - }; - A9DE85AA1043E49900567BA4 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = A93E6A8910420AC2007D418B /* GLee.c */; - name = "GLee.c: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 847; - vrLoc = 0; - }; -} diff --git a/love/src/jni/love/platform/xcode/love.xcodeproj/project.pbxproj b/love/src/jni/love/platform/xcode/love.xcodeproj/project.pbxproj deleted file mode 100644 index b1721a5c..00000000 --- a/love/src/jni/love/platform/xcode/love.xcodeproj/project.pbxproj +++ /dev/null @@ -1,948 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; - A9255DD31043183600BA1496 /* Lua.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A93E6E5310420B57007D418B /* Lua.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - A9255E031043195A00BA1496 /* vorbis.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9255E021043195A00BA1496 /* vorbis.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - A9255F58104324E100BA1496 /* ogg.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9255F51104324D700BA1496 /* ogg.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - A93E6E5510420B57007D418B /* Lua.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A93E6E5310420B57007D418B /* Lua.framework */; }; - A93E6EED10420BA8007D418B /* love.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A93E6A3410420AC0007D418B /* love.cpp */; }; - A9F169AC109E825000FC83D1 /* mpg123.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9F169A6109E824900FC83D1 /* mpg123.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - A9F169AD109E825000FC83D1 /* libmodplug.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9F16926109E7BAD00FC83D1 /* libmodplug.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - CE73F8001EEB64150052DAB3 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE73F7FF1EEB64150052DAB3 /* AVFoundation.framework */; }; - FA0797991BF480A200034B7C /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA0797981BF480A200034B7C /* GameController.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; - FA08F69616C766E000F007B5 /* love.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA08F69116C765A200F007B5 /* love.framework */; }; - FA08F69716C766E700F007B5 /* love.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = FA08F69116C765A200F007B5 /* love.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - FA0B7F301A95AC7D000E1D17 /* love.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A93E6A3410420AC0007D418B /* love.cpp */; }; - FA15DFB41F9B8D9E0042AB22 /* libbz2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = FA15DFB31F9B8D9E0042AB22 /* libbz2.tbd */; }; - FA27B3CB1B498696008A9DCE /* theora.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA27B3CA1B498696008A9DCE /* theora.framework */; }; - FA5933751C6D625B000EC779 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FA5D249A1A96CF4300C6FC8F /* Images.xcassets */; }; - FA5D24821A96CA1800C6FC8F /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA5D24811A96CA1800C6FC8F /* OpenAL.framework */; }; - FA5D24841A96CA2700C6FC8F /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA5D24831A96CA2700C6FC8F /* OpenGLES.framework */; }; - FA5D24881A96CA8A00C6FC8F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA5D24871A96CA8A00C6FC8F /* UIKit.framework */; }; - FA5D248A1A96CA9600C6FC8F /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA5D24891A96CA9600C6FC8F /* AudioToolbox.framework */; }; - FA5D248C1A96CA9E00C6FC8F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA5D248B1A96CA9E00C6FC8F /* QuartzCore.framework */; }; - FA5D248E1A96CAA700C6FC8F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA5D248D1A96CAA700C6FC8F /* CoreGraphics.framework */; }; - FA5D24941A96CABA00C6FC8F /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FA5D24931A96CABA00C6FC8F /* libz.dylib */; }; - FA5D24961A96CAC200C6FC8F /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA5D24951A96CAC200C6FC8F /* CoreMotion.framework */; }; - FA5D249C1A96CF4300C6FC8F /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FA5D249A1A96CF4300C6FC8F /* Images.xcassets */; }; - FA5D24C21A96D78000C6FC8F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA5D24C11A96D78000C6FC8F /* Foundation.framework */; }; - FA5D24D11A96E73300C6FC8F /* liblove.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FA0B7EEF1A95924A000E1D17 /* liblove.a */; }; - FA7C636A1A9C49570000FD29 /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = FA7C63691A9C49570000FD29 /* Launch Screen.xib */; }; - FA9B4A0A16E1579F00074F42 /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA9B4A0916E1579F00074F42 /* SDL2.framework */; }; - FA9B4A0B16E157B500074F42 /* SDL2.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = FA9B4A0916E1579F00074F42 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - FAAFF04716CB120000CCDE45 /* OpenAL-Soft.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = FAAFF04616CB120000CCDE45 /* OpenAL-Soft.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - FAC1A449196F5DC600125284 /* license.txt in Resources */ = {isa = PBXBuildFile; fileRef = FAC1A448196F5DC600125284 /* license.txt */; }; - FAD43ED01FF3136500831BB8 /* freetype.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = FAD43ECF1FF3133700831BB8 /* freetype.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - FAD4B1731C1F50A3004CF150 /* theora.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = FA27B3CA1B498696008A9DCE /* theora.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - FAE64A9D2072738600BC7981 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE64A9C2072738600BC7981 /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - FA0B78D71A958301000E1D17 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = FA577A9316C7217800860150 /* liblove.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = FA577AAF16C7507900860150; - remoteInfo = Framework; - }; - FA0B7EEE1A95924A000E1D17 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = FA577A9316C7217800860150 /* liblove.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = FA0B78DD1A958B90000E1D17; - remoteInfo = "liblove-ios"; - }; - FA5D24BA1A96D6FC00C6FC8F /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = FA577A9316C7217800860150 /* liblove.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = FA0B78DC1A958B90000E1D17; - remoteInfo = "liblove-ios"; - }; - FAA287711B0ABF1400B82827 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = FA577A9316C7217800860150 /* liblove.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = FA577AAE16C7507900860150; - remoteInfo = "liblove-macosx"; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - A9255DDE1043185300BA1496 /* Copy Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - FA08F69716C766E700F007B5 /* love.framework in Copy Frameworks */, - FA9B4A0B16E157B500074F42 /* SDL2.framework in Copy Frameworks */, - FAD4B1731C1F50A3004CF150 /* theora.framework in Copy Frameworks */, - FAAFF04716CB120000CCDE45 /* OpenAL-Soft.framework in Copy Frameworks */, - FAD43ED01FF3136500831BB8 /* freetype.framework in Copy Frameworks */, - A9F169AC109E825000FC83D1 /* mpg123.framework in Copy Frameworks */, - A9F169AD109E825000FC83D1 /* libmodplug.framework in Copy Frameworks */, - A9255F58104324E100BA1496 /* ogg.framework in Copy Frameworks */, - A9255E031043195A00BA1496 /* vorbis.framework in Copy Frameworks */, - A9255DD31043183600BA1496 /* Lua.framework in Copy Frameworks */, - ); - name = "Copy Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; - 8D1107320486CEB800E47090 /* love.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = love.app; sourceTree = BUILT_PRODUCTS_DIR; }; - A9255E021043195A00BA1496 /* vorbis.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = vorbis.framework; path = /Library/Frameworks/vorbis.framework; sourceTree = ""; }; - A9255F51104324D700BA1496 /* ogg.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ogg.framework; path = /Library/Frameworks/ogg.framework; sourceTree = ""; }; - A93E6A3410420AC0007D418B /* love.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = love.cpp; path = ../../src/love.cpp; sourceTree = ""; }; - A93E6E4710420B4A007D418B /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; - A93E6E5310420B57007D418B /* Lua.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Lua.framework; path = /Library/Frameworks/Lua.framework; sourceTree = ""; }; - A97E3842132A9EDE00198A2F /* love-macosx.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "love-macosx.plist"; path = "macosx/love-macosx.plist"; sourceTree = ""; }; - A9F16926109E7BAD00FC83D1 /* libmodplug.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = libmodplug.framework; path = /Library/Frameworks/libmodplug.framework; sourceTree = ""; }; - A9F169A6109E824900FC83D1 /* mpg123.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = mpg123.framework; path = /Library/Frameworks/mpg123.framework; sourceTree = ""; }; - CE73F7FF1EEB64150052DAB3 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/AVFoundation.framework; sourceTree = DEVELOPER_DIR; }; - FA0797981BF480A200034B7C /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk/System/Library/Frameworks/GameController.framework; sourceTree = DEVELOPER_DIR; }; - FA08F69116C765A200F007B5 /* love.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = love.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - FA0B7F061A95AAF3000E1D17 /* love.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = love.app; sourceTree = BUILT_PRODUCTS_DIR; }; - FA15DFB31F9B8D9E0042AB22 /* libbz2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libbz2.tbd; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/lib/libbz2.tbd; sourceTree = DEVELOPER_DIR; }; - FA27B3CA1B498696008A9DCE /* theora.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = theora.framework; path = /Library/Frameworks/theora.framework; sourceTree = ""; }; - FA577A9316C7217800860150 /* liblove.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = liblove.xcodeproj; sourceTree = ""; }; - FA5D24811A96CA1800C6FC8F /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/OpenAL.framework; sourceTree = DEVELOPER_DIR; }; - FA5D24831A96CA2700C6FC8F /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; }; - FA5D24871A96CA8A00C6FC8F /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; - FA5D24891A96CA9600C6FC8F /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/AudioToolbox.framework; sourceTree = DEVELOPER_DIR; }; - FA5D248B1A96CA9E00C6FC8F /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; }; - FA5D248D1A96CAA700C6FC8F /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; }; - FA5D24931A96CABA00C6FC8F /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/usr/lib/libz.dylib; sourceTree = DEVELOPER_DIR; }; - FA5D24951A96CAC200C6FC8F /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/CoreMotion.framework; sourceTree = DEVELOPER_DIR; }; - FA5D24971A96CE1E00C6FC8F /* love-ios.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "love-ios.plist"; path = "ios/love-ios.plist"; sourceTree = ""; }; - FA5D249A1A96CF4300C6FC8F /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - FA5D24C11A96D78000C6FC8F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; - FA7C63691A9C49570000FD29 /* Launch Screen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = "Launch Screen.xib"; path = "ios/Launch Screen.xib"; sourceTree = ""; }; - FA9B4A0916E1579F00074F42 /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = /Library/Frameworks/SDL2.framework; sourceTree = ""; }; - FAAFF04616CB120000CCDE45 /* OpenAL-Soft.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "OpenAL-Soft.framework"; path = "/Library/Frameworks/OpenAL-Soft.framework"; sourceTree = ""; }; - FAC1A448196F5DC600125284 /* license.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = license.txt; path = ../../license.txt; sourceTree = ""; }; - FAD43ECF1FF3133700831BB8 /* freetype.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = freetype.framework; path = /Library/Frameworks/freetype.framework; sourceTree = ""; }; - FAE64A9C2072738600BC7981 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.2.sdk/System/Library/Frameworks/Metal.framework; sourceTree = DEVELOPER_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 8D11072E0486CEB800E47090 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA08F69616C766E000F007B5 /* love.framework in Frameworks */, - 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, - A93E6E5510420B57007D418B /* Lua.framework in Frameworks */, - FA27B3CB1B498696008A9DCE /* theora.framework in Frameworks */, - FA9B4A0A16E1579F00074F42 /* SDL2.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - FA0B7F031A95AAF3000E1D17 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FAE64A9D2072738600BC7981 /* Metal.framework in Frameworks */, - FA15DFB41F9B8D9E0042AB22 /* libbz2.tbd in Frameworks */, - CE73F8001EEB64150052DAB3 /* AVFoundation.framework in Frameworks */, - FA5D24D11A96E73300C6FC8F /* liblove.a in Frameworks */, - FA5D24C21A96D78000C6FC8F /* Foundation.framework in Frameworks */, - FA5D24961A96CAC200C6FC8F /* CoreMotion.framework in Frameworks */, - FA0797991BF480A200034B7C /* GameController.framework in Frameworks */, - FA5D24941A96CABA00C6FC8F /* libz.dylib in Frameworks */, - FA5D248E1A96CAA700C6FC8F /* CoreGraphics.framework in Frameworks */, - FA5D248C1A96CA9E00C6FC8F /* QuartzCore.framework in Frameworks */, - FA5D248A1A96CA9600C6FC8F /* AudioToolbox.framework in Frameworks */, - FA5D24881A96CA8A00C6FC8F /* UIKit.framework in Frameworks */, - FA5D24841A96CA2700C6FC8F /* OpenGLES.framework in Frameworks */, - FA5D24821A96CA1800C6FC8F /* OpenAL.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 1058C7A0FEA54F0111CA2CBB /* Frameworks */ = { - isa = PBXGroup; - children = ( - FAE64A9C2072738600BC7981 /* Metal.framework */, - FA15DFB31F9B8D9E0042AB22 /* libbz2.tbd */, - CE73F7FF1EEB64150052DAB3 /* AVFoundation.framework */, - FA5D24801A96C97900C6FC8F /* ios */, - FA0B7EEC1A959249000E1D17 /* macosx */, - ); - name = Frameworks; - sourceTree = ""; - }; - 19C28FACFE9D520D11CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 8D1107320486CEB800E47090 /* love.app */, - FA0B7F061A95AAF3000E1D17 /* love.app */, - ); - name = Products; - sourceTree = ""; - }; - 29B97314FDCFA39411CA2CEA /* love */ = { - isa = PBXGroup; - children = ( - FA5D249A1A96CF4300C6FC8F /* Images.xcassets */, - FA577A9D16C7262E00860150 /* Source */, - FA5D24A01A96CF7200C6FC8F /* Supporting Files */, - 1058C7A0FEA54F0111CA2CBB /* Frameworks */, - 19C28FACFE9D520D11CA2CBB /* Products */, - 29B97317FDCFA39411CA2CEA /* Resources */, - FA577A9316C7217800860150 /* liblove.xcodeproj */, - ); - name = love; - sourceTree = ""; - usesTabs = 1; - }; - 29B97317FDCFA39411CA2CEA /* Resources */ = { - isa = PBXGroup; - children = ( - FAC1A448196F5DC600125284 /* license.txt */, - ); - name = Resources; - sourceTree = ""; - }; - FA0B78D41A958301000E1D17 /* Products */ = { - isa = PBXGroup; - children = ( - FA0B78D81A958301000E1D17 /* love.framework */, - FA0B7EEF1A95924A000E1D17 /* liblove.a */, - ); - name = Products; - sourceTree = ""; - }; - FA0B7EEC1A959249000E1D17 /* macosx */ = { - isa = PBXGroup; - children = ( - 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, - FAD43ECF1FF3133700831BB8 /* freetype.framework */, - A9F16926109E7BAD00FC83D1 /* libmodplug.framework */, - FA08F69116C765A200F007B5 /* love.framework */, - A93E6E5310420B57007D418B /* Lua.framework */, - A9F169A6109E824900FC83D1 /* mpg123.framework */, - A9255F51104324D700BA1496 /* ogg.framework */, - FAAFF04616CB120000CCDE45 /* OpenAL-Soft.framework */, - A93E6E4710420B4A007D418B /* OpenGL.framework */, - FA9B4A0916E1579F00074F42 /* SDL2.framework */, - FA27B3CA1B498696008A9DCE /* theora.framework */, - A9255E021043195A00BA1496 /* vorbis.framework */, - ); - name = macosx; - sourceTree = ""; - }; - FA577A9D16C7262E00860150 /* Source */ = { - isa = PBXGroup; - children = ( - A93E6A3410420AC0007D418B /* love.cpp */, - ); - name = Source; - sourceTree = ""; - }; - FA5D24801A96C97900C6FC8F /* ios */ = { - isa = PBXGroup; - children = ( - FA0797981BF480A200034B7C /* GameController.framework */, - FA5D24C11A96D78000C6FC8F /* Foundation.framework */, - FA5D24891A96CA9600C6FC8F /* AudioToolbox.framework */, - FA5D248D1A96CAA700C6FC8F /* CoreGraphics.framework */, - FA5D24951A96CAC200C6FC8F /* CoreMotion.framework */, - FA5D24931A96CABA00C6FC8F /* libz.dylib */, - FA5D24811A96CA1800C6FC8F /* OpenAL.framework */, - FA5D24831A96CA2700C6FC8F /* OpenGLES.framework */, - FA5D248B1A96CA9E00C6FC8F /* QuartzCore.framework */, - FA5D24871A96CA8A00C6FC8F /* UIKit.framework */, - ); - name = ios; - sourceTree = ""; - }; - FA5D24A01A96CF7200C6FC8F /* Supporting Files */ = { - isa = PBXGroup; - children = ( - FA7C63691A9C49570000FD29 /* Launch Screen.xib */, - FA5D24971A96CE1E00C6FC8F /* love-ios.plist */, - A97E3842132A9EDE00198A2F /* love-macosx.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 8D1107260486CEB800E47090 /* love-macosx */ = { - isa = PBXNativeTarget; - buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "love-macosx" */; - buildPhases = ( - 8D1107290486CEB800E47090 /* Resources */, - 8D11072C0486CEB800E47090 /* Sources */, - A9255DDE1043185300BA1496 /* Copy Frameworks */, - 8D11072E0486CEB800E47090 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - FAA287721B0ABF1400B82827 /* PBXTargetDependency */, - ); - name = "love-macosx"; - productInstallPath = "$(HOME)/Applications"; - productName = love; - productReference = 8D1107320486CEB800E47090 /* love.app */; - productType = "com.apple.product-type.application"; - }; - FA0B7F051A95AAF3000E1D17 /* love-ios */ = { - isa = PBXNativeTarget; - buildConfigurationList = FA0B7F2E1A95AAF4000E1D17 /* Build configuration list for PBXNativeTarget "love-ios" */; - buildPhases = ( - FA0B7F021A95AAF3000E1D17 /* Sources */, - FA0B7F031A95AAF3000E1D17 /* Frameworks */, - FA0B7F041A95AAF3000E1D17 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - FA5D24BB1A96D6FC00C6FC8F /* PBXTargetDependency */, - ); - name = "love-ios"; - productName = "love-ios"; - productReference = FA0B7F061A95AAF3000E1D17 /* love.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 29B97313FDCFA39411CA2CEA /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 1000; - TargetAttributes = { - FA0B7F051A95AAF3000E1D17 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "love" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - Base, - ); - mainGroup = 29B97314FDCFA39411CA2CEA /* love */; - projectDirPath = ""; - projectReferences = ( - { - ProductGroup = FA0B78D41A958301000E1D17 /* Products */; - ProjectRef = FA577A9316C7217800860150 /* liblove.xcodeproj */; - }, - ); - projectRoot = ""; - targets = ( - 8D1107260486CEB800E47090 /* love-macosx */, - FA0B7F051A95AAF3000E1D17 /* love-ios */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXReferenceProxy section */ - FA0B78D81A958301000E1D17 /* love.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = love.framework; - remoteRef = FA0B78D71A958301000E1D17 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - FA0B7EEF1A95924A000E1D17 /* liblove.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = liblove.a; - remoteRef = FA0B7EEE1A95924A000E1D17 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - -/* Begin PBXResourcesBuildPhase section */ - 8D1107290486CEB800E47090 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - FA5933751C6D625B000EC779 /* Images.xcassets in Resources */, - FAC1A449196F5DC600125284 /* license.txt in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - FA0B7F041A95AAF3000E1D17 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - FA5D249C1A96CF4300C6FC8F /* Images.xcassets in Resources */, - FA7C636A1A9C49570000FD29 /* Launch Screen.xib in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 8D11072C0486CEB800E47090 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - A93E6EED10420BA8007D418B /* love.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - FA0B7F021A95AAF3000E1D17 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - FA0B7F301A95AC7D000E1D17 /* love.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - FA5D24BB1A96D6FC00C6FC8F /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "liblove-ios"; - targetProxy = FA5D24BA1A96D6FC00C6FC8F /* PBXContainerItemProxy */; - }; - FAA287721B0ABF1400B82827 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "liblove-macosx"; - targetProxy = FAA287711B0ABF1400B82827 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - C01FCF4B08A954540054247B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = "OS X AppIcon"; - COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/macosx/Frameworks", - /Library/Frameworks, - "\"$(SRCROOT)/build/Release\"", - "\"$(SRCROOT)/build/Debug\"", - "$(LOCAL_LIBRARY_DIR)/Frameworks", - ); - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/macosx/Frameworks/Lua.framework/Headers", - "$(PROJECT_DIR)/macosx/Frameworks/SDL2.framework/Headers", - /Library/Frameworks/Lua.framework/Headers, - /Library/Frameworks/SDL2.framework/Headers, - ); - INFOPLIST_FILE = "macosx/love-macosx.plist"; - INSTALL_PATH = /Applications; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = org.love2d.love; - PRODUCT_NAME = love; - }; - name = Debug; - }; - C01FCF4C08A954540054247B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = "OS X AppIcon"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/macosx/Frameworks", - /Library/Frameworks, - "\"$(SRCROOT)/build/Release\"", - "\"$(SRCROOT)/build/Debug\"", - "$(LOCAL_LIBRARY_DIR)/Frameworks", - ); - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/macosx/Frameworks/Lua.framework/Headers", - "$(PROJECT_DIR)/macosx/Frameworks/SDL2.framework/Headers", - /Library/Frameworks/Lua.framework/Headers, - /Library/Frameworks/SDL2.framework/Headers, - ); - INFOPLIST_FILE = "macosx/love-macosx.plist"; - INSTALL_PATH = /Applications; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = org.love2d.love; - PRODUCT_NAME = love; - }; - name = Release; - }; - C01FCF4F08A954540054247B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - FRAMEWORK_SEARCH_PATHS = ""; - GCC_INCREASE_PRECOMPILED_HEADER_SHARING = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = LOVE_APPLE_USE_FRAMEWORKS; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = NO; - GCC_WARN_ABOUT_MISSING_NEWLINE = NO; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = YES; - GCC_WARN_ABOUT_RETURN_TYPE = NO; - GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; - GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = NO; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = NO; - GCC_WARN_MISSING_PARENTHESES = NO; - GCC_WARN_NON_VIRTUAL_DESTRUCTOR = NO; - GCC_WARN_PEDANTIC = NO; - GCC_WARN_SHADOW = NO; - GCC_WARN_SIGN_COMPARE = YES; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = NO; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "\"$(SRCROOT)/../../src\"", - "\"$(SRCROOT)/../../src/libraries\"", - "\"$(SRCROOT)/../../src/modules\"", - ); - INFOPLIST_FILE = "love-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.7; - ONLY_ACTIVE_ARCH = YES; - OTHER_LDFLAGS = ""; - "OTHER_LDFLAGS[arch=x86_64]" = ( - "-pagezero_size", - 10000, - "-image_base", - 100000000, - ); - PRODUCT_NAME = love; - SDKROOT = macosx; - WARNING_CFLAGS = ( - "-Wall", - "-W", - ); - }; - name = Debug; - }; - C01FCF5008A954540054247B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - DEPLOYMENT_POSTPROCESSING = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = ""; - GCC_INPUT_FILETYPE = automatic; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 3; - GCC_PREPROCESSOR_DEFINITIONS = LOVE_APPLE_USE_FRAMEWORKS; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = NO; - GCC_WARN_ABOUT_MISSING_NEWLINE = NO; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = YES; - GCC_WARN_ABOUT_RETURN_TYPE = NO; - GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; - GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = NO; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = NO; - GCC_WARN_MISSING_PARENTHESES = NO; - GCC_WARN_NON_VIRTUAL_DESTRUCTOR = NO; - GCC_WARN_PEDANTIC = NO; - GCC_WARN_SHADOW = NO; - GCC_WARN_SIGN_COMPARE = YES; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = NO; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_PARAMETER = NO; - GCC_WARN_UNUSED_VALUE = NO; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "\"$(SRCROOT)/../../src\"", - "\"$(SRCROOT)/../../src/libraries\"", - "\"$(SRCROOT)/../../src/modules\"", - ); - INFOPLIST_FILE = "love-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks"; - LLVM_LTO = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; - ONLY_ACTIVE_ARCH = NO; - OTHER_LDFLAGS = ""; - "OTHER_LDFLAGS[arch=x86_64]" = ( - "-pagezero_size", - 10000, - "-image_base", - 100000000, - ); - PRODUCT_NAME = love; - SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES; - SDKROOT = macosx; - WARNING_CFLAGS = ( - "-Wall", - "-W", - ); - }; - name = Release; - }; - FA0B7F261A95AAF4000E1D17 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = "iOS AppIcon"; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = "iOS LaunchImage"; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - ENABLE_BITCODE = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_DYNAMIC_NO_PIC = NO; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - ios/include, - ios/include/luajit, - ios/include/SDL2, - ); - INFOPLIST_FILE = "$(SRCROOT)/ios/love-ios.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = YES; - PRODUCT_BUNDLE_IDENTIFIER = org.love2d.love; - PRODUCT_NAME = love; - PROVISIONING_PROFILE = ""; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - FA0B7F271A95AAF4000E1D17 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = "iOS AppIcon"; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = "iOS LaunchImage"; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_BITCODE = NO; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - ios/include, - ios/include/luajit, - ios/include/SDL2, - ); - INFOPLIST_FILE = "$(SRCROOT)/ios/love-ios.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_BUNDLE_IDENTIFIER = org.love2d.love; - PRODUCT_NAME = love; - PROVISIONING_PROFILE = ""; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - FA0B7F281A95AAF4000E1D17 /* Distribution */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = "iOS AppIcon"; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = "iOS LaunchImage"; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_BITCODE = NO; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - ios/include, - ios/include/luajit, - ios/include/SDL2, - ); - INFOPLIST_FILE = "$(SRCROOT)/ios/love-ios.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_BUNDLE_IDENTIFIER = org.love2d.love; - PRODUCT_NAME = love; - PROVISIONING_PROFILE = ""; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Distribution; - }; - FA5326C618971A0900F7BBF4 /* Distribution */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - DEPLOYMENT_POSTPROCESSING = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = ""; - GCC_INPUT_FILETYPE = automatic; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 3; - GCC_PREPROCESSOR_DEFINITIONS = LOVE_APPLE_USE_FRAMEWORKS; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = NO; - GCC_WARN_ABOUT_MISSING_NEWLINE = NO; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = YES; - GCC_WARN_ABOUT_RETURN_TYPE = NO; - GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; - GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = NO; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = NO; - GCC_WARN_MISSING_PARENTHESES = NO; - GCC_WARN_NON_VIRTUAL_DESTRUCTOR = NO; - GCC_WARN_PEDANTIC = NO; - GCC_WARN_SHADOW = NO; - GCC_WARN_SIGN_COMPARE = YES; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = NO; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_PARAMETER = NO; - GCC_WARN_UNUSED_VALUE = NO; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "\"$(SRCROOT)/../../src\"", - "\"$(SRCROOT)/../../src/libraries\"", - "\"$(SRCROOT)/../../src/modules\"", - ); - INFOPLIST_FILE = "love-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks"; - LLVM_LTO = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; - ONLY_ACTIVE_ARCH = NO; - OTHER_LDFLAGS = ""; - "OTHER_LDFLAGS[arch=x86_64]" = ( - "-pagezero_size", - 10000, - "-image_base", - 100000000, - ); - PRODUCT_NAME = love; - SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES; - SDKROOT = macosx; - WARNING_CFLAGS = ( - "-Wall", - "-W", - ); - }; - name = Distribution; - }; - FA5326C718971A0900F7BBF4 /* Distribution */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = "OS X AppIcon"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/macosx/Frameworks", - /Library/Frameworks, - "\"$(SRCROOT)/build/Release\"", - "\"$(SRCROOT)/build/Debug\"", - "$(LOCAL_LIBRARY_DIR)/Frameworks", - ); - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/macosx/Frameworks/Lua.framework/Headers", - "$(PROJECT_DIR)/macosx/Frameworks/SDL2.framework/Headers", - /Library/Frameworks/Lua.framework/Headers, - /Library/Frameworks/SDL2.framework/Headers, - ); - INFOPLIST_FILE = "macosx/love-macosx.plist"; - INSTALL_PATH = /Applications; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = org.love2d.love; - PRODUCT_NAME = love; - }; - name = Distribution; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "love-macosx" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C01FCF4B08A954540054247B /* Debug */, - C01FCF4C08A954540054247B /* Release */, - FA5326C718971A0900F7BBF4 /* Distribution */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C01FCF4E08A954540054247B /* Build configuration list for PBXProject "love" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C01FCF4F08A954540054247B /* Debug */, - C01FCF5008A954540054247B /* Release */, - FA5326C618971A0900F7BBF4 /* Distribution */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - FA0B7F2E1A95AAF4000E1D17 /* Build configuration list for PBXNativeTarget "love-ios" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - FA0B7F261A95AAF4000E1D17 /* Debug */, - FA0B7F271A95AAF4000E1D17 /* Release */, - FA0B7F281A95AAF4000E1D17 /* Distribution */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; -} diff --git a/love/src/jni/love/platform/xcode/love.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/love/src/jni/love/platform/xcode/love.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 0c5703c4..00000000 --- a/love/src/jni/love/platform/xcode/love.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/love/src/jni/love/platform/xcode/love.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/love/src/jni/love/platform/xcode/love.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings deleted file mode 100644 index 0c67376e..00000000 --- a/love/src/jni/love/platform/xcode/love.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/love/src/jni/love/platform/xcode/macosx/liblove-macosx.plist b/love/src/jni/love/platform/xcode/macosx/liblove-macosx.plist deleted file mode 100644 index 45d74da4..00000000 --- a/love/src/jni/love/platform/xcode/macosx/liblove-macosx.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIconFile - - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - LÖVE - CFBundlePackageType - FMWK - CFBundleShortVersionString - 11.2 - CFBundleSignature - LoVe - NSPrincipalClass - - - diff --git a/love/src/jni/love/platform/xcode/macosx/love-macosx.plist b/love/src/jni/love/platform/xcode/macosx/love-macosx.plist deleted file mode 100644 index 8a6a7720..00000000 --- a/love/src/jni/love/platform/xcode/macosx/love-macosx.plist +++ /dev/null @@ -1,108 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleDocumentTypes - - - CFBundleTypeExtensions - - love - - CFBundleTypeIconFile - GameIcon - CFBundleTypeName - LÖVE Project - CFBundleTypeRole - Viewer - LSHandlerRank - Owner - LSItemContentTypes - - org.love2d.love-game - - LSTypeIsPackage - 1 - - - CFBundleTypeName - Folder - CFBundleTypeOSTypes - - fold - - CFBundleTypeRole - Viewer - LSHandlerRank - None - - - CFBundleTypeIconFile - Document - CFBundleTypeName - Document - CFBundleTypeOSTypes - - **** - - CFBundleTypeRole - Editor - - - CFBundleExecutable - love - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - LÖVE - CFBundlePackageType - APPL - CFBundleShortVersionString - 11.2 - CFBundleSignature - LoVe - LSApplicationCategoryType - public.app-category.games - NSHighResolutionCapable - - NSHumanReadableCopyright - © 2006-2018 LÖVE Development Team - NSPrincipalClass - NSApplication - NSSupportsAutomaticGraphicsSwitching - - UTExportedTypeDeclarations - - - UTTypeConformsTo - - com.pkware.zip-archive - com.apple.package - - UTTypeDescription - LÖVE Project - UTTypeIconFile - GameIcon - UTTypeIdentifier - org.love2d.love-game - UTTypeReferenceURL - http://love2d.org/wiki/Game_Distribution - UTTypeTagSpecification - - com.apple.ostype - LOVE - public.filename-extension - - love - - public.mime-type - application/x-love-game - - - - - diff --git a/love/src/jni/love/readme-iOS.rtf b/love/src/jni/love/readme-iOS.rtf deleted file mode 100644 index 935f60b0..00000000 --- a/love/src/jni/love/readme-iOS.rtf +++ /dev/null @@ -1,67 +0,0 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1404\cocoasubrtf340 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fnil\fcharset0 Monaco;\f2\fnil\fcharset0 LucidaGrande; -} -{\colortbl;\red255\green255\blue255;} -{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid1\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid1} -{\list\listtemplateid2\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid101\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid2} -{\list\listtemplateid3\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid201\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid3} -{\list\listtemplateid4\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid301\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid4} -{\list\listtemplateid5\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid401\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid5} -{\list\listtemplateid6\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid501\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid6}} -{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}{\listoverride\listid3\listoverridecount0\ls3}{\listoverride\listid4\listoverridecount0\ls4}{\listoverride\listid5\listoverridecount0\ls5}{\listoverride\listid6\listoverridecount0\ls6}} -\margl1440\margr1440\vieww14040\viewh10200\viewkind0 -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 - -\f0\b\fs36 \cf0 Building L\'d6VE for iOS -\b0\fs24 \ -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\cf0 \ -In order to run L\'d6VE for iOS, it must first be compiled and installed. To do that, you\'92ll need Mac OS X and {\field{\*\fldinst{HYPERLINK "https://developer.apple.com/xcode/"}}{\fldrslt Xcode 7 or newer}}.\ -\ -\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural\partightenfactor0 -\ls1\ilvl0\cf0 {\listtext \'95 }If the -\f1\fs22 include -\f0\fs24 and -\f1\fs22 libraries -\f0\fs24 folders are not present in the -\f1\fs22 love/platform/xcode/ios -\f0\fs24 folder, {\field{\*\fldinst{HYPERLINK "https://bitbucket.org/rude/love/downloads/love-0.10.0-ios-libraries.zip"}}{\fldrslt download them}} and place them there. They contain the third-party library dependencies used by L\'d6VE.\ -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\cf0 \ -\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural\partightenfactor0 -\ls2\ilvl0\cf0 {\listtext \'95 }Open the Xcode project found at -\f1\fs22 love/platform/xcode/love.xcodeproj -\f0\fs24 , and select the \'93love-ios\'94 target in the dropdown menu at the top of the window.\ -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\cf0 \ -\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural\partightenfactor0 -\ls3\ilvl0\cf0 {\listtext \'95 }You may want to change the Build Configuration from Debug to Release mode for better runtime performance, by opening the \'93Edit Scheme\'85\'94 menu from the same dropdown selection.\ -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\cf0 \ -\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural\partightenfactor0 -\ls4\ilvl0\cf0 {\listtext \'95 }Choose either an iOS Simulator device or your plugged-in iOS device from the dropdown selection to the right of the previous one, and click the Build-and-Run -\f2 \uc0\u9654 \u65038 -\f0 button to the left, which will install and run L\'d6VE on the target device after compiling it.\ -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\cf0 \ - -\b\fs36 Running Games on iOS -\b0\fs24 \ -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\cf0 \ -L\'d6VE on iOS includes a simple list interface of games that are installed (until you {\field{\*\fldinst{HYPERLINK "https://love2d.org/wiki/Game_Distribution"}}{\fldrslt fuse}} a .love to it for distribution.)\ -\ -\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural\partightenfactor0 -\ls5\ilvl0\cf0 {\listtext \'95 }To put a .love file on the iOS Simulator after L\'d6VE is installed, drag the file onto the iOS Simulator\'92s window while it\'92s open. L\'d6VE will launch if it\'92s not running already. If another game is currently active you may need to quit L\'d6VE for the new game to show up (press Shift-Command-H twice to open the App Switcher menu on the iOS Simulator.)\ -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\cf0 \ -\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural\partightenfactor0 -\ls6\ilvl0\cf0 {\listtext \'95 }To put a .love file or game folder on your iOS device after L\'d6VE is installed, you can either download it with the Safari, or transfer it from your computer through iTunes when your device is connected: open iTunes, go to the iOS device which has L\'d6VE installed, go to the \'91Apps\'92 section and scroll down and find L\'d6VE, and add the .love file or game folder to L\'d6VE\'92s Documents section.\ -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\cf0 \ - -\b\fs36 Distributing a Game on iOS -\b0\fs24 \ -\ -Refer to the {\field{\*\fldinst{HYPERLINK "https://love2d.org/wiki/Game_Distribution#iOS"}}{\fldrslt Game Distribution}} L\'d6VE wiki page.\ -} \ No newline at end of file diff --git a/love/src/jni/love/readme.md b/love/src/jni/love/readme.md deleted file mode 100644 index 80f2259c..00000000 --- a/love/src/jni/love/readme.md +++ /dev/null @@ -1,98 +0,0 @@ -LÖVE is an *awesome* framework you can use to make 2D games in Lua. It's free, open-source, and works on Windows, Mac OS X, Linux, Android, and iOS. - -[![Build Status: Windows](https://ci.appveyor.com/api/projects/status/u1a69u5o5ej1pus4?svg=true)](https://ci.appveyor.com/project/AlexSzpakowski/love) - -Documentation -------------- - -We use our [wiki][wiki] for documentation. -If you need further help, feel free to ask on our [forums][forums], and last but not least there's the irc channel [#love on OFTC][irc]. - -Compilation ------------ - -###Windows -Follow the instructions at the [megasource][megasource] repository page. - -###*nix -Run `platform/unix/automagic` from the repository root, then run ./configure and make. - - $ platform/unix/automagic - $ ./configure - $ make - -When using a source release, automagic has already been run, and the first step can be skipped. - -###Mac OS X -Download the required frameworks from [here][dependencies] and place them in `/Library/Frameworks/`. - -Then use the Xcode project found at `platform/xcode/love.xcodeproj` to build the `love-macosx` target. - -###iOS -Download the required libraries from [here][dependencies-ios] and place the `include` and `libraries` folders -into the `platform/xcode/ios` folder. - -Then use the Xcode project found at `platform/xcode/love.xcodeproj` to build the `love-ios` target. - -See `readme-iOS.rtf` for more information. - -###Android -Visit the [Android build repository][android-repository] for build instructions. - -Repository information ----------------------- - -We use the 'default' branch for development, and therefore it should not be considered stable. -Also used is the 'minor' branch, which is used for features in the next minor version and it is -not our development target (which would be the next revision - version numbers are formatted major.minor.revision.) - -We tag all our releases (since we started using mercurial), and have binary downloads available for them. - -Experimental changes are developed in the separate [love-experiments][love-experiments] repository. - -Contributing ------------- - -The best places to contribute are through the Bitbucket issue tracker and the official IRC channel. -For code contributions, pull requests and patches are welcome. Be sure to read the [source code style guide][codestyle]. - -Builds ------- - -Releases are found in the 'downloads' section on bitbucket, are linked on [the site][site], -and there's a ppa for ubuntu, [ppa:bartbes/love-stable][stableppa]. - -There are also unstable/nightly builds: - -- Most can be found [here][builds]. -- For ubuntu linux they are in [ppa:bartbes/love-unstable][unstableppa] -- For arch linux there's [love-hg][aur] in the AUR. - -Dependencies ------------- - -- SDL2 -- OpenGL 2.1+ / OpenGL ES 2+ -- OpenAL -- Lua / LuaJIT / LLVM-lua -- FreeType -- PhysicsFS -- ModPlug -- mpg123 -- Vorbisfile -- Theora - -[site]: http://love2d.org -[wiki]: http://love2d.org/wiki -[forums]: http://love2d.org/forums -[irc]: irc://irc.oftc.net/love -[dependencies]: http://love2d.org/sdk -[dependencies-ios]: https://bitbucket.org/rude/love/downloads/love-0.10.0-ios-libraries.zip -[megasource]: https://bitbucket.org/rude/megasource -[builds]: http://love2d.org/builds -[stableppa]: https://launchpad.net/~bartbes/+archive/love-stable -[unstableppa]: https://launchpad.net/~bartbes/+archive/love-unstable -[aur]: http://aur.archlinux.org/packages/love-hg -[love-experiments]: https://bitbucket.org/bartbes/love-experiments -[codestyle]: https://love2d.org/wiki/Code_Style -[android-repository]: https://bitbucket.org/MartinFelis/love-android-sdl2 diff --git a/love/src/jni/love/src/common/Color.h b/love/src/jni/love/src/common/Color.h deleted file mode 100644 index 995a37f1..00000000 --- a/love/src/jni/love/src/common/Color.h +++ /dev/null @@ -1,156 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_COLOR_H -#define LOVE_COLOR_H - -namespace love -{ - -template -struct ColorT -{ - T r; - T g; - T b; - T a; - - ColorT() : r(0), g(0), b(0), a(0) {} - ColorT(T r_, T g_, T b_, T a_) : r(r_), g(g_), b(b_), a(a_) {} - void set(T r_, T g_, T b_, T a_) - { - r = r_; - g = g_; - b = b_; - a = a_; - } - - bool operator==(const ColorT &other) const; - bool operator!=(const ColorT &other) const; - - ColorT operator+=(const ColorT &other); - ColorT operator*=(const ColorT &other); - ColorT operator*=(T s); - ColorT operator/=(T s); -}; - -template -bool ColorT::operator==(const ColorT &other) const -{ - return r == other.r && g == other.g && b == other.b && a == other.a; -} - -template -bool ColorT::operator!=(const ColorT &other) const -{ - return !(operator==(other)); -} - -template -ColorT ColorT::operator+=(const ColorT &other) -{ - r += other.r; - g += other.g; - b += other.b; - a += other.a; - return *this; -} - -template -ColorT ColorT::operator*=(const ColorT &other) -{ - r *= other.r; - g *= other.g; - b *= other.b; - a *= other.a; - return *this; -} - -template -ColorT ColorT::operator*=(T s) -{ - r *= s; - g *= s; - b *= s; - a *= s; - return *this; -} - -template -ColorT ColorT::operator/=(T s) -{ - r /= s; - g /= s; - b /= s; - a /= s; - return *this; -} - -template -ColorT operator+(const ColorT &a, const ColorT &b) -{ - ColorT tmp(a); - return tmp += b; -} - -template -ColorT operator*(const ColorT &a, const ColorT &b) -{ - ColorT res; - res.r = a.r * b.r; - res.g = a.g * b.g; - res.b = a.b * b.b; - res.a = a.a * b.a; - return res; -} - -template -ColorT operator*(const ColorT &a, T s) -{ - ColorT tmp(a); - return tmp *= s; -} - -template -ColorT operator/(const ColorT &a, T s) -{ - ColorT tmp(a); - return tmp /= s; -} - -typedef ColorT Color; -typedef ColorT Colorf; - -inline Color toColor(Colorf cf) -{ - return Color((unsigned char) (cf.r * 255.0f), - (unsigned char) (cf.g * 255.0f), - (unsigned char) (cf.b * 255.0f), - (unsigned char) (cf.a * 255.0f)); -} - -inline Colorf toColorf(Color c) -{ - return Colorf(c.r / 255.0f, c.g / 255.0f, c.b / 255.0f, c.a / 255.0f); -} - -} // love - -#endif // LOVE_COLOR_H diff --git a/love/src/jni/love/src/common/Data.cpp b/love/src/jni/love/src/common/Data.cpp deleted file mode 100644 index 4ef6bbf0..00000000 --- a/love/src/jni/love/src/common/Data.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -// LOVE -#include "Data.h" - -namespace love -{ - -love::Type Data::type("Data", &Object::type); - -} // love diff --git a/love/src/jni/love/src/common/Data.h b/love/src/jni/love/src/common/Data.h deleted file mode 100644 index 34236258..00000000 --- a/love/src/jni/love/src/common/Data.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_DATA_H -#define LOVE_DATA_H - -// LOVE -#include "config.h" -#include "Object.h" - -// C -#include - -namespace love -{ - -/** - * This class is a simple abstraction over all objects which contain data. - **/ -class Data : public Object -{ -public: - - static love::Type type; - - /** - * Destructor. - **/ - virtual ~Data() {} - - /** - * Creates a duplicate of Data derived class instance. - **/ - virtual Data *clone() const = 0; - /** - * Gets a pointer to the data. This pointer will obviously not - * be valid if the Data object is destroyed. - **/ - virtual void *getData() const = 0; - - /** - * Gets the size of the Data in bytes. - **/ - virtual size_t getSize() const = 0; - -}; // Data - -} // love - -#endif // LOVE_DATA_H diff --git a/love/src/jni/love/src/common/EnumMap.h b/love/src/jni/love/src/common/EnumMap.h deleted file mode 100644 index a8b050c6..00000000 --- a/love/src/jni/love/src/common/EnumMap.h +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_ENUM_MAP_H -#define LOVE_ENUM_MAP_H - -#include "Exception.h" - -namespace love -{ - -template -class EnumMap -{ -public: - - struct Entry - { - T t; - U u; - }; - - EnumMap(const Entry *entries, unsigned int size) - { - unsigned int n = size / sizeof(Entry); - - for (unsigned int i = 0; i < n; ++i) - { - unsigned int e_t = (unsigned int) entries[i].t; - unsigned int e_u = (unsigned int) entries[i].u; - - if (e_t < PEAK) - { - values_u[e_t].v = e_u; - values_u[e_t].set = true; - } - if (e_u < PEAK) - { - values_t[e_u].v = e_t; - values_t[e_u].set = true; - } - } - } - - bool find(T t, U &u) - { - if ((unsigned int) t < PEAK && values_u[(unsigned int) t].set) - { - u = (U) values_u[(unsigned int) t].v; - return true; - } - - return false; - } - - bool find(U u, T &t) - { - if ((unsigned int) u < PEAK && values_t[(unsigned int) u].set) - { - t = (T) values_t[(unsigned int) u].v; - return true; - } - - return false; - } - -private: - - struct Value - { - unsigned v; - bool set; - Value() : set(false) {} - }; - - Value values_t[PEAK]; - Value values_u[PEAK]; - -}; // EnumMap - -} // love - -#endif // LOVE_ENUM_MAP_H diff --git a/love/src/jni/love/src/common/Exception.cpp b/love/src/jni/love/src/common/Exception.cpp deleted file mode 100644 index 7f79f5d4..00000000 --- a/love/src/jni/love/src/common/Exception.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "common/config.h" -#include "Exception.h" - -#include - -namespace love -{ - -Exception::Exception(const char *fmt, ...) -{ - va_list args; - int size_buffer = 256, size_out; - char *buffer; - while (true) - { - buffer = new char[size_buffer]; - memset(buffer, 0, size_buffer); - - va_start(args, fmt); - size_out = vsnprintf(buffer, size_buffer, fmt, args); - va_end(args); - - // see http://perfec.to/vsnprintf/pasprintf.c - // if size_out ... - // == -1 --> output was truncated - // == size_buffer --> output was truncated - // == size_buffer-1 --> ambiguous, /may/ have been truncated - // > size_buffer --> output was truncated, and size_out - // bytes would have been written - if (size_out == size_buffer || size_out == -1 || size_out == size_buffer-1) - size_buffer *= 2; - else if (size_out > size_buffer) - size_buffer = size_out + 2; // to avoid the ambiguous case - else - break; - - delete[] buffer; - } - message = std::string(buffer); - delete[] buffer; -} - -Exception::~Exception() throw() -{ -} - -} diff --git a/love/src/jni/love/src/common/Exception.h b/love/src/jni/love/src/common/Exception.h deleted file mode 100644 index c9e24945..00000000 --- a/love/src/jni/love/src/common/Exception.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_EXCEPTION_H -#define LOVE_EXCEPTION_H - -#include -#include // vararg -#include // vsnprintf -#include // strncpy -#include - -namespace love -{ - -/** - * A convenient vararg-enabled exception class. - **/ -class Exception : public std::exception -{ -public: - - /** - * Creates a new Exception according to printf-rules. - * - * See: http://www.cplusplus.com/reference/clibrary/cstdio/printf/ - * - * @param fmt The format string (see printf). - **/ - Exception(const char *fmt, ...); - virtual ~Exception() throw(); - - /** - * Returns a string containing reason for the exception. - * @return A description of the exception. - **/ - inline virtual const char *what() const throw() - { - return message.c_str(); - } - -private: - - std::string message; - -}; // Exception - -} // love - -#endif // LOVE_EXCEPTION_H diff --git a/love/src/jni/love/src/common/Matrix.cpp b/love/src/jni/love/src/common/Matrix.cpp deleted file mode 100644 index 8e3940e3..00000000 --- a/love/src/jni/love/src/common/Matrix.cpp +++ /dev/null @@ -1,554 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "Matrix.h" -#include "common/config.h" - -// STD -#include // memcpy -#include - -#if defined(LOVE_SIMD_SSE) -#include -#endif - -#if defined(LOVE_SIMD_NEON) -#include -#endif - -namespace love -{ - -// | e0 e4 e8 e12 | -// | e1 e5 e9 e13 | -// | e2 e6 e10 e14 | -// | e3 e7 e11 e15 | -// | e0 e4 e8 e12 | -// | e1 e5 e9 e13 | -// | e2 e6 e10 e14 | -// | e3 e7 e11 e15 | - -void Matrix4::multiply(const Matrix4 &a, const Matrix4 &b, float t[16]) -{ -#if defined(LOVE_SIMD_SSE) - - // We can't guarantee 16-bit alignment (e.g. for heap-allocated Matrix4 - // objects) so we use unaligned loads and stores. - __m128 col1 = _mm_loadu_ps(&a.e[0]); - __m128 col2 = _mm_loadu_ps(&a.e[4]); - __m128 col3 = _mm_loadu_ps(&a.e[8]); - __m128 col4 = _mm_loadu_ps(&a.e[12]); - - for (int i = 0; i < 4; i++) - { - __m128 brod1 = _mm_set1_ps(b.e[4*i + 0]); - __m128 brod2 = _mm_set1_ps(b.e[4*i + 1]); - __m128 brod3 = _mm_set1_ps(b.e[4*i + 2]); - __m128 brod4 = _mm_set1_ps(b.e[4*i + 3]); - - __m128 col = _mm_add_ps( - _mm_add_ps(_mm_mul_ps(brod1, col1), _mm_mul_ps(brod2, col2)), - _mm_add_ps(_mm_mul_ps(brod3, col3), _mm_mul_ps(brod4, col4)) - ); - - _mm_storeu_ps(&t[4*i], col); - } - -#elif defined(LOVE_SIMD_NEON) - - float32x4_t cola1 = vld1q_f32(&a.e[0]); - float32x4_t cola2 = vld1q_f32(&a.e[4]); - float32x4_t cola3 = vld1q_f32(&a.e[8]); - float32x4_t cola4 = vld1q_f32(&a.e[12]); - - float32x4_t col1 = vmulq_n_f32(cola1, b.e[0]); - col1 = vmlaq_n_f32(col1, cola2, b.e[1]); - col1 = vmlaq_n_f32(col1, cola3, b.e[2]); - col1 = vmlaq_n_f32(col1, cola4, b.e[3]); - - float32x4_t col2 = vmulq_n_f32(cola1, b.e[4]); - col2 = vmlaq_n_f32(col2, cola2, b.e[5]); - col2 = vmlaq_n_f32(col2, cola3, b.e[6]); - col2 = vmlaq_n_f32(col2, cola4, b.e[7]); - - float32x4_t col3 = vmulq_n_f32(cola1, b.e[8]); - col3 = vmlaq_n_f32(col3, cola2, b.e[9]); - col3 = vmlaq_n_f32(col3, cola3, b.e[10]); - col3 = vmlaq_n_f32(col3, cola4, b.e[11]); - - float32x4_t col4 = vmulq_n_f32(cola1, b.e[12]); - col4 = vmlaq_n_f32(col4, cola2, b.e[13]); - col4 = vmlaq_n_f32(col4, cola3, b.e[14]); - col4 = vmlaq_n_f32(col4, cola4, b.e[15]); - - vst1q_f32(&t[0], col1); - vst1q_f32(&t[4], col2); - vst1q_f32(&t[8], col3); - vst1q_f32(&t[12], col4); - -#else - - t[0] = (a.e[0]*b.e[0]) + (a.e[4]*b.e[1]) + (a.e[8]*b.e[2]) + (a.e[12]*b.e[3]); - t[4] = (a.e[0]*b.e[4]) + (a.e[4]*b.e[5]) + (a.e[8]*b.e[6]) + (a.e[12]*b.e[7]); - t[8] = (a.e[0]*b.e[8]) + (a.e[4]*b.e[9]) + (a.e[8]*b.e[10]) + (a.e[12]*b.e[11]); - t[12] = (a.e[0]*b.e[12]) + (a.e[4]*b.e[13]) + (a.e[8]*b.e[14]) + (a.e[12]*b.e[15]); - - t[1] = (a.e[1]*b.e[0]) + (a.e[5]*b.e[1]) + (a.e[9]*b.e[2]) + (a.e[13]*b.e[3]); - t[5] = (a.e[1]*b.e[4]) + (a.e[5]*b.e[5]) + (a.e[9]*b.e[6]) + (a.e[13]*b.e[7]); - t[9] = (a.e[1]*b.e[8]) + (a.e[5]*b.e[9]) + (a.e[9]*b.e[10]) + (a.e[13]*b.e[11]); - t[13] = (a.e[1]*b.e[12]) + (a.e[5]*b.e[13]) + (a.e[9]*b.e[14]) + (a.e[13]*b.e[15]); - - t[2] = (a.e[2]*b.e[0]) + (a.e[6]*b.e[1]) + (a.e[10]*b.e[2]) + (a.e[14]*b.e[3]); - t[6] = (a.e[2]*b.e[4]) + (a.e[6]*b.e[5]) + (a.e[10]*b.e[6]) + (a.e[14]*b.e[7]); - t[10] = (a.e[2]*b.e[8]) + (a.e[6]*b.e[9]) + (a.e[10]*b.e[10]) + (a.e[14]*b.e[11]); - t[14] = (a.e[2]*b.e[12]) + (a.e[6]*b.e[13]) + (a.e[10]*b.e[14]) + (a.e[14]*b.e[15]); - - t[3] = (a.e[3]*b.e[0]) + (a.e[7]*b.e[1]) + (a.e[11]*b.e[2]) + (a.e[15]*b.e[3]); - t[7] = (a.e[3]*b.e[4]) + (a.e[7]*b.e[5]) + (a.e[11]*b.e[6]) + (a.e[15]*b.e[7]); - t[11] = (a.e[3]*b.e[8]) + (a.e[7]*b.e[9]) + (a.e[11]*b.e[10]) + (a.e[15]*b.e[11]); - t[15] = (a.e[3]*b.e[12]) + (a.e[7]*b.e[13]) + (a.e[11]*b.e[14]) + (a.e[15]*b.e[15]); - -#endif -} - -void Matrix4::multiply(const Matrix4 &a, const Matrix4 &b, Matrix4 &t) -{ - multiply(a, b, t.e); -} - -// | e0 e4 e8 e12 | -// | e1 e5 e9 e13 | -// | e2 e6 e10 e14 | -// | e3 e7 e11 e15 | - -Matrix4::Matrix4() -{ - setIdentity(); -} - - -Matrix4::Matrix4(const float elements[16]) -{ - memcpy(e, elements, sizeof(float) * 16); -} - -Matrix4::Matrix4(float t00, float t10, float t01, float t11, float x, float y) -{ - setRawTransformation(t00, t10, t01, t11, x, y); -} - -Matrix4::Matrix4(const Matrix4 &a, const Matrix4 &b) -{ - multiply(a, b, e); -} - -Matrix4::Matrix4(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky) -{ - setTransformation(x, y, angle, sx, sy, ox, oy, kx, ky); -} - -Matrix4 Matrix4::operator * (const Matrix4 &m) const -{ - return Matrix4(*this, m); -} - -void Matrix4::operator *= (const Matrix4 &m) -{ - float t[16]; - multiply(*this, m, t); - memcpy(this->e, t, sizeof(float)*16); -} - -const float *Matrix4::getElements() const -{ - return e; -} - -void Matrix4::setIdentity() -{ - memset(e, 0, sizeof(float)*16); - e[15] = e[10] = e[5] = e[0] = 1; -} - -void Matrix4::setTranslation(float x, float y) -{ - setIdentity(); - e[12] = x; - e[13] = y; -} - -void Matrix4::setRotation(float rad) -{ - setIdentity(); - float c = cosf(rad), s = sinf(rad); - e[0] = c; - e[4] = -s; - e[1] = s; - e[5] = c; -} - -void Matrix4::setScale(float sx, float sy) -{ - setIdentity(); - e[0] = sx; - e[5] = sy; -} - -void Matrix4::setShear(float kx, float ky) -{ - setIdentity(); - e[1] = ky; - e[4] = kx; -} - -void Matrix4::getApproximateScale(float &sx, float &sy) const -{ - sx = sqrtf(e[0] * e[0] + e[4] * e[4]); - sy = sqrtf(e[1] * e[1] + e[5] * e[5]); -} - -void Matrix4::setRawTransformation(float t00, float t10, float t01, float t11, float x, float y) -{ - memset(e, 0, sizeof(float)*16); // zero out matrix - e[10] = e[15] = 1.0f; - e[0] = t00; - e[1] = t10; - e[4] = t01; - e[5] = t11; - e[12] = x; - e[13] = y; -} - -void Matrix4::setTransformation(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky) -{ - memset(e, 0, sizeof(float)*16); // zero out matrix - float c = cosf(angle), s = sinf(angle); - // matrix multiplication carried out on paper: - // |1 x| |c -s | |sx | | 1 ky | |1 -ox| - // | 1 y| |s c | | sy | |kx 1 | | 1 -oy| - // | 1 | | 1 | | 1 | | 1 | | 1 | - // | 1| | 1| | 1| | 1| | 1 | - // move rotate scale skew origin - e[10] = e[15] = 1.0f; - e[0] = c * sx - ky * s * sy; // = a - e[1] = s * sx + ky * c * sy; // = b - e[4] = kx * c * sx - s * sy; // = c - e[5] = kx * s * sx + c * sy; // = d - e[12] = x - ox * e[0] - oy * e[4]; - e[13] = y - ox * e[1] - oy * e[5]; -} - -void Matrix4::translate(float x, float y) -{ - Matrix4 t; - t.setTranslation(x, y); - this->operator *=(t); -} - -void Matrix4::rotate(float rad) -{ - Matrix4 t; - t.setRotation(rad); - this->operator *=(t); -} - -void Matrix4::scale(float sx, float sy) -{ - Matrix4 t; - t.setScale(sx, sy); - this->operator *=(t); -} - -void Matrix4::shear(float kx, float ky) -{ - Matrix4 t; - t.setShear(kx,ky); - this->operator *=(t); -} - -bool Matrix4::isAffine2DTransform() const -{ - return fabsf(e[2] + e[3] + e[6] + e[7] + e[8] + e[9] + e[11] + e[14]) < 0.00001f - && fabsf(e[10] + e[15] - 2.0f) < 0.00001f; -} - -Matrix4 Matrix4::inverse() const -{ - Matrix4 inv; - - inv.e[0] = e[5] * e[10] * e[15] - - e[5] * e[11] * e[14] - - e[9] * e[6] * e[15] + - e[9] * e[7] * e[14] + - e[13] * e[6] * e[11] - - e[13] * e[7] * e[10]; - - inv.e[4] = -e[4] * e[10] * e[15] + - e[4] * e[11] * e[14] + - e[8] * e[6] * e[15] - - e[8] * e[7] * e[14] - - e[12] * e[6] * e[11] + - e[12] * e[7] * e[10]; - - inv.e[8] = e[4] * e[9] * e[15] - - e[4] * e[11] * e[13] - - e[8] * e[5] * e[15] + - e[8] * e[7] * e[13] + - e[12] * e[5] * e[11] - - e[12] * e[7] * e[9]; - - inv.e[12] = -e[4] * e[9] * e[14] + - e[4] * e[10] * e[13] + - e[8] * e[5] * e[14] - - e[8] * e[6] * e[13] - - e[12] * e[5] * e[10] + - e[12] * e[6] * e[9]; - - inv.e[1] = -e[1] * e[10] * e[15] + - e[1] * e[11] * e[14] + - e[9] * e[2] * e[15] - - e[9] * e[3] * e[14] - - e[13] * e[2] * e[11] + - e[13] * e[3] * e[10]; - - inv.e[5] = e[0] * e[10] * e[15] - - e[0] * e[11] * e[14] - - e[8] * e[2] * e[15] + - e[8] * e[3] * e[14] + - e[12] * e[2] * e[11] - - e[12] * e[3] * e[10]; - - inv.e[9] = -e[0] * e[9] * e[15] + - e[0] * e[11] * e[13] + - e[8] * e[1] * e[15] - - e[8] * e[3] * e[13] - - e[12] * e[1] * e[11] + - e[12] * e[3] * e[9]; - - inv.e[13] = e[0] * e[9] * e[14] - - e[0] * e[10] * e[13] - - e[8] * e[1] * e[14] + - e[8] * e[2] * e[13] + - e[12] * e[1] * e[10] - - e[12] * e[2] * e[9]; - - inv.e[2] = e[1] * e[6] * e[15] - - e[1] * e[7] * e[14] - - e[5] * e[2] * e[15] + - e[5] * e[3] * e[14] + - e[13] * e[2] * e[7] - - e[13] * e[3] * e[6]; - - inv.e[6] = -e[0] * e[6] * e[15] + - e[0] * e[7] * e[14] + - e[4] * e[2] * e[15] - - e[4] * e[3] * e[14] - - e[12] * e[2] * e[7] + - e[12] * e[3] * e[6]; - - inv.e[10] = e[0] * e[5] * e[15] - - e[0] * e[7] * e[13] - - e[4] * e[1] * e[15] + - e[4] * e[3] * e[13] + - e[12] * e[1] * e[7] - - e[12] * e[3] * e[5]; - - inv.e[14] = -e[0] * e[5] * e[14] + - e[0] * e[6] * e[13] + - e[4] * e[1] * e[14] - - e[4] * e[2] * e[13] - - e[12] * e[1] * e[6] + - e[12] * e[2] * e[5]; - - inv.e[3] = -e[1] * e[6] * e[11] + - e[1] * e[7] * e[10] + - e[5] * e[2] * e[11] - - e[5] * e[3] * e[10] - - e[9] * e[2] * e[7] + - e[9] * e[3] * e[6]; - - inv.e[7] = e[0] * e[6] * e[11] - - e[0] * e[7] * e[10] - - e[4] * e[2] * e[11] + - e[4] * e[3] * e[10] + - e[8] * e[2] * e[7] - - e[8] * e[3] * e[6]; - - inv.e[11] = -e[0] * e[5] * e[11] + - e[0] * e[7] * e[9] + - e[4] * e[1] * e[11] - - e[4] * e[3] * e[9] - - e[8] * e[1] * e[7] + - e[8] * e[3] * e[5]; - - inv.e[15] = e[0] * e[5] * e[10] - - e[0] * e[6] * e[9] - - e[4] * e[1] * e[10] + - e[4] * e[2] * e[9] + - e[8] * e[1] * e[6] - - e[8] * e[2] * e[5]; - - float det = e[0] * inv.e[0] + e[1] * inv.e[4] + e[2] * inv.e[8] + e[3] * inv.e[12]; - - float invdet = 1.0f / det; - - for (int i = 0; i < 16; i++) - inv.e[i] *= invdet; - - return inv; -} - -Matrix4 Matrix4::ortho(float left, float right, float bottom, float top, float near, float far) -{ - Matrix4 m; - - m.e[0] = 2.0f / (right - left); - m.e[5] = 2.0f / (top - bottom); - m.e[10] = -2.0f / (far - near); - - m.e[12] = -(right + left) / (right - left); - m.e[13] = -(top + bottom) / (top - bottom); - m.e[14] = -(far + near) / (far - near); - - return m; -} - -/** - * | e0 e3 e6 | - * | e1 e4 e7 | - * | e2 e5 e8 | - **/ -Matrix3::Matrix3() -{ - setIdentity(); -} - -Matrix3::Matrix3(const Matrix4 &mat4) -{ - const float *mat4elems = mat4.getElements(); - - // Column 0. - e[0] = mat4elems[0]; - e[1] = mat4elems[1]; - e[2] = mat4elems[2]; - - // Column 1. - e[3] = mat4elems[4]; - e[4] = mat4elems[5]; - e[5] = mat4elems[6]; - - // Column 2. - e[6] = mat4elems[8]; - e[7] = mat4elems[9]; - e[8] = mat4elems[10]; -} - -Matrix3::Matrix3(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky) -{ - setTransformation(x, y, angle, sx, sy, ox, oy, kx, ky); -} - -Matrix3::~Matrix3() -{ -} - -void Matrix3::setIdentity() -{ - memset(e, 0, sizeof(float) * 9); - e[8] = e[4] = e[0] = 1.0f; -} - -Matrix3 Matrix3::operator * (const love::Matrix3 &m) const -{ - Matrix3 t; - - t.e[0] = (e[0]*m.e[0]) + (e[3]*m.e[1]) + (e[6]*m.e[2]); - t.e[3] = (e[0]*m.e[3]) + (e[3]*m.e[4]) + (e[6]*m.e[5]); - t.e[6] = (e[0]*m.e[6]) + (e[3]*m.e[7]) + (e[6]*m.e[8]); - - t.e[1] = (e[1]*m.e[0]) + (e[4]*m.e[1]) + (e[7]*m.e[2]); - t.e[4] = (e[1]*m.e[3]) + (e[4]*m.e[4]) + (e[7]*m.e[5]); - t.e[7] = (e[1]*m.e[6]) + (e[4]*m.e[7]) + (e[7]*m.e[8]); - - t.e[2] = (e[2]*m.e[0]) + (e[5]*m.e[1]) + (e[8]*m.e[2]); - t.e[5] = (e[2]*m.e[3]) + (e[5]*m.e[4]) + (e[8]*m.e[5]); - t.e[8] = (e[2]*m.e[6]) + (e[5]*m.e[7]) + (e[8]*m.e[8]); - - return t; -} - -void Matrix3::operator *= (const Matrix3 &m) -{ - Matrix3 t = (*this) * m; - memcpy(e, t.e, sizeof(float) * 9); -} - -const float *Matrix3::getElements() const -{ - return e; -} - -Matrix3 Matrix3::transposedInverse() const -{ - // e0 e3 e6 - // e1 e4 e7 - // e2 e5 e8 - - float det = e[0] * (e[4]*e[8] - e[7]*e[5]) - - e[1] * (e[3]*e[8] - e[5]*e[6]) - + e[2] * (e[3]*e[7] - e[4]*e[6]); - - float invdet = 1.0f / det; - - Matrix3 m; - - m.e[0] = invdet * (e[4]*e[8] - e[7]*e[5]); - m.e[3] = -invdet * (e[1]*e[8] - e[2]*e[7]); - m.e[6] = invdet * (e[1]*e[5] - e[2]*e[4]); - m.e[1] = -invdet * (e[3]*e[8] - e[5]*e[6]); - m.e[4] = invdet * (e[0]*e[8] - e[2]*e[6]); - m.e[7] = -invdet * (e[0]*e[5] - e[3]*e[2]); - m.e[2] = invdet * (e[3]*e[7] - e[6]*e[4]); - m.e[5] = -invdet * (e[0]*e[7] - e[6]*e[1]); - m.e[8] = invdet * (e[0]*e[4] - e[3]*e[1]); - - return m; -} - -void Matrix3::setTransformation(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky) -{ - float c = cosf(angle), s = sinf(angle); - // matrix multiplication carried out on paper: - // |1 x| |c -s | |sx | | 1 ky | |1 -ox| - // | 1 y| |s c | | sy | |kx 1 | | 1 -oy| - // | 1| | 1| | 1| | 1| | 1 | - // move rotate scale skew origin - e[0] = c * sx - ky * s * sy; // = a - e[1] = s * sx + ky * c * sy; // = b - e[3] = kx * c * sx - s * sy; // = c - e[4] = kx * s * sx + c * sy; // = d - e[6] = x - ox * e[0] - oy * e[3]; - e[7] = y - ox * e[1] - oy * e[4]; - - e[2] = e[5] = 0.0f; - e[8] = 1.0f; -} - -} // love diff --git a/love/src/jni/love/src/common/Matrix.h b/love/src/jni/love/src/common/Matrix.h deleted file mode 100644 index ed11e5c1..00000000 --- a/love/src/jni/love/src/common/Matrix.h +++ /dev/null @@ -1,391 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_MATRIX_H -#define LOVE_MATRIX_H - -// LOVE -#include "math.h" - -namespace love -{ - -/** - * This class is the basis for all transformations in LOVE. Although not really - * needed for 2D, it contains 4x4 elements to be compatible with OpenGL without - * conversions. - **/ -class Matrix4 -{ -private: - - static void multiply(const Matrix4 &a, const Matrix4 &b, float t[16]); - -public: - - static void multiply(const Matrix4 &a, const Matrix4 &b, Matrix4 &result); - - /** - * Creates a new identity matrix. - **/ - Matrix4(); - - /** - * Creates a new matrix with the transform values set. - **/ - Matrix4(float t00, float t10, float t01, float t11, float x, float y); - - /** - * Creates a new matrix from the specified elements. Be sure to pass - * exactly 16 elements in! - **/ - Matrix4(const float elements[16]); - - /** - * Creates a new matrix from the result of multiplying the two specified - * matrices. - **/ - Matrix4(const Matrix4 &a, const Matrix4 &b); - - /** - * Creates a new matrix set to a transformation. - **/ - Matrix4(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky); - - /** - * Multiplies this Matrix with another Matrix, changing neither. - * @param m The Matrix to multiply with this Matrix. - * @return The combined matrix. - **/ - Matrix4 operator * (const Matrix4 &m) const; - - /** - * Multiplies a Matrix into this Matrix. - * @param m The Matrix to combine into this Matrix. - **/ - void operator *= (const Matrix4 &m); - - /** - * Gets a pointer to the 16 array elements. - * @return The array elements. - **/ - const float *getElements() const; - - /** - * Resets this Matrix to the identity matrix. - **/ - void setIdentity(); - - /** - * Resets this Matrix to a translation. - * @param x Translation along x-axis. - * @param y Translation along y-axis. - **/ - void setTranslation(float x, float y); - - /** - * Resets this Matrix to a rotation. - * @param r The angle in radians. - **/ - void setRotation(float r); - - /** - * Resets this Matrix to a scale transformation. - * @param sx Scale factor along the x-axis. - * @param sy Scale factor along the y-axis. - **/ - void setScale(float sx, float sy); - - /** - * Resets this Matrix to a shear transformation. - * @param kx Shear along x-axis. - * @param ky Shear along y-axis. - **/ - void setShear(float kx, float ky); - - /** - * Calculates the scale factors for a 2D affine transform. The output values - * are absolute (not signed). - **/ - void getApproximateScale(float &sx, float &sy) const; - - /** - * Sets a transformation's values directly. Useful if you want to modify them inplace, - * or if you want to create a transformation that's not buildable with setTransformation() - * i.e. the inverse of setTransformation() is not easily built with another call - * to setTransformation() with tweaked values. - * - * @param t00 The sx*cos(angle) component of the transformation. - * @param t10 The sx*sin(angle) component of the transformation. - * @param t01 The sy*(-sin(angle)) component of the transformation. - * @param t11 The sy*cos(angle) component of the transformation. - * @param x The x translation component of the transformation. - * @param y The y translation component of the transformation. - **/ - void setRawTransformation(float t00, float t10, float t01, float t11, float x, float y); - - /** - * Creates a transformation with a certain position, orientation, scale - * and offset. Perfect for Drawables -- what a coincidence! - * - * @param x The translation along the x-axis. - * @param y The translation along the y-axis. - * @param angle The rotation (rad) around the center with offset (ox,oy). - * @param sx Scale along x-axis. - * @param sy Scale along y-axis. - * @param ox The offset for rotation along the x-axis. - * @param oy The offset for rotation along the y-axis. - * @param kx Shear along x-axis - * @param ky Shear along y-axis - **/ - void setTransformation(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky); - - /** - * Multiplies this Matrix with a translation. - * @param x Translation along x-axis. - * @param y Translation along y-axis. - **/ - void translate(float x, float y); - - /** - * Multiplies this Matrix with a rotation. - * @param r Angle in radians. - **/ - void rotate(float r); - - /** - * Multiplies this Matrix with a scale transformation. - * @param sx Scale factor along the x-axis. - * @param sy Scale factor along the y-axis. - **/ - void scale(float sx, float sy); - - /** - * Multiplies this Matrix with a shear transformation. - * @param kx Shear along the x-axis. - * @param ky Shear along the y-axis. - **/ - void shear(float kx, float ky); - - /** - * Transforms an array of 2-component vertices by this Matrix. The source - * and destination arrays may be the same. - **/ - template - void transformXY(Vdst *dst, const Vsrc *src, int size) const; - - /** - * Transforms an array of 2-component vertices by this Matrix, and stores - * them in an array of 3-component vertices. - **/ - template - void transformXY0(Vdst *dst, const Vsrc *src, int size) const; - - /** - * Transforms an array of 3-component vertices by this Matrix. The source - * and destination arrays may be the same. - **/ - template - void transformXYZ(Vdst *dst, const Vsrc *src, int size) const; - - /** - * Gets whether this matrix is an affine 2D transform (if the only non- - * identity elements are the upper-left 2x2 and 2 translation values in the - * 4th column). - **/ - bool isAffine2DTransform() const; - - /** - * Computes and returns the inverse of the matrix. - **/ - Matrix4 inverse() const; - - /** - * Creates a new orthographic projection matrix. - **/ - static Matrix4 ortho(float left, float right, float bottom, float top, float near, float far); - -private: - - /** - * | e0 e4 e8 e12 | - * | e1 e5 e9 e13 | - * | e2 e6 e10 e14 | - * | e3 e7 e11 e15 | - **/ - float e[16]; - -}; // Matrix4 - -class Matrix3 -{ -public: - - Matrix3(); - - /** - * Constructs a 3x3 matrix from the upper left section of a 4x4 matrix. - **/ - Matrix3(const Matrix4 &mat4); - - /** - * Creates a new matrix set to a transformation. - **/ - Matrix3(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky); - - ~Matrix3(); - - /** - * Resets this matrix to the identity matrix. - **/ - void setIdentity(); - - Matrix3 operator * (const Matrix3 &m) const; - void operator *= (const Matrix3 &m); - - /** - * Gets a pointer to the 9 array elements. - **/ - const float *getElements() const; - - /** - * Calculates the inverse of the transpose of this matrix. - **/ - Matrix3 transposedInverse() const; - - /** - * Creates a transformation with a certain position, orientation, scale - * and offset. - * - * @param x The translation along the x-axis. - * @param y The translation along the y-axis. - * @param angle The rotation (rad) around the center with offset (ox,oy). - * @param sx Scale along x-axis. - * @param sy Scale along y-axis. - * @param ox The offset for rotation along the x-axis. - * @param oy The offset for rotation along the y-axis. - * @param kx Shear along x-axis - * @param ky Shear along y-axis - **/ - void setTransformation(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky); - - /** - * Transforms an array of vertices by this matrix. - **/ - template - void transformXY(Vdst *dst, const Vsrc *src, int size) const; - -private: - - /** - * | e0 e3 e6 - * | e1 e4 e7 - * | e2 e5 e8 - **/ - float e[9]; - -}; // Matrix3 - -// | x | -// | y | -// | 0 | -// | 1 | -// | e0 e4 e8 e12 | -// | e1 e5 e9 e13 | -// | e2 e6 e10 e14 | -// | e3 e7 e11 e15 | - -template -void Matrix4::transformXY(Vdst *dst, const Vsrc *src, int size) const -{ - for (int i = 0; i < size; i++) - { - // Store in temp variables in case src = dst - float x = (e[0]*src[i].x) + (e[4]*src[i].y) + (0) + (e[12]); - float y = (e[1]*src[i].x) + (e[5]*src[i].y) + (0) + (e[13]); - - dst[i].x = x; - dst[i].y = y; - } -} - -template -void Matrix4::transformXY0(Vdst *dst, const Vsrc *src, int size) const -{ - for (int i = 0; i < size; i++) - { - // Store in temp variables in case src = dst - float x = (e[0]*src[i].x) + (e[4]*src[i].y) + (0) + (e[12]); - float y = (e[1]*src[i].x) + (e[5]*src[i].y) + (0) + (e[13]); - float z = (e[2]*src[i].x) + (e[6]*src[i].y) + (0) + (e[14]); - - dst[i].x = x; - dst[i].y = y; - dst[i].z = z; - } -} - -// | x | -// | y | -// | z | -// | 1 | -// | e0 e4 e8 e12 | -// | e1 e5 e9 e13 | -// | e2 e6 e10 e14 | -// | e3 e7 e11 e15 | - -template -void Matrix4::transformXYZ(Vdst *dst, const Vsrc *src, int size) const -{ - for (int i = 0; i < size; i++) - { - // Store in temp variables in case src = dst - float x = (e[0]*src[i].x) + (e[4]*src[i].y) + (e[ 8]*src[i].z) + (e[12]); - float y = (e[1]*src[i].x) + (e[5]*src[i].y) + (e[ 9]*src[i].z) + (e[13]); - float z = (e[2]*src[i].x) + (e[6]*src[i].y) + (e[10]*src[i].z) + (e[14]); - - dst[i].x = x; - dst[i].y = y; - dst[i].z = z; - } -} - -// | x | -// | y | -// | 1 | -// | e0 e3 e6 | -// | e1 e4 e7 | -// | e2 e5 e8 | -template -void Matrix3::transformXY(Vdst *dst, const Vsrc *src, int size) const -{ - for (int i = 0; i < size; i++) - { - float x = (e[0]*src[i].x) + (e[3]*src[i].y) + (e[6]); - float y = (e[1]*src[i].x) + (e[4]*src[i].y) + (e[7]); - - dst[i].x = x; - dst[i].y = y; - } -} - -} //love - -#endif// LOVE_MATRIX_H diff --git a/love/src/jni/love/src/common/Memoizer.cpp b/love/src/jni/love/src/common/Memoizer.cpp deleted file mode 100644 index cab71006..00000000 --- a/love/src/jni/love/src/common/Memoizer.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "Memoizer.h" - -#include - -namespace love -{ - -static std::unordered_map objectMap; - -void Memoizer::add(void *key, void *val) -{ - objectMap[key] = val; -} - -void Memoizer::remove(void *key) -{ - objectMap.erase(key); -} - -void *Memoizer::find(void *key) -{ - auto it = objectMap.find(key); - - if (it != objectMap.end()) - return it->second; - else - return nullptr; -} - -} // love diff --git a/love/src/jni/love/src/common/Memoizer.h b/love/src/jni/love/src/common/Memoizer.h deleted file mode 100644 index 7e0047f7..00000000 --- a/love/src/jni/love/src/common/Memoizer.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_MEMOIZER_H -#define LOVE_MEMOIZER_H - -namespace love -{ - -class Memoizer -{ -public: - - static void add(void *key, void *val); - static void remove(void *key); - static void *find(void *key); - -}; // Memoizer - -} // love - -#endif // LOVE_MEMOIZER_H diff --git a/love/src/jni/love/src/common/Module.cpp b/love/src/jni/love/src/common/Module.cpp deleted file mode 100644 index 0b054b77..00000000 --- a/love/src/jni/love/src/common/Module.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -// LOVE -#include "Module.h" -#include "Exception.h" -#include "deprecation.h" - -// std -#include -#include -#include - -namespace -{ - typedef std::map ModuleRegistry; - - // The registry must be dynamically managed, because some modules - // (the math module) are static globals that are not guaranteed to - // be destroyed before other static globals. - ModuleRegistry *registry = nullptr; - - ModuleRegistry ®istryInstance() - { - if (!registry) - registry = new ModuleRegistry; - - return *registry; - } - - void freeEmptyRegistry() - { - if (registry && registry->empty()) - { - delete registry; - registry = nullptr; - } - } - -} // anonymous namespace - -namespace love -{ - -love::Type Module::type("Module", &Object::type); -Module *Module::instances[] = {}; - -Module::Module() -{ - initDeprecation(); -} - -Module::~Module() -{ - ModuleRegistry ®istry = registryInstance(); - - // We can't use the overridden Module::getName() in this destructor. - for (auto it = registry.begin(); it != registry.end(); ++it) - { - if (it->second == this) - { - registry.erase(it); - break; - } - } - - // Same deal with Module::getModuleType(). - for (int i = 0; i < (int) M_MAX_ENUM; i++) - { - if (instances[i] == this) - instances[i] = nullptr; - } - - freeEmptyRegistry(); - - deinitDeprecation(); -} - -void Module::registerInstance(Module *instance) -{ - if (instance == nullptr) - throw Exception("Module instance is null"); - - std::string name(instance->getName()); - - ModuleRegistry ®istry = registryInstance(); - - auto it = registry.find(name); - - if (it != registry.end()) - { - if (it->second == instance) - return; - throw Exception("Module %s already registered!", instance->getName()); - } - - registry.insert(make_pair(name, instance)); - - ModuleType moduletype = instance->getModuleType(); - - if (instances[moduletype] != nullptr) - { - printf("Warning: overwriting module instance %s with new instance %s\n", - instances[moduletype]->getName(), instance->getName()); - } - - instances[moduletype] = instance; -} - -Module *Module::getInstance(const std::string &name) -{ - ModuleRegistry ®istry = registryInstance(); - - auto it = registry.find(name); - - if (registry.end() == it) - return nullptr; - - return it->second; -} - -} // love diff --git a/love/src/jni/love/src/common/Module.h b/love/src/jni/love/src/common/Module.h deleted file mode 100644 index 89d76707..00000000 --- a/love/src/jni/love/src/common/Module.h +++ /dev/null @@ -1,113 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_MODULE_H -#define LOVE_MODULE_H - -// LOVE -#include "Exception.h" -#include "Object.h" - -namespace love -{ -/** - * Abstract superclass for all modules. - **/ -class Module : public Object -{ -public: - - static love::Type type; - - enum ModuleType - { - M_AUDIO, - M_DATA, - M_EVENT, - M_FILESYSTEM, - M_FONT, - M_GRAPHICS, - M_IMAGE, - M_JOYSTICK, - M_KEYBOARD, - M_MATH, - M_MOUSE, - M_PHYSICS, - M_SOUND, - M_SYSTEM, - M_THREAD, - M_TIMER, - M_TOUCH, - M_VIDEO, - M_WINDOW, - M_MAX_ENUM - }; - - Module(); - virtual ~Module(); - - /** - * Gets the base type of the module. - **/ - virtual ModuleType getModuleType() const = 0; - - /** - * Gets the name of the module. This is used in case of errors - * and other messages. - * - * @return The full name of the module, eg. love.graphics.opengl. - **/ - virtual const char *getName() const = 0; - - /** - * Add module to internal registry. To be used /only/ in - * runtime.cpp:luax_register_module() - * @param instance The module instance. - */ - static void registerInstance(Module *instance); - - /** - * Retrieve module instance from internal registry. May return NULL - * if module not registered. - * @param name The full name of the module. - * @return Module instance or NULL if the module is not registered. - */ - static Module *getInstance(const std::string &name); - - /** - * Retrieve module instance from the internal registry using the base - * module type. May return null if the module is not registered. - * @param type The base type of the module. - **/ - template - static T *getInstance(ModuleType type) - { - return (T *) instances[type]; - } - -private: - - static Module *instances[M_MAX_ENUM]; - -}; // Module - -} // love - -#endif // LOVE_MODULE_H diff --git a/love/src/jni/love/src/common/Object.cpp b/love/src/jni/love/src/common/Object.cpp deleted file mode 100644 index dfedd482..00000000 --- a/love/src/jni/love/src/common/Object.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -// LOVE -#include "Object.h" - -namespace love -{ - -love::Type Object::type("Object", nullptr); - -Object::Object() - : count(1) -{ -} - -Object::Object(const Object & /*other*/) - : count(1) // Always start with a reference count of 1. -{ -} - -Object::~Object() -{ -} - -int Object::getReferenceCount() const -{ - return count; -} - -void Object::retain() -{ - count.fetch_add(1, std::memory_order_relaxed); -} - -void Object::release() -{ - // http://www.boost.org/doc/libs/1_56_0/doc/html/atomic/usage_examples.html - if (count.fetch_sub(1, std::memory_order_release) == 1) - { - std::atomic_thread_fence(std::memory_order_acquire); - delete this; - } -} - -} // love diff --git a/love/src/jni/love/src/common/Object.h b/love/src/jni/love/src/common/Object.h deleted file mode 100644 index 154b8e0c..00000000 --- a/love/src/jni/love/src/common/Object.h +++ /dev/null @@ -1,162 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_OBJECT_H -#define LOVE_OBJECT_H - -#include -#include "types.h" - -namespace love -{ - -/** - * Superclass for all object that should be able to cross the Lua/C border - * (this pertains to most objects). - * - * This class is an alternative to using smart pointers; it contains retain/release - * methods, and will delete itself with the reference count hits zero. The wrapper - * code assumes that all userdata inherits from this class. - **/ -class Object -{ -public: - - static love::Type type; - - /** - * Constructor. Sets reference count to one. - **/ - Object(); - Object(const Object &other); - - /** - * Destructor. - **/ - virtual ~Object() = 0; - - /** - * Gets the reference count of this Object. - * @returns The reference count. - **/ - int getReferenceCount() const; - - /** - * Retains the Object, i.e. increases the - * reference count by one. - **/ - void retain(); - - /** - * Releases one reference to the Object, i.e. decrements the - * reference count by one, and potentially deletes the Object - * if there are no more references. - **/ - void release(); - -private: - - // The reference count. - std::atomic count; - -}; // Object - - -enum class Acquire -{ - RETAIN, - NORETAIN, -}; - -template -class StrongRef -{ -public: - - StrongRef() - : object(nullptr) - { - } - - StrongRef(T *obj, Acquire acquire = Acquire::RETAIN) - : object(obj) - { - if (object && acquire == Acquire::RETAIN) object->retain(); - } - - StrongRef(const StrongRef &other) - : object(other.get()) - { - if (object) object->retain(); - } - - StrongRef(StrongRef &&other) - : object(other.object) - { - other.object = nullptr; - } - - ~StrongRef() - { - if (object) object->release(); - } - - StrongRef &operator = (const StrongRef &other) - { - set(other.get()); - return *this; - } - - T *operator->() const - { - return object; - } - - explicit operator bool() const - { - return object != nullptr; - } - - operator T*() const - { - return object; - } - - void set(T *obj, Acquire acquire = Acquire::RETAIN) - { - if (obj && acquire == Acquire::RETAIN) obj->retain(); - if (object) object->release(); - object = obj; - } - - T *get() const - { - return object; - } - -private: - - T *object; - -}; // StrongRef - -} // love - -#endif // LOVE_OBJECT_H diff --git a/love/src/jni/love/src/common/Optional.h b/love/src/jni/love/src/common/Optional.h deleted file mode 100644 index 783bd31a..00000000 --- a/love/src/jni/love/src/common/Optional.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#pragma once - -namespace love -{ - -// Currently only meant for simple and small types. -template -struct Optional -{ - bool hasValue; - T value; - - Optional() - : hasValue(false) - , value(T()) - {} - - Optional(T val) - : hasValue(true) - , value(val) - {} - - void set(T val) - { - hasValue = true; - value = val; - } -}; - -typedef Optional OptionalBool; -typedef Optional OptionalFloat; -typedef Optional OptionalDouble; -typedef Optional OptionalInt; - -} // love diff --git a/love/src/jni/love/src/common/Reference.cpp b/love/src/jni/love/src/common/Reference.cpp deleted file mode 100644 index dff336d2..00000000 --- a/love/src/jni/love/src/common/Reference.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "Reference.h" - -namespace love -{ - -const char REFERENCE_TABLE_NAME[] = "love-references"; - -Reference::Reference() - : pinnedL(nullptr) - , idx(LUA_REFNIL) -{ -} - -Reference::Reference(lua_State *L) - : pinnedL(nullptr) - , idx(LUA_REFNIL) -{ - ref(L); -} - -Reference::~Reference() -{ - unref(); -} - -void Reference::ref(lua_State *L) -{ - unref(); // Previously created reference needs to be cleared - pinnedL = luax_getpinnedthread(L); - luax_insist(L, LUA_REGISTRYINDEX, REFERENCE_TABLE_NAME); - lua_insert(L, -2); // Move reference table behind value. - idx = luaL_ref(L, -2); - lua_pop(L, 1); -} - -void Reference::unref() -{ - if (idx != LUA_REFNIL) - { - // We use a pinned thread/coroutine for the Lua state because we know it - // hasn't been garbage collected and is valid, as long as the whole lua - // state is still open. - luax_insist(pinnedL, LUA_REGISTRYINDEX, REFERENCE_TABLE_NAME); - luaL_unref(pinnedL, -1, idx); - lua_pop(pinnedL, 1); - idx = LUA_REFNIL; - } -} - -void Reference::push(lua_State *L) -{ - if (idx != LUA_REFNIL) - { - luax_insist(L, LUA_REGISTRYINDEX, REFERENCE_TABLE_NAME); - lua_rawgeti(L, -1, idx); - lua_remove(L, -2); - } - else - lua_pushnil(L); -} - -} // love diff --git a/love/src/jni/love/src/common/Reference.h b/love/src/jni/love/src/common/Reference.h deleted file mode 100644 index b50edf46..00000000 --- a/love/src/jni/love/src/common/Reference.h +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_REFERENCE_H -#define LOVE_REFERENCE_H - -// LOVE -#include "runtime.h" - -namespace love -{ - -/** - * This class wraps the reference functionality built into - * Lua, which allows C++ code to refer to Lua variables. - **/ -class Reference -{ -public: - - /** - * Creates the reference object, but does not create - * the actual reference. - **/ - Reference(); - - /** - * Creates the object and a reference to the value - * on the top of the stack. - **/ - Reference(lua_State *L); - - /** - * Deletes the reference, if any. - **/ - virtual ~Reference(); - - /** - * Creates a reference to the value on the - * top of the stack. - **/ - void ref(lua_State *L); - - /** - * Unrefs the reference, if any. - **/ - void unref(); - - /** - * Pushes the referred value onto the stack of the specified Lua coroutine. - * NOTE: The coroutine *must* belong to the same Lua state that was used for - * Reference::ref. - **/ - void push(lua_State *L); - -private: - - // A pinned coroutine (probably the main thread) belonging to the Lua state - // in which the reference resides. - lua_State *pinnedL; - - // Index to the Lua reference. - int idx; -}; - -} // love - -#endif // LOVE_REFERENCE_H diff --git a/love/src/jni/love/src/common/Stream.cpp b/love/src/jni/love/src/common/Stream.cpp deleted file mode 100644 index d9139e35..00000000 --- a/love/src/jni/love/src/common/Stream.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) 2006-2015 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -// LOVE -#include "Stream.h" - -namespace love -{ - -love::Type Stream::type("Stream", &Object::type); - -} // love diff --git a/love/src/jni/love/src/common/Stream.h b/love/src/jni/love/src/common/Stream.h deleted file mode 100644 index 2b69144e..00000000 --- a/love/src/jni/love/src/common/Stream.h +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright (c) 2006-2015 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_STREAM_H -#define LOVE_STREAM_H - -// LOVE -#include -#include "Object.h" - -namespace love -{ - -class Stream : public Object -{ -public: - static love::Type type; - - virtual ~Stream() {} - - // getData and getSize are assumed to talk about - // the buffer - - /** - * A callback, gets called when some Stream consumer exhausts the data - **/ - virtual void fillBackBuffer() {} - - /** - * Get the front buffer, Streams are supposed to be (at least) double-buffered - **/ - virtual const void *getFrontBuffer() const = 0; - - /** - * Get the size of any (and in particular the front) buffer - **/ - virtual size_t getSize() const = 0; - - /** - * Swap buffers. Returns true if there is new data in the front buffer, - * false otherwise. - * NOTE: If there is no back buffer ready, this call must be ignored - **/ - virtual bool swapBuffers() = 0; -}; // Stream - -} // love - -#endif // LOVE_STREAM_H diff --git a/love/src/jni/love/src/common/StringMap.cpp b/love/src/jni/love/src/common/StringMap.cpp deleted file mode 100644 index 97d1e98a..00000000 --- a/love/src/jni/love/src/common/StringMap.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "StringMap.h" - -// See the header -template class std::vector; diff --git a/love/src/jni/love/src/common/StringMap.h b/love/src/jni/love/src/common/StringMap.h deleted file mode 100644 index 31ef640c..00000000 --- a/love/src/jni/love/src/common/StringMap.h +++ /dev/null @@ -1,187 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_STRING_MAP_H -#define LOVE_STRING_MAP_H - -#include "Exception.h" - -#include -#include - -// As StringMap instantiates std::vector for instances that use -// getNames(), we end up with multiple copies in the object files. This -// declaration means we only emit it once (in StringMap.cpp). -extern template class std::vector; - -namespace love -{ - -template -class StringMap -{ -public: - - struct Entry - { - const char *key; - T value; - }; - - StringMap(const Entry *entries, unsigned int num) - { - - for (unsigned int i = 0; i < SIZE; ++i) - reverse[i] = nullptr; - - unsigned int n = num / sizeof(Entry); - - for (unsigned int i = 0; i < n; ++i) - add(entries[i].key, entries[i].value); - } - - bool streq(const char *a, const char *b) - { - while (*a != 0 && *b != 0) - { - if (*a != *b) - return false; - - ++a; - ++b; - } - - return (*a == 0 && *b == 0); - } - - bool find(const char *key, T &t) - { - unsigned int str_hash = djb2(key); - - for (unsigned int i = 0; i < MAX; ++i) - { - unsigned int str_i = (str_hash + i) % MAX; - - if (!records[str_i].set) - return false; - - if (streq(records[str_i].key, key)) - { - t = records[str_i].value; - return true; - } - } - - return false; - } - - bool find(T key, const char *&str) - { - unsigned int index = (unsigned int) key; - - if (index >= SIZE) - return false; - - if (reverse[index] != nullptr) - { - str = reverse[index]; - return true; - } - else - { - return false; - } - } - - bool add(const char *key, T value) - { - unsigned int str_hash = djb2(key); - bool inserted = false; - - for (unsigned int i = 0; i < MAX; ++i) - { - unsigned int str_i = (str_hash + i) % MAX; - - if (!records[str_i].set) - { - inserted = true; - records[str_i].set = true; - records[str_i].key = key; - records[str_i].value = value; - break; - } - } - - unsigned int index = (unsigned int) value; - - if (index >= SIZE) - { - printf("Constant %s out of bounds with %u!\n", key, index); - return false; - } - - reverse[index] = key; - - return inserted; - } - - unsigned int djb2(const char *key) - { - unsigned int hash = 5381; - int c; - - while ((c = *key++)) - hash = ((hash << 5) + hash) + c; - - return hash; - } - - std::vector getNames() const - { - std::vector names; - names.reserve(SIZE); - - for (unsigned int i = 0; i < SIZE; ++i) - if (reverse[i] != nullptr) - names.emplace_back(reverse[i]); - - return names; - } - -private: - - struct Record - { - const char *key; - T value; - bool set; - Record() : set(false) {} - }; - - static const unsigned int MAX = SIZE * 2; - - Record records[MAX]; - const char *reverse[SIZE]; - -}; // StringMap - -} // love - -#endif // LOVE_STRING_MAP_H diff --git a/love/src/jni/love/src/common/Variant.cpp b/love/src/jni/love/src/common/Variant.cpp deleted file mode 100644 index fea1547f..00000000 --- a/love/src/jni/love/src/common/Variant.cpp +++ /dev/null @@ -1,280 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include - -#include "Variant.h" -#include "common/StringMap.h" - -namespace love -{ - -static Proxy *tryextractproxy(lua_State *L, int idx) -{ - Proxy *u = (Proxy *)lua_touserdata(L, idx); - - if (u == nullptr || u->type == nullptr) - return nullptr; - - // We could get rid of the dynamic_cast for more performance, but it would - // be less safe... - if (dynamic_cast(u->object) != nullptr) - return u; - - return nullptr; -} - -Variant::Variant() - : type(NIL) -{ -} - -Variant::Variant(bool boolean) - : type(BOOLEAN) -{ - data.boolean = boolean; -} - -Variant::Variant(double number) - : type(NUMBER) -{ - data.number = number; -} - -Variant::Variant(const char *string, size_t len) -{ - if (len <= MAX_SMALL_STRING_LENGTH) - { - type = SMALLSTRING; - memcpy(data.smallstring.str, string, len); - data.smallstring.len = (uint8) len; - } - else - { - type = STRING; - data.string = new SharedString(string, len); - } -} - -Variant::Variant(void *lightuserdata) - : type(LUSERDATA) -{ - data.userdata = lightuserdata; -} - -Variant::Variant(love::Type *lovetype, love::Object *object) - : type(LOVEOBJECT) -{ - data.objectproxy.type = lovetype; - data.objectproxy.object = object; - - if (data.objectproxy.object != nullptr) - data.objectproxy.object->retain(); -} - -// Variant gets ownership of the vector. -Variant::Variant(std::vector> *table) - : type(TABLE) -{ - data.table = new SharedTable(table); -} - -Variant::Variant(const Variant &v) - : type(v.type) - , data(v.data) -{ - if (type == STRING) - data.string->retain(); - else if (type == LOVEOBJECT && data.objectproxy.object != nullptr) - data.objectproxy.object->retain(); - else if (type == TABLE) - data.table->retain(); -} - -Variant::Variant(Variant &&v) - : type(std::move(v.type)) - , data(std::move(v.data)) -{ - v.type = NIL; -} - -Variant::~Variant() -{ - if (type == STRING) - data.string->release(); - else if (type == LOVEOBJECT && data.objectproxy.object != nullptr) - data.objectproxy.object->release(); - else if (type == TABLE) - data.table->release(); -} - -Variant &Variant::operator = (const Variant &v) -{ - if (v.type == STRING) - v.data.string->retain(); - else if (v.type == LOVEOBJECT && v.data.objectproxy.object != nullptr) - v.data.objectproxy.object->retain(); - else if (v.type == TABLE) - v.data.table->retain(); - - if (type == STRING) - data.string->release(); - else if (type == LOVEOBJECT && data.objectproxy.object != nullptr) - data.objectproxy.object->release(); - else if (type == TABLE) - data.table->release(); - - type = v.type; - data = v.data; - - return *this; -} - -Variant Variant::fromLua(lua_State *L, int n, std::set *tableSet) -{ - size_t len; - const char *str; - Proxy *p = nullptr; - - if (n < 0) // Fix the stack position, we might modify it later - n += lua_gettop(L) + 1; - - switch (lua_type(L, n)) - { - case LUA_TBOOLEAN: - return Variant(luax_toboolean(L, n)); - case LUA_TNUMBER: - return Variant(lua_tonumber(L, n)); - case LUA_TSTRING: - str = lua_tolstring(L, n, &len); - return Variant(str, len); - case LUA_TLIGHTUSERDATA: - return Variant(lua_touserdata(L, n)); - case LUA_TUSERDATA: - p = tryextractproxy(L, n); - if (p != nullptr) - return Variant(p->type, p->object); - else - { - luax_typerror(L, n, "love type"); - return Variant(); - } - case LUA_TNIL: - return Variant(); - case LUA_TTABLE: - { - bool success = true; - std::unique_ptr> tableSetPtr; - std::vector> *table = new std::vector>(); - - // If we had no tables argument, allocate one now, and store it in our unique_ptr - if (tableSet == nullptr) - tableSetPtr.reset(tableSet = new std::set); - - // Now make sure this table wasn't already serialised - const void *tablePointer = lua_topointer(L, n); - { - auto result = tableSet->insert(tablePointer); - if (!result.second) // insertion failed - throw love::Exception("Cycle detected in table"); - } - - size_t len = luax_objlen(L, -1); - if (len > 0) - table->reserve(len); - - lua_pushnil(L); - - while (lua_next(L, n)) - { - table->emplace_back(fromLua(L, -2, tableSet), fromLua(L, -1, tableSet)); - lua_pop(L, 1); - - const auto &p = table->back(); - if (p.first.getType() == UNKNOWN || p.second.getType() == UNKNOWN) - { - success = false; - break; - } - } - - // And remove the table from the set again - tableSet->erase(tablePointer); - - if (success) - return Variant(table); - else - delete table; - } - break; - } - - Variant v; - v.type = UNKNOWN; - return v; -} - -void Variant::toLua(lua_State *L) const -{ - switch (type) - { - case BOOLEAN: - lua_pushboolean(L, data.boolean); - break; - case NUMBER: - lua_pushnumber(L, data.number); - break; - case STRING: - lua_pushlstring(L, data.string->str, data.string->len); - break; - case SMALLSTRING: - lua_pushlstring(L, data.smallstring.str, data.smallstring.len); - break; - case LUSERDATA: - lua_pushlightuserdata(L, data.userdata); - break; - case LOVEOBJECT: - luax_pushtype(L, *data.objectproxy.type, data.objectproxy.object); - break; - case TABLE: - { - std::vector> *table = data.table->table; - int tsize = (int) table->size(); - - lua_createtable(L, 0, tsize); - - for (int i = 0; i < tsize; ++i) - { - std::pair &kv = (*table)[i]; - kv.first.toLua(L); - kv.second.toLua(L); - lua_settable(L, -3); - } - - break; - } - case NIL: - default: - lua_pushnil(L); - break; - } -} - -} // love diff --git a/love/src/jni/love/src/common/Variant.h b/love/src/jni/love/src/common/Variant.h deleted file mode 100644 index 6ed6a624..00000000 --- a/love/src/jni/love/src/common/Variant.h +++ /dev/null @@ -1,124 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_VARIANT_H -#define LOVE_VARIANT_H - -#include "common/runtime.h" -#include "common/Object.h" -#include "common/int.h" - -#include -#include -#include - -namespace love -{ - -class Variant -{ -public: - - enum Type - { - UNKNOWN = 0, - BOOLEAN, - NUMBER, - STRING, - SMALLSTRING, - LUSERDATA, - LOVEOBJECT, - NIL, - TABLE - }; - - Variant(); - Variant(bool boolean); - Variant(double number); - Variant(const char *string, size_t len); - Variant(void *lightuserdata); - Variant(love::Type *type, love::Object *object); - Variant(std::vector> *table); - Variant(const Variant &v); - Variant(Variant &&v); - ~Variant(); - - Variant &operator = (const Variant &v); - - Type getType() const { return type; } - - static Variant fromLua(lua_State *L, int n, std::set *tableSet = nullptr); - void toLua(lua_State *L) const; - -private: - - class SharedString : public love::Object - { - public: - - SharedString(const char *string, size_t len) - : len(len) - { - str = new char[len+1]; - memcpy(str, string, len); - } - virtual ~SharedString() { delete[] str; } - - char *str; - size_t len; - }; - - class SharedTable : public love::Object - { - public: - - SharedTable(std::vector> *table) - : table(table) - { - } - - virtual ~SharedTable() { delete table; } - - std::vector> *table; - }; - - static const int MAX_SMALL_STRING_LENGTH = 15; - - Type type; - - union Data - { - bool boolean; - double number; - SharedString *string; - void *userdata; - Proxy objectproxy; - SharedTable *table; - struct - { - char str[MAX_SMALL_STRING_LENGTH]; - uint8 len; - } smallstring; - } data; - -}; // Variant -} // love - -#endif // LOVE_VARIANT_H diff --git a/love/src/jni/love/src/common/Vector.cpp b/love/src/jni/love/src/common/Vector.cpp deleted file mode 100644 index 2ceb8f4f..00000000 --- a/love/src/jni/love/src/common/Vector.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "Vector.h" - -namespace love -{ -// Implementation in header. -} diff --git a/love/src/jni/love/src/common/Vector.h b/love/src/jni/love/src/common/Vector.h deleted file mode 100644 index e333a3a1..00000000 --- a/love/src/jni/love/src/common/Vector.h +++ /dev/null @@ -1,410 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_VECTOR_H -#define LOVE_VECTOR_H - -// STD -#include - -namespace love -{ - -struct Vector2 -{ - float x, y; - - Vector2() - : x(0.0f), y(0.0f) - {} - - Vector2(float x, float y) - : x(x), y(y) - {} - - Vector2(const Vector2 &v) - : x(v.x), y(v.y) - {} - - /** - * Gets the length of the Vector. - **/ - float getLength() const; - float getLengthSquare() const; - - /** - * Normalizes the Vector. - * @param length Desired length of the vector. - * @return The old length of the Vector. - **/ - float normalize(float length = 1.0); - - /** - * Gets a vector perpendicular to the Vector. - * To get the true (normalized) normal, use v.getNormal(1.0f / v.getLength()) - * @return A normal to the Vector. - **/ - Vector2 getNormal() const; - - /** - * Gets a vector perpendicular to the Vector. - * To get the true (normalized) normal, use v.getNormal(1.0f / v.getLength()) - * @param scale factor to apply. - * @return A normal to the Vector. - **/ - Vector2 getNormal(float scale) const; - - static inline float dot(const Vector2 &a, const Vector2 &b); - static inline float cross(const Vector2 &a, const Vector2 &b); - - /** - * Adds a Vector to this Vector. - **/ - Vector2 operator + (const Vector2 &v) const; - - /** - * Substracts a Vector from this Vector. - **/ - Vector2 operator - (const Vector2 &v) const; - - /** - * Component-wise multiplies the Vector by a scalar. - **/ - Vector2 operator * (float s) const; - - /** - * Component-wise divides the Vector by a scalar. - **/ - Vector2 operator / (float s) const; - - /** - * Component-wise negates the Vector. - **/ - Vector2 operator - () const; - - /** - * Adds a Vector to this Vector, and also saves changes in the first Vector. - **/ - void operator += (const Vector2 &v); - - /** - * Subtracts a Vector to this Vector, and also saves changes in the first Vector. - **/ - void operator -= (const Vector2 &v); - - /** - * Resizes the Vector, and also saves changes in the first Vector. - **/ - void operator *= (float s); - - /** - * Resizes the Vector, and also saves changes in the first Vector. - **/ - void operator /= (float s); - - bool operator == (const Vector2 &v) const; - bool operator != (const Vector2 &v) const; - -}; // Vector2 - - -struct Vector3 -{ - float x, y, z; - - Vector3() - : x(0.0f), y(0.0f), z(0.0f) - {} - - Vector3(float x, float y, float z) - : x(x), y(y), z(z) - {} - - Vector3(const Vector2 &v) - : x(v.x), y(v.y), z(0.0f) - {} - - /** - * Gets the length of the Vector. - **/ - float getLength() const; - float getLengthSquare() const; - - /** - * Normalizes the Vector. - * @param length Desired length of the vector. - * @return The old length of the Vector. - **/ - float normalize(float length = 1.0); - - static inline float dot(const Vector3 &a, const Vector3 &b); - static inline Vector3 cross(const Vector3 &a, const Vector3 &b); - - /** - * Adds a Vector to this Vector. - **/ - Vector3 operator + (const Vector3 &v) const; - - /** - * Substracts a Vector from this Vector. - **/ - Vector3 operator - (const Vector3 &v) const; - - /** - * Component-wise multiplies the Vector by a scalar. - **/ - Vector3 operator * (float s) const; - - /** - * Component-wise divides the Vector by a scalar. - **/ - Vector3 operator / (float s) const; - - /** - * Component-wise negates the Vector. - **/ - Vector3 operator - () const; - - /** - * Adds a Vector to this Vector, and also saves changes in the first Vector. - **/ - void operator += (const Vector3 &v); - - /** - * Subtracts a Vector to this Vector, and also saves changes in the first Vector. - **/ - void operator -= (const Vector3 &v); - - /** - * Resizes the Vector, and also saves changes in the first Vector. - **/ - void operator *= (float s); - - /** - * Resizes the Vector, and also saves changes in the first Vector. - **/ - void operator /= (float s); - - bool operator == (const Vector3 &v) const; - bool operator != (const Vector3 &v) const; - -}; // Vector3 - - -inline float Vector2::getLength() const -{ - return sqrtf(x*x + y*y); -} - -inline float Vector2::getLengthSquare() const -{ - return x*x + y*y; -} - -inline Vector2 Vector2::getNormal() const -{ - return Vector2(-y, x); -} - -inline Vector2 Vector2::getNormal(float scale) const -{ - return Vector2(-y * scale, x * scale); -} - -inline float Vector2::dot(const Vector2 &a, const Vector2 &b) -{ - return a.x * b.x + a.y * b.y; -} - -inline float Vector2::cross(const Vector2 &a, const Vector2 &b) -{ - return a.x * b.y - a.y * b.x; -} - -inline float Vector2::normalize(float length) -{ - float length_current = getLength(); - - if (length_current > 0) - (*this) *= length / length_current; - - return length_current; -} - -inline Vector2 Vector2::operator + (const Vector2 &v) const -{ - return Vector2(x + v.x, y + v.y); -} - -inline Vector2 Vector2::operator - (const Vector2 &v) const -{ - return Vector2(x - v.x, y - v.y); -} - -inline Vector2 Vector2::operator * (float s) const -{ - return Vector2(x*s, y*s); -} - -inline Vector2 Vector2::operator / (float s) const -{ - float invs = 1.0f / s; - return Vector2(x*invs, y*invs); -} - -inline Vector2 Vector2::operator - () const -{ - return Vector2(-x, -y); -} - -inline void Vector2::operator += (const Vector2 &v) -{ - x += v.x; - y += v.y; -} - -inline void Vector2::operator -= (const Vector2 &v) -{ - x -= v.x; - y -= v.y; -} - -inline void Vector2::operator *= (float s) -{ - x *= s; - y *= s; -} - -inline void Vector2::operator /= (float s) -{ - float invs = 1.0f / s; - x *= invs; - y *= invs; -} - -inline bool Vector2::operator == (const Vector2 &v) const -{ - return x == v.x && y == v.y; -} - -inline bool Vector2::operator != (const Vector2 &v) const -{ - return x != v.x || y != v.y; -} - - -inline float Vector3::getLength() const -{ - return sqrtf(x*x + y*y + z*z); -} - -inline float Vector3::getLengthSquare() const -{ - return x*x + y*y + z*z; -} - -inline float Vector3::dot(const Vector3 &a, const Vector3 &b) -{ - return a.x * b.x + a.y * b.y + a.z * b.z; -} - -inline Vector3 Vector3::cross(const Vector3 &a, const Vector3 &b) -{ - return Vector3(a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x); -} - -inline float Vector3::normalize(float length) -{ - float length_current = getLength(); - - if (length_current > 0) - (*this) *= length / length_current; - - return length_current; -} - -inline Vector3 Vector3::operator + (const Vector3 &v) const -{ - return Vector3(x + v.x, y + v.y, z + v.z); -} - -inline Vector3 Vector3::operator - (const Vector3 &v) const -{ - return Vector3(x - v.x, y - v.y, z - v.z); -} - -inline Vector3 Vector3::operator * (float s) const -{ - return Vector3(x*s, y*s, z*s); -} - -inline Vector3 Vector3::operator / (float s) const -{ - float invs = 1.0f / s; - return Vector3(x*invs, y*invs, z*invs); -} - -inline Vector3 Vector3::operator - () const -{ - return Vector3(-x, -y, -z); -} - -inline void Vector3::operator += (const Vector3 &v) -{ - x += v.x; - y += v.y; - z += v.z; -} - -inline void Vector3::operator -= (const Vector3 &v) -{ - x -= v.x; - y -= v.y; - z -= v.z; -} - -inline void Vector3::operator *= (float s) -{ - x *= s; - y *= s; - z *= s; -} - -inline void Vector3::operator /= (float s) -{ - float invs = 1.0f / s; - x *= invs; - y *= invs; - z *= invs; -} - -inline bool Vector3::operator == (const Vector3 &v) const -{ - return x == v.x && y == v.y && z == v.z; -} - -inline bool Vector3::operator != (const Vector3 &v) const -{ - return x != v.x || y != v.y || z != v.z; -} - -} //love - -#endif// LOVE_VECTOR_H diff --git a/love/src/jni/love/src/common/android.cpp b/love/src/jni/love/src/common/android.cpp deleted file mode 100644 index 022ed0e6..00000000 --- a/love/src/jni/love/src/common/android.cpp +++ /dev/null @@ -1,247 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "android.h" - -#ifdef LOVE_ANDROID - -#include "SDL.h" -#include "jni.h" - -#include -#include -#include -#include - -namespace love -{ -namespace android -{ - -void setImmersive(bool immersive_active) -{ - JNIEnv *env = (JNIEnv*) SDL_AndroidGetJNIEnv(); - - jobject activity = (jobject) SDL_AndroidGetActivity(); - - jclass clazz(env->GetObjectClass(activity)); - jmethodID method_id = env->GetMethodID(clazz, "setImmersiveMode", "(Z)V"); - - env->CallVoidMethod(activity, method_id, immersive_active); - - env->DeleteLocalRef(activity); - env->DeleteLocalRef(clazz); -} - -bool getImmersive() -{ - JNIEnv *env = (JNIEnv*) SDL_AndroidGetJNIEnv(); - - jobject activity = (jobject) SDL_AndroidGetActivity(); - - jclass clazz(env->GetObjectClass(activity)); - jmethodID method_id = env->GetMethodID(clazz, "getImmersiveMode", "()Z"); - - jboolean immersive_active = env->CallBooleanMethod(activity, method_id); - - env->DeleteLocalRef(activity); - env->DeleteLocalRef(clazz); - - return immersive_active; -} - -double getScreenScale() -{ - static double result = -1.; - - if (result == -1.) - { - JNIEnv *env = (JNIEnv*) SDL_AndroidGetJNIEnv(); - jclass activity = env->FindClass("org/love2d/android/GameActivity"); - - jmethodID getMetrics = env->GetStaticMethodID(activity, "getMetrics", "()Landroid/util/DisplayMetrics;"); - jobject metrics = env->CallStaticObjectMethod(activity, getMetrics); - jclass metricsClass = env->GetObjectClass(metrics); - - result = env->GetFloatField(metrics, env->GetFieldID(metricsClass, "density", "F")); - - env->DeleteLocalRef(metricsClass); - env->DeleteLocalRef(metrics); - env->DeleteLocalRef(activity); - } - - return result; -} - -const char *getSelectedGameFile() -{ - static const char *path = NULL; - - if (path) - { - delete path; - path = NULL; - } - - JNIEnv *env = (JNIEnv*) SDL_AndroidGetJNIEnv(); - jclass activity = env->FindClass("org/love2d/android/GameActivity"); - - jmethodID getGamePath = env->GetStaticMethodID(activity, "getGamePath", "()Ljava/lang/String;"); - jstring gamePath = (jstring) env->CallStaticObjectMethod(activity, getGamePath); - const char *utf = env->GetStringUTFChars(gamePath, 0); - if (utf) - { - path = SDL_strdup(utf); - env->ReleaseStringUTFChars(gamePath, utf); - } - - env->DeleteLocalRef(gamePath); - env->DeleteLocalRef(activity); - - return path; -} - -bool openURL(const std::string &url) -{ - JNIEnv *env = (JNIEnv*) SDL_AndroidGetJNIEnv(); - jclass activity = env->FindClass("org/love2d/android/GameActivity"); - - jmethodID openURL = env->GetStaticMethodID(activity, "openURL", "(Ljava/lang/String;)Z"); - jstring url_jstring = (jstring) env->NewStringUTF(url.c_str()); - - jboolean result = env->CallStaticBooleanMethod(activity, openURL, url_jstring); - - env->DeleteLocalRef(url_jstring); - env->DeleteLocalRef(activity); - return result; -} - -void vibrate(double seconds) -{ - JNIEnv *env = (JNIEnv*) SDL_AndroidGetJNIEnv(); - jclass activity = env->FindClass("org/love2d/android/GameActivity"); - - jmethodID vibrate_method = env->GetStaticMethodID(activity, "vibrate", "(D)V"); - env->CallStaticVoidMethod(activity, vibrate_method, seconds); - - env->DeleteLocalRef(activity); -} - -/* - * Helper functions for the filesystem module - */ -void freeGameArchiveMemory(void *ptr) -{ - char *game_love_data = static_cast(ptr); - delete[] game_love_data; -} - -bool loadGameArchiveToMemory(const char* filename, char **ptr, size_t *size) -{ - SDL_RWops *asset_game_file = SDL_RWFromFile(filename, "rb"); - if (!asset_game_file) { - SDL_Log("Could not find %s", filename); - return false; - } - - Sint64 file_size = asset_game_file->size(asset_game_file); - if (file_size <= 0) { - SDL_Log("Could not load game from %s. File has invalid file size: %d.", filename, (int) file_size); - return false; - } - - *ptr = new char[file_size]; - if (!*ptr) { - SDL_Log("Could not allocate memory for in-memory game archive"); - return false; - } - - size_t bytes_copied = asset_game_file->read(asset_game_file, (void*) *ptr, sizeof(char), (size_t) file_size); - if (bytes_copied != file_size) { - SDL_Log("Incomplete copy of in-memory game archive!"); - delete[] *ptr; - return false; - } - - *size = (size_t) file_size; - return true; -} - -bool directoryExists(const char *path) -{ - struct stat s; - int err = stat(path, &s); - if (err == -1) - { - if (errno != ENOENT) - SDL_Log("Error checking for directory %s errno = %d: %s", path, errno, strerror(errno)); - return false; - } - - return S_ISDIR(s.st_mode); -} - -bool mkdir(const char *path) -{ - int err = ::mkdir(path, 0770); - if (err == -1) - { - SDL_Log("Error: Could not create directory %s", path); - return false; - } - - return true; -} - -bool createStorageDirectories() -{ - std::string internal_storage_path = SDL_AndroidGetInternalStoragePath(); - - std::string save_directory = internal_storage_path + "/save"; - if (!directoryExists(save_directory.c_str()) && !mkdir(save_directory.c_str())) - return false; - - std::string game_directory = internal_storage_path + "/game"; - if (!directoryExists (game_directory.c_str()) && !mkdir(game_directory.c_str())) - return false; - - return true; -} - -bool hasBackgroundMusic() -{ - JNIEnv *env = (JNIEnv*) SDL_AndroidGetJNIEnv(); - jobject activity = (jobject) SDL_AndroidGetActivity(); - - jclass clazz(env->GetObjectClass(activity)); - jmethodID method_id = env->GetMethodID(clazz, "hasBackgroundMusic", "()Z"); - - jboolean result = env->CallBooleanMethod(activity, method_id); - - env->DeleteLocalRef(activity); - env->DeleteLocalRef(clazz); - - return result; -} - -} // android -} // love - -#endif // LOVE_ANDROID diff --git a/love/src/jni/love/src/common/android.h b/love/src/jni/love/src/common/android.h deleted file mode 100644 index 247fc8d9..00000000 --- a/love/src/jni/love/src/common/android.h +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_ANDROID_H -#define LOVE_ANDROID_H - -#include "config.h" - -#ifdef LOVE_ANDROID - -#include - -namespace love -{ -namespace android -{ - -/** - * Enables or disables immersive mode where the navigation bar is hidden. - **/ -void setImmersive(bool immersive_active); -bool getImmersive(); - -/** - * Gets the scale factor of the window's screen, e.g. on Retina displays this - * will return 2.0. - **/ -double getScreenScale(); - -/** - * Gets the selected love file in the device filesystem. - **/ -const char *getSelectedGameFile(); - -bool openURL(const std::string &url); - -void vibrate(double seconds); - -/* - * Helper functions for the filesystem module - */ -void freeGameArchiveMemory(void *ptr); - -bool loadGameArchiveToMemory(const char *filename, char **ptr, size_t *size); - -bool directoryExists(const char *path); - -bool mkdir(const char *path); - -bool createStorageDirectories(); - -bool hasBackgroundMusic(); - -} // android -} // love - -#endif // LOVE_ANDROID -#endif // LOVE_ANDROID_H diff --git a/love/src/jni/love/src/common/b64.cpp b/love/src/jni/love/src/common/b64.cpp deleted file mode 100644 index 857878ab..00000000 --- a/love/src/jni/love/src/common/b64.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "b64.h" -#include "Exception.h" - -#include -#include - -namespace love -{ - -// Translation table as described in RFC1113 -static const char cb64[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -// Translation table to decode (created by Bob Trower) -static const char cd64[]="|$$$}rstuvwxyz{$$$$$$$>?@ABCDEFGHIJKLMNOPQRSTUVW$$$$$$XYZ[\\]^_`abcdefghijklmnopq"; - -/** - * encode 3 8-bit binary bytes as 4 '6-bit' characters - **/ -static void b64_encode_block(char in[3], char out[4], int len) -{ - out[0] = (char) cb64[(int)((in[0] & 0xfc) >> 2)]; - out[1] = (char) cb64[(int)(((in[0] & 0x03) << 4) | ((in[1] & 0xf0) >> 4))]; - out[2] = (char) (len > 1 ? cb64[(int)(((in[1] & 0x0f) << 2) | ((in[2] & 0xc0) >> 6))] : '='); - out[3] = (char) (len > 2 ? cb64[(int)(in[2] & 0x3f)] : '='); -} - -char *b64_encode(const char *src, size_t srclen, size_t linelen, size_t &dstlen) -{ - if (linelen == 0) - linelen = std::numeric_limits::max(); - - size_t blocksout = 0; - size_t srcpos = 0; - - size_t adjustment = (srclen % 3) ? (3 - (srclen % 3)) : 0; - size_t paddedlen = ((srclen + adjustment) / 3) * 4; - - dstlen = paddedlen + paddedlen / linelen; - - if (dstlen == 0) - return nullptr; - - char *dst = nullptr; - try - { - dst = new char[dstlen + 1]; - } - catch (std::exception &) - { - throw love::Exception("Out of memory."); - } - - size_t dstpos = 0; - - while (srcpos < srclen) - { - char in[3] = {0}; - char out[4] = {0}; - - int len = 0; - - for (int i = 0; i < 3; i++) - { - if (srcpos >= srclen) - break; - - in[i] = src[srcpos++]; - len++; - } - - if (len > 0) - { - b64_encode_block(in, out, len); - - for (int i = 0; i < 4 && dstpos < dstlen; i++, dstpos++) - dst[dstpos] = out[i]; - - blocksout++; - } - - if (blocksout >= linelen / 4 || srcpos >= srclen) - { - if (blocksout > 0 && dstpos < dstlen) - dst[dstpos++] = '\n'; - - blocksout = 0; - } - } - - dst[dstpos] = '\0'; - return dst; -} - -static void b64_decode_block(char in[4], char out[3]) -{ - out[0] = (char)(in[0] << 2 | in[1] >> 4); - out[1] = (char)(in[1] << 4 | in[2] >> 2); - out[2] = (char)(((in[2] << 6) & 0xc0) | in[3]); -} - -char *b64_decode(const char *src, size_t srclen, size_t &size) -{ - size_t paddedsize = (srclen / 4) * 3; - - char *dst = nullptr; - try - { - dst = new char[paddedsize]; - } - catch (std::exception &) - { - throw love::Exception("Out of memory."); - } - - char *d = dst; - - char in[4] = {0}; - char out[3] = {0}; - size_t i, len, srcpos = 0; - - while (srcpos <= srclen) - { - for (len = 0, i = 0; i < 4 && srcpos <= srclen; i++) - { - char v = 0; - - while (srcpos <= srclen && v == 0) - { - v = src[srcpos++]; - v = (char)((v < 43 || v > 122) ? 0 : cd64[v - 43]); - if (v != 0) - v = (char)((v == '$') ? 0 : v - 61); - } - - if (srcpos <= srclen) - { - len++; - if (v != 0) - in[i] = (char)(v - 1); - } - else - in[i] = 0; - } - - if (len) - { - b64_decode_block(in, out); - for (i = 0; i < len - 1; i++) - *(d++) = out[i]; - } - } - - size = (size_t)(ptrdiff_t) (d - dst); - return dst; -} - -} // love diff --git a/love/src/jni/love/src/common/b64.h b/love/src/jni/love/src/common/b64.h deleted file mode 100644 index 01e0ea5f..00000000 --- a/love/src/jni/love/src/common/b64.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "config.h" - -#include - -#ifndef LOVE_B64_H -#define LOVE_B64_H - -namespace love -{ - -/** - * Base64-encode data. - * - * @param src The data to encode. - * @param srclen The size in bytes of the data. - * @param linelen The maximum length of each line in the encoded string. - * 0 indicates no maximum length. - * @param dstlen The length of the encoded string is stored here. - * @return A string containing the base64-encoded data (allocated with new[]). - */ -char *b64_encode(const char *src, size_t srclen, size_t linelen, size_t &dstlen); - -/** - * Decode base64 encoded data. - * - * @param src The string containing the base64 data. - * @param srclen The length of the string. - * @param dstlen The size of the binary data is stored here. - * @return A chunk of memory containing the binary data (allocated with new[]). - */ -char *b64_decode(const char *src, size_t srclen, size_t &dstlen); - -} // love - -#endif // LOVE_B64_H diff --git a/love/src/jni/love/src/common/config.h b/love/src/jni/love/src/common/config.h deleted file mode 100644 index 8180f6ae..00000000 --- a/love/src/jni/love/src/common/config.h +++ /dev/null @@ -1,174 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_CONFIG_H -#define LOVE_CONFIG_H - -// Platform stuff. -#if defined(WIN32) || defined(_WIN32) -# define LOVE_WINDOWS 1 - // If _USING_V110_SDK71_ is defined it means we are using the xp toolset. -# if defined(_MSC_VER) && (_MSC_VER >= 1700) && !_USING_V110_SDK71_ -# include -# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) -# define LOVE_WINDOWS_UWP 1 -# define LOVE_NO_MODPLUG 1 -# define LOVE_NOMPG123 1 -# endif -# endif -#endif -#if defined(linux) || defined(__linux) || defined(__linux__) -# define LOVE_LINUX 1 -#endif -#if defined(__ANDROID__) -# define LOVE_ANDROID 1 -#endif -#if defined(__APPLE__) -# include -# if TARGET_OS_IPHONE -# define LOVE_IOS 1 -# elif TARGET_OS_MAC -# define LOVE_MACOSX 1 -# endif -#endif -#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) -// I know it's not linux, but it seems most "linux-only" code is bsd-compatible -# define LOVE_LINUX 1 -#endif - -// Endianness. -#if defined(__ppc__) || defined(__ppc) || defined(__powerpc__) || defined(__powerpc) -# define LOVE_BIG_ENDIAN 1 -#else -# define LOVE_LITTLE_ENDIAN 1 -#endif - -// SSE instructions. -#if defined(__SSE__) -# define LOVE_SIMD_SSE -#elif defined(_MSC_VER) -# if defined(_M_AMD64) || defined(_M_X64) -# define LOVE_SIMD_SSE -# elif _M_IX86_FP -# define LOVE_SIMD_SSE -# endif -#endif - -// NEON instructions. -#if defined(__ARM_NEON) -# define LOVE_SIMD_NEON -#endif - -// Warnings. -#ifndef _CRT_SECURE_NO_WARNINGS -# define _CRT_SECURE_NO_WARNINGS -#endif - -// Preferably, and ironically, this macro should go unused. -#ifndef LOVE_UNUSED -# define LOVE_UNUSED(x) (void)sizeof(x) -#endif - - -// Warn on unused return values -#ifdef __GNUC__ -# define LOVE_WARN_UNUSED __attribute__((warn_unused_result)) -#elif _MSC_VER -# define LOVE_WARN_UNUSED _Check_return_ -#else -# define LOVE_WARN_UNUSED -#endif - -#ifndef LOVE_BUILD -# define LOVE_BUILD -# define LOVE_BUILD_STANDALONE -# define LOVE_BUILD_EXE -//# define LOVE_BUILD_DLL -#endif - -// DLL-stuff. -#ifdef LOVE_WINDOWS -# define LOVE_EXPORT __declspec(dllexport) -#else -# define LOVE_EXPORT -#endif - -#if defined(LOVE_WINDOWS) -#ifndef LOVE_WINDOWS_UWP -# define LOVE_LEGENDARY_CONSOLE_IO_HACK -#endif // LOVE_WINDOWS_UWP -# define NOMINMAX -#endif - -#if defined(LOVE_MACOSX) || defined(LOVE_IOS) -# define LOVE_LEGENDARY_APP_ARGV_HACK -#endif - -#if defined(LOVE_ANDROID) || defined(LOVE_IOS) -# define LOVE_LEGENDARY_ACCELEROMETER_AS_JOYSTICK_HACK -#endif - -// Autotools config.h -#ifdef HAVE_CONFIG_H -# include <../config.h> -# undef VERSION -# ifdef WORDS_BIGENDIAN -# undef LOVE_LITTLE_ENDIAN -# define LOVE_BIG_ENDIAN 1 -# else -# undef LOVE_BIG_ENDIAN -# define LOVE_LITTLE_ENDIAN 1 -# endif -#else -# define LOVE_ENABLE_LOVE -# define LOVE_ENABLE_AUDIO -# define LOVE_ENABLE_DATA -# define LOVE_ENABLE_EVENT -# define LOVE_ENABLE_FILESYSTEM -# define LOVE_ENABLE_FONT -# define LOVE_ENABLE_GRAPHICS -# define LOVE_ENABLE_IMAGE -# define LOVE_ENABLE_JOYSTICK -# define LOVE_ENABLE_KEYBOARD -# define LOVE_ENABLE_MATH -# define LOVE_ENABLE_MOUSE -# define LOVE_ENABLE_PHYSICS -# define LOVE_ENABLE_SOUND -# define LOVE_ENABLE_SYSTEM -# define LOVE_ENABLE_THREAD -# define LOVE_ENABLE_TIMER -# define LOVE_ENABLE_TOUCH -# define LOVE_ENABLE_VIDEO -# define LOVE_ENABLE_WINDOW - -# define LOVE_ENABLE_ENET -# define LOVE_ENABLE_LUASOCKET -# define LOVE_ENABLE_LUA53 -#endif - -// Check we have a sane configuration -#if !defined(LOVE_WINDOWS) && !defined(LOVE_LINUX) && !defined(LOVE_IOS) && !defined(LOVE_MACOSX) && !defined(LOVE_ANDROID) -# error Could not detect target platform -#endif -#if !defined(LOVE_LITTLE_ENDIAN) && !defined(LOVE_BIG_ENDIAN) -# error Could not detect endianness -#endif - -#endif // LOVE_CONFIG_H diff --git a/love/src/jni/love/src/common/delay.cpp b/love/src/jni/love/src/common/delay.cpp deleted file mode 100644 index e803fc6d..00000000 --- a/love/src/jni/love/src/common/delay.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "delay.h" - -#include - -namespace love -{ - -void sleep(unsigned int ms) -{ - // We don't need to initialize the SDL timer subsystem for SDL_Delay to - // function - and doing so causes SDL to create a worker thread. - SDL_Delay(ms); -} - -} // love diff --git a/love/src/jni/love/src/common/delay.h b/love/src/jni/love/src/common/delay.h deleted file mode 100644 index 1974da66..00000000 --- a/love/src/jni/love/src/common/delay.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef DELAY_H_ -#define DELAY_H_ - -namespace love -{ - -void sleep(unsigned int ms); - -} // namespace love - -#endif // DELAY_H_ diff --git a/love/src/jni/love/src/common/deprecation.cpp b/love/src/jni/love/src/common/deprecation.cpp deleted file mode 100644 index 1efb2952..00000000 --- a/love/src/jni/love/src/common/deprecation.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "common/config.h" -#include "deprecation.h" -#include "thread/threads.h" - -#include -#include - -namespace love -{ - -static std::map *deprecated = nullptr; -static std::vector *deprecatedList = nullptr; - -static std::atomic initCount; - -static thread::Mutex *mutex = nullptr; -static bool outputEnabled = false; - -void initDeprecation() -{ - if (initCount.fetch_add(1) == 0) - { - mutex = thread::newMutex(); - - // These are heap-allocated because we want to clear them on deinit, - // and deinit may be called when the program is shutting down in the - // middle of static variable cleanup (eg in the Math module destructor). - // Calling std::map::clear() in that case was causing segfaults. - deprecated = new std::map(); - deprecatedList = new std::vector(); - } -} - -void deinitDeprecation() -{ - if (initCount.fetch_sub(1) == 1) - { - delete deprecated; - delete deprecatedList; - delete mutex; - - deprecated = nullptr; - deprecatedList = nullptr; - mutex = nullptr; - } -} - -static void printDeprecationNotice(const DeprecationInfo &info) -{ - std::string notice = getDeprecationNotice(info, true); - printf("LOVE - Warning: %s\n", notice.c_str()); -} - -void setDeprecationOutputEnabled(bool enable) -{ - if (enable == outputEnabled) - return; - - outputEnabled = enable; - - if (enable) - { - GetDeprecated deprecated; - - for (const DeprecationInfo *info : deprecated.all) - { - if (info->uses == 1) - printDeprecationNotice(*info); - } - } -} - -bool isDeprecationOutputEnabled() -{ - return outputEnabled; -} - -std::string getDeprecationNotice(const DeprecationInfo &info, bool usewhere) -{ - std::string notice; - - if (usewhere) - notice += info.where; - - notice += "Using deprecated "; - - if (info.apiType == API_FUNCTION) - notice += "function "; - else if (info.apiType == API_METHOD) - notice += "method "; - else if (info.apiType == API_FIELD) - notice += "field "; - else if (info.apiType == API_CONSTANT) - notice += "constant "; - else - notice += "API "; - - notice += info.name; - - if (info.type == DEPRECATED_REPLACED && !info.replacement.empty()) - notice += " (replaced by " + info.replacement + ")"; - else if (info.type == DEPRECATED_RENAMED && !info.replacement.empty()) - notice += " (renamed to " + info.replacement + ")"; - - return notice; -} - -GetDeprecated::GetDeprecated() - : all(*deprecatedList) -{ - if (mutex != nullptr) - mutex->lock(); -} - -GetDeprecated::~GetDeprecated() -{ - if (mutex != nullptr) - mutex->unlock(); -} - -MarkDeprecated::MarkDeprecated(const char *name, APIType api) - : MarkDeprecated(name, api, DEPRECATED_NO_REPLACEMENT, nullptr) -{ -} - -MarkDeprecated::MarkDeprecated(const char *name, APIType api, DeprecationType type, const char *replacement) - : info(nullptr) -{ - if (mutex != nullptr) - mutex->lock(); - - auto it = deprecated->find(name); - - if (it != deprecated->end()) - { - it->second.uses++; - info = &it->second; - } - else - { - DeprecationInfo newinfo = {}; - - newinfo.type = type; - newinfo.apiType = api; - newinfo.uses = 1; - newinfo.name = name; - - if (replacement != nullptr) - newinfo.replacement = replacement; - - auto inserted = deprecated->insert(std::make_pair(newinfo.name, newinfo)); - - info = &inserted.first->second; - deprecatedList->push_back(info); - } -} - -MarkDeprecated::~MarkDeprecated() -{ - if (outputEnabled && info != nullptr && info->uses == 1) - printDeprecationNotice(*info); - - if (mutex != nullptr) - mutex->unlock(); -} - -} // love diff --git a/love/src/jni/love/src/common/deprecation.h b/love/src/jni/love/src/common/deprecation.h deleted file mode 100644 index 4d81e156..00000000 --- a/love/src/jni/love/src/common/deprecation.h +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#pragma once - -#include "int.h" - -#include -#include - -namespace love -{ - -enum APIType -{ - API_FUNCTION, - API_METHOD, - API_FIELD, - API_CONSTANT, -}; - -enum DeprecationType -{ - DEPRECATED_NO_REPLACEMENT, - DEPRECATED_REPLACED, - DEPRECATED_RENAMED, -}; - -struct DeprecationInfo -{ - DeprecationType type; - APIType apiType; - int64 uses; - std::string name; - std::string replacement; - std::string where; -}; - -void initDeprecation(); -void deinitDeprecation(); - -void setDeprecationOutputEnabled(bool enable); -bool isDeprecationOutputEnabled(); - -std::string getDeprecationNotice(const DeprecationInfo &info, bool usewhere); - -struct GetDeprecated -{ - GetDeprecated(); - ~GetDeprecated(); - - const std::vector &all; -}; - -struct MarkDeprecated -{ - MarkDeprecated(const char *name, APIType api); - MarkDeprecated(const char *name, APIType api, DeprecationType type, const char *replacement); - ~MarkDeprecated(); - - DeprecationInfo *info; -}; - -} // love diff --git a/love/src/jni/love/src/common/halffloat.cpp b/love/src/jni/love/src/common/halffloat.cpp deleted file mode 100644 index 59eaacf5..00000000 --- a/love/src/jni/love/src/common/halffloat.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "halffloat.h" - -namespace love -{ - -// Code from ftp://www.fox-toolkit.org/pub/fasthalffloatconversion.pdf - -static bool initialized = false; - -// tables for half -> float conversions -static uint32 mantissatable[2048]; -static uint16 offsettable[64]; -static uint32 exponenttable[64]; - -// tables for float -> half conversions -static uint16 basetable[512]; -static uint8 shifttable[512]; - - -static uint32 convertMantissa(uint32 i) -{ - uint32 m = i << 13; // Zero pad mantissa bits - uint32 e = 0; // Zero exponent - - while (!(m & 0x00800000)) // While not normalized - { - e -= 0x00800000; // Decrement exponent (1<<23) - m <<= 1; // Shift mantissa - } - - m &= ~(0x00800000); // Clear leading 1 bit - e += 0x38800000; // Adjust bias ((127-14)<<23) - - return m | e; // Return combined number -} - -void halfInit() -{ - if (initialized) - return; - - initialized = true; - - - // tables for half -> float conversions. - - mantissatable[0] = 0; - - for (uint32 i = 1; i < 1024; i++) - mantissatable[i] = convertMantissa(i); - - for (uint32 i = 1024; i < 2048; i++) - mantissatable[i] = 0x38000000 + ((i - 1024) << 13); - - exponenttable[0] = 0; - exponenttable[32] = 0x80000000; - - for (uint32 i = 0; i < 31; i++) - exponenttable[i] = i << 23; - - for (uint32 i = 33; i < 63; i++) - exponenttable[i] = 0x80000000 + ((i - 32) << 23); - - exponenttable[31] = 0x47800000; - exponenttable[63] = 0xC7800000; - - for (int i = 0; i < 64; i++) - { - if (i == 0 || i == 32) - offsettable[i] = 0; - else - offsettable[i] = 1024; - } - - - // tables for float -> half conversions. - - for (uint32 i = 0; i < 256; i++) - { - int e = (int) i - 127; - - if (e < -24) // Very small numbers map to zero - { - basetable[i | 0x000] = 0x0000; - basetable[i | 0x100] = 0x8000; - shifttable[i | 0x000] = 24; - shifttable[i | 0x100] = 24; - } - else if (e < -14) // Small numbers map to denorms - { - basetable[i | 0x000] = (0x0400 >> (-e - 14)); - basetable[i | 0x100] = (0x0400 >> (-e - 14)) | 0x8000; - shifttable[i | 0x000] = -e - 1; - shifttable[i | 0x100] = -e - 1; - } - else if (e <= 15) // Normal numbers just lose precision - { - basetable[i | 0x000] = ((e + 15) << 10); - basetable[i | 0x100] = ((e + 15) << 10) | 0x8000; - shifttable[i | 0x000] = 13; - shifttable[i | 0x100] = 13; - } - else if (e < 128) // Large numbers map to Infinity - { - basetable[i | 0x000] = 0x7C00; - basetable[i | 0x100] = 0xFC00; - shifttable[i | 0x000] = 24; - shifttable[i | 0x100] = 24; - } - else // Infinity and NaN's stay Infinity and NaN's - { - basetable[i | 0x000] = 0x7C00; - basetable[i | 0x100] = 0xFC00; - shifttable[i | 0x000] = 13; - shifttable[i | 0x100] = 13; - } - } -} - -float halfToFloat(half h) -{ - union { float f; uint32 i; } conv; - - conv.i = mantissatable[offsettable[h >> 10] + (h & 0x3FF)] + exponenttable[h >> 10]; - return conv.f; -} - -half floatToHalf(float f) -{ - union { float f; uint32 i; } conv; - conv.f = f; - - return basetable[(conv.i >> 23) & 0x1FF] + ((conv.i & 0x007FFFFF) >> shifttable[(conv.i >> 23) & 0x1FF]); -} - -} // love diff --git a/love/src/jni/love/src/common/halffloat.h b/love/src/jni/love/src/common/halffloat.h deleted file mode 100644 index 6a300670..00000000 --- a/love/src/jni/love/src/common/halffloat.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_HALF_FLOAT_H -#define LOVE_HALF_FLOAT_H - -#include "int.h" - -namespace love -{ - -typedef uint16 half; - -void halfInit(); - -float halfToFloat(half h); -half floatToHalf(float f); - -} // love - -#endif // LOVE_HALF_FLOAT_H diff --git a/love/src/jni/love/src/common/int.h b/love/src/jni/love/src/common/int.h deleted file mode 100644 index 4d1ba21c..00000000 --- a/love/src/jni/love/src/common/int.h +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_INT_H -#define LOVE_INT_H - -// C standard sized integer types. -#include - -#define LOVE_INT8_MAX 0x7F -#define LOVE_UINT8_MAX 0xFF -#define LOVE_INT16_MAX 0x7FFF -#define LOVE_UINT16_MAX 0xFFFF -#define LOVE_INT32_MAX 0x7FFFFFFF -#define LOVE_UINT32_MAX 0xFFFFFFFF -#define LOVE_INT64_MAX 0x7FFFFFFFFFFFFFFF -#define LOVE_UINT64_MAX 0xFFFFFFFFFFFFFFFF - -namespace love -{ - -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; - -static inline uint16 swapuint16(uint16 x) -{ - return (x >> 8) | (x << 8); -} - -static inline uint32 swapuint32(uint32 x) -{ - return ((x & 0x000000FF) << 24) | - ((x & 0x0000FF00) << 8) | - ((x & 0x00FF0000) >> 8) | - ((x & 0xFF000000) >> 24); -} - -static inline uint64 swapuint64(uint64 x) -{ - return ((x << 56) & 0xFF00000000000000ULL) | ((x << 40) & 0x00FF000000000000ULL) | - ((x << 24) & 0x0000FF0000000000ULL) | ((x << 8) & 0x000000FF00000000ULL) | - ((x >> 8) & 0x00000000FF000000ULL) | ((x >> 24) & 0x0000000000FF0000ULL) | - ((x >> 40) & 0x000000000000FF00ULL) | ((x >> 56) & 0x00000000000000FFULL); -} - -} // love - -#endif // LOVE_INT_H diff --git a/love/src/jni/love/src/common/ios.h b/love/src/jni/love/src/common/ios.h deleted file mode 100644 index 1b973094..00000000 --- a/love/src/jni/love/src/common/ios.h +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_IOS_H -#define LOVE_IOS_H - -#include "config.h" - -#ifdef LOVE_IOS - -#include - -namespace love -{ -namespace ios -{ - -/** - * Gets the filepath of the first detected love file. The main .app Bundle is - * searched first, and then the app's Documents folder. - **/ -std::string getLoveInResources(bool &fused); - -/** - * Gets the directory path where files should be stored. - **/ -std::string getAppdataDirectory(); - -/** - * Get the home directory (on iOS, this really means the app's sandbox dir.) - **/ -std::string getHomeDirectory(); - -/** - * Opens the specified URL with the default program associated with the URL's - * scheme. - **/ -bool openURL(const std::string &url); - -/** - * Returns the full path to the executable. - **/ -std::string getExecutablePath(); - -/** - * Causes devices with vibration support to vibrate for about 0.5 seconds. - **/ -void vibrate(); - -/** - * Enable mix mode (e.g. with background music apps) and playback with a muted device. - **/ -void setAudioMixWithOthers(bool mixEnabled); - -/** - * Returns whether another application is playing audio. - **/ -bool hasBackgroundMusic(); - -} // ios -} // love - -#endif // LOVE_IOS -#endif // LOVE_IOS_H diff --git a/love/src/jni/love/src/common/ios.mm b/love/src/jni/love/src/common/ios.mm deleted file mode 100644 index ff540620..00000000 --- a/love/src/jni/love/src/common/ios.mm +++ /dev/null @@ -1,373 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "ios.h" - -#ifdef LOVE_IOS - -#import -#import - -#import -#import - -#include - -#include - -static NSArray *getLovesInDocuments(); -static bool deleteFileInDocuments(NSString *filename); - -@interface LOVETableViewController : UITableViewController - -- (instancetype)initWithGameList:(NSArray *)list; - -@property (nonatomic) NSMutableArray *gameList; -@property (nonatomic, readonly, copy) NSString *selectedGame; - -@end - -@implementation LOVETableViewController - -- (instancetype)initWithGameList:(NSArray *)list -{ - if ((self = [super init])) - { - _gameList = [[NSMutableArray alloc] initWithArray:list copyItems:YES]; - - self.title = @"LÖVE Games"; - self.navigationItem.rightBarButtonItem = self.editButtonItem; - } - - return self; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ - #pragma unused(tableView) - #pragma unused(section) - // We want to list all games plus the no-game screen. - return self.gameList.count + 1; -} - -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath -{ - static NSString *cellIdentifier = @"LOVETableCell"; - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; - if (cell == nil) - cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; - - if (indexPath.row < (NSInteger) self.gameList.count) - cell.textLabel.text = self.gameList[indexPath.row]; - else - cell.textLabel.text = @"No-game screen"; - - return cell; -} - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath -{ - #pragma unused(tableView) - if (indexPath.row < (NSInteger) self.gameList.count) - _selectedGame = [(NSString *)(self.gameList[indexPath.row]) copy]; - else - { - // We test against nil to check if a game has been selected, so we'll - // just use an empty string instead to represent the no-game screen. - _selectedGame = @""; - } -} - -- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath -{ - if (editingStyle != UITableViewCellEditingStyleDelete) - return; - - if (indexPath.row >= (NSInteger) self.gameList.count) - return; - - NSString *filename = self.gameList[indexPath.row]; - - // Delete the file. - if (deleteFileInDocuments(filename)) - { - [self.gameList removeObjectAtIndex:indexPath.row]; - [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; - } -} - -- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath; -{ - #pragma unused(tableView) - // The no-game screen isn't removable. - return indexPath.row < (NSInteger) self.gameList.count; -} - -@end - -static NSString *getDocumentsDirectory() -{ - NSArray *docdirs = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); - return docdirs[0]; -} - -static NSArray *getLovesInDocuments() -{ - NSMutableArray *paths = [NSMutableArray new]; - - NSFileManager *manager = [NSFileManager defaultManager]; - NSDirectoryEnumerator *enumerator = [manager enumeratorAtPath:getDocumentsDirectory()]; - - NSString *path = nil; - while ((path = [enumerator nextObject])) - { - // Add .love files plus folders that contain main.lua to our list. - if ([path.pathExtension isEqualToString:@"love"]) - [paths addObject:path]; - else if ([path.lastPathComponent isEqualToString:@"main.lua"]) - [paths addObject:path.stringByDeletingLastPathComponent]; - } - - return paths; -} - -static bool deleteFileInDocuments(NSString *filename) -{ - NSString *documents = getDocumentsDirectory(); - - NSString *file = [documents stringByAppendingPathComponent:filename]; - bool success = [[NSFileManager defaultManager] removeItemAtPath:file error:nil]; - - if (success) - NSLog(@"Deleted file %@ in Documents folder.", filename); - - return success; -} - -static int dropFileEventFilter(void *userdata, SDL_Event *event) -{ - @autoreleasepool - { - if (event->type != SDL_DROPFILE) - return 1; - - NSString *fname = @(event->drop.file); - NSFileManager *fmanager = [NSFileManager defaultManager]; - - if ([fmanager fileExistsAtPath:fname] && [fname.pathExtension isEqual:@"love"]) - { - NSString *documents = getDocumentsDirectory(); - - documents = documents.stringByStandardizingPath.stringByResolvingSymlinksInPath; - fname = fname.stringByStandardizingPath.stringByResolvingSymlinksInPath; - - // Is the file inside the Documents directory? - if ([fname hasPrefix:documents]) - { - LOVETableViewController *vc = (__bridge LOVETableViewController *) userdata; - - // Update the game list. - NSArray *games = getLovesInDocuments(); - vc.gameList = [[NSMutableArray alloc] initWithArray:games copyItems:YES]; - [vc.tableView reloadData]; - - SDL_free(event->drop.file); - return 0; - } - } - - return 1; - } -} - -namespace love -{ -namespace ios -{ - -/** - * Displays a full-screen list of available LOVE games for the user to choose. - * Returns the index of the selected game from the list. The list of games - * includes the no-game screen, and the function will return an index outside - * of the array's range if that is selected. - **/ -static NSString *showGameList(NSArray *filenames) -{ - // Game list view controller. - LOVETableViewController *tablecontroller = [[LOVETableViewController alloc] initWithGameList:filenames]; - - // Navigation view controller (only used for the header bar right now.) - // Contains the game list view/controller. - UINavigationController *navcontroller = [[UINavigationController alloc] initWithRootViewController:tablecontroller]; - - UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - window.rootViewController = navcontroller; - - SDL_EventFilter oldfilter = nullptr; - void *oldudata = nullptr; - SDL_GetEventFilter(&oldfilter, &oldudata); - - // Manually retain the table VC and use it for the event filter userdata. - // We need to set a custom event filter to update the table when .love files - // are opened by the user. - void *tableudata = (void *) CFBridgingRetain(tablecontroller); - SDL_SetEventFilter(dropFileEventFilter, tableudata); - - [window makeKeyAndVisible]; - - // Process events until a game in the list is selected. - NSRunLoop *runloop = [NSRunLoop currentRunLoop]; - while (tablecontroller.selectedGame == nil) - { - [runloop runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantPast]]; - [runloop runMode:UITrackingRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:1.0/60.0]]; - } - - // The window will get released and cleaned up once we go out of scope. - window.hidden = YES; - - SDL_SetEventFilter(oldfilter, oldudata); - CFBridgingRelease(tableudata); - - return tablecontroller.selectedGame; -} - -std::string getLoveInResources(bool &fused) -{ - fused = false; - std::string path; - - @autoreleasepool - { - // Start by looking in the main bundle (.app) folder for .love files. - NSArray *bundlepaths = [[NSBundle mainBundle] pathsForResourcesOfType:@"love" inDirectory:nil]; - - if (bundlepaths.count > 0) - { - // The game should be fused if we have something here. - fused = true; - return [bundlepaths[0] UTF8String]; - } - - // Otherwise look in the app's Documents directory. The game won't be - // fused. - NSArray *filepaths = getLovesInDocuments(); - - // Let the user select a game from the un-fused list. - NSString *selectedfile = showGameList(filepaths); - - // The string length might be 0 if the no-game screen was selected. - if (selectedfile != nil && selectedfile.length > 0) - { - NSString *documents = getDocumentsDirectory(); - path = [documents stringByAppendingPathComponent:selectedfile].UTF8String; - } - } - - return path; -} - -std::string getAppdataDirectory() -{ - NSSearchPathDirectory searchdir = NSApplicationSupportDirectory; - std::string path; - - @autoreleasepool - { - NSArray *dirs = NSSearchPathForDirectoriesInDomains(searchdir, NSUserDomainMask, YES); - - if (dirs.count > 0) - path = [dirs[0] UTF8String]; - } - - return path; -} - -std::string getHomeDirectory() -{ - std::string path; - - @autoreleasepool - { - path = [NSHomeDirectory() UTF8String]; - } - - return path; -} - -bool openURL(const std::string &url) -{ - bool success = false; - - @autoreleasepool - { - UIApplication *app = [UIApplication sharedApplication]; - NSURL *nsurl = [NSURL URLWithString:@(url.c_str())]; - - if ([app canOpenURL:nsurl]) - success = [app openURL:nsurl]; - } - - return success; -} - -std::string getExecutablePath() -{ - @autoreleasepool - { - return std::string([NSBundle mainBundle].executablePath.UTF8String); - } -} - -void vibrate() -{ - @autoreleasepool - { - AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); - } -} - -void setAudioMixWithOthers(bool mixEnabled) -{ - @autoreleasepool - { - NSString *category = AVAudioSessionCategorySoloAmbient; - NSError *err; - - if (mixEnabled) - category = AVAudioSessionCategoryAmbient; - - if (![[AVAudioSession sharedInstance] setCategory:category error:&err]) - NSLog(@"Error in AVAudioSession setCategory: %@", [err localizedDescription]); - } -} - -bool hasBackgroundMusic() -{ - if ([[AVAudioSession sharedInstance] respondsToSelector:@selector(secondaryAudioShouldBeSilencedHint)]) - return [[AVAudioSession sharedInstance] secondaryAudioShouldBeSilencedHint]; - return false; -} - -} // ios -} // love - -#endif // LOVE_IOS diff --git a/love/src/jni/love/src/common/macosx.h b/love/src/jni/love/src/common/macosx.h deleted file mode 100644 index e539c88d..00000000 --- a/love/src/jni/love/src/common/macosx.h +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_OSX_H -#define LOVE_OSX_H - -#include "config.h" - -#ifdef LOVE_MACOSX - -#include - -namespace love -{ -namespace macosx -{ - -/** - * Returns the filepath of the first detected love file in the Resources folder - * in the main bundle (love.app.) - * Returns an empty string if no love file is found. - **/ -std::string getLoveInResources(); - -/** - * Checks for drop-file events. Returns the filepath if an event occurred, or - * an empty string otherwise. - **/ -std::string checkDropEvents(); - -/** - * Returns the full path to the executable. - **/ -std::string getExecutablePath(); - -/** - * Bounce the dock icon, if the app isn't in the foreground. - **/ -void requestAttention(bool continuous); - -} // macosx -} // love - -#endif // LOVE_MACOSX - -#endif // LOVE_OSX_H diff --git a/love/src/jni/love/src/common/macosx.mm b/love/src/jni/love/src/common/macosx.mm deleted file mode 100644 index 597a2eb7..00000000 --- a/love/src/jni/love/src/common/macosx.mm +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "macosx.h" - -#ifdef LOVE_MACOSX - -#import -#import - -#ifdef LOVE_MACOSX_SDL_DIRECT_INCLUDE -# include -#else -# include -#endif - -namespace love -{ -namespace macosx -{ - -std::string getLoveInResources() -{ - std::string path; - - @autoreleasepool - { - // Check to see if there are any .love files in Resources. - NSString *lovepath = [[NSBundle mainBundle] pathForResource:nil ofType:@"love"]; - - if (lovepath != nil) - path = lovepath.UTF8String; - } - - return path; -} - -std::string checkDropEvents() -{ - std::string dropstr; - SDL_Event event; - - SDL_InitSubSystem(SDL_INIT_VIDEO); - - SDL_PumpEvents(); - if (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_DROPFILE, SDL_DROPFILE) > 0) - { - if (event.type == SDL_DROPFILE) - { - dropstr = std::string(event.drop.file); - SDL_free(event.drop.file); - } - } - - SDL_QuitSubSystem(SDL_INIT_VIDEO); - - return dropstr; -} - -std::string getExecutablePath() -{ - @autoreleasepool - { - return std::string([NSBundle mainBundle].executablePath.UTF8String); - } -} - -void requestAttention(bool continuous) -{ - @autoreleasepool - { - if (continuous) - [NSApp requestUserAttention:NSCriticalRequest]; - else - [NSApp requestUserAttention:NSInformationalRequest]; - } -} - -} // osx -} // love - -#endif // LOVE_MACOSX diff --git a/love/src/jni/love/src/common/math.h b/love/src/jni/love/src/common/math.h deleted file mode 100644 index ac2631f2..00000000 --- a/love/src/jni/love/src/common/math.h +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_MATH_H -#define LOVE_MATH_H - -#include // for CHAR_BIT -#include // for rand() and RAND_MAX - -/* Definitions of useful mathematical constants - * M_E - e - * M_LOG2E - log2(e) - * M_LOG10E - log10(e) - * M_LN2 - ln(2) - * M_LN10 - ln(10) - * M_PI - pi - * M_PI_2 - pi/2 - * M_PI_4 - pi/4 - * M_1_PI - 1/pi - * M_2_PI - 2/pi - * M_2_SQRTPI - 2/sqrt(pi) - * M_SQRT2 - sqrt(2) - * M_SQRT1_2 - 1/sqrt(2) - */ - -#define LOVE_M_E 2.71828182845904523536 -#define LOVE_M_LOG2E 1.44269504088896340736 -#define LOVE_M_LOG10E 0.434294481903251827651 -#define LOVE_M_LN2 0.693147180559945309417 -#define LOVE_M_LN10 2.30258509299404568402 -#define LOVE_M_PI 3.14159265358979323846 -#define LOVE_M_PI_2 1.57079632679489661923 -#define LOVE_M_PI_4 0.785398163397448309616 -#define LOVE_M_1_PI 0.318309886183790671538 -#define LOVE_M_2_PI 0.636619772367581343076 -#define LOVE_M_2_SQRTPI 1.12837916709551257390 -#define LOVE_M_SQRT2 1.41421356237309504880 -#define LOVE_M_SQRT1_2 0.707106781186547524401 -#define LOVE_M_TORAD (float)(LOVE_M_PI/180.0) -#define LOVE_M_TODEG (float)(180.0/LOVE_M_PI) -#define LOVE_TORAD(x) (float)(x*LOVE_M_TORAD) -#define LOVE_TODEG(x) (float)(x*LOVE_M_TODEG) - -namespace love -{ - -struct Rect -{ - int x, y; - int w, h; - - bool operator == (const Rect &rhs) const - { - return x == rhs.x && y == rhs.y && w == rhs.w && h == rhs.h; - } -}; - -inline int nextP2(int x) -{ - x += (x == 0); - x--; - for (unsigned int i = 1; i < sizeof(int)*CHAR_BIT; i <<= 1) x |= x >> i; - return ++x; -} - -inline float nextP2(float x) -{ - return (float) nextP2((int) x); -} - -} // love - -#endif // LOVE_MATH_H diff --git a/love/src/jni/love/src/common/memory.cpp b/love/src/jni/love/src/common/memory.cpp deleted file mode 100644 index 33c75690..00000000 --- a/love/src/jni/love/src/common/memory.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "config.h" -#include "memory.h" - -#include - -#ifdef LOVE_WINDOWS -#include -#else -#include // Assume POSIX support. -#endif - -namespace love -{ - -bool alignedMalloc(void **mem, size_t size, size_t alignment) -{ -#ifdef LOVE_WINDOWS - *mem = _aligned_malloc(size, alignment); - return *mem != nullptr; -#else - return posix_memalign(mem, alignment, size) == 0; -#endif -} - -void alignedFree(void *mem) -{ -#ifdef LOVE_WINDOWS - _aligned_free(mem); -#else - free(mem); -#endif -} - -size_t getPageSize() -{ -#ifdef LOVE_WINDOWS - // TODO: Do an actual query. - return 4096; -#else - static const long size = sysconf(_SC_PAGESIZE); - return size > 0 ? (size_t) size : 4096; -#endif -} - -size_t alignUp(size_t size, size_t alignment) -{ - return (size + alignment - 1) & (~(alignment - 1)); -} - -} // love diff --git a/love/src/jni/love/src/common/memory.h b/love/src/jni/love/src/common/memory.h deleted file mode 100644 index 5cbba334..00000000 --- a/love/src/jni/love/src/common/memory.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#pragma once - -#include - -namespace love -{ - -bool alignedMalloc(void **mem, size_t size, size_t alignment); -void alignedFree(void *mem); - -size_t getPageSize(); - -/** - * 'alignment' must be a power of two. - **/ -size_t alignUp(size_t size, size_t alignment); - -} // love diff --git a/love/src/jni/love/src/common/pixelformat.cpp b/love/src/jni/love/src/common/pixelformat.cpp deleted file mode 100644 index 99457068..00000000 --- a/love/src/jni/love/src/common/pixelformat.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "pixelformat.h" -#include "StringMap.h" - -namespace love -{ - -static StringMap::Entry formatEntries[] = -{ - { "unknown", PIXELFORMAT_UNKNOWN }, - - { "normal", PIXELFORMAT_NORMAL }, - { "hdr", PIXELFORMAT_HDR }, - - { "r8", PIXELFORMAT_R8 }, - { "rg8", PIXELFORMAT_RG8 }, - { "rgba8", PIXELFORMAT_RGBA8 }, - { "srgba8", PIXELFORMAT_sRGBA8 }, - { "r16", PIXELFORMAT_R16 }, - { "rg16", PIXELFORMAT_RG16 }, - { "rgba16", PIXELFORMAT_RGBA16 }, - { "r16f", PIXELFORMAT_R16F }, - { "rg16f", PIXELFORMAT_RG16F }, - { "rgba16f", PIXELFORMAT_RGBA16F }, - { "r32f", PIXELFORMAT_R32F }, - { "rg32f", PIXELFORMAT_RG32F }, - { "rgba32f", PIXELFORMAT_RGBA32F }, - - { "la8", PIXELFORMAT_LA8 }, - - { "rgba4", PIXELFORMAT_RGBA4 }, - { "rgb5a1", PIXELFORMAT_RGB5A1 }, - { "rgb565", PIXELFORMAT_RGB565 }, - { "rgb10a2", PIXELFORMAT_RGB10A2 }, - { "rg11b10f", PIXELFORMAT_RG11B10F }, - - { "stencil8", PIXELFORMAT_STENCIL8 }, - { "depth16", PIXELFORMAT_DEPTH16 }, - { "depth24", PIXELFORMAT_DEPTH24 }, - { "depth32f", PIXELFORMAT_DEPTH32F }, - { "depth24stencil8", PIXELFORMAT_DEPTH24_STENCIL8 }, - { "depth32fstencil8", PIXELFORMAT_DEPTH32F_STENCIL8 }, - - { "DXT1", PIXELFORMAT_DXT1 }, - { "DXT3", PIXELFORMAT_DXT3 }, - { "DXT5", PIXELFORMAT_DXT5 }, - { "BC4", PIXELFORMAT_BC4 }, - { "BC4s", PIXELFORMAT_BC4s }, - { "BC5", PIXELFORMAT_BC5 }, - { "BC5s", PIXELFORMAT_BC5s }, - { "BC6h", PIXELFORMAT_BC6H }, - { "BC6hs", PIXELFORMAT_BC6Hs }, - { "BC7", PIXELFORMAT_BC7 }, - { "PVR1rgb2", PIXELFORMAT_PVR1_RGB2 }, - { "PVR1rgb4", PIXELFORMAT_PVR1_RGB4 }, - { "PVR1rgba2", PIXELFORMAT_PVR1_RGBA2 }, - { "PVR1rgba4", PIXELFORMAT_PVR1_RGBA4 }, - { "ETC1", PIXELFORMAT_ETC1 }, - { "ETC2rgb", PIXELFORMAT_ETC2_RGB }, - { "ETC2rgba", PIXELFORMAT_ETC2_RGBA }, - { "ETC2rgba1", PIXELFORMAT_ETC2_RGBA1 }, - { "EACr", PIXELFORMAT_EAC_R }, - { "EACrs", PIXELFORMAT_EAC_Rs }, - { "EACrg", PIXELFORMAT_EAC_RG }, - { "EACrgs", PIXELFORMAT_EAC_RGs }, - { "ASTC4x4", PIXELFORMAT_ASTC_4x4 }, - { "ASTC5x4", PIXELFORMAT_ASTC_5x4 }, - { "ASTC5x5", PIXELFORMAT_ASTC_5x5 }, - { "ASTC6x5", PIXELFORMAT_ASTC_6x5 }, - { "ASTC6x6", PIXELFORMAT_ASTC_6x6 }, - { "ASTC8x5", PIXELFORMAT_ASTC_8x5 }, - { "ASTC8x6", PIXELFORMAT_ASTC_8x6 }, - { "ASTC8x8", PIXELFORMAT_ASTC_8x8 }, - { "ASTC10x5", PIXELFORMAT_ASTC_10x5 }, - { "ASTC10x6", PIXELFORMAT_ASTC_10x6 }, - { "ASTC10x8", PIXELFORMAT_ASTC_10x8 }, - { "ASTC10x10", PIXELFORMAT_ASTC_10x10 }, - { "ASTC12x10", PIXELFORMAT_ASTC_12x10 }, - { "ASTC12x12", PIXELFORMAT_ASTC_12x12 }, -}; - -static_assert(sizeof(formatEntries) / sizeof(formatEntries[0]) == (size_t) PIXELFORMAT_MAX_ENUM, "pixel format string map is missing entries!"); - -static StringMap formats(formatEntries, sizeof(formatEntries)); - -bool getConstant(const char *in, PixelFormat &out) -{ - return formats.find(in, out); -} - -bool getConstant(PixelFormat in, const char *&out) -{ - return formats.find(in, out); -} - -bool isPixelFormatCompressed(PixelFormat format) -{ - // I'm lazy - int iformat = (int) format; - return iformat >= (int) PIXELFORMAT_DXT1 && iformat < (int) PIXELFORMAT_MAX_ENUM; -} - -bool isPixelFormatDepthStencil(PixelFormat format) -{ - int iformat = (int) format; - return iformat >= (int) PIXELFORMAT_STENCIL8 && iformat <= (int) PIXELFORMAT_DEPTH32F_STENCIL8; -} - -bool isPixelFormatDepth(PixelFormat format) -{ - int iformat = (int) format; - return iformat >= (int) PIXELFORMAT_DEPTH16 && iformat <= (int) PIXELFORMAT_DEPTH32F_STENCIL8; -} - -bool isPixelFormatStencil(PixelFormat format) -{ - return format == PIXELFORMAT_STENCIL8 || format == PIXELFORMAT_DEPTH24_STENCIL8 || format == PIXELFORMAT_DEPTH32F_STENCIL8; -} - -size_t getPixelFormatSize(PixelFormat format) -{ - switch (format) - { - case PIXELFORMAT_R8: - case PIXELFORMAT_STENCIL8: - return 1; - case PIXELFORMAT_RG8: - case PIXELFORMAT_R16: - case PIXELFORMAT_R16F: - case PIXELFORMAT_LA8: - case PIXELFORMAT_RGBA4: - case PIXELFORMAT_RGB5A1: - case PIXELFORMAT_RGB565: - case PIXELFORMAT_DEPTH16: - return 2; - case PIXELFORMAT_RGBA8: - case PIXELFORMAT_sRGBA8: - case PIXELFORMAT_RG16: - case PIXELFORMAT_RG16F: - case PIXELFORMAT_R32F: - case PIXELFORMAT_RGB10A2: - case PIXELFORMAT_RG11B10F: - case PIXELFORMAT_DEPTH24: - case PIXELFORMAT_DEPTH32F: - case PIXELFORMAT_DEPTH24_STENCIL8: - return 4; - case PIXELFORMAT_RGBA16: - case PIXELFORMAT_RGBA16F: - case PIXELFORMAT_RG32F: - case PIXELFORMAT_DEPTH32F_STENCIL8: - return 8; - case PIXELFORMAT_RGBA32F: - return 16; - default: - // TODO: compressed formats - return 0; - } -} - -} // love diff --git a/love/src/jni/love/src/common/pixelformat.h b/love/src/jni/love/src/common/pixelformat.h deleted file mode 100644 index e8557be1..00000000 --- a/love/src/jni/love/src/common/pixelformat.h +++ /dev/null @@ -1,138 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#pragma once - -#include "stddef.h" - -namespace love -{ - -enum PixelFormat -{ - PIXELFORMAT_UNKNOWN, - - // these are converted to an actual format by love - PIXELFORMAT_NORMAL, - PIXELFORMAT_HDR, - - // "regular" formats - PIXELFORMAT_R8, - PIXELFORMAT_RG8, - PIXELFORMAT_RGBA8, - PIXELFORMAT_sRGBA8, - PIXELFORMAT_R16, - PIXELFORMAT_RG16, - PIXELFORMAT_RGBA16, - PIXELFORMAT_R16F, - PIXELFORMAT_RG16F, - PIXELFORMAT_RGBA16F, - PIXELFORMAT_R32F, - PIXELFORMAT_RG32F, - PIXELFORMAT_RGBA32F, - - PIXELFORMAT_LA8, // Same as RG8, but accessed as (L, L, L, A) - - // packed formats - PIXELFORMAT_RGBA4, - PIXELFORMAT_RGB5A1, - PIXELFORMAT_RGB565, - PIXELFORMAT_RGB10A2, - PIXELFORMAT_RG11B10F, - - // depth/stencil formats - PIXELFORMAT_STENCIL8, - PIXELFORMAT_DEPTH16, - PIXELFORMAT_DEPTH24, - PIXELFORMAT_DEPTH32F, - PIXELFORMAT_DEPTH24_STENCIL8, - PIXELFORMAT_DEPTH32F_STENCIL8, - - // compressed formats - PIXELFORMAT_DXT1, - PIXELFORMAT_DXT3, - PIXELFORMAT_DXT5, - PIXELFORMAT_BC4, - PIXELFORMAT_BC4s, - PIXELFORMAT_BC5, - PIXELFORMAT_BC5s, - PIXELFORMAT_BC6H, - PIXELFORMAT_BC6Hs, - PIXELFORMAT_BC7, - PIXELFORMAT_PVR1_RGB2, - PIXELFORMAT_PVR1_RGB4, - PIXELFORMAT_PVR1_RGBA2, - PIXELFORMAT_PVR1_RGBA4, - PIXELFORMAT_ETC1, - PIXELFORMAT_ETC2_RGB, - PIXELFORMAT_ETC2_RGBA, - PIXELFORMAT_ETC2_RGBA1, - PIXELFORMAT_EAC_R, - PIXELFORMAT_EAC_Rs, - PIXELFORMAT_EAC_RG, - PIXELFORMAT_EAC_RGs, - PIXELFORMAT_ASTC_4x4, - PIXELFORMAT_ASTC_5x4, - PIXELFORMAT_ASTC_5x5, - PIXELFORMAT_ASTC_6x5, - PIXELFORMAT_ASTC_6x6, - PIXELFORMAT_ASTC_8x5, - PIXELFORMAT_ASTC_8x6, - PIXELFORMAT_ASTC_8x8, - PIXELFORMAT_ASTC_10x5, - PIXELFORMAT_ASTC_10x6, - PIXELFORMAT_ASTC_10x8, - PIXELFORMAT_ASTC_10x10, - PIXELFORMAT_ASTC_12x10, - PIXELFORMAT_ASTC_12x12, - - PIXELFORMAT_MAX_ENUM -}; - -bool getConstant(PixelFormat in, const char *&out); -bool getConstant(const char *in, PixelFormat &out); - -/** - * Gets whether the specified pixel format is a compressed type. - **/ -bool isPixelFormatCompressed(PixelFormat format); - -/** - * Gets whether the specified pixel format is a depth or stencil type. - **/ -bool isPixelFormatDepthStencil(PixelFormat format); - -/** - * Gets whether the specified pixel format is a depth type. - **/ -bool isPixelFormatDepth(PixelFormat format); - -/** - * Gets whether the specified pixel format is a stencil type. - **/ -bool isPixelFormatStencil(PixelFormat format); - -/** - * Gets the size in bytes of the specified pixel format. - * NOTE: Currently returns 0 for compressed formats. - **/ -size_t getPixelFormatSize(PixelFormat format); - -} // love diff --git a/love/src/jni/love/src/common/runtime.cpp b/love/src/jni/love/src/common/runtime.cpp deleted file mode 100644 index e3415e1c..00000000 --- a/love/src/jni/love/src/common/runtime.cpp +++ /dev/null @@ -1,891 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "config.h" -#include "runtime.h" - -// LOVE -#include "Module.h" -#include "Object.h" -#include "Reference.h" -#include "StringMap.h" - -// C++ -#include -#include -#include -#include - -namespace love -{ - -/** - * Called when an object is collected. The object is released - * once in this function, possibly deleting it. - **/ -static int w__gc(lua_State *L) -{ - Proxy *p = (Proxy *) lua_touserdata(L, 1); - if (p->object != nullptr) - { - p->object->release(); - p->object = nullptr; - } - return 0; -} - -static int w__tostring(lua_State *L) -{ - Proxy *p = (Proxy *) lua_touserdata(L, 1); - const char *typname = lua_tostring(L, lua_upvalueindex(1)); - lua_pushfstring(L, "%s: %p", typname, p->object); - return 1; -} - -static int w__type(lua_State *L) -{ - lua_pushvalue(L, lua_upvalueindex(1)); - return 1; -} - -static int w__typeOf(lua_State *L) -{ - Proxy *p = (Proxy *)lua_touserdata(L, 1); - Type *t = luax_type(L, 2); - if (!t) - luax_pushboolean(L, false); - else - luax_pushboolean(L, p->type->isa(*t)); - return 1; -} - -static int w__eq(lua_State *L) -{ - Proxy *p1 = (Proxy *)lua_touserdata(L, 1); - Proxy *p2 = (Proxy *)lua_touserdata(L, 2); - luax_pushboolean(L, p1->object == p2->object && p1->object != nullptr); - return 1; -} - -static int w__release(lua_State *L) -{ - Proxy *p = (Proxy *) lua_touserdata(L, 1); - Object *object = p->object; - - if (object != nullptr) - { - p->object = nullptr; - object->release(); - - // Fetch the registry table of instantiated objects. - luax_getregistry(L, REGISTRY_OBJECTS); - - if (lua_istable(L, -1)) - { - // loveobjects[object] = nil - lua_pushlightuserdata(L, object); - lua_pushnil(L); - lua_settable(L, -3); - } - - lua_pop(L, 1); - } - - luax_pushboolean(L, object != nullptr); - return 1; -} - -Reference *luax_refif(lua_State *L, int type) -{ - Reference *r = nullptr; - - // Create a reference only if the test succeeds. - if (lua_type(L, -1) == type) - r = new Reference(L); - else // Pop the value manually if it fails (done by Reference if it succeeds). - lua_pop(L, 1); - - return r; -} - -void luax_printstack(lua_State *L) -{ - for (int i = 1; i <= lua_gettop(L); i++) - std::cout << i << " - " << luaL_typename(L, i) << std::endl; -} - -int luax_traceback(lua_State *L) -{ - if (!lua_isstring(L, 1)) // 'message' not a string? - return 1; // keep it intact - - lua_getglobal(L, "debug"); - if (!lua_istable(L, -1)) - { - lua_pop(L, 1); - return 1; - } - - lua_getfield(L, -1, "traceback"); - if (!lua_isfunction(L, -1)) - { - lua_pop(L, 2); - return 1; - } - - lua_pushvalue(L, 1); // pass error message - lua_pushinteger(L, 2); // skip this function and traceback - lua_call(L, 2, 1); // call debug.traceback - return 1; -} - -bool luax_isarrayoftables(lua_State *L, int idx) -{ - if (!lua_istable(L, idx)) - return false; - - lua_rawgeti(L, idx, 1); - bool tableoftables = lua_istable(L, -1); - lua_pop(L, 1); - return tableoftables; -} - -bool luax_toboolean(lua_State *L, int idx) -{ - return (lua_toboolean(L, idx) != 0); -} - -bool luax_checkboolean(lua_State *L, int idx) -{ - luaL_checktype(L, idx, LUA_TBOOLEAN); - return luax_toboolean(L, idx); -} - -void luax_pushboolean(lua_State *L, bool b) -{ - lua_pushboolean(L, b ? 1 : 0); -} - -bool luax_optboolean(lua_State *L, int idx, bool b) -{ - if (lua_isboolean(L, idx) == 1) - return (lua_toboolean(L, idx) == 1 ? true : false); - return b; -} - -std::string luax_tostring(lua_State *L, int idx) -{ - size_t len; - const char *str = lua_tolstring(L, idx, &len); - return std::string(str, len); -} - -std::string luax_checkstring(lua_State *L, int idx) -{ - size_t len; - const char *str = luaL_checklstring(L, idx, &len); - return std::string(str, len); -} - -void luax_pushstring(lua_State *L, const std::string &str) -{ - lua_pushlstring(L, str.data(), str.size()); -} - -bool luax_boolflag(lua_State *L, int table_index, const char *key, bool defaultValue) -{ - lua_getfield(L, table_index, key); - - bool retval; - if (lua_isnoneornil(L, -1)) - retval = defaultValue; - else - retval = lua_toboolean(L, -1) != 0; - - lua_pop(L, 1); - return retval; -} - -int luax_intflag(lua_State *L, int table_index, const char *key, int defaultValue) -{ - lua_getfield(L, table_index, key); - - int retval; - if (!lua_isnumber(L, -1)) - retval = defaultValue; - else - retval = (int) lua_tointeger(L, -1); - - lua_pop(L, 1); - return retval; -} - -double luax_numberflag(lua_State *L, int table_index, const char *key, double defaultValue) -{ - lua_getfield(L, table_index, key); - - int retval; - if (!lua_isnumber(L, -1)) - retval = defaultValue; - else - retval = lua_tonumber(L, -1); - - lua_pop(L, 1); - return retval; -} - -int luax_checkintflag(lua_State *L, int table_index, const char *key) -{ - lua_getfield(L, table_index, key); - - int retval; - if (!lua_isnumber(L, -1)) - { - std::string err = "expected integer field " + std::string(key) + " in table"; - return luaL_argerror(L, table_index, err.c_str()); - } - else - retval = (int) luaL_checkinteger(L, -1); - lua_pop(L, 1); - - return retval; -} - -int luax_assert_argc(lua_State *L, int min) -{ - int argc = lua_gettop(L); - if (argc < min) - return luaL_error(L, "Incorrect number of arguments. Got [%d], expected at least [%d]", argc, min); - return 0; -} - -int luax_assert_argc(lua_State *L, int min, int max) -{ - int argc = lua_gettop(L); - if (argc < min || argc > max) - return luaL_error(L, "Incorrect number of arguments. Got [%d], expected [%d-%d]", argc, min, max); - return 0; -} - -int luax_assert_function(lua_State *L, int idx) -{ - if (!lua_isfunction(L, idx)) - return luaL_error(L, "Argument must be of type \"function\"."); - return 0; -} - -int luax_assert_nilerror(lua_State *L, int idx) -{ - if (lua_isnoneornil(L, idx)) - { - if (lua_isstring(L, idx + 1)) - return luaL_error(L, lua_tostring(L, idx + 1)); - else - return luaL_error(L, "assertion failed!"); - } - return 0; -} - -void luax_setfuncs(lua_State *L, const luaL_Reg *l) -{ - if (l == nullptr) - return; - - for (; l->name != nullptr; l++) - { - lua_pushcfunction(L, l->func); - lua_setfield(L, -2, l->name); - } -} - -int luax_require(lua_State *L, const char *name) -{ - lua_getglobal(L, "require"); - lua_pushstring(L, name); - lua_call(L, 1, 1); - return 1; -} - -int luax_register_module(lua_State *L, const WrappedModule &m) -{ - m.type->init(); - - // Put a reference to the C++ module in Lua. - luax_insistregistry(L, REGISTRY_MODULES); - - Proxy *p = (Proxy *)lua_newuserdata(L, sizeof(Proxy)); - p->object = m.module; - p->type = m.type; - - luaL_newmetatable(L, m.module->getName()); - lua_pushvalue(L, -1); - lua_setfield(L, -2, "__index"); - lua_pushcfunction(L, w__gc); - lua_setfield(L, -2, "__gc"); - - lua_setmetatable(L, -2); - lua_setfield(L, -2, m.name); // _modules[name] = proxy - lua_pop(L, 1); - - // Gets the love table. - luax_insistglobal(L, "love"); - - // Create new table for module. - lua_newtable(L); - - // Register all the functions. - if (m.functions != nullptr) - luax_setfuncs(L, m.functions); - - // Register types. - if (m.types != nullptr) - { - for (const lua_CFunction *t = m.types; *t != nullptr; t++) - (*t)(L); - } - - lua_pushvalue(L, -1); - lua_setfield(L, -3, m.name); // love.graphics = table - lua_remove(L, -2); // love - - // Register module instance - Module::registerInstance(m.module); - - return 1; -} - -int luax_preload(lua_State *L, lua_CFunction f, const char *name) -{ - lua_getglobal(L, "package"); - lua_getfield(L, -1, "preload"); - lua_pushcfunction(L, f); - lua_setfield(L, -2, name); - lua_pop(L, 2); - return 0; -} - -int luax_register_type(lua_State *L, love::Type *type, ...) -{ - type->init(); - - // Get the place for storing and re-using instantiated love types. - luax_getregistry(L, REGISTRY_OBJECTS); - - // Create registry._loveobjects if it doesn't exist yet. - if (!lua_istable(L, -1)) - { - lua_newtable(L); - lua_replace(L, -2); - - // Create a metatable. - lua_newtable(L); - - // metatable.__mode = "v". Weak userdata values. - lua_pushliteral(L, "v"); - lua_setfield(L, -2, "__mode"); - - // setmetatable(newtable, metatable) - lua_setmetatable(L, -2); - - // registry._loveobjects = newtable - lua_setfield(L, LUA_REGISTRYINDEX, "_loveobjects"); - } - else - lua_pop(L, 1); - - luaL_newmetatable(L, type->getName()); - - // m.__index = m - lua_pushvalue(L, -1); - lua_setfield(L, -2, "__index"); - - // setup gc - lua_pushcfunction(L, w__gc); - lua_setfield(L, -2, "__gc"); - - // Add equality - lua_pushcfunction(L, w__eq); - lua_setfield(L, -2, "__eq"); - - // Add tostring function. - lua_pushstring(L, type->getName()); - lua_pushcclosure(L, w__tostring, 1); - lua_setfield(L, -2, "__tostring"); - - // Add type - lua_pushstring(L, type->getName()); - lua_pushcclosure(L, w__type, 1); - lua_setfield(L, -2, "type"); - - // Add typeOf - lua_pushcfunction(L, w__typeOf); - lua_setfield(L, -2, "typeOf"); - - // Add release - lua_pushcfunction(L, w__release); - lua_setfield(L, -2, "release"); - - va_list fs; - va_start(fs, type); - for (const luaL_Reg *f = va_arg(fs, const luaL_Reg *); f; f = va_arg(fs, const luaL_Reg *)) - luax_setfuncs(L, f); - va_end(fs); - - lua_pop(L, 1); // Pops metatable. - return 0; -} - -void luax_gettypemetatable(lua_State *L, love::Type &type) -{ - const char *name = type.getName(); - lua_getfield(L, LUA_REGISTRYINDEX, name); -} - -int luax_table_insert(lua_State *L, int tindex, int vindex, int pos) -{ - if (tindex < 0) - tindex = lua_gettop(L)+1+tindex; - if (vindex < 0) - vindex = lua_gettop(L)+1+vindex; - - if (pos == -1) - { - lua_pushvalue(L, vindex); - lua_rawseti(L, tindex, (int) luax_objlen(L, tindex)+1); - return 0; - } - else if (pos < 0) - pos = (int) luax_objlen(L, tindex)+1+pos; - - for (int i = (int) luax_objlen(L, tindex)+1; i > pos; i--) - { - lua_rawgeti(L, tindex, i-1); - lua_rawseti(L, tindex, i); - } - - lua_pushvalue(L, vindex); - lua_rawseti(L, tindex, pos); - return 0; -} - -int luax_register_searcher(lua_State *L, lua_CFunction f, int pos) -{ - // Add the package loader to the package.loaders table. - lua_getglobal(L, "package"); - - if (lua_isnil(L, -1)) - return luaL_error(L, "Can't register searcher: package table does not exist."); - - lua_getfield(L, -1, "loaders"); - - // Lua 5.2 renamed package.loaders to package.searchers. - if (lua_isnil(L, -1)) - { - lua_pop(L, 1); - lua_getfield(L, -1, "searchers"); - } - - if (lua_isnil(L, -1)) - return luaL_error(L, "Can't register searcher: package.loaders table does not exist."); - - lua_pushcfunction(L, f); - luax_table_insert(L, -2, -1, pos); - lua_pop(L, 3); - return 0; -} - -void luax_rawnewtype(lua_State *L, love::Type &type, love::Object *object) -{ - Proxy *u = (Proxy *)lua_newuserdata(L, sizeof(Proxy)); - - object->retain(); - - u->object = object; - u->type = &type; - - const char *name = type.getName(); - luaL_newmetatable(L, name); - - lua_getfield(L, -1, "__gc"); - bool has_gc = !lua_isnoneornil(L, -1); - lua_pop(L, 1); - - // Make sure mt.__gc exists, so Lua states which don't have the object's - // module loaded will still clean the object up when it's collected. - if (!has_gc) - { - lua_pushcfunction(L, w__gc); - lua_setfield(L, -2, "__gc"); - } - - lua_setmetatable(L, -2); -} - -void luax_pushtype(lua_State *L, love::Type &type, love::Object *object) -{ - if (object == nullptr) - { - lua_pushnil(L); - return; - } - - // Fetch the registry table of instantiated objects. - luax_getregistry(L, REGISTRY_OBJECTS); - - // The table might not exist - it should be insisted in luax_register_type. - if (!lua_istable(L, -1)) - { - lua_pop(L, 1); - return luax_rawnewtype(L, type, object); - } - - // Get the value of loveobjects[object] on the stack. - lua_pushlightuserdata(L, object); - lua_gettable(L, -2); - - // If the Proxy userdata isn't in the instantiated types table yet, add it. - if (lua_type(L, -1) != LUA_TUSERDATA) - { - lua_pop(L, 1); - - luax_rawnewtype(L, type, object); - - lua_pushlightuserdata(L, object); - lua_pushvalue(L, -2); - - // loveobjects[object] = Proxy. - lua_settable(L, -4); - } - - // Remove the loveobjects table from the stack. - lua_remove(L, -2); - - // Keep the Proxy userdata on the stack. -} - -bool luax_istype(lua_State *L, int idx, love::Type &type) -{ - if (lua_type(L, idx) != LUA_TUSERDATA) - return false; - - Proxy *p = (Proxy *) lua_touserdata(L, idx); - - if (p->type != nullptr) - return p->type->isa(type); - else - return false; -} - -int luax_getfunction(lua_State *L, const char *mod, const char *fn) -{ - lua_getglobal(L, "love"); - if (lua_isnil(L, -1)) return luaL_error(L, "Could not find global love!"); - lua_getfield(L, -1, mod); - if (lua_isnil(L, -1)) return luaL_error(L, "Could not find love.%s!", mod); - lua_getfield(L, -1, fn); - if (lua_isnil(L, -1)) return luaL_error(L, "Could not find love.%s.%s!", mod, fn); - - lua_remove(L, -2); // remove mod - lua_remove(L, -2); // remove fn - return 0; -} - -int luax_convobj(lua_State *L, int idx, const char *mod, const char *fn) -{ - // Convert to absolute index if necessary. - if (idx < 0 && idx > LUA_REGISTRYINDEX) - idx += lua_gettop(L) + 1; - - // Convert string to a file. - luax_getfunction(L, mod, fn); - lua_pushvalue(L, idx); // The initial argument. - lua_call(L, 1, 2); // Call the function, one arg, one return value (plus optional errstring.) - luax_assert_nilerror(L, -2); // Make sure the function returned something. - lua_pop(L, 1); // Pop the second return value now that we don't need it. - lua_replace(L, idx); // Replace the initial argument with the new object. - return 0; -} - -int luax_convobj(lua_State *L, int idxs[], int n, const char *mod, const char *fn) -{ - luax_getfunction(L, mod, fn); - for (int i = 0; i < n; i++) - { - lua_pushvalue(L, idxs[i]); // The arguments. - } - lua_call(L, n, 2); // Call the function, n args, one return value (plus optional errstring.) - luax_assert_nilerror(L, -2); // Make sure the function returned something. - lua_pop(L, 1); // Pop the second return value now that we don't need it. - if (n > 0) - lua_replace(L, idxs[0]); // Replace the initial argument with the new object. - return 0; -} - -int luax_pconvobj(lua_State *L, int idx, const char *mod, const char *fn) -{ - // Convert string to a file. - luax_getfunction(L, mod, fn); - lua_pushvalue(L, idx); // The initial argument. - int ret = lua_pcall(L, 1, 1, 0); // Call the function, one arg, one return value. - if (ret == 0) - lua_replace(L, idx); // Replace the initial argument with the new object. - return ret; -} - -int luax_pconvobj(lua_State *L, int idxs[], int n, const char *mod, const char *fn) -{ - luax_getfunction(L, mod, fn); - for (int i = 0; i < n; i++) - { - lua_pushvalue(L, idxs[i]); // The arguments. - } - int ret = lua_pcall(L, n, 1, 0); // Call the function, n args, one return value. - if (ret == 0) - lua_replace(L, idxs[0]); // Replace the initial argument with the new object. - return ret; -} - -int luax_insist(lua_State *L, int idx, const char *k) -{ - // Convert to absolute index if necessary. - if (idx < 0 && idx > LUA_REGISTRYINDEX) - idx += lua_gettop(L) + 1; - - lua_getfield(L, idx, k); - - // Create if necessary. - if (!lua_istable(L, -1)) - { - lua_pop(L, 1); // Pop the non-table. - lua_newtable(L); - lua_pushvalue(L, -1); // Duplicate the table to leave on top. - lua_setfield(L, idx, k); // lua_stack[idx][k] = lua_stack[-1] (table) - } - - return 1; -} - -int luax_insistglobal(lua_State *L, const char *k) -{ - lua_getglobal(L, k); - - if (!lua_istable(L, -1)) - { - lua_pop(L, 1); // Pop the non-table. - lua_newtable(L); - lua_pushvalue(L, -1); - lua_setglobal(L, k); - } - - return 1; -} - -int luax_c_insistglobal(lua_State *L, const char *k) -{ - return luax_insistglobal(L, k); -} - -int luax_insistlove(lua_State *L, const char *k) -{ - luax_insistglobal(L, "love"); - luax_insist(L, -1, k); - - // The love table should be replaced with the top stack - // item. Only the reqested table should remain on the stack. - lua_replace(L, -2); - - return 1; -} - -int luax_getlove(lua_State *L, const char *k) -{ - lua_getglobal(L, "love"); - - if (!lua_isnil(L, -1)) - { - lua_getfield(L, -1, k); - lua_replace(L, -2); - } - - return 1; -} - -int luax_insistregistry(lua_State *L, Registry r) -{ - switch (r) - { - case REGISTRY_MODULES: - return luax_insistlove(L, "_modules"); - case REGISTRY_OBJECTS: - return luax_insist(L, LUA_REGISTRYINDEX, "_loveobjects"); - default: - return luaL_error(L, "Attempted to use invalid registry."); - } -} - -int luax_getregistry(lua_State *L, Registry r) -{ - switch (r) - { - case REGISTRY_MODULES: - return luax_getlove(L, "_modules"); - case REGISTRY_OBJECTS: - lua_getfield(L, LUA_REGISTRYINDEX, "_loveobjects"); - return 1; - default: - return luaL_error(L, "Attempted to use invalid registry."); - } -} - -static const char *MAIN_THREAD_KEY = "_love_mainthread"; - -lua_State *luax_insistpinnedthread(lua_State *L) -{ - lua_getfield(L, LUA_REGISTRYINDEX, MAIN_THREAD_KEY); - - if (lua_isnoneornil(L, -1)) - { - lua_pop(L, 1); - - // lua_pushthread returns 1 if it's actually the main thread, but we - // can't actually get the real main thread if lua_pushthread doesn't - // return it (in Lua 5.1 at least), so we ignore that for now... - // We do store a strong reference to the current thread/coroutine in - // the registry, however. - lua_pushthread(L); - lua_pushvalue(L, -1); - lua_setfield(L, LUA_REGISTRYINDEX, MAIN_THREAD_KEY); - } - - lua_State *thread = lua_tothread(L, -1); - lua_pop(L, 1); - return thread; -} - -lua_State *luax_getpinnedthread(lua_State *L) -{ - lua_getfield(L, LUA_REGISTRYINDEX, MAIN_THREAD_KEY); - lua_State *thread = lua_tothread(L, -1); - lua_pop(L, 1); - return thread; -} - -void luax_markdeprecated(lua_State *L, const char *name, APIType api) -{ - luax_markdeprecated(L, name, api, DEPRECATED_NO_REPLACEMENT, nullptr); -} - -void luax_markdeprecated(lua_State *L, const char *name, APIType api, DeprecationType type, const char *replacement) -{ - MarkDeprecated deprecated(name, api, type, replacement); - - if (deprecated.info != nullptr && deprecated.info->uses == 1) - { - luaL_where(L, 1); - const char *where = lua_tostring(L, -1); - if (where != nullptr) - deprecated.info->where = where; - lua_pop(L, 1); - } -} - -extern "C" int luax_typerror(lua_State *L, int narg, const char *tname) -{ - int argtype = lua_type(L, narg); - const char *argtname = nullptr; - - // We want to use the love type name for userdata, if possible. - if (argtype == LUA_TUSERDATA && luaL_getmetafield(L, narg, "type") != 0) - { - lua_pushvalue(L, narg); - if (lua_pcall(L, 1, 1, 0) == 0 && lua_type(L, -1) == LUA_TSTRING) - { - argtname = lua_tostring(L, -1); - - // Non-love userdata might have a type metamethod which doesn't - // describe its type properly, so we only use it for love types. - if (!Type::byName(argtname)) - argtname = nullptr; - } - } - - if (argtname == nullptr) - argtname = lua_typename(L, argtype); - - const char *msg = lua_pushfstring(L, "%s expected, got %s", tname, argtname); - return luaL_argerror(L, narg, msg); -} - -int luax_enumerror(lua_State *L, const char *enumName, const char *value) -{ - return luaL_error(L, "Invalid %s: %s", enumName, value); -} - -int luax_enumerror(lua_State *L, const char *enumName, const std::vector &values, const char *value) -{ - std::stringstream valueStream; - bool first = true; - for (auto value : values) - { - valueStream << (first ? "'" : ", '") << value << "'"; - first = false; - } - - std::string valueString = valueStream.str(); - return luaL_error(L, "Invalid %s '%s', expected one of: %s", enumName, value, valueString.c_str()); -} - -size_t luax_objlen(lua_State *L, int ndx) -{ -#if LUA_VERSION_NUM == 501 - return lua_objlen(L, ndx); -#else - return lua_rawlen(L, ndx); -#endif -} - -void luax_register(lua_State *L, const char *name, const luaL_Reg *l) -{ - if (name) - lua_newtable(L); - - luax_setfuncs(L, l); - if (name) - { - lua_pushvalue(L, -1); - lua_setglobal(L, name); - } -} - -Type *luax_type(lua_State *L, int idx) -{ - return Type::byName(luaL_checkstring(L, idx)); -} - -int luax_resume(lua_State *L, int nargs) -{ -#if LUA_VERSION_NUM >= 502 - return lua_resume(L, nullptr, nargs); -#else - return lua_resume(L, nargs); -#endif -} - -} // love diff --git a/love/src/jni/love/src/common/runtime.h b/love/src/jni/love/src/common/runtime.h deleted file mode 100644 index 90cacbb9..00000000 --- a/love/src/jni/love/src/common/runtime.h +++ /dev/null @@ -1,687 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_RUNTIME_H -#define LOVE_RUNTIME_H - -// LOVE -#include "config.h" -#include "types.h" -#include "deprecation.h" - -// Lua -extern "C" { - #define LUA_COMPAT_ALL - #include - #include - #include -} - -// C++ -#include -#include - -namespace love -{ - -// Forward declarations. -class Object; -class Module; -class Reference; - -template -class StrongRef; - -/** - * Registries represent special tables which can be accessed with - * luax_insistregistry and luax_getregistry. - **/ -enum Registry -{ - REGISTRY_MODULES, - REGISTRY_OBJECTS -}; - -/** - * This structure wraps all Lua-exposed objects. It exists in the - * Lua state as a full userdata (so we can catch __gc "events"), - * though the Object it refers to is light userdata in the sense - * that it is not allocated by the Lua VM. - **/ -struct Proxy -{ - // Holds type information (see types.h). - love::Type *type; - - // Pointer to the actual object. - Object *object; -}; - -/** - * A Module with Lua wrapper functions and other data. - **/ -struct WrappedModule -{ - // The module containing the functions. - Module *module; - - // The name for the table to put the functions in, without the 'love'-prefix. - const char *name; - - // The type of this module. - love::Type *type; - - // The functions of the module (last element {0,0}). - const luaL_Reg *functions; - - // A list of functions which expose the types of the modules (last element 0). - const lua_CFunction *types; -}; - -/** - * Returns a reference to the top stack element (-1) if the value - * is of the specified type. If the value is incorrect, zero is returned. - * - * In any case, the top stack element is popped, regardless of its type. - **/ -Reference *luax_refif(lua_State *L, int type); - -/** - * Prints the current contents of the stack. Only useful for debugging. - * @param L The Lua state. - **/ -void luax_printstack(lua_State *L); - -/** - * Traceback function for use with lua_pcall. Calls debug.traceback. - **/ -int luax_traceback(lua_State *L); - -/** - * Gets whether the value at idx is an array of tables. - **/ -bool luax_isarrayoftables(lua_State *L, int idx); - -/** - * Converts the value at idx to a bool. It follow the same rules - * as lua_toboolean, but returns a bool instead of an int. - * @param L The Lua state. - * @param idx The index on the Lua stack. - * @return True if the value evaluates to true, false otherwise. - **/ -bool luax_toboolean(lua_State *L, int idx); - -/** - * Returns the boolean value at idx. Causes a Lua error if the value is not - * a boolean. - **/ -bool luax_checkboolean(lua_State *L, int idx); - -/** - * Pushes a bool onto the stack. It's the same as lua_pushboolean, - * but with bool instead of int. - * @param L The Lua state. - * @param b The bool to push. - **/ -void luax_pushboolean(lua_State *L, bool b); - -/** - * Converts the value at idx to a bool, or if not present, b is returned. - * @param L The Lua state. - * @param idx The index of the Lua stack. - * @param b The value to return if no value exist at the specified index. - * @return True if the value evaluates to true, false otherwise. - **/ -bool luax_optboolean(lua_State *L, int idx, bool b); - -/** - * Converts the value at idx to a std::string. It takes care of the string - * size and possible embedded nulls. - * @param L The Lua state. - * @param idx The index on the Lua stack. - * @return Copy of the string at the specified index. - **/ -std::string luax_tostring(lua_State *L, int idx); - -/** - * Converts the value at idx to a std::string. It takes care of the string - * size and possible embedded nulls. - * @param L The Lua state. - * @param idx The index on the Lua stack. - * @return Copy of the string at the specified index. - **/ -std::string luax_checkstring(lua_State *L, int idx); - -/** - * Pushes a std::string onto the stack. It uses the length of the string - * for lua_pushlstring's len argument. - * @param L The Lua state. - * @param str The string to push. - **/ -void luax_pushstring(lua_State *L, const std::string &str); - - -bool luax_boolflag(lua_State *L, int table_index, const char *key, bool defaultValue); -int luax_intflag(lua_State *L, int table_index, const char *key, int defaultValue); -double luax_numberflag(lua_State *L, int table_index, const char *key, double defaultValue); - -int luax_checkintflag(lua_State *L, int table_index, const char *key); - -/** - * Convert the value at the specified index to an Lua number, and then - * convert to a float. - * - * @param L The Lua state. - * @param idx The index on the stack. - */ -inline float luax_tofloat(lua_State *L, int idx) -{ - return static_cast(lua_tonumber(L, idx)); -} - -/** - * Like luax_tofloat, but checks that the value is a number. - * - * @see luax_tofloat - */ -inline float luax_checkfloat(lua_State *L, int idx) -{ - return static_cast(luaL_checknumber(L, idx)); -} - -inline lua_Number luax_checknumberclamped01(lua_State *L, int idx) -{ - return std::min(std::max(luaL_checknumber(L, idx), 0.0), 1.0); -} - -inline lua_Number luax_optnumberclamped01(lua_State *L, int idx, double def) -{ - return std::min(std::max(luaL_optnumber(L, idx, def), 0.0), 1.0); -} - -/** - * Require at least 'min' number of items on the stack. - * @param L The Lua state. - * @param min The minimum number of items on the stack. - * @return Zero if conditions are met, otherwise a Lua error (longjmp). - **/ -int luax_assert_argc(lua_State *L, int min); - -/** - * Require at least 'min', but more than 'max' items on the stack. - * @param L The Lua state. - * @param min The minimum number of items on the stack. - * @param max The maximum number of items on the stack. - * @return Zero if conditions are met, otherwise a Lua error (longjmp). - **/ -int luax_assert_argc(lua_State *L, int min, int max); - -/** - * Require that the value at idx is a function. - * @param L The Lua state. - *@param idx The index on the stack. - **/ -int luax_assert_function(lua_State *L, int idx); - -/** - * Require that the value at idx is not nil. If it is, the function throws an - * error using an optional error string at idx+1. - * @param L The Lua state. - * @param idx The index on the stack. - **/ -int luax_assert_nilerror(lua_State *L, int idx); - -/** - * Registers all functions in the array l (see luaL_Reg) into the table at the - * top of the stack. - * Similar to Lua 5.2's luaL_setfuncs without the upvalues, and to Lua 5.1's - * luaL_register without the library name. - **/ -void luax_setfuncs(lua_State *L, const luaL_Reg *l); - -/** - * Loads a Lua module using the 'require' function. Leaves the return result on - * the stack. - * @param name The name of the module to require. - **/ -int luax_require(lua_State *L, const char *name); - -/** - * Register a module in the love table. The love table will be created if it does not exist. - * NOTE: The module-object is expected to have a +1 reference count before calling - * this function, as it doesn't retain the object itself but Lua will release it - * upon garbage collection. - * @param L The Lua state. - **/ -int luax_register_module(lua_State *L, const WrappedModule &m); - -/** - * Inserts a module with 'name' into the package.preloaded table. - * @param f The function to be called when the module is opened. - * @param name The name of the module, with 'love'-prefix, for instance 'love.graphics'. - **/ -int luax_preload(lua_State *L, lua_CFunction f, const char *name); - -/** - * Register a new type. - * NOTE: The type is passed by pointer instead of reference because calling va_start - * on a reference is undefined behaviour. - * @param type The type. - * @param ... The list of lists of member functions for the type. (of type luaL_Reg*) - **/ -int luax_register_type(lua_State *L, love::Type *type, ...); - -/** - * Pushes the metatable of the specified type onto the stack. -**/ -void luax_gettypemetatable(lua_State *L, love::Type &type); - -/** - * Do a table.insert from C - * @param L the state - * @param tindex the stack index of the table - * @param vindex the stack index of the value - * @param pos the position to insert it in - **/ -int luax_table_insert(lua_State *L, int tindex, int vindex, int pos = -1); - -/** - * Register a new searcher function for package.loaders. This can for instance enable - * loading of files through love.filesystem using standard require. - * @param L The Lua state. - * @param f The searcher function. - * @param pos The position to insert the loader in. - **/ -int luax_register_searcher(lua_State *L, lua_CFunction f, int pos = -1); - -/** - * Pushes a Lua representation of the given object onto the stack, creating and - * storing the Lua representation in a weak table if it doesn't exist yet. - * NOTE: The object will be retained by Lua and released upon garbage collection. - * @param L The Lua state. - * @param type The type information of the object. - * @param object The pointer to the actual object. - **/ -void luax_pushtype(lua_State *L, love::Type &type, love::Object *object); - -template -void luax_pushtype(lua_State *L, T *object) -{ - luax_pushtype(L, T::type, object); -} - -template -void luax_pushtype(lua_State *L, StrongRef &object) -{ - luax_pushtype(L, T::type, object); -} - -/** - * Creates a new Lua representation of the given object *without* checking if it - * exists yet, and *without* storing it in a weak table. - * This should only be used when performance is an extreme concern and the - * object is not ever expected to be pushed to Lua again, as it prevents the - * Lua-side objects from working in some cases when used as keys in tables. - * NOTE: The object will be retained by Lua and released upon garbage collection. - * @param L The Lua state. - * @param type The type information of the object. - * @param object The pointer to the actual object. - **/ -void luax_rawnewtype(lua_State *L, love::Type &type, love::Object *object); - -/** - * Checks whether the value at idx is a certain type. - * @param L The Lua state. - * @param idx The index on the stack. - * @param type The type to check for. - * @return True if the value is Proxy of the specified type, false otherwise. - **/ -bool luax_istype(lua_State *L, int idx, love::Type &type); - -/** - * Gets the function love.module.function and puts it on top of the stack (alone). If the - * love table, the module, or the function does not exist, an error is returned. - * @return An error if nonexistent, or 1 if successful. - **/ -int luax_getfunction(lua_State *L, const char *module, const char *function); - -/** - * Converts an object into another object by the specified function love.module.function. - * The conversion function must accept a single object of the relevant type as a parameter, - * and returnone value. If the function does not exist (see luax_getfunction), an error is returned. - * - * Note that the initial object at idx is replaced by the new object. - * - * @param L The Lua state. - * @param idx The index on the stack. - * @param module The module in the love table. - * @param function The function in the module. - **/ -int luax_convobj(lua_State *L, int idx, const char *module, const char *function); - -/** - * Converts an object into another object by the specified function love.module.function. - * The conversion function must accept a single object of the relevant type as its first parameter, - * and return one value. If the function does not exist (see luax_getfunction), an error is returned. - * - * Note that the initial object at idx is replaced by the new object. - * - * @param L The Lua state. - * @param idxs An array of indices on the stack. - * @param n How many arguments are being passed. - * @param module The module in the love table. - * @param function The function in the module. - **/ -int luax_convobj(lua_State *L, int idxs[], int n, const char *module, const char *function); - -// pcall versions of the above -int luax_pconvobj(lua_State *L, int idx, const char *module, const char *function); -int luax_pconvobj(lua_State *L, int idxs[], int n, const char *module, const char *function); - -/** - * 'Insist' that a table 'k' exists in the table at idx. Insistence involves that the - * table (k) is created if it does not exist in the table at idx. The table at idx must - * pre-exist, however. Also note that if the a non-table value exists at the specified - * location, it will be overwritten with a new table. The insisted table, and only the - * insisted table, will be placed on top of the stack. - * - * @param idx The index on the stack containing a table. - * @param k The name of the table we are insisting exist. - **/ -int luax_insist(lua_State *L, int idx, const char *k); - -/** - * Insist that a global table 'k' exists. See luax_insist. - * @param k The name of the table we are insisting exist. - **/ -int luax_insistglobal(lua_State *L, const char *k); - -/** - * Insists that a table 'k' exists inside the 'love' table. See luax_insist. - * @param k The name of the table we are insisting exist. - **/ -int luax_insistlove(lua_State *L, const char *k); - -/** - * Pushes the table 'k' in the love table onto the stack. Pushes nil if the - * table doesn't exist. - * @param k The name of the table we want to get. - **/ -int luax_getlove(lua_State *L, const char *k); - -/** - * Gets (creates if needed) the specified Registry, and pushes it into the - * stack. - * @param L The Lua state. - * @param r The Registry to get. - **/ -int luax_insistregistry(lua_State *L, Registry r); - -/** - * Gets the specified Registry, and pushes it onto the stack. Pushes nil if the - * registry hasn't been created (see luax_insistregistry.) - * @param L The Lua state. - * @param r The Registry to get. - **/ -int luax_getregistry(lua_State *L, Registry r); - -/** - * Gets (and pins if needed) a "pinned" Lua thread (coroutine) in the specified - * Lua state. This will usually be the main Lua thread, unless the first call - * to this function for a specific Lua state is made from within a coroutine. - * NOTE: This does not push anything to the stack. - **/ -lua_State *luax_insistpinnedthread(lua_State *L); - -/** - * Gets a "pinned" Lua thread (coroutine) in the specified Lua state. This will - * usually be the main Lua thread. This can be used to access global variables - * in a specific Lua state without needing another alive lua_State value. - * PRECONDITION: luax_insistpinnedthread must have been called on a lua_State - * value corresponding to the Lua state which will be used with this function. - * NOTE: This does not push anything to the stack. - **/ -lua_State *luax_getpinnedthread(lua_State *L); - -/** - * Mark a function as deprecated. Should only be called inside wrapper function - * code. - **/ -void luax_markdeprecated(lua_State *L, const char *name, APIType api); -void luax_markdeprecated(lua_State *L, const char *name, APIType api, DeprecationType type, const char *replacement); - -extern "C" { // Also called from luasocket - int luax_typerror(lua_State *L, int narg, const char *tname); -} - -int luax_enumerror(lua_State *L, const char *enumName, const char *value); -int luax_enumerror(lua_State *L, const char *enumName, const std::vector &values, const char *value); - -template -void luax_checktablefields(lua_State *L, int idx, const char *enumName, bool (*getConstant)(const char *, T &)) -{ - luaL_checktype(L, idx, LUA_TTABLE); - - // We want to error for invalid / misspelled fields in the table. - lua_pushnil(L); - while (lua_next(L, idx)) - { - if (lua_type(L, -2) != LUA_TSTRING) - luax_typerror(L, -2, "string"); - - const char *key = luaL_checkstring(L, -2); - T constantvalue; - - if (!getConstant(key, constantvalue)) - luax_enumerror(L, enumName, key); - - lua_pop(L, 1); - } -} - -/** - * Calls luax_objlen/lua_rawlen depending on version - **/ -size_t luax_objlen(lua_State *L, int ndx); - -extern "C" { // Called by enet and luasocket - void luax_register(lua_State *L, const char *name, const luaL_Reg *l); - int luax_c_insistglobal(lua_State *L, const char *k); -} - -/** - * Like luax_totype, but causes an error if the value at idx is not Proxy, - * or is not the specified type. - * @param L The Lua state. - * @param idx The index on the stack. - * @param type The type bit. - **/ -template -T *luax_checktype(lua_State *L, int idx, const love::Type &type) -{ - if (lua_type(L, idx) != LUA_TUSERDATA) - { - const char *name = type.getName(); - luax_typerror(L, idx, name); - } - - Proxy *u = (Proxy *)lua_touserdata(L, idx); - - if (u->type == nullptr || !u->type->isa(type)) - { - const char *name = type.getName(); - luax_typerror(L, idx, name); - } - - if (u->object == nullptr) - luaL_error(L, "Cannot use object after it has been released."); - - return (T *)u->object; -} - -template -T *luax_checktype(lua_State *L, int idx) -{ - return luax_checktype(L, idx, T::type); -} - -template -T *luax_getmodule(lua_State *L, const love::Type &type) -{ - const char *name = type.getName(); - - luax_insistregistry(L, REGISTRY_MODULES); - lua_getfield(L, -1, name); - - if (!lua_isuserdata(L, -1)) - luaL_error(L, "Tried to get nonexistent module %s.", name); - - Proxy *u = (Proxy *)lua_touserdata(L, -1); - - if (u->type == nullptr || !u->type->isa(type)) - luaL_error(L, "Incorrect module %s", name); - - lua_pop(L, 2); - - return (T *)u->object; -} - -template -T *luax_getmodule(lua_State *L) -{ - return luax_getmodule(L, T::type); -} - -template -T *luax_optmodule(lua_State *L, const love::Type &type) -{ - const char *name = type.getName(); - - luax_insistregistry(L, REGISTRY_MODULES); - lua_getfield(L, -1, name); - - if (!lua_isuserdata(L, -1)) - { - lua_pop(L, 2); - return 0; - } - - Proxy *u = (Proxy *)lua_touserdata(L, -1); - - if (!u->type->isa(type)) - luaL_error(L, "Incorrect module %s", name); - - lua_pop(L, 2); - - return (T *) u->object; -} - -template -T *luax_optmodule(lua_State *L) -{ - return luax_optmodule(L, T::type); -} - -/** - * Converts the value at idx to the specified type without checking that - * this conversion is valid. If the type has been previously verified with - * luax_istype, then this can be safely used. Otherwise, use luax_checktype. - * @param L The Lua state. - * @param idx The index on the stack. - * @param type The type of the object. - **/ -template -T *luax_totype(lua_State *L, int idx, const love::Type& /*type*/) -{ - T *o = (T *)(((Proxy *)lua_touserdata(L, idx))->object); - - if (o == nullptr) - luaL_error(L, "Cannot use object after it has been released."); - - return o; -} - -template -T *luax_totype(lua_State *L, int idx) -{ - return luax_totype(L, idx, T::type); -} - -Type *luax_type(lua_State *L, int idx); - -/** - * Converts any exceptions thrown by the passed lambda function into a Lua error. - * lua_error (and luaL_error) cannot be called from inside the exception handler - * because they use longjmp, which causes undefined behaviour when the - * destructor of the exception would have been called. - **/ -template -int luax_catchexcept(lua_State *L, const T& func) -{ - bool should_error = false; - - try - { - func(); - } - catch (const std::exception &e) - { - should_error = true; - lua_pushstring(L, e.what()); - } - - if (should_error) - return luaL_error(L, "%s", lua_tostring(L, -1)); - - return 0; -} - -template -int luax_catchexcept(lua_State *L, const T& func, const F& finallyfunc) -{ - bool should_error = false; - - try - { - func(); - } - catch (const std::exception &e) - { - should_error = true; - lua_pushstring(L, e.what()); - } - - finallyfunc(should_error); - - if (should_error) - return luaL_error(L, "%s", lua_tostring(L, -1)); - - return 0; -} - -/** - * Compatibility shim for lua_resume - * Exported because it's used in the launcher - **/ -LOVE_EXPORT int luax_resume(lua_State *L, int nargs); - -} // love - -#endif // LOVE_RUNTIME_H diff --git a/love/src/jni/love/src/common/types.cpp b/love/src/jni/love/src/common/types.cpp deleted file mode 100644 index 89fd6608..00000000 --- a/love/src/jni/love/src/common/types.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -// STL -#include - -#include "types.h" - -namespace love -{ - -static std::unordered_map types; - -Type::Type(const char *name, Type *parent) - : name(name) - , parent(parent) - , id(0) - , inited(false) -{ -} - -void Type::init() -{ - static uint32 nextId = 1; - - // Make sure we don't init twice, that would be bad - if (inited) - return; - - // Note: we add it here, not in the constructor, because some Types can get initialized before the map! - types[name] = this; - id = nextId++; - bits[id] = true; - inited = true; - - if (!parent) - return; - if (!parent->inited) - parent->init(); - bits |= parent->bits; -} - -uint32 Type::getId() -{ - if (!inited) - init(); - return id; -} - -const char *Type::getName() const -{ - return name; -} - -Type *Type::byName(const char *name) -{ - auto pos = types.find(name); - if (pos == types.end()) - return nullptr; - return pos->second; -} - -} // love diff --git a/love/src/jni/love/src/common/types.h b/love/src/jni/love/src/common/types.h deleted file mode 100644 index 4bbca69d..00000000 --- a/love/src/jni/love/src/common/types.h +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_TYPES_H -#define LOVE_TYPES_H - -#include "int.h" - -// STD -#include -#include - -namespace love -{ - -class Type -{ -public: - static const uint32 MAX_TYPES = 128; - - Type(const char *name, Type *parent); - Type(const Type&) = delete; - - static Type *byName(const char *name); - - void init(); - uint32 getId(); - const char *getName() const; - - bool isa(const uint32 &other) - { - if (!inited) - init(); - return bits[other]; - } - - bool isa(const Type &other) - { - if (!inited) - init(); - // Note that if this type implements the other - // calling init above will also have inited - // the other. - return bits[other.id]; - } - -private: - const char * const name; - Type * const parent; - uint32 id; - bool inited; - std::bitset bits; -}; - -} // love - -#endif // LOVE_TYPES_H diff --git a/love/src/jni/love/src/common/utf8.cpp b/love/src/jni/love/src/common/utf8.cpp deleted file mode 100644 index 8e8a5c47..00000000 --- a/love/src/jni/love/src/common/utf8.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "utf8.h" - -#ifdef LOVE_WINDOWS - -namespace love -{ - -std::string to_utf8(LPCWSTR wstr) -{ - size_t wide_len = wcslen(wstr)+1; - - // Get size in UTF-8. - int utf8_size = WideCharToMultiByte(CP_UTF8, 0, wstr, wide_len, 0, 0, 0, 0); - - char *utf8_str = new char[utf8_size]; - - // Convert to UTF-8. - int ok = WideCharToMultiByte(CP_UTF8, 0, wstr, wide_len, utf8_str, utf8_size, 0, 0); - - std::string ret; - if (ok) - ret = utf8_str; - - delete[] utf8_str; - return ret; -} - -std::wstring to_widestr(const std::string &str) -{ - if (str.empty()) - return std::wstring(); - - int wide_size = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), (int) str.length(), nullptr, 0); - - if (wide_size == 0) - return std::wstring(); - - std::wstring widestr; - widestr.resize(wide_size); - - int ok = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), (int) str.length(), &widestr[0], widestr.length()); - - if (!ok) - return std::wstring(); - - return widestr; -} - -void replace_char(std::string &str, char find, char replace) -{ - int length = str.length(); - - for (int i = 0; i -#include - -namespace love -{ - -/** - * Convert the wide string to a UTF-8 encoded string. - * @param wstr The wide-char string. - * @return A UTF-8 string. - **/ -std::string to_utf8(LPCWSTR wstr); - -/** - * Convert a UTF-8 encoded string to a wide string. - * @param str The UTF-8 string. - * @return A wide string. -**/ -std::wstring to_widestr(const std::string &str); - -/** - * Replace all occurences of 'find' with 'replace' in a string. - * @param str The string to modify. - * @param find The character to match. - * @param replace The character to replace matches. - **/ -void replace_char(std::string &str, char find, char replace); - -} // love - -#endif // LOVE_WINDOWS diff --git a/love/src/jni/love/src/common/version.h b/love/src/jni/love/src/common/version.h deleted file mode 100644 index 14f913f4..00000000 --- a/love/src/jni/love/src/common/version.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_VERSION_H -#define LOVE_VERSION_H - -namespace love -{ - -// Version stuff. -#define LOVE_VERSION_STRING "11.2" -static const int VERSION_MAJOR = 11; -static const int VERSION_MINOR = 2; -static const int VERSION_REV = 0; -static const char *VERSION = LOVE_VERSION_STRING; -static const char *VERSION_COMPATIBILITY[] = { VERSION, "11.0", "11.1", 0 }; -static const char *VERSION_CODENAME = "Mysterious Mysteries"; - -} // love - -#endif // LOVE_VERSION_H diff --git a/love/src/jni/love/src/libraries/Box2D/Box2D.h b/love/src/jni/love/src/libraries/Box2D/Box2D.h deleted file mode 100644 index 18704613..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Box2D.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef BOX2D_H -#define BOX2D_H - -/** -\mainpage Box2D API Documentation - -\section intro_sec Getting Started - -For documentation please see http://box2d.org/documentation.html - -For discussion please visit http://box2d.org/forum -*/ - -// These include files constitute the main Box2D API - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2ChainShape.cpp b/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2ChainShape.cpp deleted file mode 100644 index 0c7282cc..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2ChainShape.cpp +++ /dev/null @@ -1,193 +0,0 @@ -/* -* Copyright (c) 2006-2010 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include -#include - -b2ChainShape::~b2ChainShape() -{ - Clear(); -} - -void b2ChainShape::Clear() -{ - b2Free(m_vertices); - m_vertices = NULL; - m_count = 0; -} - -void b2ChainShape::CreateLoop(const b2Vec2* vertices, int32 count) -{ - b2Assert(m_vertices == NULL && m_count == 0); - b2Assert(count >= 3); - for (int32 i = 1; i < count; ++i) - { - b2Vec2 v1 = vertices[i-1]; - b2Vec2 v2 = vertices[i]; - // If the code crashes here, it means your vertices are too close together. - b2Assert(b2DistanceSquared(v1, v2) > b2_linearSlop * b2_linearSlop); - } - - m_count = count + 1; - m_vertices = (b2Vec2*)b2Alloc(m_count * sizeof(b2Vec2)); - memcpy(m_vertices, vertices, count * sizeof(b2Vec2)); - m_vertices[count] = m_vertices[0]; - m_prevVertex = m_vertices[m_count - 2]; - m_nextVertex = m_vertices[1]; - m_hasPrevVertex = true; - m_hasNextVertex = true; -} - -void b2ChainShape::CreateChain(const b2Vec2* vertices, int32 count) -{ - b2Assert(m_vertices == NULL && m_count == 0); - b2Assert(count >= 2); - for (int32 i = 1; i < count; ++i) - { - // If the code crashes here, it means your vertices are too close together. - b2Assert(b2DistanceSquared(vertices[i-1], vertices[i]) > b2_linearSlop * b2_linearSlop); - } - - m_count = count; - m_vertices = (b2Vec2*)b2Alloc(count * sizeof(b2Vec2)); - memcpy(m_vertices, vertices, m_count * sizeof(b2Vec2)); - - m_hasPrevVertex = false; - m_hasNextVertex = false; - - m_prevVertex.SetZero(); - m_nextVertex.SetZero(); -} - -void b2ChainShape::SetPrevVertex(const b2Vec2& prevVertex) -{ - m_prevVertex = prevVertex; - m_hasPrevVertex = true; -} - -void b2ChainShape::SetNextVertex(const b2Vec2& nextVertex) -{ - m_nextVertex = nextVertex; - m_hasNextVertex = true; -} - -b2Shape* b2ChainShape::Clone(b2BlockAllocator* allocator) const -{ - void* mem = allocator->Allocate(sizeof(b2ChainShape)); - b2ChainShape* clone = new (mem) b2ChainShape; - clone->CreateChain(m_vertices, m_count); - clone->m_prevVertex = m_prevVertex; - clone->m_nextVertex = m_nextVertex; - clone->m_hasPrevVertex = m_hasPrevVertex; - clone->m_hasNextVertex = m_hasNextVertex; - return clone; -} - -int32 b2ChainShape::GetChildCount() const -{ - // edge count = vertex count - 1 - return m_count - 1; -} - -void b2ChainShape::GetChildEdge(b2EdgeShape* edge, int32 index) const -{ - b2Assert(0 <= index && index < m_count - 1); - edge->m_type = b2Shape::e_edge; - edge->m_radius = m_radius; - - edge->m_vertex1 = m_vertices[index + 0]; - edge->m_vertex2 = m_vertices[index + 1]; - - if (index > 0) - { - edge->m_vertex0 = m_vertices[index - 1]; - edge->m_hasVertex0 = true; - } - else - { - edge->m_vertex0 = m_prevVertex; - edge->m_hasVertex0 = m_hasPrevVertex; - } - - if (index < m_count - 2) - { - edge->m_vertex3 = m_vertices[index + 2]; - edge->m_hasVertex3 = true; - } - else - { - edge->m_vertex3 = m_nextVertex; - edge->m_hasVertex3 = m_hasNextVertex; - } -} - -bool b2ChainShape::TestPoint(const b2Transform& xf, const b2Vec2& p) const -{ - B2_NOT_USED(xf); - B2_NOT_USED(p); - return false; -} - -bool b2ChainShape::RayCast(b2RayCastOutput* output, const b2RayCastInput& input, - const b2Transform& xf, int32 childIndex) const -{ - b2Assert(childIndex < m_count); - - b2EdgeShape edgeShape; - - int32 i1 = childIndex; - int32 i2 = childIndex + 1; - if (i2 == m_count) - { - i2 = 0; - } - - edgeShape.m_vertex1 = m_vertices[i1]; - edgeShape.m_vertex2 = m_vertices[i2]; - - return edgeShape.RayCast(output, input, xf, 0); -} - -void b2ChainShape::ComputeAABB(b2AABB* aabb, const b2Transform& xf, int32 childIndex) const -{ - b2Assert(childIndex < m_count); - - int32 i1 = childIndex; - int32 i2 = childIndex + 1; - if (i2 == m_count) - { - i2 = 0; - } - - b2Vec2 v1 = b2Mul(xf, m_vertices[i1]); - b2Vec2 v2 = b2Mul(xf, m_vertices[i2]); - - aabb->lowerBound = b2Min(v1, v2); - aabb->upperBound = b2Max(v1, v2); -} - -void b2ChainShape::ComputeMass(b2MassData* massData, float32 density) const -{ - B2_NOT_USED(density); - - massData->mass = 0.0f; - massData->center.SetZero(); - massData->I = 0.0f; -} diff --git a/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2ChainShape.h b/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2ChainShape.h deleted file mode 100644 index 44493c43..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2ChainShape.h +++ /dev/null @@ -1,105 +0,0 @@ -/* -* Copyright (c) 2006-2010 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_CHAIN_SHAPE_H -#define B2_CHAIN_SHAPE_H - -#include - -class b2EdgeShape; - -/// A chain shape is a free form sequence of line segments. -/// The chain has two-sided collision, so you can use inside and outside collision. -/// Therefore, you may use any winding order. -/// Since there may be many vertices, they are allocated using b2Alloc. -/// Connectivity information is used to create smooth collisions. -/// WARNING: The chain will not collide properly if there are self-intersections. -class b2ChainShape : public b2Shape -{ -public: - b2ChainShape(); - - /// The destructor frees the vertices using b2Free. - ~b2ChainShape(); - - /// Clear all data. - void Clear(); - - /// Create a loop. This automatically adjusts connectivity. - /// @param vertices an array of vertices, these are copied - /// @param count the vertex count - void CreateLoop(const b2Vec2* vertices, int32 count); - - /// Create a chain with isolated end vertices. - /// @param vertices an array of vertices, these are copied - /// @param count the vertex count - void CreateChain(const b2Vec2* vertices, int32 count); - - /// Establish connectivity to a vertex that precedes the first vertex. - /// Don't call this for loops. - void SetPrevVertex(const b2Vec2& prevVertex); - - /// Establish connectivity to a vertex that follows the last vertex. - /// Don't call this for loops. - void SetNextVertex(const b2Vec2& nextVertex); - - /// Implement b2Shape. Vertices are cloned using b2Alloc. - b2Shape* Clone(b2BlockAllocator* allocator) const; - - /// @see b2Shape::GetChildCount - int32 GetChildCount() const; - - /// Get a child edge. - void GetChildEdge(b2EdgeShape* edge, int32 index) const; - - /// This always return false. - /// @see b2Shape::TestPoint - bool TestPoint(const b2Transform& transform, const b2Vec2& p) const; - - /// Implement b2Shape. - bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input, - const b2Transform& transform, int32 childIndex) const; - - /// @see b2Shape::ComputeAABB - void ComputeAABB(b2AABB* aabb, const b2Transform& transform, int32 childIndex) const; - - /// Chains have zero mass. - /// @see b2Shape::ComputeMass - void ComputeMass(b2MassData* massData, float32 density) const; - - /// The vertices. Owned by this class. - b2Vec2* m_vertices; - - /// The vertex count. - int32 m_count; - - b2Vec2 m_prevVertex, m_nextVertex; - bool m_hasPrevVertex, m_hasNextVertex; -}; - -inline b2ChainShape::b2ChainShape() -{ - m_type = e_chain; - m_radius = b2_polygonRadius; - m_vertices = NULL; - m_count = 0; - m_hasPrevVertex = false; - m_hasNextVertex = false; -} - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2CircleShape.cpp b/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2CircleShape.cpp deleted file mode 100644 index 39d4ae99..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2CircleShape.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include - -b2Shape* b2CircleShape::Clone(b2BlockAllocator* allocator) const -{ - void* mem = allocator->Allocate(sizeof(b2CircleShape)); - b2CircleShape* clone = new (mem) b2CircleShape; - *clone = *this; - return clone; -} - -int32 b2CircleShape::GetChildCount() const -{ - return 1; -} - -bool b2CircleShape::TestPoint(const b2Transform& transform, const b2Vec2& p) const -{ - b2Vec2 center = transform.p + b2Mul(transform.q, m_p); - b2Vec2 d = p - center; - return b2Dot(d, d) <= m_radius * m_radius; -} - -// Collision Detection in Interactive 3D Environments by Gino van den Bergen -// From Section 3.1.2 -// x = s + a * r -// norm(x) = radius -bool b2CircleShape::RayCast(b2RayCastOutput* output, const b2RayCastInput& input, - const b2Transform& transform, int32 childIndex) const -{ - B2_NOT_USED(childIndex); - - b2Vec2 position = transform.p + b2Mul(transform.q, m_p); - b2Vec2 s = input.p1 - position; - float32 b = b2Dot(s, s) - m_radius * m_radius; - - // Solve quadratic equation. - b2Vec2 r = input.p2 - input.p1; - float32 c = b2Dot(s, r); - float32 rr = b2Dot(r, r); - float32 sigma = c * c - rr * b; - - // Check for negative discriminant and short segment. - if (sigma < 0.0f || rr < b2_epsilon) - { - return false; - } - - // Find the point of intersection of the line with the circle. - float32 a = -(c + b2Sqrt(sigma)); - - // Is the intersection point on the segment? - if (0.0f <= a && a <= input.maxFraction * rr) - { - a /= rr; - output->fraction = a; - output->normal = s + a * r; - output->normal.Normalize(); - return true; - } - - return false; -} - -void b2CircleShape::ComputeAABB(b2AABB* aabb, const b2Transform& transform, int32 childIndex) const -{ - B2_NOT_USED(childIndex); - - b2Vec2 p = transform.p + b2Mul(transform.q, m_p); - aabb->lowerBound.Set(p.x - m_radius, p.y - m_radius); - aabb->upperBound.Set(p.x + m_radius, p.y + m_radius); -} - -void b2CircleShape::ComputeMass(b2MassData* massData, float32 density) const -{ - massData->mass = density * b2_pi * m_radius * m_radius; - massData->center = m_p; - - // inertia about the local origin - massData->I = massData->mass * (0.5f * m_radius * m_radius + b2Dot(m_p, m_p)); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2CircleShape.h b/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2CircleShape.h deleted file mode 100644 index 3209f924..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2CircleShape.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_CIRCLE_SHAPE_H -#define B2_CIRCLE_SHAPE_H - -#include - -/// A circle shape. -class b2CircleShape : public b2Shape -{ -public: - b2CircleShape(); - - /// Implement b2Shape. - b2Shape* Clone(b2BlockAllocator* allocator) const; - - /// @see b2Shape::GetChildCount - int32 GetChildCount() const; - - /// Implement b2Shape. - bool TestPoint(const b2Transform& transform, const b2Vec2& p) const; - - /// Implement b2Shape. - bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input, - const b2Transform& transform, int32 childIndex) const; - - /// @see b2Shape::ComputeAABB - void ComputeAABB(b2AABB* aabb, const b2Transform& transform, int32 childIndex) const; - - /// @see b2Shape::ComputeMass - void ComputeMass(b2MassData* massData, float32 density) const; - - /// Get the supporting vertex index in the given direction. - int32 GetSupport(const b2Vec2& d) const; - - /// Get the supporting vertex in the given direction. - const b2Vec2& GetSupportVertex(const b2Vec2& d) const; - - /// Get the vertex count. - int32 GetVertexCount() const { return 1; } - - /// Get a vertex by index. Used by b2Distance. - const b2Vec2& GetVertex(int32 index) const; - - /// Position - b2Vec2 m_p; -}; - -inline b2CircleShape::b2CircleShape() -{ - m_type = e_circle; - m_radius = 0.0f; - m_p.SetZero(); -} - -inline int32 b2CircleShape::GetSupport(const b2Vec2 &d) const -{ - B2_NOT_USED(d); - return 0; -} - -inline const b2Vec2& b2CircleShape::GetSupportVertex(const b2Vec2 &d) const -{ - B2_NOT_USED(d); - return m_p; -} - -inline const b2Vec2& b2CircleShape::GetVertex(int32 index) const -{ - B2_NOT_USED(index); - b2Assert(index == 0); - return m_p; -} - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2EdgeShape.cpp b/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2EdgeShape.cpp deleted file mode 100644 index 8bcd12f7..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2EdgeShape.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* -* Copyright (c) 2006-2010 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include - -void b2EdgeShape::Set(const b2Vec2& v1, const b2Vec2& v2) -{ - m_vertex1 = v1; - m_vertex2 = v2; - m_hasVertex0 = false; - m_hasVertex3 = false; -} - -b2Shape* b2EdgeShape::Clone(b2BlockAllocator* allocator) const -{ - void* mem = allocator->Allocate(sizeof(b2EdgeShape)); - b2EdgeShape* clone = new (mem) b2EdgeShape; - *clone = *this; - return clone; -} - -int32 b2EdgeShape::GetChildCount() const -{ - return 1; -} - -bool b2EdgeShape::TestPoint(const b2Transform& xf, const b2Vec2& p) const -{ - B2_NOT_USED(xf); - B2_NOT_USED(p); - return false; -} - -// p = p1 + t * d -// v = v1 + s * e -// p1 + t * d = v1 + s * e -// s * e - t * d = p1 - v1 -bool b2EdgeShape::RayCast(b2RayCastOutput* output, const b2RayCastInput& input, - const b2Transform& xf, int32 childIndex) const -{ - B2_NOT_USED(childIndex); - - // Put the ray into the edge's frame of reference. - b2Vec2 p1 = b2MulT(xf.q, input.p1 - xf.p); - b2Vec2 p2 = b2MulT(xf.q, input.p2 - xf.p); - b2Vec2 d = p2 - p1; - - b2Vec2 v1 = m_vertex1; - b2Vec2 v2 = m_vertex2; - b2Vec2 e = v2 - v1; - b2Vec2 normal(e.y, -e.x); - normal.Normalize(); - - // q = p1 + t * d - // dot(normal, q - v1) = 0 - // dot(normal, p1 - v1) + t * dot(normal, d) = 0 - float32 numerator = b2Dot(normal, v1 - p1); - float32 denominator = b2Dot(normal, d); - - if (denominator == 0.0f) - { - return false; - } - - float32 t = numerator / denominator; - if (t < 0.0f || input.maxFraction < t) - { - return false; - } - - b2Vec2 q = p1 + t * d; - - // q = v1 + s * r - // s = dot(q - v1, r) / dot(r, r) - b2Vec2 r = v2 - v1; - float32 rr = b2Dot(r, r); - if (rr == 0.0f) - { - return false; - } - - float32 s = b2Dot(q - v1, r) / rr; - if (s < 0.0f || 1.0f < s) - { - return false; - } - - output->fraction = t; - if (numerator > 0.0f) - { - output->normal = -b2Mul(xf.q, normal); - } - else - { - output->normal = b2Mul(xf.q, normal); - } - return true; -} - -void b2EdgeShape::ComputeAABB(b2AABB* aabb, const b2Transform& xf, int32 childIndex) const -{ - B2_NOT_USED(childIndex); - - b2Vec2 v1 = b2Mul(xf, m_vertex1); - b2Vec2 v2 = b2Mul(xf, m_vertex2); - - b2Vec2 lower = b2Min(v1, v2); - b2Vec2 upper = b2Max(v1, v2); - - b2Vec2 r(m_radius, m_radius); - aabb->lowerBound = lower - r; - aabb->upperBound = upper + r; -} - -void b2EdgeShape::ComputeMass(b2MassData* massData, float32 density) const -{ - B2_NOT_USED(density); - - massData->mass = 0.0f; - massData->center = 0.5f * (m_vertex1 + m_vertex2); - massData->I = 0.0f; -} diff --git a/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2EdgeShape.h b/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2EdgeShape.h deleted file mode 100644 index 0acef851..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2EdgeShape.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -* Copyright (c) 2006-2010 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_EDGE_SHAPE_H -#define B2_EDGE_SHAPE_H - -#include - -/// A line segment (edge) shape. These can be connected in chains or loops -/// to other edge shapes. The connectivity information is used to ensure -/// correct contact normals. -class b2EdgeShape : public b2Shape -{ -public: - b2EdgeShape(); - - /// Set this as an isolated edge. - void Set(const b2Vec2& v1, const b2Vec2& v2); - - /// Implement b2Shape. - b2Shape* Clone(b2BlockAllocator* allocator) const; - - /// @see b2Shape::GetChildCount - int32 GetChildCount() const; - - /// @see b2Shape::TestPoint - bool TestPoint(const b2Transform& transform, const b2Vec2& p) const; - - /// Implement b2Shape. - bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input, - const b2Transform& transform, int32 childIndex) const; - - /// @see b2Shape::ComputeAABB - void ComputeAABB(b2AABB* aabb, const b2Transform& transform, int32 childIndex) const; - - /// @see b2Shape::ComputeMass - void ComputeMass(b2MassData* massData, float32 density) const; - - /// These are the edge vertices - b2Vec2 m_vertex1, m_vertex2; - - /// Optional adjacent vertices. These are used for smooth collision. - b2Vec2 m_vertex0, m_vertex3; - bool m_hasVertex0, m_hasVertex3; -}; - -inline b2EdgeShape::b2EdgeShape() -{ - m_type = e_edge; - m_radius = b2_polygonRadius; - m_vertex0.x = 0.0f; - m_vertex0.y = 0.0f; - m_vertex3.x = 0.0f; - m_vertex3.y = 0.0f; - m_hasVertex0 = false; - m_hasVertex3 = false; -} - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2PolygonShape.cpp b/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2PolygonShape.cpp deleted file mode 100644 index 26ba7b3a..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2PolygonShape.cpp +++ /dev/null @@ -1,467 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include - -b2Shape* b2PolygonShape::Clone(b2BlockAllocator* allocator) const -{ - void* mem = allocator->Allocate(sizeof(b2PolygonShape)); - b2PolygonShape* clone = new (mem) b2PolygonShape; - *clone = *this; - return clone; -} - -void b2PolygonShape::SetAsBox(float32 hx, float32 hy) -{ - m_count = 4; - m_vertices[0].Set(-hx, -hy); - m_vertices[1].Set( hx, -hy); - m_vertices[2].Set( hx, hy); - m_vertices[3].Set(-hx, hy); - m_normals[0].Set(0.0f, -1.0f); - m_normals[1].Set(1.0f, 0.0f); - m_normals[2].Set(0.0f, 1.0f); - m_normals[3].Set(-1.0f, 0.0f); - m_centroid.SetZero(); -} - -void b2PolygonShape::SetAsBox(float32 hx, float32 hy, const b2Vec2& center, float32 angle) -{ - m_count = 4; - m_vertices[0].Set(-hx, -hy); - m_vertices[1].Set( hx, -hy); - m_vertices[2].Set( hx, hy); - m_vertices[3].Set(-hx, hy); - m_normals[0].Set(0.0f, -1.0f); - m_normals[1].Set(1.0f, 0.0f); - m_normals[2].Set(0.0f, 1.0f); - m_normals[3].Set(-1.0f, 0.0f); - m_centroid = center; - - b2Transform xf; - xf.p = center; - xf.q.Set(angle); - - // Transform vertices and normals. - for (int32 i = 0; i < m_count; ++i) - { - m_vertices[i] = b2Mul(xf, m_vertices[i]); - m_normals[i] = b2Mul(xf.q, m_normals[i]); - } -} - -int32 b2PolygonShape::GetChildCount() const -{ - return 1; -} - -static b2Vec2 ComputeCentroid(const b2Vec2* vs, int32 count) -{ - b2Assert(count >= 3); - - b2Vec2 c; c.Set(0.0f, 0.0f); - float32 area = 0.0f; - - // pRef is the reference point for forming triangles. - // It's location doesn't change the result (except for rounding error). - b2Vec2 pRef(0.0f, 0.0f); -#if 0 - // This code would put the reference point inside the polygon. - for (int32 i = 0; i < count; ++i) - { - pRef += vs[i]; - } - pRef *= 1.0f / count; -#endif - - const float32 inv3 = 1.0f / 3.0f; - - for (int32 i = 0; i < count; ++i) - { - // Triangle vertices. - b2Vec2 p1 = pRef; - b2Vec2 p2 = vs[i]; - b2Vec2 p3 = i + 1 < count ? vs[i+1] : vs[0]; - - b2Vec2 e1 = p2 - p1; - b2Vec2 e2 = p3 - p1; - - float32 D = b2Cross(e1, e2); - - float32 triangleArea = 0.5f * D; - area += triangleArea; - - // Area weighted centroid - c += triangleArea * inv3 * (p1 + p2 + p3); - } - - // Centroid - b2Assert(area > b2_epsilon); - c *= 1.0f / area; - return c; -} - -void b2PolygonShape::Set(const b2Vec2* vertices, int32 count) -{ - b2Assert(3 <= count && count <= b2_maxPolygonVertices); - if (count < 3) - { - SetAsBox(1.0f, 1.0f); - return; - } - - int32 n = b2Min(count, b2_maxPolygonVertices); - - // Perform welding and copy vertices into local buffer. - b2Vec2 ps[b2_maxPolygonVertices]; - int32 tempCount = 0; - for (int32 i = 0; i < n; ++i) - { - b2Vec2 v = vertices[i]; - - bool unique = true; - for (int32 j = 0; j < tempCount; ++j) - { - if (b2DistanceSquared(v, ps[j]) < ((0.5f * b2_linearSlop) * (0.5f * b2_linearSlop))) - { - unique = false; - break; - } - } - - if (unique) - { - ps[tempCount++] = v; - } - } - - n = tempCount; - if (n < 3) - { - // Polygon is degenerate. - b2Assert(false); - SetAsBox(1.0f, 1.0f); - return; - } - - // Create the convex hull using the Gift wrapping algorithm - // http://en.wikipedia.org/wiki/Gift_wrapping_algorithm - - // Find the right most point on the hull - int32 i0 = 0; - float32 x0 = ps[0].x; - for (int32 i = 1; i < n; ++i) - { - float32 x = ps[i].x; - if (x > x0 || (x == x0 && ps[i].y < ps[i0].y)) - { - i0 = i; - x0 = x; - } - } - - int32 hull[b2_maxPolygonVertices]; - int32 m = 0; - int32 ih = i0; - - for (;;) - { - hull[m] = ih; - - int32 ie = 0; - for (int32 j = 1; j < n; ++j) - { - if (ie == ih) - { - ie = j; - continue; - } - - b2Vec2 r = ps[ie] - ps[hull[m]]; - b2Vec2 v = ps[j] - ps[hull[m]]; - float32 c = b2Cross(r, v); - if (c < 0.0f) - { - ie = j; - } - - // Collinearity check - if (c == 0.0f && v.LengthSquared() > r.LengthSquared()) - { - ie = j; - } - } - - ++m; - ih = ie; - - if (ie == i0) - { - break; - } - } - - if (m < 3) - { - // Polygon is degenerate. - b2Assert(false); - SetAsBox(1.0f, 1.0f); - return; - } - - m_count = m; - - // Copy vertices. - for (int32 i = 0; i < m; ++i) - { - m_vertices[i] = ps[hull[i]]; - } - - // Compute normals. Ensure the edges have non-zero length. - for (int32 i = 0; i < m; ++i) - { - int32 i1 = i; - int32 i2 = i + 1 < m ? i + 1 : 0; - b2Vec2 edge = m_vertices[i2] - m_vertices[i1]; - b2Assert(edge.LengthSquared() > b2_epsilon * b2_epsilon); - m_normals[i] = b2Cross(edge, 1.0f); - m_normals[i].Normalize(); - } - - // Compute the polygon centroid. - m_centroid = ComputeCentroid(m_vertices, m); -} - -bool b2PolygonShape::TestPoint(const b2Transform& xf, const b2Vec2& p) const -{ - b2Vec2 pLocal = b2MulT(xf.q, p - xf.p); - - for (int32 i = 0; i < m_count; ++i) - { - float32 dot = b2Dot(m_normals[i], pLocal - m_vertices[i]); - if (dot > 0.0f) - { - return false; - } - } - - return true; -} - -bool b2PolygonShape::RayCast(b2RayCastOutput* output, const b2RayCastInput& input, - const b2Transform& xf, int32 childIndex) const -{ - B2_NOT_USED(childIndex); - - // Put the ray into the polygon's frame of reference. - b2Vec2 p1 = b2MulT(xf.q, input.p1 - xf.p); - b2Vec2 p2 = b2MulT(xf.q, input.p2 - xf.p); - b2Vec2 d = p2 - p1; - - float32 lower = 0.0f, upper = input.maxFraction; - - int32 index = -1; - - for (int32 i = 0; i < m_count; ++i) - { - // p = p1 + a * d - // dot(normal, p - v) = 0 - // dot(normal, p1 - v) + a * dot(normal, d) = 0 - float32 numerator = b2Dot(m_normals[i], m_vertices[i] - p1); - float32 denominator = b2Dot(m_normals[i], d); - - if (denominator == 0.0f) - { - if (numerator < 0.0f) - { - return false; - } - } - else - { - // Note: we want this predicate without division: - // lower < numerator / denominator, where denominator < 0 - // Since denominator < 0, we have to flip the inequality: - // lower < numerator / denominator <==> denominator * lower > numerator. - if (denominator < 0.0f && numerator < lower * denominator) - { - // Increase lower. - // The segment enters this half-space. - lower = numerator / denominator; - index = i; - } - else if (denominator > 0.0f && numerator < upper * denominator) - { - // Decrease upper. - // The segment exits this half-space. - upper = numerator / denominator; - } - } - - // The use of epsilon here causes the assert on lower to trip - // in some cases. Apparently the use of epsilon was to make edge - // shapes work, but now those are handled separately. - //if (upper < lower - b2_epsilon) - if (upper < lower) - { - return false; - } - } - - b2Assert(0.0f <= lower && lower <= input.maxFraction); - - if (index >= 0) - { - output->fraction = lower; - output->normal = b2Mul(xf.q, m_normals[index]); - return true; - } - - return false; -} - -void b2PolygonShape::ComputeAABB(b2AABB* aabb, const b2Transform& xf, int32 childIndex) const -{ - B2_NOT_USED(childIndex); - - b2Vec2 lower = b2Mul(xf, m_vertices[0]); - b2Vec2 upper = lower; - - for (int32 i = 1; i < m_count; ++i) - { - b2Vec2 v = b2Mul(xf, m_vertices[i]); - lower = b2Min(lower, v); - upper = b2Max(upper, v); - } - - b2Vec2 r(m_radius, m_radius); - aabb->lowerBound = lower - r; - aabb->upperBound = upper + r; -} - -void b2PolygonShape::ComputeMass(b2MassData* massData, float32 density) const -{ - // Polygon mass, centroid, and inertia. - // Let rho be the polygon density in mass per unit area. - // Then: - // mass = rho * int(dA) - // centroid.x = (1/mass) * rho * int(x * dA) - // centroid.y = (1/mass) * rho * int(y * dA) - // I = rho * int((x*x + y*y) * dA) - // - // We can compute these integrals by summing all the integrals - // for each triangle of the polygon. To evaluate the integral - // for a single triangle, we make a change of variables to - // the (u,v) coordinates of the triangle: - // x = x0 + e1x * u + e2x * v - // y = y0 + e1y * u + e2y * v - // where 0 <= u && 0 <= v && u + v <= 1. - // - // We integrate u from [0,1-v] and then v from [0,1]. - // We also need to use the Jacobian of the transformation: - // D = cross(e1, e2) - // - // Simplification: triangle centroid = (1/3) * (p1 + p2 + p3) - // - // The rest of the derivation is handled by computer algebra. - - b2Assert(m_count >= 3); - - b2Vec2 center; center.Set(0.0f, 0.0f); - float32 area = 0.0f; - float32 I = 0.0f; - - // s is the reference point for forming triangles. - // It's location doesn't change the result (except for rounding error). - b2Vec2 s(0.0f, 0.0f); - - // This code would put the reference point inside the polygon. - for (int32 i = 0; i < m_count; ++i) - { - s += m_vertices[i]; - } - s *= 1.0f / m_count; - - const float32 k_inv3 = 1.0f / 3.0f; - - for (int32 i = 0; i < m_count; ++i) - { - // Triangle vertices. - b2Vec2 e1 = m_vertices[i] - s; - b2Vec2 e2 = i + 1 < m_count ? m_vertices[i+1] - s : m_vertices[0] - s; - - float32 D = b2Cross(e1, e2); - - float32 triangleArea = 0.5f * D; - area += triangleArea; - - // Area weighted centroid - center += triangleArea * k_inv3 * (e1 + e2); - - float32 ex1 = e1.x, ey1 = e1.y; - float32 ex2 = e2.x, ey2 = e2.y; - - float32 intx2 = ex1*ex1 + ex2*ex1 + ex2*ex2; - float32 inty2 = ey1*ey1 + ey2*ey1 + ey2*ey2; - - I += (0.25f * k_inv3 * D) * (intx2 + inty2); - } - - // Total mass - massData->mass = density * area; - - // Center of mass - b2Assert(area > b2_epsilon); - center *= 1.0f / area; - massData->center = center + s; - - // Inertia tensor relative to the local origin (point s). - massData->I = density * I; - - // Shift to center of mass then to original body origin. - massData->I += massData->mass * (b2Dot(massData->center, massData->center) - b2Dot(center, center)); -} - -bool b2PolygonShape::Validate() const -{ - for (int32 i = 0; i < m_count; ++i) - { - int32 i1 = i; - int32 i2 = i < m_count - 1 ? i1 + 1 : 0; - b2Vec2 p = m_vertices[i1]; - b2Vec2 e = m_vertices[i2] - p; - - for (int32 j = 0; j < m_count; ++j) - { - if (j == i1 || j == i2) - { - continue; - } - - b2Vec2 v = m_vertices[j] - p; - float32 c = b2Cross(e, v); - if (c < 0.0f) - { - return false; - } - } - } - - return true; -} diff --git a/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2PolygonShape.h b/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2PolygonShape.h deleted file mode 100644 index b1929803..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2PolygonShape.h +++ /dev/null @@ -1,101 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_POLYGON_SHAPE_H -#define B2_POLYGON_SHAPE_H - -#include - -/// A convex polygon. It is assumed that the interior of the polygon is to -/// the left of each edge. -/// Polygons have a maximum number of vertices equal to b2_maxPolygonVertices. -/// In most cases you should not need many vertices for a convex polygon. -class b2PolygonShape : public b2Shape -{ -public: - b2PolygonShape(); - - /// Implement b2Shape. - b2Shape* Clone(b2BlockAllocator* allocator) const; - - /// @see b2Shape::GetChildCount - int32 GetChildCount() const; - - /// Create a convex hull from the given array of local points. - /// The count must be in the range [3, b2_maxPolygonVertices]. - /// @warning the points may be re-ordered, even if they form a convex polygon - /// @warning collinear points are handled but not removed. Collinear points - /// may lead to poor stacking behavior. - void Set(const b2Vec2* points, int32 count); - - /// Build vertices to represent an axis-aligned box centered on the local origin. - /// @param hx the half-width. - /// @param hy the half-height. - void SetAsBox(float32 hx, float32 hy); - - /// Build vertices to represent an oriented box. - /// @param hx the half-width. - /// @param hy the half-height. - /// @param center the center of the box in local coordinates. - /// @param angle the rotation of the box in local coordinates. - void SetAsBox(float32 hx, float32 hy, const b2Vec2& center, float32 angle); - - /// @see b2Shape::TestPoint - bool TestPoint(const b2Transform& transform, const b2Vec2& p) const; - - /// Implement b2Shape. - bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input, - const b2Transform& transform, int32 childIndex) const; - - /// @see b2Shape::ComputeAABB - void ComputeAABB(b2AABB* aabb, const b2Transform& transform, int32 childIndex) const; - - /// @see b2Shape::ComputeMass - void ComputeMass(b2MassData* massData, float32 density) const; - - /// Get the vertex count. - int32 GetVertexCount() const { return m_count; } - - /// Get a vertex by index. - const b2Vec2& GetVertex(int32 index) const; - - /// Validate convexity. This is a very time consuming operation. - /// @returns true if valid - bool Validate() const; - - b2Vec2 m_centroid; - b2Vec2 m_vertices[b2_maxPolygonVertices]; - b2Vec2 m_normals[b2_maxPolygonVertices]; - int32 m_count; -}; - -inline b2PolygonShape::b2PolygonShape() -{ - m_type = e_polygon; - m_radius = b2_polygonRadius; - m_count = 0; - m_centroid.SetZero(); -} - -inline const b2Vec2& b2PolygonShape::GetVertex(int32 index) const -{ - b2Assert(0 <= index && index < m_count); - return m_vertices[index]; -} - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2Shape.h b/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2Shape.h deleted file mode 100644 index 170ea1a1..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Collision/Shapes/b2Shape.h +++ /dev/null @@ -1,101 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_SHAPE_H -#define B2_SHAPE_H - -#include -#include -#include - -/// This holds the mass data computed for a shape. -struct b2MassData -{ - /// The mass of the shape, usually in kilograms. - float32 mass; - - /// The position of the shape's centroid relative to the shape's origin. - b2Vec2 center; - - /// The rotational inertia of the shape about the local origin. - float32 I; -}; - -/// A shape is used for collision detection. You can create a shape however you like. -/// Shapes used for simulation in b2World are created automatically when a b2Fixture -/// is created. Shapes may encapsulate a one or more child shapes. -class b2Shape -{ -public: - - enum Type - { - e_circle = 0, - e_edge = 1, - e_polygon = 2, - e_chain = 3, - e_typeCount = 4 - }; - - virtual ~b2Shape() {} - - /// Clone the concrete shape using the provided allocator. - virtual b2Shape* Clone(b2BlockAllocator* allocator) const = 0; - - /// Get the type of this shape. You can use this to down cast to the concrete shape. - /// @return the shape type. - Type GetType() const; - - /// Get the number of child primitives. - virtual int32 GetChildCount() const = 0; - - /// Test a point for containment in this shape. This only works for convex shapes. - /// @param xf the shape world transform. - /// @param p a point in world coordinates. - virtual bool TestPoint(const b2Transform& xf, const b2Vec2& p) const = 0; - - /// Cast a ray against a child shape. - /// @param output the ray-cast results. - /// @param input the ray-cast input parameters. - /// @param transform the transform to be applied to the shape. - /// @param childIndex the child shape index - virtual bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input, - const b2Transform& transform, int32 childIndex) const = 0; - - /// Given a transform, compute the associated axis aligned bounding box for a child shape. - /// @param aabb returns the axis aligned box. - /// @param xf the world transform of the shape. - /// @param childIndex the child shape - virtual void ComputeAABB(b2AABB* aabb, const b2Transform& xf, int32 childIndex) const = 0; - - /// Compute the mass properties of this shape using its dimensions and density. - /// The inertia tensor is computed about the local origin. - /// @param massData returns the mass data for this shape. - /// @param density the density in kilograms per meter squared. - virtual void ComputeMass(b2MassData* massData, float32 density) const = 0; - - Type m_type; - float32 m_radius; -}; - -inline b2Shape::Type b2Shape::GetType() const -{ - return m_type; -} - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Collision/b2BroadPhase.cpp b/love/src/jni/love/src/libraries/Box2D/Collision/b2BroadPhase.cpp deleted file mode 100644 index f46e4d09..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Collision/b2BroadPhase.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include - -b2BroadPhase::b2BroadPhase() -{ - m_proxyCount = 0; - - m_pairCapacity = 16; - m_pairCount = 0; - m_pairBuffer = (b2Pair*)b2Alloc(m_pairCapacity * sizeof(b2Pair)); - - m_moveCapacity = 16; - m_moveCount = 0; - m_moveBuffer = (int32*)b2Alloc(m_moveCapacity * sizeof(int32)); -} - -b2BroadPhase::~b2BroadPhase() -{ - b2Free(m_moveBuffer); - b2Free(m_pairBuffer); -} - -int32 b2BroadPhase::CreateProxy(const b2AABB& aabb, void* userData) -{ - int32 proxyId = m_tree.CreateProxy(aabb, userData); - ++m_proxyCount; - BufferMove(proxyId); - return proxyId; -} - -void b2BroadPhase::DestroyProxy(int32 proxyId) -{ - UnBufferMove(proxyId); - --m_proxyCount; - m_tree.DestroyProxy(proxyId); -} - -void b2BroadPhase::MoveProxy(int32 proxyId, const b2AABB& aabb, const b2Vec2& displacement) -{ - bool buffer = m_tree.MoveProxy(proxyId, aabb, displacement); - if (buffer) - { - BufferMove(proxyId); - } -} - -void b2BroadPhase::TouchProxy(int32 proxyId) -{ - BufferMove(proxyId); -} - -void b2BroadPhase::BufferMove(int32 proxyId) -{ - if (m_moveCount == m_moveCapacity) - { - int32* oldBuffer = m_moveBuffer; - m_moveCapacity *= 2; - m_moveBuffer = (int32*)b2Alloc(m_moveCapacity * sizeof(int32)); - memcpy(m_moveBuffer, oldBuffer, m_moveCount * sizeof(int32)); - b2Free(oldBuffer); - } - - m_moveBuffer[m_moveCount] = proxyId; - ++m_moveCount; -} - -void b2BroadPhase::UnBufferMove(int32 proxyId) -{ - for (int32 i = 0; i < m_moveCount; ++i) - { - if (m_moveBuffer[i] == proxyId) - { - m_moveBuffer[i] = e_nullProxy; - } - } -} - -// This is called from b2DynamicTree::Query when we are gathering pairs. -bool b2BroadPhase::QueryCallback(int32 proxyId) -{ - // A proxy cannot form a pair with itself. - if (proxyId == m_queryProxyId) - { - return true; - } - - // Grow the pair buffer as needed. - if (m_pairCount == m_pairCapacity) - { - b2Pair* oldBuffer = m_pairBuffer; - m_pairCapacity *= 2; - m_pairBuffer = (b2Pair*)b2Alloc(m_pairCapacity * sizeof(b2Pair)); - memcpy(m_pairBuffer, oldBuffer, m_pairCount * sizeof(b2Pair)); - b2Free(oldBuffer); - } - - m_pairBuffer[m_pairCount].proxyIdA = b2Min(proxyId, m_queryProxyId); - m_pairBuffer[m_pairCount].proxyIdB = b2Max(proxyId, m_queryProxyId); - ++m_pairCount; - - return true; -} diff --git a/love/src/jni/love/src/libraries/Box2D/Collision/b2BroadPhase.h b/love/src/jni/love/src/libraries/Box2D/Collision/b2BroadPhase.h deleted file mode 100644 index 0c460cab..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Collision/b2BroadPhase.h +++ /dev/null @@ -1,257 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_BROAD_PHASE_H -#define B2_BROAD_PHASE_H - -#include -#include -#include -#include - -struct b2Pair -{ - int32 proxyIdA; - int32 proxyIdB; -}; - -/// The broad-phase is used for computing pairs and performing volume queries and ray casts. -/// This broad-phase does not persist pairs. Instead, this reports potentially new pairs. -/// It is up to the client to consume the new pairs and to track subsequent overlap. -class b2BroadPhase -{ -public: - - enum - { - e_nullProxy = -1 - }; - - b2BroadPhase(); - ~b2BroadPhase(); - - /// Create a proxy with an initial AABB. Pairs are not reported until - /// UpdatePairs is called. - int32 CreateProxy(const b2AABB& aabb, void* userData); - - /// Destroy a proxy. It is up to the client to remove any pairs. - void DestroyProxy(int32 proxyId); - - /// Call MoveProxy as many times as you like, then when you are done - /// call UpdatePairs to finalized the proxy pairs (for your time step). - void MoveProxy(int32 proxyId, const b2AABB& aabb, const b2Vec2& displacement); - - /// Call to trigger a re-processing of it's pairs on the next call to UpdatePairs. - void TouchProxy(int32 proxyId); - - /// Get the fat AABB for a proxy. - const b2AABB& GetFatAABB(int32 proxyId) const; - - /// Get user data from a proxy. Returns NULL if the id is invalid. - void* GetUserData(int32 proxyId) const; - - /// Test overlap of fat AABBs. - bool TestOverlap(int32 proxyIdA, int32 proxyIdB) const; - - /// Get the number of proxies. - int32 GetProxyCount() const; - - /// Update the pairs. This results in pair callbacks. This can only add pairs. - template - void UpdatePairs(T* callback); - - /// Query an AABB for overlapping proxies. The callback class - /// is called for each proxy that overlaps the supplied AABB. - template - void Query(T* callback, const b2AABB& aabb) const; - - /// Ray-cast against the proxies in the tree. This relies on the callback - /// to perform a exact ray-cast in the case were the proxy contains a shape. - /// The callback also performs the any collision filtering. This has performance - /// roughly equal to k * log(n), where k is the number of collisions and n is the - /// number of proxies in the tree. - /// @param input the ray-cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1). - /// @param callback a callback class that is called for each proxy that is hit by the ray. - template - void RayCast(T* callback, const b2RayCastInput& input) const; - - /// Get the height of the embedded tree. - int32 GetTreeHeight() const; - - /// Get the balance of the embedded tree. - int32 GetTreeBalance() const; - - /// Get the quality metric of the embedded tree. - float32 GetTreeQuality() const; - - /// Shift the world origin. Useful for large worlds. - /// The shift formula is: position -= newOrigin - /// @param newOrigin the new origin with respect to the old origin - void ShiftOrigin(const b2Vec2& newOrigin); - -private: - - friend class b2DynamicTree; - - void BufferMove(int32 proxyId); - void UnBufferMove(int32 proxyId); - - bool QueryCallback(int32 proxyId); - - b2DynamicTree m_tree; - - int32 m_proxyCount; - - int32* m_moveBuffer; - int32 m_moveCapacity; - int32 m_moveCount; - - b2Pair* m_pairBuffer; - int32 m_pairCapacity; - int32 m_pairCount; - - int32 m_queryProxyId; -}; - -/// This is used to sort pairs. -inline bool b2PairLessThan(const b2Pair& pair1, const b2Pair& pair2) -{ - if (pair1.proxyIdA < pair2.proxyIdA) - { - return true; - } - - if (pair1.proxyIdA == pair2.proxyIdA) - { - return pair1.proxyIdB < pair2.proxyIdB; - } - - return false; -} - -inline void* b2BroadPhase::GetUserData(int32 proxyId) const -{ - return m_tree.GetUserData(proxyId); -} - -inline bool b2BroadPhase::TestOverlap(int32 proxyIdA, int32 proxyIdB) const -{ - const b2AABB& aabbA = m_tree.GetFatAABB(proxyIdA); - const b2AABB& aabbB = m_tree.GetFatAABB(proxyIdB); - return b2TestOverlap(aabbA, aabbB); -} - -inline const b2AABB& b2BroadPhase::GetFatAABB(int32 proxyId) const -{ - return m_tree.GetFatAABB(proxyId); -} - -inline int32 b2BroadPhase::GetProxyCount() const -{ - return m_proxyCount; -} - -inline int32 b2BroadPhase::GetTreeHeight() const -{ - return m_tree.GetHeight(); -} - -inline int32 b2BroadPhase::GetTreeBalance() const -{ - return m_tree.GetMaxBalance(); -} - -inline float32 b2BroadPhase::GetTreeQuality() const -{ - return m_tree.GetAreaRatio(); -} - -template -void b2BroadPhase::UpdatePairs(T* callback) -{ - // Reset pair buffer - m_pairCount = 0; - - // Perform tree queries for all moving proxies. - for (int32 i = 0; i < m_moveCount; ++i) - { - m_queryProxyId = m_moveBuffer[i]; - if (m_queryProxyId == e_nullProxy) - { - continue; - } - - // We have to query the tree with the fat AABB so that - // we don't fail to create a pair that may touch later. - const b2AABB& fatAABB = m_tree.GetFatAABB(m_queryProxyId); - - // Query tree, create pairs and add them pair buffer. - m_tree.Query(this, fatAABB); - } - - // Reset move buffer - m_moveCount = 0; - - // Sort the pair buffer to expose duplicates. - std::sort(m_pairBuffer, m_pairBuffer + m_pairCount, b2PairLessThan); - - // Send the pairs back to the client. - int32 i = 0; - while (i < m_pairCount) - { - b2Pair* primaryPair = m_pairBuffer + i; - void* userDataA = m_tree.GetUserData(primaryPair->proxyIdA); - void* userDataB = m_tree.GetUserData(primaryPair->proxyIdB); - - callback->AddPair(userDataA, userDataB); - ++i; - - // Skip any duplicate pairs. - while (i < m_pairCount) - { - b2Pair* pair = m_pairBuffer + i; - if (pair->proxyIdA != primaryPair->proxyIdA || pair->proxyIdB != primaryPair->proxyIdB) - { - break; - } - ++i; - } - } - - // Try to keep the tree balanced. - //m_tree.Rebalance(4); -} - -template -inline void b2BroadPhase::Query(T* callback, const b2AABB& aabb) const -{ - m_tree.Query(callback, aabb); -} - -template -inline void b2BroadPhase::RayCast(T* callback, const b2RayCastInput& input) const -{ - m_tree.RayCast(callback, input); -} - -inline void b2BroadPhase::ShiftOrigin(const b2Vec2& newOrigin) -{ - m_tree.ShiftOrigin(newOrigin); -} - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Collision/b2CollideCircle.cpp b/love/src/jni/love/src/libraries/Box2D/Collision/b2CollideCircle.cpp deleted file mode 100644 index 4181fd47..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Collision/b2CollideCircle.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* -* Copyright (c) 2007-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include - -void b2CollideCircles( - b2Manifold* manifold, - const b2CircleShape* circleA, const b2Transform& xfA, - const b2CircleShape* circleB, const b2Transform& xfB) -{ - manifold->pointCount = 0; - - b2Vec2 pA = b2Mul(xfA, circleA->m_p); - b2Vec2 pB = b2Mul(xfB, circleB->m_p); - - b2Vec2 d = pB - pA; - float32 distSqr = b2Dot(d, d); - float32 rA = circleA->m_radius, rB = circleB->m_radius; - float32 radius = rA + rB; - if (distSqr > radius * radius) - { - return; - } - - manifold->type = b2Manifold::e_circles; - manifold->localPoint = circleA->m_p; - manifold->localNormal.SetZero(); - manifold->pointCount = 1; - - manifold->points[0].localPoint = circleB->m_p; - manifold->points[0].id.key = 0; -} - -void b2CollidePolygonAndCircle( - b2Manifold* manifold, - const b2PolygonShape* polygonA, const b2Transform& xfA, - const b2CircleShape* circleB, const b2Transform& xfB) -{ - manifold->pointCount = 0; - - // Compute circle position in the frame of the polygon. - b2Vec2 c = b2Mul(xfB, circleB->m_p); - b2Vec2 cLocal = b2MulT(xfA, c); - - // Find the min separating edge. - int32 normalIndex = 0; - float32 separation = -b2_maxFloat; - float32 radius = polygonA->m_radius + circleB->m_radius; - int32 vertexCount = polygonA->m_count; - const b2Vec2* vertices = polygonA->m_vertices; - const b2Vec2* normals = polygonA->m_normals; - - for (int32 i = 0; i < vertexCount; ++i) - { - float32 s = b2Dot(normals[i], cLocal - vertices[i]); - - if (s > radius) - { - // Early out. - return; - } - - if (s > separation) - { - separation = s; - normalIndex = i; - } - } - - // Vertices that subtend the incident face. - int32 vertIndex1 = normalIndex; - int32 vertIndex2 = vertIndex1 + 1 < vertexCount ? vertIndex1 + 1 : 0; - b2Vec2 v1 = vertices[vertIndex1]; - b2Vec2 v2 = vertices[vertIndex2]; - - // If the center is inside the polygon ... - if (separation < b2_epsilon) - { - manifold->pointCount = 1; - manifold->type = b2Manifold::e_faceA; - manifold->localNormal = normals[normalIndex]; - manifold->localPoint = 0.5f * (v1 + v2); - manifold->points[0].localPoint = circleB->m_p; - manifold->points[0].id.key = 0; - return; - } - - // Compute barycentric coordinates - float32 u1 = b2Dot(cLocal - v1, v2 - v1); - float32 u2 = b2Dot(cLocal - v2, v1 - v2); - if (u1 <= 0.0f) - { - if (b2DistanceSquared(cLocal, v1) > radius * radius) - { - return; - } - - manifold->pointCount = 1; - manifold->type = b2Manifold::e_faceA; - manifold->localNormal = cLocal - v1; - manifold->localNormal.Normalize(); - manifold->localPoint = v1; - manifold->points[0].localPoint = circleB->m_p; - manifold->points[0].id.key = 0; - } - else if (u2 <= 0.0f) - { - if (b2DistanceSquared(cLocal, v2) > radius * radius) - { - return; - } - - manifold->pointCount = 1; - manifold->type = b2Manifold::e_faceA; - manifold->localNormal = cLocal - v2; - manifold->localNormal.Normalize(); - manifold->localPoint = v2; - manifold->points[0].localPoint = circleB->m_p; - manifold->points[0].id.key = 0; - } - else - { - b2Vec2 faceCenter = 0.5f * (v1 + v2); - float32 separation = b2Dot(cLocal - faceCenter, normals[vertIndex1]); - if (separation > radius) - { - return; - } - - manifold->pointCount = 1; - manifold->type = b2Manifold::e_faceA; - manifold->localNormal = normals[vertIndex1]; - manifold->localPoint = faceCenter; - manifold->points[0].localPoint = circleB->m_p; - manifold->points[0].id.key = 0; - } -} diff --git a/love/src/jni/love/src/libraries/Box2D/Collision/b2CollideEdge.cpp b/love/src/jni/love/src/libraries/Box2D/Collision/b2CollideEdge.cpp deleted file mode 100644 index 88e311c6..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Collision/b2CollideEdge.cpp +++ /dev/null @@ -1,698 +0,0 @@ -/* - * Copyright (c) 2007-2009 Erin Catto http://www.box2d.org - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - */ - -#include -#include -#include -#include - - -// Compute contact points for edge versus circle. -// This accounts for edge connectivity. -void b2CollideEdgeAndCircle(b2Manifold* manifold, - const b2EdgeShape* edgeA, const b2Transform& xfA, - const b2CircleShape* circleB, const b2Transform& xfB) -{ - manifold->pointCount = 0; - - // Compute circle in frame of edge - b2Vec2 Q = b2MulT(xfA, b2Mul(xfB, circleB->m_p)); - - b2Vec2 A = edgeA->m_vertex1, B = edgeA->m_vertex2; - b2Vec2 e = B - A; - - // Barycentric coordinates - float32 u = b2Dot(e, B - Q); - float32 v = b2Dot(e, Q - A); - - float32 radius = edgeA->m_radius + circleB->m_radius; - - b2ContactFeature cf; - cf.indexB = 0; - cf.typeB = b2ContactFeature::e_vertex; - - // Region A - if (v <= 0.0f) - { - b2Vec2 P = A; - b2Vec2 d = Q - P; - float32 dd = b2Dot(d, d); - if (dd > radius * radius) - { - return; - } - - // Is there an edge connected to A? - if (edgeA->m_hasVertex0) - { - b2Vec2 A1 = edgeA->m_vertex0; - b2Vec2 B1 = A; - b2Vec2 e1 = B1 - A1; - float32 u1 = b2Dot(e1, B1 - Q); - - // Is the circle in Region AB of the previous edge? - if (u1 > 0.0f) - { - return; - } - } - - cf.indexA = 0; - cf.typeA = b2ContactFeature::e_vertex; - manifold->pointCount = 1; - manifold->type = b2Manifold::e_circles; - manifold->localNormal.SetZero(); - manifold->localPoint = P; - manifold->points[0].id.key = 0; - manifold->points[0].id.cf = cf; - manifold->points[0].localPoint = circleB->m_p; - return; - } - - // Region B - if (u <= 0.0f) - { - b2Vec2 P = B; - b2Vec2 d = Q - P; - float32 dd = b2Dot(d, d); - if (dd > radius * radius) - { - return; - } - - // Is there an edge connected to B? - if (edgeA->m_hasVertex3) - { - b2Vec2 B2 = edgeA->m_vertex3; - b2Vec2 A2 = B; - b2Vec2 e2 = B2 - A2; - float32 v2 = b2Dot(e2, Q - A2); - - // Is the circle in Region AB of the next edge? - if (v2 > 0.0f) - { - return; - } - } - - cf.indexA = 1; - cf.typeA = b2ContactFeature::e_vertex; - manifold->pointCount = 1; - manifold->type = b2Manifold::e_circles; - manifold->localNormal.SetZero(); - manifold->localPoint = P; - manifold->points[0].id.key = 0; - manifold->points[0].id.cf = cf; - manifold->points[0].localPoint = circleB->m_p; - return; - } - - // Region AB - float32 den = b2Dot(e, e); - b2Assert(den > 0.0f); - b2Vec2 P = (1.0f / den) * (u * A + v * B); - b2Vec2 d = Q - P; - float32 dd = b2Dot(d, d); - if (dd > radius * radius) - { - return; - } - - b2Vec2 n(-e.y, e.x); - if (b2Dot(n, Q - A) < 0.0f) - { - n.Set(-n.x, -n.y); - } - n.Normalize(); - - cf.indexA = 0; - cf.typeA = b2ContactFeature::e_face; - manifold->pointCount = 1; - manifold->type = b2Manifold::e_faceA; - manifold->localNormal = n; - manifold->localPoint = A; - manifold->points[0].id.key = 0; - manifold->points[0].id.cf = cf; - manifold->points[0].localPoint = circleB->m_p; -} - -// This structure is used to keep track of the best separating axis. -struct b2EPAxis -{ - enum Type - { - e_unknown, - e_edgeA, - e_edgeB - }; - - Type type; - int32 index; - float32 separation; -}; - -// This holds polygon B expressed in frame A. -struct b2TempPolygon -{ - b2Vec2 vertices[b2_maxPolygonVertices]; - b2Vec2 normals[b2_maxPolygonVertices]; - int32 count; -}; - -// Reference face used for clipping -struct b2ReferenceFace -{ - int32 i1, i2; - - b2Vec2 v1, v2; - - b2Vec2 normal; - - b2Vec2 sideNormal1; - float32 sideOffset1; - - b2Vec2 sideNormal2; - float32 sideOffset2; -}; - -// This class collides and edge and a polygon, taking into account edge adjacency. -struct b2EPCollider -{ - void Collide(b2Manifold* manifold, const b2EdgeShape* edgeA, const b2Transform& xfA, - const b2PolygonShape* polygonB, const b2Transform& xfB); - b2EPAxis ComputeEdgeSeparation(); - b2EPAxis ComputePolygonSeparation(); - - enum VertexType - { - e_isolated, - e_concave, - e_convex - }; - - b2TempPolygon m_polygonB; - - b2Transform m_xf; - b2Vec2 m_centroidB; - b2Vec2 m_v0, m_v1, m_v2, m_v3; - b2Vec2 m_normal0, m_normal1, m_normal2; - b2Vec2 m_normal; - VertexType m_type1, m_type2; - b2Vec2 m_lowerLimit, m_upperLimit; - float32 m_radius; - bool m_front; -}; - -// Algorithm: -// 1. Classify v1 and v2 -// 2. Classify polygon centroid as front or back -// 3. Flip normal if necessary -// 4. Initialize normal range to [-pi, pi] about face normal -// 5. Adjust normal range according to adjacent edges -// 6. Visit each separating axes, only accept axes within the range -// 7. Return if _any_ axis indicates separation -// 8. Clip -void b2EPCollider::Collide(b2Manifold* manifold, const b2EdgeShape* edgeA, const b2Transform& xfA, - const b2PolygonShape* polygonB, const b2Transform& xfB) -{ - m_xf = b2MulT(xfA, xfB); - - m_centroidB = b2Mul(m_xf, polygonB->m_centroid); - - m_v0 = edgeA->m_vertex0; - m_v1 = edgeA->m_vertex1; - m_v2 = edgeA->m_vertex2; - m_v3 = edgeA->m_vertex3; - - bool hasVertex0 = edgeA->m_hasVertex0; - bool hasVertex3 = edgeA->m_hasVertex3; - - b2Vec2 edge1 = m_v2 - m_v1; - edge1.Normalize(); - m_normal1.Set(edge1.y, -edge1.x); - float32 offset1 = b2Dot(m_normal1, m_centroidB - m_v1); - float32 offset0 = 0.0f, offset2 = 0.0f; - bool convex1 = false, convex2 = false; - - // Is there a preceding edge? - if (hasVertex0) - { - b2Vec2 edge0 = m_v1 - m_v0; - edge0.Normalize(); - m_normal0.Set(edge0.y, -edge0.x); - convex1 = b2Cross(edge0, edge1) >= 0.0f; - offset0 = b2Dot(m_normal0, m_centroidB - m_v0); - } - - // Is there a following edge? - if (hasVertex3) - { - b2Vec2 edge2 = m_v3 - m_v2; - edge2.Normalize(); - m_normal2.Set(edge2.y, -edge2.x); - convex2 = b2Cross(edge1, edge2) > 0.0f; - offset2 = b2Dot(m_normal2, m_centroidB - m_v2); - } - - // Determine front or back collision. Determine collision normal limits. - if (hasVertex0 && hasVertex3) - { - if (convex1 && convex2) - { - m_front = offset0 >= 0.0f || offset1 >= 0.0f || offset2 >= 0.0f; - if (m_front) - { - m_normal = m_normal1; - m_lowerLimit = m_normal0; - m_upperLimit = m_normal2; - } - else - { - m_normal = -m_normal1; - m_lowerLimit = -m_normal1; - m_upperLimit = -m_normal1; - } - } - else if (convex1) - { - m_front = offset0 >= 0.0f || (offset1 >= 0.0f && offset2 >= 0.0f); - if (m_front) - { - m_normal = m_normal1; - m_lowerLimit = m_normal0; - m_upperLimit = m_normal1; - } - else - { - m_normal = -m_normal1; - m_lowerLimit = -m_normal2; - m_upperLimit = -m_normal1; - } - } - else if (convex2) - { - m_front = offset2 >= 0.0f || (offset0 >= 0.0f && offset1 >= 0.0f); - if (m_front) - { - m_normal = m_normal1; - m_lowerLimit = m_normal1; - m_upperLimit = m_normal2; - } - else - { - m_normal = -m_normal1; - m_lowerLimit = -m_normal1; - m_upperLimit = -m_normal0; - } - } - else - { - m_front = offset0 >= 0.0f && offset1 >= 0.0f && offset2 >= 0.0f; - if (m_front) - { - m_normal = m_normal1; - m_lowerLimit = m_normal1; - m_upperLimit = m_normal1; - } - else - { - m_normal = -m_normal1; - m_lowerLimit = -m_normal2; - m_upperLimit = -m_normal0; - } - } - } - else if (hasVertex0) - { - if (convex1) - { - m_front = offset0 >= 0.0f || offset1 >= 0.0f; - if (m_front) - { - m_normal = m_normal1; - m_lowerLimit = m_normal0; - m_upperLimit = -m_normal1; - } - else - { - m_normal = -m_normal1; - m_lowerLimit = m_normal1; - m_upperLimit = -m_normal1; - } - } - else - { - m_front = offset0 >= 0.0f && offset1 >= 0.0f; - if (m_front) - { - m_normal = m_normal1; - m_lowerLimit = m_normal1; - m_upperLimit = -m_normal1; - } - else - { - m_normal = -m_normal1; - m_lowerLimit = m_normal1; - m_upperLimit = -m_normal0; - } - } - } - else if (hasVertex3) - { - if (convex2) - { - m_front = offset1 >= 0.0f || offset2 >= 0.0f; - if (m_front) - { - m_normal = m_normal1; - m_lowerLimit = -m_normal1; - m_upperLimit = m_normal2; - } - else - { - m_normal = -m_normal1; - m_lowerLimit = -m_normal1; - m_upperLimit = m_normal1; - } - } - else - { - m_front = offset1 >= 0.0f && offset2 >= 0.0f; - if (m_front) - { - m_normal = m_normal1; - m_lowerLimit = -m_normal1; - m_upperLimit = m_normal1; - } - else - { - m_normal = -m_normal1; - m_lowerLimit = -m_normal2; - m_upperLimit = m_normal1; - } - } - } - else - { - m_front = offset1 >= 0.0f; - if (m_front) - { - m_normal = m_normal1; - m_lowerLimit = -m_normal1; - m_upperLimit = -m_normal1; - } - else - { - m_normal = -m_normal1; - m_lowerLimit = m_normal1; - m_upperLimit = m_normal1; - } - } - - // Get polygonB in frameA - m_polygonB.count = polygonB->m_count; - for (int32 i = 0; i < polygonB->m_count; ++i) - { - m_polygonB.vertices[i] = b2Mul(m_xf, polygonB->m_vertices[i]); - m_polygonB.normals[i] = b2Mul(m_xf.q, polygonB->m_normals[i]); - } - - m_radius = 2.0f * b2_polygonRadius; - - manifold->pointCount = 0; - - b2EPAxis edgeAxis = ComputeEdgeSeparation(); - - // If no valid normal can be found than this edge should not collide. - if (edgeAxis.type == b2EPAxis::e_unknown) - { - return; - } - - if (edgeAxis.separation > m_radius) - { - return; - } - - b2EPAxis polygonAxis = ComputePolygonSeparation(); - if (polygonAxis.type != b2EPAxis::e_unknown && polygonAxis.separation > m_radius) - { - return; - } - - // Use hysteresis for jitter reduction. - const float32 k_relativeTol = 0.98f; - const float32 k_absoluteTol = 0.001f; - - b2EPAxis primaryAxis; - if (polygonAxis.type == b2EPAxis::e_unknown) - { - primaryAxis = edgeAxis; - } - else if (polygonAxis.separation > k_relativeTol * edgeAxis.separation + k_absoluteTol) - { - primaryAxis = polygonAxis; - } - else - { - primaryAxis = edgeAxis; - } - - b2ClipVertex ie[2]; - b2ReferenceFace rf; - if (primaryAxis.type == b2EPAxis::e_edgeA) - { - manifold->type = b2Manifold::e_faceA; - - // Search for the polygon normal that is most anti-parallel to the edge normal. - int32 bestIndex = 0; - float32 bestValue = b2Dot(m_normal, m_polygonB.normals[0]); - for (int32 i = 1; i < m_polygonB.count; ++i) - { - float32 value = b2Dot(m_normal, m_polygonB.normals[i]); - if (value < bestValue) - { - bestValue = value; - bestIndex = i; - } - } - - int32 i1 = bestIndex; - int32 i2 = i1 + 1 < m_polygonB.count ? i1 + 1 : 0; - - ie[0].v = m_polygonB.vertices[i1]; - ie[0].id.cf.indexA = 0; - ie[0].id.cf.indexB = static_cast(i1); - ie[0].id.cf.typeA = b2ContactFeature::e_face; - ie[0].id.cf.typeB = b2ContactFeature::e_vertex; - - ie[1].v = m_polygonB.vertices[i2]; - ie[1].id.cf.indexA = 0; - ie[1].id.cf.indexB = static_cast(i2); - ie[1].id.cf.typeA = b2ContactFeature::e_face; - ie[1].id.cf.typeB = b2ContactFeature::e_vertex; - - if (m_front) - { - rf.i1 = 0; - rf.i2 = 1; - rf.v1 = m_v1; - rf.v2 = m_v2; - rf.normal = m_normal1; - } - else - { - rf.i1 = 1; - rf.i2 = 0; - rf.v1 = m_v2; - rf.v2 = m_v1; - rf.normal = -m_normal1; - } - } - else - { - manifold->type = b2Manifold::e_faceB; - - ie[0].v = m_v1; - ie[0].id.cf.indexA = 0; - ie[0].id.cf.indexB = static_cast(primaryAxis.index); - ie[0].id.cf.typeA = b2ContactFeature::e_vertex; - ie[0].id.cf.typeB = b2ContactFeature::e_face; - - ie[1].v = m_v2; - ie[1].id.cf.indexA = 0; - ie[1].id.cf.indexB = static_cast(primaryAxis.index); - ie[1].id.cf.typeA = b2ContactFeature::e_vertex; - ie[1].id.cf.typeB = b2ContactFeature::e_face; - - rf.i1 = primaryAxis.index; - rf.i2 = rf.i1 + 1 < m_polygonB.count ? rf.i1 + 1 : 0; - rf.v1 = m_polygonB.vertices[rf.i1]; - rf.v2 = m_polygonB.vertices[rf.i2]; - rf.normal = m_polygonB.normals[rf.i1]; - } - - rf.sideNormal1.Set(rf.normal.y, -rf.normal.x); - rf.sideNormal2 = -rf.sideNormal1; - rf.sideOffset1 = b2Dot(rf.sideNormal1, rf.v1); - rf.sideOffset2 = b2Dot(rf.sideNormal2, rf.v2); - - // Clip incident edge against extruded edge1 side edges. - b2ClipVertex clipPoints1[2]; - b2ClipVertex clipPoints2[2]; - int32 np; - - // Clip to box side 1 - np = b2ClipSegmentToLine(clipPoints1, ie, rf.sideNormal1, rf.sideOffset1, rf.i1); - - if (np < b2_maxManifoldPoints) - { - return; - } - - // Clip to negative box side 1 - np = b2ClipSegmentToLine(clipPoints2, clipPoints1, rf.sideNormal2, rf.sideOffset2, rf.i2); - - if (np < b2_maxManifoldPoints) - { - return; - } - - // Now clipPoints2 contains the clipped points. - if (primaryAxis.type == b2EPAxis::e_edgeA) - { - manifold->localNormal = rf.normal; - manifold->localPoint = rf.v1; - } - else - { - manifold->localNormal = polygonB->m_normals[rf.i1]; - manifold->localPoint = polygonB->m_vertices[rf.i1]; - } - - int32 pointCount = 0; - for (int32 i = 0; i < b2_maxManifoldPoints; ++i) - { - float32 separation; - - separation = b2Dot(rf.normal, clipPoints2[i].v - rf.v1); - - if (separation <= m_radius) - { - b2ManifoldPoint* cp = manifold->points + pointCount; - - if (primaryAxis.type == b2EPAxis::e_edgeA) - { - cp->localPoint = b2MulT(m_xf, clipPoints2[i].v); - cp->id = clipPoints2[i].id; - } - else - { - cp->localPoint = clipPoints2[i].v; - cp->id.cf.typeA = clipPoints2[i].id.cf.typeB; - cp->id.cf.typeB = clipPoints2[i].id.cf.typeA; - cp->id.cf.indexA = clipPoints2[i].id.cf.indexB; - cp->id.cf.indexB = clipPoints2[i].id.cf.indexA; - } - - ++pointCount; - } - } - - manifold->pointCount = pointCount; -} - -b2EPAxis b2EPCollider::ComputeEdgeSeparation() -{ - b2EPAxis axis; - axis.type = b2EPAxis::e_edgeA; - axis.index = m_front ? 0 : 1; - axis.separation = FLT_MAX; - - for (int32 i = 0; i < m_polygonB.count; ++i) - { - float32 s = b2Dot(m_normal, m_polygonB.vertices[i] - m_v1); - if (s < axis.separation) - { - axis.separation = s; - } - } - - return axis; -} - -b2EPAxis b2EPCollider::ComputePolygonSeparation() -{ - b2EPAxis axis; - axis.type = b2EPAxis::e_unknown; - axis.index = -1; - axis.separation = -FLT_MAX; - - b2Vec2 perp(-m_normal.y, m_normal.x); - - for (int32 i = 0; i < m_polygonB.count; ++i) - { - b2Vec2 n = -m_polygonB.normals[i]; - - float32 s1 = b2Dot(n, m_polygonB.vertices[i] - m_v1); - float32 s2 = b2Dot(n, m_polygonB.vertices[i] - m_v2); - float32 s = b2Min(s1, s2); - - if (s > m_radius) - { - // No collision - axis.type = b2EPAxis::e_edgeB; - axis.index = i; - axis.separation = s; - return axis; - } - - // Adjacency - if (b2Dot(n, perp) >= 0.0f) - { - if (b2Dot(n - m_upperLimit, m_normal) < -b2_angularSlop) - { - continue; - } - } - else - { - if (b2Dot(n - m_lowerLimit, m_normal) < -b2_angularSlop) - { - continue; - } - } - - if (s > axis.separation) - { - axis.type = b2EPAxis::e_edgeB; - axis.index = i; - axis.separation = s; - } - } - - return axis; -} - -void b2CollideEdgeAndPolygon( b2Manifold* manifold, - const b2EdgeShape* edgeA, const b2Transform& xfA, - const b2PolygonShape* polygonB, const b2Transform& xfB) -{ - b2EPCollider collider; - collider.Collide(manifold, edgeA, xfA, polygonB, xfB); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Collision/b2CollidePolygon.cpp b/love/src/jni/love/src/libraries/Box2D/Collision/b2CollidePolygon.cpp deleted file mode 100644 index 0aac38b2..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Collision/b2CollidePolygon.cpp +++ /dev/null @@ -1,239 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include - -// Find the max separation between poly1 and poly2 using edge normals from poly1. -static float32 b2FindMaxSeparation(int32* edgeIndex, - const b2PolygonShape* poly1, const b2Transform& xf1, - const b2PolygonShape* poly2, const b2Transform& xf2) -{ - int32 count1 = poly1->m_count; - int32 count2 = poly2->m_count; - const b2Vec2* n1s = poly1->m_normals; - const b2Vec2* v1s = poly1->m_vertices; - const b2Vec2* v2s = poly2->m_vertices; - b2Transform xf = b2MulT(xf2, xf1); - - int32 bestIndex = 0; - float32 maxSeparation = -b2_maxFloat; - for (int32 i = 0; i < count1; ++i) - { - // Get poly1 normal in frame2. - b2Vec2 n = b2Mul(xf.q, n1s[i]); - b2Vec2 v1 = b2Mul(xf, v1s[i]); - - // Find deepest point for normal i. - float32 si = b2_maxFloat; - for (int32 j = 0; j < count2; ++j) - { - float32 sij = b2Dot(n, v2s[j] - v1); - if (sij < si) - { - si = sij; - } - } - - if (si > maxSeparation) - { - maxSeparation = si; - bestIndex = i; - } - } - - *edgeIndex = bestIndex; - return maxSeparation; -} - -static void b2FindIncidentEdge(b2ClipVertex c[2], - const b2PolygonShape* poly1, const b2Transform& xf1, int32 edge1, - const b2PolygonShape* poly2, const b2Transform& xf2) -{ - const b2Vec2* normals1 = poly1->m_normals; - - int32 count2 = poly2->m_count; - const b2Vec2* vertices2 = poly2->m_vertices; - const b2Vec2* normals2 = poly2->m_normals; - - b2Assert(0 <= edge1 && edge1 < poly1->m_count); - - // Get the normal of the reference edge in poly2's frame. - b2Vec2 normal1 = b2MulT(xf2.q, b2Mul(xf1.q, normals1[edge1])); - - // Find the incident edge on poly2. - int32 index = 0; - float32 minDot = b2_maxFloat; - for (int32 i = 0; i < count2; ++i) - { - float32 dot = b2Dot(normal1, normals2[i]); - if (dot < minDot) - { - minDot = dot; - index = i; - } - } - - // Build the clip vertices for the incident edge. - int32 i1 = index; - int32 i2 = i1 + 1 < count2 ? i1 + 1 : 0; - - c[0].v = b2Mul(xf2, vertices2[i1]); - c[0].id.cf.indexA = (uint8)edge1; - c[0].id.cf.indexB = (uint8)i1; - c[0].id.cf.typeA = b2ContactFeature::e_face; - c[0].id.cf.typeB = b2ContactFeature::e_vertex; - - c[1].v = b2Mul(xf2, vertices2[i2]); - c[1].id.cf.indexA = (uint8)edge1; - c[1].id.cf.indexB = (uint8)i2; - c[1].id.cf.typeA = b2ContactFeature::e_face; - c[1].id.cf.typeB = b2ContactFeature::e_vertex; -} - -// Find edge normal of max separation on A - return if separating axis is found -// Find edge normal of max separation on B - return if separation axis is found -// Choose reference edge as min(minA, minB) -// Find incident edge -// Clip - -// The normal points from 1 to 2 -void b2CollidePolygons(b2Manifold* manifold, - const b2PolygonShape* polyA, const b2Transform& xfA, - const b2PolygonShape* polyB, const b2Transform& xfB) -{ - manifold->pointCount = 0; - float32 totalRadius = polyA->m_radius + polyB->m_radius; - - int32 edgeA = 0; - float32 separationA = b2FindMaxSeparation(&edgeA, polyA, xfA, polyB, xfB); - if (separationA > totalRadius) - return; - - int32 edgeB = 0; - float32 separationB = b2FindMaxSeparation(&edgeB, polyB, xfB, polyA, xfA); - if (separationB > totalRadius) - return; - - const b2PolygonShape* poly1; // reference polygon - const b2PolygonShape* poly2; // incident polygon - b2Transform xf1, xf2; - int32 edge1; // reference edge - uint8 flip; - const float32 k_tol = 0.1f * b2_linearSlop; - - if (separationB > separationA + k_tol) - { - poly1 = polyB; - poly2 = polyA; - xf1 = xfB; - xf2 = xfA; - edge1 = edgeB; - manifold->type = b2Manifold::e_faceB; - flip = 1; - } - else - { - poly1 = polyA; - poly2 = polyB; - xf1 = xfA; - xf2 = xfB; - edge1 = edgeA; - manifold->type = b2Manifold::e_faceA; - flip = 0; - } - - b2ClipVertex incidentEdge[2]; - b2FindIncidentEdge(incidentEdge, poly1, xf1, edge1, poly2, xf2); - - int32 count1 = poly1->m_count; - const b2Vec2* vertices1 = poly1->m_vertices; - - int32 iv1 = edge1; - int32 iv2 = edge1 + 1 < count1 ? edge1 + 1 : 0; - - b2Vec2 v11 = vertices1[iv1]; - b2Vec2 v12 = vertices1[iv2]; - - b2Vec2 localTangent = v12 - v11; - localTangent.Normalize(); - - b2Vec2 localNormal = b2Cross(localTangent, 1.0f); - b2Vec2 planePoint = 0.5f * (v11 + v12); - - b2Vec2 tangent = b2Mul(xf1.q, localTangent); - b2Vec2 normal = b2Cross(tangent, 1.0f); - - v11 = b2Mul(xf1, v11); - v12 = b2Mul(xf1, v12); - - // Face offset. - float32 frontOffset = b2Dot(normal, v11); - - // Side offsets, extended by polytope skin thickness. - float32 sideOffset1 = -b2Dot(tangent, v11) + totalRadius; - float32 sideOffset2 = b2Dot(tangent, v12) + totalRadius; - - // Clip incident edge against extruded edge1 side edges. - b2ClipVertex clipPoints1[2]; - b2ClipVertex clipPoints2[2]; - int np; - - // Clip to box side 1 - np = b2ClipSegmentToLine(clipPoints1, incidentEdge, -tangent, sideOffset1, iv1); - - if (np < 2) - return; - - // Clip to negative box side 1 - np = b2ClipSegmentToLine(clipPoints2, clipPoints1, tangent, sideOffset2, iv2); - - if (np < 2) - { - return; - } - - // Now clipPoints2 contains the clipped points. - manifold->localNormal = localNormal; - manifold->localPoint = planePoint; - - int32 pointCount = 0; - for (int32 i = 0; i < b2_maxManifoldPoints; ++i) - { - float32 separation = b2Dot(normal, clipPoints2[i].v) - frontOffset; - - if (separation <= totalRadius) - { - b2ManifoldPoint* cp = manifold->points + pointCount; - cp->localPoint = b2MulT(xf2, clipPoints2[i].v); - cp->id = clipPoints2[i].id; - if (flip) - { - // Swap features - b2ContactFeature cf = cp->id.cf; - cp->id.cf.indexA = cf.indexB; - cp->id.cf.indexB = cf.indexA; - cp->id.cf.typeA = cf.typeB; - cp->id.cf.typeB = cf.typeA; - } - ++pointCount; - } - } - - manifold->pointCount = pointCount; -} diff --git a/love/src/jni/love/src/libraries/Box2D/Collision/b2Collision.cpp b/love/src/jni/love/src/libraries/Box2D/Collision/b2Collision.cpp deleted file mode 100644 index 4ebf3556..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Collision/b2Collision.cpp +++ /dev/null @@ -1,252 +0,0 @@ -/* -* Copyright (c) 2007-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include - -void b2WorldManifold::Initialize(const b2Manifold* manifold, - const b2Transform& xfA, float32 radiusA, - const b2Transform& xfB, float32 radiusB) -{ - if (manifold->pointCount == 0) - { - return; - } - - switch (manifold->type) - { - case b2Manifold::e_circles: - { - normal.Set(1.0f, 0.0f); - b2Vec2 pointA = b2Mul(xfA, manifold->localPoint); - b2Vec2 pointB = b2Mul(xfB, manifold->points[0].localPoint); - if (b2DistanceSquared(pointA, pointB) > b2_epsilon * b2_epsilon) - { - normal = pointB - pointA; - normal.Normalize(); - } - - b2Vec2 cA = pointA + radiusA * normal; - b2Vec2 cB = pointB - radiusB * normal; - points[0] = 0.5f * (cA + cB); - separations[0] = b2Dot(cB - cA, normal); - } - break; - - case b2Manifold::e_faceA: - { - normal = b2Mul(xfA.q, manifold->localNormal); - b2Vec2 planePoint = b2Mul(xfA, manifold->localPoint); - - for (int32 i = 0; i < manifold->pointCount; ++i) - { - b2Vec2 clipPoint = b2Mul(xfB, manifold->points[i].localPoint); - b2Vec2 cA = clipPoint + (radiusA - b2Dot(clipPoint - planePoint, normal)) * normal; - b2Vec2 cB = clipPoint - radiusB * normal; - points[i] = 0.5f * (cA + cB); - separations[i] = b2Dot(cB - cA, normal); - } - } - break; - - case b2Manifold::e_faceB: - { - normal = b2Mul(xfB.q, manifold->localNormal); - b2Vec2 planePoint = b2Mul(xfB, manifold->localPoint); - - for (int32 i = 0; i < manifold->pointCount; ++i) - { - b2Vec2 clipPoint = b2Mul(xfA, manifold->points[i].localPoint); - b2Vec2 cB = clipPoint + (radiusB - b2Dot(clipPoint - planePoint, normal)) * normal; - b2Vec2 cA = clipPoint - radiusA * normal; - points[i] = 0.5f * (cA + cB); - separations[i] = b2Dot(cA - cB, normal); - } - - // Ensure normal points from A to B. - normal = -normal; - } - break; - } -} - -void b2GetPointStates(b2PointState state1[b2_maxManifoldPoints], b2PointState state2[b2_maxManifoldPoints], - const b2Manifold* manifold1, const b2Manifold* manifold2) -{ - for (int32 i = 0; i < b2_maxManifoldPoints; ++i) - { - state1[i] = b2_nullState; - state2[i] = b2_nullState; - } - - // Detect persists and removes. - for (int32 i = 0; i < manifold1->pointCount; ++i) - { - b2ContactID id = manifold1->points[i].id; - - state1[i] = b2_removeState; - - for (int32 j = 0; j < manifold2->pointCount; ++j) - { - if (manifold2->points[j].id.key == id.key) - { - state1[i] = b2_persistState; - break; - } - } - } - - // Detect persists and adds. - for (int32 i = 0; i < manifold2->pointCount; ++i) - { - b2ContactID id = manifold2->points[i].id; - - state2[i] = b2_addState; - - for (int32 j = 0; j < manifold1->pointCount; ++j) - { - if (manifold1->points[j].id.key == id.key) - { - state2[i] = b2_persistState; - break; - } - } - } -} - -// From Real-time Collision Detection, p179. -bool b2AABB::RayCast(b2RayCastOutput* output, const b2RayCastInput& input) const -{ - float32 tmin = -b2_maxFloat; - float32 tmax = b2_maxFloat; - - b2Vec2 p = input.p1; - b2Vec2 d = input.p2 - input.p1; - b2Vec2 absD = b2Abs(d); - - b2Vec2 normal; - - for (int32 i = 0; i < 2; ++i) - { - if (absD(i) < b2_epsilon) - { - // Parallel. - if (p(i) < lowerBound(i) || upperBound(i) < p(i)) - { - return false; - } - } - else - { - float32 inv_d = 1.0f / d(i); - float32 t1 = (lowerBound(i) - p(i)) * inv_d; - float32 t2 = (upperBound(i) - p(i)) * inv_d; - - // Sign of the normal vector. - float32 s = -1.0f; - - if (t1 > t2) - { - b2Swap(t1, t2); - s = 1.0f; - } - - // Push the min up - if (t1 > tmin) - { - normal.SetZero(); - normal(i) = s; - tmin = t1; - } - - // Pull the max down - tmax = b2Min(tmax, t2); - - if (tmin > tmax) - { - return false; - } - } - } - - // Does the ray start inside the box? - // Does the ray intersect beyond the max fraction? - if (tmin < 0.0f || input.maxFraction < tmin) - { - return false; - } - - // Intersection. - output->fraction = tmin; - output->normal = normal; - return true; -} - -// Sutherland-Hodgman clipping. -int32 b2ClipSegmentToLine(b2ClipVertex vOut[2], const b2ClipVertex vIn[2], - const b2Vec2& normal, float32 offset, int32 vertexIndexA) -{ - // Start with no output points - int32 numOut = 0; - - // Calculate the distance of end points to the line - float32 distance0 = b2Dot(normal, vIn[0].v) - offset; - float32 distance1 = b2Dot(normal, vIn[1].v) - offset; - - // If the points are behind the plane - if (distance0 <= 0.0f) vOut[numOut++] = vIn[0]; - if (distance1 <= 0.0f) vOut[numOut++] = vIn[1]; - - // If the points are on different sides of the plane - if (distance0 * distance1 < 0.0f) - { - // Find intersection point of edge and plane - float32 interp = distance0 / (distance0 - distance1); - vOut[numOut].v = vIn[0].v + interp * (vIn[1].v - vIn[0].v); - - // VertexA is hitting edgeB. - vOut[numOut].id.cf.indexA = static_cast(vertexIndexA); - vOut[numOut].id.cf.indexB = vIn[0].id.cf.indexB; - vOut[numOut].id.cf.typeA = b2ContactFeature::e_vertex; - vOut[numOut].id.cf.typeB = b2ContactFeature::e_face; - ++numOut; - } - - return numOut; -} - -bool b2TestOverlap( const b2Shape* shapeA, int32 indexA, - const b2Shape* shapeB, int32 indexB, - const b2Transform& xfA, const b2Transform& xfB) -{ - b2DistanceInput input; - input.proxyA.Set(shapeA, indexA); - input.proxyB.Set(shapeB, indexB); - input.transformA = xfA; - input.transformB = xfB; - input.useRadii = true; - - b2SimplexCache cache; - cache.count = 0; - - b2DistanceOutput output; - - b2Distance(&output, &cache, &input); - - return output.distance < 10.0f * b2_epsilon; -} diff --git a/love/src/jni/love/src/libraries/Box2D/Collision/b2Collision.h b/love/src/jni/love/src/libraries/Box2D/Collision/b2Collision.h deleted file mode 100644 index ad023b3c..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Collision/b2Collision.h +++ /dev/null @@ -1,277 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_COLLISION_H -#define B2_COLLISION_H - -#include -#include - -/// @file -/// Structures and functions used for computing contact points, distance -/// queries, and TOI queries. - -class b2Shape; -class b2CircleShape; -class b2EdgeShape; -class b2PolygonShape; - -const uint8 b2_nullFeature = UCHAR_MAX; - -/// The features that intersect to form the contact point -/// This must be 4 bytes or less. -struct b2ContactFeature -{ - enum Type - { - e_vertex = 0, - e_face = 1 - }; - - uint8 indexA; ///< Feature index on shapeA - uint8 indexB; ///< Feature index on shapeB - uint8 typeA; ///< The feature type on shapeA - uint8 typeB; ///< The feature type on shapeB -}; - -/// Contact ids to facilitate warm starting. -union b2ContactID -{ - b2ContactFeature cf; - uint32 key; ///< Used to quickly compare contact ids. -}; - -/// A manifold point is a contact point belonging to a contact -/// manifold. It holds details related to the geometry and dynamics -/// of the contact points. -/// The local point usage depends on the manifold type: -/// -e_circles: the local center of circleB -/// -e_faceA: the local center of cirlceB or the clip point of polygonB -/// -e_faceB: the clip point of polygonA -/// This structure is stored across time steps, so we keep it small. -/// Note: the impulses are used for internal caching and may not -/// provide reliable contact forces, especially for high speed collisions. -struct b2ManifoldPoint -{ - b2Vec2 localPoint; ///< usage depends on manifold type - float32 normalImpulse; ///< the non-penetration impulse - float32 tangentImpulse; ///< the friction impulse - b2ContactID id; ///< uniquely identifies a contact point between two shapes -}; - -/// A manifold for two touching convex shapes. -/// Box2D supports multiple types of contact: -/// - clip point versus plane with radius -/// - point versus point with radius (circles) -/// The local point usage depends on the manifold type: -/// -e_circles: the local center of circleA -/// -e_faceA: the center of faceA -/// -e_faceB: the center of faceB -/// Similarly the local normal usage: -/// -e_circles: not used -/// -e_faceA: the normal on polygonA -/// -e_faceB: the normal on polygonB -/// We store contacts in this way so that position correction can -/// account for movement, which is critical for continuous physics. -/// All contact scenarios must be expressed in one of these types. -/// This structure is stored across time steps, so we keep it small. -struct b2Manifold -{ - enum Type - { - e_circles, - e_faceA, - e_faceB - }; - - b2ManifoldPoint points[b2_maxManifoldPoints]; ///< the points of contact - b2Vec2 localNormal; ///< not use for Type::e_points - b2Vec2 localPoint; ///< usage depends on manifold type - Type type; - int32 pointCount; ///< the number of manifold points -}; - -/// This is used to compute the current state of a contact manifold. -struct b2WorldManifold -{ - /// Evaluate the manifold with supplied transforms. This assumes - /// modest motion from the original state. This does not change the - /// point count, impulses, etc. The radii must come from the shapes - /// that generated the manifold. - void Initialize(const b2Manifold* manifold, - const b2Transform& xfA, float32 radiusA, - const b2Transform& xfB, float32 radiusB); - - b2Vec2 normal; ///< world vector pointing from A to B - b2Vec2 points[b2_maxManifoldPoints]; ///< world contact point (point of intersection) - float32 separations[b2_maxManifoldPoints]; ///< a negative value indicates overlap, in meters -}; - -/// This is used for determining the state of contact points. -enum b2PointState -{ - b2_nullState, ///< point does not exist - b2_addState, ///< point was added in the update - b2_persistState, ///< point persisted across the update - b2_removeState ///< point was removed in the update -}; - -/// Compute the point states given two manifolds. The states pertain to the transition from manifold1 -/// to manifold2. So state1 is either persist or remove while state2 is either add or persist. -void b2GetPointStates(b2PointState state1[b2_maxManifoldPoints], b2PointState state2[b2_maxManifoldPoints], - const b2Manifold* manifold1, const b2Manifold* manifold2); - -/// Used for computing contact manifolds. -struct b2ClipVertex -{ - b2Vec2 v; - b2ContactID id; -}; - -/// Ray-cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1). -struct b2RayCastInput -{ - b2Vec2 p1, p2; - float32 maxFraction; -}; - -/// Ray-cast output data. The ray hits at p1 + fraction * (p2 - p1), where p1 and p2 -/// come from b2RayCastInput. -struct b2RayCastOutput -{ - b2Vec2 normal; - float32 fraction; -}; - -/// An axis aligned bounding box. -struct b2AABB -{ - /// Verify that the bounds are sorted. - bool IsValid() const; - - /// Get the center of the AABB. - b2Vec2 GetCenter() const - { - return 0.5f * (lowerBound + upperBound); - } - - /// Get the extents of the AABB (half-widths). - b2Vec2 GetExtents() const - { - return 0.5f * (upperBound - lowerBound); - } - - /// Get the perimeter length - float32 GetPerimeter() const - { - float32 wx = upperBound.x - lowerBound.x; - float32 wy = upperBound.y - lowerBound.y; - return 2.0f * (wx + wy); - } - - /// Combine an AABB into this one. - void Combine(const b2AABB& aabb) - { - lowerBound = b2Min(lowerBound, aabb.lowerBound); - upperBound = b2Max(upperBound, aabb.upperBound); - } - - /// Combine two AABBs into this one. - void Combine(const b2AABB& aabb1, const b2AABB& aabb2) - { - lowerBound = b2Min(aabb1.lowerBound, aabb2.lowerBound); - upperBound = b2Max(aabb1.upperBound, aabb2.upperBound); - } - - /// Does this aabb contain the provided AABB. - bool Contains(const b2AABB& aabb) const - { - bool result = true; - result = result && lowerBound.x <= aabb.lowerBound.x; - result = result && lowerBound.y <= aabb.lowerBound.y; - result = result && aabb.upperBound.x <= upperBound.x; - result = result && aabb.upperBound.y <= upperBound.y; - return result; - } - - bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input) const; - - b2Vec2 lowerBound; ///< the lower vertex - b2Vec2 upperBound; ///< the upper vertex -}; - -/// Compute the collision manifold between two circles. -void b2CollideCircles(b2Manifold* manifold, - const b2CircleShape* circleA, const b2Transform& xfA, - const b2CircleShape* circleB, const b2Transform& xfB); - -/// Compute the collision manifold between a polygon and a circle. -void b2CollidePolygonAndCircle(b2Manifold* manifold, - const b2PolygonShape* polygonA, const b2Transform& xfA, - const b2CircleShape* circleB, const b2Transform& xfB); - -/// Compute the collision manifold between two polygons. -void b2CollidePolygons(b2Manifold* manifold, - const b2PolygonShape* polygonA, const b2Transform& xfA, - const b2PolygonShape* polygonB, const b2Transform& xfB); - -/// Compute the collision manifold between an edge and a circle. -void b2CollideEdgeAndCircle(b2Manifold* manifold, - const b2EdgeShape* polygonA, const b2Transform& xfA, - const b2CircleShape* circleB, const b2Transform& xfB); - -/// Compute the collision manifold between an edge and a circle. -void b2CollideEdgeAndPolygon(b2Manifold* manifold, - const b2EdgeShape* edgeA, const b2Transform& xfA, - const b2PolygonShape* circleB, const b2Transform& xfB); - -/// Clipping for contact manifolds. -int32 b2ClipSegmentToLine(b2ClipVertex vOut[2], const b2ClipVertex vIn[2], - const b2Vec2& normal, float32 offset, int32 vertexIndexA); - -/// Determine if two generic shapes overlap. -bool b2TestOverlap( const b2Shape* shapeA, int32 indexA, - const b2Shape* shapeB, int32 indexB, - const b2Transform& xfA, const b2Transform& xfB); - -// ---------------- Inline Functions ------------------------------------------ - -inline bool b2AABB::IsValid() const -{ - b2Vec2 d = upperBound - lowerBound; - bool valid = d.x >= 0.0f && d.y >= 0.0f; - valid = valid && lowerBound.IsValid() && upperBound.IsValid(); - return valid; -} - -inline bool b2TestOverlap(const b2AABB& a, const b2AABB& b) -{ - b2Vec2 d1, d2; - d1 = b.lowerBound - a.upperBound; - d2 = a.lowerBound - b.upperBound; - - if (d1.x > 0.0f || d1.y > 0.0f) - return false; - - if (d2.x > 0.0f || d2.y > 0.0f) - return false; - - return true; -} - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Collision/b2Distance.cpp b/love/src/jni/love/src/libraries/Box2D/Collision/b2Distance.cpp deleted file mode 100644 index 78daab3e..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Collision/b2Distance.cpp +++ /dev/null @@ -1,603 +0,0 @@ -/* -* Copyright (c) 2007-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include -#include -#include - -// GJK using Voronoi regions (Christer Ericson) and Barycentric coordinates. -int32 b2_gjkCalls, b2_gjkIters, b2_gjkMaxIters; - -void b2DistanceProxy::Set(const b2Shape* shape, int32 index) -{ - switch (shape->GetType()) - { - case b2Shape::e_circle: - { - const b2CircleShape* circle = static_cast(shape); - m_vertices = &circle->m_p; - m_count = 1; - m_radius = circle->m_radius; - } - break; - - case b2Shape::e_polygon: - { - const b2PolygonShape* polygon = static_cast(shape); - m_vertices = polygon->m_vertices; - m_count = polygon->m_count; - m_radius = polygon->m_radius; - } - break; - - case b2Shape::e_chain: - { - const b2ChainShape* chain = static_cast(shape); - b2Assert(0 <= index && index < chain->m_count); - - m_buffer[0] = chain->m_vertices[index]; - if (index + 1 < chain->m_count) - { - m_buffer[1] = chain->m_vertices[index + 1]; - } - else - { - m_buffer[1] = chain->m_vertices[0]; - } - - m_vertices = m_buffer; - m_count = 2; - m_radius = chain->m_radius; - } - break; - - case b2Shape::e_edge: - { - const b2EdgeShape* edge = static_cast(shape); - m_vertices = &edge->m_vertex1; - m_count = 2; - m_radius = edge->m_radius; - } - break; - - default: - b2Assert(false); - } -} - - -struct b2SimplexVertex -{ - b2Vec2 wA; // support point in proxyA - b2Vec2 wB; // support point in proxyB - b2Vec2 w; // wB - wA - float32 a; // barycentric coordinate for closest point - int32 indexA; // wA index - int32 indexB; // wB index -}; - -struct b2Simplex -{ - void ReadCache( const b2SimplexCache* cache, - const b2DistanceProxy* proxyA, const b2Transform& transformA, - const b2DistanceProxy* proxyB, const b2Transform& transformB) - { - b2Assert(cache->count <= 3); - - // Copy data from cache. - m_count = cache->count; - b2SimplexVertex* vertices = &m_v1; - for (int32 i = 0; i < m_count; ++i) - { - b2SimplexVertex* v = vertices + i; - v->indexA = cache->indexA[i]; - v->indexB = cache->indexB[i]; - b2Vec2 wALocal = proxyA->GetVertex(v->indexA); - b2Vec2 wBLocal = proxyB->GetVertex(v->indexB); - v->wA = b2Mul(transformA, wALocal); - v->wB = b2Mul(transformB, wBLocal); - v->w = v->wB - v->wA; - v->a = 0.0f; - } - - // Compute the new simplex metric, if it is substantially different than - // old metric then flush the simplex. - if (m_count > 1) - { - float32 metric1 = cache->metric; - float32 metric2 = GetMetric(); - if (metric2 < 0.5f * metric1 || 2.0f * metric1 < metric2 || metric2 < b2_epsilon) - { - // Reset the simplex. - m_count = 0; - } - } - - // If the cache is empty or invalid ... - if (m_count == 0) - { - b2SimplexVertex* v = vertices + 0; - v->indexA = 0; - v->indexB = 0; - b2Vec2 wALocal = proxyA->GetVertex(0); - b2Vec2 wBLocal = proxyB->GetVertex(0); - v->wA = b2Mul(transformA, wALocal); - v->wB = b2Mul(transformB, wBLocal); - v->w = v->wB - v->wA; - v->a = 1.0f; - m_count = 1; - } - } - - void WriteCache(b2SimplexCache* cache) const - { - cache->metric = GetMetric(); - cache->count = uint16(m_count); - const b2SimplexVertex* vertices = &m_v1; - for (int32 i = 0; i < m_count; ++i) - { - cache->indexA[i] = uint8(vertices[i].indexA); - cache->indexB[i] = uint8(vertices[i].indexB); - } - } - - b2Vec2 GetSearchDirection() const - { - switch (m_count) - { - case 1: - return -m_v1.w; - - case 2: - { - b2Vec2 e12 = m_v2.w - m_v1.w; - float32 sgn = b2Cross(e12, -m_v1.w); - if (sgn > 0.0f) - { - // Origin is left of e12. - return b2Cross(1.0f, e12); - } - else - { - // Origin is right of e12. - return b2Cross(e12, 1.0f); - } - } - - default: - b2Assert(false); - return b2Vec2_zero; - } - } - - b2Vec2 GetClosestPoint() const - { - switch (m_count) - { - case 0: - b2Assert(false); - return b2Vec2_zero; - - case 1: - return m_v1.w; - - case 2: - return m_v1.a * m_v1.w + m_v2.a * m_v2.w; - - case 3: - return b2Vec2_zero; - - default: - b2Assert(false); - return b2Vec2_zero; - } - } - - void GetWitnessPoints(b2Vec2* pA, b2Vec2* pB) const - { - switch (m_count) - { - case 0: - b2Assert(false); - break; - - case 1: - *pA = m_v1.wA; - *pB = m_v1.wB; - break; - - case 2: - *pA = m_v1.a * m_v1.wA + m_v2.a * m_v2.wA; - *pB = m_v1.a * m_v1.wB + m_v2.a * m_v2.wB; - break; - - case 3: - *pA = m_v1.a * m_v1.wA + m_v2.a * m_v2.wA + m_v3.a * m_v3.wA; - *pB = *pA; - break; - - default: - b2Assert(false); - break; - } - } - - float32 GetMetric() const - { - switch (m_count) - { - case 0: - b2Assert(false); - return 0.0f; - - case 1: - return 0.0f; - - case 2: - return b2Distance(m_v1.w, m_v2.w); - - case 3: - return b2Cross(m_v2.w - m_v1.w, m_v3.w - m_v1.w); - - default: - b2Assert(false); - return 0.0f; - } - } - - void Solve2(); - void Solve3(); - - b2SimplexVertex m_v1, m_v2, m_v3; - int32 m_count; -}; - - -// Solve a line segment using barycentric coordinates. -// -// p = a1 * w1 + a2 * w2 -// a1 + a2 = 1 -// -// The vector from the origin to the closest point on the line is -// perpendicular to the line. -// e12 = w2 - w1 -// dot(p, e) = 0 -// a1 * dot(w1, e) + a2 * dot(w2, e) = 0 -// -// 2-by-2 linear system -// [1 1 ][a1] = [1] -// [w1.e12 w2.e12][a2] = [0] -// -// Define -// d12_1 = dot(w2, e12) -// d12_2 = -dot(w1, e12) -// d12 = d12_1 + d12_2 -// -// Solution -// a1 = d12_1 / d12 -// a2 = d12_2 / d12 -void b2Simplex::Solve2() -{ - b2Vec2 w1 = m_v1.w; - b2Vec2 w2 = m_v2.w; - b2Vec2 e12 = w2 - w1; - - // w1 region - float32 d12_2 = -b2Dot(w1, e12); - if (d12_2 <= 0.0f) - { - // a2 <= 0, so we clamp it to 0 - m_v1.a = 1.0f; - m_count = 1; - return; - } - - // w2 region - float32 d12_1 = b2Dot(w2, e12); - if (d12_1 <= 0.0f) - { - // a1 <= 0, so we clamp it to 0 - m_v2.a = 1.0f; - m_count = 1; - m_v1 = m_v2; - return; - } - - // Must be in e12 region. - float32 inv_d12 = 1.0f / (d12_1 + d12_2); - m_v1.a = d12_1 * inv_d12; - m_v2.a = d12_2 * inv_d12; - m_count = 2; -} - -// Possible regions: -// - points[2] -// - edge points[0]-points[2] -// - edge points[1]-points[2] -// - inside the triangle -void b2Simplex::Solve3() -{ - b2Vec2 w1 = m_v1.w; - b2Vec2 w2 = m_v2.w; - b2Vec2 w3 = m_v3.w; - - // Edge12 - // [1 1 ][a1] = [1] - // [w1.e12 w2.e12][a2] = [0] - // a3 = 0 - b2Vec2 e12 = w2 - w1; - float32 w1e12 = b2Dot(w1, e12); - float32 w2e12 = b2Dot(w2, e12); - float32 d12_1 = w2e12; - float32 d12_2 = -w1e12; - - // Edge13 - // [1 1 ][a1] = [1] - // [w1.e13 w3.e13][a3] = [0] - // a2 = 0 - b2Vec2 e13 = w3 - w1; - float32 w1e13 = b2Dot(w1, e13); - float32 w3e13 = b2Dot(w3, e13); - float32 d13_1 = w3e13; - float32 d13_2 = -w1e13; - - // Edge23 - // [1 1 ][a2] = [1] - // [w2.e23 w3.e23][a3] = [0] - // a1 = 0 - b2Vec2 e23 = w3 - w2; - float32 w2e23 = b2Dot(w2, e23); - float32 w3e23 = b2Dot(w3, e23); - float32 d23_1 = w3e23; - float32 d23_2 = -w2e23; - - // Triangle123 - float32 n123 = b2Cross(e12, e13); - - float32 d123_1 = n123 * b2Cross(w2, w3); - float32 d123_2 = n123 * b2Cross(w3, w1); - float32 d123_3 = n123 * b2Cross(w1, w2); - - // w1 region - if (d12_2 <= 0.0f && d13_2 <= 0.0f) - { - m_v1.a = 1.0f; - m_count = 1; - return; - } - - // e12 - if (d12_1 > 0.0f && d12_2 > 0.0f && d123_3 <= 0.0f) - { - float32 inv_d12 = 1.0f / (d12_1 + d12_2); - m_v1.a = d12_1 * inv_d12; - m_v2.a = d12_2 * inv_d12; - m_count = 2; - return; - } - - // e13 - if (d13_1 > 0.0f && d13_2 > 0.0f && d123_2 <= 0.0f) - { - float32 inv_d13 = 1.0f / (d13_1 + d13_2); - m_v1.a = d13_1 * inv_d13; - m_v3.a = d13_2 * inv_d13; - m_count = 2; - m_v2 = m_v3; - return; - } - - // w2 region - if (d12_1 <= 0.0f && d23_2 <= 0.0f) - { - m_v2.a = 1.0f; - m_count = 1; - m_v1 = m_v2; - return; - } - - // w3 region - if (d13_1 <= 0.0f && d23_1 <= 0.0f) - { - m_v3.a = 1.0f; - m_count = 1; - m_v1 = m_v3; - return; - } - - // e23 - if (d23_1 > 0.0f && d23_2 > 0.0f && d123_1 <= 0.0f) - { - float32 inv_d23 = 1.0f / (d23_1 + d23_2); - m_v2.a = d23_1 * inv_d23; - m_v3.a = d23_2 * inv_d23; - m_count = 2; - m_v1 = m_v3; - return; - } - - // Must be in triangle123 - float32 inv_d123 = 1.0f / (d123_1 + d123_2 + d123_3); - m_v1.a = d123_1 * inv_d123; - m_v2.a = d123_2 * inv_d123; - m_v3.a = d123_3 * inv_d123; - m_count = 3; -} - -void b2Distance(b2DistanceOutput* output, - b2SimplexCache* cache, - const b2DistanceInput* input) -{ - ++b2_gjkCalls; - - const b2DistanceProxy* proxyA = &input->proxyA; - const b2DistanceProxy* proxyB = &input->proxyB; - - b2Transform transformA = input->transformA; - b2Transform transformB = input->transformB; - - // Initialize the simplex. - b2Simplex simplex; - simplex.ReadCache(cache, proxyA, transformA, proxyB, transformB); - - // Get simplex vertices as an array. - b2SimplexVertex* vertices = &simplex.m_v1; - const int32 k_maxIters = 20; - - // These store the vertices of the last simplex so that we - // can check for duplicates and prevent cycling. - int32 saveA[3], saveB[3]; - int32 saveCount = 0; - - float32 distanceSqr1 = b2_maxFloat; - float32 distanceSqr2 = distanceSqr1; - - // Main iteration loop. - int32 iter = 0; - while (iter < k_maxIters) - { - // Copy simplex so we can identify duplicates. - saveCount = simplex.m_count; - for (int32 i = 0; i < saveCount; ++i) - { - saveA[i] = vertices[i].indexA; - saveB[i] = vertices[i].indexB; - } - - switch (simplex.m_count) - { - case 1: - break; - - case 2: - simplex.Solve2(); - break; - - case 3: - simplex.Solve3(); - break; - - default: - b2Assert(false); - } - - // If we have 3 points, then the origin is in the corresponding triangle. - if (simplex.m_count == 3) - { - break; - } - - // Compute closest point. - b2Vec2 p = simplex.GetClosestPoint(); - distanceSqr2 = p.LengthSquared(); - - // Ensure progress - if (distanceSqr2 >= distanceSqr1) - { - //break; - } - distanceSqr1 = distanceSqr2; - - // Get search direction. - b2Vec2 d = simplex.GetSearchDirection(); - - // Ensure the search direction is numerically fit. - if (d.LengthSquared() < b2_epsilon * b2_epsilon) - { - // The origin is probably contained by a line segment - // or triangle. Thus the shapes are overlapped. - - // We can't return zero here even though there may be overlap. - // In case the simplex is a point, segment, or triangle it is difficult - // to determine if the origin is contained in the CSO or very close to it. - break; - } - - // Compute a tentative new simplex vertex using support points. - b2SimplexVertex* vertex = vertices + simplex.m_count; - vertex->indexA = proxyA->GetSupport(b2MulT(transformA.q, -d)); - vertex->wA = b2Mul(transformA, proxyA->GetVertex(vertex->indexA)); - b2Vec2 wBLocal; - vertex->indexB = proxyB->GetSupport(b2MulT(transformB.q, d)); - vertex->wB = b2Mul(transformB, proxyB->GetVertex(vertex->indexB)); - vertex->w = vertex->wB - vertex->wA; - - // Iteration count is equated to the number of support point calls. - ++iter; - ++b2_gjkIters; - - // Check for duplicate support points. This is the main termination criteria. - bool duplicate = false; - for (int32 i = 0; i < saveCount; ++i) - { - if (vertex->indexA == saveA[i] && vertex->indexB == saveB[i]) - { - duplicate = true; - break; - } - } - - // If we found a duplicate support point we must exit to avoid cycling. - if (duplicate) - { - break; - } - - // New vertex is ok and needed. - ++simplex.m_count; - } - - b2_gjkMaxIters = b2Max(b2_gjkMaxIters, iter); - - // Prepare output. - simplex.GetWitnessPoints(&output->pointA, &output->pointB); - output->distance = b2Distance(output->pointA, output->pointB); - output->iterations = iter; - - // Cache the simplex. - simplex.WriteCache(cache); - - // Apply radii if requested. - if (input->useRadii) - { - float32 rA = proxyA->m_radius; - float32 rB = proxyB->m_radius; - - if (output->distance > rA + rB && output->distance > b2_epsilon) - { - // Shapes are still no overlapped. - // Move the witness points to the outer surface. - output->distance -= rA + rB; - b2Vec2 normal = output->pointB - output->pointA; - normal.Normalize(); - output->pointA += rA * normal; - output->pointB -= rB * normal; - } - else - { - // Shapes are overlapped when radii are considered. - // Move the witness points to the middle. - b2Vec2 p = 0.5f * (output->pointA + output->pointB); - output->pointA = p; - output->pointB = p; - output->distance = 0.0f; - } - } -} diff --git a/love/src/jni/love/src/libraries/Box2D/Collision/b2Distance.h b/love/src/jni/love/src/libraries/Box2D/Collision/b2Distance.h deleted file mode 100644 index 7bae689d..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Collision/b2Distance.h +++ /dev/null @@ -1,141 +0,0 @@ - -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_DISTANCE_H -#define B2_DISTANCE_H - -#include - -class b2Shape; - -/// A distance proxy is used by the GJK algorithm. -/// It encapsulates any shape. -struct b2DistanceProxy -{ - b2DistanceProxy() : m_vertices(NULL), m_count(0), m_radius(0.0f) {} - - /// Initialize the proxy using the given shape. The shape - /// must remain in scope while the proxy is in use. - void Set(const b2Shape* shape, int32 index); - - /// Get the supporting vertex index in the given direction. - int32 GetSupport(const b2Vec2& d) const; - - /// Get the supporting vertex in the given direction. - const b2Vec2& GetSupportVertex(const b2Vec2& d) const; - - /// Get the vertex count. - int32 GetVertexCount() const; - - /// Get a vertex by index. Used by b2Distance. - const b2Vec2& GetVertex(int32 index) const; - - b2Vec2 m_buffer[2]; - const b2Vec2* m_vertices; - int32 m_count; - float32 m_radius; -}; - -/// Used to warm start b2Distance. -/// Set count to zero on first call. -struct b2SimplexCache -{ - float32 metric; ///< length or area - uint16 count; - uint8 indexA[3]; ///< vertices on shape A - uint8 indexB[3]; ///< vertices on shape B -}; - -/// Input for b2Distance. -/// You have to option to use the shape radii -/// in the computation. Even -struct b2DistanceInput -{ - b2DistanceProxy proxyA; - b2DistanceProxy proxyB; - b2Transform transformA; - b2Transform transformB; - bool useRadii; -}; - -/// Output for b2Distance. -struct b2DistanceOutput -{ - b2Vec2 pointA; ///< closest point on shapeA - b2Vec2 pointB; ///< closest point on shapeB - float32 distance; - int32 iterations; ///< number of GJK iterations used -}; - -/// Compute the closest points between two shapes. Supports any combination of: -/// b2CircleShape, b2PolygonShape, b2EdgeShape. The simplex cache is input/output. -/// On the first call set b2SimplexCache.count to zero. -void b2Distance(b2DistanceOutput* output, - b2SimplexCache* cache, - const b2DistanceInput* input); - - -////////////////////////////////////////////////////////////////////////// - -inline int32 b2DistanceProxy::GetVertexCount() const -{ - return m_count; -} - -inline const b2Vec2& b2DistanceProxy::GetVertex(int32 index) const -{ - b2Assert(0 <= index && index < m_count); - return m_vertices[index]; -} - -inline int32 b2DistanceProxy::GetSupport(const b2Vec2& d) const -{ - int32 bestIndex = 0; - float32 bestValue = b2Dot(m_vertices[0], d); - for (int32 i = 1; i < m_count; ++i) - { - float32 value = b2Dot(m_vertices[i], d); - if (value > bestValue) - { - bestIndex = i; - bestValue = value; - } - } - - return bestIndex; -} - -inline const b2Vec2& b2DistanceProxy::GetSupportVertex(const b2Vec2& d) const -{ - int32 bestIndex = 0; - float32 bestValue = b2Dot(m_vertices[0], d); - for (int32 i = 1; i < m_count; ++i) - { - float32 value = b2Dot(m_vertices[i], d); - if (value > bestValue) - { - bestIndex = i; - bestValue = value; - } - } - - return m_vertices[bestIndex]; -} - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Collision/b2DynamicTree.cpp b/love/src/jni/love/src/libraries/Box2D/Collision/b2DynamicTree.cpp deleted file mode 100644 index ef57b422..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Collision/b2DynamicTree.cpp +++ /dev/null @@ -1,778 +0,0 @@ -/* -* Copyright (c) 2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include - -b2DynamicTree::b2DynamicTree() -{ - m_root = b2_nullNode; - - m_nodeCapacity = 16; - m_nodeCount = 0; - m_nodes = (b2TreeNode*)b2Alloc(m_nodeCapacity * sizeof(b2TreeNode)); - memset(m_nodes, 0, m_nodeCapacity * sizeof(b2TreeNode)); - - // Build a linked list for the free list. - for (int32 i = 0; i < m_nodeCapacity - 1; ++i) - { - m_nodes[i].next = i + 1; - m_nodes[i].height = -1; - } - m_nodes[m_nodeCapacity-1].next = b2_nullNode; - m_nodes[m_nodeCapacity-1].height = -1; - m_freeList = 0; - - m_path = 0; - - m_insertionCount = 0; -} - -b2DynamicTree::~b2DynamicTree() -{ - // This frees the entire tree in one shot. - b2Free(m_nodes); -} - -// Allocate a node from the pool. Grow the pool if necessary. -int32 b2DynamicTree::AllocateNode() -{ - // Expand the node pool as needed. - if (m_freeList == b2_nullNode) - { - b2Assert(m_nodeCount == m_nodeCapacity); - - // The free list is empty. Rebuild a bigger pool. - b2TreeNode* oldNodes = m_nodes; - m_nodeCapacity *= 2; - m_nodes = (b2TreeNode*)b2Alloc(m_nodeCapacity * sizeof(b2TreeNode)); - memcpy(m_nodes, oldNodes, m_nodeCount * sizeof(b2TreeNode)); - b2Free(oldNodes); - - // Build a linked list for the free list. The parent - // pointer becomes the "next" pointer. - for (int32 i = m_nodeCount; i < m_nodeCapacity - 1; ++i) - { - m_nodes[i].next = i + 1; - m_nodes[i].height = -1; - } - m_nodes[m_nodeCapacity-1].next = b2_nullNode; - m_nodes[m_nodeCapacity-1].height = -1; - m_freeList = m_nodeCount; - } - - // Peel a node off the free list. - int32 nodeId = m_freeList; - m_freeList = m_nodes[nodeId].next; - m_nodes[nodeId].parent = b2_nullNode; - m_nodes[nodeId].child1 = b2_nullNode; - m_nodes[nodeId].child2 = b2_nullNode; - m_nodes[nodeId].height = 0; - m_nodes[nodeId].userData = NULL; - ++m_nodeCount; - return nodeId; -} - -// Return a node to the pool. -void b2DynamicTree::FreeNode(int32 nodeId) -{ - b2Assert(0 <= nodeId && nodeId < m_nodeCapacity); - b2Assert(0 < m_nodeCount); - m_nodes[nodeId].next = m_freeList; - m_nodes[nodeId].height = -1; - m_freeList = nodeId; - --m_nodeCount; -} - -// Create a proxy in the tree as a leaf node. We return the index -// of the node instead of a pointer so that we can grow -// the node pool. -int32 b2DynamicTree::CreateProxy(const b2AABB& aabb, void* userData) -{ - int32 proxyId = AllocateNode(); - - // Fatten the aabb. - b2Vec2 r(b2_aabbExtension, b2_aabbExtension); - m_nodes[proxyId].aabb.lowerBound = aabb.lowerBound - r; - m_nodes[proxyId].aabb.upperBound = aabb.upperBound + r; - m_nodes[proxyId].userData = userData; - m_nodes[proxyId].height = 0; - - InsertLeaf(proxyId); - - return proxyId; -} - -void b2DynamicTree::DestroyProxy(int32 proxyId) -{ - b2Assert(0 <= proxyId && proxyId < m_nodeCapacity); - b2Assert(m_nodes[proxyId].IsLeaf()); - - RemoveLeaf(proxyId); - FreeNode(proxyId); -} - -bool b2DynamicTree::MoveProxy(int32 proxyId, const b2AABB& aabb, const b2Vec2& displacement) -{ - b2Assert(0 <= proxyId && proxyId < m_nodeCapacity); - - b2Assert(m_nodes[proxyId].IsLeaf()); - - if (m_nodes[proxyId].aabb.Contains(aabb)) - { - return false; - } - - RemoveLeaf(proxyId); - - // Extend AABB. - b2AABB b = aabb; - b2Vec2 r(b2_aabbExtension, b2_aabbExtension); - b.lowerBound = b.lowerBound - r; - b.upperBound = b.upperBound + r; - - // Predict AABB displacement. - b2Vec2 d = b2_aabbMultiplier * displacement; - - if (d.x < 0.0f) - { - b.lowerBound.x += d.x; - } - else - { - b.upperBound.x += d.x; - } - - if (d.y < 0.0f) - { - b.lowerBound.y += d.y; - } - else - { - b.upperBound.y += d.y; - } - - m_nodes[proxyId].aabb = b; - - InsertLeaf(proxyId); - return true; -} - -void b2DynamicTree::InsertLeaf(int32 leaf) -{ - ++m_insertionCount; - - if (m_root == b2_nullNode) - { - m_root = leaf; - m_nodes[m_root].parent = b2_nullNode; - return; - } - - // Find the best sibling for this node - b2AABB leafAABB = m_nodes[leaf].aabb; - int32 index = m_root; - while (m_nodes[index].IsLeaf() == false) - { - int32 child1 = m_nodes[index].child1; - int32 child2 = m_nodes[index].child2; - - float32 area = m_nodes[index].aabb.GetPerimeter(); - - b2AABB combinedAABB; - combinedAABB.Combine(m_nodes[index].aabb, leafAABB); - float32 combinedArea = combinedAABB.GetPerimeter(); - - // Cost of creating a new parent for this node and the new leaf - float32 cost = 2.0f * combinedArea; - - // Minimum cost of pushing the leaf further down the tree - float32 inheritanceCost = 2.0f * (combinedArea - area); - - // Cost of descending into child1 - float32 cost1; - if (m_nodes[child1].IsLeaf()) - { - b2AABB aabb; - aabb.Combine(leafAABB, m_nodes[child1].aabb); - cost1 = aabb.GetPerimeter() + inheritanceCost; - } - else - { - b2AABB aabb; - aabb.Combine(leafAABB, m_nodes[child1].aabb); - float32 oldArea = m_nodes[child1].aabb.GetPerimeter(); - float32 newArea = aabb.GetPerimeter(); - cost1 = (newArea - oldArea) + inheritanceCost; - } - - // Cost of descending into child2 - float32 cost2; - if (m_nodes[child2].IsLeaf()) - { - b2AABB aabb; - aabb.Combine(leafAABB, m_nodes[child2].aabb); - cost2 = aabb.GetPerimeter() + inheritanceCost; - } - else - { - b2AABB aabb; - aabb.Combine(leafAABB, m_nodes[child2].aabb); - float32 oldArea = m_nodes[child2].aabb.GetPerimeter(); - float32 newArea = aabb.GetPerimeter(); - cost2 = newArea - oldArea + inheritanceCost; - } - - // Descend according to the minimum cost. - if (cost < cost1 && cost < cost2) - { - break; - } - - // Descend - if (cost1 < cost2) - { - index = child1; - } - else - { - index = child2; - } - } - - int32 sibling = index; - - // Create a new parent. - int32 oldParent = m_nodes[sibling].parent; - int32 newParent = AllocateNode(); - m_nodes[newParent].parent = oldParent; - m_nodes[newParent].userData = NULL; - m_nodes[newParent].aabb.Combine(leafAABB, m_nodes[sibling].aabb); - m_nodes[newParent].height = m_nodes[sibling].height + 1; - - if (oldParent != b2_nullNode) - { - // The sibling was not the root. - if (m_nodes[oldParent].child1 == sibling) - { - m_nodes[oldParent].child1 = newParent; - } - else - { - m_nodes[oldParent].child2 = newParent; - } - - m_nodes[newParent].child1 = sibling; - m_nodes[newParent].child2 = leaf; - m_nodes[sibling].parent = newParent; - m_nodes[leaf].parent = newParent; - } - else - { - // The sibling was the root. - m_nodes[newParent].child1 = sibling; - m_nodes[newParent].child2 = leaf; - m_nodes[sibling].parent = newParent; - m_nodes[leaf].parent = newParent; - m_root = newParent; - } - - // Walk back up the tree fixing heights and AABBs - index = m_nodes[leaf].parent; - while (index != b2_nullNode) - { - index = Balance(index); - - int32 child1 = m_nodes[index].child1; - int32 child2 = m_nodes[index].child2; - - b2Assert(child1 != b2_nullNode); - b2Assert(child2 != b2_nullNode); - - m_nodes[index].height = 1 + b2Max(m_nodes[child1].height, m_nodes[child2].height); - m_nodes[index].aabb.Combine(m_nodes[child1].aabb, m_nodes[child2].aabb); - - index = m_nodes[index].parent; - } - - //Validate(); -} - -void b2DynamicTree::RemoveLeaf(int32 leaf) -{ - if (leaf == m_root) - { - m_root = b2_nullNode; - return; - } - - int32 parent = m_nodes[leaf].parent; - int32 grandParent = m_nodes[parent].parent; - int32 sibling; - if (m_nodes[parent].child1 == leaf) - { - sibling = m_nodes[parent].child2; - } - else - { - sibling = m_nodes[parent].child1; - } - - if (grandParent != b2_nullNode) - { - // Destroy parent and connect sibling to grandParent. - if (m_nodes[grandParent].child1 == parent) - { - m_nodes[grandParent].child1 = sibling; - } - else - { - m_nodes[grandParent].child2 = sibling; - } - m_nodes[sibling].parent = grandParent; - FreeNode(parent); - - // Adjust ancestor bounds. - int32 index = grandParent; - while (index != b2_nullNode) - { - index = Balance(index); - - int32 child1 = m_nodes[index].child1; - int32 child2 = m_nodes[index].child2; - - m_nodes[index].aabb.Combine(m_nodes[child1].aabb, m_nodes[child2].aabb); - m_nodes[index].height = 1 + b2Max(m_nodes[child1].height, m_nodes[child2].height); - - index = m_nodes[index].parent; - } - } - else - { - m_root = sibling; - m_nodes[sibling].parent = b2_nullNode; - FreeNode(parent); - } - - //Validate(); -} - -// Perform a left or right rotation if node A is imbalanced. -// Returns the new root index. -int32 b2DynamicTree::Balance(int32 iA) -{ - b2Assert(iA != b2_nullNode); - - b2TreeNode* A = m_nodes + iA; - if (A->IsLeaf() || A->height < 2) - { - return iA; - } - - int32 iB = A->child1; - int32 iC = A->child2; - b2Assert(0 <= iB && iB < m_nodeCapacity); - b2Assert(0 <= iC && iC < m_nodeCapacity); - - b2TreeNode* B = m_nodes + iB; - b2TreeNode* C = m_nodes + iC; - - int32 balance = C->height - B->height; - - // Rotate C up - if (balance > 1) - { - int32 iF = C->child1; - int32 iG = C->child2; - b2TreeNode* F = m_nodes + iF; - b2TreeNode* G = m_nodes + iG; - b2Assert(0 <= iF && iF < m_nodeCapacity); - b2Assert(0 <= iG && iG < m_nodeCapacity); - - // Swap A and C - C->child1 = iA; - C->parent = A->parent; - A->parent = iC; - - // A's old parent should point to C - if (C->parent != b2_nullNode) - { - if (m_nodes[C->parent].child1 == iA) - { - m_nodes[C->parent].child1 = iC; - } - else - { - b2Assert(m_nodes[C->parent].child2 == iA); - m_nodes[C->parent].child2 = iC; - } - } - else - { - m_root = iC; - } - - // Rotate - if (F->height > G->height) - { - C->child2 = iF; - A->child2 = iG; - G->parent = iA; - A->aabb.Combine(B->aabb, G->aabb); - C->aabb.Combine(A->aabb, F->aabb); - - A->height = 1 + b2Max(B->height, G->height); - C->height = 1 + b2Max(A->height, F->height); - } - else - { - C->child2 = iG; - A->child2 = iF; - F->parent = iA; - A->aabb.Combine(B->aabb, F->aabb); - C->aabb.Combine(A->aabb, G->aabb); - - A->height = 1 + b2Max(B->height, F->height); - C->height = 1 + b2Max(A->height, G->height); - } - - return iC; - } - - // Rotate B up - if (balance < -1) - { - int32 iD = B->child1; - int32 iE = B->child2; - b2TreeNode* D = m_nodes + iD; - b2TreeNode* E = m_nodes + iE; - b2Assert(0 <= iD && iD < m_nodeCapacity); - b2Assert(0 <= iE && iE < m_nodeCapacity); - - // Swap A and B - B->child1 = iA; - B->parent = A->parent; - A->parent = iB; - - // A's old parent should point to B - if (B->parent != b2_nullNode) - { - if (m_nodes[B->parent].child1 == iA) - { - m_nodes[B->parent].child1 = iB; - } - else - { - b2Assert(m_nodes[B->parent].child2 == iA); - m_nodes[B->parent].child2 = iB; - } - } - else - { - m_root = iB; - } - - // Rotate - if (D->height > E->height) - { - B->child2 = iD; - A->child1 = iE; - E->parent = iA; - A->aabb.Combine(C->aabb, E->aabb); - B->aabb.Combine(A->aabb, D->aabb); - - A->height = 1 + b2Max(C->height, E->height); - B->height = 1 + b2Max(A->height, D->height); - } - else - { - B->child2 = iE; - A->child1 = iD; - D->parent = iA; - A->aabb.Combine(C->aabb, D->aabb); - B->aabb.Combine(A->aabb, E->aabb); - - A->height = 1 + b2Max(C->height, D->height); - B->height = 1 + b2Max(A->height, E->height); - } - - return iB; - } - - return iA; -} - -int32 b2DynamicTree::GetHeight() const -{ - if (m_root == b2_nullNode) - { - return 0; - } - - return m_nodes[m_root].height; -} - -// -float32 b2DynamicTree::GetAreaRatio() const -{ - if (m_root == b2_nullNode) - { - return 0.0f; - } - - const b2TreeNode* root = m_nodes + m_root; - float32 rootArea = root->aabb.GetPerimeter(); - - float32 totalArea = 0.0f; - for (int32 i = 0; i < m_nodeCapacity; ++i) - { - const b2TreeNode* node = m_nodes + i; - if (node->height < 0) - { - // Free node in pool - continue; - } - - totalArea += node->aabb.GetPerimeter(); - } - - return totalArea / rootArea; -} - -// Compute the height of a sub-tree. -int32 b2DynamicTree::ComputeHeight(int32 nodeId) const -{ - b2Assert(0 <= nodeId && nodeId < m_nodeCapacity); - b2TreeNode* node = m_nodes + nodeId; - - if (node->IsLeaf()) - { - return 0; - } - - int32 height1 = ComputeHeight(node->child1); - int32 height2 = ComputeHeight(node->child2); - return 1 + b2Max(height1, height2); -} - -int32 b2DynamicTree::ComputeHeight() const -{ - int32 height = ComputeHeight(m_root); - return height; -} - -void b2DynamicTree::ValidateStructure(int32 index) const -{ - if (index == b2_nullNode) - { - return; - } - - if (index == m_root) - { - b2Assert(m_nodes[index].parent == b2_nullNode); - } - - const b2TreeNode* node = m_nodes + index; - - int32 child1 = node->child1; - int32 child2 = node->child2; - - if (node->IsLeaf()) - { - b2Assert(child1 == b2_nullNode); - b2Assert(child2 == b2_nullNode); - b2Assert(node->height == 0); - return; - } - - b2Assert(0 <= child1 && child1 < m_nodeCapacity); - b2Assert(0 <= child2 && child2 < m_nodeCapacity); - - b2Assert(m_nodes[child1].parent == index); - b2Assert(m_nodes[child2].parent == index); - - ValidateStructure(child1); - ValidateStructure(child2); -} - -void b2DynamicTree::ValidateMetrics(int32 index) const -{ - if (index == b2_nullNode) - { - return; - } - - const b2TreeNode* node = m_nodes + index; - - int32 child1 = node->child1; - int32 child2 = node->child2; - - if (node->IsLeaf()) - { - b2Assert(child1 == b2_nullNode); - b2Assert(child2 == b2_nullNode); - b2Assert(node->height == 0); - return; - } - - b2Assert(0 <= child1 && child1 < m_nodeCapacity); - b2Assert(0 <= child2 && child2 < m_nodeCapacity); - - int32 height1 = m_nodes[child1].height; - int32 height2 = m_nodes[child2].height; - int32 height; - height = 1 + b2Max(height1, height2); - b2Assert(node->height == height); - - b2AABB aabb; - aabb.Combine(m_nodes[child1].aabb, m_nodes[child2].aabb); - - b2Assert(aabb.lowerBound == node->aabb.lowerBound); - b2Assert(aabb.upperBound == node->aabb.upperBound); - - ValidateMetrics(child1); - ValidateMetrics(child2); -} - -void b2DynamicTree::Validate() const -{ - ValidateStructure(m_root); - ValidateMetrics(m_root); - - int32 freeCount = 0; - int32 freeIndex = m_freeList; - while (freeIndex != b2_nullNode) - { - b2Assert(0 <= freeIndex && freeIndex < m_nodeCapacity); - freeIndex = m_nodes[freeIndex].next; - ++freeCount; - } - - b2Assert(GetHeight() == ComputeHeight()); - - b2Assert(m_nodeCount + freeCount == m_nodeCapacity); -} - -int32 b2DynamicTree::GetMaxBalance() const -{ - int32 maxBalance = 0; - for (int32 i = 0; i < m_nodeCapacity; ++i) - { - const b2TreeNode* node = m_nodes + i; - if (node->height <= 1) - { - continue; - } - - b2Assert(node->IsLeaf() == false); - - int32 child1 = node->child1; - int32 child2 = node->child2; - int32 balance = b2Abs(m_nodes[child2].height - m_nodes[child1].height); - maxBalance = b2Max(maxBalance, balance); - } - - return maxBalance; -} - -void b2DynamicTree::RebuildBottomUp() -{ - int32* nodes = (int32*)b2Alloc(m_nodeCount * sizeof(int32)); - int32 count = 0; - - // Build array of leaves. Free the rest. - for (int32 i = 0; i < m_nodeCapacity; ++i) - { - if (m_nodes[i].height < 0) - { - // free node in pool - continue; - } - - if (m_nodes[i].IsLeaf()) - { - m_nodes[i].parent = b2_nullNode; - nodes[count] = i; - ++count; - } - else - { - FreeNode(i); - } - } - - while (count > 1) - { - float32 minCost = b2_maxFloat; - int32 iMin = -1, jMin = -1; - for (int32 i = 0; i < count; ++i) - { - b2AABB aabbi = m_nodes[nodes[i]].aabb; - - for (int32 j = i + 1; j < count; ++j) - { - b2AABB aabbj = m_nodes[nodes[j]].aabb; - b2AABB b; - b.Combine(aabbi, aabbj); - float32 cost = b.GetPerimeter(); - if (cost < minCost) - { - iMin = i; - jMin = j; - minCost = cost; - } - } - } - - int32 index1 = nodes[iMin]; - int32 index2 = nodes[jMin]; - b2TreeNode* child1 = m_nodes + index1; - b2TreeNode* child2 = m_nodes + index2; - - int32 parentIndex = AllocateNode(); - b2TreeNode* parent = m_nodes + parentIndex; - parent->child1 = index1; - parent->child2 = index2; - parent->height = 1 + b2Max(child1->height, child2->height); - parent->aabb.Combine(child1->aabb, child2->aabb); - parent->parent = b2_nullNode; - - child1->parent = parentIndex; - child2->parent = parentIndex; - - nodes[jMin] = nodes[count-1]; - nodes[iMin] = parentIndex; - --count; - } - - m_root = nodes[0]; - b2Free(nodes); - - Validate(); -} - -void b2DynamicTree::ShiftOrigin(const b2Vec2& newOrigin) -{ - // Build array of leaves. Free the rest. - for (int32 i = 0; i < m_nodeCapacity; ++i) - { - m_nodes[i].aabb.lowerBound -= newOrigin; - m_nodes[i].aabb.upperBound -= newOrigin; - } -} diff --git a/love/src/jni/love/src/libraries/Box2D/Collision/b2DynamicTree.h b/love/src/jni/love/src/libraries/Box2D/Collision/b2DynamicTree.h deleted file mode 100644 index bf80f73a..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Collision/b2DynamicTree.h +++ /dev/null @@ -1,289 +0,0 @@ -/* -* Copyright (c) 2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_DYNAMIC_TREE_H -#define B2_DYNAMIC_TREE_H - -#include -#include - -#define b2_nullNode (-1) - -/// A node in the dynamic tree. The client does not interact with this directly. -struct b2TreeNode -{ - bool IsLeaf() const - { - return child1 == b2_nullNode; - } - - /// Enlarged AABB - b2AABB aabb; - - void* userData; - - union - { - int32 parent; - int32 next; - }; - - int32 child1; - int32 child2; - - // leaf = 0, free node = -1 - int32 height; -}; - -/// A dynamic AABB tree broad-phase, inspired by Nathanael Presson's btDbvt. -/// A dynamic tree arranges data in a binary tree to accelerate -/// queries such as volume queries and ray casts. Leafs are proxies -/// with an AABB. In the tree we expand the proxy AABB by b2_fatAABBFactor -/// so that the proxy AABB is bigger than the client object. This allows the client -/// object to move by small amounts without triggering a tree update. -/// -/// Nodes are pooled and relocatable, so we use node indices rather than pointers. -class b2DynamicTree -{ -public: - /// Constructing the tree initializes the node pool. - b2DynamicTree(); - - /// Destroy the tree, freeing the node pool. - ~b2DynamicTree(); - - /// Create a proxy. Provide a tight fitting AABB and a userData pointer. - int32 CreateProxy(const b2AABB& aabb, void* userData); - - /// Destroy a proxy. This asserts if the id is invalid. - void DestroyProxy(int32 proxyId); - - /// Move a proxy with a swepted AABB. If the proxy has moved outside of its fattened AABB, - /// then the proxy is removed from the tree and re-inserted. Otherwise - /// the function returns immediately. - /// @return true if the proxy was re-inserted. - bool MoveProxy(int32 proxyId, const b2AABB& aabb1, const b2Vec2& displacement); - - /// Get proxy user data. - /// @return the proxy user data or 0 if the id is invalid. - void* GetUserData(int32 proxyId) const; - - /// Get the fat AABB for a proxy. - const b2AABB& GetFatAABB(int32 proxyId) const; - - /// Query an AABB for overlapping proxies. The callback class - /// is called for each proxy that overlaps the supplied AABB. - template - void Query(T* callback, const b2AABB& aabb) const; - - /// Ray-cast against the proxies in the tree. This relies on the callback - /// to perform a exact ray-cast in the case were the proxy contains a shape. - /// The callback also performs the any collision filtering. This has performance - /// roughly equal to k * log(n), where k is the number of collisions and n is the - /// number of proxies in the tree. - /// @param input the ray-cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1). - /// @param callback a callback class that is called for each proxy that is hit by the ray. - template - void RayCast(T* callback, const b2RayCastInput& input) const; - - /// Validate this tree. For testing. - void Validate() const; - - /// Compute the height of the binary tree in O(N) time. Should not be - /// called often. - int32 GetHeight() const; - - /// Get the maximum balance of an node in the tree. The balance is the difference - /// in height of the two children of a node. - int32 GetMaxBalance() const; - - /// Get the ratio of the sum of the node areas to the root area. - float32 GetAreaRatio() const; - - /// Build an optimal tree. Very expensive. For testing. - void RebuildBottomUp(); - - /// Shift the world origin. Useful for large worlds. - /// The shift formula is: position -= newOrigin - /// @param newOrigin the new origin with respect to the old origin - void ShiftOrigin(const b2Vec2& newOrigin); - -private: - - int32 AllocateNode(); - void FreeNode(int32 node); - - void InsertLeaf(int32 node); - void RemoveLeaf(int32 node); - - int32 Balance(int32 index); - - int32 ComputeHeight() const; - int32 ComputeHeight(int32 nodeId) const; - - void ValidateStructure(int32 index) const; - void ValidateMetrics(int32 index) const; - - int32 m_root; - - b2TreeNode* m_nodes; - int32 m_nodeCount; - int32 m_nodeCapacity; - - int32 m_freeList; - - /// This is used to incrementally traverse the tree for re-balancing. - uint32 m_path; - - int32 m_insertionCount; -}; - -inline void* b2DynamicTree::GetUserData(int32 proxyId) const -{ - b2Assert(0 <= proxyId && proxyId < m_nodeCapacity); - return m_nodes[proxyId].userData; -} - -inline const b2AABB& b2DynamicTree::GetFatAABB(int32 proxyId) const -{ - b2Assert(0 <= proxyId && proxyId < m_nodeCapacity); - return m_nodes[proxyId].aabb; -} - -template -inline void b2DynamicTree::Query(T* callback, const b2AABB& aabb) const -{ - b2GrowableStack stack; - stack.Push(m_root); - - while (stack.GetCount() > 0) - { - int32 nodeId = stack.Pop(); - if (nodeId == b2_nullNode) - { - continue; - } - - const b2TreeNode* node = m_nodes + nodeId; - - if (b2TestOverlap(node->aabb, aabb)) - { - if (node->IsLeaf()) - { - bool proceed = callback->QueryCallback(nodeId); - if (proceed == false) - { - return; - } - } - else - { - stack.Push(node->child1); - stack.Push(node->child2); - } - } - } -} - -template -inline void b2DynamicTree::RayCast(T* callback, const b2RayCastInput& input) const -{ - b2Vec2 p1 = input.p1; - b2Vec2 p2 = input.p2; - b2Vec2 r = p2 - p1; - b2Assert(r.LengthSquared() > 0.0f); - r.Normalize(); - - // v is perpendicular to the segment. - b2Vec2 v = b2Cross(1.0f, r); - b2Vec2 abs_v = b2Abs(v); - - // Separating axis for segment (Gino, p80). - // |dot(v, p1 - c)| > dot(|v|, h) - - float32 maxFraction = input.maxFraction; - - // Build a bounding box for the segment. - b2AABB segmentAABB; - { - b2Vec2 t = p1 + maxFraction * (p2 - p1); - segmentAABB.lowerBound = b2Min(p1, t); - segmentAABB.upperBound = b2Max(p1, t); - } - - b2GrowableStack stack; - stack.Push(m_root); - - while (stack.GetCount() > 0) - { - int32 nodeId = stack.Pop(); - if (nodeId == b2_nullNode) - { - continue; - } - - const b2TreeNode* node = m_nodes + nodeId; - - if (b2TestOverlap(node->aabb, segmentAABB) == false) - { - continue; - } - - // Separating axis for segment (Gino, p80). - // |dot(v, p1 - c)| > dot(|v|, h) - b2Vec2 c = node->aabb.GetCenter(); - b2Vec2 h = node->aabb.GetExtents(); - float32 separation = b2Abs(b2Dot(v, p1 - c)) - b2Dot(abs_v, h); - if (separation > 0.0f) - { - continue; - } - - if (node->IsLeaf()) - { - b2RayCastInput subInput; - subInput.p1 = input.p1; - subInput.p2 = input.p2; - subInput.maxFraction = maxFraction; - - float32 value = callback->RayCastCallback(subInput, nodeId); - - if (value == 0.0f) - { - // The client has terminated the ray cast. - return; - } - - if (value > 0.0f) - { - // Update segment bounding box. - maxFraction = value; - b2Vec2 t = p1 + maxFraction * (p2 - p1); - segmentAABB.lowerBound = b2Min(p1, t); - segmentAABB.upperBound = b2Max(p1, t); - } - } - else - { - stack.Push(node->child1); - stack.Push(node->child2); - } - } -} - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Collision/b2TimeOfImpact.cpp b/love/src/jni/love/src/libraries/Box2D/Collision/b2TimeOfImpact.cpp deleted file mode 100644 index 60da95c3..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Collision/b2TimeOfImpact.cpp +++ /dev/null @@ -1,486 +0,0 @@ -/* -* Copyright (c) 2007-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include -#include -#include -#include - -#include - -float32 b2_toiTime, b2_toiMaxTime; -int32 b2_toiCalls, b2_toiIters, b2_toiMaxIters; -int32 b2_toiRootIters, b2_toiMaxRootIters; - -// -struct b2SeparationFunction -{ - enum Type - { - e_points, - e_faceA, - e_faceB - }; - - // TODO_ERIN might not need to return the separation - - float32 Initialize(const b2SimplexCache* cache, - const b2DistanceProxy* proxyA, const b2Sweep& sweepA, - const b2DistanceProxy* proxyB, const b2Sweep& sweepB, - float32 t1) - { - m_proxyA = proxyA; - m_proxyB = proxyB; - int32 count = cache->count; - b2Assert(0 < count && count < 3); - - m_sweepA = sweepA; - m_sweepB = sweepB; - - b2Transform xfA, xfB; - m_sweepA.GetTransform(&xfA, t1); - m_sweepB.GetTransform(&xfB, t1); - - if (count == 1) - { - m_type = e_points; - b2Vec2 localPointA = m_proxyA->GetVertex(cache->indexA[0]); - b2Vec2 localPointB = m_proxyB->GetVertex(cache->indexB[0]); - b2Vec2 pointA = b2Mul(xfA, localPointA); - b2Vec2 pointB = b2Mul(xfB, localPointB); - m_axis = pointB - pointA; - float32 s = m_axis.Normalize(); - return s; - } - else if (cache->indexA[0] == cache->indexA[1]) - { - // Two points on B and one on A. - m_type = e_faceB; - b2Vec2 localPointB1 = proxyB->GetVertex(cache->indexB[0]); - b2Vec2 localPointB2 = proxyB->GetVertex(cache->indexB[1]); - - m_axis = b2Cross(localPointB2 - localPointB1, 1.0f); - m_axis.Normalize(); - b2Vec2 normal = b2Mul(xfB.q, m_axis); - - m_localPoint = 0.5f * (localPointB1 + localPointB2); - b2Vec2 pointB = b2Mul(xfB, m_localPoint); - - b2Vec2 localPointA = proxyA->GetVertex(cache->indexA[0]); - b2Vec2 pointA = b2Mul(xfA, localPointA); - - float32 s = b2Dot(pointA - pointB, normal); - if (s < 0.0f) - { - m_axis = -m_axis; - s = -s; - } - return s; - } - else - { - // Two points on A and one or two points on B. - m_type = e_faceA; - b2Vec2 localPointA1 = m_proxyA->GetVertex(cache->indexA[0]); - b2Vec2 localPointA2 = m_proxyA->GetVertex(cache->indexA[1]); - - m_axis = b2Cross(localPointA2 - localPointA1, 1.0f); - m_axis.Normalize(); - b2Vec2 normal = b2Mul(xfA.q, m_axis); - - m_localPoint = 0.5f * (localPointA1 + localPointA2); - b2Vec2 pointA = b2Mul(xfA, m_localPoint); - - b2Vec2 localPointB = m_proxyB->GetVertex(cache->indexB[0]); - b2Vec2 pointB = b2Mul(xfB, localPointB); - - float32 s = b2Dot(pointB - pointA, normal); - if (s < 0.0f) - { - m_axis = -m_axis; - s = -s; - } - return s; - } - } - - // - float32 FindMinSeparation(int32* indexA, int32* indexB, float32 t) const - { - b2Transform xfA, xfB; - m_sweepA.GetTransform(&xfA, t); - m_sweepB.GetTransform(&xfB, t); - - switch (m_type) - { - case e_points: - { - b2Vec2 axisA = b2MulT(xfA.q, m_axis); - b2Vec2 axisB = b2MulT(xfB.q, -m_axis); - - *indexA = m_proxyA->GetSupport(axisA); - *indexB = m_proxyB->GetSupport(axisB); - - b2Vec2 localPointA = m_proxyA->GetVertex(*indexA); - b2Vec2 localPointB = m_proxyB->GetVertex(*indexB); - - b2Vec2 pointA = b2Mul(xfA, localPointA); - b2Vec2 pointB = b2Mul(xfB, localPointB); - - float32 separation = b2Dot(pointB - pointA, m_axis); - return separation; - } - - case e_faceA: - { - b2Vec2 normal = b2Mul(xfA.q, m_axis); - b2Vec2 pointA = b2Mul(xfA, m_localPoint); - - b2Vec2 axisB = b2MulT(xfB.q, -normal); - - *indexA = -1; - *indexB = m_proxyB->GetSupport(axisB); - - b2Vec2 localPointB = m_proxyB->GetVertex(*indexB); - b2Vec2 pointB = b2Mul(xfB, localPointB); - - float32 separation = b2Dot(pointB - pointA, normal); - return separation; - } - - case e_faceB: - { - b2Vec2 normal = b2Mul(xfB.q, m_axis); - b2Vec2 pointB = b2Mul(xfB, m_localPoint); - - b2Vec2 axisA = b2MulT(xfA.q, -normal); - - *indexB = -1; - *indexA = m_proxyA->GetSupport(axisA); - - b2Vec2 localPointA = m_proxyA->GetVertex(*indexA); - b2Vec2 pointA = b2Mul(xfA, localPointA); - - float32 separation = b2Dot(pointA - pointB, normal); - return separation; - } - - default: - b2Assert(false); - *indexA = -1; - *indexB = -1; - return 0.0f; - } - } - - // - float32 Evaluate(int32 indexA, int32 indexB, float32 t) const - { - b2Transform xfA, xfB; - m_sweepA.GetTransform(&xfA, t); - m_sweepB.GetTransform(&xfB, t); - - switch (m_type) - { - case e_points: - { - b2Vec2 localPointA = m_proxyA->GetVertex(indexA); - b2Vec2 localPointB = m_proxyB->GetVertex(indexB); - - b2Vec2 pointA = b2Mul(xfA, localPointA); - b2Vec2 pointB = b2Mul(xfB, localPointB); - float32 separation = b2Dot(pointB - pointA, m_axis); - - return separation; - } - - case e_faceA: - { - b2Vec2 normal = b2Mul(xfA.q, m_axis); - b2Vec2 pointA = b2Mul(xfA, m_localPoint); - - b2Vec2 localPointB = m_proxyB->GetVertex(indexB); - b2Vec2 pointB = b2Mul(xfB, localPointB); - - float32 separation = b2Dot(pointB - pointA, normal); - return separation; - } - - case e_faceB: - { - b2Vec2 normal = b2Mul(xfB.q, m_axis); - b2Vec2 pointB = b2Mul(xfB, m_localPoint); - - b2Vec2 localPointA = m_proxyA->GetVertex(indexA); - b2Vec2 pointA = b2Mul(xfA, localPointA); - - float32 separation = b2Dot(pointA - pointB, normal); - return separation; - } - - default: - b2Assert(false); - return 0.0f; - } - } - - const b2DistanceProxy* m_proxyA; - const b2DistanceProxy* m_proxyB; - b2Sweep m_sweepA, m_sweepB; - Type m_type; - b2Vec2 m_localPoint; - b2Vec2 m_axis; -}; - -// CCD via the local separating axis method. This seeks progression -// by computing the largest time at which separation is maintained. -void b2TimeOfImpact(b2TOIOutput* output, const b2TOIInput* input) -{ - b2Timer timer; - - ++b2_toiCalls; - - output->state = b2TOIOutput::e_unknown; - output->t = input->tMax; - - const b2DistanceProxy* proxyA = &input->proxyA; - const b2DistanceProxy* proxyB = &input->proxyB; - - b2Sweep sweepA = input->sweepA; - b2Sweep sweepB = input->sweepB; - - // Large rotations can make the root finder fail, so we normalize the - // sweep angles. - sweepA.Normalize(); - sweepB.Normalize(); - - float32 tMax = input->tMax; - - float32 totalRadius = proxyA->m_radius + proxyB->m_radius; - float32 target = b2Max(b2_linearSlop, totalRadius - 3.0f * b2_linearSlop); - float32 tolerance = 0.25f * b2_linearSlop; - b2Assert(target > tolerance); - - float32 t1 = 0.0f; - const int32 k_maxIterations = 20; // TODO_ERIN b2Settings - int32 iter = 0; - - // Prepare input for distance query. - b2SimplexCache cache; - cache.count = 0; - b2DistanceInput distanceInput; - distanceInput.proxyA = input->proxyA; - distanceInput.proxyB = input->proxyB; - distanceInput.useRadii = false; - - // The outer loop progressively attempts to compute new separating axes. - // This loop terminates when an axis is repeated (no progress is made). - for(;;) - { - b2Transform xfA, xfB; - sweepA.GetTransform(&xfA, t1); - sweepB.GetTransform(&xfB, t1); - - // Get the distance between shapes. We can also use the results - // to get a separating axis. - distanceInput.transformA = xfA; - distanceInput.transformB = xfB; - b2DistanceOutput distanceOutput; - b2Distance(&distanceOutput, &cache, &distanceInput); - - // If the shapes are overlapped, we give up on continuous collision. - if (distanceOutput.distance <= 0.0f) - { - // Failure! - output->state = b2TOIOutput::e_overlapped; - output->t = 0.0f; - break; - } - - if (distanceOutput.distance < target + tolerance) - { - // Victory! - output->state = b2TOIOutput::e_touching; - output->t = t1; - break; - } - - // Initialize the separating axis. - b2SeparationFunction fcn; - fcn.Initialize(&cache, proxyA, sweepA, proxyB, sweepB, t1); -#if 0 - // Dump the curve seen by the root finder - { - const int32 N = 100; - float32 dx = 1.0f / N; - float32 xs[N+1]; - float32 fs[N+1]; - - float32 x = 0.0f; - - for (int32 i = 0; i <= N; ++i) - { - sweepA.GetTransform(&xfA, x); - sweepB.GetTransform(&xfB, x); - float32 f = fcn.Evaluate(xfA, xfB) - target; - - printf("%g %g\n", x, f); - - xs[i] = x; - fs[i] = f; - - x += dx; - } - } -#endif - - // Compute the TOI on the separating axis. We do this by successively - // resolving the deepest point. This loop is bounded by the number of vertices. - bool done = false; - float32 t2 = tMax; - int32 pushBackIter = 0; - for (;;) - { - // Find the deepest point at t2. Store the witness point indices. - int32 indexA, indexB; - float32 s2 = fcn.FindMinSeparation(&indexA, &indexB, t2); - - // Is the final configuration separated? - if (s2 > target + tolerance) - { - // Victory! - output->state = b2TOIOutput::e_separated; - output->t = tMax; - done = true; - break; - } - - // Has the separation reached tolerance? - if (s2 > target - tolerance) - { - // Advance the sweeps - t1 = t2; - break; - } - - // Compute the initial separation of the witness points. - float32 s1 = fcn.Evaluate(indexA, indexB, t1); - - // Check for initial overlap. This might happen if the root finder - // runs out of iterations. - if (s1 < target - tolerance) - { - output->state = b2TOIOutput::e_failed; - output->t = t1; - done = true; - break; - } - - // Check for touching - if (s1 <= target + tolerance) - { - // Victory! t1 should hold the TOI (could be 0.0). - output->state = b2TOIOutput::e_touching; - output->t = t1; - done = true; - break; - } - - // Compute 1D root of: f(x) - target = 0 - int32 rootIterCount = 0; - float32 a1 = t1, a2 = t2; - for (;;) - { - // Use a mix of the secant rule and bisection. - float32 t; - if (rootIterCount & 1) - { - // Secant rule to improve convergence. - t = a1 + (target - s1) * (a2 - a1) / (s2 - s1); - } - else - { - // Bisection to guarantee progress. - t = 0.5f * (a1 + a2); - } - - ++rootIterCount; - ++b2_toiRootIters; - - float32 s = fcn.Evaluate(indexA, indexB, t); - - if (b2Abs(s - target) < tolerance) - { - // t2 holds a tentative value for t1 - t2 = t; - break; - } - - // Ensure we continue to bracket the root. - if (s > target) - { - a1 = t; - s1 = s; - } - else - { - a2 = t; - s2 = s; - } - - if (rootIterCount == 50) - { - break; - } - } - - b2_toiMaxRootIters = b2Max(b2_toiMaxRootIters, rootIterCount); - - ++pushBackIter; - - if (pushBackIter == b2_maxPolygonVertices) - { - break; - } - } - - ++iter; - ++b2_toiIters; - - if (done) - { - break; - } - - if (iter == k_maxIterations) - { - // Root finder got stuck. Semi-victory. - output->state = b2TOIOutput::e_failed; - output->t = t1; - break; - } - } - - b2_toiMaxIters = b2Max(b2_toiMaxIters, iter); - - float32 time = timer.GetMilliseconds(); - b2_toiMaxTime = b2Max(b2_toiMaxTime, time); - b2_toiTime += time; -} diff --git a/love/src/jni/love/src/libraries/Box2D/Collision/b2TimeOfImpact.h b/love/src/jni/love/src/libraries/Box2D/Collision/b2TimeOfImpact.h deleted file mode 100644 index 20620c1e..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Collision/b2TimeOfImpact.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_TIME_OF_IMPACT_H -#define B2_TIME_OF_IMPACT_H - -#include -#include - -/// Input parameters for b2TimeOfImpact -struct b2TOIInput -{ - b2DistanceProxy proxyA; - b2DistanceProxy proxyB; - b2Sweep sweepA; - b2Sweep sweepB; - float32 tMax; // defines sweep interval [0, tMax] -}; - -// Output parameters for b2TimeOfImpact. -struct b2TOIOutput -{ - enum State - { - e_unknown, - e_failed, - e_overlapped, - e_touching, - e_separated - }; - - State state; - float32 t; -}; - -/// Compute the upper bound on time before two shapes penetrate. Time is represented as -/// a fraction between [0,tMax]. This uses a swept separating axis and may miss some intermediate, -/// non-tunneling collision. If you change the time interval, you should call this function -/// again. -/// Note: use b2Distance to compute the contact point and normal at the time of impact. -void b2TimeOfImpact(b2TOIOutput* output, const b2TOIInput* input); - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Common/b2BlockAllocator.cpp b/love/src/jni/love/src/libraries/Box2D/Common/b2BlockAllocator.cpp deleted file mode 100644 index f16db702..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Common/b2BlockAllocator.cpp +++ /dev/null @@ -1,216 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include -#include -#include - -int32 b2BlockAllocator::s_blockSizes[b2_blockSizes] = -{ - 16, // 0 - 32, // 1 - 64, // 2 - 96, // 3 - 128, // 4 - 160, // 5 - 192, // 6 - 224, // 7 - 256, // 8 - 320, // 9 - 384, // 10 - 448, // 11 - 512, // 12 - 640, // 13 -}; -uint8 b2BlockAllocator::s_blockSizeLookup[b2_maxBlockSize + 1]; -bool b2BlockAllocator::s_blockSizeLookupInitialized; - -struct b2Chunk -{ - int32 blockSize; - b2Block* blocks; -}; - -struct b2Block -{ - b2Block* next; -}; - -b2BlockAllocator::b2BlockAllocator() -{ - b2Assert(b2_blockSizes < UCHAR_MAX); - - m_chunkSpace = b2_chunkArrayIncrement; - m_chunkCount = 0; - m_chunks = (b2Chunk*)b2Alloc(m_chunkSpace * sizeof(b2Chunk)); - - memset(m_chunks, 0, m_chunkSpace * sizeof(b2Chunk)); - memset(m_freeLists, 0, sizeof(m_freeLists)); - - if (s_blockSizeLookupInitialized == false) - { - int32 j = 0; - for (int32 i = 1; i <= b2_maxBlockSize; ++i) - { - b2Assert(j < b2_blockSizes); - if (i <= s_blockSizes[j]) - { - s_blockSizeLookup[i] = (uint8)j; - } - else - { - ++j; - s_blockSizeLookup[i] = (uint8)j; - } - } - - s_blockSizeLookupInitialized = true; - } -} - -b2BlockAllocator::~b2BlockAllocator() -{ - for (int32 i = 0; i < m_chunkCount; ++i) - { - b2Free(m_chunks[i].blocks); - } - - b2Free(m_chunks); -} - -void* b2BlockAllocator::Allocate(int32 size) -{ - if (size == 0) - return NULL; - - b2Assert(0 < size); - - if (size > b2_maxBlockSize) - { - return b2Alloc(size); - } - - int32 index = s_blockSizeLookup[size]; - b2Assert(0 <= index && index < b2_blockSizes); - - if (m_freeLists[index]) - { - b2Block* block = m_freeLists[index]; - m_freeLists[index] = block->next; - return block; - } - else - { - if (m_chunkCount == m_chunkSpace) - { - b2Chunk* oldChunks = m_chunks; - m_chunkSpace += b2_chunkArrayIncrement; - m_chunks = (b2Chunk*)b2Alloc(m_chunkSpace * sizeof(b2Chunk)); - memcpy(m_chunks, oldChunks, m_chunkCount * sizeof(b2Chunk)); - memset(m_chunks + m_chunkCount, 0, b2_chunkArrayIncrement * sizeof(b2Chunk)); - b2Free(oldChunks); - } - - b2Chunk* chunk = m_chunks + m_chunkCount; - chunk->blocks = (b2Block*)b2Alloc(b2_chunkSize); -#if defined(_DEBUG) - memset(chunk->blocks, 0xcd, b2_chunkSize); -#endif - int32 blockSize = s_blockSizes[index]; - chunk->blockSize = blockSize; - int32 blockCount = b2_chunkSize / blockSize; - b2Assert(blockCount * blockSize <= b2_chunkSize); - for (int32 i = 0; i < blockCount - 1; ++i) - { - b2Block* block = (b2Block*)((int8*)chunk->blocks + blockSize * i); - b2Block* next = (b2Block*)((int8*)chunk->blocks + blockSize * (i + 1)); - block->next = next; - } - b2Block* last = (b2Block*)((int8*)chunk->blocks + blockSize * (blockCount - 1)); - last->next = NULL; - - m_freeLists[index] = chunk->blocks->next; - ++m_chunkCount; - - return chunk->blocks; - } -} - -void b2BlockAllocator::Free(void* p, int32 size) -{ - if (size == 0) - { - return; - } - - b2Assert(0 < size); - - if (size > b2_maxBlockSize) - { - b2Free(p); - return; - } - - int32 index = s_blockSizeLookup[size]; - b2Assert(0 <= index && index < b2_blockSizes); - -#ifdef _DEBUG - // Verify the memory address and size is valid. - int32 blockSize = s_blockSizes[index]; - bool found = false; - for (int32 i = 0; i < m_chunkCount; ++i) - { - b2Chunk* chunk = m_chunks + i; - if (chunk->blockSize != blockSize) - { - b2Assert( (int8*)p + blockSize <= (int8*)chunk->blocks || - (int8*)chunk->blocks + b2_chunkSize <= (int8*)p); - } - else - { - if ((int8*)chunk->blocks <= (int8*)p && (int8*)p + blockSize <= (int8*)chunk->blocks + b2_chunkSize) - { - found = true; - } - } - } - - b2Assert(found); - - memset(p, 0xfd, blockSize); -#endif - - b2Block* block = (b2Block*)p; - block->next = m_freeLists[index]; - m_freeLists[index] = block; -} - -void b2BlockAllocator::Clear() -{ - for (int32 i = 0; i < m_chunkCount; ++i) - { - b2Free(m_chunks[i].blocks); - } - - m_chunkCount = 0; - memset(m_chunks, 0, m_chunkSpace * sizeof(b2Chunk)); - - memset(m_freeLists, 0, sizeof(m_freeLists)); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Common/b2BlockAllocator.h b/love/src/jni/love/src/libraries/Box2D/Common/b2BlockAllocator.h deleted file mode 100644 index cea3cef9..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Common/b2BlockAllocator.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_BLOCK_ALLOCATOR_H -#define B2_BLOCK_ALLOCATOR_H - -#include - -const int32 b2_chunkSize = 16 * 1024; -const int32 b2_maxBlockSize = 640; -const int32 b2_blockSizes = 14; -const int32 b2_chunkArrayIncrement = 128; - -struct b2Block; -struct b2Chunk; - -/// This is a small object allocator used for allocating small -/// objects that persist for more than one time step. -/// See: http://www.codeproject.com/useritems/Small_Block_Allocator.asp -class b2BlockAllocator -{ -public: - b2BlockAllocator(); - ~b2BlockAllocator(); - - /// Allocate memory. This will use b2Alloc if the size is larger than b2_maxBlockSize. - void* Allocate(int32 size); - - /// Free memory. This will use b2Free if the size is larger than b2_maxBlockSize. - void Free(void* p, int32 size); - - void Clear(); - -private: - - b2Chunk* m_chunks; - int32 m_chunkCount; - int32 m_chunkSpace; - - b2Block* m_freeLists[b2_blockSizes]; - - static int32 s_blockSizes[b2_blockSizes]; - static uint8 s_blockSizeLookup[b2_maxBlockSize + 1]; - static bool s_blockSizeLookupInitialized; -}; - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Common/b2Draw.cpp b/love/src/jni/love/src/libraries/Box2D/Common/b2Draw.cpp deleted file mode 100644 index 2cd9b1a5..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Common/b2Draw.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* -* Copyright (c) 2011 Erin Catto http://box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include - -b2Draw::b2Draw() -{ - m_drawFlags = 0; -} - -void b2Draw::SetFlags(uint32 flags) -{ - m_drawFlags = flags; -} - -uint32 b2Draw::GetFlags() const -{ - return m_drawFlags; -} - -void b2Draw::AppendFlags(uint32 flags) -{ - m_drawFlags |= flags; -} - -void b2Draw::ClearFlags(uint32 flags) -{ - m_drawFlags &= ~flags; -} diff --git a/love/src/jni/love/src/libraries/Box2D/Common/b2Draw.h b/love/src/jni/love/src/libraries/Box2D/Common/b2Draw.h deleted file mode 100644 index be65fb0f..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Common/b2Draw.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -* Copyright (c) 2011 Erin Catto http://box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_DRAW_H -#define B2_DRAW_H - -#include - -/// Color for debug drawing. Each value has the range [0,1]. -struct b2Color -{ - b2Color() {} - b2Color(float32 r, float32 g, float32 b, float32 a = 1.0f) : r(r), g(g), b(b), a(a) {} - void Set(float32 ri, float32 gi, float32 bi, float32 ai = 1.0f) { r = ri; g = gi; b = bi; a = ai; } - float32 r, g, b, a; -}; - -/// Implement and register this class with a b2World to provide debug drawing of physics -/// entities in your game. -class b2Draw -{ -public: - b2Draw(); - - virtual ~b2Draw() {} - - enum - { - e_shapeBit = 0x0001, ///< draw shapes - e_jointBit = 0x0002, ///< draw joint connections - e_aabbBit = 0x0004, ///< draw axis aligned bounding boxes - e_pairBit = 0x0008, ///< draw broad-phase pairs - e_centerOfMassBit = 0x0010 ///< draw center of mass frame - }; - - /// Set the drawing flags. - void SetFlags(uint32 flags); - - /// Get the drawing flags. - uint32 GetFlags() const; - - /// Append flags to the current flags. - void AppendFlags(uint32 flags); - - /// Clear flags from the current flags. - void ClearFlags(uint32 flags); - - /// Draw a closed polygon provided in CCW order. - virtual void DrawPolygon(const b2Vec2* vertices, int32 vertexCount, const b2Color& color) = 0; - - /// Draw a solid closed polygon provided in CCW order. - virtual void DrawSolidPolygon(const b2Vec2* vertices, int32 vertexCount, const b2Color& color) = 0; - - /// Draw a circle. - virtual void DrawCircle(const b2Vec2& center, float32 radius, const b2Color& color) = 0; - - /// Draw a solid circle. - virtual void DrawSolidCircle(const b2Vec2& center, float32 radius, const b2Vec2& axis, const b2Color& color) = 0; - - /// Draw a line segment. - virtual void DrawSegment(const b2Vec2& p1, const b2Vec2& p2, const b2Color& color) = 0; - - /// Draw a transform. Choose your own length scale. - /// @param xf a transform. - virtual void DrawTransform(const b2Transform& xf) = 0; - -protected: - uint32 m_drawFlags; -}; - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Common/b2GrowableStack.h b/love/src/jni/love/src/libraries/Box2D/Common/b2GrowableStack.h deleted file mode 100644 index 98924771..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Common/b2GrowableStack.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -* Copyright (c) 2010 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_GROWABLE_STACK_H -#define B2_GROWABLE_STACK_H -#include -#include - -/// This is a growable LIFO stack with an initial capacity of N. -/// If the stack size exceeds the initial capacity, the heap is used -/// to increase the size of the stack. -template -class b2GrowableStack -{ -public: - b2GrowableStack() - { - m_stack = m_array; - m_count = 0; - m_capacity = N; - } - - ~b2GrowableStack() - { - if (m_stack != m_array) - { - b2Free(m_stack); - m_stack = NULL; - } - } - - void Push(const T& element) - { - if (m_count == m_capacity) - { - T* old = m_stack; - m_capacity *= 2; - m_stack = (T*)b2Alloc(m_capacity * sizeof(T)); - memcpy(m_stack, old, m_count * sizeof(T)); - if (old != m_array) - { - b2Free(old); - } - } - - m_stack[m_count] = element; - ++m_count; - } - - T Pop() - { - b2Assert(m_count > 0); - --m_count; - return m_stack[m_count]; - } - - int32 GetCount() - { - return m_count; - } - -private: - T* m_stack; - T m_array[N]; - int32 m_count; - int32 m_capacity; -}; - - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Common/b2Math.cpp b/love/src/jni/love/src/libraries/Box2D/Common/b2Math.cpp deleted file mode 100644 index d6027be9..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Common/b2Math.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* -* Copyright (c) 2007-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include - -const b2Vec2 b2Vec2_zero(0.0f, 0.0f); - -/// Solve A * x = b, where b is a column vector. This is more efficient -/// than computing the inverse in one-shot cases. -b2Vec3 b2Mat33::Solve33(const b2Vec3& b) const -{ - float32 det = b2Dot(ex, b2Cross(ey, ez)); - if (det != 0.0f) - { - det = 1.0f / det; - } - b2Vec3 x; - x.x = det * b2Dot(b, b2Cross(ey, ez)); - x.y = det * b2Dot(ex, b2Cross(b, ez)); - x.z = det * b2Dot(ex, b2Cross(ey, b)); - return x; -} - -/// Solve A * x = b, where b is a column vector. This is more efficient -/// than computing the inverse in one-shot cases. -b2Vec2 b2Mat33::Solve22(const b2Vec2& b) const -{ - float32 a11 = ex.x, a12 = ey.x, a21 = ex.y, a22 = ey.y; - float32 det = a11 * a22 - a12 * a21; - if (det != 0.0f) - { - det = 1.0f / det; - } - b2Vec2 x; - x.x = det * (a22 * b.x - a12 * b.y); - x.y = det * (a11 * b.y - a21 * b.x); - return x; -} - -/// -void b2Mat33::GetInverse22(b2Mat33* M) const -{ - float32 a = ex.x, b = ey.x, c = ex.y, d = ey.y; - float32 det = a * d - b * c; - if (det != 0.0f) - { - det = 1.0f / det; - } - - M->ex.x = det * d; M->ey.x = -det * b; M->ex.z = 0.0f; - M->ex.y = -det * c; M->ey.y = det * a; M->ey.z = 0.0f; - M->ez.x = 0.0f; M->ez.y = 0.0f; M->ez.z = 0.0f; -} - -/// Returns the zero matrix if singular. -void b2Mat33::GetSymInverse33(b2Mat33* M) const -{ - float32 det = b2Dot(ex, b2Cross(ey, ez)); - if (det != 0.0f) - { - det = 1.0f / det; - } - - float32 a11 = ex.x, a12 = ey.x, a13 = ez.x; - float32 a22 = ey.y, a23 = ez.y; - float32 a33 = ez.z; - - M->ex.x = det * (a22 * a33 - a23 * a23); - M->ex.y = det * (a13 * a23 - a12 * a33); - M->ex.z = det * (a12 * a23 - a13 * a22); - - M->ey.x = M->ex.y; - M->ey.y = det * (a11 * a33 - a13 * a13); - M->ey.z = det * (a13 * a12 - a11 * a23); - - M->ez.x = M->ex.z; - M->ez.y = M->ey.z; - M->ez.z = det * (a11 * a22 - a12 * a12); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Common/b2Math.h b/love/src/jni/love/src/libraries/Box2D/Common/b2Math.h deleted file mode 100644 index 755c519b..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Common/b2Math.h +++ /dev/null @@ -1,720 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_MATH_H -#define B2_MATH_H - -#include -#include - -/// This function is used to ensure that a floating point number is not a NaN or infinity. -inline bool b2IsValid(float32 x) -{ - int32 ix = *reinterpret_cast(&x); - return (ix & 0x7f800000) != 0x7f800000; -} - -/// This is a approximate yet fast inverse square-root. -inline float32 b2InvSqrt(float32 x) -{ - union - { - float32 x; - int32 i; - } convert; - - convert.x = x; - float32 xhalf = 0.5f * x; - convert.i = 0x5f3759df - (convert.i >> 1); - x = convert.x; - x = x * (1.5f - xhalf * x * x); - return x; -} - -#define b2Sqrt(x) sqrtf(x) -#define b2Atan2(y, x) atan2f(y, x) - -/// A 2D column vector. -struct b2Vec2 -{ - /// Default constructor does nothing (for performance). - b2Vec2() {} - - /// Construct using coordinates. - b2Vec2(float32 x, float32 y) : x(x), y(y) {} - - /// Set this vector to all zeros. - void SetZero() { x = 0.0f; y = 0.0f; } - - /// Set this vector to some specified coordinates. - void Set(float32 x_, float32 y_) { x = x_; y = y_; } - - /// Negate this vector. - b2Vec2 operator -() const { b2Vec2 v; v.Set(-x, -y); return v; } - - /// Read from and indexed element. - float32 operator () (int32 i) const - { - return (&x)[i]; - } - - /// Write to an indexed element. - float32& operator () (int32 i) - { - return (&x)[i]; - } - - /// Add a vector to this vector. - void operator += (const b2Vec2& v) - { - x += v.x; y += v.y; - } - - /// Subtract a vector from this vector. - void operator -= (const b2Vec2& v) - { - x -= v.x; y -= v.y; - } - - /// Multiply this vector by a scalar. - void operator *= (float32 a) - { - x *= a; y *= a; - } - - /// Get the length of this vector (the norm). - float32 Length() const - { - return b2Sqrt(x * x + y * y); - } - - /// Get the length squared. For performance, use this instead of - /// b2Vec2::Length (if possible). - float32 LengthSquared() const - { - return x * x + y * y; - } - - /// Convert this vector into a unit vector. Returns the length. - float32 Normalize() - { - float32 length = Length(); - if (length < b2_epsilon) - { - return 0.0f; - } - float32 invLength = 1.0f / length; - x *= invLength; - y *= invLength; - - return length; - } - - /// Does this vector contain finite coordinates? - bool IsValid() const - { - return b2IsValid(x) && b2IsValid(y); - } - - /// Get the skew vector such that dot(skew_vec, other) == cross(vec, other) - b2Vec2 Skew() const - { - return b2Vec2(-y, x); - } - - float32 x, y; -}; - -/// A 2D column vector with 3 elements. -struct b2Vec3 -{ - /// Default constructor does nothing (for performance). - b2Vec3() {} - - /// Construct using coordinates. - b2Vec3(float32 x, float32 y, float32 z) : x(x), y(y), z(z) {} - - /// Set this vector to all zeros. - void SetZero() { x = 0.0f; y = 0.0f; z = 0.0f; } - - /// Set this vector to some specified coordinates. - void Set(float32 x_, float32 y_, float32 z_) { x = x_; y = y_; z = z_; } - - /// Negate this vector. - b2Vec3 operator -() const { b2Vec3 v; v.Set(-x, -y, -z); return v; } - - /// Add a vector to this vector. - void operator += (const b2Vec3& v) - { - x += v.x; y += v.y; z += v.z; - } - - /// Subtract a vector from this vector. - void operator -= (const b2Vec3& v) - { - x -= v.x; y -= v.y; z -= v.z; - } - - /// Multiply this vector by a scalar. - void operator *= (float32 s) - { - x *= s; y *= s; z *= s; - } - - float32 x, y, z; -}; - -/// A 2-by-2 matrix. Stored in column-major order. -struct b2Mat22 -{ - /// The default constructor does nothing (for performance). - b2Mat22() {} - - /// Construct this matrix using columns. - b2Mat22(const b2Vec2& c1, const b2Vec2& c2) - { - ex = c1; - ey = c2; - } - - /// Construct this matrix using scalars. - b2Mat22(float32 a11, float32 a12, float32 a21, float32 a22) - { - ex.x = a11; ex.y = a21; - ey.x = a12; ey.y = a22; - } - - /// Initialize this matrix using columns. - void Set(const b2Vec2& c1, const b2Vec2& c2) - { - ex = c1; - ey = c2; - } - - /// Set this to the identity matrix. - void SetIdentity() - { - ex.x = 1.0f; ey.x = 0.0f; - ex.y = 0.0f; ey.y = 1.0f; - } - - /// Set this matrix to all zeros. - void SetZero() - { - ex.x = 0.0f; ey.x = 0.0f; - ex.y = 0.0f; ey.y = 0.0f; - } - - b2Mat22 GetInverse() const - { - float32 a = ex.x, b = ey.x, c = ex.y, d = ey.y; - b2Mat22 B; - float32 det = a * d - b * c; - if (det != 0.0f) - { - det = 1.0f / det; - } - B.ex.x = det * d; B.ey.x = -det * b; - B.ex.y = -det * c; B.ey.y = det * a; - return B; - } - - /// Solve A * x = b, where b is a column vector. This is more efficient - /// than computing the inverse in one-shot cases. - b2Vec2 Solve(const b2Vec2& b) const - { - float32 a11 = ex.x, a12 = ey.x, a21 = ex.y, a22 = ey.y; - float32 det = a11 * a22 - a12 * a21; - if (det != 0.0f) - { - det = 1.0f / det; - } - b2Vec2 x; - x.x = det * (a22 * b.x - a12 * b.y); - x.y = det * (a11 * b.y - a21 * b.x); - return x; - } - - b2Vec2 ex, ey; -}; - -/// A 3-by-3 matrix. Stored in column-major order. -struct b2Mat33 -{ - /// The default constructor does nothing (for performance). - b2Mat33() {} - - /// Construct this matrix using columns. - b2Mat33(const b2Vec3& c1, const b2Vec3& c2, const b2Vec3& c3) - { - ex = c1; - ey = c2; - ez = c3; - } - - /// Set this matrix to all zeros. - void SetZero() - { - ex.SetZero(); - ey.SetZero(); - ez.SetZero(); - } - - /// Solve A * x = b, where b is a column vector. This is more efficient - /// than computing the inverse in one-shot cases. - b2Vec3 Solve33(const b2Vec3& b) const; - - /// Solve A * x = b, where b is a column vector. This is more efficient - /// than computing the inverse in one-shot cases. Solve only the upper - /// 2-by-2 matrix equation. - b2Vec2 Solve22(const b2Vec2& b) const; - - /// Get the inverse of this matrix as a 2-by-2. - /// Returns the zero matrix if singular. - void GetInverse22(b2Mat33* M) const; - - /// Get the symmetric inverse of this matrix as a 3-by-3. - /// Returns the zero matrix if singular. - void GetSymInverse33(b2Mat33* M) const; - - b2Vec3 ex, ey, ez; -}; - -/// Rotation -struct b2Rot -{ - b2Rot() {} - - /// Initialize from an angle in radians - explicit b2Rot(float32 angle) - { - /// TODO_ERIN optimize - s = sinf(angle); - c = cosf(angle); - } - - /// Set using an angle in radians. - void Set(float32 angle) - { - /// TODO_ERIN optimize - s = sinf(angle); - c = cosf(angle); - } - - /// Set to the identity rotation - void SetIdentity() - { - s = 0.0f; - c = 1.0f; - } - - /// Get the angle in radians - float32 GetAngle() const - { - return b2Atan2(s, c); - } - - /// Get the x-axis - b2Vec2 GetXAxis() const - { - return b2Vec2(c, s); - } - - /// Get the u-axis - b2Vec2 GetYAxis() const - { - return b2Vec2(-s, c); - } - - /// Sine and cosine - float32 s, c; -}; - -/// A transform contains translation and rotation. It is used to represent -/// the position and orientation of rigid frames. -struct b2Transform -{ - /// The default constructor does nothing. - b2Transform() {} - - /// Initialize using a position vector and a rotation. - b2Transform(const b2Vec2& position, const b2Rot& rotation) : p(position), q(rotation) {} - - /// Set this to the identity transform. - void SetIdentity() - { - p.SetZero(); - q.SetIdentity(); - } - - /// Set this based on the position and angle. - void Set(const b2Vec2& position, float32 angle) - { - p = position; - q.Set(angle); - } - - b2Vec2 p; - b2Rot q; -}; - -/// This describes the motion of a body/shape for TOI computation. -/// Shapes are defined with respect to the body origin, which may -/// no coincide with the center of mass. However, to support dynamics -/// we must interpolate the center of mass position. -struct b2Sweep -{ - /// Get the interpolated transform at a specific time. - /// @param beta is a factor in [0,1], where 0 indicates alpha0. - void GetTransform(b2Transform* xfb, float32 beta) const; - - /// Advance the sweep forward, yielding a new initial state. - /// @param alpha the new initial time. - void Advance(float32 alpha); - - /// Normalize the angles. - void Normalize(); - - b2Vec2 localCenter; ///< local center of mass position - b2Vec2 c0, c; ///< center world positions - float32 a0, a; ///< world angles - - /// Fraction of the current time step in the range [0,1] - /// c0 and a0 are the positions at alpha0. - float32 alpha0; -}; - -/// Useful constant -extern const b2Vec2 b2Vec2_zero; - -/// Perform the dot product on two vectors. -inline float32 b2Dot(const b2Vec2& a, const b2Vec2& b) -{ - return a.x * b.x + a.y * b.y; -} - -/// Perform the cross product on two vectors. In 2D this produces a scalar. -inline float32 b2Cross(const b2Vec2& a, const b2Vec2& b) -{ - return a.x * b.y - a.y * b.x; -} - -/// Perform the cross product on a vector and a scalar. In 2D this produces -/// a vector. -inline b2Vec2 b2Cross(const b2Vec2& a, float32 s) -{ - return b2Vec2(s * a.y, -s * a.x); -} - -/// Perform the cross product on a scalar and a vector. In 2D this produces -/// a vector. -inline b2Vec2 b2Cross(float32 s, const b2Vec2& a) -{ - return b2Vec2(-s * a.y, s * a.x); -} - -/// Multiply a matrix times a vector. If a rotation matrix is provided, -/// then this transforms the vector from one frame to another. -inline b2Vec2 b2Mul(const b2Mat22& A, const b2Vec2& v) -{ - return b2Vec2(A.ex.x * v.x + A.ey.x * v.y, A.ex.y * v.x + A.ey.y * v.y); -} - -/// Multiply a matrix transpose times a vector. If a rotation matrix is provided, -/// then this transforms the vector from one frame to another (inverse transform). -inline b2Vec2 b2MulT(const b2Mat22& A, const b2Vec2& v) -{ - return b2Vec2(b2Dot(v, A.ex), b2Dot(v, A.ey)); -} - -/// Add two vectors component-wise. -inline b2Vec2 operator + (const b2Vec2& a, const b2Vec2& b) -{ - return b2Vec2(a.x + b.x, a.y + b.y); -} - -/// Subtract two vectors component-wise. -inline b2Vec2 operator - (const b2Vec2& a, const b2Vec2& b) -{ - return b2Vec2(a.x - b.x, a.y - b.y); -} - -inline b2Vec2 operator * (float32 s, const b2Vec2& a) -{ - return b2Vec2(s * a.x, s * a.y); -} - -inline bool operator == (const b2Vec2& a, const b2Vec2& b) -{ - return a.x == b.x && a.y == b.y; -} - -inline float32 b2Distance(const b2Vec2& a, const b2Vec2& b) -{ - b2Vec2 c = a - b; - return c.Length(); -} - -inline float32 b2DistanceSquared(const b2Vec2& a, const b2Vec2& b) -{ - b2Vec2 c = a - b; - return b2Dot(c, c); -} - -inline b2Vec3 operator * (float32 s, const b2Vec3& a) -{ - return b2Vec3(s * a.x, s * a.y, s * a.z); -} - -/// Add two vectors component-wise. -inline b2Vec3 operator + (const b2Vec3& a, const b2Vec3& b) -{ - return b2Vec3(a.x + b.x, a.y + b.y, a.z + b.z); -} - -/// Subtract two vectors component-wise. -inline b2Vec3 operator - (const b2Vec3& a, const b2Vec3& b) -{ - return b2Vec3(a.x - b.x, a.y - b.y, a.z - b.z); -} - -/// Perform the dot product on two vectors. -inline float32 b2Dot(const b2Vec3& a, const b2Vec3& b) -{ - return a.x * b.x + a.y * b.y + a.z * b.z; -} - -/// Perform the cross product on two vectors. -inline b2Vec3 b2Cross(const b2Vec3& a, const b2Vec3& b) -{ - return b2Vec3(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x); -} - -inline b2Mat22 operator + (const b2Mat22& A, const b2Mat22& B) -{ - return b2Mat22(A.ex + B.ex, A.ey + B.ey); -} - -// A * B -inline b2Mat22 b2Mul(const b2Mat22& A, const b2Mat22& B) -{ - return b2Mat22(b2Mul(A, B.ex), b2Mul(A, B.ey)); -} - -// A^T * B -inline b2Mat22 b2MulT(const b2Mat22& A, const b2Mat22& B) -{ - b2Vec2 c1(b2Dot(A.ex, B.ex), b2Dot(A.ey, B.ex)); - b2Vec2 c2(b2Dot(A.ex, B.ey), b2Dot(A.ey, B.ey)); - return b2Mat22(c1, c2); -} - -/// Multiply a matrix times a vector. -inline b2Vec3 b2Mul(const b2Mat33& A, const b2Vec3& v) -{ - return v.x * A.ex + v.y * A.ey + v.z * A.ez; -} - -/// Multiply a matrix times a vector. -inline b2Vec2 b2Mul22(const b2Mat33& A, const b2Vec2& v) -{ - return b2Vec2(A.ex.x * v.x + A.ey.x * v.y, A.ex.y * v.x + A.ey.y * v.y); -} - -/// Multiply two rotations: q * r -inline b2Rot b2Mul(const b2Rot& q, const b2Rot& r) -{ - // [qc -qs] * [rc -rs] = [qc*rc-qs*rs -qc*rs-qs*rc] - // [qs qc] [rs rc] [qs*rc+qc*rs -qs*rs+qc*rc] - // s = qs * rc + qc * rs - // c = qc * rc - qs * rs - b2Rot qr; - qr.s = q.s * r.c + q.c * r.s; - qr.c = q.c * r.c - q.s * r.s; - return qr; -} - -/// Transpose multiply two rotations: qT * r -inline b2Rot b2MulT(const b2Rot& q, const b2Rot& r) -{ - // [ qc qs] * [rc -rs] = [qc*rc+qs*rs -qc*rs+qs*rc] - // [-qs qc] [rs rc] [-qs*rc+qc*rs qs*rs+qc*rc] - // s = qc * rs - qs * rc - // c = qc * rc + qs * rs - b2Rot qr; - qr.s = q.c * r.s - q.s * r.c; - qr.c = q.c * r.c + q.s * r.s; - return qr; -} - -/// Rotate a vector -inline b2Vec2 b2Mul(const b2Rot& q, const b2Vec2& v) -{ - return b2Vec2(q.c * v.x - q.s * v.y, q.s * v.x + q.c * v.y); -} - -/// Inverse rotate a vector -inline b2Vec2 b2MulT(const b2Rot& q, const b2Vec2& v) -{ - return b2Vec2(q.c * v.x + q.s * v.y, -q.s * v.x + q.c * v.y); -} - -inline b2Vec2 b2Mul(const b2Transform& T, const b2Vec2& v) -{ - float32 x = (T.q.c * v.x - T.q.s * v.y) + T.p.x; - float32 y = (T.q.s * v.x + T.q.c * v.y) + T.p.y; - - return b2Vec2(x, y); -} - -inline b2Vec2 b2MulT(const b2Transform& T, const b2Vec2& v) -{ - float32 px = v.x - T.p.x; - float32 py = v.y - T.p.y; - float32 x = (T.q.c * px + T.q.s * py); - float32 y = (-T.q.s * px + T.q.c * py); - - return b2Vec2(x, y); -} - -// v2 = A.q.Rot(B.q.Rot(v1) + B.p) + A.p -// = (A.q * B.q).Rot(v1) + A.q.Rot(B.p) + A.p -inline b2Transform b2Mul(const b2Transform& A, const b2Transform& B) -{ - b2Transform C; - C.q = b2Mul(A.q, B.q); - C.p = b2Mul(A.q, B.p) + A.p; - return C; -} - -// v2 = A.q' * (B.q * v1 + B.p - A.p) -// = A.q' * B.q * v1 + A.q' * (B.p - A.p) -inline b2Transform b2MulT(const b2Transform& A, const b2Transform& B) -{ - b2Transform C; - C.q = b2MulT(A.q, B.q); - C.p = b2MulT(A.q, B.p - A.p); - return C; -} - -template -inline T b2Abs(T a) -{ - return a > T(0) ? a : -a; -} - -inline b2Vec2 b2Abs(const b2Vec2& a) -{ - return b2Vec2(b2Abs(a.x), b2Abs(a.y)); -} - -inline b2Mat22 b2Abs(const b2Mat22& A) -{ - return b2Mat22(b2Abs(A.ex), b2Abs(A.ey)); -} - -template -inline T b2Min(T a, T b) -{ - return a < b ? a : b; -} - -inline b2Vec2 b2Min(const b2Vec2& a, const b2Vec2& b) -{ - return b2Vec2(b2Min(a.x, b.x), b2Min(a.y, b.y)); -} - -template -inline T b2Max(T a, T b) -{ - return a > b ? a : b; -} - -inline b2Vec2 b2Max(const b2Vec2& a, const b2Vec2& b) -{ - return b2Vec2(b2Max(a.x, b.x), b2Max(a.y, b.y)); -} - -template -inline T b2Clamp(T a, T low, T high) -{ - return b2Max(low, b2Min(a, high)); -} - -inline b2Vec2 b2Clamp(const b2Vec2& a, const b2Vec2& low, const b2Vec2& high) -{ - return b2Max(low, b2Min(a, high)); -} - -template inline void b2Swap(T& a, T& b) -{ - T tmp = a; - a = b; - b = tmp; -} - -/// "Next Largest Power of 2 -/// Given a binary integer value x, the next largest power of 2 can be computed by a SWAR algorithm -/// that recursively "folds" the upper bits into the lower bits. This process yields a bit vector with -/// the same most significant 1 as x, but all 1's below it. Adding 1 to that value yields the next -/// largest power of 2. For a 32-bit value:" -inline uint32 b2NextPowerOfTwo(uint32 x) -{ - x |= (x >> 1); - x |= (x >> 2); - x |= (x >> 4); - x |= (x >> 8); - x |= (x >> 16); - return x + 1; -} - -inline bool b2IsPowerOfTwo(uint32 x) -{ - bool result = x > 0 && (x & (x - 1)) == 0; - return result; -} - -inline void b2Sweep::GetTransform(b2Transform* xf, float32 beta) const -{ - xf->p = (1.0f - beta) * c0 + beta * c; - float32 angle = (1.0f - beta) * a0 + beta * a; - xf->q.Set(angle); - - // Shift to origin - xf->p -= b2Mul(xf->q, localCenter); -} - -inline void b2Sweep::Advance(float32 alpha) -{ - b2Assert(alpha0 < 1.0f); - float32 beta = (alpha - alpha0) / (1.0f - alpha0); - c0 += beta * (c - c0); - a0 += beta * (a - a0); - alpha0 = alpha; -} - -/// Normalize an angle in radians to be between -pi and pi -inline void b2Sweep::Normalize() -{ - float32 twoPi = 2.0f * b2_pi; - float32 d = twoPi * floorf(a0 / twoPi); - a0 -= d; - a -= d; -} - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Common/b2Settings.cpp b/love/src/jni/love/src/libraries/Box2D/Common/b2Settings.cpp deleted file mode 100644 index ed6d83e0..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Common/b2Settings.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include -#include - -#include "common/Exception.h" - -b2Version b2_version = {2, 3, 2}; - -// Memory allocators. Modify these to use your own allocator. -void* b2Alloc(int32 size) -{ - return malloc(size); -} - -void b2Free(void* mem) -{ - free(mem); -} - -// You can modify this to use your logging facility. -void b2Log(const char* string, ...) -{ - va_list args; - va_start(args, string); - vprintf(string, args); - va_end(args); -} - -void loveAssert(bool test, const char *teststr) -{ - if (!test) - throw love::Exception("Box2D assertion failed: %s", teststr); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Common/b2Settings.h b/love/src/jni/love/src/libraries/Box2D/Common/b2Settings.h deleted file mode 100644 index beaa1d47..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Common/b2Settings.h +++ /dev/null @@ -1,154 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_SETTINGS_H -#define B2_SETTINGS_H - -#include -#include -#include - -void loveAssert(bool test, const char *teststr); - -#define B2_NOT_USED(x) ((void)(x)) -//#define b2Assert(A) assert(A) -#define b2Assert(A) loveAssert((A), #A) - -typedef signed char int8; -typedef signed short int16; -typedef signed int int32; -typedef unsigned char uint8; -typedef unsigned short uint16; -typedef unsigned int uint32; -typedef float float32; -typedef double float64; - -#define b2_maxFloat FLT_MAX -#define b2_epsilon FLT_EPSILON -#define b2_pi 3.14159265359f - -/// @file -/// Global tuning constants based on meters-kilograms-seconds (MKS) units. -/// - -// Collision - -/// The maximum number of contact points between two convex shapes. Do -/// not change this value. -#define b2_maxManifoldPoints 2 - -/// The maximum number of vertices on a convex polygon. You cannot increase -/// this too much because b2BlockAllocator has a maximum object size. -#define b2_maxPolygonVertices 8 - -/// This is used to fatten AABBs in the dynamic tree. This allows proxies -/// to move by a small amount without triggering a tree adjustment. -/// This is in meters. -#define b2_aabbExtension 0.1f - -/// This is used to fatten AABBs in the dynamic tree. This is used to predict -/// the future position based on the current displacement. -/// This is a dimensionless multiplier. -#define b2_aabbMultiplier 2.0f - -/// A small length used as a collision and constraint tolerance. Usually it is -/// chosen to be numerically significant, but visually insignificant. -#define b2_linearSlop 0.005f - -/// A small angle used as a collision and constraint tolerance. Usually it is -/// chosen to be numerically significant, but visually insignificant. -#define b2_angularSlop (2.0f / 180.0f * b2_pi) - -/// The radius of the polygon/edge shape skin. This should not be modified. Making -/// this smaller means polygons will have an insufficient buffer for continuous collision. -/// Making it larger may create artifacts for vertex collision. -#define b2_polygonRadius (2.0f * b2_linearSlop) - -/// Maximum number of sub-steps per contact in continuous physics simulation. -#define b2_maxSubSteps 8 - - -// Dynamics - -/// Maximum number of contacts to be handled to solve a TOI impact. -#define b2_maxTOIContacts 32 - -/// A velocity threshold for elastic collisions. Any collision with a relative linear -/// velocity below this threshold will be treated as inelastic. -#define b2_velocityThreshold 1.0f - -/// The maximum linear position correction used when solving constraints. This helps to -/// prevent overshoot. -#define b2_maxLinearCorrection 0.2f - -/// The maximum angular position correction used when solving constraints. This helps to -/// prevent overshoot. -#define b2_maxAngularCorrection (8.0f / 180.0f * b2_pi) - -/// The maximum linear velocity of a body. This limit is very large and is used -/// to prevent numerical problems. You shouldn't need to adjust this. -#define b2_maxTranslation 2.0f -#define b2_maxTranslationSquared (b2_maxTranslation * b2_maxTranslation) - -/// The maximum angular velocity of a body. This limit is very large and is used -/// to prevent numerical problems. You shouldn't need to adjust this. -#define b2_maxRotation (0.5f * b2_pi) -#define b2_maxRotationSquared (b2_maxRotation * b2_maxRotation) - -/// This scale factor controls how fast overlap is resolved. Ideally this would be 1 so -/// that overlap is removed in one time step. However using values close to 1 often lead -/// to overshoot. -#define b2_baumgarte 0.2f -#define b2_toiBaugarte 0.75f - - -// Sleep - -/// The time that a body must be still before it will go to sleep. -#define b2_timeToSleep 0.5f - -/// A body cannot sleep if its linear velocity is above this tolerance. -#define b2_linearSleepTolerance 0.01f - -/// A body cannot sleep if its angular velocity is above this tolerance. -#define b2_angularSleepTolerance (2.0f / 180.0f * b2_pi) - -// Memory Allocation - -/// Implement this function to use your own memory allocator. -void* b2Alloc(int32 size); - -/// If you implement b2Alloc, you should also implement this function. -void b2Free(void* mem); - -/// Logging function. -void b2Log(const char* string, ...); - -/// Version numbering scheme. -/// See http://en.wikipedia.org/wiki/Software_versioning -struct b2Version -{ - int32 major; ///< significant changes - int32 minor; ///< incremental changes - int32 revision; ///< bug fixes -}; - -/// Current version. -extern b2Version b2_version; - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Common/b2StackAllocator.cpp b/love/src/jni/love/src/libraries/Box2D/Common/b2StackAllocator.cpp deleted file mode 100644 index 321cabb2..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Common/b2StackAllocator.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include - -b2StackAllocator::b2StackAllocator() -{ - m_index = 0; - m_allocation = 0; - m_maxAllocation = 0; - m_entryCount = 0; -} - -b2StackAllocator::~b2StackAllocator() -{ - b2Assert(m_index == 0); - b2Assert(m_entryCount == 0); -} - -void* b2StackAllocator::Allocate(int32 size) -{ - b2Assert(m_entryCount < b2_maxStackEntries); - - b2StackEntry* entry = m_entries + m_entryCount; - entry->size = size; - if (m_index + size > b2_stackSize) - { - entry->data = (char*)b2Alloc(size); - entry->usedMalloc = true; - } - else - { - entry->data = m_data + m_index; - entry->usedMalloc = false; - m_index += size; - } - - m_allocation += size; - m_maxAllocation = b2Max(m_maxAllocation, m_allocation); - ++m_entryCount; - - return entry->data; -} - -void b2StackAllocator::Free(void* p) -{ - b2Assert(m_entryCount > 0); - b2StackEntry* entry = m_entries + m_entryCount - 1; - b2Assert(p == entry->data); - if (entry->usedMalloc) - { - b2Free(p); - } - else - { - m_index -= entry->size; - } - m_allocation -= entry->size; - --m_entryCount; - - p = NULL; -} - -int32 b2StackAllocator::GetMaxAllocation() const -{ - return m_maxAllocation; -} diff --git a/love/src/jni/love/src/libraries/Box2D/Common/b2StackAllocator.h b/love/src/jni/love/src/libraries/Box2D/Common/b2StackAllocator.h deleted file mode 100644 index bb87a7ed..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Common/b2StackAllocator.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_STACK_ALLOCATOR_H -#define B2_STACK_ALLOCATOR_H - -#include - -const int32 b2_stackSize = 100 * 1024; // 100k -const int32 b2_maxStackEntries = 32; - -struct b2StackEntry -{ - char* data; - int32 size; - bool usedMalloc; -}; - -// This is a stack allocator used for fast per step allocations. -// You must nest allocate/free pairs. The code will assert -// if you try to interleave multiple allocate/free pairs. -class b2StackAllocator -{ -public: - b2StackAllocator(); - ~b2StackAllocator(); - - void* Allocate(int32 size); - void Free(void* p); - - int32 GetMaxAllocation() const; - -private: - - char m_data[b2_stackSize]; - int32 m_index; - - int32 m_allocation; - int32 m_maxAllocation; - - b2StackEntry m_entries[b2_maxStackEntries]; - int32 m_entryCount; -}; - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Common/b2Timer.cpp b/love/src/jni/love/src/libraries/Box2D/Common/b2Timer.cpp deleted file mode 100644 index cbea5309..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Common/b2Timer.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* -* Copyright (c) 2011 Erin Catto http://box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include - -#if defined(_WIN32) - -float64 b2Timer::s_invFrequency = 0.0f; - -#define WIN32_LEAN_AND_MEAN -#include - -b2Timer::b2Timer() -{ - LARGE_INTEGER largeInteger; - - if (s_invFrequency == 0.0f) - { - QueryPerformanceFrequency(&largeInteger); - s_invFrequency = float64(largeInteger.QuadPart); - if (s_invFrequency > 0.0f) - { - s_invFrequency = 1000.0f / s_invFrequency; - } - } - - QueryPerformanceCounter(&largeInteger); - m_start = float64(largeInteger.QuadPart); -} - -void b2Timer::Reset() -{ - LARGE_INTEGER largeInteger; - QueryPerformanceCounter(&largeInteger); - m_start = float64(largeInteger.QuadPart); -} - -float32 b2Timer::GetMilliseconds() const -{ - LARGE_INTEGER largeInteger; - QueryPerformanceCounter(&largeInteger); - float64 count = float64(largeInteger.QuadPart); - float32 ms = float32(s_invFrequency * (count - m_start)); - return ms; -} - -#elif defined(__linux__) || defined (__APPLE__) - -#include - -b2Timer::b2Timer() -{ - Reset(); -} - -void b2Timer::Reset() -{ - timeval t; - gettimeofday(&t, 0); - m_start_sec = t.tv_sec; - m_start_usec = t.tv_usec; -} - -float32 b2Timer::GetMilliseconds() const -{ - timeval t; - gettimeofday(&t, 0); - return 1000.0f * (t.tv_sec - m_start_sec) + 0.001f * (t.tv_usec - m_start_usec); -} - -#else - -b2Timer::b2Timer() -{ -} - -void b2Timer::Reset() -{ -} - -float32 b2Timer::GetMilliseconds() const -{ - return 0.0f; -} - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Common/b2Timer.h b/love/src/jni/love/src/libraries/Box2D/Common/b2Timer.h deleted file mode 100644 index edf1ca45..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Common/b2Timer.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2011 Erin Catto http://box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_TIMER_H -#define B2_TIMER_H - -#include - -/// Timer for profiling. This has platform specific code and may -/// not work on every platform. -class b2Timer -{ -public: - - /// Constructor - b2Timer(); - - /// Reset the timer. - void Reset(); - - /// Get the time since construction or the last reset. - float32 GetMilliseconds() const; - -private: - -#if defined(_WIN32) - float64 m_start; - static float64 s_invFrequency; -#elif defined(__linux__) || defined (__APPLE__) - unsigned long m_start_sec; - unsigned long m_start_usec; -#endif -}; - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.cpp deleted file mode 100644 index 01c921f3..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* -* Copyright (c) 2006-2010 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include -#include -#include - -#include - -b2Contact* b2ChainAndCircleContact::Create(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator) -{ - void* mem = allocator->Allocate(sizeof(b2ChainAndCircleContact)); - return new (mem) b2ChainAndCircleContact(fixtureA, indexA, fixtureB, indexB); -} - -void b2ChainAndCircleContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator) -{ - ((b2ChainAndCircleContact*)contact)->~b2ChainAndCircleContact(); - allocator->Free(contact, sizeof(b2ChainAndCircleContact)); -} - -b2ChainAndCircleContact::b2ChainAndCircleContact(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB) -: b2Contact(fixtureA, indexA, fixtureB, indexB) -{ - b2Assert(m_fixtureA->GetType() == b2Shape::e_chain); - b2Assert(m_fixtureB->GetType() == b2Shape::e_circle); -} - -void b2ChainAndCircleContact::Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB) -{ - b2ChainShape* chain = (b2ChainShape*)m_fixtureA->GetShape(); - b2EdgeShape edge; - chain->GetChildEdge(&edge, m_indexA); - b2CollideEdgeAndCircle( manifold, &edge, xfA, - (b2CircleShape*)m_fixtureB->GetShape(), xfB); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.h deleted file mode 100644 index b93c30ed..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_CHAIN_AND_CIRCLE_CONTACT_H -#define B2_CHAIN_AND_CIRCLE_CONTACT_H - -#include - -class b2BlockAllocator; - -class b2ChainAndCircleContact : public b2Contact -{ -public: - static b2Contact* Create( b2Fixture* fixtureA, int32 indexA, - b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator); - static void Destroy(b2Contact* contact, b2BlockAllocator* allocator); - - b2ChainAndCircleContact(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB); - ~b2ChainAndCircleContact() {} - - void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB); -}; - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.cpp deleted file mode 100644 index 4642fa46..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* -* Copyright (c) 2006-2010 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include -#include -#include - -#include - -b2Contact* b2ChainAndPolygonContact::Create(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator) -{ - void* mem = allocator->Allocate(sizeof(b2ChainAndPolygonContact)); - return new (mem) b2ChainAndPolygonContact(fixtureA, indexA, fixtureB, indexB); -} - -void b2ChainAndPolygonContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator) -{ - ((b2ChainAndPolygonContact*)contact)->~b2ChainAndPolygonContact(); - allocator->Free(contact, sizeof(b2ChainAndPolygonContact)); -} - -b2ChainAndPolygonContact::b2ChainAndPolygonContact(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB) -: b2Contact(fixtureA, indexA, fixtureB, indexB) -{ - b2Assert(m_fixtureA->GetType() == b2Shape::e_chain); - b2Assert(m_fixtureB->GetType() == b2Shape::e_polygon); -} - -void b2ChainAndPolygonContact::Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB) -{ - b2ChainShape* chain = (b2ChainShape*)m_fixtureA->GetShape(); - b2EdgeShape edge; - chain->GetChildEdge(&edge, m_indexA); - b2CollideEdgeAndPolygon( manifold, &edge, xfA, - (b2PolygonShape*)m_fixtureB->GetShape(), xfB); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.h deleted file mode 100644 index 0c09af68..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_CHAIN_AND_POLYGON_CONTACT_H -#define B2_CHAIN_AND_POLYGON_CONTACT_H - -#include - -class b2BlockAllocator; - -class b2ChainAndPolygonContact : public b2Contact -{ -public: - static b2Contact* Create( b2Fixture* fixtureA, int32 indexA, - b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator); - static void Destroy(b2Contact* contact, b2BlockAllocator* allocator); - - b2ChainAndPolygonContact(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB); - ~b2ChainAndPolygonContact() {} - - void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB); -}; - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2CircleContact.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2CircleContact.cpp deleted file mode 100644 index b47f35ae..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2CircleContact.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include -#include -#include -#include - -#include - -b2Contact* b2CircleContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator) -{ - void* mem = allocator->Allocate(sizeof(b2CircleContact)); - return new (mem) b2CircleContact(fixtureA, fixtureB); -} - -void b2CircleContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator) -{ - ((b2CircleContact*)contact)->~b2CircleContact(); - allocator->Free(contact, sizeof(b2CircleContact)); -} - -b2CircleContact::b2CircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB) - : b2Contact(fixtureA, 0, fixtureB, 0) -{ - b2Assert(m_fixtureA->GetType() == b2Shape::e_circle); - b2Assert(m_fixtureB->GetType() == b2Shape::e_circle); -} - -void b2CircleContact::Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB) -{ - b2CollideCircles(manifold, - (b2CircleShape*)m_fixtureA->GetShape(), xfA, - (b2CircleShape*)m_fixtureB->GetShape(), xfB); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2CircleContact.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2CircleContact.h deleted file mode 100644 index 079d3abc..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2CircleContact.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_CIRCLE_CONTACT_H -#define B2_CIRCLE_CONTACT_H - -#include - -class b2BlockAllocator; - -class b2CircleContact : public b2Contact -{ -public: - static b2Contact* Create( b2Fixture* fixtureA, int32 indexA, - b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator); - static void Destroy(b2Contact* contact, b2BlockAllocator* allocator); - - b2CircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB); - ~b2CircleContact() {} - - void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB); -}; - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2Contact.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2Contact.cpp deleted file mode 100644 index d9f1021e..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2Contact.cpp +++ /dev/null @@ -1,247 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -b2ContactRegister b2Contact::s_registers[b2Shape::e_typeCount][b2Shape::e_typeCount]; -bool b2Contact::s_initialized = false; - -void b2Contact::InitializeRegisters() -{ - AddType(b2CircleContact::Create, b2CircleContact::Destroy, b2Shape::e_circle, b2Shape::e_circle); - AddType(b2PolygonAndCircleContact::Create, b2PolygonAndCircleContact::Destroy, b2Shape::e_polygon, b2Shape::e_circle); - AddType(b2PolygonContact::Create, b2PolygonContact::Destroy, b2Shape::e_polygon, b2Shape::e_polygon); - AddType(b2EdgeAndCircleContact::Create, b2EdgeAndCircleContact::Destroy, b2Shape::e_edge, b2Shape::e_circle); - AddType(b2EdgeAndPolygonContact::Create, b2EdgeAndPolygonContact::Destroy, b2Shape::e_edge, b2Shape::e_polygon); - AddType(b2ChainAndCircleContact::Create, b2ChainAndCircleContact::Destroy, b2Shape::e_chain, b2Shape::e_circle); - AddType(b2ChainAndPolygonContact::Create, b2ChainAndPolygonContact::Destroy, b2Shape::e_chain, b2Shape::e_polygon); -} - -void b2Contact::AddType(b2ContactCreateFcn* createFcn, b2ContactDestroyFcn* destoryFcn, - b2Shape::Type type1, b2Shape::Type type2) -{ - b2Assert(0 <= type1 && type1 < b2Shape::e_typeCount); - b2Assert(0 <= type2 && type2 < b2Shape::e_typeCount); - - s_registers[type1][type2].createFcn = createFcn; - s_registers[type1][type2].destroyFcn = destoryFcn; - s_registers[type1][type2].primary = true; - - if (type1 != type2) - { - s_registers[type2][type1].createFcn = createFcn; - s_registers[type2][type1].destroyFcn = destoryFcn; - s_registers[type2][type1].primary = false; - } -} - -b2Contact* b2Contact::Create(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator) -{ - if (s_initialized == false) - { - InitializeRegisters(); - s_initialized = true; - } - - b2Shape::Type type1 = fixtureA->GetType(); - b2Shape::Type type2 = fixtureB->GetType(); - - b2Assert(0 <= type1 && type1 < b2Shape::e_typeCount); - b2Assert(0 <= type2 && type2 < b2Shape::e_typeCount); - - b2ContactCreateFcn* createFcn = s_registers[type1][type2].createFcn; - if (createFcn) - { - if (s_registers[type1][type2].primary) - { - return createFcn(fixtureA, indexA, fixtureB, indexB, allocator); - } - else - { - return createFcn(fixtureB, indexB, fixtureA, indexA, allocator); - } - } - else - { - return NULL; - } -} - -void b2Contact::Destroy(b2Contact* contact, b2BlockAllocator* allocator) -{ - b2Assert(s_initialized == true); - - b2Fixture* fixtureA = contact->m_fixtureA; - b2Fixture* fixtureB = contact->m_fixtureB; - - if (contact->m_manifold.pointCount > 0 && - fixtureA->IsSensor() == false && - fixtureB->IsSensor() == false) - { - fixtureA->GetBody()->SetAwake(true); - fixtureB->GetBody()->SetAwake(true); - } - - b2Shape::Type typeA = fixtureA->GetType(); - b2Shape::Type typeB = fixtureB->GetType(); - - b2Assert(0 <= typeA && typeB < b2Shape::e_typeCount); - b2Assert(0 <= typeA && typeB < b2Shape::e_typeCount); - - b2ContactDestroyFcn* destroyFcn = s_registers[typeA][typeB].destroyFcn; - destroyFcn(contact, allocator); -} - -b2Contact::b2Contact(b2Fixture* fA, int32 indexA, b2Fixture* fB, int32 indexB) -{ - m_flags = e_enabledFlag; - - m_fixtureA = fA; - m_fixtureB = fB; - - m_indexA = indexA; - m_indexB = indexB; - - m_manifold.pointCount = 0; - - m_prev = NULL; - m_next = NULL; - - m_nodeA.contact = NULL; - m_nodeA.prev = NULL; - m_nodeA.next = NULL; - m_nodeA.other = NULL; - - m_nodeB.contact = NULL; - m_nodeB.prev = NULL; - m_nodeB.next = NULL; - m_nodeB.other = NULL; - - m_toiCount = 0; - - m_friction = b2MixFriction(m_fixtureA->m_friction, m_fixtureB->m_friction); - m_restitution = b2MixRestitution(m_fixtureA->m_restitution, m_fixtureB->m_restitution); - - m_tangentSpeed = 0.0f; -} - -// Update the contact manifold and touching status. -// Note: do not assume the fixture AABBs are overlapping or are valid. -void b2Contact::Update(b2ContactListener* listener) -{ - b2Manifold oldManifold = m_manifold; - - // Re-enable this contact. - m_flags |= e_enabledFlag; - - bool touching = false; - bool wasTouching = (m_flags & e_touchingFlag) == e_touchingFlag; - - bool sensorA = m_fixtureA->IsSensor(); - bool sensorB = m_fixtureB->IsSensor(); - bool sensor = sensorA || sensorB; - - b2Body* bodyA = m_fixtureA->GetBody(); - b2Body* bodyB = m_fixtureB->GetBody(); - const b2Transform& xfA = bodyA->GetTransform(); - const b2Transform& xfB = bodyB->GetTransform(); - - // Is this contact a sensor? - if (sensor) - { - const b2Shape* shapeA = m_fixtureA->GetShape(); - const b2Shape* shapeB = m_fixtureB->GetShape(); - touching = b2TestOverlap(shapeA, m_indexA, shapeB, m_indexB, xfA, xfB); - - // Sensors don't generate manifolds. - m_manifold.pointCount = 0; - } - else - { - Evaluate(&m_manifold, xfA, xfB); - touching = m_manifold.pointCount > 0; - - // Match old contact ids to new contact ids and copy the - // stored impulses to warm start the solver. - for (int32 i = 0; i < m_manifold.pointCount; ++i) - { - b2ManifoldPoint* mp2 = m_manifold.points + i; - mp2->normalImpulse = 0.0f; - mp2->tangentImpulse = 0.0f; - b2ContactID id2 = mp2->id; - - for (int32 j = 0; j < oldManifold.pointCount; ++j) - { - b2ManifoldPoint* mp1 = oldManifold.points + j; - - if (mp1->id.key == id2.key) - { - mp2->normalImpulse = mp1->normalImpulse; - mp2->tangentImpulse = mp1->tangentImpulse; - break; - } - } - } - - if (touching != wasTouching) - { - bodyA->SetAwake(true); - bodyB->SetAwake(true); - } - } - - if (touching) - { - m_flags |= e_touchingFlag; - } - else - { - m_flags &= ~e_touchingFlag; - } - - if (wasTouching == false && touching == true && listener) - { - listener->BeginContact(this); - } - - if (wasTouching == true && touching == false && listener) - { - listener->EndContact(this); - } - - if (sensor == false && touching && listener) - { - listener->PreSolve(this, &oldManifold); - } -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2Contact.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2Contact.h deleted file mode 100644 index 36e31e25..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2Contact.h +++ /dev/null @@ -1,349 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_CONTACT_H -#define B2_CONTACT_H - -#include -#include -#include -#include - -class b2Body; -class b2Contact; -class b2Fixture; -class b2World; -class b2BlockAllocator; -class b2StackAllocator; -class b2ContactListener; - -/// Friction mixing law. The idea is to allow either fixture to drive the restitution to zero. -/// For example, anything slides on ice. -inline float32 b2MixFriction(float32 friction1, float32 friction2) -{ - return b2Sqrt(friction1 * friction2); -} - -/// Restitution mixing law. The idea is allow for anything to bounce off an inelastic surface. -/// For example, a superball bounces on anything. -inline float32 b2MixRestitution(float32 restitution1, float32 restitution2) -{ - return restitution1 > restitution2 ? restitution1 : restitution2; -} - -typedef b2Contact* b2ContactCreateFcn( b2Fixture* fixtureA, int32 indexA, - b2Fixture* fixtureB, int32 indexB, - b2BlockAllocator* allocator); -typedef void b2ContactDestroyFcn(b2Contact* contact, b2BlockAllocator* allocator); - -struct b2ContactRegister -{ - b2ContactCreateFcn* createFcn; - b2ContactDestroyFcn* destroyFcn; - bool primary; -}; - -/// A contact edge is used to connect bodies and contacts together -/// in a contact graph where each body is a node and each contact -/// is an edge. A contact edge belongs to a doubly linked list -/// maintained in each attached body. Each contact has two contact -/// nodes, one for each attached body. -struct b2ContactEdge -{ - b2Body* other; ///< provides quick access to the other body attached. - b2Contact* contact; ///< the contact - b2ContactEdge* prev; ///< the previous contact edge in the body's contact list - b2ContactEdge* next; ///< the next contact edge in the body's contact list -}; - -/// The class manages contact between two shapes. A contact exists for each overlapping -/// AABB in the broad-phase (except if filtered). Therefore a contact object may exist -/// that has no contact points. -class b2Contact -{ -public: - - /// Get the contact manifold. Do not modify the manifold unless you understand the - /// internals of Box2D. - b2Manifold* GetManifold(); - const b2Manifold* GetManifold() const; - - /// Get the world manifold. - void GetWorldManifold(b2WorldManifold* worldManifold) const; - - /// Is this contact touching? - bool IsTouching() const; - - /// Enable/disable this contact. This can be used inside the pre-solve - /// contact listener. The contact is only disabled for the current - /// time step (or sub-step in continuous collisions). - void SetEnabled(bool flag); - - /// Has this contact been disabled? - bool IsEnabled() const; - - /// Get the next contact in the world's contact list. - b2Contact* GetNext(); - const b2Contact* GetNext() const; - - /// Get fixture A in this contact. - b2Fixture* GetFixtureA(); - const b2Fixture* GetFixtureA() const; - - /// Get the child primitive index for fixture A. - int32 GetChildIndexA() const; - - /// Get fixture B in this contact. - b2Fixture* GetFixtureB(); - const b2Fixture* GetFixtureB() const; - - /// Get the child primitive index for fixture B. - int32 GetChildIndexB() const; - - /// Override the default friction mixture. You can call this in b2ContactListener::PreSolve. - /// This value persists until set or reset. - void SetFriction(float32 friction); - - /// Get the friction. - float32 GetFriction() const; - - /// Reset the friction mixture to the default value. - void ResetFriction(); - - /// Override the default restitution mixture. You can call this in b2ContactListener::PreSolve. - /// The value persists until you set or reset. - void SetRestitution(float32 restitution); - - /// Get the restitution. - float32 GetRestitution() const; - - /// Reset the restitution to the default value. - void ResetRestitution(); - - /// Set the desired tangent speed for a conveyor belt behavior. In meters per second. - void SetTangentSpeed(float32 speed); - - /// Get the desired tangent speed. In meters per second. - float32 GetTangentSpeed() const; - - /// Evaluate this contact with your own manifold and transforms. - virtual void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB) = 0; - -protected: - friend class b2ContactManager; - friend class b2World; - friend class b2ContactSolver; - friend class b2Body; - friend class b2Fixture; - - // Flags stored in m_flags - enum - { - // Used when crawling contact graph when forming islands. - e_islandFlag = 0x0001, - - // Set when the shapes are touching. - e_touchingFlag = 0x0002, - - // This contact can be disabled (by user) - e_enabledFlag = 0x0004, - - // This contact needs filtering because a fixture filter was changed. - e_filterFlag = 0x0008, - - // This bullet contact had a TOI event - e_bulletHitFlag = 0x0010, - - // This contact has a valid TOI in m_toi - e_toiFlag = 0x0020 - }; - - /// Flag this contact for filtering. Filtering will occur the next time step. - void FlagForFiltering(); - - static void AddType(b2ContactCreateFcn* createFcn, b2ContactDestroyFcn* destroyFcn, - b2Shape::Type typeA, b2Shape::Type typeB); - static void InitializeRegisters(); - static b2Contact* Create(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator); - static void Destroy(b2Contact* contact, b2Shape::Type typeA, b2Shape::Type typeB, b2BlockAllocator* allocator); - static void Destroy(b2Contact* contact, b2BlockAllocator* allocator); - - b2Contact() : m_fixtureA(NULL), m_fixtureB(NULL) {} - b2Contact(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB); - virtual ~b2Contact() {} - - void Update(b2ContactListener* listener); - - static b2ContactRegister s_registers[b2Shape::e_typeCount][b2Shape::e_typeCount]; - static bool s_initialized; - - uint32 m_flags; - - // World pool and list pointers. - b2Contact* m_prev; - b2Contact* m_next; - - // Nodes for connecting bodies. - b2ContactEdge m_nodeA; - b2ContactEdge m_nodeB; - - b2Fixture* m_fixtureA; - b2Fixture* m_fixtureB; - - int32 m_indexA; - int32 m_indexB; - - b2Manifold m_manifold; - - int32 m_toiCount; - float32 m_toi; - - float32 m_friction; - float32 m_restitution; - - float32 m_tangentSpeed; -}; - -inline b2Manifold* b2Contact::GetManifold() -{ - return &m_manifold; -} - -inline const b2Manifold* b2Contact::GetManifold() const -{ - return &m_manifold; -} - -inline void b2Contact::GetWorldManifold(b2WorldManifold* worldManifold) const -{ - const b2Body* bodyA = m_fixtureA->GetBody(); - const b2Body* bodyB = m_fixtureB->GetBody(); - const b2Shape* shapeA = m_fixtureA->GetShape(); - const b2Shape* shapeB = m_fixtureB->GetShape(); - - worldManifold->Initialize(&m_manifold, bodyA->GetTransform(), shapeA->m_radius, bodyB->GetTransform(), shapeB->m_radius); -} - -inline void b2Contact::SetEnabled(bool flag) -{ - if (flag) - { - m_flags |= e_enabledFlag; - } - else - { - m_flags &= ~e_enabledFlag; - } -} - -inline bool b2Contact::IsEnabled() const -{ - return (m_flags & e_enabledFlag) == e_enabledFlag; -} - -inline bool b2Contact::IsTouching() const -{ - return (m_flags & e_touchingFlag) == e_touchingFlag; -} - -inline b2Contact* b2Contact::GetNext() -{ - return m_next; -} - -inline const b2Contact* b2Contact::GetNext() const -{ - return m_next; -} - -inline b2Fixture* b2Contact::GetFixtureA() -{ - return m_fixtureA; -} - -inline const b2Fixture* b2Contact::GetFixtureA() const -{ - return m_fixtureA; -} - -inline b2Fixture* b2Contact::GetFixtureB() -{ - return m_fixtureB; -} - -inline int32 b2Contact::GetChildIndexA() const -{ - return m_indexA; -} - -inline const b2Fixture* b2Contact::GetFixtureB() const -{ - return m_fixtureB; -} - -inline int32 b2Contact::GetChildIndexB() const -{ - return m_indexB; -} - -inline void b2Contact::FlagForFiltering() -{ - m_flags |= e_filterFlag; -} - -inline void b2Contact::SetFriction(float32 friction) -{ - m_friction = friction; -} - -inline float32 b2Contact::GetFriction() const -{ - return m_friction; -} - -inline void b2Contact::ResetFriction() -{ - m_friction = b2MixFriction(m_fixtureA->m_friction, m_fixtureB->m_friction); -} - -inline void b2Contact::SetRestitution(float32 restitution) -{ - m_restitution = restitution; -} - -inline float32 b2Contact::GetRestitution() const -{ - return m_restitution; -} - -inline void b2Contact::ResetRestitution() -{ - m_restitution = b2MixRestitution(m_fixtureA->m_restitution, m_fixtureB->m_restitution); -} - -inline void b2Contact::SetTangentSpeed(float32 speed) -{ - m_tangentSpeed = speed; -} - -inline float32 b2Contact::GetTangentSpeed() const -{ - return m_tangentSpeed; -} - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2ContactSolver.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2ContactSolver.cpp deleted file mode 100644 index e31b6c23..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2ContactSolver.cpp +++ /dev/null @@ -1,838 +0,0 @@ -/* -* Copyright (c) 2006-2011 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include - -#include -#include -#include -#include -#include - -#define B2_DEBUG_SOLVER 0 - -bool g_blockSolve = true; - -struct b2ContactPositionConstraint -{ - b2Vec2 localPoints[b2_maxManifoldPoints]; - b2Vec2 localNormal; - b2Vec2 localPoint; - int32 indexA; - int32 indexB; - float32 invMassA, invMassB; - b2Vec2 localCenterA, localCenterB; - float32 invIA, invIB; - b2Manifold::Type type; - float32 radiusA, radiusB; - int32 pointCount; -}; - -b2ContactSolver::b2ContactSolver(b2ContactSolverDef* def) -{ - m_step = def->step; - m_allocator = def->allocator; - m_count = def->count; - m_positionConstraints = (b2ContactPositionConstraint*)m_allocator->Allocate(m_count * sizeof(b2ContactPositionConstraint)); - m_velocityConstraints = (b2ContactVelocityConstraint*)m_allocator->Allocate(m_count * sizeof(b2ContactVelocityConstraint)); - m_positions = def->positions; - m_velocities = def->velocities; - m_contacts = def->contacts; - - // Initialize position independent portions of the constraints. - for (int32 i = 0; i < m_count; ++i) - { - b2Contact* contact = m_contacts[i]; - - b2Fixture* fixtureA = contact->m_fixtureA; - b2Fixture* fixtureB = contact->m_fixtureB; - b2Shape* shapeA = fixtureA->GetShape(); - b2Shape* shapeB = fixtureB->GetShape(); - float32 radiusA = shapeA->m_radius; - float32 radiusB = shapeB->m_radius; - b2Body* bodyA = fixtureA->GetBody(); - b2Body* bodyB = fixtureB->GetBody(); - b2Manifold* manifold = contact->GetManifold(); - - int32 pointCount = manifold->pointCount; - b2Assert(pointCount > 0); - - b2ContactVelocityConstraint* vc = m_velocityConstraints + i; - vc->friction = contact->m_friction; - vc->restitution = contact->m_restitution; - vc->tangentSpeed = contact->m_tangentSpeed; - vc->indexA = bodyA->m_islandIndex; - vc->indexB = bodyB->m_islandIndex; - vc->invMassA = bodyA->m_invMass; - vc->invMassB = bodyB->m_invMass; - vc->invIA = bodyA->m_invI; - vc->invIB = bodyB->m_invI; - vc->contactIndex = i; - vc->pointCount = pointCount; - vc->K.SetZero(); - vc->normalMass.SetZero(); - - b2ContactPositionConstraint* pc = m_positionConstraints + i; - pc->indexA = bodyA->m_islandIndex; - pc->indexB = bodyB->m_islandIndex; - pc->invMassA = bodyA->m_invMass; - pc->invMassB = bodyB->m_invMass; - pc->localCenterA = bodyA->m_sweep.localCenter; - pc->localCenterB = bodyB->m_sweep.localCenter; - pc->invIA = bodyA->m_invI; - pc->invIB = bodyB->m_invI; - pc->localNormal = manifold->localNormal; - pc->localPoint = manifold->localPoint; - pc->pointCount = pointCount; - pc->radiusA = radiusA; - pc->radiusB = radiusB; - pc->type = manifold->type; - - for (int32 j = 0; j < pointCount; ++j) - { - b2ManifoldPoint* cp = manifold->points + j; - b2VelocityConstraintPoint* vcp = vc->points + j; - - if (m_step.warmStarting) - { - vcp->normalImpulse = m_step.dtRatio * cp->normalImpulse; - vcp->tangentImpulse = m_step.dtRatio * cp->tangentImpulse; - } - else - { - vcp->normalImpulse = 0.0f; - vcp->tangentImpulse = 0.0f; - } - - vcp->rA.SetZero(); - vcp->rB.SetZero(); - vcp->normalMass = 0.0f; - vcp->tangentMass = 0.0f; - vcp->velocityBias = 0.0f; - - pc->localPoints[j] = cp->localPoint; - } - } -} - -b2ContactSolver::~b2ContactSolver() -{ - m_allocator->Free(m_velocityConstraints); - m_allocator->Free(m_positionConstraints); -} - -// Initialize position dependent portions of the velocity constraints. -void b2ContactSolver::InitializeVelocityConstraints() -{ - for (int32 i = 0; i < m_count; ++i) - { - b2ContactVelocityConstraint* vc = m_velocityConstraints + i; - b2ContactPositionConstraint* pc = m_positionConstraints + i; - - float32 radiusA = pc->radiusA; - float32 radiusB = pc->radiusB; - b2Manifold* manifold = m_contacts[vc->contactIndex]->GetManifold(); - - int32 indexA = vc->indexA; - int32 indexB = vc->indexB; - - float32 mA = vc->invMassA; - float32 mB = vc->invMassB; - float32 iA = vc->invIA; - float32 iB = vc->invIB; - b2Vec2 localCenterA = pc->localCenterA; - b2Vec2 localCenterB = pc->localCenterB; - - b2Vec2 cA = m_positions[indexA].c; - float32 aA = m_positions[indexA].a; - b2Vec2 vA = m_velocities[indexA].v; - float32 wA = m_velocities[indexA].w; - - b2Vec2 cB = m_positions[indexB].c; - float32 aB = m_positions[indexB].a; - b2Vec2 vB = m_velocities[indexB].v; - float32 wB = m_velocities[indexB].w; - - b2Assert(manifold->pointCount > 0); - - b2Transform xfA, xfB; - xfA.q.Set(aA); - xfB.q.Set(aB); - xfA.p = cA - b2Mul(xfA.q, localCenterA); - xfB.p = cB - b2Mul(xfB.q, localCenterB); - - b2WorldManifold worldManifold; - worldManifold.Initialize(manifold, xfA, radiusA, xfB, radiusB); - - vc->normal = worldManifold.normal; - - int32 pointCount = vc->pointCount; - for (int32 j = 0; j < pointCount; ++j) - { - b2VelocityConstraintPoint* vcp = vc->points + j; - - vcp->rA = worldManifold.points[j] - cA; - vcp->rB = worldManifold.points[j] - cB; - - float32 rnA = b2Cross(vcp->rA, vc->normal); - float32 rnB = b2Cross(vcp->rB, vc->normal); - - float32 kNormal = mA + mB + iA * rnA * rnA + iB * rnB * rnB; - - vcp->normalMass = kNormal > 0.0f ? 1.0f / kNormal : 0.0f; - - b2Vec2 tangent = b2Cross(vc->normal, 1.0f); - - float32 rtA = b2Cross(vcp->rA, tangent); - float32 rtB = b2Cross(vcp->rB, tangent); - - float32 kTangent = mA + mB + iA * rtA * rtA + iB * rtB * rtB; - - vcp->tangentMass = kTangent > 0.0f ? 1.0f / kTangent : 0.0f; - - // Setup a velocity bias for restitution. - vcp->velocityBias = 0.0f; - float32 vRel = b2Dot(vc->normal, vB + b2Cross(wB, vcp->rB) - vA - b2Cross(wA, vcp->rA)); - if (vRel < -b2_velocityThreshold) - { - vcp->velocityBias = -vc->restitution * vRel; - } - } - - // If we have two points, then prepare the block solver. - if (vc->pointCount == 2 && g_blockSolve) - { - b2VelocityConstraintPoint* vcp1 = vc->points + 0; - b2VelocityConstraintPoint* vcp2 = vc->points + 1; - - float32 rn1A = b2Cross(vcp1->rA, vc->normal); - float32 rn1B = b2Cross(vcp1->rB, vc->normal); - float32 rn2A = b2Cross(vcp2->rA, vc->normal); - float32 rn2B = b2Cross(vcp2->rB, vc->normal); - - float32 k11 = mA + mB + iA * rn1A * rn1A + iB * rn1B * rn1B; - float32 k22 = mA + mB + iA * rn2A * rn2A + iB * rn2B * rn2B; - float32 k12 = mA + mB + iA * rn1A * rn2A + iB * rn1B * rn2B; - - // Ensure a reasonable condition number. - const float32 k_maxConditionNumber = 1000.0f; - if (k11 * k11 < k_maxConditionNumber * (k11 * k22 - k12 * k12)) - { - // K is safe to invert. - vc->K.ex.Set(k11, k12); - vc->K.ey.Set(k12, k22); - vc->normalMass = vc->K.GetInverse(); - } - else - { - // The constraints are redundant, just use one. - // TODO_ERIN use deepest? - vc->pointCount = 1; - } - } - } -} - -void b2ContactSolver::WarmStart() -{ - // Warm start. - for (int32 i = 0; i < m_count; ++i) - { - b2ContactVelocityConstraint* vc = m_velocityConstraints + i; - - int32 indexA = vc->indexA; - int32 indexB = vc->indexB; - float32 mA = vc->invMassA; - float32 iA = vc->invIA; - float32 mB = vc->invMassB; - float32 iB = vc->invIB; - int32 pointCount = vc->pointCount; - - b2Vec2 vA = m_velocities[indexA].v; - float32 wA = m_velocities[indexA].w; - b2Vec2 vB = m_velocities[indexB].v; - float32 wB = m_velocities[indexB].w; - - b2Vec2 normal = vc->normal; - b2Vec2 tangent = b2Cross(normal, 1.0f); - - for (int32 j = 0; j < pointCount; ++j) - { - b2VelocityConstraintPoint* vcp = vc->points + j; - b2Vec2 P = vcp->normalImpulse * normal + vcp->tangentImpulse * tangent; - wA -= iA * b2Cross(vcp->rA, P); - vA -= mA * P; - wB += iB * b2Cross(vcp->rB, P); - vB += mB * P; - } - - m_velocities[indexA].v = vA; - m_velocities[indexA].w = wA; - m_velocities[indexB].v = vB; - m_velocities[indexB].w = wB; - } -} - -void b2ContactSolver::SolveVelocityConstraints() -{ - for (int32 i = 0; i < m_count; ++i) - { - b2ContactVelocityConstraint* vc = m_velocityConstraints + i; - - int32 indexA = vc->indexA; - int32 indexB = vc->indexB; - float32 mA = vc->invMassA; - float32 iA = vc->invIA; - float32 mB = vc->invMassB; - float32 iB = vc->invIB; - int32 pointCount = vc->pointCount; - - b2Vec2 vA = m_velocities[indexA].v; - float32 wA = m_velocities[indexA].w; - b2Vec2 vB = m_velocities[indexB].v; - float32 wB = m_velocities[indexB].w; - - b2Vec2 normal = vc->normal; - b2Vec2 tangent = b2Cross(normal, 1.0f); - float32 friction = vc->friction; - - b2Assert(pointCount == 1 || pointCount == 2); - - // Solve tangent constraints first because non-penetration is more important - // than friction. - for (int32 j = 0; j < pointCount; ++j) - { - b2VelocityConstraintPoint* vcp = vc->points + j; - - // Relative velocity at contact - b2Vec2 dv = vB + b2Cross(wB, vcp->rB) - vA - b2Cross(wA, vcp->rA); - - // Compute tangent force - float32 vt = b2Dot(dv, tangent) - vc->tangentSpeed; - float32 lambda = vcp->tangentMass * (-vt); - - // b2Clamp the accumulated force - float32 maxFriction = friction * vcp->normalImpulse; - float32 newImpulse = b2Clamp(vcp->tangentImpulse + lambda, -maxFriction, maxFriction); - lambda = newImpulse - vcp->tangentImpulse; - vcp->tangentImpulse = newImpulse; - - // Apply contact impulse - b2Vec2 P = lambda * tangent; - - vA -= mA * P; - wA -= iA * b2Cross(vcp->rA, P); - - vB += mB * P; - wB += iB * b2Cross(vcp->rB, P); - } - - // Solve normal constraints - if (pointCount == 1 || g_blockSolve == false) - { - for (int32 i = 0; i < pointCount; ++i) - { - b2VelocityConstraintPoint* vcp = vc->points + i; - - // Relative velocity at contact - b2Vec2 dv = vB + b2Cross(wB, vcp->rB) - vA - b2Cross(wA, vcp->rA); - - // Compute normal impulse - float32 vn = b2Dot(dv, normal); - float32 lambda = -vcp->normalMass * (vn - vcp->velocityBias); - - // b2Clamp the accumulated impulse - float32 newImpulse = b2Max(vcp->normalImpulse + lambda, 0.0f); - lambda = newImpulse - vcp->normalImpulse; - vcp->normalImpulse = newImpulse; - - // Apply contact impulse - b2Vec2 P = lambda * normal; - vA -= mA * P; - wA -= iA * b2Cross(vcp->rA, P); - - vB += mB * P; - wB += iB * b2Cross(vcp->rB, P); - } - } - else - { - // Block solver developed in collaboration with Dirk Gregorius (back in 01/07 on Box2D_Lite). - // Build the mini LCP for this contact patch - // - // vn = A * x + b, vn >= 0, , vn >= 0, x >= 0 and vn_i * x_i = 0 with i = 1..2 - // - // A = J * W * JT and J = ( -n, -r1 x n, n, r2 x n ) - // b = vn0 - velocityBias - // - // The system is solved using the "Total enumeration method" (s. Murty). The complementary constraint vn_i * x_i - // implies that we must have in any solution either vn_i = 0 or x_i = 0. So for the 2D contact problem the cases - // vn1 = 0 and vn2 = 0, x1 = 0 and x2 = 0, x1 = 0 and vn2 = 0, x2 = 0 and vn1 = 0 need to be tested. The first valid - // solution that satisfies the problem is chosen. - // - // In order to account of the accumulated impulse 'a' (because of the iterative nature of the solver which only requires - // that the accumulated impulse is clamped and not the incremental impulse) we change the impulse variable (x_i). - // - // Substitute: - // - // x = a + d - // - // a := old total impulse - // x := new total impulse - // d := incremental impulse - // - // For the current iteration we extend the formula for the incremental impulse - // to compute the new total impulse: - // - // vn = A * d + b - // = A * (x - a) + b - // = A * x + b - A * a - // = A * x + b' - // b' = b - A * a; - - b2VelocityConstraintPoint* cp1 = vc->points + 0; - b2VelocityConstraintPoint* cp2 = vc->points + 1; - - b2Vec2 a(cp1->normalImpulse, cp2->normalImpulse); - b2Assert(a.x >= 0.0f && a.y >= 0.0f); - - // Relative velocity at contact - b2Vec2 dv1 = vB + b2Cross(wB, cp1->rB) - vA - b2Cross(wA, cp1->rA); - b2Vec2 dv2 = vB + b2Cross(wB, cp2->rB) - vA - b2Cross(wA, cp2->rA); - - // Compute normal velocity - float32 vn1 = b2Dot(dv1, normal); - float32 vn2 = b2Dot(dv2, normal); - - b2Vec2 b; - b.x = vn1 - cp1->velocityBias; - b.y = vn2 - cp2->velocityBias; - - // Compute b' - b -= b2Mul(vc->K, a); - - const float32 k_errorTol = 1e-3f; - B2_NOT_USED(k_errorTol); - - for (;;) - { - // - // Case 1: vn = 0 - // - // 0 = A * x + b' - // - // Solve for x: - // - // x = - inv(A) * b' - // - b2Vec2 x = - b2Mul(vc->normalMass, b); - - if (x.x >= 0.0f && x.y >= 0.0f) - { - // Get the incremental impulse - b2Vec2 d = x - a; - - // Apply incremental impulse - b2Vec2 P1 = d.x * normal; - b2Vec2 P2 = d.y * normal; - vA -= mA * (P1 + P2); - wA -= iA * (b2Cross(cp1->rA, P1) + b2Cross(cp2->rA, P2)); - - vB += mB * (P1 + P2); - wB += iB * (b2Cross(cp1->rB, P1) + b2Cross(cp2->rB, P2)); - - // Accumulate - cp1->normalImpulse = x.x; - cp2->normalImpulse = x.y; - -#if B2_DEBUG_SOLVER == 1 - // Postconditions - dv1 = vB + b2Cross(wB, cp1->rB) - vA - b2Cross(wA, cp1->rA); - dv2 = vB + b2Cross(wB, cp2->rB) - vA - b2Cross(wA, cp2->rA); - - // Compute normal velocity - vn1 = b2Dot(dv1, normal); - vn2 = b2Dot(dv2, normal); - - b2Assert(b2Abs(vn1 - cp1->velocityBias) < k_errorTol); - b2Assert(b2Abs(vn2 - cp2->velocityBias) < k_errorTol); -#endif - break; - } - - // - // Case 2: vn1 = 0 and x2 = 0 - // - // 0 = a11 * x1 + a12 * 0 + b1' - // vn2 = a21 * x1 + a22 * 0 + b2' - // - x.x = - cp1->normalMass * b.x; - x.y = 0.0f; - vn1 = 0.0f; - vn2 = vc->K.ex.y * x.x + b.y; - - if (x.x >= 0.0f && vn2 >= 0.0f) - { - // Get the incremental impulse - b2Vec2 d = x - a; - - // Apply incremental impulse - b2Vec2 P1 = d.x * normal; - b2Vec2 P2 = d.y * normal; - vA -= mA * (P1 + P2); - wA -= iA * (b2Cross(cp1->rA, P1) + b2Cross(cp2->rA, P2)); - - vB += mB * (P1 + P2); - wB += iB * (b2Cross(cp1->rB, P1) + b2Cross(cp2->rB, P2)); - - // Accumulate - cp1->normalImpulse = x.x; - cp2->normalImpulse = x.y; - -#if B2_DEBUG_SOLVER == 1 - // Postconditions - dv1 = vB + b2Cross(wB, cp1->rB) - vA - b2Cross(wA, cp1->rA); - - // Compute normal velocity - vn1 = b2Dot(dv1, normal); - - b2Assert(b2Abs(vn1 - cp1->velocityBias) < k_errorTol); -#endif - break; - } - - - // - // Case 3: vn2 = 0 and x1 = 0 - // - // vn1 = a11 * 0 + a12 * x2 + b1' - // 0 = a21 * 0 + a22 * x2 + b2' - // - x.x = 0.0f; - x.y = - cp2->normalMass * b.y; - vn1 = vc->K.ey.x * x.y + b.x; - vn2 = 0.0f; - - if (x.y >= 0.0f && vn1 >= 0.0f) - { - // Resubstitute for the incremental impulse - b2Vec2 d = x - a; - - // Apply incremental impulse - b2Vec2 P1 = d.x * normal; - b2Vec2 P2 = d.y * normal; - vA -= mA * (P1 + P2); - wA -= iA * (b2Cross(cp1->rA, P1) + b2Cross(cp2->rA, P2)); - - vB += mB * (P1 + P2); - wB += iB * (b2Cross(cp1->rB, P1) + b2Cross(cp2->rB, P2)); - - // Accumulate - cp1->normalImpulse = x.x; - cp2->normalImpulse = x.y; - -#if B2_DEBUG_SOLVER == 1 - // Postconditions - dv2 = vB + b2Cross(wB, cp2->rB) - vA - b2Cross(wA, cp2->rA); - - // Compute normal velocity - vn2 = b2Dot(dv2, normal); - - b2Assert(b2Abs(vn2 - cp2->velocityBias) < k_errorTol); -#endif - break; - } - - // - // Case 4: x1 = 0 and x2 = 0 - // - // vn1 = b1 - // vn2 = b2; - x.x = 0.0f; - x.y = 0.0f; - vn1 = b.x; - vn2 = b.y; - - if (vn1 >= 0.0f && vn2 >= 0.0f ) - { - // Resubstitute for the incremental impulse - b2Vec2 d = x - a; - - // Apply incremental impulse - b2Vec2 P1 = d.x * normal; - b2Vec2 P2 = d.y * normal; - vA -= mA * (P1 + P2); - wA -= iA * (b2Cross(cp1->rA, P1) + b2Cross(cp2->rA, P2)); - - vB += mB * (P1 + P2); - wB += iB * (b2Cross(cp1->rB, P1) + b2Cross(cp2->rB, P2)); - - // Accumulate - cp1->normalImpulse = x.x; - cp2->normalImpulse = x.y; - - break; - } - - // No solution, give up. This is hit sometimes, but it doesn't seem to matter. - break; - } - } - - m_velocities[indexA].v = vA; - m_velocities[indexA].w = wA; - m_velocities[indexB].v = vB; - m_velocities[indexB].w = wB; - } -} - -void b2ContactSolver::StoreImpulses() -{ - for (int32 i = 0; i < m_count; ++i) - { - b2ContactVelocityConstraint* vc = m_velocityConstraints + i; - b2Manifold* manifold = m_contacts[vc->contactIndex]->GetManifold(); - - for (int32 j = 0; j < vc->pointCount; ++j) - { - manifold->points[j].normalImpulse = vc->points[j].normalImpulse; - manifold->points[j].tangentImpulse = vc->points[j].tangentImpulse; - } - } -} - -struct b2PositionSolverManifold -{ - void Initialize(b2ContactPositionConstraint* pc, const b2Transform& xfA, const b2Transform& xfB, int32 index) - { - b2Assert(pc->pointCount > 0); - - switch (pc->type) - { - case b2Manifold::e_circles: - { - b2Vec2 pointA = b2Mul(xfA, pc->localPoint); - b2Vec2 pointB = b2Mul(xfB, pc->localPoints[0]); - normal = pointB - pointA; - normal.Normalize(); - point = 0.5f * (pointA + pointB); - separation = b2Dot(pointB - pointA, normal) - pc->radiusA - pc->radiusB; - } - break; - - case b2Manifold::e_faceA: - { - normal = b2Mul(xfA.q, pc->localNormal); - b2Vec2 planePoint = b2Mul(xfA, pc->localPoint); - - b2Vec2 clipPoint = b2Mul(xfB, pc->localPoints[index]); - separation = b2Dot(clipPoint - planePoint, normal) - pc->radiusA - pc->radiusB; - point = clipPoint; - } - break; - - case b2Manifold::e_faceB: - { - normal = b2Mul(xfB.q, pc->localNormal); - b2Vec2 planePoint = b2Mul(xfB, pc->localPoint); - - b2Vec2 clipPoint = b2Mul(xfA, pc->localPoints[index]); - separation = b2Dot(clipPoint - planePoint, normal) - pc->radiusA - pc->radiusB; - point = clipPoint; - - // Ensure normal points from A to B - normal = -normal; - } - break; - } - } - - b2Vec2 normal; - b2Vec2 point; - float32 separation; -}; - -// Sequential solver. -bool b2ContactSolver::SolvePositionConstraints() -{ - float32 minSeparation = 0.0f; - - for (int32 i = 0; i < m_count; ++i) - { - b2ContactPositionConstraint* pc = m_positionConstraints + i; - - int32 indexA = pc->indexA; - int32 indexB = pc->indexB; - b2Vec2 localCenterA = pc->localCenterA; - float32 mA = pc->invMassA; - float32 iA = pc->invIA; - b2Vec2 localCenterB = pc->localCenterB; - float32 mB = pc->invMassB; - float32 iB = pc->invIB; - int32 pointCount = pc->pointCount; - - b2Vec2 cA = m_positions[indexA].c; - float32 aA = m_positions[indexA].a; - - b2Vec2 cB = m_positions[indexB].c; - float32 aB = m_positions[indexB].a; - - // Solve normal constraints - for (int32 j = 0; j < pointCount; ++j) - { - b2Transform xfA, xfB; - xfA.q.Set(aA); - xfB.q.Set(aB); - xfA.p = cA - b2Mul(xfA.q, localCenterA); - xfB.p = cB - b2Mul(xfB.q, localCenterB); - - b2PositionSolverManifold psm; - psm.Initialize(pc, xfA, xfB, j); - b2Vec2 normal = psm.normal; - - b2Vec2 point = psm.point; - float32 separation = psm.separation; - - b2Vec2 rA = point - cA; - b2Vec2 rB = point - cB; - - // Track max constraint error. - minSeparation = b2Min(minSeparation, separation); - - // Prevent large corrections and allow slop. - float32 C = b2Clamp(b2_baumgarte * (separation + b2_linearSlop), -b2_maxLinearCorrection, 0.0f); - - // Compute the effective mass. - float32 rnA = b2Cross(rA, normal); - float32 rnB = b2Cross(rB, normal); - float32 K = mA + mB + iA * rnA * rnA + iB * rnB * rnB; - - // Compute normal impulse - float32 impulse = K > 0.0f ? - C / K : 0.0f; - - b2Vec2 P = impulse * normal; - - cA -= mA * P; - aA -= iA * b2Cross(rA, P); - - cB += mB * P; - aB += iB * b2Cross(rB, P); - } - - m_positions[indexA].c = cA; - m_positions[indexA].a = aA; - - m_positions[indexB].c = cB; - m_positions[indexB].a = aB; - } - - // We can't expect minSpeparation >= -b2_linearSlop because we don't - // push the separation above -b2_linearSlop. - return minSeparation >= -3.0f * b2_linearSlop; -} - -// Sequential position solver for position constraints. -bool b2ContactSolver::SolveTOIPositionConstraints(int32 toiIndexA, int32 toiIndexB) -{ - float32 minSeparation = 0.0f; - - for (int32 i = 0; i < m_count; ++i) - { - b2ContactPositionConstraint* pc = m_positionConstraints + i; - - int32 indexA = pc->indexA; - int32 indexB = pc->indexB; - b2Vec2 localCenterA = pc->localCenterA; - b2Vec2 localCenterB = pc->localCenterB; - int32 pointCount = pc->pointCount; - - float32 mA = 0.0f; - float32 iA = 0.0f; - if (indexA == toiIndexA || indexA == toiIndexB) - { - mA = pc->invMassA; - iA = pc->invIA; - } - - float32 mB = 0.0f; - float32 iB = 0.; - if (indexB == toiIndexA || indexB == toiIndexB) - { - mB = pc->invMassB; - iB = pc->invIB; - } - - b2Vec2 cA = m_positions[indexA].c; - float32 aA = m_positions[indexA].a; - - b2Vec2 cB = m_positions[indexB].c; - float32 aB = m_positions[indexB].a; - - // Solve normal constraints - for (int32 j = 0; j < pointCount; ++j) - { - b2Transform xfA, xfB; - xfA.q.Set(aA); - xfB.q.Set(aB); - xfA.p = cA - b2Mul(xfA.q, localCenterA); - xfB.p = cB - b2Mul(xfB.q, localCenterB); - - b2PositionSolverManifold psm; - psm.Initialize(pc, xfA, xfB, j); - b2Vec2 normal = psm.normal; - - b2Vec2 point = psm.point; - float32 separation = psm.separation; - - b2Vec2 rA = point - cA; - b2Vec2 rB = point - cB; - - // Track max constraint error. - minSeparation = b2Min(minSeparation, separation); - - // Prevent large corrections and allow slop. - float32 C = b2Clamp(b2_toiBaugarte * (separation + b2_linearSlop), -b2_maxLinearCorrection, 0.0f); - - // Compute the effective mass. - float32 rnA = b2Cross(rA, normal); - float32 rnB = b2Cross(rB, normal); - float32 K = mA + mB + iA * rnA * rnA + iB * rnB * rnB; - - // Compute normal impulse - float32 impulse = K > 0.0f ? - C / K : 0.0f; - - b2Vec2 P = impulse * normal; - - cA -= mA * P; - aA -= iA * b2Cross(rA, P); - - cB += mB * P; - aB += iB * b2Cross(rB, P); - } - - m_positions[indexA].c = cA; - m_positions[indexA].a = aA; - - m_positions[indexB].c = cB; - m_positions[indexB].a = aB; - } - - // We can't expect minSpeparation >= -b2_linearSlop because we don't - // push the separation above -b2_linearSlop. - return minSeparation >= -1.5f * b2_linearSlop; -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2ContactSolver.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2ContactSolver.h deleted file mode 100644 index a622e30d..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2ContactSolver.h +++ /dev/null @@ -1,95 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_CONTACT_SOLVER_H -#define B2_CONTACT_SOLVER_H - -#include -#include -#include - -class b2Contact; -class b2Body; -class b2StackAllocator; -struct b2ContactPositionConstraint; - -struct b2VelocityConstraintPoint -{ - b2Vec2 rA; - b2Vec2 rB; - float32 normalImpulse; - float32 tangentImpulse; - float32 normalMass; - float32 tangentMass; - float32 velocityBias; -}; - -struct b2ContactVelocityConstraint -{ - b2VelocityConstraintPoint points[b2_maxManifoldPoints]; - b2Vec2 normal; - b2Mat22 normalMass; - b2Mat22 K; - int32 indexA; - int32 indexB; - float32 invMassA, invMassB; - float32 invIA, invIB; - float32 friction; - float32 restitution; - float32 tangentSpeed; - int32 pointCount; - int32 contactIndex; -}; - -struct b2ContactSolverDef -{ - b2TimeStep step; - b2Contact** contacts; - int32 count; - b2Position* positions; - b2Velocity* velocities; - b2StackAllocator* allocator; -}; - -class b2ContactSolver -{ -public: - b2ContactSolver(b2ContactSolverDef* def); - ~b2ContactSolver(); - - void InitializeVelocityConstraints(); - - void WarmStart(); - void SolveVelocityConstraints(); - void StoreImpulses(); - - bool SolvePositionConstraints(); - bool SolveTOIPositionConstraints(int32 toiIndexA, int32 toiIndexB); - - b2TimeStep m_step; - b2Position* m_positions; - b2Velocity* m_velocities; - b2StackAllocator* m_allocator; - b2ContactPositionConstraint* m_positionConstraints; - b2ContactVelocityConstraint* m_velocityConstraints; - b2Contact** m_contacts; - int m_count; -}; - -#endif - diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.cpp deleted file mode 100644 index d1fd3295..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2006-2010 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include - -#include - -b2Contact* b2EdgeAndCircleContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator) -{ - void* mem = allocator->Allocate(sizeof(b2EdgeAndCircleContact)); - return new (mem) b2EdgeAndCircleContact(fixtureA, fixtureB); -} - -void b2EdgeAndCircleContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator) -{ - ((b2EdgeAndCircleContact*)contact)->~b2EdgeAndCircleContact(); - allocator->Free(contact, sizeof(b2EdgeAndCircleContact)); -} - -b2EdgeAndCircleContact::b2EdgeAndCircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB) -: b2Contact(fixtureA, 0, fixtureB, 0) -{ - b2Assert(m_fixtureA->GetType() == b2Shape::e_edge); - b2Assert(m_fixtureB->GetType() == b2Shape::e_circle); -} - -void b2EdgeAndCircleContact::Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB) -{ - b2CollideEdgeAndCircle( manifold, - (b2EdgeShape*)m_fixtureA->GetShape(), xfA, - (b2CircleShape*)m_fixtureB->GetShape(), xfB); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.h deleted file mode 100644 index e7a34553..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_EDGE_AND_CIRCLE_CONTACT_H -#define B2_EDGE_AND_CIRCLE_CONTACT_H - -#include - -class b2BlockAllocator; - -class b2EdgeAndCircleContact : public b2Contact -{ -public: - static b2Contact* Create( b2Fixture* fixtureA, int32 indexA, - b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator); - static void Destroy(b2Contact* contact, b2BlockAllocator* allocator); - - b2EdgeAndCircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB); - ~b2EdgeAndCircleContact() {} - - void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB); -}; - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.cpp deleted file mode 100644 index ba536bc3..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2006-2010 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include - -#include - -b2Contact* b2EdgeAndPolygonContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator) -{ - void* mem = allocator->Allocate(sizeof(b2EdgeAndPolygonContact)); - return new (mem) b2EdgeAndPolygonContact(fixtureA, fixtureB); -} - -void b2EdgeAndPolygonContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator) -{ - ((b2EdgeAndPolygonContact*)contact)->~b2EdgeAndPolygonContact(); - allocator->Free(contact, sizeof(b2EdgeAndPolygonContact)); -} - -b2EdgeAndPolygonContact::b2EdgeAndPolygonContact(b2Fixture* fixtureA, b2Fixture* fixtureB) -: b2Contact(fixtureA, 0, fixtureB, 0) -{ - b2Assert(m_fixtureA->GetType() == b2Shape::e_edge); - b2Assert(m_fixtureB->GetType() == b2Shape::e_polygon); -} - -void b2EdgeAndPolygonContact::Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB) -{ - b2CollideEdgeAndPolygon( manifold, - (b2EdgeShape*)m_fixtureA->GetShape(), xfA, - (b2PolygonShape*)m_fixtureB->GetShape(), xfB); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.h deleted file mode 100644 index 3b40f121..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_EDGE_AND_POLYGON_CONTACT_H -#define B2_EDGE_AND_POLYGON_CONTACT_H - -#include - -class b2BlockAllocator; - -class b2EdgeAndPolygonContact : public b2Contact -{ -public: - static b2Contact* Create( b2Fixture* fixtureA, int32 indexA, - b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator); - static void Destroy(b2Contact* contact, b2BlockAllocator* allocator); - - b2EdgeAndPolygonContact(b2Fixture* fixtureA, b2Fixture* fixtureB); - ~b2EdgeAndPolygonContact() {} - - void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB); -}; - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.cpp deleted file mode 100644 index 7c9cbcc9..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include - -#include - -b2Contact* b2PolygonAndCircleContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator) -{ - void* mem = allocator->Allocate(sizeof(b2PolygonAndCircleContact)); - return new (mem) b2PolygonAndCircleContact(fixtureA, fixtureB); -} - -void b2PolygonAndCircleContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator) -{ - ((b2PolygonAndCircleContact*)contact)->~b2PolygonAndCircleContact(); - allocator->Free(contact, sizeof(b2PolygonAndCircleContact)); -} - -b2PolygonAndCircleContact::b2PolygonAndCircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB) -: b2Contact(fixtureA, 0, fixtureB, 0) -{ - b2Assert(m_fixtureA->GetType() == b2Shape::e_polygon); - b2Assert(m_fixtureB->GetType() == b2Shape::e_circle); -} - -void b2PolygonAndCircleContact::Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB) -{ - b2CollidePolygonAndCircle( manifold, - (b2PolygonShape*)m_fixtureA->GetShape(), xfA, - (b2CircleShape*)m_fixtureB->GetShape(), xfB); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.h deleted file mode 100644 index fe0645e0..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_POLYGON_AND_CIRCLE_CONTACT_H -#define B2_POLYGON_AND_CIRCLE_CONTACT_H - -#include - -class b2BlockAllocator; - -class b2PolygonAndCircleContact : public b2Contact -{ -public: - static b2Contact* Create(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator); - static void Destroy(b2Contact* contact, b2BlockAllocator* allocator); - - b2PolygonAndCircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB); - ~b2PolygonAndCircleContact() {} - - void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB); -}; - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2PolygonContact.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2PolygonContact.cpp deleted file mode 100644 index b5706ca1..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2PolygonContact.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include -#include -#include -#include - -#include - -b2Contact* b2PolygonContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator) -{ - void* mem = allocator->Allocate(sizeof(b2PolygonContact)); - return new (mem) b2PolygonContact(fixtureA, fixtureB); -} - -void b2PolygonContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator) -{ - ((b2PolygonContact*)contact)->~b2PolygonContact(); - allocator->Free(contact, sizeof(b2PolygonContact)); -} - -b2PolygonContact::b2PolygonContact(b2Fixture* fixtureA, b2Fixture* fixtureB) - : b2Contact(fixtureA, 0, fixtureB, 0) -{ - b2Assert(m_fixtureA->GetType() == b2Shape::e_polygon); - b2Assert(m_fixtureB->GetType() == b2Shape::e_polygon); -} - -void b2PolygonContact::Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB) -{ - b2CollidePolygons( manifold, - (b2PolygonShape*)m_fixtureA->GetShape(), xfA, - (b2PolygonShape*)m_fixtureB->GetShape(), xfB); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2PolygonContact.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2PolygonContact.h deleted file mode 100644 index 434e6c92..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Contacts/b2PolygonContact.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_POLYGON_CONTACT_H -#define B2_POLYGON_CONTACT_H - -#include - -class b2BlockAllocator; - -class b2PolygonContact : public b2Contact -{ -public: - static b2Contact* Create( b2Fixture* fixtureA, int32 indexA, - b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator); - static void Destroy(b2Contact* contact, b2BlockAllocator* allocator); - - b2PolygonContact(b2Fixture* fixtureA, b2Fixture* fixtureB); - ~b2PolygonContact() {} - - void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB); -}; - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2DistanceJoint.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2DistanceJoint.cpp deleted file mode 100644 index ba2b6c00..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2DistanceJoint.cpp +++ /dev/null @@ -1,260 +0,0 @@ -/* -* Copyright (c) 2006-2011 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include - -// 1-D constrained system -// m (v2 - v1) = lambda -// v2 + (beta/h) * x1 + gamma * lambda = 0, gamma has units of inverse mass. -// x2 = x1 + h * v2 - -// 1-D mass-damper-spring system -// m (v2 - v1) + h * d * v2 + h * k * - -// C = norm(p2 - p1) - L -// u = (p2 - p1) / norm(p2 - p1) -// Cdot = dot(u, v2 + cross(w2, r2) - v1 - cross(w1, r1)) -// J = [-u -cross(r1, u) u cross(r2, u)] -// K = J * invM * JT -// = invMass1 + invI1 * cross(r1, u)^2 + invMass2 + invI2 * cross(r2, u)^2 - -void b2DistanceJointDef::Initialize(b2Body* b1, b2Body* b2, - const b2Vec2& anchor1, const b2Vec2& anchor2) -{ - bodyA = b1; - bodyB = b2; - localAnchorA = bodyA->GetLocalPoint(anchor1); - localAnchorB = bodyB->GetLocalPoint(anchor2); - b2Vec2 d = anchor2 - anchor1; - length = d.Length(); -} - -b2DistanceJoint::b2DistanceJoint(const b2DistanceJointDef* def) -: b2Joint(def) -{ - m_localAnchorA = def->localAnchorA; - m_localAnchorB = def->localAnchorB; - m_length = def->length; - m_frequencyHz = def->frequencyHz; - m_dampingRatio = def->dampingRatio; - m_impulse = 0.0f; - m_gamma = 0.0f; - m_bias = 0.0f; -} - -void b2DistanceJoint::InitVelocityConstraints(const b2SolverData& data) -{ - m_indexA = m_bodyA->m_islandIndex; - m_indexB = m_bodyB->m_islandIndex; - m_localCenterA = m_bodyA->m_sweep.localCenter; - m_localCenterB = m_bodyB->m_sweep.localCenter; - m_invMassA = m_bodyA->m_invMass; - m_invMassB = m_bodyB->m_invMass; - m_invIA = m_bodyA->m_invI; - m_invIB = m_bodyB->m_invI; - - b2Vec2 cA = data.positions[m_indexA].c; - float32 aA = data.positions[m_indexA].a; - b2Vec2 vA = data.velocities[m_indexA].v; - float32 wA = data.velocities[m_indexA].w; - - b2Vec2 cB = data.positions[m_indexB].c; - float32 aB = data.positions[m_indexB].a; - b2Vec2 vB = data.velocities[m_indexB].v; - float32 wB = data.velocities[m_indexB].w; - - b2Rot qA(aA), qB(aB); - - m_rA = b2Mul(qA, m_localAnchorA - m_localCenterA); - m_rB = b2Mul(qB, m_localAnchorB - m_localCenterB); - m_u = cB + m_rB - cA - m_rA; - - // Handle singularity. - float32 length = m_u.Length(); - if (length > b2_linearSlop) - { - m_u *= 1.0f / length; - } - else - { - m_u.Set(0.0f, 0.0f); - } - - float32 crAu = b2Cross(m_rA, m_u); - float32 crBu = b2Cross(m_rB, m_u); - float32 invMass = m_invMassA + m_invIA * crAu * crAu + m_invMassB + m_invIB * crBu * crBu; - - // Compute the effective mass matrix. - m_mass = invMass != 0.0f ? 1.0f / invMass : 0.0f; - - if (m_frequencyHz > 0.0f) - { - float32 C = length - m_length; - - // Frequency - float32 omega = 2.0f * b2_pi * m_frequencyHz; - - // Damping coefficient - float32 d = 2.0f * m_mass * m_dampingRatio * omega; - - // Spring stiffness - float32 k = m_mass * omega * omega; - - // magic formulas - float32 h = data.step.dt; - m_gamma = h * (d + h * k); - m_gamma = m_gamma != 0.0f ? 1.0f / m_gamma : 0.0f; - m_bias = C * h * k * m_gamma; - - invMass += m_gamma; - m_mass = invMass != 0.0f ? 1.0f / invMass : 0.0f; - } - else - { - m_gamma = 0.0f; - m_bias = 0.0f; - } - - if (data.step.warmStarting) - { - // Scale the impulse to support a variable time step. - m_impulse *= data.step.dtRatio; - - b2Vec2 P = m_impulse * m_u; - vA -= m_invMassA * P; - wA -= m_invIA * b2Cross(m_rA, P); - vB += m_invMassB * P; - wB += m_invIB * b2Cross(m_rB, P); - } - else - { - m_impulse = 0.0f; - } - - data.velocities[m_indexA].v = vA; - data.velocities[m_indexA].w = wA; - data.velocities[m_indexB].v = vB; - data.velocities[m_indexB].w = wB; -} - -void b2DistanceJoint::SolveVelocityConstraints(const b2SolverData& data) -{ - b2Vec2 vA = data.velocities[m_indexA].v; - float32 wA = data.velocities[m_indexA].w; - b2Vec2 vB = data.velocities[m_indexB].v; - float32 wB = data.velocities[m_indexB].w; - - // Cdot = dot(u, v + cross(w, r)) - b2Vec2 vpA = vA + b2Cross(wA, m_rA); - b2Vec2 vpB = vB + b2Cross(wB, m_rB); - float32 Cdot = b2Dot(m_u, vpB - vpA); - - float32 impulse = -m_mass * (Cdot + m_bias + m_gamma * m_impulse); - m_impulse += impulse; - - b2Vec2 P = impulse * m_u; - vA -= m_invMassA * P; - wA -= m_invIA * b2Cross(m_rA, P); - vB += m_invMassB * P; - wB += m_invIB * b2Cross(m_rB, P); - - data.velocities[m_indexA].v = vA; - data.velocities[m_indexA].w = wA; - data.velocities[m_indexB].v = vB; - data.velocities[m_indexB].w = wB; -} - -bool b2DistanceJoint::SolvePositionConstraints(const b2SolverData& data) -{ - if (m_frequencyHz > 0.0f) - { - // There is no position correction for soft distance constraints. - return true; - } - - b2Vec2 cA = data.positions[m_indexA].c; - float32 aA = data.positions[m_indexA].a; - b2Vec2 cB = data.positions[m_indexB].c; - float32 aB = data.positions[m_indexB].a; - - b2Rot qA(aA), qB(aB); - - b2Vec2 rA = b2Mul(qA, m_localAnchorA - m_localCenterA); - b2Vec2 rB = b2Mul(qB, m_localAnchorB - m_localCenterB); - b2Vec2 u = cB + rB - cA - rA; - - float32 length = u.Normalize(); - float32 C = length - m_length; - C = b2Clamp(C, -b2_maxLinearCorrection, b2_maxLinearCorrection); - - float32 impulse = -m_mass * C; - b2Vec2 P = impulse * u; - - cA -= m_invMassA * P; - aA -= m_invIA * b2Cross(rA, P); - cB += m_invMassB * P; - aB += m_invIB * b2Cross(rB, P); - - data.positions[m_indexA].c = cA; - data.positions[m_indexA].a = aA; - data.positions[m_indexB].c = cB; - data.positions[m_indexB].a = aB; - - return b2Abs(C) < b2_linearSlop; -} - -b2Vec2 b2DistanceJoint::GetAnchorA() const -{ - return m_bodyA->GetWorldPoint(m_localAnchorA); -} - -b2Vec2 b2DistanceJoint::GetAnchorB() const -{ - return m_bodyB->GetWorldPoint(m_localAnchorB); -} - -b2Vec2 b2DistanceJoint::GetReactionForce(float32 inv_dt) const -{ - b2Vec2 F = (inv_dt * m_impulse) * m_u; - return F; -} - -float32 b2DistanceJoint::GetReactionTorque(float32 inv_dt) const -{ - B2_NOT_USED(inv_dt); - return 0.0f; -} - -void b2DistanceJoint::Dump() -{ - int32 indexA = m_bodyA->m_islandIndex; - int32 indexB = m_bodyB->m_islandIndex; - - b2Log(" b2DistanceJointDef jd;\n"); - b2Log(" jd.bodyA = bodies[%d];\n", indexA); - b2Log(" jd.bodyB = bodies[%d];\n", indexB); - b2Log(" jd.collideConnected = bool(%d);\n", m_collideConnected); - b2Log(" jd.localAnchorA.Set(%.15lef, %.15lef);\n", m_localAnchorA.x, m_localAnchorA.y); - b2Log(" jd.localAnchorB.Set(%.15lef, %.15lef);\n", m_localAnchorB.x, m_localAnchorB.y); - b2Log(" jd.length = %.15lef;\n", m_length); - b2Log(" jd.frequencyHz = %.15lef;\n", m_frequencyHz); - b2Log(" jd.dampingRatio = %.15lef;\n", m_dampingRatio); - b2Log(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2DistanceJoint.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2DistanceJoint.h deleted file mode 100644 index 2faba9d4..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2DistanceJoint.h +++ /dev/null @@ -1,169 +0,0 @@ -/* -* Copyright (c) 2006-2007 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_DISTANCE_JOINT_H -#define B2_DISTANCE_JOINT_H - -#include - -/// Distance joint definition. This requires defining an -/// anchor point on both bodies and the non-zero length of the -/// distance joint. The definition uses local anchor points -/// so that the initial configuration can violate the constraint -/// slightly. This helps when saving and loading a game. -/// @warning Do not use a zero or short length. -struct b2DistanceJointDef : public b2JointDef -{ - b2DistanceJointDef() - { - type = e_distanceJoint; - localAnchorA.Set(0.0f, 0.0f); - localAnchorB.Set(0.0f, 0.0f); - length = 1.0f; - frequencyHz = 0.0f; - dampingRatio = 0.0f; - } - - /// Initialize the bodies, anchors, and length using the world - /// anchors. - void Initialize(b2Body* bodyA, b2Body* bodyB, - const b2Vec2& anchorA, const b2Vec2& anchorB); - - /// The local anchor point relative to bodyA's origin. - b2Vec2 localAnchorA; - - /// The local anchor point relative to bodyB's origin. - b2Vec2 localAnchorB; - - /// The natural length between the anchor points. - float32 length; - - /// The mass-spring-damper frequency in Hertz. A value of 0 - /// disables softness. - float32 frequencyHz; - - /// The damping ratio. 0 = no damping, 1 = critical damping. - float32 dampingRatio; -}; - -/// A distance joint constrains two points on two bodies -/// to remain at a fixed distance from each other. You can view -/// this as a massless, rigid rod. -class b2DistanceJoint : public b2Joint -{ -public: - - b2Vec2 GetAnchorA() const; - b2Vec2 GetAnchorB() const; - - /// Get the reaction force given the inverse time step. - /// Unit is N. - b2Vec2 GetReactionForce(float32 inv_dt) const; - - /// Get the reaction torque given the inverse time step. - /// Unit is N*m. This is always zero for a distance joint. - float32 GetReactionTorque(float32 inv_dt) const; - - /// The local anchor point relative to bodyA's origin. - const b2Vec2& GetLocalAnchorA() const { return m_localAnchorA; } - - /// The local anchor point relative to bodyB's origin. - const b2Vec2& GetLocalAnchorB() const { return m_localAnchorB; } - - /// Set/get the natural length. - /// Manipulating the length can lead to non-physical behavior when the frequency is zero. - void SetLength(float32 length); - float32 GetLength() const; - - /// Set/get frequency in Hz. - void SetFrequency(float32 hz); - float32 GetFrequency() const; - - /// Set/get damping ratio. - void SetDampingRatio(float32 ratio); - float32 GetDampingRatio() const; - - /// Dump joint to dmLog - void Dump(); - -protected: - - friend class b2Joint; - b2DistanceJoint(const b2DistanceJointDef* data); - - void InitVelocityConstraints(const b2SolverData& data); - void SolveVelocityConstraints(const b2SolverData& data); - bool SolvePositionConstraints(const b2SolverData& data); - - float32 m_frequencyHz; - float32 m_dampingRatio; - float32 m_bias; - - // Solver shared - b2Vec2 m_localAnchorA; - b2Vec2 m_localAnchorB; - float32 m_gamma; - float32 m_impulse; - float32 m_length; - - // Solver temp - int32 m_indexA; - int32 m_indexB; - b2Vec2 m_u; - b2Vec2 m_rA; - b2Vec2 m_rB; - b2Vec2 m_localCenterA; - b2Vec2 m_localCenterB; - float32 m_invMassA; - float32 m_invMassB; - float32 m_invIA; - float32 m_invIB; - float32 m_mass; -}; - -inline void b2DistanceJoint::SetLength(float32 length) -{ - m_length = length; -} - -inline float32 b2DistanceJoint::GetLength() const -{ - return m_length; -} - -inline void b2DistanceJoint::SetFrequency(float32 hz) -{ - m_frequencyHz = hz; -} - -inline float32 b2DistanceJoint::GetFrequency() const -{ - return m_frequencyHz; -} - -inline void b2DistanceJoint::SetDampingRatio(float32 ratio) -{ - m_dampingRatio = ratio; -} - -inline float32 b2DistanceJoint::GetDampingRatio() const -{ - return m_dampingRatio; -} - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2FrictionJoint.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2FrictionJoint.cpp deleted file mode 100644 index 412d257a..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2FrictionJoint.cpp +++ /dev/null @@ -1,251 +0,0 @@ -/* -* Copyright (c) 2006-2011 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include - -// Point-to-point constraint -// Cdot = v2 - v1 -// = v2 + cross(w2, r2) - v1 - cross(w1, r1) -// J = [-I -r1_skew I r2_skew ] -// Identity used: -// w k % (rx i + ry j) = w * (-ry i + rx j) - -// Angle constraint -// Cdot = w2 - w1 -// J = [0 0 -1 0 0 1] -// K = invI1 + invI2 - -void b2FrictionJointDef::Initialize(b2Body* bA, b2Body* bB, const b2Vec2& anchor) -{ - bodyA = bA; - bodyB = bB; - localAnchorA = bodyA->GetLocalPoint(anchor); - localAnchorB = bodyB->GetLocalPoint(anchor); -} - -b2FrictionJoint::b2FrictionJoint(const b2FrictionJointDef* def) -: b2Joint(def) -{ - m_localAnchorA = def->localAnchorA; - m_localAnchorB = def->localAnchorB; - - m_linearImpulse.SetZero(); - m_angularImpulse = 0.0f; - - m_maxForce = def->maxForce; - m_maxTorque = def->maxTorque; -} - -void b2FrictionJoint::InitVelocityConstraints(const b2SolverData& data) -{ - m_indexA = m_bodyA->m_islandIndex; - m_indexB = m_bodyB->m_islandIndex; - m_localCenterA = m_bodyA->m_sweep.localCenter; - m_localCenterB = m_bodyB->m_sweep.localCenter; - m_invMassA = m_bodyA->m_invMass; - m_invMassB = m_bodyB->m_invMass; - m_invIA = m_bodyA->m_invI; - m_invIB = m_bodyB->m_invI; - - float32 aA = data.positions[m_indexA].a; - b2Vec2 vA = data.velocities[m_indexA].v; - float32 wA = data.velocities[m_indexA].w; - - float32 aB = data.positions[m_indexB].a; - b2Vec2 vB = data.velocities[m_indexB].v; - float32 wB = data.velocities[m_indexB].w; - - b2Rot qA(aA), qB(aB); - - // Compute the effective mass matrix. - m_rA = b2Mul(qA, m_localAnchorA - m_localCenterA); - m_rB = b2Mul(qB, m_localAnchorB - m_localCenterB); - - // J = [-I -r1_skew I r2_skew] - // [ 0 -1 0 1] - // r_skew = [-ry; rx] - - // Matlab - // K = [ mA+r1y^2*iA+mB+r2y^2*iB, -r1y*iA*r1x-r2y*iB*r2x, -r1y*iA-r2y*iB] - // [ -r1y*iA*r1x-r2y*iB*r2x, mA+r1x^2*iA+mB+r2x^2*iB, r1x*iA+r2x*iB] - // [ -r1y*iA-r2y*iB, r1x*iA+r2x*iB, iA+iB] - - float32 mA = m_invMassA, mB = m_invMassB; - float32 iA = m_invIA, iB = m_invIB; - - b2Mat22 K; - K.ex.x = mA + mB + iA * m_rA.y * m_rA.y + iB * m_rB.y * m_rB.y; - K.ex.y = -iA * m_rA.x * m_rA.y - iB * m_rB.x * m_rB.y; - K.ey.x = K.ex.y; - K.ey.y = mA + mB + iA * m_rA.x * m_rA.x + iB * m_rB.x * m_rB.x; - - m_linearMass = K.GetInverse(); - - m_angularMass = iA + iB; - if (m_angularMass > 0.0f) - { - m_angularMass = 1.0f / m_angularMass; - } - - if (data.step.warmStarting) - { - // Scale impulses to support a variable time step. - m_linearImpulse *= data.step.dtRatio; - m_angularImpulse *= data.step.dtRatio; - - b2Vec2 P(m_linearImpulse.x, m_linearImpulse.y); - vA -= mA * P; - wA -= iA * (b2Cross(m_rA, P) + m_angularImpulse); - vB += mB * P; - wB += iB * (b2Cross(m_rB, P) + m_angularImpulse); - } - else - { - m_linearImpulse.SetZero(); - m_angularImpulse = 0.0f; - } - - data.velocities[m_indexA].v = vA; - data.velocities[m_indexA].w = wA; - data.velocities[m_indexB].v = vB; - data.velocities[m_indexB].w = wB; -} - -void b2FrictionJoint::SolveVelocityConstraints(const b2SolverData& data) -{ - b2Vec2 vA = data.velocities[m_indexA].v; - float32 wA = data.velocities[m_indexA].w; - b2Vec2 vB = data.velocities[m_indexB].v; - float32 wB = data.velocities[m_indexB].w; - - float32 mA = m_invMassA, mB = m_invMassB; - float32 iA = m_invIA, iB = m_invIB; - - float32 h = data.step.dt; - - // Solve angular friction - { - float32 Cdot = wB - wA; - float32 impulse = -m_angularMass * Cdot; - - float32 oldImpulse = m_angularImpulse; - float32 maxImpulse = h * m_maxTorque; - m_angularImpulse = b2Clamp(m_angularImpulse + impulse, -maxImpulse, maxImpulse); - impulse = m_angularImpulse - oldImpulse; - - wA -= iA * impulse; - wB += iB * impulse; - } - - // Solve linear friction - { - b2Vec2 Cdot = vB + b2Cross(wB, m_rB) - vA - b2Cross(wA, m_rA); - - b2Vec2 impulse = -b2Mul(m_linearMass, Cdot); - b2Vec2 oldImpulse = m_linearImpulse; - m_linearImpulse += impulse; - - float32 maxImpulse = h * m_maxForce; - - if (m_linearImpulse.LengthSquared() > maxImpulse * maxImpulse) - { - m_linearImpulse.Normalize(); - m_linearImpulse *= maxImpulse; - } - - impulse = m_linearImpulse - oldImpulse; - - vA -= mA * impulse; - wA -= iA * b2Cross(m_rA, impulse); - - vB += mB * impulse; - wB += iB * b2Cross(m_rB, impulse); - } - - data.velocities[m_indexA].v = vA; - data.velocities[m_indexA].w = wA; - data.velocities[m_indexB].v = vB; - data.velocities[m_indexB].w = wB; -} - -bool b2FrictionJoint::SolvePositionConstraints(const b2SolverData& data) -{ - B2_NOT_USED(data); - - return true; -} - -b2Vec2 b2FrictionJoint::GetAnchorA() const -{ - return m_bodyA->GetWorldPoint(m_localAnchorA); -} - -b2Vec2 b2FrictionJoint::GetAnchorB() const -{ - return m_bodyB->GetWorldPoint(m_localAnchorB); -} - -b2Vec2 b2FrictionJoint::GetReactionForce(float32 inv_dt) const -{ - return inv_dt * m_linearImpulse; -} - -float32 b2FrictionJoint::GetReactionTorque(float32 inv_dt) const -{ - return inv_dt * m_angularImpulse; -} - -void b2FrictionJoint::SetMaxForce(float32 force) -{ - b2Assert(b2IsValid(force) && force >= 0.0f); - m_maxForce = force; -} - -float32 b2FrictionJoint::GetMaxForce() const -{ - return m_maxForce; -} - -void b2FrictionJoint::SetMaxTorque(float32 torque) -{ - b2Assert(b2IsValid(torque) && torque >= 0.0f); - m_maxTorque = torque; -} - -float32 b2FrictionJoint::GetMaxTorque() const -{ - return m_maxTorque; -} - -void b2FrictionJoint::Dump() -{ - int32 indexA = m_bodyA->m_islandIndex; - int32 indexB = m_bodyB->m_islandIndex; - - b2Log(" b2FrictionJointDef jd;\n"); - b2Log(" jd.bodyA = bodies[%d];\n", indexA); - b2Log(" jd.bodyB = bodies[%d];\n", indexB); - b2Log(" jd.collideConnected = bool(%d);\n", m_collideConnected); - b2Log(" jd.localAnchorA.Set(%.15lef, %.15lef);\n", m_localAnchorA.x, m_localAnchorA.y); - b2Log(" jd.localAnchorB.Set(%.15lef, %.15lef);\n", m_localAnchorB.x, m_localAnchorB.y); - b2Log(" jd.maxForce = %.15lef;\n", m_maxForce); - b2Log(" jd.maxTorque = %.15lef;\n", m_maxTorque); - b2Log(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2FrictionJoint.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2FrictionJoint.h deleted file mode 100644 index d57abe80..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2FrictionJoint.h +++ /dev/null @@ -1,119 +0,0 @@ -/* -* Copyright (c) 2006-2007 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_FRICTION_JOINT_H -#define B2_FRICTION_JOINT_H - -#include - -/// Friction joint definition. -struct b2FrictionJointDef : public b2JointDef -{ - b2FrictionJointDef() - { - type = e_frictionJoint; - localAnchorA.SetZero(); - localAnchorB.SetZero(); - maxForce = 0.0f; - maxTorque = 0.0f; - } - - /// Initialize the bodies, anchors, axis, and reference angle using the world - /// anchor and world axis. - void Initialize(b2Body* bodyA, b2Body* bodyB, const b2Vec2& anchor); - - /// The local anchor point relative to bodyA's origin. - b2Vec2 localAnchorA; - - /// The local anchor point relative to bodyB's origin. - b2Vec2 localAnchorB; - - /// The maximum friction force in N. - float32 maxForce; - - /// The maximum friction torque in N-m. - float32 maxTorque; -}; - -/// Friction joint. This is used for top-down friction. -/// It provides 2D translational friction and angular friction. -class b2FrictionJoint : public b2Joint -{ -public: - b2Vec2 GetAnchorA() const; - b2Vec2 GetAnchorB() const; - - b2Vec2 GetReactionForce(float32 inv_dt) const; - float32 GetReactionTorque(float32 inv_dt) const; - - /// The local anchor point relative to bodyA's origin. - const b2Vec2& GetLocalAnchorA() const { return m_localAnchorA; } - - /// The local anchor point relative to bodyB's origin. - const b2Vec2& GetLocalAnchorB() const { return m_localAnchorB; } - - /// Set the maximum friction force in N. - void SetMaxForce(float32 force); - - /// Get the maximum friction force in N. - float32 GetMaxForce() const; - - /// Set the maximum friction torque in N*m. - void SetMaxTorque(float32 torque); - - /// Get the maximum friction torque in N*m. - float32 GetMaxTorque() const; - - /// Dump joint to dmLog - void Dump(); - -protected: - - friend class b2Joint; - - b2FrictionJoint(const b2FrictionJointDef* def); - - void InitVelocityConstraints(const b2SolverData& data); - void SolveVelocityConstraints(const b2SolverData& data); - bool SolvePositionConstraints(const b2SolverData& data); - - b2Vec2 m_localAnchorA; - b2Vec2 m_localAnchorB; - - // Solver shared - b2Vec2 m_linearImpulse; - float32 m_angularImpulse; - float32 m_maxForce; - float32 m_maxTorque; - - // Solver temp - int32 m_indexA; - int32 m_indexB; - b2Vec2 m_rA; - b2Vec2 m_rB; - b2Vec2 m_localCenterA; - b2Vec2 m_localCenterB; - float32 m_invMassA; - float32 m_invMassB; - float32 m_invIA; - float32 m_invIB; - b2Mat22 m_linearMass; - float32 m_angularMass; -}; - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2GearJoint.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2GearJoint.cpp deleted file mode 100644 index 155eb0c1..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2GearJoint.cpp +++ /dev/null @@ -1,419 +0,0 @@ -/* -* Copyright (c) 2007-2011 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include -#include -#include - -// Gear Joint: -// C0 = (coordinate1 + ratio * coordinate2)_initial -// C = (coordinate1 + ratio * coordinate2) - C0 = 0 -// J = [J1 ratio * J2] -// K = J * invM * JT -// = J1 * invM1 * J1T + ratio * ratio * J2 * invM2 * J2T -// -// Revolute: -// coordinate = rotation -// Cdot = angularVelocity -// J = [0 0 1] -// K = J * invM * JT = invI -// -// Prismatic: -// coordinate = dot(p - pg, ug) -// Cdot = dot(v + cross(w, r), ug) -// J = [ug cross(r, ug)] -// K = J * invM * JT = invMass + invI * cross(r, ug)^2 - -b2GearJoint::b2GearJoint(const b2GearJointDef* def) -: b2Joint(def) -{ - m_joint1 = def->joint1; - m_joint2 = def->joint2; - - m_typeA = m_joint1->GetType(); - m_typeB = m_joint2->GetType(); - - b2Assert(m_typeA == e_revoluteJoint || m_typeA == e_prismaticJoint); - b2Assert(m_typeB == e_revoluteJoint || m_typeB == e_prismaticJoint); - - float32 coordinateA, coordinateB; - - // TODO_ERIN there might be some problem with the joint edges in b2Joint. - - m_bodyC = m_joint1->GetBodyA(); - m_bodyA = m_joint1->GetBodyB(); - - // Get geometry of joint1 - b2Transform xfA = m_bodyA->m_xf; - float32 aA = m_bodyA->m_sweep.a; - b2Transform xfC = m_bodyC->m_xf; - float32 aC = m_bodyC->m_sweep.a; - - if (m_typeA == e_revoluteJoint) - { - b2RevoluteJoint* revolute = (b2RevoluteJoint*)def->joint1; - m_localAnchorC = revolute->m_localAnchorA; - m_localAnchorA = revolute->m_localAnchorB; - m_referenceAngleA = revolute->m_referenceAngle; - m_localAxisC.SetZero(); - - coordinateA = aA - aC - m_referenceAngleA; - } - else - { - b2PrismaticJoint* prismatic = (b2PrismaticJoint*)def->joint1; - m_localAnchorC = prismatic->m_localAnchorA; - m_localAnchorA = prismatic->m_localAnchorB; - m_referenceAngleA = prismatic->m_referenceAngle; - m_localAxisC = prismatic->m_localXAxisA; - - b2Vec2 pC = m_localAnchorC; - b2Vec2 pA = b2MulT(xfC.q, b2Mul(xfA.q, m_localAnchorA) + (xfA.p - xfC.p)); - coordinateA = b2Dot(pA - pC, m_localAxisC); - } - - m_bodyD = m_joint2->GetBodyA(); - m_bodyB = m_joint2->GetBodyB(); - - // Get geometry of joint2 - b2Transform xfB = m_bodyB->m_xf; - float32 aB = m_bodyB->m_sweep.a; - b2Transform xfD = m_bodyD->m_xf; - float32 aD = m_bodyD->m_sweep.a; - - if (m_typeB == e_revoluteJoint) - { - b2RevoluteJoint* revolute = (b2RevoluteJoint*)def->joint2; - m_localAnchorD = revolute->m_localAnchorA; - m_localAnchorB = revolute->m_localAnchorB; - m_referenceAngleB = revolute->m_referenceAngle; - m_localAxisD.SetZero(); - - coordinateB = aB - aD - m_referenceAngleB; - } - else - { - b2PrismaticJoint* prismatic = (b2PrismaticJoint*)def->joint2; - m_localAnchorD = prismatic->m_localAnchorA; - m_localAnchorB = prismatic->m_localAnchorB; - m_referenceAngleB = prismatic->m_referenceAngle; - m_localAxisD = prismatic->m_localXAxisA; - - b2Vec2 pD = m_localAnchorD; - b2Vec2 pB = b2MulT(xfD.q, b2Mul(xfB.q, m_localAnchorB) + (xfB.p - xfD.p)); - coordinateB = b2Dot(pB - pD, m_localAxisD); - } - - m_ratio = def->ratio; - - m_constant = coordinateA + m_ratio * coordinateB; - - m_impulse = 0.0f; -} - -void b2GearJoint::InitVelocityConstraints(const b2SolverData& data) -{ - m_indexA = m_bodyA->m_islandIndex; - m_indexB = m_bodyB->m_islandIndex; - m_indexC = m_bodyC->m_islandIndex; - m_indexD = m_bodyD->m_islandIndex; - m_lcA = m_bodyA->m_sweep.localCenter; - m_lcB = m_bodyB->m_sweep.localCenter; - m_lcC = m_bodyC->m_sweep.localCenter; - m_lcD = m_bodyD->m_sweep.localCenter; - m_mA = m_bodyA->m_invMass; - m_mB = m_bodyB->m_invMass; - m_mC = m_bodyC->m_invMass; - m_mD = m_bodyD->m_invMass; - m_iA = m_bodyA->m_invI; - m_iB = m_bodyB->m_invI; - m_iC = m_bodyC->m_invI; - m_iD = m_bodyD->m_invI; - - float32 aA = data.positions[m_indexA].a; - b2Vec2 vA = data.velocities[m_indexA].v; - float32 wA = data.velocities[m_indexA].w; - - float32 aB = data.positions[m_indexB].a; - b2Vec2 vB = data.velocities[m_indexB].v; - float32 wB = data.velocities[m_indexB].w; - - float32 aC = data.positions[m_indexC].a; - b2Vec2 vC = data.velocities[m_indexC].v; - float32 wC = data.velocities[m_indexC].w; - - float32 aD = data.positions[m_indexD].a; - b2Vec2 vD = data.velocities[m_indexD].v; - float32 wD = data.velocities[m_indexD].w; - - b2Rot qA(aA), qB(aB), qC(aC), qD(aD); - - m_mass = 0.0f; - - if (m_typeA == e_revoluteJoint) - { - m_JvAC.SetZero(); - m_JwA = 1.0f; - m_JwC = 1.0f; - m_mass += m_iA + m_iC; - } - else - { - b2Vec2 u = b2Mul(qC, m_localAxisC); - b2Vec2 rC = b2Mul(qC, m_localAnchorC - m_lcC); - b2Vec2 rA = b2Mul(qA, m_localAnchorA - m_lcA); - m_JvAC = u; - m_JwC = b2Cross(rC, u); - m_JwA = b2Cross(rA, u); - m_mass += m_mC + m_mA + m_iC * m_JwC * m_JwC + m_iA * m_JwA * m_JwA; - } - - if (m_typeB == e_revoluteJoint) - { - m_JvBD.SetZero(); - m_JwB = m_ratio; - m_JwD = m_ratio; - m_mass += m_ratio * m_ratio * (m_iB + m_iD); - } - else - { - b2Vec2 u = b2Mul(qD, m_localAxisD); - b2Vec2 rD = b2Mul(qD, m_localAnchorD - m_lcD); - b2Vec2 rB = b2Mul(qB, m_localAnchorB - m_lcB); - m_JvBD = m_ratio * u; - m_JwD = m_ratio * b2Cross(rD, u); - m_JwB = m_ratio * b2Cross(rB, u); - m_mass += m_ratio * m_ratio * (m_mD + m_mB) + m_iD * m_JwD * m_JwD + m_iB * m_JwB * m_JwB; - } - - // Compute effective mass. - m_mass = m_mass > 0.0f ? 1.0f / m_mass : 0.0f; - - if (data.step.warmStarting) - { - vA += (m_mA * m_impulse) * m_JvAC; - wA += m_iA * m_impulse * m_JwA; - vB += (m_mB * m_impulse) * m_JvBD; - wB += m_iB * m_impulse * m_JwB; - vC -= (m_mC * m_impulse) * m_JvAC; - wC -= m_iC * m_impulse * m_JwC; - vD -= (m_mD * m_impulse) * m_JvBD; - wD -= m_iD * m_impulse * m_JwD; - } - else - { - m_impulse = 0.0f; - } - - data.velocities[m_indexA].v = vA; - data.velocities[m_indexA].w = wA; - data.velocities[m_indexB].v = vB; - data.velocities[m_indexB].w = wB; - data.velocities[m_indexC].v = vC; - data.velocities[m_indexC].w = wC; - data.velocities[m_indexD].v = vD; - data.velocities[m_indexD].w = wD; -} - -void b2GearJoint::SolveVelocityConstraints(const b2SolverData& data) -{ - b2Vec2 vA = data.velocities[m_indexA].v; - float32 wA = data.velocities[m_indexA].w; - b2Vec2 vB = data.velocities[m_indexB].v; - float32 wB = data.velocities[m_indexB].w; - b2Vec2 vC = data.velocities[m_indexC].v; - float32 wC = data.velocities[m_indexC].w; - b2Vec2 vD = data.velocities[m_indexD].v; - float32 wD = data.velocities[m_indexD].w; - - float32 Cdot = b2Dot(m_JvAC, vA - vC) + b2Dot(m_JvBD, vB - vD); - Cdot += (m_JwA * wA - m_JwC * wC) + (m_JwB * wB - m_JwD * wD); - - float32 impulse = -m_mass * Cdot; - m_impulse += impulse; - - vA += (m_mA * impulse) * m_JvAC; - wA += m_iA * impulse * m_JwA; - vB += (m_mB * impulse) * m_JvBD; - wB += m_iB * impulse * m_JwB; - vC -= (m_mC * impulse) * m_JvAC; - wC -= m_iC * impulse * m_JwC; - vD -= (m_mD * impulse) * m_JvBD; - wD -= m_iD * impulse * m_JwD; - - data.velocities[m_indexA].v = vA; - data.velocities[m_indexA].w = wA; - data.velocities[m_indexB].v = vB; - data.velocities[m_indexB].w = wB; - data.velocities[m_indexC].v = vC; - data.velocities[m_indexC].w = wC; - data.velocities[m_indexD].v = vD; - data.velocities[m_indexD].w = wD; -} - -bool b2GearJoint::SolvePositionConstraints(const b2SolverData& data) -{ - b2Vec2 cA = data.positions[m_indexA].c; - float32 aA = data.positions[m_indexA].a; - b2Vec2 cB = data.positions[m_indexB].c; - float32 aB = data.positions[m_indexB].a; - b2Vec2 cC = data.positions[m_indexC].c; - float32 aC = data.positions[m_indexC].a; - b2Vec2 cD = data.positions[m_indexD].c; - float32 aD = data.positions[m_indexD].a; - - b2Rot qA(aA), qB(aB), qC(aC), qD(aD); - - float32 linearError = 0.0f; - - float32 coordinateA, coordinateB; - - b2Vec2 JvAC, JvBD; - float32 JwA, JwB, JwC, JwD; - float32 mass = 0.0f; - - if (m_typeA == e_revoluteJoint) - { - JvAC.SetZero(); - JwA = 1.0f; - JwC = 1.0f; - mass += m_iA + m_iC; - - coordinateA = aA - aC - m_referenceAngleA; - } - else - { - b2Vec2 u = b2Mul(qC, m_localAxisC); - b2Vec2 rC = b2Mul(qC, m_localAnchorC - m_lcC); - b2Vec2 rA = b2Mul(qA, m_localAnchorA - m_lcA); - JvAC = u; - JwC = b2Cross(rC, u); - JwA = b2Cross(rA, u); - mass += m_mC + m_mA + m_iC * JwC * JwC + m_iA * JwA * JwA; - - b2Vec2 pC = m_localAnchorC - m_lcC; - b2Vec2 pA = b2MulT(qC, rA + (cA - cC)); - coordinateA = b2Dot(pA - pC, m_localAxisC); - } - - if (m_typeB == e_revoluteJoint) - { - JvBD.SetZero(); - JwB = m_ratio; - JwD = m_ratio; - mass += m_ratio * m_ratio * (m_iB + m_iD); - - coordinateB = aB - aD - m_referenceAngleB; - } - else - { - b2Vec2 u = b2Mul(qD, m_localAxisD); - b2Vec2 rD = b2Mul(qD, m_localAnchorD - m_lcD); - b2Vec2 rB = b2Mul(qB, m_localAnchorB - m_lcB); - JvBD = m_ratio * u; - JwD = m_ratio * b2Cross(rD, u); - JwB = m_ratio * b2Cross(rB, u); - mass += m_ratio * m_ratio * (m_mD + m_mB) + m_iD * JwD * JwD + m_iB * JwB * JwB; - - b2Vec2 pD = m_localAnchorD - m_lcD; - b2Vec2 pB = b2MulT(qD, rB + (cB - cD)); - coordinateB = b2Dot(pB - pD, m_localAxisD); - } - - float32 C = (coordinateA + m_ratio * coordinateB) - m_constant; - - float32 impulse = 0.0f; - if (mass > 0.0f) - { - impulse = -C / mass; - } - - cA += m_mA * impulse * JvAC; - aA += m_iA * impulse * JwA; - cB += m_mB * impulse * JvBD; - aB += m_iB * impulse * JwB; - cC -= m_mC * impulse * JvAC; - aC -= m_iC * impulse * JwC; - cD -= m_mD * impulse * JvBD; - aD -= m_iD * impulse * JwD; - - data.positions[m_indexA].c = cA; - data.positions[m_indexA].a = aA; - data.positions[m_indexB].c = cB; - data.positions[m_indexB].a = aB; - data.positions[m_indexC].c = cC; - data.positions[m_indexC].a = aC; - data.positions[m_indexD].c = cD; - data.positions[m_indexD].a = aD; - - // TODO_ERIN not implemented - return linearError < b2_linearSlop; -} - -b2Vec2 b2GearJoint::GetAnchorA() const -{ - return m_bodyA->GetWorldPoint(m_localAnchorA); -} - -b2Vec2 b2GearJoint::GetAnchorB() const -{ - return m_bodyB->GetWorldPoint(m_localAnchorB); -} - -b2Vec2 b2GearJoint::GetReactionForce(float32 inv_dt) const -{ - b2Vec2 P = m_impulse * m_JvAC; - return inv_dt * P; -} - -float32 b2GearJoint::GetReactionTorque(float32 inv_dt) const -{ - float32 L = m_impulse * m_JwA; - return inv_dt * L; -} - -void b2GearJoint::SetRatio(float32 ratio) -{ - b2Assert(b2IsValid(ratio)); - m_ratio = ratio; -} - -float32 b2GearJoint::GetRatio() const -{ - return m_ratio; -} - -void b2GearJoint::Dump() -{ - int32 indexA = m_bodyA->m_islandIndex; - int32 indexB = m_bodyB->m_islandIndex; - - int32 index1 = m_joint1->m_index; - int32 index2 = m_joint2->m_index; - - b2Log(" b2GearJointDef jd;\n"); - b2Log(" jd.bodyA = bodies[%d];\n", indexA); - b2Log(" jd.bodyB = bodies[%d];\n", indexB); - b2Log(" jd.collideConnected = bool(%d);\n", m_collideConnected); - b2Log(" jd.joint1 = joints[%d];\n", index1); - b2Log(" jd.joint2 = joints[%d];\n", index2); - b2Log(" jd.ratio = %.15lef;\n", m_ratio); - b2Log(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2GearJoint.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2GearJoint.h deleted file mode 100644 index fd3d7b2f..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2GearJoint.h +++ /dev/null @@ -1,125 +0,0 @@ -/* -* Copyright (c) 2006-2011 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_GEAR_JOINT_H -#define B2_GEAR_JOINT_H - -#include - -/// Gear joint definition. This definition requires two existing -/// revolute or prismatic joints (any combination will work). -struct b2GearJointDef : public b2JointDef -{ - b2GearJointDef() - { - type = e_gearJoint; - joint1 = NULL; - joint2 = NULL; - ratio = 1.0f; - } - - /// The first revolute/prismatic joint attached to the gear joint. - b2Joint* joint1; - - /// The second revolute/prismatic joint attached to the gear joint. - b2Joint* joint2; - - /// The gear ratio. - /// @see b2GearJoint for explanation. - float32 ratio; -}; - -/// A gear joint is used to connect two joints together. Either joint -/// can be a revolute or prismatic joint. You specify a gear ratio -/// to bind the motions together: -/// coordinate1 + ratio * coordinate2 = constant -/// The ratio can be negative or positive. If one joint is a revolute joint -/// and the other joint is a prismatic joint, then the ratio will have units -/// of length or units of 1/length. -/// @warning You have to manually destroy the gear joint if joint1 or joint2 -/// is destroyed. -class b2GearJoint : public b2Joint -{ -public: - b2Vec2 GetAnchorA() const; - b2Vec2 GetAnchorB() const; - - b2Vec2 GetReactionForce(float32 inv_dt) const; - float32 GetReactionTorque(float32 inv_dt) const; - - /// Get the first joint. - b2Joint* GetJoint1() { return m_joint1; } - - /// Get the second joint. - b2Joint* GetJoint2() { return m_joint2; } - - /// Set/Get the gear ratio. - void SetRatio(float32 ratio); - float32 GetRatio() const; - - /// Dump joint to dmLog - void Dump(); - -protected: - - friend class b2Joint; - b2GearJoint(const b2GearJointDef* data); - - void InitVelocityConstraints(const b2SolverData& data); - void SolveVelocityConstraints(const b2SolverData& data); - bool SolvePositionConstraints(const b2SolverData& data); - - b2Joint* m_joint1; - b2Joint* m_joint2; - - b2JointType m_typeA; - b2JointType m_typeB; - - // Body A is connected to body C - // Body B is connected to body D - b2Body* m_bodyC; - b2Body* m_bodyD; - - // Solver shared - b2Vec2 m_localAnchorA; - b2Vec2 m_localAnchorB; - b2Vec2 m_localAnchorC; - b2Vec2 m_localAnchorD; - - b2Vec2 m_localAxisC; - b2Vec2 m_localAxisD; - - float32 m_referenceAngleA; - float32 m_referenceAngleB; - - float32 m_constant; - float32 m_ratio; - - float32 m_impulse; - - // Solver temp - int32 m_indexA, m_indexB, m_indexC, m_indexD; - b2Vec2 m_lcA, m_lcB, m_lcC, m_lcD; - float32 m_mA, m_mB, m_mC, m_mD; - float32 m_iA, m_iB, m_iC, m_iD; - b2Vec2 m_JvAC, m_JvBD; - float32 m_JwA, m_JwB, m_JwC, m_JwD; - float32 m_mass; -}; - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2Joint.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2Joint.cpp deleted file mode 100644 index dd55be94..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2Joint.cpp +++ /dev/null @@ -1,211 +0,0 @@ -/* -* Copyright (c) 2006-2007 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -b2Joint* b2Joint::Create(const b2JointDef* def, b2BlockAllocator* allocator) -{ - b2Joint* joint = NULL; - - switch (def->type) - { - case e_distanceJoint: - { - void* mem = allocator->Allocate(sizeof(b2DistanceJoint)); - joint = new (mem) b2DistanceJoint(static_cast(def)); - } - break; - - case e_mouseJoint: - { - void* mem = allocator->Allocate(sizeof(b2MouseJoint)); - joint = new (mem) b2MouseJoint(static_cast(def)); - } - break; - - case e_prismaticJoint: - { - void* mem = allocator->Allocate(sizeof(b2PrismaticJoint)); - joint = new (mem) b2PrismaticJoint(static_cast(def)); - } - break; - - case e_revoluteJoint: - { - void* mem = allocator->Allocate(sizeof(b2RevoluteJoint)); - joint = new (mem) b2RevoluteJoint(static_cast(def)); - } - break; - - case e_pulleyJoint: - { - void* mem = allocator->Allocate(sizeof(b2PulleyJoint)); - joint = new (mem) b2PulleyJoint(static_cast(def)); - } - break; - - case e_gearJoint: - { - void* mem = allocator->Allocate(sizeof(b2GearJoint)); - joint = new (mem) b2GearJoint(static_cast(def)); - } - break; - - case e_wheelJoint: - { - void* mem = allocator->Allocate(sizeof(b2WheelJoint)); - joint = new (mem) b2WheelJoint(static_cast(def)); - } - break; - - case e_weldJoint: - { - void* mem = allocator->Allocate(sizeof(b2WeldJoint)); - joint = new (mem) b2WeldJoint(static_cast(def)); - } - break; - - case e_frictionJoint: - { - void* mem = allocator->Allocate(sizeof(b2FrictionJoint)); - joint = new (mem) b2FrictionJoint(static_cast(def)); - } - break; - - case e_ropeJoint: - { - void* mem = allocator->Allocate(sizeof(b2RopeJoint)); - joint = new (mem) b2RopeJoint(static_cast(def)); - } - break; - - case e_motorJoint: - { - void* mem = allocator->Allocate(sizeof(b2MotorJoint)); - joint = new (mem) b2MotorJoint(static_cast(def)); - } - break; - - default: - b2Assert(false); - break; - } - - return joint; -} - -void b2Joint::Destroy(b2Joint* joint, b2BlockAllocator* allocator) -{ - joint->~b2Joint(); - switch (joint->m_type) - { - case e_distanceJoint: - allocator->Free(joint, sizeof(b2DistanceJoint)); - break; - - case e_mouseJoint: - allocator->Free(joint, sizeof(b2MouseJoint)); - break; - - case e_prismaticJoint: - allocator->Free(joint, sizeof(b2PrismaticJoint)); - break; - - case e_revoluteJoint: - allocator->Free(joint, sizeof(b2RevoluteJoint)); - break; - - case e_pulleyJoint: - allocator->Free(joint, sizeof(b2PulleyJoint)); - break; - - case e_gearJoint: - allocator->Free(joint, sizeof(b2GearJoint)); - break; - - case e_wheelJoint: - allocator->Free(joint, sizeof(b2WheelJoint)); - break; - - case e_weldJoint: - allocator->Free(joint, sizeof(b2WeldJoint)); - break; - - case e_frictionJoint: - allocator->Free(joint, sizeof(b2FrictionJoint)); - break; - - case e_ropeJoint: - allocator->Free(joint, sizeof(b2RopeJoint)); - break; - - case e_motorJoint: - allocator->Free(joint, sizeof(b2MotorJoint)); - break; - - default: - b2Assert(false); - break; - } -} - -b2Joint::b2Joint(const b2JointDef* def) -{ - b2Assert(def->bodyA != def->bodyB); - - m_type = def->type; - m_prev = NULL; - m_next = NULL; - m_bodyA = def->bodyA; - m_bodyB = def->bodyB; - m_index = 0; - m_collideConnected = def->collideConnected; - m_islandFlag = false; - m_userData = def->userData; - - m_edgeA.joint = NULL; - m_edgeA.other = NULL; - m_edgeA.prev = NULL; - m_edgeA.next = NULL; - - m_edgeB.joint = NULL; - m_edgeB.other = NULL; - m_edgeB.prev = NULL; - m_edgeB.next = NULL; -} - -bool b2Joint::IsActive() const -{ - return m_bodyA->IsActive() && m_bodyB->IsActive(); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2Joint.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2Joint.h deleted file mode 100644 index dd076b6b..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2Joint.h +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2006-2007 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_JOINT_H -#define B2_JOINT_H - -#include - -class b2Body; -class b2Joint; -struct b2SolverData; -class b2BlockAllocator; - -enum b2JointType -{ - e_unknownJoint, - e_revoluteJoint, - e_prismaticJoint, - e_distanceJoint, - e_pulleyJoint, - e_mouseJoint, - e_gearJoint, - e_wheelJoint, - e_weldJoint, - e_frictionJoint, - e_ropeJoint, - e_motorJoint -}; - -enum b2LimitState -{ - e_inactiveLimit, - e_atLowerLimit, - e_atUpperLimit, - e_equalLimits -}; - -struct b2Jacobian -{ - b2Vec2 linear; - float32 angularA; - float32 angularB; -}; - -/// A joint edge is used to connect bodies and joints together -/// in a joint graph where each body is a node and each joint -/// is an edge. A joint edge belongs to a doubly linked list -/// maintained in each attached body. Each joint has two joint -/// nodes, one for each attached body. -struct b2JointEdge -{ - b2Body* other; ///< provides quick access to the other body attached. - b2Joint* joint; ///< the joint - b2JointEdge* prev; ///< the previous joint edge in the body's joint list - b2JointEdge* next; ///< the next joint edge in the body's joint list -}; - -/// Joint definitions are used to construct joints. -struct b2JointDef -{ - b2JointDef() - { - type = e_unknownJoint; - userData = NULL; - bodyA = NULL; - bodyB = NULL; - collideConnected = false; - } - - /// The joint type is set automatically for concrete joint types. - b2JointType type; - - /// Use this to attach application specific data to your joints. - void* userData; - - /// The first attached body. - b2Body* bodyA; - - /// The second attached body. - b2Body* bodyB; - - /// Set this flag to true if the attached bodies should collide. - bool collideConnected; -}; - -/// The base joint class. Joints are used to constraint two bodies together in -/// various fashions. Some joints also feature limits and motors. -class b2Joint -{ -public: - - /// Get the type of the concrete joint. - b2JointType GetType() const; - - /// Get the first body attached to this joint. - b2Body* GetBodyA(); - - /// Get the second body attached to this joint. - b2Body* GetBodyB(); - - /// Get the anchor point on bodyA in world coordinates. - virtual b2Vec2 GetAnchorA() const = 0; - - /// Get the anchor point on bodyB in world coordinates. - virtual b2Vec2 GetAnchorB() const = 0; - - /// Get the reaction force on bodyB at the joint anchor in Newtons. - virtual b2Vec2 GetReactionForce(float32 inv_dt) const = 0; - - /// Get the reaction torque on bodyB in N*m. - virtual float32 GetReactionTorque(float32 inv_dt) const = 0; - - /// Get the next joint the world joint list. - b2Joint* GetNext(); - const b2Joint* GetNext() const; - - /// Get the user data pointer. - void* GetUserData() const; - - /// Set the user data pointer. - void SetUserData(void* data); - - /// Short-cut function to determine if either body is inactive. - bool IsActive() const; - - /// Get collide connected. - /// Note: modifying the collide connect flag won't work correctly because - /// the flag is only checked when fixture AABBs begin to overlap. - bool GetCollideConnected() const; - - /// Dump this joint to the log file. - virtual void Dump() { b2Log("// Dump is not supported for this joint type.\n"); } - - /// Shift the origin for any points stored in world coordinates. - virtual void ShiftOrigin(const b2Vec2& newOrigin) { B2_NOT_USED(newOrigin); } - -protected: - friend class b2World; - friend class b2Body; - friend class b2Island; - friend class b2GearJoint; - - static b2Joint* Create(const b2JointDef* def, b2BlockAllocator* allocator); - static void Destroy(b2Joint* joint, b2BlockAllocator* allocator); - - b2Joint(const b2JointDef* def); - virtual ~b2Joint() {} - - virtual void InitVelocityConstraints(const b2SolverData& data) = 0; - virtual void SolveVelocityConstraints(const b2SolverData& data) = 0; - - // This returns true if the position errors are within tolerance. - virtual bool SolvePositionConstraints(const b2SolverData& data) = 0; - - b2JointType m_type; - b2Joint* m_prev; - b2Joint* m_next; - b2JointEdge m_edgeA; - b2JointEdge m_edgeB; - b2Body* m_bodyA; - b2Body* m_bodyB; - - int32 m_index; - - bool m_islandFlag; - bool m_collideConnected; - - void* m_userData; -}; - -inline b2JointType b2Joint::GetType() const -{ - return m_type; -} - -inline b2Body* b2Joint::GetBodyA() -{ - return m_bodyA; -} - -inline b2Body* b2Joint::GetBodyB() -{ - return m_bodyB; -} - -inline b2Joint* b2Joint::GetNext() -{ - return m_next; -} - -inline const b2Joint* b2Joint::GetNext() const -{ - return m_next; -} - -inline void* b2Joint::GetUserData() const -{ - return m_userData; -} - -inline void b2Joint::SetUserData(void* data) -{ - m_userData = data; -} - -inline bool b2Joint::GetCollideConnected() const -{ - return m_collideConnected; -} - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2MotorJoint.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2MotorJoint.cpp deleted file mode 100644 index e5bbcb16..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2MotorJoint.cpp +++ /dev/null @@ -1,304 +0,0 @@ -/* -* Copyright (c) 2006-2012 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include - -// Point-to-point constraint -// Cdot = v2 - v1 -// = v2 + cross(w2, r2) - v1 - cross(w1, r1) -// J = [-I -r1_skew I r2_skew ] -// Identity used: -// w k % (rx i + ry j) = w * (-ry i + rx j) - -// Angle constraint -// Cdot = w2 - w1 -// J = [0 0 -1 0 0 1] -// K = invI1 + invI2 - -void b2MotorJointDef::Initialize(b2Body* bA, b2Body* bB) -{ - bodyA = bA; - bodyB = bB; - b2Vec2 xB = bodyB->GetPosition(); - linearOffset = bodyA->GetLocalPoint(xB); - - float32 angleA = bodyA->GetAngle(); - float32 angleB = bodyB->GetAngle(); - angularOffset = angleB - angleA; -} - -b2MotorJoint::b2MotorJoint(const b2MotorJointDef* def) -: b2Joint(def) -{ - m_linearOffset = def->linearOffset; - m_angularOffset = def->angularOffset; - - m_linearImpulse.SetZero(); - m_angularImpulse = 0.0f; - - m_maxForce = def->maxForce; - m_maxTorque = def->maxTorque; - m_correctionFactor = def->correctionFactor; -} - -void b2MotorJoint::InitVelocityConstraints(const b2SolverData& data) -{ - m_indexA = m_bodyA->m_islandIndex; - m_indexB = m_bodyB->m_islandIndex; - m_localCenterA = m_bodyA->m_sweep.localCenter; - m_localCenterB = m_bodyB->m_sweep.localCenter; - m_invMassA = m_bodyA->m_invMass; - m_invMassB = m_bodyB->m_invMass; - m_invIA = m_bodyA->m_invI; - m_invIB = m_bodyB->m_invI; - - b2Vec2 cA = data.positions[m_indexA].c; - float32 aA = data.positions[m_indexA].a; - b2Vec2 vA = data.velocities[m_indexA].v; - float32 wA = data.velocities[m_indexA].w; - - b2Vec2 cB = data.positions[m_indexB].c; - float32 aB = data.positions[m_indexB].a; - b2Vec2 vB = data.velocities[m_indexB].v; - float32 wB = data.velocities[m_indexB].w; - - b2Rot qA(aA), qB(aB); - - // Compute the effective mass matrix. - m_rA = b2Mul(qA, -m_localCenterA); - m_rB = b2Mul(qB, -m_localCenterB); - - // J = [-I -r1_skew I r2_skew] - // [ 0 -1 0 1] - // r_skew = [-ry; rx] - - // Matlab - // K = [ mA+r1y^2*iA+mB+r2y^2*iB, -r1y*iA*r1x-r2y*iB*r2x, -r1y*iA-r2y*iB] - // [ -r1y*iA*r1x-r2y*iB*r2x, mA+r1x^2*iA+mB+r2x^2*iB, r1x*iA+r2x*iB] - // [ -r1y*iA-r2y*iB, r1x*iA+r2x*iB, iA+iB] - - float32 mA = m_invMassA, mB = m_invMassB; - float32 iA = m_invIA, iB = m_invIB; - - b2Mat22 K; - K.ex.x = mA + mB + iA * m_rA.y * m_rA.y + iB * m_rB.y * m_rB.y; - K.ex.y = -iA * m_rA.x * m_rA.y - iB * m_rB.x * m_rB.y; - K.ey.x = K.ex.y; - K.ey.y = mA + mB + iA * m_rA.x * m_rA.x + iB * m_rB.x * m_rB.x; - - m_linearMass = K.GetInverse(); - - m_angularMass = iA + iB; - if (m_angularMass > 0.0f) - { - m_angularMass = 1.0f / m_angularMass; - } - - m_linearError = cB + m_rB - cA - m_rA - b2Mul(qA, m_linearOffset); - m_angularError = aB - aA - m_angularOffset; - - if (data.step.warmStarting) - { - // Scale impulses to support a variable time step. - m_linearImpulse *= data.step.dtRatio; - m_angularImpulse *= data.step.dtRatio; - - b2Vec2 P(m_linearImpulse.x, m_linearImpulse.y); - vA -= mA * P; - wA -= iA * (b2Cross(m_rA, P) + m_angularImpulse); - vB += mB * P; - wB += iB * (b2Cross(m_rB, P) + m_angularImpulse); - } - else - { - m_linearImpulse.SetZero(); - m_angularImpulse = 0.0f; - } - - data.velocities[m_indexA].v = vA; - data.velocities[m_indexA].w = wA; - data.velocities[m_indexB].v = vB; - data.velocities[m_indexB].w = wB; -} - -void b2MotorJoint::SolveVelocityConstraints(const b2SolverData& data) -{ - b2Vec2 vA = data.velocities[m_indexA].v; - float32 wA = data.velocities[m_indexA].w; - b2Vec2 vB = data.velocities[m_indexB].v; - float32 wB = data.velocities[m_indexB].w; - - float32 mA = m_invMassA, mB = m_invMassB; - float32 iA = m_invIA, iB = m_invIB; - - float32 h = data.step.dt; - float32 inv_h = data.step.inv_dt; - - // Solve angular friction - { - float32 Cdot = wB - wA + inv_h * m_correctionFactor * m_angularError; - float32 impulse = -m_angularMass * Cdot; - - float32 oldImpulse = m_angularImpulse; - float32 maxImpulse = h * m_maxTorque; - m_angularImpulse = b2Clamp(m_angularImpulse + impulse, -maxImpulse, maxImpulse); - impulse = m_angularImpulse - oldImpulse; - - wA -= iA * impulse; - wB += iB * impulse; - } - - // Solve linear friction - { - b2Vec2 Cdot = vB + b2Cross(wB, m_rB) - vA - b2Cross(wA, m_rA) + inv_h * m_correctionFactor * m_linearError; - - b2Vec2 impulse = -b2Mul(m_linearMass, Cdot); - b2Vec2 oldImpulse = m_linearImpulse; - m_linearImpulse += impulse; - - float32 maxImpulse = h * m_maxForce; - - if (m_linearImpulse.LengthSquared() > maxImpulse * maxImpulse) - { - m_linearImpulse.Normalize(); - m_linearImpulse *= maxImpulse; - } - - impulse = m_linearImpulse - oldImpulse; - - vA -= mA * impulse; - wA -= iA * b2Cross(m_rA, impulse); - - vB += mB * impulse; - wB += iB * b2Cross(m_rB, impulse); - } - - data.velocities[m_indexA].v = vA; - data.velocities[m_indexA].w = wA; - data.velocities[m_indexB].v = vB; - data.velocities[m_indexB].w = wB; -} - -bool b2MotorJoint::SolvePositionConstraints(const b2SolverData& data) -{ - B2_NOT_USED(data); - - return true; -} - -b2Vec2 b2MotorJoint::GetAnchorA() const -{ - return m_bodyA->GetPosition(); -} - -b2Vec2 b2MotorJoint::GetAnchorB() const -{ - return m_bodyB->GetPosition(); -} - -b2Vec2 b2MotorJoint::GetReactionForce(float32 inv_dt) const -{ - return inv_dt * m_linearImpulse; -} - -float32 b2MotorJoint::GetReactionTorque(float32 inv_dt) const -{ - return inv_dt * m_angularImpulse; -} - -void b2MotorJoint::SetMaxForce(float32 force) -{ - b2Assert(b2IsValid(force) && force >= 0.0f); - m_maxForce = force; -} - -float32 b2MotorJoint::GetMaxForce() const -{ - return m_maxForce; -} - -void b2MotorJoint::SetMaxTorque(float32 torque) -{ - b2Assert(b2IsValid(torque) && torque >= 0.0f); - m_maxTorque = torque; -} - -float32 b2MotorJoint::GetMaxTorque() const -{ - return m_maxTorque; -} - -void b2MotorJoint::SetCorrectionFactor(float32 factor) -{ - b2Assert(b2IsValid(factor) && 0.0f <= factor && factor <= 1.0f); - m_correctionFactor = factor; -} - -float32 b2MotorJoint::GetCorrectionFactor() const -{ - return m_correctionFactor; -} - -void b2MotorJoint::SetLinearOffset(const b2Vec2& linearOffset) -{ - if (linearOffset.x != m_linearOffset.x || linearOffset.y != m_linearOffset.y) - { - m_bodyA->SetAwake(true); - m_bodyB->SetAwake(true); - m_linearOffset = linearOffset; - } -} - -const b2Vec2& b2MotorJoint::GetLinearOffset() const -{ - return m_linearOffset; -} - -void b2MotorJoint::SetAngularOffset(float32 angularOffset) -{ - if (angularOffset != m_angularOffset) - { - m_bodyA->SetAwake(true); - m_bodyB->SetAwake(true); - m_angularOffset = angularOffset; - } -} - -float32 b2MotorJoint::GetAngularOffset() const -{ - return m_angularOffset; -} - -void b2MotorJoint::Dump() -{ - int32 indexA = m_bodyA->m_islandIndex; - int32 indexB = m_bodyB->m_islandIndex; - - b2Log(" b2MotorJointDef jd;\n"); - b2Log(" jd.bodyA = bodies[%d];\n", indexA); - b2Log(" jd.bodyB = bodies[%d];\n", indexB); - b2Log(" jd.collideConnected = bool(%d);\n", m_collideConnected); - b2Log(" jd.linearOffset.Set(%.15lef, %.15lef);\n", m_linearOffset.x, m_linearOffset.y); - b2Log(" jd.angularOffset = %.15lef;\n", m_angularOffset); - b2Log(" jd.maxForce = %.15lef;\n", m_maxForce); - b2Log(" jd.maxTorque = %.15lef;\n", m_maxTorque); - b2Log(" jd.correctionFactor = %.15lef;\n", m_correctionFactor); - b2Log(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2MotorJoint.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2MotorJoint.h deleted file mode 100644 index 0b76d6fe..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2MotorJoint.h +++ /dev/null @@ -1,133 +0,0 @@ -/* -* Copyright (c) 2006-2012 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_MOTOR_JOINT_H -#define B2_MOTOR_JOINT_H - -#include - -/// Motor joint definition. -struct b2MotorJointDef : public b2JointDef -{ - b2MotorJointDef() - { - type = e_motorJoint; - linearOffset.SetZero(); - angularOffset = 0.0f; - maxForce = 1.0f; - maxTorque = 1.0f; - correctionFactor = 0.3f; - } - - /// Initialize the bodies and offsets using the current transforms. - void Initialize(b2Body* bodyA, b2Body* bodyB); - - /// Position of bodyB minus the position of bodyA, in bodyA's frame, in meters. - b2Vec2 linearOffset; - - /// The bodyB angle minus bodyA angle in radians. - float32 angularOffset; - - /// The maximum motor force in N. - float32 maxForce; - - /// The maximum motor torque in N-m. - float32 maxTorque; - - /// Position correction factor in the range [0,1]. - float32 correctionFactor; -}; - -/// A motor joint is used to control the relative motion -/// between two bodies. A typical usage is to control the movement -/// of a dynamic body with respect to the ground. -class b2MotorJoint : public b2Joint -{ -public: - b2Vec2 GetAnchorA() const; - b2Vec2 GetAnchorB() const; - - b2Vec2 GetReactionForce(float32 inv_dt) const; - float32 GetReactionTorque(float32 inv_dt) const; - - /// Set/get the target linear offset, in frame A, in meters. - void SetLinearOffset(const b2Vec2& linearOffset); - const b2Vec2& GetLinearOffset() const; - - /// Set/get the target angular offset, in radians. - void SetAngularOffset(float32 angularOffset); - float32 GetAngularOffset() const; - - /// Set the maximum friction force in N. - void SetMaxForce(float32 force); - - /// Get the maximum friction force in N. - float32 GetMaxForce() const; - - /// Set the maximum friction torque in N*m. - void SetMaxTorque(float32 torque); - - /// Get the maximum friction torque in N*m. - float32 GetMaxTorque() const; - - /// Set the position correction factor in the range [0,1]. - void SetCorrectionFactor(float32 factor); - - /// Get the position correction factor in the range [0,1]. - float32 GetCorrectionFactor() const; - - /// Dump to b2Log - void Dump(); - -protected: - - friend class b2Joint; - - b2MotorJoint(const b2MotorJointDef* def); - - void InitVelocityConstraints(const b2SolverData& data); - void SolveVelocityConstraints(const b2SolverData& data); - bool SolvePositionConstraints(const b2SolverData& data); - - // Solver shared - b2Vec2 m_linearOffset; - float32 m_angularOffset; - b2Vec2 m_linearImpulse; - float32 m_angularImpulse; - float32 m_maxForce; - float32 m_maxTorque; - float32 m_correctionFactor; - - // Solver temp - int32 m_indexA; - int32 m_indexB; - b2Vec2 m_rA; - b2Vec2 m_rB; - b2Vec2 m_localCenterA; - b2Vec2 m_localCenterB; - b2Vec2 m_linearError; - float32 m_angularError; - float32 m_invMassA; - float32 m_invMassB; - float32 m_invIA; - float32 m_invIB; - b2Mat22 m_linearMass; - float32 m_angularMass; -}; - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2MouseJoint.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2MouseJoint.cpp deleted file mode 100644 index ea96edde..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2MouseJoint.cpp +++ /dev/null @@ -1,222 +0,0 @@ -/* -* Copyright (c) 2006-2007 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include - -// p = attached point, m = mouse point -// C = p - m -// Cdot = v -// = v + cross(w, r) -// J = [I r_skew] -// Identity used: -// w k % (rx i + ry j) = w * (-ry i + rx j) - -b2MouseJoint::b2MouseJoint(const b2MouseJointDef* def) -: b2Joint(def) -{ - b2Assert(def->target.IsValid()); - b2Assert(b2IsValid(def->maxForce) && def->maxForce >= 0.0f); - b2Assert(b2IsValid(def->frequencyHz) && def->frequencyHz >= 0.0f); - b2Assert(b2IsValid(def->dampingRatio) && def->dampingRatio >= 0.0f); - - m_targetA = def->target; - m_localAnchorB = b2MulT(m_bodyB->GetTransform(), m_targetA); - - m_maxForce = def->maxForce; - m_impulse.SetZero(); - - m_frequencyHz = def->frequencyHz; - m_dampingRatio = def->dampingRatio; - - m_beta = 0.0f; - m_gamma = 0.0f; -} - -void b2MouseJoint::SetTarget(const b2Vec2& target) -{ - if (m_bodyB->IsAwake() == false) - { - m_bodyB->SetAwake(true); - } - m_targetA = target; -} - -const b2Vec2& b2MouseJoint::GetTarget() const -{ - return m_targetA; -} - -void b2MouseJoint::SetMaxForce(float32 force) -{ - m_maxForce = force; -} - -float32 b2MouseJoint::GetMaxForce() const -{ - return m_maxForce; -} - -void b2MouseJoint::SetFrequency(float32 hz) -{ - m_frequencyHz = hz; -} - -float32 b2MouseJoint::GetFrequency() const -{ - return m_frequencyHz; -} - -void b2MouseJoint::SetDampingRatio(float32 ratio) -{ - m_dampingRatio = ratio; -} - -float32 b2MouseJoint::GetDampingRatio() const -{ - return m_dampingRatio; -} - -void b2MouseJoint::InitVelocityConstraints(const b2SolverData& data) -{ - m_indexB = m_bodyB->m_islandIndex; - m_localCenterB = m_bodyB->m_sweep.localCenter; - m_invMassB = m_bodyB->m_invMass; - m_invIB = m_bodyB->m_invI; - - b2Vec2 cB = data.positions[m_indexB].c; - float32 aB = data.positions[m_indexB].a; - b2Vec2 vB = data.velocities[m_indexB].v; - float32 wB = data.velocities[m_indexB].w; - - b2Rot qB(aB); - - float32 mass = m_bodyB->GetMass(); - - // Frequency - float32 omega = 2.0f * b2_pi * m_frequencyHz; - - // Damping coefficient - float32 d = 2.0f * mass * m_dampingRatio * omega; - - // Spring stiffness - float32 k = mass * (omega * omega); - - // magic formulas - // gamma has units of inverse mass. - // beta has units of inverse time. - float32 h = data.step.dt; - b2Assert(d + h * k > b2_epsilon); - m_gamma = h * (d + h * k); - if (m_gamma != 0.0f) - { - m_gamma = 1.0f / m_gamma; - } - m_beta = h * k * m_gamma; - - // Compute the effective mass matrix. - m_rB = b2Mul(qB, m_localAnchorB - m_localCenterB); - - // K = [(1/m1 + 1/m2) * eye(2) - skew(r1) * invI1 * skew(r1) - skew(r2) * invI2 * skew(r2)] - // = [1/m1+1/m2 0 ] + invI1 * [r1.y*r1.y -r1.x*r1.y] + invI2 * [r1.y*r1.y -r1.x*r1.y] - // [ 0 1/m1+1/m2] [-r1.x*r1.y r1.x*r1.x] [-r1.x*r1.y r1.x*r1.x] - b2Mat22 K; - K.ex.x = m_invMassB + m_invIB * m_rB.y * m_rB.y + m_gamma; - K.ex.y = -m_invIB * m_rB.x * m_rB.y; - K.ey.x = K.ex.y; - K.ey.y = m_invMassB + m_invIB * m_rB.x * m_rB.x + m_gamma; - - m_mass = K.GetInverse(); - - m_C = cB + m_rB - m_targetA; - m_C *= m_beta; - - // Cheat with some damping - wB *= 0.98f; - - if (data.step.warmStarting) - { - m_impulse *= data.step.dtRatio; - vB += m_invMassB * m_impulse; - wB += m_invIB * b2Cross(m_rB, m_impulse); - } - else - { - m_impulse.SetZero(); - } - - data.velocities[m_indexB].v = vB; - data.velocities[m_indexB].w = wB; -} - -void b2MouseJoint::SolveVelocityConstraints(const b2SolverData& data) -{ - b2Vec2 vB = data.velocities[m_indexB].v; - float32 wB = data.velocities[m_indexB].w; - - // Cdot = v + cross(w, r) - b2Vec2 Cdot = vB + b2Cross(wB, m_rB); - b2Vec2 impulse = b2Mul(m_mass, -(Cdot + m_C + m_gamma * m_impulse)); - - b2Vec2 oldImpulse = m_impulse; - m_impulse += impulse; - float32 maxImpulse = data.step.dt * m_maxForce; - if (m_impulse.LengthSquared() > maxImpulse * maxImpulse) - { - m_impulse *= maxImpulse / m_impulse.Length(); - } - impulse = m_impulse - oldImpulse; - - vB += m_invMassB * impulse; - wB += m_invIB * b2Cross(m_rB, impulse); - - data.velocities[m_indexB].v = vB; - data.velocities[m_indexB].w = wB; -} - -bool b2MouseJoint::SolvePositionConstraints(const b2SolverData& data) -{ - B2_NOT_USED(data); - return true; -} - -b2Vec2 b2MouseJoint::GetAnchorA() const -{ - return m_targetA; -} - -b2Vec2 b2MouseJoint::GetAnchorB() const -{ - return m_bodyB->GetWorldPoint(m_localAnchorB); -} - -b2Vec2 b2MouseJoint::GetReactionForce(float32 inv_dt) const -{ - return inv_dt * m_impulse; -} - -float32 b2MouseJoint::GetReactionTorque(float32 inv_dt) const -{ - return inv_dt * 0.0f; -} - -void b2MouseJoint::ShiftOrigin(const b2Vec2& newOrigin) -{ - m_targetA -= newOrigin; -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2MouseJoint.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2MouseJoint.h deleted file mode 100644 index 8b50a0e1..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2MouseJoint.h +++ /dev/null @@ -1,129 +0,0 @@ -/* -* Copyright (c) 2006-2007 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_MOUSE_JOINT_H -#define B2_MOUSE_JOINT_H - -#include - -/// Mouse joint definition. This requires a world target point, -/// tuning parameters, and the time step. -struct b2MouseJointDef : public b2JointDef -{ - b2MouseJointDef() - { - type = e_mouseJoint; - target.Set(0.0f, 0.0f); - maxForce = 0.0f; - frequencyHz = 5.0f; - dampingRatio = 0.7f; - } - - /// The initial world target point. This is assumed - /// to coincide with the body anchor initially. - b2Vec2 target; - - /// The maximum constraint force that can be exerted - /// to move the candidate body. Usually you will express - /// as some multiple of the weight (multiplier * mass * gravity). - float32 maxForce; - - /// The response speed. - float32 frequencyHz; - - /// The damping ratio. 0 = no damping, 1 = critical damping. - float32 dampingRatio; -}; - -/// A mouse joint is used to make a point on a body track a -/// specified world point. This a soft constraint with a maximum -/// force. This allows the constraint to stretch and without -/// applying huge forces. -/// NOTE: this joint is not documented in the manual because it was -/// developed to be used in the testbed. If you want to learn how to -/// use the mouse joint, look at the testbed. -class b2MouseJoint : public b2Joint -{ -public: - - /// Implements b2Joint. - b2Vec2 GetAnchorA() const; - - /// Implements b2Joint. - b2Vec2 GetAnchorB() const; - - /// Implements b2Joint. - b2Vec2 GetReactionForce(float32 inv_dt) const; - - /// Implements b2Joint. - float32 GetReactionTorque(float32 inv_dt) const; - - /// Use this to update the target point. - void SetTarget(const b2Vec2& target); - const b2Vec2& GetTarget() const; - - /// Set/get the maximum force in Newtons. - void SetMaxForce(float32 force); - float32 GetMaxForce() const; - - /// Set/get the frequency in Hertz. - void SetFrequency(float32 hz); - float32 GetFrequency() const; - - /// Set/get the damping ratio (dimensionless). - void SetDampingRatio(float32 ratio); - float32 GetDampingRatio() const; - - /// The mouse joint does not support dumping. - void Dump() { b2Log("Mouse joint dumping is not supported.\n"); } - - /// Implement b2Joint::ShiftOrigin - void ShiftOrigin(const b2Vec2& newOrigin); - -protected: - friend class b2Joint; - - b2MouseJoint(const b2MouseJointDef* def); - - void InitVelocityConstraints(const b2SolverData& data); - void SolveVelocityConstraints(const b2SolverData& data); - bool SolvePositionConstraints(const b2SolverData& data); - - b2Vec2 m_localAnchorB; - b2Vec2 m_targetA; - float32 m_frequencyHz; - float32 m_dampingRatio; - float32 m_beta; - - // Solver shared - b2Vec2 m_impulse; - float32 m_maxForce; - float32 m_gamma; - - // Solver temp - int32 m_indexA; - int32 m_indexB; - b2Vec2 m_rB; - b2Vec2 m_localCenterB; - float32 m_invMassB; - float32 m_invIB; - b2Mat22 m_mass; - b2Vec2 m_C; -}; - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2PrismaticJoint.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2PrismaticJoint.cpp deleted file mode 100644 index 217e1450..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2PrismaticJoint.cpp +++ /dev/null @@ -1,629 +0,0 @@ -/* -* Copyright (c) 2006-2011 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include - -// Linear constraint (point-to-line) -// d = p2 - p1 = x2 + r2 - x1 - r1 -// C = dot(perp, d) -// Cdot = dot(d, cross(w1, perp)) + dot(perp, v2 + cross(w2, r2) - v1 - cross(w1, r1)) -// = -dot(perp, v1) - dot(cross(d + r1, perp), w1) + dot(perp, v2) + dot(cross(r2, perp), v2) -// J = [-perp, -cross(d + r1, perp), perp, cross(r2,perp)] -// -// Angular constraint -// C = a2 - a1 + a_initial -// Cdot = w2 - w1 -// J = [0 0 -1 0 0 1] -// -// K = J * invM * JT -// -// J = [-a -s1 a s2] -// [0 -1 0 1] -// a = perp -// s1 = cross(d + r1, a) = cross(p2 - x1, a) -// s2 = cross(r2, a) = cross(p2 - x2, a) - - -// Motor/Limit linear constraint -// C = dot(ax1, d) -// Cdot = = -dot(ax1, v1) - dot(cross(d + r1, ax1), w1) + dot(ax1, v2) + dot(cross(r2, ax1), v2) -// J = [-ax1 -cross(d+r1,ax1) ax1 cross(r2,ax1)] - -// Block Solver -// We develop a block solver that includes the joint limit. This makes the limit stiff (inelastic) even -// when the mass has poor distribution (leading to large torques about the joint anchor points). -// -// The Jacobian has 3 rows: -// J = [-uT -s1 uT s2] // linear -// [0 -1 0 1] // angular -// [-vT -a1 vT a2] // limit -// -// u = perp -// v = axis -// s1 = cross(d + r1, u), s2 = cross(r2, u) -// a1 = cross(d + r1, v), a2 = cross(r2, v) - -// M * (v2 - v1) = JT * df -// J * v2 = bias -// -// v2 = v1 + invM * JT * df -// J * (v1 + invM * JT * df) = bias -// K * df = bias - J * v1 = -Cdot -// K = J * invM * JT -// Cdot = J * v1 - bias -// -// Now solve for f2. -// df = f2 - f1 -// K * (f2 - f1) = -Cdot -// f2 = invK * (-Cdot) + f1 -// -// Clamp accumulated limit impulse. -// lower: f2(3) = max(f2(3), 0) -// upper: f2(3) = min(f2(3), 0) -// -// Solve for correct f2(1:2) -// K(1:2, 1:2) * f2(1:2) = -Cdot(1:2) - K(1:2,3) * f2(3) + K(1:2,1:3) * f1 -// = -Cdot(1:2) - K(1:2,3) * f2(3) + K(1:2,1:2) * f1(1:2) + K(1:2,3) * f1(3) -// K(1:2, 1:2) * f2(1:2) = -Cdot(1:2) - K(1:2,3) * (f2(3) - f1(3)) + K(1:2,1:2) * f1(1:2) -// f2(1:2) = invK(1:2,1:2) * (-Cdot(1:2) - K(1:2,3) * (f2(3) - f1(3))) + f1(1:2) -// -// Now compute impulse to be applied: -// df = f2 - f1 - -void b2PrismaticJointDef::Initialize(b2Body* bA, b2Body* bB, const b2Vec2& anchor, const b2Vec2& axis) -{ - bodyA = bA; - bodyB = bB; - localAnchorA = bodyA->GetLocalPoint(anchor); - localAnchorB = bodyB->GetLocalPoint(anchor); - localAxisA = bodyA->GetLocalVector(axis); - referenceAngle = bodyB->GetAngle() - bodyA->GetAngle(); -} - -b2PrismaticJoint::b2PrismaticJoint(const b2PrismaticJointDef* def) -: b2Joint(def) -{ - m_localAnchorA = def->localAnchorA; - m_localAnchorB = def->localAnchorB; - m_localXAxisA = def->localAxisA; - m_localXAxisA.Normalize(); - m_localYAxisA = b2Cross(1.0f, m_localXAxisA); - m_referenceAngle = def->referenceAngle; - - m_impulse.SetZero(); - m_motorMass = 0.0f; - m_motorImpulse = 0.0f; - - m_lowerTranslation = def->lowerTranslation; - m_upperTranslation = def->upperTranslation; - m_maxMotorForce = def->maxMotorForce; - m_motorSpeed = def->motorSpeed; - m_enableLimit = def->enableLimit; - m_enableMotor = def->enableMotor; - m_limitState = e_inactiveLimit; - - m_axis.SetZero(); - m_perp.SetZero(); -} - -void b2PrismaticJoint::InitVelocityConstraints(const b2SolverData& data) -{ - m_indexA = m_bodyA->m_islandIndex; - m_indexB = m_bodyB->m_islandIndex; - m_localCenterA = m_bodyA->m_sweep.localCenter; - m_localCenterB = m_bodyB->m_sweep.localCenter; - m_invMassA = m_bodyA->m_invMass; - m_invMassB = m_bodyB->m_invMass; - m_invIA = m_bodyA->m_invI; - m_invIB = m_bodyB->m_invI; - - b2Vec2 cA = data.positions[m_indexA].c; - float32 aA = data.positions[m_indexA].a; - b2Vec2 vA = data.velocities[m_indexA].v; - float32 wA = data.velocities[m_indexA].w; - - b2Vec2 cB = data.positions[m_indexB].c; - float32 aB = data.positions[m_indexB].a; - b2Vec2 vB = data.velocities[m_indexB].v; - float32 wB = data.velocities[m_indexB].w; - - b2Rot qA(aA), qB(aB); - - // Compute the effective masses. - b2Vec2 rA = b2Mul(qA, m_localAnchorA - m_localCenterA); - b2Vec2 rB = b2Mul(qB, m_localAnchorB - m_localCenterB); - b2Vec2 d = (cB - cA) + rB - rA; - - float32 mA = m_invMassA, mB = m_invMassB; - float32 iA = m_invIA, iB = m_invIB; - - // Compute motor Jacobian and effective mass. - { - m_axis = b2Mul(qA, m_localXAxisA); - m_a1 = b2Cross(d + rA, m_axis); - m_a2 = b2Cross(rB, m_axis); - - m_motorMass = mA + mB + iA * m_a1 * m_a1 + iB * m_a2 * m_a2; - if (m_motorMass > 0.0f) - { - m_motorMass = 1.0f / m_motorMass; - } - } - - // Prismatic constraint. - { - m_perp = b2Mul(qA, m_localYAxisA); - - m_s1 = b2Cross(d + rA, m_perp); - m_s2 = b2Cross(rB, m_perp); - - float32 s1test; - s1test = b2Cross(rA, m_perp); - - float32 k11 = mA + mB + iA * m_s1 * m_s1 + iB * m_s2 * m_s2; - float32 k12 = iA * m_s1 + iB * m_s2; - float32 k13 = iA * m_s1 * m_a1 + iB * m_s2 * m_a2; - float32 k22 = iA + iB; - if (k22 == 0.0f) - { - // For bodies with fixed rotation. - k22 = 1.0f; - } - float32 k23 = iA * m_a1 + iB * m_a2; - float32 k33 = mA + mB + iA * m_a1 * m_a1 + iB * m_a2 * m_a2; - - m_K.ex.Set(k11, k12, k13); - m_K.ey.Set(k12, k22, k23); - m_K.ez.Set(k13, k23, k33); - } - - // Compute motor and limit terms. - if (m_enableLimit) - { - float32 jointTranslation = b2Dot(m_axis, d); - if (b2Abs(m_upperTranslation - m_lowerTranslation) < 2.0f * b2_linearSlop) - { - m_limitState = e_equalLimits; - } - else if (jointTranslation <= m_lowerTranslation) - { - if (m_limitState != e_atLowerLimit) - { - m_limitState = e_atLowerLimit; - m_impulse.z = 0.0f; - } - } - else if (jointTranslation >= m_upperTranslation) - { - if (m_limitState != e_atUpperLimit) - { - m_limitState = e_atUpperLimit; - m_impulse.z = 0.0f; - } - } - else - { - m_limitState = e_inactiveLimit; - m_impulse.z = 0.0f; - } - } - else - { - m_limitState = e_inactiveLimit; - m_impulse.z = 0.0f; - } - - if (m_enableMotor == false) - { - m_motorImpulse = 0.0f; - } - - if (data.step.warmStarting) - { - // Account for variable time step. - m_impulse *= data.step.dtRatio; - m_motorImpulse *= data.step.dtRatio; - - b2Vec2 P = m_impulse.x * m_perp + (m_motorImpulse + m_impulse.z) * m_axis; - float32 LA = m_impulse.x * m_s1 + m_impulse.y + (m_motorImpulse + m_impulse.z) * m_a1; - float32 LB = m_impulse.x * m_s2 + m_impulse.y + (m_motorImpulse + m_impulse.z) * m_a2; - - vA -= mA * P; - wA -= iA * LA; - - vB += mB * P; - wB += iB * LB; - } - else - { - m_impulse.SetZero(); - m_motorImpulse = 0.0f; - } - - data.velocities[m_indexA].v = vA; - data.velocities[m_indexA].w = wA; - data.velocities[m_indexB].v = vB; - data.velocities[m_indexB].w = wB; -} - -void b2PrismaticJoint::SolveVelocityConstraints(const b2SolverData& data) -{ - b2Vec2 vA = data.velocities[m_indexA].v; - float32 wA = data.velocities[m_indexA].w; - b2Vec2 vB = data.velocities[m_indexB].v; - float32 wB = data.velocities[m_indexB].w; - - float32 mA = m_invMassA, mB = m_invMassB; - float32 iA = m_invIA, iB = m_invIB; - - // Solve linear motor constraint. - if (m_enableMotor && m_limitState != e_equalLimits) - { - float32 Cdot = b2Dot(m_axis, vB - vA) + m_a2 * wB - m_a1 * wA; - float32 impulse = m_motorMass * (m_motorSpeed - Cdot); - float32 oldImpulse = m_motorImpulse; - float32 maxImpulse = data.step.dt * m_maxMotorForce; - m_motorImpulse = b2Clamp(m_motorImpulse + impulse, -maxImpulse, maxImpulse); - impulse = m_motorImpulse - oldImpulse; - - b2Vec2 P = impulse * m_axis; - float32 LA = impulse * m_a1; - float32 LB = impulse * m_a2; - - vA -= mA * P; - wA -= iA * LA; - - vB += mB * P; - wB += iB * LB; - } - - b2Vec2 Cdot1; - Cdot1.x = b2Dot(m_perp, vB - vA) + m_s2 * wB - m_s1 * wA; - Cdot1.y = wB - wA; - - if (m_enableLimit && m_limitState != e_inactiveLimit) - { - // Solve prismatic and limit constraint in block form. - float32 Cdot2; - Cdot2 = b2Dot(m_axis, vB - vA) + m_a2 * wB - m_a1 * wA; - b2Vec3 Cdot(Cdot1.x, Cdot1.y, Cdot2); - - b2Vec3 f1 = m_impulse; - b2Vec3 df = m_K.Solve33(-Cdot); - m_impulse += df; - - if (m_limitState == e_atLowerLimit) - { - m_impulse.z = b2Max(m_impulse.z, 0.0f); - } - else if (m_limitState == e_atUpperLimit) - { - m_impulse.z = b2Min(m_impulse.z, 0.0f); - } - - // f2(1:2) = invK(1:2,1:2) * (-Cdot(1:2) - K(1:2,3) * (f2(3) - f1(3))) + f1(1:2) - b2Vec2 b = -Cdot1 - (m_impulse.z - f1.z) * b2Vec2(m_K.ez.x, m_K.ez.y); - b2Vec2 f2r = m_K.Solve22(b) + b2Vec2(f1.x, f1.y); - m_impulse.x = f2r.x; - m_impulse.y = f2r.y; - - df = m_impulse - f1; - - b2Vec2 P = df.x * m_perp + df.z * m_axis; - float32 LA = df.x * m_s1 + df.y + df.z * m_a1; - float32 LB = df.x * m_s2 + df.y + df.z * m_a2; - - vA -= mA * P; - wA -= iA * LA; - - vB += mB * P; - wB += iB * LB; - } - else - { - // Limit is inactive, just solve the prismatic constraint in block form. - b2Vec2 df = m_K.Solve22(-Cdot1); - m_impulse.x += df.x; - m_impulse.y += df.y; - - b2Vec2 P = df.x * m_perp; - float32 LA = df.x * m_s1 + df.y; - float32 LB = df.x * m_s2 + df.y; - - vA -= mA * P; - wA -= iA * LA; - - vB += mB * P; - wB += iB * LB; - } - - data.velocities[m_indexA].v = vA; - data.velocities[m_indexA].w = wA; - data.velocities[m_indexB].v = vB; - data.velocities[m_indexB].w = wB; -} - -bool b2PrismaticJoint::SolvePositionConstraints(const b2SolverData& data) -{ - b2Vec2 cA = data.positions[m_indexA].c; - float32 aA = data.positions[m_indexA].a; - b2Vec2 cB = data.positions[m_indexB].c; - float32 aB = data.positions[m_indexB].a; - - b2Rot qA(aA), qB(aB); - - float32 mA = m_invMassA, mB = m_invMassB; - float32 iA = m_invIA, iB = m_invIB; - - // Compute fresh Jacobians - b2Vec2 rA = b2Mul(qA, m_localAnchorA - m_localCenterA); - b2Vec2 rB = b2Mul(qB, m_localAnchorB - m_localCenterB); - b2Vec2 d = cB + rB - cA - rA; - - b2Vec2 axis = b2Mul(qA, m_localXAxisA); - float32 a1 = b2Cross(d + rA, axis); - float32 a2 = b2Cross(rB, axis); - b2Vec2 perp = b2Mul(qA, m_localYAxisA); - - float32 s1 = b2Cross(d + rA, perp); - float32 s2 = b2Cross(rB, perp); - - b2Vec3 impulse; - b2Vec2 C1; - C1.x = b2Dot(perp, d); - C1.y = aB - aA - m_referenceAngle; - - float32 linearError = b2Abs(C1.x); - float32 angularError = b2Abs(C1.y); - - bool active = false; - float32 C2 = 0.0f; - if (m_enableLimit) - { - float32 translation = b2Dot(axis, d); - if (b2Abs(m_upperTranslation - m_lowerTranslation) < 2.0f * b2_linearSlop) - { - // Prevent large angular corrections - C2 = b2Clamp(translation, -b2_maxLinearCorrection, b2_maxLinearCorrection); - linearError = b2Max(linearError, b2Abs(translation)); - active = true; - } - else if (translation <= m_lowerTranslation) - { - // Prevent large linear corrections and allow some slop. - C2 = b2Clamp(translation - m_lowerTranslation + b2_linearSlop, -b2_maxLinearCorrection, 0.0f); - linearError = b2Max(linearError, m_lowerTranslation - translation); - active = true; - } - else if (translation >= m_upperTranslation) - { - // Prevent large linear corrections and allow some slop. - C2 = b2Clamp(translation - m_upperTranslation - b2_linearSlop, 0.0f, b2_maxLinearCorrection); - linearError = b2Max(linearError, translation - m_upperTranslation); - active = true; - } - } - - if (active) - { - float32 k11 = mA + mB + iA * s1 * s1 + iB * s2 * s2; - float32 k12 = iA * s1 + iB * s2; - float32 k13 = iA * s1 * a1 + iB * s2 * a2; - float32 k22 = iA + iB; - if (k22 == 0.0f) - { - // For fixed rotation - k22 = 1.0f; - } - float32 k23 = iA * a1 + iB * a2; - float32 k33 = mA + mB + iA * a1 * a1 + iB * a2 * a2; - - b2Mat33 K; - K.ex.Set(k11, k12, k13); - K.ey.Set(k12, k22, k23); - K.ez.Set(k13, k23, k33); - - b2Vec3 C; - C.x = C1.x; - C.y = C1.y; - C.z = C2; - - impulse = K.Solve33(-C); - } - else - { - float32 k11 = mA + mB + iA * s1 * s1 + iB * s2 * s2; - float32 k12 = iA * s1 + iB * s2; - float32 k22 = iA + iB; - if (k22 == 0.0f) - { - k22 = 1.0f; - } - - b2Mat22 K; - K.ex.Set(k11, k12); - K.ey.Set(k12, k22); - - b2Vec2 impulse1 = K.Solve(-C1); - impulse.x = impulse1.x; - impulse.y = impulse1.y; - impulse.z = 0.0f; - } - - b2Vec2 P = impulse.x * perp + impulse.z * axis; - float32 LA = impulse.x * s1 + impulse.y + impulse.z * a1; - float32 LB = impulse.x * s2 + impulse.y + impulse.z * a2; - - cA -= mA * P; - aA -= iA * LA; - cB += mB * P; - aB += iB * LB; - - data.positions[m_indexA].c = cA; - data.positions[m_indexA].a = aA; - data.positions[m_indexB].c = cB; - data.positions[m_indexB].a = aB; - - return linearError <= b2_linearSlop && angularError <= b2_angularSlop; -} - -b2Vec2 b2PrismaticJoint::GetAnchorA() const -{ - return m_bodyA->GetWorldPoint(m_localAnchorA); -} - -b2Vec2 b2PrismaticJoint::GetAnchorB() const -{ - return m_bodyB->GetWorldPoint(m_localAnchorB); -} - -b2Vec2 b2PrismaticJoint::GetReactionForce(float32 inv_dt) const -{ - return inv_dt * (m_impulse.x * m_perp + (m_motorImpulse + m_impulse.z) * m_axis); -} - -float32 b2PrismaticJoint::GetReactionTorque(float32 inv_dt) const -{ - return inv_dt * m_impulse.y; -} - -float32 b2PrismaticJoint::GetJointTranslation() const -{ - b2Vec2 pA = m_bodyA->GetWorldPoint(m_localAnchorA); - b2Vec2 pB = m_bodyB->GetWorldPoint(m_localAnchorB); - b2Vec2 d = pB - pA; - b2Vec2 axis = m_bodyA->GetWorldVector(m_localXAxisA); - - float32 translation = b2Dot(d, axis); - return translation; -} - -float32 b2PrismaticJoint::GetJointSpeed() const -{ - b2Body* bA = m_bodyA; - b2Body* bB = m_bodyB; - - b2Vec2 rA = b2Mul(bA->m_xf.q, m_localAnchorA - bA->m_sweep.localCenter); - b2Vec2 rB = b2Mul(bB->m_xf.q, m_localAnchorB - bB->m_sweep.localCenter); - b2Vec2 p1 = bA->m_sweep.c + rA; - b2Vec2 p2 = bB->m_sweep.c + rB; - b2Vec2 d = p2 - p1; - b2Vec2 axis = b2Mul(bA->m_xf.q, m_localXAxisA); - - b2Vec2 vA = bA->m_linearVelocity; - b2Vec2 vB = bB->m_linearVelocity; - float32 wA = bA->m_angularVelocity; - float32 wB = bB->m_angularVelocity; - - float32 speed = b2Dot(d, b2Cross(wA, axis)) + b2Dot(axis, vB + b2Cross(wB, rB) - vA - b2Cross(wA, rA)); - return speed; -} - -bool b2PrismaticJoint::IsLimitEnabled() const -{ - return m_enableLimit; -} - -void b2PrismaticJoint::EnableLimit(bool flag) -{ - if (flag != m_enableLimit) - { - m_bodyA->SetAwake(true); - m_bodyB->SetAwake(true); - m_enableLimit = flag; - m_impulse.z = 0.0f; - } -} - -float32 b2PrismaticJoint::GetLowerLimit() const -{ - return m_lowerTranslation; -} - -float32 b2PrismaticJoint::GetUpperLimit() const -{ - return m_upperTranslation; -} - -void b2PrismaticJoint::SetLimits(float32 lower, float32 upper) -{ - b2Assert(lower <= upper); - if (lower != m_lowerTranslation || upper != m_upperTranslation) - { - m_bodyA->SetAwake(true); - m_bodyB->SetAwake(true); - m_lowerTranslation = lower; - m_upperTranslation = upper; - m_impulse.z = 0.0f; - } -} - -bool b2PrismaticJoint::IsMotorEnabled() const -{ - return m_enableMotor; -} - -void b2PrismaticJoint::EnableMotor(bool flag) -{ - m_bodyA->SetAwake(true); - m_bodyB->SetAwake(true); - m_enableMotor = flag; -} - -void b2PrismaticJoint::SetMotorSpeed(float32 speed) -{ - m_bodyA->SetAwake(true); - m_bodyB->SetAwake(true); - m_motorSpeed = speed; -} - -void b2PrismaticJoint::SetMaxMotorForce(float32 force) -{ - m_bodyA->SetAwake(true); - m_bodyB->SetAwake(true); - m_maxMotorForce = force; -} - -float32 b2PrismaticJoint::GetMotorForce(float32 inv_dt) const -{ - return inv_dt * m_motorImpulse; -} - -void b2PrismaticJoint::Dump() -{ - int32 indexA = m_bodyA->m_islandIndex; - int32 indexB = m_bodyB->m_islandIndex; - - b2Log(" b2PrismaticJointDef jd;\n"); - b2Log(" jd.bodyA = bodies[%d];\n", indexA); - b2Log(" jd.bodyB = bodies[%d];\n", indexB); - b2Log(" jd.collideConnected = bool(%d);\n", m_collideConnected); - b2Log(" jd.localAnchorA.Set(%.15lef, %.15lef);\n", m_localAnchorA.x, m_localAnchorA.y); - b2Log(" jd.localAnchorB.Set(%.15lef, %.15lef);\n", m_localAnchorB.x, m_localAnchorB.y); - b2Log(" jd.localAxisA.Set(%.15lef, %.15lef);\n", m_localXAxisA.x, m_localXAxisA.y); - b2Log(" jd.referenceAngle = %.15lef;\n", m_referenceAngle); - b2Log(" jd.enableLimit = bool(%d);\n", m_enableLimit); - b2Log(" jd.lowerTranslation = %.15lef;\n", m_lowerTranslation); - b2Log(" jd.upperTranslation = %.15lef;\n", m_upperTranslation); - b2Log(" jd.enableMotor = bool(%d);\n", m_enableMotor); - b2Log(" jd.motorSpeed = %.15lef;\n", m_motorSpeed); - b2Log(" jd.maxMotorForce = %.15lef;\n", m_maxMotorForce); - b2Log(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2PrismaticJoint.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2PrismaticJoint.h deleted file mode 100644 index 6ef5d3ec..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2PrismaticJoint.h +++ /dev/null @@ -1,196 +0,0 @@ -/* -* Copyright (c) 2006-2011 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_PRISMATIC_JOINT_H -#define B2_PRISMATIC_JOINT_H - -#include - -/// Prismatic joint definition. This requires defining a line of -/// motion using an axis and an anchor point. The definition uses local -/// anchor points and a local axis so that the initial configuration -/// can violate the constraint slightly. The joint translation is zero -/// when the local anchor points coincide in world space. Using local -/// anchors and a local axis helps when saving and loading a game. -struct b2PrismaticJointDef : public b2JointDef -{ - b2PrismaticJointDef() - { - type = e_prismaticJoint; - localAnchorA.SetZero(); - localAnchorB.SetZero(); - localAxisA.Set(1.0f, 0.0f); - referenceAngle = 0.0f; - enableLimit = false; - lowerTranslation = 0.0f; - upperTranslation = 0.0f; - enableMotor = false; - maxMotorForce = 0.0f; - motorSpeed = 0.0f; - } - - /// Initialize the bodies, anchors, axis, and reference angle using the world - /// anchor and unit world axis. - void Initialize(b2Body* bodyA, b2Body* bodyB, const b2Vec2& anchor, const b2Vec2& axis); - - /// The local anchor point relative to bodyA's origin. - b2Vec2 localAnchorA; - - /// The local anchor point relative to bodyB's origin. - b2Vec2 localAnchorB; - - /// The local translation unit axis in bodyA. - b2Vec2 localAxisA; - - /// The constrained angle between the bodies: bodyB_angle - bodyA_angle. - float32 referenceAngle; - - /// Enable/disable the joint limit. - bool enableLimit; - - /// The lower translation limit, usually in meters. - float32 lowerTranslation; - - /// The upper translation limit, usually in meters. - float32 upperTranslation; - - /// Enable/disable the joint motor. - bool enableMotor; - - /// The maximum motor torque, usually in N-m. - float32 maxMotorForce; - - /// The desired motor speed in radians per second. - float32 motorSpeed; -}; - -/// A prismatic joint. This joint provides one degree of freedom: translation -/// along an axis fixed in bodyA. Relative rotation is prevented. You can -/// use a joint limit to restrict the range of motion and a joint motor to -/// drive the motion or to model joint friction. -class b2PrismaticJoint : public b2Joint -{ -public: - b2Vec2 GetAnchorA() const; - b2Vec2 GetAnchorB() const; - - b2Vec2 GetReactionForce(float32 inv_dt) const; - float32 GetReactionTorque(float32 inv_dt) const; - - /// The local anchor point relative to bodyA's origin. - const b2Vec2& GetLocalAnchorA() const { return m_localAnchorA; } - - /// The local anchor point relative to bodyB's origin. - const b2Vec2& GetLocalAnchorB() const { return m_localAnchorB; } - - /// The local joint axis relative to bodyA. - const b2Vec2& GetLocalAxisA() const { return m_localXAxisA; } - - /// Get the reference angle. - float32 GetReferenceAngle() const { return m_referenceAngle; } - - /// Get the current joint translation, usually in meters. - float32 GetJointTranslation() const; - - /// Get the current joint translation speed, usually in meters per second. - float32 GetJointSpeed() const; - - /// Is the joint limit enabled? - bool IsLimitEnabled() const; - - /// Enable/disable the joint limit. - void EnableLimit(bool flag); - - /// Get the lower joint limit, usually in meters. - float32 GetLowerLimit() const; - - /// Get the upper joint limit, usually in meters. - float32 GetUpperLimit() const; - - /// Set the joint limits, usually in meters. - void SetLimits(float32 lower, float32 upper); - - /// Is the joint motor enabled? - bool IsMotorEnabled() const; - - /// Enable/disable the joint motor. - void EnableMotor(bool flag); - - /// Set the motor speed, usually in meters per second. - void SetMotorSpeed(float32 speed); - - /// Get the motor speed, usually in meters per second. - float32 GetMotorSpeed() const; - - /// Set the maximum motor force, usually in N. - void SetMaxMotorForce(float32 force); - float32 GetMaxMotorForce() const { return m_maxMotorForce; } - - /// Get the current motor force given the inverse time step, usually in N. - float32 GetMotorForce(float32 inv_dt) const; - - /// Dump to b2Log - void Dump(); - -protected: - friend class b2Joint; - friend class b2GearJoint; - b2PrismaticJoint(const b2PrismaticJointDef* def); - - void InitVelocityConstraints(const b2SolverData& data); - void SolveVelocityConstraints(const b2SolverData& data); - bool SolvePositionConstraints(const b2SolverData& data); - - // Solver shared - b2Vec2 m_localAnchorA; - b2Vec2 m_localAnchorB; - b2Vec2 m_localXAxisA; - b2Vec2 m_localYAxisA; - float32 m_referenceAngle; - b2Vec3 m_impulse; - float32 m_motorImpulse; - float32 m_lowerTranslation; - float32 m_upperTranslation; - float32 m_maxMotorForce; - float32 m_motorSpeed; - bool m_enableLimit; - bool m_enableMotor; - b2LimitState m_limitState; - - // Solver temp - int32 m_indexA; - int32 m_indexB; - b2Vec2 m_localCenterA; - b2Vec2 m_localCenterB; - float32 m_invMassA; - float32 m_invMassB; - float32 m_invIA; - float32 m_invIB; - b2Vec2 m_axis, m_perp; - float32 m_s1, m_s2; - float32 m_a1, m_a2; - b2Mat33 m_K; - float32 m_motorMass; -}; - -inline float32 b2PrismaticJoint::GetMotorSpeed() const -{ - return m_motorSpeed; -} - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2PulleyJoint.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2PulleyJoint.cpp deleted file mode 100644 index 9cd340f1..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2PulleyJoint.cpp +++ /dev/null @@ -1,348 +0,0 @@ -/* -* Copyright (c) 2007 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include - -// Pulley: -// length1 = norm(p1 - s1) -// length2 = norm(p2 - s2) -// C0 = (length1 + ratio * length2)_initial -// C = C0 - (length1 + ratio * length2) -// u1 = (p1 - s1) / norm(p1 - s1) -// u2 = (p2 - s2) / norm(p2 - s2) -// Cdot = -dot(u1, v1 + cross(w1, r1)) - ratio * dot(u2, v2 + cross(w2, r2)) -// J = -[u1 cross(r1, u1) ratio * u2 ratio * cross(r2, u2)] -// K = J * invM * JT -// = invMass1 + invI1 * cross(r1, u1)^2 + ratio^2 * (invMass2 + invI2 * cross(r2, u2)^2) - -void b2PulleyJointDef::Initialize(b2Body* bA, b2Body* bB, - const b2Vec2& groundA, const b2Vec2& groundB, - const b2Vec2& anchorA, const b2Vec2& anchorB, - float32 r) -{ - bodyA = bA; - bodyB = bB; - groundAnchorA = groundA; - groundAnchorB = groundB; - localAnchorA = bodyA->GetLocalPoint(anchorA); - localAnchorB = bodyB->GetLocalPoint(anchorB); - b2Vec2 dA = anchorA - groundA; - lengthA = dA.Length(); - b2Vec2 dB = anchorB - groundB; - lengthB = dB.Length(); - ratio = r; - b2Assert(ratio > b2_epsilon); -} - -b2PulleyJoint::b2PulleyJoint(const b2PulleyJointDef* def) -: b2Joint(def) -{ - m_groundAnchorA = def->groundAnchorA; - m_groundAnchorB = def->groundAnchorB; - m_localAnchorA = def->localAnchorA; - m_localAnchorB = def->localAnchorB; - - m_lengthA = def->lengthA; - m_lengthB = def->lengthB; - - b2Assert(def->ratio != 0.0f); - m_ratio = def->ratio; - - m_constant = def->lengthA + m_ratio * def->lengthB; - - m_impulse = 0.0f; -} - -void b2PulleyJoint::InitVelocityConstraints(const b2SolverData& data) -{ - m_indexA = m_bodyA->m_islandIndex; - m_indexB = m_bodyB->m_islandIndex; - m_localCenterA = m_bodyA->m_sweep.localCenter; - m_localCenterB = m_bodyB->m_sweep.localCenter; - m_invMassA = m_bodyA->m_invMass; - m_invMassB = m_bodyB->m_invMass; - m_invIA = m_bodyA->m_invI; - m_invIB = m_bodyB->m_invI; - - b2Vec2 cA = data.positions[m_indexA].c; - float32 aA = data.positions[m_indexA].a; - b2Vec2 vA = data.velocities[m_indexA].v; - float32 wA = data.velocities[m_indexA].w; - - b2Vec2 cB = data.positions[m_indexB].c; - float32 aB = data.positions[m_indexB].a; - b2Vec2 vB = data.velocities[m_indexB].v; - float32 wB = data.velocities[m_indexB].w; - - b2Rot qA(aA), qB(aB); - - m_rA = b2Mul(qA, m_localAnchorA - m_localCenterA); - m_rB = b2Mul(qB, m_localAnchorB - m_localCenterB); - - // Get the pulley axes. - m_uA = cA + m_rA - m_groundAnchorA; - m_uB = cB + m_rB - m_groundAnchorB; - - float32 lengthA = m_uA.Length(); - float32 lengthB = m_uB.Length(); - - if (lengthA > 10.0f * b2_linearSlop) - { - m_uA *= 1.0f / lengthA; - } - else - { - m_uA.SetZero(); - } - - if (lengthB > 10.0f * b2_linearSlop) - { - m_uB *= 1.0f / lengthB; - } - else - { - m_uB.SetZero(); - } - - // Compute effective mass. - float32 ruA = b2Cross(m_rA, m_uA); - float32 ruB = b2Cross(m_rB, m_uB); - - float32 mA = m_invMassA + m_invIA * ruA * ruA; - float32 mB = m_invMassB + m_invIB * ruB * ruB; - - m_mass = mA + m_ratio * m_ratio * mB; - - if (m_mass > 0.0f) - { - m_mass = 1.0f / m_mass; - } - - if (data.step.warmStarting) - { - // Scale impulses to support variable time steps. - m_impulse *= data.step.dtRatio; - - // Warm starting. - b2Vec2 PA = -(m_impulse) * m_uA; - b2Vec2 PB = (-m_ratio * m_impulse) * m_uB; - - vA += m_invMassA * PA; - wA += m_invIA * b2Cross(m_rA, PA); - vB += m_invMassB * PB; - wB += m_invIB * b2Cross(m_rB, PB); - } - else - { - m_impulse = 0.0f; - } - - data.velocities[m_indexA].v = vA; - data.velocities[m_indexA].w = wA; - data.velocities[m_indexB].v = vB; - data.velocities[m_indexB].w = wB; -} - -void b2PulleyJoint::SolveVelocityConstraints(const b2SolverData& data) -{ - b2Vec2 vA = data.velocities[m_indexA].v; - float32 wA = data.velocities[m_indexA].w; - b2Vec2 vB = data.velocities[m_indexB].v; - float32 wB = data.velocities[m_indexB].w; - - b2Vec2 vpA = vA + b2Cross(wA, m_rA); - b2Vec2 vpB = vB + b2Cross(wB, m_rB); - - float32 Cdot = -b2Dot(m_uA, vpA) - m_ratio * b2Dot(m_uB, vpB); - float32 impulse = -m_mass * Cdot; - m_impulse += impulse; - - b2Vec2 PA = -impulse * m_uA; - b2Vec2 PB = -m_ratio * impulse * m_uB; - vA += m_invMassA * PA; - wA += m_invIA * b2Cross(m_rA, PA); - vB += m_invMassB * PB; - wB += m_invIB * b2Cross(m_rB, PB); - - data.velocities[m_indexA].v = vA; - data.velocities[m_indexA].w = wA; - data.velocities[m_indexB].v = vB; - data.velocities[m_indexB].w = wB; -} - -bool b2PulleyJoint::SolvePositionConstraints(const b2SolverData& data) -{ - b2Vec2 cA = data.positions[m_indexA].c; - float32 aA = data.positions[m_indexA].a; - b2Vec2 cB = data.positions[m_indexB].c; - float32 aB = data.positions[m_indexB].a; - - b2Rot qA(aA), qB(aB); - - b2Vec2 rA = b2Mul(qA, m_localAnchorA - m_localCenterA); - b2Vec2 rB = b2Mul(qB, m_localAnchorB - m_localCenterB); - - // Get the pulley axes. - b2Vec2 uA = cA + rA - m_groundAnchorA; - b2Vec2 uB = cB + rB - m_groundAnchorB; - - float32 lengthA = uA.Length(); - float32 lengthB = uB.Length(); - - if (lengthA > 10.0f * b2_linearSlop) - { - uA *= 1.0f / lengthA; - } - else - { - uA.SetZero(); - } - - if (lengthB > 10.0f * b2_linearSlop) - { - uB *= 1.0f / lengthB; - } - else - { - uB.SetZero(); - } - - // Compute effective mass. - float32 ruA = b2Cross(rA, uA); - float32 ruB = b2Cross(rB, uB); - - float32 mA = m_invMassA + m_invIA * ruA * ruA; - float32 mB = m_invMassB + m_invIB * ruB * ruB; - - float32 mass = mA + m_ratio * m_ratio * mB; - - if (mass > 0.0f) - { - mass = 1.0f / mass; - } - - float32 C = m_constant - lengthA - m_ratio * lengthB; - float32 linearError = b2Abs(C); - - float32 impulse = -mass * C; - - b2Vec2 PA = -impulse * uA; - b2Vec2 PB = -m_ratio * impulse * uB; - - cA += m_invMassA * PA; - aA += m_invIA * b2Cross(rA, PA); - cB += m_invMassB * PB; - aB += m_invIB * b2Cross(rB, PB); - - data.positions[m_indexA].c = cA; - data.positions[m_indexA].a = aA; - data.positions[m_indexB].c = cB; - data.positions[m_indexB].a = aB; - - return linearError < b2_linearSlop; -} - -b2Vec2 b2PulleyJoint::GetAnchorA() const -{ - return m_bodyA->GetWorldPoint(m_localAnchorA); -} - -b2Vec2 b2PulleyJoint::GetAnchorB() const -{ - return m_bodyB->GetWorldPoint(m_localAnchorB); -} - -b2Vec2 b2PulleyJoint::GetReactionForce(float32 inv_dt) const -{ - b2Vec2 P = m_impulse * m_uB; - return inv_dt * P; -} - -float32 b2PulleyJoint::GetReactionTorque(float32 inv_dt) const -{ - B2_NOT_USED(inv_dt); - return 0.0f; -} - -b2Vec2 b2PulleyJoint::GetGroundAnchorA() const -{ - return m_groundAnchorA; -} - -b2Vec2 b2PulleyJoint::GetGroundAnchorB() const -{ - return m_groundAnchorB; -} - -float32 b2PulleyJoint::GetLengthA() const -{ - return m_lengthA; -} - -float32 b2PulleyJoint::GetLengthB() const -{ - return m_lengthB; -} - -float32 b2PulleyJoint::GetRatio() const -{ - return m_ratio; -} - -float32 b2PulleyJoint::GetCurrentLengthA() const -{ - b2Vec2 p = m_bodyA->GetWorldPoint(m_localAnchorA); - b2Vec2 s = m_groundAnchorA; - b2Vec2 d = p - s; - return d.Length(); -} - -float32 b2PulleyJoint::GetCurrentLengthB() const -{ - b2Vec2 p = m_bodyB->GetWorldPoint(m_localAnchorB); - b2Vec2 s = m_groundAnchorB; - b2Vec2 d = p - s; - return d.Length(); -} - -void b2PulleyJoint::Dump() -{ - int32 indexA = m_bodyA->m_islandIndex; - int32 indexB = m_bodyB->m_islandIndex; - - b2Log(" b2PulleyJointDef jd;\n"); - b2Log(" jd.bodyA = bodies[%d];\n", indexA); - b2Log(" jd.bodyB = bodies[%d];\n", indexB); - b2Log(" jd.collideConnected = bool(%d);\n", m_collideConnected); - b2Log(" jd.groundAnchorA.Set(%.15lef, %.15lef);\n", m_groundAnchorA.x, m_groundAnchorA.y); - b2Log(" jd.groundAnchorB.Set(%.15lef, %.15lef);\n", m_groundAnchorB.x, m_groundAnchorB.y); - b2Log(" jd.localAnchorA.Set(%.15lef, %.15lef);\n", m_localAnchorA.x, m_localAnchorA.y); - b2Log(" jd.localAnchorB.Set(%.15lef, %.15lef);\n", m_localAnchorB.x, m_localAnchorB.y); - b2Log(" jd.lengthA = %.15lef;\n", m_lengthA); - b2Log(" jd.lengthB = %.15lef;\n", m_lengthB); - b2Log(" jd.ratio = %.15lef;\n", m_ratio); - b2Log(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index); -} - -void b2PulleyJoint::ShiftOrigin(const b2Vec2& newOrigin) -{ - m_groundAnchorA -= newOrigin; - m_groundAnchorB -= newOrigin; -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2PulleyJoint.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2PulleyJoint.h deleted file mode 100644 index 44843e7b..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2PulleyJoint.h +++ /dev/null @@ -1,152 +0,0 @@ -/* -* Copyright (c) 2006-2011 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_PULLEY_JOINT_H -#define B2_PULLEY_JOINT_H - -#include - -const float32 b2_minPulleyLength = 2.0f; - -/// Pulley joint definition. This requires two ground anchors, -/// two dynamic body anchor points, and a pulley ratio. -struct b2PulleyJointDef : public b2JointDef -{ - b2PulleyJointDef() - { - type = e_pulleyJoint; - groundAnchorA.Set(-1.0f, 1.0f); - groundAnchorB.Set(1.0f, 1.0f); - localAnchorA.Set(-1.0f, 0.0f); - localAnchorB.Set(1.0f, 0.0f); - lengthA = 0.0f; - lengthB = 0.0f; - ratio = 1.0f; - collideConnected = true; - } - - /// Initialize the bodies, anchors, lengths, max lengths, and ratio using the world anchors. - void Initialize(b2Body* bodyA, b2Body* bodyB, - const b2Vec2& groundAnchorA, const b2Vec2& groundAnchorB, - const b2Vec2& anchorA, const b2Vec2& anchorB, - float32 ratio); - - /// The first ground anchor in world coordinates. This point never moves. - b2Vec2 groundAnchorA; - - /// The second ground anchor in world coordinates. This point never moves. - b2Vec2 groundAnchorB; - - /// The local anchor point relative to bodyA's origin. - b2Vec2 localAnchorA; - - /// The local anchor point relative to bodyB's origin. - b2Vec2 localAnchorB; - - /// The a reference length for the segment attached to bodyA. - float32 lengthA; - - /// The a reference length for the segment attached to bodyB. - float32 lengthB; - - /// The pulley ratio, used to simulate a block-and-tackle. - float32 ratio; -}; - -/// The pulley joint is connected to two bodies and two fixed ground points. -/// The pulley supports a ratio such that: -/// length1 + ratio * length2 <= constant -/// Yes, the force transmitted is scaled by the ratio. -/// Warning: the pulley joint can get a bit squirrelly by itself. They often -/// work better when combined with prismatic joints. You should also cover the -/// the anchor points with static shapes to prevent one side from going to -/// zero length. -class b2PulleyJoint : public b2Joint -{ -public: - b2Vec2 GetAnchorA() const; - b2Vec2 GetAnchorB() const; - - b2Vec2 GetReactionForce(float32 inv_dt) const; - float32 GetReactionTorque(float32 inv_dt) const; - - /// Get the first ground anchor. - b2Vec2 GetGroundAnchorA() const; - - /// Get the second ground anchor. - b2Vec2 GetGroundAnchorB() const; - - /// Get the current length of the segment attached to bodyA. - float32 GetLengthA() const; - - /// Get the current length of the segment attached to bodyB. - float32 GetLengthB() const; - - /// Get the pulley ratio. - float32 GetRatio() const; - - /// Get the current length of the segment attached to bodyA. - float32 GetCurrentLengthA() const; - - /// Get the current length of the segment attached to bodyB. - float32 GetCurrentLengthB() const; - - /// Dump joint to dmLog - void Dump(); - - /// Implement b2Joint::ShiftOrigin - void ShiftOrigin(const b2Vec2& newOrigin); - -protected: - - friend class b2Joint; - b2PulleyJoint(const b2PulleyJointDef* data); - - void InitVelocityConstraints(const b2SolverData& data); - void SolveVelocityConstraints(const b2SolverData& data); - bool SolvePositionConstraints(const b2SolverData& data); - - b2Vec2 m_groundAnchorA; - b2Vec2 m_groundAnchorB; - float32 m_lengthA; - float32 m_lengthB; - - // Solver shared - b2Vec2 m_localAnchorA; - b2Vec2 m_localAnchorB; - float32 m_constant; - float32 m_ratio; - float32 m_impulse; - - // Solver temp - int32 m_indexA; - int32 m_indexB; - b2Vec2 m_uA; - b2Vec2 m_uB; - b2Vec2 m_rA; - b2Vec2 m_rB; - b2Vec2 m_localCenterA; - b2Vec2 m_localCenterB; - float32 m_invMassA; - float32 m_invMassB; - float32 m_invIA; - float32 m_invIB; - float32 m_mass; -}; - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2RevoluteJoint.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2RevoluteJoint.cpp deleted file mode 100644 index 64bd1907..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2RevoluteJoint.cpp +++ /dev/null @@ -1,502 +0,0 @@ -/* -* Copyright (c) 2006-2011 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include - -// Point-to-point constraint -// C = p2 - p1 -// Cdot = v2 - v1 -// = v2 + cross(w2, r2) - v1 - cross(w1, r1) -// J = [-I -r1_skew I r2_skew ] -// Identity used: -// w k % (rx i + ry j) = w * (-ry i + rx j) - -// Motor constraint -// Cdot = w2 - w1 -// J = [0 0 -1 0 0 1] -// K = invI1 + invI2 - -void b2RevoluteJointDef::Initialize(b2Body* bA, b2Body* bB, const b2Vec2& anchor) -{ - bodyA = bA; - bodyB = bB; - localAnchorA = bodyA->GetLocalPoint(anchor); - localAnchorB = bodyB->GetLocalPoint(anchor); - referenceAngle = bodyB->GetAngle() - bodyA->GetAngle(); -} - -b2RevoluteJoint::b2RevoluteJoint(const b2RevoluteJointDef* def) -: b2Joint(def) -{ - m_localAnchorA = def->localAnchorA; - m_localAnchorB = def->localAnchorB; - m_referenceAngle = def->referenceAngle; - - m_impulse.SetZero(); - m_motorImpulse = 0.0f; - - m_lowerAngle = def->lowerAngle; - m_upperAngle = def->upperAngle; - m_maxMotorTorque = def->maxMotorTorque; - m_motorSpeed = def->motorSpeed; - m_enableLimit = def->enableLimit; - m_enableMotor = def->enableMotor; - m_limitState = e_inactiveLimit; -} - -void b2RevoluteJoint::InitVelocityConstraints(const b2SolverData& data) -{ - m_indexA = m_bodyA->m_islandIndex; - m_indexB = m_bodyB->m_islandIndex; - m_localCenterA = m_bodyA->m_sweep.localCenter; - m_localCenterB = m_bodyB->m_sweep.localCenter; - m_invMassA = m_bodyA->m_invMass; - m_invMassB = m_bodyB->m_invMass; - m_invIA = m_bodyA->m_invI; - m_invIB = m_bodyB->m_invI; - - float32 aA = data.positions[m_indexA].a; - b2Vec2 vA = data.velocities[m_indexA].v; - float32 wA = data.velocities[m_indexA].w; - - float32 aB = data.positions[m_indexB].a; - b2Vec2 vB = data.velocities[m_indexB].v; - float32 wB = data.velocities[m_indexB].w; - - b2Rot qA(aA), qB(aB); - - m_rA = b2Mul(qA, m_localAnchorA - m_localCenterA); - m_rB = b2Mul(qB, m_localAnchorB - m_localCenterB); - - // J = [-I -r1_skew I r2_skew] - // [ 0 -1 0 1] - // r_skew = [-ry; rx] - - // Matlab - // K = [ mA+r1y^2*iA+mB+r2y^2*iB, -r1y*iA*r1x-r2y*iB*r2x, -r1y*iA-r2y*iB] - // [ -r1y*iA*r1x-r2y*iB*r2x, mA+r1x^2*iA+mB+r2x^2*iB, r1x*iA+r2x*iB] - // [ -r1y*iA-r2y*iB, r1x*iA+r2x*iB, iA+iB] - - float32 mA = m_invMassA, mB = m_invMassB; - float32 iA = m_invIA, iB = m_invIB; - - bool fixedRotation = (iA + iB == 0.0f); - - m_mass.ex.x = mA + mB + m_rA.y * m_rA.y * iA + m_rB.y * m_rB.y * iB; - m_mass.ey.x = -m_rA.y * m_rA.x * iA - m_rB.y * m_rB.x * iB; - m_mass.ez.x = -m_rA.y * iA - m_rB.y * iB; - m_mass.ex.y = m_mass.ey.x; - m_mass.ey.y = mA + mB + m_rA.x * m_rA.x * iA + m_rB.x * m_rB.x * iB; - m_mass.ez.y = m_rA.x * iA + m_rB.x * iB; - m_mass.ex.z = m_mass.ez.x; - m_mass.ey.z = m_mass.ez.y; - m_mass.ez.z = iA + iB; - - m_motorMass = iA + iB; - if (m_motorMass > 0.0f) - { - m_motorMass = 1.0f / m_motorMass; - } - - if (m_enableMotor == false || fixedRotation) - { - m_motorImpulse = 0.0f; - } - - if (m_enableLimit && fixedRotation == false) - { - float32 jointAngle = aB - aA - m_referenceAngle; - if (b2Abs(m_upperAngle - m_lowerAngle) < 2.0f * b2_angularSlop) - { - m_limitState = e_equalLimits; - } - else if (jointAngle <= m_lowerAngle) - { - if (m_limitState != e_atLowerLimit) - { - m_impulse.z = 0.0f; - } - m_limitState = e_atLowerLimit; - } - else if (jointAngle >= m_upperAngle) - { - if (m_limitState != e_atUpperLimit) - { - m_impulse.z = 0.0f; - } - m_limitState = e_atUpperLimit; - } - else - { - m_limitState = e_inactiveLimit; - m_impulse.z = 0.0f; - } - } - else - { - m_limitState = e_inactiveLimit; - } - - if (data.step.warmStarting) - { - // Scale impulses to support a variable time step. - m_impulse *= data.step.dtRatio; - m_motorImpulse *= data.step.dtRatio; - - b2Vec2 P(m_impulse.x, m_impulse.y); - - vA -= mA * P; - wA -= iA * (b2Cross(m_rA, P) + m_motorImpulse + m_impulse.z); - - vB += mB * P; - wB += iB * (b2Cross(m_rB, P) + m_motorImpulse + m_impulse.z); - } - else - { - m_impulse.SetZero(); - m_motorImpulse = 0.0f; - } - - data.velocities[m_indexA].v = vA; - data.velocities[m_indexA].w = wA; - data.velocities[m_indexB].v = vB; - data.velocities[m_indexB].w = wB; -} - -void b2RevoluteJoint::SolveVelocityConstraints(const b2SolverData& data) -{ - b2Vec2 vA = data.velocities[m_indexA].v; - float32 wA = data.velocities[m_indexA].w; - b2Vec2 vB = data.velocities[m_indexB].v; - float32 wB = data.velocities[m_indexB].w; - - float32 mA = m_invMassA, mB = m_invMassB; - float32 iA = m_invIA, iB = m_invIB; - - bool fixedRotation = (iA + iB == 0.0f); - - // Solve motor constraint. - if (m_enableMotor && m_limitState != e_equalLimits && fixedRotation == false) - { - float32 Cdot = wB - wA - m_motorSpeed; - float32 impulse = -m_motorMass * Cdot; - float32 oldImpulse = m_motorImpulse; - float32 maxImpulse = data.step.dt * m_maxMotorTorque; - m_motorImpulse = b2Clamp(m_motorImpulse + impulse, -maxImpulse, maxImpulse); - impulse = m_motorImpulse - oldImpulse; - - wA -= iA * impulse; - wB += iB * impulse; - } - - // Solve limit constraint. - if (m_enableLimit && m_limitState != e_inactiveLimit && fixedRotation == false) - { - b2Vec2 Cdot1 = vB + b2Cross(wB, m_rB) - vA - b2Cross(wA, m_rA); - float32 Cdot2 = wB - wA; - b2Vec3 Cdot(Cdot1.x, Cdot1.y, Cdot2); - - b2Vec3 impulse = -m_mass.Solve33(Cdot); - - if (m_limitState == e_equalLimits) - { - m_impulse += impulse; - } - else if (m_limitState == e_atLowerLimit) - { - float32 newImpulse = m_impulse.z + impulse.z; - if (newImpulse < 0.0f) - { - b2Vec2 rhs = -Cdot1 + m_impulse.z * b2Vec2(m_mass.ez.x, m_mass.ez.y); - b2Vec2 reduced = m_mass.Solve22(rhs); - impulse.x = reduced.x; - impulse.y = reduced.y; - impulse.z = -m_impulse.z; - m_impulse.x += reduced.x; - m_impulse.y += reduced.y; - m_impulse.z = 0.0f; - } - else - { - m_impulse += impulse; - } - } - else if (m_limitState == e_atUpperLimit) - { - float32 newImpulse = m_impulse.z + impulse.z; - if (newImpulse > 0.0f) - { - b2Vec2 rhs = -Cdot1 + m_impulse.z * b2Vec2(m_mass.ez.x, m_mass.ez.y); - b2Vec2 reduced = m_mass.Solve22(rhs); - impulse.x = reduced.x; - impulse.y = reduced.y; - impulse.z = -m_impulse.z; - m_impulse.x += reduced.x; - m_impulse.y += reduced.y; - m_impulse.z = 0.0f; - } - else - { - m_impulse += impulse; - } - } - - b2Vec2 P(impulse.x, impulse.y); - - vA -= mA * P; - wA -= iA * (b2Cross(m_rA, P) + impulse.z); - - vB += mB * P; - wB += iB * (b2Cross(m_rB, P) + impulse.z); - } - else - { - // Solve point-to-point constraint - b2Vec2 Cdot = vB + b2Cross(wB, m_rB) - vA - b2Cross(wA, m_rA); - b2Vec2 impulse = m_mass.Solve22(-Cdot); - - m_impulse.x += impulse.x; - m_impulse.y += impulse.y; - - vA -= mA * impulse; - wA -= iA * b2Cross(m_rA, impulse); - - vB += mB * impulse; - wB += iB * b2Cross(m_rB, impulse); - } - - data.velocities[m_indexA].v = vA; - data.velocities[m_indexA].w = wA; - data.velocities[m_indexB].v = vB; - data.velocities[m_indexB].w = wB; -} - -bool b2RevoluteJoint::SolvePositionConstraints(const b2SolverData& data) -{ - b2Vec2 cA = data.positions[m_indexA].c; - float32 aA = data.positions[m_indexA].a; - b2Vec2 cB = data.positions[m_indexB].c; - float32 aB = data.positions[m_indexB].a; - - b2Rot qA(aA), qB(aB); - - float32 angularError = 0.0f; - float32 positionError = 0.0f; - - bool fixedRotation = (m_invIA + m_invIB == 0.0f); - - // Solve angular limit constraint. - if (m_enableLimit && m_limitState != e_inactiveLimit && fixedRotation == false) - { - float32 angle = aB - aA - m_referenceAngle; - float32 limitImpulse = 0.0f; - - if (m_limitState == e_equalLimits) - { - // Prevent large angular corrections - float32 C = b2Clamp(angle - m_lowerAngle, -b2_maxAngularCorrection, b2_maxAngularCorrection); - limitImpulse = -m_motorMass * C; - angularError = b2Abs(C); - } - else if (m_limitState == e_atLowerLimit) - { - float32 C = angle - m_lowerAngle; - angularError = -C; - - // Prevent large angular corrections and allow some slop. - C = b2Clamp(C + b2_angularSlop, -b2_maxAngularCorrection, 0.0f); - limitImpulse = -m_motorMass * C; - } - else if (m_limitState == e_atUpperLimit) - { - float32 C = angle - m_upperAngle; - angularError = C; - - // Prevent large angular corrections and allow some slop. - C = b2Clamp(C - b2_angularSlop, 0.0f, b2_maxAngularCorrection); - limitImpulse = -m_motorMass * C; - } - - aA -= m_invIA * limitImpulse; - aB += m_invIB * limitImpulse; - } - - // Solve point-to-point constraint. - { - qA.Set(aA); - qB.Set(aB); - b2Vec2 rA = b2Mul(qA, m_localAnchorA - m_localCenterA); - b2Vec2 rB = b2Mul(qB, m_localAnchorB - m_localCenterB); - - b2Vec2 C = cB + rB - cA - rA; - positionError = C.Length(); - - float32 mA = m_invMassA, mB = m_invMassB; - float32 iA = m_invIA, iB = m_invIB; - - b2Mat22 K; - K.ex.x = mA + mB + iA * rA.y * rA.y + iB * rB.y * rB.y; - K.ex.y = -iA * rA.x * rA.y - iB * rB.x * rB.y; - K.ey.x = K.ex.y; - K.ey.y = mA + mB + iA * rA.x * rA.x + iB * rB.x * rB.x; - - b2Vec2 impulse = -K.Solve(C); - - cA -= mA * impulse; - aA -= iA * b2Cross(rA, impulse); - - cB += mB * impulse; - aB += iB * b2Cross(rB, impulse); - } - - data.positions[m_indexA].c = cA; - data.positions[m_indexA].a = aA; - data.positions[m_indexB].c = cB; - data.positions[m_indexB].a = aB; - - return positionError <= b2_linearSlop && angularError <= b2_angularSlop; -} - -b2Vec2 b2RevoluteJoint::GetAnchorA() const -{ - return m_bodyA->GetWorldPoint(m_localAnchorA); -} - -b2Vec2 b2RevoluteJoint::GetAnchorB() const -{ - return m_bodyB->GetWorldPoint(m_localAnchorB); -} - -b2Vec2 b2RevoluteJoint::GetReactionForce(float32 inv_dt) const -{ - b2Vec2 P(m_impulse.x, m_impulse.y); - return inv_dt * P; -} - -float32 b2RevoluteJoint::GetReactionTorque(float32 inv_dt) const -{ - return inv_dt * m_impulse.z; -} - -float32 b2RevoluteJoint::GetJointAngle() const -{ - b2Body* bA = m_bodyA; - b2Body* bB = m_bodyB; - return bB->m_sweep.a - bA->m_sweep.a - m_referenceAngle; -} - -float32 b2RevoluteJoint::GetJointSpeed() const -{ - b2Body* bA = m_bodyA; - b2Body* bB = m_bodyB; - return bB->m_angularVelocity - bA->m_angularVelocity; -} - -bool b2RevoluteJoint::IsMotorEnabled() const -{ - return m_enableMotor; -} - -void b2RevoluteJoint::EnableMotor(bool flag) -{ - m_bodyA->SetAwake(true); - m_bodyB->SetAwake(true); - m_enableMotor = flag; -} - -float32 b2RevoluteJoint::GetMotorTorque(float32 inv_dt) const -{ - return inv_dt * m_motorImpulse; -} - -void b2RevoluteJoint::SetMotorSpeed(float32 speed) -{ - m_bodyA->SetAwake(true); - m_bodyB->SetAwake(true); - m_motorSpeed = speed; -} - -void b2RevoluteJoint::SetMaxMotorTorque(float32 torque) -{ - m_bodyA->SetAwake(true); - m_bodyB->SetAwake(true); - m_maxMotorTorque = torque; -} - -bool b2RevoluteJoint::IsLimitEnabled() const -{ - return m_enableLimit; -} - -void b2RevoluteJoint::EnableLimit(bool flag) -{ - if (flag != m_enableLimit) - { - m_bodyA->SetAwake(true); - m_bodyB->SetAwake(true); - m_enableLimit = flag; - m_impulse.z = 0.0f; - } -} - -float32 b2RevoluteJoint::GetLowerLimit() const -{ - return m_lowerAngle; -} - -float32 b2RevoluteJoint::GetUpperLimit() const -{ - return m_upperAngle; -} - -void b2RevoluteJoint::SetLimits(float32 lower, float32 upper) -{ - b2Assert(lower <= upper); - - if (lower != m_lowerAngle || upper != m_upperAngle) - { - m_bodyA->SetAwake(true); - m_bodyB->SetAwake(true); - m_impulse.z = 0.0f; - m_lowerAngle = lower; - m_upperAngle = upper; - } -} - -void b2RevoluteJoint::Dump() -{ - int32 indexA = m_bodyA->m_islandIndex; - int32 indexB = m_bodyB->m_islandIndex; - - b2Log(" b2RevoluteJointDef jd;\n"); - b2Log(" jd.bodyA = bodies[%d];\n", indexA); - b2Log(" jd.bodyB = bodies[%d];\n", indexB); - b2Log(" jd.collideConnected = bool(%d);\n", m_collideConnected); - b2Log(" jd.localAnchorA.Set(%.15lef, %.15lef);\n", m_localAnchorA.x, m_localAnchorA.y); - b2Log(" jd.localAnchorB.Set(%.15lef, %.15lef);\n", m_localAnchorB.x, m_localAnchorB.y); - b2Log(" jd.referenceAngle = %.15lef;\n", m_referenceAngle); - b2Log(" jd.enableLimit = bool(%d);\n", m_enableLimit); - b2Log(" jd.lowerAngle = %.15lef;\n", m_lowerAngle); - b2Log(" jd.upperAngle = %.15lef;\n", m_upperAngle); - b2Log(" jd.enableMotor = bool(%d);\n", m_enableMotor); - b2Log(" jd.motorSpeed = %.15lef;\n", m_motorSpeed); - b2Log(" jd.maxMotorTorque = %.15lef;\n", m_maxMotorTorque); - b2Log(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2RevoluteJoint.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2RevoluteJoint.h deleted file mode 100644 index bbed4a6c..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2RevoluteJoint.h +++ /dev/null @@ -1,204 +0,0 @@ -/* -* Copyright (c) 2006-2011 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_REVOLUTE_JOINT_H -#define B2_REVOLUTE_JOINT_H - -#include - -/// Revolute joint definition. This requires defining an -/// anchor point where the bodies are joined. The definition -/// uses local anchor points so that the initial configuration -/// can violate the constraint slightly. You also need to -/// specify the initial relative angle for joint limits. This -/// helps when saving and loading a game. -/// The local anchor points are measured from the body's origin -/// rather than the center of mass because: -/// 1. you might not know where the center of mass will be. -/// 2. if you add/remove shapes from a body and recompute the mass, -/// the joints will be broken. -struct b2RevoluteJointDef : public b2JointDef -{ - b2RevoluteJointDef() - { - type = e_revoluteJoint; - localAnchorA.Set(0.0f, 0.0f); - localAnchorB.Set(0.0f, 0.0f); - referenceAngle = 0.0f; - lowerAngle = 0.0f; - upperAngle = 0.0f; - maxMotorTorque = 0.0f; - motorSpeed = 0.0f; - enableLimit = false; - enableMotor = false; - } - - /// Initialize the bodies, anchors, and reference angle using a world - /// anchor point. - void Initialize(b2Body* bodyA, b2Body* bodyB, const b2Vec2& anchor); - - /// The local anchor point relative to bodyA's origin. - b2Vec2 localAnchorA; - - /// The local anchor point relative to bodyB's origin. - b2Vec2 localAnchorB; - - /// The bodyB angle minus bodyA angle in the reference state (radians). - float32 referenceAngle; - - /// A flag to enable joint limits. - bool enableLimit; - - /// The lower angle for the joint limit (radians). - float32 lowerAngle; - - /// The upper angle for the joint limit (radians). - float32 upperAngle; - - /// A flag to enable the joint motor. - bool enableMotor; - - /// The desired motor speed. Usually in radians per second. - float32 motorSpeed; - - /// The maximum motor torque used to achieve the desired motor speed. - /// Usually in N-m. - float32 maxMotorTorque; -}; - -/// A revolute joint constrains two bodies to share a common point while they -/// are free to rotate about the point. The relative rotation about the shared -/// point is the joint angle. You can limit the relative rotation with -/// a joint limit that specifies a lower and upper angle. You can use a motor -/// to drive the relative rotation about the shared point. A maximum motor torque -/// is provided so that infinite forces are not generated. -class b2RevoluteJoint : public b2Joint -{ -public: - b2Vec2 GetAnchorA() const; - b2Vec2 GetAnchorB() const; - - /// The local anchor point relative to bodyA's origin. - const b2Vec2& GetLocalAnchorA() const { return m_localAnchorA; } - - /// The local anchor point relative to bodyB's origin. - const b2Vec2& GetLocalAnchorB() const { return m_localAnchorB; } - - /// Get the reference angle. - float32 GetReferenceAngle() const { return m_referenceAngle; } - - /// Get the current joint angle in radians. - float32 GetJointAngle() const; - - /// Get the current joint angle speed in radians per second. - float32 GetJointSpeed() const; - - /// Is the joint limit enabled? - bool IsLimitEnabled() const; - - /// Enable/disable the joint limit. - void EnableLimit(bool flag); - - /// Get the lower joint limit in radians. - float32 GetLowerLimit() const; - - /// Get the upper joint limit in radians. - float32 GetUpperLimit() const; - - /// Set the joint limits in radians. - void SetLimits(float32 lower, float32 upper); - - /// Is the joint motor enabled? - bool IsMotorEnabled() const; - - /// Enable/disable the joint motor. - void EnableMotor(bool flag); - - /// Set the motor speed in radians per second. - void SetMotorSpeed(float32 speed); - - /// Get the motor speed in radians per second. - float32 GetMotorSpeed() const; - - /// Set the maximum motor torque, usually in N-m. - void SetMaxMotorTorque(float32 torque); - float32 GetMaxMotorTorque() const { return m_maxMotorTorque; } - - /// Get the reaction force given the inverse time step. - /// Unit is N. - b2Vec2 GetReactionForce(float32 inv_dt) const; - - /// Get the reaction torque due to the joint limit given the inverse time step. - /// Unit is N*m. - float32 GetReactionTorque(float32 inv_dt) const; - - /// Get the current motor torque given the inverse time step. - /// Unit is N*m. - float32 GetMotorTorque(float32 inv_dt) const; - - /// Dump to b2Log. - void Dump(); - -protected: - - friend class b2Joint; - friend class b2GearJoint; - - b2RevoluteJoint(const b2RevoluteJointDef* def); - - void InitVelocityConstraints(const b2SolverData& data); - void SolveVelocityConstraints(const b2SolverData& data); - bool SolvePositionConstraints(const b2SolverData& data); - - // Solver shared - b2Vec2 m_localAnchorA; - b2Vec2 m_localAnchorB; - b2Vec3 m_impulse; - float32 m_motorImpulse; - - bool m_enableMotor; - float32 m_maxMotorTorque; - float32 m_motorSpeed; - - bool m_enableLimit; - float32 m_referenceAngle; - float32 m_lowerAngle; - float32 m_upperAngle; - - // Solver temp - int32 m_indexA; - int32 m_indexB; - b2Vec2 m_rA; - b2Vec2 m_rB; - b2Vec2 m_localCenterA; - b2Vec2 m_localCenterB; - float32 m_invMassA; - float32 m_invMassB; - float32 m_invIA; - float32 m_invIB; - b2Mat33 m_mass; // effective mass for point-to-point constraint. - float32 m_motorMass; // effective mass for motor/limit angular constraint. - b2LimitState m_limitState; -}; - -inline float32 b2RevoluteJoint::GetMotorSpeed() const -{ - return m_motorSpeed; -} - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2RopeJoint.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2RopeJoint.cpp deleted file mode 100644 index 952ee7a3..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2RopeJoint.cpp +++ /dev/null @@ -1,241 +0,0 @@ -/* -* Copyright (c) 2007-2011 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include - - -// Limit: -// C = norm(pB - pA) - L -// u = (pB - pA) / norm(pB - pA) -// Cdot = dot(u, vB + cross(wB, rB) - vA - cross(wA, rA)) -// J = [-u -cross(rA, u) u cross(rB, u)] -// K = J * invM * JT -// = invMassA + invIA * cross(rA, u)^2 + invMassB + invIB * cross(rB, u)^2 - -b2RopeJoint::b2RopeJoint(const b2RopeJointDef* def) -: b2Joint(def) -{ - m_localAnchorA = def->localAnchorA; - m_localAnchorB = def->localAnchorB; - - m_maxLength = def->maxLength; - - m_mass = 0.0f; - m_impulse = 0.0f; - m_state = e_inactiveLimit; - m_length = 0.0f; -} - -void b2RopeJoint::InitVelocityConstraints(const b2SolverData& data) -{ - m_indexA = m_bodyA->m_islandIndex; - m_indexB = m_bodyB->m_islandIndex; - m_localCenterA = m_bodyA->m_sweep.localCenter; - m_localCenterB = m_bodyB->m_sweep.localCenter; - m_invMassA = m_bodyA->m_invMass; - m_invMassB = m_bodyB->m_invMass; - m_invIA = m_bodyA->m_invI; - m_invIB = m_bodyB->m_invI; - - b2Vec2 cA = data.positions[m_indexA].c; - float32 aA = data.positions[m_indexA].a; - b2Vec2 vA = data.velocities[m_indexA].v; - float32 wA = data.velocities[m_indexA].w; - - b2Vec2 cB = data.positions[m_indexB].c; - float32 aB = data.positions[m_indexB].a; - b2Vec2 vB = data.velocities[m_indexB].v; - float32 wB = data.velocities[m_indexB].w; - - b2Rot qA(aA), qB(aB); - - m_rA = b2Mul(qA, m_localAnchorA - m_localCenterA); - m_rB = b2Mul(qB, m_localAnchorB - m_localCenterB); - m_u = cB + m_rB - cA - m_rA; - - m_length = m_u.Length(); - - float32 C = m_length - m_maxLength; - if (C > 0.0f) - { - m_state = e_atUpperLimit; - } - else - { - m_state = e_inactiveLimit; - } - - if (m_length > b2_linearSlop) - { - m_u *= 1.0f / m_length; - } - else - { - m_u.SetZero(); - m_mass = 0.0f; - m_impulse = 0.0f; - return; - } - - // Compute effective mass. - float32 crA = b2Cross(m_rA, m_u); - float32 crB = b2Cross(m_rB, m_u); - float32 invMass = m_invMassA + m_invIA * crA * crA + m_invMassB + m_invIB * crB * crB; - - m_mass = invMass != 0.0f ? 1.0f / invMass : 0.0f; - - if (data.step.warmStarting) - { - // Scale the impulse to support a variable time step. - m_impulse *= data.step.dtRatio; - - b2Vec2 P = m_impulse * m_u; - vA -= m_invMassA * P; - wA -= m_invIA * b2Cross(m_rA, P); - vB += m_invMassB * P; - wB += m_invIB * b2Cross(m_rB, P); - } - else - { - m_impulse = 0.0f; - } - - data.velocities[m_indexA].v = vA; - data.velocities[m_indexA].w = wA; - data.velocities[m_indexB].v = vB; - data.velocities[m_indexB].w = wB; -} - -void b2RopeJoint::SolveVelocityConstraints(const b2SolverData& data) -{ - b2Vec2 vA = data.velocities[m_indexA].v; - float32 wA = data.velocities[m_indexA].w; - b2Vec2 vB = data.velocities[m_indexB].v; - float32 wB = data.velocities[m_indexB].w; - - // Cdot = dot(u, v + cross(w, r)) - b2Vec2 vpA = vA + b2Cross(wA, m_rA); - b2Vec2 vpB = vB + b2Cross(wB, m_rB); - float32 C = m_length - m_maxLength; - float32 Cdot = b2Dot(m_u, vpB - vpA); - - // Predictive constraint. - if (C < 0.0f) - { - Cdot += data.step.inv_dt * C; - } - - float32 impulse = -m_mass * Cdot; - float32 oldImpulse = m_impulse; - m_impulse = b2Min(0.0f, m_impulse + impulse); - impulse = m_impulse - oldImpulse; - - b2Vec2 P = impulse * m_u; - vA -= m_invMassA * P; - wA -= m_invIA * b2Cross(m_rA, P); - vB += m_invMassB * P; - wB += m_invIB * b2Cross(m_rB, P); - - data.velocities[m_indexA].v = vA; - data.velocities[m_indexA].w = wA; - data.velocities[m_indexB].v = vB; - data.velocities[m_indexB].w = wB; -} - -bool b2RopeJoint::SolvePositionConstraints(const b2SolverData& data) -{ - b2Vec2 cA = data.positions[m_indexA].c; - float32 aA = data.positions[m_indexA].a; - b2Vec2 cB = data.positions[m_indexB].c; - float32 aB = data.positions[m_indexB].a; - - b2Rot qA(aA), qB(aB); - - b2Vec2 rA = b2Mul(qA, m_localAnchorA - m_localCenterA); - b2Vec2 rB = b2Mul(qB, m_localAnchorB - m_localCenterB); - b2Vec2 u = cB + rB - cA - rA; - - float32 length = u.Normalize(); - float32 C = length - m_maxLength; - - C = b2Clamp(C, 0.0f, b2_maxLinearCorrection); - - float32 impulse = -m_mass * C; - b2Vec2 P = impulse * u; - - cA -= m_invMassA * P; - aA -= m_invIA * b2Cross(rA, P); - cB += m_invMassB * P; - aB += m_invIB * b2Cross(rB, P); - - data.positions[m_indexA].c = cA; - data.positions[m_indexA].a = aA; - data.positions[m_indexB].c = cB; - data.positions[m_indexB].a = aB; - - return length - m_maxLength < b2_linearSlop; -} - -b2Vec2 b2RopeJoint::GetAnchorA() const -{ - return m_bodyA->GetWorldPoint(m_localAnchorA); -} - -b2Vec2 b2RopeJoint::GetAnchorB() const -{ - return m_bodyB->GetWorldPoint(m_localAnchorB); -} - -b2Vec2 b2RopeJoint::GetReactionForce(float32 inv_dt) const -{ - b2Vec2 F = (inv_dt * m_impulse) * m_u; - return F; -} - -float32 b2RopeJoint::GetReactionTorque(float32 inv_dt) const -{ - B2_NOT_USED(inv_dt); - return 0.0f; -} - -float32 b2RopeJoint::GetMaxLength() const -{ - return m_maxLength; -} - -b2LimitState b2RopeJoint::GetLimitState() const -{ - return m_state; -} - -void b2RopeJoint::Dump() -{ - int32 indexA = m_bodyA->m_islandIndex; - int32 indexB = m_bodyB->m_islandIndex; - - b2Log(" b2RopeJointDef jd;\n"); - b2Log(" jd.bodyA = bodies[%d];\n", indexA); - b2Log(" jd.bodyB = bodies[%d];\n", indexB); - b2Log(" jd.collideConnected = bool(%d);\n", m_collideConnected); - b2Log(" jd.localAnchorA.Set(%.15lef, %.15lef);\n", m_localAnchorA.x, m_localAnchorA.y); - b2Log(" jd.localAnchorB.Set(%.15lef, %.15lef);\n", m_localAnchorB.x, m_localAnchorB.y); - b2Log(" jd.maxLength = %.15lef;\n", m_maxLength); - b2Log(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2RopeJoint.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2RopeJoint.h deleted file mode 100644 index eaca575d..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2RopeJoint.h +++ /dev/null @@ -1,114 +0,0 @@ -/* -* Copyright (c) 2006-2011 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_ROPE_JOINT_H -#define B2_ROPE_JOINT_H - -#include - -/// Rope joint definition. This requires two body anchor points and -/// a maximum lengths. -/// Note: by default the connected objects will not collide. -/// see collideConnected in b2JointDef. -struct b2RopeJointDef : public b2JointDef -{ - b2RopeJointDef() - { - type = e_ropeJoint; - localAnchorA.Set(-1.0f, 0.0f); - localAnchorB.Set(1.0f, 0.0f); - maxLength = 0.0f; - } - - /// The local anchor point relative to bodyA's origin. - b2Vec2 localAnchorA; - - /// The local anchor point relative to bodyB's origin. - b2Vec2 localAnchorB; - - /// The maximum length of the rope. - /// Warning: this must be larger than b2_linearSlop or - /// the joint will have no effect. - float32 maxLength; -}; - -/// A rope joint enforces a maximum distance between two points -/// on two bodies. It has no other effect. -/// Warning: if you attempt to change the maximum length during -/// the simulation you will get some non-physical behavior. -/// A model that would allow you to dynamically modify the length -/// would have some sponginess, so I chose not to implement it -/// that way. See b2DistanceJoint if you want to dynamically -/// control length. -class b2RopeJoint : public b2Joint -{ -public: - b2Vec2 GetAnchorA() const; - b2Vec2 GetAnchorB() const; - - b2Vec2 GetReactionForce(float32 inv_dt) const; - float32 GetReactionTorque(float32 inv_dt) const; - - /// The local anchor point relative to bodyA's origin. - const b2Vec2& GetLocalAnchorA() const { return m_localAnchorA; } - - /// The local anchor point relative to bodyB's origin. - const b2Vec2& GetLocalAnchorB() const { return m_localAnchorB; } - - /// Set/Get the maximum length of the rope. - void SetMaxLength(float32 length) { m_maxLength = length; } - float32 GetMaxLength() const; - - b2LimitState GetLimitState() const; - - /// Dump joint to dmLog - void Dump(); - -protected: - - friend class b2Joint; - b2RopeJoint(const b2RopeJointDef* data); - - void InitVelocityConstraints(const b2SolverData& data); - void SolveVelocityConstraints(const b2SolverData& data); - bool SolvePositionConstraints(const b2SolverData& data); - - // Solver shared - b2Vec2 m_localAnchorA; - b2Vec2 m_localAnchorB; - float32 m_maxLength; - float32 m_length; - float32 m_impulse; - - // Solver temp - int32 m_indexA; - int32 m_indexB; - b2Vec2 m_u; - b2Vec2 m_rA; - b2Vec2 m_rB; - b2Vec2 m_localCenterA; - b2Vec2 m_localCenterB; - float32 m_invMassA; - float32 m_invMassB; - float32 m_invIA; - float32 m_invIB; - float32 m_mass; - b2LimitState m_state; -}; - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2WeldJoint.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2WeldJoint.cpp deleted file mode 100644 index ffdd386b..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2WeldJoint.cpp +++ /dev/null @@ -1,344 +0,0 @@ -/* -* Copyright (c) 2006-2011 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include - -// Point-to-point constraint -// C = p2 - p1 -// Cdot = v2 - v1 -// = v2 + cross(w2, r2) - v1 - cross(w1, r1) -// J = [-I -r1_skew I r2_skew ] -// Identity used: -// w k % (rx i + ry j) = w * (-ry i + rx j) - -// Angle constraint -// C = angle2 - angle1 - referenceAngle -// Cdot = w2 - w1 -// J = [0 0 -1 0 0 1] -// K = invI1 + invI2 - -void b2WeldJointDef::Initialize(b2Body* bA, b2Body* bB, const b2Vec2& anchor) -{ - bodyA = bA; - bodyB = bB; - localAnchorA = bodyA->GetLocalPoint(anchor); - localAnchorB = bodyB->GetLocalPoint(anchor); - referenceAngle = bodyB->GetAngle() - bodyA->GetAngle(); -} - -b2WeldJoint::b2WeldJoint(const b2WeldJointDef* def) -: b2Joint(def) -{ - m_localAnchorA = def->localAnchorA; - m_localAnchorB = def->localAnchorB; - m_referenceAngle = def->referenceAngle; - m_frequencyHz = def->frequencyHz; - m_dampingRatio = def->dampingRatio; - - m_impulse.SetZero(); -} - -void b2WeldJoint::InitVelocityConstraints(const b2SolverData& data) -{ - m_indexA = m_bodyA->m_islandIndex; - m_indexB = m_bodyB->m_islandIndex; - m_localCenterA = m_bodyA->m_sweep.localCenter; - m_localCenterB = m_bodyB->m_sweep.localCenter; - m_invMassA = m_bodyA->m_invMass; - m_invMassB = m_bodyB->m_invMass; - m_invIA = m_bodyA->m_invI; - m_invIB = m_bodyB->m_invI; - - float32 aA = data.positions[m_indexA].a; - b2Vec2 vA = data.velocities[m_indexA].v; - float32 wA = data.velocities[m_indexA].w; - - float32 aB = data.positions[m_indexB].a; - b2Vec2 vB = data.velocities[m_indexB].v; - float32 wB = data.velocities[m_indexB].w; - - b2Rot qA(aA), qB(aB); - - m_rA = b2Mul(qA, m_localAnchorA - m_localCenterA); - m_rB = b2Mul(qB, m_localAnchorB - m_localCenterB); - - // J = [-I -r1_skew I r2_skew] - // [ 0 -1 0 1] - // r_skew = [-ry; rx] - - // Matlab - // K = [ mA+r1y^2*iA+mB+r2y^2*iB, -r1y*iA*r1x-r2y*iB*r2x, -r1y*iA-r2y*iB] - // [ -r1y*iA*r1x-r2y*iB*r2x, mA+r1x^2*iA+mB+r2x^2*iB, r1x*iA+r2x*iB] - // [ -r1y*iA-r2y*iB, r1x*iA+r2x*iB, iA+iB] - - float32 mA = m_invMassA, mB = m_invMassB; - float32 iA = m_invIA, iB = m_invIB; - - b2Mat33 K; - K.ex.x = mA + mB + m_rA.y * m_rA.y * iA + m_rB.y * m_rB.y * iB; - K.ey.x = -m_rA.y * m_rA.x * iA - m_rB.y * m_rB.x * iB; - K.ez.x = -m_rA.y * iA - m_rB.y * iB; - K.ex.y = K.ey.x; - K.ey.y = mA + mB + m_rA.x * m_rA.x * iA + m_rB.x * m_rB.x * iB; - K.ez.y = m_rA.x * iA + m_rB.x * iB; - K.ex.z = K.ez.x; - K.ey.z = K.ez.y; - K.ez.z = iA + iB; - - if (m_frequencyHz > 0.0f) - { - K.GetInverse22(&m_mass); - - float32 invM = iA + iB; - float32 m = invM > 0.0f ? 1.0f / invM : 0.0f; - - float32 C = aB - aA - m_referenceAngle; - - // Frequency - float32 omega = 2.0f * b2_pi * m_frequencyHz; - - // Damping coefficient - float32 d = 2.0f * m * m_dampingRatio * omega; - - // Spring stiffness - float32 k = m * omega * omega; - - // magic formulas - float32 h = data.step.dt; - m_gamma = h * (d + h * k); - m_gamma = m_gamma != 0.0f ? 1.0f / m_gamma : 0.0f; - m_bias = C * h * k * m_gamma; - - invM += m_gamma; - m_mass.ez.z = invM != 0.0f ? 1.0f / invM : 0.0f; - } - else if (K.ez.z == 0.0f) - { - K.GetInverse22(&m_mass); - m_gamma = 0.0f; - m_bias = 0.0f; - } - else - { - K.GetSymInverse33(&m_mass); - m_gamma = 0.0f; - m_bias = 0.0f; - } - - if (data.step.warmStarting) - { - // Scale impulses to support a variable time step. - m_impulse *= data.step.dtRatio; - - b2Vec2 P(m_impulse.x, m_impulse.y); - - vA -= mA * P; - wA -= iA * (b2Cross(m_rA, P) + m_impulse.z); - - vB += mB * P; - wB += iB * (b2Cross(m_rB, P) + m_impulse.z); - } - else - { - m_impulse.SetZero(); - } - - data.velocities[m_indexA].v = vA; - data.velocities[m_indexA].w = wA; - data.velocities[m_indexB].v = vB; - data.velocities[m_indexB].w = wB; -} - -void b2WeldJoint::SolveVelocityConstraints(const b2SolverData& data) -{ - b2Vec2 vA = data.velocities[m_indexA].v; - float32 wA = data.velocities[m_indexA].w; - b2Vec2 vB = data.velocities[m_indexB].v; - float32 wB = data.velocities[m_indexB].w; - - float32 mA = m_invMassA, mB = m_invMassB; - float32 iA = m_invIA, iB = m_invIB; - - if (m_frequencyHz > 0.0f) - { - float32 Cdot2 = wB - wA; - - float32 impulse2 = -m_mass.ez.z * (Cdot2 + m_bias + m_gamma * m_impulse.z); - m_impulse.z += impulse2; - - wA -= iA * impulse2; - wB += iB * impulse2; - - b2Vec2 Cdot1 = vB + b2Cross(wB, m_rB) - vA - b2Cross(wA, m_rA); - - b2Vec2 impulse1 = -b2Mul22(m_mass, Cdot1); - m_impulse.x += impulse1.x; - m_impulse.y += impulse1.y; - - b2Vec2 P = impulse1; - - vA -= mA * P; - wA -= iA * b2Cross(m_rA, P); - - vB += mB * P; - wB += iB * b2Cross(m_rB, P); - } - else - { - b2Vec2 Cdot1 = vB + b2Cross(wB, m_rB) - vA - b2Cross(wA, m_rA); - float32 Cdot2 = wB - wA; - b2Vec3 Cdot(Cdot1.x, Cdot1.y, Cdot2); - - b2Vec3 impulse = -b2Mul(m_mass, Cdot); - m_impulse += impulse; - - b2Vec2 P(impulse.x, impulse.y); - - vA -= mA * P; - wA -= iA * (b2Cross(m_rA, P) + impulse.z); - - vB += mB * P; - wB += iB * (b2Cross(m_rB, P) + impulse.z); - } - - data.velocities[m_indexA].v = vA; - data.velocities[m_indexA].w = wA; - data.velocities[m_indexB].v = vB; - data.velocities[m_indexB].w = wB; -} - -bool b2WeldJoint::SolvePositionConstraints(const b2SolverData& data) -{ - b2Vec2 cA = data.positions[m_indexA].c; - float32 aA = data.positions[m_indexA].a; - b2Vec2 cB = data.positions[m_indexB].c; - float32 aB = data.positions[m_indexB].a; - - b2Rot qA(aA), qB(aB); - - float32 mA = m_invMassA, mB = m_invMassB; - float32 iA = m_invIA, iB = m_invIB; - - b2Vec2 rA = b2Mul(qA, m_localAnchorA - m_localCenterA); - b2Vec2 rB = b2Mul(qB, m_localAnchorB - m_localCenterB); - - float32 positionError, angularError; - - b2Mat33 K; - K.ex.x = mA + mB + rA.y * rA.y * iA + rB.y * rB.y * iB; - K.ey.x = -rA.y * rA.x * iA - rB.y * rB.x * iB; - K.ez.x = -rA.y * iA - rB.y * iB; - K.ex.y = K.ey.x; - K.ey.y = mA + mB + rA.x * rA.x * iA + rB.x * rB.x * iB; - K.ez.y = rA.x * iA + rB.x * iB; - K.ex.z = K.ez.x; - K.ey.z = K.ez.y; - K.ez.z = iA + iB; - - if (m_frequencyHz > 0.0f) - { - b2Vec2 C1 = cB + rB - cA - rA; - - positionError = C1.Length(); - angularError = 0.0f; - - b2Vec2 P = -K.Solve22(C1); - - cA -= mA * P; - aA -= iA * b2Cross(rA, P); - - cB += mB * P; - aB += iB * b2Cross(rB, P); - } - else - { - b2Vec2 C1 = cB + rB - cA - rA; - float32 C2 = aB - aA - m_referenceAngle; - - positionError = C1.Length(); - angularError = b2Abs(C2); - - b2Vec3 C(C1.x, C1.y, C2); - - b2Vec3 impulse; - if (K.ez.z > 0.0f) - { - impulse = -K.Solve33(C); - } - else - { - b2Vec2 impulse2 = -K.Solve22(C1); - impulse.Set(impulse2.x, impulse2.y, 0.0f); - } - - b2Vec2 P(impulse.x, impulse.y); - - cA -= mA * P; - aA -= iA * (b2Cross(rA, P) + impulse.z); - - cB += mB * P; - aB += iB * (b2Cross(rB, P) + impulse.z); - } - - data.positions[m_indexA].c = cA; - data.positions[m_indexA].a = aA; - data.positions[m_indexB].c = cB; - data.positions[m_indexB].a = aB; - - return positionError <= b2_linearSlop && angularError <= b2_angularSlop; -} - -b2Vec2 b2WeldJoint::GetAnchorA() const -{ - return m_bodyA->GetWorldPoint(m_localAnchorA); -} - -b2Vec2 b2WeldJoint::GetAnchorB() const -{ - return m_bodyB->GetWorldPoint(m_localAnchorB); -} - -b2Vec2 b2WeldJoint::GetReactionForce(float32 inv_dt) const -{ - b2Vec2 P(m_impulse.x, m_impulse.y); - return inv_dt * P; -} - -float32 b2WeldJoint::GetReactionTorque(float32 inv_dt) const -{ - return inv_dt * m_impulse.z; -} - -void b2WeldJoint::Dump() -{ - int32 indexA = m_bodyA->m_islandIndex; - int32 indexB = m_bodyB->m_islandIndex; - - b2Log(" b2WeldJointDef jd;\n"); - b2Log(" jd.bodyA = bodies[%d];\n", indexA); - b2Log(" jd.bodyB = bodies[%d];\n", indexB); - b2Log(" jd.collideConnected = bool(%d);\n", m_collideConnected); - b2Log(" jd.localAnchorA.Set(%.15lef, %.15lef);\n", m_localAnchorA.x, m_localAnchorA.y); - b2Log(" jd.localAnchorB.Set(%.15lef, %.15lef);\n", m_localAnchorB.x, m_localAnchorB.y); - b2Log(" jd.referenceAngle = %.15lef;\n", m_referenceAngle); - b2Log(" jd.frequencyHz = %.15lef;\n", m_frequencyHz); - b2Log(" jd.dampingRatio = %.15lef;\n", m_dampingRatio); - b2Log(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2WeldJoint.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2WeldJoint.h deleted file mode 100644 index eed9bc10..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2WeldJoint.h +++ /dev/null @@ -1,126 +0,0 @@ -/* -* Copyright (c) 2006-2011 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_WELD_JOINT_H -#define B2_WELD_JOINT_H - -#include - -/// Weld joint definition. You need to specify local anchor points -/// where they are attached and the relative body angle. The position -/// of the anchor points is important for computing the reaction torque. -struct b2WeldJointDef : public b2JointDef -{ - b2WeldJointDef() - { - type = e_weldJoint; - localAnchorA.Set(0.0f, 0.0f); - localAnchorB.Set(0.0f, 0.0f); - referenceAngle = 0.0f; - frequencyHz = 0.0f; - dampingRatio = 0.0f; - } - - /// Initialize the bodies, anchors, and reference angle using a world - /// anchor point. - void Initialize(b2Body* bodyA, b2Body* bodyB, const b2Vec2& anchor); - - /// The local anchor point relative to bodyA's origin. - b2Vec2 localAnchorA; - - /// The local anchor point relative to bodyB's origin. - b2Vec2 localAnchorB; - - /// The bodyB angle minus bodyA angle in the reference state (radians). - float32 referenceAngle; - - /// The mass-spring-damper frequency in Hertz. Rotation only. - /// Disable softness with a value of 0. - float32 frequencyHz; - - /// The damping ratio. 0 = no damping, 1 = critical damping. - float32 dampingRatio; -}; - -/// A weld joint essentially glues two bodies together. A weld joint may -/// distort somewhat because the island constraint solver is approximate. -class b2WeldJoint : public b2Joint -{ -public: - b2Vec2 GetAnchorA() const; - b2Vec2 GetAnchorB() const; - - b2Vec2 GetReactionForce(float32 inv_dt) const; - float32 GetReactionTorque(float32 inv_dt) const; - - /// The local anchor point relative to bodyA's origin. - const b2Vec2& GetLocalAnchorA() const { return m_localAnchorA; } - - /// The local anchor point relative to bodyB's origin. - const b2Vec2& GetLocalAnchorB() const { return m_localAnchorB; } - - /// Get the reference angle. - float32 GetReferenceAngle() const { return m_referenceAngle; } - - /// Set/get frequency in Hz. - void SetFrequency(float32 hz) { m_frequencyHz = hz; } - float32 GetFrequency() const { return m_frequencyHz; } - - /// Set/get damping ratio. - void SetDampingRatio(float32 ratio) { m_dampingRatio = ratio; } - float32 GetDampingRatio() const { return m_dampingRatio; } - - /// Dump to b2Log - void Dump(); - -protected: - - friend class b2Joint; - - b2WeldJoint(const b2WeldJointDef* def); - - void InitVelocityConstraints(const b2SolverData& data); - void SolveVelocityConstraints(const b2SolverData& data); - bool SolvePositionConstraints(const b2SolverData& data); - - float32 m_frequencyHz; - float32 m_dampingRatio; - float32 m_bias; - - // Solver shared - b2Vec2 m_localAnchorA; - b2Vec2 m_localAnchorB; - float32 m_referenceAngle; - float32 m_gamma; - b2Vec3 m_impulse; - - // Solver temp - int32 m_indexA; - int32 m_indexB; - b2Vec2 m_rA; - b2Vec2 m_rB; - b2Vec2 m_localCenterA; - b2Vec2 m_localCenterB; - float32 m_invMassA; - float32 m_invMassB; - float32 m_invIA; - float32 m_invIB; - b2Mat33 m_mass; -}; - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2WheelJoint.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2WheelJoint.cpp deleted file mode 100644 index c9f6de60..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2WheelJoint.cpp +++ /dev/null @@ -1,419 +0,0 @@ -/* -* Copyright (c) 2006-2007 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include - -// Linear constraint (point-to-line) -// d = pB - pA = xB + rB - xA - rA -// C = dot(ay, d) -// Cdot = dot(d, cross(wA, ay)) + dot(ay, vB + cross(wB, rB) - vA - cross(wA, rA)) -// = -dot(ay, vA) - dot(cross(d + rA, ay), wA) + dot(ay, vB) + dot(cross(rB, ay), vB) -// J = [-ay, -cross(d + rA, ay), ay, cross(rB, ay)] - -// Spring linear constraint -// C = dot(ax, d) -// Cdot = = -dot(ax, vA) - dot(cross(d + rA, ax), wA) + dot(ax, vB) + dot(cross(rB, ax), vB) -// J = [-ax -cross(d+rA, ax) ax cross(rB, ax)] - -// Motor rotational constraint -// Cdot = wB - wA -// J = [0 0 -1 0 0 1] - -void b2WheelJointDef::Initialize(b2Body* bA, b2Body* bB, const b2Vec2& anchor, const b2Vec2& axis) -{ - bodyA = bA; - bodyB = bB; - localAnchorA = bodyA->GetLocalPoint(anchor); - localAnchorB = bodyB->GetLocalPoint(anchor); - localAxisA = bodyA->GetLocalVector(axis); -} - -b2WheelJoint::b2WheelJoint(const b2WheelJointDef* def) -: b2Joint(def) -{ - m_localAnchorA = def->localAnchorA; - m_localAnchorB = def->localAnchorB; - m_localXAxisA = def->localAxisA; - m_localYAxisA = b2Cross(1.0f, m_localXAxisA); - - m_mass = 0.0f; - m_impulse = 0.0f; - m_motorMass = 0.0f; - m_motorImpulse = 0.0f; - m_springMass = 0.0f; - m_springImpulse = 0.0f; - - m_maxMotorTorque = def->maxMotorTorque; - m_motorSpeed = def->motorSpeed; - m_enableMotor = def->enableMotor; - - m_frequencyHz = def->frequencyHz; - m_dampingRatio = def->dampingRatio; - - m_bias = 0.0f; - m_gamma = 0.0f; - - m_ax.SetZero(); - m_ay.SetZero(); -} - -void b2WheelJoint::InitVelocityConstraints(const b2SolverData& data) -{ - m_indexA = m_bodyA->m_islandIndex; - m_indexB = m_bodyB->m_islandIndex; - m_localCenterA = m_bodyA->m_sweep.localCenter; - m_localCenterB = m_bodyB->m_sweep.localCenter; - m_invMassA = m_bodyA->m_invMass; - m_invMassB = m_bodyB->m_invMass; - m_invIA = m_bodyA->m_invI; - m_invIB = m_bodyB->m_invI; - - float32 mA = m_invMassA, mB = m_invMassB; - float32 iA = m_invIA, iB = m_invIB; - - b2Vec2 cA = data.positions[m_indexA].c; - float32 aA = data.positions[m_indexA].a; - b2Vec2 vA = data.velocities[m_indexA].v; - float32 wA = data.velocities[m_indexA].w; - - b2Vec2 cB = data.positions[m_indexB].c; - float32 aB = data.positions[m_indexB].a; - b2Vec2 vB = data.velocities[m_indexB].v; - float32 wB = data.velocities[m_indexB].w; - - b2Rot qA(aA), qB(aB); - - // Compute the effective masses. - b2Vec2 rA = b2Mul(qA, m_localAnchorA - m_localCenterA); - b2Vec2 rB = b2Mul(qB, m_localAnchorB - m_localCenterB); - b2Vec2 d = cB + rB - cA - rA; - - // Point to line constraint - { - m_ay = b2Mul(qA, m_localYAxisA); - m_sAy = b2Cross(d + rA, m_ay); - m_sBy = b2Cross(rB, m_ay); - - m_mass = mA + mB + iA * m_sAy * m_sAy + iB * m_sBy * m_sBy; - - if (m_mass > 0.0f) - { - m_mass = 1.0f / m_mass; - } - } - - // Spring constraint - m_springMass = 0.0f; - m_bias = 0.0f; - m_gamma = 0.0f; - if (m_frequencyHz > 0.0f) - { - m_ax = b2Mul(qA, m_localXAxisA); - m_sAx = b2Cross(d + rA, m_ax); - m_sBx = b2Cross(rB, m_ax); - - float32 invMass = mA + mB + iA * m_sAx * m_sAx + iB * m_sBx * m_sBx; - - if (invMass > 0.0f) - { - m_springMass = 1.0f / invMass; - - float32 C = b2Dot(d, m_ax); - - // Frequency - float32 omega = 2.0f * b2_pi * m_frequencyHz; - - // Damping coefficient - float32 d = 2.0f * m_springMass * m_dampingRatio * omega; - - // Spring stiffness - float32 k = m_springMass * omega * omega; - - // magic formulas - float32 h = data.step.dt; - m_gamma = h * (d + h * k); - if (m_gamma > 0.0f) - { - m_gamma = 1.0f / m_gamma; - } - - m_bias = C * h * k * m_gamma; - - m_springMass = invMass + m_gamma; - if (m_springMass > 0.0f) - { - m_springMass = 1.0f / m_springMass; - } - } - } - else - { - m_springImpulse = 0.0f; - } - - // Rotational motor - if (m_enableMotor) - { - m_motorMass = iA + iB; - if (m_motorMass > 0.0f) - { - m_motorMass = 1.0f / m_motorMass; - } - } - else - { - m_motorMass = 0.0f; - m_motorImpulse = 0.0f; - } - - if (data.step.warmStarting) - { - // Account for variable time step. - m_impulse *= data.step.dtRatio; - m_springImpulse *= data.step.dtRatio; - m_motorImpulse *= data.step.dtRatio; - - b2Vec2 P = m_impulse * m_ay + m_springImpulse * m_ax; - float32 LA = m_impulse * m_sAy + m_springImpulse * m_sAx + m_motorImpulse; - float32 LB = m_impulse * m_sBy + m_springImpulse * m_sBx + m_motorImpulse; - - vA -= m_invMassA * P; - wA -= m_invIA * LA; - - vB += m_invMassB * P; - wB += m_invIB * LB; - } - else - { - m_impulse = 0.0f; - m_springImpulse = 0.0f; - m_motorImpulse = 0.0f; - } - - data.velocities[m_indexA].v = vA; - data.velocities[m_indexA].w = wA; - data.velocities[m_indexB].v = vB; - data.velocities[m_indexB].w = wB; -} - -void b2WheelJoint::SolveVelocityConstraints(const b2SolverData& data) -{ - float32 mA = m_invMassA, mB = m_invMassB; - float32 iA = m_invIA, iB = m_invIB; - - b2Vec2 vA = data.velocities[m_indexA].v; - float32 wA = data.velocities[m_indexA].w; - b2Vec2 vB = data.velocities[m_indexB].v; - float32 wB = data.velocities[m_indexB].w; - - // Solve spring constraint - { - float32 Cdot = b2Dot(m_ax, vB - vA) + m_sBx * wB - m_sAx * wA; - float32 impulse = -m_springMass * (Cdot + m_bias + m_gamma * m_springImpulse); - m_springImpulse += impulse; - - b2Vec2 P = impulse * m_ax; - float32 LA = impulse * m_sAx; - float32 LB = impulse * m_sBx; - - vA -= mA * P; - wA -= iA * LA; - - vB += mB * P; - wB += iB * LB; - } - - // Solve rotational motor constraint - { - float32 Cdot = wB - wA - m_motorSpeed; - float32 impulse = -m_motorMass * Cdot; - - float32 oldImpulse = m_motorImpulse; - float32 maxImpulse = data.step.dt * m_maxMotorTorque; - m_motorImpulse = b2Clamp(m_motorImpulse + impulse, -maxImpulse, maxImpulse); - impulse = m_motorImpulse - oldImpulse; - - wA -= iA * impulse; - wB += iB * impulse; - } - - // Solve point to line constraint - { - float32 Cdot = b2Dot(m_ay, vB - vA) + m_sBy * wB - m_sAy * wA; - float32 impulse = -m_mass * Cdot; - m_impulse += impulse; - - b2Vec2 P = impulse * m_ay; - float32 LA = impulse * m_sAy; - float32 LB = impulse * m_sBy; - - vA -= mA * P; - wA -= iA * LA; - - vB += mB * P; - wB += iB * LB; - } - - data.velocities[m_indexA].v = vA; - data.velocities[m_indexA].w = wA; - data.velocities[m_indexB].v = vB; - data.velocities[m_indexB].w = wB; -} - -bool b2WheelJoint::SolvePositionConstraints(const b2SolverData& data) -{ - b2Vec2 cA = data.positions[m_indexA].c; - float32 aA = data.positions[m_indexA].a; - b2Vec2 cB = data.positions[m_indexB].c; - float32 aB = data.positions[m_indexB].a; - - b2Rot qA(aA), qB(aB); - - b2Vec2 rA = b2Mul(qA, m_localAnchorA - m_localCenterA); - b2Vec2 rB = b2Mul(qB, m_localAnchorB - m_localCenterB); - b2Vec2 d = (cB - cA) + rB - rA; - - b2Vec2 ay = b2Mul(qA, m_localYAxisA); - - float32 sAy = b2Cross(d + rA, ay); - float32 sBy = b2Cross(rB, ay); - - float32 C = b2Dot(d, ay); - - float32 k = m_invMassA + m_invMassB + m_invIA * m_sAy * m_sAy + m_invIB * m_sBy * m_sBy; - - float32 impulse; - if (k != 0.0f) - { - impulse = - C / k; - } - else - { - impulse = 0.0f; - } - - b2Vec2 P = impulse * ay; - float32 LA = impulse * sAy; - float32 LB = impulse * sBy; - - cA -= m_invMassA * P; - aA -= m_invIA * LA; - cB += m_invMassB * P; - aB += m_invIB * LB; - - data.positions[m_indexA].c = cA; - data.positions[m_indexA].a = aA; - data.positions[m_indexB].c = cB; - data.positions[m_indexB].a = aB; - - return b2Abs(C) <= b2_linearSlop; -} - -b2Vec2 b2WheelJoint::GetAnchorA() const -{ - return m_bodyA->GetWorldPoint(m_localAnchorA); -} - -b2Vec2 b2WheelJoint::GetAnchorB() const -{ - return m_bodyB->GetWorldPoint(m_localAnchorB); -} - -b2Vec2 b2WheelJoint::GetReactionForce(float32 inv_dt) const -{ - return inv_dt * (m_impulse * m_ay + m_springImpulse * m_ax); -} - -float32 b2WheelJoint::GetReactionTorque(float32 inv_dt) const -{ - return inv_dt * m_motorImpulse; -} - -float32 b2WheelJoint::GetJointTranslation() const -{ - b2Body* bA = m_bodyA; - b2Body* bB = m_bodyB; - - b2Vec2 pA = bA->GetWorldPoint(m_localAnchorA); - b2Vec2 pB = bB->GetWorldPoint(m_localAnchorB); - b2Vec2 d = pB - pA; - b2Vec2 axis = bA->GetWorldVector(m_localXAxisA); - - float32 translation = b2Dot(d, axis); - return translation; -} - -float32 b2WheelJoint::GetJointSpeed() const -{ - float32 wA = m_bodyA->m_angularVelocity; - float32 wB = m_bodyB->m_angularVelocity; - return wB - wA; -} - -bool b2WheelJoint::IsMotorEnabled() const -{ - return m_enableMotor; -} - -void b2WheelJoint::EnableMotor(bool flag) -{ - m_bodyA->SetAwake(true); - m_bodyB->SetAwake(true); - m_enableMotor = flag; -} - -void b2WheelJoint::SetMotorSpeed(float32 speed) -{ - m_bodyA->SetAwake(true); - m_bodyB->SetAwake(true); - m_motorSpeed = speed; -} - -void b2WheelJoint::SetMaxMotorTorque(float32 torque) -{ - m_bodyA->SetAwake(true); - m_bodyB->SetAwake(true); - m_maxMotorTorque = torque; -} - -float32 b2WheelJoint::GetMotorTorque(float32 inv_dt) const -{ - return inv_dt * m_motorImpulse; -} - -void b2WheelJoint::Dump() -{ - int32 indexA = m_bodyA->m_islandIndex; - int32 indexB = m_bodyB->m_islandIndex; - - b2Log(" b2WheelJointDef jd;\n"); - b2Log(" jd.bodyA = bodies[%d];\n", indexA); - b2Log(" jd.bodyB = bodies[%d];\n", indexB); - b2Log(" jd.collideConnected = bool(%d);\n", m_collideConnected); - b2Log(" jd.localAnchorA.Set(%.15lef, %.15lef);\n", m_localAnchorA.x, m_localAnchorA.y); - b2Log(" jd.localAnchorB.Set(%.15lef, %.15lef);\n", m_localAnchorB.x, m_localAnchorB.y); - b2Log(" jd.localAxisA.Set(%.15lef, %.15lef);\n", m_localXAxisA.x, m_localXAxisA.y); - b2Log(" jd.enableMotor = bool(%d);\n", m_enableMotor); - b2Log(" jd.motorSpeed = %.15lef;\n", m_motorSpeed); - b2Log(" jd.maxMotorTorque = %.15lef;\n", m_maxMotorTorque); - b2Log(" jd.frequencyHz = %.15lef;\n", m_frequencyHz); - b2Log(" jd.dampingRatio = %.15lef;\n", m_dampingRatio); - b2Log(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2WheelJoint.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2WheelJoint.h deleted file mode 100644 index a33c77f4..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/Joints/b2WheelJoint.h +++ /dev/null @@ -1,210 +0,0 @@ -/* -* Copyright (c) 2006-2011 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_WHEEL_JOINT_H -#define B2_WHEEL_JOINT_H - -#include - -/// Wheel joint definition. This requires defining a line of -/// motion using an axis and an anchor point. The definition uses local -/// anchor points and a local axis so that the initial configuration -/// can violate the constraint slightly. The joint translation is zero -/// when the local anchor points coincide in world space. Using local -/// anchors and a local axis helps when saving and loading a game. -struct b2WheelJointDef : public b2JointDef -{ - b2WheelJointDef() - { - type = e_wheelJoint; - localAnchorA.SetZero(); - localAnchorB.SetZero(); - localAxisA.Set(1.0f, 0.0f); - enableMotor = false; - maxMotorTorque = 0.0f; - motorSpeed = 0.0f; - frequencyHz = 2.0f; - dampingRatio = 0.7f; - } - - /// Initialize the bodies, anchors, axis, and reference angle using the world - /// anchor and world axis. - void Initialize(b2Body* bodyA, b2Body* bodyB, const b2Vec2& anchor, const b2Vec2& axis); - - /// The local anchor point relative to bodyA's origin. - b2Vec2 localAnchorA; - - /// The local anchor point relative to bodyB's origin. - b2Vec2 localAnchorB; - - /// The local translation axis in bodyA. - b2Vec2 localAxisA; - - /// Enable/disable the joint motor. - bool enableMotor; - - /// The maximum motor torque, usually in N-m. - float32 maxMotorTorque; - - /// The desired motor speed in radians per second. - float32 motorSpeed; - - /// Suspension frequency, zero indicates no suspension - float32 frequencyHz; - - /// Suspension damping ratio, one indicates critical damping - float32 dampingRatio; -}; - -/// A wheel joint. This joint provides two degrees of freedom: translation -/// along an axis fixed in bodyA and rotation in the plane. In other words, it is a point to -/// line constraint with a rotational motor and a linear spring/damper. -/// This joint is designed for vehicle suspensions. -class b2WheelJoint : public b2Joint -{ -public: - b2Vec2 GetAnchorA() const; - b2Vec2 GetAnchorB() const; - - b2Vec2 GetReactionForce(float32 inv_dt) const; - float32 GetReactionTorque(float32 inv_dt) const; - - /// The local anchor point relative to bodyA's origin. - const b2Vec2& GetLocalAnchorA() const { return m_localAnchorA; } - - /// The local anchor point relative to bodyB's origin. - const b2Vec2& GetLocalAnchorB() const { return m_localAnchorB; } - - /// The local joint axis relative to bodyA. - const b2Vec2& GetLocalAxisA() const { return m_localXAxisA; } - - /// Get the current joint translation, usually in meters. - float32 GetJointTranslation() const; - - /// Get the current joint translation speed, usually in meters per second. - float32 GetJointSpeed() const; - - /// Is the joint motor enabled? - bool IsMotorEnabled() const; - - /// Enable/disable the joint motor. - void EnableMotor(bool flag); - - /// Set the motor speed, usually in radians per second. - void SetMotorSpeed(float32 speed); - - /// Get the motor speed, usually in radians per second. - float32 GetMotorSpeed() const; - - /// Set/Get the maximum motor force, usually in N-m. - void SetMaxMotorTorque(float32 torque); - float32 GetMaxMotorTorque() const; - - /// Get the current motor torque given the inverse time step, usually in N-m. - float32 GetMotorTorque(float32 inv_dt) const; - - /// Set/Get the spring frequency in hertz. Setting the frequency to zero disables the spring. - void SetSpringFrequencyHz(float32 hz); - float32 GetSpringFrequencyHz() const; - - /// Set/Get the spring damping ratio - void SetSpringDampingRatio(float32 ratio); - float32 GetSpringDampingRatio() const; - - /// Dump to b2Log - void Dump(); - -protected: - - friend class b2Joint; - b2WheelJoint(const b2WheelJointDef* def); - - void InitVelocityConstraints(const b2SolverData& data); - void SolveVelocityConstraints(const b2SolverData& data); - bool SolvePositionConstraints(const b2SolverData& data); - - float32 m_frequencyHz; - float32 m_dampingRatio; - - // Solver shared - b2Vec2 m_localAnchorA; - b2Vec2 m_localAnchorB; - b2Vec2 m_localXAxisA; - b2Vec2 m_localYAxisA; - - float32 m_impulse; - float32 m_motorImpulse; - float32 m_springImpulse; - - float32 m_maxMotorTorque; - float32 m_motorSpeed; - bool m_enableMotor; - - // Solver temp - int32 m_indexA; - int32 m_indexB; - b2Vec2 m_localCenterA; - b2Vec2 m_localCenterB; - float32 m_invMassA; - float32 m_invMassB; - float32 m_invIA; - float32 m_invIB; - - b2Vec2 m_ax, m_ay; - float32 m_sAx, m_sBx; - float32 m_sAy, m_sBy; - - float32 m_mass; - float32 m_motorMass; - float32 m_springMass; - - float32 m_bias; - float32 m_gamma; -}; - -inline float32 b2WheelJoint::GetMotorSpeed() const -{ - return m_motorSpeed; -} - -inline float32 b2WheelJoint::GetMaxMotorTorque() const -{ - return m_maxMotorTorque; -} - -inline void b2WheelJoint::SetSpringFrequencyHz(float32 hz) -{ - m_frequencyHz = hz; -} - -inline float32 b2WheelJoint::GetSpringFrequencyHz() const -{ - return m_frequencyHz; -} - -inline void b2WheelJoint::SetSpringDampingRatio(float32 ratio) -{ - m_dampingRatio = ratio; -} - -inline float32 b2WheelJoint::GetSpringDampingRatio() const -{ - return m_dampingRatio; -} - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2Body.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/b2Body.cpp deleted file mode 100644 index b6550531..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2Body.cpp +++ /dev/null @@ -1,549 +0,0 @@ -/* -* Copyright (c) 2006-2007 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include -#include -#include - -b2Body::b2Body(const b2BodyDef* bd, b2World* world) -{ - b2Assert(bd->position.IsValid()); - b2Assert(bd->linearVelocity.IsValid()); - b2Assert(b2IsValid(bd->angle)); - b2Assert(b2IsValid(bd->angularVelocity)); - b2Assert(b2IsValid(bd->angularDamping) && bd->angularDamping >= 0.0f); - b2Assert(b2IsValid(bd->linearDamping) && bd->linearDamping >= 0.0f); - - m_flags = 0; - - if (bd->bullet) - { - m_flags |= e_bulletFlag; - } - if (bd->fixedRotation) - { - m_flags |= e_fixedRotationFlag; - } - if (bd->allowSleep) - { - m_flags |= e_autoSleepFlag; - } - if (bd->awake) - { - m_flags |= e_awakeFlag; - } - if (bd->active) - { - m_flags |= e_activeFlag; - } - - m_world = world; - - m_xf.p = bd->position; - m_xf.q.Set(bd->angle); - - m_sweep.localCenter.SetZero(); - m_sweep.c0 = m_xf.p; - m_sweep.c = m_xf.p; - m_sweep.a0 = bd->angle; - m_sweep.a = bd->angle; - m_sweep.alpha0 = 0.0f; - - m_jointList = NULL; - m_contactList = NULL; - m_prev = NULL; - m_next = NULL; - - m_linearVelocity = bd->linearVelocity; - m_angularVelocity = bd->angularVelocity; - - m_linearDamping = bd->linearDamping; - m_angularDamping = bd->angularDamping; - m_gravityScale = bd->gravityScale; - - m_force.SetZero(); - m_torque = 0.0f; - - m_sleepTime = 0.0f; - - m_type = bd->type; - - if (m_type == b2_dynamicBody) - { - m_mass = 1.0f; - m_invMass = 1.0f; - } - else - { - m_mass = 0.0f; - m_invMass = 0.0f; - } - - m_I = 0.0f; - m_invI = 0.0f; - - m_userData = bd->userData; - - m_fixtureList = NULL; - m_fixtureCount = 0; -} - -b2Body::~b2Body() -{ - // shapes and joints are destroyed in b2World::Destroy -} - -void b2Body::SetType(b2BodyType type) -{ - b2Assert(m_world->IsLocked() == false); - if (m_world->IsLocked() == true) - { - return; - } - - if (m_type == type) - { - return; - } - - m_type = type; - - ResetMassData(); - - if (m_type == b2_staticBody) - { - m_linearVelocity.SetZero(); - m_angularVelocity = 0.0f; - m_sweep.a0 = m_sweep.a; - m_sweep.c0 = m_sweep.c; - SynchronizeFixtures(); - } - - SetAwake(true); - - m_force.SetZero(); - m_torque = 0.0f; - - // Delete the attached contacts. - b2ContactEdge* ce = m_contactList; - while (ce) - { - b2ContactEdge* ce0 = ce; - ce = ce->next; - m_world->m_contactManager.Destroy(ce0->contact); - } - m_contactList = NULL; - - // Touch the proxies so that new contacts will be created (when appropriate) - b2BroadPhase* broadPhase = &m_world->m_contactManager.m_broadPhase; - for (b2Fixture* f = m_fixtureList; f; f = f->m_next) - { - int32 proxyCount = f->m_proxyCount; - for (int32 i = 0; i < proxyCount; ++i) - { - broadPhase->TouchProxy(f->m_proxies[i].proxyId); - } - } -} - -b2Fixture* b2Body::CreateFixture(const b2FixtureDef* def) -{ - b2Assert(m_world->IsLocked() == false); - if (m_world->IsLocked() == true) - { - return NULL; - } - - b2BlockAllocator* allocator = &m_world->m_blockAllocator; - - void* memory = allocator->Allocate(sizeof(b2Fixture)); - b2Fixture* fixture = new (memory) b2Fixture; - fixture->Create(allocator, this, def); - - if (m_flags & e_activeFlag) - { - b2BroadPhase* broadPhase = &m_world->m_contactManager.m_broadPhase; - fixture->CreateProxies(broadPhase, m_xf); - } - - fixture->m_next = m_fixtureList; - m_fixtureList = fixture; - ++m_fixtureCount; - - fixture->m_body = this; - - // Adjust mass properties if needed. - if (fixture->m_density > 0.0f) - { - ResetMassData(); - } - - // Let the world know we have a new fixture. This will cause new contacts - // to be created at the beginning of the next time step. - m_world->m_flags |= b2World::e_newFixture; - - return fixture; -} - -b2Fixture* b2Body::CreateFixture(const b2Shape* shape, float32 density) -{ - b2FixtureDef def; - def.shape = shape; - def.density = density; - - return CreateFixture(&def); -} - -void b2Body::DestroyFixture(b2Fixture* fixture) -{ - b2Assert(m_world->IsLocked() == false); - if (m_world->IsLocked() == true) - { - return; - } - - b2Assert(fixture->m_body == this); - - // Remove the fixture from this body's singly linked list. - b2Assert(m_fixtureCount > 0); - b2Fixture** node = &m_fixtureList; - bool found = false; - while (*node != NULL) - { - if (*node == fixture) - { - *node = fixture->m_next; - found = true; - break; - } - - node = &(*node)->m_next; - } - - // You tried to remove a shape that is not attached to this body. - b2Assert(found); - - // Destroy any contacts associated with the fixture. - b2ContactEdge* edge = m_contactList; - while (edge) - { - b2Contact* c = edge->contact; - edge = edge->next; - - b2Fixture* fixtureA = c->GetFixtureA(); - b2Fixture* fixtureB = c->GetFixtureB(); - - if (fixture == fixtureA || fixture == fixtureB) - { - // This destroys the contact and removes it from - // this body's contact list. - m_world->m_contactManager.Destroy(c); - } - } - - b2BlockAllocator* allocator = &m_world->m_blockAllocator; - - if (m_flags & e_activeFlag) - { - b2BroadPhase* broadPhase = &m_world->m_contactManager.m_broadPhase; - fixture->DestroyProxies(broadPhase); - } - - fixture->Destroy(allocator); - fixture->m_body = NULL; - fixture->m_next = NULL; - fixture->~b2Fixture(); - allocator->Free(fixture, sizeof(b2Fixture)); - - --m_fixtureCount; - - // Reset the mass data. - ResetMassData(); -} - -void b2Body::ResetMassData() -{ - // Compute mass data from shapes. Each shape has its own density. - m_mass = 0.0f; - m_invMass = 0.0f; - m_I = 0.0f; - m_invI = 0.0f; - m_sweep.localCenter.SetZero(); - - // Static and kinematic bodies have zero mass. - if (m_type == b2_staticBody || m_type == b2_kinematicBody) - { - m_sweep.c0 = m_xf.p; - m_sweep.c = m_xf.p; - m_sweep.a0 = m_sweep.a; - return; - } - - b2Assert(m_type == b2_dynamicBody); - - // Accumulate mass over all fixtures. - b2Vec2 localCenter = b2Vec2_zero; - for (b2Fixture* f = m_fixtureList; f; f = f->m_next) - { - if (f->m_density == 0.0f) - { - continue; - } - - b2MassData massData; - f->GetMassData(&massData); - m_mass += massData.mass; - localCenter += massData.mass * massData.center; - m_I += massData.I; - } - - // Compute center of mass. - if (m_mass > 0.0f) - { - m_invMass = 1.0f / m_mass; - localCenter *= m_invMass; - } - else - { - // Force all dynamic bodies to have a positive mass. - m_mass = 1.0f; - m_invMass = 1.0f; - } - - if (m_I > 0.0f && (m_flags & e_fixedRotationFlag) == 0) - { - // Center the inertia about the center of mass. - m_I -= m_mass * b2Dot(localCenter, localCenter); - b2Assert(m_I > 0.0f); - m_invI = 1.0f / m_I; - - } - else - { - m_I = 0.0f; - m_invI = 0.0f; - } - - // Move center of mass. - b2Vec2 oldCenter = m_sweep.c; - m_sweep.localCenter = localCenter; - m_sweep.c0 = m_sweep.c = b2Mul(m_xf, m_sweep.localCenter); - - // Update center of mass velocity. - m_linearVelocity += b2Cross(m_angularVelocity, m_sweep.c - oldCenter); -} - -void b2Body::SetMassData(const b2MassData* massData) -{ - b2Assert(m_world->IsLocked() == false); - if (m_world->IsLocked() == true) - { - return; - } - - if (m_type != b2_dynamicBody) - { - return; - } - - m_invMass = 0.0f; - m_I = 0.0f; - m_invI = 0.0f; - - m_mass = massData->mass; - if (m_mass <= 0.0f) - { - m_mass = 1.0f; - } - - m_invMass = 1.0f / m_mass; - - if (massData->I > 0.0f && (m_flags & b2Body::e_fixedRotationFlag) == 0) - { - m_I = massData->I - m_mass * b2Dot(massData->center, massData->center); - b2Assert(m_I > 0.0f); - m_invI = 1.0f / m_I; - } - - // Move center of mass. - b2Vec2 oldCenter = m_sweep.c; - m_sweep.localCenter = massData->center; - m_sweep.c0 = m_sweep.c = b2Mul(m_xf, m_sweep.localCenter); - - // Update center of mass velocity. - m_linearVelocity += b2Cross(m_angularVelocity, m_sweep.c - oldCenter); -} - -bool b2Body::ShouldCollide(const b2Body* other) const -{ - // At least one body should be dynamic. - if (m_type != b2_dynamicBody && other->m_type != b2_dynamicBody) - { - return false; - } - - // Does a joint prevent collision? - for (b2JointEdge* jn = m_jointList; jn; jn = jn->next) - { - if (jn->other == other) - { - if (jn->joint->m_collideConnected == false) - { - return false; - } - } - } - - return true; -} - -void b2Body::SetTransform(const b2Vec2& position, float32 angle) -{ - b2Assert(m_world->IsLocked() == false); - if (m_world->IsLocked() == true) - { - return; - } - - m_xf.q.Set(angle); - m_xf.p = position; - - m_sweep.c = b2Mul(m_xf, m_sweep.localCenter); - m_sweep.a = angle; - - m_sweep.c0 = m_sweep.c; - m_sweep.a0 = angle; - - b2BroadPhase* broadPhase = &m_world->m_contactManager.m_broadPhase; - for (b2Fixture* f = m_fixtureList; f; f = f->m_next) - { - f->Synchronize(broadPhase, m_xf, m_xf); - } -} - -void b2Body::SynchronizeFixtures() -{ - b2Transform xf1; - xf1.q.Set(m_sweep.a0); - xf1.p = m_sweep.c0 - b2Mul(xf1.q, m_sweep.localCenter); - - b2BroadPhase* broadPhase = &m_world->m_contactManager.m_broadPhase; - for (b2Fixture* f = m_fixtureList; f; f = f->m_next) - { - f->Synchronize(broadPhase, xf1, m_xf); - } -} - -void b2Body::SetActive(bool flag) -{ - b2Assert(m_world->IsLocked() == false); - - if (flag == IsActive()) - { - return; - } - - if (flag) - { - m_flags |= e_activeFlag; - - // Create all proxies. - b2BroadPhase* broadPhase = &m_world->m_contactManager.m_broadPhase; - for (b2Fixture* f = m_fixtureList; f; f = f->m_next) - { - f->CreateProxies(broadPhase, m_xf); - } - - // Contacts are created the next time step. - } - else - { - m_flags &= ~e_activeFlag; - - // Destroy all proxies. - b2BroadPhase* broadPhase = &m_world->m_contactManager.m_broadPhase; - for (b2Fixture* f = m_fixtureList; f; f = f->m_next) - { - f->DestroyProxies(broadPhase); - } - - // Destroy the attached contacts. - b2ContactEdge* ce = m_contactList; - while (ce) - { - b2ContactEdge* ce0 = ce; - ce = ce->next; - m_world->m_contactManager.Destroy(ce0->contact); - } - m_contactList = NULL; - } -} - -void b2Body::SetFixedRotation(bool flag) -{ - bool status = (m_flags & e_fixedRotationFlag) == e_fixedRotationFlag; - if (status == flag) - { - return; - } - - if (flag) - { - m_flags |= e_fixedRotationFlag; - } - else - { - m_flags &= ~e_fixedRotationFlag; - } - - m_angularVelocity = 0.0f; - - ResetMassData(); -} - -void b2Body::Dump() -{ - int32 bodyIndex = m_islandIndex; - - b2Log("{\n"); - b2Log(" b2BodyDef bd;\n"); - b2Log(" bd.type = b2BodyType(%d);\n", m_type); - b2Log(" bd.position.Set(%.15lef, %.15lef);\n", m_xf.p.x, m_xf.p.y); - b2Log(" bd.angle = %.15lef;\n", m_sweep.a); - b2Log(" bd.linearVelocity.Set(%.15lef, %.15lef);\n", m_linearVelocity.x, m_linearVelocity.y); - b2Log(" bd.angularVelocity = %.15lef;\n", m_angularVelocity); - b2Log(" bd.linearDamping = %.15lef;\n", m_linearDamping); - b2Log(" bd.angularDamping = %.15lef;\n", m_angularDamping); - b2Log(" bd.allowSleep = bool(%d);\n", m_flags & e_autoSleepFlag); - b2Log(" bd.awake = bool(%d);\n", m_flags & e_awakeFlag); - b2Log(" bd.fixedRotation = bool(%d);\n", m_flags & e_fixedRotationFlag); - b2Log(" bd.bullet = bool(%d);\n", m_flags & e_bulletFlag); - b2Log(" bd.active = bool(%d);\n", m_flags & e_activeFlag); - b2Log(" bd.gravityScale = %.15lef;\n", m_gravityScale); - b2Log(" bodies[%d] = m_world->CreateBody(&bd);\n", m_islandIndex); - b2Log("\n"); - for (b2Fixture* f = m_fixtureList; f; f = f->m_next) - { - b2Log(" {\n"); - f->Dump(bodyIndex); - b2Log(" }\n"); - } - b2Log("}\n"); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2Body.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/b2Body.h deleted file mode 100644 index 24bae640..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2Body.h +++ /dev/null @@ -1,860 +0,0 @@ -/* -* Copyright (c) 2006-2011 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_BODY_H -#define B2_BODY_H - -#include -#include -#include - -class b2Fixture; -class b2Joint; -class b2Contact; -class b2Controller; -class b2World; -struct b2FixtureDef; -struct b2JointEdge; -struct b2ContactEdge; - -/// The body type. -/// static: zero mass, zero velocity, may be manually moved -/// kinematic: zero mass, non-zero velocity set by user, moved by solver -/// dynamic: positive mass, non-zero velocity determined by forces, moved by solver -enum b2BodyType -{ - b2_staticBody = 0, - b2_kinematicBody, - b2_dynamicBody - - // TODO_ERIN - //b2_bulletBody, -}; - -/// A body definition holds all the data needed to construct a rigid body. -/// You can safely re-use body definitions. Shapes are added to a body after construction. -struct b2BodyDef -{ - /// This constructor sets the body definition default values. - b2BodyDef() - { - userData = NULL; - position.Set(0.0f, 0.0f); - angle = 0.0f; - linearVelocity.Set(0.0f, 0.0f); - angularVelocity = 0.0f; - linearDamping = 0.0f; - angularDamping = 0.0f; - allowSleep = true; - awake = true; - fixedRotation = false; - bullet = false; - type = b2_staticBody; - active = true; - gravityScale = 1.0f; - } - - /// The body type: static, kinematic, or dynamic. - /// Note: if a dynamic body would have zero mass, the mass is set to one. - b2BodyType type; - - /// The world position of the body. Avoid creating bodies at the origin - /// since this can lead to many overlapping shapes. - b2Vec2 position; - - /// The world angle of the body in radians. - float32 angle; - - /// The linear velocity of the body's origin in world co-ordinates. - b2Vec2 linearVelocity; - - /// The angular velocity of the body. - float32 angularVelocity; - - /// Linear damping is use to reduce the linear velocity. The damping parameter - /// can be larger than 1.0f but the damping effect becomes sensitive to the - /// time step when the damping parameter is large. - float32 linearDamping; - - /// Angular damping is use to reduce the angular velocity. The damping parameter - /// can be larger than 1.0f but the damping effect becomes sensitive to the - /// time step when the damping parameter is large. - float32 angularDamping; - - /// Set this flag to false if this body should never fall asleep. Note that - /// this increases CPU usage. - bool allowSleep; - - /// Is this body initially awake or sleeping? - bool awake; - - /// Should this body be prevented from rotating? Useful for characters. - bool fixedRotation; - - /// Is this a fast moving body that should be prevented from tunneling through - /// other moving bodies? Note that all bodies are prevented from tunneling through - /// kinematic and static bodies. This setting is only considered on dynamic bodies. - /// @warning You should use this flag sparingly since it increases processing time. - bool bullet; - - /// Does this body start out active? - bool active; - - /// Use this to store application specific body data. - void* userData; - - /// Scale the gravity applied to this body. - float32 gravityScale; -}; - -/// A rigid body. These are created via b2World::CreateBody. -class b2Body -{ -public: - /// Creates a fixture and attach it to this body. Use this function if you need - /// to set some fixture parameters, like friction. Otherwise you can create the - /// fixture directly from a shape. - /// If the density is non-zero, this function automatically updates the mass of the body. - /// Contacts are not created until the next time step. - /// @param def the fixture definition. - /// @warning This function is locked during callbacks. - b2Fixture* CreateFixture(const b2FixtureDef* def); - - /// Creates a fixture from a shape and attach it to this body. - /// This is a convenience function. Use b2FixtureDef if you need to set parameters - /// like friction, restitution, user data, or filtering. - /// If the density is non-zero, this function automatically updates the mass of the body. - /// @param shape the shape to be cloned. - /// @param density the shape density (set to zero for static bodies). - /// @warning This function is locked during callbacks. - b2Fixture* CreateFixture(const b2Shape* shape, float32 density); - - /// Destroy a fixture. This removes the fixture from the broad-phase and - /// destroys all contacts associated with this fixture. This will - /// automatically adjust the mass of the body if the body is dynamic and the - /// fixture has positive density. - /// All fixtures attached to a body are implicitly destroyed when the body is destroyed. - /// @param fixture the fixture to be removed. - /// @warning This function is locked during callbacks. - void DestroyFixture(b2Fixture* fixture); - - /// Set the position of the body's origin and rotation. - /// Manipulating a body's transform may cause non-physical behavior. - /// Note: contacts are updated on the next call to b2World::Step. - /// @param position the world position of the body's local origin. - /// @param angle the world rotation in radians. - void SetTransform(const b2Vec2& position, float32 angle); - - /// Get the body transform for the body's origin. - /// @return the world transform of the body's origin. - const b2Transform& GetTransform() const; - - /// Get the world body origin position. - /// @return the world position of the body's origin. - const b2Vec2& GetPosition() const; - - /// Get the angle in radians. - /// @return the current world rotation angle in radians. - float32 GetAngle() const; - - /// Get the world position of the center of mass. - const b2Vec2& GetWorldCenter() const; - - /// Get the local position of the center of mass. - const b2Vec2& GetLocalCenter() const; - - /// Set the linear velocity of the center of mass. - /// @param v the new linear velocity of the center of mass. - void SetLinearVelocity(const b2Vec2& v); - - /// Get the linear velocity of the center of mass. - /// @return the linear velocity of the center of mass. - const b2Vec2& GetLinearVelocity() const; - - /// Set the angular velocity. - /// @param omega the new angular velocity in radians/second. - void SetAngularVelocity(float32 omega); - - /// Get the angular velocity. - /// @return the angular velocity in radians/second. - float32 GetAngularVelocity() const; - - /// Apply a force at a world point. If the force is not - /// applied at the center of mass, it will generate a torque and - /// affect the angular velocity. This wakes up the body. - /// @param force the world force vector, usually in Newtons (N). - /// @param point the world position of the point of application. - /// @param wake also wake up the body - void ApplyForce(const b2Vec2& force, const b2Vec2& point, bool wake); - - /// Apply a force to the center of mass. This wakes up the body. - /// @param force the world force vector, usually in Newtons (N). - /// @param wake also wake up the body - void ApplyForceToCenter(const b2Vec2& force, bool wake); - - /// Apply a torque. This affects the angular velocity - /// without affecting the linear velocity of the center of mass. - /// This wakes up the body. - /// @param torque about the z-axis (out of the screen), usually in N-m. - /// @param wake also wake up the body - void ApplyTorque(float32 torque, bool wake); - - /// Apply an impulse at a point. This immediately modifies the velocity. - /// It also modifies the angular velocity if the point of application - /// is not at the center of mass. This wakes up the body. - /// @param impulse the world impulse vector, usually in N-seconds or kg-m/s. - /// @param point the world position of the point of application. - /// @param wake also wake up the body - void ApplyLinearImpulse(const b2Vec2& impulse, const b2Vec2& point, bool wake); - - /// Apply an angular impulse. - /// @param impulse the angular impulse in units of kg*m*m/s - /// @param wake also wake up the body - void ApplyAngularImpulse(float32 impulse, bool wake); - - /// Get the total mass of the body. - /// @return the mass, usually in kilograms (kg). - float32 GetMass() const; - - /// Get the rotational inertia of the body about the local origin. - /// @return the rotational inertia, usually in kg-m^2. - float32 GetInertia() const; - - /// Get the mass data of the body. - /// @return a struct containing the mass, inertia and center of the body. - void GetMassData(b2MassData* data) const; - - /// Set the mass properties to override the mass properties of the fixtures. - /// Note that this changes the center of mass position. - /// Note that creating or destroying fixtures can also alter the mass. - /// This function has no effect if the body isn't dynamic. - /// @param massData the mass properties. - void SetMassData(const b2MassData* data); - - /// This resets the mass properties to the sum of the mass properties of the fixtures. - /// This normally does not need to be called unless you called SetMassData to override - /// the mass and you later want to reset the mass. - void ResetMassData(); - - /// Get the world coordinates of a point given the local coordinates. - /// @param localPoint a point on the body measured relative the the body's origin. - /// @return the same point expressed in world coordinates. - b2Vec2 GetWorldPoint(const b2Vec2& localPoint) const; - - /// Get the world coordinates of a vector given the local coordinates. - /// @param localVector a vector fixed in the body. - /// @return the same vector expressed in world coordinates. - b2Vec2 GetWorldVector(const b2Vec2& localVector) const; - - /// Gets a local point relative to the body's origin given a world point. - /// @param a point in world coordinates. - /// @return the corresponding local point relative to the body's origin. - b2Vec2 GetLocalPoint(const b2Vec2& worldPoint) const; - - /// Gets a local vector given a world vector. - /// @param a vector in world coordinates. - /// @return the corresponding local vector. - b2Vec2 GetLocalVector(const b2Vec2& worldVector) const; - - /// Get the world linear velocity of a world point attached to this body. - /// @param a point in world coordinates. - /// @return the world velocity of a point. - b2Vec2 GetLinearVelocityFromWorldPoint(const b2Vec2& worldPoint) const; - - /// Get the world velocity of a local point. - /// @param a point in local coordinates. - /// @return the world velocity of a point. - b2Vec2 GetLinearVelocityFromLocalPoint(const b2Vec2& localPoint) const; - - /// Get the linear damping of the body. - float32 GetLinearDamping() const; - - /// Set the linear damping of the body. - void SetLinearDamping(float32 linearDamping); - - /// Get the angular damping of the body. - float32 GetAngularDamping() const; - - /// Set the angular damping of the body. - void SetAngularDamping(float32 angularDamping); - - /// Get the gravity scale of the body. - float32 GetGravityScale() const; - - /// Set the gravity scale of the body. - void SetGravityScale(float32 scale); - - /// Set the type of this body. This may alter the mass and velocity. - void SetType(b2BodyType type); - - /// Get the type of this body. - b2BodyType GetType() const; - - /// Should this body be treated like a bullet for continuous collision detection? - void SetBullet(bool flag); - - /// Is this body treated like a bullet for continuous collision detection? - bool IsBullet() const; - - /// You can disable sleeping on this body. If you disable sleeping, the - /// body will be woken. - void SetSleepingAllowed(bool flag); - - /// Is this body allowed to sleep - bool IsSleepingAllowed() const; - - /// Set the sleep state of the body. A sleeping body has very - /// low CPU cost. - /// @param flag set to true to wake the body, false to put it to sleep. - void SetAwake(bool flag); - - /// Get the sleeping state of this body. - /// @return true if the body is awake. - bool IsAwake() const; - - /// Set the active state of the body. An inactive body is not - /// simulated and cannot be collided with or woken up. - /// If you pass a flag of true, all fixtures will be added to the - /// broad-phase. - /// If you pass a flag of false, all fixtures will be removed from - /// the broad-phase and all contacts will be destroyed. - /// Fixtures and joints are otherwise unaffected. You may continue - /// to create/destroy fixtures and joints on inactive bodies. - /// Fixtures on an inactive body are implicitly inactive and will - /// not participate in collisions, ray-casts, or queries. - /// Joints connected to an inactive body are implicitly inactive. - /// An inactive body is still owned by a b2World object and remains - /// in the body list. - void SetActive(bool flag); - - /// Get the active state of the body. - bool IsActive() const; - - /// Set this body to have fixed rotation. This causes the mass - /// to be reset. - void SetFixedRotation(bool flag); - - /// Does this body have fixed rotation? - bool IsFixedRotation() const; - - /// Get the list of all fixtures attached to this body. - b2Fixture* GetFixtureList(); - const b2Fixture* GetFixtureList() const; - - /// Get the list of all joints attached to this body. - b2JointEdge* GetJointList(); - const b2JointEdge* GetJointList() const; - - /// Get the list of all contacts attached to this body. - /// @warning this list changes during the time step and you may - /// miss some collisions if you don't use b2ContactListener. - b2ContactEdge* GetContactList(); - const b2ContactEdge* GetContactList() const; - - /// Get the next body in the world's body list. - b2Body* GetNext(); - const b2Body* GetNext() const; - - /// Get the user data pointer that was provided in the body definition. - void* GetUserData() const; - - /// Set the user data. Use this to store your application specific data. - void SetUserData(void* data); - - /// Get the parent world of this body. - b2World* GetWorld(); - const b2World* GetWorld() const; - - /// Dump this body to a log file - void Dump(); - -private: - - friend class b2World; - friend class b2Island; - friend class b2ContactManager; - friend class b2ContactSolver; - friend class b2Contact; - - friend class b2DistanceJoint; - friend class b2FrictionJoint; - friend class b2GearJoint; - friend class b2MotorJoint; - friend class b2MouseJoint; - friend class b2PrismaticJoint; - friend class b2PulleyJoint; - friend class b2RevoluteJoint; - friend class b2RopeJoint; - friend class b2WeldJoint; - friend class b2WheelJoint; - - // m_flags - enum - { - e_islandFlag = 0x0001, - e_awakeFlag = 0x0002, - e_autoSleepFlag = 0x0004, - e_bulletFlag = 0x0008, - e_fixedRotationFlag = 0x0010, - e_activeFlag = 0x0020, - e_toiFlag = 0x0040 - }; - - b2Body(const b2BodyDef* bd, b2World* world); - ~b2Body(); - - void SynchronizeFixtures(); - void SynchronizeTransform(); - - // This is used to prevent connected bodies from colliding. - // It may lie, depending on the collideConnected flag. - bool ShouldCollide(const b2Body* other) const; - - void Advance(float32 t); - - b2BodyType m_type; - - uint16 m_flags; - - int32 m_islandIndex; - - b2Transform m_xf; // the body origin transform - b2Sweep m_sweep; // the swept motion for CCD - - b2Vec2 m_linearVelocity; - float32 m_angularVelocity; - - b2Vec2 m_force; - float32 m_torque; - - b2World* m_world; - b2Body* m_prev; - b2Body* m_next; - - b2Fixture* m_fixtureList; - int32 m_fixtureCount; - - b2JointEdge* m_jointList; - b2ContactEdge* m_contactList; - - float32 m_mass, m_invMass; - - // Rotational inertia about the center of mass. - float32 m_I, m_invI; - - float32 m_linearDamping; - float32 m_angularDamping; - float32 m_gravityScale; - - float32 m_sleepTime; - - void* m_userData; -}; - -inline b2BodyType b2Body::GetType() const -{ - return m_type; -} - -inline const b2Transform& b2Body::GetTransform() const -{ - return m_xf; -} - -inline const b2Vec2& b2Body::GetPosition() const -{ - return m_xf.p; -} - -inline float32 b2Body::GetAngle() const -{ - return m_sweep.a; -} - -inline const b2Vec2& b2Body::GetWorldCenter() const -{ - return m_sweep.c; -} - -inline const b2Vec2& b2Body::GetLocalCenter() const -{ - return m_sweep.localCenter; -} - -inline void b2Body::SetLinearVelocity(const b2Vec2& v) -{ - if (m_type == b2_staticBody) - { - return; - } - - if (b2Dot(v,v) > 0.0f) - { - SetAwake(true); - } - - m_linearVelocity = v; -} - -inline const b2Vec2& b2Body::GetLinearVelocity() const -{ - return m_linearVelocity; -} - -inline void b2Body::SetAngularVelocity(float32 w) -{ - if (m_type == b2_staticBody) - { - return; - } - - if (w * w > 0.0f) - { - SetAwake(true); - } - - m_angularVelocity = w; -} - -inline float32 b2Body::GetAngularVelocity() const -{ - return m_angularVelocity; -} - -inline float32 b2Body::GetMass() const -{ - return m_mass; -} - -inline float32 b2Body::GetInertia() const -{ - return m_I + m_mass * b2Dot(m_sweep.localCenter, m_sweep.localCenter); -} - -inline void b2Body::GetMassData(b2MassData* data) const -{ - data->mass = m_mass; - data->I = m_I + m_mass * b2Dot(m_sweep.localCenter, m_sweep.localCenter); - data->center = m_sweep.localCenter; -} - -inline b2Vec2 b2Body::GetWorldPoint(const b2Vec2& localPoint) const -{ - return b2Mul(m_xf, localPoint); -} - -inline b2Vec2 b2Body::GetWorldVector(const b2Vec2& localVector) const -{ - return b2Mul(m_xf.q, localVector); -} - -inline b2Vec2 b2Body::GetLocalPoint(const b2Vec2& worldPoint) const -{ - return b2MulT(m_xf, worldPoint); -} - -inline b2Vec2 b2Body::GetLocalVector(const b2Vec2& worldVector) const -{ - return b2MulT(m_xf.q, worldVector); -} - -inline b2Vec2 b2Body::GetLinearVelocityFromWorldPoint(const b2Vec2& worldPoint) const -{ - return m_linearVelocity + b2Cross(m_angularVelocity, worldPoint - m_sweep.c); -} - -inline b2Vec2 b2Body::GetLinearVelocityFromLocalPoint(const b2Vec2& localPoint) const -{ - return GetLinearVelocityFromWorldPoint(GetWorldPoint(localPoint)); -} - -inline float32 b2Body::GetLinearDamping() const -{ - return m_linearDamping; -} - -inline void b2Body::SetLinearDamping(float32 linearDamping) -{ - m_linearDamping = linearDamping; -} - -inline float32 b2Body::GetAngularDamping() const -{ - return m_angularDamping; -} - -inline void b2Body::SetAngularDamping(float32 angularDamping) -{ - m_angularDamping = angularDamping; -} - -inline float32 b2Body::GetGravityScale() const -{ - return m_gravityScale; -} - -inline void b2Body::SetGravityScale(float32 scale) -{ - m_gravityScale = scale; -} - -inline void b2Body::SetBullet(bool flag) -{ - if (flag) - { - m_flags |= e_bulletFlag; - } - else - { - m_flags &= ~e_bulletFlag; - } -} - -inline bool b2Body::IsBullet() const -{ - return (m_flags & e_bulletFlag) == e_bulletFlag; -} - -inline void b2Body::SetAwake(bool flag) -{ - if (flag) - { - if ((m_flags & e_awakeFlag) == 0) - { - m_flags |= e_awakeFlag; - m_sleepTime = 0.0f; - } - } - else - { - m_flags &= ~e_awakeFlag; - m_sleepTime = 0.0f; - m_linearVelocity.SetZero(); - m_angularVelocity = 0.0f; - m_force.SetZero(); - m_torque = 0.0f; - } -} - -inline bool b2Body::IsAwake() const -{ - return (m_flags & e_awakeFlag) == e_awakeFlag; -} - -inline bool b2Body::IsActive() const -{ - return (m_flags & e_activeFlag) == e_activeFlag; -} - -inline bool b2Body::IsFixedRotation() const -{ - return (m_flags & e_fixedRotationFlag) == e_fixedRotationFlag; -} - -inline void b2Body::SetSleepingAllowed(bool flag) -{ - if (flag) - { - m_flags |= e_autoSleepFlag; - } - else - { - m_flags &= ~e_autoSleepFlag; - SetAwake(true); - } -} - -inline bool b2Body::IsSleepingAllowed() const -{ - return (m_flags & e_autoSleepFlag) == e_autoSleepFlag; -} - -inline b2Fixture* b2Body::GetFixtureList() -{ - return m_fixtureList; -} - -inline const b2Fixture* b2Body::GetFixtureList() const -{ - return m_fixtureList; -} - -inline b2JointEdge* b2Body::GetJointList() -{ - return m_jointList; -} - -inline const b2JointEdge* b2Body::GetJointList() const -{ - return m_jointList; -} - -inline b2ContactEdge* b2Body::GetContactList() -{ - return m_contactList; -} - -inline const b2ContactEdge* b2Body::GetContactList() const -{ - return m_contactList; -} - -inline b2Body* b2Body::GetNext() -{ - return m_next; -} - -inline const b2Body* b2Body::GetNext() const -{ - return m_next; -} - -inline void b2Body::SetUserData(void* data) -{ - m_userData = data; -} - -inline void* b2Body::GetUserData() const -{ - return m_userData; -} - -inline void b2Body::ApplyForce(const b2Vec2& force, const b2Vec2& point, bool wake) -{ - if (m_type != b2_dynamicBody) - { - return; - } - - if (wake && (m_flags & e_awakeFlag) == 0) - { - SetAwake(true); - } - - // Don't accumulate a force if the body is sleeping. - if (m_flags & e_awakeFlag) - { - m_force += force; - m_torque += b2Cross(point - m_sweep.c, force); - } -} - -inline void b2Body::ApplyForceToCenter(const b2Vec2& force, bool wake) -{ - if (m_type != b2_dynamicBody) - { - return; - } - - if (wake && (m_flags & e_awakeFlag) == 0) - { - SetAwake(true); - } - - // Don't accumulate a force if the body is sleeping - if (m_flags & e_awakeFlag) - { - m_force += force; - } -} - -inline void b2Body::ApplyTorque(float32 torque, bool wake) -{ - if (m_type != b2_dynamicBody) - { - return; - } - - if (wake && (m_flags & e_awakeFlag) == 0) - { - SetAwake(true); - } - - // Don't accumulate a force if the body is sleeping - if (m_flags & e_awakeFlag) - { - m_torque += torque; - } -} - -inline void b2Body::ApplyLinearImpulse(const b2Vec2& impulse, const b2Vec2& point, bool wake) -{ - if (m_type != b2_dynamicBody) - { - return; - } - - if (wake && (m_flags & e_awakeFlag) == 0) - { - SetAwake(true); - } - - // Don't accumulate velocity if the body is sleeping - if (m_flags & e_awakeFlag) - { - m_linearVelocity += m_invMass * impulse; - m_angularVelocity += m_invI * b2Cross(point - m_sweep.c, impulse); - } -} - -inline void b2Body::ApplyAngularImpulse(float32 impulse, bool wake) -{ - if (m_type != b2_dynamicBody) - { - return; - } - - if (wake && (m_flags & e_awakeFlag) == 0) - { - SetAwake(true); - } - - // Don't accumulate velocity if the body is sleeping - if (m_flags & e_awakeFlag) - { - m_angularVelocity += m_invI * impulse; - } -} - -inline void b2Body::SynchronizeTransform() -{ - m_xf.q.Set(m_sweep.a); - m_xf.p = m_sweep.c - b2Mul(m_xf.q, m_sweep.localCenter); -} - -inline void b2Body::Advance(float32 alpha) -{ - // Advance to the new safe time. This doesn't sync the broad-phase. - m_sweep.Advance(alpha); - m_sweep.c = m_sweep.c0; - m_sweep.a = m_sweep.a0; - m_xf.q.Set(m_sweep.a); - m_xf.p = m_sweep.c - b2Mul(m_xf.q, m_sweep.localCenter); -} - -inline b2World* b2Body::GetWorld() -{ - return m_world; -} - -inline const b2World* b2Body::GetWorld() const -{ - return m_world; -} - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2ContactManager.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/b2ContactManager.cpp deleted file mode 100644 index d8a189b7..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2ContactManager.cpp +++ /dev/null @@ -1,296 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include -#include -#include - -b2ContactFilter b2_defaultFilter; -b2ContactListener b2_defaultListener; - -b2ContactManager::b2ContactManager() -{ - m_contactList = NULL; - m_contactCount = 0; - m_contactFilter = &b2_defaultFilter; - m_contactListener = &b2_defaultListener; - m_allocator = NULL; -} - -void b2ContactManager::Destroy(b2Contact* c) -{ - b2Fixture* fixtureA = c->GetFixtureA(); - b2Fixture* fixtureB = c->GetFixtureB(); - b2Body* bodyA = fixtureA->GetBody(); - b2Body* bodyB = fixtureB->GetBody(); - - if (m_contactListener && c->IsTouching()) - { - m_contactListener->EndContact(c); - } - - // Remove from the world. - if (c->m_prev) - { - c->m_prev->m_next = c->m_next; - } - - if (c->m_next) - { - c->m_next->m_prev = c->m_prev; - } - - if (c == m_contactList) - { - m_contactList = c->m_next; - } - - // Remove from body 1 - if (c->m_nodeA.prev) - { - c->m_nodeA.prev->next = c->m_nodeA.next; - } - - if (c->m_nodeA.next) - { - c->m_nodeA.next->prev = c->m_nodeA.prev; - } - - if (&c->m_nodeA == bodyA->m_contactList) - { - bodyA->m_contactList = c->m_nodeA.next; - } - - // Remove from body 2 - if (c->m_nodeB.prev) - { - c->m_nodeB.prev->next = c->m_nodeB.next; - } - - if (c->m_nodeB.next) - { - c->m_nodeB.next->prev = c->m_nodeB.prev; - } - - if (&c->m_nodeB == bodyB->m_contactList) - { - bodyB->m_contactList = c->m_nodeB.next; - } - - // Call the factory. - b2Contact::Destroy(c, m_allocator); - --m_contactCount; -} - -// This is the top level collision call for the time step. Here -// all the narrow phase collision is processed for the world -// contact list. -void b2ContactManager::Collide() -{ - // Update awake contacts. - b2Contact* c = m_contactList; - while (c) - { - b2Fixture* fixtureA = c->GetFixtureA(); - b2Fixture* fixtureB = c->GetFixtureB(); - int32 indexA = c->GetChildIndexA(); - int32 indexB = c->GetChildIndexB(); - b2Body* bodyA = fixtureA->GetBody(); - b2Body* bodyB = fixtureB->GetBody(); - - // Is this contact flagged for filtering? - if (c->m_flags & b2Contact::e_filterFlag) - { - // Should these bodies collide? - if (bodyB->ShouldCollide(bodyA) == false) - { - b2Contact* cNuke = c; - c = cNuke->GetNext(); - Destroy(cNuke); - continue; - } - - // Check user filtering. - if (m_contactFilter && m_contactFilter->ShouldCollide(fixtureA, fixtureB) == false) - { - b2Contact* cNuke = c; - c = cNuke->GetNext(); - Destroy(cNuke); - continue; - } - - // Clear the filtering flag. - c->m_flags &= ~b2Contact::e_filterFlag; - } - - bool activeA = bodyA->IsAwake() && bodyA->m_type != b2_staticBody; - bool activeB = bodyB->IsAwake() && bodyB->m_type != b2_staticBody; - - // At least one body must be awake and it must be dynamic or kinematic. - if (activeA == false && activeB == false) - { - c = c->GetNext(); - continue; - } - - int32 proxyIdA = fixtureA->m_proxies[indexA].proxyId; - int32 proxyIdB = fixtureB->m_proxies[indexB].proxyId; - bool overlap = m_broadPhase.TestOverlap(proxyIdA, proxyIdB); - - // Here we destroy contacts that cease to overlap in the broad-phase. - if (overlap == false) - { - b2Contact* cNuke = c; - c = cNuke->GetNext(); - Destroy(cNuke); - continue; - } - - // The contact persists. - c->Update(m_contactListener); - c = c->GetNext(); - } -} - -void b2ContactManager::FindNewContacts() -{ - m_broadPhase.UpdatePairs(this); -} - -void b2ContactManager::AddPair(void* proxyUserDataA, void* proxyUserDataB) -{ - b2FixtureProxy* proxyA = (b2FixtureProxy*)proxyUserDataA; - b2FixtureProxy* proxyB = (b2FixtureProxy*)proxyUserDataB; - - b2Fixture* fixtureA = proxyA->fixture; - b2Fixture* fixtureB = proxyB->fixture; - - int32 indexA = proxyA->childIndex; - int32 indexB = proxyB->childIndex; - - b2Body* bodyA = fixtureA->GetBody(); - b2Body* bodyB = fixtureB->GetBody(); - - // Are the fixtures on the same body? - if (bodyA == bodyB) - { - return; - } - - // TODO_ERIN use a hash table to remove a potential bottleneck when both - // bodies have a lot of contacts. - // Does a contact already exist? - b2ContactEdge* edge = bodyB->GetContactList(); - while (edge) - { - if (edge->other == bodyA) - { - b2Fixture* fA = edge->contact->GetFixtureA(); - b2Fixture* fB = edge->contact->GetFixtureB(); - int32 iA = edge->contact->GetChildIndexA(); - int32 iB = edge->contact->GetChildIndexB(); - - if (fA == fixtureA && fB == fixtureB && iA == indexA && iB == indexB) - { - // A contact already exists. - return; - } - - if (fA == fixtureB && fB == fixtureA && iA == indexB && iB == indexA) - { - // A contact already exists. - return; - } - } - - edge = edge->next; - } - - // Does a joint override collision? Is at least one body dynamic? - if (bodyB->ShouldCollide(bodyA) == false) - { - return; - } - - // Check user filtering. - if (m_contactFilter && m_contactFilter->ShouldCollide(fixtureA, fixtureB) == false) - { - return; - } - - // Call the factory. - b2Contact* c = b2Contact::Create(fixtureA, indexA, fixtureB, indexB, m_allocator); - if (c == NULL) - { - return; - } - - // Contact creation may swap fixtures. - fixtureA = c->GetFixtureA(); - fixtureB = c->GetFixtureB(); - indexA = c->GetChildIndexA(); - indexB = c->GetChildIndexB(); - bodyA = fixtureA->GetBody(); - bodyB = fixtureB->GetBody(); - - // Insert into the world. - c->m_prev = NULL; - c->m_next = m_contactList; - if (m_contactList != NULL) - { - m_contactList->m_prev = c; - } - m_contactList = c; - - // Connect to island graph. - - // Connect to body A - c->m_nodeA.contact = c; - c->m_nodeA.other = bodyB; - - c->m_nodeA.prev = NULL; - c->m_nodeA.next = bodyA->m_contactList; - if (bodyA->m_contactList != NULL) - { - bodyA->m_contactList->prev = &c->m_nodeA; - } - bodyA->m_contactList = &c->m_nodeA; - - // Connect to body B - c->m_nodeB.contact = c; - c->m_nodeB.other = bodyA; - - c->m_nodeB.prev = NULL; - c->m_nodeB.next = bodyB->m_contactList; - if (bodyB->m_contactList != NULL) - { - bodyB->m_contactList->prev = &c->m_nodeB; - } - bodyB->m_contactList = &c->m_nodeB; - - // Wake up the bodies - if (fixtureA->IsSensor() == false && fixtureB->IsSensor() == false) - { - bodyA->SetAwake(true); - bodyB->SetAwake(true); - } - - ++m_contactCount; -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2ContactManager.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/b2ContactManager.h deleted file mode 100644 index 6a1d072a..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2ContactManager.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_CONTACT_MANAGER_H -#define B2_CONTACT_MANAGER_H - -#include - -class b2Contact; -class b2ContactFilter; -class b2ContactListener; -class b2BlockAllocator; - -// Delegate of b2World. -class b2ContactManager -{ -public: - b2ContactManager(); - - // Broad-phase callback. - void AddPair(void* proxyUserDataA, void* proxyUserDataB); - - void FindNewContacts(); - - void Destroy(b2Contact* c); - - void Collide(); - - b2BroadPhase m_broadPhase; - b2Contact* m_contactList; - int32 m_contactCount; - b2ContactFilter* m_contactFilter; - b2ContactListener* m_contactListener; - b2BlockAllocator* m_allocator; -}; - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2Fixture.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/b2Fixture.cpp deleted file mode 100644 index fb17f0a3..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2Fixture.cpp +++ /dev/null @@ -1,303 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -b2Fixture::b2Fixture() -{ - m_userData = NULL; - m_body = NULL; - m_next = NULL; - m_proxies = NULL; - m_proxyCount = 0; - m_shape = NULL; - m_density = 0.0f; -} - -void b2Fixture::Create(b2BlockAllocator* allocator, b2Body* body, const b2FixtureDef* def) -{ - m_userData = def->userData; - m_friction = def->friction; - m_restitution = def->restitution; - - m_body = body; - m_next = NULL; - - m_filter = def->filter; - - m_isSensor = def->isSensor; - - m_shape = def->shape->Clone(allocator); - - // Reserve proxy space - int32 childCount = m_shape->GetChildCount(); - m_proxies = (b2FixtureProxy*)allocator->Allocate(childCount * sizeof(b2FixtureProxy)); - for (int32 i = 0; i < childCount; ++i) - { - m_proxies[i].fixture = NULL; - m_proxies[i].proxyId = b2BroadPhase::e_nullProxy; - } - m_proxyCount = 0; - - m_density = def->density; -} - -void b2Fixture::Destroy(b2BlockAllocator* allocator) -{ - // The proxies must be destroyed before calling this. - b2Assert(m_proxyCount == 0); - - // Free the proxy array. - int32 childCount = m_shape->GetChildCount(); - allocator->Free(m_proxies, childCount * sizeof(b2FixtureProxy)); - m_proxies = NULL; - - // Free the child shape. - switch (m_shape->m_type) - { - case b2Shape::e_circle: - { - b2CircleShape* s = (b2CircleShape*)m_shape; - s->~b2CircleShape(); - allocator->Free(s, sizeof(b2CircleShape)); - } - break; - - case b2Shape::e_edge: - { - b2EdgeShape* s = (b2EdgeShape*)m_shape; - s->~b2EdgeShape(); - allocator->Free(s, sizeof(b2EdgeShape)); - } - break; - - case b2Shape::e_polygon: - { - b2PolygonShape* s = (b2PolygonShape*)m_shape; - s->~b2PolygonShape(); - allocator->Free(s, sizeof(b2PolygonShape)); - } - break; - - case b2Shape::e_chain: - { - b2ChainShape* s = (b2ChainShape*)m_shape; - s->~b2ChainShape(); - allocator->Free(s, sizeof(b2ChainShape)); - } - break; - - default: - b2Assert(false); - break; - } - - m_shape = NULL; -} - -void b2Fixture::CreateProxies(b2BroadPhase* broadPhase, const b2Transform& xf) -{ - b2Assert(m_proxyCount == 0); - - // Create proxies in the broad-phase. - m_proxyCount = m_shape->GetChildCount(); - - for (int32 i = 0; i < m_proxyCount; ++i) - { - b2FixtureProxy* proxy = m_proxies + i; - m_shape->ComputeAABB(&proxy->aabb, xf, i); - proxy->proxyId = broadPhase->CreateProxy(proxy->aabb, proxy); - proxy->fixture = this; - proxy->childIndex = i; - } -} - -void b2Fixture::DestroyProxies(b2BroadPhase* broadPhase) -{ - // Destroy proxies in the broad-phase. - for (int32 i = 0; i < m_proxyCount; ++i) - { - b2FixtureProxy* proxy = m_proxies + i; - broadPhase->DestroyProxy(proxy->proxyId); - proxy->proxyId = b2BroadPhase::e_nullProxy; - } - - m_proxyCount = 0; -} - -void b2Fixture::Synchronize(b2BroadPhase* broadPhase, const b2Transform& transform1, const b2Transform& transform2) -{ - if (m_proxyCount == 0) - { - return; - } - - for (int32 i = 0; i < m_proxyCount; ++i) - { - b2FixtureProxy* proxy = m_proxies + i; - - // Compute an AABB that covers the swept shape (may miss some rotation effect). - b2AABB aabb1, aabb2; - m_shape->ComputeAABB(&aabb1, transform1, proxy->childIndex); - m_shape->ComputeAABB(&aabb2, transform2, proxy->childIndex); - - proxy->aabb.Combine(aabb1, aabb2); - - b2Vec2 displacement = transform2.p - transform1.p; - - broadPhase->MoveProxy(proxy->proxyId, proxy->aabb, displacement); - } -} - -void b2Fixture::SetFilterData(const b2Filter& filter) -{ - m_filter = filter; - - Refilter(); -} - -void b2Fixture::Refilter() -{ - if (m_body == NULL) - { - return; - } - - // Flag associated contacts for filtering. - b2ContactEdge* edge = m_body->GetContactList(); - while (edge) - { - b2Contact* contact = edge->contact; - b2Fixture* fixtureA = contact->GetFixtureA(); - b2Fixture* fixtureB = contact->GetFixtureB(); - if (fixtureA == this || fixtureB == this) - { - contact->FlagForFiltering(); - } - - edge = edge->next; - } - - b2World* world = m_body->GetWorld(); - - if (world == NULL) - { - return; - } - - // Touch each proxy so that new pairs may be created - b2BroadPhase* broadPhase = &world->m_contactManager.m_broadPhase; - for (int32 i = 0; i < m_proxyCount; ++i) - { - broadPhase->TouchProxy(m_proxies[i].proxyId); - } -} - -void b2Fixture::SetSensor(bool sensor) -{ - if (sensor != m_isSensor) - { - m_body->SetAwake(true); - m_isSensor = sensor; - } -} - -void b2Fixture::Dump(int32 bodyIndex) -{ - b2Log(" b2FixtureDef fd;\n"); - b2Log(" fd.friction = %.15lef;\n", m_friction); - b2Log(" fd.restitution = %.15lef;\n", m_restitution); - b2Log(" fd.density = %.15lef;\n", m_density); - b2Log(" fd.isSensor = bool(%d);\n", m_isSensor); - b2Log(" fd.filter.categoryBits = uint16(%d);\n", m_filter.categoryBits); - b2Log(" fd.filter.maskBits = uint16(%d);\n", m_filter.maskBits); - b2Log(" fd.filter.groupIndex = int16(%d);\n", m_filter.groupIndex); - - switch (m_shape->m_type) - { - case b2Shape::e_circle: - { - b2CircleShape* s = (b2CircleShape*)m_shape; - b2Log(" b2CircleShape shape;\n"); - b2Log(" shape.m_radius = %.15lef;\n", s->m_radius); - b2Log(" shape.m_p.Set(%.15lef, %.15lef);\n", s->m_p.x, s->m_p.y); - } - break; - - case b2Shape::e_edge: - { - b2EdgeShape* s = (b2EdgeShape*)m_shape; - b2Log(" b2EdgeShape shape;\n"); - b2Log(" shape.m_radius = %.15lef;\n", s->m_radius); - b2Log(" shape.m_vertex0.Set(%.15lef, %.15lef);\n", s->m_vertex0.x, s->m_vertex0.y); - b2Log(" shape.m_vertex1.Set(%.15lef, %.15lef);\n", s->m_vertex1.x, s->m_vertex1.y); - b2Log(" shape.m_vertex2.Set(%.15lef, %.15lef);\n", s->m_vertex2.x, s->m_vertex2.y); - b2Log(" shape.m_vertex3.Set(%.15lef, %.15lef);\n", s->m_vertex3.x, s->m_vertex3.y); - b2Log(" shape.m_hasVertex0 = bool(%d);\n", s->m_hasVertex0); - b2Log(" shape.m_hasVertex3 = bool(%d);\n", s->m_hasVertex3); - } - break; - - case b2Shape::e_polygon: - { - b2PolygonShape* s = (b2PolygonShape*)m_shape; - b2Log(" b2PolygonShape shape;\n"); - b2Log(" b2Vec2 vs[%d];\n", b2_maxPolygonVertices); - for (int32 i = 0; i < s->m_count; ++i) - { - b2Log(" vs[%d].Set(%.15lef, %.15lef);\n", i, s->m_vertices[i].x, s->m_vertices[i].y); - } - b2Log(" shape.Set(vs, %d);\n", s->m_count); - } - break; - - case b2Shape::e_chain: - { - b2ChainShape* s = (b2ChainShape*)m_shape; - b2Log(" b2ChainShape shape;\n"); - b2Log(" b2Vec2 vs[%d];\n", s->m_count); - for (int32 i = 0; i < s->m_count; ++i) - { - b2Log(" vs[%d].Set(%.15lef, %.15lef);\n", i, s->m_vertices[i].x, s->m_vertices[i].y); - } - b2Log(" shape.CreateChain(vs, %d);\n", s->m_count); - b2Log(" shape.m_prevVertex.Set(%.15lef, %.15lef);\n", s->m_prevVertex.x, s->m_prevVertex.y); - b2Log(" shape.m_nextVertex.Set(%.15lef, %.15lef);\n", s->m_nextVertex.x, s->m_nextVertex.y); - b2Log(" shape.m_hasPrevVertex = bool(%d);\n", s->m_hasPrevVertex); - b2Log(" shape.m_hasNextVertex = bool(%d);\n", s->m_hasNextVertex); - } - break; - - default: - return; - } - - b2Log("\n"); - b2Log(" fd.shape = &shape;\n"); - b2Log("\n"); - b2Log(" bodies[%d]->CreateFixture(&fd);\n", bodyIndex); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2Fixture.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/b2Fixture.h deleted file mode 100644 index 753127fb..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2Fixture.h +++ /dev/null @@ -1,345 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_FIXTURE_H -#define B2_FIXTURE_H - -#include -#include -#include - -class b2BlockAllocator; -class b2Body; -class b2BroadPhase; -class b2Fixture; - -/// This holds contact filtering data. -struct b2Filter -{ - b2Filter() - { - categoryBits = 0x0001; - maskBits = 0xFFFF; - groupIndex = 0; - } - - /// The collision category bits. Normally you would just set one bit. - uint16 categoryBits; - - /// The collision mask bits. This states the categories that this - /// shape would accept for collision. - uint16 maskBits; - - /// Collision groups allow a certain group of objects to never collide (negative) - /// or always collide (positive). Zero means no collision group. Non-zero group - /// filtering always wins against the mask bits. - int16 groupIndex; -}; - -/// A fixture definition is used to create a fixture. This class defines an -/// abstract fixture definition. You can reuse fixture definitions safely. -struct b2FixtureDef -{ - /// The constructor sets the default fixture definition values. - b2FixtureDef() - { - shape = NULL; - userData = NULL; - friction = 0.2f; - restitution = 0.0f; - density = 0.0f; - isSensor = false; - } - - /// The shape, this must be set. The shape will be cloned, so you - /// can create the shape on the stack. - const b2Shape* shape; - - /// Use this to store application specific fixture data. - void* userData; - - /// The friction coefficient, usually in the range [0,1]. - float32 friction; - - /// The restitution (elasticity) usually in the range [0,1]. - float32 restitution; - - /// The density, usually in kg/m^2. - float32 density; - - /// A sensor shape collects contact information but never generates a collision - /// response. - bool isSensor; - - /// Contact filtering data. - b2Filter filter; -}; - -/// This proxy is used internally to connect fixtures to the broad-phase. -struct b2FixtureProxy -{ - b2AABB aabb; - b2Fixture* fixture; - int32 childIndex; - int32 proxyId; -}; - -/// A fixture is used to attach a shape to a body for collision detection. A fixture -/// inherits its transform from its parent. Fixtures hold additional non-geometric data -/// such as friction, collision filters, etc. -/// Fixtures are created via b2Body::CreateFixture. -/// @warning you cannot reuse fixtures. -class b2Fixture -{ -public: - /// Get the type of the child shape. You can use this to down cast to the concrete shape. - /// @return the shape type. - b2Shape::Type GetType() const; - - /// Get the child shape. You can modify the child shape, however you should not change the - /// number of vertices because this will crash some collision caching mechanisms. - /// Manipulating the shape may lead to non-physical behavior. - b2Shape* GetShape(); - const b2Shape* GetShape() const; - - /// Set if this fixture is a sensor. - void SetSensor(bool sensor); - - /// Is this fixture a sensor (non-solid)? - /// @return the true if the shape is a sensor. - bool IsSensor() const; - - /// Set the contact filtering data. This will not update contacts until the next time - /// step when either parent body is active and awake. - /// This automatically calls Refilter. - void SetFilterData(const b2Filter& filter); - - /// Get the contact filtering data. - const b2Filter& GetFilterData() const; - - /// Call this if you want to establish collision that was previously disabled by b2ContactFilter::ShouldCollide. - void Refilter(); - - /// Get the parent body of this fixture. This is NULL if the fixture is not attached. - /// @return the parent body. - b2Body* GetBody(); - const b2Body* GetBody() const; - - /// Get the next fixture in the parent body's fixture list. - /// @return the next shape. - b2Fixture* GetNext(); - const b2Fixture* GetNext() const; - - /// Get the user data that was assigned in the fixture definition. Use this to - /// store your application specific data. - void* GetUserData() const; - - /// Set the user data. Use this to store your application specific data. - void SetUserData(void* data); - - /// Test a point for containment in this fixture. - /// @param p a point in world coordinates. - bool TestPoint(const b2Vec2& p) const; - - /// Cast a ray against this shape. - /// @param output the ray-cast results. - /// @param input the ray-cast input parameters. - bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input, int32 childIndex) const; - - /// Get the mass data for this fixture. The mass data is based on the density and - /// the shape. The rotational inertia is about the shape's origin. This operation - /// may be expensive. - void GetMassData(b2MassData* massData) const; - - /// Set the density of this fixture. This will _not_ automatically adjust the mass - /// of the body. You must call b2Body::ResetMassData to update the body's mass. - void SetDensity(float32 density); - - /// Get the density of this fixture. - float32 GetDensity() const; - - /// Get the coefficient of friction. - float32 GetFriction() const; - - /// Set the coefficient of friction. This will _not_ change the friction of - /// existing contacts. - void SetFriction(float32 friction); - - /// Get the coefficient of restitution. - float32 GetRestitution() const; - - /// Set the coefficient of restitution. This will _not_ change the restitution of - /// existing contacts. - void SetRestitution(float32 restitution); - - /// Get the fixture's AABB. This AABB may be enlarge and/or stale. - /// If you need a more accurate AABB, compute it using the shape and - /// the body transform. - const b2AABB& GetAABB(int32 childIndex) const; - - /// Dump this fixture to the log file. - void Dump(int32 bodyIndex); - -protected: - - friend class b2Body; - friend class b2World; - friend class b2Contact; - friend class b2ContactManager; - - b2Fixture(); - - // We need separation create/destroy functions from the constructor/destructor because - // the destructor cannot access the allocator (no destructor arguments allowed by C++). - void Create(b2BlockAllocator* allocator, b2Body* body, const b2FixtureDef* def); - void Destroy(b2BlockAllocator* allocator); - - // These support body activation/deactivation. - void CreateProxies(b2BroadPhase* broadPhase, const b2Transform& xf); - void DestroyProxies(b2BroadPhase* broadPhase); - - void Synchronize(b2BroadPhase* broadPhase, const b2Transform& xf1, const b2Transform& xf2); - - float32 m_density; - - b2Fixture* m_next; - b2Body* m_body; - - b2Shape* m_shape; - - float32 m_friction; - float32 m_restitution; - - b2FixtureProxy* m_proxies; - int32 m_proxyCount; - - b2Filter m_filter; - - bool m_isSensor; - - void* m_userData; -}; - -inline b2Shape::Type b2Fixture::GetType() const -{ - return m_shape->GetType(); -} - -inline b2Shape* b2Fixture::GetShape() -{ - return m_shape; -} - -inline const b2Shape* b2Fixture::GetShape() const -{ - return m_shape; -} - -inline bool b2Fixture::IsSensor() const -{ - return m_isSensor; -} - -inline const b2Filter& b2Fixture::GetFilterData() const -{ - return m_filter; -} - -inline void* b2Fixture::GetUserData() const -{ - return m_userData; -} - -inline void b2Fixture::SetUserData(void* data) -{ - m_userData = data; -} - -inline b2Body* b2Fixture::GetBody() -{ - return m_body; -} - -inline const b2Body* b2Fixture::GetBody() const -{ - return m_body; -} - -inline b2Fixture* b2Fixture::GetNext() -{ - return m_next; -} - -inline const b2Fixture* b2Fixture::GetNext() const -{ - return m_next; -} - -inline void b2Fixture::SetDensity(float32 density) -{ - b2Assert(b2IsValid(density) && density >= 0.0f); - m_density = density; -} - -inline float32 b2Fixture::GetDensity() const -{ - return m_density; -} - -inline float32 b2Fixture::GetFriction() const -{ - return m_friction; -} - -inline void b2Fixture::SetFriction(float32 friction) -{ - m_friction = friction; -} - -inline float32 b2Fixture::GetRestitution() const -{ - return m_restitution; -} - -inline void b2Fixture::SetRestitution(float32 restitution) -{ - m_restitution = restitution; -} - -inline bool b2Fixture::TestPoint(const b2Vec2& p) const -{ - return m_shape->TestPoint(m_body->GetTransform(), p); -} - -inline bool b2Fixture::RayCast(b2RayCastOutput* output, const b2RayCastInput& input, int32 childIndex) const -{ - return m_shape->RayCast(output, input, m_body->GetTransform(), childIndex); -} - -inline void b2Fixture::GetMassData(b2MassData* massData) const -{ - m_shape->ComputeMass(massData, m_density); -} - -inline const b2AABB& b2Fixture::GetAABB(int32 childIndex) const -{ - b2Assert(0 <= childIndex && childIndex < m_proxyCount); - return m_proxies[childIndex].aabb; -} - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2Island.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/b2Island.cpp deleted file mode 100644 index d46589de..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2Island.cpp +++ /dev/null @@ -1,539 +0,0 @@ -/* -* Copyright (c) 2006-2011 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* -Position Correction Notes -========================= -I tried the several algorithms for position correction of the 2D revolute joint. -I looked at these systems: -- simple pendulum (1m diameter sphere on massless 5m stick) with initial angular velocity of 100 rad/s. -- suspension bridge with 30 1m long planks of length 1m. -- multi-link chain with 30 1m long links. - -Here are the algorithms: - -Baumgarte - A fraction of the position error is added to the velocity error. There is no -separate position solver. - -Pseudo Velocities - After the velocity solver and position integration, -the position error, Jacobian, and effective mass are recomputed. Then -the velocity constraints are solved with pseudo velocities and a fraction -of the position error is added to the pseudo velocity error. The pseudo -velocities are initialized to zero and there is no warm-starting. After -the position solver, the pseudo velocities are added to the positions. -This is also called the First Order World method or the Position LCP method. - -Modified Nonlinear Gauss-Seidel (NGS) - Like Pseudo Velocities except the -position error is re-computed for each constraint and the positions are updated -after the constraint is solved. The radius vectors (aka Jacobians) are -re-computed too (otherwise the algorithm has horrible instability). The pseudo -velocity states are not needed because they are effectively zero at the beginning -of each iteration. Since we have the current position error, we allow the -iterations to terminate early if the error becomes smaller than b2_linearSlop. - -Full NGS or just NGS - Like Modified NGS except the effective mass are re-computed -each time a constraint is solved. - -Here are the results: -Baumgarte - this is the cheapest algorithm but it has some stability problems, -especially with the bridge. The chain links separate easily close to the root -and they jitter as they struggle to pull together. This is one of the most common -methods in the field. The big drawback is that the position correction artificially -affects the momentum, thus leading to instabilities and false bounce. I used a -bias factor of 0.2. A larger bias factor makes the bridge less stable, a smaller -factor makes joints and contacts more spongy. - -Pseudo Velocities - the is more stable than the Baumgarte method. The bridge is -stable. However, joints still separate with large angular velocities. Drag the -simple pendulum in a circle quickly and the joint will separate. The chain separates -easily and does not recover. I used a bias factor of 0.2. A larger value lead to -the bridge collapsing when a heavy cube drops on it. - -Modified NGS - this algorithm is better in some ways than Baumgarte and Pseudo -Velocities, but in other ways it is worse. The bridge and chain are much more -stable, but the simple pendulum goes unstable at high angular velocities. - -Full NGS - stable in all tests. The joints display good stiffness. The bridge -still sags, but this is better than infinite forces. - -Recommendations -Pseudo Velocities are not really worthwhile because the bridge and chain cannot -recover from joint separation. In other cases the benefit over Baumgarte is small. - -Modified NGS is not a robust method for the revolute joint due to the violent -instability seen in the simple pendulum. Perhaps it is viable with other constraint -types, especially scalar constraints where the effective mass is a scalar. - -This leaves Baumgarte and Full NGS. Baumgarte has small, but manageable instabilities -and is very fast. I don't think we can escape Baumgarte, especially in highly -demanding cases where high constraint fidelity is not needed. - -Full NGS is robust and easy on the eyes. I recommend this as an option for -higher fidelity simulation and certainly for suspension bridges and long chains. -Full NGS might be a good choice for ragdolls, especially motorized ragdolls where -joint separation can be problematic. The number of NGS iterations can be reduced -for better performance without harming robustness much. - -Each joint in a can be handled differently in the position solver. So I recommend -a system where the user can select the algorithm on a per joint basis. I would -probably default to the slower Full NGS and let the user select the faster -Baumgarte method in performance critical scenarios. -*/ - -/* -Cache Performance - -The Box2D solvers are dominated by cache misses. Data structures are designed -to increase the number of cache hits. Much of misses are due to random access -to body data. The constraint structures are iterated over linearly, which leads -to few cache misses. - -The bodies are not accessed during iteration. Instead read only data, such as -the mass values are stored with the constraints. The mutable data are the constraint -impulses and the bodies velocities/positions. The impulses are held inside the -constraint structures. The body velocities/positions are held in compact, temporary -arrays to increase the number of cache hits. Linear and angular velocity are -stored in a single array since multiple arrays lead to multiple misses. -*/ - -/* -2D Rotation - -R = [cos(theta) -sin(theta)] - [sin(theta) cos(theta) ] - -thetaDot = omega - -Let q1 = cos(theta), q2 = sin(theta). -R = [q1 -q2] - [q2 q1] - -q1Dot = -thetaDot * q2 -q2Dot = thetaDot * q1 - -q1_new = q1_old - dt * w * q2 -q2_new = q2_old + dt * w * q1 -then normalize. - -This might be faster than computing sin+cos. -However, we can compute sin+cos of the same angle fast. -*/ - -b2Island::b2Island( - int32 bodyCapacity, - int32 contactCapacity, - int32 jointCapacity, - b2StackAllocator* allocator, - b2ContactListener* listener) -{ - m_bodyCapacity = bodyCapacity; - m_contactCapacity = contactCapacity; - m_jointCapacity = jointCapacity; - m_bodyCount = 0; - m_contactCount = 0; - m_jointCount = 0; - - m_allocator = allocator; - m_listener = listener; - - m_bodies = (b2Body**)m_allocator->Allocate(bodyCapacity * sizeof(b2Body*)); - m_contacts = (b2Contact**)m_allocator->Allocate(contactCapacity * sizeof(b2Contact*)); - m_joints = (b2Joint**)m_allocator->Allocate(jointCapacity * sizeof(b2Joint*)); - - m_velocities = (b2Velocity*)m_allocator->Allocate(m_bodyCapacity * sizeof(b2Velocity)); - m_positions = (b2Position*)m_allocator->Allocate(m_bodyCapacity * sizeof(b2Position)); -} - -b2Island::~b2Island() -{ - // Warning: the order should reverse the constructor order. - m_allocator->Free(m_positions); - m_allocator->Free(m_velocities); - m_allocator->Free(m_joints); - m_allocator->Free(m_contacts); - m_allocator->Free(m_bodies); -} - -void b2Island::Solve(b2Profile* profile, const b2TimeStep& step, const b2Vec2& gravity, bool allowSleep) -{ - b2Timer timer; - - float32 h = step.dt; - - // Integrate velocities and apply damping. Initialize the body state. - for (int32 i = 0; i < m_bodyCount; ++i) - { - b2Body* b = m_bodies[i]; - - b2Vec2 c = b->m_sweep.c; - float32 a = b->m_sweep.a; - b2Vec2 v = b->m_linearVelocity; - float32 w = b->m_angularVelocity; - - // Store positions for continuous collision. - b->m_sweep.c0 = b->m_sweep.c; - b->m_sweep.a0 = b->m_sweep.a; - - if (b->m_type == b2_dynamicBody) - { - // Integrate velocities. - v += h * (b->m_gravityScale * gravity + b->m_invMass * b->m_force); - w += h * b->m_invI * b->m_torque; - - // Apply damping. - // ODE: dv/dt + c * v = 0 - // Solution: v(t) = v0 * exp(-c * t) - // Time step: v(t + dt) = v0 * exp(-c * (t + dt)) = v0 * exp(-c * t) * exp(-c * dt) = v * exp(-c * dt) - // v2 = exp(-c * dt) * v1 - // Pade approximation: - // v2 = v1 * 1 / (1 + c * dt) - v *= 1.0f / (1.0f + h * b->m_linearDamping); - w *= 1.0f / (1.0f + h * b->m_angularDamping); - } - - m_positions[i].c = c; - m_positions[i].a = a; - m_velocities[i].v = v; - m_velocities[i].w = w; - } - - timer.Reset(); - - // Solver data - b2SolverData solverData; - solverData.step = step; - solverData.positions = m_positions; - solverData.velocities = m_velocities; - - // Initialize velocity constraints. - b2ContactSolverDef contactSolverDef; - contactSolverDef.step = step; - contactSolverDef.contacts = m_contacts; - contactSolverDef.count = m_contactCount; - contactSolverDef.positions = m_positions; - contactSolverDef.velocities = m_velocities; - contactSolverDef.allocator = m_allocator; - - b2ContactSolver contactSolver(&contactSolverDef); - contactSolver.InitializeVelocityConstraints(); - - if (step.warmStarting) - { - contactSolver.WarmStart(); - } - - for (int32 i = 0; i < m_jointCount; ++i) - { - m_joints[i]->InitVelocityConstraints(solverData); - } - - profile->solveInit = timer.GetMilliseconds(); - - // Solve velocity constraints - timer.Reset(); - for (int32 i = 0; i < step.velocityIterations; ++i) - { - for (int32 j = 0; j < m_jointCount; ++j) - { - m_joints[j]->SolveVelocityConstraints(solverData); - } - - contactSolver.SolveVelocityConstraints(); - } - - // Store impulses for warm starting - contactSolver.StoreImpulses(); - profile->solveVelocity = timer.GetMilliseconds(); - - // Integrate positions - for (int32 i = 0; i < m_bodyCount; ++i) - { - b2Vec2 c = m_positions[i].c; - float32 a = m_positions[i].a; - b2Vec2 v = m_velocities[i].v; - float32 w = m_velocities[i].w; - - // Check for large velocities - b2Vec2 translation = h * v; - if (b2Dot(translation, translation) > b2_maxTranslationSquared) - { - float32 ratio = b2_maxTranslation / translation.Length(); - v *= ratio; - } - - float32 rotation = h * w; - if (rotation * rotation > b2_maxRotationSquared) - { - float32 ratio = b2_maxRotation / b2Abs(rotation); - w *= ratio; - } - - // Integrate - c += h * v; - a += h * w; - - m_positions[i].c = c; - m_positions[i].a = a; - m_velocities[i].v = v; - m_velocities[i].w = w; - } - - // Solve position constraints - timer.Reset(); - bool positionSolved = false; - for (int32 i = 0; i < step.positionIterations; ++i) - { - bool contactsOkay = contactSolver.SolvePositionConstraints(); - - bool jointsOkay = true; - for (int32 i = 0; i < m_jointCount; ++i) - { - bool jointOkay = m_joints[i]->SolvePositionConstraints(solverData); - jointsOkay = jointsOkay && jointOkay; - } - - if (contactsOkay && jointsOkay) - { - // Exit early if the position errors are small. - positionSolved = true; - break; - } - } - - // Copy state buffers back to the bodies - for (int32 i = 0; i < m_bodyCount; ++i) - { - b2Body* body = m_bodies[i]; - body->m_sweep.c = m_positions[i].c; - body->m_sweep.a = m_positions[i].a; - body->m_linearVelocity = m_velocities[i].v; - body->m_angularVelocity = m_velocities[i].w; - body->SynchronizeTransform(); - } - - profile->solvePosition = timer.GetMilliseconds(); - - Report(contactSolver.m_velocityConstraints); - - if (allowSleep) - { - float32 minSleepTime = b2_maxFloat; - - const float32 linTolSqr = b2_linearSleepTolerance * b2_linearSleepTolerance; - const float32 angTolSqr = b2_angularSleepTolerance * b2_angularSleepTolerance; - - for (int32 i = 0; i < m_bodyCount; ++i) - { - b2Body* b = m_bodies[i]; - if (b->GetType() == b2_staticBody) - { - continue; - } - - if ((b->m_flags & b2Body::e_autoSleepFlag) == 0 || - b->m_angularVelocity * b->m_angularVelocity > angTolSqr || - b2Dot(b->m_linearVelocity, b->m_linearVelocity) > linTolSqr) - { - b->m_sleepTime = 0.0f; - minSleepTime = 0.0f; - } - else - { - b->m_sleepTime += h; - minSleepTime = b2Min(minSleepTime, b->m_sleepTime); - } - } - - if (minSleepTime >= b2_timeToSleep && positionSolved) - { - for (int32 i = 0; i < m_bodyCount; ++i) - { - b2Body* b = m_bodies[i]; - b->SetAwake(false); - } - } - } -} - -void b2Island::SolveTOI(const b2TimeStep& subStep, int32 toiIndexA, int32 toiIndexB) -{ - b2Assert(toiIndexA < m_bodyCount); - b2Assert(toiIndexB < m_bodyCount); - - // Initialize the body state. - for (int32 i = 0; i < m_bodyCount; ++i) - { - b2Body* b = m_bodies[i]; - m_positions[i].c = b->m_sweep.c; - m_positions[i].a = b->m_sweep.a; - m_velocities[i].v = b->m_linearVelocity; - m_velocities[i].w = b->m_angularVelocity; - } - - b2ContactSolverDef contactSolverDef; - contactSolverDef.contacts = m_contacts; - contactSolverDef.count = m_contactCount; - contactSolverDef.allocator = m_allocator; - contactSolverDef.step = subStep; - contactSolverDef.positions = m_positions; - contactSolverDef.velocities = m_velocities; - b2ContactSolver contactSolver(&contactSolverDef); - - // Solve position constraints. - for (int32 i = 0; i < subStep.positionIterations; ++i) - { - bool contactsOkay = contactSolver.SolveTOIPositionConstraints(toiIndexA, toiIndexB); - if (contactsOkay) - { - break; - } - } - -#if 0 - // Is the new position really safe? - for (int32 i = 0; i < m_contactCount; ++i) - { - b2Contact* c = m_contacts[i]; - b2Fixture* fA = c->GetFixtureA(); - b2Fixture* fB = c->GetFixtureB(); - - b2Body* bA = fA->GetBody(); - b2Body* bB = fB->GetBody(); - - int32 indexA = c->GetChildIndexA(); - int32 indexB = c->GetChildIndexB(); - - b2DistanceInput input; - input.proxyA.Set(fA->GetShape(), indexA); - input.proxyB.Set(fB->GetShape(), indexB); - input.transformA = bA->GetTransform(); - input.transformB = bB->GetTransform(); - input.useRadii = false; - - b2DistanceOutput output; - b2SimplexCache cache; - cache.count = 0; - b2Distance(&output, &cache, &input); - - if (output.distance == 0 || cache.count == 3) - { - cache.count += 0; - } - } -#endif - - // Leap of faith to new safe state. - m_bodies[toiIndexA]->m_sweep.c0 = m_positions[toiIndexA].c; - m_bodies[toiIndexA]->m_sweep.a0 = m_positions[toiIndexA].a; - m_bodies[toiIndexB]->m_sweep.c0 = m_positions[toiIndexB].c; - m_bodies[toiIndexB]->m_sweep.a0 = m_positions[toiIndexB].a; - - // No warm starting is needed for TOI events because warm - // starting impulses were applied in the discrete solver. - contactSolver.InitializeVelocityConstraints(); - - // Solve velocity constraints. - for (int32 i = 0; i < subStep.velocityIterations; ++i) - { - contactSolver.SolveVelocityConstraints(); - } - - // Don't store the TOI contact forces for warm starting - // because they can be quite large. - - float32 h = subStep.dt; - - // Integrate positions - for (int32 i = 0; i < m_bodyCount; ++i) - { - b2Vec2 c = m_positions[i].c; - float32 a = m_positions[i].a; - b2Vec2 v = m_velocities[i].v; - float32 w = m_velocities[i].w; - - // Check for large velocities - b2Vec2 translation = h * v; - if (b2Dot(translation, translation) > b2_maxTranslationSquared) - { - float32 ratio = b2_maxTranslation / translation.Length(); - v *= ratio; - } - - float32 rotation = h * w; - if (rotation * rotation > b2_maxRotationSquared) - { - float32 ratio = b2_maxRotation / b2Abs(rotation); - w *= ratio; - } - - // Integrate - c += h * v; - a += h * w; - - m_positions[i].c = c; - m_positions[i].a = a; - m_velocities[i].v = v; - m_velocities[i].w = w; - - // Sync bodies - b2Body* body = m_bodies[i]; - body->m_sweep.c = c; - body->m_sweep.a = a; - body->m_linearVelocity = v; - body->m_angularVelocity = w; - body->SynchronizeTransform(); - } - - Report(contactSolver.m_velocityConstraints); -} - -void b2Island::Report(const b2ContactVelocityConstraint* constraints) -{ - if (m_listener == NULL) - { - return; - } - - for (int32 i = 0; i < m_contactCount; ++i) - { - b2Contact* c = m_contacts[i]; - - const b2ContactVelocityConstraint* vc = constraints + i; - - b2ContactImpulse impulse; - impulse.count = vc->pointCount; - for (int32 j = 0; j < vc->pointCount; ++j) - { - impulse.normalImpulses[j] = vc->points[j].normalImpulse; - impulse.tangentImpulses[j] = vc->points[j].tangentImpulse; - } - - m_listener->PostSolve(c, &impulse); - } -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2Island.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/b2Island.h deleted file mode 100644 index 4a814c46..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2Island.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_ISLAND_H -#define B2_ISLAND_H - -#include -#include -#include - -class b2Contact; -class b2Joint; -class b2StackAllocator; -class b2ContactListener; -struct b2ContactVelocityConstraint; -struct b2Profile; - -/// This is an internal class. -class b2Island -{ -public: - b2Island(int32 bodyCapacity, int32 contactCapacity, int32 jointCapacity, - b2StackAllocator* allocator, b2ContactListener* listener); - ~b2Island(); - - void Clear() - { - m_bodyCount = 0; - m_contactCount = 0; - m_jointCount = 0; - } - - void Solve(b2Profile* profile, const b2TimeStep& step, const b2Vec2& gravity, bool allowSleep); - - void SolveTOI(const b2TimeStep& subStep, int32 toiIndexA, int32 toiIndexB); - - void Add(b2Body* body) - { - b2Assert(m_bodyCount < m_bodyCapacity); - body->m_islandIndex = m_bodyCount; - m_bodies[m_bodyCount] = body; - ++m_bodyCount; - } - - void Add(b2Contact* contact) - { - b2Assert(m_contactCount < m_contactCapacity); - m_contacts[m_contactCount++] = contact; - } - - void Add(b2Joint* joint) - { - b2Assert(m_jointCount < m_jointCapacity); - m_joints[m_jointCount++] = joint; - } - - void Report(const b2ContactVelocityConstraint* constraints); - - b2StackAllocator* m_allocator; - b2ContactListener* m_listener; - - b2Body** m_bodies; - b2Contact** m_contacts; - b2Joint** m_joints; - - b2Position* m_positions; - b2Velocity* m_velocities; - - int32 m_bodyCount; - int32 m_jointCount; - int32 m_contactCount; - - int32 m_bodyCapacity; - int32 m_contactCapacity; - int32 m_jointCapacity; -}; - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2TimeStep.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/b2TimeStep.h deleted file mode 100644 index a3727624..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2TimeStep.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -* Copyright (c) 2006-2011 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_TIME_STEP_H -#define B2_TIME_STEP_H - -#include - -/// Profiling data. Times are in milliseconds. -struct b2Profile -{ - float32 step; - float32 collide; - float32 solve; - float32 solveInit; - float32 solveVelocity; - float32 solvePosition; - float32 broadphase; - float32 solveTOI; -}; - -/// This is an internal structure. -struct b2TimeStep -{ - float32 dt; // time step - float32 inv_dt; // inverse time step (0 if dt == 0). - float32 dtRatio; // dt * inv_dt0 - int32 velocityIterations; - int32 positionIterations; - bool warmStarting; -}; - -/// This is an internal structure. -struct b2Position -{ - b2Vec2 c; - float32 a; -}; - -/// This is an internal structure. -struct b2Velocity -{ - b2Vec2 v; - float32 w; -}; - -/// Solver Data -struct b2SolverData -{ - b2TimeStep step; - b2Position* positions; - b2Velocity* velocities; -}; - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2World.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/b2World.cpp deleted file mode 100644 index c6cf2957..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2World.cpp +++ /dev/null @@ -1,1339 +0,0 @@ -/* -* Copyright (c) 2006-2011 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -b2World::b2World(const b2Vec2& gravity) -{ - m_destructionListener = NULL; - g_debugDraw = NULL; - - m_bodyList = NULL; - m_jointList = NULL; - - m_bodyCount = 0; - m_jointCount = 0; - - m_warmStarting = true; - m_continuousPhysics = true; - m_subStepping = false; - - m_stepComplete = true; - - m_allowSleep = true; - m_gravity = gravity; - - m_flags = e_clearForces; - - m_inv_dt0 = 0.0f; - - m_contactManager.m_allocator = &m_blockAllocator; - - memset(&m_profile, 0, sizeof(b2Profile)); -} - -b2World::~b2World() -{ - // Some shapes allocate using b2Alloc. - b2Body* b = m_bodyList; - while (b) - { - b2Body* bNext = b->m_next; - - b2Fixture* f = b->m_fixtureList; - while (f) - { - b2Fixture* fNext = f->m_next; - f->m_proxyCount = 0; - f->Destroy(&m_blockAllocator); - f = fNext; - } - - b = bNext; - } -} - -void b2World::SetDestructionListener(b2DestructionListener* listener) -{ - m_destructionListener = listener; -} - -void b2World::SetContactFilter(b2ContactFilter* filter) -{ - m_contactManager.m_contactFilter = filter; -} - -void b2World::SetContactListener(b2ContactListener* listener) -{ - m_contactManager.m_contactListener = listener; -} - -void b2World::SetDebugDraw(b2Draw* debugDraw) -{ - g_debugDraw = debugDraw; -} - -b2Body* b2World::CreateBody(const b2BodyDef* def) -{ - b2Assert(IsLocked() == false); - if (IsLocked()) - { - return NULL; - } - - void* mem = m_blockAllocator.Allocate(sizeof(b2Body)); - b2Body* b = new (mem) b2Body(def, this); - - // Add to world doubly linked list. - b->m_prev = NULL; - b->m_next = m_bodyList; - if (m_bodyList) - { - m_bodyList->m_prev = b; - } - m_bodyList = b; - ++m_bodyCount; - - return b; -} - -void b2World::DestroyBody(b2Body* b) -{ - b2Assert(m_bodyCount > 0); - b2Assert(IsLocked() == false); - if (IsLocked()) - { - return; - } - - // Delete the attached joints. - b2JointEdge* je = b->m_jointList; - while (je) - { - b2JointEdge* je0 = je; - je = je->next; - - if (m_destructionListener) - { - m_destructionListener->SayGoodbye(je0->joint); - } - - DestroyJoint(je0->joint); - - b->m_jointList = je; - } - b->m_jointList = NULL; - - // Delete the attached contacts. - b2ContactEdge* ce = b->m_contactList; - while (ce) - { - b2ContactEdge* ce0 = ce; - ce = ce->next; - m_contactManager.Destroy(ce0->contact); - } - b->m_contactList = NULL; - - // Delete the attached fixtures. This destroys broad-phase proxies. - b2Fixture* f = b->m_fixtureList; - while (f) - { - b2Fixture* f0 = f; - f = f->m_next; - - if (m_destructionListener) - { - m_destructionListener->SayGoodbye(f0); - } - - f0->DestroyProxies(&m_contactManager.m_broadPhase); - f0->Destroy(&m_blockAllocator); - f0->~b2Fixture(); - m_blockAllocator.Free(f0, sizeof(b2Fixture)); - - b->m_fixtureList = f; - b->m_fixtureCount -= 1; - } - b->m_fixtureList = NULL; - b->m_fixtureCount = 0; - - // Remove world body list. - if (b->m_prev) - { - b->m_prev->m_next = b->m_next; - } - - if (b->m_next) - { - b->m_next->m_prev = b->m_prev; - } - - if (b == m_bodyList) - { - m_bodyList = b->m_next; - } - - --m_bodyCount; - b->~b2Body(); - m_blockAllocator.Free(b, sizeof(b2Body)); -} - -b2Joint* b2World::CreateJoint(const b2JointDef* def) -{ - b2Assert(IsLocked() == false); - if (IsLocked()) - { - return NULL; - } - - b2Joint* j = b2Joint::Create(def, &m_blockAllocator); - - // Connect to the world list. - j->m_prev = NULL; - j->m_next = m_jointList; - if (m_jointList) - { - m_jointList->m_prev = j; - } - m_jointList = j; - ++m_jointCount; - - // Connect to the bodies' doubly linked lists. - j->m_edgeA.joint = j; - j->m_edgeA.other = j->m_bodyB; - j->m_edgeA.prev = NULL; - j->m_edgeA.next = j->m_bodyA->m_jointList; - if (j->m_bodyA->m_jointList) j->m_bodyA->m_jointList->prev = &j->m_edgeA; - j->m_bodyA->m_jointList = &j->m_edgeA; - - j->m_edgeB.joint = j; - j->m_edgeB.other = j->m_bodyA; - j->m_edgeB.prev = NULL; - j->m_edgeB.next = j->m_bodyB->m_jointList; - if (j->m_bodyB->m_jointList) j->m_bodyB->m_jointList->prev = &j->m_edgeB; - j->m_bodyB->m_jointList = &j->m_edgeB; - - b2Body* bodyA = def->bodyA; - b2Body* bodyB = def->bodyB; - - // If the joint prevents collisions, then flag any contacts for filtering. - if (def->collideConnected == false) - { - b2ContactEdge* edge = bodyB->GetContactList(); - while (edge) - { - if (edge->other == bodyA) - { - // Flag the contact for filtering at the next time step (where either - // body is awake). - edge->contact->FlagForFiltering(); - } - - edge = edge->next; - } - } - - // Note: creating a joint doesn't wake the bodies. - - return j; -} - -void b2World::DestroyJoint(b2Joint* j) -{ - b2Assert(IsLocked() == false); - if (IsLocked()) - { - return; - } - - bool collideConnected = j->m_collideConnected; - - // Remove from the doubly linked list. - if (j->m_prev) - { - j->m_prev->m_next = j->m_next; - } - - if (j->m_next) - { - j->m_next->m_prev = j->m_prev; - } - - if (j == m_jointList) - { - m_jointList = j->m_next; - } - - // Disconnect from island graph. - b2Body* bodyA = j->m_bodyA; - b2Body* bodyB = j->m_bodyB; - - // Wake up connected bodies. - bodyA->SetAwake(true); - bodyB->SetAwake(true); - - // Remove from body 1. - if (j->m_edgeA.prev) - { - j->m_edgeA.prev->next = j->m_edgeA.next; - } - - if (j->m_edgeA.next) - { - j->m_edgeA.next->prev = j->m_edgeA.prev; - } - - if (&j->m_edgeA == bodyA->m_jointList) - { - bodyA->m_jointList = j->m_edgeA.next; - } - - j->m_edgeA.prev = NULL; - j->m_edgeA.next = NULL; - - // Remove from body 2 - if (j->m_edgeB.prev) - { - j->m_edgeB.prev->next = j->m_edgeB.next; - } - - if (j->m_edgeB.next) - { - j->m_edgeB.next->prev = j->m_edgeB.prev; - } - - if (&j->m_edgeB == bodyB->m_jointList) - { - bodyB->m_jointList = j->m_edgeB.next; - } - - j->m_edgeB.prev = NULL; - j->m_edgeB.next = NULL; - - b2Joint::Destroy(j, &m_blockAllocator); - - b2Assert(m_jointCount > 0); - --m_jointCount; - - // If the joint prevents collisions, then flag any contacts for filtering. - if (collideConnected == false) - { - b2ContactEdge* edge = bodyB->GetContactList(); - while (edge) - { - if (edge->other == bodyA) - { - // Flag the contact for filtering at the next time step (where either - // body is awake). - edge->contact->FlagForFiltering(); - } - - edge = edge->next; - } - } -} - -// -void b2World::SetAllowSleeping(bool flag) -{ - if (flag == m_allowSleep) - { - return; - } - - m_allowSleep = flag; - if (m_allowSleep == false) - { - for (b2Body* b = m_bodyList; b; b = b->m_next) - { - b->SetAwake(true); - } - } -} - -// Find islands, integrate and solve constraints, solve position constraints -void b2World::Solve(const b2TimeStep& step) -{ - m_profile.solveInit = 0.0f; - m_profile.solveVelocity = 0.0f; - m_profile.solvePosition = 0.0f; - - // Size the island for the worst case. - b2Island island(m_bodyCount, - m_contactManager.m_contactCount, - m_jointCount, - &m_stackAllocator, - m_contactManager.m_contactListener); - - // Clear all the island flags. - for (b2Body* b = m_bodyList; b; b = b->m_next) - { - b->m_flags &= ~b2Body::e_islandFlag; - } - for (b2Contact* c = m_contactManager.m_contactList; c; c = c->m_next) - { - c->m_flags &= ~b2Contact::e_islandFlag; - } - for (b2Joint* j = m_jointList; j; j = j->m_next) - { - j->m_islandFlag = false; - } - - // Build and simulate all awake islands. - int32 stackSize = m_bodyCount; - b2Body** stack = (b2Body**)m_stackAllocator.Allocate(stackSize * sizeof(b2Body*)); - for (b2Body* seed = m_bodyList; seed; seed = seed->m_next) - { - if (seed->m_flags & b2Body::e_islandFlag) - { - continue; - } - - if (seed->IsAwake() == false || seed->IsActive() == false) - { - continue; - } - - // The seed can be dynamic or kinematic. - if (seed->GetType() == b2_staticBody) - { - continue; - } - - // Reset island and stack. - island.Clear(); - int32 stackCount = 0; - stack[stackCount++] = seed; - seed->m_flags |= b2Body::e_islandFlag; - - // Perform a depth first search (DFS) on the constraint graph. - while (stackCount > 0) - { - // Grab the next body off the stack and add it to the island. - b2Body* b = stack[--stackCount]; - b2Assert(b->IsActive() == true); - island.Add(b); - - // Make sure the body is awake. - b->SetAwake(true); - - // To keep islands as small as possible, we don't - // propagate islands across static bodies. - if (b->GetType() == b2_staticBody) - { - continue; - } - - // Search all contacts connected to this body. - for (b2ContactEdge* ce = b->m_contactList; ce; ce = ce->next) - { - b2Contact* contact = ce->contact; - - // Has this contact already been added to an island? - if (contact->m_flags & b2Contact::e_islandFlag) - { - continue; - } - - // Is this contact solid and touching? - if (contact->IsEnabled() == false || - contact->IsTouching() == false) - { - continue; - } - - // Skip sensors. - bool sensorA = contact->m_fixtureA->m_isSensor; - bool sensorB = contact->m_fixtureB->m_isSensor; - if (sensorA || sensorB) - { - continue; - } - - island.Add(contact); - contact->m_flags |= b2Contact::e_islandFlag; - - b2Body* other = ce->other; - - // Was the other body already added to this island? - if (other->m_flags & b2Body::e_islandFlag) - { - continue; - } - - b2Assert(stackCount < stackSize); - stack[stackCount++] = other; - other->m_flags |= b2Body::e_islandFlag; - } - - // Search all joints connect to this body. - for (b2JointEdge* je = b->m_jointList; je; je = je->next) - { - if (je->joint->m_islandFlag == true) - { - continue; - } - - b2Body* other = je->other; - - // Don't simulate joints connected to inactive bodies. - if (other->IsActive() == false) - { - continue; - } - - island.Add(je->joint); - je->joint->m_islandFlag = true; - - if (other->m_flags & b2Body::e_islandFlag) - { - continue; - } - - b2Assert(stackCount < stackSize); - stack[stackCount++] = other; - other->m_flags |= b2Body::e_islandFlag; - } - } - - b2Profile profile; - island.Solve(&profile, step, m_gravity, m_allowSleep); - m_profile.solveInit += profile.solveInit; - m_profile.solveVelocity += profile.solveVelocity; - m_profile.solvePosition += profile.solvePosition; - - // Post solve cleanup. - for (int32 i = 0; i < island.m_bodyCount; ++i) - { - // Allow static bodies to participate in other islands. - b2Body* b = island.m_bodies[i]; - if (b->GetType() == b2_staticBody) - { - b->m_flags &= ~b2Body::e_islandFlag; - } - } - } - - m_stackAllocator.Free(stack); - - { - b2Timer timer; - // Synchronize fixtures, check for out of range bodies. - for (b2Body* b = m_bodyList; b; b = b->GetNext()) - { - // If a body was not in an island then it did not move. - if ((b->m_flags & b2Body::e_islandFlag) == 0) - { - continue; - } - - if (b->GetType() == b2_staticBody) - { - continue; - } - - // Update fixtures (for broad-phase). - b->SynchronizeFixtures(); - } - - // Look for new contacts. - m_contactManager.FindNewContacts(); - m_profile.broadphase = timer.GetMilliseconds(); - } -} - -// Find TOI contacts and solve them. -void b2World::SolveTOI(const b2TimeStep& step) -{ - b2Island island(2 * b2_maxTOIContacts, b2_maxTOIContacts, 0, &m_stackAllocator, m_contactManager.m_contactListener); - - if (m_stepComplete) - { - for (b2Body* b = m_bodyList; b; b = b->m_next) - { - b->m_flags &= ~b2Body::e_islandFlag; - b->m_sweep.alpha0 = 0.0f; - } - - for (b2Contact* c = m_contactManager.m_contactList; c; c = c->m_next) - { - // Invalidate TOI - c->m_flags &= ~(b2Contact::e_toiFlag | b2Contact::e_islandFlag); - c->m_toiCount = 0; - c->m_toi = 1.0f; - } - } - - // Find TOI events and solve them. - for (;;) - { - // Find the first TOI. - b2Contact* minContact = NULL; - float32 minAlpha = 1.0f; - - for (b2Contact* c = m_contactManager.m_contactList; c; c = c->m_next) - { - // Is this contact disabled? - if (c->IsEnabled() == false) - { - continue; - } - - // Prevent excessive sub-stepping. - if (c->m_toiCount > b2_maxSubSteps) - { - continue; - } - - float32 alpha = 1.0f; - if (c->m_flags & b2Contact::e_toiFlag) - { - // This contact has a valid cached TOI. - alpha = c->m_toi; - } - else - { - b2Fixture* fA = c->GetFixtureA(); - b2Fixture* fB = c->GetFixtureB(); - - // Is there a sensor? - if (fA->IsSensor() || fB->IsSensor()) - { - continue; - } - - b2Body* bA = fA->GetBody(); - b2Body* bB = fB->GetBody(); - - b2BodyType typeA = bA->m_type; - b2BodyType typeB = bB->m_type; - b2Assert(typeA == b2_dynamicBody || typeB == b2_dynamicBody); - - bool activeA = bA->IsAwake() && typeA != b2_staticBody; - bool activeB = bB->IsAwake() && typeB != b2_staticBody; - - // Is at least one body active (awake and dynamic or kinematic)? - if (activeA == false && activeB == false) - { - continue; - } - - bool collideA = bA->IsBullet() || typeA != b2_dynamicBody; - bool collideB = bB->IsBullet() || typeB != b2_dynamicBody; - - // Are these two non-bullet dynamic bodies? - if (collideA == false && collideB == false) - { - continue; - } - - // Compute the TOI for this contact. - // Put the sweeps onto the same time interval. - float32 alpha0 = bA->m_sweep.alpha0; - - if (bA->m_sweep.alpha0 < bB->m_sweep.alpha0) - { - alpha0 = bB->m_sweep.alpha0; - bA->m_sweep.Advance(alpha0); - } - else if (bB->m_sweep.alpha0 < bA->m_sweep.alpha0) - { - alpha0 = bA->m_sweep.alpha0; - bB->m_sweep.Advance(alpha0); - } - - b2Assert(alpha0 < 1.0f); - - int32 indexA = c->GetChildIndexA(); - int32 indexB = c->GetChildIndexB(); - - // Compute the time of impact in interval [0, minTOI] - b2TOIInput input; - input.proxyA.Set(fA->GetShape(), indexA); - input.proxyB.Set(fB->GetShape(), indexB); - input.sweepA = bA->m_sweep; - input.sweepB = bB->m_sweep; - input.tMax = 1.0f; - - b2TOIOutput output; - b2TimeOfImpact(&output, &input); - - // Beta is the fraction of the remaining portion of the . - float32 beta = output.t; - if (output.state == b2TOIOutput::e_touching) - { - alpha = b2Min(alpha0 + (1.0f - alpha0) * beta, 1.0f); - } - else - { - alpha = 1.0f; - } - - c->m_toi = alpha; - c->m_flags |= b2Contact::e_toiFlag; - } - - if (alpha < minAlpha) - { - // This is the minimum TOI found so far. - minContact = c; - minAlpha = alpha; - } - } - - if (minContact == NULL || 1.0f - 10.0f * b2_epsilon < minAlpha) - { - // No more TOI events. Done! - m_stepComplete = true; - break; - } - - // Advance the bodies to the TOI. - b2Fixture* fA = minContact->GetFixtureA(); - b2Fixture* fB = minContact->GetFixtureB(); - b2Body* bA = fA->GetBody(); - b2Body* bB = fB->GetBody(); - - b2Sweep backup1 = bA->m_sweep; - b2Sweep backup2 = bB->m_sweep; - - bA->Advance(minAlpha); - bB->Advance(minAlpha); - - // The TOI contact likely has some new contact points. - minContact->Update(m_contactManager.m_contactListener); - minContact->m_flags &= ~b2Contact::e_toiFlag; - ++minContact->m_toiCount; - - // Is the contact solid? - if (minContact->IsEnabled() == false || minContact->IsTouching() == false) - { - // Restore the sweeps. - minContact->SetEnabled(false); - bA->m_sweep = backup1; - bB->m_sweep = backup2; - bA->SynchronizeTransform(); - bB->SynchronizeTransform(); - continue; - } - - bA->SetAwake(true); - bB->SetAwake(true); - - // Build the island - island.Clear(); - island.Add(bA); - island.Add(bB); - island.Add(minContact); - - bA->m_flags |= b2Body::e_islandFlag; - bB->m_flags |= b2Body::e_islandFlag; - minContact->m_flags |= b2Contact::e_islandFlag; - - // Get contacts on bodyA and bodyB. - b2Body* bodies[2] = {bA, bB}; - for (int32 i = 0; i < 2; ++i) - { - b2Body* body = bodies[i]; - if (body->m_type == b2_dynamicBody) - { - for (b2ContactEdge* ce = body->m_contactList; ce; ce = ce->next) - { - if (island.m_bodyCount == island.m_bodyCapacity) - { - break; - } - - if (island.m_contactCount == island.m_contactCapacity) - { - break; - } - - b2Contact* contact = ce->contact; - - // Has this contact already been added to the island? - if (contact->m_flags & b2Contact::e_islandFlag) - { - continue; - } - - // Only add static, kinematic, or bullet bodies. - b2Body* other = ce->other; - if (other->m_type == b2_dynamicBody && - body->IsBullet() == false && other->IsBullet() == false) - { - continue; - } - - // Skip sensors. - bool sensorA = contact->m_fixtureA->m_isSensor; - bool sensorB = contact->m_fixtureB->m_isSensor; - if (sensorA || sensorB) - { - continue; - } - - // Tentatively advance the body to the TOI. - b2Sweep backup = other->m_sweep; - if ((other->m_flags & b2Body::e_islandFlag) == 0) - { - other->Advance(minAlpha); - } - - // Update the contact points - contact->Update(m_contactManager.m_contactListener); - - // Was the contact disabled by the user? - if (contact->IsEnabled() == false) - { - other->m_sweep = backup; - other->SynchronizeTransform(); - continue; - } - - // Are there contact points? - if (contact->IsTouching() == false) - { - other->m_sweep = backup; - other->SynchronizeTransform(); - continue; - } - - // Add the contact to the island - contact->m_flags |= b2Contact::e_islandFlag; - island.Add(contact); - - // Has the other body already been added to the island? - if (other->m_flags & b2Body::e_islandFlag) - { - continue; - } - - // Add the other body to the island. - other->m_flags |= b2Body::e_islandFlag; - - if (other->m_type != b2_staticBody) - { - other->SetAwake(true); - } - - island.Add(other); - } - } - } - - b2TimeStep subStep; - subStep.dt = (1.0f - minAlpha) * step.dt; - subStep.inv_dt = 1.0f / subStep.dt; - subStep.dtRatio = 1.0f; - subStep.positionIterations = 20; - subStep.velocityIterations = step.velocityIterations; - subStep.warmStarting = false; - island.SolveTOI(subStep, bA->m_islandIndex, bB->m_islandIndex); - - // Reset island flags and synchronize broad-phase proxies. - for (int32 i = 0; i < island.m_bodyCount; ++i) - { - b2Body* body = island.m_bodies[i]; - body->m_flags &= ~b2Body::e_islandFlag; - - if (body->m_type != b2_dynamicBody) - { - continue; - } - - body->SynchronizeFixtures(); - - // Invalidate all contact TOIs on this displaced body. - for (b2ContactEdge* ce = body->m_contactList; ce; ce = ce->next) - { - ce->contact->m_flags &= ~(b2Contact::e_toiFlag | b2Contact::e_islandFlag); - } - } - - // Commit fixture proxy movements to the broad-phase so that new contacts are created. - // Also, some contacts can be destroyed. - m_contactManager.FindNewContacts(); - - if (m_subStepping) - { - m_stepComplete = false; - break; - } - } -} - -void b2World::Step(float32 dt, int32 velocityIterations, int32 positionIterations) -{ - b2Timer stepTimer; - - // If new fixtures were added, we need to find the new contacts. - if (m_flags & e_newFixture) - { - m_contactManager.FindNewContacts(); - m_flags &= ~e_newFixture; - } - - m_flags |= e_locked; - - b2TimeStep step; - step.dt = dt; - step.velocityIterations = velocityIterations; - step.positionIterations = positionIterations; - if (dt > 0.0f) - { - step.inv_dt = 1.0f / dt; - } - else - { - step.inv_dt = 0.0f; - } - - step.dtRatio = m_inv_dt0 * dt; - - step.warmStarting = m_warmStarting; - - // Update contacts. This is where some contacts are destroyed. - { - b2Timer timer; - m_contactManager.Collide(); - m_profile.collide = timer.GetMilliseconds(); - } - - // Integrate velocities, solve velocity constraints, and integrate positions. - if (m_stepComplete && step.dt > 0.0f) - { - b2Timer timer; - Solve(step); - m_profile.solve = timer.GetMilliseconds(); - } - - // Handle TOI events. - if (m_continuousPhysics && step.dt > 0.0f) - { - b2Timer timer; - SolveTOI(step); - m_profile.solveTOI = timer.GetMilliseconds(); - } - - if (step.dt > 0.0f) - { - m_inv_dt0 = step.inv_dt; - } - - if (m_flags & e_clearForces) - { - ClearForces(); - } - - m_flags &= ~e_locked; - - m_profile.step = stepTimer.GetMilliseconds(); -} - -void b2World::ClearForces() -{ - for (b2Body* body = m_bodyList; body; body = body->GetNext()) - { - body->m_force.SetZero(); - body->m_torque = 0.0f; - } -} - -struct b2WorldQueryWrapper -{ - bool QueryCallback(int32 proxyId) - { - b2FixtureProxy* proxy = (b2FixtureProxy*)broadPhase->GetUserData(proxyId); - return callback->ReportFixture(proxy->fixture); - } - - const b2BroadPhase* broadPhase; - b2QueryCallback* callback; -}; - -void b2World::QueryAABB(b2QueryCallback* callback, const b2AABB& aabb) const -{ - b2WorldQueryWrapper wrapper; - wrapper.broadPhase = &m_contactManager.m_broadPhase; - wrapper.callback = callback; - m_contactManager.m_broadPhase.Query(&wrapper, aabb); -} - -struct b2WorldRayCastWrapper -{ - float32 RayCastCallback(const b2RayCastInput& input, int32 proxyId) - { - void* userData = broadPhase->GetUserData(proxyId); - b2FixtureProxy* proxy = (b2FixtureProxy*)userData; - b2Fixture* fixture = proxy->fixture; - int32 index = proxy->childIndex; - b2RayCastOutput output; - bool hit = fixture->RayCast(&output, input, index); - - if (hit) - { - float32 fraction = output.fraction; - b2Vec2 point = (1.0f - fraction) * input.p1 + fraction * input.p2; - return callback->ReportFixture(fixture, point, output.normal, fraction); - } - - return input.maxFraction; - } - - const b2BroadPhase* broadPhase; - b2RayCastCallback* callback; -}; - -void b2World::RayCast(b2RayCastCallback* callback, const b2Vec2& point1, const b2Vec2& point2) const -{ - b2WorldRayCastWrapper wrapper; - wrapper.broadPhase = &m_contactManager.m_broadPhase; - wrapper.callback = callback; - b2RayCastInput input; - input.maxFraction = 1.0f; - input.p1 = point1; - input.p2 = point2; - m_contactManager.m_broadPhase.RayCast(&wrapper, input); -} - -void b2World::DrawShape(b2Fixture* fixture, const b2Transform& xf, const b2Color& color) -{ - switch (fixture->GetType()) - { - case b2Shape::e_circle: - { - b2CircleShape* circle = (b2CircleShape*)fixture->GetShape(); - - b2Vec2 center = b2Mul(xf, circle->m_p); - float32 radius = circle->m_radius; - b2Vec2 axis = b2Mul(xf.q, b2Vec2(1.0f, 0.0f)); - - g_debugDraw->DrawSolidCircle(center, radius, axis, color); - } - break; - - case b2Shape::e_edge: - { - b2EdgeShape* edge = (b2EdgeShape*)fixture->GetShape(); - b2Vec2 v1 = b2Mul(xf, edge->m_vertex1); - b2Vec2 v2 = b2Mul(xf, edge->m_vertex2); - g_debugDraw->DrawSegment(v1, v2, color); - } - break; - - case b2Shape::e_chain: - { - b2ChainShape* chain = (b2ChainShape*)fixture->GetShape(); - int32 count = chain->m_count; - const b2Vec2* vertices = chain->m_vertices; - - b2Vec2 v1 = b2Mul(xf, vertices[0]); - for (int32 i = 1; i < count; ++i) - { - b2Vec2 v2 = b2Mul(xf, vertices[i]); - g_debugDraw->DrawSegment(v1, v2, color); - g_debugDraw->DrawCircle(v1, 0.05f, color); - v1 = v2; - } - } - break; - - case b2Shape::e_polygon: - { - b2PolygonShape* poly = (b2PolygonShape*)fixture->GetShape(); - int32 vertexCount = poly->m_count; - b2Assert(vertexCount <= b2_maxPolygonVertices); - b2Vec2 vertices[b2_maxPolygonVertices]; - - for (int32 i = 0; i < vertexCount; ++i) - { - vertices[i] = b2Mul(xf, poly->m_vertices[i]); - } - - g_debugDraw->DrawSolidPolygon(vertices, vertexCount, color); - } - break; - - default: - break; - } -} - -void b2World::DrawJoint(b2Joint* joint) -{ - b2Body* bodyA = joint->GetBodyA(); - b2Body* bodyB = joint->GetBodyB(); - const b2Transform& xf1 = bodyA->GetTransform(); - const b2Transform& xf2 = bodyB->GetTransform(); - b2Vec2 x1 = xf1.p; - b2Vec2 x2 = xf2.p; - b2Vec2 p1 = joint->GetAnchorA(); - b2Vec2 p2 = joint->GetAnchorB(); - - b2Color color(0.5f, 0.8f, 0.8f); - - switch (joint->GetType()) - { - case e_distanceJoint: - g_debugDraw->DrawSegment(p1, p2, color); - break; - - case e_pulleyJoint: - { - b2PulleyJoint* pulley = (b2PulleyJoint*)joint; - b2Vec2 s1 = pulley->GetGroundAnchorA(); - b2Vec2 s2 = pulley->GetGroundAnchorB(); - g_debugDraw->DrawSegment(s1, p1, color); - g_debugDraw->DrawSegment(s2, p2, color); - g_debugDraw->DrawSegment(s1, s2, color); - } - break; - - case e_mouseJoint: - // don't draw this - break; - - default: - g_debugDraw->DrawSegment(x1, p1, color); - g_debugDraw->DrawSegment(p1, p2, color); - g_debugDraw->DrawSegment(x2, p2, color); - } -} - -void b2World::DrawDebugData() -{ - if (g_debugDraw == NULL) - { - return; - } - - uint32 flags = g_debugDraw->GetFlags(); - - if (flags & b2Draw::e_shapeBit) - { - for (b2Body* b = m_bodyList; b; b = b->GetNext()) - { - const b2Transform& xf = b->GetTransform(); - for (b2Fixture* f = b->GetFixtureList(); f; f = f->GetNext()) - { - if (b->IsActive() == false) - { - DrawShape(f, xf, b2Color(0.5f, 0.5f, 0.3f)); - } - else if (b->GetType() == b2_staticBody) - { - DrawShape(f, xf, b2Color(0.5f, 0.9f, 0.5f)); - } - else if (b->GetType() == b2_kinematicBody) - { - DrawShape(f, xf, b2Color(0.5f, 0.5f, 0.9f)); - } - else if (b->IsAwake() == false) - { - DrawShape(f, xf, b2Color(0.6f, 0.6f, 0.6f)); - } - else - { - DrawShape(f, xf, b2Color(0.9f, 0.7f, 0.7f)); - } - } - } - } - - if (flags & b2Draw::e_jointBit) - { - for (b2Joint* j = m_jointList; j; j = j->GetNext()) - { - DrawJoint(j); - } - } - - if (flags & b2Draw::e_pairBit) - { - b2Color color(0.3f, 0.9f, 0.9f); - for (b2Contact* c = m_contactManager.m_contactList; c; c = c->GetNext()) - { - //b2Fixture* fixtureA = c->GetFixtureA(); - //b2Fixture* fixtureB = c->GetFixtureB(); - - //b2Vec2 cA = fixtureA->GetAABB().GetCenter(); - //b2Vec2 cB = fixtureB->GetAABB().GetCenter(); - - //g_debugDraw->DrawSegment(cA, cB, color); - } - } - - if (flags & b2Draw::e_aabbBit) - { - b2Color color(0.9f, 0.3f, 0.9f); - b2BroadPhase* bp = &m_contactManager.m_broadPhase; - - for (b2Body* b = m_bodyList; b; b = b->GetNext()) - { - if (b->IsActive() == false) - { - continue; - } - - for (b2Fixture* f = b->GetFixtureList(); f; f = f->GetNext()) - { - for (int32 i = 0; i < f->m_proxyCount; ++i) - { - b2FixtureProxy* proxy = f->m_proxies + i; - b2AABB aabb = bp->GetFatAABB(proxy->proxyId); - b2Vec2 vs[4]; - vs[0].Set(aabb.lowerBound.x, aabb.lowerBound.y); - vs[1].Set(aabb.upperBound.x, aabb.lowerBound.y); - vs[2].Set(aabb.upperBound.x, aabb.upperBound.y); - vs[3].Set(aabb.lowerBound.x, aabb.upperBound.y); - - g_debugDraw->DrawPolygon(vs, 4, color); - } - } - } - } - - if (flags & b2Draw::e_centerOfMassBit) - { - for (b2Body* b = m_bodyList; b; b = b->GetNext()) - { - b2Transform xf = b->GetTransform(); - xf.p = b->GetWorldCenter(); - g_debugDraw->DrawTransform(xf); - } - } -} - -int32 b2World::GetProxyCount() const -{ - return m_contactManager.m_broadPhase.GetProxyCount(); -} - -int32 b2World::GetTreeHeight() const -{ - return m_contactManager.m_broadPhase.GetTreeHeight(); -} - -int32 b2World::GetTreeBalance() const -{ - return m_contactManager.m_broadPhase.GetTreeBalance(); -} - -float32 b2World::GetTreeQuality() const -{ - return m_contactManager.m_broadPhase.GetTreeQuality(); -} - -void b2World::ShiftOrigin(const b2Vec2& newOrigin) -{ - b2Assert((m_flags & e_locked) == 0); - if ((m_flags & e_locked) == e_locked) - { - return; - } - - for (b2Body* b = m_bodyList; b; b = b->m_next) - { - b->m_xf.p -= newOrigin; - b->m_sweep.c0 -= newOrigin; - b->m_sweep.c -= newOrigin; - } - - for (b2Joint* j = m_jointList; j; j = j->m_next) - { - j->ShiftOrigin(newOrigin); - } - - m_contactManager.m_broadPhase.ShiftOrigin(newOrigin); -} - -void b2World::Dump() -{ - if ((m_flags & e_locked) == e_locked) - { - return; - } - - b2Log("b2Vec2 g(%.15lef, %.15lef);\n", m_gravity.x, m_gravity.y); - b2Log("m_world->SetGravity(g);\n"); - - b2Log("b2Body** bodies = (b2Body**)b2Alloc(%d * sizeof(b2Body*));\n", m_bodyCount); - b2Log("b2Joint** joints = (b2Joint**)b2Alloc(%d * sizeof(b2Joint*));\n", m_jointCount); - int32 i = 0; - for (b2Body* b = m_bodyList; b; b = b->m_next) - { - b->m_islandIndex = i; - b->Dump(); - ++i; - } - - i = 0; - for (b2Joint* j = m_jointList; j; j = j->m_next) - { - j->m_index = i; - ++i; - } - - // First pass on joints, skip gear joints. - for (b2Joint* j = m_jointList; j; j = j->m_next) - { - if (j->m_type == e_gearJoint) - { - continue; - } - - b2Log("{\n"); - j->Dump(); - b2Log("}\n"); - } - - // Second pass on joints, only gear joints. - for (b2Joint* j = m_jointList; j; j = j->m_next) - { - if (j->m_type != e_gearJoint) - { - continue; - } - - b2Log("{\n"); - j->Dump(); - b2Log("}\n"); - } - - b2Log("b2Free(joints);\n"); - b2Log("b2Free(bodies);\n"); - b2Log("joints = NULL;\n"); - b2Log("bodies = NULL;\n"); -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2World.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/b2World.h deleted file mode 100644 index 3968cc78..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2World.h +++ /dev/null @@ -1,354 +0,0 @@ -/* -* Copyright (c) 2006-2011 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_WORLD_H -#define B2_WORLD_H - -#include -#include -#include -#include -#include -#include - -struct b2AABB; -struct b2BodyDef; -struct b2Color; -struct b2JointDef; -class b2Body; -class b2Draw; -class b2Fixture; -class b2Joint; - -/// The world class manages all physics entities, dynamic simulation, -/// and asynchronous queries. The world also contains efficient memory -/// management facilities. -class b2World -{ -public: - /// Construct a world object. - /// @param gravity the world gravity vector. - b2World(const b2Vec2& gravity); - - /// Destruct the world. All physics entities are destroyed and all heap memory is released. - ~b2World(); - - /// Register a destruction listener. The listener is owned by you and must - /// remain in scope. - void SetDestructionListener(b2DestructionListener* listener); - - /// Register a contact filter to provide specific control over collision. - /// Otherwise the default filter is used (b2_defaultFilter). The listener is - /// owned by you and must remain in scope. - void SetContactFilter(b2ContactFilter* filter); - - /// Register a contact event listener. The listener is owned by you and must - /// remain in scope. - void SetContactListener(b2ContactListener* listener); - - /// Register a routine for debug drawing. The debug draw functions are called - /// inside with b2World::DrawDebugData method. The debug draw object is owned - /// by you and must remain in scope. - void SetDebugDraw(b2Draw* debugDraw); - - /// Create a rigid body given a definition. No reference to the definition - /// is retained. - /// @warning This function is locked during callbacks. - b2Body* CreateBody(const b2BodyDef* def); - - /// Destroy a rigid body given a definition. No reference to the definition - /// is retained. This function is locked during callbacks. - /// @warning This automatically deletes all associated shapes and joints. - /// @warning This function is locked during callbacks. - void DestroyBody(b2Body* body); - - /// Create a joint to constrain bodies together. No reference to the definition - /// is retained. This may cause the connected bodies to cease colliding. - /// @warning This function is locked during callbacks. - b2Joint* CreateJoint(const b2JointDef* def); - - /// Destroy a joint. This may cause the connected bodies to begin colliding. - /// @warning This function is locked during callbacks. - void DestroyJoint(b2Joint* joint); - - /// Take a time step. This performs collision detection, integration, - /// and constraint solution. - /// @param timeStep the amount of time to simulate, this should not vary. - /// @param velocityIterations for the velocity constraint solver. - /// @param positionIterations for the position constraint solver. - void Step( float32 timeStep, - int32 velocityIterations, - int32 positionIterations); - - /// Manually clear the force buffer on all bodies. By default, forces are cleared automatically - /// after each call to Step. The default behavior is modified by calling SetAutoClearForces. - /// The purpose of this function is to support sub-stepping. Sub-stepping is often used to maintain - /// a fixed sized time step under a variable frame-rate. - /// When you perform sub-stepping you will disable auto clearing of forces and instead call - /// ClearForces after all sub-steps are complete in one pass of your game loop. - /// @see SetAutoClearForces - void ClearForces(); - - /// Call this to draw shapes and other debug draw data. This is intentionally non-const. - void DrawDebugData(); - - /// Query the world for all fixtures that potentially overlap the - /// provided AABB. - /// @param callback a user implemented callback class. - /// @param aabb the query box. - void QueryAABB(b2QueryCallback* callback, const b2AABB& aabb) const; - - /// Ray-cast the world for all fixtures in the path of the ray. Your callback - /// controls whether you get the closest point, any point, or n-points. - /// The ray-cast ignores shapes that contain the starting point. - /// @param callback a user implemented callback class. - /// @param point1 the ray starting point - /// @param point2 the ray ending point - void RayCast(b2RayCastCallback* callback, const b2Vec2& point1, const b2Vec2& point2) const; - - /// Get the world body list. With the returned body, use b2Body::GetNext to get - /// the next body in the world list. A NULL body indicates the end of the list. - /// @return the head of the world body list. - b2Body* GetBodyList(); - const b2Body* GetBodyList() const; - - /// Get the world joint list. With the returned joint, use b2Joint::GetNext to get - /// the next joint in the world list. A NULL joint indicates the end of the list. - /// @return the head of the world joint list. - b2Joint* GetJointList(); - const b2Joint* GetJointList() const; - - /// Get the world contact list. With the returned contact, use b2Contact::GetNext to get - /// the next contact in the world list. A NULL contact indicates the end of the list. - /// @return the head of the world contact list. - /// @warning contacts are created and destroyed in the middle of a time step. - /// Use b2ContactListener to avoid missing contacts. - b2Contact* GetContactList(); - const b2Contact* GetContactList() const; - - /// Enable/disable sleep. - void SetAllowSleeping(bool flag); - bool GetAllowSleeping() const { return m_allowSleep; } - - /// Enable/disable warm starting. For testing. - void SetWarmStarting(bool flag) { m_warmStarting = flag; } - bool GetWarmStarting() const { return m_warmStarting; } - - /// Enable/disable continuous physics. For testing. - void SetContinuousPhysics(bool flag) { m_continuousPhysics = flag; } - bool GetContinuousPhysics() const { return m_continuousPhysics; } - - /// Enable/disable single stepped continuous physics. For testing. - void SetSubStepping(bool flag) { m_subStepping = flag; } - bool GetSubStepping() const { return m_subStepping; } - - /// Get the number of broad-phase proxies. - int32 GetProxyCount() const; - - /// Get the number of bodies. - int32 GetBodyCount() const; - - /// Get the number of joints. - int32 GetJointCount() const; - - /// Get the number of contacts (each may have 0 or more contact points). - int32 GetContactCount() const; - - /// Get the height of the dynamic tree. - int32 GetTreeHeight() const; - - /// Get the balance of the dynamic tree. - int32 GetTreeBalance() const; - - /// Get the quality metric of the dynamic tree. The smaller the better. - /// The minimum is 1. - float32 GetTreeQuality() const; - - /// Change the global gravity vector. - void SetGravity(const b2Vec2& gravity); - - /// Get the global gravity vector. - b2Vec2 GetGravity() const; - - /// Is the world locked (in the middle of a time step). - bool IsLocked() const; - - /// Set flag to control automatic clearing of forces after each time step. - void SetAutoClearForces(bool flag); - - /// Get the flag that controls automatic clearing of forces after each time step. - bool GetAutoClearForces() const; - - /// Shift the world origin. Useful for large worlds. - /// The body shift formula is: position -= newOrigin - /// @param newOrigin the new origin with respect to the old origin - void ShiftOrigin(const b2Vec2& newOrigin); - - /// Get the contact manager for testing. - const b2ContactManager& GetContactManager() const; - - /// Get the current profile. - const b2Profile& GetProfile() const; - - /// Dump the world into the log file. - /// @warning this should be called outside of a time step. - void Dump(); - -private: - - // m_flags - enum - { - e_newFixture = 0x0001, - e_locked = 0x0002, - e_clearForces = 0x0004 - }; - - friend class b2Body; - friend class b2Fixture; - friend class b2ContactManager; - friend class b2Controller; - - void Solve(const b2TimeStep& step); - void SolveTOI(const b2TimeStep& step); - - void DrawJoint(b2Joint* joint); - void DrawShape(b2Fixture* shape, const b2Transform& xf, const b2Color& color); - - b2BlockAllocator m_blockAllocator; - b2StackAllocator m_stackAllocator; - - int32 m_flags; - - b2ContactManager m_contactManager; - - b2Body* m_bodyList; - b2Joint* m_jointList; - - int32 m_bodyCount; - int32 m_jointCount; - - b2Vec2 m_gravity; - bool m_allowSleep; - - b2DestructionListener* m_destructionListener; - b2Draw* g_debugDraw; - - // This is used to compute the time step ratio to - // support a variable time step. - float32 m_inv_dt0; - - // These are for debugging the solver. - bool m_warmStarting; - bool m_continuousPhysics; - bool m_subStepping; - - bool m_stepComplete; - - b2Profile m_profile; -}; - -inline b2Body* b2World::GetBodyList() -{ - return m_bodyList; -} - -inline const b2Body* b2World::GetBodyList() const -{ - return m_bodyList; -} - -inline b2Joint* b2World::GetJointList() -{ - return m_jointList; -} - -inline const b2Joint* b2World::GetJointList() const -{ - return m_jointList; -} - -inline b2Contact* b2World::GetContactList() -{ - return m_contactManager.m_contactList; -} - -inline const b2Contact* b2World::GetContactList() const -{ - return m_contactManager.m_contactList; -} - -inline int32 b2World::GetBodyCount() const -{ - return m_bodyCount; -} - -inline int32 b2World::GetJointCount() const -{ - return m_jointCount; -} - -inline int32 b2World::GetContactCount() const -{ - return m_contactManager.m_contactCount; -} - -inline void b2World::SetGravity(const b2Vec2& gravity) -{ - m_gravity = gravity; -} - -inline b2Vec2 b2World::GetGravity() const -{ - return m_gravity; -} - -inline bool b2World::IsLocked() const -{ - return (m_flags & e_locked) == e_locked; -} - -inline void b2World::SetAutoClearForces(bool flag) -{ - if (flag) - { - m_flags |= e_clearForces; - } - else - { - m_flags &= ~e_clearForces; - } -} - -/// Get the flag that controls automatic clearing of forces after each time step. -inline bool b2World::GetAutoClearForces() const -{ - return (m_flags & e_clearForces) == e_clearForces; -} - -inline const b2ContactManager& b2World::GetContactManager() const -{ - return m_contactManager; -} - -inline const b2Profile& b2World::GetProfile() const -{ - return m_profile; -} - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2WorldCallbacks.cpp b/love/src/jni/love/src/libraries/Box2D/Dynamics/b2WorldCallbacks.cpp deleted file mode 100644 index 0f4b9c53..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2WorldCallbacks.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include - -// Return true if contact calculations should be performed between these two shapes. -// If you implement your own collision filter you may want to build from this implementation. -bool b2ContactFilter::ShouldCollide(b2Fixture* fixtureA, b2Fixture* fixtureB) -{ - const b2Filter& filterA = fixtureA->GetFilterData(); - const b2Filter& filterB = fixtureB->GetFilterData(); - - if (filterA.groupIndex == filterB.groupIndex && filterA.groupIndex != 0) - { - return filterA.groupIndex > 0; - } - - bool collide = (filterA.maskBits & filterB.categoryBits) != 0 && (filterA.categoryBits & filterB.maskBits) != 0; - return collide; -} diff --git a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2WorldCallbacks.h b/love/src/jni/love/src/libraries/Box2D/Dynamics/b2WorldCallbacks.h deleted file mode 100644 index 82ffc022..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Dynamics/b2WorldCallbacks.h +++ /dev/null @@ -1,155 +0,0 @@ -/* -* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_WORLD_CALLBACKS_H -#define B2_WORLD_CALLBACKS_H - -#include - -struct b2Vec2; -struct b2Transform; -class b2Fixture; -class b2Body; -class b2Joint; -class b2Contact; -struct b2ContactResult; -struct b2Manifold; - -/// Joints and fixtures are destroyed when their associated -/// body is destroyed. Implement this listener so that you -/// may nullify references to these joints and shapes. -class b2DestructionListener -{ -public: - virtual ~b2DestructionListener() {} - - /// Called when any joint is about to be destroyed due - /// to the destruction of one of its attached bodies. - virtual void SayGoodbye(b2Joint* joint) = 0; - - /// Called when any fixture is about to be destroyed due - /// to the destruction of its parent body. - virtual void SayGoodbye(b2Fixture* fixture) = 0; -}; - -/// Implement this class to provide collision filtering. In other words, you can implement -/// this class if you want finer control over contact creation. -class b2ContactFilter -{ -public: - virtual ~b2ContactFilter() {} - - /// Return true if contact calculations should be performed between these two shapes. - /// @warning for performance reasons this is only called when the AABBs begin to overlap. - virtual bool ShouldCollide(b2Fixture* fixtureA, b2Fixture* fixtureB); -}; - -/// Contact impulses for reporting. Impulses are used instead of forces because -/// sub-step forces may approach infinity for rigid body collisions. These -/// match up one-to-one with the contact points in b2Manifold. -struct b2ContactImpulse -{ - float32 normalImpulses[b2_maxManifoldPoints]; - float32 tangentImpulses[b2_maxManifoldPoints]; - int32 count; -}; - -/// Implement this class to get contact information. You can use these results for -/// things like sounds and game logic. You can also get contact results by -/// traversing the contact lists after the time step. However, you might miss -/// some contacts because continuous physics leads to sub-stepping. -/// Additionally you may receive multiple callbacks for the same contact in a -/// single time step. -/// You should strive to make your callbacks efficient because there may be -/// many callbacks per time step. -/// @warning You cannot create/destroy Box2D entities inside these callbacks. -class b2ContactListener -{ -public: - virtual ~b2ContactListener() {} - - /// Called when two fixtures begin to touch. - virtual void BeginContact(b2Contact* contact) { B2_NOT_USED(contact); } - - /// Called when two fixtures cease to touch. - virtual void EndContact(b2Contact* contact) { B2_NOT_USED(contact); } - - /// This is called after a contact is updated. This allows you to inspect a - /// contact before it goes to the solver. If you are careful, you can modify the - /// contact manifold (e.g. disable contact). - /// A copy of the old manifold is provided so that you can detect changes. - /// Note: this is called only for awake bodies. - /// Note: this is called even when the number of contact points is zero. - /// Note: this is not called for sensors. - /// Note: if you set the number of contact points to zero, you will not - /// get an EndContact callback. However, you may get a BeginContact callback - /// the next step. - virtual void PreSolve(b2Contact* contact, const b2Manifold* oldManifold) - { - B2_NOT_USED(contact); - B2_NOT_USED(oldManifold); - } - - /// This lets you inspect a contact after the solver is finished. This is useful - /// for inspecting impulses. - /// Note: the contact manifold does not include time of impact impulses, which can be - /// arbitrarily large if the sub-step is small. Hence the impulse is provided explicitly - /// in a separate data structure. - /// Note: this is only called for contacts that are touching, solid, and awake. - virtual void PostSolve(b2Contact* contact, const b2ContactImpulse* impulse) - { - B2_NOT_USED(contact); - B2_NOT_USED(impulse); - } -}; - -/// Callback class for AABB queries. -/// See b2World::Query -class b2QueryCallback -{ -public: - virtual ~b2QueryCallback() {} - - /// Called for each fixture found in the query AABB. - /// @return false to terminate the query. - virtual bool ReportFixture(b2Fixture* fixture) = 0; -}; - -/// Callback class for ray casts. -/// See b2World::RayCast -class b2RayCastCallback -{ -public: - virtual ~b2RayCastCallback() {} - - /// Called for each fixture found in the query. You control how the ray cast - /// proceeds by returning a float: - /// return -1: ignore this fixture and continue - /// return 0: terminate the ray cast - /// return fraction: clip the ray to this point - /// return 1: don't clip the ray and continue - /// @param fixture the fixture hit by the ray - /// @param point the point of initial intersection - /// @param normal the normal vector at the point of intersection - /// @return -1 to filter, 0 to terminate, fraction to clip the ray for - /// closest hit, 1 to continue - virtual float32 ReportFixture( b2Fixture* fixture, const b2Vec2& point, - const b2Vec2& normal, float32 fraction) = 0; -}; - -#endif diff --git a/love/src/jni/love/src/libraries/Box2D/README.MODIFIED b/love/src/jni/love/src/libraries/Box2D/README.MODIFIED deleted file mode 100644 index 71388bce..00000000 --- a/love/src/jni/love/src/libraries/Box2D/README.MODIFIED +++ /dev/null @@ -1 +0,0 @@ -PLEASE NOTE, this version of Box2D is NOT original, it has been MODIFIED by the LÖVE Development Team. diff --git a/love/src/jni/love/src/libraries/Box2D/Rope/b2Rope.cpp b/love/src/jni/love/src/libraries/Box2D/Rope/b2Rope.cpp deleted file mode 100644 index 7af3a6cf..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Rope/b2Rope.cpp +++ /dev/null @@ -1,259 +0,0 @@ -/* -* Copyright (c) 2011 Erin Catto http://box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include - -b2Rope::b2Rope() -{ - m_count = 0; - m_ps = NULL; - m_p0s = NULL; - m_vs = NULL; - m_ims = NULL; - m_Ls = NULL; - m_as = NULL; - m_gravity.SetZero(); - m_k2 = 1.0f; - m_k3 = 0.1f; -} - -b2Rope::~b2Rope() -{ - b2Free(m_ps); - b2Free(m_p0s); - b2Free(m_vs); - b2Free(m_ims); - b2Free(m_Ls); - b2Free(m_as); -} - -void b2Rope::Initialize(const b2RopeDef* def) -{ - b2Assert(def->count >= 3); - m_count = def->count; - m_ps = (b2Vec2*)b2Alloc(m_count * sizeof(b2Vec2)); - m_p0s = (b2Vec2*)b2Alloc(m_count * sizeof(b2Vec2)); - m_vs = (b2Vec2*)b2Alloc(m_count * sizeof(b2Vec2)); - m_ims = (float32*)b2Alloc(m_count * sizeof(float32)); - - for (int32 i = 0; i < m_count; ++i) - { - m_ps[i] = def->vertices[i]; - m_p0s[i] = def->vertices[i]; - m_vs[i].SetZero(); - - float32 m = def->masses[i]; - if (m > 0.0f) - { - m_ims[i] = 1.0f / m; - } - else - { - m_ims[i] = 0.0f; - } - } - - int32 count2 = m_count - 1; - int32 count3 = m_count - 2; - m_Ls = (float32*)b2Alloc(count2 * sizeof(float32)); - m_as = (float32*)b2Alloc(count3 * sizeof(float32)); - - for (int32 i = 0; i < count2; ++i) - { - b2Vec2 p1 = m_ps[i]; - b2Vec2 p2 = m_ps[i+1]; - m_Ls[i] = b2Distance(p1, p2); - } - - for (int32 i = 0; i < count3; ++i) - { - b2Vec2 p1 = m_ps[i]; - b2Vec2 p2 = m_ps[i + 1]; - b2Vec2 p3 = m_ps[i + 2]; - - b2Vec2 d1 = p2 - p1; - b2Vec2 d2 = p3 - p2; - - float32 a = b2Cross(d1, d2); - float32 b = b2Dot(d1, d2); - - m_as[i] = b2Atan2(a, b); - } - - m_gravity = def->gravity; - m_damping = def->damping; - m_k2 = def->k2; - m_k3 = def->k3; -} - -void b2Rope::Step(float32 h, int32 iterations) -{ - if (h == 0.0) - { - return; - } - - float32 d = expf(- h * m_damping); - - for (int32 i = 0; i < m_count; ++i) - { - m_p0s[i] = m_ps[i]; - if (m_ims[i] > 0.0f) - { - m_vs[i] += h * m_gravity; - } - m_vs[i] *= d; - m_ps[i] += h * m_vs[i]; - - } - - for (int32 i = 0; i < iterations; ++i) - { - SolveC2(); - SolveC3(); - SolveC2(); - } - - float32 inv_h = 1.0f / h; - for (int32 i = 0; i < m_count; ++i) - { - m_vs[i] = inv_h * (m_ps[i] - m_p0s[i]); - } -} - -void b2Rope::SolveC2() -{ - int32 count2 = m_count - 1; - - for (int32 i = 0; i < count2; ++i) - { - b2Vec2 p1 = m_ps[i]; - b2Vec2 p2 = m_ps[i + 1]; - - b2Vec2 d = p2 - p1; - float32 L = d.Normalize(); - - float32 im1 = m_ims[i]; - float32 im2 = m_ims[i + 1]; - - if (im1 + im2 == 0.0f) - { - continue; - } - - float32 s1 = im1 / (im1 + im2); - float32 s2 = im2 / (im1 + im2); - - p1 -= m_k2 * s1 * (m_Ls[i] - L) * d; - p2 += m_k2 * s2 * (m_Ls[i] - L) * d; - - m_ps[i] = p1; - m_ps[i + 1] = p2; - } -} - -void b2Rope::SetAngle(float32 angle) -{ - int32 count3 = m_count - 2; - for (int32 i = 0; i < count3; ++i) - { - m_as[i] = angle; - } -} - -void b2Rope::SolveC3() -{ - int32 count3 = m_count - 2; - - for (int32 i = 0; i < count3; ++i) - { - b2Vec2 p1 = m_ps[i]; - b2Vec2 p2 = m_ps[i + 1]; - b2Vec2 p3 = m_ps[i + 2]; - - float32 m1 = m_ims[i]; - float32 m2 = m_ims[i + 1]; - float32 m3 = m_ims[i + 2]; - - b2Vec2 d1 = p2 - p1; - b2Vec2 d2 = p3 - p2; - - float32 L1sqr = d1.LengthSquared(); - float32 L2sqr = d2.LengthSquared(); - - if (L1sqr * L2sqr == 0.0f) - { - continue; - } - - float32 a = b2Cross(d1, d2); - float32 b = b2Dot(d1, d2); - - float32 angle = b2Atan2(a, b); - - b2Vec2 Jd1 = (-1.0f / L1sqr) * d1.Skew(); - b2Vec2 Jd2 = (1.0f / L2sqr) * d2.Skew(); - - b2Vec2 J1 = -Jd1; - b2Vec2 J2 = Jd1 - Jd2; - b2Vec2 J3 = Jd2; - - float32 mass = m1 * b2Dot(J1, J1) + m2 * b2Dot(J2, J2) + m3 * b2Dot(J3, J3); - if (mass == 0.0f) - { - continue; - } - - mass = 1.0f / mass; - - float32 C = angle - m_as[i]; - - while (C > b2_pi) - { - angle -= 2 * b2_pi; - C = angle - m_as[i]; - } - - while (C < -b2_pi) - { - angle += 2.0f * b2_pi; - C = angle - m_as[i]; - } - - float32 impulse = - m_k3 * mass * C; - - p1 += (m1 * impulse) * J1; - p2 += (m2 * impulse) * J2; - p3 += (m3 * impulse) * J3; - - m_ps[i] = p1; - m_ps[i + 1] = p2; - m_ps[i + 2] = p3; - } -} - -void b2Rope::Draw(b2Draw* draw) const -{ - b2Color c(0.4f, 0.5f, 0.7f); - - for (int32 i = 0; i < m_count - 1; ++i) - { - draw->DrawSegment(m_ps[i], m_ps[i+1], c); - } -} diff --git a/love/src/jni/love/src/libraries/Box2D/Rope/b2Rope.h b/love/src/jni/love/src/libraries/Box2D/Rope/b2Rope.h deleted file mode 100644 index 246cf923..00000000 --- a/love/src/jni/love/src/libraries/Box2D/Rope/b2Rope.h +++ /dev/null @@ -1,115 +0,0 @@ -/* -* Copyright (c) 2011 Erin Catto http://www.box2d.org -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef B2_ROPE_H -#define B2_ROPE_H - -#include - -class b2Draw; - -/// -struct b2RopeDef -{ - b2RopeDef() - { - vertices = NULL; - count = 0; - masses = NULL; - gravity.SetZero(); - damping = 0.1f; - k2 = 0.9f; - k3 = 0.1f; - } - - /// - b2Vec2* vertices; - - /// - int32 count; - - /// - float32* masses; - - /// - b2Vec2 gravity; - - /// - float32 damping; - - /// Stretching stiffness - float32 k2; - - /// Bending stiffness. Values above 0.5 can make the simulation blow up. - float32 k3; -}; - -/// -class b2Rope -{ -public: - b2Rope(); - ~b2Rope(); - - /// - void Initialize(const b2RopeDef* def); - - /// - void Step(float32 timeStep, int32 iterations); - - /// - int32 GetVertexCount() const - { - return m_count; - } - - /// - const b2Vec2* GetVertices() const - { - return m_ps; - } - - /// - void Draw(b2Draw* draw) const; - - /// - void SetAngle(float32 angle); - -private: - - void SolveC2(); - void SolveC3(); - - int32 m_count; - b2Vec2* m_ps; - b2Vec2* m_p0s; - b2Vec2* m_vs; - - float32* m_ims; - - float32* m_Ls; - float32* m_as; - - b2Vec2 m_gravity; - float32 m_damping; - - float32 m_k2; - float32 m_k3; -}; - -#endif diff --git a/love/src/jni/love/src/libraries/Wuff/wuff.c b/love/src/jni/love/src/libraries/Wuff/wuff.c deleted file mode 100644 index f3597333..00000000 --- a/love/src/jni/love/src/libraries/Wuff/wuff.c +++ /dev/null @@ -1,203 +0,0 @@ -#include - -#include "wuff_config.h" -#include "wuff.h" -#include "wuff_internal.h" - - -wuff_sint32 wuff_open(struct wuff_handle ** handle_pointer, struct wuff_callback * callback, void * userdata) -{ - struct wuff_handle * handle; - wuff_sint32 wuff_status; - - if (handle_pointer == NULL || callback == NULL) - return WUFF_INVALID_PARAM; - - handle = wuff_alloc(sizeof(struct wuff_handle)); - if (handle == NULL) - return WUFF_MEMALLOC_ERROR; - - memset(handle, 0, sizeof(struct wuff_handle)); - handle->buffer.data = NULL; - handle->callback = callback; - handle->userdata = userdata; - - wuff_status = wuff_setup(handle); - if (wuff_status < 0) - { - wuff_cleanup(handle); - return wuff_status; - } - - *handle_pointer = handle; - - return WUFF_SUCCESS; -} - -wuff_sint32 wuff_close(struct wuff_handle * handle) -{ - wuff_sint32 wuff_status; - - if (handle == NULL) - return WUFF_INVALID_PARAM; - - wuff_status = wuff_cleanup(handle); - WUFF_STATUS_BAIL() - - return WUFF_SUCCESS; -} - -wuff_sint32 wuff_seek(struct wuff_handle * handle, wuff_uint64 offset) -{ - wuff_sint32 wuff_status; - wuff_uint64 seek_offset; - - if (handle == NULL) - return WUFF_INVALID_PARAM; - - /* Clamp offset to stream length. */ - offset = offset <= handle->stream.length ? offset : handle->stream.length; - seek_offset = offset * handle->stream.header.block_size; - wuff_status = handle->callback->seek(handle->userdata, handle->stream.data.offset + seek_offset); - WUFF_STATUS_BAIL() - - handle->stream.position = offset; - handle->output.block_offset = 0; - - /* A new position requires an empty buffer. */ - wuff_status = wuff_buffer_clear(handle); - WUFF_STATUS_BAIL() - - return WUFF_SUCCESS; -} - -wuff_sint32 wuff_tell(struct wuff_handle * handle, wuff_uint64 * offset) -{ - if (handle == NULL) - return WUFF_INVALID_PARAM; - - *offset = handle->stream.position; - - return WUFF_SUCCESS; -} - -wuff_sint32 wuff_stream_info(struct wuff_handle * handle, struct wuff_info * info) -{ - if (handle == NULL || info == NULL) - return WUFF_INVALID_PARAM; - - info->format = handle->stream.format; - info->channels = handle->stream.header.channels; - info->sample_rate = handle->stream.header.sample_rate; - info->bits_per_sample = handle->stream.header.bits_per_sample; - info->length = handle->stream.length; - /* Think about adding channel mapping and perhaps other things. */ - - return WUFF_SUCCESS; -} - -wuff_sint32 wuff_format(struct wuff_handle * handle, wuff_uint16 format) -{ - wuff_sint32 wuff_status; - - if (handle == NULL) - return WUFF_INVALID_PARAM; - else if (format >= WUFF_FORMAT_MAX) - return WUFF_FORMAT_UNSUPPORTED; - - /* A format change resets the position to the start of the block. */ - wuff_status = wuff_seek(handle, handle->stream.position); - WUFF_STATUS_BAIL() - - wuff_status = wuff_set_output_format(handle, format); - WUFF_STATUS_BAIL() - - return WUFF_SUCCESS; -} - -wuff_sint32 wuff_read(struct wuff_handle * handle, wuff_uint8 * out_buffer, size_t * out_size) -{ - size_t current_offset; - size_t r_samples, num_samples; - wuff_uint8 head_offset, head, tail, sample_size; - wuff_uint8 * in_buffer; - wuff_sint32 wuff_status; - - if (handle == NULL || out_buffer == NULL || out_size == NULL) - return WUFF_INVALID_PARAM; - - if (*out_size == 0) - return WUFF_SUCCESS; - - sample_size = (wuff_uint8)handle->output.bytes_per_sample; - - /* Calculating the number of samples that fit into the application buffer. */ - /* The first and last sample may be truncated. */ - current_offset = handle->output.block_offset; - head_offset = current_offset % sample_size; - head = head_offset == 0 ? 0 : sample_size - head_offset; - num_samples = wuff_calculate_samples(*out_size, sample_size, &head, &tail); - - /* Requesting the number of samples from the buffer. */ - /* Calculate the new sample count if necessary and write the output. */ - r_samples = num_samples; - wuff_status = wuff_buffer_request(handle, &in_buffer, &r_samples); - WUFF_STATUS_BAIL() - else if (r_samples == 0) - { - /* Possible EOF. */ - *out_size = 0; - } - else - { - if (r_samples == 1 && head != 0) - { - /* Only the first truncated sample fits. */ - /* I really hope nobody will use small buffers like this. */ - num_samples = 0; - tail = 0; - } - else - { - /* At this point the first (possibly truncated) sample will be fully written. */ - /* Subtract the first and last sample from the count if they're truncated. */ - if (r_samples < num_samples) - tail = 0; - num_samples = r_samples - !!head - !!tail; - } - - handle->output.function(out_buffer, in_buffer, num_samples, head_offset, head, tail); - - /* Report the number of bytes written. */ - *out_size = num_samples * sample_size + head + tail; - - /* Adjust the block offset and sample position. */ - current_offset += *out_size; - if (current_offset >= handle->output.block_size) - { - handle->stream.position += current_offset / handle->output.block_size; - handle->output.block_offset = current_offset % handle->output.block_size; - } - else - { - handle->output.block_offset = current_offset; - } - - /* Release the fully processed samples from the buffer. */ - wuff_status = wuff_buffer_release(handle, head_offset + head == sample_size ? num_samples + 1 : num_samples); - WUFF_STATUS_BAIL() - } - - return WUFF_SUCCESS; -} - -void wuff_version(struct wuff_version * version) -{ - if (version == NULL) - return; - - version->major = WUFF_VERSION_MAJOR; - version->minor = WUFF_VERSION_MINOR; - version->build = WUFF_VERSION_BUILD; - version->revision = WUFF_VERSION_REVISION; -} diff --git a/love/src/jni/love/src/libraries/Wuff/wuff.h b/love/src/jni/love/src/libraries/Wuff/wuff.h deleted file mode 100644 index c7cc1092..00000000 --- a/love/src/jni/love/src/libraries/Wuff/wuff.h +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Wuff - A very basic WAVE reader - */ - -#ifndef WUFF_H -#define WUFF_H - -#ifdef __cplusplus -extern "C" { -#endif - - -#define WUFF_VERSION_MAJOR 0 -#define WUFF_VERSION_MINOR 0 -#define WUFF_VERSION_BUILD 0 -#define WUFF_VERSION_REVISION 2 - - -#ifndef WUFF_API_OVERRIDE - #if defined(_WIN32) && defined(WUFF_DYNAMIC_LIB) - #define WUFF_EXPORT __declspec(dllexport) - #define WUFF_IMPORT __declspec(dllimport) - #else - #define WUFF_EXPORT - #define WUFF_IMPORT - #endif -#endif - -#ifdef WUFF_BUILDING_CORE - #define WUFF_API WUFF_EXPORT -#else - #define WUFF_API WUFF_IMPORT -#endif - - -#ifdef WUFF_FORCE_STDINT_H - #include -typedef uint8_t wuff_uint8; -typedef int8_t wuff_sint8; -typedef uint16_t wuff_uint16; -typedef int16_t wuff_sint16; -typedef uint32_t wuff_uint32; -typedef int32_t wuff_sint32; - #ifdef WUFF_NO_64BIT_TYPE -typedef uint32_t wuff_uint64; -typedef int32_t wuff_sint64; - #else -typedef uint64_t wuff_uint64; -typedef int64_t wuff_sint64; - #endif -#elif _MSC_VER -typedef unsigned __int8 wuff_uint8; -typedef signed __int8 wuff_sint8; -typedef unsigned __int16 wuff_uint16; -typedef signed __int16 wuff_sint16; -typedef unsigned __int32 wuff_uint32; -typedef signed __int32 wuff_sint32; -typedef unsigned __int64 wuff_uint64; -typedef signed __int64 wuff_sint64; -#else -typedef unsigned char wuff_uint8; -typedef signed char wuff_sint8; -typedef unsigned short wuff_uint16; -typedef signed short wuff_sint16; -typedef unsigned int wuff_uint32; -typedef signed int wuff_sint32; - #ifdef WUFF_NO_64BIT_TYPE -typedef unsigned long wuff_uint64; -typedef signed long wuff_sint64; - #else -typedef unsigned long long wuff_uint64; -typedef signed long long wuff_sint64; - #endif -#endif - -/** @file */ -/** - * Opaque structure used to identify the open Wuff streams. - */ -struct wuff_handle; - -/** - * Callbacks that control the delivery of the data of the WAVE file. - * - * The return values of the functions indicate their status. A zero or positive - * value means success and a negative value failure. The macros WUFF_SUCCESS and - * WUFF_ERROR, or a value equal or below WUFF_USER_ERROR can be used. The error - * value will be returned by the function called by the application. - */ -struct wuff_callback -{ - /** - * The read callback requests the linking application to write at least - * 'size' bytes into the memory where 'buffer' is pointing to. The value - * pointed to by 'size' must be update to the actual number of bytes - * written. Zero will be interepreted as the end-of-file. - * - * @param userdata The userdata set with wuff_open. - * @param buffer A pointer to the memory where the data can be written to. - * @param size A pointer to the size of the buffer and the bytes written. - */ - wuff_sint32 (* read)(void * userdata, wuff_uint8 * buffer, size_t * size); - - /** - * The seek callback requests the linking application to seek to a new byte - * offset in the WAVE data. The next call to the read callback must then - * write data starting from this position. The offset is always relative - * to the beginning of the WAVE data. - * - * @param userdata The userdata set with wuff_open. - * @param offset The new offset. - */ - wuff_sint32 (* seek)(void * userdata, wuff_uint64 offset); - - /** - * The tell callback requests the linking application to write the current - * byte position to the integer pointed to by 'offset'. - * - * @param userdata The userdata set with wuff_open. - * @param offset A pointer to an integer where the current position can be written to. - */ - wuff_sint32 (* tell)(void * userdata, wuff_uint64 * offset); -}; - - -/** - * Stream information structure. - */ -struct wuff_info -{ - wuff_uint16 format; /**< The format of the stream. - * See "Wuff raw sample formats" below. */ - wuff_uint16 channels; /**< The number of channels in the stream. */ - wuff_uint32 sample_rate; /**< The sample rate in hertz. */ - wuff_uint16 bits_per_sample; /**< The number of bits per sample. */ - wuff_uint64 length; /**< The length of the stream in samples. */ -}; - - -/** - * Version information structure. - */ -struct wuff_version -{ - wuff_uint16 major; - wuff_uint16 minor; - wuff_uint16 build; - wuff_uint16 revision; -}; - - -/** - * Opens a new Wuff stream. This will read from the callbacks immediately, make - * sure they're ready. It will check if the WAVE file is supported. - * - * @param handle A pointer to pointer of a wuff_handle that will be - * initialized if the function succeeds. - * @param callback The callbacks for the data of the WAVE file. - * @param userdata A void pointer that will be passed to the callbacks. - * @return Returns a negative value if an error occured. - */ -WUFF_API wuff_sint32 wuff_open(struct wuff_handle ** handle, struct wuff_callback * callback, void * userdata); - -/** - * Closes a Wuff stream. - * - * @param handle The Wuff stream handle. - * @return Returns a negative value if an error occured. - */ -WUFF_API wuff_sint32 wuff_close(struct wuff_handle * handle); - -/** - * Fills the wuff_info struct with information about the stream. - * - * @param handle The Wuff stream handle. - * @param info A pointer to a wuff_info struct. - * @return Returns a negative value if an error occured. - */ -WUFF_API wuff_sint32 wuff_stream_info(struct wuff_handle * handle, struct wuff_info * info); - -/** - * Sets the output format of the decoder. A new format resets the decoder output - * to the beginning of the current block (the sample of the first channel). - * - * @param handle The Wuff stream handle. - * @param format The new output format. - * @return Returns a negative value if an error occured. - */ -WUFF_API wuff_sint32 wuff_format(struct wuff_handle * handle, wuff_uint16 format); - -/** - * Decodes samples to the passed memory location. The size_t pointer points to - * the maximum number of bytes that can be written to the buffer. This count - * will be adjusted to the number of bytes written to the buffer. - * - * @param handle The Wuff stream handle. - * @param buffer The buffer to write to. - * @param size The maximum number of bytes to write to the buffer. - * @return Returns a negative value if an error occured. - */ -WUFF_API wuff_sint32 wuff_read(struct wuff_handle * handle, wuff_uint8 * buffer, size_t * size); - -/** - * Seeks to a sample location. - * The next call to wuff_read will return samples starting from this position. - * - * @param handle The Wuff stream handle. - * @param offset The sample offset to seek to. - * @return Returns a negative value if an error occured. - */ -WUFF_API wuff_sint32 wuff_seek(struct wuff_handle * handle, wuff_uint64 offset); - -/** - * Sets the current position. - * - * @param handle The Wuff stream handle. - * @param offset A pointer to a integer that will receive the sample offset. - * @return Returns a negative value if an error occured. - */ -WUFF_API wuff_sint32 wuff_tell(struct wuff_handle * handle, wuff_uint64 * offset); - -/** - * Copies the Wuff version of the binary into the struct. - * For compile-time version information use the WUFF_VERSION_MAJOR, - * WUFF_VERSION_MINOR, WUFF_VERSION_BUILD, and WUFF_VERSION_REVISION macros. - * - * @param version A pointer to a wuff_version struct that will receive the - * version information. - */ -WUFF_API void wuff_version(struct wuff_version * version); - - -/* Wuff raw sample formats. */ -#define WUFF_FORMAT_PCM_U8 0 -#define WUFF_FORMAT_PCM_S16 1 -#define WUFF_FORMAT_PCM_S24 2 -#define WUFF_FORMAT_PCM_S32 3 -#define WUFF_FORMAT_IEEE_FLOAT_32 4 -#define WUFF_FORMAT_IEEE_FLOAT_64 5 -#define WUFF_FORMAT_MAX 6 - - -/* Success and error return values for all functions. */ -#define WUFF_STREAM_EOF 100 - -#define WUFF_SUCCESS 0 - -#define WUFF_ERROR -1 -#define WUFF_INVALID_PARAM -2 -#define WUFF_MEMALLOC_ERROR -3 - -#define WUFF_STREAM_NOT_RIFF -100 -#define WUFF_STREAM_NOT_WAVE -101 -#define WUFF_STREAM_INVALID -102 -#define WUFF_STREAM_ZERO_CHANNELS -103 -#define WUFF_STREAM_ZERO_SAMPLE_RATE -104 -#define WUFF_STREAM_ZERO_BITS_PER_SAMPLE -105 -#define WUFF_STREAM_FORMAT_CHUNK_MISSING -106 -#define WUFF_STREAM_DATA_CHUNK_MISSING -107 -#define WUFF_STREAM_CHUNK_NOT_FOUND -108 - -#define WUFF_FORMAT_UNSUPPORTED -200 - -#define WUFF_BUFFER_INVALID_SIZE -300 -#define WUFF_BUFFER_INVALID_STREAM_POSITION -301 - -#define WUFF_USER_ERROR -10000 - - -#ifdef __cplusplus -} -#endif - -#endif /* WUFF_H */ diff --git a/love/src/jni/love/src/libraries/Wuff/wuff_config.h b/love/src/jni/love/src/libraries/Wuff/wuff_config.h deleted file mode 100644 index ed17005f..00000000 --- a/love/src/jni/love/src/libraries/Wuff/wuff_config.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef WUFF_CONFIG_H -#define WUFF_CONFIG_H - -/* Defines that the internal code is being built. */ -/* The wuff.h header uses this to change export and import macros. */ -#define WUFF_BUILDING_CORE - -#ifndef WUFF_INLINE_OVERRIDE - #ifdef __cplusplus - #define WUFF_INLINE inline - #else - #ifdef _MSC_VER - #define WUFF_INLINE __inline - #elif __GNUC__ - #define WUFF_INLINE __inline__ - #else - #define WUFF_INLINE - #endif - #endif -#endif - - -#ifndef WUFF_GCC_VISIBILITY_OVERRIDE - #if __GNUC__ >= 4 - #define WUFF_INTERN_API __attribute__((visibility("hidden"))) - #else - #define WUFF_INTERN_API - #endif -#endif - - -#ifdef WUFF_MEMALLOC_OVERRIDE - #ifdef __cplusplus -extern "C" { - #endif - - /* Define your own memory allocator. */ - void * wuff_alloc(size_t size); - void wuff_free(void * mem); - - #ifdef __cplusplus -} - #endif -#else -WUFF_INTERN_API void * wuff_alloc(size_t size); -WUFF_INTERN_API void wuff_free(void * mem); -#endif - - -#endif /* WUFF_CONFIG_H */ diff --git a/love/src/jni/love/src/libraries/Wuff/wuff_convert.c b/love/src/jni/love/src/libraries/Wuff/wuff_convert.c deleted file mode 100644 index 9e60ff5d..00000000 --- a/love/src/jni/love/src/libraries/Wuff/wuff_convert.c +++ /dev/null @@ -1,827 +0,0 @@ -#include - -#include "wuff_config.h" -#include "wuff.h" -#include "wuff_convert.h" - -/* - * int8 functions. - */ - -WUFF_CONV_FUNC(wuff_int8_to_int8) -{ - (void)offset; - memcpy(dst, src, samples + head + tail); -} - -WUFF_CONV_FUNC(wuff_int8_to_int16) -{ - wuff_sint16 i16; - size_t i; - - if (head != 0) - { - i16 = (src[0] - 128) << 8; - memcpy(dst, (wuff_uint8 *)&i16 + offset, head); - src += 1; - dst += head; - } - - for (i = 0; i < samples; i++) - { - i16 = (src[i] - 128) << 8; - memcpy(dst + i * 2, &i16, 2); - } - - if (tail != 0) - { - i16 = (src[samples] - 128) << 8; - memcpy(dst + samples * 2, &i16, tail); - } -} - -WUFF_CONV_FUNC(wuff_int8_to_int24) -{ - wuff_sint32 i24; - size_t i; - - if (head != 0) - { - i24 = (src[0] - 128) << 24; - memcpy(dst, (wuff_uint8 *)&i24 + 1 + offset, head); - src += 1; - dst += head; - } - - for (i = 0; i < samples; i++) - { - i24 = (src[i] - 128) << 24; - memcpy(dst + i * 3, (wuff_uint8 *)&i24 + 1, 3); - } - - if (tail != 0) - { - i24 = (src[samples] - 128) << 24; - memcpy(dst + samples * 3, (wuff_uint8 *)&i24 + 1, tail); - } -} - -WUFF_CONV_FUNC(wuff_int8_to_int32) -{ - wuff_sint32 i32; - size_t i; - - if (head != 0) - { - i32 = (src[0] - 128) << 24; - memcpy(dst, (wuff_uint8 *)&i32 + offset, head); - src += 1; - dst += head; - } - - for (i = 0; i < samples; i++) - { - i32 = (src[i] - 128) << 24; - memcpy(dst + i * 4, &i32, 4); - } - - if (tail != 0) - { - i32 = (src[samples] - 128) << 24; - memcpy(dst + samples * 4, &i32, tail); - } -} - -WUFF_CONV_FUNC(wuff_int8_to_float32) -{ - float f32; - size_t i; - - if (head != 0) - { - f32 = (float)(src[0] - 128) / 128.0f; - memcpy(dst, (wuff_uint8 *)&f32 + offset, head); - src += 1; - dst += head; - } - - for (i = 0; i < samples; i++) - { - f32 = (float)(src[i] - 128) / 128.0f; - memcpy(dst + i * 4, &f32, 4); - } - - if (tail != 0) - { - f32 = (float)(src[samples] - 128) / 128.0f; - memcpy(dst + samples * 4, &f32, tail); - } -} - -WUFF_CONV_FUNC(wuff_int8_to_float64) -{ - double f64; - size_t i; - - if (head != 0) - { - f64 = (double)(src[0] - 128) / 128.0; - memcpy(dst, (wuff_uint8 *)&f64 + offset, head); - src += 1; - dst += head; - } - - for (i = 0; i < samples; i++) - { - f64 = (double)(src[i] - 128) / 128.0; - memcpy(dst + i * 8, &f64, 8); - } - - if (tail != 0) - { - f64 = (double)(src[samples] - 128) / 128.0; - memcpy(dst + samples * 8, &f64, tail); - } -} - -/* - * int16 functions. - */ - -WUFF_CONV_FUNC(wuff_int16_to_int8) -{ - wuff_sint16 i16; - size_t i; - (void)offset; (void)head; (void)tail; - - for (i = 0; i < samples; i++) - { - memcpy(&i16, src + i * 2, 2); - dst[i] = (i16 >> 8) + 128; - } -} - -WUFF_CONV_FUNC(wuff_int16_to_int16) -{ - memcpy(dst, src + offset, samples * 2 + head + tail); -} - -WUFF_CONV_FUNC(wuff_int16_to_int24) -{ - wuff_sint16 i16; - wuff_sint32 i24; - size_t i; - - if (head != 0) - { - memcpy(&i16, src, 2); - i24 = i16 << 16; - memcpy(dst, (wuff_uint8 *)&i24 + 1 + offset, head); - src += 2; - dst += head; - } - - for (i = 0; i < samples; i++) - { - memcpy(&i16, src + i * 2, 2); - i24 = i16 << 16; - memcpy(dst + i * 3, (wuff_uint8 *)&i24 + 1, 3); - } - - if (tail != 0) - { - memcpy(&i16, src + samples * 2, 2); - i24 = i16 << 16; - memcpy(dst + samples * 3, (wuff_uint8 *)&i24 + 1, tail); - } -} - -WUFF_CONV_FUNC(wuff_int16_to_int32) -{ - wuff_sint16 i16; - wuff_sint32 i32; - size_t i; - - if (head != 0) - { - memcpy(&i16, src, 2); - i32 = i16 << 16; - memcpy(dst, (wuff_uint8 *)&i32 + offset, head); - src += 2; - dst += head; - } - - for (i = 0; i < samples; i++) - { - memcpy(&i16, src + i * 2, 2); - i32 = i16 << 16; - memcpy(dst + i * 4, &i32, 4); - } - - if (tail != 0) - { - memcpy(&i16, src + samples * 2, 2); - i32 = i16 << 16; - memcpy(dst + samples * 4, &i32, tail); - } -} - -WUFF_CONV_FUNC(wuff_int16_to_float32) -{ - wuff_sint16 i16; - float f32; - size_t i; - - if (head != 0) - { - memcpy(&i16, src, 2); - f32 = (float)i16 / 32768.0f; - memcpy(dst, (wuff_uint8 *)&f32 + offset, head); - src += 2; - dst += head; - } - - for (i = 0; i < samples; i++) - { - memcpy(&i16, src + i * 2, 2); - f32 = (float)i16 / 32768.0f; - memcpy(dst + i * 4, &f32, 4); - } - - if (tail != 0) - { - memcpy(&i16, src + samples * 2, 2); - f32 = (float)i16 / 32768.0f; - memcpy(dst + samples * 4, &f32, tail); - } -} - -WUFF_CONV_FUNC(wuff_int16_to_float64) -{ - wuff_sint16 i16; - double f64; - size_t i; - - if (head != 0) - { - memcpy(&i16, src, 2); - f64 = (double)i16 / 32768.0; - memcpy(dst, (wuff_uint8 *)&f64 + offset, head); - src += 2; - dst += head; - } - - for (i = 0; i < samples; i++) - { - memcpy(&i16, src + i * 2, 2); - f64 = (double)i16 / 32768.0; - memcpy(dst + i * 8, &f64, 8); - } - - if (tail != 0) - { - memcpy(&i16, src + samples * 2, 2); - f64 = (double)i16 / 32768.0; - memcpy(dst + samples * 8, &f64, tail); - } -} - -/* - * int24 functions. - */ - -WUFF_CONV_FUNC(wuff_int24_to_int8) -{ - wuff_sint32 i24 = 0; - size_t i; - (void)offset; (void)head; (void)tail; - - for (i = 0; i < samples; i++) - { - memcpy((wuff_uint8 *)&i24 + 1, src + i * 3, 3); - dst[i] = (wuff_uint8)((i24 >> 16) + 128); - } -} - -WUFF_CONV_FUNC(wuff_int24_to_int16) -{ - size_t i; - - if (head != 0) - { - memcpy(dst, src + 1 + offset, head); - src += 3; - dst += head; - } - - for (i = 0; i < samples; i++) - { - memcpy(dst + i * 2, src + 1 + i * 3, 2); - } - - if (tail != 0) - { - memcpy(dst + samples * 2, src + 1 + samples * 3, tail); - } -} - -WUFF_CONV_FUNC(wuff_int24_to_int24) -{ - memcpy(dst, src + offset, samples * 3 + head + tail); -} - -WUFF_CONV_FUNC(wuff_int24_to_int32) -{ - wuff_sint32 i32 = 0; - size_t i; - - if (head != 0) - { - memcpy((wuff_uint8 *)&i32 + 1, src, 3); - memcpy(dst, (wuff_uint8 *)&i32 + offset, head); - src += 3; - dst += head; - } - - for (i = 0; i < samples; i++) - { - memcpy((wuff_uint8 *)&i32 + 1, src + i * 3, 3); - memcpy(dst + i * 4, &i32, 4); - } - - if (tail != 0) - { - memcpy((wuff_uint8 *)&i32 + 1, src + samples * 3, 3); - memcpy(dst + samples * 4, &i32, tail); - } -} - -WUFF_CONV_FUNC(wuff_int24_to_float32) -{ - wuff_sint32 i24 = 0; - float f32; - size_t i; - - if (head != 0) - { - memcpy((wuff_uint8 *)&i24 + 1, src, 3); - f32 = (float)((double)i24 / 2147483648.0); - memcpy(dst, (wuff_uint8 *)&f32 + offset, head); - src += 3; - dst += head; - } - - for (i = 0; i < samples; i++) - { - memcpy((wuff_uint8 *)&i24 + 1, src + i * 3, 3); - f32 = (float)((double)i24 / 2147483648.0); - memcpy(dst + i * 4, &f32, 4); - } - - if (tail != 0) - { - memcpy((wuff_uint8 *)&i24 + 1, src + samples * 3, 3); - f32 = (float)((double)i24 / 2147483648.0); - memcpy(dst + samples * 4, &f32, tail); - } -} - -WUFF_CONV_FUNC(wuff_int24_to_float64) -{ - wuff_sint32 i24 = 0; - double f64; - size_t i; - - if (head != 0) - { - memcpy((wuff_uint8 *)&i24 + 1, src, 3); - f64 = (double)i24 / 2147483648.0; - memcpy(dst, (wuff_uint8 *)&f64 + offset, head); - src += 3; - dst += head; - } - - for (i = 0; i < samples; i++) - { - memcpy((wuff_uint8 *)&i24 + 1, src + i * 3, 3); - f64 = (double)i24 / 2147483648.0; - memcpy(dst + i * 8, &f64, 8); - } - - if (tail != 0) - { - memcpy((wuff_uint8 *)&i24 + 1, src + samples * 3, 3); - f64 = (double)i24 / 2147483648.0; - memcpy(dst + samples * 8, &f64, tail); - } -} - -/* - * int32 functions. - */ - -WUFF_CONV_FUNC(wuff_int32_to_int8) -{ - wuff_sint32 i32 = 0; - size_t i; - (void)offset; (void)head; (void)tail; - - for (i = 0; i < samples; i++) - { - memcpy(&i32, src + i * 4, 4); - dst[i] = (i32 >> 24) + 128; - } -} - -WUFF_CONV_FUNC(wuff_int32_to_int16) -{ - size_t i; - - if (head != 0) - { - memcpy(dst, src + 2 + offset, head); - src += 4; - dst += head; - } - - for (i = 0; i < samples; i++) - { - memcpy(dst + i * 2, src + 2 + i * 4, 2); - } - - if (tail != 0) - { - memcpy(dst + samples * 2, src + 2 + samples * 4, tail); - } -} - -WUFF_CONV_FUNC(wuff_int32_to_int24) -{ - size_t i; - - if (head != 0) - { - memcpy(dst, src + 1 + offset, head); - src += 4; - dst += head; - } - - for (i = 0; i < samples; i++) - { - memcpy(dst + i * 3, src + 1 + i * 4, 3); - } - - if (tail != 0) - { - memcpy(dst + samples * 3, src + 1 + samples * 4, tail); - } -} - -WUFF_CONV_FUNC(wuff_int32_to_int32) -{ - memcpy(dst, src + offset, samples * 4 + head + tail); -} - -WUFF_CONV_FUNC(wuff_int32_to_float32) -{ - wuff_sint32 i32; - float f32; - size_t i; - - if (head != 0) - { - memcpy(&i32, src, 4); - f32 = (float)((double)i32 / 2147483648.0); - memcpy(dst, (wuff_uint8 *)&f32 + offset, head); - src += 4; - dst += head; - } - - for (i = 0; i < samples; i++) - { - memcpy(&i32, src + i * 4, 4); - f32 = (float)((double)i32 / 2147483648.0); - memcpy(dst + i * 4, &f32, 4); - } - - if (tail != 0) - { - memcpy(&i32, src + samples * 4, 4); - f32 = (float)((double)i32 / 2147483648.0); - memcpy(dst + samples * 4, &f32, tail); - } -} - -WUFF_CONV_FUNC(wuff_int32_to_float64) -{ - wuff_sint32 i32; - double f64; - size_t i; - - if (head != 0) - { - memcpy(&i32, src, 4); - f64 = (double)i32 / 2147483648.0; - memcpy(dst, (wuff_uint8 *)&f64 + offset, head); - src += 4; - dst += head; - } - - for (i = 0; i < samples; i++) - { - memcpy(&i32, src + i * 4, 4); - f64 = (double)i32 / 2147483648.0; - memcpy(dst + i * 8, &f64, 8); - } - - if (tail != 0) - { - memcpy(&i32, src + samples * 4, 4); - f64 = (double)i32 / 2147483648.0; - memcpy(dst + samples * 8, &f64, tail); - } -} - -/* - * float32 functions. - */ - -WUFF_CONV_FUNC(wuff_float32_to_int8) -{ - float f32; - size_t i; - (void)offset; (void)head; (void)tail; - - for (i = 0; i < samples; i++) - { - memcpy(&f32, src + i * 4, 4); - dst[i] = (wuff_uint8)((f32 * 127.5f) + 128.0f); - } -} - -WUFF_CONV_FUNC(wuff_float32_to_int16) -{ - float f32; - wuff_sint16 i16; - size_t i; - - if (head != 0) - { - memcpy(&f32, src, 4); - i16 = (wuff_sint16)(f32 * 32767.5f); - memcpy(dst, (wuff_uint8 *)&i16 + offset, head); - src += 4; - dst += head; - } - - for (i = 0; i < samples; i++) - { - memcpy(&f32, src + i * 4, 4); - i16 = (wuff_sint16)(f32 * 32767.5f); - memcpy(dst + i * 2, &i16, 2); - } - - if (tail != 0) - { - memcpy(&f32, src + i * 4, 4); - i16 = (wuff_sint16)(f32 * 32767.5f); - memcpy(dst + i * 2, &i16, tail); - } -} - -WUFF_CONV_FUNC(wuff_float32_to_int24) -{ - float f32; - wuff_sint32 i24; - size_t i; - - if (head != 0) - { - memcpy(&f32, src, 4); - i24 = (wuff_sint32)((double)f32 * 2147483647.5); - memcpy(dst, (wuff_uint8 *)&i24 + 1 + offset, head); - src += 4; - dst += head; - } - - for (i = 0; i < samples; i++) - { - memcpy(&f32, src + i * 4, 4); - i24 = (wuff_sint32)((double)f32 * 2147483647.5); - memcpy(dst + i * 3, (wuff_uint8 *)&i24 + 1, 3); - } - - if (tail != 0) - { - memcpy(&f32, src + samples * 4, 4); - i24 = (wuff_sint32)((double)f32 * 2147483647.5); - memcpy(dst + samples * 3, (wuff_uint8 *)&i24 + 1, tail); - } -} - -WUFF_CONV_FUNC(wuff_float32_to_int32) -{ - float f32; - wuff_sint32 i32; - size_t i; - - if (head != 0) - { - memcpy(&f32, src, 4); - i32 = (wuff_sint32)((double)f32 * 2147483647.5); - memcpy(dst, (wuff_uint8 *)&i32 + offset, head); - src += 4; - dst += head; - } - - for (i = 0; i < samples; i++) - { - memcpy(&f32, src + i * 4, 4); - i32 = (wuff_sint32)((double)f32 * 2147483647.5); - memcpy(dst + i * 4, &i32, 4); - } - - if (tail != 0) - { - memcpy(&f32, src + samples * 4, 4); - i32 = (wuff_sint32)((double)f32 * 2147483647.5); - memcpy(dst + samples * 4, &i32, tail); - } -} - -WUFF_CONV_FUNC(wuff_float32_to_float32) -{ - memcpy(dst, src + offset, samples * 4 + head + tail); -} - -WUFF_CONV_FUNC(wuff_float32_to_float64) -{ - float f32; - double f64; - size_t i; - - if (head != 0) - { - memcpy(&f32, src, 4); - f64 = f32; - memcpy(dst, (wuff_uint8 *)&f64 + offset, head); - src += 4; - dst += head; - } - - for (i = 0; i < samples; i++) - { - memcpy(&f32, src + i * 4, 4); - f64 = f32; - memcpy(dst + i * 8, &f64, 8); - } - - if (tail != 0) - { - memcpy(&f32, src + samples * 4, 4); - f64 = f32; - memcpy(dst + samples * 8, &f64, tail); - } -} - -/* - * float64 functions. - */ - -WUFF_CONV_FUNC(wuff_float64_to_int8) -{ - double f64; - size_t i; - (void)offset; (void)head; (void)tail; - - for (i = 0; i < samples; i++) - { - memcpy(&f64, src + i * 8, 8); - dst[i] = (wuff_uint8)((f64 * 127.5) + 128.0); - } -} - -WUFF_CONV_FUNC(wuff_float64_to_int16) -{ - double f64; - wuff_sint16 i16; - size_t i; - - if (head != 0) - { - memcpy(&f64, src, 8); - i16 = (wuff_sint16)(f64 * 32767.5); - memcpy(dst, (wuff_uint8 *)&i16 + offset, head); - src += 8; - dst += head; - } - - for (i = 0; i < samples; i++) - { - memcpy(&f64, src + i * 8, 8); - i16 = (wuff_sint16)(f64 * 32767.5); - memcpy(dst + i * 2, &i16, 2); - } - - if (tail != 0) - { - memcpy(&f64, src + i * 8, 8); - i16 = (wuff_sint16)(f64 * 32767.5); - memcpy(dst + i * 2, &i16, tail); - } -} - -WUFF_CONV_FUNC(wuff_float64_to_int24) -{ - double f64; - wuff_sint32 i24; - size_t i; - - if (head != 0) - { - memcpy(&f64, src, 8); - i24 = (wuff_sint32)(f64 * 2147483647.5); - memcpy(dst, (wuff_uint8 *)&i24 + 1 + offset, head); - src += 8; - dst += head; - } - - for (i = 0; i < samples; i++) - { - memcpy(&f64, src + i * 8, 8); - i24 = (wuff_sint32)(f64 * 2147483647.5); - memcpy(dst + i * 3, (wuff_uint8 *)&i24 + 1, 3); - } - - if (tail != 0) - { - memcpy(&f64, src + samples * 8, 8); - i24 = (wuff_sint32)(f64 * 2147483647.5); - memcpy(dst + samples * 3, (wuff_uint8 *)&i24 + 1, tail); - } -} - -WUFF_CONV_FUNC(wuff_float64_to_int32) -{ - double f64; - wuff_sint32 i32; - size_t i; - - if (head != 0) - { - memcpy(&f64, src, 8); - i32 = (wuff_sint32)(f64 * 2147483647.5); - memcpy(dst, (wuff_uint8 *)&i32 + offset, head); - src += 8; - dst += head; - } - - for (i = 0; i < samples; i++) - { - memcpy(&f64, src + i * 8, 8); - i32 = (wuff_sint32)(f64 * 2147483647.5); - memcpy(dst + i * 4, &i32, 4); - } - - if (tail != 0) - { - memcpy(&f64, src + samples * 8, 8); - i32 = (wuff_sint32)(f64 * 2147483647.5); - memcpy(dst + samples * 4, &i32, tail); - } -} - -WUFF_CONV_FUNC(wuff_float64_to_float32) -{ - double f64; - float f32; - size_t i; - - if (head != 0) - { - memcpy(&f64, src, 8); - f32 = (float)f64; - memcpy(dst, (wuff_uint8 *)&f32 + offset, head); - src += 8; - dst += head; - } - - for (i = 0; i < samples; i++) - { - memcpy(&f64, src + i * 8, 8); - f32 = (float)f64; - memcpy(dst + i * 4, &f32, 4); - } - - if (tail != 0) - { - memcpy(&f64, src + samples * 8, 8); - f32 = (float)f64; - memcpy(dst + samples * 4, &f32, tail); - } -} - -WUFF_CONV_FUNC(wuff_float64_to_float64) -{ - memcpy(dst, src + offset, samples * 8 + head + tail); -} diff --git a/love/src/jni/love/src/libraries/Wuff/wuff_convert.h b/love/src/jni/love/src/libraries/Wuff/wuff_convert.h deleted file mode 100644 index 280973d2..00000000 --- a/love/src/jni/love/src/libraries/Wuff/wuff_convert.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef WUFF_CONVERT_H -#define WUFF_CONVERT_H - -#define WUFF_CONV_FUNC(name) WUFF_INTERN_API void name(wuff_uint8 * dst, wuff_uint8 * src, size_t samples, wuff_uint8 offset, wuff_uint8 head, wuff_uint8 tail) - -WUFF_CONV_FUNC(wuff_int8_to_int8); -WUFF_CONV_FUNC(wuff_int8_to_int16); -WUFF_CONV_FUNC(wuff_int8_to_int24); -WUFF_CONV_FUNC(wuff_int8_to_int32); -WUFF_CONV_FUNC(wuff_int8_to_float32); -WUFF_CONV_FUNC(wuff_int8_to_float64); - -WUFF_CONV_FUNC(wuff_int16_to_int8); -WUFF_CONV_FUNC(wuff_int16_to_int16); -WUFF_CONV_FUNC(wuff_int16_to_int24); -WUFF_CONV_FUNC(wuff_int16_to_int32); -WUFF_CONV_FUNC(wuff_int16_to_float32); -WUFF_CONV_FUNC(wuff_int16_to_float64); - -WUFF_CONV_FUNC(wuff_int24_to_int8); -WUFF_CONV_FUNC(wuff_int24_to_int16); -WUFF_CONV_FUNC(wuff_int24_to_int24); -WUFF_CONV_FUNC(wuff_int24_to_int32); -WUFF_CONV_FUNC(wuff_int24_to_float32); -WUFF_CONV_FUNC(wuff_int24_to_float64); - -WUFF_CONV_FUNC(wuff_int32_to_int8); -WUFF_CONV_FUNC(wuff_int32_to_int16); -WUFF_CONV_FUNC(wuff_int32_to_int24); -WUFF_CONV_FUNC(wuff_int32_to_int32); -WUFF_CONV_FUNC(wuff_int32_to_float32); -WUFF_CONV_FUNC(wuff_int32_to_float64); - -WUFF_CONV_FUNC(wuff_float32_to_int8); -WUFF_CONV_FUNC(wuff_float32_to_int16); -WUFF_CONV_FUNC(wuff_float32_to_int24); -WUFF_CONV_FUNC(wuff_float32_to_int32); -WUFF_CONV_FUNC(wuff_float32_to_float32); -WUFF_CONV_FUNC(wuff_float32_to_float64); - -WUFF_CONV_FUNC(wuff_float64_to_int8); -WUFF_CONV_FUNC(wuff_float64_to_int16); -WUFF_CONV_FUNC(wuff_float64_to_int24); -WUFF_CONV_FUNC(wuff_float64_to_int32); -WUFF_CONV_FUNC(wuff_float64_to_float32); -WUFF_CONV_FUNC(wuff_float64_to_float64); - -#endif /* WUFF_CONVERT_H */ diff --git a/love/src/jni/love/src/libraries/Wuff/wuff_internal.c b/love/src/jni/love/src/libraries/Wuff/wuff_internal.c deleted file mode 100644 index e4813329..00000000 --- a/love/src/jni/love/src/libraries/Wuff/wuff_internal.c +++ /dev/null @@ -1,540 +0,0 @@ -#include -#include - -#include "wuff_config.h" -#include "wuff.h" -#include "wuff_internal.h" -#include "wuff_convert.h" - - -wuff_sint32 wuff_setup(struct wuff_handle * handle) -{ - wuff_sint32 wuff_status; - - if (handle == NULL) - return WUFF_INVALID_PARAM; - - wuff_status = wuff_init_stream(handle); - WUFF_STATUS_BAIL() - - /* Allocating the buffer for the handle requires information from the stream. */ - wuff_status = wuff_buffer_alloc(handle); - WUFF_STATUS_BAIL() - - /* The output format defaults to the stream format. */ - wuff_status = wuff_format(handle, handle->stream.format); - WUFF_STATUS_BAIL() - - return WUFF_SUCCESS; -} - -wuff_sint32 wuff_cleanup(struct wuff_handle * handle) -{ - if (handle == NULL) - return WUFF_INVALID_PARAM; - - if (handle->buffer.data != NULL) - wuff_free(handle->buffer.data); - wuff_free(handle); - - return WUFF_SUCCESS; -} - -wuff_sint32 wuff_set_output_format(struct wuff_handle * handle, wuff_uint16 format) -{ - wuff_uint16 bits; - wuff_uint16 stream_format; - - if (handle == NULL) - return WUFF_INVALID_PARAM; - else if (format >= WUFF_FORMAT_MAX) - return WUFF_FORMAT_UNSUPPORTED; - - stream_format = handle->stream.format; - - switch (format) - { - case WUFF_FORMAT_PCM_U8: - bits = 8; - switch (stream_format) - { - case WUFF_FORMAT_PCM_U8: - handle->output.function = wuff_int8_to_int8; - break; - case WUFF_FORMAT_PCM_S16: - handle->output.function = wuff_int16_to_int8; - break; - case WUFF_FORMAT_PCM_S24: - handle->output.function = wuff_int24_to_int8; - break; - case WUFF_FORMAT_PCM_S32: - handle->output.function = wuff_int32_to_int8; - break; - case WUFF_FORMAT_IEEE_FLOAT_32: - handle->output.function = wuff_float32_to_int8; - break; - case WUFF_FORMAT_IEEE_FLOAT_64: - handle->output.function = wuff_float64_to_int8; - break; - } - break; - case WUFF_FORMAT_PCM_S16: - bits = 16; - switch (stream_format) - { - case WUFF_FORMAT_PCM_U8: - handle->output.function = wuff_int8_to_int16; - break; - case WUFF_FORMAT_PCM_S16: - handle->output.function = wuff_int16_to_int16; - break; - case WUFF_FORMAT_PCM_S24: - handle->output.function = wuff_int24_to_int16; - break; - case WUFF_FORMAT_PCM_S32: - handle->output.function = wuff_int32_to_int16; - break; - case WUFF_FORMAT_IEEE_FLOAT_32: - handle->output.function = wuff_float32_to_int16; - break; - case WUFF_FORMAT_IEEE_FLOAT_64: - handle->output.function = wuff_float64_to_int16; - break; - } - break; - case WUFF_FORMAT_PCM_S24: - bits = 24; - switch (stream_format) - { - case WUFF_FORMAT_PCM_U8: - handle->output.function = wuff_int8_to_int24; - break; - case WUFF_FORMAT_PCM_S16: - handle->output.function = wuff_int16_to_int24; - break; - case WUFF_FORMAT_PCM_S24: - handle->output.function = wuff_int24_to_int24; - break; - case WUFF_FORMAT_PCM_S32: - handle->output.function = wuff_int32_to_int24; - break; - case WUFF_FORMAT_IEEE_FLOAT_32: - handle->output.function = wuff_float32_to_int24; - break; - case WUFF_FORMAT_IEEE_FLOAT_64: - handle->output.function = wuff_float64_to_int24; - break; - } - break; - case WUFF_FORMAT_PCM_S32: - bits = 32; - switch (stream_format) - { - case WUFF_FORMAT_PCM_U8: - handle->output.function = wuff_int8_to_int32; - break; - case WUFF_FORMAT_PCM_S16: - handle->output.function = wuff_int16_to_int32; - break; - case WUFF_FORMAT_PCM_S24: - handle->output.function = wuff_int24_to_int32; - break; - case WUFF_FORMAT_PCM_S32: - handle->output.function = wuff_int32_to_int32; - break; - case WUFF_FORMAT_IEEE_FLOAT_32: - handle->output.function = wuff_float32_to_int32; - break; - case WUFF_FORMAT_IEEE_FLOAT_64: - handle->output.function = wuff_float64_to_int32; - break; - } - break; - case WUFF_FORMAT_IEEE_FLOAT_32: - bits = 32; - switch (stream_format) - { - case WUFF_FORMAT_PCM_U8: - handle->output.function = wuff_int8_to_float32; - break; - case WUFF_FORMAT_PCM_S16: - handle->output.function = wuff_int16_to_float32; - break; - case WUFF_FORMAT_PCM_S24: - handle->output.function = wuff_int24_to_float32; - break; - case WUFF_FORMAT_PCM_S32: - handle->output.function = wuff_int32_to_float32; - break; - case WUFF_FORMAT_IEEE_FLOAT_32: - handle->output.function = wuff_float32_to_float32; - break; - case WUFF_FORMAT_IEEE_FLOAT_64: - handle->output.function = wuff_float64_to_float32; - break; - } - break; - case WUFF_FORMAT_IEEE_FLOAT_64: - bits = 64; - switch (stream_format) - { - case WUFF_FORMAT_PCM_U8: - handle->output.function = wuff_int8_to_float64; - break; - case WUFF_FORMAT_PCM_S16: - handle->output.function = wuff_int16_to_float64; - break; - case WUFF_FORMAT_PCM_S24: - handle->output.function = wuff_int24_to_float64; - break; - case WUFF_FORMAT_PCM_S32: - handle->output.function = wuff_int32_to_float64; - break; - case WUFF_FORMAT_IEEE_FLOAT_32: - handle->output.function = wuff_float32_to_float64; - break; - case WUFF_FORMAT_IEEE_FLOAT_64: - handle->output.function = wuff_float64_to_float64; - break; - } - break; - default: - return WUFF_FORMAT_UNSUPPORTED; - } - - handle->output.format = format; - handle->output.bytes_per_sample = bits / 8; - handle->output.block_size = handle->stream.header.channels * (bits / 8); - - return WUFF_SUCCESS; -} - -wuff_sint32 wuff_check_bits(wuff_uint16 bits, wuff_uint16 * format) -{ - if (*format == WUFF_FORMAT_PCM) - { - switch (bits) - { - case 8: - *format = WUFF_FORMAT_PCM_U8; - break; - case 16: - *format = WUFF_FORMAT_PCM_S16; - break; - case 24: - *format = WUFF_FORMAT_PCM_S24; - break; - case 32: - *format = WUFF_FORMAT_PCM_S32; - break; - default: - return WUFF_FORMAT_UNSUPPORTED; - } - } - else if (*format == WUFF_FORMAT_IEEE_FLOAT) - { - switch (bits) - { - case 32: - *format = WUFF_FORMAT_IEEE_FLOAT_32; - break; - case 64: - *format = WUFF_FORMAT_IEEE_FLOAT_64; - break; - default: - return WUFF_FORMAT_UNSUPPORTED; - } - } - else - { - return WUFF_FORMAT_UNSUPPORTED; - } - - return WUFF_SUCCESS; -} - -size_t wuff_calculate_samples(size_t target_size, wuff_uint8 sample_size, wuff_uint8 * head, wuff_uint8 * tail) -{ - size_t samples = 0; - - if (*head != 0) - { - if (target_size <= *head) - { - *head = (wuff_uint8)target_size; - *tail = 0; - return 1; - } - target_size -= *head; - ++samples; - } - - samples = target_size / sample_size; - *tail = target_size % sample_size; - if (*tail != 0) - ++samples; - return samples; -} - -wuff_sint32 wuff_init_stream(struct wuff_handle * handle) -{ - /* Allocate some space on the stack. */ - /* No need to do dynamic allocation for simple header probing. */ - wuff_uint8 buffer[WUFF_HEADER_FETCH_SIZE]; - size_t buffer_size = WUFF_HEADER_FETCH_SIZE; - wuff_uint64 search_offset; - struct wuff_chunk_header chunk; - wuff_sint32 wuff_status; - - wuff_status = handle->callback->read(handle->userdata, buffer, &buffer_size); - WUFF_STATUS_BAIL() - else if (buffer_size < WUFF_STREAM_MIN_SIZE) - return WUFF_STREAM_NOT_RIFF; - - /* Check for RIFF signature. */ - wuff_copy_chunk_header_data(&chunk, buffer); - if (chunk.id != WUFF_RIFF_CHUNK_ID) - return WUFF_STREAM_NOT_RIFF; - handle->stream.size = chunk.size; - - /* Check for WAVE format. */ - wuff_copy_chunk_header_data(&chunk, buffer + 8); - if (chunk.id != WUFF_WAVE_CHUNK_ID) - return WUFF_STREAM_NOT_WAVE; - - /* Search fmt chunk. */ - wuff_copy_chunk_header_data(&chunk, buffer + 12); - search_offset = 12; - if (chunk.id != WUFF_FORMAT_CHUNK_ID) - { - chunk.id = 0; - /* The fmt chunk must appear before the data chunk. */ - wuff_status = wuff_search_chunk(handle, &chunk, &search_offset, WUFF_FORMAT_CHUNK_ID, WUFF_DATA_CHUNK_ID); - if (wuff_status == WUFF_STREAM_CHUNK_NOT_FOUND) - return WUFF_STREAM_FORMAT_CHUNK_MISSING; - else WUFF_STATUS_BAIL() - - /* In case the fmt chunk is not the first chunk, align it on the stack buffer as if it were. */ - buffer_size = WUFF_HEADER_FETCH_SIZE - 20; - wuff_status = handle->callback->read(handle->userdata, buffer + 20, &buffer_size); - WUFF_STATUS_BAIL() - /* EOF bail. */ - else if (buffer_size < WUFF_HEADER_MIN_SIZE) - return WUFF_STREAM_INVALID; - } - - /* Extract header information. */ - handle->stream.header.size = chunk.size; - handle->stream.header.offset = search_offset + 8; - handle->stream.header.format = wuff_get_uint16(buffer + 20); - handle->stream.header.channels = wuff_get_uint16(buffer + 22); - handle->stream.header.sample_rate = wuff_get_uint32(buffer + 24); - handle->stream.header.bits_per_sample = wuff_get_uint16(buffer + 34); - handle->stream.header.bytes_per_sample = handle->stream.header.bits_per_sample / 8; - handle->stream.header.block_size = handle->stream.header.channels * handle->stream.header.bytes_per_sample; - - /* Bail on invalid streams. */ - if (handle->stream.header.channels == 0) - return WUFF_STREAM_ZERO_CHANNELS; - else if (handle->stream.header.sample_rate == 0) - return WUFF_STREAM_ZERO_SAMPLE_RATE; - else if (handle->stream.header.bits_per_sample == 0) - return WUFF_STREAM_ZERO_BITS_PER_SAMPLE; - - /* Grab the format from the extended header. */ - if (handle->stream.header.size > WUFF_HEADER_MIN_SIZE && wuff_get_uint16(buffer + 36) == 22) - { - if (handle->stream.header.format == WUFF_FORMAT_EXTENSIBLE) - handle->stream.header.format = wuff_get_uint16(buffer + 44); - } - - /* The check if this format is actually supported. */ - handle->stream.format = handle->stream.header.format; - wuff_status = wuff_check_bits(handle->stream.header.bits_per_sample, &handle->stream.format); - WUFF_STATUS_BAIL() - - /* The search for the data chunk begins. */ - wuff_copy_chunk_header_data(&chunk, buffer + 20 + handle->stream.header.size); - search_offset = handle->stream.header.offset + handle->stream.header.size; - wuff_status = wuff_search_chunk(handle, &chunk, &search_offset, WUFF_DATA_CHUNK_ID, 0); - if (wuff_status == WUFF_STREAM_CHUNK_NOT_FOUND) - return WUFF_STREAM_DATA_CHUNK_MISSING; - else WUFF_STATUS_BAIL() - - handle->stream.data.size = chunk.size; - handle->stream.data.offset = search_offset + 8; - handle->stream.length = handle->stream.data.size / handle->stream.header.channels / handle->stream.header.bytes_per_sample; - handle->stream.position = 0; - - return WUFF_SUCCESS; -} - -wuff_sint32 wuff_search_chunk(struct wuff_handle * handle, struct wuff_chunk_header * chunk, wuff_uint64 * offset, wuff_uint32 id, wuff_uint32 stop_id) -{ - wuff_uint8 buffer[8]; - wuff_uint64 search_offset; - size_t buffer_size; - wuff_sint32 wuff_status = 0; - - if (chunk->id != 0 && chunk->id == id) - return WUFF_SUCCESS; - - /* Copy the current file position. */ - search_offset = *offset; - - while (wuff_status >= 0) - { - search_offset += 8 + chunk->size; - /* FIXME: Non-compliant RIFFs may not pad to WORD alignment. What now? */ - if (search_offset & 1) - search_offset++; - - wuff_status = handle->callback->seek(handle->userdata, search_offset); - WUFF_STATUS_BAIL() - /*else if (wuff_status == WUFF_CALLBACK_EOF) - return WUFF_STREAM_CHUNK_NOT_FOUND;*/ - - buffer_size = 8; - wuff_status = handle->callback->read(handle->userdata, buffer, &buffer_size); - WUFF_STATUS_BAIL() - - wuff_copy_chunk_header_data(chunk, buffer); - /* Bail if we're at the EOF or the stop id. */ - if (buffer_size < 8 || (stop_id != 0 && chunk->id == stop_id)) - return WUFF_STREAM_CHUNK_NOT_FOUND; - else if (chunk->id == id) - break; - } - - /* Report chunk offset. */ - *offset = search_offset; - - return WUFF_SUCCESS; -} - -wuff_sint32 wuff_buffer_alloc(struct wuff_handle * handle) -{ - wuff_sint32 wuff_status; - - if (handle == NULL) - return WUFF_INVALID_PARAM; - - /* Try to allocate a buffer for 0.25 seconds, but clamp at some minimum and maximum value. */ - handle->buffer.size = handle->stream.header.sample_rate * handle->stream.header.block_size / 4; - if (handle->buffer.size < WUFF_BUFFER_MIN_SIZE) - handle->buffer.size = WUFF_BUFFER_MIN_SIZE; - else if (handle->buffer.size > WUFF_BUFFER_MAX_SIZE) - handle->buffer.size = WUFF_BUFFER_MAX_SIZE; - - handle->buffer.data = wuff_alloc(handle->buffer.size); - if (handle->buffer.data == NULL) - return WUFF_MEMALLOC_ERROR; - - /* Just in case, let's null the offsets. */ - wuff_status = wuff_buffer_clear(handle); - WUFF_STATUS_BAIL() - - return WUFF_SUCCESS; -} - -wuff_sint32 wuff_buffer_clear(struct wuff_handle * handle) -{ - wuff_uint64 position; - wuff_sint32 wuff_status; - - if (handle == NULL) - return WUFF_INVALID_PARAM; - - wuff_status = handle->callback->tell(handle->userdata, &position); - WUFF_STATUS_BAIL() - - if (position < handle->stream.data.offset || position > handle->stream.data.offset + handle->stream.data.size) - return WUFF_BUFFER_INVALID_STREAM_POSITION; - - handle->buffer.bytes_left = handle->stream.data.size - (position - handle->stream.data.offset); - handle->buffer.offset = 0; - handle->buffer.end = 0; - - return WUFF_SUCCESS; -} - -wuff_sint32 wuff_buffer_fill(struct wuff_handle * handle) -{ - size_t bytes_in_buffer; - size_t bytes_to_read; - wuff_sint32 wuff_status; - - if (handle == NULL) - return WUFF_INVALID_PARAM; - - /* Check if there are bytes in the buffer and move them to the start of the buffer. */ - /* Probably not the most efficient way. Think on it some more! */ - bytes_in_buffer = handle->buffer.end - handle->buffer.offset; - - if (bytes_in_buffer == handle->buffer.size) - return WUFF_SUCCESS; - else if (bytes_in_buffer > 0) - memmove(handle->buffer.data, handle->buffer.data + handle->buffer.offset, bytes_in_buffer); - - bytes_to_read = handle->buffer.size - bytes_in_buffer; - if (bytes_to_read > handle->buffer.bytes_left) - bytes_to_read = (size_t)handle->buffer.bytes_left; - - wuff_status = handle->callback->read(handle->userdata, handle->buffer.data + bytes_in_buffer, &bytes_to_read); - WUFF_STATUS_BAIL() - - handle->buffer.offset = 0; - handle->buffer.end = bytes_in_buffer + bytes_to_read; - handle->buffer.bytes_left -= bytes_to_read; - - return WUFF_SUCCESS; -} - -wuff_sint32 wuff_buffer_release(struct wuff_handle * handle, size_t samples) -{ - size_t size; - - if (handle == NULL) - return WUFF_INVALID_PARAM; - - size = samples * handle->stream.header.bytes_per_sample; - - /* Check for an attempt to release more samples than the buffer could hold. */ - /* "This should never happen." Let's throw an error anyway in case.*/ - if (size > handle->buffer.end - handle->buffer.offset) - return WUFF_BUFFER_INVALID_SIZE; - - handle->buffer.offset += size; - - return WUFF_SUCCESS; -} - -wuff_sint32 wuff_buffer_request(struct wuff_handle * handle, wuff_uint8 ** buffer, size_t * samples) -{ - size_t request_samples = *samples; - size_t buffer_samples, size; - size_t bps = handle->stream.header.bytes_per_sample; - wuff_sint32 wuff_status; - - if (handle == NULL || buffer == NULL || samples == NULL) - return WUFF_INVALID_PARAM; - - /* Fill the buffer some more if the requested size is bigger than the current data in the buffer. */ - size = request_samples * bps; - if (size > handle->buffer.end - handle->buffer.offset) - { - wuff_status = wuff_buffer_fill(handle); - WUFF_STATUS_BAIL() - } - - buffer_samples = (handle->buffer.end - handle->buffer.offset) / bps; - - /* Report sample count change. */ - if (buffer_samples < request_samples) - *samples = buffer_samples; - - /* Report sample buffer start. */ - *buffer = handle->buffer.data + handle->buffer.offset; - - return WUFF_SUCCESS; -} diff --git a/love/src/jni/love/src/libraries/Wuff/wuff_internal.h b/love/src/jni/love/src/libraries/Wuff/wuff_internal.h deleted file mode 100644 index 2679cdbc..00000000 --- a/love/src/jni/love/src/libraries/Wuff/wuff_internal.h +++ /dev/null @@ -1,171 +0,0 @@ -#ifndef WUFF_INTERNAL_H -#define WUFF_INTERNAL_H - -#define WUFF_BUFFER_MIN_SIZE 4096 -#define WUFF_BUFFER_MAX_SIZE 2097152 -#define WUFF_STREAM_MIN_SIZE 36 -#define WUFF_HEADER_MIN_SIZE 16 -#define WUFF_HEADER_FETCH_SIZE 80 - -#define WUFF_FORMAT_PCM 1 -#define WUFF_FORMAT_IEEE_FLOAT 3 -#define WUFF_FORMAT_EXTENSIBLE 0xFFFE - - -#define WUFF_RIFF_CHUNK_ID wuff_get_chunk_id("RIFF") -#define WUFF_WAVE_CHUNK_ID wuff_get_chunk_id("WAVE") -#define WUFF_FORMAT_CHUNK_ID wuff_get_chunk_id("fmt ") -#define WUFF_DATA_CHUNK_ID wuff_get_chunk_id("data") - -#define WUFF_STATUS_BAIL() if (wuff_status < 0) return wuff_status; - - -static WUFF_INLINE wuff_uint32 wuff_get_uint32(wuff_uint8 * data) -{ - return data[0] + (data[1] << 8) + (data[2] << 16) + (data[3] << 24); -} - -static WUFF_INLINE wuff_uint16 wuff_get_uint16(wuff_uint8 * data) -{ - return data[0] + (data[1] << 8); -} - -struct wuff_chunk_header -{ - wuff_uint32 id; - wuff_uint32 size; -}; - -static WUFF_INLINE wuff_uint32 wuff_get_chunk_id(const char txt[5]) -{ - const wuff_uint8 * id = (wuff_uint8*) txt; - wuff_uint32 int_id; - wuff_uint8 * id_bytes = (wuff_uint8 *)&int_id; - id_bytes[0] = id[0]; - id_bytes[1] = id[1]; - id_bytes[2] = id[2]; - id_bytes[3] = id[3]; - - return int_id; -} - -static WUFF_INLINE void wuff_copy_chunk_header_data(struct wuff_chunk_header * chunk, wuff_uint8 * data) -{ - wuff_uint8 * id = (wuff_uint8 *)&chunk->id; - id[0] = data[0]; - id[1] = data[1]; - id[2] = data[2]; - id[3] = data[3]; - - chunk->size = wuff_get_uint32(data + 4); -} - -struct wuff_stream_header -{ - wuff_uint64 size; - wuff_uint64 offset; - - wuff_uint16 format; - wuff_uint16 channels; - wuff_uint32 sample_rate; - wuff_uint16 bits_per_sample; - wuff_uint16 bytes_per_sample; - size_t block_size; -}; - -struct wuff_stream_data -{ - wuff_uint64 size; - wuff_uint64 offset; -}; - -struct wuff_buffer -{ - wuff_uint8 * data; - wuff_uint64 bytes_left; - size_t size; - size_t offset; - size_t end; -}; - -struct wuff_output -{ - wuff_uint16 format; - size_t bytes_per_sample; - size_t block_size; - size_t block_offset; - void (* function)(wuff_uint8 *, wuff_uint8 *, size_t, wuff_uint8, wuff_uint8, wuff_uint8); -}; - -struct wuff_stream -{ - wuff_uint64 size; - wuff_uint64 length; - wuff_uint16 format; - - wuff_uint64 position; - - struct wuff_stream_header header; - struct wuff_stream_data data; -}; - -struct wuff_handle -{ - struct wuff_stream stream; - struct wuff_buffer buffer; - struct wuff_output output; - struct wuff_callback * callback; - void * userdata; -}; - - -/* Initializes the stream, allocates the buffer, and sets the output format. */ -/* Expects a nulled wuff_handle and the callbacks set and ready. */ -WUFF_INTERN_API wuff_sint32 wuff_setup(struct wuff_handle * handle); - -/* Cleans the stream up, frees the buffer and the wuff_handle. */ -WUFF_INTERN_API wuff_sint32 wuff_cleanup(struct wuff_handle * handle); - -/* Called by wuff_setup. Initializes the stream by reading the data from the */ -/* callbacks, searching for headers and stream information. */ -WUFF_INTERN_API wuff_sint32 wuff_init_stream(struct wuff_handle * handle); - -/* Searches for a specific chunk id and stops before another if it's not 0. */ -/* If the id in wuff_chunk_header is not 0, it will be checked too and if */ -/* they match, then the function will return immediately. */ -/* Expects offset to point to the file position of a chunk and */ -/* wuff_chunk_header to have the size of this chunk. */ -WUFF_INTERN_API wuff_sint32 wuff_search_chunk(struct wuff_handle * handle, struct wuff_chunk_header * chunk, wuff_uint64 * offset, wuff_uint32 id, wuff_uint32 stop_id); - -/* Sets the output struct of the stream to the new format. */ -WUFF_INTERN_API wuff_sint32 wuff_set_output_format(struct wuff_handle * handle, wuff_uint16); - -/* Checks if the number of bits per samples is supported and writes the */ -/* output identifier to the 16-bit integer. */ -WUFF_INTERN_API wuff_sint32 wuff_check_bits(wuff_uint16 bits, wuff_uint16 * format); - -/* Calculates the number of samples that have to be requested from the buffer */ -/* by also taking the truncated samples at the start and end into account. */ -/* The return value is the number of samples needed. */ -WUFF_INTERN_API size_t wuff_calculate_samples(size_t target_size, wuff_uint8 sample_size, wuff_uint8 * head, wuff_uint8 * tail); - - -/* Allocates the buffer for the input stream. */ -/* Expects the stream to be initialized, as format information is needed. */ -WUFF_INTERN_API wuff_sint32 wuff_buffer_alloc(struct wuff_handle * handle); - -/* Fills the buffer with new data. */ -WUFF_INTERN_API wuff_sint32 wuff_buffer_fill(struct wuff_handle * handle); - -/* Marks all bytes in the buffer as free. */ -WUFF_INTERN_API wuff_sint32 wuff_buffer_clear(struct wuff_handle * handle); - -/* Requests samples and a pointer to them. */ -/* The number of samples may be lower than requested. */ -WUFF_INTERN_API wuff_sint32 wuff_buffer_request(struct wuff_handle * handle, wuff_uint8 ** buffer, size_t * samples); - -/* Releases the number of samples from the buffer. */ -WUFF_INTERN_API wuff_sint32 wuff_buffer_release(struct wuff_handle * handle, size_t samples); - - -#endif /* WUFF_INTERNAL_H */ diff --git a/love/src/jni/love/src/libraries/Wuff/wuff_memory.c b/love/src/jni/love/src/libraries/Wuff/wuff_memory.c deleted file mode 100644 index eaffa4e6..00000000 --- a/love/src/jni/love/src/libraries/Wuff/wuff_memory.c +++ /dev/null @@ -1,17 +0,0 @@ -#include - -#include "wuff_config.h" - -/* Default memory allocators. */ -/* They can be overridden with custom functions at build time. */ -#ifndef WUFF_MEMALLOC_OVERRIDE -void * wuff_alloc(size_t size) -{ - return malloc(size); -} - -void wuff_free(void * mem) -{ - free(mem); -} -#endif diff --git a/love/src/jni/love/src/libraries/ddsparse/ddsinfo.h b/love/src/jni/love/src/libraries/ddsparse/ddsinfo.h deleted file mode 100644 index f653b31e..00000000 --- a/love/src/jni/love/src/libraries/ddsparse/ddsinfo.h +++ /dev/null @@ -1,233 +0,0 @@ -/** - * Simple DDS data parser for compressed 2D textures. - * - * Copyright (c) 2013-2017 Alex Szpakowski - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - * - * - * Enums and structs copied from Microsoft. - * http://msdn.microsoft.com/en-us/library/bb943991.aspx - **/ - -#ifndef DDS_INFO_H -#define DDS_INFO_H - -#include - -namespace dds -{ -namespace dxinfo -{ - -enum DDPF -{ - DDPF_ALPHAPIXELS = 0x000001, - DDPF_ALPHA = 0x000002, - DDPF_FOURCC = 0x000004, - DDPF_RGB = 0x000040, - DDPF_YUV = 0x000200, - DDPF_LUMINANCE = 0x020000 -}; - -enum D3D10ResourceDimension -{ - D3D10_RESOURCE_DIMENSION_UNKNOWN = 0, - D3D10_RESOURCE_DIMENSION_BUFFER = 1, - D3D10_RESOURCE_DIMENSION_TEXTURE1D = 2, - D3D10_RESOURCE_DIMENSION_TEXTURE2D = 3, - D3D10_RESOURCE_DIMENSION_TEXTURE3D = 4 -}; - -enum DXGIFormat -{ - DXGI_FORMAT_UNKNOWN = 0, - - DXGI_FORMAT_R32G32B32A32_TYPELESS = 1, - DXGI_FORMAT_R32G32B32A32_FLOAT = 2, - DXGI_FORMAT_R32G32B32A32_UINT = 3, - DXGI_FORMAT_R32G32B32A32_SINT = 4, - - DXGI_FORMAT_R32G32B32_TYPELESS = 5, - DXGI_FORMAT_R32G32B32_FLOAT = 6, - DXGI_FORMAT_R32G32B32_UINT = 7, - DXGI_FORMAT_R32G32B32_SINT = 8, - - DXGI_FORMAT_R16G16B16A16_TYPELESS = 9, - DXGI_FORMAT_R16G16B16A16_FLOAT = 10, - DXGI_FORMAT_R16G16B16A16_UNORM = 11, - DXGI_FORMAT_R16G16B16A16_UINT = 12, - DXGI_FORMAT_R16G16B16A16_SNORM = 13, - DXGI_FORMAT_R16G16B16A16_SINT = 14, - - DXGI_FORMAT_R32G32_TYPELESS = 15, - DXGI_FORMAT_R32G32_FLOAT = 16, - DXGI_FORMAT_R32G32_UINT = 17, - DXGI_FORMAT_R32G32_SINT = 18, - - DXGI_FORMAT_R32G8X24_TYPELESS = 19, - DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20, - DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21, - DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22, - - DXGI_FORMAT_R10G10B10A2_TYPELESS = 23, - DXGI_FORMAT_R10G10B10A2_UNORM = 24, - DXGI_FORMAT_R10G10B10A2_UINT = 25, - - DXGI_FORMAT_R11G11B10_FLOAT = 26, - - DXGI_FORMAT_R8G8B8A8_TYPELESS = 27, - DXGI_FORMAT_R8G8B8A8_UNORM = 28, - DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29, - DXGI_FORMAT_R8G8B8A8_UINT = 30, - DXGI_FORMAT_R8G8B8A8_SNORM = 31, - DXGI_FORMAT_R8G8B8A8_SINT = 32, - - DXGI_FORMAT_R16G16_TYPELESS = 33, - DXGI_FORMAT_R16G16_FLOAT = 34, - DXGI_FORMAT_R16G16_UNORM = 35, - DXGI_FORMAT_R16G16_UINT = 36, - DXGI_FORMAT_R16G16_SNORM = 37, - DXGI_FORMAT_R16G16_SINT = 38, - - DXGI_FORMAT_R32_TYPELESS = 39, - DXGI_FORMAT_D32_FLOAT = 40, - DXGI_FORMAT_R32_FLOAT = 41, - DXGI_FORMAT_R32_UINT = 42, - DXGI_FORMAT_R32_SINT = 43, - - DXGI_FORMAT_R24G8_TYPELESS = 44, - DXGI_FORMAT_D24_UNORM_S8_UINT = 45, - DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46, - DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47, - - DXGI_FORMAT_R8G8_TYPELESS = 48, - DXGI_FORMAT_R8G8_UNORM = 49, - DXGI_FORMAT_R8G8_UINT = 50, - DXGI_FORMAT_R8G8_SNORM = 51, - DXGI_FORMAT_R8G8_SINT = 52, - - DXGI_FORMAT_R16_TYPELESS = 53, - DXGI_FORMAT_R16_FLOAT = 54, - DXGI_FORMAT_D16_UNORM = 55, - DXGI_FORMAT_R16_UNORM = 56, - DXGI_FORMAT_R16_UINT = 57, - DXGI_FORMAT_R16_SNORM = 58, - DXGI_FORMAT_R16_SINT = 59, - - DXGI_FORMAT_R8_TYPELESS = 60, - DXGI_FORMAT_R8_UNORM = 61, - DXGI_FORMAT_R8_UINT = 62, - DXGI_FORMAT_R8_SNORM = 63, - DXGI_FORMAT_R8_SINT = 64, - DXGI_FORMAT_A8_UNORM = 65, - - DXGI_FORMAT_R1_UNORM = 66, - - DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67, - - DXGI_FORMAT_R8G8_B8G8_UNORM = 68, - DXGI_FORMAT_G8R8_G8B8_UNORM = 69, - - DXGI_FORMAT_BC1_TYPELESS = 70, - DXGI_FORMAT_BC1_UNORM = 71, - DXGI_FORMAT_BC1_UNORM_SRGB = 72, - - DXGI_FORMAT_BC2_TYPELESS = 73, - DXGI_FORMAT_BC2_UNORM = 74, - DXGI_FORMAT_BC2_UNORM_SRGB = 75, - - DXGI_FORMAT_BC3_TYPELESS = 76, - DXGI_FORMAT_BC3_UNORM = 77, - DXGI_FORMAT_BC3_UNORM_SRGB = 78, - - DXGI_FORMAT_BC4_TYPELESS = 79, - DXGI_FORMAT_BC4_UNORM = 80, - DXGI_FORMAT_BC4_SNORM = 81, - - DXGI_FORMAT_BC5_TYPELESS = 82, - DXGI_FORMAT_BC5_UNORM = 83, - DXGI_FORMAT_BC5_SNORM = 84, - - DXGI_FORMAT_B5G6R5_UNORM = 85, - DXGI_FORMAT_B5G5R5A1_UNORM = 86, - DXGI_FORMAT_B8G8R8A8_UNORM = 87, - DXGI_FORMAT_B8G8R8X8_UNORM = 88, - - DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89, - DXGI_FORMAT_B8G8R8A8_TYPELESS = 90, - DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91, - DXGI_FORMAT_B8G8R8X8_TYPELESS = 92, - DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93, - - DXGI_FORMAT_BC6H_TYPELESS = 94, - DXGI_FORMAT_BC6H_UF16 = 95, - DXGI_FORMAT_BC6H_SF16 = 96, - - DXGI_FORMAT_BC7_TYPELESS = 97, - DXGI_FORMAT_BC7_UNORM = 98, - DXGI_FORMAT_BC7_UNORM_SRGB = 99, - - DXGI_FORMAT_FORCE_UINT = 0xffffffffUL -}; - -struct DDSPixelFormat -{ - uint32_t size; - uint32_t flags; - uint32_t fourCC; - uint32_t rgbBitCount; - uint32_t rBitMask; - uint32_t gBitMask; - uint32_t bBitMask; - uint32_t aBitMask; -}; - -struct DDSHeader -{ - uint32_t size; - uint32_t flags; - uint32_t height; - uint32_t width; - uint32_t pitchOrLinearSize; - uint32_t depth; - uint32_t mipMapCount; - uint32_t reserved[11]; - - DDSPixelFormat format; - - uint32_t caps1; - uint32_t caps2; - uint32_t caps3; - uint32_t caps4; - uint32_t reserved2; -}; - -struct DDSHeader10 -{ - DXGIFormat dxgiFormat; - D3D10ResourceDimension resourceDimension; - - uint32_t miscFlag; - uint32_t arraySize; - uint32_t reserved; -}; - -} // dxinfo -} // dds - -#endif // DDS_INFO_H diff --git a/love/src/jni/love/src/libraries/ddsparse/ddsparse.cpp b/love/src/jni/love/src/libraries/ddsparse/ddsparse.cpp deleted file mode 100644 index d583ff3a..00000000 --- a/love/src/jni/love/src/libraries/ddsparse/ddsparse.cpp +++ /dev/null @@ -1,355 +0,0 @@ -/** - * Simple DDS data parser for compressed 2D textures. - * - * Copyright (c) 2013-2017 Alex Szpakowski - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "ddsparse.h" -#include "ddsinfo.h" - -#include - -namespace dds -{ - -using namespace dds::dxinfo; - -// Creates a packed uint representation of a FourCC code. -#define MakeFourCC(a, b, c, d) ((uint32_t) (((d)<<24) | ((c)<<16) | ((b)<<8) | (a))) - -// Translate the old DDS format to our own. -static Format parseDDSFormat(const DDSPixelFormat &fmt) -{ - if ((fmt.flags & DDPF_FOURCC) == 0) - return FORMAT_UNKNOWN; - - Format f = FORMAT_UNKNOWN; - - switch (fmt.fourCC) - { - case MakeFourCC('D','X','T','1'): - f = FORMAT_DXT1; - break; - case MakeFourCC('D','X','T','3'): - f = FORMAT_DXT3; - break; - case MakeFourCC('D','X','T','5'): - f = FORMAT_DXT5; - break; - case MakeFourCC('A','T','I','1'): - case MakeFourCC('B','C','4','U'): - f = FORMAT_BC4; - break; - case MakeFourCC('B','C','4','S'): - f = FORMAT_BC4s; - break; - case MakeFourCC('A','T','I','2'): - case MakeFourCC('B','C','5','U'): - f = FORMAT_BC5; - break; - case MakeFourCC('B','C','5','S'): - f = FORMAT_BC5s; - break; - default: - break; - } - - return f; -} - -// Translate the new DX10 formats to our own. -static Format parseDX10Format(DXGIFormat fmt) -{ - Format f = FORMAT_UNKNOWN; - - switch (fmt) - { - case DXGI_FORMAT_BC1_TYPELESS: - case DXGI_FORMAT_BC1_UNORM: - case DXGI_FORMAT_BC1_UNORM_SRGB: - f = FORMAT_DXT1; - break; - case DXGI_FORMAT_BC2_TYPELESS: - case DXGI_FORMAT_BC2_UNORM: - case DXGI_FORMAT_BC2_UNORM_SRGB: - f = FORMAT_DXT3; - break; - case DXGI_FORMAT_BC3_TYPELESS: - case DXGI_FORMAT_BC3_UNORM: - case DXGI_FORMAT_BC3_UNORM_SRGB: - f = FORMAT_DXT5; - break; - case DXGI_FORMAT_BC4_TYPELESS: - case DXGI_FORMAT_BC4_UNORM: - f = FORMAT_BC4; - break; - case DXGI_FORMAT_BC4_SNORM: - f = FORMAT_BC4s; - break; - case DXGI_FORMAT_BC5_TYPELESS: - case DXGI_FORMAT_BC5_UNORM: - f = FORMAT_BC5; - break; - case DXGI_FORMAT_BC5_SNORM: - f = FORMAT_BC5s; - break; - case DXGI_FORMAT_BC6H_TYPELESS: - case DXGI_FORMAT_BC6H_UF16: - f = FORMAT_BC6H; - break; - case DXGI_FORMAT_BC6H_SF16: - f = FORMAT_BC6Hs; - break; - case DXGI_FORMAT_BC7_TYPELESS: - case DXGI_FORMAT_BC7_UNORM: - f = FORMAT_BC7; - break; - case DXGI_FORMAT_BC7_UNORM_SRGB: - f = FORMAT_BC7srgb; - break; - default: - break; - } - - return f; -} - -bool isDDS(const void *data, size_t dataSize) -{ - const uint8_t *readData = (const uint8_t *) data; - ptrdiff_t offset = 0; - - // Is the data large enough to hold the DDS header? - if(dataSize < sizeof(uint32_t) + sizeof(DDSHeader)) - return false; - - // All DDS files start with "DDS ". - if((*(uint32_t *) readData) != MakeFourCC('D','D','S',' ')) - return false; - - offset += sizeof(uint32_t); - - DDSHeader *header = (DDSHeader *) &readData[offset]; - - - // Verify header to validate DDS data. - if (header->size != sizeof(DDSHeader) || header->format.size != sizeof(DDSPixelFormat)) - return false; - - offset += sizeof(DDSHeader); - - // Check for DX10 extension. - if ((header->format.flags & DDPF_FOURCC) && (header->format.fourCC == MakeFourCC('D','X','1','0'))) - { - // Data must be big enough for both headers plus the magic value. - if (dataSize < (sizeof(uint32_t) + sizeof(DDSHeader) + sizeof(DDSHeader10))) - return false; - } - - return true; -} - -bool isCompressedDDS(const void *data, size_t dataSize) -{ - if (!isDDS(data, dataSize)) - return false; - - const uint8_t *readData = (const uint8_t *) data; - ptrdiff_t offset = sizeof(uint32_t); - - DDSHeader *header = (DDSHeader *) &readData[offset]; - offset += sizeof(DDSHeader); - - // Check for DX10 extension. - if ((header->format.flags & DDPF_FOURCC) && (header->format.fourCC == MakeFourCC('D','X','1','0'))) - { - DDSHeader10 *header10 = (DDSHeader10 *) &readData[offset]; - return parseDX10Format(header10->dxgiFormat) != FORMAT_UNKNOWN; - } - - return parseDDSFormat(header->format) != FORMAT_UNKNOWN; -} - -Parser::Parser(const void *data, size_t dataSize) - : format(FORMAT_UNKNOWN) -{ - parseData(data, dataSize); -} - -Parser::Parser(const Parser &other) - : texData(other.texData) - , format(other.format) -{ -} - -Parser::Parser() - : format(FORMAT_UNKNOWN) -{ -} - -Parser &Parser::operator = (const Parser &other) -{ - texData = other.texData; - format = other.format; - - return *this; -} - -Parser::~Parser() -{ -} - -Format Parser::getFormat() const -{ - return format; -} - -const Image *Parser::getImageData(size_t miplevel) const -{ - if (miplevel >= texData.size()) - return 0; - - return &texData[miplevel]; -} - -size_t Parser::getMipmapCount() const -{ - return texData.size(); -} - -size_t Parser::parseImageSize(Format fmt, int width, int height) const -{ - size_t numBlocksWide = 0; - size_t numBlocksHigh = 0; - size_t numBytesPerBlock = 0; - - switch (fmt) - { - case FORMAT_DXT1: - case FORMAT_BC4: - case FORMAT_BC4s: - numBytesPerBlock = 8; - break; - case FORMAT_DXT3: - case FORMAT_DXT5: - case FORMAT_BC5s: - case FORMAT_BC5: - case FORMAT_BC6H: - case FORMAT_BC7: - case FORMAT_BC7srgb: - numBytesPerBlock = 16; - break; - default: - break; - } - - if (width > 0) - numBlocksWide = std::max(1, (width + 3) / 4); - - if (height > 0) - numBlocksHigh = std::max(1, (height + 3) / 4); - - return numBlocksWide * numBytesPerBlock * numBlocksHigh; -} - -bool Parser::parseTexData(const uint8_t *data, size_t dataSize, Format fmt, int w, int h, int mips) -{ - size_t offset = 0; - std::vector newTexData; - - for (int i = 0; i < mips; i++) - { - Image img; - img.width = w; - img.height = h; - - img.dataSize = parseImageSize(fmt, img.width, img.height); - - // Make sure the data size is valid. - if (img.dataSize == 0 || (offset + img.dataSize) > dataSize) - return false; - - // Store the memory address of the data representing this mip level. - img.data = &data[offset]; - - newTexData.push_back(img); - - // Move to the next mip level. - offset += img.dataSize; - - w = std::max(w / 2, 1); - h = std::max(h / 2, 1); - } - - texData = newTexData; - - return true; -} - -bool Parser::parseData(const void *data, size_t dataSize) -{ - if (!isDDS(data, dataSize)) - return false; - - const uint8_t *readData = (const uint8_t *) data; - ptrdiff_t offset = sizeof(uint32_t); - - DDSHeader *header = (DDSHeader *) &readData[offset]; - offset += sizeof(DDSHeader); - - - // Check for DX10 extension. - if ((header->format.flags & DDPF_FOURCC) && (header->format.fourCC == MakeFourCC('D','X','1','0'))) - { - DDSHeader10 *header10 = (DDSHeader10 *) &readData[offset]; - offset += sizeof(DDSHeader10); - - // We can't deal with 1D/3D textures. - switch (header10->resourceDimension) - { - case D3D10_RESOURCE_DIMENSION_TEXTURE2D: - case D3D10_RESOURCE_DIMENSION_UNKNOWN: - break; - default: - return false; - } - - // We also can't deal with texture arrays and cubemaps. - if (header10->arraySize > 1) - return false; - - format = parseDX10Format(header10->dxgiFormat); - } - else - format = parseDDSFormat(header->format); - - - if (format == FORMAT_UNKNOWN) - return false; - - - int w = header->width; - int h = header->height; - - int mips = std::max((int) header->mipMapCount, 1); - - return parseTexData(&readData[offset], dataSize - offset, format, w, h, mips); -} - -} // dds diff --git a/love/src/jni/love/src/libraries/ddsparse/ddsparse.h b/love/src/jni/love/src/libraries/ddsparse/ddsparse.h deleted file mode 100644 index d6387574..00000000 --- a/love/src/jni/love/src/libraries/ddsparse/ddsparse.h +++ /dev/null @@ -1,135 +0,0 @@ -/** - * Simple DDS data parser for compressed 2D textures. - * - * Copyright (c) 2013-2017 Alex Szpakowski - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef DDS_PARSE_H -#define DDS_PARSE_H - -#include -#include - -#include - -namespace dds -{ - -// Supported DDS formats. -// Formats with an 's' suffix have signed data. -enum Format -{ - FORMAT_DXT1, - FORMAT_DXT3, - FORMAT_DXT5, - FORMAT_BC4, - FORMAT_BC4s, - FORMAT_BC5, - FORMAT_BC5s, - FORMAT_BC6H, - FORMAT_BC6Hs, - FORMAT_BC7, - FORMAT_BC7srgb, // sRGB color space. - FORMAT_UNKNOWN -}; - -// Represents a single mipmap level of a texture. -struct Image -{ - int width; - int height; - size_t dataSize; - const uint8_t *data; - - Image() : width(0), height(0), dataSize(0), data(0) - {} -}; - -/** - * Determines whether the input byte data represents a valid DDS file. - * Does not take into account whether the texture format is supported. - * - * @param data The byte data to parse. - * @param dataSize The size in bytes of the data. - **/ -bool isDDS(const void *data, size_t dataSize); - -/** - * Determines whether the input byte data represents a valid compressed DDS - * file. Takes into account texture format, but not type (3D textures, etc.) - * - * @param data The byte data to parse. - * @param dataSize The size in bytes of the data. - **/ -bool isCompressedDDS(const void *data, size_t dataSize); - -class Parser -{ -public: - - /** - * Constructor. - * Attempts to parse byte data as a compressed DDS file. - * - * @param data The byte data to parse. - * @param dataSize The size in bytes of the data. - **/ - Parser(const void *data, size_t dataSize); - Parser(const Parser &other); - Parser(); - - Parser &operator = (const Parser &other); - - ~Parser(); - - /** - * Gets the format of this texture. - **/ - Format getFormat() const; - - /** - * Gets the data of this texture at a mipmap level. Mipmap level 0 - * represents the base image. - * - * @param miplevel The mipmap level to get the data of. - * @return Pointer to the image data, or NULL if miplevel is not within the - * range of [0, numMipmaps). - **/ - const Image *getImageData(size_t miplevel = 0) const; - - /** - * Gets the number of mipmap levels in this texture. - * Includes the base mip level. - **/ - size_t getMipmapCount() const; - -private: - - size_t parseImageSize(Format fmt, int width, int height) const; - bool parseTexData(const uint8_t *data, size_t dataSize, Format fmt, int w, int h, int mips); - bool parseData(const void *data, size_t dataSize); - - std::vector texData; - Format format; - -}; // Parser - -} // dds - -#endif // DDS_PARSE_H diff --git a/love/src/jni/love/src/libraries/enet/enet.cpp b/love/src/jni/love/src/libraries/enet/enet.cpp deleted file mode 100644 index dbc2e7b5..00000000 --- a/love/src/jni/love/src/libraries/enet/enet.cpp +++ /dev/null @@ -1,813 +0,0 @@ -/** - * - * Copyright (C) 2014 by Leaf Corcoran - * - * 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 -#include - -extern "C" { -#define LUA_COMPAT_ALL -#include "lua.h" -#include "lualib.h" -#include "lauxlib.h" -#include -} - -#define check_host(l, idx)\ - *(ENetHost**)luaL_checkudata(l, idx, "enet_host") - -#define check_peer(l, idx)\ - *(ENetPeer**)luaL_checkudata(l, idx, "enet_peer") - -/** - * Parse address string, eg: - * *:5959 - * 127.0.0.1:* - * website.com:8080 - */ -static void parse_address(lua_State *l, const char *addr_str, ENetAddress *address) { - int host_i = 0, port_i = 0; - char host_str[128] = {0}; - char port_str[32] = {0}; - int scanning_port = 0; - - char *c = (char *)addr_str; - - while (*c != 0) { - if (host_i >= 128 || port_i >= 32 ) luaL_error(l, "Hostname too long"); - if (scanning_port) { - port_str[port_i++] = *c; - } else { - if (*c == ':') { - scanning_port = 1; - } else { - host_str[host_i++] = *c; - } - } - c++; - } - host_str[host_i] = '\0'; - port_str[port_i] = '\0'; - - if (host_i == 0) luaL_error(l, "Failed to parse address"); - if (port_i == 0) luaL_error(l, "Missing port in address"); - - if (strcmp("*", host_str) == 0) { - address->host = ENET_HOST_ANY; - } else { - if (enet_address_set_host(address, host_str) != 0) { - luaL_error(l, "Failed to resolve host name"); - } - } - - if (strcmp("*", port_str) == 0) { - address->port = ENET_PORT_ANY; - } else { - address->port = atoi(port_str); - } -} - -/** - * Find the index of a given peer for which we only have the pointer. - */ -static size_t find_peer_index(lua_State *l, ENetHost *enet_host, ENetPeer *peer) { - size_t peer_index; - for (peer_index = 0; peer_index < enet_host->peerCount; peer_index++) { - if (peer == &(enet_host->peers[peer_index])) - return peer_index; - } - - luaL_error (l, "enet: could not find peer id!"); - - return peer_index; -} - -static void push_peer(lua_State *l, ENetPeer *peer) { - // try to find in peer table - lua_getfield(l, LUA_REGISTRYINDEX, "enet_peers"); - lua_pushlightuserdata(l, peer); - lua_gettable(l, -2); - - if (lua_isnil(l, -1)) { - // printf("creating new peer\n"); - lua_pop(l, 1); - - *(ENetPeer**)lua_newuserdata(l, sizeof(void*)) = peer; - luaL_getmetatable(l, "enet_peer"); - lua_setmetatable(l, -2); - - lua_pushlightuserdata(l, peer); - lua_pushvalue(l, -2); - - lua_settable(l, -4); - } - lua_remove(l, -2); // remove enet_peers -} - -static void push_event(lua_State *l, ENetEvent *event) { - lua_newtable(l); // event table - - if (event->peer) { - push_peer(l, event->peer); - lua_setfield(l, -2, "peer"); - } - - switch (event->type) { - case ENET_EVENT_TYPE_CONNECT: - lua_pushinteger(l, event->data); - lua_setfield(l, -2, "data"); - - lua_pushstring(l, "connect"); - break; - case ENET_EVENT_TYPE_DISCONNECT: - lua_pushinteger(l, event->data); - lua_setfield(l, -2, "data"); - - lua_pushstring(l, "disconnect"); - break; - case ENET_EVENT_TYPE_RECEIVE: - lua_pushlstring(l, (const char *)event->packet->data, event->packet->dataLength); - lua_setfield(l, -2, "data"); - - lua_pushinteger(l, event->channelID); - lua_setfield(l, -2, "channel"); - - lua_pushstring(l, "receive"); - - enet_packet_destroy(event->packet); - break; - case ENET_EVENT_TYPE_NONE: - lua_pushstring(l, "none"); - break; - } - - lua_setfield(l, -2, "type"); -} - -/** - * Read a packet off the stack as a string - * idx is position of string - */ -static ENetPacket *read_packet(lua_State *l, int idx, enet_uint8 *channel_id) { - size_t size; - int argc = lua_gettop(l); - const void *data = luaL_checklstring(l, idx, &size); - ENetPacket *packet; - - enet_uint32 flags = ENET_PACKET_FLAG_RELIABLE; - *channel_id = 0; - - if (argc >= idx+2 && !lua_isnil(l, idx+2)) { - const char *flag_str = luaL_checkstring(l, idx+2); - if (strcmp("unsequenced", flag_str) == 0) { - flags = ENET_PACKET_FLAG_UNSEQUENCED; - } else if (strcmp("reliable", flag_str) == 0) { - flags = ENET_PACKET_FLAG_RELIABLE; - } else if (strcmp("unreliable", flag_str) == 0) { - flags = 0; - } else { - luaL_error(l, "Unknown packet flag: %s", flag_str); - } - } - - if (argc >= idx+1 && !lua_isnil(l, idx+1)) { - *channel_id = (int) luaL_checknumber(l, idx+1); - } - - packet = enet_packet_create(data, size, flags); - if (packet == NULL) { - luaL_error(l, "Failed to create packet"); - } - - return packet; -} - -/** - * Create a new host - * Args: - * address (nil for client) - * [peer_count = 64] - * [channel_count = 1] - * [in_bandwidth = 0] - * [out_bandwidth = 0] - */ -static int host_create(lua_State *l) { - ENetHost *host; - size_t peer_count = 64, channel_count = 1; - enet_uint32 in_bandwidth = 0, out_bandwidth = 0; - - int have_address = 1; - ENetAddress address; - - if (lua_gettop(l) == 0 || lua_isnil(l, 1)) { - have_address = 0; - } else { - parse_address(l, luaL_checkstring(l, 1), &address); - } - - switch (lua_gettop(l)) { - case 5: - if (!lua_isnil(l, 5)) out_bandwidth = (int) luaL_checknumber(l, 5); - case 4: - if (!lua_isnil(l, 4)) in_bandwidth = (int) luaL_checknumber(l, 4); - case 3: - if (!lua_isnil(l, 3)) channel_count = (int) luaL_checknumber(l, 3); - case 2: - if (!lua_isnil(l, 2)) peer_count = (int) luaL_checknumber(l, 2); - } - - // printf("host create, peers=%d, channels=%d, in=%d, out=%d\n", - // peer_count, channel_count, in_bandwidth, out_bandwidth); - host = enet_host_create(have_address ? &address : NULL, peer_count, - channel_count, in_bandwidth, out_bandwidth); - - if (host == NULL) { - lua_pushnil (l); - lua_pushstring(l, "enet: failed to create host (already listening?)"); - return 2; - } - - *(ENetHost**)lua_newuserdata(l, sizeof(void*)) = host; - luaL_getmetatable(l, "enet_host"); - lua_setmetatable(l, -2); - - return 1; -} - -static int linked_version(lua_State *l) { - lua_pushfstring(l, "%d.%d.%d", - ENET_VERSION_GET_MAJOR(enet_linked_version()), - ENET_VERSION_GET_MINOR(enet_linked_version()), - ENET_VERSION_GET_PATCH(enet_linked_version())); - return 1; -} - -/** - * Serice a host - * Args: - * timeout - * - * Return - * nil on no event - * an event table on event - */ -static int host_service(lua_State *l) { - ENetHost *host = check_host(l, 1); - if (!host) { - return luaL_error(l, "Tried to index a nil host!"); - } - ENetEvent event; - int timeout = 0, out; - - if (lua_gettop(l) > 1) - timeout = (int) luaL_checknumber(l, 2); - - out = enet_host_service(host, &event, timeout); - if (out == 0) return 0; - if (out < 0) return luaL_error(l, "Error during service"); - - push_event(l, &event); - return 1; -} - -/** - * Dispatch a single event if available - */ -static int host_check_events(lua_State *l) { - ENetHost *host = check_host(l, 1); - if (!host) { - return luaL_error(l, "Tried to index a nil host!"); - } - ENetEvent event; - int out = enet_host_check_events(host, &event); - if (out == 0) return 0; - if (out < 0) return luaL_error(l, "Error checking event"); - - push_event(l, &event); - return 1; -} - -/** - * Enables an adaptive order-2 PPM range coder for the transmitted data of - * all peers. - */ -static int host_compress_with_range_coder(lua_State *l) { - ENetHost *host = check_host(l, 1); - if (!host) { - return luaL_error(l, "Tried to index a nil host!"); - } - - int result = enet_host_compress_with_range_coder (host); - if (result == 0) { - lua_pushboolean (l, 1); - } else { - lua_pushboolean (l, 0); - } - - return 1; -} - -/** - * Connect a host to an address - * Args: - * the address - * [channel_count = 1] - * [data = 0] - */ -static int host_connect(lua_State *l) { - ENetHost *host = check_host(l, 1); - if (!host) { - return luaL_error(l, "Tried to index a nil host!"); - } - ENetAddress address; - ENetPeer *peer; - - enet_uint32 data = 0; - size_t channel_count = 1; - - parse_address(l, luaL_checkstring(l, 2), &address); - - switch (lua_gettop(l)) { - case 4: - if (!lua_isnil(l, 4)) data = (int) luaL_checknumber(l, 4); - case 3: - if (!lua_isnil(l, 3)) channel_count = (int) luaL_checknumber(l, 3); - } - - // printf("host connect, channels=%d, data=%d\n", channel_count, data); - peer = enet_host_connect(host, &address, channel_count, data); - - if (peer == NULL) { - return luaL_error(l, "Failed to create peer"); - } - - push_peer(l, peer); - - return 1; -} - -static int host_flush(lua_State *l) { - ENetHost *host = check_host(l, 1); - if (!host) { - return luaL_error(l, "Tried to index a nil host!"); - } - enet_host_flush(host); - return 0; -} - -static int host_broadcast(lua_State *l) { - ENetHost *host = check_host(l, 1); - if (!host) { - return luaL_error(l, "Tried to index a nil host!"); - } - - enet_uint8 channel_id; - ENetPacket *packet = read_packet(l, 2, &channel_id); - enet_host_broadcast(host, channel_id, packet); - return 0; -} - -// Args: limit:number -static int host_channel_limit(lua_State *l) { - ENetHost *host = check_host(l, 1); - if (!host) { - return luaL_error(l, "Tried to index a nil host!"); - } - int limit = (int) luaL_checknumber(l, 2); - enet_host_channel_limit(host, limit); - return 0; -} - -static int host_bandwidth_limit(lua_State *l) { - ENetHost *host = check_host(l, 1); - if (!host) { - return luaL_error(l, "Tried to index a nil host!"); - } - enet_uint32 in_bandwidth = (int) luaL_checknumber(l, 2); - enet_uint32 out_bandwidth = (int) luaL_checknumber(l, 2); - enet_host_bandwidth_limit(host, in_bandwidth, out_bandwidth); - return 0; -} - -static int host_get_socket_address(lua_State *l) { - ENetHost *host = check_host(l, 1); - if (!host) { - return luaL_error(l, "Tried to index a nil host!"); - } - ENetAddress address; - enet_socket_get_address (host->socket, &address); - - lua_pushfstring(l, "%d.%d.%d.%d:%d", - ((address.host) & 0xFF), - ((address.host >> 8) & 0xFF), - ((address.host >> 16) & 0xFF), - (address.host >> 24& 0xFF), - address.port); - return 1; -} -static int host_total_sent_data(lua_State *l) { - ENetHost *host = check_host(l, 1); - if (!host) { - return luaL_error(l, "Tried to index a nil host!"); - } - - lua_pushinteger (l, host->totalSentData); - - return 1; -} - -static int host_total_received_data(lua_State *l) { - ENetHost *host = check_host(l, 1); - if (!host) { - return luaL_error(l, "Tried to index a nil host!"); - } - - lua_pushinteger (l, host->totalReceivedData); - - return 1; -} -static int host_service_time(lua_State *l) { - ENetHost *host = check_host(l, 1); - if (!host) { - return luaL_error(l, "Tried to index a nil host!"); - } - - lua_pushinteger (l, host->serviceTime); - - return 1; -} - -static int host_peer_count(lua_State *l) { - ENetHost *host = check_host(l, 1); - if (!host) { - return luaL_error(l, "Tried to index a nil host!"); - } - - lua_pushinteger (l, host->peerCount); - - return 1; -} - -static int host_get_peer(lua_State *l) { - ENetHost *host = check_host(l, 1); - if (!host) { - return luaL_error(l, "Tried to index a nil host!"); - } - - int peer_index = (int) luaL_checknumber(l, 2) - 1; - - if (peer_index < 0 || ((size_t) peer_index) >= host->peerCount) { - luaL_argerror (l, 2, "Invalid peer index"); - } - - ENetPeer *peer = &(host->peers[peer_index]); - - push_peer (l, peer); - return 1; -} - -static int host_gc(lua_State *l) { - // We have to manually grab the userdata so that we can set it to NULL. - ENetHost** host = (ENetHost**)luaL_checkudata(l, 1, "enet_host"); - // We don't want to crash by destroying a non-existant host. - if (*host) { - enet_host_destroy(*host); - } - *host = NULL; - return 0; -} - -static int peer_tostring(lua_State *l) { - ENetPeer *peer = check_peer(l, 1); - char host_str[128]; - enet_address_get_host_ip(&peer->address, host_str, 128); - - lua_pushstring(l, host_str); - lua_pushstring(l, ":"); - lua_pushinteger(l, peer->address.port); - lua_concat(l, 3); - return 1; -} - -static int peer_ping(lua_State *l) { - ENetPeer *peer = check_peer(l, 1); - enet_peer_ping(peer); - return 0; -} - -static int peer_throttle_configure(lua_State *l) { - ENetPeer *peer = check_peer(l, 1); - - enet_uint32 interval = (int) luaL_checknumber(l, 2); - enet_uint32 acceleration = (int) luaL_checknumber(l, 3); - enet_uint32 deceleration = (int) luaL_checknumber(l, 4); - - enet_peer_throttle_configure(peer, interval, acceleration, deceleration); - return 0; -} - -static int peer_round_trip_time(lua_State *l) { - ENetPeer *peer = check_peer(l, 1); - - if (lua_gettop(l) > 1) { - enet_uint32 round_trip_time = (int) luaL_checknumber(l, 2); - peer->roundTripTime = round_trip_time; - } - - lua_pushinteger (l, peer->roundTripTime); - - return 1; -} - -static int peer_last_round_trip_time(lua_State *l) { - ENetPeer *peer = check_peer(l, 1); - - if (lua_gettop(l) > 1) { - enet_uint32 round_trip_time = (int) luaL_checknumber(l, 2); - peer->lastRoundTripTime = round_trip_time; - } - lua_pushinteger (l, peer->lastRoundTripTime); - - return 1; -} - -static int peer_ping_interval(lua_State *l) { - ENetPeer *peer = check_peer(l, 1); - - if (lua_gettop(l) > 1) { - enet_uint32 interval = (int) luaL_checknumber(l, 2); - enet_peer_ping_interval (peer, interval); - } - - lua_pushinteger (l, peer->pingInterval); - - return 1; -} - -static int peer_timeout(lua_State *l) { - ENetPeer *peer = check_peer(l, 1); - - enet_uint32 timeout_limit = 0; - enet_uint32 timeout_minimum = 0; - enet_uint32 timeout_maximum = 0; - - switch (lua_gettop(l)) { - case 4: - if (!lua_isnil(l, 4)) timeout_maximum = (int) luaL_checknumber(l, 4); - case 3: - if (!lua_isnil(l, 3)) timeout_minimum = (int) luaL_checknumber(l, 3); - case 2: - if (!lua_isnil(l, 2)) timeout_limit = (int) luaL_checknumber(l, 2); - } - - enet_peer_timeout (peer, timeout_limit, timeout_minimum, timeout_maximum); - - lua_pushinteger (l, peer->timeoutLimit); - lua_pushinteger (l, peer->timeoutMinimum); - lua_pushinteger (l, peer->timeoutMaximum); - - return 3; -} - -static int peer_disconnect(lua_State *l) { - ENetPeer *peer = check_peer(l, 1); - - enet_uint32 data = lua_gettop(l) > 1 ? (int) luaL_checknumber(l, 2) : 0; - enet_peer_disconnect(peer, data); - return 0; -} - -static int peer_disconnect_now(lua_State *l) { - ENetPeer *peer = check_peer(l, 1); - - enet_uint32 data = lua_gettop(l) > 1 ? (int) luaL_checknumber(l, 2) : 0; - enet_peer_disconnect_now(peer, data); - return 0; -} - -static int peer_disconnect_later(lua_State *l) { - ENetPeer *peer = check_peer(l, 1); - - enet_uint32 data = lua_gettop(l) > 1 ? (int) luaL_checknumber(l, 2) : 0; - enet_peer_disconnect_later(peer, data); - return 0; -} - -static int peer_index(lua_State *l) { - ENetPeer *peer = check_peer(l, 1); - - size_t peer_index = find_peer_index (l, peer->host, peer); - lua_pushinteger (l, peer_index + 1); - - return 1; -} - -static int peer_state(lua_State *l) { - ENetPeer *peer = check_peer(l, 1); - - switch (peer->state) { - case (ENET_PEER_STATE_DISCONNECTED): - lua_pushstring (l, "disconnected"); - break; - case (ENET_PEER_STATE_CONNECTING): - lua_pushstring (l, "connecting"); - break; - case (ENET_PEER_STATE_ACKNOWLEDGING_CONNECT): - lua_pushstring (l, "acknowledging_connect"); - break; - case (ENET_PEER_STATE_CONNECTION_PENDING): - lua_pushstring (l, "connection_pending"); - break; - case (ENET_PEER_STATE_CONNECTION_SUCCEEDED): - lua_pushstring (l, "connection_succeeded"); - break; - case (ENET_PEER_STATE_CONNECTED): - lua_pushstring (l, "connected"); - break; - case (ENET_PEER_STATE_DISCONNECT_LATER): - lua_pushstring (l, "disconnect_later"); - break; - case (ENET_PEER_STATE_DISCONNECTING): - lua_pushstring (l, "disconnecting"); - break; - case (ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT): - lua_pushstring (l, "acknowledging_disconnect"); - break; - case (ENET_PEER_STATE_ZOMBIE): - lua_pushstring (l, "zombie"); - break; - default: - lua_pushstring (l, "unknown"); - } - - return 1; -} - -static int peer_connect_id(lua_State *l) { - ENetPeer *peer = check_peer(l, 1); - - lua_pushinteger (l, peer->connectID); - - return 1; -} - - -static int peer_reset(lua_State *l) { - ENetPeer *peer = check_peer(l, 1); - enet_peer_reset(peer); - return 0; -} - -static int peer_receive(lua_State *l) { - ENetPeer *peer = check_peer(l, 1); - ENetPacket *packet; - enet_uint8 channel_id = 0; - - if (lua_gettop(l) > 1) { - channel_id = (int) luaL_checknumber(l, 2); - } - - packet = enet_peer_receive(peer, &channel_id); - if (packet == NULL) return 0; - - lua_pushlstring(l, (const char *)packet->data, packet->dataLength); - lua_pushinteger(l, channel_id); - - enet_packet_destroy(packet); - return 2; -} - - -/** - * Send a lua string to a peer - * Args: - * packet data, string - * channel id - * flags ["reliable", nil] - * - */ -static int peer_send(lua_State *l) { - ENetPeer *peer = check_peer(l, 1); - - enet_uint8 channel_id; - ENetPacket *packet = read_packet(l, 2, &channel_id); - - // printf("sending, channel_id=%d\n", channel_id); - int ret = enet_peer_send(peer, channel_id, packet); - if (ret < 0) { - enet_packet_destroy(packet); - } - - lua_pushinteger(l, ret); - - return 1; -} - -static const struct luaL_Reg enet_funcs [] = { - {"host_create", host_create}, - {"linked_version", linked_version}, - {NULL, NULL} -}; - -static const struct luaL_Reg enet_host_funcs [] = { - {"service", host_service}, - {"check_events", host_check_events}, - {"compress_with_range_coder", host_compress_with_range_coder}, - {"connect", host_connect}, - {"flush", host_flush}, - {"broadcast", host_broadcast}, - {"channel_limit", host_channel_limit}, - {"bandwidth_limit", host_bandwidth_limit}, - // Since ENetSocket isn't part of enet-lua, we should try to keep - // naming conventions the same as the rest of the lib. - {"get_socket_address", host_get_socket_address}, - // We need this function to free up our ports when needed! - {"destroy", host_gc}, - - // additional convenience functions (mostly accessors) - {"total_sent_data", host_total_sent_data}, - {"total_received_data", host_total_received_data}, - {"service_time", host_service_time}, - {"peer_count", host_peer_count}, - {"get_peer", host_get_peer}, - {NULL, NULL} -}; - -static const struct luaL_Reg enet_peer_funcs [] = { - {"disconnect", peer_disconnect}, - {"disconnect_now", peer_disconnect_now}, - {"disconnect_later", peer_disconnect_later}, - {"reset", peer_reset}, - {"ping", peer_ping}, - {"receive", peer_receive}, - {"send", peer_send}, - {"throttle_configure", peer_throttle_configure}, - {"ping_interval", peer_ping_interval}, - {"timeout", peer_timeout}, - - // additional convenience functions to member variables - {"index", peer_index}, - {"state", peer_state}, - {"connect_id", peer_connect_id}, - {"round_trip_time", peer_round_trip_time}, - {"last_round_trip_time", peer_last_round_trip_time}, - {NULL, NULL} -}; - -extern "C" { - void luax_register(lua_State *L, const char *name, const luaL_Reg *l); -} - -int luaopen_enet(lua_State *l) { - enet_initialize(); - atexit(enet_deinitialize); - - // create metatables - luaL_newmetatable(l, "enet_host"); - lua_newtable(l); // index - luax_register(l, NULL, enet_host_funcs); - lua_setfield(l, -2, "__index"); - lua_pushcfunction(l, host_gc); - lua_setfield(l, -2, "__gc"); - - luaL_newmetatable(l, "enet_peer"); - lua_newtable(l); - luax_register(l, NULL, enet_peer_funcs); - lua_setfield(l, -2, "__index"); - lua_pushcfunction(l, peer_tostring); - lua_setfield(l, -2, "__tostring"); - - // set up peer table - lua_newtable(l); - - lua_newtable(l); // metatable - lua_pushstring(l, "v"); - lua_setfield(l, -2, "__mode"); - lua_setmetatable(l, -2); - - lua_setfield(l, LUA_REGISTRYINDEX, "enet_peers"); - - luax_register(l, nullptr, enet_funcs); - - // return the enet table created with luaL_register - return 1; -} diff --git a/love/src/jni/love/src/libraries/enet/libenet/ChangeLog b/love/src/jni/love/src/libraries/enet/libenet/ChangeLog deleted file mode 100644 index 663c7b73..00000000 --- a/love/src/jni/love/src/libraries/enet/libenet/ChangeLog +++ /dev/null @@ -1,179 +0,0 @@ -* use getaddrinfo and getnameinfo where available - -ENet 1.3.13 (April 30, 2015): - -* miscellaneous bug fixes -* added premake and cmake support -* miscellaneous documentation cleanups - -ENet 1.3.12 (April 24, 2014): - -* added maximumPacketSize and maximumWaitingData fields to ENetHost to limit the amount of -data waiting to be delivered on a peer (beware that the default maximumPacketSize is -32MB and should be set higher if desired as should maximumWaitingData) - -ENet 1.3.11 (December 26, 2013): - -* allow an ENetHost to connect to itself -* fixed possible bug with disconnect notifications during connect attempts -* fixed some preprocessor definition bugs - -ENet 1.3.10 (October 23, 2013); - -* doubled maximum reliable window size -* fixed RCVTIMEO/SNDTIMEO socket options and also added NODELAY - -ENet 1.3.9 (August 19, 2013): - -* added duplicatePeers option to ENetHost which can limit the number of peers from duplicate IPs -* added enet_socket_get_option() and ENET_SOCKOPT_ERROR -* added enet_host_random_seed() platform stub - -ENet 1.3.8 (June 2, 2013): - -* added enet_linked_version() for checking the linked version -* added enet_socket_get_address() for querying the local address of a socket -* silenced some debugging prints unless ENET_DEBUG is defined during compilation -* handle EINTR in enet_socket_wait() so that enet_host_service() doesn't propagate errors from signals -* optimized enet_host_bandwidth_throttle() to be less expensive for large numbers of peers - -ENet 1.3.7 (March 6, 2013): - -* added ENET_PACKET_FLAG_SENT to indicate that a packet is being freed because it has been sent -* added userData field to ENetPacket -* changed how random seed is generated on Windows to avoid import warnings -* fixed case where disconnects could be generated with no preceding connect event - -ENet 1.3.6 (December 11, 2012): - -* added support for intercept callback in ENetHost that can be used to process raw packets before ENet -* added enet_socket_shutdown() for issuing shutdown on a socket -* fixed enet_socket_connect() to not error on non-blocking connects -* fixed bug in MTU negotiation during connections - -ENet 1.3.5 (July 31, 2012): - -* fixed bug in unreliable packet fragment queuing - -ENet 1.3.4 (May 29, 2012): - -* added enet_peer_ping_interval() for configuring per-peer ping intervals -* added enet_peer_timeout() for configuring per-peer timeouts -* added protocol packet size limits - -ENet 1.3.3 (June 28, 2011): - -* fixed bug with simultaneous disconnects not dispatching events - -ENet 1.3.2 (May 31, 2011): - -* added support for unreliable packet fragmenting via the packet flag -ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT -* fixed regression in unreliable packet queuing -* added check against received port to limit some forms of IP-spoofing - -ENet 1.3.1 (February 10, 2011): - -* fixed bug in tracking of reliable data in transit -* reliable data window size now scales with the throttle -* fixed bug in fragment length calculation when checksums are used - -ENet 1.3.0 (June 5, 2010): - -* enet_host_create() now requires the channel limit to be specified as -a parameter -* enet_host_connect() now accepts a data parameter which is supplied -to the receiving receiving host in the event data field for a connect event -* added an adaptive order-2 PPM range coder as a built-in compressor option -which can be set with enet_host_compress_with_range_coder() -* added support for packet compression configurable with a callback -* improved session number handling to not rely on the packet checksum -field, saving 4 bytes per packet unless the checksum option is used -* removed the dependence on the rand callback for session number handling - -Caveats: This version is not protocol compatible with the 1.2 series or -earlier. The enet_host_connect and enet_host_create API functions require -supplying additional parameters. - -ENet 1.2.5 (June 28, 2011): - -* fixed bug with simultaneous disconnects not dispatching events - -ENet 1.2.4 (May 31, 2011): - -* fixed regression in unreliable packet queuing -* added check against received port to limit some forms of IP-spoofing - -ENet 1.2.3 (February 10, 2011): - -* fixed bug in tracking reliable data in transit - -ENet 1.2.2 (June 5, 2010): - -* checksum functionality is now enabled by setting a checksum callback -inside ENetHost instead of being a configure script option -* added totalSentData, totalSentPackets, totalReceivedData, and -totalReceivedPackets counters inside ENetHost for getting usage -statistics -* added enet_host_channel_limit() for limiting the maximum number of -channels allowed by connected peers -* now uses dispatch queues for event dispatch rather than potentially -unscalable array walking -* added no_memory callback that is called when a malloc attempt fails, -such that if no_memory returns rather than aborts (the default behavior), -then the error is propagated to the return value of the API calls -* now uses packed attribute for protocol structures on platforms with -strange alignment rules -* improved autoconf build system contributed by Nathan Brink allowing -for easier building as a shared library - -Caveats: If you were using the compile-time option that enabled checksums, -make sure to set the checksum callback inside ENetHost to enet_crc32 to -regain the old behavior. The ENetCallbacks structure has added new fields, -so make sure to clear the structure to zero before use if -using enet_initialize_with_callbacks(). - -ENet 1.2.1 (November 12, 2009): - -* fixed bug that could cause disconnect events to be dropped -* added thin wrapper around select() for portable usage -* added ENET_SOCKOPT_REUSEADDR socket option -* factored enet_socket_bind()/enet_socket_listen() out of enet_socket_create() -* added contributed Code::Blocks build file - -ENet 1.2 (February 12, 2008): - -* fixed bug in VERIFY_CONNECT acknowledgement that could cause connect -attempts to occasionally timeout -* fixed acknowledgements to check both the outgoing and sent queues -when removing acknowledged packets -* fixed accidental bit rot in the MSVC project file -* revised sequence number overflow handling to address some possible -disconnect bugs -* added enet_host_check_events() for getting only local queued events -* factored out socket option setting into enet_socket_set_option() so -that socket options are now set separately from enet_socket_create() - -Caveats: While this release is superficially protocol compatible with 1.1, -differences in the sequence number overflow handling can potentially cause -random disconnects. - -ENet 1.1 (June 6, 2007): - -* optional CRC32 just in case someone needs a stronger checksum than UDP -provides (--enable-crc32 configure option) -* the size of packet headers are half the size they used to be (so less -overhead when sending small packets) -* enet_peer_disconnect_later() that waits till all queued outgoing -packets get sent before issuing an actual disconnect -* freeCallback field in individual packets for notification of when a -packet is about to be freed -* ENET_PACKET_FLAG_NO_ALLOCATE for supplying pre-allocated data to a -packet (can be used in concert with freeCallback to support some custom -allocation schemes that the normal memory allocation callbacks would -normally not allow) -* enet_address_get_host_ip() for printing address numbers -* promoted the enet_socket_*() functions to be part of the API now -* a few stability/crash fixes - - diff --git a/love/src/jni/love/src/libraries/enet/libenet/LICENSE b/love/src/jni/love/src/libraries/enet/libenet/LICENSE deleted file mode 100644 index 39af84a8..00000000 --- a/love/src/jni/love/src/libraries/enet/libenet/LICENSE +++ /dev/null @@ -1,7 +0,0 @@ -Copyright (c) 2002-2016 Lee Salzman - -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/love/src/jni/love/src/libraries/enet/libenet/README b/love/src/jni/love/src/libraries/enet/libenet/README deleted file mode 100644 index 54b2d213..00000000 --- a/love/src/jni/love/src/libraries/enet/libenet/README +++ /dev/null @@ -1,15 +0,0 @@ -Please visit the ENet homepage at http://enet.bespin.org for installation -and usage instructions. - -If you obtained this package from github, the quick description on how to build -is: - -# Generate the build system. - -autoreconf -vfi - -# Compile and install the library. - -./configure && make && make install - - diff --git a/love/src/jni/love/src/libraries/enet/libenet/callbacks.c b/love/src/jni/love/src/libraries/enet/libenet/callbacks.c deleted file mode 100644 index b3990af1..00000000 --- a/love/src/jni/love/src/libraries/enet/libenet/callbacks.c +++ /dev/null @@ -1,53 +0,0 @@ -/** - @file callbacks.c - @brief ENet callback functions -*/ -#define ENET_BUILDING_LIB 1 -#include "enet/enet.h" - -static ENetCallbacks callbacks = { malloc, free, abort }; - -int -enet_initialize_with_callbacks (ENetVersion version, const ENetCallbacks * inits) -{ - if (version < ENET_VERSION_CREATE (1, 3, 0)) - return -1; - - if (inits -> malloc != NULL || inits -> free != NULL) - { - if (inits -> malloc == NULL || inits -> free == NULL) - return -1; - - callbacks.malloc = inits -> malloc; - callbacks.free = inits -> free; - } - - if (inits -> no_memory != NULL) - callbacks.no_memory = inits -> no_memory; - - return enet_initialize (); -} - -ENetVersion -enet_linked_version (void) -{ - return ENET_VERSION; -} - -void * -enet_malloc (size_t size) -{ - void * memory = callbacks.malloc (size); - - if (memory == NULL) - callbacks.no_memory (); - - return memory; -} - -void -enet_free (void * memory) -{ - callbacks.free (memory); -} - diff --git a/love/src/jni/love/src/libraries/enet/libenet/compress.c b/love/src/jni/love/src/libraries/enet/libenet/compress.c deleted file mode 100644 index 784489a7..00000000 --- a/love/src/jni/love/src/libraries/enet/libenet/compress.c +++ /dev/null @@ -1,654 +0,0 @@ -/** - @file compress.c - @brief An adaptive order-2 PPM range coder -*/ -#define ENET_BUILDING_LIB 1 -#include -#include "enet/enet.h" - -typedef struct _ENetSymbol -{ - /* binary indexed tree of symbols */ - enet_uint8 value; - enet_uint8 count; - enet_uint16 under; - enet_uint16 left, right; - - /* context defined by this symbol */ - enet_uint16 symbols; - enet_uint16 escapes; - enet_uint16 total; - enet_uint16 parent; -} ENetSymbol; - -/* adaptation constants tuned aggressively for small packet sizes rather than large file compression */ -enum -{ - ENET_RANGE_CODER_TOP = 1<<24, - ENET_RANGE_CODER_BOTTOM = 1<<16, - - ENET_CONTEXT_SYMBOL_DELTA = 3, - ENET_CONTEXT_SYMBOL_MINIMUM = 1, - ENET_CONTEXT_ESCAPE_MINIMUM = 1, - - ENET_SUBCONTEXT_ORDER = 2, - ENET_SUBCONTEXT_SYMBOL_DELTA = 2, - ENET_SUBCONTEXT_ESCAPE_DELTA = 5 -}; - -/* context exclusion roughly halves compression speed, so disable for now */ -#undef ENET_CONTEXT_EXCLUSION - -typedef struct _ENetRangeCoder -{ - /* only allocate enough symbols for reasonable MTUs, would need to be larger for large file compression */ - ENetSymbol symbols[4096]; -} ENetRangeCoder; - -void * -enet_range_coder_create (void) -{ - ENetRangeCoder * rangeCoder = (ENetRangeCoder *) enet_malloc (sizeof (ENetRangeCoder)); - if (rangeCoder == NULL) - return NULL; - - return rangeCoder; -} - -void -enet_range_coder_destroy (void * context) -{ - ENetRangeCoder * rangeCoder = (ENetRangeCoder *) context; - if (rangeCoder == NULL) - return; - - enet_free (rangeCoder); -} - -#define ENET_SYMBOL_CREATE(symbol, value_, count_) \ -{ \ - symbol = & rangeCoder -> symbols [nextSymbol ++]; \ - symbol -> value = value_; \ - symbol -> count = count_; \ - symbol -> under = count_; \ - symbol -> left = 0; \ - symbol -> right = 0; \ - symbol -> symbols = 0; \ - symbol -> escapes = 0; \ - symbol -> total = 0; \ - symbol -> parent = 0; \ -} - -#define ENET_CONTEXT_CREATE(context, escapes_, minimum) \ -{ \ - ENET_SYMBOL_CREATE (context, 0, 0); \ - (context) -> escapes = escapes_; \ - (context) -> total = escapes_ + 256*minimum; \ - (context) -> symbols = 0; \ -} - -static enet_uint16 -enet_symbol_rescale (ENetSymbol * symbol) -{ - enet_uint16 total = 0; - for (;;) - { - symbol -> count -= symbol->count >> 1; - symbol -> under = symbol -> count; - if (symbol -> left) - symbol -> under += enet_symbol_rescale (symbol + symbol -> left); - total += symbol -> under; - if (! symbol -> right) break; - symbol += symbol -> right; - } - return total; -} - -#define ENET_CONTEXT_RESCALE(context, minimum) \ -{ \ - (context) -> total = (context) -> symbols ? enet_symbol_rescale ((context) + (context) -> symbols) : 0; \ - (context) -> escapes -= (context) -> escapes >> 1; \ - (context) -> total += (context) -> escapes + 256*minimum; \ -} - -#define ENET_RANGE_CODER_OUTPUT(value) \ -{ \ - if (outData >= outEnd) \ - return 0; \ - * outData ++ = value; \ -} - -#define ENET_RANGE_CODER_ENCODE(under, count, total) \ -{ \ - encodeRange /= (total); \ - encodeLow += (under) * encodeRange; \ - encodeRange *= (count); \ - for (;;) \ - { \ - if((encodeLow ^ (encodeLow + encodeRange)) >= ENET_RANGE_CODER_TOP) \ - { \ - if(encodeRange >= ENET_RANGE_CODER_BOTTOM) break; \ - encodeRange = -encodeLow & (ENET_RANGE_CODER_BOTTOM - 1); \ - } \ - ENET_RANGE_CODER_OUTPUT (encodeLow >> 24); \ - encodeRange <<= 8; \ - encodeLow <<= 8; \ - } \ -} - -#define ENET_RANGE_CODER_FLUSH \ -{ \ - while (encodeLow) \ - { \ - ENET_RANGE_CODER_OUTPUT (encodeLow >> 24); \ - encodeLow <<= 8; \ - } \ -} - -#define ENET_RANGE_CODER_FREE_SYMBOLS \ -{ \ - if (nextSymbol >= sizeof (rangeCoder -> symbols) / sizeof (ENetSymbol) - ENET_SUBCONTEXT_ORDER ) \ - { \ - nextSymbol = 0; \ - ENET_CONTEXT_CREATE (root, ENET_CONTEXT_ESCAPE_MINIMUM, ENET_CONTEXT_SYMBOL_MINIMUM); \ - predicted = 0; \ - order = 0; \ - } \ -} - -#define ENET_CONTEXT_ENCODE(context, symbol_, value_, under_, count_, update, minimum) \ -{ \ - under_ = value*minimum; \ - count_ = minimum; \ - if (! (context) -> symbols) \ - { \ - ENET_SYMBOL_CREATE (symbol_, value_, update); \ - (context) -> symbols = symbol_ - (context); \ - } \ - else \ - { \ - ENetSymbol * node = (context) + (context) -> symbols; \ - for (;;) \ - { \ - if (value_ < node -> value) \ - { \ - node -> under += update; \ - if (node -> left) { node += node -> left; continue; } \ - ENET_SYMBOL_CREATE (symbol_, value_, update); \ - node -> left = symbol_ - node; \ - } \ - else \ - if (value_ > node -> value) \ - { \ - under_ += node -> under; \ - if (node -> right) { node += node -> right; continue; } \ - ENET_SYMBOL_CREATE (symbol_, value_, update); \ - node -> right = symbol_ - node; \ - } \ - else \ - { \ - count_ += node -> count; \ - under_ += node -> under - node -> count; \ - node -> under += update; \ - node -> count += update; \ - symbol_ = node; \ - } \ - break; \ - } \ - } \ -} - -#ifdef ENET_CONTEXT_EXCLUSION -static const ENetSymbol emptyContext = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -#define ENET_CONTEXT_WALK(context, body) \ -{ \ - const ENetSymbol * node = (context) + (context) -> symbols; \ - const ENetSymbol * stack [256]; \ - size_t stackSize = 0; \ - while (node -> left) \ - { \ - stack [stackSize ++] = node; \ - node += node -> left; \ - } \ - for (;;) \ - { \ - body; \ - if (node -> right) \ - { \ - node += node -> right; \ - while (node -> left) \ - { \ - stack [stackSize ++] = node; \ - node += node -> left; \ - } \ - } \ - else \ - if (stackSize <= 0) \ - break; \ - else \ - node = stack [-- stackSize]; \ - } \ -} - -#define ENET_CONTEXT_ENCODE_EXCLUDE(context, value_, under, total, minimum) \ -ENET_CONTEXT_WALK(context, { \ - if (node -> value != value_) \ - { \ - enet_uint16 parentCount = rangeCoder -> symbols [node -> parent].count + minimum; \ - if (node -> value < value_) \ - under -= parentCount; \ - total -= parentCount; \ - } \ -}) -#endif - -size_t -enet_range_coder_compress (void * context, const ENetBuffer * inBuffers, size_t inBufferCount, size_t inLimit, enet_uint8 * outData, size_t outLimit) -{ - ENetRangeCoder * rangeCoder = (ENetRangeCoder *) context; - enet_uint8 * outStart = outData, * outEnd = & outData [outLimit]; - const enet_uint8 * inData, * inEnd; - enet_uint32 encodeLow = 0, encodeRange = ~0; - ENetSymbol * root; - enet_uint16 predicted = 0; - size_t order = 0, nextSymbol = 0; - - if (rangeCoder == NULL || inBufferCount <= 0 || inLimit <= 0) - return 0; - - inData = (const enet_uint8 *) inBuffers -> data; - inEnd = & inData [inBuffers -> dataLength]; - inBuffers ++; - inBufferCount --; - - ENET_CONTEXT_CREATE (root, ENET_CONTEXT_ESCAPE_MINIMUM, ENET_CONTEXT_SYMBOL_MINIMUM); - - for (;;) - { - ENetSymbol * subcontext, * symbol; -#ifdef ENET_CONTEXT_EXCLUSION - const ENetSymbol * childContext = & emptyContext; -#endif - enet_uint8 value; - enet_uint16 count, under, * parent = & predicted, total; - if (inData >= inEnd) - { - if (inBufferCount <= 0) - break; - inData = (const enet_uint8 *) inBuffers -> data; - inEnd = & inData [inBuffers -> dataLength]; - inBuffers ++; - inBufferCount --; - } - value = * inData ++; - - for (subcontext = & rangeCoder -> symbols [predicted]; - subcontext != root; -#ifdef ENET_CONTEXT_EXCLUSION - childContext = subcontext, -#endif - subcontext = & rangeCoder -> symbols [subcontext -> parent]) - { - ENET_CONTEXT_ENCODE (subcontext, symbol, value, under, count, ENET_SUBCONTEXT_SYMBOL_DELTA, 0); - * parent = symbol - rangeCoder -> symbols; - parent = & symbol -> parent; - total = subcontext -> total; -#ifdef ENET_CONTEXT_EXCLUSION - if (childContext -> total > ENET_SUBCONTEXT_SYMBOL_DELTA + ENET_SUBCONTEXT_ESCAPE_DELTA) - ENET_CONTEXT_ENCODE_EXCLUDE (childContext, value, under, total, 0); -#endif - if (count > 0) - { - ENET_RANGE_CODER_ENCODE (subcontext -> escapes + under, count, total); - } - else - { - if (subcontext -> escapes > 0 && subcontext -> escapes < total) - ENET_RANGE_CODER_ENCODE (0, subcontext -> escapes, total); - subcontext -> escapes += ENET_SUBCONTEXT_ESCAPE_DELTA; - subcontext -> total += ENET_SUBCONTEXT_ESCAPE_DELTA; - } - subcontext -> total += ENET_SUBCONTEXT_SYMBOL_DELTA; - if (count > 0xFF - 2*ENET_SUBCONTEXT_SYMBOL_DELTA || subcontext -> total > ENET_RANGE_CODER_BOTTOM - 0x100) - ENET_CONTEXT_RESCALE (subcontext, 0); - if (count > 0) goto nextInput; - } - - ENET_CONTEXT_ENCODE (root, symbol, value, under, count, ENET_CONTEXT_SYMBOL_DELTA, ENET_CONTEXT_SYMBOL_MINIMUM); - * parent = symbol - rangeCoder -> symbols; - parent = & symbol -> parent; - total = root -> total; -#ifdef ENET_CONTEXT_EXCLUSION - if (childContext -> total > ENET_SUBCONTEXT_SYMBOL_DELTA + ENET_SUBCONTEXT_ESCAPE_DELTA) - ENET_CONTEXT_ENCODE_EXCLUDE (childContext, value, under, total, ENET_CONTEXT_SYMBOL_MINIMUM); -#endif - ENET_RANGE_CODER_ENCODE (root -> escapes + under, count, total); - root -> total += ENET_CONTEXT_SYMBOL_DELTA; - if (count > 0xFF - 2*ENET_CONTEXT_SYMBOL_DELTA + ENET_CONTEXT_SYMBOL_MINIMUM || root -> total > ENET_RANGE_CODER_BOTTOM - 0x100) - ENET_CONTEXT_RESCALE (root, ENET_CONTEXT_SYMBOL_MINIMUM); - - nextInput: - if (order >= ENET_SUBCONTEXT_ORDER) - predicted = rangeCoder -> symbols [predicted].parent; - else - order ++; - ENET_RANGE_CODER_FREE_SYMBOLS; - } - - ENET_RANGE_CODER_FLUSH; - - return (size_t) (outData - outStart); -} - -#define ENET_RANGE_CODER_SEED \ -{ \ - if (inData < inEnd) decodeCode |= * inData ++ << 24; \ - if (inData < inEnd) decodeCode |= * inData ++ << 16; \ - if (inData < inEnd) decodeCode |= * inData ++ << 8; \ - if (inData < inEnd) decodeCode |= * inData ++; \ -} - -#define ENET_RANGE_CODER_READ(total) ((decodeCode - decodeLow) / (decodeRange /= (total))) - -#define ENET_RANGE_CODER_DECODE(under, count, total) \ -{ \ - decodeLow += (under) * decodeRange; \ - decodeRange *= (count); \ - for (;;) \ - { \ - if((decodeLow ^ (decodeLow + decodeRange)) >= ENET_RANGE_CODER_TOP) \ - { \ - if(decodeRange >= ENET_RANGE_CODER_BOTTOM) break; \ - decodeRange = -decodeLow & (ENET_RANGE_CODER_BOTTOM - 1); \ - } \ - decodeCode <<= 8; \ - if (inData < inEnd) \ - decodeCode |= * inData ++; \ - decodeRange <<= 8; \ - decodeLow <<= 8; \ - } \ -} - -#define ENET_CONTEXT_DECODE(context, symbol_, code, value_, under_, count_, update, minimum, createRoot, visitNode, createRight, createLeft) \ -{ \ - under_ = 0; \ - count_ = minimum; \ - if (! (context) -> symbols) \ - { \ - createRoot; \ - } \ - else \ - { \ - ENetSymbol * node = (context) + (context) -> symbols; \ - for (;;) \ - { \ - enet_uint16 after = under_ + node -> under + (node -> value + 1)*minimum, before = node -> count + minimum; \ - visitNode; \ - if (code >= after) \ - { \ - under_ += node -> under; \ - if (node -> right) { node += node -> right; continue; } \ - createRight; \ - } \ - else \ - if (code < after - before) \ - { \ - node -> under += update; \ - if (node -> left) { node += node -> left; continue; } \ - createLeft; \ - } \ - else \ - { \ - value_ = node -> value; \ - count_ += node -> count; \ - under_ = after - before; \ - node -> under += update; \ - node -> count += update; \ - symbol_ = node; \ - } \ - break; \ - } \ - } \ -} - -#define ENET_CONTEXT_TRY_DECODE(context, symbol_, code, value_, under_, count_, update, minimum, exclude) \ -ENET_CONTEXT_DECODE (context, symbol_, code, value_, under_, count_, update, minimum, return 0, exclude (node -> value, after, before), return 0, return 0) - -#define ENET_CONTEXT_ROOT_DECODE(context, symbol_, code, value_, under_, count_, update, minimum, exclude) \ -ENET_CONTEXT_DECODE (context, symbol_, code, value_, under_, count_, update, minimum, \ - { \ - value_ = code / minimum; \ - under_ = code - code%minimum; \ - ENET_SYMBOL_CREATE (symbol_, value_, update); \ - (context) -> symbols = symbol_ - (context); \ - }, \ - exclude (node -> value, after, before), \ - { \ - value_ = node->value + 1 + (code - after)/minimum; \ - under_ = code - (code - after)%minimum; \ - ENET_SYMBOL_CREATE (symbol_, value_, update); \ - node -> right = symbol_ - node; \ - }, \ - { \ - value_ = node->value - 1 - (after - before - code - 1)/minimum; \ - under_ = code - (after - before - code - 1)%minimum; \ - ENET_SYMBOL_CREATE (symbol_, value_, update); \ - node -> left = symbol_ - node; \ - }) \ - -#ifdef ENET_CONTEXT_EXCLUSION -typedef struct _ENetExclude -{ - enet_uint8 value; - enet_uint16 under; -} ENetExclude; - -#define ENET_CONTEXT_DECODE_EXCLUDE(context, total, minimum) \ -{ \ - enet_uint16 under = 0; \ - nextExclude = excludes; \ - ENET_CONTEXT_WALK (context, { \ - under += rangeCoder -> symbols [node -> parent].count + minimum; \ - nextExclude -> value = node -> value; \ - nextExclude -> under = under; \ - nextExclude ++; \ - }); \ - total -= under; \ -} - -#define ENET_CONTEXT_EXCLUDED(value_, after, before) \ -{ \ - size_t low = 0, high = nextExclude - excludes; \ - for(;;) \ - { \ - size_t mid = (low + high) >> 1; \ - const ENetExclude * exclude = & excludes [mid]; \ - if (value_ < exclude -> value) \ - { \ - if (low + 1 < high) \ - { \ - high = mid; \ - continue; \ - } \ - if (exclude > excludes) \ - after -= exclude [-1].under; \ - } \ - else \ - { \ - if (value_ > exclude -> value) \ - { \ - if (low + 1 < high) \ - { \ - low = mid; \ - continue; \ - } \ - } \ - else \ - before = 0; \ - after -= exclude -> under; \ - } \ - break; \ - } \ -} -#endif - -#define ENET_CONTEXT_NOT_EXCLUDED(value_, after, before) - -size_t -enet_range_coder_decompress (void * context, const enet_uint8 * inData, size_t inLimit, enet_uint8 * outData, size_t outLimit) -{ - ENetRangeCoder * rangeCoder = (ENetRangeCoder *) context; - enet_uint8 * outStart = outData, * outEnd = & outData [outLimit]; - const enet_uint8 * inEnd = & inData [inLimit]; - enet_uint32 decodeLow = 0, decodeCode = 0, decodeRange = ~0; - ENetSymbol * root; - enet_uint16 predicted = 0; - size_t order = 0, nextSymbol = 0; -#ifdef ENET_CONTEXT_EXCLUSION - ENetExclude excludes [256]; - ENetExclude * nextExclude = excludes; -#endif - - if (rangeCoder == NULL || inLimit <= 0) - return 0; - - ENET_CONTEXT_CREATE (root, ENET_CONTEXT_ESCAPE_MINIMUM, ENET_CONTEXT_SYMBOL_MINIMUM); - - ENET_RANGE_CODER_SEED; - - for (;;) - { - ENetSymbol * subcontext, * symbol, * patch; -#ifdef ENET_CONTEXT_EXCLUSION - const ENetSymbol * childContext = & emptyContext; -#endif - enet_uint8 value = 0; - enet_uint16 code, under, count, bottom, * parent = & predicted, total; - - for (subcontext = & rangeCoder -> symbols [predicted]; - subcontext != root; -#ifdef ENET_CONTEXT_EXCLUSION - childContext = subcontext, -#endif - subcontext = & rangeCoder -> symbols [subcontext -> parent]) - { - if (subcontext -> escapes <= 0) - continue; - total = subcontext -> total; -#ifdef ENET_CONTEXT_EXCLUSION - if (childContext -> total > 0) - ENET_CONTEXT_DECODE_EXCLUDE (childContext, total, 0); -#endif - if (subcontext -> escapes >= total) - continue; - code = ENET_RANGE_CODER_READ (total); - if (code < subcontext -> escapes) - { - ENET_RANGE_CODER_DECODE (0, subcontext -> escapes, total); - continue; - } - code -= subcontext -> escapes; -#ifdef ENET_CONTEXT_EXCLUSION - if (childContext -> total > 0) - { - ENET_CONTEXT_TRY_DECODE (subcontext, symbol, code, value, under, count, ENET_SUBCONTEXT_SYMBOL_DELTA, 0, ENET_CONTEXT_EXCLUDED); - } - else -#endif - { - ENET_CONTEXT_TRY_DECODE (subcontext, symbol, code, value, under, count, ENET_SUBCONTEXT_SYMBOL_DELTA, 0, ENET_CONTEXT_NOT_EXCLUDED); - } - bottom = symbol - rangeCoder -> symbols; - ENET_RANGE_CODER_DECODE (subcontext -> escapes + under, count, total); - subcontext -> total += ENET_SUBCONTEXT_SYMBOL_DELTA; - if (count > 0xFF - 2*ENET_SUBCONTEXT_SYMBOL_DELTA || subcontext -> total > ENET_RANGE_CODER_BOTTOM - 0x100) - ENET_CONTEXT_RESCALE (subcontext, 0); - goto patchContexts; - } - - total = root -> total; -#ifdef ENET_CONTEXT_EXCLUSION - if (childContext -> total > 0) - ENET_CONTEXT_DECODE_EXCLUDE (childContext, total, ENET_CONTEXT_SYMBOL_MINIMUM); -#endif - code = ENET_RANGE_CODER_READ (total); - if (code < root -> escapes) - { - ENET_RANGE_CODER_DECODE (0, root -> escapes, total); - break; - } - code -= root -> escapes; -#ifdef ENET_CONTEXT_EXCLUSION - if (childContext -> total > 0) - { - ENET_CONTEXT_ROOT_DECODE (root, symbol, code, value, under, count, ENET_CONTEXT_SYMBOL_DELTA, ENET_CONTEXT_SYMBOL_MINIMUM, ENET_CONTEXT_EXCLUDED); - } - else -#endif - { - ENET_CONTEXT_ROOT_DECODE (root, symbol, code, value, under, count, ENET_CONTEXT_SYMBOL_DELTA, ENET_CONTEXT_SYMBOL_MINIMUM, ENET_CONTEXT_NOT_EXCLUDED); - } - bottom = symbol - rangeCoder -> symbols; - ENET_RANGE_CODER_DECODE (root -> escapes + under, count, total); - root -> total += ENET_CONTEXT_SYMBOL_DELTA; - if (count > 0xFF - 2*ENET_CONTEXT_SYMBOL_DELTA + ENET_CONTEXT_SYMBOL_MINIMUM || root -> total > ENET_RANGE_CODER_BOTTOM - 0x100) - ENET_CONTEXT_RESCALE (root, ENET_CONTEXT_SYMBOL_MINIMUM); - - patchContexts: - for (patch = & rangeCoder -> symbols [predicted]; - patch != subcontext; - patch = & rangeCoder -> symbols [patch -> parent]) - { - ENET_CONTEXT_ENCODE (patch, symbol, value, under, count, ENET_SUBCONTEXT_SYMBOL_DELTA, 0); - * parent = symbol - rangeCoder -> symbols; - parent = & symbol -> parent; - if (count <= 0) - { - patch -> escapes += ENET_SUBCONTEXT_ESCAPE_DELTA; - patch -> total += ENET_SUBCONTEXT_ESCAPE_DELTA; - } - patch -> total += ENET_SUBCONTEXT_SYMBOL_DELTA; - if (count > 0xFF - 2*ENET_SUBCONTEXT_SYMBOL_DELTA || patch -> total > ENET_RANGE_CODER_BOTTOM - 0x100) - ENET_CONTEXT_RESCALE (patch, 0); - } - * parent = bottom; - - ENET_RANGE_CODER_OUTPUT (value); - - if (order >= ENET_SUBCONTEXT_ORDER) - predicted = rangeCoder -> symbols [predicted].parent; - else - order ++; - ENET_RANGE_CODER_FREE_SYMBOLS; - } - - return (size_t) (outData - outStart); -} - -/** @defgroup host ENet host functions - @{ -*/ - -/** Sets the packet compressor the host should use to the default range coder. - @param host host to enable the range coder for - @returns 0 on success, < 0 on failure -*/ -int -enet_host_compress_with_range_coder (ENetHost * host) -{ - ENetCompressor compressor; - memset (& compressor, 0, sizeof (compressor)); - compressor.context = enet_range_coder_create(); - if (compressor.context == NULL) - return -1; - compressor.compress = enet_range_coder_compress; - compressor.decompress = enet_range_coder_decompress; - compressor.destroy = enet_range_coder_destroy; - enet_host_compress (host, & compressor); - return 0; -} - -/** @} */ - - diff --git a/love/src/jni/love/src/libraries/enet/libenet/host.c b/love/src/jni/love/src/libraries/enet/libenet/host.c deleted file mode 100644 index 3be6c092..00000000 --- a/love/src/jni/love/src/libraries/enet/libenet/host.c +++ /dev/null @@ -1,492 +0,0 @@ -/** - @file host.c - @brief ENet host management functions -*/ -#define ENET_BUILDING_LIB 1 -#include -#include "enet/enet.h" - -/** @defgroup host ENet host functions - @{ -*/ - -/** Creates a host for communicating to peers. - - @param address the address at which other peers may connect to this host. If NULL, then no peers may connect to the host. - @param peerCount the maximum number of peers that should be allocated for the host. - @param channelLimit the maximum number of channels allowed; if 0, then this is equivalent to ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT - @param incomingBandwidth downstream bandwidth of the host in bytes/second; if 0, ENet will assume unlimited bandwidth. - @param outgoingBandwidth upstream bandwidth of the host in bytes/second; if 0, ENet will assume unlimited bandwidth. - - @returns the host on success and NULL on failure - - @remarks ENet will strategically drop packets on specific sides of a connection between hosts - to ensure the host's bandwidth is not overwhelmed. The bandwidth parameters also determine - the window size of a connection which limits the amount of reliable packets that may be in transit - at any given time. -*/ -ENetHost * -enet_host_create (const ENetAddress * address, size_t peerCount, size_t channelLimit, enet_uint32 incomingBandwidth, enet_uint32 outgoingBandwidth) -{ - ENetHost * host; - ENetPeer * currentPeer; - - if (peerCount > ENET_PROTOCOL_MAXIMUM_PEER_ID) - return NULL; - - host = (ENetHost *) enet_malloc (sizeof (ENetHost)); - if (host == NULL) - return NULL; - memset (host, 0, sizeof (ENetHost)); - - host -> peers = (ENetPeer *) enet_malloc (peerCount * sizeof (ENetPeer)); - if (host -> peers == NULL) - { - enet_free (host); - - return NULL; - } - memset (host -> peers, 0, peerCount * sizeof (ENetPeer)); - - host -> socket = enet_socket_create (ENET_SOCKET_TYPE_DATAGRAM); - if (host -> socket == ENET_SOCKET_NULL || (address != NULL && enet_socket_bind (host -> socket, address) < 0)) - { - if (host -> socket != ENET_SOCKET_NULL) - enet_socket_destroy (host -> socket); - - enet_free (host -> peers); - enet_free (host); - - return NULL; - } - - enet_socket_set_option (host -> socket, ENET_SOCKOPT_NONBLOCK, 1); - enet_socket_set_option (host -> socket, ENET_SOCKOPT_BROADCAST, 1); - enet_socket_set_option (host -> socket, ENET_SOCKOPT_RCVBUF, ENET_HOST_RECEIVE_BUFFER_SIZE); - enet_socket_set_option (host -> socket, ENET_SOCKOPT_SNDBUF, ENET_HOST_SEND_BUFFER_SIZE); - - if (address != NULL && enet_socket_get_address (host -> socket, & host -> address) < 0) - host -> address = * address; - - if (! channelLimit || channelLimit > ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT) - channelLimit = ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT; - else - if (channelLimit < ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT) - channelLimit = ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT; - - host -> randomSeed = (enet_uint32) (size_t) host; - host -> randomSeed += enet_host_random_seed (); - host -> randomSeed = (host -> randomSeed << 16) | (host -> randomSeed >> 16); - host -> channelLimit = channelLimit; - host -> incomingBandwidth = incomingBandwidth; - host -> outgoingBandwidth = outgoingBandwidth; - host -> bandwidthThrottleEpoch = 0; - host -> recalculateBandwidthLimits = 0; - host -> mtu = ENET_HOST_DEFAULT_MTU; - host -> peerCount = peerCount; - host -> commandCount = 0; - host -> bufferCount = 0; - host -> checksum = NULL; - host -> receivedAddress.host = ENET_HOST_ANY; - host -> receivedAddress.port = 0; - host -> receivedData = NULL; - host -> receivedDataLength = 0; - - host -> totalSentData = 0; - host -> totalSentPackets = 0; - host -> totalReceivedData = 0; - host -> totalReceivedPackets = 0; - - host -> connectedPeers = 0; - host -> bandwidthLimitedPeers = 0; - host -> duplicatePeers = ENET_PROTOCOL_MAXIMUM_PEER_ID; - host -> maximumPacketSize = ENET_HOST_DEFAULT_MAXIMUM_PACKET_SIZE; - host -> maximumWaitingData = ENET_HOST_DEFAULT_MAXIMUM_WAITING_DATA; - - host -> compressor.context = NULL; - host -> compressor.compress = NULL; - host -> compressor.decompress = NULL; - host -> compressor.destroy = NULL; - - host -> intercept = NULL; - - enet_list_clear (& host -> dispatchQueue); - - for (currentPeer = host -> peers; - currentPeer < & host -> peers [host -> peerCount]; - ++ currentPeer) - { - currentPeer -> host = host; - currentPeer -> incomingPeerID = currentPeer - host -> peers; - currentPeer -> outgoingSessionID = currentPeer -> incomingSessionID = 0xFF; - currentPeer -> data = NULL; - - enet_list_clear (& currentPeer -> acknowledgements); - enet_list_clear (& currentPeer -> sentReliableCommands); - enet_list_clear (& currentPeer -> sentUnreliableCommands); - enet_list_clear (& currentPeer -> outgoingReliableCommands); - enet_list_clear (& currentPeer -> outgoingUnreliableCommands); - enet_list_clear (& currentPeer -> dispatchedCommands); - - enet_peer_reset (currentPeer); - } - - return host; -} - -/** Destroys the host and all resources associated with it. - @param host pointer to the host to destroy -*/ -void -enet_host_destroy (ENetHost * host) -{ - ENetPeer * currentPeer; - - if (host == NULL) - return; - - enet_socket_destroy (host -> socket); - - for (currentPeer = host -> peers; - currentPeer < & host -> peers [host -> peerCount]; - ++ currentPeer) - { - enet_peer_reset (currentPeer); - } - - if (host -> compressor.context != NULL && host -> compressor.destroy) - (* host -> compressor.destroy) (host -> compressor.context); - - enet_free (host -> peers); - enet_free (host); -} - -/** Initiates a connection to a foreign host. - @param host host seeking the connection - @param address destination for the connection - @param channelCount number of channels to allocate - @param data user data supplied to the receiving host - @returns a peer representing the foreign host on success, NULL on failure - @remarks The peer returned will have not completed the connection until enet_host_service() - notifies of an ENET_EVENT_TYPE_CONNECT event for the peer. -*/ -ENetPeer * -enet_host_connect (ENetHost * host, const ENetAddress * address, size_t channelCount, enet_uint32 data) -{ - ENetPeer * currentPeer; - ENetChannel * channel; - ENetProtocol command; - - if (channelCount < ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT) - channelCount = ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT; - else - if (channelCount > ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT) - channelCount = ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT; - - for (currentPeer = host -> peers; - currentPeer < & host -> peers [host -> peerCount]; - ++ currentPeer) - { - if (currentPeer -> state == ENET_PEER_STATE_DISCONNECTED) - break; - } - - if (currentPeer >= & host -> peers [host -> peerCount]) - return NULL; - - currentPeer -> channels = (ENetChannel *) enet_malloc (channelCount * sizeof (ENetChannel)); - if (currentPeer -> channels == NULL) - return NULL; - currentPeer -> channelCount = channelCount; - currentPeer -> state = ENET_PEER_STATE_CONNECTING; - currentPeer -> address = * address; - currentPeer -> connectID = ++ host -> randomSeed; - - if (host -> outgoingBandwidth == 0) - currentPeer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; - else - currentPeer -> windowSize = (host -> outgoingBandwidth / - ENET_PEER_WINDOW_SIZE_SCALE) * - ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; - - if (currentPeer -> windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE) - currentPeer -> windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; - else - if (currentPeer -> windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE) - currentPeer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; - - for (channel = currentPeer -> channels; - channel < & currentPeer -> channels [channelCount]; - ++ channel) - { - channel -> outgoingReliableSequenceNumber = 0; - channel -> outgoingUnreliableSequenceNumber = 0; - channel -> incomingReliableSequenceNumber = 0; - channel -> incomingUnreliableSequenceNumber = 0; - - enet_list_clear (& channel -> incomingReliableCommands); - enet_list_clear (& channel -> incomingUnreliableCommands); - - channel -> usedReliableWindows = 0; - memset (channel -> reliableWindows, 0, sizeof (channel -> reliableWindows)); - } - - command.header.command = ENET_PROTOCOL_COMMAND_CONNECT | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; - command.header.channelID = 0xFF; - command.connect.outgoingPeerID = ENET_HOST_TO_NET_16 (currentPeer -> incomingPeerID); - command.connect.incomingSessionID = currentPeer -> incomingSessionID; - command.connect.outgoingSessionID = currentPeer -> outgoingSessionID; - command.connect.mtu = ENET_HOST_TO_NET_32 (currentPeer -> mtu); - command.connect.windowSize = ENET_HOST_TO_NET_32 (currentPeer -> windowSize); - command.connect.channelCount = ENET_HOST_TO_NET_32 (channelCount); - command.connect.incomingBandwidth = ENET_HOST_TO_NET_32 (host -> incomingBandwidth); - command.connect.outgoingBandwidth = ENET_HOST_TO_NET_32 (host -> outgoingBandwidth); - command.connect.packetThrottleInterval = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleInterval); - command.connect.packetThrottleAcceleration = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleAcceleration); - command.connect.packetThrottleDeceleration = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleDeceleration); - command.connect.connectID = currentPeer -> connectID; - command.connect.data = ENET_HOST_TO_NET_32 (data); - - enet_peer_queue_outgoing_command (currentPeer, & command, NULL, 0, 0); - - return currentPeer; -} - -/** Queues a packet to be sent to all peers associated with the host. - @param host host on which to broadcast the packet - @param channelID channel on which to broadcast - @param packet packet to broadcast -*/ -void -enet_host_broadcast (ENetHost * host, enet_uint8 channelID, ENetPacket * packet) -{ - ENetPeer * currentPeer; - - for (currentPeer = host -> peers; - currentPeer < & host -> peers [host -> peerCount]; - ++ currentPeer) - { - if (currentPeer -> state != ENET_PEER_STATE_CONNECTED) - continue; - - enet_peer_send (currentPeer, channelID, packet); - } - - if (packet -> referenceCount == 0) - enet_packet_destroy (packet); -} - -/** Sets the packet compressor the host should use to compress and decompress packets. - @param host host to enable or disable compression for - @param compressor callbacks for for the packet compressor; if NULL, then compression is disabled -*/ -void -enet_host_compress (ENetHost * host, const ENetCompressor * compressor) -{ - if (host -> compressor.context != NULL && host -> compressor.destroy) - (* host -> compressor.destroy) (host -> compressor.context); - - if (compressor) - host -> compressor = * compressor; - else - host -> compressor.context = NULL; -} - -/** Limits the maximum allowed channels of future incoming connections. - @param host host to limit - @param channelLimit the maximum number of channels allowed; if 0, then this is equivalent to ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT -*/ -void -enet_host_channel_limit (ENetHost * host, size_t channelLimit) -{ - if (! channelLimit || channelLimit > ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT) - channelLimit = ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT; - else - if (channelLimit < ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT) - channelLimit = ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT; - - host -> channelLimit = channelLimit; -} - - -/** Adjusts the bandwidth limits of a host. - @param host host to adjust - @param incomingBandwidth new incoming bandwidth - @param outgoingBandwidth new outgoing bandwidth - @remarks the incoming and outgoing bandwidth parameters are identical in function to those - specified in enet_host_create(). -*/ -void -enet_host_bandwidth_limit (ENetHost * host, enet_uint32 incomingBandwidth, enet_uint32 outgoingBandwidth) -{ - host -> incomingBandwidth = incomingBandwidth; - host -> outgoingBandwidth = outgoingBandwidth; - host -> recalculateBandwidthLimits = 1; -} - -void -enet_host_bandwidth_throttle (ENetHost * host) -{ - enet_uint32 timeCurrent = enet_time_get (), - elapsedTime = timeCurrent - host -> bandwidthThrottleEpoch, - peersRemaining = (enet_uint32) host -> connectedPeers, - dataTotal = ~0, - bandwidth = ~0, - throttle = 0, - bandwidthLimit = 0; - int needsAdjustment = host -> bandwidthLimitedPeers > 0 ? 1 : 0; - ENetPeer * peer; - ENetProtocol command; - - if (elapsedTime < ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL) - return; - - host -> bandwidthThrottleEpoch = timeCurrent; - - if (peersRemaining == 0) - return; - - if (host -> outgoingBandwidth != 0) - { - dataTotal = 0; - bandwidth = (host -> outgoingBandwidth * elapsedTime) / 1000; - - for (peer = host -> peers; - peer < & host -> peers [host -> peerCount]; - ++ peer) - { - if (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) - continue; - - dataTotal += peer -> outgoingDataTotal; - } - } - - while (peersRemaining > 0 && needsAdjustment != 0) - { - needsAdjustment = 0; - - if (dataTotal <= bandwidth) - throttle = ENET_PEER_PACKET_THROTTLE_SCALE; - else - throttle = (bandwidth * ENET_PEER_PACKET_THROTTLE_SCALE) / dataTotal; - - for (peer = host -> peers; - peer < & host -> peers [host -> peerCount]; - ++ peer) - { - enet_uint32 peerBandwidth; - - if ((peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) || - peer -> incomingBandwidth == 0 || - peer -> outgoingBandwidthThrottleEpoch == timeCurrent) - continue; - - peerBandwidth = (peer -> incomingBandwidth * elapsedTime) / 1000; - if ((throttle * peer -> outgoingDataTotal) / ENET_PEER_PACKET_THROTTLE_SCALE <= peerBandwidth) - continue; - - peer -> packetThrottleLimit = (peerBandwidth * - ENET_PEER_PACKET_THROTTLE_SCALE) / peer -> outgoingDataTotal; - - if (peer -> packetThrottleLimit == 0) - peer -> packetThrottleLimit = 1; - - if (peer -> packetThrottle > peer -> packetThrottleLimit) - peer -> packetThrottle = peer -> packetThrottleLimit; - - peer -> outgoingBandwidthThrottleEpoch = timeCurrent; - - peer -> incomingDataTotal = 0; - peer -> outgoingDataTotal = 0; - - needsAdjustment = 1; - -- peersRemaining; - bandwidth -= peerBandwidth; - dataTotal -= peerBandwidth; - } - } - - if (peersRemaining > 0) - { - if (dataTotal <= bandwidth) - throttle = ENET_PEER_PACKET_THROTTLE_SCALE; - else - throttle = (bandwidth * ENET_PEER_PACKET_THROTTLE_SCALE) / dataTotal; - - for (peer = host -> peers; - peer < & host -> peers [host -> peerCount]; - ++ peer) - { - if ((peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) || - peer -> outgoingBandwidthThrottleEpoch == timeCurrent) - continue; - - peer -> packetThrottleLimit = throttle; - - if (peer -> packetThrottle > peer -> packetThrottleLimit) - peer -> packetThrottle = peer -> packetThrottleLimit; - - peer -> incomingDataTotal = 0; - peer -> outgoingDataTotal = 0; - } - } - - if (host -> recalculateBandwidthLimits) - { - host -> recalculateBandwidthLimits = 0; - - peersRemaining = (enet_uint32) host -> connectedPeers; - bandwidth = host -> incomingBandwidth; - needsAdjustment = 1; - - if (bandwidth == 0) - bandwidthLimit = 0; - else - while (peersRemaining > 0 && needsAdjustment != 0) - { - needsAdjustment = 0; - bandwidthLimit = bandwidth / peersRemaining; - - for (peer = host -> peers; - peer < & host -> peers [host -> peerCount]; - ++ peer) - { - if ((peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) || - peer -> incomingBandwidthThrottleEpoch == timeCurrent) - continue; - - if (peer -> outgoingBandwidth > 0 && - peer -> outgoingBandwidth >= bandwidthLimit) - continue; - - peer -> incomingBandwidthThrottleEpoch = timeCurrent; - - needsAdjustment = 1; - -- peersRemaining; - bandwidth -= peer -> outgoingBandwidth; - } - } - - for (peer = host -> peers; - peer < & host -> peers [host -> peerCount]; - ++ peer) - { - if (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) - continue; - - command.header.command = ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; - command.header.channelID = 0xFF; - command.bandwidthLimit.outgoingBandwidth = ENET_HOST_TO_NET_32 (host -> outgoingBandwidth); - - if (peer -> incomingBandwidthThrottleEpoch == timeCurrent) - command.bandwidthLimit.incomingBandwidth = ENET_HOST_TO_NET_32 (peer -> outgoingBandwidth); - else - command.bandwidthLimit.incomingBandwidth = ENET_HOST_TO_NET_32 (bandwidthLimit); - - enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0); - } - } -} - -/** @} */ diff --git a/love/src/jni/love/src/libraries/enet/libenet/include/enet/callbacks.h b/love/src/jni/love/src/libraries/enet/libenet/include/enet/callbacks.h deleted file mode 100644 index 340a4a98..00000000 --- a/love/src/jni/love/src/libraries/enet/libenet/include/enet/callbacks.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - @file callbacks.h - @brief ENet callbacks -*/ -#ifndef __ENET_CALLBACKS_H__ -#define __ENET_CALLBACKS_H__ - -#include - -typedef struct _ENetCallbacks -{ - void * (ENET_CALLBACK * malloc) (size_t size); - void (ENET_CALLBACK * free) (void * memory); - void (ENET_CALLBACK * no_memory) (void); -} ENetCallbacks; - -/** @defgroup callbacks ENet internal callbacks - @{ - @ingroup private -*/ -extern void * enet_malloc (size_t); -extern void enet_free (void *); - -/** @} */ - -#endif /* __ENET_CALLBACKS_H__ */ - diff --git a/love/src/jni/love/src/libraries/enet/libenet/include/enet/enet.h b/love/src/jni/love/src/libraries/enet/libenet/include/enet/enet.h deleted file mode 100644 index 9389400e..00000000 --- a/love/src/jni/love/src/libraries/enet/libenet/include/enet/enet.h +++ /dev/null @@ -1,596 +0,0 @@ -/** - @file enet.h - @brief ENet public header file -*/ -#ifndef __ENET_ENET_H__ -#define __ENET_ENET_H__ - -#ifdef __cplusplus -extern "C" -{ -#endif - -#include - -#ifdef _WIN32 -#include "enet/win32.h" -#else -#include "enet/unix.h" -#endif - -#include "enet/types.h" -#include "enet/protocol.h" -#include "enet/list.h" -#include "enet/callbacks.h" - -#define ENET_VERSION_MAJOR 1 -#define ENET_VERSION_MINOR 3 -#define ENET_VERSION_PATCH 13 -#define ENET_VERSION_CREATE(major, minor, patch) (((major)<<16) | ((minor)<<8) | (patch)) -#define ENET_VERSION_GET_MAJOR(version) (((version)>>16)&0xFF) -#define ENET_VERSION_GET_MINOR(version) (((version)>>8)&0xFF) -#define ENET_VERSION_GET_PATCH(version) ((version)&0xFF) -#define ENET_VERSION ENET_VERSION_CREATE(ENET_VERSION_MAJOR, ENET_VERSION_MINOR, ENET_VERSION_PATCH) - -typedef enet_uint32 ENetVersion; - -struct _ENetHost; -struct _ENetEvent; -struct _ENetPacket; - -typedef enum _ENetSocketType -{ - ENET_SOCKET_TYPE_STREAM = 1, - ENET_SOCKET_TYPE_DATAGRAM = 2 -} ENetSocketType; - -typedef enum _ENetSocketWait -{ - ENET_SOCKET_WAIT_NONE = 0, - ENET_SOCKET_WAIT_SEND = (1 << 0), - ENET_SOCKET_WAIT_RECEIVE = (1 << 1), - ENET_SOCKET_WAIT_INTERRUPT = (1 << 2) -} ENetSocketWait; - -typedef enum _ENetSocketOption -{ - ENET_SOCKOPT_NONBLOCK = 1, - ENET_SOCKOPT_BROADCAST = 2, - ENET_SOCKOPT_RCVBUF = 3, - ENET_SOCKOPT_SNDBUF = 4, - ENET_SOCKOPT_REUSEADDR = 5, - ENET_SOCKOPT_RCVTIMEO = 6, - ENET_SOCKOPT_SNDTIMEO = 7, - ENET_SOCKOPT_ERROR = 8, - ENET_SOCKOPT_NODELAY = 9 -} ENetSocketOption; - -typedef enum _ENetSocketShutdown -{ - ENET_SOCKET_SHUTDOWN_READ = 0, - ENET_SOCKET_SHUTDOWN_WRITE = 1, - ENET_SOCKET_SHUTDOWN_READ_WRITE = 2 -} ENetSocketShutdown; - -#define ENET_HOST_ANY 0 -#define ENET_HOST_BROADCAST 0xFFFFFFFFU -#define ENET_PORT_ANY 0 - -/** - * Portable internet address structure. - * - * The host must be specified in network byte-order, and the port must be in host - * byte-order. The constant ENET_HOST_ANY may be used to specify the default - * server host. The constant ENET_HOST_BROADCAST may be used to specify the - * broadcast address (255.255.255.255). This makes sense for enet_host_connect, - * but not for enet_host_create. Once a server responds to a broadcast, the - * address is updated from ENET_HOST_BROADCAST to the server's actual IP address. - */ -typedef struct _ENetAddress -{ - enet_uint32 host; - enet_uint16 port; -} ENetAddress; - -/** - * Packet flag bit constants. - * - * The host must be specified in network byte-order, and the port must be in - * host byte-order. The constant ENET_HOST_ANY may be used to specify the - * default server host. - - @sa ENetPacket -*/ -typedef enum _ENetPacketFlag -{ - /** packet must be received by the target peer and resend attempts should be - * made until the packet is delivered */ - ENET_PACKET_FLAG_RELIABLE = (1 << 0), - /** packet will not be sequenced with other packets - * not supported for reliable packets - */ - ENET_PACKET_FLAG_UNSEQUENCED = (1 << 1), - /** packet will not allocate data, and user must supply it instead */ - ENET_PACKET_FLAG_NO_ALLOCATE = (1 << 2), - /** packet will be fragmented using unreliable (instead of reliable) sends - * if it exceeds the MTU */ - ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT = (1 << 3), - - /** whether the packet has been sent from all queues it has been entered into */ - ENET_PACKET_FLAG_SENT = (1<<8) -} ENetPacketFlag; - -typedef void (ENET_CALLBACK * ENetPacketFreeCallback) (struct _ENetPacket *); - -/** - * ENet packet structure. - * - * An ENet data packet that may be sent to or received from a peer. The shown - * fields should only be read and never modified. The data field contains the - * allocated data for the packet. The dataLength fields specifies the length - * of the allocated data. The flags field is either 0 (specifying no flags), - * or a bitwise-or of any combination of the following flags: - * - * ENET_PACKET_FLAG_RELIABLE - packet must be received by the target peer - * and resend attempts should be made until the packet is delivered - * - * ENET_PACKET_FLAG_UNSEQUENCED - packet will not be sequenced with other packets - * (not supported for reliable packets) - * - * ENET_PACKET_FLAG_NO_ALLOCATE - packet will not allocate data, and user must supply it instead - * - * ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT - packet will be fragmented using unreliable - * (instead of reliable) sends if it exceeds the MTU - * - * ENET_PACKET_FLAG_SENT - whether the packet has been sent from all queues it has been entered into - @sa ENetPacketFlag - */ -typedef struct _ENetPacket -{ - size_t referenceCount; /**< internal use only */ - enet_uint32 flags; /**< bitwise-or of ENetPacketFlag constants */ - enet_uint8 * data; /**< allocated data for packet */ - size_t dataLength; /**< length of data */ - ENetPacketFreeCallback freeCallback; /**< function to be called when the packet is no longer in use */ - void * userData; /**< application private data, may be freely modified */ -} ENetPacket; - -typedef struct _ENetAcknowledgement -{ - ENetListNode acknowledgementList; - enet_uint32 sentTime; - ENetProtocol command; -} ENetAcknowledgement; - -typedef struct _ENetOutgoingCommand -{ - ENetListNode outgoingCommandList; - enet_uint16 reliableSequenceNumber; - enet_uint16 unreliableSequenceNumber; - enet_uint32 sentTime; - enet_uint32 roundTripTimeout; - enet_uint32 roundTripTimeoutLimit; - enet_uint32 fragmentOffset; - enet_uint16 fragmentLength; - enet_uint16 sendAttempts; - ENetProtocol command; - ENetPacket * packet; -} ENetOutgoingCommand; - -typedef struct _ENetIncomingCommand -{ - ENetListNode incomingCommandList; - enet_uint16 reliableSequenceNumber; - enet_uint16 unreliableSequenceNumber; - ENetProtocol command; - enet_uint32 fragmentCount; - enet_uint32 fragmentsRemaining; - enet_uint32 * fragments; - ENetPacket * packet; -} ENetIncomingCommand; - -typedef enum _ENetPeerState -{ - ENET_PEER_STATE_DISCONNECTED = 0, - ENET_PEER_STATE_CONNECTING = 1, - ENET_PEER_STATE_ACKNOWLEDGING_CONNECT = 2, - ENET_PEER_STATE_CONNECTION_PENDING = 3, - ENET_PEER_STATE_CONNECTION_SUCCEEDED = 4, - ENET_PEER_STATE_CONNECTED = 5, - ENET_PEER_STATE_DISCONNECT_LATER = 6, - ENET_PEER_STATE_DISCONNECTING = 7, - ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT = 8, - ENET_PEER_STATE_ZOMBIE = 9 -} ENetPeerState; - -#ifndef ENET_BUFFER_MAXIMUM -#define ENET_BUFFER_MAXIMUM (1 + 2 * ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS) -#endif - -enum -{ - ENET_HOST_RECEIVE_BUFFER_SIZE = 256 * 1024, - ENET_HOST_SEND_BUFFER_SIZE = 256 * 1024, - ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL = 1000, - ENET_HOST_DEFAULT_MTU = 1400, - ENET_HOST_DEFAULT_MAXIMUM_PACKET_SIZE = 32 * 1024 * 1024, - ENET_HOST_DEFAULT_MAXIMUM_WAITING_DATA = 32 * 1024 * 1024, - - ENET_PEER_DEFAULT_ROUND_TRIP_TIME = 500, - ENET_PEER_DEFAULT_PACKET_THROTTLE = 32, - ENET_PEER_PACKET_THROTTLE_SCALE = 32, - ENET_PEER_PACKET_THROTTLE_COUNTER = 7, - ENET_PEER_PACKET_THROTTLE_ACCELERATION = 2, - ENET_PEER_PACKET_THROTTLE_DECELERATION = 2, - ENET_PEER_PACKET_THROTTLE_INTERVAL = 5000, - ENET_PEER_PACKET_LOSS_SCALE = (1 << 16), - ENET_PEER_PACKET_LOSS_INTERVAL = 10000, - ENET_PEER_WINDOW_SIZE_SCALE = 64 * 1024, - ENET_PEER_TIMEOUT_LIMIT = 32, - ENET_PEER_TIMEOUT_MINIMUM = 5000, - ENET_PEER_TIMEOUT_MAXIMUM = 30000, - ENET_PEER_PING_INTERVAL = 500, - ENET_PEER_UNSEQUENCED_WINDOWS = 64, - ENET_PEER_UNSEQUENCED_WINDOW_SIZE = 1024, - ENET_PEER_FREE_UNSEQUENCED_WINDOWS = 32, - ENET_PEER_RELIABLE_WINDOWS = 16, - ENET_PEER_RELIABLE_WINDOW_SIZE = 0x1000, - ENET_PEER_FREE_RELIABLE_WINDOWS = 8 -}; - -typedef struct _ENetChannel -{ - enet_uint16 outgoingReliableSequenceNumber; - enet_uint16 outgoingUnreliableSequenceNumber; - enet_uint16 usedReliableWindows; - enet_uint16 reliableWindows [ENET_PEER_RELIABLE_WINDOWS]; - enet_uint16 incomingReliableSequenceNumber; - enet_uint16 incomingUnreliableSequenceNumber; - ENetList incomingReliableCommands; - ENetList incomingUnreliableCommands; -} ENetChannel; - -/** - * An ENet peer which data packets may be sent or received from. - * - * No fields should be modified unless otherwise specified. - */ -typedef struct _ENetPeer -{ - ENetListNode dispatchList; - struct _ENetHost * host; - enet_uint16 outgoingPeerID; - enet_uint16 incomingPeerID; - enet_uint32 connectID; - enet_uint8 outgoingSessionID; - enet_uint8 incomingSessionID; - ENetAddress address; /**< Internet address of the peer */ - void * data; /**< Application private data, may be freely modified */ - ENetPeerState state; - ENetChannel * channels; - size_t channelCount; /**< Number of channels allocated for communication with peer */ - enet_uint32 incomingBandwidth; /**< Downstream bandwidth of the client in bytes/second */ - enet_uint32 outgoingBandwidth; /**< Upstream bandwidth of the client in bytes/second */ - enet_uint32 incomingBandwidthThrottleEpoch; - enet_uint32 outgoingBandwidthThrottleEpoch; - enet_uint32 incomingDataTotal; - enet_uint32 outgoingDataTotal; - enet_uint32 lastSendTime; - enet_uint32 lastReceiveTime; - enet_uint32 nextTimeout; - enet_uint32 earliestTimeout; - enet_uint32 packetLossEpoch; - enet_uint32 packetsSent; - enet_uint32 packetsLost; - enet_uint32 packetLoss; /**< mean packet loss of reliable packets as a ratio with respect to the constant ENET_PEER_PACKET_LOSS_SCALE */ - enet_uint32 packetLossVariance; - enet_uint32 packetThrottle; - enet_uint32 packetThrottleLimit; - enet_uint32 packetThrottleCounter; - enet_uint32 packetThrottleEpoch; - enet_uint32 packetThrottleAcceleration; - enet_uint32 packetThrottleDeceleration; - enet_uint32 packetThrottleInterval; - enet_uint32 pingInterval; - enet_uint32 timeoutLimit; - enet_uint32 timeoutMinimum; - enet_uint32 timeoutMaximum; - enet_uint32 lastRoundTripTime; - enet_uint32 lowestRoundTripTime; - enet_uint32 lastRoundTripTimeVariance; - enet_uint32 highestRoundTripTimeVariance; - enet_uint32 roundTripTime; /**< mean round trip time (RTT), in milliseconds, between sending a reliable packet and receiving its acknowledgement */ - enet_uint32 roundTripTimeVariance; - enet_uint32 mtu; - enet_uint32 windowSize; - enet_uint32 reliableDataInTransit; - enet_uint16 outgoingReliableSequenceNumber; - ENetList acknowledgements; - ENetList sentReliableCommands; - ENetList sentUnreliableCommands; - ENetList outgoingReliableCommands; - ENetList outgoingUnreliableCommands; - ENetList dispatchedCommands; - int needsDispatch; - enet_uint16 incomingUnsequencedGroup; - enet_uint16 outgoingUnsequencedGroup; - enet_uint32 unsequencedWindow [ENET_PEER_UNSEQUENCED_WINDOW_SIZE / 32]; - enet_uint32 eventData; - size_t totalWaitingData; -} ENetPeer; - -/** An ENet packet compressor for compressing UDP packets before socket sends or receives. - */ -typedef struct _ENetCompressor -{ - /** Context data for the compressor. Must be non-NULL. */ - void * context; - /** Compresses from inBuffers[0:inBufferCount-1], containing inLimit bytes, to outData, outputting at most outLimit bytes. Should return 0 on failure. */ - size_t (ENET_CALLBACK * compress) (void * context, const ENetBuffer * inBuffers, size_t inBufferCount, size_t inLimit, enet_uint8 * outData, size_t outLimit); - /** Decompresses from inData, containing inLimit bytes, to outData, outputting at most outLimit bytes. Should return 0 on failure. */ - size_t (ENET_CALLBACK * decompress) (void * context, const enet_uint8 * inData, size_t inLimit, enet_uint8 * outData, size_t outLimit); - /** Destroys the context when compression is disabled or the host is destroyed. May be NULL. */ - void (ENET_CALLBACK * destroy) (void * context); -} ENetCompressor; - -/** Callback that computes the checksum of the data held in buffers[0:bufferCount-1] */ -typedef enet_uint32 (ENET_CALLBACK * ENetChecksumCallback) (const ENetBuffer * buffers, size_t bufferCount); - -/** Callback for intercepting received raw UDP packets. Should return 1 to intercept, 0 to ignore, or -1 to propagate an error. */ -typedef int (ENET_CALLBACK * ENetInterceptCallback) (struct _ENetHost * host, struct _ENetEvent * event); - -/** An ENet host for communicating with peers. - * - * No fields should be modified unless otherwise stated. - - @sa enet_host_create() - @sa enet_host_destroy() - @sa enet_host_connect() - @sa enet_host_service() - @sa enet_host_flush() - @sa enet_host_broadcast() - @sa enet_host_compress() - @sa enet_host_compress_with_range_coder() - @sa enet_host_channel_limit() - @sa enet_host_bandwidth_limit() - @sa enet_host_bandwidth_throttle() - */ -typedef struct _ENetHost -{ - ENetSocket socket; - ENetAddress address; /**< Internet address of the host */ - enet_uint32 incomingBandwidth; /**< downstream bandwidth of the host */ - enet_uint32 outgoingBandwidth; /**< upstream bandwidth of the host */ - enet_uint32 bandwidthThrottleEpoch; - enet_uint32 mtu; - enet_uint32 randomSeed; - int recalculateBandwidthLimits; - ENetPeer * peers; /**< array of peers allocated for this host */ - size_t peerCount; /**< number of peers allocated for this host */ - size_t channelLimit; /**< maximum number of channels allowed for connected peers */ - enet_uint32 serviceTime; - ENetList dispatchQueue; - int continueSending; - size_t packetSize; - enet_uint16 headerFlags; - ENetProtocol commands [ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS]; - size_t commandCount; - ENetBuffer buffers [ENET_BUFFER_MAXIMUM]; - size_t bufferCount; - ENetChecksumCallback checksum; /**< callback the user can set to enable packet checksums for this host */ - ENetCompressor compressor; - enet_uint8 packetData [2][ENET_PROTOCOL_MAXIMUM_MTU]; - ENetAddress receivedAddress; - enet_uint8 * receivedData; - size_t receivedDataLength; - enet_uint32 totalSentData; /**< total data sent, user should reset to 0 as needed to prevent overflow */ - enet_uint32 totalSentPackets; /**< total UDP packets sent, user should reset to 0 as needed to prevent overflow */ - enet_uint32 totalReceivedData; /**< total data received, user should reset to 0 as needed to prevent overflow */ - enet_uint32 totalReceivedPackets; /**< total UDP packets received, user should reset to 0 as needed to prevent overflow */ - ENetInterceptCallback intercept; /**< callback the user can set to intercept received raw UDP packets */ - size_t connectedPeers; - size_t bandwidthLimitedPeers; - size_t duplicatePeers; /**< optional number of allowed peers from duplicate IPs, defaults to ENET_PROTOCOL_MAXIMUM_PEER_ID */ - size_t maximumPacketSize; /**< the maximum allowable packet size that may be sent or received on a peer */ - size_t maximumWaitingData; /**< the maximum aggregate amount of buffer space a peer may use waiting for packets to be delivered */ -} ENetHost; - -/** - * An ENet event type, as specified in @ref ENetEvent. - */ -typedef enum _ENetEventType -{ - /** no event occurred within the specified time limit */ - ENET_EVENT_TYPE_NONE = 0, - - /** a connection request initiated by enet_host_connect has completed. - * The peer field contains the peer which successfully connected. - */ - ENET_EVENT_TYPE_CONNECT = 1, - - /** a peer has disconnected. This event is generated on a successful - * completion of a disconnect initiated by enet_pper_disconnect, if - * a peer has timed out, or if a connection request intialized by - * enet_host_connect has timed out. The peer field contains the peer - * which disconnected. The data field contains user supplied data - * describing the disconnection, or 0, if none is available. - */ - ENET_EVENT_TYPE_DISCONNECT = 2, - - /** a packet has been received from a peer. The peer field specifies the - * peer which sent the packet. The channelID field specifies the channel - * number upon which the packet was received. The packet field contains - * the packet that was received; this packet must be destroyed with - * enet_packet_destroy after use. - */ - ENET_EVENT_TYPE_RECEIVE = 3 -} ENetEventType; - -/** - * An ENet event as returned by enet_host_service(). - - @sa enet_host_service - */ -typedef struct _ENetEvent -{ - ENetEventType type; /**< type of the event */ - ENetPeer * peer; /**< peer that generated a connect, disconnect or receive event */ - enet_uint8 channelID; /**< channel on the peer that generated the event, if appropriate */ - enet_uint32 data; /**< data associated with the event, if appropriate */ - ENetPacket * packet; /**< packet associated with the event, if appropriate */ -} ENetEvent; - -/** @defgroup global ENet global functions - @{ -*/ - -/** - Initializes ENet globally. Must be called prior to using any functions in - ENet. - @returns 0 on success, < 0 on failure -*/ -ENET_API int enet_initialize (void); - -/** - Initializes ENet globally and supplies user-overridden callbacks. Must be called prior to using any functions in ENet. Do not use enet_initialize() if you use this variant. Make sure the ENetCallbacks structure is zeroed out so that any additional callbacks added in future versions will be properly ignored. - - @param version the constant ENET_VERSION should be supplied so ENet knows which version of ENetCallbacks struct to use - @param inits user-overridden callbacks where any NULL callbacks will use ENet's defaults - @returns 0 on success, < 0 on failure -*/ -ENET_API int enet_initialize_with_callbacks (ENetVersion version, const ENetCallbacks * inits); - -/** - Shuts down ENet globally. Should be called when a program that has - initialized ENet exits. -*/ -ENET_API void enet_deinitialize (void); - -/** - Gives the linked version of the ENet library. - @returns the version number -*/ -ENET_API ENetVersion enet_linked_version (void); - -/** @} */ - -/** @defgroup private ENet private implementation functions */ - -/** - Returns the wall-time in milliseconds. Its initial value is unspecified - unless otherwise set. - */ -ENET_API enet_uint32 enet_time_get (void); -/** - Sets the current wall-time in milliseconds. - */ -ENET_API void enet_time_set (enet_uint32); - -/** @defgroup socket ENet socket functions - @{ -*/ -ENET_API ENetSocket enet_socket_create (ENetSocketType); -ENET_API int enet_socket_bind (ENetSocket, const ENetAddress *); -ENET_API int enet_socket_get_address (ENetSocket, ENetAddress *); -ENET_API int enet_socket_listen (ENetSocket, int); -ENET_API ENetSocket enet_socket_accept (ENetSocket, ENetAddress *); -ENET_API int enet_socket_connect (ENetSocket, const ENetAddress *); -ENET_API int enet_socket_send (ENetSocket, const ENetAddress *, const ENetBuffer *, size_t); -ENET_API int enet_socket_receive (ENetSocket, ENetAddress *, ENetBuffer *, size_t); -ENET_API int enet_socket_wait (ENetSocket, enet_uint32 *, enet_uint32); -ENET_API int enet_socket_set_option (ENetSocket, ENetSocketOption, int); -ENET_API int enet_socket_get_option (ENetSocket, ENetSocketOption, int *); -ENET_API int enet_socket_shutdown (ENetSocket, ENetSocketShutdown); -ENET_API void enet_socket_destroy (ENetSocket); -ENET_API int enet_socketset_select (ENetSocket, ENetSocketSet *, ENetSocketSet *, enet_uint32); - -/** @} */ - -/** @defgroup Address ENet address functions - @{ -*/ -/** Attempts to resolve the host named by the parameter hostName and sets - the host field in the address parameter if successful. - @param address destination to store resolved address - @param hostName host name to lookup - @retval 0 on success - @retval < 0 on failure - @returns the address of the given hostName in address on success -*/ -ENET_API int enet_address_set_host (ENetAddress * address, const char * hostName); - -/** Gives the printable form of the IP address specified in the address parameter. - @param address address printed - @param hostName destination for name, must not be NULL - @param nameLength maximum length of hostName. - @returns the null-terminated name of the host in hostName on success - @retval 0 on success - @retval < 0 on failure -*/ -ENET_API int enet_address_get_host_ip (const ENetAddress * address, char * hostName, size_t nameLength); - -/** Attempts to do a reverse lookup of the host field in the address parameter. - @param address address used for reverse lookup - @param hostName destination for name, must not be NULL - @param nameLength maximum length of hostName. - @returns the null-terminated name of the host in hostName on success - @retval 0 on success - @retval < 0 on failure -*/ -ENET_API int enet_address_get_host (const ENetAddress * address, char * hostName, size_t nameLength); - -/** @} */ - -ENET_API ENetPacket * enet_packet_create (const void *, size_t, enet_uint32); -ENET_API void enet_packet_destroy (ENetPacket *); -ENET_API int enet_packet_resize (ENetPacket *, size_t); -ENET_API enet_uint32 enet_crc32 (const ENetBuffer *, size_t); - -ENET_API ENetHost * enet_host_create (const ENetAddress *, size_t, size_t, enet_uint32, enet_uint32); -ENET_API void enet_host_destroy (ENetHost *); -ENET_API ENetPeer * enet_host_connect (ENetHost *, const ENetAddress *, size_t, enet_uint32); -ENET_API int enet_host_check_events (ENetHost *, ENetEvent *); -ENET_API int enet_host_service (ENetHost *, ENetEvent *, enet_uint32); -ENET_API void enet_host_flush (ENetHost *); -ENET_API void enet_host_broadcast (ENetHost *, enet_uint8, ENetPacket *); -ENET_API void enet_host_compress (ENetHost *, const ENetCompressor *); -ENET_API int enet_host_compress_with_range_coder (ENetHost * host); -ENET_API void enet_host_channel_limit (ENetHost *, size_t); -ENET_API void enet_host_bandwidth_limit (ENetHost *, enet_uint32, enet_uint32); -extern void enet_host_bandwidth_throttle (ENetHost *); -extern enet_uint32 enet_host_random_seed (void); - -ENET_API int enet_peer_send (ENetPeer *, enet_uint8, ENetPacket *); -ENET_API ENetPacket * enet_peer_receive (ENetPeer *, enet_uint8 * channelID); -ENET_API void enet_peer_ping (ENetPeer *); -ENET_API void enet_peer_ping_interval (ENetPeer *, enet_uint32); -ENET_API void enet_peer_timeout (ENetPeer *, enet_uint32, enet_uint32, enet_uint32); -ENET_API void enet_peer_reset (ENetPeer *); -ENET_API void enet_peer_disconnect (ENetPeer *, enet_uint32); -ENET_API void enet_peer_disconnect_now (ENetPeer *, enet_uint32); -ENET_API void enet_peer_disconnect_later (ENetPeer *, enet_uint32); -ENET_API void enet_peer_throttle_configure (ENetPeer *, enet_uint32, enet_uint32, enet_uint32); -extern int enet_peer_throttle (ENetPeer *, enet_uint32); -extern void enet_peer_reset_queues (ENetPeer *); -extern void enet_peer_setup_outgoing_command (ENetPeer *, ENetOutgoingCommand *); -extern ENetOutgoingCommand * enet_peer_queue_outgoing_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32, enet_uint16); -extern ENetIncomingCommand * enet_peer_queue_incoming_command (ENetPeer *, const ENetProtocol *, const void *, size_t, enet_uint32, enet_uint32); -extern ENetAcknowledgement * enet_peer_queue_acknowledgement (ENetPeer *, const ENetProtocol *, enet_uint16); -extern void enet_peer_dispatch_incoming_unreliable_commands (ENetPeer *, ENetChannel *); -extern void enet_peer_dispatch_incoming_reliable_commands (ENetPeer *, ENetChannel *); -extern void enet_peer_on_connect (ENetPeer *); -extern void enet_peer_on_disconnect (ENetPeer *); - -ENET_API void * enet_range_coder_create (void); -ENET_API void enet_range_coder_destroy (void *); -ENET_API size_t enet_range_coder_compress (void *, const ENetBuffer *, size_t, size_t, enet_uint8 *, size_t); -ENET_API size_t enet_range_coder_decompress (void *, const enet_uint8 *, size_t, enet_uint8 *, size_t); - -extern size_t enet_protocol_command_size (enet_uint8); - -#ifdef __cplusplus -} -#endif - -#endif /* __ENET_ENET_H__ */ - diff --git a/love/src/jni/love/src/libraries/enet/libenet/include/enet/list.h b/love/src/jni/love/src/libraries/enet/libenet/include/enet/list.h deleted file mode 100644 index d7b26008..00000000 --- a/love/src/jni/love/src/libraries/enet/libenet/include/enet/list.h +++ /dev/null @@ -1,43 +0,0 @@ -/** - @file list.h - @brief ENet list management -*/ -#ifndef __ENET_LIST_H__ -#define __ENET_LIST_H__ - -#include - -typedef struct _ENetListNode -{ - struct _ENetListNode * next; - struct _ENetListNode * previous; -} ENetListNode; - -typedef ENetListNode * ENetListIterator; - -typedef struct _ENetList -{ - ENetListNode sentinel; -} ENetList; - -extern void enet_list_clear (ENetList *); - -extern ENetListIterator enet_list_insert (ENetListIterator, void *); -extern void * enet_list_remove (ENetListIterator); -extern ENetListIterator enet_list_move (ENetListIterator, void *, void *); - -extern size_t enet_list_size (ENetList *); - -#define enet_list_begin(list) ((list) -> sentinel.next) -#define enet_list_end(list) (& (list) -> sentinel) - -#define enet_list_empty(list) (enet_list_begin (list) == enet_list_end (list)) - -#define enet_list_next(iterator) ((iterator) -> next) -#define enet_list_previous(iterator) ((iterator) -> previous) - -#define enet_list_front(list) ((void *) (list) -> sentinel.next) -#define enet_list_back(list) ((void *) (list) -> sentinel.previous) - -#endif /* __ENET_LIST_H__ */ - diff --git a/love/src/jni/love/src/libraries/enet/libenet/include/enet/protocol.h b/love/src/jni/love/src/libraries/enet/libenet/include/enet/protocol.h deleted file mode 100644 index f8c73d8a..00000000 --- a/love/src/jni/love/src/libraries/enet/libenet/include/enet/protocol.h +++ /dev/null @@ -1,198 +0,0 @@ -/** - @file protocol.h - @brief ENet protocol -*/ -#ifndef __ENET_PROTOCOL_H__ -#define __ENET_PROTOCOL_H__ - -#include "enet/types.h" - -enum -{ - ENET_PROTOCOL_MINIMUM_MTU = 576, - ENET_PROTOCOL_MAXIMUM_MTU = 4096, - ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS = 32, - ENET_PROTOCOL_MINIMUM_WINDOW_SIZE = 4096, - ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE = 65536, - ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT = 1, - ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT = 255, - ENET_PROTOCOL_MAXIMUM_PEER_ID = 0xFFF, - ENET_PROTOCOL_MAXIMUM_FRAGMENT_COUNT = 1024 * 1024 -}; - -typedef enum _ENetProtocolCommand -{ - ENET_PROTOCOL_COMMAND_NONE = 0, - ENET_PROTOCOL_COMMAND_ACKNOWLEDGE = 1, - ENET_PROTOCOL_COMMAND_CONNECT = 2, - ENET_PROTOCOL_COMMAND_VERIFY_CONNECT = 3, - ENET_PROTOCOL_COMMAND_DISCONNECT = 4, - ENET_PROTOCOL_COMMAND_PING = 5, - ENET_PROTOCOL_COMMAND_SEND_RELIABLE = 6, - ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE = 7, - ENET_PROTOCOL_COMMAND_SEND_FRAGMENT = 8, - ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED = 9, - ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT = 10, - ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE = 11, - ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE_FRAGMENT = 12, - ENET_PROTOCOL_COMMAND_COUNT = 13, - - ENET_PROTOCOL_COMMAND_MASK = 0x0F -} ENetProtocolCommand; - -typedef enum _ENetProtocolFlag -{ - ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE = (1 << 7), - ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED = (1 << 6), - - ENET_PROTOCOL_HEADER_FLAG_COMPRESSED = (1 << 14), - ENET_PROTOCOL_HEADER_FLAG_SENT_TIME = (1 << 15), - ENET_PROTOCOL_HEADER_FLAG_MASK = ENET_PROTOCOL_HEADER_FLAG_COMPRESSED | ENET_PROTOCOL_HEADER_FLAG_SENT_TIME, - - ENET_PROTOCOL_HEADER_SESSION_MASK = (3 << 12), - ENET_PROTOCOL_HEADER_SESSION_SHIFT = 12 -} ENetProtocolFlag; - -#ifdef _MSC_VER -#pragma pack(push, 1) -#define ENET_PACKED -#elif defined(__GNUC__) || defined(__clang__) -#define ENET_PACKED __attribute__ ((packed)) -#else -#define ENET_PACKED -#endif - -typedef struct _ENetProtocolHeader -{ - enet_uint16 peerID; - enet_uint16 sentTime; -} ENET_PACKED ENetProtocolHeader; - -typedef struct _ENetProtocolCommandHeader -{ - enet_uint8 command; - enet_uint8 channelID; - enet_uint16 reliableSequenceNumber; -} ENET_PACKED ENetProtocolCommandHeader; - -typedef struct _ENetProtocolAcknowledge -{ - ENetProtocolCommandHeader header; - enet_uint16 receivedReliableSequenceNumber; - enet_uint16 receivedSentTime; -} ENET_PACKED ENetProtocolAcknowledge; - -typedef struct _ENetProtocolConnect -{ - ENetProtocolCommandHeader header; - enet_uint16 outgoingPeerID; - enet_uint8 incomingSessionID; - enet_uint8 outgoingSessionID; - enet_uint32 mtu; - enet_uint32 windowSize; - enet_uint32 channelCount; - enet_uint32 incomingBandwidth; - enet_uint32 outgoingBandwidth; - enet_uint32 packetThrottleInterval; - enet_uint32 packetThrottleAcceleration; - enet_uint32 packetThrottleDeceleration; - enet_uint32 connectID; - enet_uint32 data; -} ENET_PACKED ENetProtocolConnect; - -typedef struct _ENetProtocolVerifyConnect -{ - ENetProtocolCommandHeader header; - enet_uint16 outgoingPeerID; - enet_uint8 incomingSessionID; - enet_uint8 outgoingSessionID; - enet_uint32 mtu; - enet_uint32 windowSize; - enet_uint32 channelCount; - enet_uint32 incomingBandwidth; - enet_uint32 outgoingBandwidth; - enet_uint32 packetThrottleInterval; - enet_uint32 packetThrottleAcceleration; - enet_uint32 packetThrottleDeceleration; - enet_uint32 connectID; -} ENET_PACKED ENetProtocolVerifyConnect; - -typedef struct _ENetProtocolBandwidthLimit -{ - ENetProtocolCommandHeader header; - enet_uint32 incomingBandwidth; - enet_uint32 outgoingBandwidth; -} ENET_PACKED ENetProtocolBandwidthLimit; - -typedef struct _ENetProtocolThrottleConfigure -{ - ENetProtocolCommandHeader header; - enet_uint32 packetThrottleInterval; - enet_uint32 packetThrottleAcceleration; - enet_uint32 packetThrottleDeceleration; -} ENET_PACKED ENetProtocolThrottleConfigure; - -typedef struct _ENetProtocolDisconnect -{ - ENetProtocolCommandHeader header; - enet_uint32 data; -} ENET_PACKED ENetProtocolDisconnect; - -typedef struct _ENetProtocolPing -{ - ENetProtocolCommandHeader header; -} ENET_PACKED ENetProtocolPing; - -typedef struct _ENetProtocolSendReliable -{ - ENetProtocolCommandHeader header; - enet_uint16 dataLength; -} ENET_PACKED ENetProtocolSendReliable; - -typedef struct _ENetProtocolSendUnreliable -{ - ENetProtocolCommandHeader header; - enet_uint16 unreliableSequenceNumber; - enet_uint16 dataLength; -} ENET_PACKED ENetProtocolSendUnreliable; - -typedef struct _ENetProtocolSendUnsequenced -{ - ENetProtocolCommandHeader header; - enet_uint16 unsequencedGroup; - enet_uint16 dataLength; -} ENET_PACKED ENetProtocolSendUnsequenced; - -typedef struct _ENetProtocolSendFragment -{ - ENetProtocolCommandHeader header; - enet_uint16 startSequenceNumber; - enet_uint16 dataLength; - enet_uint32 fragmentCount; - enet_uint32 fragmentNumber; - enet_uint32 totalLength; - enet_uint32 fragmentOffset; -} ENET_PACKED ENetProtocolSendFragment; - -typedef union _ENetProtocol -{ - ENetProtocolCommandHeader header; - ENetProtocolAcknowledge acknowledge; - ENetProtocolConnect connect; - ENetProtocolVerifyConnect verifyConnect; - ENetProtocolDisconnect disconnect; - ENetProtocolPing ping; - ENetProtocolSendReliable sendReliable; - ENetProtocolSendUnreliable sendUnreliable; - ENetProtocolSendUnsequenced sendUnsequenced; - ENetProtocolSendFragment sendFragment; - ENetProtocolBandwidthLimit bandwidthLimit; - ENetProtocolThrottleConfigure throttleConfigure; -} ENET_PACKED ENetProtocol; - -#ifdef _MSC_VER -#pragma pack(pop) -#endif - -#endif /* __ENET_PROTOCOL_H__ */ - diff --git a/love/src/jni/love/src/libraries/enet/libenet/include/enet/time.h b/love/src/jni/love/src/libraries/enet/libenet/include/enet/time.h deleted file mode 100644 index c82a5460..00000000 --- a/love/src/jni/love/src/libraries/enet/libenet/include/enet/time.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - @file time.h - @brief ENet time constants and macros -*/ -#ifndef __ENET_TIME_H__ -#define __ENET_TIME_H__ - -#define ENET_TIME_OVERFLOW 86400000 - -#define ENET_TIME_LESS(a, b) ((a) - (b) >= ENET_TIME_OVERFLOW) -#define ENET_TIME_GREATER(a, b) ((b) - (a) >= ENET_TIME_OVERFLOW) -#define ENET_TIME_LESS_EQUAL(a, b) (! ENET_TIME_GREATER (a, b)) -#define ENET_TIME_GREATER_EQUAL(a, b) (! ENET_TIME_LESS (a, b)) - -#define ENET_TIME_DIFFERENCE(a, b) ((a) - (b) >= ENET_TIME_OVERFLOW ? (b) - (a) : (a) - (b)) - -#endif /* __ENET_TIME_H__ */ - diff --git a/love/src/jni/love/src/libraries/enet/libenet/include/enet/types.h b/love/src/jni/love/src/libraries/enet/libenet/include/enet/types.h deleted file mode 100644 index ab010a4b..00000000 --- a/love/src/jni/love/src/libraries/enet/libenet/include/enet/types.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - @file types.h - @brief type definitions for ENet -*/ -#ifndef __ENET_TYPES_H__ -#define __ENET_TYPES_H__ - -typedef unsigned char enet_uint8; /**< unsigned 8-bit type */ -typedef unsigned short enet_uint16; /**< unsigned 16-bit type */ -typedef unsigned int enet_uint32; /**< unsigned 32-bit type */ - -#endif /* __ENET_TYPES_H__ */ - diff --git a/love/src/jni/love/src/libraries/enet/libenet/include/enet/unix.h b/love/src/jni/love/src/libraries/enet/libenet/include/enet/unix.h deleted file mode 100644 index a59e3406..00000000 --- a/love/src/jni/love/src/libraries/enet/libenet/include/enet/unix.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - @file unix.h - @brief ENet Unix header -*/ -#ifndef __ENET_UNIX_H__ -#define __ENET_UNIX_H__ - -#include -#include -#include -#include -#include -#include - -#ifdef MSG_MAXIOVLEN -#define ENET_BUFFER_MAXIMUM MSG_MAXIOVLEN -#endif - -typedef int ENetSocket; - -#define ENET_SOCKET_NULL -1 - -#define ENET_HOST_TO_NET_16(value) (htons (value)) /**< macro that converts host to net byte-order of a 16-bit value */ -#define ENET_HOST_TO_NET_32(value) (htonl (value)) /**< macro that converts host to net byte-order of a 32-bit value */ - -#define ENET_NET_TO_HOST_16(value) (ntohs (value)) /**< macro that converts net to host byte-order of a 16-bit value */ -#define ENET_NET_TO_HOST_32(value) (ntohl (value)) /**< macro that converts net to host byte-order of a 32-bit value */ - -typedef struct -{ - void * data; - size_t dataLength; -} ENetBuffer; - -#define ENET_CALLBACK - -#define ENET_API extern - -typedef fd_set ENetSocketSet; - -#define ENET_SOCKETSET_EMPTY(sockset) FD_ZERO (& (sockset)) -#define ENET_SOCKETSET_ADD(sockset, socket) FD_SET (socket, & (sockset)) -#define ENET_SOCKETSET_REMOVE(sockset, socket) FD_CLR (socket, & (sockset)) -#define ENET_SOCKETSET_CHECK(sockset, socket) FD_ISSET (socket, & (sockset)) - -#endif /* __ENET_UNIX_H__ */ - diff --git a/love/src/jni/love/src/libraries/enet/libenet/include/enet/utility.h b/love/src/jni/love/src/libraries/enet/libenet/include/enet/utility.h deleted file mode 100644 index e48a476b..00000000 --- a/love/src/jni/love/src/libraries/enet/libenet/include/enet/utility.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - @file utility.h - @brief ENet utility header -*/ -#ifndef __ENET_UTILITY_H__ -#define __ENET_UTILITY_H__ - -#define ENET_MAX(x, y) ((x) > (y) ? (x) : (y)) -#define ENET_MIN(x, y) ((x) < (y) ? (x) : (y)) - -#endif /* __ENET_UTILITY_H__ */ - diff --git a/love/src/jni/love/src/libraries/enet/libenet/include/enet/win32.h b/love/src/jni/love/src/libraries/enet/libenet/include/enet/win32.h deleted file mode 100644 index e73ca9d0..00000000 --- a/love/src/jni/love/src/libraries/enet/libenet/include/enet/win32.h +++ /dev/null @@ -1,57 +0,0 @@ -/** - @file win32.h - @brief ENet Win32 header -*/ -#ifndef __ENET_WIN32_H__ -#define __ENET_WIN32_H__ - -#ifdef _MSC_VER -#ifdef ENET_BUILDING_LIB -#pragma warning (disable: 4267) // size_t to int conversion -#pragma warning (disable: 4244) // 64bit to 32bit int -#pragma warning (disable: 4018) // signed/unsigned mismatch -#pragma warning (disable: 4146) // unary minus operator applied to unsigned type -#endif -#endif - -#include -#include - -typedef SOCKET ENetSocket; - -#define ENET_SOCKET_NULL INVALID_SOCKET - -#define ENET_HOST_TO_NET_16(value) (htons (value)) -#define ENET_HOST_TO_NET_32(value) (htonl (value)) - -#define ENET_NET_TO_HOST_16(value) (ntohs (value)) -#define ENET_NET_TO_HOST_32(value) (ntohl (value)) - -typedef struct -{ - size_t dataLength; - void * data; -} ENetBuffer; - -#define ENET_CALLBACK __cdecl - -#ifdef ENET_DLL -#ifdef ENET_BUILDING_LIB -#define ENET_API __declspec( dllexport ) -#else -#define ENET_API __declspec( dllimport ) -#endif /* ENET_BUILDING_LIB */ -#else /* !ENET_DLL */ -#define ENET_API extern -#endif /* ENET_DLL */ - -typedef fd_set ENetSocketSet; - -#define ENET_SOCKETSET_EMPTY(sockset) FD_ZERO (& (sockset)) -#define ENET_SOCKETSET_ADD(sockset, socket) FD_SET (socket, & (sockset)) -#define ENET_SOCKETSET_REMOVE(sockset, socket) FD_CLR (socket, & (sockset)) -#define ENET_SOCKETSET_CHECK(sockset, socket) FD_ISSET (socket, & (sockset)) - -#endif /* __ENET_WIN32_H__ */ - - diff --git a/love/src/jni/love/src/libraries/enet/libenet/list.c b/love/src/jni/love/src/libraries/enet/libenet/list.c deleted file mode 100644 index 1c1a8dfa..00000000 --- a/love/src/jni/love/src/libraries/enet/libenet/list.c +++ /dev/null @@ -1,75 +0,0 @@ -/** - @file list.c - @brief ENet linked list functions -*/ -#define ENET_BUILDING_LIB 1 -#include "enet/enet.h" - -/** - @defgroup list ENet linked list utility functions - @ingroup private - @{ -*/ -void -enet_list_clear (ENetList * list) -{ - list -> sentinel.next = & list -> sentinel; - list -> sentinel.previous = & list -> sentinel; -} - -ENetListIterator -enet_list_insert (ENetListIterator position, void * data) -{ - ENetListIterator result = (ENetListIterator) data; - - result -> previous = position -> previous; - result -> next = position; - - result -> previous -> next = result; - position -> previous = result; - - return result; -} - -void * -enet_list_remove (ENetListIterator position) -{ - position -> previous -> next = position -> next; - position -> next -> previous = position -> previous; - - return position; -} - -ENetListIterator -enet_list_move (ENetListIterator position, void * dataFirst, void * dataLast) -{ - ENetListIterator first = (ENetListIterator) dataFirst, - last = (ENetListIterator) dataLast; - - first -> previous -> next = last -> next; - last -> next -> previous = first -> previous; - - first -> previous = position -> previous; - last -> next = position; - - first -> previous -> next = first; - position -> previous = last; - - return first; -} - -size_t -enet_list_size (ENetList * list) -{ - size_t size = 0; - ENetListIterator position; - - for (position = enet_list_begin (list); - position != enet_list_end (list); - position = enet_list_next (position)) - ++ size; - - return size; -} - -/** @} */ diff --git a/love/src/jni/love/src/libraries/enet/libenet/packet.c b/love/src/jni/love/src/libraries/enet/libenet/packet.c deleted file mode 100644 index 5fa78b28..00000000 --- a/love/src/jni/love/src/libraries/enet/libenet/packet.c +++ /dev/null @@ -1,165 +0,0 @@ -/** - @file packet.c - @brief ENet packet management functions -*/ -#include -#define ENET_BUILDING_LIB 1 -#include "enet/enet.h" - -/** @defgroup Packet ENet packet functions - @{ -*/ - -/** Creates a packet that may be sent to a peer. - @param data initial contents of the packet's data; the packet's data will remain uninitialized if data is NULL. - @param dataLength size of the data allocated for this packet - @param flags flags for this packet as described for the ENetPacket structure. - @returns the packet on success, NULL on failure -*/ -ENetPacket * -enet_packet_create (const void * data, size_t dataLength, enet_uint32 flags) -{ - ENetPacket * packet = (ENetPacket *) enet_malloc (sizeof (ENetPacket)); - if (packet == NULL) - return NULL; - - if (flags & ENET_PACKET_FLAG_NO_ALLOCATE) - packet -> data = (enet_uint8 *) data; - else - if (dataLength <= 0) - packet -> data = NULL; - else - { - packet -> data = (enet_uint8 *) enet_malloc (dataLength); - if (packet -> data == NULL) - { - enet_free (packet); - return NULL; - } - - if (data != NULL) - memcpy (packet -> data, data, dataLength); - } - - packet -> referenceCount = 0; - packet -> flags = flags; - packet -> dataLength = dataLength; - packet -> freeCallback = NULL; - packet -> userData = NULL; - - return packet; -} - -/** Destroys the packet and deallocates its data. - @param packet packet to be destroyed -*/ -void -enet_packet_destroy (ENetPacket * packet) -{ - if (packet == NULL) - return; - - if (packet -> freeCallback != NULL) - (* packet -> freeCallback) (packet); - if (! (packet -> flags & ENET_PACKET_FLAG_NO_ALLOCATE) && - packet -> data != NULL) - enet_free (packet -> data); - enet_free (packet); -} - -/** Attempts to resize the data in the packet to length specified in the - dataLength parameter - @param packet packet to resize - @param dataLength new size for the packet data - @returns 0 on success, < 0 on failure -*/ -int -enet_packet_resize (ENetPacket * packet, size_t dataLength) -{ - enet_uint8 * newData; - - if (dataLength <= packet -> dataLength || (packet -> flags & ENET_PACKET_FLAG_NO_ALLOCATE)) - { - packet -> dataLength = dataLength; - - return 0; - } - - newData = (enet_uint8 *) enet_malloc (dataLength); - if (newData == NULL) - return -1; - - memcpy (newData, packet -> data, packet -> dataLength); - enet_free (packet -> data); - - packet -> data = newData; - packet -> dataLength = dataLength; - - return 0; -} - -static int initializedCRC32 = 0; -static enet_uint32 crcTable [256]; - -static enet_uint32 -reflect_crc (int val, int bits) -{ - int result = 0, bit; - - for (bit = 0; bit < bits; bit ++) - { - if(val & 1) result |= 1 << (bits - 1 - bit); - val >>= 1; - } - - return result; -} - -static void -initialize_crc32 (void) -{ - int byte; - - for (byte = 0; byte < 256; ++ byte) - { - enet_uint32 crc = reflect_crc (byte, 8) << 24; - int offset; - - for(offset = 0; offset < 8; ++ offset) - { - if (crc & 0x80000000) - crc = (crc << 1) ^ 0x04c11db7; - else - crc <<= 1; - } - - crcTable [byte] = reflect_crc (crc, 32); - } - - initializedCRC32 = 1; -} - -enet_uint32 -enet_crc32 (const ENetBuffer * buffers, size_t bufferCount) -{ - enet_uint32 crc = 0xFFFFFFFF; - - if (! initializedCRC32) initialize_crc32 (); - - while (bufferCount -- > 0) - { - const enet_uint8 * data = (const enet_uint8 *) buffers -> data, - * dataEnd = & data [buffers -> dataLength]; - - while (data < dataEnd) - { - crc = (crc >> 8) ^ crcTable [(crc & 0xFF) ^ *data++]; - } - - ++ buffers; - } - - return ENET_HOST_TO_NET_32 (~ crc); -} - -/** @} */ diff --git a/love/src/jni/love/src/libraries/enet/libenet/peer.c b/love/src/jni/love/src/libraries/enet/libenet/peer.c deleted file mode 100644 index e2d0872b..00000000 --- a/love/src/jni/love/src/libraries/enet/libenet/peer.c +++ /dev/null @@ -1,1004 +0,0 @@ -/** - @file peer.c - @brief ENet peer management functions -*/ -#include -#define ENET_BUILDING_LIB 1 -#include "enet/enet.h" - -/** @defgroup peer ENet peer functions - @{ -*/ - -/** Configures throttle parameter for a peer. - - Unreliable packets are dropped by ENet in response to the varying conditions - of the Internet connection to the peer. The throttle represents a probability - that an unreliable packet should not be dropped and thus sent by ENet to the peer. - The lowest mean round trip time from the sending of a reliable packet to the - receipt of its acknowledgement is measured over an amount of time specified by - the interval parameter in milliseconds. If a measured round trip time happens to - be significantly less than the mean round trip time measured over the interval, - then the throttle probability is increased to allow more traffic by an amount - specified in the acceleration parameter, which is a ratio to the ENET_PEER_PACKET_THROTTLE_SCALE - constant. If a measured round trip time happens to be significantly greater than - the mean round trip time measured over the interval, then the throttle probability - is decreased to limit traffic by an amount specified in the deceleration parameter, which - is a ratio to the ENET_PEER_PACKET_THROTTLE_SCALE constant. When the throttle has - a value of ENET_PEER_PACKET_THROTTLE_SCALE, no unreliable packets are dropped by - ENet, and so 100% of all unreliable packets will be sent. When the throttle has a - value of 0, all unreliable packets are dropped by ENet, and so 0% of all unreliable - packets will be sent. Intermediate values for the throttle represent intermediate - probabilities between 0% and 100% of unreliable packets being sent. The bandwidth - limits of the local and foreign hosts are taken into account to determine a - sensible limit for the throttle probability above which it should not raise even in - the best of conditions. - - @param peer peer to configure - @param interval interval, in milliseconds, over which to measure lowest mean RTT; the default value is ENET_PEER_PACKET_THROTTLE_INTERVAL. - @param acceleration rate at which to increase the throttle probability as mean RTT declines - @param deceleration rate at which to decrease the throttle probability as mean RTT increases -*/ -void -enet_peer_throttle_configure (ENetPeer * peer, enet_uint32 interval, enet_uint32 acceleration, enet_uint32 deceleration) -{ - ENetProtocol command; - - peer -> packetThrottleInterval = interval; - peer -> packetThrottleAcceleration = acceleration; - peer -> packetThrottleDeceleration = deceleration; - - command.header.command = ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; - command.header.channelID = 0xFF; - - command.throttleConfigure.packetThrottleInterval = ENET_HOST_TO_NET_32 (interval); - command.throttleConfigure.packetThrottleAcceleration = ENET_HOST_TO_NET_32 (acceleration); - command.throttleConfigure.packetThrottleDeceleration = ENET_HOST_TO_NET_32 (deceleration); - - enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0); -} - -int -enet_peer_throttle (ENetPeer * peer, enet_uint32 rtt) -{ - if (peer -> lastRoundTripTime <= peer -> lastRoundTripTimeVariance) - { - peer -> packetThrottle = peer -> packetThrottleLimit; - } - else - if (rtt < peer -> lastRoundTripTime) - { - peer -> packetThrottle += peer -> packetThrottleAcceleration; - - if (peer -> packetThrottle > peer -> packetThrottleLimit) - peer -> packetThrottle = peer -> packetThrottleLimit; - - return 1; - } - else - if (rtt > peer -> lastRoundTripTime + 2 * peer -> lastRoundTripTimeVariance) - { - if (peer -> packetThrottle > peer -> packetThrottleDeceleration) - peer -> packetThrottle -= peer -> packetThrottleDeceleration; - else - peer -> packetThrottle = 0; - - return -1; - } - - return 0; -} - -/** Queues a packet to be sent. - @param peer destination for the packet - @param channelID channel on which to send - @param packet packet to send - @retval 0 on success - @retval < 0 on failure -*/ -int -enet_peer_send (ENetPeer * peer, enet_uint8 channelID, ENetPacket * packet) -{ - ENetChannel * channel = & peer -> channels [channelID]; - ENetProtocol command; - size_t fragmentLength; - - if (peer -> state != ENET_PEER_STATE_CONNECTED || - channelID >= peer -> channelCount || - packet -> dataLength > peer -> host -> maximumPacketSize) - return -1; - - fragmentLength = peer -> mtu - sizeof (ENetProtocolHeader) - sizeof (ENetProtocolSendFragment); - if (peer -> host -> checksum != NULL) - fragmentLength -= sizeof(enet_uint32); - - if (packet -> dataLength > fragmentLength) - { - enet_uint32 fragmentCount = (packet -> dataLength + fragmentLength - 1) / fragmentLength, - fragmentNumber, - fragmentOffset; - enet_uint8 commandNumber; - enet_uint16 startSequenceNumber; - ENetList fragments; - ENetOutgoingCommand * fragment; - - if (fragmentCount > ENET_PROTOCOL_MAXIMUM_FRAGMENT_COUNT) - return -1; - - if ((packet -> flags & (ENET_PACKET_FLAG_RELIABLE | ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT)) == ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT && - channel -> outgoingUnreliableSequenceNumber < 0xFFFF) - { - commandNumber = ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE_FRAGMENT; - startSequenceNumber = ENET_HOST_TO_NET_16 (channel -> outgoingUnreliableSequenceNumber + 1); - } - else - { - commandNumber = ENET_PROTOCOL_COMMAND_SEND_FRAGMENT | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; - startSequenceNumber = ENET_HOST_TO_NET_16 (channel -> outgoingReliableSequenceNumber + 1); - } - - enet_list_clear (& fragments); - - for (fragmentNumber = 0, - fragmentOffset = 0; - fragmentOffset < packet -> dataLength; - ++ fragmentNumber, - fragmentOffset += fragmentLength) - { - if (packet -> dataLength - fragmentOffset < fragmentLength) - fragmentLength = packet -> dataLength - fragmentOffset; - - fragment = (ENetOutgoingCommand *) enet_malloc (sizeof (ENetOutgoingCommand)); - if (fragment == NULL) - { - while (! enet_list_empty (& fragments)) - { - fragment = (ENetOutgoingCommand *) enet_list_remove (enet_list_begin (& fragments)); - - enet_free (fragment); - } - - return -1; - } - - fragment -> fragmentOffset = fragmentOffset; - fragment -> fragmentLength = fragmentLength; - fragment -> packet = packet; - fragment -> command.header.command = commandNumber; - fragment -> command.header.channelID = channelID; - fragment -> command.sendFragment.startSequenceNumber = startSequenceNumber; - fragment -> command.sendFragment.dataLength = ENET_HOST_TO_NET_16 (fragmentLength); - fragment -> command.sendFragment.fragmentCount = ENET_HOST_TO_NET_32 (fragmentCount); - fragment -> command.sendFragment.fragmentNumber = ENET_HOST_TO_NET_32 (fragmentNumber); - fragment -> command.sendFragment.totalLength = ENET_HOST_TO_NET_32 (packet -> dataLength); - fragment -> command.sendFragment.fragmentOffset = ENET_NET_TO_HOST_32 (fragmentOffset); - - enet_list_insert (enet_list_end (& fragments), fragment); - } - - packet -> referenceCount += fragmentNumber; - - while (! enet_list_empty (& fragments)) - { - fragment = (ENetOutgoingCommand *) enet_list_remove (enet_list_begin (& fragments)); - - enet_peer_setup_outgoing_command (peer, fragment); - } - - return 0; - } - - command.header.channelID = channelID; - - if ((packet -> flags & (ENET_PACKET_FLAG_RELIABLE | ENET_PACKET_FLAG_UNSEQUENCED)) == ENET_PACKET_FLAG_UNSEQUENCED) - { - command.header.command = ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED | ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED; - command.sendUnsequenced.dataLength = ENET_HOST_TO_NET_16 (packet -> dataLength); - } - else - if (packet -> flags & ENET_PACKET_FLAG_RELIABLE || channel -> outgoingUnreliableSequenceNumber >= 0xFFFF) - { - command.header.command = ENET_PROTOCOL_COMMAND_SEND_RELIABLE | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; - command.sendReliable.dataLength = ENET_HOST_TO_NET_16 (packet -> dataLength); - } - else - { - command.header.command = ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE; - command.sendUnreliable.dataLength = ENET_HOST_TO_NET_16 (packet -> dataLength); - } - - if (enet_peer_queue_outgoing_command (peer, & command, packet, 0, packet -> dataLength) == NULL) - return -1; - - return 0; -} - -/** Attempts to dequeue any incoming queued packet. - @param peer peer to dequeue packets from - @param channelID holds the channel ID of the channel the packet was received on success - @returns a pointer to the packet, or NULL if there are no available incoming queued packets -*/ -ENetPacket * -enet_peer_receive (ENetPeer * peer, enet_uint8 * channelID) -{ - ENetIncomingCommand * incomingCommand; - ENetPacket * packet; - - if (enet_list_empty (& peer -> dispatchedCommands)) - return NULL; - - incomingCommand = (ENetIncomingCommand *) enet_list_remove (enet_list_begin (& peer -> dispatchedCommands)); - - if (channelID != NULL) - * channelID = incomingCommand -> command.header.channelID; - - packet = incomingCommand -> packet; - - -- packet -> referenceCount; - - if (incomingCommand -> fragments != NULL) - enet_free (incomingCommand -> fragments); - - enet_free (incomingCommand); - - peer -> totalWaitingData -= packet -> dataLength; - - return packet; -} - -static void -enet_peer_reset_outgoing_commands (ENetList * queue) -{ - ENetOutgoingCommand * outgoingCommand; - - while (! enet_list_empty (queue)) - { - outgoingCommand = (ENetOutgoingCommand *) enet_list_remove (enet_list_begin (queue)); - - if (outgoingCommand -> packet != NULL) - { - -- outgoingCommand -> packet -> referenceCount; - - if (outgoingCommand -> packet -> referenceCount == 0) - enet_packet_destroy (outgoingCommand -> packet); - } - - enet_free (outgoingCommand); - } -} - -static void -enet_peer_remove_incoming_commands (ENetList * queue, ENetListIterator startCommand, ENetListIterator endCommand) -{ - ENetListIterator currentCommand; - - for (currentCommand = startCommand; currentCommand != endCommand; ) - { - ENetIncomingCommand * incomingCommand = (ENetIncomingCommand *) currentCommand; - - currentCommand = enet_list_next (currentCommand); - - enet_list_remove (& incomingCommand -> incomingCommandList); - - if (incomingCommand -> packet != NULL) - { - -- incomingCommand -> packet -> referenceCount; - - if (incomingCommand -> packet -> referenceCount == 0) - enet_packet_destroy (incomingCommand -> packet); - } - - if (incomingCommand -> fragments != NULL) - enet_free (incomingCommand -> fragments); - - enet_free (incomingCommand); - } -} - -static void -enet_peer_reset_incoming_commands (ENetList * queue) -{ - enet_peer_remove_incoming_commands(queue, enet_list_begin (queue), enet_list_end (queue)); -} - -void -enet_peer_reset_queues (ENetPeer * peer) -{ - ENetChannel * channel; - - if (peer -> needsDispatch) - { - enet_list_remove (& peer -> dispatchList); - - peer -> needsDispatch = 0; - } - - while (! enet_list_empty (& peer -> acknowledgements)) - enet_free (enet_list_remove (enet_list_begin (& peer -> acknowledgements))); - - enet_peer_reset_outgoing_commands (& peer -> sentReliableCommands); - enet_peer_reset_outgoing_commands (& peer -> sentUnreliableCommands); - enet_peer_reset_outgoing_commands (& peer -> outgoingReliableCommands); - enet_peer_reset_outgoing_commands (& peer -> outgoingUnreliableCommands); - enet_peer_reset_incoming_commands (& peer -> dispatchedCommands); - - if (peer -> channels != NULL && peer -> channelCount > 0) - { - for (channel = peer -> channels; - channel < & peer -> channels [peer -> channelCount]; - ++ channel) - { - enet_peer_reset_incoming_commands (& channel -> incomingReliableCommands); - enet_peer_reset_incoming_commands (& channel -> incomingUnreliableCommands); - } - - enet_free (peer -> channels); - } - - peer -> channels = NULL; - peer -> channelCount = 0; -} - -void -enet_peer_on_connect (ENetPeer * peer) -{ - if (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) - { - if (peer -> incomingBandwidth != 0) - ++ peer -> host -> bandwidthLimitedPeers; - - ++ peer -> host -> connectedPeers; - } -} - -void -enet_peer_on_disconnect (ENetPeer * peer) -{ - if (peer -> state == ENET_PEER_STATE_CONNECTED || peer -> state == ENET_PEER_STATE_DISCONNECT_LATER) - { - if (peer -> incomingBandwidth != 0) - -- peer -> host -> bandwidthLimitedPeers; - - -- peer -> host -> connectedPeers; - } -} - -/** Forcefully disconnects a peer. - @param peer peer to forcefully disconnect - @remarks The foreign host represented by the peer is not notified of the disconnection and will timeout - on its connection to the local host. -*/ -void -enet_peer_reset (ENetPeer * peer) -{ - enet_peer_on_disconnect (peer); - - peer -> outgoingPeerID = ENET_PROTOCOL_MAXIMUM_PEER_ID; - peer -> connectID = 0; - - peer -> state = ENET_PEER_STATE_DISCONNECTED; - - peer -> incomingBandwidth = 0; - peer -> outgoingBandwidth = 0; - peer -> incomingBandwidthThrottleEpoch = 0; - peer -> outgoingBandwidthThrottleEpoch = 0; - peer -> incomingDataTotal = 0; - peer -> outgoingDataTotal = 0; - peer -> lastSendTime = 0; - peer -> lastReceiveTime = 0; - peer -> nextTimeout = 0; - peer -> earliestTimeout = 0; - peer -> packetLossEpoch = 0; - peer -> packetsSent = 0; - peer -> packetsLost = 0; - peer -> packetLoss = 0; - peer -> packetLossVariance = 0; - peer -> packetThrottle = ENET_PEER_DEFAULT_PACKET_THROTTLE; - peer -> packetThrottleLimit = ENET_PEER_PACKET_THROTTLE_SCALE; - peer -> packetThrottleCounter = 0; - peer -> packetThrottleEpoch = 0; - peer -> packetThrottleAcceleration = ENET_PEER_PACKET_THROTTLE_ACCELERATION; - peer -> packetThrottleDeceleration = ENET_PEER_PACKET_THROTTLE_DECELERATION; - peer -> packetThrottleInterval = ENET_PEER_PACKET_THROTTLE_INTERVAL; - peer -> pingInterval = ENET_PEER_PING_INTERVAL; - peer -> timeoutLimit = ENET_PEER_TIMEOUT_LIMIT; - peer -> timeoutMinimum = ENET_PEER_TIMEOUT_MINIMUM; - peer -> timeoutMaximum = ENET_PEER_TIMEOUT_MAXIMUM; - peer -> lastRoundTripTime = ENET_PEER_DEFAULT_ROUND_TRIP_TIME; - peer -> lowestRoundTripTime = ENET_PEER_DEFAULT_ROUND_TRIP_TIME; - peer -> lastRoundTripTimeVariance = 0; - peer -> highestRoundTripTimeVariance = 0; - peer -> roundTripTime = ENET_PEER_DEFAULT_ROUND_TRIP_TIME; - peer -> roundTripTimeVariance = 0; - peer -> mtu = peer -> host -> mtu; - peer -> reliableDataInTransit = 0; - peer -> outgoingReliableSequenceNumber = 0; - peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; - peer -> incomingUnsequencedGroup = 0; - peer -> outgoingUnsequencedGroup = 0; - peer -> eventData = 0; - peer -> totalWaitingData = 0; - - memset (peer -> unsequencedWindow, 0, sizeof (peer -> unsequencedWindow)); - - enet_peer_reset_queues (peer); -} - -/** Sends a ping request to a peer. - @param peer destination for the ping request - @remarks ping requests factor into the mean round trip time as designated by the - roundTripTime field in the ENetPeer structure. ENet automatically pings all connected - peers at regular intervals, however, this function may be called to ensure more - frequent ping requests. -*/ -void -enet_peer_ping (ENetPeer * peer) -{ - ENetProtocol command; - - if (peer -> state != ENET_PEER_STATE_CONNECTED) - return; - - command.header.command = ENET_PROTOCOL_COMMAND_PING | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; - command.header.channelID = 0xFF; - - enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0); -} - -/** Sets the interval at which pings will be sent to a peer. - - Pings are used both to monitor the liveness of the connection and also to dynamically - adjust the throttle during periods of low traffic so that the throttle has reasonable - responsiveness during traffic spikes. - - @param peer the peer to adjust - @param pingInterval the interval at which to send pings; defaults to ENET_PEER_PING_INTERVAL if 0 -*/ -void -enet_peer_ping_interval (ENetPeer * peer, enet_uint32 pingInterval) -{ - peer -> pingInterval = pingInterval ? pingInterval : ENET_PEER_PING_INTERVAL; -} - -/** Sets the timeout parameters for a peer. - - The timeout parameter control how and when a peer will timeout from a failure to acknowledge - reliable traffic. Timeout values use an exponential backoff mechanism, where if a reliable - packet is not acknowledge within some multiple of the average RTT plus a variance tolerance, - the timeout will be doubled until it reaches a set limit. If the timeout is thus at this - limit and reliable packets have been sent but not acknowledged within a certain minimum time - period, the peer will be disconnected. Alternatively, if reliable packets have been sent - but not acknowledged for a certain maximum time period, the peer will be disconnected regardless - of the current timeout limit value. - - @param peer the peer to adjust - @param timeoutLimit the timeout limit; defaults to ENET_PEER_TIMEOUT_LIMIT if 0 - @param timeoutMinimum the timeout minimum; defaults to ENET_PEER_TIMEOUT_MINIMUM if 0 - @param timeoutMaximum the timeout maximum; defaults to ENET_PEER_TIMEOUT_MAXIMUM if 0 -*/ - -void -enet_peer_timeout (ENetPeer * peer, enet_uint32 timeoutLimit, enet_uint32 timeoutMinimum, enet_uint32 timeoutMaximum) -{ - peer -> timeoutLimit = timeoutLimit ? timeoutLimit : ENET_PEER_TIMEOUT_LIMIT; - peer -> timeoutMinimum = timeoutMinimum ? timeoutMinimum : ENET_PEER_TIMEOUT_MINIMUM; - peer -> timeoutMaximum = timeoutMaximum ? timeoutMaximum : ENET_PEER_TIMEOUT_MAXIMUM; -} - -/** Force an immediate disconnection from a peer. - @param peer peer to disconnect - @param data data describing the disconnection - @remarks No ENET_EVENT_DISCONNECT event will be generated. The foreign peer is not - guaranteed to receive the disconnect notification, and is reset immediately upon - return from this function. -*/ -void -enet_peer_disconnect_now (ENetPeer * peer, enet_uint32 data) -{ - ENetProtocol command; - - if (peer -> state == ENET_PEER_STATE_DISCONNECTED) - return; - - if (peer -> state != ENET_PEER_STATE_ZOMBIE && - peer -> state != ENET_PEER_STATE_DISCONNECTING) - { - enet_peer_reset_queues (peer); - - command.header.command = ENET_PROTOCOL_COMMAND_DISCONNECT | ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED; - command.header.channelID = 0xFF; - command.disconnect.data = ENET_HOST_TO_NET_32 (data); - - enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0); - - enet_host_flush (peer -> host); - } - - enet_peer_reset (peer); -} - -/** Request a disconnection from a peer. - @param peer peer to request a disconnection - @param data data describing the disconnection - @remarks An ENET_EVENT_DISCONNECT event will be generated by enet_host_service() - once the disconnection is complete. -*/ -void -enet_peer_disconnect (ENetPeer * peer, enet_uint32 data) -{ - ENetProtocol command; - - if (peer -> state == ENET_PEER_STATE_DISCONNECTING || - peer -> state == ENET_PEER_STATE_DISCONNECTED || - peer -> state == ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT || - peer -> state == ENET_PEER_STATE_ZOMBIE) - return; - - enet_peer_reset_queues (peer); - - command.header.command = ENET_PROTOCOL_COMMAND_DISCONNECT; - command.header.channelID = 0xFF; - command.disconnect.data = ENET_HOST_TO_NET_32 (data); - - if (peer -> state == ENET_PEER_STATE_CONNECTED || peer -> state == ENET_PEER_STATE_DISCONNECT_LATER) - command.header.command |= ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; - else - command.header.command |= ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED; - - enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0); - - if (peer -> state == ENET_PEER_STATE_CONNECTED || peer -> state == ENET_PEER_STATE_DISCONNECT_LATER) - { - enet_peer_on_disconnect (peer); - - peer -> state = ENET_PEER_STATE_DISCONNECTING; - } - else - { - enet_host_flush (peer -> host); - enet_peer_reset (peer); - } -} - -/** Request a disconnection from a peer, but only after all queued outgoing packets are sent. - @param peer peer to request a disconnection - @param data data describing the disconnection - @remarks An ENET_EVENT_DISCONNECT event will be generated by enet_host_service() - once the disconnection is complete. -*/ -void -enet_peer_disconnect_later (ENetPeer * peer, enet_uint32 data) -{ - if ((peer -> state == ENET_PEER_STATE_CONNECTED || peer -> state == ENET_PEER_STATE_DISCONNECT_LATER) && - ! (enet_list_empty (& peer -> outgoingReliableCommands) && - enet_list_empty (& peer -> outgoingUnreliableCommands) && - enet_list_empty (& peer -> sentReliableCommands))) - { - peer -> state = ENET_PEER_STATE_DISCONNECT_LATER; - peer -> eventData = data; - } - else - enet_peer_disconnect (peer, data); -} - -ENetAcknowledgement * -enet_peer_queue_acknowledgement (ENetPeer * peer, const ENetProtocol * command, enet_uint16 sentTime) -{ - ENetAcknowledgement * acknowledgement; - - if (command -> header.channelID < peer -> channelCount) - { - ENetChannel * channel = & peer -> channels [command -> header.channelID]; - enet_uint16 reliableWindow = command -> header.reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE, - currentWindow = channel -> incomingReliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; - - if (command -> header.reliableSequenceNumber < channel -> incomingReliableSequenceNumber) - reliableWindow += ENET_PEER_RELIABLE_WINDOWS; - - if (reliableWindow >= currentWindow + ENET_PEER_FREE_RELIABLE_WINDOWS - 1 && reliableWindow <= currentWindow + ENET_PEER_FREE_RELIABLE_WINDOWS) - return NULL; - } - - acknowledgement = (ENetAcknowledgement *) enet_malloc (sizeof (ENetAcknowledgement)); - if (acknowledgement == NULL) - return NULL; - - peer -> outgoingDataTotal += sizeof (ENetProtocolAcknowledge); - - acknowledgement -> sentTime = sentTime; - acknowledgement -> command = * command; - - enet_list_insert (enet_list_end (& peer -> acknowledgements), acknowledgement); - - return acknowledgement; -} - -void -enet_peer_setup_outgoing_command (ENetPeer * peer, ENetOutgoingCommand * outgoingCommand) -{ - ENetChannel * channel = & peer -> channels [outgoingCommand -> command.header.channelID]; - - peer -> outgoingDataTotal += enet_protocol_command_size (outgoingCommand -> command.header.command) + outgoingCommand -> fragmentLength; - - if (outgoingCommand -> command.header.channelID == 0xFF) - { - ++ peer -> outgoingReliableSequenceNumber; - - outgoingCommand -> reliableSequenceNumber = peer -> outgoingReliableSequenceNumber; - outgoingCommand -> unreliableSequenceNumber = 0; - } - else - if (outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE) - { - ++ channel -> outgoingReliableSequenceNumber; - channel -> outgoingUnreliableSequenceNumber = 0; - - outgoingCommand -> reliableSequenceNumber = channel -> outgoingReliableSequenceNumber; - outgoingCommand -> unreliableSequenceNumber = 0; - } - else - if (outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED) - { - ++ peer -> outgoingUnsequencedGroup; - - outgoingCommand -> reliableSequenceNumber = 0; - outgoingCommand -> unreliableSequenceNumber = 0; - } - else - { - if (outgoingCommand -> fragmentOffset == 0) - ++ channel -> outgoingUnreliableSequenceNumber; - - outgoingCommand -> reliableSequenceNumber = channel -> outgoingReliableSequenceNumber; - outgoingCommand -> unreliableSequenceNumber = channel -> outgoingUnreliableSequenceNumber; - } - - outgoingCommand -> sendAttempts = 0; - outgoingCommand -> sentTime = 0; - outgoingCommand -> roundTripTimeout = 0; - outgoingCommand -> roundTripTimeoutLimit = 0; - outgoingCommand -> command.header.reliableSequenceNumber = ENET_HOST_TO_NET_16 (outgoingCommand -> reliableSequenceNumber); - - switch (outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK) - { - case ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE: - outgoingCommand -> command.sendUnreliable.unreliableSequenceNumber = ENET_HOST_TO_NET_16 (outgoingCommand -> unreliableSequenceNumber); - break; - - case ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED: - outgoingCommand -> command.sendUnsequenced.unsequencedGroup = ENET_HOST_TO_NET_16 (peer -> outgoingUnsequencedGroup); - break; - - default: - break; - } - - if (outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE) - enet_list_insert (enet_list_end (& peer -> outgoingReliableCommands), outgoingCommand); - else - enet_list_insert (enet_list_end (& peer -> outgoingUnreliableCommands), outgoingCommand); -} - -ENetOutgoingCommand * -enet_peer_queue_outgoing_command (ENetPeer * peer, const ENetProtocol * command, ENetPacket * packet, enet_uint32 offset, enet_uint16 length) -{ - ENetOutgoingCommand * outgoingCommand = (ENetOutgoingCommand *) enet_malloc (sizeof (ENetOutgoingCommand)); - if (outgoingCommand == NULL) - return NULL; - - outgoingCommand -> command = * command; - outgoingCommand -> fragmentOffset = offset; - outgoingCommand -> fragmentLength = length; - outgoingCommand -> packet = packet; - if (packet != NULL) - ++ packet -> referenceCount; - - enet_peer_setup_outgoing_command (peer, outgoingCommand); - - return outgoingCommand; -} - -void -enet_peer_dispatch_incoming_unreliable_commands (ENetPeer * peer, ENetChannel * channel) -{ - ENetListIterator droppedCommand, startCommand, currentCommand; - - for (droppedCommand = startCommand = currentCommand = enet_list_begin (& channel -> incomingUnreliableCommands); - currentCommand != enet_list_end (& channel -> incomingUnreliableCommands); - currentCommand = enet_list_next (currentCommand)) - { - ENetIncomingCommand * incomingCommand = (ENetIncomingCommand *) currentCommand; - - if ((incomingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK) == ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED) - continue; - - if (incomingCommand -> reliableSequenceNumber == channel -> incomingReliableSequenceNumber) - { - if (incomingCommand -> fragmentsRemaining <= 0) - { - channel -> incomingUnreliableSequenceNumber = incomingCommand -> unreliableSequenceNumber; - continue; - } - - if (startCommand != currentCommand) - { - enet_list_move (enet_list_end (& peer -> dispatchedCommands), startCommand, enet_list_previous (currentCommand)); - - if (! peer -> needsDispatch) - { - enet_list_insert (enet_list_end (& peer -> host -> dispatchQueue), & peer -> dispatchList); - - peer -> needsDispatch = 1; - } - - droppedCommand = currentCommand; - } - else - if (droppedCommand != currentCommand) - droppedCommand = enet_list_previous (currentCommand); - } - else - { - enet_uint16 reliableWindow = incomingCommand -> reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE, - currentWindow = channel -> incomingReliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; - if (incomingCommand -> reliableSequenceNumber < channel -> incomingReliableSequenceNumber) - reliableWindow += ENET_PEER_RELIABLE_WINDOWS; - if (reliableWindow >= currentWindow && reliableWindow < currentWindow + ENET_PEER_FREE_RELIABLE_WINDOWS - 1) - break; - - droppedCommand = enet_list_next (currentCommand); - - if (startCommand != currentCommand) - { - enet_list_move (enet_list_end (& peer -> dispatchedCommands), startCommand, enet_list_previous (currentCommand)); - - if (! peer -> needsDispatch) - { - enet_list_insert (enet_list_end (& peer -> host -> dispatchQueue), & peer -> dispatchList); - - peer -> needsDispatch = 1; - } - } - } - - startCommand = enet_list_next (currentCommand); - } - - if (startCommand != currentCommand) - { - enet_list_move (enet_list_end (& peer -> dispatchedCommands), startCommand, enet_list_previous (currentCommand)); - - if (! peer -> needsDispatch) - { - enet_list_insert (enet_list_end (& peer -> host -> dispatchQueue), & peer -> dispatchList); - - peer -> needsDispatch = 1; - } - - droppedCommand = currentCommand; - } - - enet_peer_remove_incoming_commands (& channel -> incomingUnreliableCommands, enet_list_begin (& channel -> incomingUnreliableCommands), droppedCommand); -} - -void -enet_peer_dispatch_incoming_reliable_commands (ENetPeer * peer, ENetChannel * channel) -{ - ENetListIterator currentCommand; - - for (currentCommand = enet_list_begin (& channel -> incomingReliableCommands); - currentCommand != enet_list_end (& channel -> incomingReliableCommands); - currentCommand = enet_list_next (currentCommand)) - { - ENetIncomingCommand * incomingCommand = (ENetIncomingCommand *) currentCommand; - - if (incomingCommand -> fragmentsRemaining > 0 || - incomingCommand -> reliableSequenceNumber != (enet_uint16) (channel -> incomingReliableSequenceNumber + 1)) - break; - - channel -> incomingReliableSequenceNumber = incomingCommand -> reliableSequenceNumber; - - if (incomingCommand -> fragmentCount > 0) - channel -> incomingReliableSequenceNumber += incomingCommand -> fragmentCount - 1; - } - - if (currentCommand == enet_list_begin (& channel -> incomingReliableCommands)) - return; - - channel -> incomingUnreliableSequenceNumber = 0; - - enet_list_move (enet_list_end (& peer -> dispatchedCommands), enet_list_begin (& channel -> incomingReliableCommands), enet_list_previous (currentCommand)); - - if (! peer -> needsDispatch) - { - enet_list_insert (enet_list_end (& peer -> host -> dispatchQueue), & peer -> dispatchList); - - peer -> needsDispatch = 1; - } - - if (! enet_list_empty (& channel -> incomingUnreliableCommands)) - enet_peer_dispatch_incoming_unreliable_commands (peer, channel); -} - -ENetIncomingCommand * -enet_peer_queue_incoming_command (ENetPeer * peer, const ENetProtocol * command, const void * data, size_t dataLength, enet_uint32 flags, enet_uint32 fragmentCount) -{ - static ENetIncomingCommand dummyCommand; - - ENetChannel * channel = & peer -> channels [command -> header.channelID]; - enet_uint32 unreliableSequenceNumber = 0, reliableSequenceNumber = 0; - enet_uint16 reliableWindow, currentWindow; - ENetIncomingCommand * incomingCommand; - ENetListIterator currentCommand; - ENetPacket * packet = NULL; - - if (peer -> state == ENET_PEER_STATE_DISCONNECT_LATER) - goto discardCommand; - - if ((command -> header.command & ENET_PROTOCOL_COMMAND_MASK) != ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED) - { - reliableSequenceNumber = command -> header.reliableSequenceNumber; - reliableWindow = reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; - currentWindow = channel -> incomingReliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; - - if (reliableSequenceNumber < channel -> incomingReliableSequenceNumber) - reliableWindow += ENET_PEER_RELIABLE_WINDOWS; - - if (reliableWindow < currentWindow || reliableWindow >= currentWindow + ENET_PEER_FREE_RELIABLE_WINDOWS - 1) - goto discardCommand; - } - - switch (command -> header.command & ENET_PROTOCOL_COMMAND_MASK) - { - case ENET_PROTOCOL_COMMAND_SEND_FRAGMENT: - case ENET_PROTOCOL_COMMAND_SEND_RELIABLE: - if (reliableSequenceNumber == channel -> incomingReliableSequenceNumber) - goto discardCommand; - - for (currentCommand = enet_list_previous (enet_list_end (& channel -> incomingReliableCommands)); - currentCommand != enet_list_end (& channel -> incomingReliableCommands); - currentCommand = enet_list_previous (currentCommand)) - { - incomingCommand = (ENetIncomingCommand *) currentCommand; - - if (reliableSequenceNumber >= channel -> incomingReliableSequenceNumber) - { - if (incomingCommand -> reliableSequenceNumber < channel -> incomingReliableSequenceNumber) - continue; - } - else - if (incomingCommand -> reliableSequenceNumber >= channel -> incomingReliableSequenceNumber) - break; - - if (incomingCommand -> reliableSequenceNumber <= reliableSequenceNumber) - { - if (incomingCommand -> reliableSequenceNumber < reliableSequenceNumber) - break; - - goto discardCommand; - } - } - break; - - case ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE: - case ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE_FRAGMENT: - unreliableSequenceNumber = ENET_NET_TO_HOST_16 (command -> sendUnreliable.unreliableSequenceNumber); - - if (reliableSequenceNumber == channel -> incomingReliableSequenceNumber && - unreliableSequenceNumber <= channel -> incomingUnreliableSequenceNumber) - goto discardCommand; - - for (currentCommand = enet_list_previous (enet_list_end (& channel -> incomingUnreliableCommands)); - currentCommand != enet_list_end (& channel -> incomingUnreliableCommands); - currentCommand = enet_list_previous (currentCommand)) - { - incomingCommand = (ENetIncomingCommand *) currentCommand; - - if ((command -> header.command & ENET_PROTOCOL_COMMAND_MASK) == ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED) - continue; - - if (reliableSequenceNumber >= channel -> incomingReliableSequenceNumber) - { - if (incomingCommand -> reliableSequenceNumber < channel -> incomingReliableSequenceNumber) - continue; - } - else - if (incomingCommand -> reliableSequenceNumber >= channel -> incomingReliableSequenceNumber) - break; - - if (incomingCommand -> reliableSequenceNumber < reliableSequenceNumber) - break; - - if (incomingCommand -> reliableSequenceNumber > reliableSequenceNumber) - continue; - - if (incomingCommand -> unreliableSequenceNumber <= unreliableSequenceNumber) - { - if (incomingCommand -> unreliableSequenceNumber < unreliableSequenceNumber) - break; - - goto discardCommand; - } - } - break; - - case ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED: - currentCommand = enet_list_end (& channel -> incomingUnreliableCommands); - break; - - default: - goto discardCommand; - } - - if (peer -> totalWaitingData >= peer -> host -> maximumWaitingData) - goto notifyError; - - packet = enet_packet_create (data, dataLength, flags); - if (packet == NULL) - goto notifyError; - - incomingCommand = (ENetIncomingCommand *) enet_malloc (sizeof (ENetIncomingCommand)); - if (incomingCommand == NULL) - goto notifyError; - - incomingCommand -> reliableSequenceNumber = command -> header.reliableSequenceNumber; - incomingCommand -> unreliableSequenceNumber = unreliableSequenceNumber & 0xFFFF; - incomingCommand -> command = * command; - incomingCommand -> fragmentCount = fragmentCount; - incomingCommand -> fragmentsRemaining = fragmentCount; - incomingCommand -> packet = packet; - incomingCommand -> fragments = NULL; - - if (fragmentCount > 0) - { - if (fragmentCount <= ENET_PROTOCOL_MAXIMUM_FRAGMENT_COUNT) - incomingCommand -> fragments = (enet_uint32 *) enet_malloc ((fragmentCount + 31) / 32 * sizeof (enet_uint32)); - if (incomingCommand -> fragments == NULL) - { - enet_free (incomingCommand); - - goto notifyError; - } - memset (incomingCommand -> fragments, 0, (fragmentCount + 31) / 32 * sizeof (enet_uint32)); - } - - if (packet != NULL) - { - ++ packet -> referenceCount; - - peer -> totalWaitingData += packet -> dataLength; - } - - enet_list_insert (enet_list_next (currentCommand), incomingCommand); - - switch (command -> header.command & ENET_PROTOCOL_COMMAND_MASK) - { - case ENET_PROTOCOL_COMMAND_SEND_FRAGMENT: - case ENET_PROTOCOL_COMMAND_SEND_RELIABLE: - enet_peer_dispatch_incoming_reliable_commands (peer, channel); - break; - - default: - enet_peer_dispatch_incoming_unreliable_commands (peer, channel); - break; - } - - return incomingCommand; - -discardCommand: - if (fragmentCount > 0) - goto notifyError; - - if (packet != NULL && packet -> referenceCount == 0) - enet_packet_destroy (packet); - - return & dummyCommand; - -notifyError: - if (packet != NULL && packet -> referenceCount == 0) - enet_packet_destroy (packet); - - return NULL; -} - -/** @} */ diff --git a/love/src/jni/love/src/libraries/enet/libenet/protocol.c b/love/src/jni/love/src/libraries/enet/libenet/protocol.c deleted file mode 100644 index 29d64873..00000000 --- a/love/src/jni/love/src/libraries/enet/libenet/protocol.c +++ /dev/null @@ -1,1913 +0,0 @@ -/** - @file protocol.c - @brief ENet protocol functions -*/ -#include -#include -#define ENET_BUILDING_LIB 1 -#include "enet/utility.h" -#include "enet/time.h" -#include "enet/enet.h" - -static size_t commandSizes [ENET_PROTOCOL_COMMAND_COUNT] = -{ - 0, - sizeof (ENetProtocolAcknowledge), - sizeof (ENetProtocolConnect), - sizeof (ENetProtocolVerifyConnect), - sizeof (ENetProtocolDisconnect), - sizeof (ENetProtocolPing), - sizeof (ENetProtocolSendReliable), - sizeof (ENetProtocolSendUnreliable), - sizeof (ENetProtocolSendFragment), - sizeof (ENetProtocolSendUnsequenced), - sizeof (ENetProtocolBandwidthLimit), - sizeof (ENetProtocolThrottleConfigure), - sizeof (ENetProtocolSendFragment) -}; - -size_t -enet_protocol_command_size (enet_uint8 commandNumber) -{ - return commandSizes [commandNumber & ENET_PROTOCOL_COMMAND_MASK]; -} - -static void -enet_protocol_change_state (ENetHost * host, ENetPeer * peer, ENetPeerState state) -{ - if (state == ENET_PEER_STATE_CONNECTED || state == ENET_PEER_STATE_DISCONNECT_LATER) - enet_peer_on_connect (peer); - else - enet_peer_on_disconnect (peer); - - peer -> state = state; -} - -static void -enet_protocol_dispatch_state (ENetHost * host, ENetPeer * peer, ENetPeerState state) -{ - enet_protocol_change_state (host, peer, state); - - if (! peer -> needsDispatch) - { - enet_list_insert (enet_list_end (& host -> dispatchQueue), & peer -> dispatchList); - - peer -> needsDispatch = 1; - } -} - -static int -enet_protocol_dispatch_incoming_commands (ENetHost * host, ENetEvent * event) -{ - while (! enet_list_empty (& host -> dispatchQueue)) - { - ENetPeer * peer = (ENetPeer *) enet_list_remove (enet_list_begin (& host -> dispatchQueue)); - - peer -> needsDispatch = 0; - - switch (peer -> state) - { - case ENET_PEER_STATE_CONNECTION_PENDING: - case ENET_PEER_STATE_CONNECTION_SUCCEEDED: - enet_protocol_change_state (host, peer, ENET_PEER_STATE_CONNECTED); - - event -> type = ENET_EVENT_TYPE_CONNECT; - event -> peer = peer; - event -> data = peer -> eventData; - - return 1; - - case ENET_PEER_STATE_ZOMBIE: - host -> recalculateBandwidthLimits = 1; - - event -> type = ENET_EVENT_TYPE_DISCONNECT; - event -> peer = peer; - event -> data = peer -> eventData; - - enet_peer_reset (peer); - - return 1; - - case ENET_PEER_STATE_CONNECTED: - if (enet_list_empty (& peer -> dispatchedCommands)) - continue; - - event -> packet = enet_peer_receive (peer, & event -> channelID); - if (event -> packet == NULL) - continue; - - event -> type = ENET_EVENT_TYPE_RECEIVE; - event -> peer = peer; - - if (! enet_list_empty (& peer -> dispatchedCommands)) - { - peer -> needsDispatch = 1; - - enet_list_insert (enet_list_end (& host -> dispatchQueue), & peer -> dispatchList); - } - - return 1; - - default: - break; - } - } - - return 0; -} - -static void -enet_protocol_notify_connect (ENetHost * host, ENetPeer * peer, ENetEvent * event) -{ - host -> recalculateBandwidthLimits = 1; - - if (event != NULL) - { - enet_protocol_change_state (host, peer, ENET_PEER_STATE_CONNECTED); - - event -> type = ENET_EVENT_TYPE_CONNECT; - event -> peer = peer; - event -> data = peer -> eventData; - } - else - enet_protocol_dispatch_state (host, peer, peer -> state == ENET_PEER_STATE_CONNECTING ? ENET_PEER_STATE_CONNECTION_SUCCEEDED : ENET_PEER_STATE_CONNECTION_PENDING); -} - -static void -enet_protocol_notify_disconnect (ENetHost * host, ENetPeer * peer, ENetEvent * event) -{ - if (peer -> state >= ENET_PEER_STATE_CONNECTION_PENDING) - host -> recalculateBandwidthLimits = 1; - - if (peer -> state != ENET_PEER_STATE_CONNECTING && peer -> state < ENET_PEER_STATE_CONNECTION_SUCCEEDED) - enet_peer_reset (peer); - else - if (event != NULL) - { - event -> type = ENET_EVENT_TYPE_DISCONNECT; - event -> peer = peer; - event -> data = 0; - - enet_peer_reset (peer); - } - else - { - peer -> eventData = 0; - - enet_protocol_dispatch_state (host, peer, ENET_PEER_STATE_ZOMBIE); - } -} - -static void -enet_protocol_remove_sent_unreliable_commands (ENetPeer * peer) -{ - ENetOutgoingCommand * outgoingCommand; - - while (! enet_list_empty (& peer -> sentUnreliableCommands)) - { - outgoingCommand = (ENetOutgoingCommand *) enet_list_front (& peer -> sentUnreliableCommands); - - enet_list_remove (& outgoingCommand -> outgoingCommandList); - - if (outgoingCommand -> packet != NULL) - { - -- outgoingCommand -> packet -> referenceCount; - - if (outgoingCommand -> packet -> referenceCount == 0) - { - outgoingCommand -> packet -> flags |= ENET_PACKET_FLAG_SENT; - - enet_packet_destroy (outgoingCommand -> packet); - } - } - - enet_free (outgoingCommand); - } -} - -static ENetProtocolCommand -enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliableSequenceNumber, enet_uint8 channelID) -{ - ENetOutgoingCommand * outgoingCommand = NULL; - ENetListIterator currentCommand; - ENetProtocolCommand commandNumber; - int wasSent = 1; - - for (currentCommand = enet_list_begin (& peer -> sentReliableCommands); - currentCommand != enet_list_end (& peer -> sentReliableCommands); - currentCommand = enet_list_next (currentCommand)) - { - outgoingCommand = (ENetOutgoingCommand *) currentCommand; - - if (outgoingCommand -> reliableSequenceNumber == reliableSequenceNumber && - outgoingCommand -> command.header.channelID == channelID) - break; - } - - if (currentCommand == enet_list_end (& peer -> sentReliableCommands)) - { - for (currentCommand = enet_list_begin (& peer -> outgoingReliableCommands); - currentCommand != enet_list_end (& peer -> outgoingReliableCommands); - currentCommand = enet_list_next (currentCommand)) - { - outgoingCommand = (ENetOutgoingCommand *) currentCommand; - - if (outgoingCommand -> sendAttempts < 1) return ENET_PROTOCOL_COMMAND_NONE; - - if (outgoingCommand -> reliableSequenceNumber == reliableSequenceNumber && - outgoingCommand -> command.header.channelID == channelID) - break; - } - - if (currentCommand == enet_list_end (& peer -> outgoingReliableCommands)) - return ENET_PROTOCOL_COMMAND_NONE; - - wasSent = 0; - } - - if (outgoingCommand == NULL) - return ENET_PROTOCOL_COMMAND_NONE; - - if (channelID < peer -> channelCount) - { - ENetChannel * channel = & peer -> channels [channelID]; - enet_uint16 reliableWindow = reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; - if (channel -> reliableWindows [reliableWindow] > 0) - { - -- channel -> reliableWindows [reliableWindow]; - if (! channel -> reliableWindows [reliableWindow]) - channel -> usedReliableWindows &= ~ (1 << reliableWindow); - } - } - - commandNumber = (ENetProtocolCommand) (outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK); - - enet_list_remove (& outgoingCommand -> outgoingCommandList); - - if (outgoingCommand -> packet != NULL) - { - if (wasSent) - peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength; - - -- outgoingCommand -> packet -> referenceCount; - - if (outgoingCommand -> packet -> referenceCount == 0) - { - outgoingCommand -> packet -> flags |= ENET_PACKET_FLAG_SENT; - - enet_packet_destroy (outgoingCommand -> packet); - } - } - - enet_free (outgoingCommand); - - if (enet_list_empty (& peer -> sentReliableCommands)) - return commandNumber; - - outgoingCommand = (ENetOutgoingCommand *) enet_list_front (& peer -> sentReliableCommands); - - peer -> nextTimeout = outgoingCommand -> sentTime + outgoingCommand -> roundTripTimeout; - - return commandNumber; -} - -static ENetPeer * -enet_protocol_handle_connect (ENetHost * host, ENetProtocolHeader * header, ENetProtocol * command) -{ - enet_uint8 incomingSessionID, outgoingSessionID; - enet_uint32 mtu, windowSize; - ENetChannel * channel; - size_t channelCount, duplicatePeers = 0; - ENetPeer * currentPeer, * peer = NULL; - ENetProtocol verifyCommand; - - channelCount = ENET_NET_TO_HOST_32 (command -> connect.channelCount); - - if (channelCount < ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT || - channelCount > ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT) - return NULL; - - for (currentPeer = host -> peers; - currentPeer < & host -> peers [host -> peerCount]; - ++ currentPeer) - { - if (currentPeer -> state == ENET_PEER_STATE_DISCONNECTED) - { - if (peer == NULL) - peer = currentPeer; - } - else - if (currentPeer -> state != ENET_PEER_STATE_CONNECTING && - currentPeer -> address.host == host -> receivedAddress.host) - { - if (currentPeer -> address.port == host -> receivedAddress.port && - currentPeer -> connectID == command -> connect.connectID) - return NULL; - - ++ duplicatePeers; - } - } - - if (peer == NULL || duplicatePeers >= host -> duplicatePeers) - return NULL; - - if (channelCount > host -> channelLimit) - channelCount = host -> channelLimit; - peer -> channels = (ENetChannel *) enet_malloc (channelCount * sizeof (ENetChannel)); - if (peer -> channels == NULL) - return NULL; - peer -> channelCount = channelCount; - peer -> state = ENET_PEER_STATE_ACKNOWLEDGING_CONNECT; - peer -> connectID = command -> connect.connectID; - peer -> address = host -> receivedAddress; - peer -> outgoingPeerID = ENET_NET_TO_HOST_16 (command -> connect.outgoingPeerID); - peer -> incomingBandwidth = ENET_NET_TO_HOST_32 (command -> connect.incomingBandwidth); - peer -> outgoingBandwidth = ENET_NET_TO_HOST_32 (command -> connect.outgoingBandwidth); - peer -> packetThrottleInterval = ENET_NET_TO_HOST_32 (command -> connect.packetThrottleInterval); - peer -> packetThrottleAcceleration = ENET_NET_TO_HOST_32 (command -> connect.packetThrottleAcceleration); - peer -> packetThrottleDeceleration = ENET_NET_TO_HOST_32 (command -> connect.packetThrottleDeceleration); - peer -> eventData = ENET_NET_TO_HOST_32 (command -> connect.data); - - incomingSessionID = command -> connect.incomingSessionID == 0xFF ? peer -> outgoingSessionID : command -> connect.incomingSessionID; - incomingSessionID = (incomingSessionID + 1) & (ENET_PROTOCOL_HEADER_SESSION_MASK >> ENET_PROTOCOL_HEADER_SESSION_SHIFT); - if (incomingSessionID == peer -> outgoingSessionID) - incomingSessionID = (incomingSessionID + 1) & (ENET_PROTOCOL_HEADER_SESSION_MASK >> ENET_PROTOCOL_HEADER_SESSION_SHIFT); - peer -> outgoingSessionID = incomingSessionID; - - outgoingSessionID = command -> connect.outgoingSessionID == 0xFF ? peer -> incomingSessionID : command -> connect.outgoingSessionID; - outgoingSessionID = (outgoingSessionID + 1) & (ENET_PROTOCOL_HEADER_SESSION_MASK >> ENET_PROTOCOL_HEADER_SESSION_SHIFT); - if (outgoingSessionID == peer -> incomingSessionID) - outgoingSessionID = (outgoingSessionID + 1) & (ENET_PROTOCOL_HEADER_SESSION_MASK >> ENET_PROTOCOL_HEADER_SESSION_SHIFT); - peer -> incomingSessionID = outgoingSessionID; - - for (channel = peer -> channels; - channel < & peer -> channels [channelCount]; - ++ channel) - { - channel -> outgoingReliableSequenceNumber = 0; - channel -> outgoingUnreliableSequenceNumber = 0; - channel -> incomingReliableSequenceNumber = 0; - channel -> incomingUnreliableSequenceNumber = 0; - - enet_list_clear (& channel -> incomingReliableCommands); - enet_list_clear (& channel -> incomingUnreliableCommands); - - channel -> usedReliableWindows = 0; - memset (channel -> reliableWindows, 0, sizeof (channel -> reliableWindows)); - } - - mtu = ENET_NET_TO_HOST_32 (command -> connect.mtu); - - if (mtu < ENET_PROTOCOL_MINIMUM_MTU) - mtu = ENET_PROTOCOL_MINIMUM_MTU; - else - if (mtu > ENET_PROTOCOL_MAXIMUM_MTU) - mtu = ENET_PROTOCOL_MAXIMUM_MTU; - - peer -> mtu = mtu; - - if (host -> outgoingBandwidth == 0 && - peer -> incomingBandwidth == 0) - peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; - else - if (host -> outgoingBandwidth == 0 || - peer -> incomingBandwidth == 0) - peer -> windowSize = (ENET_MAX (host -> outgoingBandwidth, peer -> incomingBandwidth) / - ENET_PEER_WINDOW_SIZE_SCALE) * - ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; - else - peer -> windowSize = (ENET_MIN (host -> outgoingBandwidth, peer -> incomingBandwidth) / - ENET_PEER_WINDOW_SIZE_SCALE) * - ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; - - if (peer -> windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE) - peer -> windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; - else - if (peer -> windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE) - peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; - - if (host -> incomingBandwidth == 0) - windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; - else - windowSize = (host -> incomingBandwidth / ENET_PEER_WINDOW_SIZE_SCALE) * - ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; - - if (windowSize > ENET_NET_TO_HOST_32 (command -> connect.windowSize)) - windowSize = ENET_NET_TO_HOST_32 (command -> connect.windowSize); - - if (windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE) - windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; - else - if (windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE) - windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; - - verifyCommand.header.command = ENET_PROTOCOL_COMMAND_VERIFY_CONNECT | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; - verifyCommand.header.channelID = 0xFF; - verifyCommand.verifyConnect.outgoingPeerID = ENET_HOST_TO_NET_16 (peer -> incomingPeerID); - verifyCommand.verifyConnect.incomingSessionID = incomingSessionID; - verifyCommand.verifyConnect.outgoingSessionID = outgoingSessionID; - verifyCommand.verifyConnect.mtu = ENET_HOST_TO_NET_32 (peer -> mtu); - verifyCommand.verifyConnect.windowSize = ENET_HOST_TO_NET_32 (windowSize); - verifyCommand.verifyConnect.channelCount = ENET_HOST_TO_NET_32 (channelCount); - verifyCommand.verifyConnect.incomingBandwidth = ENET_HOST_TO_NET_32 (host -> incomingBandwidth); - verifyCommand.verifyConnect.outgoingBandwidth = ENET_HOST_TO_NET_32 (host -> outgoingBandwidth); - verifyCommand.verifyConnect.packetThrottleInterval = ENET_HOST_TO_NET_32 (peer -> packetThrottleInterval); - verifyCommand.verifyConnect.packetThrottleAcceleration = ENET_HOST_TO_NET_32 (peer -> packetThrottleAcceleration); - verifyCommand.verifyConnect.packetThrottleDeceleration = ENET_HOST_TO_NET_32 (peer -> packetThrottleDeceleration); - verifyCommand.verifyConnect.connectID = peer -> connectID; - - enet_peer_queue_outgoing_command (peer, & verifyCommand, NULL, 0, 0); - - return peer; -} - -static int -enet_protocol_handle_send_reliable (ENetHost * host, ENetPeer * peer, const ENetProtocol * command, enet_uint8 ** currentData) -{ - size_t dataLength; - - if (command -> header.channelID >= peer -> channelCount || - (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER)) - return -1; - - dataLength = ENET_NET_TO_HOST_16 (command -> sendReliable.dataLength); - * currentData += dataLength; - if (dataLength > host -> maximumPacketSize || - * currentData < host -> receivedData || - * currentData > & host -> receivedData [host -> receivedDataLength]) - return -1; - - if (enet_peer_queue_incoming_command (peer, command, (const enet_uint8 *) command + sizeof (ENetProtocolSendReliable), dataLength, ENET_PACKET_FLAG_RELIABLE, 0) == NULL) - return -1; - - return 0; -} - -static int -enet_protocol_handle_send_unsequenced (ENetHost * host, ENetPeer * peer, const ENetProtocol * command, enet_uint8 ** currentData) -{ - enet_uint32 unsequencedGroup, index; - size_t dataLength; - - if (command -> header.channelID >= peer -> channelCount || - (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER)) - return -1; - - dataLength = ENET_NET_TO_HOST_16 (command -> sendUnsequenced.dataLength); - * currentData += dataLength; - if (dataLength > host -> maximumPacketSize || - * currentData < host -> receivedData || - * currentData > & host -> receivedData [host -> receivedDataLength]) - return -1; - - unsequencedGroup = ENET_NET_TO_HOST_16 (command -> sendUnsequenced.unsequencedGroup); - index = unsequencedGroup % ENET_PEER_UNSEQUENCED_WINDOW_SIZE; - - if (unsequencedGroup < peer -> incomingUnsequencedGroup) - unsequencedGroup += 0x10000; - - if (unsequencedGroup >= (enet_uint32) peer -> incomingUnsequencedGroup + ENET_PEER_FREE_UNSEQUENCED_WINDOWS * ENET_PEER_UNSEQUENCED_WINDOW_SIZE) - return 0; - - unsequencedGroup &= 0xFFFF; - - if (unsequencedGroup - index != peer -> incomingUnsequencedGroup) - { - peer -> incomingUnsequencedGroup = unsequencedGroup - index; - - memset (peer -> unsequencedWindow, 0, sizeof (peer -> unsequencedWindow)); - } - else - if (peer -> unsequencedWindow [index / 32] & (1 << (index % 32))) - return 0; - - if (enet_peer_queue_incoming_command (peer, command, (const enet_uint8 *) command + sizeof (ENetProtocolSendUnsequenced), dataLength, ENET_PACKET_FLAG_UNSEQUENCED, 0) == NULL) - return -1; - - peer -> unsequencedWindow [index / 32] |= 1 << (index % 32); - - return 0; -} - -static int -enet_protocol_handle_send_unreliable (ENetHost * host, ENetPeer * peer, const ENetProtocol * command, enet_uint8 ** currentData) -{ - size_t dataLength; - - if (command -> header.channelID >= peer -> channelCount || - (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER)) - return -1; - - dataLength = ENET_NET_TO_HOST_16 (command -> sendUnreliable.dataLength); - * currentData += dataLength; - if (dataLength > host -> maximumPacketSize || - * currentData < host -> receivedData || - * currentData > & host -> receivedData [host -> receivedDataLength]) - return -1; - - if (enet_peer_queue_incoming_command (peer, command, (const enet_uint8 *) command + sizeof (ENetProtocolSendUnreliable), dataLength, 0, 0) == NULL) - return -1; - - return 0; -} - -static int -enet_protocol_handle_send_fragment (ENetHost * host, ENetPeer * peer, const ENetProtocol * command, enet_uint8 ** currentData) -{ - enet_uint32 fragmentNumber, - fragmentCount, - fragmentOffset, - fragmentLength, - startSequenceNumber, - totalLength; - ENetChannel * channel; - enet_uint16 startWindow, currentWindow; - ENetListIterator currentCommand; - ENetIncomingCommand * startCommand = NULL; - - if (command -> header.channelID >= peer -> channelCount || - (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER)) - return -1; - - fragmentLength = ENET_NET_TO_HOST_16 (command -> sendFragment.dataLength); - * currentData += fragmentLength; - if (fragmentLength > host -> maximumPacketSize || - * currentData < host -> receivedData || - * currentData > & host -> receivedData [host -> receivedDataLength]) - return -1; - - channel = & peer -> channels [command -> header.channelID]; - startSequenceNumber = ENET_NET_TO_HOST_16 (command -> sendFragment.startSequenceNumber); - startWindow = startSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; - currentWindow = channel -> incomingReliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; - - if (startSequenceNumber < channel -> incomingReliableSequenceNumber) - startWindow += ENET_PEER_RELIABLE_WINDOWS; - - if (startWindow < currentWindow || startWindow >= currentWindow + ENET_PEER_FREE_RELIABLE_WINDOWS - 1) - return 0; - - fragmentNumber = ENET_NET_TO_HOST_32 (command -> sendFragment.fragmentNumber); - fragmentCount = ENET_NET_TO_HOST_32 (command -> sendFragment.fragmentCount); - fragmentOffset = ENET_NET_TO_HOST_32 (command -> sendFragment.fragmentOffset); - totalLength = ENET_NET_TO_HOST_32 (command -> sendFragment.totalLength); - - if (fragmentCount > ENET_PROTOCOL_MAXIMUM_FRAGMENT_COUNT || - fragmentNumber >= fragmentCount || - totalLength > host -> maximumPacketSize || - fragmentOffset >= totalLength || - fragmentLength > totalLength - fragmentOffset) - return -1; - - for (currentCommand = enet_list_previous (enet_list_end (& channel -> incomingReliableCommands)); - currentCommand != enet_list_end (& channel -> incomingReliableCommands); - currentCommand = enet_list_previous (currentCommand)) - { - ENetIncomingCommand * incomingCommand = (ENetIncomingCommand *) currentCommand; - - if (startSequenceNumber >= channel -> incomingReliableSequenceNumber) - { - if (incomingCommand -> reliableSequenceNumber < channel -> incomingReliableSequenceNumber) - continue; - } - else - if (incomingCommand -> reliableSequenceNumber >= channel -> incomingReliableSequenceNumber) - break; - - if (incomingCommand -> reliableSequenceNumber <= startSequenceNumber) - { - if (incomingCommand -> reliableSequenceNumber < startSequenceNumber) - break; - - if ((incomingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK) != ENET_PROTOCOL_COMMAND_SEND_FRAGMENT || - totalLength != incomingCommand -> packet -> dataLength || - fragmentCount != incomingCommand -> fragmentCount) - return -1; - - startCommand = incomingCommand; - break; - } - } - - if (startCommand == NULL) - { - ENetProtocol hostCommand = * command; - - hostCommand.header.reliableSequenceNumber = startSequenceNumber; - - startCommand = enet_peer_queue_incoming_command (peer, & hostCommand, NULL, totalLength, ENET_PACKET_FLAG_RELIABLE, fragmentCount); - if (startCommand == NULL) - return -1; - } - - if ((startCommand -> fragments [fragmentNumber / 32] & (1 << (fragmentNumber % 32))) == 0) - { - -- startCommand -> fragmentsRemaining; - - startCommand -> fragments [fragmentNumber / 32] |= (1 << (fragmentNumber % 32)); - - if (fragmentOffset + fragmentLength > startCommand -> packet -> dataLength) - fragmentLength = startCommand -> packet -> dataLength - fragmentOffset; - - memcpy (startCommand -> packet -> data + fragmentOffset, - (enet_uint8 *) command + sizeof (ENetProtocolSendFragment), - fragmentLength); - - if (startCommand -> fragmentsRemaining <= 0) - enet_peer_dispatch_incoming_reliable_commands (peer, channel); - } - - return 0; -} - -static int -enet_protocol_handle_send_unreliable_fragment (ENetHost * host, ENetPeer * peer, const ENetProtocol * command, enet_uint8 ** currentData) -{ - enet_uint32 fragmentNumber, - fragmentCount, - fragmentOffset, - fragmentLength, - reliableSequenceNumber, - startSequenceNumber, - totalLength; - enet_uint16 reliableWindow, currentWindow; - ENetChannel * channel; - ENetListIterator currentCommand; - ENetIncomingCommand * startCommand = NULL; - - if (command -> header.channelID >= peer -> channelCount || - (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER)) - return -1; - - fragmentLength = ENET_NET_TO_HOST_16 (command -> sendFragment.dataLength); - * currentData += fragmentLength; - if (fragmentLength > host -> maximumPacketSize || - * currentData < host -> receivedData || - * currentData > & host -> receivedData [host -> receivedDataLength]) - return -1; - - channel = & peer -> channels [command -> header.channelID]; - reliableSequenceNumber = command -> header.reliableSequenceNumber; - startSequenceNumber = ENET_NET_TO_HOST_16 (command -> sendFragment.startSequenceNumber); - - reliableWindow = reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; - currentWindow = channel -> incomingReliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; - - if (reliableSequenceNumber < channel -> incomingReliableSequenceNumber) - reliableWindow += ENET_PEER_RELIABLE_WINDOWS; - - if (reliableWindow < currentWindow || reliableWindow >= currentWindow + ENET_PEER_FREE_RELIABLE_WINDOWS - 1) - return 0; - - if (reliableSequenceNumber == channel -> incomingReliableSequenceNumber && - startSequenceNumber <= channel -> incomingUnreliableSequenceNumber) - return 0; - - fragmentNumber = ENET_NET_TO_HOST_32 (command -> sendFragment.fragmentNumber); - fragmentCount = ENET_NET_TO_HOST_32 (command -> sendFragment.fragmentCount); - fragmentOffset = ENET_NET_TO_HOST_32 (command -> sendFragment.fragmentOffset); - totalLength = ENET_NET_TO_HOST_32 (command -> sendFragment.totalLength); - - if (fragmentCount > ENET_PROTOCOL_MAXIMUM_FRAGMENT_COUNT || - fragmentNumber >= fragmentCount || - totalLength > host -> maximumPacketSize || - fragmentOffset >= totalLength || - fragmentLength > totalLength - fragmentOffset) - return -1; - - for (currentCommand = enet_list_previous (enet_list_end (& channel -> incomingUnreliableCommands)); - currentCommand != enet_list_end (& channel -> incomingUnreliableCommands); - currentCommand = enet_list_previous (currentCommand)) - { - ENetIncomingCommand * incomingCommand = (ENetIncomingCommand *) currentCommand; - - if (reliableSequenceNumber >= channel -> incomingReliableSequenceNumber) - { - if (incomingCommand -> reliableSequenceNumber < channel -> incomingReliableSequenceNumber) - continue; - } - else - if (incomingCommand -> reliableSequenceNumber >= channel -> incomingReliableSequenceNumber) - break; - - if (incomingCommand -> reliableSequenceNumber < reliableSequenceNumber) - break; - - if (incomingCommand -> reliableSequenceNumber > reliableSequenceNumber) - continue; - - if (incomingCommand -> unreliableSequenceNumber <= startSequenceNumber) - { - if (incomingCommand -> unreliableSequenceNumber < startSequenceNumber) - break; - - if ((incomingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK) != ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE_FRAGMENT || - totalLength != incomingCommand -> packet -> dataLength || - fragmentCount != incomingCommand -> fragmentCount) - return -1; - - startCommand = incomingCommand; - break; - } - } - - if (startCommand == NULL) - { - startCommand = enet_peer_queue_incoming_command (peer, command, NULL, totalLength, ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT, fragmentCount); - if (startCommand == NULL) - return -1; - } - - if ((startCommand -> fragments [fragmentNumber / 32] & (1 << (fragmentNumber % 32))) == 0) - { - -- startCommand -> fragmentsRemaining; - - startCommand -> fragments [fragmentNumber / 32] |= (1 << (fragmentNumber % 32)); - - if (fragmentOffset + fragmentLength > startCommand -> packet -> dataLength) - fragmentLength = startCommand -> packet -> dataLength - fragmentOffset; - - memcpy (startCommand -> packet -> data + fragmentOffset, - (enet_uint8 *) command + sizeof (ENetProtocolSendFragment), - fragmentLength); - - if (startCommand -> fragmentsRemaining <= 0) - enet_peer_dispatch_incoming_unreliable_commands (peer, channel); - } - - return 0; -} - -static int -enet_protocol_handle_ping (ENetHost * host, ENetPeer * peer, const ENetProtocol * command) -{ - if (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) - return -1; - - return 0; -} - -static int -enet_protocol_handle_bandwidth_limit (ENetHost * host, ENetPeer * peer, const ENetProtocol * command) -{ - if (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) - return -1; - - if (peer -> incomingBandwidth != 0) - -- host -> bandwidthLimitedPeers; - - peer -> incomingBandwidth = ENET_NET_TO_HOST_32 (command -> bandwidthLimit.incomingBandwidth); - peer -> outgoingBandwidth = ENET_NET_TO_HOST_32 (command -> bandwidthLimit.outgoingBandwidth); - - if (peer -> incomingBandwidth != 0) - ++ host -> bandwidthLimitedPeers; - - if (peer -> incomingBandwidth == 0 && host -> outgoingBandwidth == 0) - peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; - else - if (peer -> incomingBandwidth == 0 || host -> outgoingBandwidth == 0) - peer -> windowSize = (ENET_MAX (peer -> incomingBandwidth, host -> outgoingBandwidth) / - ENET_PEER_WINDOW_SIZE_SCALE) * ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; - else - peer -> windowSize = (ENET_MIN (peer -> incomingBandwidth, host -> outgoingBandwidth) / - ENET_PEER_WINDOW_SIZE_SCALE) * ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; - - if (peer -> windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE) - peer -> windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; - else - if (peer -> windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE) - peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; - - return 0; -} - -static int -enet_protocol_handle_throttle_configure (ENetHost * host, ENetPeer * peer, const ENetProtocol * command) -{ - if (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) - return -1; - - peer -> packetThrottleInterval = ENET_NET_TO_HOST_32 (command -> throttleConfigure.packetThrottleInterval); - peer -> packetThrottleAcceleration = ENET_NET_TO_HOST_32 (command -> throttleConfigure.packetThrottleAcceleration); - peer -> packetThrottleDeceleration = ENET_NET_TO_HOST_32 (command -> throttleConfigure.packetThrottleDeceleration); - - return 0; -} - -static int -enet_protocol_handle_disconnect (ENetHost * host, ENetPeer * peer, const ENetProtocol * command) -{ - if (peer -> state == ENET_PEER_STATE_DISCONNECTED || peer -> state == ENET_PEER_STATE_ZOMBIE || peer -> state == ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT) - return 0; - - enet_peer_reset_queues (peer); - - if (peer -> state == ENET_PEER_STATE_CONNECTION_SUCCEEDED || peer -> state == ENET_PEER_STATE_DISCONNECTING || peer -> state == ENET_PEER_STATE_CONNECTING) - enet_protocol_dispatch_state (host, peer, ENET_PEER_STATE_ZOMBIE); - else - if (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) - { - if (peer -> state == ENET_PEER_STATE_CONNECTION_PENDING) host -> recalculateBandwidthLimits = 1; - - enet_peer_reset (peer); - } - else - if (command -> header.command & ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE) - enet_protocol_change_state (host, peer, ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT); - else - enet_protocol_dispatch_state (host, peer, ENET_PEER_STATE_ZOMBIE); - - if (peer -> state != ENET_PEER_STATE_DISCONNECTED) - peer -> eventData = ENET_NET_TO_HOST_32 (command -> disconnect.data); - - return 0; -} - -static int -enet_protocol_handle_acknowledge (ENetHost * host, ENetEvent * event, ENetPeer * peer, const ENetProtocol * command) -{ - enet_uint32 roundTripTime, - receivedSentTime, - receivedReliableSequenceNumber; - ENetProtocolCommand commandNumber; - - if (peer -> state == ENET_PEER_STATE_DISCONNECTED || peer -> state == ENET_PEER_STATE_ZOMBIE) - return 0; - - receivedSentTime = ENET_NET_TO_HOST_16 (command -> acknowledge.receivedSentTime); - receivedSentTime |= host -> serviceTime & 0xFFFF0000; - if ((receivedSentTime & 0x8000) > (host -> serviceTime & 0x8000)) - receivedSentTime -= 0x10000; - - if (ENET_TIME_LESS (host -> serviceTime, receivedSentTime)) - return 0; - - peer -> lastReceiveTime = host -> serviceTime; - peer -> earliestTimeout = 0; - - roundTripTime = ENET_TIME_DIFFERENCE (host -> serviceTime, receivedSentTime); - - enet_peer_throttle (peer, roundTripTime); - - peer -> roundTripTimeVariance -= peer -> roundTripTimeVariance / 4; - - if (roundTripTime >= peer -> roundTripTime) - { - peer -> roundTripTime += (roundTripTime - peer -> roundTripTime) / 8; - peer -> roundTripTimeVariance += (roundTripTime - peer -> roundTripTime) / 4; - } - else - { - peer -> roundTripTime -= (peer -> roundTripTime - roundTripTime) / 8; - peer -> roundTripTimeVariance += (peer -> roundTripTime - roundTripTime) / 4; - } - - if (peer -> roundTripTime < peer -> lowestRoundTripTime) - peer -> lowestRoundTripTime = peer -> roundTripTime; - - if (peer -> roundTripTimeVariance > peer -> highestRoundTripTimeVariance) - peer -> highestRoundTripTimeVariance = peer -> roundTripTimeVariance; - - if (peer -> packetThrottleEpoch == 0 || - ENET_TIME_DIFFERENCE (host -> serviceTime, peer -> packetThrottleEpoch) >= peer -> packetThrottleInterval) - { - peer -> lastRoundTripTime = peer -> lowestRoundTripTime; - peer -> lastRoundTripTimeVariance = peer -> highestRoundTripTimeVariance; - peer -> lowestRoundTripTime = peer -> roundTripTime; - peer -> highestRoundTripTimeVariance = peer -> roundTripTimeVariance; - peer -> packetThrottleEpoch = host -> serviceTime; - } - - receivedReliableSequenceNumber = ENET_NET_TO_HOST_16 (command -> acknowledge.receivedReliableSequenceNumber); - - commandNumber = enet_protocol_remove_sent_reliable_command (peer, receivedReliableSequenceNumber, command -> header.channelID); - - switch (peer -> state) - { - case ENET_PEER_STATE_ACKNOWLEDGING_CONNECT: - if (commandNumber != ENET_PROTOCOL_COMMAND_VERIFY_CONNECT) - return -1; - - enet_protocol_notify_connect (host, peer, event); - break; - - case ENET_PEER_STATE_DISCONNECTING: - if (commandNumber != ENET_PROTOCOL_COMMAND_DISCONNECT) - return -1; - - enet_protocol_notify_disconnect (host, peer, event); - break; - - case ENET_PEER_STATE_DISCONNECT_LATER: - if (enet_list_empty (& peer -> outgoingReliableCommands) && - enet_list_empty (& peer -> outgoingUnreliableCommands) && - enet_list_empty (& peer -> sentReliableCommands)) - enet_peer_disconnect (peer, peer -> eventData); - break; - - default: - break; - } - - return 0; -} - -static int -enet_protocol_handle_verify_connect (ENetHost * host, ENetEvent * event, ENetPeer * peer, const ENetProtocol * command) -{ - enet_uint32 mtu, windowSize; - size_t channelCount; - - if (peer -> state != ENET_PEER_STATE_CONNECTING) - return 0; - - channelCount = ENET_NET_TO_HOST_32 (command -> verifyConnect.channelCount); - - if (channelCount < ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT || channelCount > ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT || - ENET_NET_TO_HOST_32 (command -> verifyConnect.packetThrottleInterval) != peer -> packetThrottleInterval || - ENET_NET_TO_HOST_32 (command -> verifyConnect.packetThrottleAcceleration) != peer -> packetThrottleAcceleration || - ENET_NET_TO_HOST_32 (command -> verifyConnect.packetThrottleDeceleration) != peer -> packetThrottleDeceleration || - command -> verifyConnect.connectID != peer -> connectID) - { - peer -> eventData = 0; - - enet_protocol_dispatch_state (host, peer, ENET_PEER_STATE_ZOMBIE); - - return -1; - } - - enet_protocol_remove_sent_reliable_command (peer, 1, 0xFF); - - if (channelCount < peer -> channelCount) - peer -> channelCount = channelCount; - - peer -> outgoingPeerID = ENET_NET_TO_HOST_16 (command -> verifyConnect.outgoingPeerID); - peer -> incomingSessionID = command -> verifyConnect.incomingSessionID; - peer -> outgoingSessionID = command -> verifyConnect.outgoingSessionID; - - mtu = ENET_NET_TO_HOST_32 (command -> verifyConnect.mtu); - - if (mtu < ENET_PROTOCOL_MINIMUM_MTU) - mtu = ENET_PROTOCOL_MINIMUM_MTU; - else - if (mtu > ENET_PROTOCOL_MAXIMUM_MTU) - mtu = ENET_PROTOCOL_MAXIMUM_MTU; - - if (mtu < peer -> mtu) - peer -> mtu = mtu; - - windowSize = ENET_NET_TO_HOST_32 (command -> verifyConnect.windowSize); - - if (windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE) - windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; - - if (windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE) - windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; - - if (windowSize < peer -> windowSize) - peer -> windowSize = windowSize; - - peer -> incomingBandwidth = ENET_NET_TO_HOST_32 (command -> verifyConnect.incomingBandwidth); - peer -> outgoingBandwidth = ENET_NET_TO_HOST_32 (command -> verifyConnect.outgoingBandwidth); - - enet_protocol_notify_connect (host, peer, event); - return 0; -} - -static int -enet_protocol_handle_incoming_commands (ENetHost * host, ENetEvent * event) -{ - ENetProtocolHeader * header; - ENetProtocol * command; - ENetPeer * peer; - enet_uint8 * currentData; - size_t headerSize; - enet_uint16 peerID, flags; - enet_uint8 sessionID; - - if (host -> receivedDataLength < (size_t) & ((ENetProtocolHeader *) 0) -> sentTime) - return 0; - - header = (ENetProtocolHeader *) host -> receivedData; - - peerID = ENET_NET_TO_HOST_16 (header -> peerID); - sessionID = (peerID & ENET_PROTOCOL_HEADER_SESSION_MASK) >> ENET_PROTOCOL_HEADER_SESSION_SHIFT; - flags = peerID & ENET_PROTOCOL_HEADER_FLAG_MASK; - peerID &= ~ (ENET_PROTOCOL_HEADER_FLAG_MASK | ENET_PROTOCOL_HEADER_SESSION_MASK); - - headerSize = (flags & ENET_PROTOCOL_HEADER_FLAG_SENT_TIME ? sizeof (ENetProtocolHeader) : (size_t) & ((ENetProtocolHeader *) 0) -> sentTime); - if (host -> checksum != NULL) - headerSize += sizeof (enet_uint32); - - if (peerID == ENET_PROTOCOL_MAXIMUM_PEER_ID) - peer = NULL; - else - if (peerID >= host -> peerCount) - return 0; - else - { - peer = & host -> peers [peerID]; - - if (peer -> state == ENET_PEER_STATE_DISCONNECTED || - peer -> state == ENET_PEER_STATE_ZOMBIE || - ((host -> receivedAddress.host != peer -> address.host || - host -> receivedAddress.port != peer -> address.port) && - peer -> address.host != ENET_HOST_BROADCAST) || - (peer -> outgoingPeerID < ENET_PROTOCOL_MAXIMUM_PEER_ID && - sessionID != peer -> incomingSessionID)) - return 0; - } - - if (flags & ENET_PROTOCOL_HEADER_FLAG_COMPRESSED) - { - size_t originalSize; - if (host -> compressor.context == NULL || host -> compressor.decompress == NULL) - return 0; - - originalSize = host -> compressor.decompress (host -> compressor.context, - host -> receivedData + headerSize, - host -> receivedDataLength - headerSize, - host -> packetData [1] + headerSize, - sizeof (host -> packetData [1]) - headerSize); - if (originalSize <= 0 || originalSize > sizeof (host -> packetData [1]) - headerSize) - return 0; - - memcpy (host -> packetData [1], header, headerSize); - host -> receivedData = host -> packetData [1]; - host -> receivedDataLength = headerSize + originalSize; - } - - if (host -> checksum != NULL) - { - enet_uint32 * checksum = (enet_uint32 *) & host -> receivedData [headerSize - sizeof (enet_uint32)], - desiredChecksum = * checksum; - ENetBuffer buffer; - - * checksum = peer != NULL ? peer -> connectID : 0; - - buffer.data = host -> receivedData; - buffer.dataLength = host -> receivedDataLength; - - if (host -> checksum (& buffer, 1) != desiredChecksum) - return 0; - } - - if (peer != NULL) - { - peer -> address.host = host -> receivedAddress.host; - peer -> address.port = host -> receivedAddress.port; - peer -> incomingDataTotal += host -> receivedDataLength; - } - - currentData = host -> receivedData + headerSize; - - while (currentData < & host -> receivedData [host -> receivedDataLength]) - { - enet_uint8 commandNumber; - size_t commandSize; - - command = (ENetProtocol *) currentData; - - if (currentData + sizeof (ENetProtocolCommandHeader) > & host -> receivedData [host -> receivedDataLength]) - break; - - commandNumber = command -> header.command & ENET_PROTOCOL_COMMAND_MASK; - if (commandNumber >= ENET_PROTOCOL_COMMAND_COUNT) - break; - - commandSize = commandSizes [commandNumber]; - if (commandSize == 0 || currentData + commandSize > & host -> receivedData [host -> receivedDataLength]) - break; - - currentData += commandSize; - - if (peer == NULL && commandNumber != ENET_PROTOCOL_COMMAND_CONNECT) - break; - - command -> header.reliableSequenceNumber = ENET_NET_TO_HOST_16 (command -> header.reliableSequenceNumber); - - switch (commandNumber) - { - case ENET_PROTOCOL_COMMAND_ACKNOWLEDGE: - if (enet_protocol_handle_acknowledge (host, event, peer, command)) - goto commandError; - break; - - case ENET_PROTOCOL_COMMAND_CONNECT: - if (peer != NULL) - goto commandError; - peer = enet_protocol_handle_connect (host, header, command); - if (peer == NULL) - goto commandError; - break; - - case ENET_PROTOCOL_COMMAND_VERIFY_CONNECT: - if (enet_protocol_handle_verify_connect (host, event, peer, command)) - goto commandError; - break; - - case ENET_PROTOCOL_COMMAND_DISCONNECT: - if (enet_protocol_handle_disconnect (host, peer, command)) - goto commandError; - break; - - case ENET_PROTOCOL_COMMAND_PING: - if (enet_protocol_handle_ping (host, peer, command)) - goto commandError; - break; - - case ENET_PROTOCOL_COMMAND_SEND_RELIABLE: - if (enet_protocol_handle_send_reliable (host, peer, command, & currentData)) - goto commandError; - break; - - case ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE: - if (enet_protocol_handle_send_unreliable (host, peer, command, & currentData)) - goto commandError; - break; - - case ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED: - if (enet_protocol_handle_send_unsequenced (host, peer, command, & currentData)) - goto commandError; - break; - - case ENET_PROTOCOL_COMMAND_SEND_FRAGMENT: - if (enet_protocol_handle_send_fragment (host, peer, command, & currentData)) - goto commandError; - break; - - case ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT: - if (enet_protocol_handle_bandwidth_limit (host, peer, command)) - goto commandError; - break; - - case ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE: - if (enet_protocol_handle_throttle_configure (host, peer, command)) - goto commandError; - break; - - case ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE_FRAGMENT: - if (enet_protocol_handle_send_unreliable_fragment (host, peer, command, & currentData)) - goto commandError; - break; - - default: - goto commandError; - } - - if (peer != NULL && - (command -> header.command & ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE) != 0) - { - enet_uint16 sentTime; - - if (! (flags & ENET_PROTOCOL_HEADER_FLAG_SENT_TIME)) - break; - - sentTime = ENET_NET_TO_HOST_16 (header -> sentTime); - - switch (peer -> state) - { - case ENET_PEER_STATE_DISCONNECTING: - case ENET_PEER_STATE_ACKNOWLEDGING_CONNECT: - case ENET_PEER_STATE_DISCONNECTED: - case ENET_PEER_STATE_ZOMBIE: - break; - - case ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT: - if ((command -> header.command & ENET_PROTOCOL_COMMAND_MASK) == ENET_PROTOCOL_COMMAND_DISCONNECT) - enet_peer_queue_acknowledgement (peer, command, sentTime); - break; - - default: - enet_peer_queue_acknowledgement (peer, command, sentTime); - break; - } - } - } - -commandError: - if (event != NULL && event -> type != ENET_EVENT_TYPE_NONE) - return 1; - - return 0; -} - -static int -enet_protocol_receive_incoming_commands (ENetHost * host, ENetEvent * event) -{ - int packets; - - for (packets = 0; packets < 256; ++ packets) - { - int receivedLength; - ENetBuffer buffer; - - buffer.data = host -> packetData [0]; - buffer.dataLength = sizeof (host -> packetData [0]); - - receivedLength = enet_socket_receive (host -> socket, - & host -> receivedAddress, - & buffer, - 1); - - if (receivedLength < 0) - return -1; - - if (receivedLength == 0) - return 0; - - host -> receivedData = host -> packetData [0]; - host -> receivedDataLength = receivedLength; - - host -> totalReceivedData += receivedLength; - host -> totalReceivedPackets ++; - - if (host -> intercept != NULL) - { - switch (host -> intercept (host, event)) - { - case 1: - if (event != NULL && event -> type != ENET_EVENT_TYPE_NONE) - return 1; - - continue; - - case -1: - return -1; - - default: - break; - } - } - - switch (enet_protocol_handle_incoming_commands (host, event)) - { - case 1: - return 1; - - case -1: - return -1; - - default: - break; - } - } - - return -1; -} - -static void -enet_protocol_send_acknowledgements (ENetHost * host, ENetPeer * peer) -{ - ENetProtocol * command = & host -> commands [host -> commandCount]; - ENetBuffer * buffer = & host -> buffers [host -> bufferCount]; - ENetAcknowledgement * acknowledgement; - ENetListIterator currentAcknowledgement; - enet_uint16 reliableSequenceNumber; - - currentAcknowledgement = enet_list_begin (& peer -> acknowledgements); - - while (currentAcknowledgement != enet_list_end (& peer -> acknowledgements)) - { - if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] || - buffer >= & host -> buffers [sizeof (host -> buffers) / sizeof (ENetBuffer)] || - peer -> mtu - host -> packetSize < sizeof (ENetProtocolAcknowledge)) - { - host -> continueSending = 1; - - break; - } - - acknowledgement = (ENetAcknowledgement *) currentAcknowledgement; - - currentAcknowledgement = enet_list_next (currentAcknowledgement); - - buffer -> data = command; - buffer -> dataLength = sizeof (ENetProtocolAcknowledge); - - host -> packetSize += buffer -> dataLength; - - reliableSequenceNumber = ENET_HOST_TO_NET_16 (acknowledgement -> command.header.reliableSequenceNumber); - - command -> header.command = ENET_PROTOCOL_COMMAND_ACKNOWLEDGE; - command -> header.channelID = acknowledgement -> command.header.channelID; - command -> header.reliableSequenceNumber = reliableSequenceNumber; - command -> acknowledge.receivedReliableSequenceNumber = reliableSequenceNumber; - command -> acknowledge.receivedSentTime = ENET_HOST_TO_NET_16 (acknowledgement -> sentTime); - - if ((acknowledgement -> command.header.command & ENET_PROTOCOL_COMMAND_MASK) == ENET_PROTOCOL_COMMAND_DISCONNECT) - enet_protocol_dispatch_state (host, peer, ENET_PEER_STATE_ZOMBIE); - - enet_list_remove (& acknowledgement -> acknowledgementList); - enet_free (acknowledgement); - - ++ command; - ++ buffer; - } - - host -> commandCount = command - host -> commands; - host -> bufferCount = buffer - host -> buffers; -} - -static void -enet_protocol_send_unreliable_outgoing_commands (ENetHost * host, ENetPeer * peer) -{ - ENetProtocol * command = & host -> commands [host -> commandCount]; - ENetBuffer * buffer = & host -> buffers [host -> bufferCount]; - ENetOutgoingCommand * outgoingCommand; - ENetListIterator currentCommand; - - currentCommand = enet_list_begin (& peer -> outgoingUnreliableCommands); - - while (currentCommand != enet_list_end (& peer -> outgoingUnreliableCommands)) - { - size_t commandSize; - - outgoingCommand = (ENetOutgoingCommand *) currentCommand; - commandSize = commandSizes [outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK]; - - if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] || - buffer + 1 >= & host -> buffers [sizeof (host -> buffers) / sizeof (ENetBuffer)] || - peer -> mtu - host -> packetSize < commandSize || - (outgoingCommand -> packet != NULL && - peer -> mtu - host -> packetSize < commandSize + outgoingCommand -> fragmentLength)) - { - host -> continueSending = 1; - - break; - } - - currentCommand = enet_list_next (currentCommand); - - if (outgoingCommand -> packet != NULL && outgoingCommand -> fragmentOffset == 0) - { - peer -> packetThrottleCounter += ENET_PEER_PACKET_THROTTLE_COUNTER; - peer -> packetThrottleCounter %= ENET_PEER_PACKET_THROTTLE_SCALE; - - if (peer -> packetThrottleCounter > peer -> packetThrottle) - { - enet_uint16 reliableSequenceNumber = outgoingCommand -> reliableSequenceNumber, - unreliableSequenceNumber = outgoingCommand -> unreliableSequenceNumber; - for (;;) - { - -- outgoingCommand -> packet -> referenceCount; - - if (outgoingCommand -> packet -> referenceCount == 0) - enet_packet_destroy (outgoingCommand -> packet); - - enet_list_remove (& outgoingCommand -> outgoingCommandList); - enet_free (outgoingCommand); - - if (currentCommand == enet_list_end (& peer -> outgoingUnreliableCommands)) - break; - - outgoingCommand = (ENetOutgoingCommand *) currentCommand; - if (outgoingCommand -> reliableSequenceNumber != reliableSequenceNumber || - outgoingCommand -> unreliableSequenceNumber != unreliableSequenceNumber) - break; - - currentCommand = enet_list_next (currentCommand); - } - - continue; - } - } - - buffer -> data = command; - buffer -> dataLength = commandSize; - - host -> packetSize += buffer -> dataLength; - - * command = outgoingCommand -> command; - - enet_list_remove (& outgoingCommand -> outgoingCommandList); - - if (outgoingCommand -> packet != NULL) - { - ++ buffer; - - buffer -> data = outgoingCommand -> packet -> data + outgoingCommand -> fragmentOffset; - buffer -> dataLength = outgoingCommand -> fragmentLength; - - host -> packetSize += buffer -> dataLength; - - enet_list_insert (enet_list_end (& peer -> sentUnreliableCommands), outgoingCommand); - } - else - enet_free (outgoingCommand); - - ++ command; - ++ buffer; - } - - host -> commandCount = command - host -> commands; - host -> bufferCount = buffer - host -> buffers; - - if (peer -> state == ENET_PEER_STATE_DISCONNECT_LATER && - enet_list_empty (& peer -> outgoingReliableCommands) && - enet_list_empty (& peer -> outgoingUnreliableCommands) && - enet_list_empty (& peer -> sentReliableCommands)) - enet_peer_disconnect (peer, peer -> eventData); -} - -static int -enet_protocol_check_timeouts (ENetHost * host, ENetPeer * peer, ENetEvent * event) -{ - ENetOutgoingCommand * outgoingCommand; - ENetListIterator currentCommand, insertPosition; - - currentCommand = enet_list_begin (& peer -> sentReliableCommands); - insertPosition = enet_list_begin (& peer -> outgoingReliableCommands); - - while (currentCommand != enet_list_end (& peer -> sentReliableCommands)) - { - outgoingCommand = (ENetOutgoingCommand *) currentCommand; - - currentCommand = enet_list_next (currentCommand); - - if (ENET_TIME_DIFFERENCE (host -> serviceTime, outgoingCommand -> sentTime) < outgoingCommand -> roundTripTimeout) - continue; - - if (peer -> earliestTimeout == 0 || - ENET_TIME_LESS (outgoingCommand -> sentTime, peer -> earliestTimeout)) - peer -> earliestTimeout = outgoingCommand -> sentTime; - - if (peer -> earliestTimeout != 0 && - (ENET_TIME_DIFFERENCE (host -> serviceTime, peer -> earliestTimeout) >= peer -> timeoutMaximum || - (outgoingCommand -> roundTripTimeout >= outgoingCommand -> roundTripTimeoutLimit && - ENET_TIME_DIFFERENCE (host -> serviceTime, peer -> earliestTimeout) >= peer -> timeoutMinimum))) - { - enet_protocol_notify_disconnect (host, peer, event); - - return 1; - } - - if (outgoingCommand -> packet != NULL) - peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength; - - ++ peer -> packetsLost; - - outgoingCommand -> roundTripTimeout *= 2; - - enet_list_insert (insertPosition, enet_list_remove (& outgoingCommand -> outgoingCommandList)); - - if (currentCommand == enet_list_begin (& peer -> sentReliableCommands) && - ! enet_list_empty (& peer -> sentReliableCommands)) - { - outgoingCommand = (ENetOutgoingCommand *) currentCommand; - - peer -> nextTimeout = outgoingCommand -> sentTime + outgoingCommand -> roundTripTimeout; - } - } - - return 0; -} - -static int -enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer) -{ - ENetProtocol * command = & host -> commands [host -> commandCount]; - ENetBuffer * buffer = & host -> buffers [host -> bufferCount]; - ENetOutgoingCommand * outgoingCommand; - ENetListIterator currentCommand; - ENetChannel *channel; - enet_uint16 reliableWindow; - size_t commandSize; - int windowExceeded = 0, windowWrap = 0, canPing = 1; - - currentCommand = enet_list_begin (& peer -> outgoingReliableCommands); - - while (currentCommand != enet_list_end (& peer -> outgoingReliableCommands)) - { - outgoingCommand = (ENetOutgoingCommand *) currentCommand; - - channel = outgoingCommand -> command.header.channelID < peer -> channelCount ? & peer -> channels [outgoingCommand -> command.header.channelID] : NULL; - reliableWindow = outgoingCommand -> reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; - if (channel != NULL) - { - if (! windowWrap && - outgoingCommand -> sendAttempts < 1 && - ! (outgoingCommand -> reliableSequenceNumber % ENET_PEER_RELIABLE_WINDOW_SIZE) && - (channel -> reliableWindows [(reliableWindow + ENET_PEER_RELIABLE_WINDOWS - 1) % ENET_PEER_RELIABLE_WINDOWS] >= ENET_PEER_RELIABLE_WINDOW_SIZE || - channel -> usedReliableWindows & ((((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) << reliableWindow) | - (((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) >> (ENET_PEER_RELIABLE_WINDOWS - reliableWindow))))) - windowWrap = 1; - if (windowWrap) - { - currentCommand = enet_list_next (currentCommand); - - continue; - } - } - - if (outgoingCommand -> packet != NULL) - { - if (! windowExceeded) - { - enet_uint32 windowSize = (peer -> packetThrottle * peer -> windowSize) / ENET_PEER_PACKET_THROTTLE_SCALE; - - if (peer -> reliableDataInTransit + outgoingCommand -> fragmentLength > ENET_MAX (windowSize, peer -> mtu)) - windowExceeded = 1; - } - if (windowExceeded) - { - currentCommand = enet_list_next (currentCommand); - - continue; - } - } - - canPing = 0; - - commandSize = commandSizes [outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK]; - if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] || - buffer + 1 >= & host -> buffers [sizeof (host -> buffers) / sizeof (ENetBuffer)] || - peer -> mtu - host -> packetSize < commandSize || - (outgoingCommand -> packet != NULL && - (enet_uint16) (peer -> mtu - host -> packetSize) < (enet_uint16) (commandSize + outgoingCommand -> fragmentLength))) - { - host -> continueSending = 1; - - break; - } - - currentCommand = enet_list_next (currentCommand); - - if (channel != NULL && outgoingCommand -> sendAttempts < 1) - { - channel -> usedReliableWindows |= 1 << reliableWindow; - ++ channel -> reliableWindows [reliableWindow]; - } - - ++ outgoingCommand -> sendAttempts; - - if (outgoingCommand -> roundTripTimeout == 0) - { - outgoingCommand -> roundTripTimeout = peer -> roundTripTime + 4 * peer -> roundTripTimeVariance; - outgoingCommand -> roundTripTimeoutLimit = peer -> timeoutLimit * outgoingCommand -> roundTripTimeout; - } - - if (enet_list_empty (& peer -> sentReliableCommands)) - peer -> nextTimeout = host -> serviceTime + outgoingCommand -> roundTripTimeout; - - enet_list_insert (enet_list_end (& peer -> sentReliableCommands), - enet_list_remove (& outgoingCommand -> outgoingCommandList)); - - outgoingCommand -> sentTime = host -> serviceTime; - - buffer -> data = command; - buffer -> dataLength = commandSize; - - host -> packetSize += buffer -> dataLength; - host -> headerFlags |= ENET_PROTOCOL_HEADER_FLAG_SENT_TIME; - - * command = outgoingCommand -> command; - - if (outgoingCommand -> packet != NULL) - { - ++ buffer; - - buffer -> data = outgoingCommand -> packet -> data + outgoingCommand -> fragmentOffset; - buffer -> dataLength = outgoingCommand -> fragmentLength; - - host -> packetSize += outgoingCommand -> fragmentLength; - - peer -> reliableDataInTransit += outgoingCommand -> fragmentLength; - } - - ++ peer -> packetsSent; - - ++ command; - ++ buffer; - } - - host -> commandCount = command - host -> commands; - host -> bufferCount = buffer - host -> buffers; - - return canPing; -} - -static int -enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int checkForTimeouts) -{ - enet_uint8 headerData [sizeof (ENetProtocolHeader) + sizeof (enet_uint32)]; - ENetProtocolHeader * header = (ENetProtocolHeader *) headerData; - ENetPeer * currentPeer; - int sentLength; - size_t shouldCompress = 0; - - host -> continueSending = 1; - - while (host -> continueSending) - for (host -> continueSending = 0, - currentPeer = host -> peers; - currentPeer < & host -> peers [host -> peerCount]; - ++ currentPeer) - { - if (currentPeer -> state == ENET_PEER_STATE_DISCONNECTED || - currentPeer -> state == ENET_PEER_STATE_ZOMBIE) - continue; - - host -> headerFlags = 0; - host -> commandCount = 0; - host -> bufferCount = 1; - host -> packetSize = sizeof (ENetProtocolHeader); - - if (! enet_list_empty (& currentPeer -> acknowledgements)) - enet_protocol_send_acknowledgements (host, currentPeer); - - if (checkForTimeouts != 0 && - ! enet_list_empty (& currentPeer -> sentReliableCommands) && - ENET_TIME_GREATER_EQUAL (host -> serviceTime, currentPeer -> nextTimeout) && - enet_protocol_check_timeouts (host, currentPeer, event) == 1) - { - if (event != NULL && event -> type != ENET_EVENT_TYPE_NONE) - return 1; - else - continue; - } - - if ((enet_list_empty (& currentPeer -> outgoingReliableCommands) || - enet_protocol_send_reliable_outgoing_commands (host, currentPeer)) && - enet_list_empty (& currentPeer -> sentReliableCommands) && - ENET_TIME_DIFFERENCE (host -> serviceTime, currentPeer -> lastReceiveTime) >= currentPeer -> pingInterval && - currentPeer -> mtu - host -> packetSize >= sizeof (ENetProtocolPing)) - { - enet_peer_ping (currentPeer); - enet_protocol_send_reliable_outgoing_commands (host, currentPeer); - } - - if (! enet_list_empty (& currentPeer -> outgoingUnreliableCommands)) - enet_protocol_send_unreliable_outgoing_commands (host, currentPeer); - - if (host -> commandCount == 0) - continue; - - if (currentPeer -> packetLossEpoch == 0) - currentPeer -> packetLossEpoch = host -> serviceTime; - else - if (ENET_TIME_DIFFERENCE (host -> serviceTime, currentPeer -> packetLossEpoch) >= ENET_PEER_PACKET_LOSS_INTERVAL && - currentPeer -> packetsSent > 0) - { - enet_uint32 packetLoss = currentPeer -> packetsLost * ENET_PEER_PACKET_LOSS_SCALE / currentPeer -> packetsSent; - -#ifdef ENET_DEBUG - printf ("peer %u: %f%%+-%f%% packet loss, %u+-%u ms round trip time, %f%% throttle, %u/%u outgoing, %u/%u incoming\n", currentPeer -> incomingPeerID, currentPeer -> packetLoss / (float) ENET_PEER_PACKET_LOSS_SCALE, currentPeer -> packetLossVariance / (float) ENET_PEER_PACKET_LOSS_SCALE, currentPeer -> roundTripTime, currentPeer -> roundTripTimeVariance, currentPeer -> packetThrottle / (float) ENET_PEER_PACKET_THROTTLE_SCALE, enet_list_size (& currentPeer -> outgoingReliableCommands), enet_list_size (& currentPeer -> outgoingUnreliableCommands), currentPeer -> channels != NULL ? enet_list_size (& currentPeer -> channels -> incomingReliableCommands) : 0, currentPeer -> channels != NULL ? enet_list_size (& currentPeer -> channels -> incomingUnreliableCommands) : 0); -#endif - - currentPeer -> packetLossVariance -= currentPeer -> packetLossVariance / 4; - - if (packetLoss >= currentPeer -> packetLoss) - { - currentPeer -> packetLoss += (packetLoss - currentPeer -> packetLoss) / 8; - currentPeer -> packetLossVariance += (packetLoss - currentPeer -> packetLoss) / 4; - } - else - { - currentPeer -> packetLoss -= (currentPeer -> packetLoss - packetLoss) / 8; - currentPeer -> packetLossVariance += (currentPeer -> packetLoss - packetLoss) / 4; - } - - currentPeer -> packetLossEpoch = host -> serviceTime; - currentPeer -> packetsSent = 0; - currentPeer -> packetsLost = 0; - } - - host -> buffers -> data = headerData; - if (host -> headerFlags & ENET_PROTOCOL_HEADER_FLAG_SENT_TIME) - { - header -> sentTime = ENET_HOST_TO_NET_16 (host -> serviceTime & 0xFFFF); - - host -> buffers -> dataLength = sizeof (ENetProtocolHeader); - } - else - host -> buffers -> dataLength = (size_t) & ((ENetProtocolHeader *) 0) -> sentTime; - - shouldCompress = 0; - if (host -> compressor.context != NULL && host -> compressor.compress != NULL) - { - size_t originalSize = host -> packetSize - sizeof(ENetProtocolHeader), - compressedSize = host -> compressor.compress (host -> compressor.context, - & host -> buffers [1], host -> bufferCount - 1, - originalSize, - host -> packetData [1], - originalSize); - if (compressedSize > 0 && compressedSize < originalSize) - { - host -> headerFlags |= ENET_PROTOCOL_HEADER_FLAG_COMPRESSED; - shouldCompress = compressedSize; -#ifdef ENET_DEBUG_COMPRESS - printf ("peer %u: compressed %u -> %u (%u%%)\n", currentPeer -> incomingPeerID, originalSize, compressedSize, (compressedSize * 100) / originalSize); -#endif - } - } - - if (currentPeer -> outgoingPeerID < ENET_PROTOCOL_MAXIMUM_PEER_ID) - host -> headerFlags |= currentPeer -> outgoingSessionID << ENET_PROTOCOL_HEADER_SESSION_SHIFT; - header -> peerID = ENET_HOST_TO_NET_16 (currentPeer -> outgoingPeerID | host -> headerFlags); - if (host -> checksum != NULL) - { - enet_uint32 * checksum = (enet_uint32 *) & headerData [host -> buffers -> dataLength]; - * checksum = currentPeer -> outgoingPeerID < ENET_PROTOCOL_MAXIMUM_PEER_ID ? currentPeer -> connectID : 0; - host -> buffers -> dataLength += sizeof (enet_uint32); - * checksum = host -> checksum (host -> buffers, host -> bufferCount); - } - - if (shouldCompress > 0) - { - host -> buffers [1].data = host -> packetData [1]; - host -> buffers [1].dataLength = shouldCompress; - host -> bufferCount = 2; - } - - currentPeer -> lastSendTime = host -> serviceTime; - - sentLength = enet_socket_send (host -> socket, & currentPeer -> address, host -> buffers, host -> bufferCount); - - enet_protocol_remove_sent_unreliable_commands (currentPeer); - - if (sentLength < 0) - return -1; - - host -> totalSentData += sentLength; - host -> totalSentPackets ++; - } - - return 0; -} - -/** Sends any queued packets on the host specified to its designated peers. - - @param host host to flush - @remarks this function need only be used in circumstances where one wishes to send queued packets earlier than in a call to enet_host_service(). - @ingroup host -*/ -void -enet_host_flush (ENetHost * host) -{ - host -> serviceTime = enet_time_get (); - - enet_protocol_send_outgoing_commands (host, NULL, 0); -} - -/** Checks for any queued events on the host and dispatches one if available. - - @param host host to check for events - @param event an event structure where event details will be placed if available - @retval > 0 if an event was dispatched - @retval 0 if no events are available - @retval < 0 on failure - @ingroup host -*/ -int -enet_host_check_events (ENetHost * host, ENetEvent * event) -{ - if (event == NULL) return -1; - - event -> type = ENET_EVENT_TYPE_NONE; - event -> peer = NULL; - event -> packet = NULL; - - return enet_protocol_dispatch_incoming_commands (host, event); -} - -/** Waits for events on the host specified and shuttles packets between - the host and its peers. - - @param host host to service - @param event an event structure where event details will be placed if one occurs - if event == NULL then no events will be delivered - @param timeout number of milliseconds that ENet should wait for events - @retval > 0 if an event occurred within the specified time limit - @retval 0 if no event occurred - @retval < 0 on failure - @remarks enet_host_service should be called fairly regularly for adequate performance - @ingroup host -*/ -int -enet_host_service (ENetHost * host, ENetEvent * event, enet_uint32 timeout) -{ - enet_uint32 waitCondition; - - if (event != NULL) - { - event -> type = ENET_EVENT_TYPE_NONE; - event -> peer = NULL; - event -> packet = NULL; - - switch (enet_protocol_dispatch_incoming_commands (host, event)) - { - case 1: - return 1; - - case -1: -#ifdef ENET_DEBUG - perror ("Error dispatching incoming packets"); -#endif - - return -1; - - default: - break; - } - } - - host -> serviceTime = enet_time_get (); - - timeout += host -> serviceTime; - - do - { - if (ENET_TIME_DIFFERENCE (host -> serviceTime, host -> bandwidthThrottleEpoch) >= ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL) - enet_host_bandwidth_throttle (host); - - switch (enet_protocol_send_outgoing_commands (host, event, 1)) - { - case 1: - return 1; - - case -1: -#ifdef ENET_DEBUG - perror ("Error sending outgoing packets"); -#endif - - return -1; - - default: - break; - } - - switch (enet_protocol_receive_incoming_commands (host, event)) - { - case 1: - return 1; - - case -1: -#ifdef ENET_DEBUG - perror ("Error receiving incoming packets"); -#endif - - return -1; - - default: - break; - } - - switch (enet_protocol_send_outgoing_commands (host, event, 1)) - { - case 1: - return 1; - - case -1: -#ifdef ENET_DEBUG - perror ("Error sending outgoing packets"); -#endif - - return -1; - - default: - break; - } - - if (event != NULL) - { - switch (enet_protocol_dispatch_incoming_commands (host, event)) - { - case 1: - return 1; - - case -1: -#ifdef ENET_DEBUG - perror ("Error dispatching incoming packets"); -#endif - - return -1; - - default: - break; - } - } - - if (ENET_TIME_GREATER_EQUAL (host -> serviceTime, timeout)) - return 0; - - do - { - host -> serviceTime = enet_time_get (); - - if (ENET_TIME_GREATER_EQUAL (host -> serviceTime, timeout)) - return 0; - - waitCondition = ENET_SOCKET_WAIT_RECEIVE | ENET_SOCKET_WAIT_INTERRUPT; - - if (enet_socket_wait (host -> socket, & waitCondition, ENET_TIME_DIFFERENCE (timeout, host -> serviceTime)) != 0) - return -1; - } - while (waitCondition & ENET_SOCKET_WAIT_INTERRUPT); - - host -> serviceTime = enet_time_get (); - } while (waitCondition & ENET_SOCKET_WAIT_RECEIVE); - - return 0; -} - diff --git a/love/src/jni/love/src/libraries/enet/libenet/unix.c b/love/src/jni/love/src/libraries/enet/libenet/unix.c deleted file mode 100644 index 8cbeae5b..00000000 --- a/love/src/jni/love/src/libraries/enet/libenet/unix.c +++ /dev/null @@ -1,611 +0,0 @@ -/** - @file unix.c - @brief ENet Unix system specific functions -*/ -#ifndef _WIN32 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define ENET_BUILDING_LIB 1 -#include "enet/enet.h" - -#ifdef __APPLE__ -#ifdef HAS_POLL -#undef HAS_POLL -#endif -#ifndef HAS_FCNTL -#define HAS_FCNTL 1 -#endif -#ifndef HAS_INET_PTON -#define HAS_INET_PTON 1 -#endif -#ifndef HAS_INET_NTOP -#define HAS_INET_NTOP 1 -#endif -#ifndef HAS_MSGHDR_FLAGS -#define HAS_MSGHDR_FLAGS 1 -#endif -#ifndef HAS_SOCKLEN_T -#define HAS_SOCKLEN_T 1 -#endif -#ifndef HAS_GETADDRINFO -#define HAS_GETADDRINFO 1 -#endif -#ifndef HAS_GETNAMEINFO -#define HAS_GETNAMEINFO 1 -#endif -#endif - -#ifdef HAS_FCNTL -#include -#endif - -#ifdef HAS_POLL -#include -#endif - -#include "common/config.h" -#ifndef HAS_SOCKLEN_T -typedef int socklen_t; -#endif - -#ifndef MSG_NOSIGNAL -#define MSG_NOSIGNAL 0 -#endif - -static enet_uint32 timeBase = 0; - -int -enet_initialize (void) -{ - return 0; -} - -void -enet_deinitialize (void) -{ -} - -enet_uint32 -enet_host_random_seed (void) -{ - return (enet_uint32) time (NULL); -} - -enet_uint32 -enet_time_get (void) -{ - struct timeval timeVal; - - gettimeofday (& timeVal, NULL); - - return timeVal.tv_sec * 1000 + timeVal.tv_usec / 1000 - timeBase; -} - -void -enet_time_set (enet_uint32 newTimeBase) -{ - struct timeval timeVal; - - gettimeofday (& timeVal, NULL); - - timeBase = timeVal.tv_sec * 1000 + timeVal.tv_usec / 1000 - newTimeBase; -} - -int -enet_address_set_host (ENetAddress * address, const char * name) -{ -#ifdef HAS_GETADDRINFO - struct addrinfo hints, * resultList = NULL, * result = NULL; - - memset (& hints, 0, sizeof (hints)); - hints.ai_family = AF_INET; - - if (getaddrinfo (name, NULL, NULL, & resultList) != 0) - return -1; - - for (result = resultList; result != NULL; result = result -> ai_next) - { - if (result -> ai_family == AF_INET && result -> ai_addr != NULL && result -> ai_addrlen >= sizeof (struct sockaddr_in)) - { - struct sockaddr_in * sin = (struct sockaddr_in *) result -> ai_addr; - - address -> host = sin -> sin_addr.s_addr; - - freeaddrinfo (resultList); - - return 0; - } - } - - if (resultList != NULL) - freeaddrinfo (resultList); -#else - struct hostent * hostEntry = NULL; -#ifdef HAS_GETHOSTBYNAME_R - struct hostent hostData; - char buffer [2048]; - int errnum; - -#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) - gethostbyname_r (name, & hostData, buffer, sizeof (buffer), & hostEntry, & errnum); -#else - hostEntry = gethostbyname_r (name, & hostData, buffer, sizeof (buffer), & errnum); -#endif -#else - hostEntry = gethostbyname (name); -#endif - - if (hostEntry != NULL && hostEntry -> h_addrtype == AF_INET) - { - address -> host = * (enet_uint32 *) hostEntry -> h_addr_list [0]; - - return 0; - } -#endif - -#ifdef HAS_INET_PTON - if (! inet_pton (AF_INET, name, & address -> host)) -#else - if (! inet_aton (name, (struct in_addr *) & address -> host)) -#endif - return -1; - - return 0; -} - -int -enet_address_get_host_ip (const ENetAddress * address, char * name, size_t nameLength) -{ -#ifdef HAS_INET_NTOP - if (inet_ntop (AF_INET, & address -> host, name, nameLength) == NULL) -#else - char * addr = inet_ntoa (* (struct in_addr *) & address -> host); - if (addr != NULL) - { - size_t addrLen = strlen(addr); - if (addrLen >= nameLength) - return -1; - memcpy (name, addr, addrLen + 1); - } - else -#endif - return -1; - return 0; -} - -int -enet_address_get_host (const ENetAddress * address, char * name, size_t nameLength) -{ -#ifdef HAS_GETNAMEINFO - struct sockaddr_in sin; - int err; - - memset (& sin, 0, sizeof (struct sockaddr_in)); - - sin.sin_family = AF_INET; - sin.sin_port = ENET_HOST_TO_NET_16 (address -> port); - sin.sin_addr.s_addr = address -> host; - - err = getnameinfo ((struct sockaddr *) & sin, sizeof (sin), name, nameLength, NULL, 0, NI_NAMEREQD); - if (! err) - { - if (name != NULL && nameLength > 0 && ! memchr (name, '\0', nameLength)) - return -1; - return 0; - } - if (err != EAI_NONAME) - return -1; -#else - struct in_addr in; - struct hostent * hostEntry = NULL; -#ifdef HAS_GETHOSTBYADDR_R - struct hostent hostData; - char buffer [2048]; - int errnum; - - in.s_addr = address -> host; - -#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) - gethostbyaddr_r ((char *) & in, sizeof (struct in_addr), AF_INET, & hostData, buffer, sizeof (buffer), & hostEntry, & errnum); -#else - hostEntry = gethostbyaddr_r ((char *) & in, sizeof (struct in_addr), AF_INET, & hostData, buffer, sizeof (buffer), & errnum); -#endif -#else - in.s_addr = address -> host; - - hostEntry = gethostbyaddr ((char *) & in, sizeof (struct in_addr), AF_INET); -#endif - - if (hostEntry != NULL) - { - size_t hostLen = strlen (hostEntry -> h_name); - if (hostLen >= nameLength) - return -1; - memcpy (name, hostEntry -> h_name, hostLen + 1); - return 0; - } -#endif - - return enet_address_get_host_ip (address, name, nameLength); -} - -int -enet_socket_bind (ENetSocket socket, const ENetAddress * address) -{ - struct sockaddr_in sin; - - memset (& sin, 0, sizeof (struct sockaddr_in)); - - sin.sin_family = AF_INET; - - if (address != NULL) - { - sin.sin_port = ENET_HOST_TO_NET_16 (address -> port); - sin.sin_addr.s_addr = address -> host; - } - else - { - sin.sin_port = 0; - sin.sin_addr.s_addr = INADDR_ANY; - } - - return bind (socket, - (struct sockaddr *) & sin, - sizeof (struct sockaddr_in)); -} - -int -enet_socket_get_address (ENetSocket socket, ENetAddress * address) -{ - struct sockaddr_in sin; - socklen_t sinLength = sizeof (struct sockaddr_in); - - if (getsockname (socket, (struct sockaddr *) & sin, & sinLength) == -1) - return -1; - - address -> host = (enet_uint32) sin.sin_addr.s_addr; - address -> port = ENET_NET_TO_HOST_16 (sin.sin_port); - - return 0; -} - -int -enet_socket_listen (ENetSocket socket, int backlog) -{ - return listen (socket, backlog < 0 ? SOMAXCONN : backlog); -} - -ENetSocket -enet_socket_create (ENetSocketType type) -{ - return socket (PF_INET, type == ENET_SOCKET_TYPE_DATAGRAM ? SOCK_DGRAM : SOCK_STREAM, 0); -} - -int -enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value) -{ - int result = -1; - switch (option) - { - case ENET_SOCKOPT_NONBLOCK: -#ifdef HAS_FCNTL - result = fcntl (socket, F_SETFL, (value ? O_NONBLOCK : 0) | (fcntl (socket, F_GETFL) & ~O_NONBLOCK)); -#else - result = ioctl (socket, FIONBIO, & value); -#endif - break; - - case ENET_SOCKOPT_BROADCAST: - result = setsockopt (socket, SOL_SOCKET, SO_BROADCAST, (char *) & value, sizeof (int)); - break; - - case ENET_SOCKOPT_REUSEADDR: - result = setsockopt (socket, SOL_SOCKET, SO_REUSEADDR, (char *) & value, sizeof (int)); - break; - - case ENET_SOCKOPT_RCVBUF: - result = setsockopt (socket, SOL_SOCKET, SO_RCVBUF, (char *) & value, sizeof (int)); - break; - - case ENET_SOCKOPT_SNDBUF: - result = setsockopt (socket, SOL_SOCKET, SO_SNDBUF, (char *) & value, sizeof (int)); - break; - - case ENET_SOCKOPT_RCVTIMEO: - { - struct timeval timeVal; - timeVal.tv_sec = value / 1000; - timeVal.tv_usec = (value % 1000) * 1000; - result = setsockopt (socket, SOL_SOCKET, SO_RCVTIMEO, (char *) & timeVal, sizeof (struct timeval)); - break; - } - - case ENET_SOCKOPT_SNDTIMEO: - { - struct timeval timeVal; - timeVal.tv_sec = value / 1000; - timeVal.tv_usec = (value % 1000) * 1000; - result = setsockopt (socket, SOL_SOCKET, SO_SNDTIMEO, (char *) & timeVal, sizeof (struct timeval)); - break; - } - - case ENET_SOCKOPT_NODELAY: - result = setsockopt (socket, IPPROTO_TCP, TCP_NODELAY, (char *) & value, sizeof (int)); - break; - - default: - break; - } - return result == -1 ? -1 : 0; -} - -int -enet_socket_get_option (ENetSocket socket, ENetSocketOption option, int * value) -{ - int result = -1; - socklen_t len; - switch (option) - { - case ENET_SOCKOPT_ERROR: - len = sizeof (int); - result = getsockopt (socket, SOL_SOCKET, SO_ERROR, value, & len); - break; - - default: - break; - } - return result == -1 ? -1 : 0; -} - -int -enet_socket_connect (ENetSocket socket, const ENetAddress * address) -{ - struct sockaddr_in sin; - int result; - - memset (& sin, 0, sizeof (struct sockaddr_in)); - - sin.sin_family = AF_INET; - sin.sin_port = ENET_HOST_TO_NET_16 (address -> port); - sin.sin_addr.s_addr = address -> host; - - result = connect (socket, (struct sockaddr *) & sin, sizeof (struct sockaddr_in)); - if (result == -1 && errno == EINPROGRESS) - return 0; - - return result; -} - -ENetSocket -enet_socket_accept (ENetSocket socket, ENetAddress * address) -{ - int result; - struct sockaddr_in sin; - socklen_t sinLength = sizeof (struct sockaddr_in); - - result = accept (socket, - address != NULL ? (struct sockaddr *) & sin : NULL, - address != NULL ? & sinLength : NULL); - - if (result == -1) - return ENET_SOCKET_NULL; - - if (address != NULL) - { - address -> host = (enet_uint32) sin.sin_addr.s_addr; - address -> port = ENET_NET_TO_HOST_16 (sin.sin_port); - } - - return result; -} - -int -enet_socket_shutdown (ENetSocket socket, ENetSocketShutdown how) -{ - return shutdown (socket, (int) how); -} - -void -enet_socket_destroy (ENetSocket socket) -{ - if (socket != -1) - close (socket); -} - -int -enet_socket_send (ENetSocket socket, - const ENetAddress * address, - const ENetBuffer * buffers, - size_t bufferCount) -{ - struct msghdr msgHdr; - struct sockaddr_in sin; - int sentLength; - - memset (& msgHdr, 0, sizeof (struct msghdr)); - - if (address != NULL) - { - memset (& sin, 0, sizeof (struct sockaddr_in)); - - sin.sin_family = AF_INET; - sin.sin_port = ENET_HOST_TO_NET_16 (address -> port); - sin.sin_addr.s_addr = address -> host; - - msgHdr.msg_name = & sin; - msgHdr.msg_namelen = sizeof (struct sockaddr_in); - } - - msgHdr.msg_iov = (struct iovec *) buffers; - msgHdr.msg_iovlen = bufferCount; - - sentLength = sendmsg (socket, & msgHdr, MSG_NOSIGNAL); - - if (sentLength == -1) - { - if (errno == EWOULDBLOCK) - return 0; - - return -1; - } - - return sentLength; -} - -int -enet_socket_receive (ENetSocket socket, - ENetAddress * address, - ENetBuffer * buffers, - size_t bufferCount) -{ - struct msghdr msgHdr; - struct sockaddr_in sin; - int recvLength; - - memset (& msgHdr, 0, sizeof (struct msghdr)); - - if (address != NULL) - { - msgHdr.msg_name = & sin; - msgHdr.msg_namelen = sizeof (struct sockaddr_in); - } - - msgHdr.msg_iov = (struct iovec *) buffers; - msgHdr.msg_iovlen = bufferCount; - - recvLength = recvmsg (socket, & msgHdr, MSG_NOSIGNAL); - - if (recvLength == -1) - { - if (errno == EWOULDBLOCK) - return 0; - - return -1; - } - -#ifdef HAS_MSGHDR_FLAGS - if (msgHdr.msg_flags & MSG_TRUNC) - return -1; -#endif - - if (address != NULL) - { - address -> host = (enet_uint32) sin.sin_addr.s_addr; - address -> port = ENET_NET_TO_HOST_16 (sin.sin_port); - } - - return recvLength; -} - -int -enet_socketset_select (ENetSocket maxSocket, ENetSocketSet * readSet, ENetSocketSet * writeSet, enet_uint32 timeout) -{ - struct timeval timeVal; - - timeVal.tv_sec = timeout / 1000; - timeVal.tv_usec = (timeout % 1000) * 1000; - - return select (maxSocket + 1, readSet, writeSet, NULL, & timeVal); -} - -int -enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeout) -{ -#ifdef HAS_POLL - struct pollfd pollSocket; - int pollCount; - - pollSocket.fd = socket; - pollSocket.events = 0; - - if (* condition & ENET_SOCKET_WAIT_SEND) - pollSocket.events |= POLLOUT; - - if (* condition & ENET_SOCKET_WAIT_RECEIVE) - pollSocket.events |= POLLIN; - - pollCount = poll (& pollSocket, 1, timeout); - - if (pollCount < 0) - { - if (errno == EINTR && * condition & ENET_SOCKET_WAIT_INTERRUPT) - { - * condition = ENET_SOCKET_WAIT_INTERRUPT; - - return 0; - } - - return -1; - } - - * condition = ENET_SOCKET_WAIT_NONE; - - if (pollCount == 0) - return 0; - - if (pollSocket.revents & POLLOUT) - * condition |= ENET_SOCKET_WAIT_SEND; - - if (pollSocket.revents & POLLIN) - * condition |= ENET_SOCKET_WAIT_RECEIVE; - - return 0; -#else - fd_set readSet, writeSet; - struct timeval timeVal; - int selectCount; - - timeVal.tv_sec = timeout / 1000; - timeVal.tv_usec = (timeout % 1000) * 1000; - - FD_ZERO (& readSet); - FD_ZERO (& writeSet); - - if (* condition & ENET_SOCKET_WAIT_SEND) - FD_SET (socket, & writeSet); - - if (* condition & ENET_SOCKET_WAIT_RECEIVE) - FD_SET (socket, & readSet); - - selectCount = select (socket + 1, & readSet, & writeSet, NULL, & timeVal); - - if (selectCount < 0) - { - if (errno == EINTR && * condition & ENET_SOCKET_WAIT_INTERRUPT) - { - * condition = ENET_SOCKET_WAIT_INTERRUPT; - - return 0; - } - - return -1; - } - - * condition = ENET_SOCKET_WAIT_NONE; - - if (selectCount == 0) - return 0; - - if (FD_ISSET (socket, & writeSet)) - * condition |= ENET_SOCKET_WAIT_SEND; - - if (FD_ISSET (socket, & readSet)) - * condition |= ENET_SOCKET_WAIT_RECEIVE; - - return 0; -#endif -} - -#endif - diff --git a/love/src/jni/love/src/libraries/enet/libenet/win32.c b/love/src/jni/love/src/libraries/enet/libenet/win32.c deleted file mode 100644 index 5cc16799..00000000 --- a/love/src/jni/love/src/libraries/enet/libenet/win32.c +++ /dev/null @@ -1,422 +0,0 @@ -/** - @file win32.c - @brief ENet Win32 system specific functions -*/ -#ifdef _WIN32 - -#define ENET_BUILDING_LIB 1 -#include "enet/enet.h" -#include -#include - -static enet_uint32 timeBase = 0; - -int -enet_initialize (void) -{ - WORD versionRequested = MAKEWORD (1, 1); - WSADATA wsaData; - - if (WSAStartup (versionRequested, & wsaData)) - return -1; - - if (LOBYTE (wsaData.wVersion) != 1|| - HIBYTE (wsaData.wVersion) != 1) - { - WSACleanup (); - - return -1; - } - - timeBeginPeriod (1); - - return 0; -} - -void -enet_deinitialize (void) -{ - timeEndPeriod (1); - - WSACleanup (); -} - -enet_uint32 -enet_host_random_seed (void) -{ - return (enet_uint32) timeGetTime (); -} - -enet_uint32 -enet_time_get (void) -{ - return (enet_uint32) timeGetTime () - timeBase; -} - -void -enet_time_set (enet_uint32 newTimeBase) -{ - timeBase = (enet_uint32) timeGetTime () - newTimeBase; -} - -int -enet_address_set_host (ENetAddress * address, const char * name) -{ - struct hostent * hostEntry; - - hostEntry = gethostbyname (name); - if (hostEntry == NULL || - hostEntry -> h_addrtype != AF_INET) - { - unsigned long host = inet_addr (name); - if (host == INADDR_NONE) - return -1; - address -> host = host; - return 0; - } - - address -> host = * (enet_uint32 *) hostEntry -> h_addr_list [0]; - - return 0; -} - -int -enet_address_get_host_ip (const ENetAddress * address, char * name, size_t nameLength) -{ - char * addr = inet_ntoa (* (struct in_addr *) & address -> host); - if (addr == NULL) - return -1; - else - { - size_t addrLen = strlen(addr); - if (addrLen >= nameLength) - return -1; - memcpy (name, addr, addrLen + 1); - } - return 0; -} - -int -enet_address_get_host (const ENetAddress * address, char * name, size_t nameLength) -{ - struct in_addr in; - struct hostent * hostEntry; - - in.s_addr = address -> host; - - hostEntry = gethostbyaddr ((char *) & in, sizeof (struct in_addr), AF_INET); - if (hostEntry == NULL) - return enet_address_get_host_ip (address, name, nameLength); - else - { - size_t hostLen = strlen (hostEntry -> h_name); - if (hostLen >= nameLength) - return -1; - memcpy (name, hostEntry -> h_name, hostLen + 1); - } - - return 0; -} - -int -enet_socket_bind (ENetSocket socket, const ENetAddress * address) -{ - struct sockaddr_in sin; - - memset (& sin, 0, sizeof (struct sockaddr_in)); - - sin.sin_family = AF_INET; - - if (address != NULL) - { - sin.sin_port = ENET_HOST_TO_NET_16 (address -> port); - sin.sin_addr.s_addr = address -> host; - } - else - { - sin.sin_port = 0; - sin.sin_addr.s_addr = INADDR_ANY; - } - - return bind (socket, - (struct sockaddr *) & sin, - sizeof (struct sockaddr_in)) == SOCKET_ERROR ? -1 : 0; -} - -int -enet_socket_get_address (ENetSocket socket, ENetAddress * address) -{ - struct sockaddr_in sin; - int sinLength = sizeof (struct sockaddr_in); - - if (getsockname (socket, (struct sockaddr *) & sin, & sinLength) == -1) - return -1; - - address -> host = (enet_uint32) sin.sin_addr.s_addr; - address -> port = ENET_NET_TO_HOST_16 (sin.sin_port); - - return 0; -} - -int -enet_socket_listen (ENetSocket socket, int backlog) -{ - return listen (socket, backlog < 0 ? SOMAXCONN : backlog) == SOCKET_ERROR ? -1 : 0; -} - -ENetSocket -enet_socket_create (ENetSocketType type) -{ - return socket (PF_INET, type == ENET_SOCKET_TYPE_DATAGRAM ? SOCK_DGRAM : SOCK_STREAM, 0); -} - -int -enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value) -{ - int result = SOCKET_ERROR; - switch (option) - { - case ENET_SOCKOPT_NONBLOCK: - { - u_long nonBlocking = (u_long) value; - result = ioctlsocket (socket, FIONBIO, & nonBlocking); - break; - } - - case ENET_SOCKOPT_BROADCAST: - result = setsockopt (socket, SOL_SOCKET, SO_BROADCAST, (char *) & value, sizeof (int)); - break; - - case ENET_SOCKOPT_REUSEADDR: - result = setsockopt (socket, SOL_SOCKET, SO_REUSEADDR, (char *) & value, sizeof (int)); - break; - - case ENET_SOCKOPT_RCVBUF: - result = setsockopt (socket, SOL_SOCKET, SO_RCVBUF, (char *) & value, sizeof (int)); - break; - - case ENET_SOCKOPT_SNDBUF: - result = setsockopt (socket, SOL_SOCKET, SO_SNDBUF, (char *) & value, sizeof (int)); - break; - - case ENET_SOCKOPT_RCVTIMEO: - result = setsockopt (socket, SOL_SOCKET, SO_RCVTIMEO, (char *) & value, sizeof (int)); - break; - - case ENET_SOCKOPT_SNDTIMEO: - result = setsockopt (socket, SOL_SOCKET, SO_SNDTIMEO, (char *) & value, sizeof (int)); - break; - - case ENET_SOCKOPT_NODELAY: - result = setsockopt (socket, IPPROTO_TCP, TCP_NODELAY, (char *) & value, sizeof (int)); - break; - - default: - break; - } - return result == SOCKET_ERROR ? -1 : 0; -} - -int -enet_socket_get_option (ENetSocket socket, ENetSocketOption option, int * value) -{ - int result = SOCKET_ERROR, len; - switch (option) - { - case ENET_SOCKOPT_ERROR: - len = sizeof(int); - result = getsockopt (socket, SOL_SOCKET, SO_ERROR, (char *) value, & len); - break; - - default: - break; - } - return result == SOCKET_ERROR ? -1 : 0; -} - -int -enet_socket_connect (ENetSocket socket, const ENetAddress * address) -{ - struct sockaddr_in sin; - int result; - - memset (& sin, 0, sizeof (struct sockaddr_in)); - - sin.sin_family = AF_INET; - sin.sin_port = ENET_HOST_TO_NET_16 (address -> port); - sin.sin_addr.s_addr = address -> host; - - result = connect (socket, (struct sockaddr *) & sin, sizeof (struct sockaddr_in)); - if (result == SOCKET_ERROR && WSAGetLastError () != WSAEWOULDBLOCK) - return -1; - - return 0; -} - -ENetSocket -enet_socket_accept (ENetSocket socket, ENetAddress * address) -{ - SOCKET result; - struct sockaddr_in sin; - int sinLength = sizeof (struct sockaddr_in); - - result = accept (socket, - address != NULL ? (struct sockaddr *) & sin : NULL, - address != NULL ? & sinLength : NULL); - - if (result == INVALID_SOCKET) - return ENET_SOCKET_NULL; - - if (address != NULL) - { - address -> host = (enet_uint32) sin.sin_addr.s_addr; - address -> port = ENET_NET_TO_HOST_16 (sin.sin_port); - } - - return result; -} - -int -enet_socket_shutdown (ENetSocket socket, ENetSocketShutdown how) -{ - return shutdown (socket, (int) how) == SOCKET_ERROR ? -1 : 0; -} - -void -enet_socket_destroy (ENetSocket socket) -{ - if (socket != INVALID_SOCKET) - closesocket (socket); -} - -int -enet_socket_send (ENetSocket socket, - const ENetAddress * address, - const ENetBuffer * buffers, - size_t bufferCount) -{ - struct sockaddr_in sin; - DWORD sentLength; - - if (address != NULL) - { - memset (& sin, 0, sizeof (struct sockaddr_in)); - - sin.sin_family = AF_INET; - sin.sin_port = ENET_HOST_TO_NET_16 (address -> port); - sin.sin_addr.s_addr = address -> host; - } - - if (WSASendTo (socket, - (LPWSABUF) buffers, - (DWORD) bufferCount, - & sentLength, - 0, - address != NULL ? (struct sockaddr *) & sin : NULL, - address != NULL ? sizeof (struct sockaddr_in) : 0, - NULL, - NULL) == SOCKET_ERROR) - { - if (WSAGetLastError () == WSAEWOULDBLOCK) - return 0; - - return -1; - } - - return (int) sentLength; -} - -int -enet_socket_receive (ENetSocket socket, - ENetAddress * address, - ENetBuffer * buffers, - size_t bufferCount) -{ - INT sinLength = sizeof (struct sockaddr_in); - DWORD flags = 0, - recvLength; - struct sockaddr_in sin; - - if (WSARecvFrom (socket, - (LPWSABUF) buffers, - (DWORD) bufferCount, - & recvLength, - & flags, - address != NULL ? (struct sockaddr *) & sin : NULL, - address != NULL ? & sinLength : NULL, - NULL, - NULL) == SOCKET_ERROR) - { - switch (WSAGetLastError ()) - { - case WSAEWOULDBLOCK: - case WSAECONNRESET: - return 0; - } - - return -1; - } - - if (flags & MSG_PARTIAL) - return -1; - - if (address != NULL) - { - address -> host = (enet_uint32) sin.sin_addr.s_addr; - address -> port = ENET_NET_TO_HOST_16 (sin.sin_port); - } - - return (int) recvLength; -} - -int -enet_socketset_select (ENetSocket maxSocket, ENetSocketSet * readSet, ENetSocketSet * writeSet, enet_uint32 timeout) -{ - struct timeval timeVal; - - timeVal.tv_sec = timeout / 1000; - timeVal.tv_usec = (timeout % 1000) * 1000; - - return select (maxSocket + 1, readSet, writeSet, NULL, & timeVal); -} - -int -enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeout) -{ - fd_set readSet, writeSet; - struct timeval timeVal; - int selectCount; - - timeVal.tv_sec = timeout / 1000; - timeVal.tv_usec = (timeout % 1000) * 1000; - - FD_ZERO (& readSet); - FD_ZERO (& writeSet); - - if (* condition & ENET_SOCKET_WAIT_SEND) - FD_SET (socket, & writeSet); - - if (* condition & ENET_SOCKET_WAIT_RECEIVE) - FD_SET (socket, & readSet); - - selectCount = select (socket + 1, & readSet, & writeSet, NULL, & timeVal); - - if (selectCount < 0) - return -1; - - * condition = ENET_SOCKET_WAIT_NONE; - - if (selectCount == 0) - return 0; - - if (FD_ISSET (socket, & writeSet)) - * condition |= ENET_SOCKET_WAIT_SEND; - - if (FD_ISSET (socket, & readSet)) - * condition |= ENET_SOCKET_WAIT_RECEIVE; - - return 0; -} - -#endif - diff --git a/love/src/jni/love/src/libraries/enet/lua-enet.h b/love/src/jni/love/src/libraries/enet/lua-enet.h deleted file mode 100644 index de40b213..00000000 --- a/love/src/jni/love/src/libraries/enet/lua-enet.h +++ /dev/null @@ -1,26 +0,0 @@ -/** -* Copyright (c) 2006-2018 LOVE Development Team -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. -**/ - -#ifndef LOVE_LUAENET_LUAENET_H -#define LOVE_LUAENET_LUAENET_H - -int luaopen_enet(lua_State * L); - -#endif // LOVE_LUAENET_LUAENET_H diff --git a/love/src/jni/love/src/libraries/glad/glad.cpp b/love/src/jni/love/src/libraries/glad/glad.cpp deleted file mode 100644 index a9f8af1b..00000000 --- a/love/src/jni/love/src/libraries/glad/glad.cpp +++ /dev/null @@ -1,7535 +0,0 @@ -#include -#include "glad.hpp" - -namespace glad { - - -#ifdef GLAD_USE_SDL -#include -#if !SDL_VERSION_ATLEAST(2,0,0) -#error SDL 2 is required! -#endif -#else -#include -#endif - -bool gladLoadGL(void) { -#ifdef GLAD_USE_SDL - return gladLoadGLLoader(SDL_GL_GetProcAddress); -#else - // generic gladLoadGL is not implemented, use gladLoadGLLoader or define GLAD_USE_SDL - assert(0); - return false; -#endif -} - -struct { - int major; - int minor; - int gles; -} GLVersion; - - -static bool has_ext(const char *ext) { - if(GLVersion.major < 3) { - const char *extensions; - const char *loc; - const char *terminator; - extensions = (const char *)fp_glGetString(GL_EXTENSIONS); - if(extensions == NULL || ext == NULL) { - return false; - } - - while(1) { - loc = strstr(extensions, ext); - if(loc == NULL) { - return false; - } - - terminator = loc + strlen(ext); - if((loc == extensions || *(loc - 1) == ' ') && - (*terminator == ' ' || *terminator == '\0')) { - return true; - } - extensions = terminator; - } - } else { - int num; - fp_glGetIntegerv(GL_NUM_EXTENSIONS, &num); - - int index; - for(index = 0; index < num; index++) { - const char *e = (const char*)fp_glGetStringi(GL_EXTENSIONS, index); - if(strcmp(e, ext) == 0) { - return true; - } - } - } - - return false; -} - -pfn_glCopyTexImage1D fp_glCopyTexImage1D; -pfn_glTextureParameterf fp_glTextureParameterf; -pfn_glVertexAttribI3ui fp_glVertexAttribI3ui; -pfn_glVertexArrayElementBuffer fp_glVertexArrayElementBuffer; -pfn_glWindowPos2s fp_glWindowPos2s; -pfn_glTextureStorage3DMultisample fp_glTextureStorage3DMultisample; -pfn_glTextureParameterfv fp_glTextureParameterfv; -pfn_glWindowPos2i fp_glWindowPos2i; -pfn_glWindowPos2f fp_glWindowPos2f; -pfn_glWindowPos2d fp_glWindowPos2d; -pfn_glVertex2fv fp_glVertex2fv; -pfn_glIndexi fp_glIndexi; -pfn_glFramebufferRenderbuffer fp_glFramebufferRenderbuffer; -pfn_glUniformSubroutinesuiv fp_glUniformSubroutinesuiv; -pfn_glRectdv fp_glRectdv; -pfn_glCompressedTexSubImage3D fp_glCompressedTexSubImage3D; -pfn_glEvalCoord2d fp_glEvalCoord2d; -pfn_glEvalCoord2f fp_glEvalCoord2f; -pfn_glGetDoublei_v fp_glGetDoublei_v; -pfn_glIndexd fp_glIndexd; -pfn_glVertexAttrib1sv fp_glVertexAttrib1sv; -pfn_glIndexf fp_glIndexf; -pfn_glBindSampler fp_glBindSampler; -pfn_glLineWidth fp_glLineWidth; -pfn_glColorP3uiv fp_glColorP3uiv; -pfn_glGetIntegeri_v fp_glGetIntegeri_v; -pfn_glGetMapfv fp_glGetMapfv; -pfn_glIndexs fp_glIndexs; -pfn_glCompileShader fp_glCompileShader; -pfn_glGetTransformFeedbackVarying fp_glGetTransformFeedbackVarying; -pfn_glWindowPos2iv fp_glWindowPos2iv; -pfn_glDrawTransformFeedbackStreamInstanced fp_glDrawTransformFeedbackStreamInstanced; -pfn_glIndexfv fp_glIndexfv; -pfn_glGetCompressedTextureImage fp_glGetCompressedTextureImage; -pfn_glGetnMapfv fp_glGetnMapfv; -pfn_glFogiv fp_glFogiv; -pfn_glStencilMaskSeparate fp_glStencilMaskSeparate; -pfn_glRasterPos2fv fp_glRasterPos2fv; -pfn_glLightModeliv fp_glLightModeliv; -pfn_glDepthRangef fp_glDepthRangef; -pfn_glColor4ui fp_glColor4ui; -pfn_glSecondaryColor3fv fp_glSecondaryColor3fv; -pfn_glMultiTexCoordP3ui fp_glMultiTexCoordP3ui; -pfn_glMemoryBarrierByRegion fp_glMemoryBarrierByRegion; -pfn_glGetNamedBufferParameteriv fp_glGetNamedBufferParameteriv; -pfn_glFogfv fp_glFogfv; -pfn_glVertexP4ui fp_glVertexP4ui; -pfn_glDrawElementsInstancedBaseInstance fp_glDrawElementsInstancedBaseInstance; -pfn_glEnablei fp_glEnablei; -pfn_glProgramUniform3dv fp_glProgramUniform3dv; -pfn_glVertex4iv fp_glVertex4iv; -pfn_glEvalCoord1fv fp_glEvalCoord1fv; -pfn_glWindowPos2sv fp_glWindowPos2sv; -pfn_glVertexAttribP4ui fp_glVertexAttribP4ui; -pfn_glCreateShader fp_glCreateShader; -pfn_glIsBuffer fp_glIsBuffer; -pfn_glGetMultisamplefv fp_glGetMultisamplefv; -pfn_glProgramUniformMatrix2dv fp_glProgramUniformMatrix2dv; -pfn_glGenRenderbuffers fp_glGenRenderbuffers; -pfn_glCopyTexSubImage2D fp_glCopyTexSubImage2D; -pfn_glCompressedTexImage2D fp_glCompressedTexImage2D; -pfn_glVertexAttrib1f fp_glVertexAttrib1f; -pfn_glBlendFuncSeparate fp_glBlendFuncSeparate; -pfn_glVertex4fv fp_glVertex4fv; -pfn_glMinSampleShading fp_glMinSampleShading; -pfn_glClearNamedFramebufferfi fp_glClearNamedFramebufferfi; -pfn_glGetQueryBufferObjectuiv fp_glGetQueryBufferObjectuiv; -pfn_glBindTexture fp_glBindTexture; -pfn_glVertexAttrib1s fp_glVertexAttrib1s; -pfn_glTexCoord2fv fp_glTexCoord2fv; -pfn_glSampleMaski fp_glSampleMaski; -pfn_glVertexP2ui fp_glVertexP2ui; -pfn_glDrawRangeElementsBaseVertex fp_glDrawRangeElementsBaseVertex; -pfn_glTexCoord4fv fp_glTexCoord4fv; -pfn_glUniformMatrix3x2fv fp_glUniformMatrix3x2fv; -pfn_glDebugMessageControl fp_glDebugMessageControl; -pfn_glPointSize fp_glPointSize; -pfn_glBindTextureUnit fp_glBindTextureUnit; -pfn_glVertexAttrib2dv fp_glVertexAttrib2dv; -pfn_glDeleteProgram fp_glDeleteProgram; -pfn_glColor4bv fp_glColor4bv; -pfn_glRasterPos2f fp_glRasterPos2f; -pfn_glRasterPos2d fp_glRasterPos2d; -pfn_glLoadIdentity fp_glLoadIdentity; -pfn_glRasterPos2i fp_glRasterPos2i; -pfn_glMultiDrawArraysIndirect fp_glMultiDrawArraysIndirect; -pfn_glRenderbufferStorage fp_glRenderbufferStorage; -pfn_glUniformMatrix4x3fv fp_glUniformMatrix4x3fv; -pfn_glColor3b fp_glColor3b; -pfn_glClearBufferfv fp_glClearBufferfv; -pfn_glEdgeFlag fp_glEdgeFlag; -pfn_glDeleteSamplers fp_glDeleteSamplers; -pfn_glVertex3d fp_glVertex3d; -pfn_glVertex3f fp_glVertex3f; -pfn_glGetnMapiv fp_glGetnMapiv; -pfn_glVertex3i fp_glVertex3i; -pfn_glColor3i fp_glColor3i; -pfn_glUniform3d fp_glUniform3d; -pfn_glUniform3f fp_glUniform3f; -pfn_glVertexAttrib4ubv fp_glVertexAttrib4ubv; -pfn_glColor3s fp_glColor3s; -pfn_glVertex3s fp_glVertex3s; -pfn_glTexCoordP2ui fp_glTexCoordP2ui; -pfn_glColorMaski fp_glColorMaski; -pfn_glClearBufferfi fp_glClearBufferfi; -pfn_glDrawArraysIndirect fp_glDrawArraysIndirect; -pfn_glTexCoord1iv fp_glTexCoord1iv; -pfn_glBlitFramebuffer fp_glBlitFramebuffer; -pfn_glPauseTransformFeedback fp_glPauseTransformFeedback; -pfn_glMultiTexCoordP2ui fp_glMultiTexCoordP2ui; -pfn_glProgramUniformMatrix3x2dv fp_glProgramUniformMatrix3x2dv; -pfn_glCopyNamedBufferSubData fp_glCopyNamedBufferSubData; -pfn_glNamedFramebufferTexture fp_glNamedFramebufferTexture; -pfn_glProgramUniformMatrix3x2fv fp_glProgramUniformMatrix3x2fv; -pfn_glGetSamplerParameterIiv fp_glGetSamplerParameterIiv; -pfn_glGetFragDataIndex fp_glGetFragDataIndex; -pfn_glVertexAttribL4d fp_glVertexAttribL4d; -pfn_glBindImageTexture fp_glBindImageTexture; -pfn_glVertexAttrib3f fp_glVertexAttrib3f; -pfn_glProgramUniformMatrix4fv fp_glProgramUniformMatrix4fv; -pfn_glVertex2iv fp_glVertex2iv; -pfn_glGetQueryBufferObjecti64v fp_glGetQueryBufferObjecti64v; -pfn_glColor3sv fp_glColor3sv; -pfn_glGetVertexAttribdv fp_glGetVertexAttribdv; -pfn_glActiveShaderProgram fp_glActiveShaderProgram; -pfn_glUniformMatrix3x4fv fp_glUniformMatrix3x4fv; -pfn_glUniformMatrix3dv fp_glUniformMatrix3dv; -pfn_glNormalPointer fp_glNormalPointer; -pfn_glTexCoordP3uiv fp_glTexCoordP3uiv; -pfn_glVertex4sv fp_glVertex4sv; -pfn_glVertexArrayAttribLFormat fp_glVertexArrayAttribLFormat; -pfn_glInvalidateBufferSubData fp_glInvalidateBufferSubData; -pfn_glPassThrough fp_glPassThrough; -pfn_glMultiTexCoordP4ui fp_glMultiTexCoordP4ui; -pfn_glFogi fp_glFogi; -pfn_glBegin fp_glBegin; -pfn_glEvalCoord2dv fp_glEvalCoord2dv; -pfn_glColor3ubv fp_glColor3ubv; -pfn_glVertexPointer fp_glVertexPointer; -pfn_glSecondaryColor3uiv fp_glSecondaryColor3uiv; -pfn_glDeleteFramebuffers fp_glDeleteFramebuffers; -pfn_glDrawArrays fp_glDrawArrays; -pfn_glUniform1ui fp_glUniform1ui; -pfn_glGetTransformFeedbackiv fp_glGetTransformFeedbackiv; -pfn_glMultiTexCoord1d fp_glMultiTexCoord1d; -pfn_glMultiTexCoord1f fp_glMultiTexCoord1f; -pfn_glProgramParameteri fp_glProgramParameteri; -pfn_glLightfv fp_glLightfv; -pfn_glTexCoordP3ui fp_glTexCoordP3ui; -pfn_glVertexAttrib3d fp_glVertexAttrib3d; -pfn_glClear fp_glClear; -pfn_glMultiTexCoord1i fp_glMultiTexCoord1i; -pfn_glGetActiveUniformName fp_glGetActiveUniformName; -pfn_glMemoryBarrier fp_glMemoryBarrier; -pfn_glGetGraphicsResetStatus fp_glGetGraphicsResetStatus; -pfn_glMultiTexCoord1s fp_glMultiTexCoord1s; -pfn_glIsEnabled fp_glIsEnabled; -pfn_glStencilOp fp_glStencilOp; -pfn_glGetQueryObjectuiv fp_glGetQueryObjectuiv; -pfn_glFramebufferTexture2D fp_glFramebufferTexture2D; -pfn_glGetFramebufferAttachmentParameteriv fp_glGetFramebufferAttachmentParameteriv; -pfn_glTranslatef fp_glTranslatef; -pfn_glVertexAttrib4Nub fp_glVertexAttrib4Nub; -pfn_glTranslated fp_glTranslated; -pfn_glTexCoord3sv fp_glTexCoord3sv; -pfn_glGetFragDataLocation fp_glGetFragDataLocation; -pfn_glGetTextureParameterIiv fp_glGetTextureParameterIiv; -pfn_glTexImage1D fp_glTexImage1D; -pfn_glCopyTextureSubImage3D fp_glCopyTextureSubImage3D; -pfn_glVertexP3uiv fp_glVertexP3uiv; -pfn_glTexParameteriv fp_glTexParameteriv; -pfn_glVertexArrayAttribIFormat fp_glVertexArrayAttribIFormat; -pfn_glSecondaryColor3bv fp_glSecondaryColor3bv; -pfn_glGetMaterialfv fp_glGetMaterialfv; -pfn_glGetTexImage fp_glGetTexImage; -pfn_glFogCoordfv fp_glFogCoordfv; -pfn_glPixelMapuiv fp_glPixelMapuiv; -pfn_glGetShaderInfoLog fp_glGetShaderInfoLog; -pfn_glGetQueryObjecti64v fp_glGetQueryObjecti64v; -pfn_glGenFramebuffers fp_glGenFramebuffers; -pfn_glCreateTextures fp_glCreateTextures; -pfn_glTransformFeedbackBufferBase fp_glTransformFeedbackBufferBase; -pfn_glIndexsv fp_glIndexsv; -pfn_glClearTexSubImage fp_glClearTexSubImage; -pfn_glProgramUniformMatrix3x4dv fp_glProgramUniformMatrix3x4dv; -pfn_glGetAttachedShaders fp_glGetAttachedShaders; -pfn_glIsRenderbuffer fp_glIsRenderbuffer; -pfn_glVertex3iv fp_glVertex3iv; -pfn_glBitmap fp_glBitmap; -pfn_glGetDebugMessageLog fp_glGetDebugMessageLog; -pfn_glProgramUniform1uiv fp_glProgramUniform1uiv; -pfn_glMateriali fp_glMateriali; -pfn_glIsVertexArray fp_glIsVertexArray; -pfn_glDisableVertexAttribArray fp_glDisableVertexAttribArray; -pfn_glProgramUniform2iv fp_glProgramUniform2iv; -pfn_glGetQueryiv fp_glGetQueryiv; -pfn_glTexCoord4f fp_glTexCoord4f; -pfn_glBlitNamedFramebuffer fp_glBlitNamedFramebuffer; -pfn_glTexCoord4d fp_glTexCoord4d; -pfn_glCreateQueries fp_glCreateQueries; -pfn_glGetSamplerParameterfv fp_glGetSamplerParameterfv; -pfn_glTexCoord4i fp_glTexCoord4i; -pfn_glShaderStorageBlockBinding fp_glShaderStorageBlockBinding; -pfn_glMaterialf fp_glMaterialf; -pfn_glTexCoord4s fp_glTexCoord4s; -pfn_glProgramUniformMatrix4x2dv fp_glProgramUniformMatrix4x2dv; -pfn_glGetUniformIndices fp_glGetUniformIndices; -pfn_glIsShader fp_glIsShader; -pfn_glMultiTexCoord2s fp_glMultiTexCoord2s; -pfn_glVertexAttribI4ubv fp_glVertexAttribI4ubv; -pfn_glVertex3dv fp_glVertex3dv; -pfn_glGetInteger64v fp_glGetInteger64v; -pfn_glPointParameteriv fp_glPointParameteriv; -pfn_glGetnMinmax fp_glGetnMinmax; -pfn_glEnable fp_glEnable; -pfn_glGetActiveUniformsiv fp_glGetActiveUniformsiv; -pfn_glColor4fv fp_glColor4fv; -pfn_glTexCoord1fv fp_glTexCoord1fv; -pfn_glVertexArrayAttribBinding fp_glVertexArrayAttribBinding; -pfn_glTextureStorage1D fp_glTextureStorage1D; -pfn_glPopDebugGroup fp_glPopDebugGroup; -pfn_glBlendEquationi fp_glBlendEquationi; -pfn_glTexCoord2sv fp_glTexCoord2sv; -pfn_glVertexAttrib4dv fp_glVertexAttrib4dv; -pfn_glMultiTexCoord1dv fp_glMultiTexCoord1dv; -pfn_glGetProgramInterfaceiv fp_glGetProgramInterfaceiv; -pfn_glMultiTexCoord2i fp_glMultiTexCoord2i; -pfn_glTexCoord3fv fp_glTexCoord3fv; -pfn_glSecondaryColor3usv fp_glSecondaryColor3usv; -pfn_glTexGenf fp_glTexGenf; -pfn_glMapNamedBuffer fp_glMapNamedBuffer; -pfn_glMultiTexCoordP3uiv fp_glMultiTexCoordP3uiv; -pfn_glVertexAttribP3ui fp_glVertexAttribP3ui; -pfn_glVertexAttribL1dv fp_glVertexAttribL1dv; -pfn_glTextureBufferRange fp_glTextureBufferRange; -pfn_glGetnUniformdv fp_glGetnUniformdv; -pfn_glMultiTexCoordP1ui fp_glMultiTexCoordP1ui; -pfn_glProgramUniform3ui fp_glProgramUniform3ui; -pfn_glTransformFeedbackBufferRange fp_glTransformFeedbackBufferRange; -pfn_glGetPointerv fp_glGetPointerv; -pfn_glVertexBindingDivisor fp_glVertexBindingDivisor; -pfn_glPolygonOffset fp_glPolygonOffset; -pfn_glGetUniformuiv fp_glGetUniformuiv; -pfn_glNormal3fv fp_glNormal3fv; -pfn_glSecondaryColor3s fp_glSecondaryColor3s; -pfn_glNamedFramebufferDrawBuffers fp_glNamedFramebufferDrawBuffers; -pfn_glDepthRange fp_glDepthRange; -pfn_glFrustum fp_glFrustum; -pfn_glMultiTexCoord4sv fp_glMultiTexCoord4sv; -pfn_glVertexArrayBindingDivisor fp_glVertexArrayBindingDivisor; -pfn_glDrawBuffer fp_glDrawBuffer; -pfn_glPushMatrix fp_glPushMatrix; -pfn_glGetnPixelMapusv fp_glGetnPixelMapusv; -pfn_glRasterPos3fv fp_glRasterPos3fv; -pfn_glOrtho fp_glOrtho; -pfn_glDrawElementsInstanced fp_glDrawElementsInstanced; -pfn_glWindowPos3sv fp_glWindowPos3sv; -pfn_glVertexAttribL4dv fp_glVertexAttribL4dv; -pfn_glProgramUniform1i fp_glProgramUniform1i; -pfn_glUniform2dv fp_glUniform2dv; -pfn_glProgramUniform1d fp_glProgramUniform1d; -pfn_glProgramUniform1f fp_glProgramUniform1f; -pfn_glClearIndex fp_glClearIndex; -pfn_glMap1d fp_glMap1d; -pfn_glMap1f fp_glMap1f; -pfn_glFlush fp_glFlush; -pfn_glGetRenderbufferParameteriv fp_glGetRenderbufferParameteriv; -pfn_glBeginQueryIndexed fp_glBeginQueryIndexed; -pfn_glProgramUniform3iv fp_glProgramUniform3iv; -pfn_glIndexiv fp_glIndexiv; -pfn_glNamedRenderbufferStorage fp_glNamedRenderbufferStorage; -pfn_glRasterPos3sv fp_glRasterPos3sv; -pfn_glGetVertexAttribPointerv fp_glGetVertexAttribPointerv; -pfn_glPixelZoom fp_glPixelZoom; -pfn_glFenceSync fp_glFenceSync; -pfn_glDeleteVertexArrays fp_glDeleteVertexArrays; -pfn_glColorP3ui fp_glColorP3ui; -pfn_glDrawElementsInstancedBaseVertexBaseInstance fp_glDrawElementsInstancedBaseVertexBaseInstance; -pfn_glTextureStorage2DMultisample fp_glTextureStorage2DMultisample; -pfn_glVertexAttrib3sv fp_glVertexAttrib3sv; -pfn_glBeginConditionalRender fp_glBeginConditionalRender; -pfn_glPushDebugGroup fp_glPushDebugGroup; -pfn_glGetShaderPrecisionFormat fp_glGetShaderPrecisionFormat; -pfn_glValidateProgramPipeline fp_glValidateProgramPipeline; -pfn_glDrawElementsBaseVertex fp_glDrawElementsBaseVertex; -pfn_glGetTexLevelParameteriv fp_glGetTexLevelParameteriv; -pfn_glLighti fp_glLighti; -pfn_glMultiTexCoordP4uiv fp_glMultiTexCoordP4uiv; -pfn_glVertexArrayVertexBuffer fp_glVertexArrayVertexBuffer; -pfn_glLightf fp_glLightf; -pfn_glBindVertexBuffers fp_glBindVertexBuffers; -pfn_glGetAttribLocation fp_glGetAttribLocation; -pfn_glTexStorage3DMultisample fp_glTexStorage3DMultisample; -pfn_glStencilFuncSeparate fp_glStencilFuncSeparate; -pfn_glDisableVertexArrayAttrib fp_glDisableVertexArrayAttrib; -pfn_glGenSamplers fp_glGenSamplers; -pfn_glClampColor fp_glClampColor; -pfn_glUniform4iv fp_glUniform4iv; -pfn_glClearStencil fp_glClearStencil; -pfn_glTexCoordP1uiv fp_glTexCoordP1uiv; -pfn_glGetNamedRenderbufferParameteriv fp_glGetNamedRenderbufferParameteriv; -pfn_glDrawTransformFeedbackInstanced fp_glDrawTransformFeedbackInstanced; -pfn_glMultiTexCoord3fv fp_glMultiTexCoord3fv; -pfn_glGetPixelMapuiv fp_glGetPixelMapuiv; -pfn_glGenTextures fp_glGenTextures; -pfn_glTexCoord4iv fp_glTexCoord4iv; -pfn_glDrawTransformFeedback fp_glDrawTransformFeedback; -pfn_glUniform1dv fp_glUniform1dv; -pfn_glGetTexParameterIuiv fp_glGetTexParameterIuiv; -pfn_glGetTransformFeedbacki_v fp_glGetTransformFeedbacki_v; -pfn_glIndexPointer fp_glIndexPointer; -pfn_glGetnPolygonStipple fp_glGetnPolygonStipple; -pfn_glVertexAttrib4Nbv fp_glVertexAttrib4Nbv; -pfn_glClearNamedFramebufferuiv fp_glClearNamedFramebufferuiv; -pfn_glGetVertexArrayIndexediv fp_glGetVertexArrayIndexediv; -pfn_glIsSync fp_glIsSync; -pfn_glVertex2f fp_glVertex2f; -pfn_glVertex2d fp_glVertex2d; -pfn_glDeleteRenderbuffers fp_glDeleteRenderbuffers; -pfn_glUniform2i fp_glUniform2i; -pfn_glMapGrid2d fp_glMapGrid2d; -pfn_glMapGrid2f fp_glMapGrid2f; -pfn_glTexCoordP4ui fp_glTexCoordP4ui; -pfn_glVertex2i fp_glVertex2i; -pfn_glVertexAttribPointer fp_glVertexAttribPointer; -pfn_glProgramUniform1ui fp_glProgramUniform1ui; -pfn_glFramebufferTextureLayer fp_glFramebufferTextureLayer; -pfn_glVertex2s fp_glVertex2s; -pfn_glGetObjectPtrLabel fp_glGetObjectPtrLabel; -pfn_glTextureParameteri fp_glTextureParameteri; -pfn_glNormal3bv fp_glNormal3bv; -pfn_glVertexAttrib4Nuiv fp_glVertexAttrib4Nuiv; -pfn_glFlushMappedBufferRange fp_glFlushMappedBufferRange; -pfn_glProgramUniform2fv fp_glProgramUniform2fv; -pfn_glUniformMatrix2x3dv fp_glUniformMatrix2x3dv; -pfn_glProgramUniformMatrix4dv fp_glProgramUniformMatrix4dv; -pfn_glSecondaryColor3sv fp_glSecondaryColor3sv; -pfn_glPrimitiveBoundingBox fp_glPrimitiveBoundingBox; -pfn_glProgramUniformMatrix2x4dv fp_glProgramUniformMatrix2x4dv; -pfn_glDispatchCompute fp_glDispatchCompute; -pfn_glVertex3sv fp_glVertex3sv; -pfn_glGenQueries fp_glGenQueries; -pfn_glGetPixelMapfv fp_glGetPixelMapfv; -pfn_glTexEnvf fp_glTexEnvf; -pfn_glVertexAttribP1ui fp_glVertexAttribP1ui; -pfn_glTexSubImage3D fp_glTexSubImage3D; -pfn_glGetInteger64i_v fp_glGetInteger64i_v; -pfn_glFogCoordd fp_glFogCoordd; -pfn_glFogCoordf fp_glFogCoordf; -pfn_glCopyTexImage2D fp_glCopyTexImage2D; -pfn_glTexEnvi fp_glTexEnvi; -pfn_glMultiTexCoord1iv fp_glMultiTexCoord1iv; -pfn_glIsEnabledi fp_glIsEnabledi; -pfn_glBindBuffersRange fp_glBindBuffersRange; -pfn_glSecondaryColorP3ui fp_glSecondaryColorP3ui; -pfn_glVertexAttribI2i fp_glVertexAttribI2i; -pfn_glBindFragDataLocationIndexed fp_glBindFragDataLocationIndexed; -pfn_glCopyImageSubData fp_glCopyImageSubData; -pfn_glMultiTexCoord2dv fp_glMultiTexCoord2dv; -pfn_glUniform2iv fp_glUniform2iv; -pfn_glVertexAttrib1fv fp_glVertexAttrib1fv; -pfn_glGetInternalformativ fp_glGetInternalformativ; -pfn_glUniform4uiv fp_glUniform4uiv; -pfn_glMatrixMode fp_glMatrixMode; -pfn_glGetTextureImage fp_glGetTextureImage; -pfn_glFeedbackBuffer fp_glFeedbackBuffer; -pfn_glProgramUniform2dv fp_glProgramUniform2dv; -pfn_glEndQueryIndexed fp_glEndQueryIndexed; -pfn_glGetMapiv fp_glGetMapiv; -pfn_glTextureSubImage3D fp_glTextureSubImage3D; -pfn_glFramebufferTexture1D fp_glFramebufferTexture1D; -pfn_glUniform4d fp_glUniform4d; -pfn_glGetShaderiv fp_glGetShaderiv; -pfn_glMultiTexCoord2d fp_glMultiTexCoord2d; -pfn_glMultiTexCoord2f fp_glMultiTexCoord2f; -pfn_glProgramUniformMatrix3fv fp_glProgramUniformMatrix3fv; -pfn_glObjectPtrLabel fp_glObjectPtrLabel; -pfn_glInvalidateFramebuffer fp_glInvalidateFramebuffer; -pfn_glBindTextures fp_glBindTextures; -pfn_glBindFragDataLocation fp_glBindFragDataLocation; -pfn_glNamedBufferStorage fp_glNamedBufferStorage; -pfn_glScissorArrayv fp_glScissorArrayv; -pfn_glPrioritizeTextures fp_glPrioritizeTextures; -pfn_glCallList fp_glCallList; -pfn_glPatchParameterfv fp_glPatchParameterfv; -pfn_glSecondaryColor3ubv fp_glSecondaryColor3ubv; -pfn_glGetDoublev fp_glGetDoublev; -pfn_glMultiTexCoord3iv fp_glMultiTexCoord3iv; -pfn_glVertexAttrib1d fp_glVertexAttrib1d; -pfn_glUniform4dv fp_glUniform4dv; -pfn_glLightModelf fp_glLightModelf; -pfn_glGetUniformiv fp_glGetUniformiv; -pfn_glInvalidateBufferData fp_glInvalidateBufferData; -pfn_glVertex2sv fp_glVertex2sv; -pfn_glVertexArrayVertexBuffers fp_glVertexArrayVertexBuffers; -pfn_glCompressedTextureSubImage1D fp_glCompressedTextureSubImage1D; -pfn_glLightModeli fp_glLightModeli; -pfn_glWindowPos3iv fp_glWindowPos3iv; -pfn_glMultiTexCoordP1uiv fp_glMultiTexCoordP1uiv; -pfn_glUniform3fv fp_glUniform3fv; -pfn_glPixelStorei fp_glPixelStorei; -pfn_glGetProgramPipelineInfoLog fp_glGetProgramPipelineInfoLog; -pfn_glCallLists fp_glCallLists; -pfn_glProgramUniformMatrix3x4fv fp_glProgramUniformMatrix3x4fv; -pfn_glInvalidateSubFramebuffer fp_glInvalidateSubFramebuffer; -pfn_glMapBuffer fp_glMapBuffer; -pfn_glSecondaryColor3d fp_glSecondaryColor3d; -pfn_glTexCoord3i fp_glTexCoord3i; -pfn_glMultiTexCoord4fv fp_glMultiTexCoord4fv; -pfn_glRasterPos3i fp_glRasterPos3i; -pfn_glSecondaryColor3b fp_glSecondaryColor3b; -pfn_glRasterPos3d fp_glRasterPos3d; -pfn_glRasterPos3f fp_glRasterPos3f; -pfn_glCompressedTexImage3D fp_glCompressedTexImage3D; -pfn_glTexCoord3f fp_glTexCoord3f; -pfn_glDeleteSync fp_glDeleteSync; -pfn_glTexCoord3d fp_glTexCoord3d; -pfn_glGetTransformFeedbacki64_v fp_glGetTransformFeedbacki64_v; -pfn_glUniformMatrix4dv fp_glUniformMatrix4dv; -pfn_glTexImage2DMultisample fp_glTexImage2DMultisample; -pfn_glGetVertexAttribiv fp_glGetVertexAttribiv; -pfn_glUniformMatrix4x2dv fp_glUniformMatrix4x2dv; -pfn_glMultiDrawElements fp_glMultiDrawElements; -pfn_glVertexAttrib3fv fp_glVertexAttrib3fv; -pfn_glTexCoord3s fp_glTexCoord3s; -pfn_glUniform3iv fp_glUniform3iv; -pfn_glRasterPos3s fp_glRasterPos3s; -pfn_glPolygonMode fp_glPolygonMode; -pfn_glDrawBuffers fp_glDrawBuffers; -pfn_glGetnHistogram fp_glGetnHistogram; -pfn_glGetActiveUniformBlockiv fp_glGetActiveUniformBlockiv; -pfn_glAreTexturesResident fp_glAreTexturesResident; -pfn_glProgramUniform2d fp_glProgramUniform2d; -pfn_glProgramUniformMatrix4x3dv fp_glProgramUniformMatrix4x3dv; -pfn_glIsList fp_glIsList; -pfn_glProgramUniform4iv fp_glProgramUniform4iv; -pfn_glRasterPos2sv fp_glRasterPos2sv; -pfn_glRasterPos4sv fp_glRasterPos4sv; -pfn_glColor4s fp_glColor4s; -pfn_glGetProgramBinary fp_glGetProgramBinary; -pfn_glUseProgram fp_glUseProgram; -pfn_glLineStipple fp_glLineStipple; -pfn_glMultiTexCoord1sv fp_glMultiTexCoord1sv; -pfn_glGetProgramInfoLog fp_glGetProgramInfoLog; -pfn_glClearTexImage fp_glClearTexImage; -pfn_glGetBufferParameteriv fp_glGetBufferParameteriv; -pfn_glMultiTexCoord2iv fp_glMultiTexCoord2iv; -pfn_glUniformMatrix2x4fv fp_glUniformMatrix2x4fv; -pfn_glBindVertexArray fp_glBindVertexArray; -pfn_glColor4b fp_glColor4b; -pfn_glSecondaryColor3f fp_glSecondaryColor3f; -pfn_glColor4f fp_glColor4f; -pfn_glColor4d fp_glColor4d; -pfn_glColor4i fp_glColor4i; -pfn_glSamplerParameterIiv fp_glSamplerParameterIiv; -pfn_glMultiDrawElementsBaseVertex fp_glMultiDrawElementsBaseVertex; -pfn_glVertexAttribLFormat fp_glVertexAttribLFormat; -pfn_glRasterPos3iv fp_glRasterPos3iv; -pfn_glTextureStorage2D fp_glTextureStorage2D; -pfn_glGenerateTextureMipmap fp_glGenerateTextureMipmap; -pfn_glVertex2dv fp_glVertex2dv; -pfn_glTexCoord4sv fp_glTexCoord4sv; -pfn_glUniform2uiv fp_glUniform2uiv; -pfn_glCompressedTexSubImage1D fp_glCompressedTexSubImage1D; -pfn_glFinish fp_glFinish; -pfn_glDepthRangeIndexed fp_glDepthRangeIndexed; -pfn_glGetBooleanv fp_glGetBooleanv; -pfn_glDeleteShader fp_glDeleteShader; -pfn_glDrawElements fp_glDrawElements; -pfn_glGetInternalformati64v fp_glGetInternalformati64v; -pfn_glRasterPos2s fp_glRasterPos2s; -pfn_glCopyTextureSubImage1D fp_glCopyTextureSubImage1D; -pfn_glGetMapdv fp_glGetMapdv; -pfn_glVertexAttrib4Nsv fp_glVertexAttrib4Nsv; -pfn_glMaterialfv fp_glMaterialfv; -pfn_glTextureParameterIuiv fp_glTextureParameterIuiv; -pfn_glViewport fp_glViewport; -pfn_glUniform1uiv fp_glUniform1uiv; -pfn_glTransformFeedbackVaryings fp_glTransformFeedbackVaryings; -pfn_glIndexdv fp_glIndexdv; -pfn_glCopyTexSubImage3D fp_glCopyTexSubImage3D; -pfn_glTexCoord3iv fp_glTexCoord3iv; -pfn_glDebugMessageCallback fp_glDebugMessageCallback; -pfn_glVertexAttribI3i fp_glVertexAttribI3i; -pfn_glInvalidateTexImage fp_glInvalidateTexImage; -pfn_glVertexAttribFormat fp_glVertexAttribFormat; -pfn_glClearDepth fp_glClearDepth; -pfn_glVertexAttribI4usv fp_glVertexAttribI4usv; -pfn_glTexParameterf fp_glTexParameterf; -pfn_glVertexAttribBinding fp_glVertexAttribBinding; -pfn_glTexParameteri fp_glTexParameteri; -pfn_glGetActiveSubroutineUniformiv fp_glGetActiveSubroutineUniformiv; -pfn_glGetShaderSource fp_glGetShaderSource; -pfn_glCreateTransformFeedbacks fp_glCreateTransformFeedbacks; -pfn_glGetnTexImage fp_glGetnTexImage; -pfn_glTexBuffer fp_glTexBuffer; -pfn_glPopName fp_glPopName; -pfn_glValidateProgram fp_glValidateProgram; -pfn_glPixelStoref fp_glPixelStoref; -pfn_glUniform3uiv fp_glUniform3uiv; -pfn_glViewportIndexedf fp_glViewportIndexedf; -pfn_glRasterPos4fv fp_glRasterPos4fv; -pfn_glEvalCoord1dv fp_glEvalCoord1dv; -pfn_glMultiTexCoordP2uiv fp_glMultiTexCoordP2uiv; -pfn_glGenProgramPipelines fp_glGenProgramPipelines; -pfn_glRecti fp_glRecti; -pfn_glColor4ub fp_glColor4ub; -pfn_glMultTransposeMatrixf fp_glMultTransposeMatrixf; -pfn_glRectf fp_glRectf; -pfn_glRectd fp_glRectd; -pfn_glNormal3sv fp_glNormal3sv; -pfn_glNewList fp_glNewList; -pfn_glProgramUniformMatrix2x3dv fp_glProgramUniformMatrix2x3dv; -pfn_glColor4us fp_glColor4us; -pfn_glVertexAttribP1uiv fp_glVertexAttribP1uiv; -pfn_glLinkProgram fp_glLinkProgram; -pfn_glHint fp_glHint; -pfn_glRects fp_glRects; -pfn_glTexCoord2dv fp_glTexCoord2dv; -pfn_glRasterPos4iv fp_glRasterPos4iv; -pfn_glGetObjectLabel fp_glGetObjectLabel; -pfn_glProgramUniform2f fp_glProgramUniform2f; -pfn_glGetString fp_glGetString; -pfn_glVertexAttribP2uiv fp_glVertexAttribP2uiv; -pfn_glEdgeFlagv fp_glEdgeFlagv; -pfn_glDetachShader fp_glDetachShader; -pfn_glProgramUniform3i fp_glProgramUniform3i; -pfn_glScalef fp_glScalef; -pfn_glEndQuery fp_glEndQuery; -pfn_glScaled fp_glScaled; -pfn_glEdgeFlagPointer fp_glEdgeFlagPointer; -pfn_glFramebufferParameteri fp_glFramebufferParameteri; -pfn_glGetProgramResourceName fp_glGetProgramResourceName; -pfn_glUniformMatrix4x3dv fp_glUniformMatrix4x3dv; -pfn_glDepthRangeArrayv fp_glDepthRangeArrayv; -pfn_glCopyPixels fp_glCopyPixels; -pfn_glVertexAttribI2ui fp_glVertexAttribI2ui; -pfn_glGetProgramResourceLocation fp_glGetProgramResourceLocation; -pfn_glPopAttrib fp_glPopAttrib; -pfn_glDeleteTextures fp_glDeleteTextures; -pfn_glGetActiveAtomicCounterBufferiv fp_glGetActiveAtomicCounterBufferiv; -pfn_glStencilOpSeparate fp_glStencilOpSeparate; -pfn_glGetTextureParameteriv fp_glGetTextureParameteriv; -pfn_glDeleteQueries fp_glDeleteQueries; -pfn_glNormalP3uiv fp_glNormalP3uiv; -pfn_glVertexAttrib4f fp_glVertexAttrib4f; -pfn_glVertexAttrib4d fp_glVertexAttrib4d; -pfn_glViewportIndexedfv fp_glViewportIndexedfv; -pfn_glInitNames fp_glInitNames; -pfn_glGetBufferParameteri64v fp_glGetBufferParameteri64v; -pfn_glColor3dv fp_glColor3dv; -pfn_glVertexAttribI1i fp_glVertexAttribI1i; -pfn_glGetTexParameteriv fp_glGetTexParameteriv; -pfn_glWaitSync fp_glWaitSync; -pfn_glCreateVertexArrays fp_glCreateVertexArrays; -pfn_glProgramUniform1dv fp_glProgramUniform1dv; -pfn_glVertexAttrib4s fp_glVertexAttrib4s; -pfn_glColorMaterial fp_glColorMaterial; -pfn_glSampleCoverage fp_glSampleCoverage; -pfn_glSamplerParameteri fp_glSamplerParameteri; -pfn_glClearBufferSubData fp_glClearBufferSubData; -pfn_glSamplerParameterf fp_glSamplerParameterf; -pfn_glTexStorage1D fp_glTexStorage1D; -pfn_glUniform1f fp_glUniform1f; -pfn_glGetVertexAttribfv fp_glGetVertexAttribfv; -pfn_glUniform1d fp_glUniform1d; -pfn_glRenderMode fp_glRenderMode; -pfn_glGetCompressedTexImage fp_glGetCompressedTexImage; -pfn_glGetnCompressedTexImage fp_glGetnCompressedTexImage; -pfn_glWindowPos2dv fp_glWindowPos2dv; -pfn_glUniform1i fp_glUniform1i; -pfn_glGetActiveAttrib fp_glGetActiveAttrib; -pfn_glUniform3i fp_glUniform3i; -pfn_glPixelTransferi fp_glPixelTransferi; -pfn_glTexSubImage2D fp_glTexSubImage2D; -pfn_glDisable fp_glDisable; -pfn_glLogicOp fp_glLogicOp; -pfn_glEvalPoint2 fp_glEvalPoint2; -pfn_glPixelTransferf fp_glPixelTransferf; -pfn_glSecondaryColor3i fp_glSecondaryColor3i; -pfn_glProgramUniform4uiv fp_glProgramUniform4uiv; -pfn_glUniform4ui fp_glUniform4ui; -pfn_glColor3f fp_glColor3f; -pfn_glNamedFramebufferReadBuffer fp_glNamedFramebufferReadBuffer; -pfn_glBindFramebuffer fp_glBindFramebuffer; -pfn_glGetTexEnvfv fp_glGetTexEnvfv; -pfn_glRectfv fp_glRectfv; -pfn_glCullFace fp_glCullFace; -pfn_glGetLightfv fp_glGetLightfv; -pfn_glGetnUniformiv fp_glGetnUniformiv; -pfn_glColor3d fp_glColor3d; -pfn_glProgramUniform4i fp_glProgramUniform4i; -pfn_glTexGend fp_glTexGend; -pfn_glProgramUniform4f fp_glProgramUniform4f; -pfn_glTexGeni fp_glTexGeni; -pfn_glProgramUniform4d fp_glProgramUniform4d; -pfn_glTextureParameterIiv fp_glTextureParameterIiv; -pfn_glMultiTexCoord3s fp_glMultiTexCoord3s; -pfn_glGetStringi fp_glGetStringi; -pfn_glGetTextureParameterfv fp_glGetTextureParameterfv; -pfn_glTextureSubImage2D fp_glTextureSubImage2D; -pfn_glMultiTexCoord3i fp_glMultiTexCoord3i; -pfn_glMultiTexCoord3f fp_glMultiTexCoord3f; -pfn_glDrawTransformFeedbackStream fp_glDrawTransformFeedbackStream; -pfn_glMultiTexCoord3d fp_glMultiTexCoord3d; -pfn_glAttachShader fp_glAttachShader; -pfn_glFogCoorddv fp_glFogCoorddv; -pfn_glUniformMatrix2x3fv fp_glUniformMatrix2x3fv; -pfn_glGetTexGenfv fp_glGetTexGenfv; -pfn_glQueryCounter fp_glQueryCounter; -pfn_glFogCoordPointer fp_glFogCoordPointer; -pfn_glProgramUniformMatrix3dv fp_glProgramUniformMatrix3dv; -pfn_glProvokingVertex fp_glProvokingVertex; -pfn_glShaderBinary fp_glShaderBinary; -pfn_glUnmapNamedBuffer fp_glUnmapNamedBuffer; -pfn_glGetnColorTable fp_glGetnColorTable; -pfn_glFramebufferTexture3D fp_glFramebufferTexture3D; -pfn_glTexGeniv fp_glTexGeniv; -pfn_glRasterPos2dv fp_glRasterPos2dv; -pfn_glSecondaryColor3dv fp_glSecondaryColor3dv; -pfn_glClientActiveTexture fp_glClientActiveTexture; -pfn_glNamedRenderbufferStorageMultisample fp_glNamedRenderbufferStorageMultisample; -pfn_glVertexAttribI4sv fp_glVertexAttribI4sv; -pfn_glClearNamedBufferData fp_glClearNamedBufferData; -pfn_glSecondaryColor3us fp_glSecondaryColor3us; -pfn_glNormalP3ui fp_glNormalP3ui; -pfn_glTexEnvfv fp_glTexEnvfv; -pfn_glReadBuffer fp_glReadBuffer; -pfn_glViewportArrayv fp_glViewportArrayv; -pfn_glTexParameterIuiv fp_glTexParameterIuiv; -pfn_glDrawArraysInstanced fp_glDrawArraysInstanced; -pfn_glGenerateMipmap fp_glGenerateMipmap; -pfn_glCompressedTextureSubImage2D fp_glCompressedTextureSubImage2D; -pfn_glProgramUniformMatrix2fv fp_glProgramUniformMatrix2fv; -pfn_glWindowPos3fv fp_glWindowPos3fv; -pfn_glUniformMatrix3x4dv fp_glUniformMatrix3x4dv; -pfn_glLightModelfv fp_glLightModelfv; -pfn_glSamplerParameteriv fp_glSamplerParameteriv; -pfn_glDeleteLists fp_glDeleteLists; -pfn_glGetClipPlane fp_glGetClipPlane; -pfn_glVertex4dv fp_glVertex4dv; -pfn_glTexCoord2d fp_glTexCoord2d; -pfn_glPopMatrix fp_glPopMatrix; -pfn_glTexCoord2f fp_glTexCoord2f; -pfn_glColor4iv fp_glColor4iv; -pfn_glIndexubv fp_glIndexubv; -pfn_glCheckNamedFramebufferStatus fp_glCheckNamedFramebufferStatus; -pfn_glUnmapBuffer fp_glUnmapBuffer; -pfn_glTexCoord2i fp_glTexCoord2i; -pfn_glRasterPos4d fp_glRasterPos4d; -pfn_glRasterPos4f fp_glRasterPos4f; -pfn_glProgramUniform1iv fp_glProgramUniform1iv; -pfn_glGetVertexArrayiv fp_glGetVertexArrayiv; -pfn_glCopyTextureSubImage2D fp_glCopyTextureSubImage2D; -pfn_glVertexAttrib3s fp_glVertexAttrib3s; -pfn_glTexCoord2s fp_glTexCoord2s; -pfn_glBindRenderbuffer fp_glBindRenderbuffer; -pfn_glVertex3fv fp_glVertex3fv; -pfn_glTexCoord4dv fp_glTexCoord4dv; -pfn_glMaterialiv fp_glMaterialiv; -pfn_glVertexAttribP4uiv fp_glVertexAttribP4uiv; -pfn_glGetProgramStageiv fp_glGetProgramStageiv; -pfn_glIsProgram fp_glIsProgram; -pfn_glVertexAttrib4bv fp_glVertexAttrib4bv; -pfn_glVertex4s fp_glVertex4s; -pfn_glUniformMatrix3x2dv fp_glUniformMatrix3x2dv; -pfn_glVertexAttrib4fv fp_glVertexAttrib4fv; -pfn_glNormal3dv fp_glNormal3dv; -pfn_glIsTransformFeedback fp_glIsTransformFeedback; -pfn_glUniform4i fp_glUniform4i; -pfn_glActiveTexture fp_glActiveTexture; -pfn_glEnableVertexAttribArray fp_glEnableVertexAttribArray; -pfn_glRotated fp_glRotated; -pfn_glIsProgramPipeline fp_glIsProgramPipeline; -pfn_glRotatef fp_glRotatef; -pfn_glVertex4i fp_glVertex4i; -pfn_glReadPixels fp_glReadPixels; -pfn_glVertexAttribI3iv fp_glVertexAttribI3iv; -pfn_glLoadName fp_glLoadName; -pfn_glUniform4f fp_glUniform4f; -pfn_glRenderbufferStorageMultisample fp_glRenderbufferStorageMultisample; -pfn_glCreateProgramPipelines fp_glCreateProgramPipelines; -pfn_glGenVertexArrays fp_glGenVertexArrays; -pfn_glShadeModel fp_glShadeModel; -pfn_glMapGrid1d fp_glMapGrid1d; -pfn_glGetUniformfv fp_glGetUniformfv; -pfn_glMapGrid1f fp_glMapGrid1f; -pfn_glSamplerParameterfv fp_glSamplerParameterfv; -pfn_glVertexAttribLPointer fp_glVertexAttribLPointer; -pfn_glDisableClientState fp_glDisableClientState; -pfn_glMultiTexCoord3sv fp_glMultiTexCoord3sv; -pfn_glGetnUniformfv fp_glGetnUniformfv; -pfn_glDrawElementsInstancedBaseVertex fp_glDrawElementsInstancedBaseVertex; -pfn_glVertexAttribL2dv fp_glVertexAttribL2dv; -pfn_glMultiDrawElementsIndirect fp_glMultiDrawElementsIndirect; -pfn_glEnableVertexArrayAttrib fp_glEnableVertexArrayAttrib; -pfn_glSecondaryColorPointer fp_glSecondaryColorPointer; -pfn_glAlphaFunc fp_glAlphaFunc; -pfn_glUniform1iv fp_glUniform1iv; -pfn_glCreateShaderProgramv fp_glCreateShaderProgramv; -pfn_glGetActiveSubroutineName fp_glGetActiveSubroutineName; -pfn_glMultiTexCoord4iv fp_glMultiTexCoord4iv; -pfn_glVertexAttribL2d fp_glVertexAttribL2d; -pfn_glGetQueryObjectiv fp_glGetQueryObjectiv; -pfn_glStencilFunc fp_glStencilFunc; -pfn_glInvalidateNamedFramebufferData fp_glInvalidateNamedFramebufferData; -pfn_glMultiTexCoord1fv fp_glMultiTexCoord1fv; -pfn_glUniformBlockBinding fp_glUniformBlockBinding; -pfn_glColor4uiv fp_glColor4uiv; -pfn_glRectiv fp_glRectiv; -pfn_glColorP4ui fp_glColorP4ui; -pfn_glUseProgramStages fp_glUseProgramStages; -pfn_glRasterPos3dv fp_glRasterPos3dv; -pfn_glEvalMesh2 fp_glEvalMesh2; -pfn_glEvalMesh1 fp_glEvalMesh1; -pfn_glTexCoordPointer fp_glTexCoordPointer; -pfn_glProgramUniform3f fp_glProgramUniform3f; -pfn_glProgramUniform3d fp_glProgramUniform3d; -pfn_glVertexAttrib4Nubv fp_glVertexAttrib4Nubv; -pfn_glVertexAttribI4iv fp_glVertexAttribI4iv; -pfn_glGetProgramPipelineiv fp_glGetProgramPipelineiv; -pfn_glTexStorage3D fp_glTexStorage3D; -pfn_glEvalCoord2fv fp_glEvalCoord2fv; -pfn_glNamedFramebufferDrawBuffer fp_glNamedFramebufferDrawBuffer; -pfn_glGetQueryIndexediv fp_glGetQueryIndexediv; -pfn_glColor4ubv fp_glColor4ubv; -pfn_glLoadTransposeMatrixd fp_glLoadTransposeMatrixd; -pfn_glLoadTransposeMatrixf fp_glLoadTransposeMatrixf; -pfn_glTextureParameteriv fp_glTextureParameteriv; -pfn_glObjectLabel fp_glObjectLabel; -pfn_glVertexAttribI4i fp_glVertexAttribI4i; -pfn_glRasterPos2iv fp_glRasterPos2iv; -pfn_glGetBufferSubData fp_glGetBufferSubData; -pfn_glGetVertexAttribLdv fp_glGetVertexAttribLdv; -pfn_glGetnUniformuiv fp_glGetnUniformuiv; -pfn_glGetQueryBufferObjectiv fp_glGetQueryBufferObjectiv; -pfn_glTexEnviv fp_glTexEnviv; -pfn_glBlendEquationSeparate fp_glBlendEquationSeparate; -pfn_glVertexAttribI1ui fp_glVertexAttribI1ui; -pfn_glGenBuffers fp_glGenBuffers; -pfn_glSelectBuffer fp_glSelectBuffer; -pfn_glGetSubroutineIndex fp_glGetSubroutineIndex; -pfn_glVertexAttrib2sv fp_glVertexAttrib2sv; -pfn_glScissorIndexedv fp_glScissorIndexedv; -pfn_glPushAttrib fp_glPushAttrib; -pfn_glVertexAttribIPointer fp_glVertexAttribIPointer; -pfn_glBlendFunc fp_glBlendFunc; -pfn_glCreateProgram fp_glCreateProgram; -pfn_glNamedBufferSubData fp_glNamedBufferSubData; -pfn_glTexImage3D fp_glTexImage3D; -pfn_glIsFramebuffer fp_glIsFramebuffer; -pfn_glClearNamedFramebufferfv fp_glClearNamedFramebufferfv; -pfn_glLightiv fp_glLightiv; -pfn_glGetNamedBufferSubData fp_glGetNamedBufferSubData; -pfn_glCompressedTextureSubImage3D fp_glCompressedTextureSubImage3D; -pfn_glPrimitiveRestartIndex fp_glPrimitiveRestartIndex; -pfn_glFlushMappedNamedBufferRange fp_glFlushMappedNamedBufferRange; -pfn_glInvalidateTexSubImage fp_glInvalidateTexSubImage; -pfn_glTexGenfv fp_glTexGenfv; -pfn_glGetTextureParameterIuiv fp_glGetTextureParameterIuiv; -pfn_glGetnConvolutionFilter fp_glGetnConvolutionFilter; -pfn_glBindImageTextures fp_glBindImageTextures; -pfn_glEnd fp_glEnd; -pfn_glDeleteBuffers fp_glDeleteBuffers; -pfn_glBindProgramPipeline fp_glBindProgramPipeline; -pfn_glScissor fp_glScissor; -pfn_glTexCoordP4uiv fp_glTexCoordP4uiv; -pfn_glClipPlane fp_glClipPlane; -pfn_glPushName fp_glPushName; -pfn_glTexGendv fp_glTexGendv; -pfn_glIndexub fp_glIndexub; -pfn_glGetNamedFramebufferAttachmentParameteriv fp_glGetNamedFramebufferAttachmentParameteriv; -pfn_glNamedFramebufferRenderbuffer fp_glNamedFramebufferRenderbuffer; -pfn_glVertexP2uiv fp_glVertexP2uiv; -pfn_glSecondaryColor3iv fp_glSecondaryColor3iv; -pfn_glRasterPos4i fp_glRasterPos4i; -pfn_glMultTransposeMatrixd fp_glMultTransposeMatrixd; -pfn_glClearColor fp_glClearColor; -pfn_glVertexAttrib4uiv fp_glVertexAttrib4uiv; -pfn_glNormal3s fp_glNormal3s; -pfn_glVertexAttrib4Niv fp_glVertexAttrib4Niv; -pfn_glProgramUniformMatrix2x3fv fp_glProgramUniformMatrix2x3fv; -pfn_glClearBufferiv fp_glClearBufferiv; -pfn_glPointParameteri fp_glPointParameteri; -pfn_glProgramUniform4dv fp_glProgramUniform4dv; -pfn_glColorP4uiv fp_glColorP4uiv; -pfn_glBlendColor fp_glBlendColor; -pfn_glGetnPixelMapuiv fp_glGetnPixelMapuiv; -pfn_glGetTextureLevelParameteriv fp_glGetTextureLevelParameteriv; -pfn_glWindowPos3d fp_glWindowPos3d; -pfn_glProgramUniform3fv fp_glProgramUniform3fv; -pfn_glVertexAttribI2uiv fp_glVertexAttribI2uiv; -pfn_glGetNamedFramebufferParameteriv fp_glGetNamedFramebufferParameteriv; -pfn_glSamplerParameterIuiv fp_glSamplerParameterIuiv; -pfn_glUniform3ui fp_glUniform3ui; -pfn_glProgramUniform3uiv fp_glProgramUniform3uiv; -pfn_glColor4dv fp_glColor4dv; -pfn_glVertexAttribI4uiv fp_glVertexAttribI4uiv; -pfn_glPointParameterfv fp_glPointParameterfv; -pfn_glResumeTransformFeedback fp_glResumeTransformFeedback; -pfn_glUniform2fv fp_glUniform2fv; -pfn_glGetActiveSubroutineUniformName fp_glGetActiveSubroutineUniformName; -pfn_glGetProgramResourceIndex fp_glGetProgramResourceIndex; -pfn_glSecondaryColor3ub fp_glSecondaryColor3ub; -pfn_glDrawElementsIndirect fp_glDrawElementsIndirect; -pfn_glGetTextureLevelParameterfv fp_glGetTextureLevelParameterfv; -pfn_glSecondaryColor3ui fp_glSecondaryColor3ui; -pfn_glTexCoord3dv fp_glTexCoord3dv; -pfn_glGetNamedBufferPointerv fp_glGetNamedBufferPointerv; -pfn_glDispatchComputeIndirect fp_glDispatchComputeIndirect; -pfn_glInvalidateNamedFramebufferSubData fp_glInvalidateNamedFramebufferSubData; -pfn_glGetSamplerParameterIuiv fp_glGetSamplerParameterIuiv; -pfn_glBindBufferRange fp_glBindBufferRange; -pfn_glNormal3iv fp_glNormal3iv; -pfn_glTextureSubImage1D fp_glTextureSubImage1D; -pfn_glVertexAttribL3dv fp_glVertexAttribL3dv; -pfn_glGetUniformdv fp_glGetUniformdv; -pfn_glWindowPos3s fp_glWindowPos3s; -pfn_glPointParameterf fp_glPointParameterf; -pfn_glClearDepthf fp_glClearDepthf; -pfn_glGetVertexAttribIuiv fp_glGetVertexAttribIuiv; -pfn_glWindowPos3i fp_glWindowPos3i; -pfn_glMultiTexCoord4s fp_glMultiTexCoord4s; -pfn_glGetTextureSubImage fp_glGetTextureSubImage; -pfn_glWindowPos3f fp_glWindowPos3f; -pfn_glGenTransformFeedbacks fp_glGenTransformFeedbacks; -pfn_glColor3us fp_glColor3us; -pfn_glColor3uiv fp_glColor3uiv; -pfn_glVertexAttrib4Nusv fp_glVertexAttrib4Nusv; -pfn_glGetLightiv fp_glGetLightiv; -pfn_glDepthFunc fp_glDepthFunc; -pfn_glCompressedTexSubImage2D fp_glCompressedTexSubImage2D; -pfn_glListBase fp_glListBase; -pfn_glMultiTexCoord4f fp_glMultiTexCoord4f; -pfn_glColor3ub fp_glColor3ub; -pfn_glMultiTexCoord4d fp_glMultiTexCoord4d; -pfn_glVertexAttribI4bv fp_glVertexAttribI4bv; -pfn_glBlendEquationSeparatei fp_glBlendEquationSeparatei; -pfn_glGetTexParameterfv fp_glGetTexParameterfv; -pfn_glColor3ui fp_glColor3ui; -pfn_glGetProgramResourceLocationIndex fp_glGetProgramResourceLocationIndex; -pfn_glMultiTexCoord4i fp_glMultiTexCoord4i; -pfn_glBufferStorage fp_glBufferStorage; -pfn_glGetPolygonStipple fp_glGetPolygonStipple; -pfn_glClientWaitSync fp_glClientWaitSync; -pfn_glVertexAttribI4ui fp_glVertexAttribI4ui; -pfn_glGetFloati_v fp_glGetFloati_v; -pfn_glMultiTexCoord4dv fp_glMultiTexCoord4dv; -pfn_glColorMask fp_glColorMask; -pfn_glTextureBuffer fp_glTextureBuffer; -pfn_glTexParameterIiv fp_glTexParameterIiv; -pfn_glBlendEquation fp_glBlendEquation; -pfn_glGetUniformLocation fp_glGetUniformLocation; -pfn_glGetSamplerParameteriv fp_glGetSamplerParameteriv; -pfn_glVertexArrayAttribFormat fp_glVertexArrayAttribFormat; -pfn_glReadnPixels fp_glReadnPixels; -pfn_glRasterPos4s fp_glRasterPos4s; -pfn_glEndTransformFeedback fp_glEndTransformFeedback; -pfn_glVertexAttrib4usv fp_glVertexAttrib4usv; -pfn_glGetUniformSubroutineuiv fp_glGetUniformSubroutineuiv; -pfn_glMultiTexCoord3dv fp_glMultiTexCoord3dv; -pfn_glBindVertexBuffer fp_glBindVertexBuffer; -pfn_glColor4sv fp_glColor4sv; -pfn_glDebugMessageInsert fp_glDebugMessageInsert; -pfn_glCreateSamplers fp_glCreateSamplers; -pfn_glPopClientAttrib fp_glPopClientAttrib; -pfn_glClearBufferData fp_glClearBufferData; -pfn_glBeginTransformFeedback fp_glBeginTransformFeedback; -pfn_glFogf fp_glFogf; -pfn_glVertexAttribI1iv fp_glVertexAttribI1iv; -pfn_glProgramBinary fp_glProgramBinary; -pfn_glIsSampler fp_glIsSampler; -pfn_glVertexP3ui fp_glVertexP3ui; -pfn_glVertexAttribDivisor fp_glVertexAttribDivisor; -pfn_glBindSamplers fp_glBindSamplers; -pfn_glColor3iv fp_glColor3iv; -pfn_glCompressedTexImage1D fp_glCompressedTexImage1D; -pfn_glDeleteTransformFeedbacks fp_glDeleteTransformFeedbacks; -pfn_glCopyTexSubImage1D fp_glCopyTexSubImage1D; -pfn_glTexCoord1i fp_glTexCoord1i; -pfn_glCheckFramebufferStatus fp_glCheckFramebufferStatus; -pfn_glTexCoord1d fp_glTexCoord1d; -pfn_glTexCoord1f fp_glTexCoord1f; -pfn_glTextureStorage3D fp_glTextureStorage3D; -pfn_glEndConditionalRender fp_glEndConditionalRender; -pfn_glEnableClientState fp_glEnableClientState; -pfn_glBindAttribLocation fp_glBindAttribLocation; -pfn_glUniformMatrix4x2fv fp_glUniformMatrix4x2fv; -pfn_glUniformMatrix2dv fp_glUniformMatrix2dv; -pfn_glBlendFunci fp_glBlendFunci; -pfn_glMultiTexCoord2sv fp_glMultiTexCoord2sv; -pfn_glVertexAttrib1dv fp_glVertexAttrib1dv; -pfn_glDrawRangeElements fp_glDrawRangeElements; -pfn_glTexCoord1s fp_glTexCoord1s; -pfn_glBindBufferBase fp_glBindBufferBase; -pfn_glBufferSubData fp_glBufferSubData; -pfn_glVertexAttrib4iv fp_glVertexAttrib4iv; -pfn_glGenLists fp_glGenLists; -pfn_glColor3bv fp_glColor3bv; -pfn_glMapBufferRange fp_glMapBufferRange; -pfn_glFramebufferTexture fp_glFramebufferTexture; -pfn_glBlendFuncSeparatei fp_glBlendFuncSeparatei; -pfn_glProgramUniformMatrix4x2fv fp_glProgramUniformMatrix4x2fv; -pfn_glVertexAttribL1d fp_glVertexAttribL1d; -pfn_glGetTexGendv fp_glGetTexGendv; -pfn_glClearNamedFramebufferiv fp_glClearNamedFramebufferiv; -pfn_glMultiDrawArrays fp_glMultiDrawArrays; -pfn_glEndList fp_glEndList; -pfn_glScissorIndexed fp_glScissorIndexed; -pfn_glVertexP4uiv fp_glVertexP4uiv; -pfn_glUniform2ui fp_glUniform2ui; -pfn_glVertexAttribI2iv fp_glVertexAttribI2iv; -pfn_glGetnMapdv fp_glGetnMapdv; -pfn_glColor3usv fp_glColor3usv; -pfn_glWindowPos2fv fp_glWindowPos2fv; -pfn_glTextureView fp_glTextureView; -pfn_glDisablei fp_glDisablei; -pfn_glProgramUniformMatrix2x4fv fp_glProgramUniformMatrix2x4fv; -pfn_glCreateRenderbuffers fp_glCreateRenderbuffers; -pfn_glIndexMask fp_glIndexMask; -pfn_glPushClientAttrib fp_glPushClientAttrib; -pfn_glShaderSource fp_glShaderSource; -pfn_glGetnSeparableFilter fp_glGetnSeparableFilter; -pfn_glGetActiveUniformBlockName fp_glGetActiveUniformBlockName; -pfn_glVertexAttribI3uiv fp_glVertexAttribI3uiv; -pfn_glReleaseShaderCompiler fp_glReleaseShaderCompiler; -pfn_glVertexAttribIFormat fp_glVertexAttribIFormat; -pfn_glCreateFramebuffers fp_glCreateFramebuffers; -pfn_glClearAccum fp_glClearAccum; -pfn_glGetSynciv fp_glGetSynciv; -pfn_glProgramUniform2uiv fp_glProgramUniform2uiv; -pfn_glGetnPixelMapfv fp_glGetnPixelMapfv; -pfn_glTexCoordP2uiv fp_glTexCoordP2uiv; -pfn_glPatchParameteri fp_glPatchParameteri; -pfn_glProgramUniform2i fp_glProgramUniform2i; -pfn_glUniform2f fp_glUniform2f; -pfn_glGetNamedBufferParameteri64v fp_glGetNamedBufferParameteri64v; -pfn_glBeginQuery fp_glBeginQuery; -pfn_glGetUniformBlockIndex fp_glGetUniformBlockIndex; -pfn_glBindBuffer fp_glBindBuffer; -pfn_glMap2d fp_glMap2d; -pfn_glMap2f fp_glMap2f; -pfn_glTexStorage2DMultisample fp_glTexStorage2DMultisample; -pfn_glUniform2d fp_glUniform2d; -pfn_glVertex4d fp_glVertex4d; -pfn_glUniformMatrix2fv fp_glUniformMatrix2fv; -pfn_glTexCoord1sv fp_glTexCoord1sv; -pfn_glBufferData fp_glBufferData; -pfn_glEvalPoint1 fp_glEvalPoint1; -pfn_glGetTexParameterIiv fp_glGetTexParameterIiv; -pfn_glGetQueryBufferObjectui64v fp_glGetQueryBufferObjectui64v; -pfn_glTexCoord1dv fp_glTexCoord1dv; -pfn_glTexCoordP1ui fp_glTexCoordP1ui; -pfn_glGetError fp_glGetError; -pfn_glGetTexEnviv fp_glGetTexEnviv; -pfn_glGetProgramiv fp_glGetProgramiv; -pfn_glVertexAttribP2ui fp_glVertexAttribP2ui; -pfn_glGetFloatv fp_glGetFloatv; -pfn_glTexSubImage1D fp_glTexSubImage1D; -pfn_glMultiTexCoord2fv fp_glMultiTexCoord2fv; -pfn_glUniformMatrix2x4dv fp_glUniformMatrix2x4dv; -pfn_glVertexAttrib2fv fp_glVertexAttrib2fv; -pfn_glEvalCoord1d fp_glEvalCoord1d; -pfn_glGetTexLevelParameterfv fp_glGetTexLevelParameterfv; -pfn_glEvalCoord1f fp_glEvalCoord1f; -pfn_glPixelMapfv fp_glPixelMapfv; -pfn_glVertexAttribP3uiv fp_glVertexAttribP3uiv; -pfn_glGetPixelMapusv fp_glGetPixelMapusv; -pfn_glSecondaryColorP3uiv fp_glSecondaryColorP3uiv; -pfn_glGetIntegerv fp_glGetIntegerv; -pfn_glAccum fp_glAccum; -pfn_glGetVertexArrayIndexed64iv fp_glGetVertexArrayIndexed64iv; -pfn_glGetBufferPointerv fp_glGetBufferPointerv; -pfn_glGetVertexAttribIiv fp_glGetVertexAttribIiv; -pfn_glRasterPos4dv fp_glRasterPos4dv; -pfn_glProgramUniform4fv fp_glProgramUniform4fv; -pfn_glTexCoord2iv fp_glTexCoord2iv; -pfn_glTextureBarrier fp_glTextureBarrier; -pfn_glIsQuery fp_glIsQuery; -pfn_glBlendBarrier fp_glBlendBarrier; -pfn_glProgramUniform2ui fp_glProgramUniform2ui; -pfn_glProgramUniform4ui fp_glProgramUniform4ui; -pfn_glVertexAttrib4sv fp_glVertexAttrib4sv; -pfn_glWindowPos3dv fp_glWindowPos3dv; -pfn_glTexImage2D fp_glTexImage2D; -pfn_glStencilMask fp_glStencilMask; -pfn_glDrawPixels fp_glDrawPixels; -pfn_glMultMatrixd fp_glMultMatrixd; -pfn_glMultMatrixf fp_glMultMatrixf; -pfn_glIsTexture fp_glIsTexture; -pfn_glGetMaterialiv fp_glGetMaterialiv; -pfn_glNamedBufferData fp_glNamedBufferData; -pfn_glUniform1fv fp_glUniform1fv; -pfn_glLoadMatrixf fp_glLoadMatrixf; -pfn_glTexStorage2D fp_glTexStorage2D; -pfn_glLoadMatrixd fp_glLoadMatrixd; -pfn_glClearNamedBufferSubData fp_glClearNamedBufferSubData; -pfn_glMapNamedBufferRange fp_glMapNamedBufferRange; -pfn_glNamedFramebufferTextureLayer fp_glNamedFramebufferTextureLayer; -pfn_glTexParameterfv fp_glTexParameterfv; -pfn_glUniformMatrix3fv fp_glUniformMatrix3fv; -pfn_glVertex4f fp_glVertex4f; -pfn_glRectsv fp_glRectsv; -pfn_glColor4usv fp_glColor4usv; -pfn_glUniform3dv fp_glUniform3dv; -pfn_glProgramUniformMatrix4x3fv fp_glProgramUniformMatrix4x3fv; -pfn_glPolygonStipple fp_glPolygonStipple; -pfn_glBindBuffersBase fp_glBindBuffersBase; -pfn_glInterleavedArrays fp_glInterleavedArrays; -pfn_glGetSubroutineUniformLocation fp_glGetSubroutineUniformLocation; -pfn_glNormal3i fp_glNormal3i; -pfn_glNormal3f fp_glNormal3f; -pfn_glNormal3d fp_glNormal3d; -pfn_glNormal3b fp_glNormal3b; -pfn_glGetFramebufferParameteriv fp_glGetFramebufferParameteriv; -pfn_glPixelMapusv fp_glPixelMapusv; -pfn_glGetTexGeniv fp_glGetTexGeniv; -pfn_glArrayElement fp_glArrayElement; -pfn_glGetCompressedTextureSubImage fp_glGetCompressedTextureSubImage; -pfn_glCopyBufferSubData fp_glCopyBufferSubData; -pfn_glVertexAttribI1uiv fp_glVertexAttribI1uiv; -pfn_glVertexAttrib2d fp_glVertexAttrib2d; -pfn_glBindTransformFeedback fp_glBindTransformFeedback; -pfn_glVertexAttrib2f fp_glVertexAttrib2f; -pfn_glVertexAttrib3dv fp_glVertexAttrib3dv; -pfn_glGetQueryObjectui64v fp_glGetQueryObjectui64v; -pfn_glDepthMask fp_glDepthMask; -pfn_glVertexAttrib2s fp_glVertexAttrib2s; -pfn_glColor3fv fp_glColor3fv; -pfn_glTexImage3DMultisample fp_glTexImage3DMultisample; -pfn_glProgramUniform1fv fp_glProgramUniform1fv; -pfn_glUniformMatrix4fv fp_glUniformMatrix4fv; -pfn_glUniform4fv fp_glUniform4fv; -pfn_glGetActiveUniform fp_glGetActiveUniform; -pfn_glColorPointer fp_glColorPointer; -pfn_glFrontFace fp_glFrontFace; -pfn_glTexBufferRange fp_glTexBufferRange; -pfn_glCreateBuffers fp_glCreateBuffers; -pfn_glNamedFramebufferParameteri fp_glNamedFramebufferParameteri; -pfn_glDrawArraysInstancedBaseInstance fp_glDrawArraysInstancedBaseInstance; -pfn_glGetBooleani_v fp_glGetBooleani_v; -pfn_glVertexAttribL3d fp_glVertexAttribL3d; -pfn_glDeleteProgramPipelines fp_glDeleteProgramPipelines; -pfn_glClearBufferuiv fp_glClearBufferuiv; -pfn_glClipControl fp_glClipControl; -pfn_glGetProgramResourceiv fp_glGetProgramResourceiv; -pfn_glBlendBarrierKHR fp_glBlendBarrierKHR; -pfn_glDebugMessageControlKHR fp_glDebugMessageControlKHR; -pfn_glDebugMessageInsertKHR fp_glDebugMessageInsertKHR; -pfn_glDebugMessageCallbackKHR fp_glDebugMessageCallbackKHR; -pfn_glGetDebugMessageLogKHR fp_glGetDebugMessageLogKHR; -pfn_glPushDebugGroupKHR fp_glPushDebugGroupKHR; -pfn_glPopDebugGroupKHR fp_glPopDebugGroupKHR; -pfn_glObjectLabelKHR fp_glObjectLabelKHR; -pfn_glGetObjectLabelKHR fp_glGetObjectLabelKHR; -pfn_glObjectPtrLabelKHR fp_glObjectPtrLabelKHR; -pfn_glGetObjectPtrLabelKHR fp_glGetObjectPtrLabelKHR; -pfn_glGetPointervKHR fp_glGetPointervKHR; -pfn_glGetGraphicsResetStatusKHR fp_glGetGraphicsResetStatusKHR; -pfn_glReadnPixelsKHR fp_glReadnPixelsKHR; -pfn_glGetnUniformfvKHR fp_glGetnUniformfvKHR; -pfn_glGetnUniformivKHR fp_glGetnUniformivKHR; -pfn_glGetnUniformuivKHR fp_glGetnUniformuivKHR; -pfn_glGetTextureHandleARB fp_glGetTextureHandleARB; -pfn_glGetTextureSamplerHandleARB fp_glGetTextureSamplerHandleARB; -pfn_glMakeTextureHandleResidentARB fp_glMakeTextureHandleResidentARB; -pfn_glMakeTextureHandleNonResidentARB fp_glMakeTextureHandleNonResidentARB; -pfn_glGetImageHandleARB fp_glGetImageHandleARB; -pfn_glMakeImageHandleResidentARB fp_glMakeImageHandleResidentARB; -pfn_glMakeImageHandleNonResidentARB fp_glMakeImageHandleNonResidentARB; -pfn_glUniformHandleui64ARB fp_glUniformHandleui64ARB; -pfn_glUniformHandleui64vARB fp_glUniformHandleui64vARB; -pfn_glProgramUniformHandleui64ARB fp_glProgramUniformHandleui64ARB; -pfn_glProgramUniformHandleui64vARB fp_glProgramUniformHandleui64vARB; -pfn_glIsTextureHandleResidentARB fp_glIsTextureHandleResidentARB; -pfn_glIsImageHandleResidentARB fp_glIsImageHandleResidentARB; -pfn_glVertexAttribL1ui64ARB fp_glVertexAttribL1ui64ARB; -pfn_glVertexAttribL1ui64vARB fp_glVertexAttribL1ui64vARB; -pfn_glGetVertexAttribLui64vARB fp_glGetVertexAttribLui64vARB; -pfn_glCreateSyncFromCLeventARB fp_glCreateSyncFromCLeventARB; -pfn_glClampColorARB fp_glClampColorARB; -pfn_glDispatchComputeGroupSizeARB fp_glDispatchComputeGroupSizeARB; -pfn_glDebugMessageControlARB fp_glDebugMessageControlARB; -pfn_glDebugMessageInsertARB fp_glDebugMessageInsertARB; -pfn_glDebugMessageCallbackARB fp_glDebugMessageCallbackARB; -pfn_glGetDebugMessageLogARB fp_glGetDebugMessageLogARB; -pfn_glBlendEquationiARB fp_glBlendEquationiARB; -pfn_glBlendEquationSeparateiARB fp_glBlendEquationSeparateiARB; -pfn_glBlendFunciARB fp_glBlendFunciARB; -pfn_glBlendFuncSeparateiARB fp_glBlendFuncSeparateiARB; -pfn_glDrawArraysInstancedARB fp_glDrawArraysInstancedARB; -pfn_glDrawElementsInstancedARB fp_glDrawElementsInstancedARB; -pfn_glPrimitiveBoundingBoxARB fp_glPrimitiveBoundingBoxARB; -pfn_glProgramParameteriARB fp_glProgramParameteriARB; -pfn_glFramebufferTextureARB fp_glFramebufferTextureARB; -pfn_glFramebufferTextureLayerARB fp_glFramebufferTextureLayerARB; -pfn_glFramebufferTextureFaceARB fp_glFramebufferTextureFaceARB; -pfn_glUniform1i64ARB fp_glUniform1i64ARB; -pfn_glUniform2i64ARB fp_glUniform2i64ARB; -pfn_glUniform3i64ARB fp_glUniform3i64ARB; -pfn_glUniform4i64ARB fp_glUniform4i64ARB; -pfn_glUniform1i64vARB fp_glUniform1i64vARB; -pfn_glUniform2i64vARB fp_glUniform2i64vARB; -pfn_glUniform3i64vARB fp_glUniform3i64vARB; -pfn_glUniform4i64vARB fp_glUniform4i64vARB; -pfn_glUniform1ui64ARB fp_glUniform1ui64ARB; -pfn_glUniform2ui64ARB fp_glUniform2ui64ARB; -pfn_glUniform3ui64ARB fp_glUniform3ui64ARB; -pfn_glUniform4ui64ARB fp_glUniform4ui64ARB; -pfn_glUniform1ui64vARB fp_glUniform1ui64vARB; -pfn_glUniform2ui64vARB fp_glUniform2ui64vARB; -pfn_glUniform3ui64vARB fp_glUniform3ui64vARB; -pfn_glUniform4ui64vARB fp_glUniform4ui64vARB; -pfn_glGetUniformi64vARB fp_glGetUniformi64vARB; -pfn_glGetUniformui64vARB fp_glGetUniformui64vARB; -pfn_glGetnUniformi64vARB fp_glGetnUniformi64vARB; -pfn_glGetnUniformui64vARB fp_glGetnUniformui64vARB; -pfn_glProgramUniform1i64ARB fp_glProgramUniform1i64ARB; -pfn_glProgramUniform2i64ARB fp_glProgramUniform2i64ARB; -pfn_glProgramUniform3i64ARB fp_glProgramUniform3i64ARB; -pfn_glProgramUniform4i64ARB fp_glProgramUniform4i64ARB; -pfn_glProgramUniform1i64vARB fp_glProgramUniform1i64vARB; -pfn_glProgramUniform2i64vARB fp_glProgramUniform2i64vARB; -pfn_glProgramUniform3i64vARB fp_glProgramUniform3i64vARB; -pfn_glProgramUniform4i64vARB fp_glProgramUniform4i64vARB; -pfn_glProgramUniform1ui64ARB fp_glProgramUniform1ui64ARB; -pfn_glProgramUniform2ui64ARB fp_glProgramUniform2ui64ARB; -pfn_glProgramUniform3ui64ARB fp_glProgramUniform3ui64ARB; -pfn_glProgramUniform4ui64ARB fp_glProgramUniform4ui64ARB; -pfn_glProgramUniform1ui64vARB fp_glProgramUniform1ui64vARB; -pfn_glProgramUniform2ui64vARB fp_glProgramUniform2ui64vARB; -pfn_glProgramUniform3ui64vARB fp_glProgramUniform3ui64vARB; -pfn_glProgramUniform4ui64vARB fp_glProgramUniform4ui64vARB; -pfn_glMultiDrawArraysIndirectCountARB fp_glMultiDrawArraysIndirectCountARB; -pfn_glMultiDrawElementsIndirectCountARB fp_glMultiDrawElementsIndirectCountARB; -pfn_glVertexAttribDivisorARB fp_glVertexAttribDivisorARB; -pfn_glMaxShaderCompilerThreadsARB fp_glMaxShaderCompilerThreadsARB; -pfn_glGetGraphicsResetStatusARB fp_glGetGraphicsResetStatusARB; -pfn_glGetnTexImageARB fp_glGetnTexImageARB; -pfn_glReadnPixelsARB fp_glReadnPixelsARB; -pfn_glGetnCompressedTexImageARB fp_glGetnCompressedTexImageARB; -pfn_glGetnUniformfvARB fp_glGetnUniformfvARB; -pfn_glGetnUniformivARB fp_glGetnUniformivARB; -pfn_glGetnUniformuivARB fp_glGetnUniformuivARB; -pfn_glGetnUniformdvARB fp_glGetnUniformdvARB; -pfn_glGetnMapdvARB fp_glGetnMapdvARB; -pfn_glGetnMapfvARB fp_glGetnMapfvARB; -pfn_glGetnMapivARB fp_glGetnMapivARB; -pfn_glGetnPixelMapfvARB fp_glGetnPixelMapfvARB; -pfn_glGetnPixelMapuivARB fp_glGetnPixelMapuivARB; -pfn_glGetnPixelMapusvARB fp_glGetnPixelMapusvARB; -pfn_glGetnPolygonStippleARB fp_glGetnPolygonStippleARB; -pfn_glGetnColorTableARB fp_glGetnColorTableARB; -pfn_glGetnConvolutionFilterARB fp_glGetnConvolutionFilterARB; -pfn_glGetnSeparableFilterARB fp_glGetnSeparableFilterARB; -pfn_glGetnHistogramARB fp_glGetnHistogramARB; -pfn_glGetnMinmaxARB fp_glGetnMinmaxARB; -pfn_glFramebufferSampleLocationsfvARB fp_glFramebufferSampleLocationsfvARB; -pfn_glNamedFramebufferSampleLocationsfvARB fp_glNamedFramebufferSampleLocationsfvARB; -pfn_glEvaluateDepthValuesARB fp_glEvaluateDepthValuesARB; -pfn_glMinSampleShadingARB fp_glMinSampleShadingARB; -pfn_glNamedStringARB fp_glNamedStringARB; -pfn_glDeleteNamedStringARB fp_glDeleteNamedStringARB; -pfn_glCompileShaderIncludeARB fp_glCompileShaderIncludeARB; -pfn_glIsNamedStringARB fp_glIsNamedStringARB; -pfn_glGetNamedStringARB fp_glGetNamedStringARB; -pfn_glGetNamedStringivARB fp_glGetNamedStringivARB; -pfn_glBufferPageCommitmentARB fp_glBufferPageCommitmentARB; -pfn_glNamedBufferPageCommitmentEXT fp_glNamedBufferPageCommitmentEXT; -pfn_glNamedBufferPageCommitmentARB fp_glNamedBufferPageCommitmentARB; -pfn_glTexPageCommitmentARB fp_glTexPageCommitmentARB; -pfn_glTexBufferARB fp_glTexBufferARB; -pfn_glDrawArraysInstancedBaseInstanceEXT fp_glDrawArraysInstancedBaseInstanceEXT; -pfn_glDrawElementsInstancedBaseInstanceEXT fp_glDrawElementsInstancedBaseInstanceEXT; -pfn_glDrawElementsInstancedBaseVertexBaseInstanceEXT fp_glDrawElementsInstancedBaseVertexBaseInstanceEXT; -pfn_glUniformBufferEXT fp_glUniformBufferEXT; -pfn_glGetUniformBufferSizeEXT fp_glGetUniformBufferSizeEXT; -pfn_glGetUniformOffsetEXT fp_glGetUniformOffsetEXT; -pfn_glBindFragDataLocationIndexedEXT fp_glBindFragDataLocationIndexedEXT; -pfn_glBindFragDataLocationEXT fp_glBindFragDataLocationEXT; -pfn_glGetProgramResourceLocationIndexEXT fp_glGetProgramResourceLocationIndexEXT; -pfn_glGetFragDataIndexEXT fp_glGetFragDataIndexEXT; -pfn_glBlendEquationEXT fp_glBlendEquationEXT; -pfn_glBufferStorageEXT fp_glBufferStorageEXT; -pfn_glCopyImageSubDataEXT fp_glCopyImageSubDataEXT; -pfn_glLabelObjectEXT fp_glLabelObjectEXT; -pfn_glGetObjectLabelEXT fp_glGetObjectLabelEXT; -pfn_glInsertEventMarkerEXT fp_glInsertEventMarkerEXT; -pfn_glPushGroupMarkerEXT fp_glPushGroupMarkerEXT; -pfn_glPopGroupMarkerEXT fp_glPopGroupMarkerEXT; -pfn_glMatrixLoadfEXT fp_glMatrixLoadfEXT; -pfn_glMatrixLoaddEXT fp_glMatrixLoaddEXT; -pfn_glMatrixMultfEXT fp_glMatrixMultfEXT; -pfn_glMatrixMultdEXT fp_glMatrixMultdEXT; -pfn_glMatrixLoadIdentityEXT fp_glMatrixLoadIdentityEXT; -pfn_glMatrixRotatefEXT fp_glMatrixRotatefEXT; -pfn_glMatrixRotatedEXT fp_glMatrixRotatedEXT; -pfn_glMatrixScalefEXT fp_glMatrixScalefEXT; -pfn_glMatrixScaledEXT fp_glMatrixScaledEXT; -pfn_glMatrixTranslatefEXT fp_glMatrixTranslatefEXT; -pfn_glMatrixTranslatedEXT fp_glMatrixTranslatedEXT; -pfn_glMatrixFrustumEXT fp_glMatrixFrustumEXT; -pfn_glMatrixOrthoEXT fp_glMatrixOrthoEXT; -pfn_glMatrixPopEXT fp_glMatrixPopEXT; -pfn_glMatrixPushEXT fp_glMatrixPushEXT; -pfn_glClientAttribDefaultEXT fp_glClientAttribDefaultEXT; -pfn_glPushClientAttribDefaultEXT fp_glPushClientAttribDefaultEXT; -pfn_glTextureParameterfEXT fp_glTextureParameterfEXT; -pfn_glTextureParameterfvEXT fp_glTextureParameterfvEXT; -pfn_glTextureParameteriEXT fp_glTextureParameteriEXT; -pfn_glTextureParameterivEXT fp_glTextureParameterivEXT; -pfn_glTextureImage1DEXT fp_glTextureImage1DEXT; -pfn_glTextureImage2DEXT fp_glTextureImage2DEXT; -pfn_glTextureSubImage1DEXT fp_glTextureSubImage1DEXT; -pfn_glTextureSubImage2DEXT fp_glTextureSubImage2DEXT; -pfn_glCopyTextureImage1DEXT fp_glCopyTextureImage1DEXT; -pfn_glCopyTextureImage2DEXT fp_glCopyTextureImage2DEXT; -pfn_glCopyTextureSubImage1DEXT fp_glCopyTextureSubImage1DEXT; -pfn_glCopyTextureSubImage2DEXT fp_glCopyTextureSubImage2DEXT; -pfn_glGetTextureImageEXT fp_glGetTextureImageEXT; -pfn_glGetTextureParameterfvEXT fp_glGetTextureParameterfvEXT; -pfn_glGetTextureParameterivEXT fp_glGetTextureParameterivEXT; -pfn_glGetTextureLevelParameterfvEXT fp_glGetTextureLevelParameterfvEXT; -pfn_glGetTextureLevelParameterivEXT fp_glGetTextureLevelParameterivEXT; -pfn_glTextureImage3DEXT fp_glTextureImage3DEXT; -pfn_glTextureSubImage3DEXT fp_glTextureSubImage3DEXT; -pfn_glCopyTextureSubImage3DEXT fp_glCopyTextureSubImage3DEXT; -pfn_glBindMultiTextureEXT fp_glBindMultiTextureEXT; -pfn_glMultiTexCoordPointerEXT fp_glMultiTexCoordPointerEXT; -pfn_glMultiTexEnvfEXT fp_glMultiTexEnvfEXT; -pfn_glMultiTexEnvfvEXT fp_glMultiTexEnvfvEXT; -pfn_glMultiTexEnviEXT fp_glMultiTexEnviEXT; -pfn_glMultiTexEnvivEXT fp_glMultiTexEnvivEXT; -pfn_glMultiTexGendEXT fp_glMultiTexGendEXT; -pfn_glMultiTexGendvEXT fp_glMultiTexGendvEXT; -pfn_glMultiTexGenfEXT fp_glMultiTexGenfEXT; -pfn_glMultiTexGenfvEXT fp_glMultiTexGenfvEXT; -pfn_glMultiTexGeniEXT fp_glMultiTexGeniEXT; -pfn_glMultiTexGenivEXT fp_glMultiTexGenivEXT; -pfn_glGetMultiTexEnvfvEXT fp_glGetMultiTexEnvfvEXT; -pfn_glGetMultiTexEnvivEXT fp_glGetMultiTexEnvivEXT; -pfn_glGetMultiTexGendvEXT fp_glGetMultiTexGendvEXT; -pfn_glGetMultiTexGenfvEXT fp_glGetMultiTexGenfvEXT; -pfn_glGetMultiTexGenivEXT fp_glGetMultiTexGenivEXT; -pfn_glMultiTexParameteriEXT fp_glMultiTexParameteriEXT; -pfn_glMultiTexParameterivEXT fp_glMultiTexParameterivEXT; -pfn_glMultiTexParameterfEXT fp_glMultiTexParameterfEXT; -pfn_glMultiTexParameterfvEXT fp_glMultiTexParameterfvEXT; -pfn_glMultiTexImage1DEXT fp_glMultiTexImage1DEXT; -pfn_glMultiTexImage2DEXT fp_glMultiTexImage2DEXT; -pfn_glMultiTexSubImage1DEXT fp_glMultiTexSubImage1DEXT; -pfn_glMultiTexSubImage2DEXT fp_glMultiTexSubImage2DEXT; -pfn_glCopyMultiTexImage1DEXT fp_glCopyMultiTexImage1DEXT; -pfn_glCopyMultiTexImage2DEXT fp_glCopyMultiTexImage2DEXT; -pfn_glCopyMultiTexSubImage1DEXT fp_glCopyMultiTexSubImage1DEXT; -pfn_glCopyMultiTexSubImage2DEXT fp_glCopyMultiTexSubImage2DEXT; -pfn_glGetMultiTexImageEXT fp_glGetMultiTexImageEXT; -pfn_glGetMultiTexParameterfvEXT fp_glGetMultiTexParameterfvEXT; -pfn_glGetMultiTexParameterivEXT fp_glGetMultiTexParameterivEXT; -pfn_glGetMultiTexLevelParameterfvEXT fp_glGetMultiTexLevelParameterfvEXT; -pfn_glGetMultiTexLevelParameterivEXT fp_glGetMultiTexLevelParameterivEXT; -pfn_glMultiTexImage3DEXT fp_glMultiTexImage3DEXT; -pfn_glMultiTexSubImage3DEXT fp_glMultiTexSubImage3DEXT; -pfn_glCopyMultiTexSubImage3DEXT fp_glCopyMultiTexSubImage3DEXT; -pfn_glEnableClientStateIndexedEXT fp_glEnableClientStateIndexedEXT; -pfn_glDisableClientStateIndexedEXT fp_glDisableClientStateIndexedEXT; -pfn_glGetFloatIndexedvEXT fp_glGetFloatIndexedvEXT; -pfn_glGetDoubleIndexedvEXT fp_glGetDoubleIndexedvEXT; -pfn_glGetPointerIndexedvEXT fp_glGetPointerIndexedvEXT; -pfn_glEnableIndexedEXT fp_glEnableIndexedEXT; -pfn_glDisableIndexedEXT fp_glDisableIndexedEXT; -pfn_glIsEnabledIndexedEXT fp_glIsEnabledIndexedEXT; -pfn_glGetIntegerIndexedvEXT fp_glGetIntegerIndexedvEXT; -pfn_glGetBooleanIndexedvEXT fp_glGetBooleanIndexedvEXT; -pfn_glCompressedTextureImage3DEXT fp_glCompressedTextureImage3DEXT; -pfn_glCompressedTextureImage2DEXT fp_glCompressedTextureImage2DEXT; -pfn_glCompressedTextureImage1DEXT fp_glCompressedTextureImage1DEXT; -pfn_glCompressedTextureSubImage3DEXT fp_glCompressedTextureSubImage3DEXT; -pfn_glCompressedTextureSubImage2DEXT fp_glCompressedTextureSubImage2DEXT; -pfn_glCompressedTextureSubImage1DEXT fp_glCompressedTextureSubImage1DEXT; -pfn_glGetCompressedTextureImageEXT fp_glGetCompressedTextureImageEXT; -pfn_glCompressedMultiTexImage3DEXT fp_glCompressedMultiTexImage3DEXT; -pfn_glCompressedMultiTexImage2DEXT fp_glCompressedMultiTexImage2DEXT; -pfn_glCompressedMultiTexImage1DEXT fp_glCompressedMultiTexImage1DEXT; -pfn_glCompressedMultiTexSubImage3DEXT fp_glCompressedMultiTexSubImage3DEXT; -pfn_glCompressedMultiTexSubImage2DEXT fp_glCompressedMultiTexSubImage2DEXT; -pfn_glCompressedMultiTexSubImage1DEXT fp_glCompressedMultiTexSubImage1DEXT; -pfn_glGetCompressedMultiTexImageEXT fp_glGetCompressedMultiTexImageEXT; -pfn_glMatrixLoadTransposefEXT fp_glMatrixLoadTransposefEXT; -pfn_glMatrixLoadTransposedEXT fp_glMatrixLoadTransposedEXT; -pfn_glMatrixMultTransposefEXT fp_glMatrixMultTransposefEXT; -pfn_glMatrixMultTransposedEXT fp_glMatrixMultTransposedEXT; -pfn_glNamedBufferDataEXT fp_glNamedBufferDataEXT; -pfn_glNamedBufferSubDataEXT fp_glNamedBufferSubDataEXT; -pfn_glMapNamedBufferEXT fp_glMapNamedBufferEXT; -pfn_glUnmapNamedBufferEXT fp_glUnmapNamedBufferEXT; -pfn_glGetNamedBufferParameterivEXT fp_glGetNamedBufferParameterivEXT; -pfn_glGetNamedBufferPointervEXT fp_glGetNamedBufferPointervEXT; -pfn_glGetNamedBufferSubDataEXT fp_glGetNamedBufferSubDataEXT; -pfn_glProgramUniform1fEXT fp_glProgramUniform1fEXT; -pfn_glProgramUniform2fEXT fp_glProgramUniform2fEXT; -pfn_glProgramUniform3fEXT fp_glProgramUniform3fEXT; -pfn_glProgramUniform4fEXT fp_glProgramUniform4fEXT; -pfn_glProgramUniform1iEXT fp_glProgramUniform1iEXT; -pfn_glProgramUniform2iEXT fp_glProgramUniform2iEXT; -pfn_glProgramUniform3iEXT fp_glProgramUniform3iEXT; -pfn_glProgramUniform4iEXT fp_glProgramUniform4iEXT; -pfn_glProgramUniform1fvEXT fp_glProgramUniform1fvEXT; -pfn_glProgramUniform2fvEXT fp_glProgramUniform2fvEXT; -pfn_glProgramUniform3fvEXT fp_glProgramUniform3fvEXT; -pfn_glProgramUniform4fvEXT fp_glProgramUniform4fvEXT; -pfn_glProgramUniform1ivEXT fp_glProgramUniform1ivEXT; -pfn_glProgramUniform2ivEXT fp_glProgramUniform2ivEXT; -pfn_glProgramUniform3ivEXT fp_glProgramUniform3ivEXT; -pfn_glProgramUniform4ivEXT fp_glProgramUniform4ivEXT; -pfn_glProgramUniformMatrix2fvEXT fp_glProgramUniformMatrix2fvEXT; -pfn_glProgramUniformMatrix3fvEXT fp_glProgramUniformMatrix3fvEXT; -pfn_glProgramUniformMatrix4fvEXT fp_glProgramUniformMatrix4fvEXT; -pfn_glProgramUniformMatrix2x3fvEXT fp_glProgramUniformMatrix2x3fvEXT; -pfn_glProgramUniformMatrix3x2fvEXT fp_glProgramUniformMatrix3x2fvEXT; -pfn_glProgramUniformMatrix2x4fvEXT fp_glProgramUniformMatrix2x4fvEXT; -pfn_glProgramUniformMatrix4x2fvEXT fp_glProgramUniformMatrix4x2fvEXT; -pfn_glProgramUniformMatrix3x4fvEXT fp_glProgramUniformMatrix3x4fvEXT; -pfn_glProgramUniformMatrix4x3fvEXT fp_glProgramUniformMatrix4x3fvEXT; -pfn_glTextureBufferEXT fp_glTextureBufferEXT; -pfn_glMultiTexBufferEXT fp_glMultiTexBufferEXT; -pfn_glTextureParameterIivEXT fp_glTextureParameterIivEXT; -pfn_glTextureParameterIuivEXT fp_glTextureParameterIuivEXT; -pfn_glGetTextureParameterIivEXT fp_glGetTextureParameterIivEXT; -pfn_glGetTextureParameterIuivEXT fp_glGetTextureParameterIuivEXT; -pfn_glMultiTexParameterIivEXT fp_glMultiTexParameterIivEXT; -pfn_glMultiTexParameterIuivEXT fp_glMultiTexParameterIuivEXT; -pfn_glGetMultiTexParameterIivEXT fp_glGetMultiTexParameterIivEXT; -pfn_glGetMultiTexParameterIuivEXT fp_glGetMultiTexParameterIuivEXT; -pfn_glProgramUniform1uiEXT fp_glProgramUniform1uiEXT; -pfn_glProgramUniform2uiEXT fp_glProgramUniform2uiEXT; -pfn_glProgramUniform3uiEXT fp_glProgramUniform3uiEXT; -pfn_glProgramUniform4uiEXT fp_glProgramUniform4uiEXT; -pfn_glProgramUniform1uivEXT fp_glProgramUniform1uivEXT; -pfn_glProgramUniform2uivEXT fp_glProgramUniform2uivEXT; -pfn_glProgramUniform3uivEXT fp_glProgramUniform3uivEXT; -pfn_glProgramUniform4uivEXT fp_glProgramUniform4uivEXT; -pfn_glNamedProgramLocalParameters4fvEXT fp_glNamedProgramLocalParameters4fvEXT; -pfn_glNamedProgramLocalParameterI4iEXT fp_glNamedProgramLocalParameterI4iEXT; -pfn_glNamedProgramLocalParameterI4ivEXT fp_glNamedProgramLocalParameterI4ivEXT; -pfn_glNamedProgramLocalParametersI4ivEXT fp_glNamedProgramLocalParametersI4ivEXT; -pfn_glNamedProgramLocalParameterI4uiEXT fp_glNamedProgramLocalParameterI4uiEXT; -pfn_glNamedProgramLocalParameterI4uivEXT fp_glNamedProgramLocalParameterI4uivEXT; -pfn_glNamedProgramLocalParametersI4uivEXT fp_glNamedProgramLocalParametersI4uivEXT; -pfn_glGetNamedProgramLocalParameterIivEXT fp_glGetNamedProgramLocalParameterIivEXT; -pfn_glGetNamedProgramLocalParameterIuivEXT fp_glGetNamedProgramLocalParameterIuivEXT; -pfn_glEnableClientStateiEXT fp_glEnableClientStateiEXT; -pfn_glDisableClientStateiEXT fp_glDisableClientStateiEXT; -pfn_glGetFloati_vEXT fp_glGetFloati_vEXT; -pfn_glGetDoublei_vEXT fp_glGetDoublei_vEXT; -pfn_glGetPointeri_vEXT fp_glGetPointeri_vEXT; -pfn_glNamedProgramStringEXT fp_glNamedProgramStringEXT; -pfn_glNamedProgramLocalParameter4dEXT fp_glNamedProgramLocalParameter4dEXT; -pfn_glNamedProgramLocalParameter4dvEXT fp_glNamedProgramLocalParameter4dvEXT; -pfn_glNamedProgramLocalParameter4fEXT fp_glNamedProgramLocalParameter4fEXT; -pfn_glNamedProgramLocalParameter4fvEXT fp_glNamedProgramLocalParameter4fvEXT; -pfn_glGetNamedProgramLocalParameterdvEXT fp_glGetNamedProgramLocalParameterdvEXT; -pfn_glGetNamedProgramLocalParameterfvEXT fp_glGetNamedProgramLocalParameterfvEXT; -pfn_glGetNamedProgramivEXT fp_glGetNamedProgramivEXT; -pfn_glGetNamedProgramStringEXT fp_glGetNamedProgramStringEXT; -pfn_glNamedRenderbufferStorageEXT fp_glNamedRenderbufferStorageEXT; -pfn_glGetNamedRenderbufferParameterivEXT fp_glGetNamedRenderbufferParameterivEXT; -pfn_glNamedRenderbufferStorageMultisampleEXT fp_glNamedRenderbufferStorageMultisampleEXT; -pfn_glNamedRenderbufferStorageMultisampleCoverageEXT fp_glNamedRenderbufferStorageMultisampleCoverageEXT; -pfn_glCheckNamedFramebufferStatusEXT fp_glCheckNamedFramebufferStatusEXT; -pfn_glNamedFramebufferTexture1DEXT fp_glNamedFramebufferTexture1DEXT; -pfn_glNamedFramebufferTexture2DEXT fp_glNamedFramebufferTexture2DEXT; -pfn_glNamedFramebufferTexture3DEXT fp_glNamedFramebufferTexture3DEXT; -pfn_glNamedFramebufferRenderbufferEXT fp_glNamedFramebufferRenderbufferEXT; -pfn_glGetNamedFramebufferAttachmentParameterivEXT fp_glGetNamedFramebufferAttachmentParameterivEXT; -pfn_glGenerateTextureMipmapEXT fp_glGenerateTextureMipmapEXT; -pfn_glGenerateMultiTexMipmapEXT fp_glGenerateMultiTexMipmapEXT; -pfn_glFramebufferDrawBufferEXT fp_glFramebufferDrawBufferEXT; -pfn_glFramebufferDrawBuffersEXT fp_glFramebufferDrawBuffersEXT; -pfn_glFramebufferReadBufferEXT fp_glFramebufferReadBufferEXT; -pfn_glGetFramebufferParameterivEXT fp_glGetFramebufferParameterivEXT; -pfn_glNamedCopyBufferSubDataEXT fp_glNamedCopyBufferSubDataEXT; -pfn_glNamedFramebufferTextureEXT fp_glNamedFramebufferTextureEXT; -pfn_glNamedFramebufferTextureLayerEXT fp_glNamedFramebufferTextureLayerEXT; -pfn_glNamedFramebufferTextureFaceEXT fp_glNamedFramebufferTextureFaceEXT; -pfn_glTextureRenderbufferEXT fp_glTextureRenderbufferEXT; -pfn_glMultiTexRenderbufferEXT fp_glMultiTexRenderbufferEXT; -pfn_glVertexArrayVertexOffsetEXT fp_glVertexArrayVertexOffsetEXT; -pfn_glVertexArrayColorOffsetEXT fp_glVertexArrayColorOffsetEXT; -pfn_glVertexArrayEdgeFlagOffsetEXT fp_glVertexArrayEdgeFlagOffsetEXT; -pfn_glVertexArrayIndexOffsetEXT fp_glVertexArrayIndexOffsetEXT; -pfn_glVertexArrayNormalOffsetEXT fp_glVertexArrayNormalOffsetEXT; -pfn_glVertexArrayTexCoordOffsetEXT fp_glVertexArrayTexCoordOffsetEXT; -pfn_glVertexArrayMultiTexCoordOffsetEXT fp_glVertexArrayMultiTexCoordOffsetEXT; -pfn_glVertexArrayFogCoordOffsetEXT fp_glVertexArrayFogCoordOffsetEXT; -pfn_glVertexArraySecondaryColorOffsetEXT fp_glVertexArraySecondaryColorOffsetEXT; -pfn_glVertexArrayVertexAttribOffsetEXT fp_glVertexArrayVertexAttribOffsetEXT; -pfn_glVertexArrayVertexAttribIOffsetEXT fp_glVertexArrayVertexAttribIOffsetEXT; -pfn_glEnableVertexArrayEXT fp_glEnableVertexArrayEXT; -pfn_glDisableVertexArrayEXT fp_glDisableVertexArrayEXT; -pfn_glEnableVertexArrayAttribEXT fp_glEnableVertexArrayAttribEXT; -pfn_glDisableVertexArrayAttribEXT fp_glDisableVertexArrayAttribEXT; -pfn_glGetVertexArrayIntegervEXT fp_glGetVertexArrayIntegervEXT; -pfn_glGetVertexArrayPointervEXT fp_glGetVertexArrayPointervEXT; -pfn_glGetVertexArrayIntegeri_vEXT fp_glGetVertexArrayIntegeri_vEXT; -pfn_glGetVertexArrayPointeri_vEXT fp_glGetVertexArrayPointeri_vEXT; -pfn_glMapNamedBufferRangeEXT fp_glMapNamedBufferRangeEXT; -pfn_glFlushMappedNamedBufferRangeEXT fp_glFlushMappedNamedBufferRangeEXT; -pfn_glNamedBufferStorageEXT fp_glNamedBufferStorageEXT; -pfn_glClearNamedBufferDataEXT fp_glClearNamedBufferDataEXT; -pfn_glClearNamedBufferSubDataEXT fp_glClearNamedBufferSubDataEXT; -pfn_glNamedFramebufferParameteriEXT fp_glNamedFramebufferParameteriEXT; -pfn_glGetNamedFramebufferParameterivEXT fp_glGetNamedFramebufferParameterivEXT; -pfn_glProgramUniform1dEXT fp_glProgramUniform1dEXT; -pfn_glProgramUniform2dEXT fp_glProgramUniform2dEXT; -pfn_glProgramUniform3dEXT fp_glProgramUniform3dEXT; -pfn_glProgramUniform4dEXT fp_glProgramUniform4dEXT; -pfn_glProgramUniform1dvEXT fp_glProgramUniform1dvEXT; -pfn_glProgramUniform2dvEXT fp_glProgramUniform2dvEXT; -pfn_glProgramUniform3dvEXT fp_glProgramUniform3dvEXT; -pfn_glProgramUniform4dvEXT fp_glProgramUniform4dvEXT; -pfn_glProgramUniformMatrix2dvEXT fp_glProgramUniformMatrix2dvEXT; -pfn_glProgramUniformMatrix3dvEXT fp_glProgramUniformMatrix3dvEXT; -pfn_glProgramUniformMatrix4dvEXT fp_glProgramUniformMatrix4dvEXT; -pfn_glProgramUniformMatrix2x3dvEXT fp_glProgramUniformMatrix2x3dvEXT; -pfn_glProgramUniformMatrix2x4dvEXT fp_glProgramUniformMatrix2x4dvEXT; -pfn_glProgramUniformMatrix3x2dvEXT fp_glProgramUniformMatrix3x2dvEXT; -pfn_glProgramUniformMatrix3x4dvEXT fp_glProgramUniformMatrix3x4dvEXT; -pfn_glProgramUniformMatrix4x2dvEXT fp_glProgramUniformMatrix4x2dvEXT; -pfn_glProgramUniformMatrix4x3dvEXT fp_glProgramUniformMatrix4x3dvEXT; -pfn_glTextureBufferRangeEXT fp_glTextureBufferRangeEXT; -pfn_glTextureStorage1DEXT fp_glTextureStorage1DEXT; -pfn_glTextureStorage2DEXT fp_glTextureStorage2DEXT; -pfn_glTextureStorage3DEXT fp_glTextureStorage3DEXT; -pfn_glTextureStorage2DMultisampleEXT fp_glTextureStorage2DMultisampleEXT; -pfn_glTextureStorage3DMultisampleEXT fp_glTextureStorage3DMultisampleEXT; -pfn_glVertexArrayBindVertexBufferEXT fp_glVertexArrayBindVertexBufferEXT; -pfn_glVertexArrayVertexAttribFormatEXT fp_glVertexArrayVertexAttribFormatEXT; -pfn_glVertexArrayVertexAttribIFormatEXT fp_glVertexArrayVertexAttribIFormatEXT; -pfn_glVertexArrayVertexAttribLFormatEXT fp_glVertexArrayVertexAttribLFormatEXT; -pfn_glVertexArrayVertexAttribBindingEXT fp_glVertexArrayVertexAttribBindingEXT; -pfn_glVertexArrayVertexBindingDivisorEXT fp_glVertexArrayVertexBindingDivisorEXT; -pfn_glVertexArrayVertexAttribLOffsetEXT fp_glVertexArrayVertexAttribLOffsetEXT; -pfn_glTexturePageCommitmentEXT fp_glTexturePageCommitmentEXT; -pfn_glVertexArrayVertexAttribDivisorEXT fp_glVertexArrayVertexAttribDivisorEXT; -pfn_glDiscardFramebufferEXT fp_glDiscardFramebufferEXT; -pfn_glGenQueriesEXT fp_glGenQueriesEXT; -pfn_glDeleteQueriesEXT fp_glDeleteQueriesEXT; -pfn_glIsQueryEXT fp_glIsQueryEXT; -pfn_glBeginQueryEXT fp_glBeginQueryEXT; -pfn_glEndQueryEXT fp_glEndQueryEXT; -pfn_glQueryCounterEXT fp_glQueryCounterEXT; -pfn_glGetQueryivEXT fp_glGetQueryivEXT; -pfn_glGetQueryObjectivEXT fp_glGetQueryObjectivEXT; -pfn_glGetQueryObjectuivEXT fp_glGetQueryObjectuivEXT; -pfn_glGetQueryObjecti64vEXT fp_glGetQueryObjecti64vEXT; -pfn_glGetQueryObjectui64vEXT fp_glGetQueryObjectui64vEXT; -pfn_glDrawBuffersEXT fp_glDrawBuffersEXT; -pfn_glColorMaskIndexedEXT fp_glColorMaskIndexedEXT; -pfn_glEnableiEXT fp_glEnableiEXT; -pfn_glDisableiEXT fp_glDisableiEXT; -pfn_glBlendEquationiEXT fp_glBlendEquationiEXT; -pfn_glBlendEquationSeparateiEXT fp_glBlendEquationSeparateiEXT; -pfn_glBlendFunciEXT fp_glBlendFunciEXT; -pfn_glBlendFuncSeparateiEXT fp_glBlendFuncSeparateiEXT; -pfn_glColorMaskiEXT fp_glColorMaskiEXT; -pfn_glIsEnablediEXT fp_glIsEnablediEXT; -pfn_glDrawElementsBaseVertexEXT fp_glDrawElementsBaseVertexEXT; -pfn_glDrawRangeElementsBaseVertexEXT fp_glDrawRangeElementsBaseVertexEXT; -pfn_glDrawElementsInstancedBaseVertexEXT fp_glDrawElementsInstancedBaseVertexEXT; -pfn_glMultiDrawElementsBaseVertexEXT fp_glMultiDrawElementsBaseVertexEXT; -pfn_glDrawArraysInstancedEXT fp_glDrawArraysInstancedEXT; -pfn_glDrawElementsInstancedEXT fp_glDrawElementsInstancedEXT; -pfn_glBlitFramebufferEXT fp_glBlitFramebufferEXT; -pfn_glRenderbufferStorageMultisampleEXT fp_glRenderbufferStorageMultisampleEXT; -pfn_glIsRenderbufferEXT fp_glIsRenderbufferEXT; -pfn_glBindRenderbufferEXT fp_glBindRenderbufferEXT; -pfn_glDeleteRenderbuffersEXT fp_glDeleteRenderbuffersEXT; -pfn_glGenRenderbuffersEXT fp_glGenRenderbuffersEXT; -pfn_glRenderbufferStorageEXT fp_glRenderbufferStorageEXT; -pfn_glGetRenderbufferParameterivEXT fp_glGetRenderbufferParameterivEXT; -pfn_glIsFramebufferEXT fp_glIsFramebufferEXT; -pfn_glBindFramebufferEXT fp_glBindFramebufferEXT; -pfn_glDeleteFramebuffersEXT fp_glDeleteFramebuffersEXT; -pfn_glGenFramebuffersEXT fp_glGenFramebuffersEXT; -pfn_glCheckFramebufferStatusEXT fp_glCheckFramebufferStatusEXT; -pfn_glFramebufferTexture1DEXT fp_glFramebufferTexture1DEXT; -pfn_glFramebufferTexture2DEXT fp_glFramebufferTexture2DEXT; -pfn_glFramebufferTexture3DEXT fp_glFramebufferTexture3DEXT; -pfn_glFramebufferRenderbufferEXT fp_glFramebufferRenderbufferEXT; -pfn_glGetFramebufferAttachmentParameterivEXT fp_glGetFramebufferAttachmentParameterivEXT; -pfn_glGenerateMipmapEXT fp_glGenerateMipmapEXT; -pfn_glFramebufferTextureEXT fp_glFramebufferTextureEXT; -pfn_glProgramParameteriEXT fp_glProgramParameteriEXT; -pfn_glProgramEnvParameters4fvEXT fp_glProgramEnvParameters4fvEXT; -pfn_glProgramLocalParameters4fvEXT fp_glProgramLocalParameters4fvEXT; -pfn_glGetUniformuivEXT fp_glGetUniformuivEXT; -pfn_glGetFragDataLocationEXT fp_glGetFragDataLocationEXT; -pfn_glUniform1uiEXT fp_glUniform1uiEXT; -pfn_glUniform2uiEXT fp_glUniform2uiEXT; -pfn_glUniform3uiEXT fp_glUniform3uiEXT; -pfn_glUniform4uiEXT fp_glUniform4uiEXT; -pfn_glUniform1uivEXT fp_glUniform1uivEXT; -pfn_glUniform2uivEXT fp_glUniform2uivEXT; -pfn_glUniform3uivEXT fp_glUniform3uivEXT; -pfn_glUniform4uivEXT fp_glUniform4uivEXT; -pfn_glVertexAttribDivisorEXT fp_glVertexAttribDivisorEXT; -pfn_glMapBufferRangeEXT fp_glMapBufferRangeEXT; -pfn_glFlushMappedBufferRangeEXT fp_glFlushMappedBufferRangeEXT; -pfn_glMultiDrawArraysIndirectEXT fp_glMultiDrawArraysIndirectEXT; -pfn_glMultiDrawElementsIndirectEXT fp_glMultiDrawElementsIndirectEXT; -pfn_glFramebufferTexture2DMultisampleEXT fp_glFramebufferTexture2DMultisampleEXT; -pfn_glReadBufferIndexedEXT fp_glReadBufferIndexedEXT; -pfn_glDrawBuffersIndexedEXT fp_glDrawBuffersIndexedEXT; -pfn_glGetIntegeri_vEXT fp_glGetIntegeri_vEXT; -pfn_glPolygonOffsetClampEXT fp_glPolygonOffsetClampEXT; -pfn_glPrimitiveBoundingBoxEXT fp_glPrimitiveBoundingBoxEXT; -pfn_glProvokingVertexEXT fp_glProvokingVertexEXT; -pfn_glRasterSamplesEXT fp_glRasterSamplesEXT; -pfn_glGetGraphicsResetStatusEXT fp_glGetGraphicsResetStatusEXT; -pfn_glReadnPixelsEXT fp_glReadnPixelsEXT; -pfn_glGetnUniformfvEXT fp_glGetnUniformfvEXT; -pfn_glGetnUniformivEXT fp_glGetnUniformivEXT; -pfn_glUseShaderProgramEXT fp_glUseShaderProgramEXT; -pfn_glActiveProgramEXT fp_glActiveProgramEXT; -pfn_glCreateShaderProgramEXT fp_glCreateShaderProgramEXT; -pfn_glActiveShaderProgramEXT fp_glActiveShaderProgramEXT; -pfn_glBindProgramPipelineEXT fp_glBindProgramPipelineEXT; -pfn_glCreateShaderProgramvEXT fp_glCreateShaderProgramvEXT; -pfn_glDeleteProgramPipelinesEXT fp_glDeleteProgramPipelinesEXT; -pfn_glGenProgramPipelinesEXT fp_glGenProgramPipelinesEXT; -pfn_glGetProgramPipelineInfoLogEXT fp_glGetProgramPipelineInfoLogEXT; -pfn_glGetProgramPipelineivEXT fp_glGetProgramPipelineivEXT; -pfn_glIsProgramPipelineEXT fp_glIsProgramPipelineEXT; -pfn_glUseProgramStagesEXT fp_glUseProgramStagesEXT; -pfn_glValidateProgramPipelineEXT fp_glValidateProgramPipelineEXT; -pfn_glBindImageTextureEXT fp_glBindImageTextureEXT; -pfn_glMemoryBarrierEXT fp_glMemoryBarrierEXT; -pfn_glTexPageCommitmentEXT fp_glTexPageCommitmentEXT; -pfn_glStencilClearTagEXT fp_glStencilClearTagEXT; -pfn_glPatchParameteriEXT fp_glPatchParameteriEXT; -pfn_glFramebufferTextureLayerEXT fp_glFramebufferTextureLayerEXT; -pfn_glTexParameterIivEXT fp_glTexParameterIivEXT; -pfn_glTexParameterIuivEXT fp_glTexParameterIuivEXT; -pfn_glGetTexParameterIivEXT fp_glGetTexParameterIivEXT; -pfn_glGetTexParameterIuivEXT fp_glGetTexParameterIuivEXT; -pfn_glSamplerParameterIivEXT fp_glSamplerParameterIivEXT; -pfn_glSamplerParameterIuivEXT fp_glSamplerParameterIuivEXT; -pfn_glGetSamplerParameterIivEXT fp_glGetSamplerParameterIivEXT; -pfn_glGetSamplerParameterIuivEXT fp_glGetSamplerParameterIuivEXT; -pfn_glTexBufferEXT fp_glTexBufferEXT; -pfn_glTexBufferRangeEXT fp_glTexBufferRangeEXT; -pfn_glClearColorIiEXT fp_glClearColorIiEXT; -pfn_glClearColorIuiEXT fp_glClearColorIuiEXT; -pfn_glTexStorage1DEXT fp_glTexStorage1DEXT; -pfn_glTexStorage2DEXT fp_glTexStorage2DEXT; -pfn_glTexStorage3DEXT fp_glTexStorage3DEXT; -pfn_glTextureViewEXT fp_glTextureViewEXT; -pfn_glBeginTransformFeedbackEXT fp_glBeginTransformFeedbackEXT; -pfn_glEndTransformFeedbackEXT fp_glEndTransformFeedbackEXT; -pfn_glBindBufferRangeEXT fp_glBindBufferRangeEXT; -pfn_glBindBufferOffsetEXT fp_glBindBufferOffsetEXT; -pfn_glBindBufferBaseEXT fp_glBindBufferBaseEXT; -pfn_glTransformFeedbackVaryingsEXT fp_glTransformFeedbackVaryingsEXT; -pfn_glGetTransformFeedbackVaryingEXT fp_glGetTransformFeedbackVaryingEXT; -pfn_glVertexAttribL1dEXT fp_glVertexAttribL1dEXT; -pfn_glVertexAttribL2dEXT fp_glVertexAttribL2dEXT; -pfn_glVertexAttribL3dEXT fp_glVertexAttribL3dEXT; -pfn_glVertexAttribL4dEXT fp_glVertexAttribL4dEXT; -pfn_glVertexAttribL1dvEXT fp_glVertexAttribL1dvEXT; -pfn_glVertexAttribL2dvEXT fp_glVertexAttribL2dvEXT; -pfn_glVertexAttribL3dvEXT fp_glVertexAttribL3dvEXT; -pfn_glVertexAttribL4dvEXT fp_glVertexAttribL4dvEXT; -pfn_glVertexAttribLPointerEXT fp_glVertexAttribLPointerEXT; -pfn_glGetVertexAttribLdvEXT fp_glGetVertexAttribLdvEXT; -pfn_glImportSyncEXT fp_glImportSyncEXT; -pfn_glCopyImageSubDataOES fp_glCopyImageSubDataOES; -pfn_glEnableiOES fp_glEnableiOES; -pfn_glDisableiOES fp_glDisableiOES; -pfn_glBlendEquationiOES fp_glBlendEquationiOES; -pfn_glBlendEquationSeparateiOES fp_glBlendEquationSeparateiOES; -pfn_glBlendFunciOES fp_glBlendFunciOES; -pfn_glBlendFuncSeparateiOES fp_glBlendFuncSeparateiOES; -pfn_glColorMaskiOES fp_glColorMaskiOES; -pfn_glIsEnablediOES fp_glIsEnablediOES; -pfn_glDrawElementsBaseVertexOES fp_glDrawElementsBaseVertexOES; -pfn_glDrawRangeElementsBaseVertexOES fp_glDrawRangeElementsBaseVertexOES; -pfn_glDrawElementsInstancedBaseVertexOES fp_glDrawElementsInstancedBaseVertexOES; -pfn_glMultiDrawElementsBaseVertexOES fp_glMultiDrawElementsBaseVertexOES; -pfn_glEGLImageTargetTexture2DOES fp_glEGLImageTargetTexture2DOES; -pfn_glEGLImageTargetRenderbufferStorageOES fp_glEGLImageTargetRenderbufferStorageOES; -pfn_glFramebufferTextureOES fp_glFramebufferTextureOES; -pfn_glGetProgramBinaryOES fp_glGetProgramBinaryOES; -pfn_glProgramBinaryOES fp_glProgramBinaryOES; -pfn_glMapBufferOES fp_glMapBufferOES; -pfn_glUnmapBufferOES fp_glUnmapBufferOES; -pfn_glGetBufferPointervOES fp_glGetBufferPointervOES; -pfn_glPrimitiveBoundingBoxOES fp_glPrimitiveBoundingBoxOES; -pfn_glMinSampleShadingOES fp_glMinSampleShadingOES; -pfn_glPatchParameteriOES fp_glPatchParameteriOES; -pfn_glTexImage3DOES fp_glTexImage3DOES; -pfn_glTexSubImage3DOES fp_glTexSubImage3DOES; -pfn_glCopyTexSubImage3DOES fp_glCopyTexSubImage3DOES; -pfn_glCompressedTexImage3DOES fp_glCompressedTexImage3DOES; -pfn_glCompressedTexSubImage3DOES fp_glCompressedTexSubImage3DOES; -pfn_glFramebufferTexture3DOES fp_glFramebufferTexture3DOES; -pfn_glTexParameterIivOES fp_glTexParameterIivOES; -pfn_glTexParameterIuivOES fp_glTexParameterIuivOES; -pfn_glGetTexParameterIivOES fp_glGetTexParameterIivOES; -pfn_glGetTexParameterIuivOES fp_glGetTexParameterIuivOES; -pfn_glSamplerParameterIivOES fp_glSamplerParameterIivOES; -pfn_glSamplerParameterIuivOES fp_glSamplerParameterIuivOES; -pfn_glGetSamplerParameterIivOES fp_glGetSamplerParameterIivOES; -pfn_glGetSamplerParameterIuivOES fp_glGetSamplerParameterIuivOES; -pfn_glTexBufferOES fp_glTexBufferOES; -pfn_glTexBufferRangeOES fp_glTexBufferRangeOES; -pfn_glTexStorage3DMultisampleOES fp_glTexStorage3DMultisampleOES; -pfn_glTextureViewOES fp_glTextureViewOES; -pfn_glBindVertexArrayOES fp_glBindVertexArrayOES; -pfn_glDeleteVertexArraysOES fp_glDeleteVertexArraysOES; -pfn_glGenVertexArraysOES fp_glGenVertexArraysOES; -pfn_glIsVertexArrayOES fp_glIsVertexArrayOES; -pfn_glDebugMessageEnableAMD fp_glDebugMessageEnableAMD; -pfn_glDebugMessageInsertAMD fp_glDebugMessageInsertAMD; -pfn_glDebugMessageCallbackAMD fp_glDebugMessageCallbackAMD; -pfn_glGetDebugMessageLogAMD fp_glGetDebugMessageLogAMD; -pfn_glBlendFuncIndexedAMD fp_glBlendFuncIndexedAMD; -pfn_glBlendFuncSeparateIndexedAMD fp_glBlendFuncSeparateIndexedAMD; -pfn_glBlendEquationIndexedAMD fp_glBlendEquationIndexedAMD; -pfn_glBlendEquationSeparateIndexedAMD fp_glBlendEquationSeparateIndexedAMD; -pfn_glUniform1i64NV fp_glUniform1i64NV; -pfn_glUniform2i64NV fp_glUniform2i64NV; -pfn_glUniform3i64NV fp_glUniform3i64NV; -pfn_glUniform4i64NV fp_glUniform4i64NV; -pfn_glUniform1i64vNV fp_glUniform1i64vNV; -pfn_glUniform2i64vNV fp_glUniform2i64vNV; -pfn_glUniform3i64vNV fp_glUniform3i64vNV; -pfn_glUniform4i64vNV fp_glUniform4i64vNV; -pfn_glUniform1ui64NV fp_glUniform1ui64NV; -pfn_glUniform2ui64NV fp_glUniform2ui64NV; -pfn_glUniform3ui64NV fp_glUniform3ui64NV; -pfn_glUniform4ui64NV fp_glUniform4ui64NV; -pfn_glUniform1ui64vNV fp_glUniform1ui64vNV; -pfn_glUniform2ui64vNV fp_glUniform2ui64vNV; -pfn_glUniform3ui64vNV fp_glUniform3ui64vNV; -pfn_glUniform4ui64vNV fp_glUniform4ui64vNV; -pfn_glGetUniformi64vNV fp_glGetUniformi64vNV; -pfn_glGetUniformui64vNV fp_glGetUniformui64vNV; -pfn_glProgramUniform1i64NV fp_glProgramUniform1i64NV; -pfn_glProgramUniform2i64NV fp_glProgramUniform2i64NV; -pfn_glProgramUniform3i64NV fp_glProgramUniform3i64NV; -pfn_glProgramUniform4i64NV fp_glProgramUniform4i64NV; -pfn_glProgramUniform1i64vNV fp_glProgramUniform1i64vNV; -pfn_glProgramUniform2i64vNV fp_glProgramUniform2i64vNV; -pfn_glProgramUniform3i64vNV fp_glProgramUniform3i64vNV; -pfn_glProgramUniform4i64vNV fp_glProgramUniform4i64vNV; -pfn_glProgramUniform1ui64NV fp_glProgramUniform1ui64NV; -pfn_glProgramUniform2ui64NV fp_glProgramUniform2ui64NV; -pfn_glProgramUniform3ui64NV fp_glProgramUniform3ui64NV; -pfn_glProgramUniform4ui64NV fp_glProgramUniform4ui64NV; -pfn_glProgramUniform1ui64vNV fp_glProgramUniform1ui64vNV; -pfn_glProgramUniform2ui64vNV fp_glProgramUniform2ui64vNV; -pfn_glProgramUniform3ui64vNV fp_glProgramUniform3ui64vNV; -pfn_glProgramUniform4ui64vNV fp_glProgramUniform4ui64vNV; -pfn_glVertexAttribParameteriAMD fp_glVertexAttribParameteriAMD; -pfn_glMultiDrawArraysIndirectAMD fp_glMultiDrawArraysIndirectAMD; -pfn_glMultiDrawElementsIndirectAMD fp_glMultiDrawElementsIndirectAMD; -pfn_glGenNamesAMD fp_glGenNamesAMD; -pfn_glDeleteNamesAMD fp_glDeleteNamesAMD; -pfn_glIsNameAMD fp_glIsNameAMD; -pfn_glQueryObjectParameteruiAMD fp_glQueryObjectParameteruiAMD; -pfn_glGetPerfMonitorGroupsAMD fp_glGetPerfMonitorGroupsAMD; -pfn_glGetPerfMonitorCountersAMD fp_glGetPerfMonitorCountersAMD; -pfn_glGetPerfMonitorGroupStringAMD fp_glGetPerfMonitorGroupStringAMD; -pfn_glGetPerfMonitorCounterStringAMD fp_glGetPerfMonitorCounterStringAMD; -pfn_glGetPerfMonitorCounterInfoAMD fp_glGetPerfMonitorCounterInfoAMD; -pfn_glGenPerfMonitorsAMD fp_glGenPerfMonitorsAMD; -pfn_glDeletePerfMonitorsAMD fp_glDeletePerfMonitorsAMD; -pfn_glSelectPerfMonitorCountersAMD fp_glSelectPerfMonitorCountersAMD; -pfn_glBeginPerfMonitorAMD fp_glBeginPerfMonitorAMD; -pfn_glEndPerfMonitorAMD fp_glEndPerfMonitorAMD; -pfn_glGetPerfMonitorCounterDataAMD fp_glGetPerfMonitorCounterDataAMD; -pfn_glSetMultisamplefvAMD fp_glSetMultisamplefvAMD; -pfn_glTexStorageSparseAMD fp_glTexStorageSparseAMD; -pfn_glTextureStorageSparseAMD fp_glTextureStorageSparseAMD; -pfn_glStencilOpValueAMD fp_glStencilOpValueAMD; -pfn_glTessellationFactorAMD fp_glTessellationFactorAMD; -pfn_glTessellationModeAMD fp_glTessellationModeAMD; -pfn_glBlitFramebufferANGLE fp_glBlitFramebufferANGLE; -pfn_glRenderbufferStorageMultisampleANGLE fp_glRenderbufferStorageMultisampleANGLE; -pfn_glDrawArraysInstancedANGLE fp_glDrawArraysInstancedANGLE; -pfn_glDrawElementsInstancedANGLE fp_glDrawElementsInstancedANGLE; -pfn_glVertexAttribDivisorANGLE fp_glVertexAttribDivisorANGLE; -pfn_glGetTranslatedShaderSourceANGLE fp_glGetTranslatedShaderSourceANGLE; -pfn_glCopyTextureLevelsAPPLE fp_glCopyTextureLevelsAPPLE; -pfn_glElementPointerAPPLE fp_glElementPointerAPPLE; -pfn_glDrawElementArrayAPPLE fp_glDrawElementArrayAPPLE; -pfn_glDrawRangeElementArrayAPPLE fp_glDrawRangeElementArrayAPPLE; -pfn_glMultiDrawElementArrayAPPLE fp_glMultiDrawElementArrayAPPLE; -pfn_glMultiDrawRangeElementArrayAPPLE fp_glMultiDrawRangeElementArrayAPPLE; -pfn_glGenFencesAPPLE fp_glGenFencesAPPLE; -pfn_glDeleteFencesAPPLE fp_glDeleteFencesAPPLE; -pfn_glSetFenceAPPLE fp_glSetFenceAPPLE; -pfn_glIsFenceAPPLE fp_glIsFenceAPPLE; -pfn_glTestFenceAPPLE fp_glTestFenceAPPLE; -pfn_glFinishFenceAPPLE fp_glFinishFenceAPPLE; -pfn_glTestObjectAPPLE fp_glTestObjectAPPLE; -pfn_glFinishObjectAPPLE fp_glFinishObjectAPPLE; -pfn_glBufferParameteriAPPLE fp_glBufferParameteriAPPLE; -pfn_glFlushMappedBufferRangeAPPLE fp_glFlushMappedBufferRangeAPPLE; -pfn_glRenderbufferStorageMultisampleAPPLE fp_glRenderbufferStorageMultisampleAPPLE; -pfn_glResolveMultisampleFramebufferAPPLE fp_glResolveMultisampleFramebufferAPPLE; -pfn_glObjectPurgeableAPPLE fp_glObjectPurgeableAPPLE; -pfn_glObjectUnpurgeableAPPLE fp_glObjectUnpurgeableAPPLE; -pfn_glGetObjectParameterivAPPLE fp_glGetObjectParameterivAPPLE; -pfn_glFenceSyncAPPLE fp_glFenceSyncAPPLE; -pfn_glIsSyncAPPLE fp_glIsSyncAPPLE; -pfn_glDeleteSyncAPPLE fp_glDeleteSyncAPPLE; -pfn_glClientWaitSyncAPPLE fp_glClientWaitSyncAPPLE; -pfn_glWaitSyncAPPLE fp_glWaitSyncAPPLE; -pfn_glGetInteger64vAPPLE fp_glGetInteger64vAPPLE; -pfn_glGetSyncivAPPLE fp_glGetSyncivAPPLE; -pfn_glTextureRangeAPPLE fp_glTextureRangeAPPLE; -pfn_glGetTexParameterPointervAPPLE fp_glGetTexParameterPointervAPPLE; -pfn_glBindVertexArrayAPPLE fp_glBindVertexArrayAPPLE; -pfn_glDeleteVertexArraysAPPLE fp_glDeleteVertexArraysAPPLE; -pfn_glGenVertexArraysAPPLE fp_glGenVertexArraysAPPLE; -pfn_glIsVertexArrayAPPLE fp_glIsVertexArrayAPPLE; -pfn_glVertexArrayRangeAPPLE fp_glVertexArrayRangeAPPLE; -pfn_glFlushVertexArrayRangeAPPLE fp_glFlushVertexArrayRangeAPPLE; -pfn_glVertexArrayParameteriAPPLE fp_glVertexArrayParameteriAPPLE; -pfn_glEnableVertexAttribAPPLE fp_glEnableVertexAttribAPPLE; -pfn_glDisableVertexAttribAPPLE fp_glDisableVertexAttribAPPLE; -pfn_glIsVertexAttribEnabledAPPLE fp_glIsVertexAttribEnabledAPPLE; -pfn_glMapVertexAttrib1dAPPLE fp_glMapVertexAttrib1dAPPLE; -pfn_glMapVertexAttrib1fAPPLE fp_glMapVertexAttrib1fAPPLE; -pfn_glMapVertexAttrib2dAPPLE fp_glMapVertexAttrib2dAPPLE; -pfn_glMapVertexAttrib2fAPPLE fp_glMapVertexAttrib2fAPPLE; -pfn_glFrameTerminatorGREMEDY fp_glFrameTerminatorGREMEDY; -pfn_glStringMarkerGREMEDY fp_glStringMarkerGREMEDY; -pfn_glRenderbufferStorageMultisampleIMG fp_glRenderbufferStorageMultisampleIMG; -pfn_glFramebufferTexture2DMultisampleIMG fp_glFramebufferTexture2DMultisampleIMG; -pfn_glBlendFuncSeparateINGR fp_glBlendFuncSeparateINGR; -pfn_glApplyFramebufferAttachmentCMAAINTEL fp_glApplyFramebufferAttachmentCMAAINTEL; -pfn_glSyncTextureINTEL fp_glSyncTextureINTEL; -pfn_glUnmapTexture2DINTEL fp_glUnmapTexture2DINTEL; -pfn_glMapTexture2DINTEL fp_glMapTexture2DINTEL; -pfn_glBeginPerfQueryINTEL fp_glBeginPerfQueryINTEL; -pfn_glCreatePerfQueryINTEL fp_glCreatePerfQueryINTEL; -pfn_glDeletePerfQueryINTEL fp_glDeletePerfQueryINTEL; -pfn_glEndPerfQueryINTEL fp_glEndPerfQueryINTEL; -pfn_glGetFirstPerfQueryIdINTEL fp_glGetFirstPerfQueryIdINTEL; -pfn_glGetNextPerfQueryIdINTEL fp_glGetNextPerfQueryIdINTEL; -pfn_glGetPerfCounterInfoINTEL fp_glGetPerfCounterInfoINTEL; -pfn_glGetPerfQueryDataINTEL fp_glGetPerfQueryDataINTEL; -pfn_glGetPerfQueryIdByNameINTEL fp_glGetPerfQueryIdByNameINTEL; -pfn_glGetPerfQueryInfoINTEL fp_glGetPerfQueryInfoINTEL; -pfn_glMultiDrawArraysIndirectBindlessNV fp_glMultiDrawArraysIndirectBindlessNV; -pfn_glMultiDrawElementsIndirectBindlessNV fp_glMultiDrawElementsIndirectBindlessNV; -pfn_glMultiDrawArraysIndirectBindlessCountNV fp_glMultiDrawArraysIndirectBindlessCountNV; -pfn_glMultiDrawElementsIndirectBindlessCountNV fp_glMultiDrawElementsIndirectBindlessCountNV; -pfn_glGetTextureHandleNV fp_glGetTextureHandleNV; -pfn_glGetTextureSamplerHandleNV fp_glGetTextureSamplerHandleNV; -pfn_glMakeTextureHandleResidentNV fp_glMakeTextureHandleResidentNV; -pfn_glMakeTextureHandleNonResidentNV fp_glMakeTextureHandleNonResidentNV; -pfn_glGetImageHandleNV fp_glGetImageHandleNV; -pfn_glMakeImageHandleResidentNV fp_glMakeImageHandleResidentNV; -pfn_glMakeImageHandleNonResidentNV fp_glMakeImageHandleNonResidentNV; -pfn_glUniformHandleui64NV fp_glUniformHandleui64NV; -pfn_glUniformHandleui64vNV fp_glUniformHandleui64vNV; -pfn_glProgramUniformHandleui64NV fp_glProgramUniformHandleui64NV; -pfn_glProgramUniformHandleui64vNV fp_glProgramUniformHandleui64vNV; -pfn_glIsTextureHandleResidentNV fp_glIsTextureHandleResidentNV; -pfn_glIsImageHandleResidentNV fp_glIsImageHandleResidentNV; -pfn_glBlendParameteriNV fp_glBlendParameteriNV; -pfn_glBlendBarrierNV fp_glBlendBarrierNV; -pfn_glCreateStatesNV fp_glCreateStatesNV; -pfn_glDeleteStatesNV fp_glDeleteStatesNV; -pfn_glIsStateNV fp_glIsStateNV; -pfn_glStateCaptureNV fp_glStateCaptureNV; -pfn_glGetCommandHeaderNV fp_glGetCommandHeaderNV; -pfn_glGetStageIndexNV fp_glGetStageIndexNV; -pfn_glDrawCommandsNV fp_glDrawCommandsNV; -pfn_glDrawCommandsAddressNV fp_glDrawCommandsAddressNV; -pfn_glDrawCommandsStatesNV fp_glDrawCommandsStatesNV; -pfn_glDrawCommandsStatesAddressNV fp_glDrawCommandsStatesAddressNV; -pfn_glCreateCommandListsNV fp_glCreateCommandListsNV; -pfn_glDeleteCommandListsNV fp_glDeleteCommandListsNV; -pfn_glIsCommandListNV fp_glIsCommandListNV; -pfn_glListDrawCommandsStatesClientNV fp_glListDrawCommandsStatesClientNV; -pfn_glCommandListSegmentsNV fp_glCommandListSegmentsNV; -pfn_glCompileCommandListNV fp_glCompileCommandListNV; -pfn_glCallCommandListNV fp_glCallCommandListNV; -pfn_glBeginConditionalRenderNV fp_glBeginConditionalRenderNV; -pfn_glEndConditionalRenderNV fp_glEndConditionalRenderNV; -pfn_glSubpixelPrecisionBiasNV fp_glSubpixelPrecisionBiasNV; -pfn_glConservativeRasterParameterfNV fp_glConservativeRasterParameterfNV; -pfn_glCopyBufferSubDataNV fp_glCopyBufferSubDataNV; -pfn_glCopyImageSubDataNV fp_glCopyImageSubDataNV; -pfn_glCoverageMaskNV fp_glCoverageMaskNV; -pfn_glCoverageOperationNV fp_glCoverageOperationNV; -pfn_glDepthRangedNV fp_glDepthRangedNV; -pfn_glClearDepthdNV fp_glClearDepthdNV; -pfn_glDepthBoundsdNV fp_glDepthBoundsdNV; -pfn_glDrawBuffersNV fp_glDrawBuffersNV; -pfn_glDrawArraysInstancedNV fp_glDrawArraysInstancedNV; -pfn_glDrawElementsInstancedNV fp_glDrawElementsInstancedNV; -pfn_glDrawTextureNV fp_glDrawTextureNV; -pfn_glGetMultisamplefvNV fp_glGetMultisamplefvNV; -pfn_glSampleMaskIndexedNV fp_glSampleMaskIndexedNV; -pfn_glTexRenderbufferNV fp_glTexRenderbufferNV; -pfn_glDeleteFencesNV fp_glDeleteFencesNV; -pfn_glGenFencesNV fp_glGenFencesNV; -pfn_glIsFenceNV fp_glIsFenceNV; -pfn_glTestFenceNV fp_glTestFenceNV; -pfn_glGetFenceivNV fp_glGetFenceivNV; -pfn_glFinishFenceNV fp_glFinishFenceNV; -pfn_glSetFenceNV fp_glSetFenceNV; -pfn_glFragmentCoverageColorNV fp_glFragmentCoverageColorNV; -pfn_glBlitFramebufferNV fp_glBlitFramebufferNV; -pfn_glCoverageModulationTableNV fp_glCoverageModulationTableNV; -pfn_glGetCoverageModulationTableNV fp_glGetCoverageModulationTableNV; -pfn_glCoverageModulationNV fp_glCoverageModulationNV; -pfn_glRenderbufferStorageMultisampleNV fp_glRenderbufferStorageMultisampleNV; -pfn_glRenderbufferStorageMultisampleCoverageNV fp_glRenderbufferStorageMultisampleCoverageNV; -pfn_glProgramVertexLimitNV fp_glProgramVertexLimitNV; -pfn_glFramebufferTextureFaceEXT fp_glFramebufferTextureFaceEXT; -pfn_glProgramLocalParameterI4iNV fp_glProgramLocalParameterI4iNV; -pfn_glProgramLocalParameterI4ivNV fp_glProgramLocalParameterI4ivNV; -pfn_glProgramLocalParametersI4ivNV fp_glProgramLocalParametersI4ivNV; -pfn_glProgramLocalParameterI4uiNV fp_glProgramLocalParameterI4uiNV; -pfn_glProgramLocalParameterI4uivNV fp_glProgramLocalParameterI4uivNV; -pfn_glProgramLocalParametersI4uivNV fp_glProgramLocalParametersI4uivNV; -pfn_glProgramEnvParameterI4iNV fp_glProgramEnvParameterI4iNV; -pfn_glProgramEnvParameterI4ivNV fp_glProgramEnvParameterI4ivNV; -pfn_glProgramEnvParametersI4ivNV fp_glProgramEnvParametersI4ivNV; -pfn_glProgramEnvParameterI4uiNV fp_glProgramEnvParameterI4uiNV; -pfn_glProgramEnvParameterI4uivNV fp_glProgramEnvParameterI4uivNV; -pfn_glProgramEnvParametersI4uivNV fp_glProgramEnvParametersI4uivNV; -pfn_glGetProgramLocalParameterIivNV fp_glGetProgramLocalParameterIivNV; -pfn_glGetProgramLocalParameterIuivNV fp_glGetProgramLocalParameterIuivNV; -pfn_glGetProgramEnvParameterIivNV fp_glGetProgramEnvParameterIivNV; -pfn_glGetProgramEnvParameterIuivNV fp_glGetProgramEnvParameterIuivNV; -pfn_glProgramSubroutineParametersuivNV fp_glProgramSubroutineParametersuivNV; -pfn_glGetProgramSubroutineParameteruivNV fp_glGetProgramSubroutineParameteruivNV; -pfn_glVertex2hNV fp_glVertex2hNV; -pfn_glVertex2hvNV fp_glVertex2hvNV; -pfn_glVertex3hNV fp_glVertex3hNV; -pfn_glVertex3hvNV fp_glVertex3hvNV; -pfn_glVertex4hNV fp_glVertex4hNV; -pfn_glVertex4hvNV fp_glVertex4hvNV; -pfn_glNormal3hNV fp_glNormal3hNV; -pfn_glNormal3hvNV fp_glNormal3hvNV; -pfn_glColor3hNV fp_glColor3hNV; -pfn_glColor3hvNV fp_glColor3hvNV; -pfn_glColor4hNV fp_glColor4hNV; -pfn_glColor4hvNV fp_glColor4hvNV; -pfn_glTexCoord1hNV fp_glTexCoord1hNV; -pfn_glTexCoord1hvNV fp_glTexCoord1hvNV; -pfn_glTexCoord2hNV fp_glTexCoord2hNV; -pfn_glTexCoord2hvNV fp_glTexCoord2hvNV; -pfn_glTexCoord3hNV fp_glTexCoord3hNV; -pfn_glTexCoord3hvNV fp_glTexCoord3hvNV; -pfn_glTexCoord4hNV fp_glTexCoord4hNV; -pfn_glTexCoord4hvNV fp_glTexCoord4hvNV; -pfn_glMultiTexCoord1hNV fp_glMultiTexCoord1hNV; -pfn_glMultiTexCoord1hvNV fp_glMultiTexCoord1hvNV; -pfn_glMultiTexCoord2hNV fp_glMultiTexCoord2hNV; -pfn_glMultiTexCoord2hvNV fp_glMultiTexCoord2hvNV; -pfn_glMultiTexCoord3hNV fp_glMultiTexCoord3hNV; -pfn_glMultiTexCoord3hvNV fp_glMultiTexCoord3hvNV; -pfn_glMultiTexCoord4hNV fp_glMultiTexCoord4hNV; -pfn_glMultiTexCoord4hvNV fp_glMultiTexCoord4hvNV; -pfn_glFogCoordhNV fp_glFogCoordhNV; -pfn_glFogCoordhvNV fp_glFogCoordhvNV; -pfn_glSecondaryColor3hNV fp_glSecondaryColor3hNV; -pfn_glSecondaryColor3hvNV fp_glSecondaryColor3hvNV; -pfn_glVertexWeighthNV fp_glVertexWeighthNV; -pfn_glVertexWeighthvNV fp_glVertexWeighthvNV; -pfn_glVertexAttrib1hNV fp_glVertexAttrib1hNV; -pfn_glVertexAttrib1hvNV fp_glVertexAttrib1hvNV; -pfn_glVertexAttrib2hNV fp_glVertexAttrib2hNV; -pfn_glVertexAttrib2hvNV fp_glVertexAttrib2hvNV; -pfn_glVertexAttrib3hNV fp_glVertexAttrib3hNV; -pfn_glVertexAttrib3hvNV fp_glVertexAttrib3hvNV; -pfn_glVertexAttrib4hNV fp_glVertexAttrib4hNV; -pfn_glVertexAttrib4hvNV fp_glVertexAttrib4hvNV; -pfn_glVertexAttribs1hvNV fp_glVertexAttribs1hvNV; -pfn_glVertexAttribs2hvNV fp_glVertexAttribs2hvNV; -pfn_glVertexAttribs3hvNV fp_glVertexAttribs3hvNV; -pfn_glVertexAttribs4hvNV fp_glVertexAttribs4hvNV; -pfn_glVertexAttribDivisorNV fp_glVertexAttribDivisorNV; -pfn_glGetInternalformatSampleivNV fp_glGetInternalformatSampleivNV; -pfn_glUniformMatrix2x3fvNV fp_glUniformMatrix2x3fvNV; -pfn_glUniformMatrix3x2fvNV fp_glUniformMatrix3x2fvNV; -pfn_glUniformMatrix2x4fvNV fp_glUniformMatrix2x4fvNV; -pfn_glUniformMatrix4x2fvNV fp_glUniformMatrix4x2fvNV; -pfn_glUniformMatrix3x4fvNV fp_glUniformMatrix3x4fvNV; -pfn_glUniformMatrix4x3fvNV fp_glUniformMatrix4x3fvNV; -pfn_glGenOcclusionQueriesNV fp_glGenOcclusionQueriesNV; -pfn_glDeleteOcclusionQueriesNV fp_glDeleteOcclusionQueriesNV; -pfn_glIsOcclusionQueryNV fp_glIsOcclusionQueryNV; -pfn_glBeginOcclusionQueryNV fp_glBeginOcclusionQueryNV; -pfn_glEndOcclusionQueryNV fp_glEndOcclusionQueryNV; -pfn_glGetOcclusionQueryivNV fp_glGetOcclusionQueryivNV; -pfn_glGetOcclusionQueryuivNV fp_glGetOcclusionQueryuivNV; -pfn_glProgramBufferParametersfvNV fp_glProgramBufferParametersfvNV; -pfn_glProgramBufferParametersIivNV fp_glProgramBufferParametersIivNV; -pfn_glProgramBufferParametersIuivNV fp_glProgramBufferParametersIuivNV; -pfn_glGenPathsNV fp_glGenPathsNV; -pfn_glDeletePathsNV fp_glDeletePathsNV; -pfn_glIsPathNV fp_glIsPathNV; -pfn_glPathCommandsNV fp_glPathCommandsNV; -pfn_glPathCoordsNV fp_glPathCoordsNV; -pfn_glPathSubCommandsNV fp_glPathSubCommandsNV; -pfn_glPathSubCoordsNV fp_glPathSubCoordsNV; -pfn_glPathStringNV fp_glPathStringNV; -pfn_glPathGlyphsNV fp_glPathGlyphsNV; -pfn_glPathGlyphRangeNV fp_glPathGlyphRangeNV; -pfn_glWeightPathsNV fp_glWeightPathsNV; -pfn_glCopyPathNV fp_glCopyPathNV; -pfn_glInterpolatePathsNV fp_glInterpolatePathsNV; -pfn_glTransformPathNV fp_glTransformPathNV; -pfn_glPathParameterivNV fp_glPathParameterivNV; -pfn_glPathParameteriNV fp_glPathParameteriNV; -pfn_glPathParameterfvNV fp_glPathParameterfvNV; -pfn_glPathParameterfNV fp_glPathParameterfNV; -pfn_glPathDashArrayNV fp_glPathDashArrayNV; -pfn_glPathStencilFuncNV fp_glPathStencilFuncNV; -pfn_glPathStencilDepthOffsetNV fp_glPathStencilDepthOffsetNV; -pfn_glStencilFillPathNV fp_glStencilFillPathNV; -pfn_glStencilStrokePathNV fp_glStencilStrokePathNV; -pfn_glStencilFillPathInstancedNV fp_glStencilFillPathInstancedNV; -pfn_glStencilStrokePathInstancedNV fp_glStencilStrokePathInstancedNV; -pfn_glPathCoverDepthFuncNV fp_glPathCoverDepthFuncNV; -pfn_glCoverFillPathNV fp_glCoverFillPathNV; -pfn_glCoverStrokePathNV fp_glCoverStrokePathNV; -pfn_glCoverFillPathInstancedNV fp_glCoverFillPathInstancedNV; -pfn_glCoverStrokePathInstancedNV fp_glCoverStrokePathInstancedNV; -pfn_glGetPathParameterivNV fp_glGetPathParameterivNV; -pfn_glGetPathParameterfvNV fp_glGetPathParameterfvNV; -pfn_glGetPathCommandsNV fp_glGetPathCommandsNV; -pfn_glGetPathCoordsNV fp_glGetPathCoordsNV; -pfn_glGetPathDashArrayNV fp_glGetPathDashArrayNV; -pfn_glGetPathMetricsNV fp_glGetPathMetricsNV; -pfn_glGetPathMetricRangeNV fp_glGetPathMetricRangeNV; -pfn_glGetPathSpacingNV fp_glGetPathSpacingNV; -pfn_glIsPointInFillPathNV fp_glIsPointInFillPathNV; -pfn_glIsPointInStrokePathNV fp_glIsPointInStrokePathNV; -pfn_glGetPathLengthNV fp_glGetPathLengthNV; -pfn_glPointAlongPathNV fp_glPointAlongPathNV; -pfn_glMatrixLoad3x2fNV fp_glMatrixLoad3x2fNV; -pfn_glMatrixLoad3x3fNV fp_glMatrixLoad3x3fNV; -pfn_glMatrixLoadTranspose3x3fNV fp_glMatrixLoadTranspose3x3fNV; -pfn_glMatrixMult3x2fNV fp_glMatrixMult3x2fNV; -pfn_glMatrixMult3x3fNV fp_glMatrixMult3x3fNV; -pfn_glMatrixMultTranspose3x3fNV fp_glMatrixMultTranspose3x3fNV; -pfn_glStencilThenCoverFillPathNV fp_glStencilThenCoverFillPathNV; -pfn_glStencilThenCoverStrokePathNV fp_glStencilThenCoverStrokePathNV; -pfn_glStencilThenCoverFillPathInstancedNV fp_glStencilThenCoverFillPathInstancedNV; -pfn_glStencilThenCoverStrokePathInstancedNV fp_glStencilThenCoverStrokePathInstancedNV; -pfn_glPathGlyphIndexRangeNV fp_glPathGlyphIndexRangeNV; -pfn_glPathGlyphIndexArrayNV fp_glPathGlyphIndexArrayNV; -pfn_glPathMemoryGlyphIndexArrayNV fp_glPathMemoryGlyphIndexArrayNV; -pfn_glProgramPathFragmentInputGenNV fp_glProgramPathFragmentInputGenNV; -pfn_glGetProgramResourcefvNV fp_glGetProgramResourcefvNV; -pfn_glPathColorGenNV fp_glPathColorGenNV; -pfn_glPathTexGenNV fp_glPathTexGenNV; -pfn_glPathFogGenNV fp_glPathFogGenNV; -pfn_glGetPathColorGenivNV fp_glGetPathColorGenivNV; -pfn_glGetPathColorGenfvNV fp_glGetPathColorGenfvNV; -pfn_glGetPathTexGenivNV fp_glGetPathTexGenivNV; -pfn_glGetPathTexGenfvNV fp_glGetPathTexGenfvNV; -pfn_glPolygonModeNV fp_glPolygonModeNV; -pfn_glPresentFrameKeyedNV fp_glPresentFrameKeyedNV; -pfn_glPresentFrameDualFillNV fp_glPresentFrameDualFillNV; -pfn_glGetVideoivNV fp_glGetVideoivNV; -pfn_glGetVideouivNV fp_glGetVideouivNV; -pfn_glGetVideoi64vNV fp_glGetVideoi64vNV; -pfn_glGetVideoui64vNV fp_glGetVideoui64vNV; -pfn_glPrimitiveRestartNV fp_glPrimitiveRestartNV; -pfn_glPrimitiveRestartIndexNV fp_glPrimitiveRestartIndexNV; -pfn_glReadBufferNV fp_glReadBufferNV; -pfn_glFramebufferSampleLocationsfvNV fp_glFramebufferSampleLocationsfvNV; -pfn_glNamedFramebufferSampleLocationsfvNV fp_glNamedFramebufferSampleLocationsfvNV; -pfn_glResolveDepthValuesNV fp_glResolveDepthValuesNV; -pfn_glMakeBufferResidentNV fp_glMakeBufferResidentNV; -pfn_glMakeBufferNonResidentNV fp_glMakeBufferNonResidentNV; -pfn_glIsBufferResidentNV fp_glIsBufferResidentNV; -pfn_glMakeNamedBufferResidentNV fp_glMakeNamedBufferResidentNV; -pfn_glMakeNamedBufferNonResidentNV fp_glMakeNamedBufferNonResidentNV; -pfn_glIsNamedBufferResidentNV fp_glIsNamedBufferResidentNV; -pfn_glGetBufferParameterui64vNV fp_glGetBufferParameterui64vNV; -pfn_glGetNamedBufferParameterui64vNV fp_glGetNamedBufferParameterui64vNV; -pfn_glGetIntegerui64vNV fp_glGetIntegerui64vNV; -pfn_glUniformui64NV fp_glUniformui64NV; -pfn_glUniformui64vNV fp_glUniformui64vNV; -pfn_glProgramUniformui64NV fp_glProgramUniformui64NV; -pfn_glProgramUniformui64vNV fp_glProgramUniformui64vNV; -pfn_glTextureBarrierNV fp_glTextureBarrierNV; -pfn_glTexImage2DMultisampleCoverageNV fp_glTexImage2DMultisampleCoverageNV; -pfn_glTexImage3DMultisampleCoverageNV fp_glTexImage3DMultisampleCoverageNV; -pfn_glTextureImage2DMultisampleNV fp_glTextureImage2DMultisampleNV; -pfn_glTextureImage3DMultisampleNV fp_glTextureImage3DMultisampleNV; -pfn_glTextureImage2DMultisampleCoverageNV fp_glTextureImage2DMultisampleCoverageNV; -pfn_glTextureImage3DMultisampleCoverageNV fp_glTextureImage3DMultisampleCoverageNV; -pfn_glBeginTransformFeedbackNV fp_glBeginTransformFeedbackNV; -pfn_glEndTransformFeedbackNV fp_glEndTransformFeedbackNV; -pfn_glTransformFeedbackAttribsNV fp_glTransformFeedbackAttribsNV; -pfn_glBindBufferRangeNV fp_glBindBufferRangeNV; -pfn_glBindBufferOffsetNV fp_glBindBufferOffsetNV; -pfn_glBindBufferBaseNV fp_glBindBufferBaseNV; -pfn_glTransformFeedbackVaryingsNV fp_glTransformFeedbackVaryingsNV; -pfn_glActiveVaryingNV fp_glActiveVaryingNV; -pfn_glGetVaryingLocationNV fp_glGetVaryingLocationNV; -pfn_glGetActiveVaryingNV fp_glGetActiveVaryingNV; -pfn_glGetTransformFeedbackVaryingNV fp_glGetTransformFeedbackVaryingNV; -pfn_glTransformFeedbackStreamAttribsNV fp_glTransformFeedbackStreamAttribsNV; -pfn_glBindTransformFeedbackNV fp_glBindTransformFeedbackNV; -pfn_glDeleteTransformFeedbacksNV fp_glDeleteTransformFeedbacksNV; -pfn_glGenTransformFeedbacksNV fp_glGenTransformFeedbacksNV; -pfn_glIsTransformFeedbackNV fp_glIsTransformFeedbackNV; -pfn_glPauseTransformFeedbackNV fp_glPauseTransformFeedbackNV; -pfn_glResumeTransformFeedbackNV fp_glResumeTransformFeedbackNV; -pfn_glDrawTransformFeedbackNV fp_glDrawTransformFeedbackNV; -pfn_glVDPAUInitNV fp_glVDPAUInitNV; -pfn_glVDPAUFiniNV fp_glVDPAUFiniNV; -pfn_glVDPAURegisterVideoSurfaceNV fp_glVDPAURegisterVideoSurfaceNV; -pfn_glVDPAURegisterOutputSurfaceNV fp_glVDPAURegisterOutputSurfaceNV; -pfn_glVDPAUIsSurfaceNV fp_glVDPAUIsSurfaceNV; -pfn_glVDPAUUnregisterSurfaceNV fp_glVDPAUUnregisterSurfaceNV; -pfn_glVDPAUGetSurfaceivNV fp_glVDPAUGetSurfaceivNV; -pfn_glVDPAUSurfaceAccessNV fp_glVDPAUSurfaceAccessNV; -pfn_glVDPAUMapSurfacesNV fp_glVDPAUMapSurfacesNV; -pfn_glVDPAUUnmapSurfacesNV fp_glVDPAUUnmapSurfacesNV; -pfn_glVertexAttribL1i64NV fp_glVertexAttribL1i64NV; -pfn_glVertexAttribL2i64NV fp_glVertexAttribL2i64NV; -pfn_glVertexAttribL3i64NV fp_glVertexAttribL3i64NV; -pfn_glVertexAttribL4i64NV fp_glVertexAttribL4i64NV; -pfn_glVertexAttribL1i64vNV fp_glVertexAttribL1i64vNV; -pfn_glVertexAttribL2i64vNV fp_glVertexAttribL2i64vNV; -pfn_glVertexAttribL3i64vNV fp_glVertexAttribL3i64vNV; -pfn_glVertexAttribL4i64vNV fp_glVertexAttribL4i64vNV; -pfn_glVertexAttribL1ui64NV fp_glVertexAttribL1ui64NV; -pfn_glVertexAttribL2ui64NV fp_glVertexAttribL2ui64NV; -pfn_glVertexAttribL3ui64NV fp_glVertexAttribL3ui64NV; -pfn_glVertexAttribL4ui64NV fp_glVertexAttribL4ui64NV; -pfn_glVertexAttribL1ui64vNV fp_glVertexAttribL1ui64vNV; -pfn_glVertexAttribL2ui64vNV fp_glVertexAttribL2ui64vNV; -pfn_glVertexAttribL3ui64vNV fp_glVertexAttribL3ui64vNV; -pfn_glVertexAttribL4ui64vNV fp_glVertexAttribL4ui64vNV; -pfn_glGetVertexAttribLi64vNV fp_glGetVertexAttribLi64vNV; -pfn_glGetVertexAttribLui64vNV fp_glGetVertexAttribLui64vNV; -pfn_glVertexAttribLFormatNV fp_glVertexAttribLFormatNV; -pfn_glBufferAddressRangeNV fp_glBufferAddressRangeNV; -pfn_glVertexFormatNV fp_glVertexFormatNV; -pfn_glNormalFormatNV fp_glNormalFormatNV; -pfn_glColorFormatNV fp_glColorFormatNV; -pfn_glIndexFormatNV fp_glIndexFormatNV; -pfn_glTexCoordFormatNV fp_glTexCoordFormatNV; -pfn_glEdgeFlagFormatNV fp_glEdgeFlagFormatNV; -pfn_glSecondaryColorFormatNV fp_glSecondaryColorFormatNV; -pfn_glFogCoordFormatNV fp_glFogCoordFormatNV; -pfn_glVertexAttribFormatNV fp_glVertexAttribFormatNV; -pfn_glVertexAttribIFormatNV fp_glVertexAttribIFormatNV; -pfn_glGetIntegerui64i_vNV fp_glGetIntegerui64i_vNV; -pfn_glVertexAttribI1iEXT fp_glVertexAttribI1iEXT; -pfn_glVertexAttribI2iEXT fp_glVertexAttribI2iEXT; -pfn_glVertexAttribI3iEXT fp_glVertexAttribI3iEXT; -pfn_glVertexAttribI4iEXT fp_glVertexAttribI4iEXT; -pfn_glVertexAttribI1uiEXT fp_glVertexAttribI1uiEXT; -pfn_glVertexAttribI2uiEXT fp_glVertexAttribI2uiEXT; -pfn_glVertexAttribI3uiEXT fp_glVertexAttribI3uiEXT; -pfn_glVertexAttribI4uiEXT fp_glVertexAttribI4uiEXT; -pfn_glVertexAttribI1ivEXT fp_glVertexAttribI1ivEXT; -pfn_glVertexAttribI2ivEXT fp_glVertexAttribI2ivEXT; -pfn_glVertexAttribI3ivEXT fp_glVertexAttribI3ivEXT; -pfn_glVertexAttribI4ivEXT fp_glVertexAttribI4ivEXT; -pfn_glVertexAttribI1uivEXT fp_glVertexAttribI1uivEXT; -pfn_glVertexAttribI2uivEXT fp_glVertexAttribI2uivEXT; -pfn_glVertexAttribI3uivEXT fp_glVertexAttribI3uivEXT; -pfn_glVertexAttribI4uivEXT fp_glVertexAttribI4uivEXT; -pfn_glVertexAttribI4bvEXT fp_glVertexAttribI4bvEXT; -pfn_glVertexAttribI4svEXT fp_glVertexAttribI4svEXT; -pfn_glVertexAttribI4ubvEXT fp_glVertexAttribI4ubvEXT; -pfn_glVertexAttribI4usvEXT fp_glVertexAttribI4usvEXT; -pfn_glVertexAttribIPointerEXT fp_glVertexAttribIPointerEXT; -pfn_glGetVertexAttribIivEXT fp_glGetVertexAttribIivEXT; -pfn_glGetVertexAttribIuivEXT fp_glGetVertexAttribIuivEXT; -pfn_glBeginVideoCaptureNV fp_glBeginVideoCaptureNV; -pfn_glBindVideoCaptureStreamBufferNV fp_glBindVideoCaptureStreamBufferNV; -pfn_glBindVideoCaptureStreamTextureNV fp_glBindVideoCaptureStreamTextureNV; -pfn_glEndVideoCaptureNV fp_glEndVideoCaptureNV; -pfn_glGetVideoCaptureivNV fp_glGetVideoCaptureivNV; -pfn_glGetVideoCaptureStreamivNV fp_glGetVideoCaptureStreamivNV; -pfn_glGetVideoCaptureStreamfvNV fp_glGetVideoCaptureStreamfvNV; -pfn_glGetVideoCaptureStreamdvNV fp_glGetVideoCaptureStreamdvNV; -pfn_glVideoCaptureNV fp_glVideoCaptureNV; -pfn_glVideoCaptureStreamParameterivNV fp_glVideoCaptureStreamParameterivNV; -pfn_glVideoCaptureStreamParameterfvNV fp_glVideoCaptureStreamParameterfvNV; -pfn_glVideoCaptureStreamParameterdvNV fp_glVideoCaptureStreamParameterdvNV; -pfn_glViewportArrayvNV fp_glViewportArrayvNV; -pfn_glViewportIndexedfNV fp_glViewportIndexedfNV; -pfn_glViewportIndexedfvNV fp_glViewportIndexedfvNV; -pfn_glScissorArrayvNV fp_glScissorArrayvNV; -pfn_glScissorIndexedNV fp_glScissorIndexedNV; -pfn_glScissorIndexedvNV fp_glScissorIndexedvNV; -pfn_glDepthRangeArrayfvNV fp_glDepthRangeArrayfvNV; -pfn_glDepthRangeIndexedfNV fp_glDepthRangeIndexedfNV; -pfn_glGetFloati_vNV fp_glGetFloati_vNV; -pfn_glEnableiNV fp_glEnableiNV; -pfn_glDisableiNV fp_glDisableiNV; -pfn_glIsEnablediNV fp_glIsEnablediNV; -pfn_glBeginConditionalRenderNVX fp_glBeginConditionalRenderNVX; -pfn_glEndConditionalRenderNVX fp_glEndConditionalRenderNVX; -pfn_glFramebufferTextureMultiviewOVR fp_glFramebufferTextureMultiviewOVR; -pfn_glFramebufferTextureMultisampleMultiviewOVR fp_glFramebufferTextureMultisampleMultiviewOVR; -pfn_glAlphaFuncQCOM fp_glAlphaFuncQCOM; -pfn_glGetDriverControlsQCOM fp_glGetDriverControlsQCOM; -pfn_glGetDriverControlStringQCOM fp_glGetDriverControlStringQCOM; -pfn_glEnableDriverControlQCOM fp_glEnableDriverControlQCOM; -pfn_glDisableDriverControlQCOM fp_glDisableDriverControlQCOM; -pfn_glExtGetTexturesQCOM fp_glExtGetTexturesQCOM; -pfn_glExtGetBuffersQCOM fp_glExtGetBuffersQCOM; -pfn_glExtGetRenderbuffersQCOM fp_glExtGetRenderbuffersQCOM; -pfn_glExtGetFramebuffersQCOM fp_glExtGetFramebuffersQCOM; -pfn_glExtGetTexLevelParameterivQCOM fp_glExtGetTexLevelParameterivQCOM; -pfn_glExtTexObjectStateOverrideiQCOM fp_glExtTexObjectStateOverrideiQCOM; -pfn_glExtGetTexSubImageQCOM fp_glExtGetTexSubImageQCOM; -pfn_glExtGetBufferPointervQCOM fp_glExtGetBufferPointervQCOM; -pfn_glExtGetShadersQCOM fp_glExtGetShadersQCOM; -pfn_glExtGetProgramsQCOM fp_glExtGetProgramsQCOM; -pfn_glExtIsProgramBinaryQCOM fp_glExtIsProgramBinaryQCOM; -pfn_glExtGetProgramBinarySourceQCOM fp_glExtGetProgramBinarySourceQCOM; -pfn_glStartTilingQCOM fp_glStartTilingQCOM; -pfn_glEndTilingQCOM fp_glEndTilingQCOM; - -GLboolean GLAD_VERSION_1_0 = GL_FALSE; -static void load_GL_VERSION_1_0(LOADER load) { - if(!GLAD_VERSION_1_0) return; - fp_glCullFace = (pfn_glCullFace)load("glCullFace"); - fp_glFrontFace = (pfn_glFrontFace)load("glFrontFace"); - fp_glHint = (pfn_glHint)load("glHint"); - fp_glLineWidth = (pfn_glLineWidth)load("glLineWidth"); - fp_glPointSize = (pfn_glPointSize)load("glPointSize"); - fp_glPolygonMode = (pfn_glPolygonMode)load("glPolygonMode"); - fp_glScissor = (pfn_glScissor)load("glScissor"); - fp_glTexParameterf = (pfn_glTexParameterf)load("glTexParameterf"); - fp_glTexParameterfv = (pfn_glTexParameterfv)load("glTexParameterfv"); - fp_glTexParameteri = (pfn_glTexParameteri)load("glTexParameteri"); - fp_glTexParameteriv = (pfn_glTexParameteriv)load("glTexParameteriv"); - fp_glTexImage1D = (pfn_glTexImage1D)load("glTexImage1D"); - fp_glTexImage2D = (pfn_glTexImage2D)load("glTexImage2D"); - fp_glDrawBuffer = (pfn_glDrawBuffer)load("glDrawBuffer"); - fp_glClear = (pfn_glClear)load("glClear"); - fp_glClearColor = (pfn_glClearColor)load("glClearColor"); - fp_glClearStencil = (pfn_glClearStencil)load("glClearStencil"); - fp_glClearDepth = (pfn_glClearDepth)load("glClearDepth"); - fp_glStencilMask = (pfn_glStencilMask)load("glStencilMask"); - fp_glColorMask = (pfn_glColorMask)load("glColorMask"); - fp_glDepthMask = (pfn_glDepthMask)load("glDepthMask"); - fp_glDisable = (pfn_glDisable)load("glDisable"); - fp_glEnable = (pfn_glEnable)load("glEnable"); - fp_glFinish = (pfn_glFinish)load("glFinish"); - fp_glFlush = (pfn_glFlush)load("glFlush"); - fp_glBlendFunc = (pfn_glBlendFunc)load("glBlendFunc"); - fp_glLogicOp = (pfn_glLogicOp)load("glLogicOp"); - fp_glStencilFunc = (pfn_glStencilFunc)load("glStencilFunc"); - fp_glStencilOp = (pfn_glStencilOp)load("glStencilOp"); - fp_glDepthFunc = (pfn_glDepthFunc)load("glDepthFunc"); - fp_glPixelStoref = (pfn_glPixelStoref)load("glPixelStoref"); - fp_glPixelStorei = (pfn_glPixelStorei)load("glPixelStorei"); - fp_glReadBuffer = (pfn_glReadBuffer)load("glReadBuffer"); - fp_glReadPixels = (pfn_glReadPixels)load("glReadPixels"); - fp_glGetBooleanv = (pfn_glGetBooleanv)load("glGetBooleanv"); - fp_glGetDoublev = (pfn_glGetDoublev)load("glGetDoublev"); - fp_glGetError = (pfn_glGetError)load("glGetError"); - fp_glGetFloatv = (pfn_glGetFloatv)load("glGetFloatv"); - fp_glGetIntegerv = (pfn_glGetIntegerv)load("glGetIntegerv"); - fp_glGetString = (pfn_glGetString)load("glGetString"); - fp_glGetTexImage = (pfn_glGetTexImage)load("glGetTexImage"); - fp_glGetTexParameterfv = (pfn_glGetTexParameterfv)load("glGetTexParameterfv"); - fp_glGetTexParameteriv = (pfn_glGetTexParameteriv)load("glGetTexParameteriv"); - fp_glGetTexLevelParameterfv = (pfn_glGetTexLevelParameterfv)load("glGetTexLevelParameterfv"); - fp_glGetTexLevelParameteriv = (pfn_glGetTexLevelParameteriv)load("glGetTexLevelParameteriv"); - fp_glIsEnabled = (pfn_glIsEnabled)load("glIsEnabled"); - fp_glDepthRange = (pfn_glDepthRange)load("glDepthRange"); - fp_glViewport = (pfn_glViewport)load("glViewport"); - fp_glNewList = (pfn_glNewList)load("glNewList"); - fp_glEndList = (pfn_glEndList)load("glEndList"); - fp_glCallList = (pfn_glCallList)load("glCallList"); - fp_glCallLists = (pfn_glCallLists)load("glCallLists"); - fp_glDeleteLists = (pfn_glDeleteLists)load("glDeleteLists"); - fp_glGenLists = (pfn_glGenLists)load("glGenLists"); - fp_glListBase = (pfn_glListBase)load("glListBase"); - fp_glBegin = (pfn_glBegin)load("glBegin"); - fp_glBitmap = (pfn_glBitmap)load("glBitmap"); - fp_glColor3b = (pfn_glColor3b)load("glColor3b"); - fp_glColor3bv = (pfn_glColor3bv)load("glColor3bv"); - fp_glColor3d = (pfn_glColor3d)load("glColor3d"); - fp_glColor3dv = (pfn_glColor3dv)load("glColor3dv"); - fp_glColor3f = (pfn_glColor3f)load("glColor3f"); - fp_glColor3fv = (pfn_glColor3fv)load("glColor3fv"); - fp_glColor3i = (pfn_glColor3i)load("glColor3i"); - fp_glColor3iv = (pfn_glColor3iv)load("glColor3iv"); - fp_glColor3s = (pfn_glColor3s)load("glColor3s"); - fp_glColor3sv = (pfn_glColor3sv)load("glColor3sv"); - fp_glColor3ub = (pfn_glColor3ub)load("glColor3ub"); - fp_glColor3ubv = (pfn_glColor3ubv)load("glColor3ubv"); - fp_glColor3ui = (pfn_glColor3ui)load("glColor3ui"); - fp_glColor3uiv = (pfn_glColor3uiv)load("glColor3uiv"); - fp_glColor3us = (pfn_glColor3us)load("glColor3us"); - fp_glColor3usv = (pfn_glColor3usv)load("glColor3usv"); - fp_glColor4b = (pfn_glColor4b)load("glColor4b"); - fp_glColor4bv = (pfn_glColor4bv)load("glColor4bv"); - fp_glColor4d = (pfn_glColor4d)load("glColor4d"); - fp_glColor4dv = (pfn_glColor4dv)load("glColor4dv"); - fp_glColor4f = (pfn_glColor4f)load("glColor4f"); - fp_glColor4fv = (pfn_glColor4fv)load("glColor4fv"); - fp_glColor4i = (pfn_glColor4i)load("glColor4i"); - fp_glColor4iv = (pfn_glColor4iv)load("glColor4iv"); - fp_glColor4s = (pfn_glColor4s)load("glColor4s"); - fp_glColor4sv = (pfn_glColor4sv)load("glColor4sv"); - fp_glColor4ub = (pfn_glColor4ub)load("glColor4ub"); - fp_glColor4ubv = (pfn_glColor4ubv)load("glColor4ubv"); - fp_glColor4ui = (pfn_glColor4ui)load("glColor4ui"); - fp_glColor4uiv = (pfn_glColor4uiv)load("glColor4uiv"); - fp_glColor4us = (pfn_glColor4us)load("glColor4us"); - fp_glColor4usv = (pfn_glColor4usv)load("glColor4usv"); - fp_glEdgeFlag = (pfn_glEdgeFlag)load("glEdgeFlag"); - fp_glEdgeFlagv = (pfn_glEdgeFlagv)load("glEdgeFlagv"); - fp_glEnd = (pfn_glEnd)load("glEnd"); - fp_glIndexd = (pfn_glIndexd)load("glIndexd"); - fp_glIndexdv = (pfn_glIndexdv)load("glIndexdv"); - fp_glIndexf = (pfn_glIndexf)load("glIndexf"); - fp_glIndexfv = (pfn_glIndexfv)load("glIndexfv"); - fp_glIndexi = (pfn_glIndexi)load("glIndexi"); - fp_glIndexiv = (pfn_glIndexiv)load("glIndexiv"); - fp_glIndexs = (pfn_glIndexs)load("glIndexs"); - fp_glIndexsv = (pfn_glIndexsv)load("glIndexsv"); - fp_glNormal3b = (pfn_glNormal3b)load("glNormal3b"); - fp_glNormal3bv = (pfn_glNormal3bv)load("glNormal3bv"); - fp_glNormal3d = (pfn_glNormal3d)load("glNormal3d"); - fp_glNormal3dv = (pfn_glNormal3dv)load("glNormal3dv"); - fp_glNormal3f = (pfn_glNormal3f)load("glNormal3f"); - fp_glNormal3fv = (pfn_glNormal3fv)load("glNormal3fv"); - fp_glNormal3i = (pfn_glNormal3i)load("glNormal3i"); - fp_glNormal3iv = (pfn_glNormal3iv)load("glNormal3iv"); - fp_glNormal3s = (pfn_glNormal3s)load("glNormal3s"); - fp_glNormal3sv = (pfn_glNormal3sv)load("glNormal3sv"); - fp_glRasterPos2d = (pfn_glRasterPos2d)load("glRasterPos2d"); - fp_glRasterPos2dv = (pfn_glRasterPos2dv)load("glRasterPos2dv"); - fp_glRasterPos2f = (pfn_glRasterPos2f)load("glRasterPos2f"); - fp_glRasterPos2fv = (pfn_glRasterPos2fv)load("glRasterPos2fv"); - fp_glRasterPos2i = (pfn_glRasterPos2i)load("glRasterPos2i"); - fp_glRasterPos2iv = (pfn_glRasterPos2iv)load("glRasterPos2iv"); - fp_glRasterPos2s = (pfn_glRasterPos2s)load("glRasterPos2s"); - fp_glRasterPos2sv = (pfn_glRasterPos2sv)load("glRasterPos2sv"); - fp_glRasterPos3d = (pfn_glRasterPos3d)load("glRasterPos3d"); - fp_glRasterPos3dv = (pfn_glRasterPos3dv)load("glRasterPos3dv"); - fp_glRasterPos3f = (pfn_glRasterPos3f)load("glRasterPos3f"); - fp_glRasterPos3fv = (pfn_glRasterPos3fv)load("glRasterPos3fv"); - fp_glRasterPos3i = (pfn_glRasterPos3i)load("glRasterPos3i"); - fp_glRasterPos3iv = (pfn_glRasterPos3iv)load("glRasterPos3iv"); - fp_glRasterPos3s = (pfn_glRasterPos3s)load("glRasterPos3s"); - fp_glRasterPos3sv = (pfn_glRasterPos3sv)load("glRasterPos3sv"); - fp_glRasterPos4d = (pfn_glRasterPos4d)load("glRasterPos4d"); - fp_glRasterPos4dv = (pfn_glRasterPos4dv)load("glRasterPos4dv"); - fp_glRasterPos4f = (pfn_glRasterPos4f)load("glRasterPos4f"); - fp_glRasterPos4fv = (pfn_glRasterPos4fv)load("glRasterPos4fv"); - fp_glRasterPos4i = (pfn_glRasterPos4i)load("glRasterPos4i"); - fp_glRasterPos4iv = (pfn_glRasterPos4iv)load("glRasterPos4iv"); - fp_glRasterPos4s = (pfn_glRasterPos4s)load("glRasterPos4s"); - fp_glRasterPos4sv = (pfn_glRasterPos4sv)load("glRasterPos4sv"); - fp_glRectd = (pfn_glRectd)load("glRectd"); - fp_glRectdv = (pfn_glRectdv)load("glRectdv"); - fp_glRectf = (pfn_glRectf)load("glRectf"); - fp_glRectfv = (pfn_glRectfv)load("glRectfv"); - fp_glRecti = (pfn_glRecti)load("glRecti"); - fp_glRectiv = (pfn_glRectiv)load("glRectiv"); - fp_glRects = (pfn_glRects)load("glRects"); - fp_glRectsv = (pfn_glRectsv)load("glRectsv"); - fp_glTexCoord1d = (pfn_glTexCoord1d)load("glTexCoord1d"); - fp_glTexCoord1dv = (pfn_glTexCoord1dv)load("glTexCoord1dv"); - fp_glTexCoord1f = (pfn_glTexCoord1f)load("glTexCoord1f"); - fp_glTexCoord1fv = (pfn_glTexCoord1fv)load("glTexCoord1fv"); - fp_glTexCoord1i = (pfn_glTexCoord1i)load("glTexCoord1i"); - fp_glTexCoord1iv = (pfn_glTexCoord1iv)load("glTexCoord1iv"); - fp_glTexCoord1s = (pfn_glTexCoord1s)load("glTexCoord1s"); - fp_glTexCoord1sv = (pfn_glTexCoord1sv)load("glTexCoord1sv"); - fp_glTexCoord2d = (pfn_glTexCoord2d)load("glTexCoord2d"); - fp_glTexCoord2dv = (pfn_glTexCoord2dv)load("glTexCoord2dv"); - fp_glTexCoord2f = (pfn_glTexCoord2f)load("glTexCoord2f"); - fp_glTexCoord2fv = (pfn_glTexCoord2fv)load("glTexCoord2fv"); - fp_glTexCoord2i = (pfn_glTexCoord2i)load("glTexCoord2i"); - fp_glTexCoord2iv = (pfn_glTexCoord2iv)load("glTexCoord2iv"); - fp_glTexCoord2s = (pfn_glTexCoord2s)load("glTexCoord2s"); - fp_glTexCoord2sv = (pfn_glTexCoord2sv)load("glTexCoord2sv"); - fp_glTexCoord3d = (pfn_glTexCoord3d)load("glTexCoord3d"); - fp_glTexCoord3dv = (pfn_glTexCoord3dv)load("glTexCoord3dv"); - fp_glTexCoord3f = (pfn_glTexCoord3f)load("glTexCoord3f"); - fp_glTexCoord3fv = (pfn_glTexCoord3fv)load("glTexCoord3fv"); - fp_glTexCoord3i = (pfn_glTexCoord3i)load("glTexCoord3i"); - fp_glTexCoord3iv = (pfn_glTexCoord3iv)load("glTexCoord3iv"); - fp_glTexCoord3s = (pfn_glTexCoord3s)load("glTexCoord3s"); - fp_glTexCoord3sv = (pfn_glTexCoord3sv)load("glTexCoord3sv"); - fp_glTexCoord4d = (pfn_glTexCoord4d)load("glTexCoord4d"); - fp_glTexCoord4dv = (pfn_glTexCoord4dv)load("glTexCoord4dv"); - fp_glTexCoord4f = (pfn_glTexCoord4f)load("glTexCoord4f"); - fp_glTexCoord4fv = (pfn_glTexCoord4fv)load("glTexCoord4fv"); - fp_glTexCoord4i = (pfn_glTexCoord4i)load("glTexCoord4i"); - fp_glTexCoord4iv = (pfn_glTexCoord4iv)load("glTexCoord4iv"); - fp_glTexCoord4s = (pfn_glTexCoord4s)load("glTexCoord4s"); - fp_glTexCoord4sv = (pfn_glTexCoord4sv)load("glTexCoord4sv"); - fp_glVertex2d = (pfn_glVertex2d)load("glVertex2d"); - fp_glVertex2dv = (pfn_glVertex2dv)load("glVertex2dv"); - fp_glVertex2f = (pfn_glVertex2f)load("glVertex2f"); - fp_glVertex2fv = (pfn_glVertex2fv)load("glVertex2fv"); - fp_glVertex2i = (pfn_glVertex2i)load("glVertex2i"); - fp_glVertex2iv = (pfn_glVertex2iv)load("glVertex2iv"); - fp_glVertex2s = (pfn_glVertex2s)load("glVertex2s"); - fp_glVertex2sv = (pfn_glVertex2sv)load("glVertex2sv"); - fp_glVertex3d = (pfn_glVertex3d)load("glVertex3d"); - fp_glVertex3dv = (pfn_glVertex3dv)load("glVertex3dv"); - fp_glVertex3f = (pfn_glVertex3f)load("glVertex3f"); - fp_glVertex3fv = (pfn_glVertex3fv)load("glVertex3fv"); - fp_glVertex3i = (pfn_glVertex3i)load("glVertex3i"); - fp_glVertex3iv = (pfn_glVertex3iv)load("glVertex3iv"); - fp_glVertex3s = (pfn_glVertex3s)load("glVertex3s"); - fp_glVertex3sv = (pfn_glVertex3sv)load("glVertex3sv"); - fp_glVertex4d = (pfn_glVertex4d)load("glVertex4d"); - fp_glVertex4dv = (pfn_glVertex4dv)load("glVertex4dv"); - fp_glVertex4f = (pfn_glVertex4f)load("glVertex4f"); - fp_glVertex4fv = (pfn_glVertex4fv)load("glVertex4fv"); - fp_glVertex4i = (pfn_glVertex4i)load("glVertex4i"); - fp_glVertex4iv = (pfn_glVertex4iv)load("glVertex4iv"); - fp_glVertex4s = (pfn_glVertex4s)load("glVertex4s"); - fp_glVertex4sv = (pfn_glVertex4sv)load("glVertex4sv"); - fp_glClipPlane = (pfn_glClipPlane)load("glClipPlane"); - fp_glColorMaterial = (pfn_glColorMaterial)load("glColorMaterial"); - fp_glFogf = (pfn_glFogf)load("glFogf"); - fp_glFogfv = (pfn_glFogfv)load("glFogfv"); - fp_glFogi = (pfn_glFogi)load("glFogi"); - fp_glFogiv = (pfn_glFogiv)load("glFogiv"); - fp_glLightf = (pfn_glLightf)load("glLightf"); - fp_glLightfv = (pfn_glLightfv)load("glLightfv"); - fp_glLighti = (pfn_glLighti)load("glLighti"); - fp_glLightiv = (pfn_glLightiv)load("glLightiv"); - fp_glLightModelf = (pfn_glLightModelf)load("glLightModelf"); - fp_glLightModelfv = (pfn_glLightModelfv)load("glLightModelfv"); - fp_glLightModeli = (pfn_glLightModeli)load("glLightModeli"); - fp_glLightModeliv = (pfn_glLightModeliv)load("glLightModeliv"); - fp_glLineStipple = (pfn_glLineStipple)load("glLineStipple"); - fp_glMaterialf = (pfn_glMaterialf)load("glMaterialf"); - fp_glMaterialfv = (pfn_glMaterialfv)load("glMaterialfv"); - fp_glMateriali = (pfn_glMateriali)load("glMateriali"); - fp_glMaterialiv = (pfn_glMaterialiv)load("glMaterialiv"); - fp_glPolygonStipple = (pfn_glPolygonStipple)load("glPolygonStipple"); - fp_glShadeModel = (pfn_glShadeModel)load("glShadeModel"); - fp_glTexEnvf = (pfn_glTexEnvf)load("glTexEnvf"); - fp_glTexEnvfv = (pfn_glTexEnvfv)load("glTexEnvfv"); - fp_glTexEnvi = (pfn_glTexEnvi)load("glTexEnvi"); - fp_glTexEnviv = (pfn_glTexEnviv)load("glTexEnviv"); - fp_glTexGend = (pfn_glTexGend)load("glTexGend"); - fp_glTexGendv = (pfn_glTexGendv)load("glTexGendv"); - fp_glTexGenf = (pfn_glTexGenf)load("glTexGenf"); - fp_glTexGenfv = (pfn_glTexGenfv)load("glTexGenfv"); - fp_glTexGeni = (pfn_glTexGeni)load("glTexGeni"); - fp_glTexGeniv = (pfn_glTexGeniv)load("glTexGeniv"); - fp_glFeedbackBuffer = (pfn_glFeedbackBuffer)load("glFeedbackBuffer"); - fp_glSelectBuffer = (pfn_glSelectBuffer)load("glSelectBuffer"); - fp_glRenderMode = (pfn_glRenderMode)load("glRenderMode"); - fp_glInitNames = (pfn_glInitNames)load("glInitNames"); - fp_glLoadName = (pfn_glLoadName)load("glLoadName"); - fp_glPassThrough = (pfn_glPassThrough)load("glPassThrough"); - fp_glPopName = (pfn_glPopName)load("glPopName"); - fp_glPushName = (pfn_glPushName)load("glPushName"); - fp_glClearAccum = (pfn_glClearAccum)load("glClearAccum"); - fp_glClearIndex = (pfn_glClearIndex)load("glClearIndex"); - fp_glIndexMask = (pfn_glIndexMask)load("glIndexMask"); - fp_glAccum = (pfn_glAccum)load("glAccum"); - fp_glPopAttrib = (pfn_glPopAttrib)load("glPopAttrib"); - fp_glPushAttrib = (pfn_glPushAttrib)load("glPushAttrib"); - fp_glMap1d = (pfn_glMap1d)load("glMap1d"); - fp_glMap1f = (pfn_glMap1f)load("glMap1f"); - fp_glMap2d = (pfn_glMap2d)load("glMap2d"); - fp_glMap2f = (pfn_glMap2f)load("glMap2f"); - fp_glMapGrid1d = (pfn_glMapGrid1d)load("glMapGrid1d"); - fp_glMapGrid1f = (pfn_glMapGrid1f)load("glMapGrid1f"); - fp_glMapGrid2d = (pfn_glMapGrid2d)load("glMapGrid2d"); - fp_glMapGrid2f = (pfn_glMapGrid2f)load("glMapGrid2f"); - fp_glEvalCoord1d = (pfn_glEvalCoord1d)load("glEvalCoord1d"); - fp_glEvalCoord1dv = (pfn_glEvalCoord1dv)load("glEvalCoord1dv"); - fp_glEvalCoord1f = (pfn_glEvalCoord1f)load("glEvalCoord1f"); - fp_glEvalCoord1fv = (pfn_glEvalCoord1fv)load("glEvalCoord1fv"); - fp_glEvalCoord2d = (pfn_glEvalCoord2d)load("glEvalCoord2d"); - fp_glEvalCoord2dv = (pfn_glEvalCoord2dv)load("glEvalCoord2dv"); - fp_glEvalCoord2f = (pfn_glEvalCoord2f)load("glEvalCoord2f"); - fp_glEvalCoord2fv = (pfn_glEvalCoord2fv)load("glEvalCoord2fv"); - fp_glEvalMesh1 = (pfn_glEvalMesh1)load("glEvalMesh1"); - fp_glEvalPoint1 = (pfn_glEvalPoint1)load("glEvalPoint1"); - fp_glEvalMesh2 = (pfn_glEvalMesh2)load("glEvalMesh2"); - fp_glEvalPoint2 = (pfn_glEvalPoint2)load("glEvalPoint2"); - fp_glAlphaFunc = (pfn_glAlphaFunc)load("glAlphaFunc"); - fp_glPixelZoom = (pfn_glPixelZoom)load("glPixelZoom"); - fp_glPixelTransferf = (pfn_glPixelTransferf)load("glPixelTransferf"); - fp_glPixelTransferi = (pfn_glPixelTransferi)load("glPixelTransferi"); - fp_glPixelMapfv = (pfn_glPixelMapfv)load("glPixelMapfv"); - fp_glPixelMapuiv = (pfn_glPixelMapuiv)load("glPixelMapuiv"); - fp_glPixelMapusv = (pfn_glPixelMapusv)load("glPixelMapusv"); - fp_glCopyPixels = (pfn_glCopyPixels)load("glCopyPixels"); - fp_glDrawPixels = (pfn_glDrawPixels)load("glDrawPixels"); - fp_glGetClipPlane = (pfn_glGetClipPlane)load("glGetClipPlane"); - fp_glGetLightfv = (pfn_glGetLightfv)load("glGetLightfv"); - fp_glGetLightiv = (pfn_glGetLightiv)load("glGetLightiv"); - fp_glGetMapdv = (pfn_glGetMapdv)load("glGetMapdv"); - fp_glGetMapfv = (pfn_glGetMapfv)load("glGetMapfv"); - fp_glGetMapiv = (pfn_glGetMapiv)load("glGetMapiv"); - fp_glGetMaterialfv = (pfn_glGetMaterialfv)load("glGetMaterialfv"); - fp_glGetMaterialiv = (pfn_glGetMaterialiv)load("glGetMaterialiv"); - fp_glGetPixelMapfv = (pfn_glGetPixelMapfv)load("glGetPixelMapfv"); - fp_glGetPixelMapuiv = (pfn_glGetPixelMapuiv)load("glGetPixelMapuiv"); - fp_glGetPixelMapusv = (pfn_glGetPixelMapusv)load("glGetPixelMapusv"); - fp_glGetPolygonStipple = (pfn_glGetPolygonStipple)load("glGetPolygonStipple"); - fp_glGetTexEnvfv = (pfn_glGetTexEnvfv)load("glGetTexEnvfv"); - fp_glGetTexEnviv = (pfn_glGetTexEnviv)load("glGetTexEnviv"); - fp_glGetTexGendv = (pfn_glGetTexGendv)load("glGetTexGendv"); - fp_glGetTexGenfv = (pfn_glGetTexGenfv)load("glGetTexGenfv"); - fp_glGetTexGeniv = (pfn_glGetTexGeniv)load("glGetTexGeniv"); - fp_glIsList = (pfn_glIsList)load("glIsList"); - fp_glFrustum = (pfn_glFrustum)load("glFrustum"); - fp_glLoadIdentity = (pfn_glLoadIdentity)load("glLoadIdentity"); - fp_glLoadMatrixf = (pfn_glLoadMatrixf)load("glLoadMatrixf"); - fp_glLoadMatrixd = (pfn_glLoadMatrixd)load("glLoadMatrixd"); - fp_glMatrixMode = (pfn_glMatrixMode)load("glMatrixMode"); - fp_glMultMatrixf = (pfn_glMultMatrixf)load("glMultMatrixf"); - fp_glMultMatrixd = (pfn_glMultMatrixd)load("glMultMatrixd"); - fp_glOrtho = (pfn_glOrtho)load("glOrtho"); - fp_glPopMatrix = (pfn_glPopMatrix)load("glPopMatrix"); - fp_glPushMatrix = (pfn_glPushMatrix)load("glPushMatrix"); - fp_glRotated = (pfn_glRotated)load("glRotated"); - fp_glRotatef = (pfn_glRotatef)load("glRotatef"); - fp_glScaled = (pfn_glScaled)load("glScaled"); - fp_glScalef = (pfn_glScalef)load("glScalef"); - fp_glTranslated = (pfn_glTranslated)load("glTranslated"); - fp_glTranslatef = (pfn_glTranslatef)load("glTranslatef"); -} - -GLboolean GLAD_VERSION_1_1 = GL_FALSE; -static void load_GL_VERSION_1_1(LOADER load) { - if(!GLAD_VERSION_1_1) return; - fp_glDrawArrays = (pfn_glDrawArrays)load("glDrawArrays"); - fp_glDrawElements = (pfn_glDrawElements)load("glDrawElements"); - fp_glGetPointerv = (pfn_glGetPointerv)load("glGetPointerv"); - fp_glPolygonOffset = (pfn_glPolygonOffset)load("glPolygonOffset"); - fp_glCopyTexImage1D = (pfn_glCopyTexImage1D)load("glCopyTexImage1D"); - fp_glCopyTexImage2D = (pfn_glCopyTexImage2D)load("glCopyTexImage2D"); - fp_glCopyTexSubImage1D = (pfn_glCopyTexSubImage1D)load("glCopyTexSubImage1D"); - fp_glCopyTexSubImage2D = (pfn_glCopyTexSubImage2D)load("glCopyTexSubImage2D"); - fp_glTexSubImage1D = (pfn_glTexSubImage1D)load("glTexSubImage1D"); - fp_glTexSubImage2D = (pfn_glTexSubImage2D)load("glTexSubImage2D"); - fp_glBindTexture = (pfn_glBindTexture)load("glBindTexture"); - fp_glDeleteTextures = (pfn_glDeleteTextures)load("glDeleteTextures"); - fp_glGenTextures = (pfn_glGenTextures)load("glGenTextures"); - fp_glIsTexture = (pfn_glIsTexture)load("glIsTexture"); - fp_glArrayElement = (pfn_glArrayElement)load("glArrayElement"); - fp_glColorPointer = (pfn_glColorPointer)load("glColorPointer"); - fp_glDisableClientState = (pfn_glDisableClientState)load("glDisableClientState"); - fp_glEdgeFlagPointer = (pfn_glEdgeFlagPointer)load("glEdgeFlagPointer"); - fp_glEnableClientState = (pfn_glEnableClientState)load("glEnableClientState"); - fp_glIndexPointer = (pfn_glIndexPointer)load("glIndexPointer"); - fp_glInterleavedArrays = (pfn_glInterleavedArrays)load("glInterleavedArrays"); - fp_glNormalPointer = (pfn_glNormalPointer)load("glNormalPointer"); - fp_glTexCoordPointer = (pfn_glTexCoordPointer)load("glTexCoordPointer"); - fp_glVertexPointer = (pfn_glVertexPointer)load("glVertexPointer"); - fp_glAreTexturesResident = (pfn_glAreTexturesResident)load("glAreTexturesResident"); - fp_glPrioritizeTextures = (pfn_glPrioritizeTextures)load("glPrioritizeTextures"); - fp_glIndexub = (pfn_glIndexub)load("glIndexub"); - fp_glIndexubv = (pfn_glIndexubv)load("glIndexubv"); - fp_glPopClientAttrib = (pfn_glPopClientAttrib)load("glPopClientAttrib"); - fp_glPushClientAttrib = (pfn_glPushClientAttrib)load("glPushClientAttrib"); -} - -GLboolean GLAD_VERSION_1_2 = GL_FALSE; -static void load_GL_VERSION_1_2(LOADER load) { - if(!GLAD_VERSION_1_2) return; - fp_glDrawRangeElements = (pfn_glDrawRangeElements)load("glDrawRangeElements"); - fp_glTexImage3D = (pfn_glTexImage3D)load("glTexImage3D"); - fp_glTexSubImage3D = (pfn_glTexSubImage3D)load("glTexSubImage3D"); - fp_glCopyTexSubImage3D = (pfn_glCopyTexSubImage3D)load("glCopyTexSubImage3D"); -} - -GLboolean GLAD_VERSION_1_3 = GL_FALSE; -static void load_GL_VERSION_1_3(LOADER load) { - if(!GLAD_VERSION_1_3) return; - fp_glActiveTexture = (pfn_glActiveTexture)load("glActiveTexture"); - fp_glSampleCoverage = (pfn_glSampleCoverage)load("glSampleCoverage"); - fp_glCompressedTexImage3D = (pfn_glCompressedTexImage3D)load("glCompressedTexImage3D"); - fp_glCompressedTexImage2D = (pfn_glCompressedTexImage2D)load("glCompressedTexImage2D"); - fp_glCompressedTexImage1D = (pfn_glCompressedTexImage1D)load("glCompressedTexImage1D"); - fp_glCompressedTexSubImage3D = (pfn_glCompressedTexSubImage3D)load("glCompressedTexSubImage3D"); - fp_glCompressedTexSubImage2D = (pfn_glCompressedTexSubImage2D)load("glCompressedTexSubImage2D"); - fp_glCompressedTexSubImage1D = (pfn_glCompressedTexSubImage1D)load("glCompressedTexSubImage1D"); - fp_glGetCompressedTexImage = (pfn_glGetCompressedTexImage)load("glGetCompressedTexImage"); - fp_glClientActiveTexture = (pfn_glClientActiveTexture)load("glClientActiveTexture"); - fp_glMultiTexCoord1d = (pfn_glMultiTexCoord1d)load("glMultiTexCoord1d"); - fp_glMultiTexCoord1dv = (pfn_glMultiTexCoord1dv)load("glMultiTexCoord1dv"); - fp_glMultiTexCoord1f = (pfn_glMultiTexCoord1f)load("glMultiTexCoord1f"); - fp_glMultiTexCoord1fv = (pfn_glMultiTexCoord1fv)load("glMultiTexCoord1fv"); - fp_glMultiTexCoord1i = (pfn_glMultiTexCoord1i)load("glMultiTexCoord1i"); - fp_glMultiTexCoord1iv = (pfn_glMultiTexCoord1iv)load("glMultiTexCoord1iv"); - fp_glMultiTexCoord1s = (pfn_glMultiTexCoord1s)load("glMultiTexCoord1s"); - fp_glMultiTexCoord1sv = (pfn_glMultiTexCoord1sv)load("glMultiTexCoord1sv"); - fp_glMultiTexCoord2d = (pfn_glMultiTexCoord2d)load("glMultiTexCoord2d"); - fp_glMultiTexCoord2dv = (pfn_glMultiTexCoord2dv)load("glMultiTexCoord2dv"); - fp_glMultiTexCoord2f = (pfn_glMultiTexCoord2f)load("glMultiTexCoord2f"); - fp_glMultiTexCoord2fv = (pfn_glMultiTexCoord2fv)load("glMultiTexCoord2fv"); - fp_glMultiTexCoord2i = (pfn_glMultiTexCoord2i)load("glMultiTexCoord2i"); - fp_glMultiTexCoord2iv = (pfn_glMultiTexCoord2iv)load("glMultiTexCoord2iv"); - fp_glMultiTexCoord2s = (pfn_glMultiTexCoord2s)load("glMultiTexCoord2s"); - fp_glMultiTexCoord2sv = (pfn_glMultiTexCoord2sv)load("glMultiTexCoord2sv"); - fp_glMultiTexCoord3d = (pfn_glMultiTexCoord3d)load("glMultiTexCoord3d"); - fp_glMultiTexCoord3dv = (pfn_glMultiTexCoord3dv)load("glMultiTexCoord3dv"); - fp_glMultiTexCoord3f = (pfn_glMultiTexCoord3f)load("glMultiTexCoord3f"); - fp_glMultiTexCoord3fv = (pfn_glMultiTexCoord3fv)load("glMultiTexCoord3fv"); - fp_glMultiTexCoord3i = (pfn_glMultiTexCoord3i)load("glMultiTexCoord3i"); - fp_glMultiTexCoord3iv = (pfn_glMultiTexCoord3iv)load("glMultiTexCoord3iv"); - fp_glMultiTexCoord3s = (pfn_glMultiTexCoord3s)load("glMultiTexCoord3s"); - fp_glMultiTexCoord3sv = (pfn_glMultiTexCoord3sv)load("glMultiTexCoord3sv"); - fp_glMultiTexCoord4d = (pfn_glMultiTexCoord4d)load("glMultiTexCoord4d"); - fp_glMultiTexCoord4dv = (pfn_glMultiTexCoord4dv)load("glMultiTexCoord4dv"); - fp_glMultiTexCoord4f = (pfn_glMultiTexCoord4f)load("glMultiTexCoord4f"); - fp_glMultiTexCoord4fv = (pfn_glMultiTexCoord4fv)load("glMultiTexCoord4fv"); - fp_glMultiTexCoord4i = (pfn_glMultiTexCoord4i)load("glMultiTexCoord4i"); - fp_glMultiTexCoord4iv = (pfn_glMultiTexCoord4iv)load("glMultiTexCoord4iv"); - fp_glMultiTexCoord4s = (pfn_glMultiTexCoord4s)load("glMultiTexCoord4s"); - fp_glMultiTexCoord4sv = (pfn_glMultiTexCoord4sv)load("glMultiTexCoord4sv"); - fp_glLoadTransposeMatrixf = (pfn_glLoadTransposeMatrixf)load("glLoadTransposeMatrixf"); - fp_glLoadTransposeMatrixd = (pfn_glLoadTransposeMatrixd)load("glLoadTransposeMatrixd"); - fp_glMultTransposeMatrixf = (pfn_glMultTransposeMatrixf)load("glMultTransposeMatrixf"); - fp_glMultTransposeMatrixd = (pfn_glMultTransposeMatrixd)load("glMultTransposeMatrixd"); -} - -GLboolean GLAD_VERSION_1_4 = GL_FALSE; -static void load_GL_VERSION_1_4(LOADER load) { - if(!GLAD_VERSION_1_4) return; - fp_glBlendFuncSeparate = (pfn_glBlendFuncSeparate)load("glBlendFuncSeparate"); - fp_glMultiDrawArrays = (pfn_glMultiDrawArrays)load("glMultiDrawArrays"); - fp_glMultiDrawElements = (pfn_glMultiDrawElements)load("glMultiDrawElements"); - fp_glPointParameterf = (pfn_glPointParameterf)load("glPointParameterf"); - fp_glPointParameterfv = (pfn_glPointParameterfv)load("glPointParameterfv"); - fp_glPointParameteri = (pfn_glPointParameteri)load("glPointParameteri"); - fp_glPointParameteriv = (pfn_glPointParameteriv)load("glPointParameteriv"); - fp_glFogCoordf = (pfn_glFogCoordf)load("glFogCoordf"); - fp_glFogCoordfv = (pfn_glFogCoordfv)load("glFogCoordfv"); - fp_glFogCoordd = (pfn_glFogCoordd)load("glFogCoordd"); - fp_glFogCoorddv = (pfn_glFogCoorddv)load("glFogCoorddv"); - fp_glFogCoordPointer = (pfn_glFogCoordPointer)load("glFogCoordPointer"); - fp_glSecondaryColor3b = (pfn_glSecondaryColor3b)load("glSecondaryColor3b"); - fp_glSecondaryColor3bv = (pfn_glSecondaryColor3bv)load("glSecondaryColor3bv"); - fp_glSecondaryColor3d = (pfn_glSecondaryColor3d)load("glSecondaryColor3d"); - fp_glSecondaryColor3dv = (pfn_glSecondaryColor3dv)load("glSecondaryColor3dv"); - fp_glSecondaryColor3f = (pfn_glSecondaryColor3f)load("glSecondaryColor3f"); - fp_glSecondaryColor3fv = (pfn_glSecondaryColor3fv)load("glSecondaryColor3fv"); - fp_glSecondaryColor3i = (pfn_glSecondaryColor3i)load("glSecondaryColor3i"); - fp_glSecondaryColor3iv = (pfn_glSecondaryColor3iv)load("glSecondaryColor3iv"); - fp_glSecondaryColor3s = (pfn_glSecondaryColor3s)load("glSecondaryColor3s"); - fp_glSecondaryColor3sv = (pfn_glSecondaryColor3sv)load("glSecondaryColor3sv"); - fp_glSecondaryColor3ub = (pfn_glSecondaryColor3ub)load("glSecondaryColor3ub"); - fp_glSecondaryColor3ubv = (pfn_glSecondaryColor3ubv)load("glSecondaryColor3ubv"); - fp_glSecondaryColor3ui = (pfn_glSecondaryColor3ui)load("glSecondaryColor3ui"); - fp_glSecondaryColor3uiv = (pfn_glSecondaryColor3uiv)load("glSecondaryColor3uiv"); - fp_glSecondaryColor3us = (pfn_glSecondaryColor3us)load("glSecondaryColor3us"); - fp_glSecondaryColor3usv = (pfn_glSecondaryColor3usv)load("glSecondaryColor3usv"); - fp_glSecondaryColorPointer = (pfn_glSecondaryColorPointer)load("glSecondaryColorPointer"); - fp_glWindowPos2d = (pfn_glWindowPos2d)load("glWindowPos2d"); - fp_glWindowPos2dv = (pfn_glWindowPos2dv)load("glWindowPos2dv"); - fp_glWindowPos2f = (pfn_glWindowPos2f)load("glWindowPos2f"); - fp_glWindowPos2fv = (pfn_glWindowPos2fv)load("glWindowPos2fv"); - fp_glWindowPos2i = (pfn_glWindowPos2i)load("glWindowPos2i"); - fp_glWindowPos2iv = (pfn_glWindowPos2iv)load("glWindowPos2iv"); - fp_glWindowPos2s = (pfn_glWindowPos2s)load("glWindowPos2s"); - fp_glWindowPos2sv = (pfn_glWindowPos2sv)load("glWindowPos2sv"); - fp_glWindowPos3d = (pfn_glWindowPos3d)load("glWindowPos3d"); - fp_glWindowPos3dv = (pfn_glWindowPos3dv)load("glWindowPos3dv"); - fp_glWindowPos3f = (pfn_glWindowPos3f)load("glWindowPos3f"); - fp_glWindowPos3fv = (pfn_glWindowPos3fv)load("glWindowPos3fv"); - fp_glWindowPos3i = (pfn_glWindowPos3i)load("glWindowPos3i"); - fp_glWindowPos3iv = (pfn_glWindowPos3iv)load("glWindowPos3iv"); - fp_glWindowPos3s = (pfn_glWindowPos3s)load("glWindowPos3s"); - fp_glWindowPos3sv = (pfn_glWindowPos3sv)load("glWindowPos3sv"); - fp_glBlendColor = (pfn_glBlendColor)load("glBlendColor"); - fp_glBlendEquation = (pfn_glBlendEquation)load("glBlendEquation"); -} - -GLboolean GLAD_VERSION_1_5 = GL_FALSE; -static void load_GL_VERSION_1_5(LOADER load) { - if(!GLAD_VERSION_1_5) return; - fp_glGenQueries = (pfn_glGenQueries)load("glGenQueries"); - fp_glDeleteQueries = (pfn_glDeleteQueries)load("glDeleteQueries"); - fp_glIsQuery = (pfn_glIsQuery)load("glIsQuery"); - fp_glBeginQuery = (pfn_glBeginQuery)load("glBeginQuery"); - fp_glEndQuery = (pfn_glEndQuery)load("glEndQuery"); - fp_glGetQueryiv = (pfn_glGetQueryiv)load("glGetQueryiv"); - fp_glGetQueryObjectiv = (pfn_glGetQueryObjectiv)load("glGetQueryObjectiv"); - fp_glGetQueryObjectuiv = (pfn_glGetQueryObjectuiv)load("glGetQueryObjectuiv"); - fp_glBindBuffer = (pfn_glBindBuffer)load("glBindBuffer"); - fp_glDeleteBuffers = (pfn_glDeleteBuffers)load("glDeleteBuffers"); - fp_glGenBuffers = (pfn_glGenBuffers)load("glGenBuffers"); - fp_glIsBuffer = (pfn_glIsBuffer)load("glIsBuffer"); - fp_glBufferData = (pfn_glBufferData)load("glBufferData"); - fp_glBufferSubData = (pfn_glBufferSubData)load("glBufferSubData"); - fp_glGetBufferSubData = (pfn_glGetBufferSubData)load("glGetBufferSubData"); - fp_glMapBuffer = (pfn_glMapBuffer)load("glMapBuffer"); - fp_glUnmapBuffer = (pfn_glUnmapBuffer)load("glUnmapBuffer"); - fp_glGetBufferParameteriv = (pfn_glGetBufferParameteriv)load("glGetBufferParameteriv"); - fp_glGetBufferPointerv = (pfn_glGetBufferPointerv)load("glGetBufferPointerv"); -} - -GLboolean GLAD_VERSION_2_0 = GL_FALSE; -static void load_GL_VERSION_2_0(LOADER load) { - if(!GLAD_VERSION_2_0) return; - fp_glBlendEquationSeparate = (pfn_glBlendEquationSeparate)load("glBlendEquationSeparate"); - fp_glDrawBuffers = (pfn_glDrawBuffers)load("glDrawBuffers"); - fp_glStencilOpSeparate = (pfn_glStencilOpSeparate)load("glStencilOpSeparate"); - fp_glStencilFuncSeparate = (pfn_glStencilFuncSeparate)load("glStencilFuncSeparate"); - fp_glStencilMaskSeparate = (pfn_glStencilMaskSeparate)load("glStencilMaskSeparate"); - fp_glAttachShader = (pfn_glAttachShader)load("glAttachShader"); - fp_glBindAttribLocation = (pfn_glBindAttribLocation)load("glBindAttribLocation"); - fp_glCompileShader = (pfn_glCompileShader)load("glCompileShader"); - fp_glCreateProgram = (pfn_glCreateProgram)load("glCreateProgram"); - fp_glCreateShader = (pfn_glCreateShader)load("glCreateShader"); - fp_glDeleteProgram = (pfn_glDeleteProgram)load("glDeleteProgram"); - fp_glDeleteShader = (pfn_glDeleteShader)load("glDeleteShader"); - fp_glDetachShader = (pfn_glDetachShader)load("glDetachShader"); - fp_glDisableVertexAttribArray = (pfn_glDisableVertexAttribArray)load("glDisableVertexAttribArray"); - fp_glEnableVertexAttribArray = (pfn_glEnableVertexAttribArray)load("glEnableVertexAttribArray"); - fp_glGetActiveAttrib = (pfn_glGetActiveAttrib)load("glGetActiveAttrib"); - fp_glGetActiveUniform = (pfn_glGetActiveUniform)load("glGetActiveUniform"); - fp_glGetAttachedShaders = (pfn_glGetAttachedShaders)load("glGetAttachedShaders"); - fp_glGetAttribLocation = (pfn_glGetAttribLocation)load("glGetAttribLocation"); - fp_glGetProgramiv = (pfn_glGetProgramiv)load("glGetProgramiv"); - fp_glGetProgramInfoLog = (pfn_glGetProgramInfoLog)load("glGetProgramInfoLog"); - fp_glGetShaderiv = (pfn_glGetShaderiv)load("glGetShaderiv"); - fp_glGetShaderInfoLog = (pfn_glGetShaderInfoLog)load("glGetShaderInfoLog"); - fp_glGetShaderSource = (pfn_glGetShaderSource)load("glGetShaderSource"); - fp_glGetUniformLocation = (pfn_glGetUniformLocation)load("glGetUniformLocation"); - fp_glGetUniformfv = (pfn_glGetUniformfv)load("glGetUniformfv"); - fp_glGetUniformiv = (pfn_glGetUniformiv)load("glGetUniformiv"); - fp_glGetVertexAttribdv = (pfn_glGetVertexAttribdv)load("glGetVertexAttribdv"); - fp_glGetVertexAttribfv = (pfn_glGetVertexAttribfv)load("glGetVertexAttribfv"); - fp_glGetVertexAttribiv = (pfn_glGetVertexAttribiv)load("glGetVertexAttribiv"); - fp_glGetVertexAttribPointerv = (pfn_glGetVertexAttribPointerv)load("glGetVertexAttribPointerv"); - fp_glIsProgram = (pfn_glIsProgram)load("glIsProgram"); - fp_glIsShader = (pfn_glIsShader)load("glIsShader"); - fp_glLinkProgram = (pfn_glLinkProgram)load("glLinkProgram"); - fp_glShaderSource = (pfn_glShaderSource)load("glShaderSource"); - fp_glUseProgram = (pfn_glUseProgram)load("glUseProgram"); - fp_glUniform1f = (pfn_glUniform1f)load("glUniform1f"); - fp_glUniform2f = (pfn_glUniform2f)load("glUniform2f"); - fp_glUniform3f = (pfn_glUniform3f)load("glUniform3f"); - fp_glUniform4f = (pfn_glUniform4f)load("glUniform4f"); - fp_glUniform1i = (pfn_glUniform1i)load("glUniform1i"); - fp_glUniform2i = (pfn_glUniform2i)load("glUniform2i"); - fp_glUniform3i = (pfn_glUniform3i)load("glUniform3i"); - fp_glUniform4i = (pfn_glUniform4i)load("glUniform4i"); - fp_glUniform1fv = (pfn_glUniform1fv)load("glUniform1fv"); - fp_glUniform2fv = (pfn_glUniform2fv)load("glUniform2fv"); - fp_glUniform3fv = (pfn_glUniform3fv)load("glUniform3fv"); - fp_glUniform4fv = (pfn_glUniform4fv)load("glUniform4fv"); - fp_glUniform1iv = (pfn_glUniform1iv)load("glUniform1iv"); - fp_glUniform2iv = (pfn_glUniform2iv)load("glUniform2iv"); - fp_glUniform3iv = (pfn_glUniform3iv)load("glUniform3iv"); - fp_glUniform4iv = (pfn_glUniform4iv)load("glUniform4iv"); - fp_glUniformMatrix2fv = (pfn_glUniformMatrix2fv)load("glUniformMatrix2fv"); - fp_glUniformMatrix3fv = (pfn_glUniformMatrix3fv)load("glUniformMatrix3fv"); - fp_glUniformMatrix4fv = (pfn_glUniformMatrix4fv)load("glUniformMatrix4fv"); - fp_glValidateProgram = (pfn_glValidateProgram)load("glValidateProgram"); - fp_glVertexAttrib1d = (pfn_glVertexAttrib1d)load("glVertexAttrib1d"); - fp_glVertexAttrib1dv = (pfn_glVertexAttrib1dv)load("glVertexAttrib1dv"); - fp_glVertexAttrib1f = (pfn_glVertexAttrib1f)load("glVertexAttrib1f"); - fp_glVertexAttrib1fv = (pfn_glVertexAttrib1fv)load("glVertexAttrib1fv"); - fp_glVertexAttrib1s = (pfn_glVertexAttrib1s)load("glVertexAttrib1s"); - fp_glVertexAttrib1sv = (pfn_glVertexAttrib1sv)load("glVertexAttrib1sv"); - fp_glVertexAttrib2d = (pfn_glVertexAttrib2d)load("glVertexAttrib2d"); - fp_glVertexAttrib2dv = (pfn_glVertexAttrib2dv)load("glVertexAttrib2dv"); - fp_glVertexAttrib2f = (pfn_glVertexAttrib2f)load("glVertexAttrib2f"); - fp_glVertexAttrib2fv = (pfn_glVertexAttrib2fv)load("glVertexAttrib2fv"); - fp_glVertexAttrib2s = (pfn_glVertexAttrib2s)load("glVertexAttrib2s"); - fp_glVertexAttrib2sv = (pfn_glVertexAttrib2sv)load("glVertexAttrib2sv"); - fp_glVertexAttrib3d = (pfn_glVertexAttrib3d)load("glVertexAttrib3d"); - fp_glVertexAttrib3dv = (pfn_glVertexAttrib3dv)load("glVertexAttrib3dv"); - fp_glVertexAttrib3f = (pfn_glVertexAttrib3f)load("glVertexAttrib3f"); - fp_glVertexAttrib3fv = (pfn_glVertexAttrib3fv)load("glVertexAttrib3fv"); - fp_glVertexAttrib3s = (pfn_glVertexAttrib3s)load("glVertexAttrib3s"); - fp_glVertexAttrib3sv = (pfn_glVertexAttrib3sv)load("glVertexAttrib3sv"); - fp_glVertexAttrib4Nbv = (pfn_glVertexAttrib4Nbv)load("glVertexAttrib4Nbv"); - fp_glVertexAttrib4Niv = (pfn_glVertexAttrib4Niv)load("glVertexAttrib4Niv"); - fp_glVertexAttrib4Nsv = (pfn_glVertexAttrib4Nsv)load("glVertexAttrib4Nsv"); - fp_glVertexAttrib4Nub = (pfn_glVertexAttrib4Nub)load("glVertexAttrib4Nub"); - fp_glVertexAttrib4Nubv = (pfn_glVertexAttrib4Nubv)load("glVertexAttrib4Nubv"); - fp_glVertexAttrib4Nuiv = (pfn_glVertexAttrib4Nuiv)load("glVertexAttrib4Nuiv"); - fp_glVertexAttrib4Nusv = (pfn_glVertexAttrib4Nusv)load("glVertexAttrib4Nusv"); - fp_glVertexAttrib4bv = (pfn_glVertexAttrib4bv)load("glVertexAttrib4bv"); - fp_glVertexAttrib4d = (pfn_glVertexAttrib4d)load("glVertexAttrib4d"); - fp_glVertexAttrib4dv = (pfn_glVertexAttrib4dv)load("glVertexAttrib4dv"); - fp_glVertexAttrib4f = (pfn_glVertexAttrib4f)load("glVertexAttrib4f"); - fp_glVertexAttrib4fv = (pfn_glVertexAttrib4fv)load("glVertexAttrib4fv"); - fp_glVertexAttrib4iv = (pfn_glVertexAttrib4iv)load("glVertexAttrib4iv"); - fp_glVertexAttrib4s = (pfn_glVertexAttrib4s)load("glVertexAttrib4s"); - fp_glVertexAttrib4sv = (pfn_glVertexAttrib4sv)load("glVertexAttrib4sv"); - fp_glVertexAttrib4ubv = (pfn_glVertexAttrib4ubv)load("glVertexAttrib4ubv"); - fp_glVertexAttrib4uiv = (pfn_glVertexAttrib4uiv)load("glVertexAttrib4uiv"); - fp_glVertexAttrib4usv = (pfn_glVertexAttrib4usv)load("glVertexAttrib4usv"); - fp_glVertexAttribPointer = (pfn_glVertexAttribPointer)load("glVertexAttribPointer"); -} - -GLboolean GLAD_VERSION_2_1 = GL_FALSE; -static void load_GL_VERSION_2_1(LOADER load) { - if(!GLAD_VERSION_2_1) return; - fp_glUniformMatrix2x3fv = (pfn_glUniformMatrix2x3fv)load("glUniformMatrix2x3fv"); - fp_glUniformMatrix3x2fv = (pfn_glUniformMatrix3x2fv)load("glUniformMatrix3x2fv"); - fp_glUniformMatrix2x4fv = (pfn_glUniformMatrix2x4fv)load("glUniformMatrix2x4fv"); - fp_glUniformMatrix4x2fv = (pfn_glUniformMatrix4x2fv)load("glUniformMatrix4x2fv"); - fp_glUniformMatrix3x4fv = (pfn_glUniformMatrix3x4fv)load("glUniformMatrix3x4fv"); - fp_glUniformMatrix4x3fv = (pfn_glUniformMatrix4x3fv)load("glUniformMatrix4x3fv"); -} - -GLboolean GLAD_VERSION_3_0 = GL_FALSE; -static void load_GL_VERSION_3_0(LOADER load) { - if(!GLAD_VERSION_3_0) return; - fp_glColorMaski = (pfn_glColorMaski)load("glColorMaski"); - fp_glGetBooleani_v = (pfn_glGetBooleani_v)load("glGetBooleani_v"); - fp_glGetIntegeri_v = (pfn_glGetIntegeri_v)load("glGetIntegeri_v"); - fp_glEnablei = (pfn_glEnablei)load("glEnablei"); - fp_glDisablei = (pfn_glDisablei)load("glDisablei"); - fp_glIsEnabledi = (pfn_glIsEnabledi)load("glIsEnabledi"); - fp_glBeginTransformFeedback = (pfn_glBeginTransformFeedback)load("glBeginTransformFeedback"); - fp_glEndTransformFeedback = (pfn_glEndTransformFeedback)load("glEndTransformFeedback"); - fp_glBindBufferRange = (pfn_glBindBufferRange)load("glBindBufferRange"); - fp_glBindBufferBase = (pfn_glBindBufferBase)load("glBindBufferBase"); - fp_glTransformFeedbackVaryings = (pfn_glTransformFeedbackVaryings)load("glTransformFeedbackVaryings"); - fp_glGetTransformFeedbackVarying = (pfn_glGetTransformFeedbackVarying)load("glGetTransformFeedbackVarying"); - fp_glClampColor = (pfn_glClampColor)load("glClampColor"); - fp_glBeginConditionalRender = (pfn_glBeginConditionalRender)load("glBeginConditionalRender"); - fp_glEndConditionalRender = (pfn_glEndConditionalRender)load("glEndConditionalRender"); - fp_glVertexAttribIPointer = (pfn_glVertexAttribIPointer)load("glVertexAttribIPointer"); - fp_glGetVertexAttribIiv = (pfn_glGetVertexAttribIiv)load("glGetVertexAttribIiv"); - fp_glGetVertexAttribIuiv = (pfn_glGetVertexAttribIuiv)load("glGetVertexAttribIuiv"); - fp_glVertexAttribI1i = (pfn_glVertexAttribI1i)load("glVertexAttribI1i"); - fp_glVertexAttribI2i = (pfn_glVertexAttribI2i)load("glVertexAttribI2i"); - fp_glVertexAttribI3i = (pfn_glVertexAttribI3i)load("glVertexAttribI3i"); - fp_glVertexAttribI4i = (pfn_glVertexAttribI4i)load("glVertexAttribI4i"); - fp_glVertexAttribI1ui = (pfn_glVertexAttribI1ui)load("glVertexAttribI1ui"); - fp_glVertexAttribI2ui = (pfn_glVertexAttribI2ui)load("glVertexAttribI2ui"); - fp_glVertexAttribI3ui = (pfn_glVertexAttribI3ui)load("glVertexAttribI3ui"); - fp_glVertexAttribI4ui = (pfn_glVertexAttribI4ui)load("glVertexAttribI4ui"); - fp_glVertexAttribI1iv = (pfn_glVertexAttribI1iv)load("glVertexAttribI1iv"); - fp_glVertexAttribI2iv = (pfn_glVertexAttribI2iv)load("glVertexAttribI2iv"); - fp_glVertexAttribI3iv = (pfn_glVertexAttribI3iv)load("glVertexAttribI3iv"); - fp_glVertexAttribI4iv = (pfn_glVertexAttribI4iv)load("glVertexAttribI4iv"); - fp_glVertexAttribI1uiv = (pfn_glVertexAttribI1uiv)load("glVertexAttribI1uiv"); - fp_glVertexAttribI2uiv = (pfn_glVertexAttribI2uiv)load("glVertexAttribI2uiv"); - fp_glVertexAttribI3uiv = (pfn_glVertexAttribI3uiv)load("glVertexAttribI3uiv"); - fp_glVertexAttribI4uiv = (pfn_glVertexAttribI4uiv)load("glVertexAttribI4uiv"); - fp_glVertexAttribI4bv = (pfn_glVertexAttribI4bv)load("glVertexAttribI4bv"); - fp_glVertexAttribI4sv = (pfn_glVertexAttribI4sv)load("glVertexAttribI4sv"); - fp_glVertexAttribI4ubv = (pfn_glVertexAttribI4ubv)load("glVertexAttribI4ubv"); - fp_glVertexAttribI4usv = (pfn_glVertexAttribI4usv)load("glVertexAttribI4usv"); - fp_glGetUniformuiv = (pfn_glGetUniformuiv)load("glGetUniformuiv"); - fp_glBindFragDataLocation = (pfn_glBindFragDataLocation)load("glBindFragDataLocation"); - fp_glGetFragDataLocation = (pfn_glGetFragDataLocation)load("glGetFragDataLocation"); - fp_glUniform1ui = (pfn_glUniform1ui)load("glUniform1ui"); - fp_glUniform2ui = (pfn_glUniform2ui)load("glUniform2ui"); - fp_glUniform3ui = (pfn_glUniform3ui)load("glUniform3ui"); - fp_glUniform4ui = (pfn_glUniform4ui)load("glUniform4ui"); - fp_glUniform1uiv = (pfn_glUniform1uiv)load("glUniform1uiv"); - fp_glUniform2uiv = (pfn_glUniform2uiv)load("glUniform2uiv"); - fp_glUniform3uiv = (pfn_glUniform3uiv)load("glUniform3uiv"); - fp_glUniform4uiv = (pfn_glUniform4uiv)load("glUniform4uiv"); - fp_glTexParameterIiv = (pfn_glTexParameterIiv)load("glTexParameterIiv"); - fp_glTexParameterIuiv = (pfn_glTexParameterIuiv)load("glTexParameterIuiv"); - fp_glGetTexParameterIiv = (pfn_glGetTexParameterIiv)load("glGetTexParameterIiv"); - fp_glGetTexParameterIuiv = (pfn_glGetTexParameterIuiv)load("glGetTexParameterIuiv"); - fp_glClearBufferiv = (pfn_glClearBufferiv)load("glClearBufferiv"); - fp_glClearBufferuiv = (pfn_glClearBufferuiv)load("glClearBufferuiv"); - fp_glClearBufferfv = (pfn_glClearBufferfv)load("glClearBufferfv"); - fp_glClearBufferfi = (pfn_glClearBufferfi)load("glClearBufferfi"); - fp_glGetStringi = (pfn_glGetStringi)load("glGetStringi"); - fp_glIsRenderbuffer = (pfn_glIsRenderbuffer)load("glIsRenderbuffer"); - fp_glBindRenderbuffer = (pfn_glBindRenderbuffer)load("glBindRenderbuffer"); - fp_glDeleteRenderbuffers = (pfn_glDeleteRenderbuffers)load("glDeleteRenderbuffers"); - fp_glGenRenderbuffers = (pfn_glGenRenderbuffers)load("glGenRenderbuffers"); - fp_glRenderbufferStorage = (pfn_glRenderbufferStorage)load("glRenderbufferStorage"); - fp_glGetRenderbufferParameteriv = (pfn_glGetRenderbufferParameteriv)load("glGetRenderbufferParameteriv"); - fp_glIsFramebuffer = (pfn_glIsFramebuffer)load("glIsFramebuffer"); - fp_glBindFramebuffer = (pfn_glBindFramebuffer)load("glBindFramebuffer"); - fp_glDeleteFramebuffers = (pfn_glDeleteFramebuffers)load("glDeleteFramebuffers"); - fp_glGenFramebuffers = (pfn_glGenFramebuffers)load("glGenFramebuffers"); - fp_glCheckFramebufferStatus = (pfn_glCheckFramebufferStatus)load("glCheckFramebufferStatus"); - fp_glFramebufferTexture1D = (pfn_glFramebufferTexture1D)load("glFramebufferTexture1D"); - fp_glFramebufferTexture2D = (pfn_glFramebufferTexture2D)load("glFramebufferTexture2D"); - fp_glFramebufferTexture3D = (pfn_glFramebufferTexture3D)load("glFramebufferTexture3D"); - fp_glFramebufferRenderbuffer = (pfn_glFramebufferRenderbuffer)load("glFramebufferRenderbuffer"); - fp_glGetFramebufferAttachmentParameteriv = (pfn_glGetFramebufferAttachmentParameteriv)load("glGetFramebufferAttachmentParameteriv"); - fp_glGenerateMipmap = (pfn_glGenerateMipmap)load("glGenerateMipmap"); - fp_glBlitFramebuffer = (pfn_glBlitFramebuffer)load("glBlitFramebuffer"); - fp_glRenderbufferStorageMultisample = (pfn_glRenderbufferStorageMultisample)load("glRenderbufferStorageMultisample"); - fp_glFramebufferTextureLayer = (pfn_glFramebufferTextureLayer)load("glFramebufferTextureLayer"); - fp_glMapBufferRange = (pfn_glMapBufferRange)load("glMapBufferRange"); - fp_glFlushMappedBufferRange = (pfn_glFlushMappedBufferRange)load("glFlushMappedBufferRange"); - fp_glBindVertexArray = (pfn_glBindVertexArray)load("glBindVertexArray"); - fp_glDeleteVertexArrays = (pfn_glDeleteVertexArrays)load("glDeleteVertexArrays"); - fp_glGenVertexArrays = (pfn_glGenVertexArrays)load("glGenVertexArrays"); - fp_glIsVertexArray = (pfn_glIsVertexArray)load("glIsVertexArray"); -} - -GLboolean GLAD_VERSION_3_1 = GL_FALSE; -static void load_GL_VERSION_3_1(LOADER load) { - if(!GLAD_VERSION_3_1) return; - fp_glDrawArraysInstanced = (pfn_glDrawArraysInstanced)load("glDrawArraysInstanced"); - fp_glDrawElementsInstanced = (pfn_glDrawElementsInstanced)load("glDrawElementsInstanced"); - fp_glTexBuffer = (pfn_glTexBuffer)load("glTexBuffer"); - fp_glPrimitiveRestartIndex = (pfn_glPrimitiveRestartIndex)load("glPrimitiveRestartIndex"); - fp_glCopyBufferSubData = (pfn_glCopyBufferSubData)load("glCopyBufferSubData"); - fp_glGetUniformIndices = (pfn_glGetUniformIndices)load("glGetUniformIndices"); - fp_glGetActiveUniformsiv = (pfn_glGetActiveUniformsiv)load("glGetActiveUniformsiv"); - fp_glGetActiveUniformName = (pfn_glGetActiveUniformName)load("glGetActiveUniformName"); - fp_glGetUniformBlockIndex = (pfn_glGetUniformBlockIndex)load("glGetUniformBlockIndex"); - fp_glGetActiveUniformBlockiv = (pfn_glGetActiveUniformBlockiv)load("glGetActiveUniformBlockiv"); - fp_glGetActiveUniformBlockName = (pfn_glGetActiveUniformBlockName)load("glGetActiveUniformBlockName"); - fp_glUniformBlockBinding = (pfn_glUniformBlockBinding)load("glUniformBlockBinding"); - fp_glBindBufferRange = (pfn_glBindBufferRange)load("glBindBufferRange"); - fp_glBindBufferBase = (pfn_glBindBufferBase)load("glBindBufferBase"); - fp_glGetIntegeri_v = (pfn_glGetIntegeri_v)load("glGetIntegeri_v"); -} - -GLboolean GLAD_VERSION_3_2 = GL_FALSE; -static void load_GL_VERSION_3_2(LOADER load) { - if(!GLAD_VERSION_3_2) return; - fp_glDrawElementsBaseVertex = (pfn_glDrawElementsBaseVertex)load("glDrawElementsBaseVertex"); - fp_glDrawRangeElementsBaseVertex = (pfn_glDrawRangeElementsBaseVertex)load("glDrawRangeElementsBaseVertex"); - fp_glDrawElementsInstancedBaseVertex = (pfn_glDrawElementsInstancedBaseVertex)load("glDrawElementsInstancedBaseVertex"); - fp_glMultiDrawElementsBaseVertex = (pfn_glMultiDrawElementsBaseVertex)load("glMultiDrawElementsBaseVertex"); - fp_glProvokingVertex = (pfn_glProvokingVertex)load("glProvokingVertex"); - fp_glFenceSync = (pfn_glFenceSync)load("glFenceSync"); - fp_glIsSync = (pfn_glIsSync)load("glIsSync"); - fp_glDeleteSync = (pfn_glDeleteSync)load("glDeleteSync"); - fp_glClientWaitSync = (pfn_glClientWaitSync)load("glClientWaitSync"); - fp_glWaitSync = (pfn_glWaitSync)load("glWaitSync"); - fp_glGetInteger64v = (pfn_glGetInteger64v)load("glGetInteger64v"); - fp_glGetSynciv = (pfn_glGetSynciv)load("glGetSynciv"); - fp_glGetInteger64i_v = (pfn_glGetInteger64i_v)load("glGetInteger64i_v"); - fp_glGetBufferParameteri64v = (pfn_glGetBufferParameteri64v)load("glGetBufferParameteri64v"); - fp_glFramebufferTexture = (pfn_glFramebufferTexture)load("glFramebufferTexture"); - fp_glTexImage2DMultisample = (pfn_glTexImage2DMultisample)load("glTexImage2DMultisample"); - fp_glTexImage3DMultisample = (pfn_glTexImage3DMultisample)load("glTexImage3DMultisample"); - fp_glGetMultisamplefv = (pfn_glGetMultisamplefv)load("glGetMultisamplefv"); - fp_glSampleMaski = (pfn_glSampleMaski)load("glSampleMaski"); -} - -GLboolean GLAD_VERSION_3_3 = GL_FALSE; -static void load_GL_VERSION_3_3(LOADER load) { - if(!GLAD_VERSION_3_3) return; - fp_glBindFragDataLocationIndexed = (pfn_glBindFragDataLocationIndexed)load("glBindFragDataLocationIndexed"); - fp_glGetFragDataIndex = (pfn_glGetFragDataIndex)load("glGetFragDataIndex"); - fp_glGenSamplers = (pfn_glGenSamplers)load("glGenSamplers"); - fp_glDeleteSamplers = (pfn_glDeleteSamplers)load("glDeleteSamplers"); - fp_glIsSampler = (pfn_glIsSampler)load("glIsSampler"); - fp_glBindSampler = (pfn_glBindSampler)load("glBindSampler"); - fp_glSamplerParameteri = (pfn_glSamplerParameteri)load("glSamplerParameteri"); - fp_glSamplerParameteriv = (pfn_glSamplerParameteriv)load("glSamplerParameteriv"); - fp_glSamplerParameterf = (pfn_glSamplerParameterf)load("glSamplerParameterf"); - fp_glSamplerParameterfv = (pfn_glSamplerParameterfv)load("glSamplerParameterfv"); - fp_glSamplerParameterIiv = (pfn_glSamplerParameterIiv)load("glSamplerParameterIiv"); - fp_glSamplerParameterIuiv = (pfn_glSamplerParameterIuiv)load("glSamplerParameterIuiv"); - fp_glGetSamplerParameteriv = (pfn_glGetSamplerParameteriv)load("glGetSamplerParameteriv"); - fp_glGetSamplerParameterIiv = (pfn_glGetSamplerParameterIiv)load("glGetSamplerParameterIiv"); - fp_glGetSamplerParameterfv = (pfn_glGetSamplerParameterfv)load("glGetSamplerParameterfv"); - fp_glGetSamplerParameterIuiv = (pfn_glGetSamplerParameterIuiv)load("glGetSamplerParameterIuiv"); - fp_glQueryCounter = (pfn_glQueryCounter)load("glQueryCounter"); - fp_glGetQueryObjecti64v = (pfn_glGetQueryObjecti64v)load("glGetQueryObjecti64v"); - fp_glGetQueryObjectui64v = (pfn_glGetQueryObjectui64v)load("glGetQueryObjectui64v"); - fp_glVertexAttribDivisor = (pfn_glVertexAttribDivisor)load("glVertexAttribDivisor"); - fp_glVertexAttribP1ui = (pfn_glVertexAttribP1ui)load("glVertexAttribP1ui"); - fp_glVertexAttribP1uiv = (pfn_glVertexAttribP1uiv)load("glVertexAttribP1uiv"); - fp_glVertexAttribP2ui = (pfn_glVertexAttribP2ui)load("glVertexAttribP2ui"); - fp_glVertexAttribP2uiv = (pfn_glVertexAttribP2uiv)load("glVertexAttribP2uiv"); - fp_glVertexAttribP3ui = (pfn_glVertexAttribP3ui)load("glVertexAttribP3ui"); - fp_glVertexAttribP3uiv = (pfn_glVertexAttribP3uiv)load("glVertexAttribP3uiv"); - fp_glVertexAttribP4ui = (pfn_glVertexAttribP4ui)load("glVertexAttribP4ui"); - fp_glVertexAttribP4uiv = (pfn_glVertexAttribP4uiv)load("glVertexAttribP4uiv"); - fp_glVertexP2ui = (pfn_glVertexP2ui)load("glVertexP2ui"); - fp_glVertexP2uiv = (pfn_glVertexP2uiv)load("glVertexP2uiv"); - fp_glVertexP3ui = (pfn_glVertexP3ui)load("glVertexP3ui"); - fp_glVertexP3uiv = (pfn_glVertexP3uiv)load("glVertexP3uiv"); - fp_glVertexP4ui = (pfn_glVertexP4ui)load("glVertexP4ui"); - fp_glVertexP4uiv = (pfn_glVertexP4uiv)load("glVertexP4uiv"); - fp_glTexCoordP1ui = (pfn_glTexCoordP1ui)load("glTexCoordP1ui"); - fp_glTexCoordP1uiv = (pfn_glTexCoordP1uiv)load("glTexCoordP1uiv"); - fp_glTexCoordP2ui = (pfn_glTexCoordP2ui)load("glTexCoordP2ui"); - fp_glTexCoordP2uiv = (pfn_glTexCoordP2uiv)load("glTexCoordP2uiv"); - fp_glTexCoordP3ui = (pfn_glTexCoordP3ui)load("glTexCoordP3ui"); - fp_glTexCoordP3uiv = (pfn_glTexCoordP3uiv)load("glTexCoordP3uiv"); - fp_glTexCoordP4ui = (pfn_glTexCoordP4ui)load("glTexCoordP4ui"); - fp_glTexCoordP4uiv = (pfn_glTexCoordP4uiv)load("glTexCoordP4uiv"); - fp_glMultiTexCoordP1ui = (pfn_glMultiTexCoordP1ui)load("glMultiTexCoordP1ui"); - fp_glMultiTexCoordP1uiv = (pfn_glMultiTexCoordP1uiv)load("glMultiTexCoordP1uiv"); - fp_glMultiTexCoordP2ui = (pfn_glMultiTexCoordP2ui)load("glMultiTexCoordP2ui"); - fp_glMultiTexCoordP2uiv = (pfn_glMultiTexCoordP2uiv)load("glMultiTexCoordP2uiv"); - fp_glMultiTexCoordP3ui = (pfn_glMultiTexCoordP3ui)load("glMultiTexCoordP3ui"); - fp_glMultiTexCoordP3uiv = (pfn_glMultiTexCoordP3uiv)load("glMultiTexCoordP3uiv"); - fp_glMultiTexCoordP4ui = (pfn_glMultiTexCoordP4ui)load("glMultiTexCoordP4ui"); - fp_glMultiTexCoordP4uiv = (pfn_glMultiTexCoordP4uiv)load("glMultiTexCoordP4uiv"); - fp_glNormalP3ui = (pfn_glNormalP3ui)load("glNormalP3ui"); - fp_glNormalP3uiv = (pfn_glNormalP3uiv)load("glNormalP3uiv"); - fp_glColorP3ui = (pfn_glColorP3ui)load("glColorP3ui"); - fp_glColorP3uiv = (pfn_glColorP3uiv)load("glColorP3uiv"); - fp_glColorP4ui = (pfn_glColorP4ui)load("glColorP4ui"); - fp_glColorP4uiv = (pfn_glColorP4uiv)load("glColorP4uiv"); - fp_glSecondaryColorP3ui = (pfn_glSecondaryColorP3ui)load("glSecondaryColorP3ui"); - fp_glSecondaryColorP3uiv = (pfn_glSecondaryColorP3uiv)load("glSecondaryColorP3uiv"); -} - -GLboolean GLAD_VERSION_4_0 = GL_FALSE; -static void load_GL_VERSION_4_0(LOADER load) { - if(!GLAD_VERSION_4_0) return; - fp_glMinSampleShading = (pfn_glMinSampleShading)load("glMinSampleShading"); - fp_glBlendEquationi = (pfn_glBlendEquationi)load("glBlendEquationi"); - fp_glBlendEquationSeparatei = (pfn_glBlendEquationSeparatei)load("glBlendEquationSeparatei"); - fp_glBlendFunci = (pfn_glBlendFunci)load("glBlendFunci"); - fp_glBlendFuncSeparatei = (pfn_glBlendFuncSeparatei)load("glBlendFuncSeparatei"); - fp_glDrawArraysIndirect = (pfn_glDrawArraysIndirect)load("glDrawArraysIndirect"); - fp_glDrawElementsIndirect = (pfn_glDrawElementsIndirect)load("glDrawElementsIndirect"); - fp_glUniform1d = (pfn_glUniform1d)load("glUniform1d"); - fp_glUniform2d = (pfn_glUniform2d)load("glUniform2d"); - fp_glUniform3d = (pfn_glUniform3d)load("glUniform3d"); - fp_glUniform4d = (pfn_glUniform4d)load("glUniform4d"); - fp_glUniform1dv = (pfn_glUniform1dv)load("glUniform1dv"); - fp_glUniform2dv = (pfn_glUniform2dv)load("glUniform2dv"); - fp_glUniform3dv = (pfn_glUniform3dv)load("glUniform3dv"); - fp_glUniform4dv = (pfn_glUniform4dv)load("glUniform4dv"); - fp_glUniformMatrix2dv = (pfn_glUniformMatrix2dv)load("glUniformMatrix2dv"); - fp_glUniformMatrix3dv = (pfn_glUniformMatrix3dv)load("glUniformMatrix3dv"); - fp_glUniformMatrix4dv = (pfn_glUniformMatrix4dv)load("glUniformMatrix4dv"); - fp_glUniformMatrix2x3dv = (pfn_glUniformMatrix2x3dv)load("glUniformMatrix2x3dv"); - fp_glUniformMatrix2x4dv = (pfn_glUniformMatrix2x4dv)load("glUniformMatrix2x4dv"); - fp_glUniformMatrix3x2dv = (pfn_glUniformMatrix3x2dv)load("glUniformMatrix3x2dv"); - fp_glUniformMatrix3x4dv = (pfn_glUniformMatrix3x4dv)load("glUniformMatrix3x4dv"); - fp_glUniformMatrix4x2dv = (pfn_glUniformMatrix4x2dv)load("glUniformMatrix4x2dv"); - fp_glUniformMatrix4x3dv = (pfn_glUniformMatrix4x3dv)load("glUniformMatrix4x3dv"); - fp_glGetUniformdv = (pfn_glGetUniformdv)load("glGetUniformdv"); - fp_glGetSubroutineUniformLocation = (pfn_glGetSubroutineUniformLocation)load("glGetSubroutineUniformLocation"); - fp_glGetSubroutineIndex = (pfn_glGetSubroutineIndex)load("glGetSubroutineIndex"); - fp_glGetActiveSubroutineUniformiv = (pfn_glGetActiveSubroutineUniformiv)load("glGetActiveSubroutineUniformiv"); - fp_glGetActiveSubroutineUniformName = (pfn_glGetActiveSubroutineUniformName)load("glGetActiveSubroutineUniformName"); - fp_glGetActiveSubroutineName = (pfn_glGetActiveSubroutineName)load("glGetActiveSubroutineName"); - fp_glUniformSubroutinesuiv = (pfn_glUniformSubroutinesuiv)load("glUniformSubroutinesuiv"); - fp_glGetUniformSubroutineuiv = (pfn_glGetUniformSubroutineuiv)load("glGetUniformSubroutineuiv"); - fp_glGetProgramStageiv = (pfn_glGetProgramStageiv)load("glGetProgramStageiv"); - fp_glPatchParameteri = (pfn_glPatchParameteri)load("glPatchParameteri"); - fp_glPatchParameterfv = (pfn_glPatchParameterfv)load("glPatchParameterfv"); - fp_glBindTransformFeedback = (pfn_glBindTransformFeedback)load("glBindTransformFeedback"); - fp_glDeleteTransformFeedbacks = (pfn_glDeleteTransformFeedbacks)load("glDeleteTransformFeedbacks"); - fp_glGenTransformFeedbacks = (pfn_glGenTransformFeedbacks)load("glGenTransformFeedbacks"); - fp_glIsTransformFeedback = (pfn_glIsTransformFeedback)load("glIsTransformFeedback"); - fp_glPauseTransformFeedback = (pfn_glPauseTransformFeedback)load("glPauseTransformFeedback"); - fp_glResumeTransformFeedback = (pfn_glResumeTransformFeedback)load("glResumeTransformFeedback"); - fp_glDrawTransformFeedback = (pfn_glDrawTransformFeedback)load("glDrawTransformFeedback"); - fp_glDrawTransformFeedbackStream = (pfn_glDrawTransformFeedbackStream)load("glDrawTransformFeedbackStream"); - fp_glBeginQueryIndexed = (pfn_glBeginQueryIndexed)load("glBeginQueryIndexed"); - fp_glEndQueryIndexed = (pfn_glEndQueryIndexed)load("glEndQueryIndexed"); - fp_glGetQueryIndexediv = (pfn_glGetQueryIndexediv)load("glGetQueryIndexediv"); -} - -GLboolean GLAD_VERSION_4_1 = GL_FALSE; -static void load_GL_VERSION_4_1(LOADER load) { - if(!GLAD_VERSION_4_1) return; - fp_glReleaseShaderCompiler = (pfn_glReleaseShaderCompiler)load("glReleaseShaderCompiler"); - fp_glShaderBinary = (pfn_glShaderBinary)load("glShaderBinary"); - fp_glGetShaderPrecisionFormat = (pfn_glGetShaderPrecisionFormat)load("glGetShaderPrecisionFormat"); - fp_glDepthRangef = (pfn_glDepthRangef)load("glDepthRangef"); - fp_glClearDepthf = (pfn_glClearDepthf)load("glClearDepthf"); - fp_glGetProgramBinary = (pfn_glGetProgramBinary)load("glGetProgramBinary"); - fp_glProgramBinary = (pfn_glProgramBinary)load("glProgramBinary"); - fp_glProgramParameteri = (pfn_glProgramParameteri)load("glProgramParameteri"); - fp_glUseProgramStages = (pfn_glUseProgramStages)load("glUseProgramStages"); - fp_glActiveShaderProgram = (pfn_glActiveShaderProgram)load("glActiveShaderProgram"); - fp_glCreateShaderProgramv = (pfn_glCreateShaderProgramv)load("glCreateShaderProgramv"); - fp_glBindProgramPipeline = (pfn_glBindProgramPipeline)load("glBindProgramPipeline"); - fp_glDeleteProgramPipelines = (pfn_glDeleteProgramPipelines)load("glDeleteProgramPipelines"); - fp_glGenProgramPipelines = (pfn_glGenProgramPipelines)load("glGenProgramPipelines"); - fp_glIsProgramPipeline = (pfn_glIsProgramPipeline)load("glIsProgramPipeline"); - fp_glGetProgramPipelineiv = (pfn_glGetProgramPipelineiv)load("glGetProgramPipelineiv"); - fp_glProgramUniform1i = (pfn_glProgramUniform1i)load("glProgramUniform1i"); - fp_glProgramUniform1iv = (pfn_glProgramUniform1iv)load("glProgramUniform1iv"); - fp_glProgramUniform1f = (pfn_glProgramUniform1f)load("glProgramUniform1f"); - fp_glProgramUniform1fv = (pfn_glProgramUniform1fv)load("glProgramUniform1fv"); - fp_glProgramUniform1d = (pfn_glProgramUniform1d)load("glProgramUniform1d"); - fp_glProgramUniform1dv = (pfn_glProgramUniform1dv)load("glProgramUniform1dv"); - fp_glProgramUniform1ui = (pfn_glProgramUniform1ui)load("glProgramUniform1ui"); - fp_glProgramUniform1uiv = (pfn_glProgramUniform1uiv)load("glProgramUniform1uiv"); - fp_glProgramUniform2i = (pfn_glProgramUniform2i)load("glProgramUniform2i"); - fp_glProgramUniform2iv = (pfn_glProgramUniform2iv)load("glProgramUniform2iv"); - fp_glProgramUniform2f = (pfn_glProgramUniform2f)load("glProgramUniform2f"); - fp_glProgramUniform2fv = (pfn_glProgramUniform2fv)load("glProgramUniform2fv"); - fp_glProgramUniform2d = (pfn_glProgramUniform2d)load("glProgramUniform2d"); - fp_glProgramUniform2dv = (pfn_glProgramUniform2dv)load("glProgramUniform2dv"); - fp_glProgramUniform2ui = (pfn_glProgramUniform2ui)load("glProgramUniform2ui"); - fp_glProgramUniform2uiv = (pfn_glProgramUniform2uiv)load("glProgramUniform2uiv"); - fp_glProgramUniform3i = (pfn_glProgramUniform3i)load("glProgramUniform3i"); - fp_glProgramUniform3iv = (pfn_glProgramUniform3iv)load("glProgramUniform3iv"); - fp_glProgramUniform3f = (pfn_glProgramUniform3f)load("glProgramUniform3f"); - fp_glProgramUniform3fv = (pfn_glProgramUniform3fv)load("glProgramUniform3fv"); - fp_glProgramUniform3d = (pfn_glProgramUniform3d)load("glProgramUniform3d"); - fp_glProgramUniform3dv = (pfn_glProgramUniform3dv)load("glProgramUniform3dv"); - fp_glProgramUniform3ui = (pfn_glProgramUniform3ui)load("glProgramUniform3ui"); - fp_glProgramUniform3uiv = (pfn_glProgramUniform3uiv)load("glProgramUniform3uiv"); - fp_glProgramUniform4i = (pfn_glProgramUniform4i)load("glProgramUniform4i"); - fp_glProgramUniform4iv = (pfn_glProgramUniform4iv)load("glProgramUniform4iv"); - fp_glProgramUniform4f = (pfn_glProgramUniform4f)load("glProgramUniform4f"); - fp_glProgramUniform4fv = (pfn_glProgramUniform4fv)load("glProgramUniform4fv"); - fp_glProgramUniform4d = (pfn_glProgramUniform4d)load("glProgramUniform4d"); - fp_glProgramUniform4dv = (pfn_glProgramUniform4dv)load("glProgramUniform4dv"); - fp_glProgramUniform4ui = (pfn_glProgramUniform4ui)load("glProgramUniform4ui"); - fp_glProgramUniform4uiv = (pfn_glProgramUniform4uiv)load("glProgramUniform4uiv"); - fp_glProgramUniformMatrix2fv = (pfn_glProgramUniformMatrix2fv)load("glProgramUniformMatrix2fv"); - fp_glProgramUniformMatrix3fv = (pfn_glProgramUniformMatrix3fv)load("glProgramUniformMatrix3fv"); - fp_glProgramUniformMatrix4fv = (pfn_glProgramUniformMatrix4fv)load("glProgramUniformMatrix4fv"); - fp_glProgramUniformMatrix2dv = (pfn_glProgramUniformMatrix2dv)load("glProgramUniformMatrix2dv"); - fp_glProgramUniformMatrix3dv = (pfn_glProgramUniformMatrix3dv)load("glProgramUniformMatrix3dv"); - fp_glProgramUniformMatrix4dv = (pfn_glProgramUniformMatrix4dv)load("glProgramUniformMatrix4dv"); - fp_glProgramUniformMatrix2x3fv = (pfn_glProgramUniformMatrix2x3fv)load("glProgramUniformMatrix2x3fv"); - fp_glProgramUniformMatrix3x2fv = (pfn_glProgramUniformMatrix3x2fv)load("glProgramUniformMatrix3x2fv"); - fp_glProgramUniformMatrix2x4fv = (pfn_glProgramUniformMatrix2x4fv)load("glProgramUniformMatrix2x4fv"); - fp_glProgramUniformMatrix4x2fv = (pfn_glProgramUniformMatrix4x2fv)load("glProgramUniformMatrix4x2fv"); - fp_glProgramUniformMatrix3x4fv = (pfn_glProgramUniformMatrix3x4fv)load("glProgramUniformMatrix3x4fv"); - fp_glProgramUniformMatrix4x3fv = (pfn_glProgramUniformMatrix4x3fv)load("glProgramUniformMatrix4x3fv"); - fp_glProgramUniformMatrix2x3dv = (pfn_glProgramUniformMatrix2x3dv)load("glProgramUniformMatrix2x3dv"); - fp_glProgramUniformMatrix3x2dv = (pfn_glProgramUniformMatrix3x2dv)load("glProgramUniformMatrix3x2dv"); - fp_glProgramUniformMatrix2x4dv = (pfn_glProgramUniformMatrix2x4dv)load("glProgramUniformMatrix2x4dv"); - fp_glProgramUniformMatrix4x2dv = (pfn_glProgramUniformMatrix4x2dv)load("glProgramUniformMatrix4x2dv"); - fp_glProgramUniformMatrix3x4dv = (pfn_glProgramUniformMatrix3x4dv)load("glProgramUniformMatrix3x4dv"); - fp_glProgramUniformMatrix4x3dv = (pfn_glProgramUniformMatrix4x3dv)load("glProgramUniformMatrix4x3dv"); - fp_glValidateProgramPipeline = (pfn_glValidateProgramPipeline)load("glValidateProgramPipeline"); - fp_glGetProgramPipelineInfoLog = (pfn_glGetProgramPipelineInfoLog)load("glGetProgramPipelineInfoLog"); - fp_glVertexAttribL1d = (pfn_glVertexAttribL1d)load("glVertexAttribL1d"); - fp_glVertexAttribL2d = (pfn_glVertexAttribL2d)load("glVertexAttribL2d"); - fp_glVertexAttribL3d = (pfn_glVertexAttribL3d)load("glVertexAttribL3d"); - fp_glVertexAttribL4d = (pfn_glVertexAttribL4d)load("glVertexAttribL4d"); - fp_glVertexAttribL1dv = (pfn_glVertexAttribL1dv)load("glVertexAttribL1dv"); - fp_glVertexAttribL2dv = (pfn_glVertexAttribL2dv)load("glVertexAttribL2dv"); - fp_glVertexAttribL3dv = (pfn_glVertexAttribL3dv)load("glVertexAttribL3dv"); - fp_glVertexAttribL4dv = (pfn_glVertexAttribL4dv)load("glVertexAttribL4dv"); - fp_glVertexAttribLPointer = (pfn_glVertexAttribLPointer)load("glVertexAttribLPointer"); - fp_glGetVertexAttribLdv = (pfn_glGetVertexAttribLdv)load("glGetVertexAttribLdv"); - fp_glViewportArrayv = (pfn_glViewportArrayv)load("glViewportArrayv"); - fp_glViewportIndexedf = (pfn_glViewportIndexedf)load("glViewportIndexedf"); - fp_glViewportIndexedfv = (pfn_glViewportIndexedfv)load("glViewportIndexedfv"); - fp_glScissorArrayv = (pfn_glScissorArrayv)load("glScissorArrayv"); - fp_glScissorIndexed = (pfn_glScissorIndexed)load("glScissorIndexed"); - fp_glScissorIndexedv = (pfn_glScissorIndexedv)load("glScissorIndexedv"); - fp_glDepthRangeArrayv = (pfn_glDepthRangeArrayv)load("glDepthRangeArrayv"); - fp_glDepthRangeIndexed = (pfn_glDepthRangeIndexed)load("glDepthRangeIndexed"); - fp_glGetFloati_v = (pfn_glGetFloati_v)load("glGetFloati_v"); - fp_glGetDoublei_v = (pfn_glGetDoublei_v)load("glGetDoublei_v"); -} - -GLboolean GLAD_VERSION_4_2 = GL_FALSE; -static void load_GL_VERSION_4_2(LOADER load) { - if(!GLAD_VERSION_4_2) return; - fp_glDrawArraysInstancedBaseInstance = (pfn_glDrawArraysInstancedBaseInstance)load("glDrawArraysInstancedBaseInstance"); - fp_glDrawElementsInstancedBaseInstance = (pfn_glDrawElementsInstancedBaseInstance)load("glDrawElementsInstancedBaseInstance"); - fp_glDrawElementsInstancedBaseVertexBaseInstance = (pfn_glDrawElementsInstancedBaseVertexBaseInstance)load("glDrawElementsInstancedBaseVertexBaseInstance"); - fp_glGetInternalformativ = (pfn_glGetInternalformativ)load("glGetInternalformativ"); - fp_glGetActiveAtomicCounterBufferiv = (pfn_glGetActiveAtomicCounterBufferiv)load("glGetActiveAtomicCounterBufferiv"); - fp_glBindImageTexture = (pfn_glBindImageTexture)load("glBindImageTexture"); - fp_glMemoryBarrier = (pfn_glMemoryBarrier)load("glMemoryBarrier"); - fp_glTexStorage1D = (pfn_glTexStorage1D)load("glTexStorage1D"); - fp_glTexStorage2D = (pfn_glTexStorage2D)load("glTexStorage2D"); - fp_glTexStorage3D = (pfn_glTexStorage3D)load("glTexStorage3D"); - fp_glDrawTransformFeedbackInstanced = (pfn_glDrawTransformFeedbackInstanced)load("glDrawTransformFeedbackInstanced"); - fp_glDrawTransformFeedbackStreamInstanced = (pfn_glDrawTransformFeedbackStreamInstanced)load("glDrawTransformFeedbackStreamInstanced"); -} - -GLboolean GLAD_VERSION_4_3 = GL_FALSE; -static void load_GL_VERSION_4_3(LOADER load) { - if(!GLAD_VERSION_4_3) return; - fp_glClearBufferData = (pfn_glClearBufferData)load("glClearBufferData"); - fp_glClearBufferSubData = (pfn_glClearBufferSubData)load("glClearBufferSubData"); - fp_glDispatchCompute = (pfn_glDispatchCompute)load("glDispatchCompute"); - fp_glDispatchComputeIndirect = (pfn_glDispatchComputeIndirect)load("glDispatchComputeIndirect"); - fp_glCopyImageSubData = (pfn_glCopyImageSubData)load("glCopyImageSubData"); - fp_glFramebufferParameteri = (pfn_glFramebufferParameteri)load("glFramebufferParameteri"); - fp_glGetFramebufferParameteriv = (pfn_glGetFramebufferParameteriv)load("glGetFramebufferParameteriv"); - fp_glGetInternalformati64v = (pfn_glGetInternalformati64v)load("glGetInternalformati64v"); - fp_glInvalidateTexSubImage = (pfn_glInvalidateTexSubImage)load("glInvalidateTexSubImage"); - fp_glInvalidateTexImage = (pfn_glInvalidateTexImage)load("glInvalidateTexImage"); - fp_glInvalidateBufferSubData = (pfn_glInvalidateBufferSubData)load("glInvalidateBufferSubData"); - fp_glInvalidateBufferData = (pfn_glInvalidateBufferData)load("glInvalidateBufferData"); - fp_glInvalidateFramebuffer = (pfn_glInvalidateFramebuffer)load("glInvalidateFramebuffer"); - fp_glInvalidateSubFramebuffer = (pfn_glInvalidateSubFramebuffer)load("glInvalidateSubFramebuffer"); - fp_glMultiDrawArraysIndirect = (pfn_glMultiDrawArraysIndirect)load("glMultiDrawArraysIndirect"); - fp_glMultiDrawElementsIndirect = (pfn_glMultiDrawElementsIndirect)load("glMultiDrawElementsIndirect"); - fp_glGetProgramInterfaceiv = (pfn_glGetProgramInterfaceiv)load("glGetProgramInterfaceiv"); - fp_glGetProgramResourceIndex = (pfn_glGetProgramResourceIndex)load("glGetProgramResourceIndex"); - fp_glGetProgramResourceName = (pfn_glGetProgramResourceName)load("glGetProgramResourceName"); - fp_glGetProgramResourceiv = (pfn_glGetProgramResourceiv)load("glGetProgramResourceiv"); - fp_glGetProgramResourceLocation = (pfn_glGetProgramResourceLocation)load("glGetProgramResourceLocation"); - fp_glGetProgramResourceLocationIndex = (pfn_glGetProgramResourceLocationIndex)load("glGetProgramResourceLocationIndex"); - fp_glShaderStorageBlockBinding = (pfn_glShaderStorageBlockBinding)load("glShaderStorageBlockBinding"); - fp_glTexBufferRange = (pfn_glTexBufferRange)load("glTexBufferRange"); - fp_glTexStorage2DMultisample = (pfn_glTexStorage2DMultisample)load("glTexStorage2DMultisample"); - fp_glTexStorage3DMultisample = (pfn_glTexStorage3DMultisample)load("glTexStorage3DMultisample"); - fp_glTextureView = (pfn_glTextureView)load("glTextureView"); - fp_glBindVertexBuffer = (pfn_glBindVertexBuffer)load("glBindVertexBuffer"); - fp_glVertexAttribFormat = (pfn_glVertexAttribFormat)load("glVertexAttribFormat"); - fp_glVertexAttribIFormat = (pfn_glVertexAttribIFormat)load("glVertexAttribIFormat"); - fp_glVertexAttribLFormat = (pfn_glVertexAttribLFormat)load("glVertexAttribLFormat"); - fp_glVertexAttribBinding = (pfn_glVertexAttribBinding)load("glVertexAttribBinding"); - fp_glVertexBindingDivisor = (pfn_glVertexBindingDivisor)load("glVertexBindingDivisor"); - fp_glDebugMessageControl = (pfn_glDebugMessageControl)load("glDebugMessageControl"); - fp_glDebugMessageInsert = (pfn_glDebugMessageInsert)load("glDebugMessageInsert"); - fp_glDebugMessageCallback = (pfn_glDebugMessageCallback)load("glDebugMessageCallback"); - fp_glGetDebugMessageLog = (pfn_glGetDebugMessageLog)load("glGetDebugMessageLog"); - fp_glPushDebugGroup = (pfn_glPushDebugGroup)load("glPushDebugGroup"); - fp_glPopDebugGroup = (pfn_glPopDebugGroup)load("glPopDebugGroup"); - fp_glObjectLabel = (pfn_glObjectLabel)load("glObjectLabel"); - fp_glGetObjectLabel = (pfn_glGetObjectLabel)load("glGetObjectLabel"); - fp_glObjectPtrLabel = (pfn_glObjectPtrLabel)load("glObjectPtrLabel"); - fp_glGetObjectPtrLabel = (pfn_glGetObjectPtrLabel)load("glGetObjectPtrLabel"); - fp_glGetPointerv = (pfn_glGetPointerv)load("glGetPointerv"); - fp_glGetPointerv = (pfn_glGetPointerv)load("glGetPointerv"); -} - -GLboolean GLAD_VERSION_4_4 = GL_FALSE; -static void load_GL_VERSION_4_4(LOADER load) { - if(!GLAD_VERSION_4_4) return; - fp_glBufferStorage = (pfn_glBufferStorage)load("glBufferStorage"); - fp_glClearTexImage = (pfn_glClearTexImage)load("glClearTexImage"); - fp_glClearTexSubImage = (pfn_glClearTexSubImage)load("glClearTexSubImage"); - fp_glBindBuffersBase = (pfn_glBindBuffersBase)load("glBindBuffersBase"); - fp_glBindBuffersRange = (pfn_glBindBuffersRange)load("glBindBuffersRange"); - fp_glBindTextures = (pfn_glBindTextures)load("glBindTextures"); - fp_glBindSamplers = (pfn_glBindSamplers)load("glBindSamplers"); - fp_glBindImageTextures = (pfn_glBindImageTextures)load("glBindImageTextures"); - fp_glBindVertexBuffers = (pfn_glBindVertexBuffers)load("glBindVertexBuffers"); -} - -GLboolean GLAD_VERSION_4_5 = GL_FALSE; -static void load_GL_VERSION_4_5(LOADER load) { - if(!GLAD_VERSION_4_5) return; - fp_glClipControl = (pfn_glClipControl)load("glClipControl"); - fp_glCreateTransformFeedbacks = (pfn_glCreateTransformFeedbacks)load("glCreateTransformFeedbacks"); - fp_glTransformFeedbackBufferBase = (pfn_glTransformFeedbackBufferBase)load("glTransformFeedbackBufferBase"); - fp_glTransformFeedbackBufferRange = (pfn_glTransformFeedbackBufferRange)load("glTransformFeedbackBufferRange"); - fp_glGetTransformFeedbackiv = (pfn_glGetTransformFeedbackiv)load("glGetTransformFeedbackiv"); - fp_glGetTransformFeedbacki_v = (pfn_glGetTransformFeedbacki_v)load("glGetTransformFeedbacki_v"); - fp_glGetTransformFeedbacki64_v = (pfn_glGetTransformFeedbacki64_v)load("glGetTransformFeedbacki64_v"); - fp_glCreateBuffers = (pfn_glCreateBuffers)load("glCreateBuffers"); - fp_glNamedBufferStorage = (pfn_glNamedBufferStorage)load("glNamedBufferStorage"); - fp_glNamedBufferData = (pfn_glNamedBufferData)load("glNamedBufferData"); - fp_glNamedBufferSubData = (pfn_glNamedBufferSubData)load("glNamedBufferSubData"); - fp_glCopyNamedBufferSubData = (pfn_glCopyNamedBufferSubData)load("glCopyNamedBufferSubData"); - fp_glClearNamedBufferData = (pfn_glClearNamedBufferData)load("glClearNamedBufferData"); - fp_glClearNamedBufferSubData = (pfn_glClearNamedBufferSubData)load("glClearNamedBufferSubData"); - fp_glMapNamedBuffer = (pfn_glMapNamedBuffer)load("glMapNamedBuffer"); - fp_glMapNamedBufferRange = (pfn_glMapNamedBufferRange)load("glMapNamedBufferRange"); - fp_glUnmapNamedBuffer = (pfn_glUnmapNamedBuffer)load("glUnmapNamedBuffer"); - fp_glFlushMappedNamedBufferRange = (pfn_glFlushMappedNamedBufferRange)load("glFlushMappedNamedBufferRange"); - fp_glGetNamedBufferParameteriv = (pfn_glGetNamedBufferParameteriv)load("glGetNamedBufferParameteriv"); - fp_glGetNamedBufferParameteri64v = (pfn_glGetNamedBufferParameteri64v)load("glGetNamedBufferParameteri64v"); - fp_glGetNamedBufferPointerv = (pfn_glGetNamedBufferPointerv)load("glGetNamedBufferPointerv"); - fp_glGetNamedBufferSubData = (pfn_glGetNamedBufferSubData)load("glGetNamedBufferSubData"); - fp_glCreateFramebuffers = (pfn_glCreateFramebuffers)load("glCreateFramebuffers"); - fp_glNamedFramebufferRenderbuffer = (pfn_glNamedFramebufferRenderbuffer)load("glNamedFramebufferRenderbuffer"); - fp_glNamedFramebufferParameteri = (pfn_glNamedFramebufferParameteri)load("glNamedFramebufferParameteri"); - fp_glNamedFramebufferTexture = (pfn_glNamedFramebufferTexture)load("glNamedFramebufferTexture"); - fp_glNamedFramebufferTextureLayer = (pfn_glNamedFramebufferTextureLayer)load("glNamedFramebufferTextureLayer"); - fp_glNamedFramebufferDrawBuffer = (pfn_glNamedFramebufferDrawBuffer)load("glNamedFramebufferDrawBuffer"); - fp_glNamedFramebufferDrawBuffers = (pfn_glNamedFramebufferDrawBuffers)load("glNamedFramebufferDrawBuffers"); - fp_glNamedFramebufferReadBuffer = (pfn_glNamedFramebufferReadBuffer)load("glNamedFramebufferReadBuffer"); - fp_glInvalidateNamedFramebufferData = (pfn_glInvalidateNamedFramebufferData)load("glInvalidateNamedFramebufferData"); - fp_glInvalidateNamedFramebufferSubData = (pfn_glInvalidateNamedFramebufferSubData)load("glInvalidateNamedFramebufferSubData"); - fp_glClearNamedFramebufferiv = (pfn_glClearNamedFramebufferiv)load("glClearNamedFramebufferiv"); - fp_glClearNamedFramebufferuiv = (pfn_glClearNamedFramebufferuiv)load("glClearNamedFramebufferuiv"); - fp_glClearNamedFramebufferfv = (pfn_glClearNamedFramebufferfv)load("glClearNamedFramebufferfv"); - fp_glClearNamedFramebufferfi = (pfn_glClearNamedFramebufferfi)load("glClearNamedFramebufferfi"); - fp_glBlitNamedFramebuffer = (pfn_glBlitNamedFramebuffer)load("glBlitNamedFramebuffer"); - fp_glCheckNamedFramebufferStatus = (pfn_glCheckNamedFramebufferStatus)load("glCheckNamedFramebufferStatus"); - fp_glGetNamedFramebufferParameteriv = (pfn_glGetNamedFramebufferParameteriv)load("glGetNamedFramebufferParameteriv"); - fp_glGetNamedFramebufferAttachmentParameteriv = (pfn_glGetNamedFramebufferAttachmentParameteriv)load("glGetNamedFramebufferAttachmentParameteriv"); - fp_glCreateRenderbuffers = (pfn_glCreateRenderbuffers)load("glCreateRenderbuffers"); - fp_glNamedRenderbufferStorage = (pfn_glNamedRenderbufferStorage)load("glNamedRenderbufferStorage"); - fp_glNamedRenderbufferStorageMultisample = (pfn_glNamedRenderbufferStorageMultisample)load("glNamedRenderbufferStorageMultisample"); - fp_glGetNamedRenderbufferParameteriv = (pfn_glGetNamedRenderbufferParameteriv)load("glGetNamedRenderbufferParameteriv"); - fp_glCreateTextures = (pfn_glCreateTextures)load("glCreateTextures"); - fp_glTextureBuffer = (pfn_glTextureBuffer)load("glTextureBuffer"); - fp_glTextureBufferRange = (pfn_glTextureBufferRange)load("glTextureBufferRange"); - fp_glTextureStorage1D = (pfn_glTextureStorage1D)load("glTextureStorage1D"); - fp_glTextureStorage2D = (pfn_glTextureStorage2D)load("glTextureStorage2D"); - fp_glTextureStorage3D = (pfn_glTextureStorage3D)load("glTextureStorage3D"); - fp_glTextureStorage2DMultisample = (pfn_glTextureStorage2DMultisample)load("glTextureStorage2DMultisample"); - fp_glTextureStorage3DMultisample = (pfn_glTextureStorage3DMultisample)load("glTextureStorage3DMultisample"); - fp_glTextureSubImage1D = (pfn_glTextureSubImage1D)load("glTextureSubImage1D"); - fp_glTextureSubImage2D = (pfn_glTextureSubImage2D)load("glTextureSubImage2D"); - fp_glTextureSubImage3D = (pfn_glTextureSubImage3D)load("glTextureSubImage3D"); - fp_glCompressedTextureSubImage1D = (pfn_glCompressedTextureSubImage1D)load("glCompressedTextureSubImage1D"); - fp_glCompressedTextureSubImage2D = (pfn_glCompressedTextureSubImage2D)load("glCompressedTextureSubImage2D"); - fp_glCompressedTextureSubImage3D = (pfn_glCompressedTextureSubImage3D)load("glCompressedTextureSubImage3D"); - fp_glCopyTextureSubImage1D = (pfn_glCopyTextureSubImage1D)load("glCopyTextureSubImage1D"); - fp_glCopyTextureSubImage2D = (pfn_glCopyTextureSubImage2D)load("glCopyTextureSubImage2D"); - fp_glCopyTextureSubImage3D = (pfn_glCopyTextureSubImage3D)load("glCopyTextureSubImage3D"); - fp_glTextureParameterf = (pfn_glTextureParameterf)load("glTextureParameterf"); - fp_glTextureParameterfv = (pfn_glTextureParameterfv)load("glTextureParameterfv"); - fp_glTextureParameteri = (pfn_glTextureParameteri)load("glTextureParameteri"); - fp_glTextureParameterIiv = (pfn_glTextureParameterIiv)load("glTextureParameterIiv"); - fp_glTextureParameterIuiv = (pfn_glTextureParameterIuiv)load("glTextureParameterIuiv"); - fp_glTextureParameteriv = (pfn_glTextureParameteriv)load("glTextureParameteriv"); - fp_glGenerateTextureMipmap = (pfn_glGenerateTextureMipmap)load("glGenerateTextureMipmap"); - fp_glBindTextureUnit = (pfn_glBindTextureUnit)load("glBindTextureUnit"); - fp_glGetTextureImage = (pfn_glGetTextureImage)load("glGetTextureImage"); - fp_glGetCompressedTextureImage = (pfn_glGetCompressedTextureImage)load("glGetCompressedTextureImage"); - fp_glGetTextureLevelParameterfv = (pfn_glGetTextureLevelParameterfv)load("glGetTextureLevelParameterfv"); - fp_glGetTextureLevelParameteriv = (pfn_glGetTextureLevelParameteriv)load("glGetTextureLevelParameteriv"); - fp_glGetTextureParameterfv = (pfn_glGetTextureParameterfv)load("glGetTextureParameterfv"); - fp_glGetTextureParameterIiv = (pfn_glGetTextureParameterIiv)load("glGetTextureParameterIiv"); - fp_glGetTextureParameterIuiv = (pfn_glGetTextureParameterIuiv)load("glGetTextureParameterIuiv"); - fp_glGetTextureParameteriv = (pfn_glGetTextureParameteriv)load("glGetTextureParameteriv"); - fp_glCreateVertexArrays = (pfn_glCreateVertexArrays)load("glCreateVertexArrays"); - fp_glDisableVertexArrayAttrib = (pfn_glDisableVertexArrayAttrib)load("glDisableVertexArrayAttrib"); - fp_glEnableVertexArrayAttrib = (pfn_glEnableVertexArrayAttrib)load("glEnableVertexArrayAttrib"); - fp_glVertexArrayElementBuffer = (pfn_glVertexArrayElementBuffer)load("glVertexArrayElementBuffer"); - fp_glVertexArrayVertexBuffer = (pfn_glVertexArrayVertexBuffer)load("glVertexArrayVertexBuffer"); - fp_glVertexArrayVertexBuffers = (pfn_glVertexArrayVertexBuffers)load("glVertexArrayVertexBuffers"); - fp_glVertexArrayAttribBinding = (pfn_glVertexArrayAttribBinding)load("glVertexArrayAttribBinding"); - fp_glVertexArrayAttribFormat = (pfn_glVertexArrayAttribFormat)load("glVertexArrayAttribFormat"); - fp_glVertexArrayAttribIFormat = (pfn_glVertexArrayAttribIFormat)load("glVertexArrayAttribIFormat"); - fp_glVertexArrayAttribLFormat = (pfn_glVertexArrayAttribLFormat)load("glVertexArrayAttribLFormat"); - fp_glVertexArrayBindingDivisor = (pfn_glVertexArrayBindingDivisor)load("glVertexArrayBindingDivisor"); - fp_glGetVertexArrayiv = (pfn_glGetVertexArrayiv)load("glGetVertexArrayiv"); - fp_glGetVertexArrayIndexediv = (pfn_glGetVertexArrayIndexediv)load("glGetVertexArrayIndexediv"); - fp_glGetVertexArrayIndexed64iv = (pfn_glGetVertexArrayIndexed64iv)load("glGetVertexArrayIndexed64iv"); - fp_glCreateSamplers = (pfn_glCreateSamplers)load("glCreateSamplers"); - fp_glCreateProgramPipelines = (pfn_glCreateProgramPipelines)load("glCreateProgramPipelines"); - fp_glCreateQueries = (pfn_glCreateQueries)load("glCreateQueries"); - fp_glGetQueryBufferObjecti64v = (pfn_glGetQueryBufferObjecti64v)load("glGetQueryBufferObjecti64v"); - fp_glGetQueryBufferObjectiv = (pfn_glGetQueryBufferObjectiv)load("glGetQueryBufferObjectiv"); - fp_glGetQueryBufferObjectui64v = (pfn_glGetQueryBufferObjectui64v)load("glGetQueryBufferObjectui64v"); - fp_glGetQueryBufferObjectuiv = (pfn_glGetQueryBufferObjectuiv)load("glGetQueryBufferObjectuiv"); - fp_glMemoryBarrierByRegion = (pfn_glMemoryBarrierByRegion)load("glMemoryBarrierByRegion"); - fp_glGetTextureSubImage = (pfn_glGetTextureSubImage)load("glGetTextureSubImage"); - fp_glGetCompressedTextureSubImage = (pfn_glGetCompressedTextureSubImage)load("glGetCompressedTextureSubImage"); - fp_glGetGraphicsResetStatus = (pfn_glGetGraphicsResetStatus)load("glGetGraphicsResetStatus"); - fp_glGetnCompressedTexImage = (pfn_glGetnCompressedTexImage)load("glGetnCompressedTexImage"); - fp_glGetnTexImage = (pfn_glGetnTexImage)load("glGetnTexImage"); - fp_glGetnUniformdv = (pfn_glGetnUniformdv)load("glGetnUniformdv"); - fp_glGetnUniformfv = (pfn_glGetnUniformfv)load("glGetnUniformfv"); - fp_glGetnUniformiv = (pfn_glGetnUniformiv)load("glGetnUniformiv"); - fp_glGetnUniformuiv = (pfn_glGetnUniformuiv)load("glGetnUniformuiv"); - fp_glReadnPixels = (pfn_glReadnPixels)load("glReadnPixels"); - fp_glGetnMapdv = (pfn_glGetnMapdv)load("glGetnMapdv"); - fp_glGetnMapfv = (pfn_glGetnMapfv)load("glGetnMapfv"); - fp_glGetnMapiv = (pfn_glGetnMapiv)load("glGetnMapiv"); - fp_glGetnPixelMapfv = (pfn_glGetnPixelMapfv)load("glGetnPixelMapfv"); - fp_glGetnPixelMapuiv = (pfn_glGetnPixelMapuiv)load("glGetnPixelMapuiv"); - fp_glGetnPixelMapusv = (pfn_glGetnPixelMapusv)load("glGetnPixelMapusv"); - fp_glGetnPolygonStipple = (pfn_glGetnPolygonStipple)load("glGetnPolygonStipple"); - fp_glGetnColorTable = (pfn_glGetnColorTable)load("glGetnColorTable"); - fp_glGetnConvolutionFilter = (pfn_glGetnConvolutionFilter)load("glGetnConvolutionFilter"); - fp_glGetnSeparableFilter = (pfn_glGetnSeparableFilter)load("glGetnSeparableFilter"); - fp_glGetnHistogram = (pfn_glGetnHistogram)load("glGetnHistogram"); - fp_glGetnMinmax = (pfn_glGetnMinmax)load("glGetnMinmax"); - fp_glTextureBarrier = (pfn_glTextureBarrier)load("glTextureBarrier"); -} - -GLboolean GLAD_ES_VERSION_2_0 = GL_FALSE; -static void load_GL_ES_VERSION_2_0(LOADER load) { - if(!GLAD_ES_VERSION_2_0) return; - fp_glActiveTexture = (pfn_glActiveTexture)load("glActiveTexture"); - fp_glAttachShader = (pfn_glAttachShader)load("glAttachShader"); - fp_glBindAttribLocation = (pfn_glBindAttribLocation)load("glBindAttribLocation"); - fp_glBindBuffer = (pfn_glBindBuffer)load("glBindBuffer"); - fp_glBindFramebuffer = (pfn_glBindFramebuffer)load("glBindFramebuffer"); - fp_glBindRenderbuffer = (pfn_glBindRenderbuffer)load("glBindRenderbuffer"); - fp_glBindTexture = (pfn_glBindTexture)load("glBindTexture"); - fp_glBlendColor = (pfn_glBlendColor)load("glBlendColor"); - fp_glBlendEquation = (pfn_glBlendEquation)load("glBlendEquation"); - fp_glBlendEquationSeparate = (pfn_glBlendEquationSeparate)load("glBlendEquationSeparate"); - fp_glBlendFunc = (pfn_glBlendFunc)load("glBlendFunc"); - fp_glBlendFuncSeparate = (pfn_glBlendFuncSeparate)load("glBlendFuncSeparate"); - fp_glBufferData = (pfn_glBufferData)load("glBufferData"); - fp_glBufferSubData = (pfn_glBufferSubData)load("glBufferSubData"); - fp_glCheckFramebufferStatus = (pfn_glCheckFramebufferStatus)load("glCheckFramebufferStatus"); - fp_glClear = (pfn_glClear)load("glClear"); - fp_glClearColor = (pfn_glClearColor)load("glClearColor"); - fp_glClearDepthf = (pfn_glClearDepthf)load("glClearDepthf"); - fp_glClearStencil = (pfn_glClearStencil)load("glClearStencil"); - fp_glColorMask = (pfn_glColorMask)load("glColorMask"); - fp_glCompileShader = (pfn_glCompileShader)load("glCompileShader"); - fp_glCompressedTexImage2D = (pfn_glCompressedTexImage2D)load("glCompressedTexImage2D"); - fp_glCompressedTexSubImage2D = (pfn_glCompressedTexSubImage2D)load("glCompressedTexSubImage2D"); - fp_glCopyTexImage2D = (pfn_glCopyTexImage2D)load("glCopyTexImage2D"); - fp_glCopyTexSubImage2D = (pfn_glCopyTexSubImage2D)load("glCopyTexSubImage2D"); - fp_glCreateProgram = (pfn_glCreateProgram)load("glCreateProgram"); - fp_glCreateShader = (pfn_glCreateShader)load("glCreateShader"); - fp_glCullFace = (pfn_glCullFace)load("glCullFace"); - fp_glDeleteBuffers = (pfn_glDeleteBuffers)load("glDeleteBuffers"); - fp_glDeleteFramebuffers = (pfn_glDeleteFramebuffers)load("glDeleteFramebuffers"); - fp_glDeleteProgram = (pfn_glDeleteProgram)load("glDeleteProgram"); - fp_glDeleteRenderbuffers = (pfn_glDeleteRenderbuffers)load("glDeleteRenderbuffers"); - fp_glDeleteShader = (pfn_glDeleteShader)load("glDeleteShader"); - fp_glDeleteTextures = (pfn_glDeleteTextures)load("glDeleteTextures"); - fp_glDepthFunc = (pfn_glDepthFunc)load("glDepthFunc"); - fp_glDepthMask = (pfn_glDepthMask)load("glDepthMask"); - fp_glDepthRangef = (pfn_glDepthRangef)load("glDepthRangef"); - fp_glDetachShader = (pfn_glDetachShader)load("glDetachShader"); - fp_glDisable = (pfn_glDisable)load("glDisable"); - fp_glDisableVertexAttribArray = (pfn_glDisableVertexAttribArray)load("glDisableVertexAttribArray"); - fp_glDrawArrays = (pfn_glDrawArrays)load("glDrawArrays"); - fp_glDrawElements = (pfn_glDrawElements)load("glDrawElements"); - fp_glEnable = (pfn_glEnable)load("glEnable"); - fp_glEnableVertexAttribArray = (pfn_glEnableVertexAttribArray)load("glEnableVertexAttribArray"); - fp_glFinish = (pfn_glFinish)load("glFinish"); - fp_glFlush = (pfn_glFlush)load("glFlush"); - fp_glFramebufferRenderbuffer = (pfn_glFramebufferRenderbuffer)load("glFramebufferRenderbuffer"); - fp_glFramebufferTexture2D = (pfn_glFramebufferTexture2D)load("glFramebufferTexture2D"); - fp_glFrontFace = (pfn_glFrontFace)load("glFrontFace"); - fp_glGenBuffers = (pfn_glGenBuffers)load("glGenBuffers"); - fp_glGenerateMipmap = (pfn_glGenerateMipmap)load("glGenerateMipmap"); - fp_glGenFramebuffers = (pfn_glGenFramebuffers)load("glGenFramebuffers"); - fp_glGenRenderbuffers = (pfn_glGenRenderbuffers)load("glGenRenderbuffers"); - fp_glGenTextures = (pfn_glGenTextures)load("glGenTextures"); - fp_glGetActiveAttrib = (pfn_glGetActiveAttrib)load("glGetActiveAttrib"); - fp_glGetActiveUniform = (pfn_glGetActiveUniform)load("glGetActiveUniform"); - fp_glGetAttachedShaders = (pfn_glGetAttachedShaders)load("glGetAttachedShaders"); - fp_glGetAttribLocation = (pfn_glGetAttribLocation)load("glGetAttribLocation"); - fp_glGetBooleanv = (pfn_glGetBooleanv)load("glGetBooleanv"); - fp_glGetBufferParameteriv = (pfn_glGetBufferParameteriv)load("glGetBufferParameteriv"); - fp_glGetError = (pfn_glGetError)load("glGetError"); - fp_glGetFloatv = (pfn_glGetFloatv)load("glGetFloatv"); - fp_glGetFramebufferAttachmentParameteriv = (pfn_glGetFramebufferAttachmentParameteriv)load("glGetFramebufferAttachmentParameteriv"); - fp_glGetIntegerv = (pfn_glGetIntegerv)load("glGetIntegerv"); - fp_glGetProgramiv = (pfn_glGetProgramiv)load("glGetProgramiv"); - fp_glGetProgramInfoLog = (pfn_glGetProgramInfoLog)load("glGetProgramInfoLog"); - fp_glGetRenderbufferParameteriv = (pfn_glGetRenderbufferParameteriv)load("glGetRenderbufferParameteriv"); - fp_glGetShaderiv = (pfn_glGetShaderiv)load("glGetShaderiv"); - fp_glGetShaderInfoLog = (pfn_glGetShaderInfoLog)load("glGetShaderInfoLog"); - fp_glGetShaderPrecisionFormat = (pfn_glGetShaderPrecisionFormat)load("glGetShaderPrecisionFormat"); - fp_glGetShaderSource = (pfn_glGetShaderSource)load("glGetShaderSource"); - fp_glGetString = (pfn_glGetString)load("glGetString"); - fp_glGetTexParameterfv = (pfn_glGetTexParameterfv)load("glGetTexParameterfv"); - fp_glGetTexParameteriv = (pfn_glGetTexParameteriv)load("glGetTexParameteriv"); - fp_glGetUniformfv = (pfn_glGetUniformfv)load("glGetUniformfv"); - fp_glGetUniformiv = (pfn_glGetUniformiv)load("glGetUniformiv"); - fp_glGetUniformLocation = (pfn_glGetUniformLocation)load("glGetUniformLocation"); - fp_glGetVertexAttribfv = (pfn_glGetVertexAttribfv)load("glGetVertexAttribfv"); - fp_glGetVertexAttribiv = (pfn_glGetVertexAttribiv)load("glGetVertexAttribiv"); - fp_glGetVertexAttribPointerv = (pfn_glGetVertexAttribPointerv)load("glGetVertexAttribPointerv"); - fp_glHint = (pfn_glHint)load("glHint"); - fp_glIsBuffer = (pfn_glIsBuffer)load("glIsBuffer"); - fp_glIsEnabled = (pfn_glIsEnabled)load("glIsEnabled"); - fp_glIsFramebuffer = (pfn_glIsFramebuffer)load("glIsFramebuffer"); - fp_glIsProgram = (pfn_glIsProgram)load("glIsProgram"); - fp_glIsRenderbuffer = (pfn_glIsRenderbuffer)load("glIsRenderbuffer"); - fp_glIsShader = (pfn_glIsShader)load("glIsShader"); - fp_glIsTexture = (pfn_glIsTexture)load("glIsTexture"); - fp_glLineWidth = (pfn_glLineWidth)load("glLineWidth"); - fp_glLinkProgram = (pfn_glLinkProgram)load("glLinkProgram"); - fp_glPixelStorei = (pfn_glPixelStorei)load("glPixelStorei"); - fp_glPolygonOffset = (pfn_glPolygonOffset)load("glPolygonOffset"); - fp_glReadPixels = (pfn_glReadPixels)load("glReadPixels"); - fp_glReleaseShaderCompiler = (pfn_glReleaseShaderCompiler)load("glReleaseShaderCompiler"); - fp_glRenderbufferStorage = (pfn_glRenderbufferStorage)load("glRenderbufferStorage"); - fp_glSampleCoverage = (pfn_glSampleCoverage)load("glSampleCoverage"); - fp_glScissor = (pfn_glScissor)load("glScissor"); - fp_glShaderBinary = (pfn_glShaderBinary)load("glShaderBinary"); - fp_glShaderSource = (pfn_glShaderSource)load("glShaderSource"); - fp_glStencilFunc = (pfn_glStencilFunc)load("glStencilFunc"); - fp_glStencilFuncSeparate = (pfn_glStencilFuncSeparate)load("glStencilFuncSeparate"); - fp_glStencilMask = (pfn_glStencilMask)load("glStencilMask"); - fp_glStencilMaskSeparate = (pfn_glStencilMaskSeparate)load("glStencilMaskSeparate"); - fp_glStencilOp = (pfn_glStencilOp)load("glStencilOp"); - fp_glStencilOpSeparate = (pfn_glStencilOpSeparate)load("glStencilOpSeparate"); - fp_glTexImage2D = (pfn_glTexImage2D)load("glTexImage2D"); - fp_glTexParameterf = (pfn_glTexParameterf)load("glTexParameterf"); - fp_glTexParameterfv = (pfn_glTexParameterfv)load("glTexParameterfv"); - fp_glTexParameteri = (pfn_glTexParameteri)load("glTexParameteri"); - fp_glTexParameteriv = (pfn_glTexParameteriv)load("glTexParameteriv"); - fp_glTexSubImage2D = (pfn_glTexSubImage2D)load("glTexSubImage2D"); - fp_glUniform1f = (pfn_glUniform1f)load("glUniform1f"); - fp_glUniform1fv = (pfn_glUniform1fv)load("glUniform1fv"); - fp_glUniform1i = (pfn_glUniform1i)load("glUniform1i"); - fp_glUniform1iv = (pfn_glUniform1iv)load("glUniform1iv"); - fp_glUniform2f = (pfn_glUniform2f)load("glUniform2f"); - fp_glUniform2fv = (pfn_glUniform2fv)load("glUniform2fv"); - fp_glUniform2i = (pfn_glUniform2i)load("glUniform2i"); - fp_glUniform2iv = (pfn_glUniform2iv)load("glUniform2iv"); - fp_glUniform3f = (pfn_glUniform3f)load("glUniform3f"); - fp_glUniform3fv = (pfn_glUniform3fv)load("glUniform3fv"); - fp_glUniform3i = (pfn_glUniform3i)load("glUniform3i"); - fp_glUniform3iv = (pfn_glUniform3iv)load("glUniform3iv"); - fp_glUniform4f = (pfn_glUniform4f)load("glUniform4f"); - fp_glUniform4fv = (pfn_glUniform4fv)load("glUniform4fv"); - fp_glUniform4i = (pfn_glUniform4i)load("glUniform4i"); - fp_glUniform4iv = (pfn_glUniform4iv)load("glUniform4iv"); - fp_glUniformMatrix2fv = (pfn_glUniformMatrix2fv)load("glUniformMatrix2fv"); - fp_glUniformMatrix3fv = (pfn_glUniformMatrix3fv)load("glUniformMatrix3fv"); - fp_glUniformMatrix4fv = (pfn_glUniformMatrix4fv)load("glUniformMatrix4fv"); - fp_glUseProgram = (pfn_glUseProgram)load("glUseProgram"); - fp_glValidateProgram = (pfn_glValidateProgram)load("glValidateProgram"); - fp_glVertexAttrib1f = (pfn_glVertexAttrib1f)load("glVertexAttrib1f"); - fp_glVertexAttrib1fv = (pfn_glVertexAttrib1fv)load("glVertexAttrib1fv"); - fp_glVertexAttrib2f = (pfn_glVertexAttrib2f)load("glVertexAttrib2f"); - fp_glVertexAttrib2fv = (pfn_glVertexAttrib2fv)load("glVertexAttrib2fv"); - fp_glVertexAttrib3f = (pfn_glVertexAttrib3f)load("glVertexAttrib3f"); - fp_glVertexAttrib3fv = (pfn_glVertexAttrib3fv)load("glVertexAttrib3fv"); - fp_glVertexAttrib4f = (pfn_glVertexAttrib4f)load("glVertexAttrib4f"); - fp_glVertexAttrib4fv = (pfn_glVertexAttrib4fv)load("glVertexAttrib4fv"); - fp_glVertexAttribPointer = (pfn_glVertexAttribPointer)load("glVertexAttribPointer"); - fp_glViewport = (pfn_glViewport)load("glViewport"); -} - -GLboolean GLAD_ES_VERSION_3_0 = GL_FALSE; -static void load_GL_ES_VERSION_3_0(LOADER load) { - if(!GLAD_ES_VERSION_3_0) return; - fp_glReadBuffer = (pfn_glReadBuffer)load("glReadBuffer"); - fp_glDrawRangeElements = (pfn_glDrawRangeElements)load("glDrawRangeElements"); - fp_glTexImage3D = (pfn_glTexImage3D)load("glTexImage3D"); - fp_glTexSubImage3D = (pfn_glTexSubImage3D)load("glTexSubImage3D"); - fp_glCopyTexSubImage3D = (pfn_glCopyTexSubImage3D)load("glCopyTexSubImage3D"); - fp_glCompressedTexImage3D = (pfn_glCompressedTexImage3D)load("glCompressedTexImage3D"); - fp_glCompressedTexSubImage3D = (pfn_glCompressedTexSubImage3D)load("glCompressedTexSubImage3D"); - fp_glGenQueries = (pfn_glGenQueries)load("glGenQueries"); - fp_glDeleteQueries = (pfn_glDeleteQueries)load("glDeleteQueries"); - fp_glIsQuery = (pfn_glIsQuery)load("glIsQuery"); - fp_glBeginQuery = (pfn_glBeginQuery)load("glBeginQuery"); - fp_glEndQuery = (pfn_glEndQuery)load("glEndQuery"); - fp_glGetQueryiv = (pfn_glGetQueryiv)load("glGetQueryiv"); - fp_glGetQueryObjectuiv = (pfn_glGetQueryObjectuiv)load("glGetQueryObjectuiv"); - fp_glUnmapBuffer = (pfn_glUnmapBuffer)load("glUnmapBuffer"); - fp_glGetBufferPointerv = (pfn_glGetBufferPointerv)load("glGetBufferPointerv"); - fp_glDrawBuffers = (pfn_glDrawBuffers)load("glDrawBuffers"); - fp_glUniformMatrix2x3fv = (pfn_glUniformMatrix2x3fv)load("glUniformMatrix2x3fv"); - fp_glUniformMatrix3x2fv = (pfn_glUniformMatrix3x2fv)load("glUniformMatrix3x2fv"); - fp_glUniformMatrix2x4fv = (pfn_glUniformMatrix2x4fv)load("glUniformMatrix2x4fv"); - fp_glUniformMatrix4x2fv = (pfn_glUniformMatrix4x2fv)load("glUniformMatrix4x2fv"); - fp_glUniformMatrix3x4fv = (pfn_glUniformMatrix3x4fv)load("glUniformMatrix3x4fv"); - fp_glUniformMatrix4x3fv = (pfn_glUniformMatrix4x3fv)load("glUniformMatrix4x3fv"); - fp_glBlitFramebuffer = (pfn_glBlitFramebuffer)load("glBlitFramebuffer"); - fp_glRenderbufferStorageMultisample = (pfn_glRenderbufferStorageMultisample)load("glRenderbufferStorageMultisample"); - fp_glFramebufferTextureLayer = (pfn_glFramebufferTextureLayer)load("glFramebufferTextureLayer"); - fp_glMapBufferRange = (pfn_glMapBufferRange)load("glMapBufferRange"); - fp_glFlushMappedBufferRange = (pfn_glFlushMappedBufferRange)load("glFlushMappedBufferRange"); - fp_glBindVertexArray = (pfn_glBindVertexArray)load("glBindVertexArray"); - fp_glDeleteVertexArrays = (pfn_glDeleteVertexArrays)load("glDeleteVertexArrays"); - fp_glGenVertexArrays = (pfn_glGenVertexArrays)load("glGenVertexArrays"); - fp_glIsVertexArray = (pfn_glIsVertexArray)load("glIsVertexArray"); - fp_glGetIntegeri_v = (pfn_glGetIntegeri_v)load("glGetIntegeri_v"); - fp_glBeginTransformFeedback = (pfn_glBeginTransformFeedback)load("glBeginTransformFeedback"); - fp_glEndTransformFeedback = (pfn_glEndTransformFeedback)load("glEndTransformFeedback"); - fp_glBindBufferRange = (pfn_glBindBufferRange)load("glBindBufferRange"); - fp_glBindBufferBase = (pfn_glBindBufferBase)load("glBindBufferBase"); - fp_glTransformFeedbackVaryings = (pfn_glTransformFeedbackVaryings)load("glTransformFeedbackVaryings"); - fp_glGetTransformFeedbackVarying = (pfn_glGetTransformFeedbackVarying)load("glGetTransformFeedbackVarying"); - fp_glVertexAttribIPointer = (pfn_glVertexAttribIPointer)load("glVertexAttribIPointer"); - fp_glGetVertexAttribIiv = (pfn_glGetVertexAttribIiv)load("glGetVertexAttribIiv"); - fp_glGetVertexAttribIuiv = (pfn_glGetVertexAttribIuiv)load("glGetVertexAttribIuiv"); - fp_glVertexAttribI4i = (pfn_glVertexAttribI4i)load("glVertexAttribI4i"); - fp_glVertexAttribI4ui = (pfn_glVertexAttribI4ui)load("glVertexAttribI4ui"); - fp_glVertexAttribI4iv = (pfn_glVertexAttribI4iv)load("glVertexAttribI4iv"); - fp_glVertexAttribI4uiv = (pfn_glVertexAttribI4uiv)load("glVertexAttribI4uiv"); - fp_glGetUniformuiv = (pfn_glGetUniformuiv)load("glGetUniformuiv"); - fp_glGetFragDataLocation = (pfn_glGetFragDataLocation)load("glGetFragDataLocation"); - fp_glUniform1ui = (pfn_glUniform1ui)load("glUniform1ui"); - fp_glUniform2ui = (pfn_glUniform2ui)load("glUniform2ui"); - fp_glUniform3ui = (pfn_glUniform3ui)load("glUniform3ui"); - fp_glUniform4ui = (pfn_glUniform4ui)load("glUniform4ui"); - fp_glUniform1uiv = (pfn_glUniform1uiv)load("glUniform1uiv"); - fp_glUniform2uiv = (pfn_glUniform2uiv)load("glUniform2uiv"); - fp_glUniform3uiv = (pfn_glUniform3uiv)load("glUniform3uiv"); - fp_glUniform4uiv = (pfn_glUniform4uiv)load("glUniform4uiv"); - fp_glClearBufferiv = (pfn_glClearBufferiv)load("glClearBufferiv"); - fp_glClearBufferuiv = (pfn_glClearBufferuiv)load("glClearBufferuiv"); - fp_glClearBufferfv = (pfn_glClearBufferfv)load("glClearBufferfv"); - fp_glClearBufferfi = (pfn_glClearBufferfi)load("glClearBufferfi"); - fp_glGetStringi = (pfn_glGetStringi)load("glGetStringi"); - fp_glCopyBufferSubData = (pfn_glCopyBufferSubData)load("glCopyBufferSubData"); - fp_glGetUniformIndices = (pfn_glGetUniformIndices)load("glGetUniformIndices"); - fp_glGetActiveUniformsiv = (pfn_glGetActiveUniformsiv)load("glGetActiveUniformsiv"); - fp_glGetUniformBlockIndex = (pfn_glGetUniformBlockIndex)load("glGetUniformBlockIndex"); - fp_glGetActiveUniformBlockiv = (pfn_glGetActiveUniformBlockiv)load("glGetActiveUniformBlockiv"); - fp_glGetActiveUniformBlockName = (pfn_glGetActiveUniformBlockName)load("glGetActiveUniformBlockName"); - fp_glUniformBlockBinding = (pfn_glUniformBlockBinding)load("glUniformBlockBinding"); - fp_glDrawArraysInstanced = (pfn_glDrawArraysInstanced)load("glDrawArraysInstanced"); - fp_glDrawElementsInstanced = (pfn_glDrawElementsInstanced)load("glDrawElementsInstanced"); - fp_glFenceSync = (pfn_glFenceSync)load("glFenceSync"); - fp_glIsSync = (pfn_glIsSync)load("glIsSync"); - fp_glDeleteSync = (pfn_glDeleteSync)load("glDeleteSync"); - fp_glClientWaitSync = (pfn_glClientWaitSync)load("glClientWaitSync"); - fp_glWaitSync = (pfn_glWaitSync)load("glWaitSync"); - fp_glGetInteger64v = (pfn_glGetInteger64v)load("glGetInteger64v"); - fp_glGetSynciv = (pfn_glGetSynciv)load("glGetSynciv"); - fp_glGetInteger64i_v = (pfn_glGetInteger64i_v)load("glGetInteger64i_v"); - fp_glGetBufferParameteri64v = (pfn_glGetBufferParameteri64v)load("glGetBufferParameteri64v"); - fp_glGenSamplers = (pfn_glGenSamplers)load("glGenSamplers"); - fp_glDeleteSamplers = (pfn_glDeleteSamplers)load("glDeleteSamplers"); - fp_glIsSampler = (pfn_glIsSampler)load("glIsSampler"); - fp_glBindSampler = (pfn_glBindSampler)load("glBindSampler"); - fp_glSamplerParameteri = (pfn_glSamplerParameteri)load("glSamplerParameteri"); - fp_glSamplerParameteriv = (pfn_glSamplerParameteriv)load("glSamplerParameteriv"); - fp_glSamplerParameterf = (pfn_glSamplerParameterf)load("glSamplerParameterf"); - fp_glSamplerParameterfv = (pfn_glSamplerParameterfv)load("glSamplerParameterfv"); - fp_glGetSamplerParameteriv = (pfn_glGetSamplerParameteriv)load("glGetSamplerParameteriv"); - fp_glGetSamplerParameterfv = (pfn_glGetSamplerParameterfv)load("glGetSamplerParameterfv"); - fp_glVertexAttribDivisor = (pfn_glVertexAttribDivisor)load("glVertexAttribDivisor"); - fp_glBindTransformFeedback = (pfn_glBindTransformFeedback)load("glBindTransformFeedback"); - fp_glDeleteTransformFeedbacks = (pfn_glDeleteTransformFeedbacks)load("glDeleteTransformFeedbacks"); - fp_glGenTransformFeedbacks = (pfn_glGenTransformFeedbacks)load("glGenTransformFeedbacks"); - fp_glIsTransformFeedback = (pfn_glIsTransformFeedback)load("glIsTransformFeedback"); - fp_glPauseTransformFeedback = (pfn_glPauseTransformFeedback)load("glPauseTransformFeedback"); - fp_glResumeTransformFeedback = (pfn_glResumeTransformFeedback)load("glResumeTransformFeedback"); - fp_glGetProgramBinary = (pfn_glGetProgramBinary)load("glGetProgramBinary"); - fp_glProgramBinary = (pfn_glProgramBinary)load("glProgramBinary"); - fp_glProgramParameteri = (pfn_glProgramParameteri)load("glProgramParameteri"); - fp_glInvalidateFramebuffer = (pfn_glInvalidateFramebuffer)load("glInvalidateFramebuffer"); - fp_glInvalidateSubFramebuffer = (pfn_glInvalidateSubFramebuffer)load("glInvalidateSubFramebuffer"); - fp_glTexStorage2D = (pfn_glTexStorage2D)load("glTexStorage2D"); - fp_glTexStorage3D = (pfn_glTexStorage3D)load("glTexStorage3D"); - fp_glGetInternalformativ = (pfn_glGetInternalformativ)load("glGetInternalformativ"); -} - -GLboolean GLAD_ES_VERSION_3_1 = GL_FALSE; -static void load_GL_ES_VERSION_3_1(LOADER load) { - if(!GLAD_ES_VERSION_3_1) return; - fp_glDispatchCompute = (pfn_glDispatchCompute)load("glDispatchCompute"); - fp_glDispatchComputeIndirect = (pfn_glDispatchComputeIndirect)load("glDispatchComputeIndirect"); - fp_glDrawArraysIndirect = (pfn_glDrawArraysIndirect)load("glDrawArraysIndirect"); - fp_glDrawElementsIndirect = (pfn_glDrawElementsIndirect)load("glDrawElementsIndirect"); - fp_glFramebufferParameteri = (pfn_glFramebufferParameteri)load("glFramebufferParameteri"); - fp_glGetFramebufferParameteriv = (pfn_glGetFramebufferParameteriv)load("glGetFramebufferParameteriv"); - fp_glGetProgramInterfaceiv = (pfn_glGetProgramInterfaceiv)load("glGetProgramInterfaceiv"); - fp_glGetProgramResourceIndex = (pfn_glGetProgramResourceIndex)load("glGetProgramResourceIndex"); - fp_glGetProgramResourceName = (pfn_glGetProgramResourceName)load("glGetProgramResourceName"); - fp_glGetProgramResourceiv = (pfn_glGetProgramResourceiv)load("glGetProgramResourceiv"); - fp_glGetProgramResourceLocation = (pfn_glGetProgramResourceLocation)load("glGetProgramResourceLocation"); - fp_glUseProgramStages = (pfn_glUseProgramStages)load("glUseProgramStages"); - fp_glActiveShaderProgram = (pfn_glActiveShaderProgram)load("glActiveShaderProgram"); - fp_glCreateShaderProgramv = (pfn_glCreateShaderProgramv)load("glCreateShaderProgramv"); - fp_glBindProgramPipeline = (pfn_glBindProgramPipeline)load("glBindProgramPipeline"); - fp_glDeleteProgramPipelines = (pfn_glDeleteProgramPipelines)load("glDeleteProgramPipelines"); - fp_glGenProgramPipelines = (pfn_glGenProgramPipelines)load("glGenProgramPipelines"); - fp_glIsProgramPipeline = (pfn_glIsProgramPipeline)load("glIsProgramPipeline"); - fp_glGetProgramPipelineiv = (pfn_glGetProgramPipelineiv)load("glGetProgramPipelineiv"); - fp_glProgramUniform1i = (pfn_glProgramUniform1i)load("glProgramUniform1i"); - fp_glProgramUniform2i = (pfn_glProgramUniform2i)load("glProgramUniform2i"); - fp_glProgramUniform3i = (pfn_glProgramUniform3i)load("glProgramUniform3i"); - fp_glProgramUniform4i = (pfn_glProgramUniform4i)load("glProgramUniform4i"); - fp_glProgramUniform1ui = (pfn_glProgramUniform1ui)load("glProgramUniform1ui"); - fp_glProgramUniform2ui = (pfn_glProgramUniform2ui)load("glProgramUniform2ui"); - fp_glProgramUniform3ui = (pfn_glProgramUniform3ui)load("glProgramUniform3ui"); - fp_glProgramUniform4ui = (pfn_glProgramUniform4ui)load("glProgramUniform4ui"); - fp_glProgramUniform1f = (pfn_glProgramUniform1f)load("glProgramUniform1f"); - fp_glProgramUniform2f = (pfn_glProgramUniform2f)load("glProgramUniform2f"); - fp_glProgramUniform3f = (pfn_glProgramUniform3f)load("glProgramUniform3f"); - fp_glProgramUniform4f = (pfn_glProgramUniform4f)load("glProgramUniform4f"); - fp_glProgramUniform1iv = (pfn_glProgramUniform1iv)load("glProgramUniform1iv"); - fp_glProgramUniform2iv = (pfn_glProgramUniform2iv)load("glProgramUniform2iv"); - fp_glProgramUniform3iv = (pfn_glProgramUniform3iv)load("glProgramUniform3iv"); - fp_glProgramUniform4iv = (pfn_glProgramUniform4iv)load("glProgramUniform4iv"); - fp_glProgramUniform1uiv = (pfn_glProgramUniform1uiv)load("glProgramUniform1uiv"); - fp_glProgramUniform2uiv = (pfn_glProgramUniform2uiv)load("glProgramUniform2uiv"); - fp_glProgramUniform3uiv = (pfn_glProgramUniform3uiv)load("glProgramUniform3uiv"); - fp_glProgramUniform4uiv = (pfn_glProgramUniform4uiv)load("glProgramUniform4uiv"); - fp_glProgramUniform1fv = (pfn_glProgramUniform1fv)load("glProgramUniform1fv"); - fp_glProgramUniform2fv = (pfn_glProgramUniform2fv)load("glProgramUniform2fv"); - fp_glProgramUniform3fv = (pfn_glProgramUniform3fv)load("glProgramUniform3fv"); - fp_glProgramUniform4fv = (pfn_glProgramUniform4fv)load("glProgramUniform4fv"); - fp_glProgramUniformMatrix2fv = (pfn_glProgramUniformMatrix2fv)load("glProgramUniformMatrix2fv"); - fp_glProgramUniformMatrix3fv = (pfn_glProgramUniformMatrix3fv)load("glProgramUniformMatrix3fv"); - fp_glProgramUniformMatrix4fv = (pfn_glProgramUniformMatrix4fv)load("glProgramUniformMatrix4fv"); - fp_glProgramUniformMatrix2x3fv = (pfn_glProgramUniformMatrix2x3fv)load("glProgramUniformMatrix2x3fv"); - fp_glProgramUniformMatrix3x2fv = (pfn_glProgramUniformMatrix3x2fv)load("glProgramUniformMatrix3x2fv"); - fp_glProgramUniformMatrix2x4fv = (pfn_glProgramUniformMatrix2x4fv)load("glProgramUniformMatrix2x4fv"); - fp_glProgramUniformMatrix4x2fv = (pfn_glProgramUniformMatrix4x2fv)load("glProgramUniformMatrix4x2fv"); - fp_glProgramUniformMatrix3x4fv = (pfn_glProgramUniformMatrix3x4fv)load("glProgramUniformMatrix3x4fv"); - fp_glProgramUniformMatrix4x3fv = (pfn_glProgramUniformMatrix4x3fv)load("glProgramUniformMatrix4x3fv"); - fp_glValidateProgramPipeline = (pfn_glValidateProgramPipeline)load("glValidateProgramPipeline"); - fp_glGetProgramPipelineInfoLog = (pfn_glGetProgramPipelineInfoLog)load("glGetProgramPipelineInfoLog"); - fp_glBindImageTexture = (pfn_glBindImageTexture)load("glBindImageTexture"); - fp_glGetBooleani_v = (pfn_glGetBooleani_v)load("glGetBooleani_v"); - fp_glMemoryBarrier = (pfn_glMemoryBarrier)load("glMemoryBarrier"); - fp_glMemoryBarrierByRegion = (pfn_glMemoryBarrierByRegion)load("glMemoryBarrierByRegion"); - fp_glTexStorage2DMultisample = (pfn_glTexStorage2DMultisample)load("glTexStorage2DMultisample"); - fp_glGetMultisamplefv = (pfn_glGetMultisamplefv)load("glGetMultisamplefv"); - fp_glSampleMaski = (pfn_glSampleMaski)load("glSampleMaski"); - fp_glGetTexLevelParameteriv = (pfn_glGetTexLevelParameteriv)load("glGetTexLevelParameteriv"); - fp_glGetTexLevelParameterfv = (pfn_glGetTexLevelParameterfv)load("glGetTexLevelParameterfv"); - fp_glBindVertexBuffer = (pfn_glBindVertexBuffer)load("glBindVertexBuffer"); - fp_glVertexAttribFormat = (pfn_glVertexAttribFormat)load("glVertexAttribFormat"); - fp_glVertexAttribIFormat = (pfn_glVertexAttribIFormat)load("glVertexAttribIFormat"); - fp_glVertexAttribBinding = (pfn_glVertexAttribBinding)load("glVertexAttribBinding"); - fp_glVertexBindingDivisor = (pfn_glVertexBindingDivisor)load("glVertexBindingDivisor"); -} - -GLboolean GLAD_ES_VERSION_3_2 = GL_FALSE; -static void load_GL_ES_VERSION_3_2(LOADER load) { - if(!GLAD_ES_VERSION_3_2) return; - fp_glBlendBarrier = (pfn_glBlendBarrier)load("glBlendBarrier"); - fp_glCopyImageSubData = (pfn_glCopyImageSubData)load("glCopyImageSubData"); - fp_glDebugMessageControl = (pfn_glDebugMessageControl)load("glDebugMessageControl"); - fp_glDebugMessageInsert = (pfn_glDebugMessageInsert)load("glDebugMessageInsert"); - fp_glDebugMessageCallback = (pfn_glDebugMessageCallback)load("glDebugMessageCallback"); - fp_glGetDebugMessageLog = (pfn_glGetDebugMessageLog)load("glGetDebugMessageLog"); - fp_glPushDebugGroup = (pfn_glPushDebugGroup)load("glPushDebugGroup"); - fp_glPopDebugGroup = (pfn_glPopDebugGroup)load("glPopDebugGroup"); - fp_glObjectLabel = (pfn_glObjectLabel)load("glObjectLabel"); - fp_glGetObjectLabel = (pfn_glGetObjectLabel)load("glGetObjectLabel"); - fp_glObjectPtrLabel = (pfn_glObjectPtrLabel)load("glObjectPtrLabel"); - fp_glGetObjectPtrLabel = (pfn_glGetObjectPtrLabel)load("glGetObjectPtrLabel"); - fp_glGetPointerv = (pfn_glGetPointerv)load("glGetPointerv"); - fp_glEnablei = (pfn_glEnablei)load("glEnablei"); - fp_glDisablei = (pfn_glDisablei)load("glDisablei"); - fp_glBlendEquationi = (pfn_glBlendEquationi)load("glBlendEquationi"); - fp_glBlendEquationSeparatei = (pfn_glBlendEquationSeparatei)load("glBlendEquationSeparatei"); - fp_glBlendFunci = (pfn_glBlendFunci)load("glBlendFunci"); - fp_glBlendFuncSeparatei = (pfn_glBlendFuncSeparatei)load("glBlendFuncSeparatei"); - fp_glColorMaski = (pfn_glColorMaski)load("glColorMaski"); - fp_glIsEnabledi = (pfn_glIsEnabledi)load("glIsEnabledi"); - fp_glDrawElementsBaseVertex = (pfn_glDrawElementsBaseVertex)load("glDrawElementsBaseVertex"); - fp_glDrawRangeElementsBaseVertex = (pfn_glDrawRangeElementsBaseVertex)load("glDrawRangeElementsBaseVertex"); - fp_glDrawElementsInstancedBaseVertex = (pfn_glDrawElementsInstancedBaseVertex)load("glDrawElementsInstancedBaseVertex"); - fp_glFramebufferTexture = (pfn_glFramebufferTexture)load("glFramebufferTexture"); - fp_glPrimitiveBoundingBox = (pfn_glPrimitiveBoundingBox)load("glPrimitiveBoundingBox"); - fp_glGetGraphicsResetStatus = (pfn_glGetGraphicsResetStatus)load("glGetGraphicsResetStatus"); - fp_glReadnPixels = (pfn_glReadnPixels)load("glReadnPixels"); - fp_glGetnUniformfv = (pfn_glGetnUniformfv)load("glGetnUniformfv"); - fp_glGetnUniformiv = (pfn_glGetnUniformiv)load("glGetnUniformiv"); - fp_glGetnUniformuiv = (pfn_glGetnUniformuiv)load("glGetnUniformuiv"); - fp_glMinSampleShading = (pfn_glMinSampleShading)load("glMinSampleShading"); - fp_glPatchParameteri = (pfn_glPatchParameteri)load("glPatchParameteri"); - fp_glTexParameterIiv = (pfn_glTexParameterIiv)load("glTexParameterIiv"); - fp_glTexParameterIuiv = (pfn_glTexParameterIuiv)load("glTexParameterIuiv"); - fp_glGetTexParameterIiv = (pfn_glGetTexParameterIiv)load("glGetTexParameterIiv"); - fp_glGetTexParameterIuiv = (pfn_glGetTexParameterIuiv)load("glGetTexParameterIuiv"); - fp_glSamplerParameterIiv = (pfn_glSamplerParameterIiv)load("glSamplerParameterIiv"); - fp_glSamplerParameterIuiv = (pfn_glSamplerParameterIuiv)load("glSamplerParameterIuiv"); - fp_glGetSamplerParameterIiv = (pfn_glGetSamplerParameterIiv)load("glGetSamplerParameterIiv"); - fp_glGetSamplerParameterIuiv = (pfn_glGetSamplerParameterIuiv)load("glGetSamplerParameterIuiv"); - fp_glTexBuffer = (pfn_glTexBuffer)load("glTexBuffer"); - fp_glTexBufferRange = (pfn_glTexBufferRange)load("glTexBufferRange"); - fp_glTexStorage3DMultisample = (pfn_glTexStorage3DMultisample)load("glTexStorage3DMultisample"); -} - -GLboolean GLAD_KHR_blend_equation_advanced = GL_FALSE; -static void load_GL_KHR_blend_equation_advanced(LOADER load) { - if(!GLAD_KHR_blend_equation_advanced) return; - fp_glBlendBarrierKHR = (pfn_glBlendBarrierKHR)load("glBlendBarrierKHR"); -} - -GLboolean GLAD_KHR_blend_equation_advanced_coherent = GL_FALSE; -GLboolean GLAD_KHR_context_flush_control = GL_FALSE; -GLboolean GLAD_KHR_debug = GL_FALSE; -static void load_GL_KHR_debug(LOADER load) { - if(!GLAD_KHR_debug) return; - fp_glDebugMessageControl = (pfn_glDebugMessageControl)load("glDebugMessageControl"); - fp_glDebugMessageInsert = (pfn_glDebugMessageInsert)load("glDebugMessageInsert"); - fp_glDebugMessageCallback = (pfn_glDebugMessageCallback)load("glDebugMessageCallback"); - fp_glGetDebugMessageLog = (pfn_glGetDebugMessageLog)load("glGetDebugMessageLog"); - fp_glPushDebugGroup = (pfn_glPushDebugGroup)load("glPushDebugGroup"); - fp_glPopDebugGroup = (pfn_glPopDebugGroup)load("glPopDebugGroup"); - fp_glObjectLabel = (pfn_glObjectLabel)load("glObjectLabel"); - fp_glGetObjectLabel = (pfn_glGetObjectLabel)load("glGetObjectLabel"); - fp_glObjectPtrLabel = (pfn_glObjectPtrLabel)load("glObjectPtrLabel"); - fp_glGetObjectPtrLabel = (pfn_glGetObjectPtrLabel)load("glGetObjectPtrLabel"); - fp_glGetPointerv = (pfn_glGetPointerv)load("glGetPointerv"); - fp_glDebugMessageControlKHR = (pfn_glDebugMessageControlKHR)load("glDebugMessageControlKHR"); - fp_glDebugMessageInsertKHR = (pfn_glDebugMessageInsertKHR)load("glDebugMessageInsertKHR"); - fp_glDebugMessageCallbackKHR = (pfn_glDebugMessageCallbackKHR)load("glDebugMessageCallbackKHR"); - fp_glGetDebugMessageLogKHR = (pfn_glGetDebugMessageLogKHR)load("glGetDebugMessageLogKHR"); - fp_glPushDebugGroupKHR = (pfn_glPushDebugGroupKHR)load("glPushDebugGroupKHR"); - fp_glPopDebugGroupKHR = (pfn_glPopDebugGroupKHR)load("glPopDebugGroupKHR"); - fp_glObjectLabelKHR = (pfn_glObjectLabelKHR)load("glObjectLabelKHR"); - fp_glGetObjectLabelKHR = (pfn_glGetObjectLabelKHR)load("glGetObjectLabelKHR"); - fp_glObjectPtrLabelKHR = (pfn_glObjectPtrLabelKHR)load("glObjectPtrLabelKHR"); - fp_glGetObjectPtrLabelKHR = (pfn_glGetObjectPtrLabelKHR)load("glGetObjectPtrLabelKHR"); - fp_glGetPointervKHR = (pfn_glGetPointervKHR)load("glGetPointervKHR"); -} - -GLboolean GLAD_KHR_no_error = GL_FALSE; -GLboolean GLAD_KHR_robust_buffer_access_behavior = GL_FALSE; -GLboolean GLAD_KHR_robustness = GL_FALSE; -static void load_GL_KHR_robustness(LOADER load) { - if(!GLAD_KHR_robustness) return; - fp_glGetGraphicsResetStatus = (pfn_glGetGraphicsResetStatus)load("glGetGraphicsResetStatus"); - fp_glReadnPixels = (pfn_glReadnPixels)load("glReadnPixels"); - fp_glGetnUniformfv = (pfn_glGetnUniformfv)load("glGetnUniformfv"); - fp_glGetnUniformiv = (pfn_glGetnUniformiv)load("glGetnUniformiv"); - fp_glGetnUniformuiv = (pfn_glGetnUniformuiv)load("glGetnUniformuiv"); - fp_glGetGraphicsResetStatusKHR = (pfn_glGetGraphicsResetStatusKHR)load("glGetGraphicsResetStatusKHR"); - fp_glReadnPixelsKHR = (pfn_glReadnPixelsKHR)load("glReadnPixelsKHR"); - fp_glGetnUniformfvKHR = (pfn_glGetnUniformfvKHR)load("glGetnUniformfvKHR"); - fp_glGetnUniformivKHR = (pfn_glGetnUniformivKHR)load("glGetnUniformivKHR"); - fp_glGetnUniformuivKHR = (pfn_glGetnUniformuivKHR)load("glGetnUniformuivKHR"); -} - -GLboolean GLAD_KHR_texture_compression_astc_hdr = GL_FALSE; -GLboolean GLAD_KHR_texture_compression_astc_ldr = GL_FALSE; -GLboolean GLAD_KHR_texture_compression_astc_sliced_3d = GL_FALSE; -GLboolean GLAD_ARB_arrays_of_arrays = GL_FALSE; -GLboolean GLAD_ARB_base_instance = GL_FALSE; -static void load_GL_ARB_base_instance(LOADER load) { - if(!GLAD_ARB_base_instance) return; - fp_glDrawArraysInstancedBaseInstance = (pfn_glDrawArraysInstancedBaseInstance)load("glDrawArraysInstancedBaseInstance"); - fp_glDrawElementsInstancedBaseInstance = (pfn_glDrawElementsInstancedBaseInstance)load("glDrawElementsInstancedBaseInstance"); - fp_glDrawElementsInstancedBaseVertexBaseInstance = (pfn_glDrawElementsInstancedBaseVertexBaseInstance)load("glDrawElementsInstancedBaseVertexBaseInstance"); -} - -GLboolean GLAD_ARB_bindless_texture = GL_FALSE; -static void load_GL_ARB_bindless_texture(LOADER load) { - if(!GLAD_ARB_bindless_texture) return; - fp_glGetTextureHandleARB = (pfn_glGetTextureHandleARB)load("glGetTextureHandleARB"); - fp_glGetTextureSamplerHandleARB = (pfn_glGetTextureSamplerHandleARB)load("glGetTextureSamplerHandleARB"); - fp_glMakeTextureHandleResidentARB = (pfn_glMakeTextureHandleResidentARB)load("glMakeTextureHandleResidentARB"); - fp_glMakeTextureHandleNonResidentARB = (pfn_glMakeTextureHandleNonResidentARB)load("glMakeTextureHandleNonResidentARB"); - fp_glGetImageHandleARB = (pfn_glGetImageHandleARB)load("glGetImageHandleARB"); - fp_glMakeImageHandleResidentARB = (pfn_glMakeImageHandleResidentARB)load("glMakeImageHandleResidentARB"); - fp_glMakeImageHandleNonResidentARB = (pfn_glMakeImageHandleNonResidentARB)load("glMakeImageHandleNonResidentARB"); - fp_glUniformHandleui64ARB = (pfn_glUniformHandleui64ARB)load("glUniformHandleui64ARB"); - fp_glUniformHandleui64vARB = (pfn_glUniformHandleui64vARB)load("glUniformHandleui64vARB"); - fp_glProgramUniformHandleui64ARB = (pfn_glProgramUniformHandleui64ARB)load("glProgramUniformHandleui64ARB"); - fp_glProgramUniformHandleui64vARB = (pfn_glProgramUniformHandleui64vARB)load("glProgramUniformHandleui64vARB"); - fp_glIsTextureHandleResidentARB = (pfn_glIsTextureHandleResidentARB)load("glIsTextureHandleResidentARB"); - fp_glIsImageHandleResidentARB = (pfn_glIsImageHandleResidentARB)load("glIsImageHandleResidentARB"); - fp_glVertexAttribL1ui64ARB = (pfn_glVertexAttribL1ui64ARB)load("glVertexAttribL1ui64ARB"); - fp_glVertexAttribL1ui64vARB = (pfn_glVertexAttribL1ui64vARB)load("glVertexAttribL1ui64vARB"); - fp_glGetVertexAttribLui64vARB = (pfn_glGetVertexAttribLui64vARB)load("glGetVertexAttribLui64vARB"); -} - -GLboolean GLAD_ARB_blend_func_extended = GL_FALSE; -static void load_GL_ARB_blend_func_extended(LOADER load) { - if(!GLAD_ARB_blend_func_extended) return; - fp_glBindFragDataLocationIndexed = (pfn_glBindFragDataLocationIndexed)load("glBindFragDataLocationIndexed"); - fp_glGetFragDataIndex = (pfn_glGetFragDataIndex)load("glGetFragDataIndex"); -} - -GLboolean GLAD_ARB_buffer_storage = GL_FALSE; -static void load_GL_ARB_buffer_storage(LOADER load) { - if(!GLAD_ARB_buffer_storage) return; - fp_glBufferStorage = (pfn_glBufferStorage)load("glBufferStorage"); -} - -GLboolean GLAD_ARB_cl_event = GL_FALSE; -static void load_GL_ARB_cl_event(LOADER load) { - if(!GLAD_ARB_cl_event) return; - fp_glCreateSyncFromCLeventARB = (pfn_glCreateSyncFromCLeventARB)load("glCreateSyncFromCLeventARB"); -} - -GLboolean GLAD_ARB_clear_buffer_object = GL_FALSE; -static void load_GL_ARB_clear_buffer_object(LOADER load) { - if(!GLAD_ARB_clear_buffer_object) return; - fp_glClearBufferData = (pfn_glClearBufferData)load("glClearBufferData"); - fp_glClearBufferSubData = (pfn_glClearBufferSubData)load("glClearBufferSubData"); -} - -GLboolean GLAD_ARB_clear_texture = GL_FALSE; -static void load_GL_ARB_clear_texture(LOADER load) { - if(!GLAD_ARB_clear_texture) return; - fp_glClearTexImage = (pfn_glClearTexImage)load("glClearTexImage"); - fp_glClearTexSubImage = (pfn_glClearTexSubImage)load("glClearTexSubImage"); -} - -GLboolean GLAD_ARB_clip_control = GL_FALSE; -static void load_GL_ARB_clip_control(LOADER load) { - if(!GLAD_ARB_clip_control) return; - fp_glClipControl = (pfn_glClipControl)load("glClipControl"); -} - -GLboolean GLAD_ARB_color_buffer_float = GL_FALSE; -static void load_GL_ARB_color_buffer_float(LOADER load) { - if(!GLAD_ARB_color_buffer_float) return; - fp_glClampColorARB = (pfn_glClampColorARB)load("glClampColorARB"); -} - -GLboolean GLAD_ARB_compatibility = GL_FALSE; -GLboolean GLAD_ARB_compressed_texture_pixel_storage = GL_FALSE; -GLboolean GLAD_ARB_compute_shader = GL_FALSE; -static void load_GL_ARB_compute_shader(LOADER load) { - if(!GLAD_ARB_compute_shader) return; - fp_glDispatchCompute = (pfn_glDispatchCompute)load("glDispatchCompute"); - fp_glDispatchComputeIndirect = (pfn_glDispatchComputeIndirect)load("glDispatchComputeIndirect"); -} - -GLboolean GLAD_ARB_compute_variable_group_size = GL_FALSE; -static void load_GL_ARB_compute_variable_group_size(LOADER load) { - if(!GLAD_ARB_compute_variable_group_size) return; - fp_glDispatchComputeGroupSizeARB = (pfn_glDispatchComputeGroupSizeARB)load("glDispatchComputeGroupSizeARB"); -} - -GLboolean GLAD_ARB_conditional_render_inverted = GL_FALSE; -GLboolean GLAD_ARB_conservative_depth = GL_FALSE; -GLboolean GLAD_ARB_copy_buffer = GL_FALSE; -static void load_GL_ARB_copy_buffer(LOADER load) { - if(!GLAD_ARB_copy_buffer) return; - fp_glCopyBufferSubData = (pfn_glCopyBufferSubData)load("glCopyBufferSubData"); -} - -GLboolean GLAD_ARB_copy_image = GL_FALSE; -static void load_GL_ARB_copy_image(LOADER load) { - if(!GLAD_ARB_copy_image) return; - fp_glCopyImageSubData = (pfn_glCopyImageSubData)load("glCopyImageSubData"); -} - -GLboolean GLAD_ARB_cull_distance = GL_FALSE; -GLboolean GLAD_ARB_debug_output = GL_FALSE; -static void load_GL_ARB_debug_output(LOADER load) { - if(!GLAD_ARB_debug_output) return; - fp_glDebugMessageControlARB = (pfn_glDebugMessageControlARB)load("glDebugMessageControlARB"); - fp_glDebugMessageInsertARB = (pfn_glDebugMessageInsertARB)load("glDebugMessageInsertARB"); - fp_glDebugMessageCallbackARB = (pfn_glDebugMessageCallbackARB)load("glDebugMessageCallbackARB"); - fp_glGetDebugMessageLogARB = (pfn_glGetDebugMessageLogARB)load("glGetDebugMessageLogARB"); -} - -GLboolean GLAD_ARB_depth_buffer_float = GL_FALSE; -GLboolean GLAD_ARB_depth_clamp = GL_FALSE; -GLboolean GLAD_ARB_derivative_control = GL_FALSE; -GLboolean GLAD_ARB_direct_state_access = GL_FALSE; -static void load_GL_ARB_direct_state_access(LOADER load) { - if(!GLAD_ARB_direct_state_access) return; - fp_glCreateTransformFeedbacks = (pfn_glCreateTransformFeedbacks)load("glCreateTransformFeedbacks"); - fp_glTransformFeedbackBufferBase = (pfn_glTransformFeedbackBufferBase)load("glTransformFeedbackBufferBase"); - fp_glTransformFeedbackBufferRange = (pfn_glTransformFeedbackBufferRange)load("glTransformFeedbackBufferRange"); - fp_glGetTransformFeedbackiv = (pfn_glGetTransformFeedbackiv)load("glGetTransformFeedbackiv"); - fp_glGetTransformFeedbacki_v = (pfn_glGetTransformFeedbacki_v)load("glGetTransformFeedbacki_v"); - fp_glGetTransformFeedbacki64_v = (pfn_glGetTransformFeedbacki64_v)load("glGetTransformFeedbacki64_v"); - fp_glCreateBuffers = (pfn_glCreateBuffers)load("glCreateBuffers"); - fp_glNamedBufferStorage = (pfn_glNamedBufferStorage)load("glNamedBufferStorage"); - fp_glNamedBufferData = (pfn_glNamedBufferData)load("glNamedBufferData"); - fp_glNamedBufferSubData = (pfn_glNamedBufferSubData)load("glNamedBufferSubData"); - fp_glCopyNamedBufferSubData = (pfn_glCopyNamedBufferSubData)load("glCopyNamedBufferSubData"); - fp_glClearNamedBufferData = (pfn_glClearNamedBufferData)load("glClearNamedBufferData"); - fp_glClearNamedBufferSubData = (pfn_glClearNamedBufferSubData)load("glClearNamedBufferSubData"); - fp_glMapNamedBuffer = (pfn_glMapNamedBuffer)load("glMapNamedBuffer"); - fp_glMapNamedBufferRange = (pfn_glMapNamedBufferRange)load("glMapNamedBufferRange"); - fp_glUnmapNamedBuffer = (pfn_glUnmapNamedBuffer)load("glUnmapNamedBuffer"); - fp_glFlushMappedNamedBufferRange = (pfn_glFlushMappedNamedBufferRange)load("glFlushMappedNamedBufferRange"); - fp_glGetNamedBufferParameteriv = (pfn_glGetNamedBufferParameteriv)load("glGetNamedBufferParameteriv"); - fp_glGetNamedBufferParameteri64v = (pfn_glGetNamedBufferParameteri64v)load("glGetNamedBufferParameteri64v"); - fp_glGetNamedBufferPointerv = (pfn_glGetNamedBufferPointerv)load("glGetNamedBufferPointerv"); - fp_glGetNamedBufferSubData = (pfn_glGetNamedBufferSubData)load("glGetNamedBufferSubData"); - fp_glCreateFramebuffers = (pfn_glCreateFramebuffers)load("glCreateFramebuffers"); - fp_glNamedFramebufferRenderbuffer = (pfn_glNamedFramebufferRenderbuffer)load("glNamedFramebufferRenderbuffer"); - fp_glNamedFramebufferParameteri = (pfn_glNamedFramebufferParameteri)load("glNamedFramebufferParameteri"); - fp_glNamedFramebufferTexture = (pfn_glNamedFramebufferTexture)load("glNamedFramebufferTexture"); - fp_glNamedFramebufferTextureLayer = (pfn_glNamedFramebufferTextureLayer)load("glNamedFramebufferTextureLayer"); - fp_glNamedFramebufferDrawBuffer = (pfn_glNamedFramebufferDrawBuffer)load("glNamedFramebufferDrawBuffer"); - fp_glNamedFramebufferDrawBuffers = (pfn_glNamedFramebufferDrawBuffers)load("glNamedFramebufferDrawBuffers"); - fp_glNamedFramebufferReadBuffer = (pfn_glNamedFramebufferReadBuffer)load("glNamedFramebufferReadBuffer"); - fp_glInvalidateNamedFramebufferData = (pfn_glInvalidateNamedFramebufferData)load("glInvalidateNamedFramebufferData"); - fp_glInvalidateNamedFramebufferSubData = (pfn_glInvalidateNamedFramebufferSubData)load("glInvalidateNamedFramebufferSubData"); - fp_glClearNamedFramebufferiv = (pfn_glClearNamedFramebufferiv)load("glClearNamedFramebufferiv"); - fp_glClearNamedFramebufferuiv = (pfn_glClearNamedFramebufferuiv)load("glClearNamedFramebufferuiv"); - fp_glClearNamedFramebufferfv = (pfn_glClearNamedFramebufferfv)load("glClearNamedFramebufferfv"); - fp_glClearNamedFramebufferfi = (pfn_glClearNamedFramebufferfi)load("glClearNamedFramebufferfi"); - fp_glBlitNamedFramebuffer = (pfn_glBlitNamedFramebuffer)load("glBlitNamedFramebuffer"); - fp_glCheckNamedFramebufferStatus = (pfn_glCheckNamedFramebufferStatus)load("glCheckNamedFramebufferStatus"); - fp_glGetNamedFramebufferParameteriv = (pfn_glGetNamedFramebufferParameteriv)load("glGetNamedFramebufferParameteriv"); - fp_glGetNamedFramebufferAttachmentParameteriv = (pfn_glGetNamedFramebufferAttachmentParameteriv)load("glGetNamedFramebufferAttachmentParameteriv"); - fp_glCreateRenderbuffers = (pfn_glCreateRenderbuffers)load("glCreateRenderbuffers"); - fp_glNamedRenderbufferStorage = (pfn_glNamedRenderbufferStorage)load("glNamedRenderbufferStorage"); - fp_glNamedRenderbufferStorageMultisample = (pfn_glNamedRenderbufferStorageMultisample)load("glNamedRenderbufferStorageMultisample"); - fp_glGetNamedRenderbufferParameteriv = (pfn_glGetNamedRenderbufferParameteriv)load("glGetNamedRenderbufferParameteriv"); - fp_glCreateTextures = (pfn_glCreateTextures)load("glCreateTextures"); - fp_glTextureBuffer = (pfn_glTextureBuffer)load("glTextureBuffer"); - fp_glTextureBufferRange = (pfn_glTextureBufferRange)load("glTextureBufferRange"); - fp_glTextureStorage1D = (pfn_glTextureStorage1D)load("glTextureStorage1D"); - fp_glTextureStorage2D = (pfn_glTextureStorage2D)load("glTextureStorage2D"); - fp_glTextureStorage3D = (pfn_glTextureStorage3D)load("glTextureStorage3D"); - fp_glTextureStorage2DMultisample = (pfn_glTextureStorage2DMultisample)load("glTextureStorage2DMultisample"); - fp_glTextureStorage3DMultisample = (pfn_glTextureStorage3DMultisample)load("glTextureStorage3DMultisample"); - fp_glTextureSubImage1D = (pfn_glTextureSubImage1D)load("glTextureSubImage1D"); - fp_glTextureSubImage2D = (pfn_glTextureSubImage2D)load("glTextureSubImage2D"); - fp_glTextureSubImage3D = (pfn_glTextureSubImage3D)load("glTextureSubImage3D"); - fp_glCompressedTextureSubImage1D = (pfn_glCompressedTextureSubImage1D)load("glCompressedTextureSubImage1D"); - fp_glCompressedTextureSubImage2D = (pfn_glCompressedTextureSubImage2D)load("glCompressedTextureSubImage2D"); - fp_glCompressedTextureSubImage3D = (pfn_glCompressedTextureSubImage3D)load("glCompressedTextureSubImage3D"); - fp_glCopyTextureSubImage1D = (pfn_glCopyTextureSubImage1D)load("glCopyTextureSubImage1D"); - fp_glCopyTextureSubImage2D = (pfn_glCopyTextureSubImage2D)load("glCopyTextureSubImage2D"); - fp_glCopyTextureSubImage3D = (pfn_glCopyTextureSubImage3D)load("glCopyTextureSubImage3D"); - fp_glTextureParameterf = (pfn_glTextureParameterf)load("glTextureParameterf"); - fp_glTextureParameterfv = (pfn_glTextureParameterfv)load("glTextureParameterfv"); - fp_glTextureParameteri = (pfn_glTextureParameteri)load("glTextureParameteri"); - fp_glTextureParameterIiv = (pfn_glTextureParameterIiv)load("glTextureParameterIiv"); - fp_glTextureParameterIuiv = (pfn_glTextureParameterIuiv)load("glTextureParameterIuiv"); - fp_glTextureParameteriv = (pfn_glTextureParameteriv)load("glTextureParameteriv"); - fp_glGenerateTextureMipmap = (pfn_glGenerateTextureMipmap)load("glGenerateTextureMipmap"); - fp_glBindTextureUnit = (pfn_glBindTextureUnit)load("glBindTextureUnit"); - fp_glGetTextureImage = (pfn_glGetTextureImage)load("glGetTextureImage"); - fp_glGetCompressedTextureImage = (pfn_glGetCompressedTextureImage)load("glGetCompressedTextureImage"); - fp_glGetTextureLevelParameterfv = (pfn_glGetTextureLevelParameterfv)load("glGetTextureLevelParameterfv"); - fp_glGetTextureLevelParameteriv = (pfn_glGetTextureLevelParameteriv)load("glGetTextureLevelParameteriv"); - fp_glGetTextureParameterfv = (pfn_glGetTextureParameterfv)load("glGetTextureParameterfv"); - fp_glGetTextureParameterIiv = (pfn_glGetTextureParameterIiv)load("glGetTextureParameterIiv"); - fp_glGetTextureParameterIuiv = (pfn_glGetTextureParameterIuiv)load("glGetTextureParameterIuiv"); - fp_glGetTextureParameteriv = (pfn_glGetTextureParameteriv)load("glGetTextureParameteriv"); - fp_glCreateVertexArrays = (pfn_glCreateVertexArrays)load("glCreateVertexArrays"); - fp_glDisableVertexArrayAttrib = (pfn_glDisableVertexArrayAttrib)load("glDisableVertexArrayAttrib"); - fp_glEnableVertexArrayAttrib = (pfn_glEnableVertexArrayAttrib)load("glEnableVertexArrayAttrib"); - fp_glVertexArrayElementBuffer = (pfn_glVertexArrayElementBuffer)load("glVertexArrayElementBuffer"); - fp_glVertexArrayVertexBuffer = (pfn_glVertexArrayVertexBuffer)load("glVertexArrayVertexBuffer"); - fp_glVertexArrayVertexBuffers = (pfn_glVertexArrayVertexBuffers)load("glVertexArrayVertexBuffers"); - fp_glVertexArrayAttribBinding = (pfn_glVertexArrayAttribBinding)load("glVertexArrayAttribBinding"); - fp_glVertexArrayAttribFormat = (pfn_glVertexArrayAttribFormat)load("glVertexArrayAttribFormat"); - fp_glVertexArrayAttribIFormat = (pfn_glVertexArrayAttribIFormat)load("glVertexArrayAttribIFormat"); - fp_glVertexArrayAttribLFormat = (pfn_glVertexArrayAttribLFormat)load("glVertexArrayAttribLFormat"); - fp_glVertexArrayBindingDivisor = (pfn_glVertexArrayBindingDivisor)load("glVertexArrayBindingDivisor"); - fp_glGetVertexArrayiv = (pfn_glGetVertexArrayiv)load("glGetVertexArrayiv"); - fp_glGetVertexArrayIndexediv = (pfn_glGetVertexArrayIndexediv)load("glGetVertexArrayIndexediv"); - fp_glGetVertexArrayIndexed64iv = (pfn_glGetVertexArrayIndexed64iv)load("glGetVertexArrayIndexed64iv"); - fp_glCreateSamplers = (pfn_glCreateSamplers)load("glCreateSamplers"); - fp_glCreateProgramPipelines = (pfn_glCreateProgramPipelines)load("glCreateProgramPipelines"); - fp_glCreateQueries = (pfn_glCreateQueries)load("glCreateQueries"); - fp_glGetQueryBufferObjecti64v = (pfn_glGetQueryBufferObjecti64v)load("glGetQueryBufferObjecti64v"); - fp_glGetQueryBufferObjectiv = (pfn_glGetQueryBufferObjectiv)load("glGetQueryBufferObjectiv"); - fp_glGetQueryBufferObjectui64v = (pfn_glGetQueryBufferObjectui64v)load("glGetQueryBufferObjectui64v"); - fp_glGetQueryBufferObjectuiv = (pfn_glGetQueryBufferObjectuiv)load("glGetQueryBufferObjectuiv"); -} - -GLboolean GLAD_ARB_draw_buffers_blend = GL_FALSE; -static void load_GL_ARB_draw_buffers_blend(LOADER load) { - if(!GLAD_ARB_draw_buffers_blend) return; - fp_glBlendEquationiARB = (pfn_glBlendEquationiARB)load("glBlendEquationiARB"); - fp_glBlendEquationSeparateiARB = (pfn_glBlendEquationSeparateiARB)load("glBlendEquationSeparateiARB"); - fp_glBlendFunciARB = (pfn_glBlendFunciARB)load("glBlendFunciARB"); - fp_glBlendFuncSeparateiARB = (pfn_glBlendFuncSeparateiARB)load("glBlendFuncSeparateiARB"); -} - -GLboolean GLAD_ARB_draw_elements_base_vertex = GL_FALSE; -static void load_GL_ARB_draw_elements_base_vertex(LOADER load) { - if(!GLAD_ARB_draw_elements_base_vertex) return; - fp_glDrawElementsBaseVertex = (pfn_glDrawElementsBaseVertex)load("glDrawElementsBaseVertex"); - fp_glDrawRangeElementsBaseVertex = (pfn_glDrawRangeElementsBaseVertex)load("glDrawRangeElementsBaseVertex"); - fp_glDrawElementsInstancedBaseVertex = (pfn_glDrawElementsInstancedBaseVertex)load("glDrawElementsInstancedBaseVertex"); - fp_glMultiDrawElementsBaseVertex = (pfn_glMultiDrawElementsBaseVertex)load("glMultiDrawElementsBaseVertex"); -} - -GLboolean GLAD_ARB_draw_indirect = GL_FALSE; -static void load_GL_ARB_draw_indirect(LOADER load) { - if(!GLAD_ARB_draw_indirect) return; - fp_glDrawArraysIndirect = (pfn_glDrawArraysIndirect)load("glDrawArraysIndirect"); - fp_glDrawElementsIndirect = (pfn_glDrawElementsIndirect)load("glDrawElementsIndirect"); -} - -GLboolean GLAD_ARB_draw_instanced = GL_FALSE; -static void load_GL_ARB_draw_instanced(LOADER load) { - if(!GLAD_ARB_draw_instanced) return; - fp_glDrawArraysInstancedARB = (pfn_glDrawArraysInstancedARB)load("glDrawArraysInstancedARB"); - fp_glDrawElementsInstancedARB = (pfn_glDrawElementsInstancedARB)load("glDrawElementsInstancedARB"); -} - -GLboolean GLAD_ARB_enhanced_layouts = GL_FALSE; -GLboolean GLAD_ARB_ES2_compatibility = GL_FALSE; -static void load_GL_ARB_ES2_compatibility(LOADER load) { - if(!GLAD_ARB_ES2_compatibility) return; - fp_glReleaseShaderCompiler = (pfn_glReleaseShaderCompiler)load("glReleaseShaderCompiler"); - fp_glShaderBinary = (pfn_glShaderBinary)load("glShaderBinary"); - fp_glGetShaderPrecisionFormat = (pfn_glGetShaderPrecisionFormat)load("glGetShaderPrecisionFormat"); - fp_glDepthRangef = (pfn_glDepthRangef)load("glDepthRangef"); - fp_glClearDepthf = (pfn_glClearDepthf)load("glClearDepthf"); -} - -GLboolean GLAD_ARB_ES3_1_compatibility = GL_FALSE; -static void load_GL_ARB_ES3_1_compatibility(LOADER load) { - if(!GLAD_ARB_ES3_1_compatibility) return; - fp_glMemoryBarrierByRegion = (pfn_glMemoryBarrierByRegion)load("glMemoryBarrierByRegion"); -} - -GLboolean GLAD_ARB_ES3_2_compatibility = GL_FALSE; -static void load_GL_ARB_ES3_2_compatibility(LOADER load) { - if(!GLAD_ARB_ES3_2_compatibility) return; - fp_glPrimitiveBoundingBoxARB = (pfn_glPrimitiveBoundingBoxARB)load("glPrimitiveBoundingBoxARB"); -} - -GLboolean GLAD_ARB_ES3_compatibility = GL_FALSE; -GLboolean GLAD_ARB_explicit_attrib_location = GL_FALSE; -GLboolean GLAD_ARB_explicit_uniform_location = GL_FALSE; -GLboolean GLAD_ARB_fragment_coord_conventions = GL_FALSE; -GLboolean GLAD_ARB_fragment_layer_viewport = GL_FALSE; -GLboolean GLAD_ARB_fragment_shader_interlock = GL_FALSE; -GLboolean GLAD_ARB_framebuffer_no_attachments = GL_FALSE; -static void load_GL_ARB_framebuffer_no_attachments(LOADER load) { - if(!GLAD_ARB_framebuffer_no_attachments) return; - fp_glFramebufferParameteri = (pfn_glFramebufferParameteri)load("glFramebufferParameteri"); - fp_glGetFramebufferParameteriv = (pfn_glGetFramebufferParameteriv)load("glGetFramebufferParameteriv"); -} - -GLboolean GLAD_ARB_framebuffer_object = GL_FALSE; -static void load_GL_ARB_framebuffer_object(LOADER load) { - if(!GLAD_ARB_framebuffer_object) return; - fp_glIsRenderbuffer = (pfn_glIsRenderbuffer)load("glIsRenderbuffer"); - fp_glBindRenderbuffer = (pfn_glBindRenderbuffer)load("glBindRenderbuffer"); - fp_glDeleteRenderbuffers = (pfn_glDeleteRenderbuffers)load("glDeleteRenderbuffers"); - fp_glGenRenderbuffers = (pfn_glGenRenderbuffers)load("glGenRenderbuffers"); - fp_glRenderbufferStorage = (pfn_glRenderbufferStorage)load("glRenderbufferStorage"); - fp_glGetRenderbufferParameteriv = (pfn_glGetRenderbufferParameteriv)load("glGetRenderbufferParameteriv"); - fp_glIsFramebuffer = (pfn_glIsFramebuffer)load("glIsFramebuffer"); - fp_glBindFramebuffer = (pfn_glBindFramebuffer)load("glBindFramebuffer"); - fp_glDeleteFramebuffers = (pfn_glDeleteFramebuffers)load("glDeleteFramebuffers"); - fp_glGenFramebuffers = (pfn_glGenFramebuffers)load("glGenFramebuffers"); - fp_glCheckFramebufferStatus = (pfn_glCheckFramebufferStatus)load("glCheckFramebufferStatus"); - fp_glFramebufferTexture1D = (pfn_glFramebufferTexture1D)load("glFramebufferTexture1D"); - fp_glFramebufferTexture2D = (pfn_glFramebufferTexture2D)load("glFramebufferTexture2D"); - fp_glFramebufferTexture3D = (pfn_glFramebufferTexture3D)load("glFramebufferTexture3D"); - fp_glFramebufferRenderbuffer = (pfn_glFramebufferRenderbuffer)load("glFramebufferRenderbuffer"); - fp_glGetFramebufferAttachmentParameteriv = (pfn_glGetFramebufferAttachmentParameteriv)load("glGetFramebufferAttachmentParameteriv"); - fp_glGenerateMipmap = (pfn_glGenerateMipmap)load("glGenerateMipmap"); - fp_glBlitFramebuffer = (pfn_glBlitFramebuffer)load("glBlitFramebuffer"); - fp_glRenderbufferStorageMultisample = (pfn_glRenderbufferStorageMultisample)load("glRenderbufferStorageMultisample"); - fp_glFramebufferTextureLayer = (pfn_glFramebufferTextureLayer)load("glFramebufferTextureLayer"); -} - -GLboolean GLAD_ARB_framebuffer_sRGB = GL_FALSE; -GLboolean GLAD_ARB_geometry_shader4 = GL_FALSE; -static void load_GL_ARB_geometry_shader4(LOADER load) { - if(!GLAD_ARB_geometry_shader4) return; - fp_glProgramParameteriARB = (pfn_glProgramParameteriARB)load("glProgramParameteriARB"); - fp_glFramebufferTextureARB = (pfn_glFramebufferTextureARB)load("glFramebufferTextureARB"); - fp_glFramebufferTextureLayerARB = (pfn_glFramebufferTextureLayerARB)load("glFramebufferTextureLayerARB"); - fp_glFramebufferTextureFaceARB = (pfn_glFramebufferTextureFaceARB)load("glFramebufferTextureFaceARB"); -} - -GLboolean GLAD_ARB_get_program_binary = GL_FALSE; -static void load_GL_ARB_get_program_binary(LOADER load) { - if(!GLAD_ARB_get_program_binary) return; - fp_glGetProgramBinary = (pfn_glGetProgramBinary)load("glGetProgramBinary"); - fp_glProgramBinary = (pfn_glProgramBinary)load("glProgramBinary"); - fp_glProgramParameteri = (pfn_glProgramParameteri)load("glProgramParameteri"); -} - -GLboolean GLAD_ARB_get_texture_sub_image = GL_FALSE; -static void load_GL_ARB_get_texture_sub_image(LOADER load) { - if(!GLAD_ARB_get_texture_sub_image) return; - fp_glGetTextureSubImage = (pfn_glGetTextureSubImage)load("glGetTextureSubImage"); - fp_glGetCompressedTextureSubImage = (pfn_glGetCompressedTextureSubImage)load("glGetCompressedTextureSubImage"); -} - -GLboolean GLAD_ARB_gpu_shader5 = GL_FALSE; -GLboolean GLAD_ARB_gpu_shader_fp64 = GL_FALSE; -static void load_GL_ARB_gpu_shader_fp64(LOADER load) { - if(!GLAD_ARB_gpu_shader_fp64) return; - fp_glUniform1d = (pfn_glUniform1d)load("glUniform1d"); - fp_glUniform2d = (pfn_glUniform2d)load("glUniform2d"); - fp_glUniform3d = (pfn_glUniform3d)load("glUniform3d"); - fp_glUniform4d = (pfn_glUniform4d)load("glUniform4d"); - fp_glUniform1dv = (pfn_glUniform1dv)load("glUniform1dv"); - fp_glUniform2dv = (pfn_glUniform2dv)load("glUniform2dv"); - fp_glUniform3dv = (pfn_glUniform3dv)load("glUniform3dv"); - fp_glUniform4dv = (pfn_glUniform4dv)load("glUniform4dv"); - fp_glUniformMatrix2dv = (pfn_glUniformMatrix2dv)load("glUniformMatrix2dv"); - fp_glUniformMatrix3dv = (pfn_glUniformMatrix3dv)load("glUniformMatrix3dv"); - fp_glUniformMatrix4dv = (pfn_glUniformMatrix4dv)load("glUniformMatrix4dv"); - fp_glUniformMatrix2x3dv = (pfn_glUniformMatrix2x3dv)load("glUniformMatrix2x3dv"); - fp_glUniformMatrix2x4dv = (pfn_glUniformMatrix2x4dv)load("glUniformMatrix2x4dv"); - fp_glUniformMatrix3x2dv = (pfn_glUniformMatrix3x2dv)load("glUniformMatrix3x2dv"); - fp_glUniformMatrix3x4dv = (pfn_glUniformMatrix3x4dv)load("glUniformMatrix3x4dv"); - fp_glUniformMatrix4x2dv = (pfn_glUniformMatrix4x2dv)load("glUniformMatrix4x2dv"); - fp_glUniformMatrix4x3dv = (pfn_glUniformMatrix4x3dv)load("glUniformMatrix4x3dv"); - fp_glGetUniformdv = (pfn_glGetUniformdv)load("glGetUniformdv"); -} - -GLboolean GLAD_ARB_gpu_shader_int64 = GL_FALSE; -static void load_GL_ARB_gpu_shader_int64(LOADER load) { - if(!GLAD_ARB_gpu_shader_int64) return; - fp_glUniform1i64ARB = (pfn_glUniform1i64ARB)load("glUniform1i64ARB"); - fp_glUniform2i64ARB = (pfn_glUniform2i64ARB)load("glUniform2i64ARB"); - fp_glUniform3i64ARB = (pfn_glUniform3i64ARB)load("glUniform3i64ARB"); - fp_glUniform4i64ARB = (pfn_glUniform4i64ARB)load("glUniform4i64ARB"); - fp_glUniform1i64vARB = (pfn_glUniform1i64vARB)load("glUniform1i64vARB"); - fp_glUniform2i64vARB = (pfn_glUniform2i64vARB)load("glUniform2i64vARB"); - fp_glUniform3i64vARB = (pfn_glUniform3i64vARB)load("glUniform3i64vARB"); - fp_glUniform4i64vARB = (pfn_glUniform4i64vARB)load("glUniform4i64vARB"); - fp_glUniform1ui64ARB = (pfn_glUniform1ui64ARB)load("glUniform1ui64ARB"); - fp_glUniform2ui64ARB = (pfn_glUniform2ui64ARB)load("glUniform2ui64ARB"); - fp_glUniform3ui64ARB = (pfn_glUniform3ui64ARB)load("glUniform3ui64ARB"); - fp_glUniform4ui64ARB = (pfn_glUniform4ui64ARB)load("glUniform4ui64ARB"); - fp_glUniform1ui64vARB = (pfn_glUniform1ui64vARB)load("glUniform1ui64vARB"); - fp_glUniform2ui64vARB = (pfn_glUniform2ui64vARB)load("glUniform2ui64vARB"); - fp_glUniform3ui64vARB = (pfn_glUniform3ui64vARB)load("glUniform3ui64vARB"); - fp_glUniform4ui64vARB = (pfn_glUniform4ui64vARB)load("glUniform4ui64vARB"); - fp_glGetUniformi64vARB = (pfn_glGetUniformi64vARB)load("glGetUniformi64vARB"); - fp_glGetUniformui64vARB = (pfn_glGetUniformui64vARB)load("glGetUniformui64vARB"); - fp_glGetnUniformi64vARB = (pfn_glGetnUniformi64vARB)load("glGetnUniformi64vARB"); - fp_glGetnUniformui64vARB = (pfn_glGetnUniformui64vARB)load("glGetnUniformui64vARB"); - fp_glProgramUniform1i64ARB = (pfn_glProgramUniform1i64ARB)load("glProgramUniform1i64ARB"); - fp_glProgramUniform2i64ARB = (pfn_glProgramUniform2i64ARB)load("glProgramUniform2i64ARB"); - fp_glProgramUniform3i64ARB = (pfn_glProgramUniform3i64ARB)load("glProgramUniform3i64ARB"); - fp_glProgramUniform4i64ARB = (pfn_glProgramUniform4i64ARB)load("glProgramUniform4i64ARB"); - fp_glProgramUniform1i64vARB = (pfn_glProgramUniform1i64vARB)load("glProgramUniform1i64vARB"); - fp_glProgramUniform2i64vARB = (pfn_glProgramUniform2i64vARB)load("glProgramUniform2i64vARB"); - fp_glProgramUniform3i64vARB = (pfn_glProgramUniform3i64vARB)load("glProgramUniform3i64vARB"); - fp_glProgramUniform4i64vARB = (pfn_glProgramUniform4i64vARB)load("glProgramUniform4i64vARB"); - fp_glProgramUniform1ui64ARB = (pfn_glProgramUniform1ui64ARB)load("glProgramUniform1ui64ARB"); - fp_glProgramUniform2ui64ARB = (pfn_glProgramUniform2ui64ARB)load("glProgramUniform2ui64ARB"); - fp_glProgramUniform3ui64ARB = (pfn_glProgramUniform3ui64ARB)load("glProgramUniform3ui64ARB"); - fp_glProgramUniform4ui64ARB = (pfn_glProgramUniform4ui64ARB)load("glProgramUniform4ui64ARB"); - fp_glProgramUniform1ui64vARB = (pfn_glProgramUniform1ui64vARB)load("glProgramUniform1ui64vARB"); - fp_glProgramUniform2ui64vARB = (pfn_glProgramUniform2ui64vARB)load("glProgramUniform2ui64vARB"); - fp_glProgramUniform3ui64vARB = (pfn_glProgramUniform3ui64vARB)load("glProgramUniform3ui64vARB"); - fp_glProgramUniform4ui64vARB = (pfn_glProgramUniform4ui64vARB)load("glProgramUniform4ui64vARB"); -} - -GLboolean GLAD_ARB_half_float_pixel = GL_FALSE; -GLboolean GLAD_ARB_half_float_vertex = GL_FALSE; -GLboolean GLAD_ARB_indirect_parameters = GL_FALSE; -static void load_GL_ARB_indirect_parameters(LOADER load) { - if(!GLAD_ARB_indirect_parameters) return; - fp_glMultiDrawArraysIndirectCountARB = (pfn_glMultiDrawArraysIndirectCountARB)load("glMultiDrawArraysIndirectCountARB"); - fp_glMultiDrawElementsIndirectCountARB = (pfn_glMultiDrawElementsIndirectCountARB)load("glMultiDrawElementsIndirectCountARB"); -} - -GLboolean GLAD_ARB_instanced_arrays = GL_FALSE; -static void load_GL_ARB_instanced_arrays(LOADER load) { - if(!GLAD_ARB_instanced_arrays) return; - fp_glVertexAttribDivisorARB = (pfn_glVertexAttribDivisorARB)load("glVertexAttribDivisorARB"); -} - -GLboolean GLAD_ARB_internalformat_query = GL_FALSE; -static void load_GL_ARB_internalformat_query(LOADER load) { - if(!GLAD_ARB_internalformat_query) return; - fp_glGetInternalformativ = (pfn_glGetInternalformativ)load("glGetInternalformativ"); -} - -GLboolean GLAD_ARB_internalformat_query2 = GL_FALSE; -static void load_GL_ARB_internalformat_query2(LOADER load) { - if(!GLAD_ARB_internalformat_query2) return; - fp_glGetInternalformati64v = (pfn_glGetInternalformati64v)load("glGetInternalformati64v"); -} - -GLboolean GLAD_ARB_invalidate_subdata = GL_FALSE; -static void load_GL_ARB_invalidate_subdata(LOADER load) { - if(!GLAD_ARB_invalidate_subdata) return; - fp_glInvalidateTexSubImage = (pfn_glInvalidateTexSubImage)load("glInvalidateTexSubImage"); - fp_glInvalidateTexImage = (pfn_glInvalidateTexImage)load("glInvalidateTexImage"); - fp_glInvalidateBufferSubData = (pfn_glInvalidateBufferSubData)load("glInvalidateBufferSubData"); - fp_glInvalidateBufferData = (pfn_glInvalidateBufferData)load("glInvalidateBufferData"); - fp_glInvalidateFramebuffer = (pfn_glInvalidateFramebuffer)load("glInvalidateFramebuffer"); - fp_glInvalidateSubFramebuffer = (pfn_glInvalidateSubFramebuffer)load("glInvalidateSubFramebuffer"); -} - -GLboolean GLAD_ARB_map_buffer_alignment = GL_FALSE; -GLboolean GLAD_ARB_map_buffer_range = GL_FALSE; -static void load_GL_ARB_map_buffer_range(LOADER load) { - if(!GLAD_ARB_map_buffer_range) return; - fp_glMapBufferRange = (pfn_glMapBufferRange)load("glMapBufferRange"); - fp_glFlushMappedBufferRange = (pfn_glFlushMappedBufferRange)load("glFlushMappedBufferRange"); -} - -GLboolean GLAD_ARB_multi_bind = GL_FALSE; -static void load_GL_ARB_multi_bind(LOADER load) { - if(!GLAD_ARB_multi_bind) return; - fp_glBindBuffersBase = (pfn_glBindBuffersBase)load("glBindBuffersBase"); - fp_glBindBuffersRange = (pfn_glBindBuffersRange)load("glBindBuffersRange"); - fp_glBindTextures = (pfn_glBindTextures)load("glBindTextures"); - fp_glBindSamplers = (pfn_glBindSamplers)load("glBindSamplers"); - fp_glBindImageTextures = (pfn_glBindImageTextures)load("glBindImageTextures"); - fp_glBindVertexBuffers = (pfn_glBindVertexBuffers)load("glBindVertexBuffers"); -} - -GLboolean GLAD_ARB_multi_draw_indirect = GL_FALSE; -static void load_GL_ARB_multi_draw_indirect(LOADER load) { - if(!GLAD_ARB_multi_draw_indirect) return; - fp_glMultiDrawArraysIndirect = (pfn_glMultiDrawArraysIndirect)load("glMultiDrawArraysIndirect"); - fp_glMultiDrawElementsIndirect = (pfn_glMultiDrawElementsIndirect)load("glMultiDrawElementsIndirect"); -} - -GLboolean GLAD_ARB_occlusion_query2 = GL_FALSE; -GLboolean GLAD_ARB_parallel_shader_compile = GL_FALSE; -static void load_GL_ARB_parallel_shader_compile(LOADER load) { - if(!GLAD_ARB_parallel_shader_compile) return; - fp_glMaxShaderCompilerThreadsARB = (pfn_glMaxShaderCompilerThreadsARB)load("glMaxShaderCompilerThreadsARB"); -} - -GLboolean GLAD_ARB_pipeline_statistics_query = GL_FALSE; -GLboolean GLAD_ARB_pixel_buffer_object = GL_FALSE; -GLboolean GLAD_ARB_post_depth_coverage = GL_FALSE; -GLboolean GLAD_ARB_program_interface_query = GL_FALSE; -static void load_GL_ARB_program_interface_query(LOADER load) { - if(!GLAD_ARB_program_interface_query) return; - fp_glGetProgramInterfaceiv = (pfn_glGetProgramInterfaceiv)load("glGetProgramInterfaceiv"); - fp_glGetProgramResourceIndex = (pfn_glGetProgramResourceIndex)load("glGetProgramResourceIndex"); - fp_glGetProgramResourceName = (pfn_glGetProgramResourceName)load("glGetProgramResourceName"); - fp_glGetProgramResourceiv = (pfn_glGetProgramResourceiv)load("glGetProgramResourceiv"); - fp_glGetProgramResourceLocation = (pfn_glGetProgramResourceLocation)load("glGetProgramResourceLocation"); - fp_glGetProgramResourceLocationIndex = (pfn_glGetProgramResourceLocationIndex)load("glGetProgramResourceLocationIndex"); -} - -GLboolean GLAD_ARB_provoking_vertex = GL_FALSE; -static void load_GL_ARB_provoking_vertex(LOADER load) { - if(!GLAD_ARB_provoking_vertex) return; - fp_glProvokingVertex = (pfn_glProvokingVertex)load("glProvokingVertex"); -} - -GLboolean GLAD_ARB_query_buffer_object = GL_FALSE; -GLboolean GLAD_ARB_robust_buffer_access_behavior = GL_FALSE; -GLboolean GLAD_ARB_robustness = GL_FALSE; -static void load_GL_ARB_robustness(LOADER load) { - if(!GLAD_ARB_robustness) return; - fp_glGetGraphicsResetStatusARB = (pfn_glGetGraphicsResetStatusARB)load("glGetGraphicsResetStatusARB"); - fp_glGetnTexImageARB = (pfn_glGetnTexImageARB)load("glGetnTexImageARB"); - fp_glReadnPixelsARB = (pfn_glReadnPixelsARB)load("glReadnPixelsARB"); - fp_glGetnCompressedTexImageARB = (pfn_glGetnCompressedTexImageARB)load("glGetnCompressedTexImageARB"); - fp_glGetnUniformfvARB = (pfn_glGetnUniformfvARB)load("glGetnUniformfvARB"); - fp_glGetnUniformivARB = (pfn_glGetnUniformivARB)load("glGetnUniformivARB"); - fp_glGetnUniformuivARB = (pfn_glGetnUniformuivARB)load("glGetnUniformuivARB"); - fp_glGetnUniformdvARB = (pfn_glGetnUniformdvARB)load("glGetnUniformdvARB"); - fp_glGetnMapdvARB = (pfn_glGetnMapdvARB)load("glGetnMapdvARB"); - fp_glGetnMapfvARB = (pfn_glGetnMapfvARB)load("glGetnMapfvARB"); - fp_glGetnMapivARB = (pfn_glGetnMapivARB)load("glGetnMapivARB"); - fp_glGetnPixelMapfvARB = (pfn_glGetnPixelMapfvARB)load("glGetnPixelMapfvARB"); - fp_glGetnPixelMapuivARB = (pfn_glGetnPixelMapuivARB)load("glGetnPixelMapuivARB"); - fp_glGetnPixelMapusvARB = (pfn_glGetnPixelMapusvARB)load("glGetnPixelMapusvARB"); - fp_glGetnPolygonStippleARB = (pfn_glGetnPolygonStippleARB)load("glGetnPolygonStippleARB"); - fp_glGetnColorTableARB = (pfn_glGetnColorTableARB)load("glGetnColorTableARB"); - fp_glGetnConvolutionFilterARB = (pfn_glGetnConvolutionFilterARB)load("glGetnConvolutionFilterARB"); - fp_glGetnSeparableFilterARB = (pfn_glGetnSeparableFilterARB)load("glGetnSeparableFilterARB"); - fp_glGetnHistogramARB = (pfn_glGetnHistogramARB)load("glGetnHistogramARB"); - fp_glGetnMinmaxARB = (pfn_glGetnMinmaxARB)load("glGetnMinmaxARB"); -} - -GLboolean GLAD_ARB_robustness_isolation = GL_FALSE; -GLboolean GLAD_ARB_sample_locations = GL_FALSE; -static void load_GL_ARB_sample_locations(LOADER load) { - if(!GLAD_ARB_sample_locations) return; - fp_glFramebufferSampleLocationsfvARB = (pfn_glFramebufferSampleLocationsfvARB)load("glFramebufferSampleLocationsfvARB"); - fp_glNamedFramebufferSampleLocationsfvARB = (pfn_glNamedFramebufferSampleLocationsfvARB)load("glNamedFramebufferSampleLocationsfvARB"); - fp_glEvaluateDepthValuesARB = (pfn_glEvaluateDepthValuesARB)load("glEvaluateDepthValuesARB"); -} - -GLboolean GLAD_ARB_sample_shading = GL_FALSE; -static void load_GL_ARB_sample_shading(LOADER load) { - if(!GLAD_ARB_sample_shading) return; - fp_glMinSampleShadingARB = (pfn_glMinSampleShadingARB)load("glMinSampleShadingARB"); -} - -GLboolean GLAD_ARB_sampler_objects = GL_FALSE; -static void load_GL_ARB_sampler_objects(LOADER load) { - if(!GLAD_ARB_sampler_objects) return; - fp_glGenSamplers = (pfn_glGenSamplers)load("glGenSamplers"); - fp_glDeleteSamplers = (pfn_glDeleteSamplers)load("glDeleteSamplers"); - fp_glIsSampler = (pfn_glIsSampler)load("glIsSampler"); - fp_glBindSampler = (pfn_glBindSampler)load("glBindSampler"); - fp_glSamplerParameteri = (pfn_glSamplerParameteri)load("glSamplerParameteri"); - fp_glSamplerParameteriv = (pfn_glSamplerParameteriv)load("glSamplerParameteriv"); - fp_glSamplerParameterf = (pfn_glSamplerParameterf)load("glSamplerParameterf"); - fp_glSamplerParameterfv = (pfn_glSamplerParameterfv)load("glSamplerParameterfv"); - fp_glSamplerParameterIiv = (pfn_glSamplerParameterIiv)load("glSamplerParameterIiv"); - fp_glSamplerParameterIuiv = (pfn_glSamplerParameterIuiv)load("glSamplerParameterIuiv"); - fp_glGetSamplerParameteriv = (pfn_glGetSamplerParameteriv)load("glGetSamplerParameteriv"); - fp_glGetSamplerParameterIiv = (pfn_glGetSamplerParameterIiv)load("glGetSamplerParameterIiv"); - fp_glGetSamplerParameterfv = (pfn_glGetSamplerParameterfv)load("glGetSamplerParameterfv"); - fp_glGetSamplerParameterIuiv = (pfn_glGetSamplerParameterIuiv)load("glGetSamplerParameterIuiv"); -} - -GLboolean GLAD_ARB_seamless_cube_map = GL_FALSE; -GLboolean GLAD_ARB_seamless_cubemap_per_texture = GL_FALSE; -GLboolean GLAD_ARB_separate_shader_objects = GL_FALSE; -static void load_GL_ARB_separate_shader_objects(LOADER load) { - if(!GLAD_ARB_separate_shader_objects) return; - fp_glUseProgramStages = (pfn_glUseProgramStages)load("glUseProgramStages"); - fp_glActiveShaderProgram = (pfn_glActiveShaderProgram)load("glActiveShaderProgram"); - fp_glCreateShaderProgramv = (pfn_glCreateShaderProgramv)load("glCreateShaderProgramv"); - fp_glBindProgramPipeline = (pfn_glBindProgramPipeline)load("glBindProgramPipeline"); - fp_glDeleteProgramPipelines = (pfn_glDeleteProgramPipelines)load("glDeleteProgramPipelines"); - fp_glGenProgramPipelines = (pfn_glGenProgramPipelines)load("glGenProgramPipelines"); - fp_glIsProgramPipeline = (pfn_glIsProgramPipeline)load("glIsProgramPipeline"); - fp_glGetProgramPipelineiv = (pfn_glGetProgramPipelineiv)load("glGetProgramPipelineiv"); - fp_glProgramUniform1i = (pfn_glProgramUniform1i)load("glProgramUniform1i"); - fp_glProgramUniform1iv = (pfn_glProgramUniform1iv)load("glProgramUniform1iv"); - fp_glProgramUniform1f = (pfn_glProgramUniform1f)load("glProgramUniform1f"); - fp_glProgramUniform1fv = (pfn_glProgramUniform1fv)load("glProgramUniform1fv"); - fp_glProgramUniform1d = (pfn_glProgramUniform1d)load("glProgramUniform1d"); - fp_glProgramUniform1dv = (pfn_glProgramUniform1dv)load("glProgramUniform1dv"); - fp_glProgramUniform1ui = (pfn_glProgramUniform1ui)load("glProgramUniform1ui"); - fp_glProgramUniform1uiv = (pfn_glProgramUniform1uiv)load("glProgramUniform1uiv"); - fp_glProgramUniform2i = (pfn_glProgramUniform2i)load("glProgramUniform2i"); - fp_glProgramUniform2iv = (pfn_glProgramUniform2iv)load("glProgramUniform2iv"); - fp_glProgramUniform2f = (pfn_glProgramUniform2f)load("glProgramUniform2f"); - fp_glProgramUniform2fv = (pfn_glProgramUniform2fv)load("glProgramUniform2fv"); - fp_glProgramUniform2d = (pfn_glProgramUniform2d)load("glProgramUniform2d"); - fp_glProgramUniform2dv = (pfn_glProgramUniform2dv)load("glProgramUniform2dv"); - fp_glProgramUniform2ui = (pfn_glProgramUniform2ui)load("glProgramUniform2ui"); - fp_glProgramUniform2uiv = (pfn_glProgramUniform2uiv)load("glProgramUniform2uiv"); - fp_glProgramUniform3i = (pfn_glProgramUniform3i)load("glProgramUniform3i"); - fp_glProgramUniform3iv = (pfn_glProgramUniform3iv)load("glProgramUniform3iv"); - fp_glProgramUniform3f = (pfn_glProgramUniform3f)load("glProgramUniform3f"); - fp_glProgramUniform3fv = (pfn_glProgramUniform3fv)load("glProgramUniform3fv"); - fp_glProgramUniform3d = (pfn_glProgramUniform3d)load("glProgramUniform3d"); - fp_glProgramUniform3dv = (pfn_glProgramUniform3dv)load("glProgramUniform3dv"); - fp_glProgramUniform3ui = (pfn_glProgramUniform3ui)load("glProgramUniform3ui"); - fp_glProgramUniform3uiv = (pfn_glProgramUniform3uiv)load("glProgramUniform3uiv"); - fp_glProgramUniform4i = (pfn_glProgramUniform4i)load("glProgramUniform4i"); - fp_glProgramUniform4iv = (pfn_glProgramUniform4iv)load("glProgramUniform4iv"); - fp_glProgramUniform4f = (pfn_glProgramUniform4f)load("glProgramUniform4f"); - fp_glProgramUniform4fv = (pfn_glProgramUniform4fv)load("glProgramUniform4fv"); - fp_glProgramUniform4d = (pfn_glProgramUniform4d)load("glProgramUniform4d"); - fp_glProgramUniform4dv = (pfn_glProgramUniform4dv)load("glProgramUniform4dv"); - fp_glProgramUniform4ui = (pfn_glProgramUniform4ui)load("glProgramUniform4ui"); - fp_glProgramUniform4uiv = (pfn_glProgramUniform4uiv)load("glProgramUniform4uiv"); - fp_glProgramUniformMatrix2fv = (pfn_glProgramUniformMatrix2fv)load("glProgramUniformMatrix2fv"); - fp_glProgramUniformMatrix3fv = (pfn_glProgramUniformMatrix3fv)load("glProgramUniformMatrix3fv"); - fp_glProgramUniformMatrix4fv = (pfn_glProgramUniformMatrix4fv)load("glProgramUniformMatrix4fv"); - fp_glProgramUniformMatrix2dv = (pfn_glProgramUniformMatrix2dv)load("glProgramUniformMatrix2dv"); - fp_glProgramUniformMatrix3dv = (pfn_glProgramUniformMatrix3dv)load("glProgramUniformMatrix3dv"); - fp_glProgramUniformMatrix4dv = (pfn_glProgramUniformMatrix4dv)load("glProgramUniformMatrix4dv"); - fp_glProgramUniformMatrix2x3fv = (pfn_glProgramUniformMatrix2x3fv)load("glProgramUniformMatrix2x3fv"); - fp_glProgramUniformMatrix3x2fv = (pfn_glProgramUniformMatrix3x2fv)load("glProgramUniformMatrix3x2fv"); - fp_glProgramUniformMatrix2x4fv = (pfn_glProgramUniformMatrix2x4fv)load("glProgramUniformMatrix2x4fv"); - fp_glProgramUniformMatrix4x2fv = (pfn_glProgramUniformMatrix4x2fv)load("glProgramUniformMatrix4x2fv"); - fp_glProgramUniformMatrix3x4fv = (pfn_glProgramUniformMatrix3x4fv)load("glProgramUniformMatrix3x4fv"); - fp_glProgramUniformMatrix4x3fv = (pfn_glProgramUniformMatrix4x3fv)load("glProgramUniformMatrix4x3fv"); - fp_glProgramUniformMatrix2x3dv = (pfn_glProgramUniformMatrix2x3dv)load("glProgramUniformMatrix2x3dv"); - fp_glProgramUniformMatrix3x2dv = (pfn_glProgramUniformMatrix3x2dv)load("glProgramUniformMatrix3x2dv"); - fp_glProgramUniformMatrix2x4dv = (pfn_glProgramUniformMatrix2x4dv)load("glProgramUniformMatrix2x4dv"); - fp_glProgramUniformMatrix4x2dv = (pfn_glProgramUniformMatrix4x2dv)load("glProgramUniformMatrix4x2dv"); - fp_glProgramUniformMatrix3x4dv = (pfn_glProgramUniformMatrix3x4dv)load("glProgramUniformMatrix3x4dv"); - fp_glProgramUniformMatrix4x3dv = (pfn_glProgramUniformMatrix4x3dv)load("glProgramUniformMatrix4x3dv"); - fp_glValidateProgramPipeline = (pfn_glValidateProgramPipeline)load("glValidateProgramPipeline"); - fp_glGetProgramPipelineInfoLog = (pfn_glGetProgramPipelineInfoLog)load("glGetProgramPipelineInfoLog"); -} - -GLboolean GLAD_ARB_shader_atomic_counter_ops = GL_FALSE; -GLboolean GLAD_ARB_shader_atomic_counters = GL_FALSE; -static void load_GL_ARB_shader_atomic_counters(LOADER load) { - if(!GLAD_ARB_shader_atomic_counters) return; - fp_glGetActiveAtomicCounterBufferiv = (pfn_glGetActiveAtomicCounterBufferiv)load("glGetActiveAtomicCounterBufferiv"); -} - -GLboolean GLAD_ARB_shader_ballot = GL_FALSE; -GLboolean GLAD_ARB_shader_bit_encoding = GL_FALSE; -GLboolean GLAD_ARB_shader_clock = GL_FALSE; -GLboolean GLAD_ARB_shader_draw_parameters = GL_FALSE; -GLboolean GLAD_ARB_shader_group_vote = GL_FALSE; -GLboolean GLAD_ARB_shader_image_load_store = GL_FALSE; -static void load_GL_ARB_shader_image_load_store(LOADER load) { - if(!GLAD_ARB_shader_image_load_store) return; - fp_glBindImageTexture = (pfn_glBindImageTexture)load("glBindImageTexture"); - fp_glMemoryBarrier = (pfn_glMemoryBarrier)load("glMemoryBarrier"); -} - -GLboolean GLAD_ARB_shader_image_size = GL_FALSE; -GLboolean GLAD_ARB_shader_precision = GL_FALSE; -GLboolean GLAD_ARB_shader_stencil_export = GL_FALSE; -GLboolean GLAD_ARB_shader_storage_buffer_object = GL_FALSE; -static void load_GL_ARB_shader_storage_buffer_object(LOADER load) { - if(!GLAD_ARB_shader_storage_buffer_object) return; - fp_glShaderStorageBlockBinding = (pfn_glShaderStorageBlockBinding)load("glShaderStorageBlockBinding"); -} - -GLboolean GLAD_ARB_shader_subroutine = GL_FALSE; -static void load_GL_ARB_shader_subroutine(LOADER load) { - if(!GLAD_ARB_shader_subroutine) return; - fp_glGetSubroutineUniformLocation = (pfn_glGetSubroutineUniformLocation)load("glGetSubroutineUniformLocation"); - fp_glGetSubroutineIndex = (pfn_glGetSubroutineIndex)load("glGetSubroutineIndex"); - fp_glGetActiveSubroutineUniformiv = (pfn_glGetActiveSubroutineUniformiv)load("glGetActiveSubroutineUniformiv"); - fp_glGetActiveSubroutineUniformName = (pfn_glGetActiveSubroutineUniformName)load("glGetActiveSubroutineUniformName"); - fp_glGetActiveSubroutineName = (pfn_glGetActiveSubroutineName)load("glGetActiveSubroutineName"); - fp_glUniformSubroutinesuiv = (pfn_glUniformSubroutinesuiv)load("glUniformSubroutinesuiv"); - fp_glGetUniformSubroutineuiv = (pfn_glGetUniformSubroutineuiv)load("glGetUniformSubroutineuiv"); - fp_glGetProgramStageiv = (pfn_glGetProgramStageiv)load("glGetProgramStageiv"); -} - -GLboolean GLAD_ARB_shader_texture_image_samples = GL_FALSE; -GLboolean GLAD_ARB_shader_texture_lod = GL_FALSE; -GLboolean GLAD_ARB_shader_viewport_layer_array = GL_FALSE; -GLboolean GLAD_ARB_shading_language_420pack = GL_FALSE; -GLboolean GLAD_ARB_shading_language_include = GL_FALSE; -static void load_GL_ARB_shading_language_include(LOADER load) { - if(!GLAD_ARB_shading_language_include) return; - fp_glNamedStringARB = (pfn_glNamedStringARB)load("glNamedStringARB"); - fp_glDeleteNamedStringARB = (pfn_glDeleteNamedStringARB)load("glDeleteNamedStringARB"); - fp_glCompileShaderIncludeARB = (pfn_glCompileShaderIncludeARB)load("glCompileShaderIncludeARB"); - fp_glIsNamedStringARB = (pfn_glIsNamedStringARB)load("glIsNamedStringARB"); - fp_glGetNamedStringARB = (pfn_glGetNamedStringARB)load("glGetNamedStringARB"); - fp_glGetNamedStringivARB = (pfn_glGetNamedStringivARB)load("glGetNamedStringivARB"); -} - -GLboolean GLAD_ARB_shading_language_packing = GL_FALSE; -GLboolean GLAD_ARB_sparse_buffer = GL_FALSE; -static void load_GL_ARB_sparse_buffer(LOADER load) { - if(!GLAD_ARB_sparse_buffer) return; - fp_glBufferPageCommitmentARB = (pfn_glBufferPageCommitmentARB)load("glBufferPageCommitmentARB"); - fp_glNamedBufferPageCommitmentEXT = (pfn_glNamedBufferPageCommitmentEXT)load("glNamedBufferPageCommitmentEXT"); - fp_glNamedBufferPageCommitmentARB = (pfn_glNamedBufferPageCommitmentARB)load("glNamedBufferPageCommitmentARB"); -} - -GLboolean GLAD_ARB_sparse_texture = GL_FALSE; -static void load_GL_ARB_sparse_texture(LOADER load) { - if(!GLAD_ARB_sparse_texture) return; - fp_glTexPageCommitmentARB = (pfn_glTexPageCommitmentARB)load("glTexPageCommitmentARB"); -} - -GLboolean GLAD_ARB_sparse_texture2 = GL_FALSE; -GLboolean GLAD_ARB_sparse_texture_clamp = GL_FALSE; -GLboolean GLAD_ARB_stencil_texturing = GL_FALSE; -GLboolean GLAD_ARB_sync = GL_FALSE; -static void load_GL_ARB_sync(LOADER load) { - if(!GLAD_ARB_sync) return; - fp_glFenceSync = (pfn_glFenceSync)load("glFenceSync"); - fp_glIsSync = (pfn_glIsSync)load("glIsSync"); - fp_glDeleteSync = (pfn_glDeleteSync)load("glDeleteSync"); - fp_glClientWaitSync = (pfn_glClientWaitSync)load("glClientWaitSync"); - fp_glWaitSync = (pfn_glWaitSync)load("glWaitSync"); - fp_glGetInteger64v = (pfn_glGetInteger64v)load("glGetInteger64v"); - fp_glGetSynciv = (pfn_glGetSynciv)load("glGetSynciv"); -} - -GLboolean GLAD_ARB_tessellation_shader = GL_FALSE; -static void load_GL_ARB_tessellation_shader(LOADER load) { - if(!GLAD_ARB_tessellation_shader) return; - fp_glPatchParameteri = (pfn_glPatchParameteri)load("glPatchParameteri"); - fp_glPatchParameterfv = (pfn_glPatchParameterfv)load("glPatchParameterfv"); -} - -GLboolean GLAD_ARB_texture_barrier = GL_FALSE; -static void load_GL_ARB_texture_barrier(LOADER load) { - if(!GLAD_ARB_texture_barrier) return; - fp_glTextureBarrier = (pfn_glTextureBarrier)load("glTextureBarrier"); -} - -GLboolean GLAD_ARB_texture_buffer_object = GL_FALSE; -static void load_GL_ARB_texture_buffer_object(LOADER load) { - if(!GLAD_ARB_texture_buffer_object) return; - fp_glTexBufferARB = (pfn_glTexBufferARB)load("glTexBufferARB"); -} - -GLboolean GLAD_ARB_texture_buffer_object_rgb32 = GL_FALSE; -GLboolean GLAD_ARB_texture_buffer_range = GL_FALSE; -static void load_GL_ARB_texture_buffer_range(LOADER load) { - if(!GLAD_ARB_texture_buffer_range) return; - fp_glTexBufferRange = (pfn_glTexBufferRange)load("glTexBufferRange"); -} - -GLboolean GLAD_ARB_texture_compression_bptc = GL_FALSE; -GLboolean GLAD_ARB_texture_compression_rgtc = GL_FALSE; -GLboolean GLAD_ARB_texture_cube_map_array = GL_FALSE; -GLboolean GLAD_ARB_texture_filter_minmax = GL_FALSE; -GLboolean GLAD_ARB_texture_float = GL_FALSE; -GLboolean GLAD_ARB_texture_gather = GL_FALSE; -GLboolean GLAD_ARB_texture_mirror_clamp_to_edge = GL_FALSE; -GLboolean GLAD_ARB_texture_multisample = GL_FALSE; -static void load_GL_ARB_texture_multisample(LOADER load) { - if(!GLAD_ARB_texture_multisample) return; - fp_glTexImage2DMultisample = (pfn_glTexImage2DMultisample)load("glTexImage2DMultisample"); - fp_glTexImage3DMultisample = (pfn_glTexImage3DMultisample)load("glTexImage3DMultisample"); - fp_glGetMultisamplefv = (pfn_glGetMultisamplefv)load("glGetMultisamplefv"); - fp_glSampleMaski = (pfn_glSampleMaski)load("glSampleMaski"); -} - -GLboolean GLAD_ARB_texture_query_levels = GL_FALSE; -GLboolean GLAD_ARB_texture_query_lod = GL_FALSE; -GLboolean GLAD_ARB_texture_rectangle = GL_FALSE; -GLboolean GLAD_ARB_texture_rg = GL_FALSE; -GLboolean GLAD_ARB_texture_rgb10_a2ui = GL_FALSE; -GLboolean GLAD_ARB_texture_stencil8 = GL_FALSE; -GLboolean GLAD_ARB_texture_storage = GL_FALSE; -static void load_GL_ARB_texture_storage(LOADER load) { - if(!GLAD_ARB_texture_storage) return; - fp_glTexStorage1D = (pfn_glTexStorage1D)load("glTexStorage1D"); - fp_glTexStorage2D = (pfn_glTexStorage2D)load("glTexStorage2D"); - fp_glTexStorage3D = (pfn_glTexStorage3D)load("glTexStorage3D"); -} - -GLboolean GLAD_ARB_texture_storage_multisample = GL_FALSE; -static void load_GL_ARB_texture_storage_multisample(LOADER load) { - if(!GLAD_ARB_texture_storage_multisample) return; - fp_glTexStorage2DMultisample = (pfn_glTexStorage2DMultisample)load("glTexStorage2DMultisample"); - fp_glTexStorage3DMultisample = (pfn_glTexStorage3DMultisample)load("glTexStorage3DMultisample"); -} - -GLboolean GLAD_ARB_texture_swizzle = GL_FALSE; -GLboolean GLAD_ARB_texture_view = GL_FALSE; -static void load_GL_ARB_texture_view(LOADER load) { - if(!GLAD_ARB_texture_view) return; - fp_glTextureView = (pfn_glTextureView)load("glTextureView"); -} - -GLboolean GLAD_ARB_timer_query = GL_FALSE; -static void load_GL_ARB_timer_query(LOADER load) { - if(!GLAD_ARB_timer_query) return; - fp_glQueryCounter = (pfn_glQueryCounter)load("glQueryCounter"); - fp_glGetQueryObjecti64v = (pfn_glGetQueryObjecti64v)load("glGetQueryObjecti64v"); - fp_glGetQueryObjectui64v = (pfn_glGetQueryObjectui64v)load("glGetQueryObjectui64v"); -} - -GLboolean GLAD_ARB_transform_feedback2 = GL_FALSE; -static void load_GL_ARB_transform_feedback2(LOADER load) { - if(!GLAD_ARB_transform_feedback2) return; - fp_glBindTransformFeedback = (pfn_glBindTransformFeedback)load("glBindTransformFeedback"); - fp_glDeleteTransformFeedbacks = (pfn_glDeleteTransformFeedbacks)load("glDeleteTransformFeedbacks"); - fp_glGenTransformFeedbacks = (pfn_glGenTransformFeedbacks)load("glGenTransformFeedbacks"); - fp_glIsTransformFeedback = (pfn_glIsTransformFeedback)load("glIsTransformFeedback"); - fp_glPauseTransformFeedback = (pfn_glPauseTransformFeedback)load("glPauseTransformFeedback"); - fp_glResumeTransformFeedback = (pfn_glResumeTransformFeedback)load("glResumeTransformFeedback"); - fp_glDrawTransformFeedback = (pfn_glDrawTransformFeedback)load("glDrawTransformFeedback"); -} - -GLboolean GLAD_ARB_transform_feedback3 = GL_FALSE; -static void load_GL_ARB_transform_feedback3(LOADER load) { - if(!GLAD_ARB_transform_feedback3) return; - fp_glDrawTransformFeedbackStream = (pfn_glDrawTransformFeedbackStream)load("glDrawTransformFeedbackStream"); - fp_glBeginQueryIndexed = (pfn_glBeginQueryIndexed)load("glBeginQueryIndexed"); - fp_glEndQueryIndexed = (pfn_glEndQueryIndexed)load("glEndQueryIndexed"); - fp_glGetQueryIndexediv = (pfn_glGetQueryIndexediv)load("glGetQueryIndexediv"); -} - -GLboolean GLAD_ARB_transform_feedback_instanced = GL_FALSE; -static void load_GL_ARB_transform_feedback_instanced(LOADER load) { - if(!GLAD_ARB_transform_feedback_instanced) return; - fp_glDrawTransformFeedbackInstanced = (pfn_glDrawTransformFeedbackInstanced)load("glDrawTransformFeedbackInstanced"); - fp_glDrawTransformFeedbackStreamInstanced = (pfn_glDrawTransformFeedbackStreamInstanced)load("glDrawTransformFeedbackStreamInstanced"); -} - -GLboolean GLAD_ARB_transform_feedback_overflow_query = GL_FALSE; -GLboolean GLAD_ARB_uniform_buffer_object = GL_FALSE; -static void load_GL_ARB_uniform_buffer_object(LOADER load) { - if(!GLAD_ARB_uniform_buffer_object) return; - fp_glGetUniformIndices = (pfn_glGetUniformIndices)load("glGetUniformIndices"); - fp_glGetActiveUniformsiv = (pfn_glGetActiveUniformsiv)load("glGetActiveUniformsiv"); - fp_glGetActiveUniformName = (pfn_glGetActiveUniformName)load("glGetActiveUniformName"); - fp_glGetUniformBlockIndex = (pfn_glGetUniformBlockIndex)load("glGetUniformBlockIndex"); - fp_glGetActiveUniformBlockiv = (pfn_glGetActiveUniformBlockiv)load("glGetActiveUniformBlockiv"); - fp_glGetActiveUniformBlockName = (pfn_glGetActiveUniformBlockName)load("glGetActiveUniformBlockName"); - fp_glUniformBlockBinding = (pfn_glUniformBlockBinding)load("glUniformBlockBinding"); - fp_glBindBufferRange = (pfn_glBindBufferRange)load("glBindBufferRange"); - fp_glBindBufferBase = (pfn_glBindBufferBase)load("glBindBufferBase"); - fp_glGetIntegeri_v = (pfn_glGetIntegeri_v)load("glGetIntegeri_v"); -} - -GLboolean GLAD_ARB_vertex_array_bgra = GL_FALSE; -GLboolean GLAD_ARB_vertex_array_object = GL_FALSE; -static void load_GL_ARB_vertex_array_object(LOADER load) { - if(!GLAD_ARB_vertex_array_object) return; - fp_glBindVertexArray = (pfn_glBindVertexArray)load("glBindVertexArray"); - fp_glDeleteVertexArrays = (pfn_glDeleteVertexArrays)load("glDeleteVertexArrays"); - fp_glGenVertexArrays = (pfn_glGenVertexArrays)load("glGenVertexArrays"); - fp_glIsVertexArray = (pfn_glIsVertexArray)load("glIsVertexArray"); -} - -GLboolean GLAD_ARB_vertex_attrib_64bit = GL_FALSE; -static void load_GL_ARB_vertex_attrib_64bit(LOADER load) { - if(!GLAD_ARB_vertex_attrib_64bit) return; - fp_glVertexAttribL1d = (pfn_glVertexAttribL1d)load("glVertexAttribL1d"); - fp_glVertexAttribL2d = (pfn_glVertexAttribL2d)load("glVertexAttribL2d"); - fp_glVertexAttribL3d = (pfn_glVertexAttribL3d)load("glVertexAttribL3d"); - fp_glVertexAttribL4d = (pfn_glVertexAttribL4d)load("glVertexAttribL4d"); - fp_glVertexAttribL1dv = (pfn_glVertexAttribL1dv)load("glVertexAttribL1dv"); - fp_glVertexAttribL2dv = (pfn_glVertexAttribL2dv)load("glVertexAttribL2dv"); - fp_glVertexAttribL3dv = (pfn_glVertexAttribL3dv)load("glVertexAttribL3dv"); - fp_glVertexAttribL4dv = (pfn_glVertexAttribL4dv)load("glVertexAttribL4dv"); - fp_glVertexAttribLPointer = (pfn_glVertexAttribLPointer)load("glVertexAttribLPointer"); - fp_glGetVertexAttribLdv = (pfn_glGetVertexAttribLdv)load("glGetVertexAttribLdv"); -} - -GLboolean GLAD_ARB_vertex_attrib_binding = GL_FALSE; -static void load_GL_ARB_vertex_attrib_binding(LOADER load) { - if(!GLAD_ARB_vertex_attrib_binding) return; - fp_glBindVertexBuffer = (pfn_glBindVertexBuffer)load("glBindVertexBuffer"); - fp_glVertexAttribFormat = (pfn_glVertexAttribFormat)load("glVertexAttribFormat"); - fp_glVertexAttribIFormat = (pfn_glVertexAttribIFormat)load("glVertexAttribIFormat"); - fp_glVertexAttribLFormat = (pfn_glVertexAttribLFormat)load("glVertexAttribLFormat"); - fp_glVertexAttribBinding = (pfn_glVertexAttribBinding)load("glVertexAttribBinding"); - fp_glVertexBindingDivisor = (pfn_glVertexBindingDivisor)load("glVertexBindingDivisor"); -} - -GLboolean GLAD_ARB_vertex_type_10f_11f_11f_rev = GL_FALSE; -GLboolean GLAD_ARB_vertex_type_2_10_10_10_rev = GL_FALSE; -static void load_GL_ARB_vertex_type_2_10_10_10_rev(LOADER load) { - if(!GLAD_ARB_vertex_type_2_10_10_10_rev) return; - fp_glVertexAttribP1ui = (pfn_glVertexAttribP1ui)load("glVertexAttribP1ui"); - fp_glVertexAttribP1uiv = (pfn_glVertexAttribP1uiv)load("glVertexAttribP1uiv"); - fp_glVertexAttribP2ui = (pfn_glVertexAttribP2ui)load("glVertexAttribP2ui"); - fp_glVertexAttribP2uiv = (pfn_glVertexAttribP2uiv)load("glVertexAttribP2uiv"); - fp_glVertexAttribP3ui = (pfn_glVertexAttribP3ui)load("glVertexAttribP3ui"); - fp_glVertexAttribP3uiv = (pfn_glVertexAttribP3uiv)load("glVertexAttribP3uiv"); - fp_glVertexAttribP4ui = (pfn_glVertexAttribP4ui)load("glVertexAttribP4ui"); - fp_glVertexAttribP4uiv = (pfn_glVertexAttribP4uiv)load("glVertexAttribP4uiv"); - fp_glVertexP2ui = (pfn_glVertexP2ui)load("glVertexP2ui"); - fp_glVertexP2uiv = (pfn_glVertexP2uiv)load("glVertexP2uiv"); - fp_glVertexP3ui = (pfn_glVertexP3ui)load("glVertexP3ui"); - fp_glVertexP3uiv = (pfn_glVertexP3uiv)load("glVertexP3uiv"); - fp_glVertexP4ui = (pfn_glVertexP4ui)load("glVertexP4ui"); - fp_glVertexP4uiv = (pfn_glVertexP4uiv)load("glVertexP4uiv"); - fp_glTexCoordP1ui = (pfn_glTexCoordP1ui)load("glTexCoordP1ui"); - fp_glTexCoordP1uiv = (pfn_glTexCoordP1uiv)load("glTexCoordP1uiv"); - fp_glTexCoordP2ui = (pfn_glTexCoordP2ui)load("glTexCoordP2ui"); - fp_glTexCoordP2uiv = (pfn_glTexCoordP2uiv)load("glTexCoordP2uiv"); - fp_glTexCoordP3ui = (pfn_glTexCoordP3ui)load("glTexCoordP3ui"); - fp_glTexCoordP3uiv = (pfn_glTexCoordP3uiv)load("glTexCoordP3uiv"); - fp_glTexCoordP4ui = (pfn_glTexCoordP4ui)load("glTexCoordP4ui"); - fp_glTexCoordP4uiv = (pfn_glTexCoordP4uiv)load("glTexCoordP4uiv"); - fp_glMultiTexCoordP1ui = (pfn_glMultiTexCoordP1ui)load("glMultiTexCoordP1ui"); - fp_glMultiTexCoordP1uiv = (pfn_glMultiTexCoordP1uiv)load("glMultiTexCoordP1uiv"); - fp_glMultiTexCoordP2ui = (pfn_glMultiTexCoordP2ui)load("glMultiTexCoordP2ui"); - fp_glMultiTexCoordP2uiv = (pfn_glMultiTexCoordP2uiv)load("glMultiTexCoordP2uiv"); - fp_glMultiTexCoordP3ui = (pfn_glMultiTexCoordP3ui)load("glMultiTexCoordP3ui"); - fp_glMultiTexCoordP3uiv = (pfn_glMultiTexCoordP3uiv)load("glMultiTexCoordP3uiv"); - fp_glMultiTexCoordP4ui = (pfn_glMultiTexCoordP4ui)load("glMultiTexCoordP4ui"); - fp_glMultiTexCoordP4uiv = (pfn_glMultiTexCoordP4uiv)load("glMultiTexCoordP4uiv"); - fp_glNormalP3ui = (pfn_glNormalP3ui)load("glNormalP3ui"); - fp_glNormalP3uiv = (pfn_glNormalP3uiv)load("glNormalP3uiv"); - fp_glColorP3ui = (pfn_glColorP3ui)load("glColorP3ui"); - fp_glColorP3uiv = (pfn_glColorP3uiv)load("glColorP3uiv"); - fp_glColorP4ui = (pfn_glColorP4ui)load("glColorP4ui"); - fp_glColorP4uiv = (pfn_glColorP4uiv)load("glColorP4uiv"); - fp_glSecondaryColorP3ui = (pfn_glSecondaryColorP3ui)load("glSecondaryColorP3ui"); - fp_glSecondaryColorP3uiv = (pfn_glSecondaryColorP3uiv)load("glSecondaryColorP3uiv"); -} - -GLboolean GLAD_ARB_viewport_array = GL_FALSE; -static void load_GL_ARB_viewport_array(LOADER load) { - if(!GLAD_ARB_viewport_array) return; - fp_glViewportArrayv = (pfn_glViewportArrayv)load("glViewportArrayv"); - fp_glViewportIndexedf = (pfn_glViewportIndexedf)load("glViewportIndexedf"); - fp_glViewportIndexedfv = (pfn_glViewportIndexedfv)load("glViewportIndexedfv"); - fp_glScissorArrayv = (pfn_glScissorArrayv)load("glScissorArrayv"); - fp_glScissorIndexed = (pfn_glScissorIndexed)load("glScissorIndexed"); - fp_glScissorIndexedv = (pfn_glScissorIndexedv)load("glScissorIndexedv"); - fp_glDepthRangeArrayv = (pfn_glDepthRangeArrayv)load("glDepthRangeArrayv"); - fp_glDepthRangeIndexed = (pfn_glDepthRangeIndexed)load("glDepthRangeIndexed"); - fp_glGetFloati_v = (pfn_glGetFloati_v)load("glGetFloati_v"); - fp_glGetDoublei_v = (pfn_glGetDoublei_v)load("glGetDoublei_v"); -} - -GLboolean GLAD_EXT_base_instance = GL_FALSE; -static void load_GL_EXT_base_instance(LOADER load) { - if(!GLAD_EXT_base_instance) return; - fp_glDrawArraysInstancedBaseInstanceEXT = (pfn_glDrawArraysInstancedBaseInstanceEXT)load("glDrawArraysInstancedBaseInstanceEXT"); - fp_glDrawElementsInstancedBaseInstanceEXT = (pfn_glDrawElementsInstancedBaseInstanceEXT)load("glDrawElementsInstancedBaseInstanceEXT"); - fp_glDrawElementsInstancedBaseVertexBaseInstanceEXT = (pfn_glDrawElementsInstancedBaseVertexBaseInstanceEXT)load("glDrawElementsInstancedBaseVertexBaseInstanceEXT"); -} - -GLboolean GLAD_EXT_bgra = GL_FALSE; -GLboolean GLAD_EXT_bindable_uniform = GL_FALSE; -static void load_GL_EXT_bindable_uniform(LOADER load) { - if(!GLAD_EXT_bindable_uniform) return; - fp_glUniformBufferEXT = (pfn_glUniformBufferEXT)load("glUniformBufferEXT"); - fp_glGetUniformBufferSizeEXT = (pfn_glGetUniformBufferSizeEXT)load("glGetUniformBufferSizeEXT"); - fp_glGetUniformOffsetEXT = (pfn_glGetUniformOffsetEXT)load("glGetUniformOffsetEXT"); -} - -GLboolean GLAD_EXT_blend_func_extended = GL_FALSE; -static void load_GL_EXT_blend_func_extended(LOADER load) { - if(!GLAD_EXT_blend_func_extended) return; - fp_glBindFragDataLocationIndexedEXT = (pfn_glBindFragDataLocationIndexedEXT)load("glBindFragDataLocationIndexedEXT"); - fp_glBindFragDataLocationEXT = (pfn_glBindFragDataLocationEXT)load("glBindFragDataLocationEXT"); - fp_glGetProgramResourceLocationIndexEXT = (pfn_glGetProgramResourceLocationIndexEXT)load("glGetProgramResourceLocationIndexEXT"); - fp_glGetFragDataIndexEXT = (pfn_glGetFragDataIndexEXT)load("glGetFragDataIndexEXT"); -} - -GLboolean GLAD_EXT_blend_minmax = GL_FALSE; -static void load_GL_EXT_blend_minmax(LOADER load) { - if(!GLAD_EXT_blend_minmax) return; - fp_glBlendEquationEXT = (pfn_glBlendEquationEXT)load("glBlendEquationEXT"); -} - -GLboolean GLAD_EXT_buffer_storage = GL_FALSE; -static void load_GL_EXT_buffer_storage(LOADER load) { - if(!GLAD_EXT_buffer_storage) return; - fp_glBufferStorageEXT = (pfn_glBufferStorageEXT)load("glBufferStorageEXT"); -} - -GLboolean GLAD_EXT_color_buffer_float = GL_FALSE; -GLboolean GLAD_EXT_color_buffer_half_float = GL_FALSE; -GLboolean GLAD_EXT_copy_image = GL_FALSE; -static void load_GL_EXT_copy_image(LOADER load) { - if(!GLAD_EXT_copy_image) return; - fp_glCopyImageSubDataEXT = (pfn_glCopyImageSubDataEXT)load("glCopyImageSubDataEXT"); -} - -GLboolean GLAD_EXT_debug_label = GL_FALSE; -static void load_GL_EXT_debug_label(LOADER load) { - if(!GLAD_EXT_debug_label) return; - fp_glLabelObjectEXT = (pfn_glLabelObjectEXT)load("glLabelObjectEXT"); - fp_glGetObjectLabelEXT = (pfn_glGetObjectLabelEXT)load("glGetObjectLabelEXT"); -} - -GLboolean GLAD_EXT_debug_marker = GL_FALSE; -static void load_GL_EXT_debug_marker(LOADER load) { - if(!GLAD_EXT_debug_marker) return; - fp_glInsertEventMarkerEXT = (pfn_glInsertEventMarkerEXT)load("glInsertEventMarkerEXT"); - fp_glPushGroupMarkerEXT = (pfn_glPushGroupMarkerEXT)load("glPushGroupMarkerEXT"); - fp_glPopGroupMarkerEXT = (pfn_glPopGroupMarkerEXT)load("glPopGroupMarkerEXT"); -} - -GLboolean GLAD_EXT_direct_state_access = GL_FALSE; -static void load_GL_EXT_direct_state_access(LOADER load) { - if(!GLAD_EXT_direct_state_access) return; - fp_glMatrixLoadfEXT = (pfn_glMatrixLoadfEXT)load("glMatrixLoadfEXT"); - fp_glMatrixLoaddEXT = (pfn_glMatrixLoaddEXT)load("glMatrixLoaddEXT"); - fp_glMatrixMultfEXT = (pfn_glMatrixMultfEXT)load("glMatrixMultfEXT"); - fp_glMatrixMultdEXT = (pfn_glMatrixMultdEXT)load("glMatrixMultdEXT"); - fp_glMatrixLoadIdentityEXT = (pfn_glMatrixLoadIdentityEXT)load("glMatrixLoadIdentityEXT"); - fp_glMatrixRotatefEXT = (pfn_glMatrixRotatefEXT)load("glMatrixRotatefEXT"); - fp_glMatrixRotatedEXT = (pfn_glMatrixRotatedEXT)load("glMatrixRotatedEXT"); - fp_glMatrixScalefEXT = (pfn_glMatrixScalefEXT)load("glMatrixScalefEXT"); - fp_glMatrixScaledEXT = (pfn_glMatrixScaledEXT)load("glMatrixScaledEXT"); - fp_glMatrixTranslatefEXT = (pfn_glMatrixTranslatefEXT)load("glMatrixTranslatefEXT"); - fp_glMatrixTranslatedEXT = (pfn_glMatrixTranslatedEXT)load("glMatrixTranslatedEXT"); - fp_glMatrixFrustumEXT = (pfn_glMatrixFrustumEXT)load("glMatrixFrustumEXT"); - fp_glMatrixOrthoEXT = (pfn_glMatrixOrthoEXT)load("glMatrixOrthoEXT"); - fp_glMatrixPopEXT = (pfn_glMatrixPopEXT)load("glMatrixPopEXT"); - fp_glMatrixPushEXT = (pfn_glMatrixPushEXT)load("glMatrixPushEXT"); - fp_glClientAttribDefaultEXT = (pfn_glClientAttribDefaultEXT)load("glClientAttribDefaultEXT"); - fp_glPushClientAttribDefaultEXT = (pfn_glPushClientAttribDefaultEXT)load("glPushClientAttribDefaultEXT"); - fp_glTextureParameterfEXT = (pfn_glTextureParameterfEXT)load("glTextureParameterfEXT"); - fp_glTextureParameterfvEXT = (pfn_glTextureParameterfvEXT)load("glTextureParameterfvEXT"); - fp_glTextureParameteriEXT = (pfn_glTextureParameteriEXT)load("glTextureParameteriEXT"); - fp_glTextureParameterivEXT = (pfn_glTextureParameterivEXT)load("glTextureParameterivEXT"); - fp_glTextureImage1DEXT = (pfn_glTextureImage1DEXT)load("glTextureImage1DEXT"); - fp_glTextureImage2DEXT = (pfn_glTextureImage2DEXT)load("glTextureImage2DEXT"); - fp_glTextureSubImage1DEXT = (pfn_glTextureSubImage1DEXT)load("glTextureSubImage1DEXT"); - fp_glTextureSubImage2DEXT = (pfn_glTextureSubImage2DEXT)load("glTextureSubImage2DEXT"); - fp_glCopyTextureImage1DEXT = (pfn_glCopyTextureImage1DEXT)load("glCopyTextureImage1DEXT"); - fp_glCopyTextureImage2DEXT = (pfn_glCopyTextureImage2DEXT)load("glCopyTextureImage2DEXT"); - fp_glCopyTextureSubImage1DEXT = (pfn_glCopyTextureSubImage1DEXT)load("glCopyTextureSubImage1DEXT"); - fp_glCopyTextureSubImage2DEXT = (pfn_glCopyTextureSubImage2DEXT)load("glCopyTextureSubImage2DEXT"); - fp_glGetTextureImageEXT = (pfn_glGetTextureImageEXT)load("glGetTextureImageEXT"); - fp_glGetTextureParameterfvEXT = (pfn_glGetTextureParameterfvEXT)load("glGetTextureParameterfvEXT"); - fp_glGetTextureParameterivEXT = (pfn_glGetTextureParameterivEXT)load("glGetTextureParameterivEXT"); - fp_glGetTextureLevelParameterfvEXT = (pfn_glGetTextureLevelParameterfvEXT)load("glGetTextureLevelParameterfvEXT"); - fp_glGetTextureLevelParameterivEXT = (pfn_glGetTextureLevelParameterivEXT)load("glGetTextureLevelParameterivEXT"); - fp_glTextureImage3DEXT = (pfn_glTextureImage3DEXT)load("glTextureImage3DEXT"); - fp_glTextureSubImage3DEXT = (pfn_glTextureSubImage3DEXT)load("glTextureSubImage3DEXT"); - fp_glCopyTextureSubImage3DEXT = (pfn_glCopyTextureSubImage3DEXT)load("glCopyTextureSubImage3DEXT"); - fp_glBindMultiTextureEXT = (pfn_glBindMultiTextureEXT)load("glBindMultiTextureEXT"); - fp_glMultiTexCoordPointerEXT = (pfn_glMultiTexCoordPointerEXT)load("glMultiTexCoordPointerEXT"); - fp_glMultiTexEnvfEXT = (pfn_glMultiTexEnvfEXT)load("glMultiTexEnvfEXT"); - fp_glMultiTexEnvfvEXT = (pfn_glMultiTexEnvfvEXT)load("glMultiTexEnvfvEXT"); - fp_glMultiTexEnviEXT = (pfn_glMultiTexEnviEXT)load("glMultiTexEnviEXT"); - fp_glMultiTexEnvivEXT = (pfn_glMultiTexEnvivEXT)load("glMultiTexEnvivEXT"); - fp_glMultiTexGendEXT = (pfn_glMultiTexGendEXT)load("glMultiTexGendEXT"); - fp_glMultiTexGendvEXT = (pfn_glMultiTexGendvEXT)load("glMultiTexGendvEXT"); - fp_glMultiTexGenfEXT = (pfn_glMultiTexGenfEXT)load("glMultiTexGenfEXT"); - fp_glMultiTexGenfvEXT = (pfn_glMultiTexGenfvEXT)load("glMultiTexGenfvEXT"); - fp_glMultiTexGeniEXT = (pfn_glMultiTexGeniEXT)load("glMultiTexGeniEXT"); - fp_glMultiTexGenivEXT = (pfn_glMultiTexGenivEXT)load("glMultiTexGenivEXT"); - fp_glGetMultiTexEnvfvEXT = (pfn_glGetMultiTexEnvfvEXT)load("glGetMultiTexEnvfvEXT"); - fp_glGetMultiTexEnvivEXT = (pfn_glGetMultiTexEnvivEXT)load("glGetMultiTexEnvivEXT"); - fp_glGetMultiTexGendvEXT = (pfn_glGetMultiTexGendvEXT)load("glGetMultiTexGendvEXT"); - fp_glGetMultiTexGenfvEXT = (pfn_glGetMultiTexGenfvEXT)load("glGetMultiTexGenfvEXT"); - fp_glGetMultiTexGenivEXT = (pfn_glGetMultiTexGenivEXT)load("glGetMultiTexGenivEXT"); - fp_glMultiTexParameteriEXT = (pfn_glMultiTexParameteriEXT)load("glMultiTexParameteriEXT"); - fp_glMultiTexParameterivEXT = (pfn_glMultiTexParameterivEXT)load("glMultiTexParameterivEXT"); - fp_glMultiTexParameterfEXT = (pfn_glMultiTexParameterfEXT)load("glMultiTexParameterfEXT"); - fp_glMultiTexParameterfvEXT = (pfn_glMultiTexParameterfvEXT)load("glMultiTexParameterfvEXT"); - fp_glMultiTexImage1DEXT = (pfn_glMultiTexImage1DEXT)load("glMultiTexImage1DEXT"); - fp_glMultiTexImage2DEXT = (pfn_glMultiTexImage2DEXT)load("glMultiTexImage2DEXT"); - fp_glMultiTexSubImage1DEXT = (pfn_glMultiTexSubImage1DEXT)load("glMultiTexSubImage1DEXT"); - fp_glMultiTexSubImage2DEXT = (pfn_glMultiTexSubImage2DEXT)load("glMultiTexSubImage2DEXT"); - fp_glCopyMultiTexImage1DEXT = (pfn_glCopyMultiTexImage1DEXT)load("glCopyMultiTexImage1DEXT"); - fp_glCopyMultiTexImage2DEXT = (pfn_glCopyMultiTexImage2DEXT)load("glCopyMultiTexImage2DEXT"); - fp_glCopyMultiTexSubImage1DEXT = (pfn_glCopyMultiTexSubImage1DEXT)load("glCopyMultiTexSubImage1DEXT"); - fp_glCopyMultiTexSubImage2DEXT = (pfn_glCopyMultiTexSubImage2DEXT)load("glCopyMultiTexSubImage2DEXT"); - fp_glGetMultiTexImageEXT = (pfn_glGetMultiTexImageEXT)load("glGetMultiTexImageEXT"); - fp_glGetMultiTexParameterfvEXT = (pfn_glGetMultiTexParameterfvEXT)load("glGetMultiTexParameterfvEXT"); - fp_glGetMultiTexParameterivEXT = (pfn_glGetMultiTexParameterivEXT)load("glGetMultiTexParameterivEXT"); - fp_glGetMultiTexLevelParameterfvEXT = (pfn_glGetMultiTexLevelParameterfvEXT)load("glGetMultiTexLevelParameterfvEXT"); - fp_glGetMultiTexLevelParameterivEXT = (pfn_glGetMultiTexLevelParameterivEXT)load("glGetMultiTexLevelParameterivEXT"); - fp_glMultiTexImage3DEXT = (pfn_glMultiTexImage3DEXT)load("glMultiTexImage3DEXT"); - fp_glMultiTexSubImage3DEXT = (pfn_glMultiTexSubImage3DEXT)load("glMultiTexSubImage3DEXT"); - fp_glCopyMultiTexSubImage3DEXT = (pfn_glCopyMultiTexSubImage3DEXT)load("glCopyMultiTexSubImage3DEXT"); - fp_glEnableClientStateIndexedEXT = (pfn_glEnableClientStateIndexedEXT)load("glEnableClientStateIndexedEXT"); - fp_glDisableClientStateIndexedEXT = (pfn_glDisableClientStateIndexedEXT)load("glDisableClientStateIndexedEXT"); - fp_glGetFloatIndexedvEXT = (pfn_glGetFloatIndexedvEXT)load("glGetFloatIndexedvEXT"); - fp_glGetDoubleIndexedvEXT = (pfn_glGetDoubleIndexedvEXT)load("glGetDoubleIndexedvEXT"); - fp_glGetPointerIndexedvEXT = (pfn_glGetPointerIndexedvEXT)load("glGetPointerIndexedvEXT"); - fp_glEnableIndexedEXT = (pfn_glEnableIndexedEXT)load("glEnableIndexedEXT"); - fp_glDisableIndexedEXT = (pfn_glDisableIndexedEXT)load("glDisableIndexedEXT"); - fp_glIsEnabledIndexedEXT = (pfn_glIsEnabledIndexedEXT)load("glIsEnabledIndexedEXT"); - fp_glGetIntegerIndexedvEXT = (pfn_glGetIntegerIndexedvEXT)load("glGetIntegerIndexedvEXT"); - fp_glGetBooleanIndexedvEXT = (pfn_glGetBooleanIndexedvEXT)load("glGetBooleanIndexedvEXT"); - fp_glCompressedTextureImage3DEXT = (pfn_glCompressedTextureImage3DEXT)load("glCompressedTextureImage3DEXT"); - fp_glCompressedTextureImage2DEXT = (pfn_glCompressedTextureImage2DEXT)load("glCompressedTextureImage2DEXT"); - fp_glCompressedTextureImage1DEXT = (pfn_glCompressedTextureImage1DEXT)load("glCompressedTextureImage1DEXT"); - fp_glCompressedTextureSubImage3DEXT = (pfn_glCompressedTextureSubImage3DEXT)load("glCompressedTextureSubImage3DEXT"); - fp_glCompressedTextureSubImage2DEXT = (pfn_glCompressedTextureSubImage2DEXT)load("glCompressedTextureSubImage2DEXT"); - fp_glCompressedTextureSubImage1DEXT = (pfn_glCompressedTextureSubImage1DEXT)load("glCompressedTextureSubImage1DEXT"); - fp_glGetCompressedTextureImageEXT = (pfn_glGetCompressedTextureImageEXT)load("glGetCompressedTextureImageEXT"); - fp_glCompressedMultiTexImage3DEXT = (pfn_glCompressedMultiTexImage3DEXT)load("glCompressedMultiTexImage3DEXT"); - fp_glCompressedMultiTexImage2DEXT = (pfn_glCompressedMultiTexImage2DEXT)load("glCompressedMultiTexImage2DEXT"); - fp_glCompressedMultiTexImage1DEXT = (pfn_glCompressedMultiTexImage1DEXT)load("glCompressedMultiTexImage1DEXT"); - fp_glCompressedMultiTexSubImage3DEXT = (pfn_glCompressedMultiTexSubImage3DEXT)load("glCompressedMultiTexSubImage3DEXT"); - fp_glCompressedMultiTexSubImage2DEXT = (pfn_glCompressedMultiTexSubImage2DEXT)load("glCompressedMultiTexSubImage2DEXT"); - fp_glCompressedMultiTexSubImage1DEXT = (pfn_glCompressedMultiTexSubImage1DEXT)load("glCompressedMultiTexSubImage1DEXT"); - fp_glGetCompressedMultiTexImageEXT = (pfn_glGetCompressedMultiTexImageEXT)load("glGetCompressedMultiTexImageEXT"); - fp_glMatrixLoadTransposefEXT = (pfn_glMatrixLoadTransposefEXT)load("glMatrixLoadTransposefEXT"); - fp_glMatrixLoadTransposedEXT = (pfn_glMatrixLoadTransposedEXT)load("glMatrixLoadTransposedEXT"); - fp_glMatrixMultTransposefEXT = (pfn_glMatrixMultTransposefEXT)load("glMatrixMultTransposefEXT"); - fp_glMatrixMultTransposedEXT = (pfn_glMatrixMultTransposedEXT)load("glMatrixMultTransposedEXT"); - fp_glNamedBufferDataEXT = (pfn_glNamedBufferDataEXT)load("glNamedBufferDataEXT"); - fp_glNamedBufferSubDataEXT = (pfn_glNamedBufferSubDataEXT)load("glNamedBufferSubDataEXT"); - fp_glMapNamedBufferEXT = (pfn_glMapNamedBufferEXT)load("glMapNamedBufferEXT"); - fp_glUnmapNamedBufferEXT = (pfn_glUnmapNamedBufferEXT)load("glUnmapNamedBufferEXT"); - fp_glGetNamedBufferParameterivEXT = (pfn_glGetNamedBufferParameterivEXT)load("glGetNamedBufferParameterivEXT"); - fp_glGetNamedBufferPointervEXT = (pfn_glGetNamedBufferPointervEXT)load("glGetNamedBufferPointervEXT"); - fp_glGetNamedBufferSubDataEXT = (pfn_glGetNamedBufferSubDataEXT)load("glGetNamedBufferSubDataEXT"); - fp_glProgramUniform1fEXT = (pfn_glProgramUniform1fEXT)load("glProgramUniform1fEXT"); - fp_glProgramUniform2fEXT = (pfn_glProgramUniform2fEXT)load("glProgramUniform2fEXT"); - fp_glProgramUniform3fEXT = (pfn_glProgramUniform3fEXT)load("glProgramUniform3fEXT"); - fp_glProgramUniform4fEXT = (pfn_glProgramUniform4fEXT)load("glProgramUniform4fEXT"); - fp_glProgramUniform1iEXT = (pfn_glProgramUniform1iEXT)load("glProgramUniform1iEXT"); - fp_glProgramUniform2iEXT = (pfn_glProgramUniform2iEXT)load("glProgramUniform2iEXT"); - fp_glProgramUniform3iEXT = (pfn_glProgramUniform3iEXT)load("glProgramUniform3iEXT"); - fp_glProgramUniform4iEXT = (pfn_glProgramUniform4iEXT)load("glProgramUniform4iEXT"); - fp_glProgramUniform1fvEXT = (pfn_glProgramUniform1fvEXT)load("glProgramUniform1fvEXT"); - fp_glProgramUniform2fvEXT = (pfn_glProgramUniform2fvEXT)load("glProgramUniform2fvEXT"); - fp_glProgramUniform3fvEXT = (pfn_glProgramUniform3fvEXT)load("glProgramUniform3fvEXT"); - fp_glProgramUniform4fvEXT = (pfn_glProgramUniform4fvEXT)load("glProgramUniform4fvEXT"); - fp_glProgramUniform1ivEXT = (pfn_glProgramUniform1ivEXT)load("glProgramUniform1ivEXT"); - fp_glProgramUniform2ivEXT = (pfn_glProgramUniform2ivEXT)load("glProgramUniform2ivEXT"); - fp_glProgramUniform3ivEXT = (pfn_glProgramUniform3ivEXT)load("glProgramUniform3ivEXT"); - fp_glProgramUniform4ivEXT = (pfn_glProgramUniform4ivEXT)load("glProgramUniform4ivEXT"); - fp_glProgramUniformMatrix2fvEXT = (pfn_glProgramUniformMatrix2fvEXT)load("glProgramUniformMatrix2fvEXT"); - fp_glProgramUniformMatrix3fvEXT = (pfn_glProgramUniformMatrix3fvEXT)load("glProgramUniformMatrix3fvEXT"); - fp_glProgramUniformMatrix4fvEXT = (pfn_glProgramUniformMatrix4fvEXT)load("glProgramUniformMatrix4fvEXT"); - fp_glProgramUniformMatrix2x3fvEXT = (pfn_glProgramUniformMatrix2x3fvEXT)load("glProgramUniformMatrix2x3fvEXT"); - fp_glProgramUniformMatrix3x2fvEXT = (pfn_glProgramUniformMatrix3x2fvEXT)load("glProgramUniformMatrix3x2fvEXT"); - fp_glProgramUniformMatrix2x4fvEXT = (pfn_glProgramUniformMatrix2x4fvEXT)load("glProgramUniformMatrix2x4fvEXT"); - fp_glProgramUniformMatrix4x2fvEXT = (pfn_glProgramUniformMatrix4x2fvEXT)load("glProgramUniformMatrix4x2fvEXT"); - fp_glProgramUniformMatrix3x4fvEXT = (pfn_glProgramUniformMatrix3x4fvEXT)load("glProgramUniformMatrix3x4fvEXT"); - fp_glProgramUniformMatrix4x3fvEXT = (pfn_glProgramUniformMatrix4x3fvEXT)load("glProgramUniformMatrix4x3fvEXT"); - fp_glTextureBufferEXT = (pfn_glTextureBufferEXT)load("glTextureBufferEXT"); - fp_glMultiTexBufferEXT = (pfn_glMultiTexBufferEXT)load("glMultiTexBufferEXT"); - fp_glTextureParameterIivEXT = (pfn_glTextureParameterIivEXT)load("glTextureParameterIivEXT"); - fp_glTextureParameterIuivEXT = (pfn_glTextureParameterIuivEXT)load("glTextureParameterIuivEXT"); - fp_glGetTextureParameterIivEXT = (pfn_glGetTextureParameterIivEXT)load("glGetTextureParameterIivEXT"); - fp_glGetTextureParameterIuivEXT = (pfn_glGetTextureParameterIuivEXT)load("glGetTextureParameterIuivEXT"); - fp_glMultiTexParameterIivEXT = (pfn_glMultiTexParameterIivEXT)load("glMultiTexParameterIivEXT"); - fp_glMultiTexParameterIuivEXT = (pfn_glMultiTexParameterIuivEXT)load("glMultiTexParameterIuivEXT"); - fp_glGetMultiTexParameterIivEXT = (pfn_glGetMultiTexParameterIivEXT)load("glGetMultiTexParameterIivEXT"); - fp_glGetMultiTexParameterIuivEXT = (pfn_glGetMultiTexParameterIuivEXT)load("glGetMultiTexParameterIuivEXT"); - fp_glProgramUniform1uiEXT = (pfn_glProgramUniform1uiEXT)load("glProgramUniform1uiEXT"); - fp_glProgramUniform2uiEXT = (pfn_glProgramUniform2uiEXT)load("glProgramUniform2uiEXT"); - fp_glProgramUniform3uiEXT = (pfn_glProgramUniform3uiEXT)load("glProgramUniform3uiEXT"); - fp_glProgramUniform4uiEXT = (pfn_glProgramUniform4uiEXT)load("glProgramUniform4uiEXT"); - fp_glProgramUniform1uivEXT = (pfn_glProgramUniform1uivEXT)load("glProgramUniform1uivEXT"); - fp_glProgramUniform2uivEXT = (pfn_glProgramUniform2uivEXT)load("glProgramUniform2uivEXT"); - fp_glProgramUniform3uivEXT = (pfn_glProgramUniform3uivEXT)load("glProgramUniform3uivEXT"); - fp_glProgramUniform4uivEXT = (pfn_glProgramUniform4uivEXT)load("glProgramUniform4uivEXT"); - fp_glNamedProgramLocalParameters4fvEXT = (pfn_glNamedProgramLocalParameters4fvEXT)load("glNamedProgramLocalParameters4fvEXT"); - fp_glNamedProgramLocalParameterI4iEXT = (pfn_glNamedProgramLocalParameterI4iEXT)load("glNamedProgramLocalParameterI4iEXT"); - fp_glNamedProgramLocalParameterI4ivEXT = (pfn_glNamedProgramLocalParameterI4ivEXT)load("glNamedProgramLocalParameterI4ivEXT"); - fp_glNamedProgramLocalParametersI4ivEXT = (pfn_glNamedProgramLocalParametersI4ivEXT)load("glNamedProgramLocalParametersI4ivEXT"); - fp_glNamedProgramLocalParameterI4uiEXT = (pfn_glNamedProgramLocalParameterI4uiEXT)load("glNamedProgramLocalParameterI4uiEXT"); - fp_glNamedProgramLocalParameterI4uivEXT = (pfn_glNamedProgramLocalParameterI4uivEXT)load("glNamedProgramLocalParameterI4uivEXT"); - fp_glNamedProgramLocalParametersI4uivEXT = (pfn_glNamedProgramLocalParametersI4uivEXT)load("glNamedProgramLocalParametersI4uivEXT"); - fp_glGetNamedProgramLocalParameterIivEXT = (pfn_glGetNamedProgramLocalParameterIivEXT)load("glGetNamedProgramLocalParameterIivEXT"); - fp_glGetNamedProgramLocalParameterIuivEXT = (pfn_glGetNamedProgramLocalParameterIuivEXT)load("glGetNamedProgramLocalParameterIuivEXT"); - fp_glEnableClientStateiEXT = (pfn_glEnableClientStateiEXT)load("glEnableClientStateiEXT"); - fp_glDisableClientStateiEXT = (pfn_glDisableClientStateiEXT)load("glDisableClientStateiEXT"); - fp_glGetFloati_vEXT = (pfn_glGetFloati_vEXT)load("glGetFloati_vEXT"); - fp_glGetDoublei_vEXT = (pfn_glGetDoublei_vEXT)load("glGetDoublei_vEXT"); - fp_glGetPointeri_vEXT = (pfn_glGetPointeri_vEXT)load("glGetPointeri_vEXT"); - fp_glNamedProgramStringEXT = (pfn_glNamedProgramStringEXT)load("glNamedProgramStringEXT"); - fp_glNamedProgramLocalParameter4dEXT = (pfn_glNamedProgramLocalParameter4dEXT)load("glNamedProgramLocalParameter4dEXT"); - fp_glNamedProgramLocalParameter4dvEXT = (pfn_glNamedProgramLocalParameter4dvEXT)load("glNamedProgramLocalParameter4dvEXT"); - fp_glNamedProgramLocalParameter4fEXT = (pfn_glNamedProgramLocalParameter4fEXT)load("glNamedProgramLocalParameter4fEXT"); - fp_glNamedProgramLocalParameter4fvEXT = (pfn_glNamedProgramLocalParameter4fvEXT)load("glNamedProgramLocalParameter4fvEXT"); - fp_glGetNamedProgramLocalParameterdvEXT = (pfn_glGetNamedProgramLocalParameterdvEXT)load("glGetNamedProgramLocalParameterdvEXT"); - fp_glGetNamedProgramLocalParameterfvEXT = (pfn_glGetNamedProgramLocalParameterfvEXT)load("glGetNamedProgramLocalParameterfvEXT"); - fp_glGetNamedProgramivEXT = (pfn_glGetNamedProgramivEXT)load("glGetNamedProgramivEXT"); - fp_glGetNamedProgramStringEXT = (pfn_glGetNamedProgramStringEXT)load("glGetNamedProgramStringEXT"); - fp_glNamedRenderbufferStorageEXT = (pfn_glNamedRenderbufferStorageEXT)load("glNamedRenderbufferStorageEXT"); - fp_glGetNamedRenderbufferParameterivEXT = (pfn_glGetNamedRenderbufferParameterivEXT)load("glGetNamedRenderbufferParameterivEXT"); - fp_glNamedRenderbufferStorageMultisampleEXT = (pfn_glNamedRenderbufferStorageMultisampleEXT)load("glNamedRenderbufferStorageMultisampleEXT"); - fp_glNamedRenderbufferStorageMultisampleCoverageEXT = (pfn_glNamedRenderbufferStorageMultisampleCoverageEXT)load("glNamedRenderbufferStorageMultisampleCoverageEXT"); - fp_glCheckNamedFramebufferStatusEXT = (pfn_glCheckNamedFramebufferStatusEXT)load("glCheckNamedFramebufferStatusEXT"); - fp_glNamedFramebufferTexture1DEXT = (pfn_glNamedFramebufferTexture1DEXT)load("glNamedFramebufferTexture1DEXT"); - fp_glNamedFramebufferTexture2DEXT = (pfn_glNamedFramebufferTexture2DEXT)load("glNamedFramebufferTexture2DEXT"); - fp_glNamedFramebufferTexture3DEXT = (pfn_glNamedFramebufferTexture3DEXT)load("glNamedFramebufferTexture3DEXT"); - fp_glNamedFramebufferRenderbufferEXT = (pfn_glNamedFramebufferRenderbufferEXT)load("glNamedFramebufferRenderbufferEXT"); - fp_glGetNamedFramebufferAttachmentParameterivEXT = (pfn_glGetNamedFramebufferAttachmentParameterivEXT)load("glGetNamedFramebufferAttachmentParameterivEXT"); - fp_glGenerateTextureMipmapEXT = (pfn_glGenerateTextureMipmapEXT)load("glGenerateTextureMipmapEXT"); - fp_glGenerateMultiTexMipmapEXT = (pfn_glGenerateMultiTexMipmapEXT)load("glGenerateMultiTexMipmapEXT"); - fp_glFramebufferDrawBufferEXT = (pfn_glFramebufferDrawBufferEXT)load("glFramebufferDrawBufferEXT"); - fp_glFramebufferDrawBuffersEXT = (pfn_glFramebufferDrawBuffersEXT)load("glFramebufferDrawBuffersEXT"); - fp_glFramebufferReadBufferEXT = (pfn_glFramebufferReadBufferEXT)load("glFramebufferReadBufferEXT"); - fp_glGetFramebufferParameterivEXT = (pfn_glGetFramebufferParameterivEXT)load("glGetFramebufferParameterivEXT"); - fp_glNamedCopyBufferSubDataEXT = (pfn_glNamedCopyBufferSubDataEXT)load("glNamedCopyBufferSubDataEXT"); - fp_glNamedFramebufferTextureEXT = (pfn_glNamedFramebufferTextureEXT)load("glNamedFramebufferTextureEXT"); - fp_glNamedFramebufferTextureLayerEXT = (pfn_glNamedFramebufferTextureLayerEXT)load("glNamedFramebufferTextureLayerEXT"); - fp_glNamedFramebufferTextureFaceEXT = (pfn_glNamedFramebufferTextureFaceEXT)load("glNamedFramebufferTextureFaceEXT"); - fp_glTextureRenderbufferEXT = (pfn_glTextureRenderbufferEXT)load("glTextureRenderbufferEXT"); - fp_glMultiTexRenderbufferEXT = (pfn_glMultiTexRenderbufferEXT)load("glMultiTexRenderbufferEXT"); - fp_glVertexArrayVertexOffsetEXT = (pfn_glVertexArrayVertexOffsetEXT)load("glVertexArrayVertexOffsetEXT"); - fp_glVertexArrayColorOffsetEXT = (pfn_glVertexArrayColorOffsetEXT)load("glVertexArrayColorOffsetEXT"); - fp_glVertexArrayEdgeFlagOffsetEXT = (pfn_glVertexArrayEdgeFlagOffsetEXT)load("glVertexArrayEdgeFlagOffsetEXT"); - fp_glVertexArrayIndexOffsetEXT = (pfn_glVertexArrayIndexOffsetEXT)load("glVertexArrayIndexOffsetEXT"); - fp_glVertexArrayNormalOffsetEXT = (pfn_glVertexArrayNormalOffsetEXT)load("glVertexArrayNormalOffsetEXT"); - fp_glVertexArrayTexCoordOffsetEXT = (pfn_glVertexArrayTexCoordOffsetEXT)load("glVertexArrayTexCoordOffsetEXT"); - fp_glVertexArrayMultiTexCoordOffsetEXT = (pfn_glVertexArrayMultiTexCoordOffsetEXT)load("glVertexArrayMultiTexCoordOffsetEXT"); - fp_glVertexArrayFogCoordOffsetEXT = (pfn_glVertexArrayFogCoordOffsetEXT)load("glVertexArrayFogCoordOffsetEXT"); - fp_glVertexArraySecondaryColorOffsetEXT = (pfn_glVertexArraySecondaryColorOffsetEXT)load("glVertexArraySecondaryColorOffsetEXT"); - fp_glVertexArrayVertexAttribOffsetEXT = (pfn_glVertexArrayVertexAttribOffsetEXT)load("glVertexArrayVertexAttribOffsetEXT"); - fp_glVertexArrayVertexAttribIOffsetEXT = (pfn_glVertexArrayVertexAttribIOffsetEXT)load("glVertexArrayVertexAttribIOffsetEXT"); - fp_glEnableVertexArrayEXT = (pfn_glEnableVertexArrayEXT)load("glEnableVertexArrayEXT"); - fp_glDisableVertexArrayEXT = (pfn_glDisableVertexArrayEXT)load("glDisableVertexArrayEXT"); - fp_glEnableVertexArrayAttribEXT = (pfn_glEnableVertexArrayAttribEXT)load("glEnableVertexArrayAttribEXT"); - fp_glDisableVertexArrayAttribEXT = (pfn_glDisableVertexArrayAttribEXT)load("glDisableVertexArrayAttribEXT"); - fp_glGetVertexArrayIntegervEXT = (pfn_glGetVertexArrayIntegervEXT)load("glGetVertexArrayIntegervEXT"); - fp_glGetVertexArrayPointervEXT = (pfn_glGetVertexArrayPointervEXT)load("glGetVertexArrayPointervEXT"); - fp_glGetVertexArrayIntegeri_vEXT = (pfn_glGetVertexArrayIntegeri_vEXT)load("glGetVertexArrayIntegeri_vEXT"); - fp_glGetVertexArrayPointeri_vEXT = (pfn_glGetVertexArrayPointeri_vEXT)load("glGetVertexArrayPointeri_vEXT"); - fp_glMapNamedBufferRangeEXT = (pfn_glMapNamedBufferRangeEXT)load("glMapNamedBufferRangeEXT"); - fp_glFlushMappedNamedBufferRangeEXT = (pfn_glFlushMappedNamedBufferRangeEXT)load("glFlushMappedNamedBufferRangeEXT"); - fp_glNamedBufferStorageEXT = (pfn_glNamedBufferStorageEXT)load("glNamedBufferStorageEXT"); - fp_glClearNamedBufferDataEXT = (pfn_glClearNamedBufferDataEXT)load("glClearNamedBufferDataEXT"); - fp_glClearNamedBufferSubDataEXT = (pfn_glClearNamedBufferSubDataEXT)load("glClearNamedBufferSubDataEXT"); - fp_glNamedFramebufferParameteriEXT = (pfn_glNamedFramebufferParameteriEXT)load("glNamedFramebufferParameteriEXT"); - fp_glGetNamedFramebufferParameterivEXT = (pfn_glGetNamedFramebufferParameterivEXT)load("glGetNamedFramebufferParameterivEXT"); - fp_glProgramUniform1dEXT = (pfn_glProgramUniform1dEXT)load("glProgramUniform1dEXT"); - fp_glProgramUniform2dEXT = (pfn_glProgramUniform2dEXT)load("glProgramUniform2dEXT"); - fp_glProgramUniform3dEXT = (pfn_glProgramUniform3dEXT)load("glProgramUniform3dEXT"); - fp_glProgramUniform4dEXT = (pfn_glProgramUniform4dEXT)load("glProgramUniform4dEXT"); - fp_glProgramUniform1dvEXT = (pfn_glProgramUniform1dvEXT)load("glProgramUniform1dvEXT"); - fp_glProgramUniform2dvEXT = (pfn_glProgramUniform2dvEXT)load("glProgramUniform2dvEXT"); - fp_glProgramUniform3dvEXT = (pfn_glProgramUniform3dvEXT)load("glProgramUniform3dvEXT"); - fp_glProgramUniform4dvEXT = (pfn_glProgramUniform4dvEXT)load("glProgramUniform4dvEXT"); - fp_glProgramUniformMatrix2dvEXT = (pfn_glProgramUniformMatrix2dvEXT)load("glProgramUniformMatrix2dvEXT"); - fp_glProgramUniformMatrix3dvEXT = (pfn_glProgramUniformMatrix3dvEXT)load("glProgramUniformMatrix3dvEXT"); - fp_glProgramUniformMatrix4dvEXT = (pfn_glProgramUniformMatrix4dvEXT)load("glProgramUniformMatrix4dvEXT"); - fp_glProgramUniformMatrix2x3dvEXT = (pfn_glProgramUniformMatrix2x3dvEXT)load("glProgramUniformMatrix2x3dvEXT"); - fp_glProgramUniformMatrix2x4dvEXT = (pfn_glProgramUniformMatrix2x4dvEXT)load("glProgramUniformMatrix2x4dvEXT"); - fp_glProgramUniformMatrix3x2dvEXT = (pfn_glProgramUniformMatrix3x2dvEXT)load("glProgramUniformMatrix3x2dvEXT"); - fp_glProgramUniformMatrix3x4dvEXT = (pfn_glProgramUniformMatrix3x4dvEXT)load("glProgramUniformMatrix3x4dvEXT"); - fp_glProgramUniformMatrix4x2dvEXT = (pfn_glProgramUniformMatrix4x2dvEXT)load("glProgramUniformMatrix4x2dvEXT"); - fp_glProgramUniformMatrix4x3dvEXT = (pfn_glProgramUniformMatrix4x3dvEXT)load("glProgramUniformMatrix4x3dvEXT"); - fp_glTextureBufferRangeEXT = (pfn_glTextureBufferRangeEXT)load("glTextureBufferRangeEXT"); - fp_glTextureStorage1DEXT = (pfn_glTextureStorage1DEXT)load("glTextureStorage1DEXT"); - fp_glTextureStorage2DEXT = (pfn_glTextureStorage2DEXT)load("glTextureStorage2DEXT"); - fp_glTextureStorage3DEXT = (pfn_glTextureStorage3DEXT)load("glTextureStorage3DEXT"); - fp_glTextureStorage2DMultisampleEXT = (pfn_glTextureStorage2DMultisampleEXT)load("glTextureStorage2DMultisampleEXT"); - fp_glTextureStorage3DMultisampleEXT = (pfn_glTextureStorage3DMultisampleEXT)load("glTextureStorage3DMultisampleEXT"); - fp_glVertexArrayBindVertexBufferEXT = (pfn_glVertexArrayBindVertexBufferEXT)load("glVertexArrayBindVertexBufferEXT"); - fp_glVertexArrayVertexAttribFormatEXT = (pfn_glVertexArrayVertexAttribFormatEXT)load("glVertexArrayVertexAttribFormatEXT"); - fp_glVertexArrayVertexAttribIFormatEXT = (pfn_glVertexArrayVertexAttribIFormatEXT)load("glVertexArrayVertexAttribIFormatEXT"); - fp_glVertexArrayVertexAttribLFormatEXT = (pfn_glVertexArrayVertexAttribLFormatEXT)load("glVertexArrayVertexAttribLFormatEXT"); - fp_glVertexArrayVertexAttribBindingEXT = (pfn_glVertexArrayVertexAttribBindingEXT)load("glVertexArrayVertexAttribBindingEXT"); - fp_glVertexArrayVertexBindingDivisorEXT = (pfn_glVertexArrayVertexBindingDivisorEXT)load("glVertexArrayVertexBindingDivisorEXT"); - fp_glVertexArrayVertexAttribLOffsetEXT = (pfn_glVertexArrayVertexAttribLOffsetEXT)load("glVertexArrayVertexAttribLOffsetEXT"); - fp_glTexturePageCommitmentEXT = (pfn_glTexturePageCommitmentEXT)load("glTexturePageCommitmentEXT"); - fp_glVertexArrayVertexAttribDivisorEXT = (pfn_glVertexArrayVertexAttribDivisorEXT)load("glVertexArrayVertexAttribDivisorEXT"); -} - -GLboolean GLAD_EXT_discard_framebuffer = GL_FALSE; -static void load_GL_EXT_discard_framebuffer(LOADER load) { - if(!GLAD_EXT_discard_framebuffer) return; - fp_glDiscardFramebufferEXT = (pfn_glDiscardFramebufferEXT)load("glDiscardFramebufferEXT"); -} - -GLboolean GLAD_EXT_disjoint_timer_query = GL_FALSE; -static void load_GL_EXT_disjoint_timer_query(LOADER load) { - if(!GLAD_EXT_disjoint_timer_query) return; - fp_glGenQueriesEXT = (pfn_glGenQueriesEXT)load("glGenQueriesEXT"); - fp_glDeleteQueriesEXT = (pfn_glDeleteQueriesEXT)load("glDeleteQueriesEXT"); - fp_glIsQueryEXT = (pfn_glIsQueryEXT)load("glIsQueryEXT"); - fp_glBeginQueryEXT = (pfn_glBeginQueryEXT)load("glBeginQueryEXT"); - fp_glEndQueryEXT = (pfn_glEndQueryEXT)load("glEndQueryEXT"); - fp_glQueryCounterEXT = (pfn_glQueryCounterEXT)load("glQueryCounterEXT"); - fp_glGetQueryivEXT = (pfn_glGetQueryivEXT)load("glGetQueryivEXT"); - fp_glGetQueryObjectivEXT = (pfn_glGetQueryObjectivEXT)load("glGetQueryObjectivEXT"); - fp_glGetQueryObjectuivEXT = (pfn_glGetQueryObjectuivEXT)load("glGetQueryObjectuivEXT"); - fp_glGetQueryObjecti64vEXT = (pfn_glGetQueryObjecti64vEXT)load("glGetQueryObjecti64vEXT"); - fp_glGetQueryObjectui64vEXT = (pfn_glGetQueryObjectui64vEXT)load("glGetQueryObjectui64vEXT"); -} - -GLboolean GLAD_EXT_draw_buffers = GL_FALSE; -static void load_GL_EXT_draw_buffers(LOADER load) { - if(!GLAD_EXT_draw_buffers) return; - fp_glDrawBuffersEXT = (pfn_glDrawBuffersEXT)load("glDrawBuffersEXT"); -} - -GLboolean GLAD_EXT_draw_buffers2 = GL_FALSE; -static void load_GL_EXT_draw_buffers2(LOADER load) { - if(!GLAD_EXT_draw_buffers2) return; - fp_glColorMaskIndexedEXT = (pfn_glColorMaskIndexedEXT)load("glColorMaskIndexedEXT"); - fp_glGetBooleanIndexedvEXT = (pfn_glGetBooleanIndexedvEXT)load("glGetBooleanIndexedvEXT"); - fp_glGetIntegerIndexedvEXT = (pfn_glGetIntegerIndexedvEXT)load("glGetIntegerIndexedvEXT"); - fp_glEnableIndexedEXT = (pfn_glEnableIndexedEXT)load("glEnableIndexedEXT"); - fp_glDisableIndexedEXT = (pfn_glDisableIndexedEXT)load("glDisableIndexedEXT"); - fp_glIsEnabledIndexedEXT = (pfn_glIsEnabledIndexedEXT)load("glIsEnabledIndexedEXT"); -} - -GLboolean GLAD_EXT_draw_buffers_indexed = GL_FALSE; -static void load_GL_EXT_draw_buffers_indexed(LOADER load) { - if(!GLAD_EXT_draw_buffers_indexed) return; - fp_glEnableiEXT = (pfn_glEnableiEXT)load("glEnableiEXT"); - fp_glDisableiEXT = (pfn_glDisableiEXT)load("glDisableiEXT"); - fp_glBlendEquationiEXT = (pfn_glBlendEquationiEXT)load("glBlendEquationiEXT"); - fp_glBlendEquationSeparateiEXT = (pfn_glBlendEquationSeparateiEXT)load("glBlendEquationSeparateiEXT"); - fp_glBlendFunciEXT = (pfn_glBlendFunciEXT)load("glBlendFunciEXT"); - fp_glBlendFuncSeparateiEXT = (pfn_glBlendFuncSeparateiEXT)load("glBlendFuncSeparateiEXT"); - fp_glColorMaskiEXT = (pfn_glColorMaskiEXT)load("glColorMaskiEXT"); - fp_glIsEnablediEXT = (pfn_glIsEnablediEXT)load("glIsEnablediEXT"); -} - -GLboolean GLAD_EXT_draw_elements_base_vertex = GL_FALSE; -static void load_GL_EXT_draw_elements_base_vertex(LOADER load) { - if(!GLAD_EXT_draw_elements_base_vertex) return; - fp_glDrawElementsBaseVertexEXT = (pfn_glDrawElementsBaseVertexEXT)load("glDrawElementsBaseVertexEXT"); - fp_glDrawRangeElementsBaseVertexEXT = (pfn_glDrawRangeElementsBaseVertexEXT)load("glDrawRangeElementsBaseVertexEXT"); - fp_glDrawElementsInstancedBaseVertexEXT = (pfn_glDrawElementsInstancedBaseVertexEXT)load("glDrawElementsInstancedBaseVertexEXT"); - fp_glMultiDrawElementsBaseVertexEXT = (pfn_glMultiDrawElementsBaseVertexEXT)load("glMultiDrawElementsBaseVertexEXT"); -} - -GLboolean GLAD_EXT_draw_instanced = GL_FALSE; -static void load_GL_EXT_draw_instanced(LOADER load) { - if(!GLAD_EXT_draw_instanced) return; - fp_glDrawArraysInstancedEXT = (pfn_glDrawArraysInstancedEXT)load("glDrawArraysInstancedEXT"); - fp_glDrawElementsInstancedEXT = (pfn_glDrawElementsInstancedEXT)load("glDrawElementsInstancedEXT"); -} - -GLboolean GLAD_EXT_float_blend = GL_FALSE; -GLboolean GLAD_EXT_framebuffer_blit = GL_FALSE; -static void load_GL_EXT_framebuffer_blit(LOADER load) { - if(!GLAD_EXT_framebuffer_blit) return; - fp_glBlitFramebufferEXT = (pfn_glBlitFramebufferEXT)load("glBlitFramebufferEXT"); -} - -GLboolean GLAD_EXT_framebuffer_multisample = GL_FALSE; -static void load_GL_EXT_framebuffer_multisample(LOADER load) { - if(!GLAD_EXT_framebuffer_multisample) return; - fp_glRenderbufferStorageMultisampleEXT = (pfn_glRenderbufferStorageMultisampleEXT)load("glRenderbufferStorageMultisampleEXT"); -} - -GLboolean GLAD_EXT_framebuffer_multisample_blit_scaled = GL_FALSE; -GLboolean GLAD_EXT_framebuffer_object = GL_FALSE; -static void load_GL_EXT_framebuffer_object(LOADER load) { - if(!GLAD_EXT_framebuffer_object) return; - fp_glIsRenderbufferEXT = (pfn_glIsRenderbufferEXT)load("glIsRenderbufferEXT"); - fp_glBindRenderbufferEXT = (pfn_glBindRenderbufferEXT)load("glBindRenderbufferEXT"); - fp_glDeleteRenderbuffersEXT = (pfn_glDeleteRenderbuffersEXT)load("glDeleteRenderbuffersEXT"); - fp_glGenRenderbuffersEXT = (pfn_glGenRenderbuffersEXT)load("glGenRenderbuffersEXT"); - fp_glRenderbufferStorageEXT = (pfn_glRenderbufferStorageEXT)load("glRenderbufferStorageEXT"); - fp_glGetRenderbufferParameterivEXT = (pfn_glGetRenderbufferParameterivEXT)load("glGetRenderbufferParameterivEXT"); - fp_glIsFramebufferEXT = (pfn_glIsFramebufferEXT)load("glIsFramebufferEXT"); - fp_glBindFramebufferEXT = (pfn_glBindFramebufferEXT)load("glBindFramebufferEXT"); - fp_glDeleteFramebuffersEXT = (pfn_glDeleteFramebuffersEXT)load("glDeleteFramebuffersEXT"); - fp_glGenFramebuffersEXT = (pfn_glGenFramebuffersEXT)load("glGenFramebuffersEXT"); - fp_glCheckFramebufferStatusEXT = (pfn_glCheckFramebufferStatusEXT)load("glCheckFramebufferStatusEXT"); - fp_glFramebufferTexture1DEXT = (pfn_glFramebufferTexture1DEXT)load("glFramebufferTexture1DEXT"); - fp_glFramebufferTexture2DEXT = (pfn_glFramebufferTexture2DEXT)load("glFramebufferTexture2DEXT"); - fp_glFramebufferTexture3DEXT = (pfn_glFramebufferTexture3DEXT)load("glFramebufferTexture3DEXT"); - fp_glFramebufferRenderbufferEXT = (pfn_glFramebufferRenderbufferEXT)load("glFramebufferRenderbufferEXT"); - fp_glGetFramebufferAttachmentParameterivEXT = (pfn_glGetFramebufferAttachmentParameterivEXT)load("glGetFramebufferAttachmentParameterivEXT"); - fp_glGenerateMipmapEXT = (pfn_glGenerateMipmapEXT)load("glGenerateMipmapEXT"); -} - -GLboolean GLAD_EXT_framebuffer_sRGB = GL_FALSE; -GLboolean GLAD_EXT_geometry_point_size = GL_FALSE; -GLboolean GLAD_EXT_geometry_shader = GL_FALSE; -static void load_GL_EXT_geometry_shader(LOADER load) { - if(!GLAD_EXT_geometry_shader) return; - fp_glFramebufferTextureEXT = (pfn_glFramebufferTextureEXT)load("glFramebufferTextureEXT"); -} - -GLboolean GLAD_EXT_geometry_shader4 = GL_FALSE; -static void load_GL_EXT_geometry_shader4(LOADER load) { - if(!GLAD_EXT_geometry_shader4) return; - fp_glProgramParameteriEXT = (pfn_glProgramParameteriEXT)load("glProgramParameteriEXT"); -} - -GLboolean GLAD_EXT_gpu_program_parameters = GL_FALSE; -static void load_GL_EXT_gpu_program_parameters(LOADER load) { - if(!GLAD_EXT_gpu_program_parameters) return; - fp_glProgramEnvParameters4fvEXT = (pfn_glProgramEnvParameters4fvEXT)load("glProgramEnvParameters4fvEXT"); - fp_glProgramLocalParameters4fvEXT = (pfn_glProgramLocalParameters4fvEXT)load("glProgramLocalParameters4fvEXT"); -} - -GLboolean GLAD_EXT_gpu_shader4 = GL_FALSE; -static void load_GL_EXT_gpu_shader4(LOADER load) { - if(!GLAD_EXT_gpu_shader4) return; - fp_glGetUniformuivEXT = (pfn_glGetUniformuivEXT)load("glGetUniformuivEXT"); - fp_glBindFragDataLocationEXT = (pfn_glBindFragDataLocationEXT)load("glBindFragDataLocationEXT"); - fp_glGetFragDataLocationEXT = (pfn_glGetFragDataLocationEXT)load("glGetFragDataLocationEXT"); - fp_glUniform1uiEXT = (pfn_glUniform1uiEXT)load("glUniform1uiEXT"); - fp_glUniform2uiEXT = (pfn_glUniform2uiEXT)load("glUniform2uiEXT"); - fp_glUniform3uiEXT = (pfn_glUniform3uiEXT)load("glUniform3uiEXT"); - fp_glUniform4uiEXT = (pfn_glUniform4uiEXT)load("glUniform4uiEXT"); - fp_glUniform1uivEXT = (pfn_glUniform1uivEXT)load("glUniform1uivEXT"); - fp_glUniform2uivEXT = (pfn_glUniform2uivEXT)load("glUniform2uivEXT"); - fp_glUniform3uivEXT = (pfn_glUniform3uivEXT)load("glUniform3uivEXT"); - fp_glUniform4uivEXT = (pfn_glUniform4uivEXT)load("glUniform4uivEXT"); -} - -GLboolean GLAD_EXT_gpu_shader5 = GL_FALSE; -GLboolean GLAD_EXT_instanced_arrays = GL_FALSE; -static void load_GL_EXT_instanced_arrays(LOADER load) { - if(!GLAD_EXT_instanced_arrays) return; - fp_glDrawArraysInstancedEXT = (pfn_glDrawArraysInstancedEXT)load("glDrawArraysInstancedEXT"); - fp_glDrawElementsInstancedEXT = (pfn_glDrawElementsInstancedEXT)load("glDrawElementsInstancedEXT"); - fp_glVertexAttribDivisorEXT = (pfn_glVertexAttribDivisorEXT)load("glVertexAttribDivisorEXT"); -} - -GLboolean GLAD_EXT_map_buffer_range = GL_FALSE; -static void load_GL_EXT_map_buffer_range(LOADER load) { - if(!GLAD_EXT_map_buffer_range) return; - fp_glMapBufferRangeEXT = (pfn_glMapBufferRangeEXT)load("glMapBufferRangeEXT"); - fp_glFlushMappedBufferRangeEXT = (pfn_glFlushMappedBufferRangeEXT)load("glFlushMappedBufferRangeEXT"); -} - -GLboolean GLAD_EXT_multi_draw_indirect = GL_FALSE; -static void load_GL_EXT_multi_draw_indirect(LOADER load) { - if(!GLAD_EXT_multi_draw_indirect) return; - fp_glMultiDrawArraysIndirectEXT = (pfn_glMultiDrawArraysIndirectEXT)load("glMultiDrawArraysIndirectEXT"); - fp_glMultiDrawElementsIndirectEXT = (pfn_glMultiDrawElementsIndirectEXT)load("glMultiDrawElementsIndirectEXT"); -} - -GLboolean GLAD_EXT_multisampled_compatibility = GL_FALSE; -GLboolean GLAD_EXT_multisampled_render_to_texture = GL_FALSE; -static void load_GL_EXT_multisampled_render_to_texture(LOADER load) { - if(!GLAD_EXT_multisampled_render_to_texture) return; - fp_glRenderbufferStorageMultisampleEXT = (pfn_glRenderbufferStorageMultisampleEXT)load("glRenderbufferStorageMultisampleEXT"); - fp_glFramebufferTexture2DMultisampleEXT = (pfn_glFramebufferTexture2DMultisampleEXT)load("glFramebufferTexture2DMultisampleEXT"); -} - -GLboolean GLAD_EXT_multiview_draw_buffers = GL_FALSE; -static void load_GL_EXT_multiview_draw_buffers(LOADER load) { - if(!GLAD_EXT_multiview_draw_buffers) return; - fp_glReadBufferIndexedEXT = (pfn_glReadBufferIndexedEXT)load("glReadBufferIndexedEXT"); - fp_glDrawBuffersIndexedEXT = (pfn_glDrawBuffersIndexedEXT)load("glDrawBuffersIndexedEXT"); - fp_glGetIntegeri_vEXT = (pfn_glGetIntegeri_vEXT)load("glGetIntegeri_vEXT"); -} - -GLboolean GLAD_EXT_occlusion_query_boolean = GL_FALSE; -static void load_GL_EXT_occlusion_query_boolean(LOADER load) { - if(!GLAD_EXT_occlusion_query_boolean) return; - fp_glGenQueriesEXT = (pfn_glGenQueriesEXT)load("glGenQueriesEXT"); - fp_glDeleteQueriesEXT = (pfn_glDeleteQueriesEXT)load("glDeleteQueriesEXT"); - fp_glIsQueryEXT = (pfn_glIsQueryEXT)load("glIsQueryEXT"); - fp_glBeginQueryEXT = (pfn_glBeginQueryEXT)load("glBeginQueryEXT"); - fp_glEndQueryEXT = (pfn_glEndQueryEXT)load("glEndQueryEXT"); - fp_glGetQueryivEXT = (pfn_glGetQueryivEXT)load("glGetQueryivEXT"); - fp_glGetQueryObjectuivEXT = (pfn_glGetQueryObjectuivEXT)load("glGetQueryObjectuivEXT"); -} - -GLboolean GLAD_EXT_packed_depth_stencil = GL_FALSE; -GLboolean GLAD_EXT_packed_float = GL_FALSE; -GLboolean GLAD_EXT_pixel_buffer_object = GL_FALSE; -GLboolean GLAD_EXT_polygon_offset_clamp = GL_FALSE; -static void load_GL_EXT_polygon_offset_clamp(LOADER load) { - if(!GLAD_EXT_polygon_offset_clamp) return; - fp_glPolygonOffsetClampEXT = (pfn_glPolygonOffsetClampEXT)load("glPolygonOffsetClampEXT"); -} - -GLboolean GLAD_EXT_post_depth_coverage = GL_FALSE; -GLboolean GLAD_EXT_primitive_bounding_box = GL_FALSE; -static void load_GL_EXT_primitive_bounding_box(LOADER load) { - if(!GLAD_EXT_primitive_bounding_box) return; - fp_glPrimitiveBoundingBoxEXT = (pfn_glPrimitiveBoundingBoxEXT)load("glPrimitiveBoundingBoxEXT"); -} - -GLboolean GLAD_EXT_provoking_vertex = GL_FALSE; -static void load_GL_EXT_provoking_vertex(LOADER load) { - if(!GLAD_EXT_provoking_vertex) return; - fp_glProvokingVertexEXT = (pfn_glProvokingVertexEXT)load("glProvokingVertexEXT"); -} - -GLboolean GLAD_EXT_pvrtc_sRGB = GL_FALSE; -GLboolean GLAD_EXT_raster_multisample = GL_FALSE; -static void load_GL_EXT_raster_multisample(LOADER load) { - if(!GLAD_EXT_raster_multisample) return; - fp_glRasterSamplesEXT = (pfn_glRasterSamplesEXT)load("glRasterSamplesEXT"); -} - -GLboolean GLAD_EXT_read_format_bgra = GL_FALSE; -GLboolean GLAD_EXT_render_snorm = GL_FALSE; -GLboolean GLAD_EXT_robustness = GL_FALSE; -static void load_GL_EXT_robustness(LOADER load) { - if(!GLAD_EXT_robustness) return; - fp_glGetGraphicsResetStatusEXT = (pfn_glGetGraphicsResetStatusEXT)load("glGetGraphicsResetStatusEXT"); - fp_glReadnPixelsEXT = (pfn_glReadnPixelsEXT)load("glReadnPixelsEXT"); - fp_glGetnUniformfvEXT = (pfn_glGetnUniformfvEXT)load("glGetnUniformfvEXT"); - fp_glGetnUniformivEXT = (pfn_glGetnUniformivEXT)load("glGetnUniformivEXT"); -} - -GLboolean GLAD_EXT_separate_shader_objects = GL_FALSE; -static void load_GL_EXT_separate_shader_objects(LOADER load) { - if(!GLAD_EXT_separate_shader_objects) return; - fp_glUseShaderProgramEXT = (pfn_glUseShaderProgramEXT)load("glUseShaderProgramEXT"); - fp_glActiveProgramEXT = (pfn_glActiveProgramEXT)load("glActiveProgramEXT"); - fp_glCreateShaderProgramEXT = (pfn_glCreateShaderProgramEXT)load("glCreateShaderProgramEXT"); - fp_glActiveShaderProgramEXT = (pfn_glActiveShaderProgramEXT)load("glActiveShaderProgramEXT"); - fp_glBindProgramPipelineEXT = (pfn_glBindProgramPipelineEXT)load("glBindProgramPipelineEXT"); - fp_glCreateShaderProgramvEXT = (pfn_glCreateShaderProgramvEXT)load("glCreateShaderProgramvEXT"); - fp_glDeleteProgramPipelinesEXT = (pfn_glDeleteProgramPipelinesEXT)load("glDeleteProgramPipelinesEXT"); - fp_glGenProgramPipelinesEXT = (pfn_glGenProgramPipelinesEXT)load("glGenProgramPipelinesEXT"); - fp_glGetProgramPipelineInfoLogEXT = (pfn_glGetProgramPipelineInfoLogEXT)load("glGetProgramPipelineInfoLogEXT"); - fp_glGetProgramPipelineivEXT = (pfn_glGetProgramPipelineivEXT)load("glGetProgramPipelineivEXT"); - fp_glIsProgramPipelineEXT = (pfn_glIsProgramPipelineEXT)load("glIsProgramPipelineEXT"); - fp_glProgramParameteriEXT = (pfn_glProgramParameteriEXT)load("glProgramParameteriEXT"); - fp_glProgramUniform1fEXT = (pfn_glProgramUniform1fEXT)load("glProgramUniform1fEXT"); - fp_glProgramUniform1fvEXT = (pfn_glProgramUniform1fvEXT)load("glProgramUniform1fvEXT"); - fp_glProgramUniform1iEXT = (pfn_glProgramUniform1iEXT)load("glProgramUniform1iEXT"); - fp_glProgramUniform1ivEXT = (pfn_glProgramUniform1ivEXT)load("glProgramUniform1ivEXT"); - fp_glProgramUniform2fEXT = (pfn_glProgramUniform2fEXT)load("glProgramUniform2fEXT"); - fp_glProgramUniform2fvEXT = (pfn_glProgramUniform2fvEXT)load("glProgramUniform2fvEXT"); - fp_glProgramUniform2iEXT = (pfn_glProgramUniform2iEXT)load("glProgramUniform2iEXT"); - fp_glProgramUniform2ivEXT = (pfn_glProgramUniform2ivEXT)load("glProgramUniform2ivEXT"); - fp_glProgramUniform3fEXT = (pfn_glProgramUniform3fEXT)load("glProgramUniform3fEXT"); - fp_glProgramUniform3fvEXT = (pfn_glProgramUniform3fvEXT)load("glProgramUniform3fvEXT"); - fp_glProgramUniform3iEXT = (pfn_glProgramUniform3iEXT)load("glProgramUniform3iEXT"); - fp_glProgramUniform3ivEXT = (pfn_glProgramUniform3ivEXT)load("glProgramUniform3ivEXT"); - fp_glProgramUniform4fEXT = (pfn_glProgramUniform4fEXT)load("glProgramUniform4fEXT"); - fp_glProgramUniform4fvEXT = (pfn_glProgramUniform4fvEXT)load("glProgramUniform4fvEXT"); - fp_glProgramUniform4iEXT = (pfn_glProgramUniform4iEXT)load("glProgramUniform4iEXT"); - fp_glProgramUniform4ivEXT = (pfn_glProgramUniform4ivEXT)load("glProgramUniform4ivEXT"); - fp_glProgramUniformMatrix2fvEXT = (pfn_glProgramUniformMatrix2fvEXT)load("glProgramUniformMatrix2fvEXT"); - fp_glProgramUniformMatrix3fvEXT = (pfn_glProgramUniformMatrix3fvEXT)load("glProgramUniformMatrix3fvEXT"); - fp_glProgramUniformMatrix4fvEXT = (pfn_glProgramUniformMatrix4fvEXT)load("glProgramUniformMatrix4fvEXT"); - fp_glUseProgramStagesEXT = (pfn_glUseProgramStagesEXT)load("glUseProgramStagesEXT"); - fp_glValidateProgramPipelineEXT = (pfn_glValidateProgramPipelineEXT)load("glValidateProgramPipelineEXT"); - fp_glProgramUniform1uiEXT = (pfn_glProgramUniform1uiEXT)load("glProgramUniform1uiEXT"); - fp_glProgramUniform2uiEXT = (pfn_glProgramUniform2uiEXT)load("glProgramUniform2uiEXT"); - fp_glProgramUniform3uiEXT = (pfn_glProgramUniform3uiEXT)load("glProgramUniform3uiEXT"); - fp_glProgramUniform4uiEXT = (pfn_glProgramUniform4uiEXT)load("glProgramUniform4uiEXT"); - fp_glProgramUniform1uivEXT = (pfn_glProgramUniform1uivEXT)load("glProgramUniform1uivEXT"); - fp_glProgramUniform2uivEXT = (pfn_glProgramUniform2uivEXT)load("glProgramUniform2uivEXT"); - fp_glProgramUniform3uivEXT = (pfn_glProgramUniform3uivEXT)load("glProgramUniform3uivEXT"); - fp_glProgramUniform4uivEXT = (pfn_glProgramUniform4uivEXT)load("glProgramUniform4uivEXT"); - fp_glProgramUniformMatrix4fvEXT = (pfn_glProgramUniformMatrix4fvEXT)load("glProgramUniformMatrix4fvEXT"); - fp_glProgramUniformMatrix2x3fvEXT = (pfn_glProgramUniformMatrix2x3fvEXT)load("glProgramUniformMatrix2x3fvEXT"); - fp_glProgramUniformMatrix3x2fvEXT = (pfn_glProgramUniformMatrix3x2fvEXT)load("glProgramUniformMatrix3x2fvEXT"); - fp_glProgramUniformMatrix2x4fvEXT = (pfn_glProgramUniformMatrix2x4fvEXT)load("glProgramUniformMatrix2x4fvEXT"); - fp_glProgramUniformMatrix4x2fvEXT = (pfn_glProgramUniformMatrix4x2fvEXT)load("glProgramUniformMatrix4x2fvEXT"); - fp_glProgramUniformMatrix3x4fvEXT = (pfn_glProgramUniformMatrix3x4fvEXT)load("glProgramUniformMatrix3x4fvEXT"); - fp_glProgramUniformMatrix4x3fvEXT = (pfn_glProgramUniformMatrix4x3fvEXT)load("glProgramUniformMatrix4x3fvEXT"); -} - -GLboolean GLAD_EXT_shader_framebuffer_fetch = GL_FALSE; -GLboolean GLAD_EXT_shader_image_load_formatted = GL_FALSE; -GLboolean GLAD_EXT_shader_image_load_store = GL_FALSE; -static void load_GL_EXT_shader_image_load_store(LOADER load) { - if(!GLAD_EXT_shader_image_load_store) return; - fp_glBindImageTextureEXT = (pfn_glBindImageTextureEXT)load("glBindImageTextureEXT"); - fp_glMemoryBarrierEXT = (pfn_glMemoryBarrierEXT)load("glMemoryBarrierEXT"); -} - -GLboolean GLAD_EXT_shader_implicit_conversions = GL_FALSE; -GLboolean GLAD_EXT_shader_integer_mix = GL_FALSE; -GLboolean GLAD_EXT_shader_io_blocks = GL_FALSE; -GLboolean GLAD_EXT_shader_pixel_local_storage = GL_FALSE; -GLboolean GLAD_EXT_shader_texture_lod = GL_FALSE; -GLboolean GLAD_EXT_shadow_samplers = GL_FALSE; -GLboolean GLAD_EXT_sparse_texture = GL_FALSE; -static void load_GL_EXT_sparse_texture(LOADER load) { - if(!GLAD_EXT_sparse_texture) return; - fp_glTexPageCommitmentEXT = (pfn_glTexPageCommitmentEXT)load("glTexPageCommitmentEXT"); -} - -GLboolean GLAD_EXT_sparse_texture2 = GL_FALSE; -GLboolean GLAD_EXT_sRGB = GL_FALSE; -GLboolean GLAD_EXT_sRGB_write_control = GL_FALSE; -GLboolean GLAD_EXT_stencil_clear_tag = GL_FALSE; -static void load_GL_EXT_stencil_clear_tag(LOADER load) { - if(!GLAD_EXT_stencil_clear_tag) return; - fp_glStencilClearTagEXT = (pfn_glStencilClearTagEXT)load("glStencilClearTagEXT"); -} - -GLboolean GLAD_EXT_tessellation_point_size = GL_FALSE; -GLboolean GLAD_EXT_tessellation_shader = GL_FALSE; -static void load_GL_EXT_tessellation_shader(LOADER load) { - if(!GLAD_EXT_tessellation_shader) return; - fp_glPatchParameteriEXT = (pfn_glPatchParameteriEXT)load("glPatchParameteriEXT"); -} - -GLboolean GLAD_EXT_texture_array = GL_FALSE; -static void load_GL_EXT_texture_array(LOADER load) { - if(!GLAD_EXT_texture_array) return; - fp_glFramebufferTextureLayerEXT = (pfn_glFramebufferTextureLayerEXT)load("glFramebufferTextureLayerEXT"); -} - -GLboolean GLAD_EXT_texture_border_clamp = GL_FALSE; -static void load_GL_EXT_texture_border_clamp(LOADER load) { - if(!GLAD_EXT_texture_border_clamp) return; - fp_glTexParameterIivEXT = (pfn_glTexParameterIivEXT)load("glTexParameterIivEXT"); - fp_glTexParameterIuivEXT = (pfn_glTexParameterIuivEXT)load("glTexParameterIuivEXT"); - fp_glGetTexParameterIivEXT = (pfn_glGetTexParameterIivEXT)load("glGetTexParameterIivEXT"); - fp_glGetTexParameterIuivEXT = (pfn_glGetTexParameterIuivEXT)load("glGetTexParameterIuivEXT"); - fp_glSamplerParameterIivEXT = (pfn_glSamplerParameterIivEXT)load("glSamplerParameterIivEXT"); - fp_glSamplerParameterIuivEXT = (pfn_glSamplerParameterIuivEXT)load("glSamplerParameterIuivEXT"); - fp_glGetSamplerParameterIivEXT = (pfn_glGetSamplerParameterIivEXT)load("glGetSamplerParameterIivEXT"); - fp_glGetSamplerParameterIuivEXT = (pfn_glGetSamplerParameterIuivEXT)load("glGetSamplerParameterIuivEXT"); -} - -GLboolean GLAD_EXT_texture_buffer = GL_FALSE; -static void load_GL_EXT_texture_buffer(LOADER load) { - if(!GLAD_EXT_texture_buffer) return; - fp_glTexBufferEXT = (pfn_glTexBufferEXT)load("glTexBufferEXT"); - fp_glTexBufferRangeEXT = (pfn_glTexBufferRangeEXT)load("glTexBufferRangeEXT"); -} - -GLboolean GLAD_EXT_texture_buffer_object = GL_FALSE; -static void load_GL_EXT_texture_buffer_object(LOADER load) { - if(!GLAD_EXT_texture_buffer_object) return; - fp_glTexBufferEXT = (pfn_glTexBufferEXT)load("glTexBufferEXT"); -} - -GLboolean GLAD_EXT_texture_compression_dxt1 = GL_FALSE; -GLboolean GLAD_EXT_texture_compression_latc = GL_FALSE; -GLboolean GLAD_EXT_texture_compression_rgtc = GL_FALSE; -GLboolean GLAD_EXT_texture_compression_s3tc = GL_FALSE; -GLboolean GLAD_EXT_texture_cube_map = GL_FALSE; -GLboolean GLAD_EXT_texture_cube_map_array = GL_FALSE; -GLboolean GLAD_EXT_texture_filter_anisotropic = GL_FALSE; -GLboolean GLAD_EXT_texture_filter_minmax = GL_FALSE; -static void load_GL_EXT_texture_filter_minmax(LOADER load) { - if(!GLAD_EXT_texture_filter_minmax) return; - fp_glRasterSamplesEXT = (pfn_glRasterSamplesEXT)load("glRasterSamplesEXT"); -} - -GLboolean GLAD_EXT_texture_format_BGRA8888 = GL_FALSE; -GLboolean GLAD_EXT_texture_integer = GL_FALSE; -static void load_GL_EXT_texture_integer(LOADER load) { - if(!GLAD_EXT_texture_integer) return; - fp_glTexParameterIivEXT = (pfn_glTexParameterIivEXT)load("glTexParameterIivEXT"); - fp_glTexParameterIuivEXT = (pfn_glTexParameterIuivEXT)load("glTexParameterIuivEXT"); - fp_glGetTexParameterIivEXT = (pfn_glGetTexParameterIivEXT)load("glGetTexParameterIivEXT"); - fp_glGetTexParameterIuivEXT = (pfn_glGetTexParameterIuivEXT)load("glGetTexParameterIuivEXT"); - fp_glClearColorIiEXT = (pfn_glClearColorIiEXT)load("glClearColorIiEXT"); - fp_glClearColorIuiEXT = (pfn_glClearColorIuiEXT)load("glClearColorIuiEXT"); -} - -GLboolean GLAD_EXT_texture_norm16 = GL_FALSE; -GLboolean GLAD_EXT_texture_rg = GL_FALSE; -GLboolean GLAD_EXT_texture_shared_exponent = GL_FALSE; -GLboolean GLAD_EXT_texture_snorm = GL_FALSE; -GLboolean GLAD_EXT_texture_sRGB = GL_FALSE; -GLboolean GLAD_EXT_texture_sRGB_decode = GL_FALSE; -GLboolean GLAD_EXT_texture_sRGB_R8 = GL_FALSE; -GLboolean GLAD_EXT_texture_sRGB_RG8 = GL_FALSE; -GLboolean GLAD_EXT_texture_storage = GL_FALSE; -static void load_GL_EXT_texture_storage(LOADER load) { - if(!GLAD_EXT_texture_storage) return; - fp_glTexStorage1DEXT = (pfn_glTexStorage1DEXT)load("glTexStorage1DEXT"); - fp_glTexStorage2DEXT = (pfn_glTexStorage2DEXT)load("glTexStorage2DEXT"); - fp_glTexStorage3DEXT = (pfn_glTexStorage3DEXT)load("glTexStorage3DEXT"); - fp_glTextureStorage1DEXT = (pfn_glTextureStorage1DEXT)load("glTextureStorage1DEXT"); - fp_glTextureStorage2DEXT = (pfn_glTextureStorage2DEXT)load("glTextureStorage2DEXT"); - fp_glTextureStorage3DEXT = (pfn_glTextureStorage3DEXT)load("glTextureStorage3DEXT"); -} - -GLboolean GLAD_EXT_texture_swizzle = GL_FALSE; -GLboolean GLAD_EXT_texture_type_2_10_10_10_REV = GL_FALSE; -GLboolean GLAD_EXT_texture_view = GL_FALSE; -static void load_GL_EXT_texture_view(LOADER load) { - if(!GLAD_EXT_texture_view) return; - fp_glTextureViewEXT = (pfn_glTextureViewEXT)load("glTextureViewEXT"); -} - -GLboolean GLAD_EXT_timer_query = GL_FALSE; -static void load_GL_EXT_timer_query(LOADER load) { - if(!GLAD_EXT_timer_query) return; - fp_glGetQueryObjecti64vEXT = (pfn_glGetQueryObjecti64vEXT)load("glGetQueryObjecti64vEXT"); - fp_glGetQueryObjectui64vEXT = (pfn_glGetQueryObjectui64vEXT)load("glGetQueryObjectui64vEXT"); -} - -GLboolean GLAD_EXT_transform_feedback = GL_FALSE; -static void load_GL_EXT_transform_feedback(LOADER load) { - if(!GLAD_EXT_transform_feedback) return; - fp_glBeginTransformFeedbackEXT = (pfn_glBeginTransformFeedbackEXT)load("glBeginTransformFeedbackEXT"); - fp_glEndTransformFeedbackEXT = (pfn_glEndTransformFeedbackEXT)load("glEndTransformFeedbackEXT"); - fp_glBindBufferRangeEXT = (pfn_glBindBufferRangeEXT)load("glBindBufferRangeEXT"); - fp_glBindBufferOffsetEXT = (pfn_glBindBufferOffsetEXT)load("glBindBufferOffsetEXT"); - fp_glBindBufferBaseEXT = (pfn_glBindBufferBaseEXT)load("glBindBufferBaseEXT"); - fp_glTransformFeedbackVaryingsEXT = (pfn_glTransformFeedbackVaryingsEXT)load("glTransformFeedbackVaryingsEXT"); - fp_glGetTransformFeedbackVaryingEXT = (pfn_glGetTransformFeedbackVaryingEXT)load("glGetTransformFeedbackVaryingEXT"); -} - -GLboolean GLAD_EXT_unpack_subimage = GL_FALSE; -GLboolean GLAD_EXT_vertex_array_bgra = GL_FALSE; -GLboolean GLAD_EXT_vertex_attrib_64bit = GL_FALSE; -static void load_GL_EXT_vertex_attrib_64bit(LOADER load) { - if(!GLAD_EXT_vertex_attrib_64bit) return; - fp_glVertexAttribL1dEXT = (pfn_glVertexAttribL1dEXT)load("glVertexAttribL1dEXT"); - fp_glVertexAttribL2dEXT = (pfn_glVertexAttribL2dEXT)load("glVertexAttribL2dEXT"); - fp_glVertexAttribL3dEXT = (pfn_glVertexAttribL3dEXT)load("glVertexAttribL3dEXT"); - fp_glVertexAttribL4dEXT = (pfn_glVertexAttribL4dEXT)load("glVertexAttribL4dEXT"); - fp_glVertexAttribL1dvEXT = (pfn_glVertexAttribL1dvEXT)load("glVertexAttribL1dvEXT"); - fp_glVertexAttribL2dvEXT = (pfn_glVertexAttribL2dvEXT)load("glVertexAttribL2dvEXT"); - fp_glVertexAttribL3dvEXT = (pfn_glVertexAttribL3dvEXT)load("glVertexAttribL3dvEXT"); - fp_glVertexAttribL4dvEXT = (pfn_glVertexAttribL4dvEXT)load("glVertexAttribL4dvEXT"); - fp_glVertexAttribLPointerEXT = (pfn_glVertexAttribLPointerEXT)load("glVertexAttribLPointerEXT"); - fp_glGetVertexAttribLdvEXT = (pfn_glGetVertexAttribLdvEXT)load("glGetVertexAttribLdvEXT"); -} - -GLboolean GLAD_EXT_x11_sync_object = GL_FALSE; -static void load_GL_EXT_x11_sync_object(LOADER load) { - if(!GLAD_EXT_x11_sync_object) return; - fp_glImportSyncEXT = (pfn_glImportSyncEXT)load("glImportSyncEXT"); -} - -GLboolean GLAD_EXT_YUV_target = GL_FALSE; -GLboolean GLAD_OES_compressed_ETC1_RGB8_sub_texture = GL_FALSE; -GLboolean GLAD_OES_compressed_ETC1_RGB8_texture = GL_FALSE; -GLboolean GLAD_OES_copy_image = GL_FALSE; -static void load_GL_OES_copy_image(LOADER load) { - if(!GLAD_OES_copy_image) return; - fp_glCopyImageSubDataOES = (pfn_glCopyImageSubDataOES)load("glCopyImageSubDataOES"); -} - -GLboolean GLAD_OES_depth24 = GL_FALSE; -GLboolean GLAD_OES_depth32 = GL_FALSE; -GLboolean GLAD_OES_depth_texture = GL_FALSE; -GLboolean GLAD_OES_draw_buffers_indexed = GL_FALSE; -static void load_GL_OES_draw_buffers_indexed(LOADER load) { - if(!GLAD_OES_draw_buffers_indexed) return; - fp_glEnableiOES = (pfn_glEnableiOES)load("glEnableiOES"); - fp_glDisableiOES = (pfn_glDisableiOES)load("glDisableiOES"); - fp_glBlendEquationiOES = (pfn_glBlendEquationiOES)load("glBlendEquationiOES"); - fp_glBlendEquationSeparateiOES = (pfn_glBlendEquationSeparateiOES)load("glBlendEquationSeparateiOES"); - fp_glBlendFunciOES = (pfn_glBlendFunciOES)load("glBlendFunciOES"); - fp_glBlendFuncSeparateiOES = (pfn_glBlendFuncSeparateiOES)load("glBlendFuncSeparateiOES"); - fp_glColorMaskiOES = (pfn_glColorMaskiOES)load("glColorMaskiOES"); - fp_glIsEnablediOES = (pfn_glIsEnablediOES)load("glIsEnablediOES"); -} - -GLboolean GLAD_OES_draw_elements_base_vertex = GL_FALSE; -static void load_GL_OES_draw_elements_base_vertex(LOADER load) { - if(!GLAD_OES_draw_elements_base_vertex) return; - fp_glDrawElementsBaseVertexOES = (pfn_glDrawElementsBaseVertexOES)load("glDrawElementsBaseVertexOES"); - fp_glDrawRangeElementsBaseVertexOES = (pfn_glDrawRangeElementsBaseVertexOES)load("glDrawRangeElementsBaseVertexOES"); - fp_glDrawElementsInstancedBaseVertexOES = (pfn_glDrawElementsInstancedBaseVertexOES)load("glDrawElementsInstancedBaseVertexOES"); - fp_glMultiDrawElementsBaseVertexOES = (pfn_glMultiDrawElementsBaseVertexOES)load("glMultiDrawElementsBaseVertexOES"); -} - -GLboolean GLAD_OES_EGL_image = GL_FALSE; -static void load_GL_OES_EGL_image(LOADER load) { - if(!GLAD_OES_EGL_image) return; - fp_glEGLImageTargetTexture2DOES = (pfn_glEGLImageTargetTexture2DOES)load("glEGLImageTargetTexture2DOES"); - fp_glEGLImageTargetRenderbufferStorageOES = (pfn_glEGLImageTargetRenderbufferStorageOES)load("glEGLImageTargetRenderbufferStorageOES"); -} - -GLboolean GLAD_OES_EGL_image_external = GL_FALSE; -GLboolean GLAD_OES_EGL_image_external_essl3 = GL_FALSE; -GLboolean GLAD_OES_element_index_uint = GL_FALSE; -GLboolean GLAD_OES_fbo_render_mipmap = GL_FALSE; -GLboolean GLAD_OES_fragment_precision_high = GL_FALSE; -GLboolean GLAD_OES_geometry_point_size = GL_FALSE; -GLboolean GLAD_OES_geometry_shader = GL_FALSE; -static void load_GL_OES_geometry_shader(LOADER load) { - if(!GLAD_OES_geometry_shader) return; - fp_glFramebufferTextureOES = (pfn_glFramebufferTextureOES)load("glFramebufferTextureOES"); -} - -GLboolean GLAD_OES_get_program_binary = GL_FALSE; -static void load_GL_OES_get_program_binary(LOADER load) { - if(!GLAD_OES_get_program_binary) return; - fp_glGetProgramBinaryOES = (pfn_glGetProgramBinaryOES)load("glGetProgramBinaryOES"); - fp_glProgramBinaryOES = (pfn_glProgramBinaryOES)load("glProgramBinaryOES"); -} - -GLboolean GLAD_OES_gpu_shader5 = GL_FALSE; -GLboolean GLAD_OES_mapbuffer = GL_FALSE; -static void load_GL_OES_mapbuffer(LOADER load) { - if(!GLAD_OES_mapbuffer) return; - fp_glMapBufferOES = (pfn_glMapBufferOES)load("glMapBufferOES"); - fp_glUnmapBufferOES = (pfn_glUnmapBufferOES)load("glUnmapBufferOES"); - fp_glGetBufferPointervOES = (pfn_glGetBufferPointervOES)load("glGetBufferPointervOES"); -} - -GLboolean GLAD_OES_packed_depth_stencil = GL_FALSE; -GLboolean GLAD_OES_primitive_bounding_box = GL_FALSE; -static void load_GL_OES_primitive_bounding_box(LOADER load) { - if(!GLAD_OES_primitive_bounding_box) return; - fp_glPrimitiveBoundingBoxOES = (pfn_glPrimitiveBoundingBoxOES)load("glPrimitiveBoundingBoxOES"); -} - -GLboolean GLAD_OES_required_internalformat = GL_FALSE; -GLboolean GLAD_OES_rgb8_rgba8 = GL_FALSE; -GLboolean GLAD_OES_sample_shading = GL_FALSE; -static void load_GL_OES_sample_shading(LOADER load) { - if(!GLAD_OES_sample_shading) return; - fp_glMinSampleShadingOES = (pfn_glMinSampleShadingOES)load("glMinSampleShadingOES"); -} - -GLboolean GLAD_OES_sample_variables = GL_FALSE; -GLboolean GLAD_OES_shader_image_atomic = GL_FALSE; -GLboolean GLAD_OES_shader_io_blocks = GL_FALSE; -GLboolean GLAD_OES_shader_multisample_interpolation = GL_FALSE; -GLboolean GLAD_OES_standard_derivatives = GL_FALSE; -GLboolean GLAD_OES_stencil1 = GL_FALSE; -GLboolean GLAD_OES_stencil4 = GL_FALSE; -GLboolean GLAD_OES_surfaceless_context = GL_FALSE; -GLboolean GLAD_OES_tessellation_point_size = GL_FALSE; -GLboolean GLAD_OES_tessellation_shader = GL_FALSE; -static void load_GL_OES_tessellation_shader(LOADER load) { - if(!GLAD_OES_tessellation_shader) return; - fp_glPatchParameteriOES = (pfn_glPatchParameteriOES)load("glPatchParameteriOES"); -} - -GLboolean GLAD_OES_texture_3D = GL_FALSE; -static void load_GL_OES_texture_3D(LOADER load) { - if(!GLAD_OES_texture_3D) return; - fp_glTexImage3DOES = (pfn_glTexImage3DOES)load("glTexImage3DOES"); - fp_glTexSubImage3DOES = (pfn_glTexSubImage3DOES)load("glTexSubImage3DOES"); - fp_glCopyTexSubImage3DOES = (pfn_glCopyTexSubImage3DOES)load("glCopyTexSubImage3DOES"); - fp_glCompressedTexImage3DOES = (pfn_glCompressedTexImage3DOES)load("glCompressedTexImage3DOES"); - fp_glCompressedTexSubImage3DOES = (pfn_glCompressedTexSubImage3DOES)load("glCompressedTexSubImage3DOES"); - fp_glFramebufferTexture3DOES = (pfn_glFramebufferTexture3DOES)load("glFramebufferTexture3DOES"); -} - -GLboolean GLAD_OES_texture_border_clamp = GL_FALSE; -static void load_GL_OES_texture_border_clamp(LOADER load) { - if(!GLAD_OES_texture_border_clamp) return; - fp_glTexParameterIivOES = (pfn_glTexParameterIivOES)load("glTexParameterIivOES"); - fp_glTexParameterIuivOES = (pfn_glTexParameterIuivOES)load("glTexParameterIuivOES"); - fp_glGetTexParameterIivOES = (pfn_glGetTexParameterIivOES)load("glGetTexParameterIivOES"); - fp_glGetTexParameterIuivOES = (pfn_glGetTexParameterIuivOES)load("glGetTexParameterIuivOES"); - fp_glSamplerParameterIivOES = (pfn_glSamplerParameterIivOES)load("glSamplerParameterIivOES"); - fp_glSamplerParameterIuivOES = (pfn_glSamplerParameterIuivOES)load("glSamplerParameterIuivOES"); - fp_glGetSamplerParameterIivOES = (pfn_glGetSamplerParameterIivOES)load("glGetSamplerParameterIivOES"); - fp_glGetSamplerParameterIuivOES = (pfn_glGetSamplerParameterIuivOES)load("glGetSamplerParameterIuivOES"); -} - -GLboolean GLAD_OES_texture_buffer = GL_FALSE; -static void load_GL_OES_texture_buffer(LOADER load) { - if(!GLAD_OES_texture_buffer) return; - fp_glTexBufferOES = (pfn_glTexBufferOES)load("glTexBufferOES"); - fp_glTexBufferRangeOES = (pfn_glTexBufferRangeOES)load("glTexBufferRangeOES"); -} - -GLboolean GLAD_OES_texture_compression_astc = GL_FALSE; -GLboolean GLAD_OES_texture_cube_map_array = GL_FALSE; -GLboolean GLAD_OES_texture_float = GL_FALSE; -GLboolean GLAD_OES_texture_float_linear = GL_FALSE; -GLboolean GLAD_OES_texture_half_float = GL_FALSE; -GLboolean GLAD_OES_texture_half_float_linear = GL_FALSE; -GLboolean GLAD_OES_texture_npot = GL_FALSE; -GLboolean GLAD_OES_texture_stencil8 = GL_FALSE; -GLboolean GLAD_OES_texture_storage_multisample_2d_array = GL_FALSE; -static void load_GL_OES_texture_storage_multisample_2d_array(LOADER load) { - if(!GLAD_OES_texture_storage_multisample_2d_array) return; - fp_glTexStorage3DMultisampleOES = (pfn_glTexStorage3DMultisampleOES)load("glTexStorage3DMultisampleOES"); -} - -GLboolean GLAD_OES_texture_view = GL_FALSE; -static void load_GL_OES_texture_view(LOADER load) { - if(!GLAD_OES_texture_view) return; - fp_glTextureViewOES = (pfn_glTextureViewOES)load("glTextureViewOES"); -} - -GLboolean GLAD_OES_vertex_array_object = GL_FALSE; -static void load_GL_OES_vertex_array_object(LOADER load) { - if(!GLAD_OES_vertex_array_object) return; - fp_glBindVertexArrayOES = (pfn_glBindVertexArrayOES)load("glBindVertexArrayOES"); - fp_glDeleteVertexArraysOES = (pfn_glDeleteVertexArraysOES)load("glDeleteVertexArraysOES"); - fp_glGenVertexArraysOES = (pfn_glGenVertexArraysOES)load("glGenVertexArraysOES"); - fp_glIsVertexArrayOES = (pfn_glIsVertexArrayOES)load("glIsVertexArrayOES"); -} - -GLboolean GLAD_OES_vertex_half_float = GL_FALSE; -GLboolean GLAD_OES_vertex_type_10_10_10_2 = GL_FALSE; -GLboolean GLAD_AMD_blend_minmax_factor = GL_FALSE; -GLboolean GLAD_AMD_compressed_3DC_texture = GL_FALSE; -GLboolean GLAD_AMD_compressed_ATC_texture = GL_FALSE; -GLboolean GLAD_AMD_conservative_depth = GL_FALSE; -GLboolean GLAD_AMD_debug_output = GL_FALSE; -static void load_GL_AMD_debug_output(LOADER load) { - if(!GLAD_AMD_debug_output) return; - fp_glDebugMessageEnableAMD = (pfn_glDebugMessageEnableAMD)load("glDebugMessageEnableAMD"); - fp_glDebugMessageInsertAMD = (pfn_glDebugMessageInsertAMD)load("glDebugMessageInsertAMD"); - fp_glDebugMessageCallbackAMD = (pfn_glDebugMessageCallbackAMD)load("glDebugMessageCallbackAMD"); - fp_glGetDebugMessageLogAMD = (pfn_glGetDebugMessageLogAMD)load("glGetDebugMessageLogAMD"); -} - -GLboolean GLAD_AMD_depth_clamp_separate = GL_FALSE; -GLboolean GLAD_AMD_draw_buffers_blend = GL_FALSE; -static void load_GL_AMD_draw_buffers_blend(LOADER load) { - if(!GLAD_AMD_draw_buffers_blend) return; - fp_glBlendFuncIndexedAMD = (pfn_glBlendFuncIndexedAMD)load("glBlendFuncIndexedAMD"); - fp_glBlendFuncSeparateIndexedAMD = (pfn_glBlendFuncSeparateIndexedAMD)load("glBlendFuncSeparateIndexedAMD"); - fp_glBlendEquationIndexedAMD = (pfn_glBlendEquationIndexedAMD)load("glBlendEquationIndexedAMD"); - fp_glBlendEquationSeparateIndexedAMD = (pfn_glBlendEquationSeparateIndexedAMD)load("glBlendEquationSeparateIndexedAMD"); -} - -GLboolean GLAD_AMD_gcn_shader = GL_FALSE; -GLboolean GLAD_AMD_gpu_shader_int64 = GL_FALSE; -static void load_GL_AMD_gpu_shader_int64(LOADER load) { - if(!GLAD_AMD_gpu_shader_int64) return; - fp_glUniform1i64NV = (pfn_glUniform1i64NV)load("glUniform1i64NV"); - fp_glUniform2i64NV = (pfn_glUniform2i64NV)load("glUniform2i64NV"); - fp_glUniform3i64NV = (pfn_glUniform3i64NV)load("glUniform3i64NV"); - fp_glUniform4i64NV = (pfn_glUniform4i64NV)load("glUniform4i64NV"); - fp_glUniform1i64vNV = (pfn_glUniform1i64vNV)load("glUniform1i64vNV"); - fp_glUniform2i64vNV = (pfn_glUniform2i64vNV)load("glUniform2i64vNV"); - fp_glUniform3i64vNV = (pfn_glUniform3i64vNV)load("glUniform3i64vNV"); - fp_glUniform4i64vNV = (pfn_glUniform4i64vNV)load("glUniform4i64vNV"); - fp_glUniform1ui64NV = (pfn_glUniform1ui64NV)load("glUniform1ui64NV"); - fp_glUniform2ui64NV = (pfn_glUniform2ui64NV)load("glUniform2ui64NV"); - fp_glUniform3ui64NV = (pfn_glUniform3ui64NV)load("glUniform3ui64NV"); - fp_glUniform4ui64NV = (pfn_glUniform4ui64NV)load("glUniform4ui64NV"); - fp_glUniform1ui64vNV = (pfn_glUniform1ui64vNV)load("glUniform1ui64vNV"); - fp_glUniform2ui64vNV = (pfn_glUniform2ui64vNV)load("glUniform2ui64vNV"); - fp_glUniform3ui64vNV = (pfn_glUniform3ui64vNV)load("glUniform3ui64vNV"); - fp_glUniform4ui64vNV = (pfn_glUniform4ui64vNV)load("glUniform4ui64vNV"); - fp_glGetUniformi64vNV = (pfn_glGetUniformi64vNV)load("glGetUniformi64vNV"); - fp_glGetUniformui64vNV = (pfn_glGetUniformui64vNV)load("glGetUniformui64vNV"); - fp_glProgramUniform1i64NV = (pfn_glProgramUniform1i64NV)load("glProgramUniform1i64NV"); - fp_glProgramUniform2i64NV = (pfn_glProgramUniform2i64NV)load("glProgramUniform2i64NV"); - fp_glProgramUniform3i64NV = (pfn_glProgramUniform3i64NV)load("glProgramUniform3i64NV"); - fp_glProgramUniform4i64NV = (pfn_glProgramUniform4i64NV)load("glProgramUniform4i64NV"); - fp_glProgramUniform1i64vNV = (pfn_glProgramUniform1i64vNV)load("glProgramUniform1i64vNV"); - fp_glProgramUniform2i64vNV = (pfn_glProgramUniform2i64vNV)load("glProgramUniform2i64vNV"); - fp_glProgramUniform3i64vNV = (pfn_glProgramUniform3i64vNV)load("glProgramUniform3i64vNV"); - fp_glProgramUniform4i64vNV = (pfn_glProgramUniform4i64vNV)load("glProgramUniform4i64vNV"); - fp_glProgramUniform1ui64NV = (pfn_glProgramUniform1ui64NV)load("glProgramUniform1ui64NV"); - fp_glProgramUniform2ui64NV = (pfn_glProgramUniform2ui64NV)load("glProgramUniform2ui64NV"); - fp_glProgramUniform3ui64NV = (pfn_glProgramUniform3ui64NV)load("glProgramUniform3ui64NV"); - fp_glProgramUniform4ui64NV = (pfn_glProgramUniform4ui64NV)load("glProgramUniform4ui64NV"); - fp_glProgramUniform1ui64vNV = (pfn_glProgramUniform1ui64vNV)load("glProgramUniform1ui64vNV"); - fp_glProgramUniform2ui64vNV = (pfn_glProgramUniform2ui64vNV)load("glProgramUniform2ui64vNV"); - fp_glProgramUniform3ui64vNV = (pfn_glProgramUniform3ui64vNV)load("glProgramUniform3ui64vNV"); - fp_glProgramUniform4ui64vNV = (pfn_glProgramUniform4ui64vNV)load("glProgramUniform4ui64vNV"); -} - -GLboolean GLAD_AMD_interleaved_elements = GL_FALSE; -static void load_GL_AMD_interleaved_elements(LOADER load) { - if(!GLAD_AMD_interleaved_elements) return; - fp_glVertexAttribParameteriAMD = (pfn_glVertexAttribParameteriAMD)load("glVertexAttribParameteriAMD"); -} - -GLboolean GLAD_AMD_multi_draw_indirect = GL_FALSE; -static void load_GL_AMD_multi_draw_indirect(LOADER load) { - if(!GLAD_AMD_multi_draw_indirect) return; - fp_glMultiDrawArraysIndirectAMD = (pfn_glMultiDrawArraysIndirectAMD)load("glMultiDrawArraysIndirectAMD"); - fp_glMultiDrawElementsIndirectAMD = (pfn_glMultiDrawElementsIndirectAMD)load("glMultiDrawElementsIndirectAMD"); -} - -GLboolean GLAD_AMD_name_gen_delete = GL_FALSE; -static void load_GL_AMD_name_gen_delete(LOADER load) { - if(!GLAD_AMD_name_gen_delete) return; - fp_glGenNamesAMD = (pfn_glGenNamesAMD)load("glGenNamesAMD"); - fp_glDeleteNamesAMD = (pfn_glDeleteNamesAMD)load("glDeleteNamesAMD"); - fp_glIsNameAMD = (pfn_glIsNameAMD)load("glIsNameAMD"); -} - -GLboolean GLAD_AMD_occlusion_query_event = GL_FALSE; -static void load_GL_AMD_occlusion_query_event(LOADER load) { - if(!GLAD_AMD_occlusion_query_event) return; - fp_glQueryObjectParameteruiAMD = (pfn_glQueryObjectParameteruiAMD)load("glQueryObjectParameteruiAMD"); -} - -GLboolean GLAD_AMD_performance_monitor = GL_FALSE; -static void load_GL_AMD_performance_monitor(LOADER load) { - if(!GLAD_AMD_performance_monitor) return; - fp_glGetPerfMonitorGroupsAMD = (pfn_glGetPerfMonitorGroupsAMD)load("glGetPerfMonitorGroupsAMD"); - fp_glGetPerfMonitorCountersAMD = (pfn_glGetPerfMonitorCountersAMD)load("glGetPerfMonitorCountersAMD"); - fp_glGetPerfMonitorGroupStringAMD = (pfn_glGetPerfMonitorGroupStringAMD)load("glGetPerfMonitorGroupStringAMD"); - fp_glGetPerfMonitorCounterStringAMD = (pfn_glGetPerfMonitorCounterStringAMD)load("glGetPerfMonitorCounterStringAMD"); - fp_glGetPerfMonitorCounterInfoAMD = (pfn_glGetPerfMonitorCounterInfoAMD)load("glGetPerfMonitorCounterInfoAMD"); - fp_glGenPerfMonitorsAMD = (pfn_glGenPerfMonitorsAMD)load("glGenPerfMonitorsAMD"); - fp_glDeletePerfMonitorsAMD = (pfn_glDeletePerfMonitorsAMD)load("glDeletePerfMonitorsAMD"); - fp_glSelectPerfMonitorCountersAMD = (pfn_glSelectPerfMonitorCountersAMD)load("glSelectPerfMonitorCountersAMD"); - fp_glBeginPerfMonitorAMD = (pfn_glBeginPerfMonitorAMD)load("glBeginPerfMonitorAMD"); - fp_glEndPerfMonitorAMD = (pfn_glEndPerfMonitorAMD)load("glEndPerfMonitorAMD"); - fp_glGetPerfMonitorCounterDataAMD = (pfn_glGetPerfMonitorCounterDataAMD)load("glGetPerfMonitorCounterDataAMD"); -} - -GLboolean GLAD_AMD_pinned_memory = GL_FALSE; -GLboolean GLAD_AMD_program_binary_Z400 = GL_FALSE; -GLboolean GLAD_AMD_query_buffer_object = GL_FALSE; -GLboolean GLAD_AMD_sample_positions = GL_FALSE; -static void load_GL_AMD_sample_positions(LOADER load) { - if(!GLAD_AMD_sample_positions) return; - fp_glSetMultisamplefvAMD = (pfn_glSetMultisamplefvAMD)load("glSetMultisamplefvAMD"); -} - -GLboolean GLAD_AMD_seamless_cubemap_per_texture = GL_FALSE; -GLboolean GLAD_AMD_shader_atomic_counter_ops = GL_FALSE; -GLboolean GLAD_AMD_shader_stencil_export = GL_FALSE; -GLboolean GLAD_AMD_shader_trinary_minmax = GL_FALSE; -GLboolean GLAD_AMD_sparse_texture = GL_FALSE; -static void load_GL_AMD_sparse_texture(LOADER load) { - if(!GLAD_AMD_sparse_texture) return; - fp_glTexStorageSparseAMD = (pfn_glTexStorageSparseAMD)load("glTexStorageSparseAMD"); - fp_glTextureStorageSparseAMD = (pfn_glTextureStorageSparseAMD)load("glTextureStorageSparseAMD"); -} - -GLboolean GLAD_AMD_stencil_operation_extended = GL_FALSE; -static void load_GL_AMD_stencil_operation_extended(LOADER load) { - if(!GLAD_AMD_stencil_operation_extended) return; - fp_glStencilOpValueAMD = (pfn_glStencilOpValueAMD)load("glStencilOpValueAMD"); -} - -GLboolean GLAD_AMD_texture_texture4 = GL_FALSE; -GLboolean GLAD_AMD_transform_feedback3_lines_triangles = GL_FALSE; -GLboolean GLAD_AMD_transform_feedback4 = GL_FALSE; -GLboolean GLAD_AMD_vertex_shader_layer = GL_FALSE; -GLboolean GLAD_AMD_vertex_shader_tessellator = GL_FALSE; -static void load_GL_AMD_vertex_shader_tessellator(LOADER load) { - if(!GLAD_AMD_vertex_shader_tessellator) return; - fp_glTessellationFactorAMD = (pfn_glTessellationFactorAMD)load("glTessellationFactorAMD"); - fp_glTessellationModeAMD = (pfn_glTessellationModeAMD)load("glTessellationModeAMD"); -} - -GLboolean GLAD_AMD_vertex_shader_viewport_index = GL_FALSE; -GLboolean GLAD_ANDROID_extension_pack_es31a = GL_FALSE; -GLboolean GLAD_ANGLE_depth_texture = GL_FALSE; -GLboolean GLAD_ANGLE_framebuffer_blit = GL_FALSE; -static void load_GL_ANGLE_framebuffer_blit(LOADER load) { - if(!GLAD_ANGLE_framebuffer_blit) return; - fp_glBlitFramebufferANGLE = (pfn_glBlitFramebufferANGLE)load("glBlitFramebufferANGLE"); -} - -GLboolean GLAD_ANGLE_framebuffer_multisample = GL_FALSE; -static void load_GL_ANGLE_framebuffer_multisample(LOADER load) { - if(!GLAD_ANGLE_framebuffer_multisample) return; - fp_glRenderbufferStorageMultisampleANGLE = (pfn_glRenderbufferStorageMultisampleANGLE)load("glRenderbufferStorageMultisampleANGLE"); -} - -GLboolean GLAD_ANGLE_instanced_arrays = GL_FALSE; -static void load_GL_ANGLE_instanced_arrays(LOADER load) { - if(!GLAD_ANGLE_instanced_arrays) return; - fp_glDrawArraysInstancedANGLE = (pfn_glDrawArraysInstancedANGLE)load("glDrawArraysInstancedANGLE"); - fp_glDrawElementsInstancedANGLE = (pfn_glDrawElementsInstancedANGLE)load("glDrawElementsInstancedANGLE"); - fp_glVertexAttribDivisorANGLE = (pfn_glVertexAttribDivisorANGLE)load("glVertexAttribDivisorANGLE"); -} - -GLboolean GLAD_ANGLE_pack_reverse_row_order = GL_FALSE; -GLboolean GLAD_ANGLE_program_binary = GL_FALSE; -GLboolean GLAD_ANGLE_texture_compression_dxt3 = GL_FALSE; -GLboolean GLAD_ANGLE_texture_compression_dxt5 = GL_FALSE; -GLboolean GLAD_ANGLE_texture_usage = GL_FALSE; -GLboolean GLAD_ANGLE_translated_shader_source = GL_FALSE; -static void load_GL_ANGLE_translated_shader_source(LOADER load) { - if(!GLAD_ANGLE_translated_shader_source) return; - fp_glGetTranslatedShaderSourceANGLE = (pfn_glGetTranslatedShaderSourceANGLE)load("glGetTranslatedShaderSourceANGLE"); -} - -GLboolean GLAD_APPLE_aux_depth_stencil = GL_FALSE; -GLboolean GLAD_APPLE_client_storage = GL_FALSE; -GLboolean GLAD_APPLE_clip_distance = GL_FALSE; -GLboolean GLAD_APPLE_color_buffer_packed_float = GL_FALSE; -GLboolean GLAD_APPLE_copy_texture_levels = GL_FALSE; -static void load_GL_APPLE_copy_texture_levels(LOADER load) { - if(!GLAD_APPLE_copy_texture_levels) return; - fp_glCopyTextureLevelsAPPLE = (pfn_glCopyTextureLevelsAPPLE)load("glCopyTextureLevelsAPPLE"); -} - -GLboolean GLAD_APPLE_element_array = GL_FALSE; -static void load_GL_APPLE_element_array(LOADER load) { - if(!GLAD_APPLE_element_array) return; - fp_glElementPointerAPPLE = (pfn_glElementPointerAPPLE)load("glElementPointerAPPLE"); - fp_glDrawElementArrayAPPLE = (pfn_glDrawElementArrayAPPLE)load("glDrawElementArrayAPPLE"); - fp_glDrawRangeElementArrayAPPLE = (pfn_glDrawRangeElementArrayAPPLE)load("glDrawRangeElementArrayAPPLE"); - fp_glMultiDrawElementArrayAPPLE = (pfn_glMultiDrawElementArrayAPPLE)load("glMultiDrawElementArrayAPPLE"); - fp_glMultiDrawRangeElementArrayAPPLE = (pfn_glMultiDrawRangeElementArrayAPPLE)load("glMultiDrawRangeElementArrayAPPLE"); -} - -GLboolean GLAD_APPLE_fence = GL_FALSE; -static void load_GL_APPLE_fence(LOADER load) { - if(!GLAD_APPLE_fence) return; - fp_glGenFencesAPPLE = (pfn_glGenFencesAPPLE)load("glGenFencesAPPLE"); - fp_glDeleteFencesAPPLE = (pfn_glDeleteFencesAPPLE)load("glDeleteFencesAPPLE"); - fp_glSetFenceAPPLE = (pfn_glSetFenceAPPLE)load("glSetFenceAPPLE"); - fp_glIsFenceAPPLE = (pfn_glIsFenceAPPLE)load("glIsFenceAPPLE"); - fp_glTestFenceAPPLE = (pfn_glTestFenceAPPLE)load("glTestFenceAPPLE"); - fp_glFinishFenceAPPLE = (pfn_glFinishFenceAPPLE)load("glFinishFenceAPPLE"); - fp_glTestObjectAPPLE = (pfn_glTestObjectAPPLE)load("glTestObjectAPPLE"); - fp_glFinishObjectAPPLE = (pfn_glFinishObjectAPPLE)load("glFinishObjectAPPLE"); -} - -GLboolean GLAD_APPLE_float_pixels = GL_FALSE; -GLboolean GLAD_APPLE_flush_buffer_range = GL_FALSE; -static void load_GL_APPLE_flush_buffer_range(LOADER load) { - if(!GLAD_APPLE_flush_buffer_range) return; - fp_glBufferParameteriAPPLE = (pfn_glBufferParameteriAPPLE)load("glBufferParameteriAPPLE"); - fp_glFlushMappedBufferRangeAPPLE = (pfn_glFlushMappedBufferRangeAPPLE)load("glFlushMappedBufferRangeAPPLE"); -} - -GLboolean GLAD_APPLE_framebuffer_multisample = GL_FALSE; -static void load_GL_APPLE_framebuffer_multisample(LOADER load) { - if(!GLAD_APPLE_framebuffer_multisample) return; - fp_glRenderbufferStorageMultisampleAPPLE = (pfn_glRenderbufferStorageMultisampleAPPLE)load("glRenderbufferStorageMultisampleAPPLE"); - fp_glResolveMultisampleFramebufferAPPLE = (pfn_glResolveMultisampleFramebufferAPPLE)load("glResolveMultisampleFramebufferAPPLE"); -} - -GLboolean GLAD_APPLE_object_purgeable = GL_FALSE; -static void load_GL_APPLE_object_purgeable(LOADER load) { - if(!GLAD_APPLE_object_purgeable) return; - fp_glObjectPurgeableAPPLE = (pfn_glObjectPurgeableAPPLE)load("glObjectPurgeableAPPLE"); - fp_glObjectUnpurgeableAPPLE = (pfn_glObjectUnpurgeableAPPLE)load("glObjectUnpurgeableAPPLE"); - fp_glGetObjectParameterivAPPLE = (pfn_glGetObjectParameterivAPPLE)load("glGetObjectParameterivAPPLE"); -} - -GLboolean GLAD_APPLE_rgb_422 = GL_FALSE; -GLboolean GLAD_APPLE_row_bytes = GL_FALSE; -GLboolean GLAD_APPLE_sync = GL_FALSE; -static void load_GL_APPLE_sync(LOADER load) { - if(!GLAD_APPLE_sync) return; - fp_glFenceSyncAPPLE = (pfn_glFenceSyncAPPLE)load("glFenceSyncAPPLE"); - fp_glIsSyncAPPLE = (pfn_glIsSyncAPPLE)load("glIsSyncAPPLE"); - fp_glDeleteSyncAPPLE = (pfn_glDeleteSyncAPPLE)load("glDeleteSyncAPPLE"); - fp_glClientWaitSyncAPPLE = (pfn_glClientWaitSyncAPPLE)load("glClientWaitSyncAPPLE"); - fp_glWaitSyncAPPLE = (pfn_glWaitSyncAPPLE)load("glWaitSyncAPPLE"); - fp_glGetInteger64vAPPLE = (pfn_glGetInteger64vAPPLE)load("glGetInteger64vAPPLE"); - fp_glGetSyncivAPPLE = (pfn_glGetSyncivAPPLE)load("glGetSyncivAPPLE"); -} - -GLboolean GLAD_APPLE_texture_format_BGRA8888 = GL_FALSE; -GLboolean GLAD_APPLE_texture_max_level = GL_FALSE; -GLboolean GLAD_APPLE_texture_packed_float = GL_FALSE; -GLboolean GLAD_APPLE_texture_range = GL_FALSE; -static void load_GL_APPLE_texture_range(LOADER load) { - if(!GLAD_APPLE_texture_range) return; - fp_glTextureRangeAPPLE = (pfn_glTextureRangeAPPLE)load("glTextureRangeAPPLE"); - fp_glGetTexParameterPointervAPPLE = (pfn_glGetTexParameterPointervAPPLE)load("glGetTexParameterPointervAPPLE"); -} - -GLboolean GLAD_APPLE_vertex_array_object = GL_FALSE; -static void load_GL_APPLE_vertex_array_object(LOADER load) { - if(!GLAD_APPLE_vertex_array_object) return; - fp_glBindVertexArrayAPPLE = (pfn_glBindVertexArrayAPPLE)load("glBindVertexArrayAPPLE"); - fp_glDeleteVertexArraysAPPLE = (pfn_glDeleteVertexArraysAPPLE)load("glDeleteVertexArraysAPPLE"); - fp_glGenVertexArraysAPPLE = (pfn_glGenVertexArraysAPPLE)load("glGenVertexArraysAPPLE"); - fp_glIsVertexArrayAPPLE = (pfn_glIsVertexArrayAPPLE)load("glIsVertexArrayAPPLE"); -} - -GLboolean GLAD_APPLE_vertex_array_range = GL_FALSE; -static void load_GL_APPLE_vertex_array_range(LOADER load) { - if(!GLAD_APPLE_vertex_array_range) return; - fp_glVertexArrayRangeAPPLE = (pfn_glVertexArrayRangeAPPLE)load("glVertexArrayRangeAPPLE"); - fp_glFlushVertexArrayRangeAPPLE = (pfn_glFlushVertexArrayRangeAPPLE)load("glFlushVertexArrayRangeAPPLE"); - fp_glVertexArrayParameteriAPPLE = (pfn_glVertexArrayParameteriAPPLE)load("glVertexArrayParameteriAPPLE"); -} - -GLboolean GLAD_APPLE_vertex_program_evaluators = GL_FALSE; -static void load_GL_APPLE_vertex_program_evaluators(LOADER load) { - if(!GLAD_APPLE_vertex_program_evaluators) return; - fp_glEnableVertexAttribAPPLE = (pfn_glEnableVertexAttribAPPLE)load("glEnableVertexAttribAPPLE"); - fp_glDisableVertexAttribAPPLE = (pfn_glDisableVertexAttribAPPLE)load("glDisableVertexAttribAPPLE"); - fp_glIsVertexAttribEnabledAPPLE = (pfn_glIsVertexAttribEnabledAPPLE)load("glIsVertexAttribEnabledAPPLE"); - fp_glMapVertexAttrib1dAPPLE = (pfn_glMapVertexAttrib1dAPPLE)load("glMapVertexAttrib1dAPPLE"); - fp_glMapVertexAttrib1fAPPLE = (pfn_glMapVertexAttrib1fAPPLE)load("glMapVertexAttrib1fAPPLE"); - fp_glMapVertexAttrib2dAPPLE = (pfn_glMapVertexAttrib2dAPPLE)load("glMapVertexAttrib2dAPPLE"); - fp_glMapVertexAttrib2fAPPLE = (pfn_glMapVertexAttrib2fAPPLE)load("glMapVertexAttrib2fAPPLE"); -} - -GLboolean GLAD_APPLE_ycbcr_422 = GL_FALSE; -GLboolean GLAD_ARM_mali_program_binary = GL_FALSE; -GLboolean GLAD_ARM_mali_shader_binary = GL_FALSE; -GLboolean GLAD_ARM_rgba8 = GL_FALSE; -GLboolean GLAD_ARM_shader_framebuffer_fetch = GL_FALSE; -GLboolean GLAD_ARM_shader_framebuffer_fetch_depth_stencil = GL_FALSE; -GLboolean GLAD_ATI_meminfo = GL_FALSE; -GLboolean GLAD_ATI_pixel_format_float = GL_FALSE; -GLboolean GLAD_DMP_program_binary = GL_FALSE; -GLboolean GLAD_DMP_shader_binary = GL_FALSE; -GLboolean GLAD_FJ_shader_binary_GCCSO = GL_FALSE; -GLboolean GLAD_GREMEDY_frame_terminator = GL_FALSE; -static void load_GL_GREMEDY_frame_terminator(LOADER load) { - if(!GLAD_GREMEDY_frame_terminator) return; - fp_glFrameTerminatorGREMEDY = (pfn_glFrameTerminatorGREMEDY)load("glFrameTerminatorGREMEDY"); -} - -GLboolean GLAD_GREMEDY_string_marker = GL_FALSE; -static void load_GL_GREMEDY_string_marker(LOADER load) { - if(!GLAD_GREMEDY_string_marker) return; - fp_glStringMarkerGREMEDY = (pfn_glStringMarkerGREMEDY)load("glStringMarkerGREMEDY"); -} - -GLboolean GLAD_IMG_multisampled_render_to_texture = GL_FALSE; -static void load_GL_IMG_multisampled_render_to_texture(LOADER load) { - if(!GLAD_IMG_multisampled_render_to_texture) return; - fp_glRenderbufferStorageMultisampleIMG = (pfn_glRenderbufferStorageMultisampleIMG)load("glRenderbufferStorageMultisampleIMG"); - fp_glFramebufferTexture2DMultisampleIMG = (pfn_glFramebufferTexture2DMultisampleIMG)load("glFramebufferTexture2DMultisampleIMG"); -} - -GLboolean GLAD_IMG_program_binary = GL_FALSE; -GLboolean GLAD_IMG_read_format = GL_FALSE; -GLboolean GLAD_IMG_shader_binary = GL_FALSE; -GLboolean GLAD_IMG_texture_compression_pvrtc = GL_FALSE; -GLboolean GLAD_IMG_texture_compression_pvrtc2 = GL_FALSE; -GLboolean GLAD_IMG_texture_filter_cubic = GL_FALSE; -GLboolean GLAD_INGR_blend_func_separate = GL_FALSE; -static void load_GL_INGR_blend_func_separate(LOADER load) { - if(!GLAD_INGR_blend_func_separate) return; - fp_glBlendFuncSeparateINGR = (pfn_glBlendFuncSeparateINGR)load("glBlendFuncSeparateINGR"); -} - -GLboolean GLAD_INTEL_fragment_shader_ordering = GL_FALSE; -GLboolean GLAD_INTEL_framebuffer_CMAA = GL_FALSE; -static void load_GL_INTEL_framebuffer_CMAA(LOADER load) { - if(!GLAD_INTEL_framebuffer_CMAA) return; - fp_glApplyFramebufferAttachmentCMAAINTEL = (pfn_glApplyFramebufferAttachmentCMAAINTEL)load("glApplyFramebufferAttachmentCMAAINTEL"); -} - -GLboolean GLAD_INTEL_map_texture = GL_FALSE; -static void load_GL_INTEL_map_texture(LOADER load) { - if(!GLAD_INTEL_map_texture) return; - fp_glSyncTextureINTEL = (pfn_glSyncTextureINTEL)load("glSyncTextureINTEL"); - fp_glUnmapTexture2DINTEL = (pfn_glUnmapTexture2DINTEL)load("glUnmapTexture2DINTEL"); - fp_glMapTexture2DINTEL = (pfn_glMapTexture2DINTEL)load("glMapTexture2DINTEL"); -} - -GLboolean GLAD_INTEL_performance_query = GL_FALSE; -static void load_GL_INTEL_performance_query(LOADER load) { - if(!GLAD_INTEL_performance_query) return; - fp_glBeginPerfQueryINTEL = (pfn_glBeginPerfQueryINTEL)load("glBeginPerfQueryINTEL"); - fp_glCreatePerfQueryINTEL = (pfn_glCreatePerfQueryINTEL)load("glCreatePerfQueryINTEL"); - fp_glDeletePerfQueryINTEL = (pfn_glDeletePerfQueryINTEL)load("glDeletePerfQueryINTEL"); - fp_glEndPerfQueryINTEL = (pfn_glEndPerfQueryINTEL)load("glEndPerfQueryINTEL"); - fp_glGetFirstPerfQueryIdINTEL = (pfn_glGetFirstPerfQueryIdINTEL)load("glGetFirstPerfQueryIdINTEL"); - fp_glGetNextPerfQueryIdINTEL = (pfn_glGetNextPerfQueryIdINTEL)load("glGetNextPerfQueryIdINTEL"); - fp_glGetPerfCounterInfoINTEL = (pfn_glGetPerfCounterInfoINTEL)load("glGetPerfCounterInfoINTEL"); - fp_glGetPerfQueryDataINTEL = (pfn_glGetPerfQueryDataINTEL)load("glGetPerfQueryDataINTEL"); - fp_glGetPerfQueryIdByNameINTEL = (pfn_glGetPerfQueryIdByNameINTEL)load("glGetPerfQueryIdByNameINTEL"); - fp_glGetPerfQueryInfoINTEL = (pfn_glGetPerfQueryInfoINTEL)load("glGetPerfQueryInfoINTEL"); -} - -GLboolean GLAD_MESA_pack_invert = GL_FALSE; -GLboolean GLAD_MESA_ycbcr_texture = GL_FALSE; -GLboolean GLAD_MESAX_texture_stack = GL_FALSE; -GLboolean GLAD_NV_bindless_multi_draw_indirect = GL_FALSE; -static void load_GL_NV_bindless_multi_draw_indirect(LOADER load) { - if(!GLAD_NV_bindless_multi_draw_indirect) return; - fp_glMultiDrawArraysIndirectBindlessNV = (pfn_glMultiDrawArraysIndirectBindlessNV)load("glMultiDrawArraysIndirectBindlessNV"); - fp_glMultiDrawElementsIndirectBindlessNV = (pfn_glMultiDrawElementsIndirectBindlessNV)load("glMultiDrawElementsIndirectBindlessNV"); -} - -GLboolean GLAD_NV_bindless_multi_draw_indirect_count = GL_FALSE; -static void load_GL_NV_bindless_multi_draw_indirect_count(LOADER load) { - if(!GLAD_NV_bindless_multi_draw_indirect_count) return; - fp_glMultiDrawArraysIndirectBindlessCountNV = (pfn_glMultiDrawArraysIndirectBindlessCountNV)load("glMultiDrawArraysIndirectBindlessCountNV"); - fp_glMultiDrawElementsIndirectBindlessCountNV = (pfn_glMultiDrawElementsIndirectBindlessCountNV)load("glMultiDrawElementsIndirectBindlessCountNV"); -} - -GLboolean GLAD_NV_bindless_texture = GL_FALSE; -static void load_GL_NV_bindless_texture(LOADER load) { - if(!GLAD_NV_bindless_texture) return; - fp_glGetTextureHandleNV = (pfn_glGetTextureHandleNV)load("glGetTextureHandleNV"); - fp_glGetTextureSamplerHandleNV = (pfn_glGetTextureSamplerHandleNV)load("glGetTextureSamplerHandleNV"); - fp_glMakeTextureHandleResidentNV = (pfn_glMakeTextureHandleResidentNV)load("glMakeTextureHandleResidentNV"); - fp_glMakeTextureHandleNonResidentNV = (pfn_glMakeTextureHandleNonResidentNV)load("glMakeTextureHandleNonResidentNV"); - fp_glGetImageHandleNV = (pfn_glGetImageHandleNV)load("glGetImageHandleNV"); - fp_glMakeImageHandleResidentNV = (pfn_glMakeImageHandleResidentNV)load("glMakeImageHandleResidentNV"); - fp_glMakeImageHandleNonResidentNV = (pfn_glMakeImageHandleNonResidentNV)load("glMakeImageHandleNonResidentNV"); - fp_glUniformHandleui64NV = (pfn_glUniformHandleui64NV)load("glUniformHandleui64NV"); - fp_glUniformHandleui64vNV = (pfn_glUniformHandleui64vNV)load("glUniformHandleui64vNV"); - fp_glProgramUniformHandleui64NV = (pfn_glProgramUniformHandleui64NV)load("glProgramUniformHandleui64NV"); - fp_glProgramUniformHandleui64vNV = (pfn_glProgramUniformHandleui64vNV)load("glProgramUniformHandleui64vNV"); - fp_glIsTextureHandleResidentNV = (pfn_glIsTextureHandleResidentNV)load("glIsTextureHandleResidentNV"); - fp_glIsImageHandleResidentNV = (pfn_glIsImageHandleResidentNV)load("glIsImageHandleResidentNV"); -} - -GLboolean GLAD_NV_blend_equation_advanced = GL_FALSE; -static void load_GL_NV_blend_equation_advanced(LOADER load) { - if(!GLAD_NV_blend_equation_advanced) return; - fp_glBlendParameteriNV = (pfn_glBlendParameteriNV)load("glBlendParameteriNV"); - fp_glBlendBarrierNV = (pfn_glBlendBarrierNV)load("glBlendBarrierNV"); -} - -GLboolean GLAD_NV_blend_equation_advanced_coherent = GL_FALSE; -GLboolean GLAD_NV_command_list = GL_FALSE; -static void load_GL_NV_command_list(LOADER load) { - if(!GLAD_NV_command_list) return; - fp_glCreateStatesNV = (pfn_glCreateStatesNV)load("glCreateStatesNV"); - fp_glDeleteStatesNV = (pfn_glDeleteStatesNV)load("glDeleteStatesNV"); - fp_glIsStateNV = (pfn_glIsStateNV)load("glIsStateNV"); - fp_glStateCaptureNV = (pfn_glStateCaptureNV)load("glStateCaptureNV"); - fp_glGetCommandHeaderNV = (pfn_glGetCommandHeaderNV)load("glGetCommandHeaderNV"); - fp_glGetStageIndexNV = (pfn_glGetStageIndexNV)load("glGetStageIndexNV"); - fp_glDrawCommandsNV = (pfn_glDrawCommandsNV)load("glDrawCommandsNV"); - fp_glDrawCommandsAddressNV = (pfn_glDrawCommandsAddressNV)load("glDrawCommandsAddressNV"); - fp_glDrawCommandsStatesNV = (pfn_glDrawCommandsStatesNV)load("glDrawCommandsStatesNV"); - fp_glDrawCommandsStatesAddressNV = (pfn_glDrawCommandsStatesAddressNV)load("glDrawCommandsStatesAddressNV"); - fp_glCreateCommandListsNV = (pfn_glCreateCommandListsNV)load("glCreateCommandListsNV"); - fp_glDeleteCommandListsNV = (pfn_glDeleteCommandListsNV)load("glDeleteCommandListsNV"); - fp_glIsCommandListNV = (pfn_glIsCommandListNV)load("glIsCommandListNV"); - fp_glListDrawCommandsStatesClientNV = (pfn_glListDrawCommandsStatesClientNV)load("glListDrawCommandsStatesClientNV"); - fp_glCommandListSegmentsNV = (pfn_glCommandListSegmentsNV)load("glCommandListSegmentsNV"); - fp_glCompileCommandListNV = (pfn_glCompileCommandListNV)load("glCompileCommandListNV"); - fp_glCallCommandListNV = (pfn_glCallCommandListNV)load("glCallCommandListNV"); -} - -GLboolean GLAD_NV_compute_program5 = GL_FALSE; -GLboolean GLAD_NV_conditional_render = GL_FALSE; -static void load_GL_NV_conditional_render(LOADER load) { - if(!GLAD_NV_conditional_render) return; - fp_glBeginConditionalRenderNV = (pfn_glBeginConditionalRenderNV)load("glBeginConditionalRenderNV"); - fp_glEndConditionalRenderNV = (pfn_glEndConditionalRenderNV)load("glEndConditionalRenderNV"); -} - -GLboolean GLAD_NV_conservative_raster = GL_FALSE; -static void load_GL_NV_conservative_raster(LOADER load) { - if(!GLAD_NV_conservative_raster) return; - fp_glSubpixelPrecisionBiasNV = (pfn_glSubpixelPrecisionBiasNV)load("glSubpixelPrecisionBiasNV"); -} - -GLboolean GLAD_NV_conservative_raster_dilate = GL_FALSE; -static void load_GL_NV_conservative_raster_dilate(LOADER load) { - if(!GLAD_NV_conservative_raster_dilate) return; - fp_glConservativeRasterParameterfNV = (pfn_glConservativeRasterParameterfNV)load("glConservativeRasterParameterfNV"); -} - -GLboolean GLAD_NV_copy_buffer = GL_FALSE; -static void load_GL_NV_copy_buffer(LOADER load) { - if(!GLAD_NV_copy_buffer) return; - fp_glCopyBufferSubDataNV = (pfn_glCopyBufferSubDataNV)load("glCopyBufferSubDataNV"); -} - -GLboolean GLAD_NV_copy_image = GL_FALSE; -static void load_GL_NV_copy_image(LOADER load) { - if(!GLAD_NV_copy_image) return; - fp_glCopyImageSubDataNV = (pfn_glCopyImageSubDataNV)load("glCopyImageSubDataNV"); -} - -GLboolean GLAD_NV_coverage_sample = GL_FALSE; -static void load_GL_NV_coverage_sample(LOADER load) { - if(!GLAD_NV_coverage_sample) return; - fp_glCoverageMaskNV = (pfn_glCoverageMaskNV)load("glCoverageMaskNV"); - fp_glCoverageOperationNV = (pfn_glCoverageOperationNV)load("glCoverageOperationNV"); -} - -GLboolean GLAD_NV_deep_texture3D = GL_FALSE; -GLboolean GLAD_NV_depth_buffer_float = GL_FALSE; -static void load_GL_NV_depth_buffer_float(LOADER load) { - if(!GLAD_NV_depth_buffer_float) return; - fp_glDepthRangedNV = (pfn_glDepthRangedNV)load("glDepthRangedNV"); - fp_glClearDepthdNV = (pfn_glClearDepthdNV)load("glClearDepthdNV"); - fp_glDepthBoundsdNV = (pfn_glDepthBoundsdNV)load("glDepthBoundsdNV"); -} - -GLboolean GLAD_NV_depth_clamp = GL_FALSE; -GLboolean GLAD_NV_depth_nonlinear = GL_FALSE; -GLboolean GLAD_NV_draw_buffers = GL_FALSE; -static void load_GL_NV_draw_buffers(LOADER load) { - if(!GLAD_NV_draw_buffers) return; - fp_glDrawBuffersNV = (pfn_glDrawBuffersNV)load("glDrawBuffersNV"); -} - -GLboolean GLAD_NV_draw_instanced = GL_FALSE; -static void load_GL_NV_draw_instanced(LOADER load) { - if(!GLAD_NV_draw_instanced) return; - fp_glDrawArraysInstancedNV = (pfn_glDrawArraysInstancedNV)load("glDrawArraysInstancedNV"); - fp_glDrawElementsInstancedNV = (pfn_glDrawElementsInstancedNV)load("glDrawElementsInstancedNV"); -} - -GLboolean GLAD_NV_draw_texture = GL_FALSE; -static void load_GL_NV_draw_texture(LOADER load) { - if(!GLAD_NV_draw_texture) return; - fp_glDrawTextureNV = (pfn_glDrawTextureNV)load("glDrawTextureNV"); -} - -GLboolean GLAD_NV_explicit_attrib_location = GL_FALSE; -GLboolean GLAD_NV_explicit_multisample = GL_FALSE; -static void load_GL_NV_explicit_multisample(LOADER load) { - if(!GLAD_NV_explicit_multisample) return; - fp_glGetMultisamplefvNV = (pfn_glGetMultisamplefvNV)load("glGetMultisamplefvNV"); - fp_glSampleMaskIndexedNV = (pfn_glSampleMaskIndexedNV)load("glSampleMaskIndexedNV"); - fp_glTexRenderbufferNV = (pfn_glTexRenderbufferNV)load("glTexRenderbufferNV"); -} - -GLboolean GLAD_NV_fbo_color_attachments = GL_FALSE; -GLboolean GLAD_NV_fence = GL_FALSE; -static void load_GL_NV_fence(LOADER load) { - if(!GLAD_NV_fence) return; - fp_glDeleteFencesNV = (pfn_glDeleteFencesNV)load("glDeleteFencesNV"); - fp_glGenFencesNV = (pfn_glGenFencesNV)load("glGenFencesNV"); - fp_glIsFenceNV = (pfn_glIsFenceNV)load("glIsFenceNV"); - fp_glTestFenceNV = (pfn_glTestFenceNV)load("glTestFenceNV"); - fp_glGetFenceivNV = (pfn_glGetFenceivNV)load("glGetFenceivNV"); - fp_glFinishFenceNV = (pfn_glFinishFenceNV)load("glFinishFenceNV"); - fp_glSetFenceNV = (pfn_glSetFenceNV)load("glSetFenceNV"); -} - -GLboolean GLAD_NV_fill_rectangle = GL_FALSE; -GLboolean GLAD_NV_float_buffer = GL_FALSE; -GLboolean GLAD_NV_fragment_coverage_to_color = GL_FALSE; -static void load_GL_NV_fragment_coverage_to_color(LOADER load) { - if(!GLAD_NV_fragment_coverage_to_color) return; - fp_glFragmentCoverageColorNV = (pfn_glFragmentCoverageColorNV)load("glFragmentCoverageColorNV"); -} - -GLboolean GLAD_NV_fragment_program4 = GL_FALSE; -GLboolean GLAD_NV_fragment_shader_interlock = GL_FALSE; -GLboolean GLAD_NV_framebuffer_blit = GL_FALSE; -static void load_GL_NV_framebuffer_blit(LOADER load) { - if(!GLAD_NV_framebuffer_blit) return; - fp_glBlitFramebufferNV = (pfn_glBlitFramebufferNV)load("glBlitFramebufferNV"); -} - -GLboolean GLAD_NV_framebuffer_mixed_samples = GL_FALSE; -static void load_GL_NV_framebuffer_mixed_samples(LOADER load) { - if(!GLAD_NV_framebuffer_mixed_samples) return; - fp_glRasterSamplesEXT = (pfn_glRasterSamplesEXT)load("glRasterSamplesEXT"); - fp_glCoverageModulationTableNV = (pfn_glCoverageModulationTableNV)load("glCoverageModulationTableNV"); - fp_glGetCoverageModulationTableNV = (pfn_glGetCoverageModulationTableNV)load("glGetCoverageModulationTableNV"); - fp_glCoverageModulationNV = (pfn_glCoverageModulationNV)load("glCoverageModulationNV"); -} - -GLboolean GLAD_NV_framebuffer_multisample = GL_FALSE; -static void load_GL_NV_framebuffer_multisample(LOADER load) { - if(!GLAD_NV_framebuffer_multisample) return; - fp_glRenderbufferStorageMultisampleNV = (pfn_glRenderbufferStorageMultisampleNV)load("glRenderbufferStorageMultisampleNV"); -} - -GLboolean GLAD_NV_framebuffer_multisample_coverage = GL_FALSE; -static void load_GL_NV_framebuffer_multisample_coverage(LOADER load) { - if(!GLAD_NV_framebuffer_multisample_coverage) return; - fp_glRenderbufferStorageMultisampleCoverageNV = (pfn_glRenderbufferStorageMultisampleCoverageNV)load("glRenderbufferStorageMultisampleCoverageNV"); -} - -GLboolean GLAD_NV_generate_mipmap_sRGB = GL_FALSE; -GLboolean GLAD_NV_geometry_program4 = GL_FALSE; -static void load_GL_NV_geometry_program4(LOADER load) { - if(!GLAD_NV_geometry_program4) return; - fp_glProgramVertexLimitNV = (pfn_glProgramVertexLimitNV)load("glProgramVertexLimitNV"); - fp_glFramebufferTextureEXT = (pfn_glFramebufferTextureEXT)load("glFramebufferTextureEXT"); - fp_glFramebufferTextureLayerEXT = (pfn_glFramebufferTextureLayerEXT)load("glFramebufferTextureLayerEXT"); - fp_glFramebufferTextureFaceEXT = (pfn_glFramebufferTextureFaceEXT)load("glFramebufferTextureFaceEXT"); -} - -GLboolean GLAD_NV_geometry_shader4 = GL_FALSE; -GLboolean GLAD_NV_geometry_shader_passthrough = GL_FALSE; -GLboolean GLAD_NV_gpu_program4 = GL_FALSE; -static void load_GL_NV_gpu_program4(LOADER load) { - if(!GLAD_NV_gpu_program4) return; - fp_glProgramLocalParameterI4iNV = (pfn_glProgramLocalParameterI4iNV)load("glProgramLocalParameterI4iNV"); - fp_glProgramLocalParameterI4ivNV = (pfn_glProgramLocalParameterI4ivNV)load("glProgramLocalParameterI4ivNV"); - fp_glProgramLocalParametersI4ivNV = (pfn_glProgramLocalParametersI4ivNV)load("glProgramLocalParametersI4ivNV"); - fp_glProgramLocalParameterI4uiNV = (pfn_glProgramLocalParameterI4uiNV)load("glProgramLocalParameterI4uiNV"); - fp_glProgramLocalParameterI4uivNV = (pfn_glProgramLocalParameterI4uivNV)load("glProgramLocalParameterI4uivNV"); - fp_glProgramLocalParametersI4uivNV = (pfn_glProgramLocalParametersI4uivNV)load("glProgramLocalParametersI4uivNV"); - fp_glProgramEnvParameterI4iNV = (pfn_glProgramEnvParameterI4iNV)load("glProgramEnvParameterI4iNV"); - fp_glProgramEnvParameterI4ivNV = (pfn_glProgramEnvParameterI4ivNV)load("glProgramEnvParameterI4ivNV"); - fp_glProgramEnvParametersI4ivNV = (pfn_glProgramEnvParametersI4ivNV)load("glProgramEnvParametersI4ivNV"); - fp_glProgramEnvParameterI4uiNV = (pfn_glProgramEnvParameterI4uiNV)load("glProgramEnvParameterI4uiNV"); - fp_glProgramEnvParameterI4uivNV = (pfn_glProgramEnvParameterI4uivNV)load("glProgramEnvParameterI4uivNV"); - fp_glProgramEnvParametersI4uivNV = (pfn_glProgramEnvParametersI4uivNV)load("glProgramEnvParametersI4uivNV"); - fp_glGetProgramLocalParameterIivNV = (pfn_glGetProgramLocalParameterIivNV)load("glGetProgramLocalParameterIivNV"); - fp_glGetProgramLocalParameterIuivNV = (pfn_glGetProgramLocalParameterIuivNV)load("glGetProgramLocalParameterIuivNV"); - fp_glGetProgramEnvParameterIivNV = (pfn_glGetProgramEnvParameterIivNV)load("glGetProgramEnvParameterIivNV"); - fp_glGetProgramEnvParameterIuivNV = (pfn_glGetProgramEnvParameterIuivNV)load("glGetProgramEnvParameterIuivNV"); -} - -GLboolean GLAD_NV_gpu_program5 = GL_FALSE; -static void load_GL_NV_gpu_program5(LOADER load) { - if(!GLAD_NV_gpu_program5) return; - fp_glProgramSubroutineParametersuivNV = (pfn_glProgramSubroutineParametersuivNV)load("glProgramSubroutineParametersuivNV"); - fp_glGetProgramSubroutineParameteruivNV = (pfn_glGetProgramSubroutineParameteruivNV)load("glGetProgramSubroutineParameteruivNV"); -} - -GLboolean GLAD_NV_gpu_program5_mem_extended = GL_FALSE; -GLboolean GLAD_NV_gpu_shader5 = GL_FALSE; -static void load_GL_NV_gpu_shader5(LOADER load) { - if(!GLAD_NV_gpu_shader5) return; - fp_glUniform1i64NV = (pfn_glUniform1i64NV)load("glUniform1i64NV"); - fp_glUniform2i64NV = (pfn_glUniform2i64NV)load("glUniform2i64NV"); - fp_glUniform3i64NV = (pfn_glUniform3i64NV)load("glUniform3i64NV"); - fp_glUniform4i64NV = (pfn_glUniform4i64NV)load("glUniform4i64NV"); - fp_glUniform1i64vNV = (pfn_glUniform1i64vNV)load("glUniform1i64vNV"); - fp_glUniform2i64vNV = (pfn_glUniform2i64vNV)load("glUniform2i64vNV"); - fp_glUniform3i64vNV = (pfn_glUniform3i64vNV)load("glUniform3i64vNV"); - fp_glUniform4i64vNV = (pfn_glUniform4i64vNV)load("glUniform4i64vNV"); - fp_glUniform1ui64NV = (pfn_glUniform1ui64NV)load("glUniform1ui64NV"); - fp_glUniform2ui64NV = (pfn_glUniform2ui64NV)load("glUniform2ui64NV"); - fp_glUniform3ui64NV = (pfn_glUniform3ui64NV)load("glUniform3ui64NV"); - fp_glUniform4ui64NV = (pfn_glUniform4ui64NV)load("glUniform4ui64NV"); - fp_glUniform1ui64vNV = (pfn_glUniform1ui64vNV)load("glUniform1ui64vNV"); - fp_glUniform2ui64vNV = (pfn_glUniform2ui64vNV)load("glUniform2ui64vNV"); - fp_glUniform3ui64vNV = (pfn_glUniform3ui64vNV)load("glUniform3ui64vNV"); - fp_glUniform4ui64vNV = (pfn_glUniform4ui64vNV)load("glUniform4ui64vNV"); - fp_glGetUniformi64vNV = (pfn_glGetUniformi64vNV)load("glGetUniformi64vNV"); - fp_glProgramUniform1i64NV = (pfn_glProgramUniform1i64NV)load("glProgramUniform1i64NV"); - fp_glProgramUniform2i64NV = (pfn_glProgramUniform2i64NV)load("glProgramUniform2i64NV"); - fp_glProgramUniform3i64NV = (pfn_glProgramUniform3i64NV)load("glProgramUniform3i64NV"); - fp_glProgramUniform4i64NV = (pfn_glProgramUniform4i64NV)load("glProgramUniform4i64NV"); - fp_glProgramUniform1i64vNV = (pfn_glProgramUniform1i64vNV)load("glProgramUniform1i64vNV"); - fp_glProgramUniform2i64vNV = (pfn_glProgramUniform2i64vNV)load("glProgramUniform2i64vNV"); - fp_glProgramUniform3i64vNV = (pfn_glProgramUniform3i64vNV)load("glProgramUniform3i64vNV"); - fp_glProgramUniform4i64vNV = (pfn_glProgramUniform4i64vNV)load("glProgramUniform4i64vNV"); - fp_glProgramUniform1ui64NV = (pfn_glProgramUniform1ui64NV)load("glProgramUniform1ui64NV"); - fp_glProgramUniform2ui64NV = (pfn_glProgramUniform2ui64NV)load("glProgramUniform2ui64NV"); - fp_glProgramUniform3ui64NV = (pfn_glProgramUniform3ui64NV)load("glProgramUniform3ui64NV"); - fp_glProgramUniform4ui64NV = (pfn_glProgramUniform4ui64NV)load("glProgramUniform4ui64NV"); - fp_glProgramUniform1ui64vNV = (pfn_glProgramUniform1ui64vNV)load("glProgramUniform1ui64vNV"); - fp_glProgramUniform2ui64vNV = (pfn_glProgramUniform2ui64vNV)load("glProgramUniform2ui64vNV"); - fp_glProgramUniform3ui64vNV = (pfn_glProgramUniform3ui64vNV)load("glProgramUniform3ui64vNV"); - fp_glProgramUniform4ui64vNV = (pfn_glProgramUniform4ui64vNV)load("glProgramUniform4ui64vNV"); -} - -GLboolean GLAD_NV_half_float = GL_FALSE; -static void load_GL_NV_half_float(LOADER load) { - if(!GLAD_NV_half_float) return; - fp_glVertex2hNV = (pfn_glVertex2hNV)load("glVertex2hNV"); - fp_glVertex2hvNV = (pfn_glVertex2hvNV)load("glVertex2hvNV"); - fp_glVertex3hNV = (pfn_glVertex3hNV)load("glVertex3hNV"); - fp_glVertex3hvNV = (pfn_glVertex3hvNV)load("glVertex3hvNV"); - fp_glVertex4hNV = (pfn_glVertex4hNV)load("glVertex4hNV"); - fp_glVertex4hvNV = (pfn_glVertex4hvNV)load("glVertex4hvNV"); - fp_glNormal3hNV = (pfn_glNormal3hNV)load("glNormal3hNV"); - fp_glNormal3hvNV = (pfn_glNormal3hvNV)load("glNormal3hvNV"); - fp_glColor3hNV = (pfn_glColor3hNV)load("glColor3hNV"); - fp_glColor3hvNV = (pfn_glColor3hvNV)load("glColor3hvNV"); - fp_glColor4hNV = (pfn_glColor4hNV)load("glColor4hNV"); - fp_glColor4hvNV = (pfn_glColor4hvNV)load("glColor4hvNV"); - fp_glTexCoord1hNV = (pfn_glTexCoord1hNV)load("glTexCoord1hNV"); - fp_glTexCoord1hvNV = (pfn_glTexCoord1hvNV)load("glTexCoord1hvNV"); - fp_glTexCoord2hNV = (pfn_glTexCoord2hNV)load("glTexCoord2hNV"); - fp_glTexCoord2hvNV = (pfn_glTexCoord2hvNV)load("glTexCoord2hvNV"); - fp_glTexCoord3hNV = (pfn_glTexCoord3hNV)load("glTexCoord3hNV"); - fp_glTexCoord3hvNV = (pfn_glTexCoord3hvNV)load("glTexCoord3hvNV"); - fp_glTexCoord4hNV = (pfn_glTexCoord4hNV)load("glTexCoord4hNV"); - fp_glTexCoord4hvNV = (pfn_glTexCoord4hvNV)load("glTexCoord4hvNV"); - fp_glMultiTexCoord1hNV = (pfn_glMultiTexCoord1hNV)load("glMultiTexCoord1hNV"); - fp_glMultiTexCoord1hvNV = (pfn_glMultiTexCoord1hvNV)load("glMultiTexCoord1hvNV"); - fp_glMultiTexCoord2hNV = (pfn_glMultiTexCoord2hNV)load("glMultiTexCoord2hNV"); - fp_glMultiTexCoord2hvNV = (pfn_glMultiTexCoord2hvNV)load("glMultiTexCoord2hvNV"); - fp_glMultiTexCoord3hNV = (pfn_glMultiTexCoord3hNV)load("glMultiTexCoord3hNV"); - fp_glMultiTexCoord3hvNV = (pfn_glMultiTexCoord3hvNV)load("glMultiTexCoord3hvNV"); - fp_glMultiTexCoord4hNV = (pfn_glMultiTexCoord4hNV)load("glMultiTexCoord4hNV"); - fp_glMultiTexCoord4hvNV = (pfn_glMultiTexCoord4hvNV)load("glMultiTexCoord4hvNV"); - fp_glFogCoordhNV = (pfn_glFogCoordhNV)load("glFogCoordhNV"); - fp_glFogCoordhvNV = (pfn_glFogCoordhvNV)load("glFogCoordhvNV"); - fp_glSecondaryColor3hNV = (pfn_glSecondaryColor3hNV)load("glSecondaryColor3hNV"); - fp_glSecondaryColor3hvNV = (pfn_glSecondaryColor3hvNV)load("glSecondaryColor3hvNV"); - fp_glVertexWeighthNV = (pfn_glVertexWeighthNV)load("glVertexWeighthNV"); - fp_glVertexWeighthvNV = (pfn_glVertexWeighthvNV)load("glVertexWeighthvNV"); - fp_glVertexAttrib1hNV = (pfn_glVertexAttrib1hNV)load("glVertexAttrib1hNV"); - fp_glVertexAttrib1hvNV = (pfn_glVertexAttrib1hvNV)load("glVertexAttrib1hvNV"); - fp_glVertexAttrib2hNV = (pfn_glVertexAttrib2hNV)load("glVertexAttrib2hNV"); - fp_glVertexAttrib2hvNV = (pfn_glVertexAttrib2hvNV)load("glVertexAttrib2hvNV"); - fp_glVertexAttrib3hNV = (pfn_glVertexAttrib3hNV)load("glVertexAttrib3hNV"); - fp_glVertexAttrib3hvNV = (pfn_glVertexAttrib3hvNV)load("glVertexAttrib3hvNV"); - fp_glVertexAttrib4hNV = (pfn_glVertexAttrib4hNV)load("glVertexAttrib4hNV"); - fp_glVertexAttrib4hvNV = (pfn_glVertexAttrib4hvNV)load("glVertexAttrib4hvNV"); - fp_glVertexAttribs1hvNV = (pfn_glVertexAttribs1hvNV)load("glVertexAttribs1hvNV"); - fp_glVertexAttribs2hvNV = (pfn_glVertexAttribs2hvNV)load("glVertexAttribs2hvNV"); - fp_glVertexAttribs3hvNV = (pfn_glVertexAttribs3hvNV)load("glVertexAttribs3hvNV"); - fp_glVertexAttribs4hvNV = (pfn_glVertexAttribs4hvNV)load("glVertexAttribs4hvNV"); -} - -GLboolean GLAD_NV_image_formats = GL_FALSE; -GLboolean GLAD_NV_instanced_arrays = GL_FALSE; -static void load_GL_NV_instanced_arrays(LOADER load) { - if(!GLAD_NV_instanced_arrays) return; - fp_glVertexAttribDivisorNV = (pfn_glVertexAttribDivisorNV)load("glVertexAttribDivisorNV"); -} - -GLboolean GLAD_NV_internalformat_sample_query = GL_FALSE; -static void load_GL_NV_internalformat_sample_query(LOADER load) { - if(!GLAD_NV_internalformat_sample_query) return; - fp_glGetInternalformatSampleivNV = (pfn_glGetInternalformatSampleivNV)load("glGetInternalformatSampleivNV"); -} - -GLboolean GLAD_NV_multisample_coverage = GL_FALSE; -GLboolean GLAD_NV_non_square_matrices = GL_FALSE; -static void load_GL_NV_non_square_matrices(LOADER load) { - if(!GLAD_NV_non_square_matrices) return; - fp_glUniformMatrix2x3fvNV = (pfn_glUniformMatrix2x3fvNV)load("glUniformMatrix2x3fvNV"); - fp_glUniformMatrix3x2fvNV = (pfn_glUniformMatrix3x2fvNV)load("glUniformMatrix3x2fvNV"); - fp_glUniformMatrix2x4fvNV = (pfn_glUniformMatrix2x4fvNV)load("glUniformMatrix2x4fvNV"); - fp_glUniformMatrix4x2fvNV = (pfn_glUniformMatrix4x2fvNV)load("glUniformMatrix4x2fvNV"); - fp_glUniformMatrix3x4fvNV = (pfn_glUniformMatrix3x4fvNV)load("glUniformMatrix3x4fvNV"); - fp_glUniformMatrix4x3fvNV = (pfn_glUniformMatrix4x3fvNV)load("glUniformMatrix4x3fvNV"); -} - -GLboolean GLAD_NV_occlusion_query = GL_FALSE; -static void load_GL_NV_occlusion_query(LOADER load) { - if(!GLAD_NV_occlusion_query) return; - fp_glGenOcclusionQueriesNV = (pfn_glGenOcclusionQueriesNV)load("glGenOcclusionQueriesNV"); - fp_glDeleteOcclusionQueriesNV = (pfn_glDeleteOcclusionQueriesNV)load("glDeleteOcclusionQueriesNV"); - fp_glIsOcclusionQueryNV = (pfn_glIsOcclusionQueryNV)load("glIsOcclusionQueryNV"); - fp_glBeginOcclusionQueryNV = (pfn_glBeginOcclusionQueryNV)load("glBeginOcclusionQueryNV"); - fp_glEndOcclusionQueryNV = (pfn_glEndOcclusionQueryNV)load("glEndOcclusionQueryNV"); - fp_glGetOcclusionQueryivNV = (pfn_glGetOcclusionQueryivNV)load("glGetOcclusionQueryivNV"); - fp_glGetOcclusionQueryuivNV = (pfn_glGetOcclusionQueryuivNV)load("glGetOcclusionQueryuivNV"); -} - -GLboolean GLAD_NV_parameter_buffer_object = GL_FALSE; -static void load_GL_NV_parameter_buffer_object(LOADER load) { - if(!GLAD_NV_parameter_buffer_object) return; - fp_glProgramBufferParametersfvNV = (pfn_glProgramBufferParametersfvNV)load("glProgramBufferParametersfvNV"); - fp_glProgramBufferParametersIivNV = (pfn_glProgramBufferParametersIivNV)load("glProgramBufferParametersIivNV"); - fp_glProgramBufferParametersIuivNV = (pfn_glProgramBufferParametersIuivNV)load("glProgramBufferParametersIuivNV"); -} - -GLboolean GLAD_NV_parameter_buffer_object2 = GL_FALSE; -GLboolean GLAD_NV_path_rendering = GL_FALSE; -static void load_GL_NV_path_rendering(LOADER load) { - if(!GLAD_NV_path_rendering) return; - fp_glGenPathsNV = (pfn_glGenPathsNV)load("glGenPathsNV"); - fp_glDeletePathsNV = (pfn_glDeletePathsNV)load("glDeletePathsNV"); - fp_glIsPathNV = (pfn_glIsPathNV)load("glIsPathNV"); - fp_glPathCommandsNV = (pfn_glPathCommandsNV)load("glPathCommandsNV"); - fp_glPathCoordsNV = (pfn_glPathCoordsNV)load("glPathCoordsNV"); - fp_glPathSubCommandsNV = (pfn_glPathSubCommandsNV)load("glPathSubCommandsNV"); - fp_glPathSubCoordsNV = (pfn_glPathSubCoordsNV)load("glPathSubCoordsNV"); - fp_glPathStringNV = (pfn_glPathStringNV)load("glPathStringNV"); - fp_glPathGlyphsNV = (pfn_glPathGlyphsNV)load("glPathGlyphsNV"); - fp_glPathGlyphRangeNV = (pfn_glPathGlyphRangeNV)load("glPathGlyphRangeNV"); - fp_glWeightPathsNV = (pfn_glWeightPathsNV)load("glWeightPathsNV"); - fp_glCopyPathNV = (pfn_glCopyPathNV)load("glCopyPathNV"); - fp_glInterpolatePathsNV = (pfn_glInterpolatePathsNV)load("glInterpolatePathsNV"); - fp_glTransformPathNV = (pfn_glTransformPathNV)load("glTransformPathNV"); - fp_glPathParameterivNV = (pfn_glPathParameterivNV)load("glPathParameterivNV"); - fp_glPathParameteriNV = (pfn_glPathParameteriNV)load("glPathParameteriNV"); - fp_glPathParameterfvNV = (pfn_glPathParameterfvNV)load("glPathParameterfvNV"); - fp_glPathParameterfNV = (pfn_glPathParameterfNV)load("glPathParameterfNV"); - fp_glPathDashArrayNV = (pfn_glPathDashArrayNV)load("glPathDashArrayNV"); - fp_glPathStencilFuncNV = (pfn_glPathStencilFuncNV)load("glPathStencilFuncNV"); - fp_glPathStencilDepthOffsetNV = (pfn_glPathStencilDepthOffsetNV)load("glPathStencilDepthOffsetNV"); - fp_glStencilFillPathNV = (pfn_glStencilFillPathNV)load("glStencilFillPathNV"); - fp_glStencilStrokePathNV = (pfn_glStencilStrokePathNV)load("glStencilStrokePathNV"); - fp_glStencilFillPathInstancedNV = (pfn_glStencilFillPathInstancedNV)load("glStencilFillPathInstancedNV"); - fp_glStencilStrokePathInstancedNV = (pfn_glStencilStrokePathInstancedNV)load("glStencilStrokePathInstancedNV"); - fp_glPathCoverDepthFuncNV = (pfn_glPathCoverDepthFuncNV)load("glPathCoverDepthFuncNV"); - fp_glCoverFillPathNV = (pfn_glCoverFillPathNV)load("glCoverFillPathNV"); - fp_glCoverStrokePathNV = (pfn_glCoverStrokePathNV)load("glCoverStrokePathNV"); - fp_glCoverFillPathInstancedNV = (pfn_glCoverFillPathInstancedNV)load("glCoverFillPathInstancedNV"); - fp_glCoverStrokePathInstancedNV = (pfn_glCoverStrokePathInstancedNV)load("glCoverStrokePathInstancedNV"); - fp_glGetPathParameterivNV = (pfn_glGetPathParameterivNV)load("glGetPathParameterivNV"); - fp_glGetPathParameterfvNV = (pfn_glGetPathParameterfvNV)load("glGetPathParameterfvNV"); - fp_glGetPathCommandsNV = (pfn_glGetPathCommandsNV)load("glGetPathCommandsNV"); - fp_glGetPathCoordsNV = (pfn_glGetPathCoordsNV)load("glGetPathCoordsNV"); - fp_glGetPathDashArrayNV = (pfn_glGetPathDashArrayNV)load("glGetPathDashArrayNV"); - fp_glGetPathMetricsNV = (pfn_glGetPathMetricsNV)load("glGetPathMetricsNV"); - fp_glGetPathMetricRangeNV = (pfn_glGetPathMetricRangeNV)load("glGetPathMetricRangeNV"); - fp_glGetPathSpacingNV = (pfn_glGetPathSpacingNV)load("glGetPathSpacingNV"); - fp_glIsPointInFillPathNV = (pfn_glIsPointInFillPathNV)load("glIsPointInFillPathNV"); - fp_glIsPointInStrokePathNV = (pfn_glIsPointInStrokePathNV)load("glIsPointInStrokePathNV"); - fp_glGetPathLengthNV = (pfn_glGetPathLengthNV)load("glGetPathLengthNV"); - fp_glPointAlongPathNV = (pfn_glPointAlongPathNV)load("glPointAlongPathNV"); - fp_glMatrixLoad3x2fNV = (pfn_glMatrixLoad3x2fNV)load("glMatrixLoad3x2fNV"); - fp_glMatrixLoad3x3fNV = (pfn_glMatrixLoad3x3fNV)load("glMatrixLoad3x3fNV"); - fp_glMatrixLoadTranspose3x3fNV = (pfn_glMatrixLoadTranspose3x3fNV)load("glMatrixLoadTranspose3x3fNV"); - fp_glMatrixMult3x2fNV = (pfn_glMatrixMult3x2fNV)load("glMatrixMult3x2fNV"); - fp_glMatrixMult3x3fNV = (pfn_glMatrixMult3x3fNV)load("glMatrixMult3x3fNV"); - fp_glMatrixMultTranspose3x3fNV = (pfn_glMatrixMultTranspose3x3fNV)load("glMatrixMultTranspose3x3fNV"); - fp_glStencilThenCoverFillPathNV = (pfn_glStencilThenCoverFillPathNV)load("glStencilThenCoverFillPathNV"); - fp_glStencilThenCoverStrokePathNV = (pfn_glStencilThenCoverStrokePathNV)load("glStencilThenCoverStrokePathNV"); - fp_glStencilThenCoverFillPathInstancedNV = (pfn_glStencilThenCoverFillPathInstancedNV)load("glStencilThenCoverFillPathInstancedNV"); - fp_glStencilThenCoverStrokePathInstancedNV = (pfn_glStencilThenCoverStrokePathInstancedNV)load("glStencilThenCoverStrokePathInstancedNV"); - fp_glPathGlyphIndexRangeNV = (pfn_glPathGlyphIndexRangeNV)load("glPathGlyphIndexRangeNV"); - fp_glPathGlyphIndexArrayNV = (pfn_glPathGlyphIndexArrayNV)load("glPathGlyphIndexArrayNV"); - fp_glPathMemoryGlyphIndexArrayNV = (pfn_glPathMemoryGlyphIndexArrayNV)load("glPathMemoryGlyphIndexArrayNV"); - fp_glProgramPathFragmentInputGenNV = (pfn_glProgramPathFragmentInputGenNV)load("glProgramPathFragmentInputGenNV"); - fp_glGetProgramResourcefvNV = (pfn_glGetProgramResourcefvNV)load("glGetProgramResourcefvNV"); - fp_glPathColorGenNV = (pfn_glPathColorGenNV)load("glPathColorGenNV"); - fp_glPathTexGenNV = (pfn_glPathTexGenNV)load("glPathTexGenNV"); - fp_glPathFogGenNV = (pfn_glPathFogGenNV)load("glPathFogGenNV"); - fp_glGetPathColorGenivNV = (pfn_glGetPathColorGenivNV)load("glGetPathColorGenivNV"); - fp_glGetPathColorGenfvNV = (pfn_glGetPathColorGenfvNV)load("glGetPathColorGenfvNV"); - fp_glGetPathTexGenivNV = (pfn_glGetPathTexGenivNV)load("glGetPathTexGenivNV"); - fp_glGetPathTexGenfvNV = (pfn_glGetPathTexGenfvNV)load("glGetPathTexGenfvNV"); -} - -GLboolean GLAD_NV_path_rendering_shared_edge = GL_FALSE; -GLboolean GLAD_NV_polygon_mode = GL_FALSE; -static void load_GL_NV_polygon_mode(LOADER load) { - if(!GLAD_NV_polygon_mode) return; - fp_glPolygonModeNV = (pfn_glPolygonModeNV)load("glPolygonModeNV"); -} - -GLboolean GLAD_NV_present_video = GL_FALSE; -static void load_GL_NV_present_video(LOADER load) { - if(!GLAD_NV_present_video) return; - fp_glPresentFrameKeyedNV = (pfn_glPresentFrameKeyedNV)load("glPresentFrameKeyedNV"); - fp_glPresentFrameDualFillNV = (pfn_glPresentFrameDualFillNV)load("glPresentFrameDualFillNV"); - fp_glGetVideoivNV = (pfn_glGetVideoivNV)load("glGetVideoivNV"); - fp_glGetVideouivNV = (pfn_glGetVideouivNV)load("glGetVideouivNV"); - fp_glGetVideoi64vNV = (pfn_glGetVideoi64vNV)load("glGetVideoi64vNV"); - fp_glGetVideoui64vNV = (pfn_glGetVideoui64vNV)load("glGetVideoui64vNV"); -} - -GLboolean GLAD_NV_primitive_restart = GL_FALSE; -static void load_GL_NV_primitive_restart(LOADER load) { - if(!GLAD_NV_primitive_restart) return; - fp_glPrimitiveRestartNV = (pfn_glPrimitiveRestartNV)load("glPrimitiveRestartNV"); - fp_glPrimitiveRestartIndexNV = (pfn_glPrimitiveRestartIndexNV)load("glPrimitiveRestartIndexNV"); -} - -GLboolean GLAD_NV_read_buffer = GL_FALSE; -static void load_GL_NV_read_buffer(LOADER load) { - if(!GLAD_NV_read_buffer) return; - fp_glReadBufferNV = (pfn_glReadBufferNV)load("glReadBufferNV"); -} - -GLboolean GLAD_NV_read_buffer_front = GL_FALSE; -GLboolean GLAD_NV_read_depth = GL_FALSE; -GLboolean GLAD_NV_read_depth_stencil = GL_FALSE; -GLboolean GLAD_NV_read_stencil = GL_FALSE; -GLboolean GLAD_NV_sample_locations = GL_FALSE; -static void load_GL_NV_sample_locations(LOADER load) { - if(!GLAD_NV_sample_locations) return; - fp_glFramebufferSampleLocationsfvNV = (pfn_glFramebufferSampleLocationsfvNV)load("glFramebufferSampleLocationsfvNV"); - fp_glNamedFramebufferSampleLocationsfvNV = (pfn_glNamedFramebufferSampleLocationsfvNV)load("glNamedFramebufferSampleLocationsfvNV"); - fp_glResolveDepthValuesNV = (pfn_glResolveDepthValuesNV)load("glResolveDepthValuesNV"); -} - -GLboolean GLAD_NV_sample_mask_override_coverage = GL_FALSE; -GLboolean GLAD_NV_shader_atomic_counters = GL_FALSE; -GLboolean GLAD_NV_shader_atomic_float = GL_FALSE; -GLboolean GLAD_NV_shader_atomic_fp16_vector = GL_FALSE; -GLboolean GLAD_NV_shader_atomic_int64 = GL_FALSE; -GLboolean GLAD_NV_shader_buffer_load = GL_FALSE; -static void load_GL_NV_shader_buffer_load(LOADER load) { - if(!GLAD_NV_shader_buffer_load) return; - fp_glMakeBufferResidentNV = (pfn_glMakeBufferResidentNV)load("glMakeBufferResidentNV"); - fp_glMakeBufferNonResidentNV = (pfn_glMakeBufferNonResidentNV)load("glMakeBufferNonResidentNV"); - fp_glIsBufferResidentNV = (pfn_glIsBufferResidentNV)load("glIsBufferResidentNV"); - fp_glMakeNamedBufferResidentNV = (pfn_glMakeNamedBufferResidentNV)load("glMakeNamedBufferResidentNV"); - fp_glMakeNamedBufferNonResidentNV = (pfn_glMakeNamedBufferNonResidentNV)load("glMakeNamedBufferNonResidentNV"); - fp_glIsNamedBufferResidentNV = (pfn_glIsNamedBufferResidentNV)load("glIsNamedBufferResidentNV"); - fp_glGetBufferParameterui64vNV = (pfn_glGetBufferParameterui64vNV)load("glGetBufferParameterui64vNV"); - fp_glGetNamedBufferParameterui64vNV = (pfn_glGetNamedBufferParameterui64vNV)load("glGetNamedBufferParameterui64vNV"); - fp_glGetIntegerui64vNV = (pfn_glGetIntegerui64vNV)load("glGetIntegerui64vNV"); - fp_glUniformui64NV = (pfn_glUniformui64NV)load("glUniformui64NV"); - fp_glUniformui64vNV = (pfn_glUniformui64vNV)load("glUniformui64vNV"); - fp_glGetUniformui64vNV = (pfn_glGetUniformui64vNV)load("glGetUniformui64vNV"); - fp_glProgramUniformui64NV = (pfn_glProgramUniformui64NV)load("glProgramUniformui64NV"); - fp_glProgramUniformui64vNV = (pfn_glProgramUniformui64vNV)load("glProgramUniformui64vNV"); -} - -GLboolean GLAD_NV_shader_buffer_store = GL_FALSE; -GLboolean GLAD_NV_shader_noperspective_interpolation = GL_FALSE; -GLboolean GLAD_NV_shader_storage_buffer_object = GL_FALSE; -GLboolean GLAD_NV_shader_thread_group = GL_FALSE; -GLboolean GLAD_NV_shader_thread_shuffle = GL_FALSE; -GLboolean GLAD_NV_shadow_samplers_array = GL_FALSE; -GLboolean GLAD_NV_shadow_samplers_cube = GL_FALSE; -GLboolean GLAD_NV_sRGB_formats = GL_FALSE; -GLboolean GLAD_NV_tessellation_program5 = GL_FALSE; -GLboolean GLAD_NV_texture_barrier = GL_FALSE; -static void load_GL_NV_texture_barrier(LOADER load) { - if(!GLAD_NV_texture_barrier) return; - fp_glTextureBarrierNV = (pfn_glTextureBarrierNV)load("glTextureBarrierNV"); -} - -GLboolean GLAD_NV_texture_border_clamp = GL_FALSE; -GLboolean GLAD_NV_texture_compression_s3tc_update = GL_FALSE; -GLboolean GLAD_NV_texture_multisample = GL_FALSE; -static void load_GL_NV_texture_multisample(LOADER load) { - if(!GLAD_NV_texture_multisample) return; - fp_glTexImage2DMultisampleCoverageNV = (pfn_glTexImage2DMultisampleCoverageNV)load("glTexImage2DMultisampleCoverageNV"); - fp_glTexImage3DMultisampleCoverageNV = (pfn_glTexImage3DMultisampleCoverageNV)load("glTexImage3DMultisampleCoverageNV"); - fp_glTextureImage2DMultisampleNV = (pfn_glTextureImage2DMultisampleNV)load("glTextureImage2DMultisampleNV"); - fp_glTextureImage3DMultisampleNV = (pfn_glTextureImage3DMultisampleNV)load("glTextureImage3DMultisampleNV"); - fp_glTextureImage2DMultisampleCoverageNV = (pfn_glTextureImage2DMultisampleCoverageNV)load("glTextureImage2DMultisampleCoverageNV"); - fp_glTextureImage3DMultisampleCoverageNV = (pfn_glTextureImage3DMultisampleCoverageNV)load("glTextureImage3DMultisampleCoverageNV"); -} - -GLboolean GLAD_NV_texture_npot_2D_mipmap = GL_FALSE; -GLboolean GLAD_NV_transform_feedback = GL_FALSE; -static void load_GL_NV_transform_feedback(LOADER load) { - if(!GLAD_NV_transform_feedback) return; - fp_glBeginTransformFeedbackNV = (pfn_glBeginTransformFeedbackNV)load("glBeginTransformFeedbackNV"); - fp_glEndTransformFeedbackNV = (pfn_glEndTransformFeedbackNV)load("glEndTransformFeedbackNV"); - fp_glTransformFeedbackAttribsNV = (pfn_glTransformFeedbackAttribsNV)load("glTransformFeedbackAttribsNV"); - fp_glBindBufferRangeNV = (pfn_glBindBufferRangeNV)load("glBindBufferRangeNV"); - fp_glBindBufferOffsetNV = (pfn_glBindBufferOffsetNV)load("glBindBufferOffsetNV"); - fp_glBindBufferBaseNV = (pfn_glBindBufferBaseNV)load("glBindBufferBaseNV"); - fp_glTransformFeedbackVaryingsNV = (pfn_glTransformFeedbackVaryingsNV)load("glTransformFeedbackVaryingsNV"); - fp_glActiveVaryingNV = (pfn_glActiveVaryingNV)load("glActiveVaryingNV"); - fp_glGetVaryingLocationNV = (pfn_glGetVaryingLocationNV)load("glGetVaryingLocationNV"); - fp_glGetActiveVaryingNV = (pfn_glGetActiveVaryingNV)load("glGetActiveVaryingNV"); - fp_glGetTransformFeedbackVaryingNV = (pfn_glGetTransformFeedbackVaryingNV)load("glGetTransformFeedbackVaryingNV"); - fp_glTransformFeedbackStreamAttribsNV = (pfn_glTransformFeedbackStreamAttribsNV)load("glTransformFeedbackStreamAttribsNV"); -} - -GLboolean GLAD_NV_transform_feedback2 = GL_FALSE; -static void load_GL_NV_transform_feedback2(LOADER load) { - if(!GLAD_NV_transform_feedback2) return; - fp_glBindTransformFeedbackNV = (pfn_glBindTransformFeedbackNV)load("glBindTransformFeedbackNV"); - fp_glDeleteTransformFeedbacksNV = (pfn_glDeleteTransformFeedbacksNV)load("glDeleteTransformFeedbacksNV"); - fp_glGenTransformFeedbacksNV = (pfn_glGenTransformFeedbacksNV)load("glGenTransformFeedbacksNV"); - fp_glIsTransformFeedbackNV = (pfn_glIsTransformFeedbackNV)load("glIsTransformFeedbackNV"); - fp_glPauseTransformFeedbackNV = (pfn_glPauseTransformFeedbackNV)load("glPauseTransformFeedbackNV"); - fp_glResumeTransformFeedbackNV = (pfn_glResumeTransformFeedbackNV)load("glResumeTransformFeedbackNV"); - fp_glDrawTransformFeedbackNV = (pfn_glDrawTransformFeedbackNV)load("glDrawTransformFeedbackNV"); -} - -GLboolean GLAD_NV_uniform_buffer_unified_memory = GL_FALSE; -GLboolean GLAD_NV_vdpau_interop = GL_FALSE; -static void load_GL_NV_vdpau_interop(LOADER load) { - if(!GLAD_NV_vdpau_interop) return; - fp_glVDPAUInitNV = (pfn_glVDPAUInitNV)load("glVDPAUInitNV"); - fp_glVDPAUFiniNV = (pfn_glVDPAUFiniNV)load("glVDPAUFiniNV"); - fp_glVDPAURegisterVideoSurfaceNV = (pfn_glVDPAURegisterVideoSurfaceNV)load("glVDPAURegisterVideoSurfaceNV"); - fp_glVDPAURegisterOutputSurfaceNV = (pfn_glVDPAURegisterOutputSurfaceNV)load("glVDPAURegisterOutputSurfaceNV"); - fp_glVDPAUIsSurfaceNV = (pfn_glVDPAUIsSurfaceNV)load("glVDPAUIsSurfaceNV"); - fp_glVDPAUUnregisterSurfaceNV = (pfn_glVDPAUUnregisterSurfaceNV)load("glVDPAUUnregisterSurfaceNV"); - fp_glVDPAUGetSurfaceivNV = (pfn_glVDPAUGetSurfaceivNV)load("glVDPAUGetSurfaceivNV"); - fp_glVDPAUSurfaceAccessNV = (pfn_glVDPAUSurfaceAccessNV)load("glVDPAUSurfaceAccessNV"); - fp_glVDPAUMapSurfacesNV = (pfn_glVDPAUMapSurfacesNV)load("glVDPAUMapSurfacesNV"); - fp_glVDPAUUnmapSurfacesNV = (pfn_glVDPAUUnmapSurfacesNV)load("glVDPAUUnmapSurfacesNV"); -} - -GLboolean GLAD_NV_vertex_attrib_integer_64bit = GL_FALSE; -static void load_GL_NV_vertex_attrib_integer_64bit(LOADER load) { - if(!GLAD_NV_vertex_attrib_integer_64bit) return; - fp_glVertexAttribL1i64NV = (pfn_glVertexAttribL1i64NV)load("glVertexAttribL1i64NV"); - fp_glVertexAttribL2i64NV = (pfn_glVertexAttribL2i64NV)load("glVertexAttribL2i64NV"); - fp_glVertexAttribL3i64NV = (pfn_glVertexAttribL3i64NV)load("glVertexAttribL3i64NV"); - fp_glVertexAttribL4i64NV = (pfn_glVertexAttribL4i64NV)load("glVertexAttribL4i64NV"); - fp_glVertexAttribL1i64vNV = (pfn_glVertexAttribL1i64vNV)load("glVertexAttribL1i64vNV"); - fp_glVertexAttribL2i64vNV = (pfn_glVertexAttribL2i64vNV)load("glVertexAttribL2i64vNV"); - fp_glVertexAttribL3i64vNV = (pfn_glVertexAttribL3i64vNV)load("glVertexAttribL3i64vNV"); - fp_glVertexAttribL4i64vNV = (pfn_glVertexAttribL4i64vNV)load("glVertexAttribL4i64vNV"); - fp_glVertexAttribL1ui64NV = (pfn_glVertexAttribL1ui64NV)load("glVertexAttribL1ui64NV"); - fp_glVertexAttribL2ui64NV = (pfn_glVertexAttribL2ui64NV)load("glVertexAttribL2ui64NV"); - fp_glVertexAttribL3ui64NV = (pfn_glVertexAttribL3ui64NV)load("glVertexAttribL3ui64NV"); - fp_glVertexAttribL4ui64NV = (pfn_glVertexAttribL4ui64NV)load("glVertexAttribL4ui64NV"); - fp_glVertexAttribL1ui64vNV = (pfn_glVertexAttribL1ui64vNV)load("glVertexAttribL1ui64vNV"); - fp_glVertexAttribL2ui64vNV = (pfn_glVertexAttribL2ui64vNV)load("glVertexAttribL2ui64vNV"); - fp_glVertexAttribL3ui64vNV = (pfn_glVertexAttribL3ui64vNV)load("glVertexAttribL3ui64vNV"); - fp_glVertexAttribL4ui64vNV = (pfn_glVertexAttribL4ui64vNV)load("glVertexAttribL4ui64vNV"); - fp_glGetVertexAttribLi64vNV = (pfn_glGetVertexAttribLi64vNV)load("glGetVertexAttribLi64vNV"); - fp_glGetVertexAttribLui64vNV = (pfn_glGetVertexAttribLui64vNV)load("glGetVertexAttribLui64vNV"); - fp_glVertexAttribLFormatNV = (pfn_glVertexAttribLFormatNV)load("glVertexAttribLFormatNV"); -} - -GLboolean GLAD_NV_vertex_buffer_unified_memory = GL_FALSE; -static void load_GL_NV_vertex_buffer_unified_memory(LOADER load) { - if(!GLAD_NV_vertex_buffer_unified_memory) return; - fp_glBufferAddressRangeNV = (pfn_glBufferAddressRangeNV)load("glBufferAddressRangeNV"); - fp_glVertexFormatNV = (pfn_glVertexFormatNV)load("glVertexFormatNV"); - fp_glNormalFormatNV = (pfn_glNormalFormatNV)load("glNormalFormatNV"); - fp_glColorFormatNV = (pfn_glColorFormatNV)load("glColorFormatNV"); - fp_glIndexFormatNV = (pfn_glIndexFormatNV)load("glIndexFormatNV"); - fp_glTexCoordFormatNV = (pfn_glTexCoordFormatNV)load("glTexCoordFormatNV"); - fp_glEdgeFlagFormatNV = (pfn_glEdgeFlagFormatNV)load("glEdgeFlagFormatNV"); - fp_glSecondaryColorFormatNV = (pfn_glSecondaryColorFormatNV)load("glSecondaryColorFormatNV"); - fp_glFogCoordFormatNV = (pfn_glFogCoordFormatNV)load("glFogCoordFormatNV"); - fp_glVertexAttribFormatNV = (pfn_glVertexAttribFormatNV)load("glVertexAttribFormatNV"); - fp_glVertexAttribIFormatNV = (pfn_glVertexAttribIFormatNV)load("glVertexAttribIFormatNV"); - fp_glGetIntegerui64i_vNV = (pfn_glGetIntegerui64i_vNV)load("glGetIntegerui64i_vNV"); -} - -GLboolean GLAD_NV_vertex_program4 = GL_FALSE; -static void load_GL_NV_vertex_program4(LOADER load) { - if(!GLAD_NV_vertex_program4) return; - fp_glVertexAttribI1iEXT = (pfn_glVertexAttribI1iEXT)load("glVertexAttribI1iEXT"); - fp_glVertexAttribI2iEXT = (pfn_glVertexAttribI2iEXT)load("glVertexAttribI2iEXT"); - fp_glVertexAttribI3iEXT = (pfn_glVertexAttribI3iEXT)load("glVertexAttribI3iEXT"); - fp_glVertexAttribI4iEXT = (pfn_glVertexAttribI4iEXT)load("glVertexAttribI4iEXT"); - fp_glVertexAttribI1uiEXT = (pfn_glVertexAttribI1uiEXT)load("glVertexAttribI1uiEXT"); - fp_glVertexAttribI2uiEXT = (pfn_glVertexAttribI2uiEXT)load("glVertexAttribI2uiEXT"); - fp_glVertexAttribI3uiEXT = (pfn_glVertexAttribI3uiEXT)load("glVertexAttribI3uiEXT"); - fp_glVertexAttribI4uiEXT = (pfn_glVertexAttribI4uiEXT)load("glVertexAttribI4uiEXT"); - fp_glVertexAttribI1ivEXT = (pfn_glVertexAttribI1ivEXT)load("glVertexAttribI1ivEXT"); - fp_glVertexAttribI2ivEXT = (pfn_glVertexAttribI2ivEXT)load("glVertexAttribI2ivEXT"); - fp_glVertexAttribI3ivEXT = (pfn_glVertexAttribI3ivEXT)load("glVertexAttribI3ivEXT"); - fp_glVertexAttribI4ivEXT = (pfn_glVertexAttribI4ivEXT)load("glVertexAttribI4ivEXT"); - fp_glVertexAttribI1uivEXT = (pfn_glVertexAttribI1uivEXT)load("glVertexAttribI1uivEXT"); - fp_glVertexAttribI2uivEXT = (pfn_glVertexAttribI2uivEXT)load("glVertexAttribI2uivEXT"); - fp_glVertexAttribI3uivEXT = (pfn_glVertexAttribI3uivEXT)load("glVertexAttribI3uivEXT"); - fp_glVertexAttribI4uivEXT = (pfn_glVertexAttribI4uivEXT)load("glVertexAttribI4uivEXT"); - fp_glVertexAttribI4bvEXT = (pfn_glVertexAttribI4bvEXT)load("glVertexAttribI4bvEXT"); - fp_glVertexAttribI4svEXT = (pfn_glVertexAttribI4svEXT)load("glVertexAttribI4svEXT"); - fp_glVertexAttribI4ubvEXT = (pfn_glVertexAttribI4ubvEXT)load("glVertexAttribI4ubvEXT"); - fp_glVertexAttribI4usvEXT = (pfn_glVertexAttribI4usvEXT)load("glVertexAttribI4usvEXT"); - fp_glVertexAttribIPointerEXT = (pfn_glVertexAttribIPointerEXT)load("glVertexAttribIPointerEXT"); - fp_glGetVertexAttribIivEXT = (pfn_glGetVertexAttribIivEXT)load("glGetVertexAttribIivEXT"); - fp_glGetVertexAttribIuivEXT = (pfn_glGetVertexAttribIuivEXT)load("glGetVertexAttribIuivEXT"); -} - -GLboolean GLAD_NV_video_capture = GL_FALSE; -static void load_GL_NV_video_capture(LOADER load) { - if(!GLAD_NV_video_capture) return; - fp_glBeginVideoCaptureNV = (pfn_glBeginVideoCaptureNV)load("glBeginVideoCaptureNV"); - fp_glBindVideoCaptureStreamBufferNV = (pfn_glBindVideoCaptureStreamBufferNV)load("glBindVideoCaptureStreamBufferNV"); - fp_glBindVideoCaptureStreamTextureNV = (pfn_glBindVideoCaptureStreamTextureNV)load("glBindVideoCaptureStreamTextureNV"); - fp_glEndVideoCaptureNV = (pfn_glEndVideoCaptureNV)load("glEndVideoCaptureNV"); - fp_glGetVideoCaptureivNV = (pfn_glGetVideoCaptureivNV)load("glGetVideoCaptureivNV"); - fp_glGetVideoCaptureStreamivNV = (pfn_glGetVideoCaptureStreamivNV)load("glGetVideoCaptureStreamivNV"); - fp_glGetVideoCaptureStreamfvNV = (pfn_glGetVideoCaptureStreamfvNV)load("glGetVideoCaptureStreamfvNV"); - fp_glGetVideoCaptureStreamdvNV = (pfn_glGetVideoCaptureStreamdvNV)load("glGetVideoCaptureStreamdvNV"); - fp_glVideoCaptureNV = (pfn_glVideoCaptureNV)load("glVideoCaptureNV"); - fp_glVideoCaptureStreamParameterivNV = (pfn_glVideoCaptureStreamParameterivNV)load("glVideoCaptureStreamParameterivNV"); - fp_glVideoCaptureStreamParameterfvNV = (pfn_glVideoCaptureStreamParameterfvNV)load("glVideoCaptureStreamParameterfvNV"); - fp_glVideoCaptureStreamParameterdvNV = (pfn_glVideoCaptureStreamParameterdvNV)load("glVideoCaptureStreamParameterdvNV"); -} - -GLboolean GLAD_NV_viewport_array = GL_FALSE; -static void load_GL_NV_viewport_array(LOADER load) { - if(!GLAD_NV_viewport_array) return; - fp_glViewportArrayvNV = (pfn_glViewportArrayvNV)load("glViewportArrayvNV"); - fp_glViewportIndexedfNV = (pfn_glViewportIndexedfNV)load("glViewportIndexedfNV"); - fp_glViewportIndexedfvNV = (pfn_glViewportIndexedfvNV)load("glViewportIndexedfvNV"); - fp_glScissorArrayvNV = (pfn_glScissorArrayvNV)load("glScissorArrayvNV"); - fp_glScissorIndexedNV = (pfn_glScissorIndexedNV)load("glScissorIndexedNV"); - fp_glScissorIndexedvNV = (pfn_glScissorIndexedvNV)load("glScissorIndexedvNV"); - fp_glDepthRangeArrayfvNV = (pfn_glDepthRangeArrayfvNV)load("glDepthRangeArrayfvNV"); - fp_glDepthRangeIndexedfNV = (pfn_glDepthRangeIndexedfNV)load("glDepthRangeIndexedfNV"); - fp_glGetFloati_vNV = (pfn_glGetFloati_vNV)load("glGetFloati_vNV"); - fp_glEnableiNV = (pfn_glEnableiNV)load("glEnableiNV"); - fp_glDisableiNV = (pfn_glDisableiNV)load("glDisableiNV"); - fp_glIsEnablediNV = (pfn_glIsEnablediNV)load("glIsEnablediNV"); -} - -GLboolean GLAD_NV_viewport_array2 = GL_FALSE; -GLboolean GLAD_NVX_conditional_render = GL_FALSE; -static void load_GL_NVX_conditional_render(LOADER load) { - if(!GLAD_NVX_conditional_render) return; - fp_glBeginConditionalRenderNVX = (pfn_glBeginConditionalRenderNVX)load("glBeginConditionalRenderNVX"); - fp_glEndConditionalRenderNVX = (pfn_glEndConditionalRenderNVX)load("glEndConditionalRenderNVX"); -} - -GLboolean GLAD_NVX_gpu_memory_info = GL_FALSE; -GLboolean GLAD_OVR_multiview = GL_FALSE; -static void load_GL_OVR_multiview(LOADER load) { - if(!GLAD_OVR_multiview) return; - fp_glFramebufferTextureMultiviewOVR = (pfn_glFramebufferTextureMultiviewOVR)load("glFramebufferTextureMultiviewOVR"); -} - -GLboolean GLAD_OVR_multiview2 = GL_FALSE; -GLboolean GLAD_OVR_multiview_multisampled_render_to_texture = GL_FALSE; -static void load_GL_OVR_multiview_multisampled_render_to_texture(LOADER load) { - if(!GLAD_OVR_multiview_multisampled_render_to_texture) return; - fp_glFramebufferTextureMultisampleMultiviewOVR = (pfn_glFramebufferTextureMultisampleMultiviewOVR)load("glFramebufferTextureMultisampleMultiviewOVR"); -} - -GLboolean GLAD_QCOM_alpha_test = GL_FALSE; -static void load_GL_QCOM_alpha_test(LOADER load) { - if(!GLAD_QCOM_alpha_test) return; - fp_glAlphaFuncQCOM = (pfn_glAlphaFuncQCOM)load("glAlphaFuncQCOM"); -} - -GLboolean GLAD_QCOM_binning_control = GL_FALSE; -GLboolean GLAD_QCOM_driver_control = GL_FALSE; -static void load_GL_QCOM_driver_control(LOADER load) { - if(!GLAD_QCOM_driver_control) return; - fp_glGetDriverControlsQCOM = (pfn_glGetDriverControlsQCOM)load("glGetDriverControlsQCOM"); - fp_glGetDriverControlStringQCOM = (pfn_glGetDriverControlStringQCOM)load("glGetDriverControlStringQCOM"); - fp_glEnableDriverControlQCOM = (pfn_glEnableDriverControlQCOM)load("glEnableDriverControlQCOM"); - fp_glDisableDriverControlQCOM = (pfn_glDisableDriverControlQCOM)load("glDisableDriverControlQCOM"); -} - -GLboolean GLAD_QCOM_extended_get = GL_FALSE; -static void load_GL_QCOM_extended_get(LOADER load) { - if(!GLAD_QCOM_extended_get) return; - fp_glExtGetTexturesQCOM = (pfn_glExtGetTexturesQCOM)load("glExtGetTexturesQCOM"); - fp_glExtGetBuffersQCOM = (pfn_glExtGetBuffersQCOM)load("glExtGetBuffersQCOM"); - fp_glExtGetRenderbuffersQCOM = (pfn_glExtGetRenderbuffersQCOM)load("glExtGetRenderbuffersQCOM"); - fp_glExtGetFramebuffersQCOM = (pfn_glExtGetFramebuffersQCOM)load("glExtGetFramebuffersQCOM"); - fp_glExtGetTexLevelParameterivQCOM = (pfn_glExtGetTexLevelParameterivQCOM)load("glExtGetTexLevelParameterivQCOM"); - fp_glExtTexObjectStateOverrideiQCOM = (pfn_glExtTexObjectStateOverrideiQCOM)load("glExtTexObjectStateOverrideiQCOM"); - fp_glExtGetTexSubImageQCOM = (pfn_glExtGetTexSubImageQCOM)load("glExtGetTexSubImageQCOM"); - fp_glExtGetBufferPointervQCOM = (pfn_glExtGetBufferPointervQCOM)load("glExtGetBufferPointervQCOM"); -} - -GLboolean GLAD_QCOM_extended_get2 = GL_FALSE; -static void load_GL_QCOM_extended_get2(LOADER load) { - if(!GLAD_QCOM_extended_get2) return; - fp_glExtGetShadersQCOM = (pfn_glExtGetShadersQCOM)load("glExtGetShadersQCOM"); - fp_glExtGetProgramsQCOM = (pfn_glExtGetProgramsQCOM)load("glExtGetProgramsQCOM"); - fp_glExtIsProgramBinaryQCOM = (pfn_glExtIsProgramBinaryQCOM)load("glExtIsProgramBinaryQCOM"); - fp_glExtGetProgramBinarySourceQCOM = (pfn_glExtGetProgramBinarySourceQCOM)load("glExtGetProgramBinarySourceQCOM"); -} - -GLboolean GLAD_QCOM_perfmon_global_mode = GL_FALSE; -GLboolean GLAD_QCOM_tiled_rendering = GL_FALSE; -static void load_GL_QCOM_tiled_rendering(LOADER load) { - if(!GLAD_QCOM_tiled_rendering) return; - fp_glStartTilingQCOM = (pfn_glStartTilingQCOM)load("glStartTilingQCOM"); - fp_glEndTilingQCOM = (pfn_glEndTilingQCOM)load("glEndTilingQCOM"); -} - -GLboolean GLAD_QCOM_writeonly_rendering = GL_FALSE; -GLboolean GLAD_VIV_shader_binary = GL_FALSE; -static void find_extensions(void) { - GLAD_KHR_blend_equation_advanced = has_ext("GL_KHR_blend_equation_advanced"); - GLAD_KHR_blend_equation_advanced_coherent = has_ext("GL_KHR_blend_equation_advanced_coherent"); - GLAD_KHR_context_flush_control = has_ext("GL_KHR_context_flush_control"); - GLAD_KHR_debug = has_ext("GL_KHR_debug"); - GLAD_KHR_no_error = has_ext("GL_KHR_no_error"); - GLAD_KHR_robust_buffer_access_behavior = has_ext("GL_KHR_robust_buffer_access_behavior"); - GLAD_KHR_robustness = has_ext("GL_KHR_robustness"); - GLAD_KHR_texture_compression_astc_hdr = has_ext("GL_KHR_texture_compression_astc_hdr"); - GLAD_KHR_texture_compression_astc_ldr = has_ext("GL_KHR_texture_compression_astc_ldr"); - GLAD_KHR_texture_compression_astc_sliced_3d = has_ext("GL_KHR_texture_compression_astc_sliced_3d"); - GLAD_ARB_arrays_of_arrays = has_ext("GL_ARB_arrays_of_arrays"); - GLAD_ARB_base_instance = has_ext("GL_ARB_base_instance"); - GLAD_ARB_bindless_texture = has_ext("GL_ARB_bindless_texture"); - GLAD_ARB_blend_func_extended = has_ext("GL_ARB_blend_func_extended"); - GLAD_ARB_buffer_storage = has_ext("GL_ARB_buffer_storage"); - GLAD_ARB_cl_event = has_ext("GL_ARB_cl_event"); - GLAD_ARB_clear_buffer_object = has_ext("GL_ARB_clear_buffer_object"); - GLAD_ARB_clear_texture = has_ext("GL_ARB_clear_texture"); - GLAD_ARB_clip_control = has_ext("GL_ARB_clip_control"); - GLAD_ARB_color_buffer_float = has_ext("GL_ARB_color_buffer_float"); - GLAD_ARB_compatibility = has_ext("GL_ARB_compatibility"); - GLAD_ARB_compressed_texture_pixel_storage = has_ext("GL_ARB_compressed_texture_pixel_storage"); - GLAD_ARB_compute_shader = has_ext("GL_ARB_compute_shader"); - GLAD_ARB_compute_variable_group_size = has_ext("GL_ARB_compute_variable_group_size"); - GLAD_ARB_conditional_render_inverted = has_ext("GL_ARB_conditional_render_inverted"); - GLAD_ARB_conservative_depth = has_ext("GL_ARB_conservative_depth"); - GLAD_ARB_copy_buffer = has_ext("GL_ARB_copy_buffer"); - GLAD_ARB_copy_image = has_ext("GL_ARB_copy_image"); - GLAD_ARB_cull_distance = has_ext("GL_ARB_cull_distance"); - GLAD_ARB_debug_output = has_ext("GL_ARB_debug_output"); - GLAD_ARB_depth_buffer_float = has_ext("GL_ARB_depth_buffer_float"); - GLAD_ARB_depth_clamp = has_ext("GL_ARB_depth_clamp"); - GLAD_ARB_derivative_control = has_ext("GL_ARB_derivative_control"); - GLAD_ARB_direct_state_access = has_ext("GL_ARB_direct_state_access"); - GLAD_ARB_draw_buffers_blend = has_ext("GL_ARB_draw_buffers_blend"); - GLAD_ARB_draw_elements_base_vertex = has_ext("GL_ARB_draw_elements_base_vertex"); - GLAD_ARB_draw_indirect = has_ext("GL_ARB_draw_indirect"); - GLAD_ARB_draw_instanced = has_ext("GL_ARB_draw_instanced"); - GLAD_ARB_enhanced_layouts = has_ext("GL_ARB_enhanced_layouts"); - GLAD_ARB_ES2_compatibility = has_ext("GL_ARB_ES2_compatibility"); - GLAD_ARB_ES3_1_compatibility = has_ext("GL_ARB_ES3_1_compatibility"); - GLAD_ARB_ES3_2_compatibility = has_ext("GL_ARB_ES3_2_compatibility"); - GLAD_ARB_ES3_compatibility = has_ext("GL_ARB_ES3_compatibility"); - GLAD_ARB_explicit_attrib_location = has_ext("GL_ARB_explicit_attrib_location"); - GLAD_ARB_explicit_uniform_location = has_ext("GL_ARB_explicit_uniform_location"); - GLAD_ARB_fragment_coord_conventions = has_ext("GL_ARB_fragment_coord_conventions"); - GLAD_ARB_fragment_layer_viewport = has_ext("GL_ARB_fragment_layer_viewport"); - GLAD_ARB_fragment_shader_interlock = has_ext("GL_ARB_fragment_shader_interlock"); - GLAD_ARB_framebuffer_no_attachments = has_ext("GL_ARB_framebuffer_no_attachments"); - GLAD_ARB_framebuffer_object = has_ext("GL_ARB_framebuffer_object"); - GLAD_ARB_framebuffer_sRGB = has_ext("GL_ARB_framebuffer_sRGB"); - GLAD_ARB_geometry_shader4 = has_ext("GL_ARB_geometry_shader4"); - GLAD_ARB_get_program_binary = has_ext("GL_ARB_get_program_binary"); - GLAD_ARB_get_texture_sub_image = has_ext("GL_ARB_get_texture_sub_image"); - GLAD_ARB_gpu_shader5 = has_ext("GL_ARB_gpu_shader5"); - GLAD_ARB_gpu_shader_fp64 = has_ext("GL_ARB_gpu_shader_fp64"); - GLAD_ARB_gpu_shader_int64 = has_ext("GL_ARB_gpu_shader_int64"); - GLAD_ARB_half_float_pixel = has_ext("GL_ARB_half_float_pixel"); - GLAD_ARB_half_float_vertex = has_ext("GL_ARB_half_float_vertex"); - GLAD_ARB_indirect_parameters = has_ext("GL_ARB_indirect_parameters"); - GLAD_ARB_instanced_arrays = has_ext("GL_ARB_instanced_arrays"); - GLAD_ARB_internalformat_query = has_ext("GL_ARB_internalformat_query"); - GLAD_ARB_internalformat_query2 = has_ext("GL_ARB_internalformat_query2"); - GLAD_ARB_invalidate_subdata = has_ext("GL_ARB_invalidate_subdata"); - GLAD_ARB_map_buffer_alignment = has_ext("GL_ARB_map_buffer_alignment"); - GLAD_ARB_map_buffer_range = has_ext("GL_ARB_map_buffer_range"); - GLAD_ARB_multi_bind = has_ext("GL_ARB_multi_bind"); - GLAD_ARB_multi_draw_indirect = has_ext("GL_ARB_multi_draw_indirect"); - GLAD_ARB_occlusion_query2 = has_ext("GL_ARB_occlusion_query2"); - GLAD_ARB_parallel_shader_compile = has_ext("GL_ARB_parallel_shader_compile"); - GLAD_ARB_pipeline_statistics_query = has_ext("GL_ARB_pipeline_statistics_query"); - GLAD_ARB_pixel_buffer_object = has_ext("GL_ARB_pixel_buffer_object"); - GLAD_ARB_post_depth_coverage = has_ext("GL_ARB_post_depth_coverage"); - GLAD_ARB_program_interface_query = has_ext("GL_ARB_program_interface_query"); - GLAD_ARB_provoking_vertex = has_ext("GL_ARB_provoking_vertex"); - GLAD_ARB_query_buffer_object = has_ext("GL_ARB_query_buffer_object"); - GLAD_ARB_robust_buffer_access_behavior = has_ext("GL_ARB_robust_buffer_access_behavior"); - GLAD_ARB_robustness = has_ext("GL_ARB_robustness"); - GLAD_ARB_robustness_isolation = has_ext("GL_ARB_robustness_isolation"); - GLAD_ARB_sample_locations = has_ext("GL_ARB_sample_locations"); - GLAD_ARB_sample_shading = has_ext("GL_ARB_sample_shading"); - GLAD_ARB_sampler_objects = has_ext("GL_ARB_sampler_objects"); - GLAD_ARB_seamless_cube_map = has_ext("GL_ARB_seamless_cube_map"); - GLAD_ARB_seamless_cubemap_per_texture = has_ext("GL_ARB_seamless_cubemap_per_texture"); - GLAD_ARB_separate_shader_objects = has_ext("GL_ARB_separate_shader_objects"); - GLAD_ARB_shader_atomic_counter_ops = has_ext("GL_ARB_shader_atomic_counter_ops"); - GLAD_ARB_shader_atomic_counters = has_ext("GL_ARB_shader_atomic_counters"); - GLAD_ARB_shader_ballot = has_ext("GL_ARB_shader_ballot"); - GLAD_ARB_shader_bit_encoding = has_ext("GL_ARB_shader_bit_encoding"); - GLAD_ARB_shader_clock = has_ext("GL_ARB_shader_clock"); - GLAD_ARB_shader_draw_parameters = has_ext("GL_ARB_shader_draw_parameters"); - GLAD_ARB_shader_group_vote = has_ext("GL_ARB_shader_group_vote"); - GLAD_ARB_shader_image_load_store = has_ext("GL_ARB_shader_image_load_store"); - GLAD_ARB_shader_image_size = has_ext("GL_ARB_shader_image_size"); - GLAD_ARB_shader_precision = has_ext("GL_ARB_shader_precision"); - GLAD_ARB_shader_stencil_export = has_ext("GL_ARB_shader_stencil_export"); - GLAD_ARB_shader_storage_buffer_object = has_ext("GL_ARB_shader_storage_buffer_object"); - GLAD_ARB_shader_subroutine = has_ext("GL_ARB_shader_subroutine"); - GLAD_ARB_shader_texture_image_samples = has_ext("GL_ARB_shader_texture_image_samples"); - GLAD_ARB_shader_texture_lod = has_ext("GL_ARB_shader_texture_lod"); - GLAD_ARB_shader_viewport_layer_array = has_ext("GL_ARB_shader_viewport_layer_array"); - GLAD_ARB_shading_language_420pack = has_ext("GL_ARB_shading_language_420pack"); - GLAD_ARB_shading_language_include = has_ext("GL_ARB_shading_language_include"); - GLAD_ARB_shading_language_packing = has_ext("GL_ARB_shading_language_packing"); - GLAD_ARB_sparse_buffer = has_ext("GL_ARB_sparse_buffer"); - GLAD_ARB_sparse_texture = has_ext("GL_ARB_sparse_texture"); - GLAD_ARB_sparse_texture2 = has_ext("GL_ARB_sparse_texture2"); - GLAD_ARB_sparse_texture_clamp = has_ext("GL_ARB_sparse_texture_clamp"); - GLAD_ARB_stencil_texturing = has_ext("GL_ARB_stencil_texturing"); - GLAD_ARB_sync = has_ext("GL_ARB_sync"); - GLAD_ARB_tessellation_shader = has_ext("GL_ARB_tessellation_shader"); - GLAD_ARB_texture_barrier = has_ext("GL_ARB_texture_barrier"); - GLAD_ARB_texture_buffer_object = has_ext("GL_ARB_texture_buffer_object"); - GLAD_ARB_texture_buffer_object_rgb32 = has_ext("GL_ARB_texture_buffer_object_rgb32"); - GLAD_ARB_texture_buffer_range = has_ext("GL_ARB_texture_buffer_range"); - GLAD_ARB_texture_compression_bptc = has_ext("GL_ARB_texture_compression_bptc"); - GLAD_ARB_texture_compression_rgtc = has_ext("GL_ARB_texture_compression_rgtc"); - GLAD_ARB_texture_cube_map_array = has_ext("GL_ARB_texture_cube_map_array"); - GLAD_ARB_texture_filter_minmax = has_ext("GL_ARB_texture_filter_minmax"); - GLAD_ARB_texture_float = has_ext("GL_ARB_texture_float"); - GLAD_ARB_texture_gather = has_ext("GL_ARB_texture_gather"); - GLAD_ARB_texture_mirror_clamp_to_edge = has_ext("GL_ARB_texture_mirror_clamp_to_edge"); - GLAD_ARB_texture_multisample = has_ext("GL_ARB_texture_multisample"); - GLAD_ARB_texture_query_levels = has_ext("GL_ARB_texture_query_levels"); - GLAD_ARB_texture_query_lod = has_ext("GL_ARB_texture_query_lod"); - GLAD_ARB_texture_rectangle = has_ext("GL_ARB_texture_rectangle"); - GLAD_ARB_texture_rg = has_ext("GL_ARB_texture_rg"); - GLAD_ARB_texture_rgb10_a2ui = has_ext("GL_ARB_texture_rgb10_a2ui"); - GLAD_ARB_texture_stencil8 = has_ext("GL_ARB_texture_stencil8"); - GLAD_ARB_texture_storage = has_ext("GL_ARB_texture_storage"); - GLAD_ARB_texture_storage_multisample = has_ext("GL_ARB_texture_storage_multisample"); - GLAD_ARB_texture_swizzle = has_ext("GL_ARB_texture_swizzle"); - GLAD_ARB_texture_view = has_ext("GL_ARB_texture_view"); - GLAD_ARB_timer_query = has_ext("GL_ARB_timer_query"); - GLAD_ARB_transform_feedback2 = has_ext("GL_ARB_transform_feedback2"); - GLAD_ARB_transform_feedback3 = has_ext("GL_ARB_transform_feedback3"); - GLAD_ARB_transform_feedback_instanced = has_ext("GL_ARB_transform_feedback_instanced"); - GLAD_ARB_transform_feedback_overflow_query = has_ext("GL_ARB_transform_feedback_overflow_query"); - GLAD_ARB_uniform_buffer_object = has_ext("GL_ARB_uniform_buffer_object"); - GLAD_ARB_vertex_array_bgra = has_ext("GL_ARB_vertex_array_bgra"); - GLAD_ARB_vertex_array_object = has_ext("GL_ARB_vertex_array_object"); - GLAD_ARB_vertex_attrib_64bit = has_ext("GL_ARB_vertex_attrib_64bit"); - GLAD_ARB_vertex_attrib_binding = has_ext("GL_ARB_vertex_attrib_binding"); - GLAD_ARB_vertex_type_10f_11f_11f_rev = has_ext("GL_ARB_vertex_type_10f_11f_11f_rev"); - GLAD_ARB_vertex_type_2_10_10_10_rev = has_ext("GL_ARB_vertex_type_2_10_10_10_rev"); - GLAD_ARB_viewport_array = has_ext("GL_ARB_viewport_array"); - GLAD_EXT_base_instance = has_ext("GL_EXT_base_instance"); - GLAD_EXT_bgra = has_ext("GL_EXT_bgra"); - GLAD_EXT_bindable_uniform = has_ext("GL_EXT_bindable_uniform"); - GLAD_EXT_blend_func_extended = has_ext("GL_EXT_blend_func_extended"); - GLAD_EXT_blend_minmax = has_ext("GL_EXT_blend_minmax"); - GLAD_EXT_buffer_storage = has_ext("GL_EXT_buffer_storage"); - GLAD_EXT_color_buffer_float = has_ext("GL_EXT_color_buffer_float"); - GLAD_EXT_color_buffer_half_float = has_ext("GL_EXT_color_buffer_half_float"); - GLAD_EXT_copy_image = has_ext("GL_EXT_copy_image"); - GLAD_EXT_debug_label = has_ext("GL_EXT_debug_label"); - GLAD_EXT_debug_marker = has_ext("GL_EXT_debug_marker"); - GLAD_EXT_direct_state_access = has_ext("GL_EXT_direct_state_access"); - GLAD_EXT_discard_framebuffer = has_ext("GL_EXT_discard_framebuffer"); - GLAD_EXT_disjoint_timer_query = has_ext("GL_EXT_disjoint_timer_query"); - GLAD_EXT_draw_buffers = has_ext("GL_EXT_draw_buffers"); - GLAD_EXT_draw_buffers2 = has_ext("GL_EXT_draw_buffers2"); - GLAD_EXT_draw_buffers_indexed = has_ext("GL_EXT_draw_buffers_indexed"); - GLAD_EXT_draw_elements_base_vertex = has_ext("GL_EXT_draw_elements_base_vertex"); - GLAD_EXT_draw_instanced = has_ext("GL_EXT_draw_instanced"); - GLAD_EXT_float_blend = has_ext("GL_EXT_float_blend"); - GLAD_EXT_framebuffer_blit = has_ext("GL_EXT_framebuffer_blit"); - GLAD_EXT_framebuffer_multisample = has_ext("GL_EXT_framebuffer_multisample"); - GLAD_EXT_framebuffer_multisample_blit_scaled = has_ext("GL_EXT_framebuffer_multisample_blit_scaled"); - GLAD_EXT_framebuffer_object = has_ext("GL_EXT_framebuffer_object"); - GLAD_EXT_framebuffer_sRGB = has_ext("GL_EXT_framebuffer_sRGB"); - GLAD_EXT_geometry_point_size = has_ext("GL_EXT_geometry_point_size"); - GLAD_EXT_geometry_shader = has_ext("GL_EXT_geometry_shader"); - GLAD_EXT_geometry_shader4 = has_ext("GL_EXT_geometry_shader4"); - GLAD_EXT_gpu_program_parameters = has_ext("GL_EXT_gpu_program_parameters"); - GLAD_EXT_gpu_shader4 = has_ext("GL_EXT_gpu_shader4"); - GLAD_EXT_gpu_shader5 = has_ext("GL_EXT_gpu_shader5"); - GLAD_EXT_instanced_arrays = has_ext("GL_EXT_instanced_arrays"); - GLAD_EXT_map_buffer_range = has_ext("GL_EXT_map_buffer_range"); - GLAD_EXT_multi_draw_indirect = has_ext("GL_EXT_multi_draw_indirect"); - GLAD_EXT_multisampled_compatibility = has_ext("GL_EXT_multisampled_compatibility"); - GLAD_EXT_multisampled_render_to_texture = has_ext("GL_EXT_multisampled_render_to_texture"); - GLAD_EXT_multiview_draw_buffers = has_ext("GL_EXT_multiview_draw_buffers"); - GLAD_EXT_occlusion_query_boolean = has_ext("GL_EXT_occlusion_query_boolean"); - GLAD_EXT_packed_depth_stencil = has_ext("GL_EXT_packed_depth_stencil"); - GLAD_EXT_packed_float = has_ext("GL_EXT_packed_float"); - GLAD_EXT_pixel_buffer_object = has_ext("GL_EXT_pixel_buffer_object"); - GLAD_EXT_polygon_offset_clamp = has_ext("GL_EXT_polygon_offset_clamp"); - GLAD_EXT_post_depth_coverage = has_ext("GL_EXT_post_depth_coverage"); - GLAD_EXT_primitive_bounding_box = has_ext("GL_EXT_primitive_bounding_box"); - GLAD_EXT_provoking_vertex = has_ext("GL_EXT_provoking_vertex"); - GLAD_EXT_pvrtc_sRGB = has_ext("GL_EXT_pvrtc_sRGB"); - GLAD_EXT_raster_multisample = has_ext("GL_EXT_raster_multisample"); - GLAD_EXT_read_format_bgra = has_ext("GL_EXT_read_format_bgra"); - GLAD_EXT_render_snorm = has_ext("GL_EXT_render_snorm"); - GLAD_EXT_robustness = has_ext("GL_EXT_robustness"); - GLAD_EXT_separate_shader_objects = has_ext("GL_EXT_separate_shader_objects"); - GLAD_EXT_shader_framebuffer_fetch = has_ext("GL_EXT_shader_framebuffer_fetch"); - GLAD_EXT_shader_image_load_formatted = has_ext("GL_EXT_shader_image_load_formatted"); - GLAD_EXT_shader_image_load_store = has_ext("GL_EXT_shader_image_load_store"); - GLAD_EXT_shader_implicit_conversions = has_ext("GL_EXT_shader_implicit_conversions"); - GLAD_EXT_shader_integer_mix = has_ext("GL_EXT_shader_integer_mix"); - GLAD_EXT_shader_io_blocks = has_ext("GL_EXT_shader_io_blocks"); - GLAD_EXT_shader_pixel_local_storage = has_ext("GL_EXT_shader_pixel_local_storage"); - GLAD_EXT_shader_texture_lod = has_ext("GL_EXT_shader_texture_lod"); - GLAD_EXT_shadow_samplers = has_ext("GL_EXT_shadow_samplers"); - GLAD_EXT_sparse_texture = has_ext("GL_EXT_sparse_texture"); - GLAD_EXT_sparse_texture2 = has_ext("GL_EXT_sparse_texture2"); - GLAD_EXT_sRGB = has_ext("GL_EXT_sRGB"); - GLAD_EXT_sRGB_write_control = has_ext("GL_EXT_sRGB_write_control"); - GLAD_EXT_stencil_clear_tag = has_ext("GL_EXT_stencil_clear_tag"); - GLAD_EXT_tessellation_point_size = has_ext("GL_EXT_tessellation_point_size"); - GLAD_EXT_tessellation_shader = has_ext("GL_EXT_tessellation_shader"); - GLAD_EXT_texture_array = has_ext("GL_EXT_texture_array"); - GLAD_EXT_texture_border_clamp = has_ext("GL_EXT_texture_border_clamp"); - GLAD_EXT_texture_buffer = has_ext("GL_EXT_texture_buffer"); - GLAD_EXT_texture_buffer_object = has_ext("GL_EXT_texture_buffer_object"); - GLAD_EXT_texture_compression_dxt1 = has_ext("GL_EXT_texture_compression_dxt1"); - GLAD_EXT_texture_compression_latc = has_ext("GL_EXT_texture_compression_latc"); - GLAD_EXT_texture_compression_rgtc = has_ext("GL_EXT_texture_compression_rgtc"); - GLAD_EXT_texture_compression_s3tc = has_ext("GL_EXT_texture_compression_s3tc"); - GLAD_EXT_texture_cube_map = has_ext("GL_EXT_texture_cube_map"); - GLAD_EXT_texture_cube_map_array = has_ext("GL_EXT_texture_cube_map_array"); - GLAD_EXT_texture_filter_anisotropic = has_ext("GL_EXT_texture_filter_anisotropic"); - GLAD_EXT_texture_filter_minmax = has_ext("GL_EXT_texture_filter_minmax"); - GLAD_EXT_texture_format_BGRA8888 = has_ext("GL_EXT_texture_format_BGRA8888"); - GLAD_EXT_texture_integer = has_ext("GL_EXT_texture_integer"); - GLAD_EXT_texture_norm16 = has_ext("GL_EXT_texture_norm16"); - GLAD_EXT_texture_rg = has_ext("GL_EXT_texture_rg"); - GLAD_EXT_texture_shared_exponent = has_ext("GL_EXT_texture_shared_exponent"); - GLAD_EXT_texture_snorm = has_ext("GL_EXT_texture_snorm"); - GLAD_EXT_texture_sRGB = has_ext("GL_EXT_texture_sRGB"); - GLAD_EXT_texture_sRGB_decode = has_ext("GL_EXT_texture_sRGB_decode"); - GLAD_EXT_texture_sRGB_R8 = has_ext("GL_EXT_texture_sRGB_R8"); - GLAD_EXT_texture_sRGB_RG8 = has_ext("GL_EXT_texture_sRGB_RG8"); - GLAD_EXT_texture_storage = has_ext("GL_EXT_texture_storage"); - GLAD_EXT_texture_swizzle = has_ext("GL_EXT_texture_swizzle"); - GLAD_EXT_texture_type_2_10_10_10_REV = has_ext("GL_EXT_texture_type_2_10_10_10_REV"); - GLAD_EXT_texture_view = has_ext("GL_EXT_texture_view"); - GLAD_EXT_timer_query = has_ext("GL_EXT_timer_query"); - GLAD_EXT_transform_feedback = has_ext("GL_EXT_transform_feedback"); - GLAD_EXT_unpack_subimage = has_ext("GL_EXT_unpack_subimage"); - GLAD_EXT_vertex_array_bgra = has_ext("GL_EXT_vertex_array_bgra"); - GLAD_EXT_vertex_attrib_64bit = has_ext("GL_EXT_vertex_attrib_64bit"); - GLAD_EXT_x11_sync_object = has_ext("GL_EXT_x11_sync_object"); - GLAD_EXT_YUV_target = has_ext("GL_EXT_YUV_target"); - GLAD_OES_compressed_ETC1_RGB8_sub_texture = has_ext("GL_OES_compressed_ETC1_RGB8_sub_texture"); - GLAD_OES_compressed_ETC1_RGB8_texture = has_ext("GL_OES_compressed_ETC1_RGB8_texture"); - GLAD_OES_copy_image = has_ext("GL_OES_copy_image"); - GLAD_OES_depth24 = has_ext("GL_OES_depth24"); - GLAD_OES_depth32 = has_ext("GL_OES_depth32"); - GLAD_OES_depth_texture = has_ext("GL_OES_depth_texture"); - GLAD_OES_draw_buffers_indexed = has_ext("GL_OES_draw_buffers_indexed"); - GLAD_OES_draw_elements_base_vertex = has_ext("GL_OES_draw_elements_base_vertex"); - GLAD_OES_EGL_image = has_ext("GL_OES_EGL_image"); - GLAD_OES_EGL_image_external = has_ext("GL_OES_EGL_image_external"); - GLAD_OES_EGL_image_external_essl3 = has_ext("GL_OES_EGL_image_external_essl3"); - GLAD_OES_element_index_uint = has_ext("GL_OES_element_index_uint"); - GLAD_OES_fbo_render_mipmap = has_ext("GL_OES_fbo_render_mipmap"); - GLAD_OES_fragment_precision_high = has_ext("GL_OES_fragment_precision_high"); - GLAD_OES_geometry_point_size = has_ext("GL_OES_geometry_point_size"); - GLAD_OES_geometry_shader = has_ext("GL_OES_geometry_shader"); - GLAD_OES_get_program_binary = has_ext("GL_OES_get_program_binary"); - GLAD_OES_gpu_shader5 = has_ext("GL_OES_gpu_shader5"); - GLAD_OES_mapbuffer = has_ext("GL_OES_mapbuffer"); - GLAD_OES_packed_depth_stencil = has_ext("GL_OES_packed_depth_stencil"); - GLAD_OES_primitive_bounding_box = has_ext("GL_OES_primitive_bounding_box"); - GLAD_OES_required_internalformat = has_ext("GL_OES_required_internalformat"); - GLAD_OES_rgb8_rgba8 = has_ext("GL_OES_rgb8_rgba8"); - GLAD_OES_sample_shading = has_ext("GL_OES_sample_shading"); - GLAD_OES_sample_variables = has_ext("GL_OES_sample_variables"); - GLAD_OES_shader_image_atomic = has_ext("GL_OES_shader_image_atomic"); - GLAD_OES_shader_io_blocks = has_ext("GL_OES_shader_io_blocks"); - GLAD_OES_shader_multisample_interpolation = has_ext("GL_OES_shader_multisample_interpolation"); - GLAD_OES_standard_derivatives = has_ext("GL_OES_standard_derivatives"); - GLAD_OES_stencil1 = has_ext("GL_OES_stencil1"); - GLAD_OES_stencil4 = has_ext("GL_OES_stencil4"); - GLAD_OES_surfaceless_context = has_ext("GL_OES_surfaceless_context"); - GLAD_OES_tessellation_point_size = has_ext("GL_OES_tessellation_point_size"); - GLAD_OES_tessellation_shader = has_ext("GL_OES_tessellation_shader"); - GLAD_OES_texture_3D = has_ext("GL_OES_texture_3D"); - GLAD_OES_texture_border_clamp = has_ext("GL_OES_texture_border_clamp"); - GLAD_OES_texture_buffer = has_ext("GL_OES_texture_buffer"); - GLAD_OES_texture_compression_astc = has_ext("GL_OES_texture_compression_astc"); - GLAD_OES_texture_cube_map_array = has_ext("GL_OES_texture_cube_map_array"); - GLAD_OES_texture_float = has_ext("GL_OES_texture_float"); - GLAD_OES_texture_float_linear = has_ext("GL_OES_texture_float_linear"); - GLAD_OES_texture_half_float = has_ext("GL_OES_texture_half_float"); - GLAD_OES_texture_half_float_linear = has_ext("GL_OES_texture_half_float_linear"); - GLAD_OES_texture_npot = has_ext("GL_OES_texture_npot"); - GLAD_OES_texture_stencil8 = has_ext("GL_OES_texture_stencil8"); - GLAD_OES_texture_storage_multisample_2d_array = has_ext("GL_OES_texture_storage_multisample_2d_array"); - GLAD_OES_texture_view = has_ext("GL_OES_texture_view"); - GLAD_OES_vertex_array_object = has_ext("GL_OES_vertex_array_object"); - GLAD_OES_vertex_half_float = has_ext("GL_OES_vertex_half_float"); - GLAD_OES_vertex_type_10_10_10_2 = has_ext("GL_OES_vertex_type_10_10_10_2"); - GLAD_AMD_blend_minmax_factor = has_ext("GL_AMD_blend_minmax_factor"); - GLAD_AMD_compressed_3DC_texture = has_ext("GL_AMD_compressed_3DC_texture"); - GLAD_AMD_compressed_ATC_texture = has_ext("GL_AMD_compressed_ATC_texture"); - GLAD_AMD_conservative_depth = has_ext("GL_AMD_conservative_depth"); - GLAD_AMD_debug_output = has_ext("GL_AMD_debug_output"); - GLAD_AMD_depth_clamp_separate = has_ext("GL_AMD_depth_clamp_separate"); - GLAD_AMD_draw_buffers_blend = has_ext("GL_AMD_draw_buffers_blend"); - GLAD_AMD_gcn_shader = has_ext("GL_AMD_gcn_shader"); - GLAD_AMD_gpu_shader_int64 = has_ext("GL_AMD_gpu_shader_int64"); - GLAD_AMD_interleaved_elements = has_ext("GL_AMD_interleaved_elements"); - GLAD_AMD_multi_draw_indirect = has_ext("GL_AMD_multi_draw_indirect"); - GLAD_AMD_name_gen_delete = has_ext("GL_AMD_name_gen_delete"); - GLAD_AMD_occlusion_query_event = has_ext("GL_AMD_occlusion_query_event"); - GLAD_AMD_performance_monitor = has_ext("GL_AMD_performance_monitor"); - GLAD_AMD_pinned_memory = has_ext("GL_AMD_pinned_memory"); - GLAD_AMD_program_binary_Z400 = has_ext("GL_AMD_program_binary_Z400"); - GLAD_AMD_query_buffer_object = has_ext("GL_AMD_query_buffer_object"); - GLAD_AMD_sample_positions = has_ext("GL_AMD_sample_positions"); - GLAD_AMD_seamless_cubemap_per_texture = has_ext("GL_AMD_seamless_cubemap_per_texture"); - GLAD_AMD_shader_atomic_counter_ops = has_ext("GL_AMD_shader_atomic_counter_ops"); - GLAD_AMD_shader_stencil_export = has_ext("GL_AMD_shader_stencil_export"); - GLAD_AMD_shader_trinary_minmax = has_ext("GL_AMD_shader_trinary_minmax"); - GLAD_AMD_sparse_texture = has_ext("GL_AMD_sparse_texture"); - GLAD_AMD_stencil_operation_extended = has_ext("GL_AMD_stencil_operation_extended"); - GLAD_AMD_texture_texture4 = has_ext("GL_AMD_texture_texture4"); - GLAD_AMD_transform_feedback3_lines_triangles = has_ext("GL_AMD_transform_feedback3_lines_triangles"); - GLAD_AMD_transform_feedback4 = has_ext("GL_AMD_transform_feedback4"); - GLAD_AMD_vertex_shader_layer = has_ext("GL_AMD_vertex_shader_layer"); - GLAD_AMD_vertex_shader_tessellator = has_ext("GL_AMD_vertex_shader_tessellator"); - GLAD_AMD_vertex_shader_viewport_index = has_ext("GL_AMD_vertex_shader_viewport_index"); - GLAD_ANDROID_extension_pack_es31a = has_ext("GL_ANDROID_extension_pack_es31a"); - GLAD_ANGLE_depth_texture = has_ext("GL_ANGLE_depth_texture"); - GLAD_ANGLE_framebuffer_blit = has_ext("GL_ANGLE_framebuffer_blit"); - GLAD_ANGLE_framebuffer_multisample = has_ext("GL_ANGLE_framebuffer_multisample"); - GLAD_ANGLE_instanced_arrays = has_ext("GL_ANGLE_instanced_arrays"); - GLAD_ANGLE_pack_reverse_row_order = has_ext("GL_ANGLE_pack_reverse_row_order"); - GLAD_ANGLE_program_binary = has_ext("GL_ANGLE_program_binary"); - GLAD_ANGLE_texture_compression_dxt3 = has_ext("GL_ANGLE_texture_compression_dxt3"); - GLAD_ANGLE_texture_compression_dxt5 = has_ext("GL_ANGLE_texture_compression_dxt5"); - GLAD_ANGLE_texture_usage = has_ext("GL_ANGLE_texture_usage"); - GLAD_ANGLE_translated_shader_source = has_ext("GL_ANGLE_translated_shader_source"); - GLAD_APPLE_aux_depth_stencil = has_ext("GL_APPLE_aux_depth_stencil"); - GLAD_APPLE_client_storage = has_ext("GL_APPLE_client_storage"); - GLAD_APPLE_clip_distance = has_ext("GL_APPLE_clip_distance"); - GLAD_APPLE_color_buffer_packed_float = has_ext("GL_APPLE_color_buffer_packed_float"); - GLAD_APPLE_copy_texture_levels = has_ext("GL_APPLE_copy_texture_levels"); - GLAD_APPLE_element_array = has_ext("GL_APPLE_element_array"); - GLAD_APPLE_fence = has_ext("GL_APPLE_fence"); - GLAD_APPLE_float_pixels = has_ext("GL_APPLE_float_pixels"); - GLAD_APPLE_flush_buffer_range = has_ext("GL_APPLE_flush_buffer_range"); - GLAD_APPLE_framebuffer_multisample = has_ext("GL_APPLE_framebuffer_multisample"); - GLAD_APPLE_object_purgeable = has_ext("GL_APPLE_object_purgeable"); - GLAD_APPLE_rgb_422 = has_ext("GL_APPLE_rgb_422"); - GLAD_APPLE_row_bytes = has_ext("GL_APPLE_row_bytes"); - GLAD_APPLE_sync = has_ext("GL_APPLE_sync"); - GLAD_APPLE_texture_format_BGRA8888 = has_ext("GL_APPLE_texture_format_BGRA8888"); - GLAD_APPLE_texture_max_level = has_ext("GL_APPLE_texture_max_level"); - GLAD_APPLE_texture_packed_float = has_ext("GL_APPLE_texture_packed_float"); - GLAD_APPLE_texture_range = has_ext("GL_APPLE_texture_range"); - GLAD_APPLE_vertex_array_object = has_ext("GL_APPLE_vertex_array_object"); - GLAD_APPLE_vertex_array_range = has_ext("GL_APPLE_vertex_array_range"); - GLAD_APPLE_vertex_program_evaluators = has_ext("GL_APPLE_vertex_program_evaluators"); - GLAD_APPLE_ycbcr_422 = has_ext("GL_APPLE_ycbcr_422"); - GLAD_ARM_mali_program_binary = has_ext("GL_ARM_mali_program_binary"); - GLAD_ARM_mali_shader_binary = has_ext("GL_ARM_mali_shader_binary"); - GLAD_ARM_rgba8 = has_ext("GL_ARM_rgba8"); - GLAD_ARM_shader_framebuffer_fetch = has_ext("GL_ARM_shader_framebuffer_fetch"); - GLAD_ARM_shader_framebuffer_fetch_depth_stencil = has_ext("GL_ARM_shader_framebuffer_fetch_depth_stencil"); - GLAD_ATI_meminfo = has_ext("GL_ATI_meminfo"); - GLAD_ATI_pixel_format_float = has_ext("GL_ATI_pixel_format_float"); - GLAD_DMP_program_binary = has_ext("GL_DMP_program_binary"); - GLAD_DMP_shader_binary = has_ext("GL_DMP_shader_binary"); - GLAD_FJ_shader_binary_GCCSO = has_ext("GL_FJ_shader_binary_GCCSO"); - GLAD_GREMEDY_frame_terminator = has_ext("GL_GREMEDY_frame_terminator"); - GLAD_GREMEDY_string_marker = has_ext("GL_GREMEDY_string_marker"); - GLAD_IMG_multisampled_render_to_texture = has_ext("GL_IMG_multisampled_render_to_texture"); - GLAD_IMG_program_binary = has_ext("GL_IMG_program_binary"); - GLAD_IMG_read_format = has_ext("GL_IMG_read_format"); - GLAD_IMG_shader_binary = has_ext("GL_IMG_shader_binary"); - GLAD_IMG_texture_compression_pvrtc = has_ext("GL_IMG_texture_compression_pvrtc"); - GLAD_IMG_texture_compression_pvrtc2 = has_ext("GL_IMG_texture_compression_pvrtc2"); - GLAD_IMG_texture_filter_cubic = has_ext("GL_IMG_texture_filter_cubic"); - GLAD_INGR_blend_func_separate = has_ext("GL_INGR_blend_func_separate"); - GLAD_INTEL_fragment_shader_ordering = has_ext("GL_INTEL_fragment_shader_ordering"); - GLAD_INTEL_framebuffer_CMAA = has_ext("GL_INTEL_framebuffer_CMAA"); - GLAD_INTEL_map_texture = has_ext("GL_INTEL_map_texture"); - GLAD_INTEL_performance_query = has_ext("GL_INTEL_performance_query"); - GLAD_MESA_pack_invert = has_ext("GL_MESA_pack_invert"); - GLAD_MESA_ycbcr_texture = has_ext("GL_MESA_ycbcr_texture"); - GLAD_MESAX_texture_stack = has_ext("GL_MESAX_texture_stack"); - GLAD_NV_bindless_multi_draw_indirect = has_ext("GL_NV_bindless_multi_draw_indirect"); - GLAD_NV_bindless_multi_draw_indirect_count = has_ext("GL_NV_bindless_multi_draw_indirect_count"); - GLAD_NV_bindless_texture = has_ext("GL_NV_bindless_texture"); - GLAD_NV_blend_equation_advanced = has_ext("GL_NV_blend_equation_advanced"); - GLAD_NV_blend_equation_advanced_coherent = has_ext("GL_NV_blend_equation_advanced_coherent"); - GLAD_NV_command_list = has_ext("GL_NV_command_list"); - GLAD_NV_compute_program5 = has_ext("GL_NV_compute_program5"); - GLAD_NV_conditional_render = has_ext("GL_NV_conditional_render"); - GLAD_NV_conservative_raster = has_ext("GL_NV_conservative_raster"); - GLAD_NV_conservative_raster_dilate = has_ext("GL_NV_conservative_raster_dilate"); - GLAD_NV_copy_buffer = has_ext("GL_NV_copy_buffer"); - GLAD_NV_copy_image = has_ext("GL_NV_copy_image"); - GLAD_NV_coverage_sample = has_ext("GL_NV_coverage_sample"); - GLAD_NV_deep_texture3D = has_ext("GL_NV_deep_texture3D"); - GLAD_NV_depth_buffer_float = has_ext("GL_NV_depth_buffer_float"); - GLAD_NV_depth_clamp = has_ext("GL_NV_depth_clamp"); - GLAD_NV_depth_nonlinear = has_ext("GL_NV_depth_nonlinear"); - GLAD_NV_draw_buffers = has_ext("GL_NV_draw_buffers"); - GLAD_NV_draw_instanced = has_ext("GL_NV_draw_instanced"); - GLAD_NV_draw_texture = has_ext("GL_NV_draw_texture"); - GLAD_NV_explicit_attrib_location = has_ext("GL_NV_explicit_attrib_location"); - GLAD_NV_explicit_multisample = has_ext("GL_NV_explicit_multisample"); - GLAD_NV_fbo_color_attachments = has_ext("GL_NV_fbo_color_attachments"); - GLAD_NV_fence = has_ext("GL_NV_fence"); - GLAD_NV_fill_rectangle = has_ext("GL_NV_fill_rectangle"); - GLAD_NV_float_buffer = has_ext("GL_NV_float_buffer"); - GLAD_NV_fragment_coverage_to_color = has_ext("GL_NV_fragment_coverage_to_color"); - GLAD_NV_fragment_program4 = has_ext("GL_NV_fragment_program4"); - GLAD_NV_fragment_shader_interlock = has_ext("GL_NV_fragment_shader_interlock"); - GLAD_NV_framebuffer_blit = has_ext("GL_NV_framebuffer_blit"); - GLAD_NV_framebuffer_mixed_samples = has_ext("GL_NV_framebuffer_mixed_samples"); - GLAD_NV_framebuffer_multisample = has_ext("GL_NV_framebuffer_multisample"); - GLAD_NV_framebuffer_multisample_coverage = has_ext("GL_NV_framebuffer_multisample_coverage"); - GLAD_NV_generate_mipmap_sRGB = has_ext("GL_NV_generate_mipmap_sRGB"); - GLAD_NV_geometry_program4 = has_ext("GL_NV_geometry_program4"); - GLAD_NV_geometry_shader4 = has_ext("GL_NV_geometry_shader4"); - GLAD_NV_geometry_shader_passthrough = has_ext("GL_NV_geometry_shader_passthrough"); - GLAD_NV_gpu_program4 = has_ext("GL_NV_gpu_program4"); - GLAD_NV_gpu_program5 = has_ext("GL_NV_gpu_program5"); - GLAD_NV_gpu_program5_mem_extended = has_ext("GL_NV_gpu_program5_mem_extended"); - GLAD_NV_gpu_shader5 = has_ext("GL_NV_gpu_shader5"); - GLAD_NV_half_float = has_ext("GL_NV_half_float"); - GLAD_NV_image_formats = has_ext("GL_NV_image_formats"); - GLAD_NV_instanced_arrays = has_ext("GL_NV_instanced_arrays"); - GLAD_NV_internalformat_sample_query = has_ext("GL_NV_internalformat_sample_query"); - GLAD_NV_multisample_coverage = has_ext("GL_NV_multisample_coverage"); - GLAD_NV_non_square_matrices = has_ext("GL_NV_non_square_matrices"); - GLAD_NV_occlusion_query = has_ext("GL_NV_occlusion_query"); - GLAD_NV_parameter_buffer_object = has_ext("GL_NV_parameter_buffer_object"); - GLAD_NV_parameter_buffer_object2 = has_ext("GL_NV_parameter_buffer_object2"); - GLAD_NV_path_rendering = has_ext("GL_NV_path_rendering"); - GLAD_NV_path_rendering_shared_edge = has_ext("GL_NV_path_rendering_shared_edge"); - GLAD_NV_polygon_mode = has_ext("GL_NV_polygon_mode"); - GLAD_NV_present_video = has_ext("GL_NV_present_video"); - GLAD_NV_primitive_restart = has_ext("GL_NV_primitive_restart"); - GLAD_NV_read_buffer = has_ext("GL_NV_read_buffer"); - GLAD_NV_read_buffer_front = has_ext("GL_NV_read_buffer_front"); - GLAD_NV_read_depth = has_ext("GL_NV_read_depth"); - GLAD_NV_read_depth_stencil = has_ext("GL_NV_read_depth_stencil"); - GLAD_NV_read_stencil = has_ext("GL_NV_read_stencil"); - GLAD_NV_sample_locations = has_ext("GL_NV_sample_locations"); - GLAD_NV_sample_mask_override_coverage = has_ext("GL_NV_sample_mask_override_coverage"); - GLAD_NV_shader_atomic_counters = has_ext("GL_NV_shader_atomic_counters"); - GLAD_NV_shader_atomic_float = has_ext("GL_NV_shader_atomic_float"); - GLAD_NV_shader_atomic_fp16_vector = has_ext("GL_NV_shader_atomic_fp16_vector"); - GLAD_NV_shader_atomic_int64 = has_ext("GL_NV_shader_atomic_int64"); - GLAD_NV_shader_buffer_load = has_ext("GL_NV_shader_buffer_load"); - GLAD_NV_shader_buffer_store = has_ext("GL_NV_shader_buffer_store"); - GLAD_NV_shader_noperspective_interpolation = has_ext("GL_NV_shader_noperspective_interpolation"); - GLAD_NV_shader_storage_buffer_object = has_ext("GL_NV_shader_storage_buffer_object"); - GLAD_NV_shader_thread_group = has_ext("GL_NV_shader_thread_group"); - GLAD_NV_shader_thread_shuffle = has_ext("GL_NV_shader_thread_shuffle"); - GLAD_NV_shadow_samplers_array = has_ext("GL_NV_shadow_samplers_array"); - GLAD_NV_shadow_samplers_cube = has_ext("GL_NV_shadow_samplers_cube"); - GLAD_NV_sRGB_formats = has_ext("GL_NV_sRGB_formats"); - GLAD_NV_tessellation_program5 = has_ext("GL_NV_tessellation_program5"); - GLAD_NV_texture_barrier = has_ext("GL_NV_texture_barrier"); - GLAD_NV_texture_border_clamp = has_ext("GL_NV_texture_border_clamp"); - GLAD_NV_texture_compression_s3tc_update = has_ext("GL_NV_texture_compression_s3tc_update"); - GLAD_NV_texture_multisample = has_ext("GL_NV_texture_multisample"); - GLAD_NV_texture_npot_2D_mipmap = has_ext("GL_NV_texture_npot_2D_mipmap"); - GLAD_NV_transform_feedback = has_ext("GL_NV_transform_feedback"); - GLAD_NV_transform_feedback2 = has_ext("GL_NV_transform_feedback2"); - GLAD_NV_uniform_buffer_unified_memory = has_ext("GL_NV_uniform_buffer_unified_memory"); - GLAD_NV_vdpau_interop = has_ext("GL_NV_vdpau_interop"); - GLAD_NV_vertex_attrib_integer_64bit = has_ext("GL_NV_vertex_attrib_integer_64bit"); - GLAD_NV_vertex_buffer_unified_memory = has_ext("GL_NV_vertex_buffer_unified_memory"); - GLAD_NV_vertex_program4 = has_ext("GL_NV_vertex_program4"); - GLAD_NV_video_capture = has_ext("GL_NV_video_capture"); - GLAD_NV_viewport_array = has_ext("GL_NV_viewport_array"); - GLAD_NV_viewport_array2 = has_ext("GL_NV_viewport_array2"); - GLAD_NVX_conditional_render = has_ext("GL_NVX_conditional_render"); - GLAD_NVX_gpu_memory_info = has_ext("GL_NVX_gpu_memory_info"); - GLAD_OVR_multiview = has_ext("GL_OVR_multiview"); - GLAD_OVR_multiview2 = has_ext("GL_OVR_multiview2"); - GLAD_OVR_multiview_multisampled_render_to_texture = has_ext("GL_OVR_multiview_multisampled_render_to_texture"); - GLAD_QCOM_alpha_test = has_ext("GL_QCOM_alpha_test"); - GLAD_QCOM_binning_control = has_ext("GL_QCOM_binning_control"); - GLAD_QCOM_driver_control = has_ext("GL_QCOM_driver_control"); - GLAD_QCOM_extended_get = has_ext("GL_QCOM_extended_get"); - GLAD_QCOM_extended_get2 = has_ext("GL_QCOM_extended_get2"); - GLAD_QCOM_perfmon_global_mode = has_ext("GL_QCOM_perfmon_global_mode"); - GLAD_QCOM_tiled_rendering = has_ext("GL_QCOM_tiled_rendering"); - GLAD_QCOM_writeonly_rendering = has_ext("GL_QCOM_writeonly_rendering"); - GLAD_VIV_shader_binary = has_ext("GL_VIV_shader_binary"); -} - -static void find_core(void) { - const char *v = (const char *)fp_glGetString(GL_VERSION); - int major = v[0] - '0', minor = v[2] - '0', gles = false; - GLVersion.gles = false; - if (strstr(v, "OpenGL ES ") == v) { - major = v[10] - '0'; minor = v[12] - '0'; gles = true; - } - GLVersion.major = major; GLVersion.minor = minor; GLVersion.gles = gles; - GLAD_VERSION_1_0 = gles == 0 && ((major == 1 && minor >= 0) || major > 1); - GLAD_VERSION_1_1 = gles == 0 && ((major == 1 && minor >= 1) || major > 1); - GLAD_VERSION_1_2 = gles == 0 && ((major == 1 && minor >= 2) || major > 1); - GLAD_VERSION_1_3 = gles == 0 && ((major == 1 && minor >= 3) || major > 1); - GLAD_VERSION_1_4 = gles == 0 && ((major == 1 && minor >= 4) || major > 1); - GLAD_VERSION_1_5 = gles == 0 && ((major == 1 && minor >= 5) || major > 1); - GLAD_VERSION_2_0 = gles == 0 && ((major == 2 && minor >= 0) || major > 2); - GLAD_VERSION_2_1 = gles == 0 && ((major == 2 && minor >= 1) || major > 2); - GLAD_VERSION_3_0 = gles == 0 && ((major == 3 && minor >= 0) || major > 3); - GLAD_VERSION_3_1 = gles == 0 && ((major == 3 && minor >= 1) || major > 3); - GLAD_VERSION_3_2 = gles == 0 && ((major == 3 && minor >= 2) || major > 3); - GLAD_VERSION_3_3 = gles == 0 && ((major == 3 && minor >= 3) || major > 3); - GLAD_VERSION_4_0 = gles == 0 && ((major == 4 && minor >= 0) || major > 4); - GLAD_VERSION_4_1 = gles == 0 && ((major == 4 && minor >= 1) || major > 4); - GLAD_VERSION_4_2 = gles == 0 && ((major == 4 && minor >= 2) || major > 4); - GLAD_VERSION_4_3 = gles == 0 && ((major == 4 && minor >= 3) || major > 4); - GLAD_VERSION_4_4 = gles == 0 && ((major == 4 && minor >= 4) || major > 4); - GLAD_VERSION_4_5 = gles == 0 && ((major == 4 && minor >= 5) || major > 4); - GLAD_ES_VERSION_2_0 = gles == 1 && ((major == 2 && minor >= 0) || major > 2); - GLAD_ES_VERSION_3_0 = gles == 1 && ((major == 3 && minor >= 0) || major > 3); - GLAD_ES_VERSION_3_1 = gles == 1 && ((major == 3 && minor >= 1) || major > 3); - GLAD_ES_VERSION_3_2 = gles == 1 && ((major == 3 && minor >= 2) || major > 3); -} - -bool gladLoadGLLoader(LOADER load) { - GLVersion.major = 0; GLVersion.minor = 0; GLVersion.gles = 0; - fp_glGetString = (pfn_glGetString)load("glGetString"); - if(fp_glGetString == NULL) return false; - find_core(); - load_GL_VERSION_1_0(load); - load_GL_VERSION_1_1(load); - load_GL_VERSION_1_2(load); - load_GL_VERSION_1_3(load); - load_GL_VERSION_1_4(load); - load_GL_VERSION_1_5(load); - load_GL_VERSION_2_0(load); - load_GL_VERSION_2_1(load); - load_GL_VERSION_3_0(load); - load_GL_VERSION_3_1(load); - load_GL_VERSION_3_2(load); - load_GL_VERSION_3_3(load); - load_GL_VERSION_4_0(load); - load_GL_VERSION_4_1(load); - load_GL_VERSION_4_2(load); - load_GL_VERSION_4_3(load); - load_GL_VERSION_4_4(load); - load_GL_VERSION_4_5(load); - load_GL_ES_VERSION_2_0(load); - load_GL_ES_VERSION_3_0(load); - load_GL_ES_VERSION_3_1(load); - load_GL_ES_VERSION_3_2(load); - - find_extensions(); - load_GL_KHR_blend_equation_advanced(load); - load_GL_KHR_debug(load); - load_GL_KHR_robustness(load); - load_GL_ARB_base_instance(load); - load_GL_ARB_bindless_texture(load); - load_GL_ARB_blend_func_extended(load); - load_GL_ARB_buffer_storage(load); - load_GL_ARB_cl_event(load); - load_GL_ARB_clear_buffer_object(load); - load_GL_ARB_clear_texture(load); - load_GL_ARB_clip_control(load); - load_GL_ARB_color_buffer_float(load); - load_GL_ARB_compute_shader(load); - load_GL_ARB_compute_variable_group_size(load); - load_GL_ARB_copy_buffer(load); - load_GL_ARB_copy_image(load); - load_GL_ARB_debug_output(load); - load_GL_ARB_direct_state_access(load); - load_GL_ARB_draw_buffers_blend(load); - load_GL_ARB_draw_elements_base_vertex(load); - load_GL_ARB_draw_indirect(load); - load_GL_ARB_draw_instanced(load); - load_GL_ARB_ES2_compatibility(load); - load_GL_ARB_ES3_1_compatibility(load); - load_GL_ARB_ES3_2_compatibility(load); - load_GL_ARB_framebuffer_no_attachments(load); - load_GL_ARB_framebuffer_object(load); - load_GL_ARB_geometry_shader4(load); - load_GL_ARB_get_program_binary(load); - load_GL_ARB_get_texture_sub_image(load); - load_GL_ARB_gpu_shader_fp64(load); - load_GL_ARB_gpu_shader_int64(load); - load_GL_ARB_indirect_parameters(load); - load_GL_ARB_instanced_arrays(load); - load_GL_ARB_internalformat_query(load); - load_GL_ARB_internalformat_query2(load); - load_GL_ARB_invalidate_subdata(load); - load_GL_ARB_map_buffer_range(load); - load_GL_ARB_multi_bind(load); - load_GL_ARB_multi_draw_indirect(load); - load_GL_ARB_parallel_shader_compile(load); - load_GL_ARB_program_interface_query(load); - load_GL_ARB_provoking_vertex(load); - load_GL_ARB_robustness(load); - load_GL_ARB_sample_locations(load); - load_GL_ARB_sample_shading(load); - load_GL_ARB_sampler_objects(load); - load_GL_ARB_separate_shader_objects(load); - load_GL_ARB_shader_atomic_counters(load); - load_GL_ARB_shader_image_load_store(load); - load_GL_ARB_shader_storage_buffer_object(load); - load_GL_ARB_shader_subroutine(load); - load_GL_ARB_shading_language_include(load); - load_GL_ARB_sparse_buffer(load); - load_GL_ARB_sparse_texture(load); - load_GL_ARB_sync(load); - load_GL_ARB_tessellation_shader(load); - load_GL_ARB_texture_barrier(load); - load_GL_ARB_texture_buffer_object(load); - load_GL_ARB_texture_buffer_range(load); - load_GL_ARB_texture_multisample(load); - load_GL_ARB_texture_storage(load); - load_GL_ARB_texture_storage_multisample(load); - load_GL_ARB_texture_view(load); - load_GL_ARB_timer_query(load); - load_GL_ARB_transform_feedback2(load); - load_GL_ARB_transform_feedback3(load); - load_GL_ARB_transform_feedback_instanced(load); - load_GL_ARB_uniform_buffer_object(load); - load_GL_ARB_vertex_array_object(load); - load_GL_ARB_vertex_attrib_64bit(load); - load_GL_ARB_vertex_attrib_binding(load); - load_GL_ARB_vertex_type_2_10_10_10_rev(load); - load_GL_ARB_viewport_array(load); - load_GL_EXT_base_instance(load); - load_GL_EXT_bindable_uniform(load); - load_GL_EXT_blend_func_extended(load); - load_GL_EXT_blend_minmax(load); - load_GL_EXT_buffer_storage(load); - load_GL_EXT_copy_image(load); - load_GL_EXT_debug_label(load); - load_GL_EXT_debug_marker(load); - load_GL_EXT_direct_state_access(load); - load_GL_EXT_discard_framebuffer(load); - load_GL_EXT_disjoint_timer_query(load); - load_GL_EXT_draw_buffers(load); - load_GL_EXT_draw_buffers2(load); - load_GL_EXT_draw_buffers_indexed(load); - load_GL_EXT_draw_elements_base_vertex(load); - load_GL_EXT_draw_instanced(load); - load_GL_EXT_framebuffer_blit(load); - load_GL_EXT_framebuffer_multisample(load); - load_GL_EXT_framebuffer_object(load); - load_GL_EXT_geometry_shader(load); - load_GL_EXT_geometry_shader4(load); - load_GL_EXT_gpu_program_parameters(load); - load_GL_EXT_gpu_shader4(load); - load_GL_EXT_instanced_arrays(load); - load_GL_EXT_map_buffer_range(load); - load_GL_EXT_multi_draw_indirect(load); - load_GL_EXT_multisampled_render_to_texture(load); - load_GL_EXT_multiview_draw_buffers(load); - load_GL_EXT_occlusion_query_boolean(load); - load_GL_EXT_polygon_offset_clamp(load); - load_GL_EXT_primitive_bounding_box(load); - load_GL_EXT_provoking_vertex(load); - load_GL_EXT_raster_multisample(load); - load_GL_EXT_robustness(load); - load_GL_EXT_separate_shader_objects(load); - load_GL_EXT_shader_image_load_store(load); - load_GL_EXT_sparse_texture(load); - load_GL_EXT_stencil_clear_tag(load); - load_GL_EXT_tessellation_shader(load); - load_GL_EXT_texture_array(load); - load_GL_EXT_texture_border_clamp(load); - load_GL_EXT_texture_buffer(load); - load_GL_EXT_texture_buffer_object(load); - load_GL_EXT_texture_filter_minmax(load); - load_GL_EXT_texture_integer(load); - load_GL_EXT_texture_storage(load); - load_GL_EXT_texture_view(load); - load_GL_EXT_timer_query(load); - load_GL_EXT_transform_feedback(load); - load_GL_EXT_vertex_attrib_64bit(load); - load_GL_EXT_x11_sync_object(load); - load_GL_OES_copy_image(load); - load_GL_OES_draw_buffers_indexed(load); - load_GL_OES_draw_elements_base_vertex(load); - load_GL_OES_EGL_image(load); - load_GL_OES_geometry_shader(load); - load_GL_OES_get_program_binary(load); - load_GL_OES_mapbuffer(load); - load_GL_OES_primitive_bounding_box(load); - load_GL_OES_sample_shading(load); - load_GL_OES_tessellation_shader(load); - load_GL_OES_texture_3D(load); - load_GL_OES_texture_border_clamp(load); - load_GL_OES_texture_buffer(load); - load_GL_OES_texture_storage_multisample_2d_array(load); - load_GL_OES_texture_view(load); - load_GL_OES_vertex_array_object(load); - load_GL_AMD_debug_output(load); - load_GL_AMD_draw_buffers_blend(load); - load_GL_AMD_gpu_shader_int64(load); - load_GL_AMD_interleaved_elements(load); - load_GL_AMD_multi_draw_indirect(load); - load_GL_AMD_name_gen_delete(load); - load_GL_AMD_occlusion_query_event(load); - load_GL_AMD_performance_monitor(load); - load_GL_AMD_sample_positions(load); - load_GL_AMD_sparse_texture(load); - load_GL_AMD_stencil_operation_extended(load); - load_GL_AMD_vertex_shader_tessellator(load); - load_GL_ANGLE_framebuffer_blit(load); - load_GL_ANGLE_framebuffer_multisample(load); - load_GL_ANGLE_instanced_arrays(load); - load_GL_ANGLE_translated_shader_source(load); - load_GL_APPLE_copy_texture_levels(load); - load_GL_APPLE_element_array(load); - load_GL_APPLE_fence(load); - load_GL_APPLE_flush_buffer_range(load); - load_GL_APPLE_framebuffer_multisample(load); - load_GL_APPLE_object_purgeable(load); - load_GL_APPLE_sync(load); - load_GL_APPLE_texture_range(load); - load_GL_APPLE_vertex_array_object(load); - load_GL_APPLE_vertex_array_range(load); - load_GL_APPLE_vertex_program_evaluators(load); - load_GL_GREMEDY_frame_terminator(load); - load_GL_GREMEDY_string_marker(load); - load_GL_IMG_multisampled_render_to_texture(load); - load_GL_INGR_blend_func_separate(load); - load_GL_INTEL_framebuffer_CMAA(load); - load_GL_INTEL_map_texture(load); - load_GL_INTEL_performance_query(load); - load_GL_NV_bindless_multi_draw_indirect(load); - load_GL_NV_bindless_multi_draw_indirect_count(load); - load_GL_NV_bindless_texture(load); - load_GL_NV_blend_equation_advanced(load); - load_GL_NV_command_list(load); - load_GL_NV_conditional_render(load); - load_GL_NV_conservative_raster(load); - load_GL_NV_conservative_raster_dilate(load); - load_GL_NV_copy_buffer(load); - load_GL_NV_copy_image(load); - load_GL_NV_coverage_sample(load); - load_GL_NV_depth_buffer_float(load); - load_GL_NV_draw_buffers(load); - load_GL_NV_draw_instanced(load); - load_GL_NV_draw_texture(load); - load_GL_NV_explicit_multisample(load); - load_GL_NV_fence(load); - load_GL_NV_fragment_coverage_to_color(load); - load_GL_NV_framebuffer_blit(load); - load_GL_NV_framebuffer_mixed_samples(load); - load_GL_NV_framebuffer_multisample(load); - load_GL_NV_framebuffer_multisample_coverage(load); - load_GL_NV_geometry_program4(load); - load_GL_NV_gpu_program4(load); - load_GL_NV_gpu_program5(load); - load_GL_NV_gpu_shader5(load); - load_GL_NV_half_float(load); - load_GL_NV_instanced_arrays(load); - load_GL_NV_internalformat_sample_query(load); - load_GL_NV_non_square_matrices(load); - load_GL_NV_occlusion_query(load); - load_GL_NV_parameter_buffer_object(load); - load_GL_NV_path_rendering(load); - load_GL_NV_polygon_mode(load); - load_GL_NV_present_video(load); - load_GL_NV_primitive_restart(load); - load_GL_NV_read_buffer(load); - load_GL_NV_sample_locations(load); - load_GL_NV_shader_buffer_load(load); - load_GL_NV_texture_barrier(load); - load_GL_NV_texture_multisample(load); - load_GL_NV_transform_feedback(load); - load_GL_NV_transform_feedback2(load); - load_GL_NV_vdpau_interop(load); - load_GL_NV_vertex_attrib_integer_64bit(load); - load_GL_NV_vertex_buffer_unified_memory(load); - load_GL_NV_vertex_program4(load); - load_GL_NV_video_capture(load); - load_GL_NV_viewport_array(load); - load_GL_NVX_conditional_render(load); - load_GL_OVR_multiview(load); - load_GL_OVR_multiview_multisampled_render_to_texture(load); - load_GL_QCOM_alpha_test(load); - load_GL_QCOM_driver_control(load); - load_GL_QCOM_extended_get(load); - load_GL_QCOM_extended_get2(load); - load_GL_QCOM_tiled_rendering(load); - return true; -} - -} /* namespace glad */ diff --git a/love/src/jni/love/src/libraries/glad/glad.hpp b/love/src/jni/love/src/libraries/glad/glad.hpp deleted file mode 100644 index 195d2054..00000000 --- a/love/src/jni/love/src/libraries/glad/glad.hpp +++ /dev/null @@ -1,9689 +0,0 @@ - -/** - * The MIT License (MIT) - * - * Copyright (c) 2013 David Herberth, modified by Alex Szpakowski - * - * 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 __glad_hpp_ - -#if defined(__gl_h_) || defined(__glext_h_) || defined(__glcorearb_h_) \ - || defined(__gl3_h) || defined(__gl3_ext_h) -#error OpenGL header already included, remove this include, glad already provides it -#endif - -#define __glad_hpp_ -#define __gl_h_ - -#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN 1 -#endif - -#include - -#ifdef near -#undef near -#endif - -#ifdef far -#undef far -#endif - -#endif - -#ifndef APIENTRY -#define APIENTRY -#endif -#ifndef APIENTRYP -#define APIENTRYP APIENTRY * -#endif -#ifndef GLAPI -#define GLAPI extern -#endif - -#include - -namespace glad { - -bool gladLoadGL(void); - -typedef void* (* LOADER)(const char *name); -bool gladLoadGLLoader(LOADER); - - -#ifndef GLEXT_64_TYPES_DEFINED -/* This code block is duplicated in glxext.h, so must be protected */ -#define GLEXT_64_TYPES_DEFINED -/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ -/* (as used in the GL_EXT_timer_query extension). */ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -#include -#elif defined(__sun__) || defined(__digital__) -#include -#if defined(__STDC__) -#if defined(__arch64__) || defined(_LP64) -typedef long int int64_t; -typedef unsigned long int uint64_t; -#else -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#endif /* __arch64__ */ -#endif /* __STDC__ */ -#elif defined( __VMS ) || defined(__sgi) -#include -#elif defined(__SCO__) || defined(__USLC__) -#include -#elif defined(__UNIXOS2__) || defined(__SOL64__) -typedef long int int32_t; -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#elif defined(_WIN32) && defined(__GNUC__) -#include -#elif defined(_WIN32) -typedef __int32 int32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -#else -/* Fallback if nothing above works */ -#include -#endif -#endif -typedef unsigned int GLenum; -typedef unsigned char GLboolean; -typedef unsigned int GLbitfield; -typedef void GLvoid; -typedef signed char GLbyte; -typedef short GLshort; -typedef int GLint; -typedef int GLclampx; -typedef unsigned char GLubyte; -typedef unsigned short GLushort; -typedef unsigned int GLuint; -typedef int GLsizei; -typedef float GLfloat; -typedef float GLclampf; -typedef double GLdouble; -typedef double GLclampd; -typedef void *GLeglImageOES; -typedef char GLchar; -typedef char GLcharARB; -#ifdef __APPLE__ -typedef void *GLhandleARB; -#else -typedef unsigned int GLhandleARB; -#endif -typedef unsigned short GLhalfARB; -typedef unsigned short GLhalf; -typedef GLint GLfixed; -typedef ptrdiff_t GLintptr; -typedef ptrdiff_t GLsizeiptr; -typedef int64_t GLint64; -typedef uint64_t GLuint64; -typedef ptrdiff_t GLintptrARB; -typedef ptrdiff_t GLsizeiptrARB; -typedef int64_t GLint64EXT; -typedef uint64_t GLuint64EXT; -typedef struct __GLsync *GLsync; -struct _cl_context; -struct _cl_event; -typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); -typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); -typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); -typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam); -typedef unsigned short GLhalfNV; -typedef GLintptr GLvdpauSurfaceNV; - - /* GL_VERSION_1_0 */ -extern GLboolean GLAD_VERSION_1_0; -typedef void (APIENTRYP pfn_glCullFace) (GLenum); -extern pfn_glCullFace fp_glCullFace; -typedef void (APIENTRYP pfn_glFrontFace) (GLenum); -extern pfn_glFrontFace fp_glFrontFace; -typedef void (APIENTRYP pfn_glHint) (GLenum, GLenum); -extern pfn_glHint fp_glHint; -typedef void (APIENTRYP pfn_glLineWidth) (GLfloat); -extern pfn_glLineWidth fp_glLineWidth; -typedef void (APIENTRYP pfn_glPointSize) (GLfloat); -extern pfn_glPointSize fp_glPointSize; -typedef void (APIENTRYP pfn_glPolygonMode) (GLenum, GLenum); -extern pfn_glPolygonMode fp_glPolygonMode; -typedef void (APIENTRYP pfn_glScissor) (GLint, GLint, GLsizei, GLsizei); -extern pfn_glScissor fp_glScissor; -typedef void (APIENTRYP pfn_glTexParameterf) (GLenum, GLenum, GLfloat); -extern pfn_glTexParameterf fp_glTexParameterf; -typedef void (APIENTRYP pfn_glTexParameterfv) (GLenum, GLenum, const GLfloat*); -extern pfn_glTexParameterfv fp_glTexParameterfv; -typedef void (APIENTRYP pfn_glTexParameteri) (GLenum, GLenum, GLint); -extern pfn_glTexParameteri fp_glTexParameteri; -typedef void (APIENTRYP pfn_glTexParameteriv) (GLenum, GLenum, const GLint*); -extern pfn_glTexParameteriv fp_glTexParameteriv; -typedef void (APIENTRYP pfn_glTexImage1D) (GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const void*); -extern pfn_glTexImage1D fp_glTexImage1D; -typedef void (APIENTRYP pfn_glTexImage2D) (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void*); -extern pfn_glTexImage2D fp_glTexImage2D; -typedef void (APIENTRYP pfn_glDrawBuffer) (GLenum); -extern pfn_glDrawBuffer fp_glDrawBuffer; -typedef void (APIENTRYP pfn_glClear) (GLbitfield); -extern pfn_glClear fp_glClear; -typedef void (APIENTRYP pfn_glClearColor) (GLfloat, GLfloat, GLfloat, GLfloat); -extern pfn_glClearColor fp_glClearColor; -typedef void (APIENTRYP pfn_glClearStencil) (GLint); -extern pfn_glClearStencil fp_glClearStencil; -typedef void (APIENTRYP pfn_glClearDepth) (GLdouble); -extern pfn_glClearDepth fp_glClearDepth; -typedef void (APIENTRYP pfn_glStencilMask) (GLuint); -extern pfn_glStencilMask fp_glStencilMask; -typedef void (APIENTRYP pfn_glColorMask) (GLboolean, GLboolean, GLboolean, GLboolean); -extern pfn_glColorMask fp_glColorMask; -typedef void (APIENTRYP pfn_glDepthMask) (GLboolean); -extern pfn_glDepthMask fp_glDepthMask; -typedef void (APIENTRYP pfn_glDisable) (GLenum); -extern pfn_glDisable fp_glDisable; -typedef void (APIENTRYP pfn_glEnable) (GLenum); -extern pfn_glEnable fp_glEnable; -typedef void (APIENTRYP pfn_glFinish) (); -extern pfn_glFinish fp_glFinish; -typedef void (APIENTRYP pfn_glFlush) (); -extern pfn_glFlush fp_glFlush; -typedef void (APIENTRYP pfn_glBlendFunc) (GLenum, GLenum); -extern pfn_glBlendFunc fp_glBlendFunc; -typedef void (APIENTRYP pfn_glLogicOp) (GLenum); -extern pfn_glLogicOp fp_glLogicOp; -typedef void (APIENTRYP pfn_glStencilFunc) (GLenum, GLint, GLuint); -extern pfn_glStencilFunc fp_glStencilFunc; -typedef void (APIENTRYP pfn_glStencilOp) (GLenum, GLenum, GLenum); -extern pfn_glStencilOp fp_glStencilOp; -typedef void (APIENTRYP pfn_glDepthFunc) (GLenum); -extern pfn_glDepthFunc fp_glDepthFunc; -typedef void (APIENTRYP pfn_glPixelStoref) (GLenum, GLfloat); -extern pfn_glPixelStoref fp_glPixelStoref; -typedef void (APIENTRYP pfn_glPixelStorei) (GLenum, GLint); -extern pfn_glPixelStorei fp_glPixelStorei; -typedef void (APIENTRYP pfn_glReadBuffer) (GLenum); -extern pfn_glReadBuffer fp_glReadBuffer; -typedef void (APIENTRYP pfn_glReadPixels) (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, void*); -extern pfn_glReadPixels fp_glReadPixels; -typedef void (APIENTRYP pfn_glGetBooleanv) (GLenum, GLboolean*); -extern pfn_glGetBooleanv fp_glGetBooleanv; -typedef void (APIENTRYP pfn_glGetDoublev) (GLenum, GLdouble*); -extern pfn_glGetDoublev fp_glGetDoublev; -typedef GLenum (APIENTRYP pfn_glGetError) (); -extern pfn_glGetError fp_glGetError; -typedef void (APIENTRYP pfn_glGetFloatv) (GLenum, GLfloat*); -extern pfn_glGetFloatv fp_glGetFloatv; -typedef void (APIENTRYP pfn_glGetIntegerv) (GLenum, GLint*); -extern pfn_glGetIntegerv fp_glGetIntegerv; -typedef const GLubyte* (APIENTRYP pfn_glGetString) (GLenum); -extern pfn_glGetString fp_glGetString; -typedef void (APIENTRYP pfn_glGetTexImage) (GLenum, GLint, GLenum, GLenum, void*); -extern pfn_glGetTexImage fp_glGetTexImage; -typedef void (APIENTRYP pfn_glGetTexParameterfv) (GLenum, GLenum, GLfloat*); -extern pfn_glGetTexParameterfv fp_glGetTexParameterfv; -typedef void (APIENTRYP pfn_glGetTexParameteriv) (GLenum, GLenum, GLint*); -extern pfn_glGetTexParameteriv fp_glGetTexParameteriv; -typedef void (APIENTRYP pfn_glGetTexLevelParameterfv) (GLenum, GLint, GLenum, GLfloat*); -extern pfn_glGetTexLevelParameterfv fp_glGetTexLevelParameterfv; -typedef void (APIENTRYP pfn_glGetTexLevelParameteriv) (GLenum, GLint, GLenum, GLint*); -extern pfn_glGetTexLevelParameteriv fp_glGetTexLevelParameteriv; -typedef GLboolean (APIENTRYP pfn_glIsEnabled) (GLenum); -extern pfn_glIsEnabled fp_glIsEnabled; -typedef void (APIENTRYP pfn_glDepthRange) (GLdouble, GLdouble); -extern pfn_glDepthRange fp_glDepthRange; -typedef void (APIENTRYP pfn_glViewport) (GLint, GLint, GLsizei, GLsizei); -extern pfn_glViewport fp_glViewport; -typedef void (APIENTRYP pfn_glNewList) (GLuint, GLenum); -extern pfn_glNewList fp_glNewList; -typedef void (APIENTRYP pfn_glEndList) (); -extern pfn_glEndList fp_glEndList; -typedef void (APIENTRYP pfn_glCallList) (GLuint); -extern pfn_glCallList fp_glCallList; -typedef void (APIENTRYP pfn_glCallLists) (GLsizei, GLenum, const void*); -extern pfn_glCallLists fp_glCallLists; -typedef void (APIENTRYP pfn_glDeleteLists) (GLuint, GLsizei); -extern pfn_glDeleteLists fp_glDeleteLists; -typedef GLuint (APIENTRYP pfn_glGenLists) (GLsizei); -extern pfn_glGenLists fp_glGenLists; -typedef void (APIENTRYP pfn_glListBase) (GLuint); -extern pfn_glListBase fp_glListBase; -typedef void (APIENTRYP pfn_glBegin) (GLenum); -extern pfn_glBegin fp_glBegin; -typedef void (APIENTRYP pfn_glBitmap) (GLsizei, GLsizei, GLfloat, GLfloat, GLfloat, GLfloat, const GLubyte*); -extern pfn_glBitmap fp_glBitmap; -typedef void (APIENTRYP pfn_glColor3b) (GLbyte, GLbyte, GLbyte); -extern pfn_glColor3b fp_glColor3b; -typedef void (APIENTRYP pfn_glColor3bv) (const GLbyte*); -extern pfn_glColor3bv fp_glColor3bv; -typedef void (APIENTRYP pfn_glColor3d) (GLdouble, GLdouble, GLdouble); -extern pfn_glColor3d fp_glColor3d; -typedef void (APIENTRYP pfn_glColor3dv) (const GLdouble*); -extern pfn_glColor3dv fp_glColor3dv; -typedef void (APIENTRYP pfn_glColor3f) (GLfloat, GLfloat, GLfloat); -extern pfn_glColor3f fp_glColor3f; -typedef void (APIENTRYP pfn_glColor3fv) (const GLfloat*); -extern pfn_glColor3fv fp_glColor3fv; -typedef void (APIENTRYP pfn_glColor3i) (GLint, GLint, GLint); -extern pfn_glColor3i fp_glColor3i; -typedef void (APIENTRYP pfn_glColor3iv) (const GLint*); -extern pfn_glColor3iv fp_glColor3iv; -typedef void (APIENTRYP pfn_glColor3s) (GLshort, GLshort, GLshort); -extern pfn_glColor3s fp_glColor3s; -typedef void (APIENTRYP pfn_glColor3sv) (const GLshort*); -extern pfn_glColor3sv fp_glColor3sv; -typedef void (APIENTRYP pfn_glColor3ub) (GLubyte, GLubyte, GLubyte); -extern pfn_glColor3ub fp_glColor3ub; -typedef void (APIENTRYP pfn_glColor3ubv) (const GLubyte*); -extern pfn_glColor3ubv fp_glColor3ubv; -typedef void (APIENTRYP pfn_glColor3ui) (GLuint, GLuint, GLuint); -extern pfn_glColor3ui fp_glColor3ui; -typedef void (APIENTRYP pfn_glColor3uiv) (const GLuint*); -extern pfn_glColor3uiv fp_glColor3uiv; -typedef void (APIENTRYP pfn_glColor3us) (GLushort, GLushort, GLushort); -extern pfn_glColor3us fp_glColor3us; -typedef void (APIENTRYP pfn_glColor3usv) (const GLushort*); -extern pfn_glColor3usv fp_glColor3usv; -typedef void (APIENTRYP pfn_glColor4b) (GLbyte, GLbyte, GLbyte, GLbyte); -extern pfn_glColor4b fp_glColor4b; -typedef void (APIENTRYP pfn_glColor4bv) (const GLbyte*); -extern pfn_glColor4bv fp_glColor4bv; -typedef void (APIENTRYP pfn_glColor4d) (GLdouble, GLdouble, GLdouble, GLdouble); -extern pfn_glColor4d fp_glColor4d; -typedef void (APIENTRYP pfn_glColor4dv) (const GLdouble*); -extern pfn_glColor4dv fp_glColor4dv; -typedef void (APIENTRYP pfn_glColor4f) (GLfloat, GLfloat, GLfloat, GLfloat); -extern pfn_glColor4f fp_glColor4f; -typedef void (APIENTRYP pfn_glColor4fv) (const GLfloat*); -extern pfn_glColor4fv fp_glColor4fv; -typedef void (APIENTRYP pfn_glColor4i) (GLint, GLint, GLint, GLint); -extern pfn_glColor4i fp_glColor4i; -typedef void (APIENTRYP pfn_glColor4iv) (const GLint*); -extern pfn_glColor4iv fp_glColor4iv; -typedef void (APIENTRYP pfn_glColor4s) (GLshort, GLshort, GLshort, GLshort); -extern pfn_glColor4s fp_glColor4s; -typedef void (APIENTRYP pfn_glColor4sv) (const GLshort*); -extern pfn_glColor4sv fp_glColor4sv; -typedef void (APIENTRYP pfn_glColor4ub) (GLubyte, GLubyte, GLubyte, GLubyte); -extern pfn_glColor4ub fp_glColor4ub; -typedef void (APIENTRYP pfn_glColor4ubv) (const GLubyte*); -extern pfn_glColor4ubv fp_glColor4ubv; -typedef void (APIENTRYP pfn_glColor4ui) (GLuint, GLuint, GLuint, GLuint); -extern pfn_glColor4ui fp_glColor4ui; -typedef void (APIENTRYP pfn_glColor4uiv) (const GLuint*); -extern pfn_glColor4uiv fp_glColor4uiv; -typedef void (APIENTRYP pfn_glColor4us) (GLushort, GLushort, GLushort, GLushort); -extern pfn_glColor4us fp_glColor4us; -typedef void (APIENTRYP pfn_glColor4usv) (const GLushort*); -extern pfn_glColor4usv fp_glColor4usv; -typedef void (APIENTRYP pfn_glEdgeFlag) (GLboolean); -extern pfn_glEdgeFlag fp_glEdgeFlag; -typedef void (APIENTRYP pfn_glEdgeFlagv) (const GLboolean*); -extern pfn_glEdgeFlagv fp_glEdgeFlagv; -typedef void (APIENTRYP pfn_glEnd) (); -extern pfn_glEnd fp_glEnd; -typedef void (APIENTRYP pfn_glIndexd) (GLdouble); -extern pfn_glIndexd fp_glIndexd; -typedef void (APIENTRYP pfn_glIndexdv) (const GLdouble*); -extern pfn_glIndexdv fp_glIndexdv; -typedef void (APIENTRYP pfn_glIndexf) (GLfloat); -extern pfn_glIndexf fp_glIndexf; -typedef void (APIENTRYP pfn_glIndexfv) (const GLfloat*); -extern pfn_glIndexfv fp_glIndexfv; -typedef void (APIENTRYP pfn_glIndexi) (GLint); -extern pfn_glIndexi fp_glIndexi; -typedef void (APIENTRYP pfn_glIndexiv) (const GLint*); -extern pfn_glIndexiv fp_glIndexiv; -typedef void (APIENTRYP pfn_glIndexs) (GLshort); -extern pfn_glIndexs fp_glIndexs; -typedef void (APIENTRYP pfn_glIndexsv) (const GLshort*); -extern pfn_glIndexsv fp_glIndexsv; -typedef void (APIENTRYP pfn_glNormal3b) (GLbyte, GLbyte, GLbyte); -extern pfn_glNormal3b fp_glNormal3b; -typedef void (APIENTRYP pfn_glNormal3bv) (const GLbyte*); -extern pfn_glNormal3bv fp_glNormal3bv; -typedef void (APIENTRYP pfn_glNormal3d) (GLdouble, GLdouble, GLdouble); -extern pfn_glNormal3d fp_glNormal3d; -typedef void (APIENTRYP pfn_glNormal3dv) (const GLdouble*); -extern pfn_glNormal3dv fp_glNormal3dv; -typedef void (APIENTRYP pfn_glNormal3f) (GLfloat, GLfloat, GLfloat); -extern pfn_glNormal3f fp_glNormal3f; -typedef void (APIENTRYP pfn_glNormal3fv) (const GLfloat*); -extern pfn_glNormal3fv fp_glNormal3fv; -typedef void (APIENTRYP pfn_glNormal3i) (GLint, GLint, GLint); -extern pfn_glNormal3i fp_glNormal3i; -typedef void (APIENTRYP pfn_glNormal3iv) (const GLint*); -extern pfn_glNormal3iv fp_glNormal3iv; -typedef void (APIENTRYP pfn_glNormal3s) (GLshort, GLshort, GLshort); -extern pfn_glNormal3s fp_glNormal3s; -typedef void (APIENTRYP pfn_glNormal3sv) (const GLshort*); -extern pfn_glNormal3sv fp_glNormal3sv; -typedef void (APIENTRYP pfn_glRasterPos2d) (GLdouble, GLdouble); -extern pfn_glRasterPos2d fp_glRasterPos2d; -typedef void (APIENTRYP pfn_glRasterPos2dv) (const GLdouble*); -extern pfn_glRasterPos2dv fp_glRasterPos2dv; -typedef void (APIENTRYP pfn_glRasterPos2f) (GLfloat, GLfloat); -extern pfn_glRasterPos2f fp_glRasterPos2f; -typedef void (APIENTRYP pfn_glRasterPos2fv) (const GLfloat*); -extern pfn_glRasterPos2fv fp_glRasterPos2fv; -typedef void (APIENTRYP pfn_glRasterPos2i) (GLint, GLint); -extern pfn_glRasterPos2i fp_glRasterPos2i; -typedef void (APIENTRYP pfn_glRasterPos2iv) (const GLint*); -extern pfn_glRasterPos2iv fp_glRasterPos2iv; -typedef void (APIENTRYP pfn_glRasterPos2s) (GLshort, GLshort); -extern pfn_glRasterPos2s fp_glRasterPos2s; -typedef void (APIENTRYP pfn_glRasterPos2sv) (const GLshort*); -extern pfn_glRasterPos2sv fp_glRasterPos2sv; -typedef void (APIENTRYP pfn_glRasterPos3d) (GLdouble, GLdouble, GLdouble); -extern pfn_glRasterPos3d fp_glRasterPos3d; -typedef void (APIENTRYP pfn_glRasterPos3dv) (const GLdouble*); -extern pfn_glRasterPos3dv fp_glRasterPos3dv; -typedef void (APIENTRYP pfn_glRasterPos3f) (GLfloat, GLfloat, GLfloat); -extern pfn_glRasterPos3f fp_glRasterPos3f; -typedef void (APIENTRYP pfn_glRasterPos3fv) (const GLfloat*); -extern pfn_glRasterPos3fv fp_glRasterPos3fv; -typedef void (APIENTRYP pfn_glRasterPos3i) (GLint, GLint, GLint); -extern pfn_glRasterPos3i fp_glRasterPos3i; -typedef void (APIENTRYP pfn_glRasterPos3iv) (const GLint*); -extern pfn_glRasterPos3iv fp_glRasterPos3iv; -typedef void (APIENTRYP pfn_glRasterPos3s) (GLshort, GLshort, GLshort); -extern pfn_glRasterPos3s fp_glRasterPos3s; -typedef void (APIENTRYP pfn_glRasterPos3sv) (const GLshort*); -extern pfn_glRasterPos3sv fp_glRasterPos3sv; -typedef void (APIENTRYP pfn_glRasterPos4d) (GLdouble, GLdouble, GLdouble, GLdouble); -extern pfn_glRasterPos4d fp_glRasterPos4d; -typedef void (APIENTRYP pfn_glRasterPos4dv) (const GLdouble*); -extern pfn_glRasterPos4dv fp_glRasterPos4dv; -typedef void (APIENTRYP pfn_glRasterPos4f) (GLfloat, GLfloat, GLfloat, GLfloat); -extern pfn_glRasterPos4f fp_glRasterPos4f; -typedef void (APIENTRYP pfn_glRasterPos4fv) (const GLfloat*); -extern pfn_glRasterPos4fv fp_glRasterPos4fv; -typedef void (APIENTRYP pfn_glRasterPos4i) (GLint, GLint, GLint, GLint); -extern pfn_glRasterPos4i fp_glRasterPos4i; -typedef void (APIENTRYP pfn_glRasterPos4iv) (const GLint*); -extern pfn_glRasterPos4iv fp_glRasterPos4iv; -typedef void (APIENTRYP pfn_glRasterPos4s) (GLshort, GLshort, GLshort, GLshort); -extern pfn_glRasterPos4s fp_glRasterPos4s; -typedef void (APIENTRYP pfn_glRasterPos4sv) (const GLshort*); -extern pfn_glRasterPos4sv fp_glRasterPos4sv; -typedef void (APIENTRYP pfn_glRectd) (GLdouble, GLdouble, GLdouble, GLdouble); -extern pfn_glRectd fp_glRectd; -typedef void (APIENTRYP pfn_glRectdv) (const GLdouble*, const GLdouble*); -extern pfn_glRectdv fp_glRectdv; -typedef void (APIENTRYP pfn_glRectf) (GLfloat, GLfloat, GLfloat, GLfloat); -extern pfn_glRectf fp_glRectf; -typedef void (APIENTRYP pfn_glRectfv) (const GLfloat*, const GLfloat*); -extern pfn_glRectfv fp_glRectfv; -typedef void (APIENTRYP pfn_glRecti) (GLint, GLint, GLint, GLint); -extern pfn_glRecti fp_glRecti; -typedef void (APIENTRYP pfn_glRectiv) (const GLint*, const GLint*); -extern pfn_glRectiv fp_glRectiv; -typedef void (APIENTRYP pfn_glRects) (GLshort, GLshort, GLshort, GLshort); -extern pfn_glRects fp_glRects; -typedef void (APIENTRYP pfn_glRectsv) (const GLshort*, const GLshort*); -extern pfn_glRectsv fp_glRectsv; -typedef void (APIENTRYP pfn_glTexCoord1d) (GLdouble); -extern pfn_glTexCoord1d fp_glTexCoord1d; -typedef void (APIENTRYP pfn_glTexCoord1dv) (const GLdouble*); -extern pfn_glTexCoord1dv fp_glTexCoord1dv; -typedef void (APIENTRYP pfn_glTexCoord1f) (GLfloat); -extern pfn_glTexCoord1f fp_glTexCoord1f; -typedef void (APIENTRYP pfn_glTexCoord1fv) (const GLfloat*); -extern pfn_glTexCoord1fv fp_glTexCoord1fv; -typedef void (APIENTRYP pfn_glTexCoord1i) (GLint); -extern pfn_glTexCoord1i fp_glTexCoord1i; -typedef void (APIENTRYP pfn_glTexCoord1iv) (const GLint*); -extern pfn_glTexCoord1iv fp_glTexCoord1iv; -typedef void (APIENTRYP pfn_glTexCoord1s) (GLshort); -extern pfn_glTexCoord1s fp_glTexCoord1s; -typedef void (APIENTRYP pfn_glTexCoord1sv) (const GLshort*); -extern pfn_glTexCoord1sv fp_glTexCoord1sv; -typedef void (APIENTRYP pfn_glTexCoord2d) (GLdouble, GLdouble); -extern pfn_glTexCoord2d fp_glTexCoord2d; -typedef void (APIENTRYP pfn_glTexCoord2dv) (const GLdouble*); -extern pfn_glTexCoord2dv fp_glTexCoord2dv; -typedef void (APIENTRYP pfn_glTexCoord2f) (GLfloat, GLfloat); -extern pfn_glTexCoord2f fp_glTexCoord2f; -typedef void (APIENTRYP pfn_glTexCoord2fv) (const GLfloat*); -extern pfn_glTexCoord2fv fp_glTexCoord2fv; -typedef void (APIENTRYP pfn_glTexCoord2i) (GLint, GLint); -extern pfn_glTexCoord2i fp_glTexCoord2i; -typedef void (APIENTRYP pfn_glTexCoord2iv) (const GLint*); -extern pfn_glTexCoord2iv fp_glTexCoord2iv; -typedef void (APIENTRYP pfn_glTexCoord2s) (GLshort, GLshort); -extern pfn_glTexCoord2s fp_glTexCoord2s; -typedef void (APIENTRYP pfn_glTexCoord2sv) (const GLshort*); -extern pfn_glTexCoord2sv fp_glTexCoord2sv; -typedef void (APIENTRYP pfn_glTexCoord3d) (GLdouble, GLdouble, GLdouble); -extern pfn_glTexCoord3d fp_glTexCoord3d; -typedef void (APIENTRYP pfn_glTexCoord3dv) (const GLdouble*); -extern pfn_glTexCoord3dv fp_glTexCoord3dv; -typedef void (APIENTRYP pfn_glTexCoord3f) (GLfloat, GLfloat, GLfloat); -extern pfn_glTexCoord3f fp_glTexCoord3f; -typedef void (APIENTRYP pfn_glTexCoord3fv) (const GLfloat*); -extern pfn_glTexCoord3fv fp_glTexCoord3fv; -typedef void (APIENTRYP pfn_glTexCoord3i) (GLint, GLint, GLint); -extern pfn_glTexCoord3i fp_glTexCoord3i; -typedef void (APIENTRYP pfn_glTexCoord3iv) (const GLint*); -extern pfn_glTexCoord3iv fp_glTexCoord3iv; -typedef void (APIENTRYP pfn_glTexCoord3s) (GLshort, GLshort, GLshort); -extern pfn_glTexCoord3s fp_glTexCoord3s; -typedef void (APIENTRYP pfn_glTexCoord3sv) (const GLshort*); -extern pfn_glTexCoord3sv fp_glTexCoord3sv; -typedef void (APIENTRYP pfn_glTexCoord4d) (GLdouble, GLdouble, GLdouble, GLdouble); -extern pfn_glTexCoord4d fp_glTexCoord4d; -typedef void (APIENTRYP pfn_glTexCoord4dv) (const GLdouble*); -extern pfn_glTexCoord4dv fp_glTexCoord4dv; -typedef void (APIENTRYP pfn_glTexCoord4f) (GLfloat, GLfloat, GLfloat, GLfloat); -extern pfn_glTexCoord4f fp_glTexCoord4f; -typedef void (APIENTRYP pfn_glTexCoord4fv) (const GLfloat*); -extern pfn_glTexCoord4fv fp_glTexCoord4fv; -typedef void (APIENTRYP pfn_glTexCoord4i) (GLint, GLint, GLint, GLint); -extern pfn_glTexCoord4i fp_glTexCoord4i; -typedef void (APIENTRYP pfn_glTexCoord4iv) (const GLint*); -extern pfn_glTexCoord4iv fp_glTexCoord4iv; -typedef void (APIENTRYP pfn_glTexCoord4s) (GLshort, GLshort, GLshort, GLshort); -extern pfn_glTexCoord4s fp_glTexCoord4s; -typedef void (APIENTRYP pfn_glTexCoord4sv) (const GLshort*); -extern pfn_glTexCoord4sv fp_glTexCoord4sv; -typedef void (APIENTRYP pfn_glVertex2d) (GLdouble, GLdouble); -extern pfn_glVertex2d fp_glVertex2d; -typedef void (APIENTRYP pfn_glVertex2dv) (const GLdouble*); -extern pfn_glVertex2dv fp_glVertex2dv; -typedef void (APIENTRYP pfn_glVertex2f) (GLfloat, GLfloat); -extern pfn_glVertex2f fp_glVertex2f; -typedef void (APIENTRYP pfn_glVertex2fv) (const GLfloat*); -extern pfn_glVertex2fv fp_glVertex2fv; -typedef void (APIENTRYP pfn_glVertex2i) (GLint, GLint); -extern pfn_glVertex2i fp_glVertex2i; -typedef void (APIENTRYP pfn_glVertex2iv) (const GLint*); -extern pfn_glVertex2iv fp_glVertex2iv; -typedef void (APIENTRYP pfn_glVertex2s) (GLshort, GLshort); -extern pfn_glVertex2s fp_glVertex2s; -typedef void (APIENTRYP pfn_glVertex2sv) (const GLshort*); -extern pfn_glVertex2sv fp_glVertex2sv; -typedef void (APIENTRYP pfn_glVertex3d) (GLdouble, GLdouble, GLdouble); -extern pfn_glVertex3d fp_glVertex3d; -typedef void (APIENTRYP pfn_glVertex3dv) (const GLdouble*); -extern pfn_glVertex3dv fp_glVertex3dv; -typedef void (APIENTRYP pfn_glVertex3f) (GLfloat, GLfloat, GLfloat); -extern pfn_glVertex3f fp_glVertex3f; -typedef void (APIENTRYP pfn_glVertex3fv) (const GLfloat*); -extern pfn_glVertex3fv fp_glVertex3fv; -typedef void (APIENTRYP pfn_glVertex3i) (GLint, GLint, GLint); -extern pfn_glVertex3i fp_glVertex3i; -typedef void (APIENTRYP pfn_glVertex3iv) (const GLint*); -extern pfn_glVertex3iv fp_glVertex3iv; -typedef void (APIENTRYP pfn_glVertex3s) (GLshort, GLshort, GLshort); -extern pfn_glVertex3s fp_glVertex3s; -typedef void (APIENTRYP pfn_glVertex3sv) (const GLshort*); -extern pfn_glVertex3sv fp_glVertex3sv; -typedef void (APIENTRYP pfn_glVertex4d) (GLdouble, GLdouble, GLdouble, GLdouble); -extern pfn_glVertex4d fp_glVertex4d; -typedef void (APIENTRYP pfn_glVertex4dv) (const GLdouble*); -extern pfn_glVertex4dv fp_glVertex4dv; -typedef void (APIENTRYP pfn_glVertex4f) (GLfloat, GLfloat, GLfloat, GLfloat); -extern pfn_glVertex4f fp_glVertex4f; -typedef void (APIENTRYP pfn_glVertex4fv) (const GLfloat*); -extern pfn_glVertex4fv fp_glVertex4fv; -typedef void (APIENTRYP pfn_glVertex4i) (GLint, GLint, GLint, GLint); -extern pfn_glVertex4i fp_glVertex4i; -typedef void (APIENTRYP pfn_glVertex4iv) (const GLint*); -extern pfn_glVertex4iv fp_glVertex4iv; -typedef void (APIENTRYP pfn_glVertex4s) (GLshort, GLshort, GLshort, GLshort); -extern pfn_glVertex4s fp_glVertex4s; -typedef void (APIENTRYP pfn_glVertex4sv) (const GLshort*); -extern pfn_glVertex4sv fp_glVertex4sv; -typedef void (APIENTRYP pfn_glClipPlane) (GLenum, const GLdouble*); -extern pfn_glClipPlane fp_glClipPlane; -typedef void (APIENTRYP pfn_glColorMaterial) (GLenum, GLenum); -extern pfn_glColorMaterial fp_glColorMaterial; -typedef void (APIENTRYP pfn_glFogf) (GLenum, GLfloat); -extern pfn_glFogf fp_glFogf; -typedef void (APIENTRYP pfn_glFogfv) (GLenum, const GLfloat*); -extern pfn_glFogfv fp_glFogfv; -typedef void (APIENTRYP pfn_glFogi) (GLenum, GLint); -extern pfn_glFogi fp_glFogi; -typedef void (APIENTRYP pfn_glFogiv) (GLenum, const GLint*); -extern pfn_glFogiv fp_glFogiv; -typedef void (APIENTRYP pfn_glLightf) (GLenum, GLenum, GLfloat); -extern pfn_glLightf fp_glLightf; -typedef void (APIENTRYP pfn_glLightfv) (GLenum, GLenum, const GLfloat*); -extern pfn_glLightfv fp_glLightfv; -typedef void (APIENTRYP pfn_glLighti) (GLenum, GLenum, GLint); -extern pfn_glLighti fp_glLighti; -typedef void (APIENTRYP pfn_glLightiv) (GLenum, GLenum, const GLint*); -extern pfn_glLightiv fp_glLightiv; -typedef void (APIENTRYP pfn_glLightModelf) (GLenum, GLfloat); -extern pfn_glLightModelf fp_glLightModelf; -typedef void (APIENTRYP pfn_glLightModelfv) (GLenum, const GLfloat*); -extern pfn_glLightModelfv fp_glLightModelfv; -typedef void (APIENTRYP pfn_glLightModeli) (GLenum, GLint); -extern pfn_glLightModeli fp_glLightModeli; -typedef void (APIENTRYP pfn_glLightModeliv) (GLenum, const GLint*); -extern pfn_glLightModeliv fp_glLightModeliv; -typedef void (APIENTRYP pfn_glLineStipple) (GLint, GLushort); -extern pfn_glLineStipple fp_glLineStipple; -typedef void (APIENTRYP pfn_glMaterialf) (GLenum, GLenum, GLfloat); -extern pfn_glMaterialf fp_glMaterialf; -typedef void (APIENTRYP pfn_glMaterialfv) (GLenum, GLenum, const GLfloat*); -extern pfn_glMaterialfv fp_glMaterialfv; -typedef void (APIENTRYP pfn_glMateriali) (GLenum, GLenum, GLint); -extern pfn_glMateriali fp_glMateriali; -typedef void (APIENTRYP pfn_glMaterialiv) (GLenum, GLenum, const GLint*); -extern pfn_glMaterialiv fp_glMaterialiv; -typedef void (APIENTRYP pfn_glPolygonStipple) (const GLubyte*); -extern pfn_glPolygonStipple fp_glPolygonStipple; -typedef void (APIENTRYP pfn_glShadeModel) (GLenum); -extern pfn_glShadeModel fp_glShadeModel; -typedef void (APIENTRYP pfn_glTexEnvf) (GLenum, GLenum, GLfloat); -extern pfn_glTexEnvf fp_glTexEnvf; -typedef void (APIENTRYP pfn_glTexEnvfv) (GLenum, GLenum, const GLfloat*); -extern pfn_glTexEnvfv fp_glTexEnvfv; -typedef void (APIENTRYP pfn_glTexEnvi) (GLenum, GLenum, GLint); -extern pfn_glTexEnvi fp_glTexEnvi; -typedef void (APIENTRYP pfn_glTexEnviv) (GLenum, GLenum, const GLint*); -extern pfn_glTexEnviv fp_glTexEnviv; -typedef void (APIENTRYP pfn_glTexGend) (GLenum, GLenum, GLdouble); -extern pfn_glTexGend fp_glTexGend; -typedef void (APIENTRYP pfn_glTexGendv) (GLenum, GLenum, const GLdouble*); -extern pfn_glTexGendv fp_glTexGendv; -typedef void (APIENTRYP pfn_glTexGenf) (GLenum, GLenum, GLfloat); -extern pfn_glTexGenf fp_glTexGenf; -typedef void (APIENTRYP pfn_glTexGenfv) (GLenum, GLenum, const GLfloat*); -extern pfn_glTexGenfv fp_glTexGenfv; -typedef void (APIENTRYP pfn_glTexGeni) (GLenum, GLenum, GLint); -extern pfn_glTexGeni fp_glTexGeni; -typedef void (APIENTRYP pfn_glTexGeniv) (GLenum, GLenum, const GLint*); -extern pfn_glTexGeniv fp_glTexGeniv; -typedef void (APIENTRYP pfn_glFeedbackBuffer) (GLsizei, GLenum, GLfloat*); -extern pfn_glFeedbackBuffer fp_glFeedbackBuffer; -typedef void (APIENTRYP pfn_glSelectBuffer) (GLsizei, GLuint*); -extern pfn_glSelectBuffer fp_glSelectBuffer; -typedef GLint (APIENTRYP pfn_glRenderMode) (GLenum); -extern pfn_glRenderMode fp_glRenderMode; -typedef void (APIENTRYP pfn_glInitNames) (); -extern pfn_glInitNames fp_glInitNames; -typedef void (APIENTRYP pfn_glLoadName) (GLuint); -extern pfn_glLoadName fp_glLoadName; -typedef void (APIENTRYP pfn_glPassThrough) (GLfloat); -extern pfn_glPassThrough fp_glPassThrough; -typedef void (APIENTRYP pfn_glPopName) (); -extern pfn_glPopName fp_glPopName; -typedef void (APIENTRYP pfn_glPushName) (GLuint); -extern pfn_glPushName fp_glPushName; -typedef void (APIENTRYP pfn_glClearAccum) (GLfloat, GLfloat, GLfloat, GLfloat); -extern pfn_glClearAccum fp_glClearAccum; -typedef void (APIENTRYP pfn_glClearIndex) (GLfloat); -extern pfn_glClearIndex fp_glClearIndex; -typedef void (APIENTRYP pfn_glIndexMask) (GLuint); -extern pfn_glIndexMask fp_glIndexMask; -typedef void (APIENTRYP pfn_glAccum) (GLenum, GLfloat); -extern pfn_glAccum fp_glAccum; -typedef void (APIENTRYP pfn_glPopAttrib) (); -extern pfn_glPopAttrib fp_glPopAttrib; -typedef void (APIENTRYP pfn_glPushAttrib) (GLbitfield); -extern pfn_glPushAttrib fp_glPushAttrib; -typedef void (APIENTRYP pfn_glMap1d) (GLenum, GLdouble, GLdouble, GLint, GLint, const GLdouble*); -extern pfn_glMap1d fp_glMap1d; -typedef void (APIENTRYP pfn_glMap1f) (GLenum, GLfloat, GLfloat, GLint, GLint, const GLfloat*); -extern pfn_glMap1f fp_glMap1f; -typedef void (APIENTRYP pfn_glMap2d) (GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble*); -extern pfn_glMap2d fp_glMap2d; -typedef void (APIENTRYP pfn_glMap2f) (GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat*); -extern pfn_glMap2f fp_glMap2f; -typedef void (APIENTRYP pfn_glMapGrid1d) (GLint, GLdouble, GLdouble); -extern pfn_glMapGrid1d fp_glMapGrid1d; -typedef void (APIENTRYP pfn_glMapGrid1f) (GLint, GLfloat, GLfloat); -extern pfn_glMapGrid1f fp_glMapGrid1f; -typedef void (APIENTRYP pfn_glMapGrid2d) (GLint, GLdouble, GLdouble, GLint, GLdouble, GLdouble); -extern pfn_glMapGrid2d fp_glMapGrid2d; -typedef void (APIENTRYP pfn_glMapGrid2f) (GLint, GLfloat, GLfloat, GLint, GLfloat, GLfloat); -extern pfn_glMapGrid2f fp_glMapGrid2f; -typedef void (APIENTRYP pfn_glEvalCoord1d) (GLdouble); -extern pfn_glEvalCoord1d fp_glEvalCoord1d; -typedef void (APIENTRYP pfn_glEvalCoord1dv) (const GLdouble*); -extern pfn_glEvalCoord1dv fp_glEvalCoord1dv; -typedef void (APIENTRYP pfn_glEvalCoord1f) (GLfloat); -extern pfn_glEvalCoord1f fp_glEvalCoord1f; -typedef void (APIENTRYP pfn_glEvalCoord1fv) (const GLfloat*); -extern pfn_glEvalCoord1fv fp_glEvalCoord1fv; -typedef void (APIENTRYP pfn_glEvalCoord2d) (GLdouble, GLdouble); -extern pfn_glEvalCoord2d fp_glEvalCoord2d; -typedef void (APIENTRYP pfn_glEvalCoord2dv) (const GLdouble*); -extern pfn_glEvalCoord2dv fp_glEvalCoord2dv; -typedef void (APIENTRYP pfn_glEvalCoord2f) (GLfloat, GLfloat); -extern pfn_glEvalCoord2f fp_glEvalCoord2f; -typedef void (APIENTRYP pfn_glEvalCoord2fv) (const GLfloat*); -extern pfn_glEvalCoord2fv fp_glEvalCoord2fv; -typedef void (APIENTRYP pfn_glEvalMesh1) (GLenum, GLint, GLint); -extern pfn_glEvalMesh1 fp_glEvalMesh1; -typedef void (APIENTRYP pfn_glEvalPoint1) (GLint); -extern pfn_glEvalPoint1 fp_glEvalPoint1; -typedef void (APIENTRYP pfn_glEvalMesh2) (GLenum, GLint, GLint, GLint, GLint); -extern pfn_glEvalMesh2 fp_glEvalMesh2; -typedef void (APIENTRYP pfn_glEvalPoint2) (GLint, GLint); -extern pfn_glEvalPoint2 fp_glEvalPoint2; -typedef void (APIENTRYP pfn_glAlphaFunc) (GLenum, GLfloat); -extern pfn_glAlphaFunc fp_glAlphaFunc; -typedef void (APIENTRYP pfn_glPixelZoom) (GLfloat, GLfloat); -extern pfn_glPixelZoom fp_glPixelZoom; -typedef void (APIENTRYP pfn_glPixelTransferf) (GLenum, GLfloat); -extern pfn_glPixelTransferf fp_glPixelTransferf; -typedef void (APIENTRYP pfn_glPixelTransferi) (GLenum, GLint); -extern pfn_glPixelTransferi fp_glPixelTransferi; -typedef void (APIENTRYP pfn_glPixelMapfv) (GLenum, GLsizei, const GLfloat*); -extern pfn_glPixelMapfv fp_glPixelMapfv; -typedef void (APIENTRYP pfn_glPixelMapuiv) (GLenum, GLsizei, const GLuint*); -extern pfn_glPixelMapuiv fp_glPixelMapuiv; -typedef void (APIENTRYP pfn_glPixelMapusv) (GLenum, GLsizei, const GLushort*); -extern pfn_glPixelMapusv fp_glPixelMapusv; -typedef void (APIENTRYP pfn_glCopyPixels) (GLint, GLint, GLsizei, GLsizei, GLenum); -extern pfn_glCopyPixels fp_glCopyPixels; -typedef void (APIENTRYP pfn_glDrawPixels) (GLsizei, GLsizei, GLenum, GLenum, const void*); -extern pfn_glDrawPixels fp_glDrawPixels; -typedef void (APIENTRYP pfn_glGetClipPlane) (GLenum, GLdouble*); -extern pfn_glGetClipPlane fp_glGetClipPlane; -typedef void (APIENTRYP pfn_glGetLightfv) (GLenum, GLenum, GLfloat*); -extern pfn_glGetLightfv fp_glGetLightfv; -typedef void (APIENTRYP pfn_glGetLightiv) (GLenum, GLenum, GLint*); -extern pfn_glGetLightiv fp_glGetLightiv; -typedef void (APIENTRYP pfn_glGetMapdv) (GLenum, GLenum, GLdouble*); -extern pfn_glGetMapdv fp_glGetMapdv; -typedef void (APIENTRYP pfn_glGetMapfv) (GLenum, GLenum, GLfloat*); -extern pfn_glGetMapfv fp_glGetMapfv; -typedef void (APIENTRYP pfn_glGetMapiv) (GLenum, GLenum, GLint*); -extern pfn_glGetMapiv fp_glGetMapiv; -typedef void (APIENTRYP pfn_glGetMaterialfv) (GLenum, GLenum, GLfloat*); -extern pfn_glGetMaterialfv fp_glGetMaterialfv; -typedef void (APIENTRYP pfn_glGetMaterialiv) (GLenum, GLenum, GLint*); -extern pfn_glGetMaterialiv fp_glGetMaterialiv; -typedef void (APIENTRYP pfn_glGetPixelMapfv) (GLenum, GLfloat*); -extern pfn_glGetPixelMapfv fp_glGetPixelMapfv; -typedef void (APIENTRYP pfn_glGetPixelMapuiv) (GLenum, GLuint*); -extern pfn_glGetPixelMapuiv fp_glGetPixelMapuiv; -typedef void (APIENTRYP pfn_glGetPixelMapusv) (GLenum, GLushort*); -extern pfn_glGetPixelMapusv fp_glGetPixelMapusv; -typedef void (APIENTRYP pfn_glGetPolygonStipple) (GLubyte*); -extern pfn_glGetPolygonStipple fp_glGetPolygonStipple; -typedef void (APIENTRYP pfn_glGetTexEnvfv) (GLenum, GLenum, GLfloat*); -extern pfn_glGetTexEnvfv fp_glGetTexEnvfv; -typedef void (APIENTRYP pfn_glGetTexEnviv) (GLenum, GLenum, GLint*); -extern pfn_glGetTexEnviv fp_glGetTexEnviv; -typedef void (APIENTRYP pfn_glGetTexGendv) (GLenum, GLenum, GLdouble*); -extern pfn_glGetTexGendv fp_glGetTexGendv; -typedef void (APIENTRYP pfn_glGetTexGenfv) (GLenum, GLenum, GLfloat*); -extern pfn_glGetTexGenfv fp_glGetTexGenfv; -typedef void (APIENTRYP pfn_glGetTexGeniv) (GLenum, GLenum, GLint*); -extern pfn_glGetTexGeniv fp_glGetTexGeniv; -typedef GLboolean (APIENTRYP pfn_glIsList) (GLuint); -extern pfn_glIsList fp_glIsList; -typedef void (APIENTRYP pfn_glFrustum) (GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble); -extern pfn_glFrustum fp_glFrustum; -typedef void (APIENTRYP pfn_glLoadIdentity) (); -extern pfn_glLoadIdentity fp_glLoadIdentity; -typedef void (APIENTRYP pfn_glLoadMatrixf) (const GLfloat*); -extern pfn_glLoadMatrixf fp_glLoadMatrixf; -typedef void (APIENTRYP pfn_glLoadMatrixd) (const GLdouble*); -extern pfn_glLoadMatrixd fp_glLoadMatrixd; -typedef void (APIENTRYP pfn_glMatrixMode) (GLenum); -extern pfn_glMatrixMode fp_glMatrixMode; -typedef void (APIENTRYP pfn_glMultMatrixf) (const GLfloat*); -extern pfn_glMultMatrixf fp_glMultMatrixf; -typedef void (APIENTRYP pfn_glMultMatrixd) (const GLdouble*); -extern pfn_glMultMatrixd fp_glMultMatrixd; -typedef void (APIENTRYP pfn_glOrtho) (GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble); -extern pfn_glOrtho fp_glOrtho; -typedef void (APIENTRYP pfn_glPopMatrix) (); -extern pfn_glPopMatrix fp_glPopMatrix; -typedef void (APIENTRYP pfn_glPushMatrix) (); -extern pfn_glPushMatrix fp_glPushMatrix; -typedef void (APIENTRYP pfn_glRotated) (GLdouble, GLdouble, GLdouble, GLdouble); -extern pfn_glRotated fp_glRotated; -typedef void (APIENTRYP pfn_glRotatef) (GLfloat, GLfloat, GLfloat, GLfloat); -extern pfn_glRotatef fp_glRotatef; -typedef void (APIENTRYP pfn_glScaled) (GLdouble, GLdouble, GLdouble); -extern pfn_glScaled fp_glScaled; -typedef void (APIENTRYP pfn_glScalef) (GLfloat, GLfloat, GLfloat); -extern pfn_glScalef fp_glScalef; -typedef void (APIENTRYP pfn_glTranslated) (GLdouble, GLdouble, GLdouble); -extern pfn_glTranslated fp_glTranslated; -typedef void (APIENTRYP pfn_glTranslatef) (GLfloat, GLfloat, GLfloat); -extern pfn_glTranslatef fp_glTranslatef; - - /* GL_VERSION_1_1 */ -extern GLboolean GLAD_VERSION_1_1; -#define GL_DEPTH_BUFFER_BIT 0x00000100 -#define GL_STENCIL_BUFFER_BIT 0x00000400 -#define GL_COLOR_BUFFER_BIT 0x00004000 -#define GL_FALSE 0 -#define GL_TRUE 1 -#define GL_POINTS 0x0000 -#define GL_LINES 0x0001 -#define GL_LINE_LOOP 0x0002 -#define GL_LINE_STRIP 0x0003 -#define GL_TRIANGLES 0x0004 -#define GL_TRIANGLE_STRIP 0x0005 -#define GL_TRIANGLE_FAN 0x0006 -#define GL_QUADS 0x0007 -#define GL_NEVER 0x0200 -#define GL_LESS 0x0201 -#define GL_EQUAL 0x0202 -#define GL_LEQUAL 0x0203 -#define GL_GREATER 0x0204 -#define GL_NOTEQUAL 0x0205 -#define GL_GEQUAL 0x0206 -#define GL_ALWAYS 0x0207 -#define GL_ZERO 0 -#define GL_ONE 1 -#define GL_SRC_COLOR 0x0300 -#define GL_ONE_MINUS_SRC_COLOR 0x0301 -#define GL_SRC_ALPHA 0x0302 -#define GL_ONE_MINUS_SRC_ALPHA 0x0303 -#define GL_DST_ALPHA 0x0304 -#define GL_ONE_MINUS_DST_ALPHA 0x0305 -#define GL_DST_COLOR 0x0306 -#define GL_ONE_MINUS_DST_COLOR 0x0307 -#define GL_SRC_ALPHA_SATURATE 0x0308 -#define GL_NONE 0 -#define GL_FRONT_LEFT 0x0400 -#define GL_FRONT_RIGHT 0x0401 -#define GL_BACK_LEFT 0x0402 -#define GL_BACK_RIGHT 0x0403 -#define GL_FRONT 0x0404 -#define GL_BACK 0x0405 -#define GL_LEFT 0x0406 -#define GL_RIGHT 0x0407 -#define GL_FRONT_AND_BACK 0x0408 -#define GL_NO_ERROR 0 -#define GL_INVALID_ENUM 0x0500 -#define GL_INVALID_VALUE 0x0501 -#define GL_INVALID_OPERATION 0x0502 -#define GL_OUT_OF_MEMORY 0x0505 -#define GL_CW 0x0900 -#define GL_CCW 0x0901 -#define GL_POINT_SIZE 0x0B11 -#define GL_POINT_SIZE_RANGE 0x0B12 -#define GL_POINT_SIZE_GRANULARITY 0x0B13 -#define GL_LINE_SMOOTH 0x0B20 -#define GL_LINE_WIDTH 0x0B21 -#define GL_LINE_WIDTH_RANGE 0x0B22 -#define GL_LINE_WIDTH_GRANULARITY 0x0B23 -#define GL_POLYGON_MODE 0x0B40 -#define GL_POLYGON_SMOOTH 0x0B41 -#define GL_CULL_FACE 0x0B44 -#define GL_CULL_FACE_MODE 0x0B45 -#define GL_FRONT_FACE 0x0B46 -#define GL_DEPTH_RANGE 0x0B70 -#define GL_DEPTH_TEST 0x0B71 -#define GL_DEPTH_WRITEMASK 0x0B72 -#define GL_DEPTH_CLEAR_VALUE 0x0B73 -#define GL_DEPTH_FUNC 0x0B74 -#define GL_STENCIL_TEST 0x0B90 -#define GL_STENCIL_CLEAR_VALUE 0x0B91 -#define GL_STENCIL_FUNC 0x0B92 -#define GL_STENCIL_VALUE_MASK 0x0B93 -#define GL_STENCIL_FAIL 0x0B94 -#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 -#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 -#define GL_STENCIL_REF 0x0B97 -#define GL_STENCIL_WRITEMASK 0x0B98 -#define GL_VIEWPORT 0x0BA2 -#define GL_DITHER 0x0BD0 -#define GL_BLEND_DST 0x0BE0 -#define GL_BLEND_SRC 0x0BE1 -#define GL_BLEND 0x0BE2 -#define GL_LOGIC_OP_MODE 0x0BF0 -#define GL_COLOR_LOGIC_OP 0x0BF2 -#define GL_DRAW_BUFFER 0x0C01 -#define GL_READ_BUFFER 0x0C02 -#define GL_SCISSOR_BOX 0x0C10 -#define GL_SCISSOR_TEST 0x0C11 -#define GL_COLOR_CLEAR_VALUE 0x0C22 -#define GL_COLOR_WRITEMASK 0x0C23 -#define GL_DOUBLEBUFFER 0x0C32 -#define GL_STEREO 0x0C33 -#define GL_LINE_SMOOTH_HINT 0x0C52 -#define GL_POLYGON_SMOOTH_HINT 0x0C53 -#define GL_UNPACK_SWAP_BYTES 0x0CF0 -#define GL_UNPACK_LSB_FIRST 0x0CF1 -#define GL_UNPACK_ROW_LENGTH 0x0CF2 -#define GL_UNPACK_SKIP_ROWS 0x0CF3 -#define GL_UNPACK_SKIP_PIXELS 0x0CF4 -#define GL_UNPACK_ALIGNMENT 0x0CF5 -#define GL_PACK_SWAP_BYTES 0x0D00 -#define GL_PACK_LSB_FIRST 0x0D01 -#define GL_PACK_ROW_LENGTH 0x0D02 -#define GL_PACK_SKIP_ROWS 0x0D03 -#define GL_PACK_SKIP_PIXELS 0x0D04 -#define GL_PACK_ALIGNMENT 0x0D05 -#define GL_MAX_TEXTURE_SIZE 0x0D33 -#define GL_MAX_VIEWPORT_DIMS 0x0D3A -#define GL_SUBPIXEL_BITS 0x0D50 -#define GL_TEXTURE_1D 0x0DE0 -#define GL_TEXTURE_2D 0x0DE1 -#define GL_POLYGON_OFFSET_UNITS 0x2A00 -#define GL_POLYGON_OFFSET_POINT 0x2A01 -#define GL_POLYGON_OFFSET_LINE 0x2A02 -#define GL_POLYGON_OFFSET_FILL 0x8037 -#define GL_POLYGON_OFFSET_FACTOR 0x8038 -#define GL_TEXTURE_BINDING_1D 0x8068 -#define GL_TEXTURE_BINDING_2D 0x8069 -#define GL_TEXTURE_WIDTH 0x1000 -#define GL_TEXTURE_HEIGHT 0x1001 -#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 -#define GL_TEXTURE_BORDER_COLOR 0x1004 -#define GL_TEXTURE_RED_SIZE 0x805C -#define GL_TEXTURE_GREEN_SIZE 0x805D -#define GL_TEXTURE_BLUE_SIZE 0x805E -#define GL_TEXTURE_ALPHA_SIZE 0x805F -#define GL_DONT_CARE 0x1100 -#define GL_FASTEST 0x1101 -#define GL_NICEST 0x1102 -#define GL_BYTE 0x1400 -#define GL_UNSIGNED_BYTE 0x1401 -#define GL_SHORT 0x1402 -#define GL_UNSIGNED_SHORT 0x1403 -#define GL_INT 0x1404 -#define GL_UNSIGNED_INT 0x1405 -#define GL_FLOAT 0x1406 -#define GL_DOUBLE 0x140A -#define GL_STACK_OVERFLOW 0x0503 -#define GL_STACK_UNDERFLOW 0x0504 -#define GL_CLEAR 0x1500 -#define GL_AND 0x1501 -#define GL_AND_REVERSE 0x1502 -#define GL_COPY 0x1503 -#define GL_AND_INVERTED 0x1504 -#define GL_NOOP 0x1505 -#define GL_XOR 0x1506 -#define GL_OR 0x1507 -#define GL_NOR 0x1508 -#define GL_EQUIV 0x1509 -#define GL_INVERT 0x150A -#define GL_OR_REVERSE 0x150B -#define GL_COPY_INVERTED 0x150C -#define GL_OR_INVERTED 0x150D -#define GL_NAND 0x150E -#define GL_SET 0x150F -#define GL_TEXTURE 0x1702 -#define GL_COLOR 0x1800 -#define GL_DEPTH 0x1801 -#define GL_STENCIL 0x1802 -#define GL_STENCIL_INDEX 0x1901 -#define GL_DEPTH_COMPONENT 0x1902 -#define GL_RED 0x1903 -#define GL_GREEN 0x1904 -#define GL_BLUE 0x1905 -#define GL_ALPHA 0x1906 -#define GL_RGB 0x1907 -#define GL_RGBA 0x1908 -#define GL_POINT 0x1B00 -#define GL_LINE 0x1B01 -#define GL_FILL 0x1B02 -#define GL_KEEP 0x1E00 -#define GL_REPLACE 0x1E01 -#define GL_INCR 0x1E02 -#define GL_DECR 0x1E03 -#define GL_VENDOR 0x1F00 -#define GL_RENDERER 0x1F01 -#define GL_VERSION 0x1F02 -#define GL_EXTENSIONS 0x1F03 -#define GL_NEAREST 0x2600 -#define GL_LINEAR 0x2601 -#define GL_NEAREST_MIPMAP_NEAREST 0x2700 -#define GL_LINEAR_MIPMAP_NEAREST 0x2701 -#define GL_NEAREST_MIPMAP_LINEAR 0x2702 -#define GL_LINEAR_MIPMAP_LINEAR 0x2703 -#define GL_TEXTURE_MAG_FILTER 0x2800 -#define GL_TEXTURE_MIN_FILTER 0x2801 -#define GL_TEXTURE_WRAP_S 0x2802 -#define GL_TEXTURE_WRAP_T 0x2803 -#define GL_PROXY_TEXTURE_1D 0x8063 -#define GL_PROXY_TEXTURE_2D 0x8064 -#define GL_REPEAT 0x2901 -#define GL_R3_G3_B2 0x2A10 -#define GL_RGB4 0x804F -#define GL_RGB5 0x8050 -#define GL_RGB8 0x8051 -#define GL_RGB10 0x8052 -#define GL_RGB12 0x8053 -#define GL_RGB16 0x8054 -#define GL_RGBA2 0x8055 -#define GL_RGBA4 0x8056 -#define GL_RGB5_A1 0x8057 -#define GL_RGBA8 0x8058 -#define GL_RGB10_A2 0x8059 -#define GL_RGBA12 0x805A -#define GL_RGBA16 0x805B -#define GL_CURRENT_BIT 0x00000001 -#define GL_POINT_BIT 0x00000002 -#define GL_LINE_BIT 0x00000004 -#define GL_POLYGON_BIT 0x00000008 -#define GL_POLYGON_STIPPLE_BIT 0x00000010 -#define GL_PIXEL_MODE_BIT 0x00000020 -#define GL_LIGHTING_BIT 0x00000040 -#define GL_FOG_BIT 0x00000080 -#define GL_ACCUM_BUFFER_BIT 0x00000200 -#define GL_VIEWPORT_BIT 0x00000800 -#define GL_TRANSFORM_BIT 0x00001000 -#define GL_ENABLE_BIT 0x00002000 -#define GL_HINT_BIT 0x00008000 -#define GL_EVAL_BIT 0x00010000 -#define GL_LIST_BIT 0x00020000 -#define GL_TEXTURE_BIT 0x00040000 -#define GL_SCISSOR_BIT 0x00080000 -#define GL_ALL_ATTRIB_BITS 0xFFFFFFFF -#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 -#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 -#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF -#define GL_QUAD_STRIP 0x0008 -#define GL_POLYGON 0x0009 -#define GL_ACCUM 0x0100 -#define GL_LOAD 0x0101 -#define GL_RETURN 0x0102 -#define GL_MULT 0x0103 -#define GL_ADD 0x0104 -#define GL_AUX0 0x0409 -#define GL_AUX1 0x040A -#define GL_AUX2 0x040B -#define GL_AUX3 0x040C -#define GL_2D 0x0600 -#define GL_3D 0x0601 -#define GL_3D_COLOR 0x0602 -#define GL_3D_COLOR_TEXTURE 0x0603 -#define GL_4D_COLOR_TEXTURE 0x0604 -#define GL_PASS_THROUGH_TOKEN 0x0700 -#define GL_POINT_TOKEN 0x0701 -#define GL_LINE_TOKEN 0x0702 -#define GL_POLYGON_TOKEN 0x0703 -#define GL_BITMAP_TOKEN 0x0704 -#define GL_DRAW_PIXEL_TOKEN 0x0705 -#define GL_COPY_PIXEL_TOKEN 0x0706 -#define GL_LINE_RESET_TOKEN 0x0707 -#define GL_EXP 0x0800 -#define GL_EXP2 0x0801 -#define GL_COEFF 0x0A00 -#define GL_ORDER 0x0A01 -#define GL_DOMAIN 0x0A02 -#define GL_PIXEL_MAP_I_TO_I 0x0C70 -#define GL_PIXEL_MAP_S_TO_S 0x0C71 -#define GL_PIXEL_MAP_I_TO_R 0x0C72 -#define GL_PIXEL_MAP_I_TO_G 0x0C73 -#define GL_PIXEL_MAP_I_TO_B 0x0C74 -#define GL_PIXEL_MAP_I_TO_A 0x0C75 -#define GL_PIXEL_MAP_R_TO_R 0x0C76 -#define GL_PIXEL_MAP_G_TO_G 0x0C77 -#define GL_PIXEL_MAP_B_TO_B 0x0C78 -#define GL_PIXEL_MAP_A_TO_A 0x0C79 -#define GL_VERTEX_ARRAY_POINTER 0x808E -#define GL_NORMAL_ARRAY_POINTER 0x808F -#define GL_COLOR_ARRAY_POINTER 0x8090 -#define GL_INDEX_ARRAY_POINTER 0x8091 -#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 -#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 -#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 -#define GL_SELECTION_BUFFER_POINTER 0x0DF3 -#define GL_CURRENT_COLOR 0x0B00 -#define GL_CURRENT_INDEX 0x0B01 -#define GL_CURRENT_NORMAL 0x0B02 -#define GL_CURRENT_TEXTURE_COORDS 0x0B03 -#define GL_CURRENT_RASTER_COLOR 0x0B04 -#define GL_CURRENT_RASTER_INDEX 0x0B05 -#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 -#define GL_CURRENT_RASTER_POSITION 0x0B07 -#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 -#define GL_CURRENT_RASTER_DISTANCE 0x0B09 -#define GL_POINT_SMOOTH 0x0B10 -#define GL_LINE_STIPPLE 0x0B24 -#define GL_LINE_STIPPLE_PATTERN 0x0B25 -#define GL_LINE_STIPPLE_REPEAT 0x0B26 -#define GL_LIST_MODE 0x0B30 -#define GL_MAX_LIST_NESTING 0x0B31 -#define GL_LIST_BASE 0x0B32 -#define GL_LIST_INDEX 0x0B33 -#define GL_POLYGON_STIPPLE 0x0B42 -#define GL_EDGE_FLAG 0x0B43 -#define GL_LIGHTING 0x0B50 -#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 -#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 -#define GL_LIGHT_MODEL_AMBIENT 0x0B53 -#define GL_SHADE_MODEL 0x0B54 -#define GL_COLOR_MATERIAL_FACE 0x0B55 -#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 -#define GL_COLOR_MATERIAL 0x0B57 -#define GL_FOG 0x0B60 -#define GL_FOG_INDEX 0x0B61 -#define GL_FOG_DENSITY 0x0B62 -#define GL_FOG_START 0x0B63 -#define GL_FOG_END 0x0B64 -#define GL_FOG_MODE 0x0B65 -#define GL_FOG_COLOR 0x0B66 -#define GL_ACCUM_CLEAR_VALUE 0x0B80 -#define GL_MATRIX_MODE 0x0BA0 -#define GL_NORMALIZE 0x0BA1 -#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 -#define GL_PROJECTION_STACK_DEPTH 0x0BA4 -#define GL_TEXTURE_STACK_DEPTH 0x0BA5 -#define GL_MODELVIEW_MATRIX 0x0BA6 -#define GL_PROJECTION_MATRIX 0x0BA7 -#define GL_TEXTURE_MATRIX 0x0BA8 -#define GL_ATTRIB_STACK_DEPTH 0x0BB0 -#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 -#define GL_ALPHA_TEST 0x0BC0 -#define GL_ALPHA_TEST_FUNC 0x0BC1 -#define GL_ALPHA_TEST_REF 0x0BC2 -#define GL_INDEX_LOGIC_OP 0x0BF1 -#define GL_LOGIC_OP 0x0BF1 -#define GL_AUX_BUFFERS 0x0C00 -#define GL_INDEX_CLEAR_VALUE 0x0C20 -#define GL_INDEX_WRITEMASK 0x0C21 -#define GL_INDEX_MODE 0x0C30 -#define GL_RGBA_MODE 0x0C31 -#define GL_RENDER_MODE 0x0C40 -#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 -#define GL_POINT_SMOOTH_HINT 0x0C51 -#define GL_FOG_HINT 0x0C54 -#define GL_TEXTURE_GEN_S 0x0C60 -#define GL_TEXTURE_GEN_T 0x0C61 -#define GL_TEXTURE_GEN_R 0x0C62 -#define GL_TEXTURE_GEN_Q 0x0C63 -#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 -#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 -#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 -#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 -#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 -#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 -#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 -#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 -#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 -#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 -#define GL_MAP_COLOR 0x0D10 -#define GL_MAP_STENCIL 0x0D11 -#define GL_INDEX_SHIFT 0x0D12 -#define GL_INDEX_OFFSET 0x0D13 -#define GL_RED_SCALE 0x0D14 -#define GL_RED_BIAS 0x0D15 -#define GL_ZOOM_X 0x0D16 -#define GL_ZOOM_Y 0x0D17 -#define GL_GREEN_SCALE 0x0D18 -#define GL_GREEN_BIAS 0x0D19 -#define GL_BLUE_SCALE 0x0D1A -#define GL_BLUE_BIAS 0x0D1B -#define GL_ALPHA_SCALE 0x0D1C -#define GL_ALPHA_BIAS 0x0D1D -#define GL_DEPTH_SCALE 0x0D1E -#define GL_DEPTH_BIAS 0x0D1F -#define GL_MAX_EVAL_ORDER 0x0D30 -#define GL_MAX_LIGHTS 0x0D31 -#define GL_MAX_CLIP_PLANES 0x0D32 -#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 -#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 -#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 -#define GL_MAX_NAME_STACK_DEPTH 0x0D37 -#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 -#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 -#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B -#define GL_INDEX_BITS 0x0D51 -#define GL_RED_BITS 0x0D52 -#define GL_GREEN_BITS 0x0D53 -#define GL_BLUE_BITS 0x0D54 -#define GL_ALPHA_BITS 0x0D55 -#define GL_DEPTH_BITS 0x0D56 -#define GL_STENCIL_BITS 0x0D57 -#define GL_ACCUM_RED_BITS 0x0D58 -#define GL_ACCUM_GREEN_BITS 0x0D59 -#define GL_ACCUM_BLUE_BITS 0x0D5A -#define GL_ACCUM_ALPHA_BITS 0x0D5B -#define GL_NAME_STACK_DEPTH 0x0D70 -#define GL_AUTO_NORMAL 0x0D80 -#define GL_MAP1_COLOR_4 0x0D90 -#define GL_MAP1_INDEX 0x0D91 -#define GL_MAP1_NORMAL 0x0D92 -#define GL_MAP1_TEXTURE_COORD_1 0x0D93 -#define GL_MAP1_TEXTURE_COORD_2 0x0D94 -#define GL_MAP1_TEXTURE_COORD_3 0x0D95 -#define GL_MAP1_TEXTURE_COORD_4 0x0D96 -#define GL_MAP1_VERTEX_3 0x0D97 -#define GL_MAP1_VERTEX_4 0x0D98 -#define GL_MAP2_COLOR_4 0x0DB0 -#define GL_MAP2_INDEX 0x0DB1 -#define GL_MAP2_NORMAL 0x0DB2 -#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 -#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 -#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 -#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 -#define GL_MAP2_VERTEX_3 0x0DB7 -#define GL_MAP2_VERTEX_4 0x0DB8 -#define GL_MAP1_GRID_DOMAIN 0x0DD0 -#define GL_MAP1_GRID_SEGMENTS 0x0DD1 -#define GL_MAP2_GRID_DOMAIN 0x0DD2 -#define GL_MAP2_GRID_SEGMENTS 0x0DD3 -#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 -#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 -#define GL_SELECTION_BUFFER_SIZE 0x0DF4 -#define GL_VERTEX_ARRAY 0x8074 -#define GL_NORMAL_ARRAY 0x8075 -#define GL_COLOR_ARRAY 0x8076 -#define GL_INDEX_ARRAY 0x8077 -#define GL_TEXTURE_COORD_ARRAY 0x8078 -#define GL_EDGE_FLAG_ARRAY 0x8079 -#define GL_VERTEX_ARRAY_SIZE 0x807A -#define GL_VERTEX_ARRAY_TYPE 0x807B -#define GL_VERTEX_ARRAY_STRIDE 0x807C -#define GL_NORMAL_ARRAY_TYPE 0x807E -#define GL_NORMAL_ARRAY_STRIDE 0x807F -#define GL_COLOR_ARRAY_SIZE 0x8081 -#define GL_COLOR_ARRAY_TYPE 0x8082 -#define GL_COLOR_ARRAY_STRIDE 0x8083 -#define GL_INDEX_ARRAY_TYPE 0x8085 -#define GL_INDEX_ARRAY_STRIDE 0x8086 -#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 -#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 -#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A -#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C -#define GL_TEXTURE_COMPONENTS 0x1003 -#define GL_TEXTURE_BORDER 0x1005 -#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 -#define GL_TEXTURE_INTENSITY_SIZE 0x8061 -#define GL_TEXTURE_PRIORITY 0x8066 -#define GL_TEXTURE_RESIDENT 0x8067 -#define GL_AMBIENT 0x1200 -#define GL_DIFFUSE 0x1201 -#define GL_SPECULAR 0x1202 -#define GL_POSITION 0x1203 -#define GL_SPOT_DIRECTION 0x1204 -#define GL_SPOT_EXPONENT 0x1205 -#define GL_SPOT_CUTOFF 0x1206 -#define GL_CONSTANT_ATTENUATION 0x1207 -#define GL_LINEAR_ATTENUATION 0x1208 -#define GL_QUADRATIC_ATTENUATION 0x1209 -#define GL_COMPILE 0x1300 -#define GL_COMPILE_AND_EXECUTE 0x1301 -#define GL_2_BYTES 0x1407 -#define GL_3_BYTES 0x1408 -#define GL_4_BYTES 0x1409 -#define GL_EMISSION 0x1600 -#define GL_SHININESS 0x1601 -#define GL_AMBIENT_AND_DIFFUSE 0x1602 -#define GL_COLOR_INDEXES 0x1603 -#define GL_MODELVIEW 0x1700 -#define GL_PROJECTION 0x1701 -#define GL_COLOR_INDEX 0x1900 -#define GL_LUMINANCE 0x1909 -#define GL_LUMINANCE_ALPHA 0x190A -#define GL_BITMAP 0x1A00 -#define GL_RENDER 0x1C00 -#define GL_FEEDBACK 0x1C01 -#define GL_SELECT 0x1C02 -#define GL_FLAT 0x1D00 -#define GL_SMOOTH 0x1D01 -#define GL_S 0x2000 -#define GL_T 0x2001 -#define GL_R 0x2002 -#define GL_Q 0x2003 -#define GL_MODULATE 0x2100 -#define GL_DECAL 0x2101 -#define GL_TEXTURE_ENV_MODE 0x2200 -#define GL_TEXTURE_ENV_COLOR 0x2201 -#define GL_TEXTURE_ENV 0x2300 -#define GL_EYE_LINEAR 0x2400 -#define GL_OBJECT_LINEAR 0x2401 -#define GL_SPHERE_MAP 0x2402 -#define GL_TEXTURE_GEN_MODE 0x2500 -#define GL_OBJECT_PLANE 0x2501 -#define GL_EYE_PLANE 0x2502 -#define GL_CLAMP 0x2900 -#define GL_ALPHA4 0x803B -#define GL_ALPHA8 0x803C -#define GL_ALPHA12 0x803D -#define GL_ALPHA16 0x803E -#define GL_LUMINANCE4 0x803F -#define GL_LUMINANCE8 0x8040 -#define GL_LUMINANCE12 0x8041 -#define GL_LUMINANCE16 0x8042 -#define GL_LUMINANCE4_ALPHA4 0x8043 -#define GL_LUMINANCE6_ALPHA2 0x8044 -#define GL_LUMINANCE8_ALPHA8 0x8045 -#define GL_LUMINANCE12_ALPHA4 0x8046 -#define GL_LUMINANCE12_ALPHA12 0x8047 -#define GL_LUMINANCE16_ALPHA16 0x8048 -#define GL_INTENSITY 0x8049 -#define GL_INTENSITY4 0x804A -#define GL_INTENSITY8 0x804B -#define GL_INTENSITY12 0x804C -#define GL_INTENSITY16 0x804D -#define GL_V2F 0x2A20 -#define GL_V3F 0x2A21 -#define GL_C4UB_V2F 0x2A22 -#define GL_C4UB_V3F 0x2A23 -#define GL_C3F_V3F 0x2A24 -#define GL_N3F_V3F 0x2A25 -#define GL_C4F_N3F_V3F 0x2A26 -#define GL_T2F_V3F 0x2A27 -#define GL_T4F_V4F 0x2A28 -#define GL_T2F_C4UB_V3F 0x2A29 -#define GL_T2F_C3F_V3F 0x2A2A -#define GL_T2F_N3F_V3F 0x2A2B -#define GL_T2F_C4F_N3F_V3F 0x2A2C -#define GL_T4F_C4F_N3F_V4F 0x2A2D -#define GL_CLIP_PLANE0 0x3000 -#define GL_CLIP_PLANE1 0x3001 -#define GL_CLIP_PLANE2 0x3002 -#define GL_CLIP_PLANE3 0x3003 -#define GL_CLIP_PLANE4 0x3004 -#define GL_CLIP_PLANE5 0x3005 -#define GL_LIGHT0 0x4000 -#define GL_LIGHT1 0x4001 -#define GL_LIGHT2 0x4002 -#define GL_LIGHT3 0x4003 -#define GL_LIGHT4 0x4004 -#define GL_LIGHT5 0x4005 -#define GL_LIGHT6 0x4006 -#define GL_LIGHT7 0x4007 -typedef void (APIENTRYP pfn_glDrawArrays) (GLenum, GLint, GLsizei); -extern pfn_glDrawArrays fp_glDrawArrays; -typedef void (APIENTRYP pfn_glDrawElements) (GLenum, GLsizei, GLenum, const void*); -extern pfn_glDrawElements fp_glDrawElements; -typedef void (APIENTRYP pfn_glGetPointerv) (GLenum, void**); -extern pfn_glGetPointerv fp_glGetPointerv; -typedef void (APIENTRYP pfn_glPolygonOffset) (GLfloat, GLfloat); -extern pfn_glPolygonOffset fp_glPolygonOffset; -typedef void (APIENTRYP pfn_glCopyTexImage1D) (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint); -extern pfn_glCopyTexImage1D fp_glCopyTexImage1D; -typedef void (APIENTRYP pfn_glCopyTexImage2D) (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); -extern pfn_glCopyTexImage2D fp_glCopyTexImage2D; -typedef void (APIENTRYP pfn_glCopyTexSubImage1D) (GLenum, GLint, GLint, GLint, GLint, GLsizei); -extern pfn_glCopyTexSubImage1D fp_glCopyTexSubImage1D; -typedef void (APIENTRYP pfn_glCopyTexSubImage2D) (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); -extern pfn_glCopyTexSubImage2D fp_glCopyTexSubImage2D; -typedef void (APIENTRYP pfn_glTexSubImage1D) (GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const void*); -extern pfn_glTexSubImage1D fp_glTexSubImage1D; -typedef void (APIENTRYP pfn_glTexSubImage2D) (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void*); -extern pfn_glTexSubImage2D fp_glTexSubImage2D; -typedef void (APIENTRYP pfn_glBindTexture) (GLenum, GLuint); -extern pfn_glBindTexture fp_glBindTexture; -typedef void (APIENTRYP pfn_glDeleteTextures) (GLsizei, const GLuint*); -extern pfn_glDeleteTextures fp_glDeleteTextures; -typedef void (APIENTRYP pfn_glGenTextures) (GLsizei, GLuint*); -extern pfn_glGenTextures fp_glGenTextures; -typedef GLboolean (APIENTRYP pfn_glIsTexture) (GLuint); -extern pfn_glIsTexture fp_glIsTexture; -typedef void (APIENTRYP pfn_glArrayElement) (GLint); -extern pfn_glArrayElement fp_glArrayElement; -typedef void (APIENTRYP pfn_glColorPointer) (GLint, GLenum, GLsizei, const void*); -extern pfn_glColorPointer fp_glColorPointer; -typedef void (APIENTRYP pfn_glDisableClientState) (GLenum); -extern pfn_glDisableClientState fp_glDisableClientState; -typedef void (APIENTRYP pfn_glEdgeFlagPointer) (GLsizei, const void*); -extern pfn_glEdgeFlagPointer fp_glEdgeFlagPointer; -typedef void (APIENTRYP pfn_glEnableClientState) (GLenum); -extern pfn_glEnableClientState fp_glEnableClientState; -typedef void (APIENTRYP pfn_glIndexPointer) (GLenum, GLsizei, const void*); -extern pfn_glIndexPointer fp_glIndexPointer; -typedef void (APIENTRYP pfn_glInterleavedArrays) (GLenum, GLsizei, const void*); -extern pfn_glInterleavedArrays fp_glInterleavedArrays; -typedef void (APIENTRYP pfn_glNormalPointer) (GLenum, GLsizei, const void*); -extern pfn_glNormalPointer fp_glNormalPointer; -typedef void (APIENTRYP pfn_glTexCoordPointer) (GLint, GLenum, GLsizei, const void*); -extern pfn_glTexCoordPointer fp_glTexCoordPointer; -typedef void (APIENTRYP pfn_glVertexPointer) (GLint, GLenum, GLsizei, const void*); -extern pfn_glVertexPointer fp_glVertexPointer; -typedef GLboolean (APIENTRYP pfn_glAreTexturesResident) (GLsizei, const GLuint*, GLboolean*); -extern pfn_glAreTexturesResident fp_glAreTexturesResident; -typedef void (APIENTRYP pfn_glPrioritizeTextures) (GLsizei, const GLuint*, const GLfloat*); -extern pfn_glPrioritizeTextures fp_glPrioritizeTextures; -typedef void (APIENTRYP pfn_glIndexub) (GLubyte); -extern pfn_glIndexub fp_glIndexub; -typedef void (APIENTRYP pfn_glIndexubv) (const GLubyte*); -extern pfn_glIndexubv fp_glIndexubv; -typedef void (APIENTRYP pfn_glPopClientAttrib) (); -extern pfn_glPopClientAttrib fp_glPopClientAttrib; -typedef void (APIENTRYP pfn_glPushClientAttrib) (GLbitfield); -extern pfn_glPushClientAttrib fp_glPushClientAttrib; - - /* GL_VERSION_1_2 */ -extern GLboolean GLAD_VERSION_1_2; -#define GL_UNSIGNED_BYTE_3_3_2 0x8032 -#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 -#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 -#define GL_UNSIGNED_INT_8_8_8_8 0x8035 -#define GL_UNSIGNED_INT_10_10_10_2 0x8036 -#define GL_TEXTURE_BINDING_3D 0x806A -#define GL_PACK_SKIP_IMAGES 0x806B -#define GL_PACK_IMAGE_HEIGHT 0x806C -#define GL_UNPACK_SKIP_IMAGES 0x806D -#define GL_UNPACK_IMAGE_HEIGHT 0x806E -#define GL_TEXTURE_3D 0x806F -#define GL_PROXY_TEXTURE_3D 0x8070 -#define GL_TEXTURE_DEPTH 0x8071 -#define GL_TEXTURE_WRAP_R 0x8072 -#define GL_MAX_3D_TEXTURE_SIZE 0x8073 -#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 -#define GL_UNSIGNED_SHORT_5_6_5 0x8363 -#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 -#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 -#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 -#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 -#define GL_BGR 0x80E0 -#define GL_BGRA 0x80E1 -#define GL_MAX_ELEMENTS_VERTICES 0x80E8 -#define GL_MAX_ELEMENTS_INDICES 0x80E9 -#define GL_CLAMP_TO_EDGE 0x812F -#define GL_TEXTURE_MIN_LOD 0x813A -#define GL_TEXTURE_MAX_LOD 0x813B -#define GL_TEXTURE_BASE_LEVEL 0x813C -#define GL_TEXTURE_MAX_LEVEL 0x813D -#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 -#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 -#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 -#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 -#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E -#define GL_RESCALE_NORMAL 0x803A -#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 -#define GL_SINGLE_COLOR 0x81F9 -#define GL_SEPARATE_SPECULAR_COLOR 0x81FA -#define GL_ALIASED_POINT_SIZE_RANGE 0x846D -typedef void (APIENTRYP pfn_glDrawRangeElements) (GLenum, GLuint, GLuint, GLsizei, GLenum, const void*); -extern pfn_glDrawRangeElements fp_glDrawRangeElements; -typedef void (APIENTRYP pfn_glTexImage3D) (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const void*); -extern pfn_glTexImage3D fp_glTexImage3D; -typedef void (APIENTRYP pfn_glTexSubImage3D) (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const void*); -extern pfn_glTexSubImage3D fp_glTexSubImage3D; -typedef void (APIENTRYP pfn_glCopyTexSubImage3D) (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); -extern pfn_glCopyTexSubImage3D fp_glCopyTexSubImage3D; - - /* GL_VERSION_1_3 */ -extern GLboolean GLAD_VERSION_1_3; -#define GL_TEXTURE0 0x84C0 -#define GL_TEXTURE1 0x84C1 -#define GL_TEXTURE2 0x84C2 -#define GL_TEXTURE3 0x84C3 -#define GL_TEXTURE4 0x84C4 -#define GL_TEXTURE5 0x84C5 -#define GL_TEXTURE6 0x84C6 -#define GL_TEXTURE7 0x84C7 -#define GL_TEXTURE8 0x84C8 -#define GL_TEXTURE9 0x84C9 -#define GL_TEXTURE10 0x84CA -#define GL_TEXTURE11 0x84CB -#define GL_TEXTURE12 0x84CC -#define GL_TEXTURE13 0x84CD -#define GL_TEXTURE14 0x84CE -#define GL_TEXTURE15 0x84CF -#define GL_TEXTURE16 0x84D0 -#define GL_TEXTURE17 0x84D1 -#define GL_TEXTURE18 0x84D2 -#define GL_TEXTURE19 0x84D3 -#define GL_TEXTURE20 0x84D4 -#define GL_TEXTURE21 0x84D5 -#define GL_TEXTURE22 0x84D6 -#define GL_TEXTURE23 0x84D7 -#define GL_TEXTURE24 0x84D8 -#define GL_TEXTURE25 0x84D9 -#define GL_TEXTURE26 0x84DA -#define GL_TEXTURE27 0x84DB -#define GL_TEXTURE28 0x84DC -#define GL_TEXTURE29 0x84DD -#define GL_TEXTURE30 0x84DE -#define GL_TEXTURE31 0x84DF -#define GL_ACTIVE_TEXTURE 0x84E0 -#define GL_MULTISAMPLE 0x809D -#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE 0x809F -#define GL_SAMPLE_COVERAGE 0x80A0 -#define GL_SAMPLE_BUFFERS 0x80A8 -#define GL_SAMPLES 0x80A9 -#define GL_SAMPLE_COVERAGE_VALUE 0x80AA -#define GL_SAMPLE_COVERAGE_INVERT 0x80AB -#define GL_TEXTURE_CUBE_MAP 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A -#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C -#define GL_COMPRESSED_RGB 0x84ED -#define GL_COMPRESSED_RGBA 0x84EE -#define GL_TEXTURE_COMPRESSION_HINT 0x84EF -#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 -#define GL_TEXTURE_COMPRESSED 0x86A1 -#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 -#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 -#define GL_CLAMP_TO_BORDER 0x812D -#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 -#define GL_MAX_TEXTURE_UNITS 0x84E2 -#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 -#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 -#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 -#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 -#define GL_MULTISAMPLE_BIT 0x20000000 -#define GL_NORMAL_MAP 0x8511 -#define GL_REFLECTION_MAP 0x8512 -#define GL_COMPRESSED_ALPHA 0x84E9 -#define GL_COMPRESSED_LUMINANCE 0x84EA -#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB -#define GL_COMPRESSED_INTENSITY 0x84EC -#define GL_COMBINE 0x8570 -#define GL_COMBINE_RGB 0x8571 -#define GL_COMBINE_ALPHA 0x8572 -#define GL_SOURCE0_RGB 0x8580 -#define GL_SOURCE1_RGB 0x8581 -#define GL_SOURCE2_RGB 0x8582 -#define GL_SOURCE0_ALPHA 0x8588 -#define GL_SOURCE1_ALPHA 0x8589 -#define GL_SOURCE2_ALPHA 0x858A -#define GL_OPERAND0_RGB 0x8590 -#define GL_OPERAND1_RGB 0x8591 -#define GL_OPERAND2_RGB 0x8592 -#define GL_OPERAND0_ALPHA 0x8598 -#define GL_OPERAND1_ALPHA 0x8599 -#define GL_OPERAND2_ALPHA 0x859A -#define GL_RGB_SCALE 0x8573 -#define GL_ADD_SIGNED 0x8574 -#define GL_INTERPOLATE 0x8575 -#define GL_SUBTRACT 0x84E7 -#define GL_CONSTANT 0x8576 -#define GL_PRIMARY_COLOR 0x8577 -#define GL_PREVIOUS 0x8578 -#define GL_DOT3_RGB 0x86AE -#define GL_DOT3_RGBA 0x86AF -typedef void (APIENTRYP pfn_glActiveTexture) (GLenum); -extern pfn_glActiveTexture fp_glActiveTexture; -typedef void (APIENTRYP pfn_glSampleCoverage) (GLfloat, GLboolean); -extern pfn_glSampleCoverage fp_glSampleCoverage; -typedef void (APIENTRYP pfn_glCompressedTexImage3D) (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const void*); -extern pfn_glCompressedTexImage3D fp_glCompressedTexImage3D; -typedef void (APIENTRYP pfn_glCompressedTexImage2D) (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void*); -extern pfn_glCompressedTexImage2D fp_glCompressedTexImage2D; -typedef void (APIENTRYP pfn_glCompressedTexImage1D) (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const void*); -extern pfn_glCompressedTexImage1D fp_glCompressedTexImage1D; -typedef void (APIENTRYP pfn_glCompressedTexSubImage3D) (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const void*); -extern pfn_glCompressedTexSubImage3D fp_glCompressedTexSubImage3D; -typedef void (APIENTRYP pfn_glCompressedTexSubImage2D) (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void*); -extern pfn_glCompressedTexSubImage2D fp_glCompressedTexSubImage2D; -typedef void (APIENTRYP pfn_glCompressedTexSubImage1D) (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const void*); -extern pfn_glCompressedTexSubImage1D fp_glCompressedTexSubImage1D; -typedef void (APIENTRYP pfn_glGetCompressedTexImage) (GLenum, GLint, void*); -extern pfn_glGetCompressedTexImage fp_glGetCompressedTexImage; -typedef void (APIENTRYP pfn_glClientActiveTexture) (GLenum); -extern pfn_glClientActiveTexture fp_glClientActiveTexture; -typedef void (APIENTRYP pfn_glMultiTexCoord1d) (GLenum, GLdouble); -extern pfn_glMultiTexCoord1d fp_glMultiTexCoord1d; -typedef void (APIENTRYP pfn_glMultiTexCoord1dv) (GLenum, const GLdouble*); -extern pfn_glMultiTexCoord1dv fp_glMultiTexCoord1dv; -typedef void (APIENTRYP pfn_glMultiTexCoord1f) (GLenum, GLfloat); -extern pfn_glMultiTexCoord1f fp_glMultiTexCoord1f; -typedef void (APIENTRYP pfn_glMultiTexCoord1fv) (GLenum, const GLfloat*); -extern pfn_glMultiTexCoord1fv fp_glMultiTexCoord1fv; -typedef void (APIENTRYP pfn_glMultiTexCoord1i) (GLenum, GLint); -extern pfn_glMultiTexCoord1i fp_glMultiTexCoord1i; -typedef void (APIENTRYP pfn_glMultiTexCoord1iv) (GLenum, const GLint*); -extern pfn_glMultiTexCoord1iv fp_glMultiTexCoord1iv; -typedef void (APIENTRYP pfn_glMultiTexCoord1s) (GLenum, GLshort); -extern pfn_glMultiTexCoord1s fp_glMultiTexCoord1s; -typedef void (APIENTRYP pfn_glMultiTexCoord1sv) (GLenum, const GLshort*); -extern pfn_glMultiTexCoord1sv fp_glMultiTexCoord1sv; -typedef void (APIENTRYP pfn_glMultiTexCoord2d) (GLenum, GLdouble, GLdouble); -extern pfn_glMultiTexCoord2d fp_glMultiTexCoord2d; -typedef void (APIENTRYP pfn_glMultiTexCoord2dv) (GLenum, const GLdouble*); -extern pfn_glMultiTexCoord2dv fp_glMultiTexCoord2dv; -typedef void (APIENTRYP pfn_glMultiTexCoord2f) (GLenum, GLfloat, GLfloat); -extern pfn_glMultiTexCoord2f fp_glMultiTexCoord2f; -typedef void (APIENTRYP pfn_glMultiTexCoord2fv) (GLenum, const GLfloat*); -extern pfn_glMultiTexCoord2fv fp_glMultiTexCoord2fv; -typedef void (APIENTRYP pfn_glMultiTexCoord2i) (GLenum, GLint, GLint); -extern pfn_glMultiTexCoord2i fp_glMultiTexCoord2i; -typedef void (APIENTRYP pfn_glMultiTexCoord2iv) (GLenum, const GLint*); -extern pfn_glMultiTexCoord2iv fp_glMultiTexCoord2iv; -typedef void (APIENTRYP pfn_glMultiTexCoord2s) (GLenum, GLshort, GLshort); -extern pfn_glMultiTexCoord2s fp_glMultiTexCoord2s; -typedef void (APIENTRYP pfn_glMultiTexCoord2sv) (GLenum, const GLshort*); -extern pfn_glMultiTexCoord2sv fp_glMultiTexCoord2sv; -typedef void (APIENTRYP pfn_glMultiTexCoord3d) (GLenum, GLdouble, GLdouble, GLdouble); -extern pfn_glMultiTexCoord3d fp_glMultiTexCoord3d; -typedef void (APIENTRYP pfn_glMultiTexCoord3dv) (GLenum, const GLdouble*); -extern pfn_glMultiTexCoord3dv fp_glMultiTexCoord3dv; -typedef void (APIENTRYP pfn_glMultiTexCoord3f) (GLenum, GLfloat, GLfloat, GLfloat); -extern pfn_glMultiTexCoord3f fp_glMultiTexCoord3f; -typedef void (APIENTRYP pfn_glMultiTexCoord3fv) (GLenum, const GLfloat*); -extern pfn_glMultiTexCoord3fv fp_glMultiTexCoord3fv; -typedef void (APIENTRYP pfn_glMultiTexCoord3i) (GLenum, GLint, GLint, GLint); -extern pfn_glMultiTexCoord3i fp_glMultiTexCoord3i; -typedef void (APIENTRYP pfn_glMultiTexCoord3iv) (GLenum, const GLint*); -extern pfn_glMultiTexCoord3iv fp_glMultiTexCoord3iv; -typedef void (APIENTRYP pfn_glMultiTexCoord3s) (GLenum, GLshort, GLshort, GLshort); -extern pfn_glMultiTexCoord3s fp_glMultiTexCoord3s; -typedef void (APIENTRYP pfn_glMultiTexCoord3sv) (GLenum, const GLshort*); -extern pfn_glMultiTexCoord3sv fp_glMultiTexCoord3sv; -typedef void (APIENTRYP pfn_glMultiTexCoord4d) (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); -extern pfn_glMultiTexCoord4d fp_glMultiTexCoord4d; -typedef void (APIENTRYP pfn_glMultiTexCoord4dv) (GLenum, const GLdouble*); -extern pfn_glMultiTexCoord4dv fp_glMultiTexCoord4dv; -typedef void (APIENTRYP pfn_glMultiTexCoord4f) (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); -extern pfn_glMultiTexCoord4f fp_glMultiTexCoord4f; -typedef void (APIENTRYP pfn_glMultiTexCoord4fv) (GLenum, const GLfloat*); -extern pfn_glMultiTexCoord4fv fp_glMultiTexCoord4fv; -typedef void (APIENTRYP pfn_glMultiTexCoord4i) (GLenum, GLint, GLint, GLint, GLint); -extern pfn_glMultiTexCoord4i fp_glMultiTexCoord4i; -typedef void (APIENTRYP pfn_glMultiTexCoord4iv) (GLenum, const GLint*); -extern pfn_glMultiTexCoord4iv fp_glMultiTexCoord4iv; -typedef void (APIENTRYP pfn_glMultiTexCoord4s) (GLenum, GLshort, GLshort, GLshort, GLshort); -extern pfn_glMultiTexCoord4s fp_glMultiTexCoord4s; -typedef void (APIENTRYP pfn_glMultiTexCoord4sv) (GLenum, const GLshort*); -extern pfn_glMultiTexCoord4sv fp_glMultiTexCoord4sv; -typedef void (APIENTRYP pfn_glLoadTransposeMatrixf) (const GLfloat*); -extern pfn_glLoadTransposeMatrixf fp_glLoadTransposeMatrixf; -typedef void (APIENTRYP pfn_glLoadTransposeMatrixd) (const GLdouble*); -extern pfn_glLoadTransposeMatrixd fp_glLoadTransposeMatrixd; -typedef void (APIENTRYP pfn_glMultTransposeMatrixf) (const GLfloat*); -extern pfn_glMultTransposeMatrixf fp_glMultTransposeMatrixf; -typedef void (APIENTRYP pfn_glMultTransposeMatrixd) (const GLdouble*); -extern pfn_glMultTransposeMatrixd fp_glMultTransposeMatrixd; - - /* GL_VERSION_1_4 */ -extern GLboolean GLAD_VERSION_1_4; -#define GL_BLEND_DST_RGB 0x80C8 -#define GL_BLEND_SRC_RGB 0x80C9 -#define GL_BLEND_DST_ALPHA 0x80CA -#define GL_BLEND_SRC_ALPHA 0x80CB -#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 -#define GL_DEPTH_COMPONENT16 0x81A5 -#define GL_DEPTH_COMPONENT24 0x81A6 -#define GL_DEPTH_COMPONENT32 0x81A7 -#define GL_MIRRORED_REPEAT 0x8370 -#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD -#define GL_TEXTURE_LOD_BIAS 0x8501 -#define GL_INCR_WRAP 0x8507 -#define GL_DECR_WRAP 0x8508 -#define GL_TEXTURE_DEPTH_SIZE 0x884A -#define GL_TEXTURE_COMPARE_MODE 0x884C -#define GL_TEXTURE_COMPARE_FUNC 0x884D -#define GL_POINT_SIZE_MIN 0x8126 -#define GL_POINT_SIZE_MAX 0x8127 -#define GL_POINT_DISTANCE_ATTENUATION 0x8129 -#define GL_GENERATE_MIPMAP 0x8191 -#define GL_GENERATE_MIPMAP_HINT 0x8192 -#define GL_FOG_COORDINATE_SOURCE 0x8450 -#define GL_FOG_COORDINATE 0x8451 -#define GL_FRAGMENT_DEPTH 0x8452 -#define GL_CURRENT_FOG_COORDINATE 0x8453 -#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 -#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 -#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 -#define GL_FOG_COORDINATE_ARRAY 0x8457 -#define GL_COLOR_SUM 0x8458 -#define GL_CURRENT_SECONDARY_COLOR 0x8459 -#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A -#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B -#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C -#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D -#define GL_SECONDARY_COLOR_ARRAY 0x845E -#define GL_TEXTURE_FILTER_CONTROL 0x8500 -#define GL_DEPTH_TEXTURE_MODE 0x884B -#define GL_COMPARE_R_TO_TEXTURE 0x884E -#define GL_FUNC_ADD 0x8006 -#define GL_FUNC_SUBTRACT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT 0x800B -#define GL_MIN 0x8007 -#define GL_MAX 0x8008 -#define GL_CONSTANT_COLOR 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 -#define GL_CONSTANT_ALPHA 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -typedef void (APIENTRYP pfn_glBlendFuncSeparate) (GLenum, GLenum, GLenum, GLenum); -extern pfn_glBlendFuncSeparate fp_glBlendFuncSeparate; -typedef void (APIENTRYP pfn_glMultiDrawArrays) (GLenum, const GLint*, const GLsizei*, GLsizei); -extern pfn_glMultiDrawArrays fp_glMultiDrawArrays; -typedef void (APIENTRYP pfn_glMultiDrawElements) (GLenum, const GLsizei*, GLenum, const void**, GLsizei); -extern pfn_glMultiDrawElements fp_glMultiDrawElements; -typedef void (APIENTRYP pfn_glPointParameterf) (GLenum, GLfloat); -extern pfn_glPointParameterf fp_glPointParameterf; -typedef void (APIENTRYP pfn_glPointParameterfv) (GLenum, const GLfloat*); -extern pfn_glPointParameterfv fp_glPointParameterfv; -typedef void (APIENTRYP pfn_glPointParameteri) (GLenum, GLint); -extern pfn_glPointParameteri fp_glPointParameteri; -typedef void (APIENTRYP pfn_glPointParameteriv) (GLenum, const GLint*); -extern pfn_glPointParameteriv fp_glPointParameteriv; -typedef void (APIENTRYP pfn_glFogCoordf) (GLfloat); -extern pfn_glFogCoordf fp_glFogCoordf; -typedef void (APIENTRYP pfn_glFogCoordfv) (const GLfloat*); -extern pfn_glFogCoordfv fp_glFogCoordfv; -typedef void (APIENTRYP pfn_glFogCoordd) (GLdouble); -extern pfn_glFogCoordd fp_glFogCoordd; -typedef void (APIENTRYP pfn_glFogCoorddv) (const GLdouble*); -extern pfn_glFogCoorddv fp_glFogCoorddv; -typedef void (APIENTRYP pfn_glFogCoordPointer) (GLenum, GLsizei, const void*); -extern pfn_glFogCoordPointer fp_glFogCoordPointer; -typedef void (APIENTRYP pfn_glSecondaryColor3b) (GLbyte, GLbyte, GLbyte); -extern pfn_glSecondaryColor3b fp_glSecondaryColor3b; -typedef void (APIENTRYP pfn_glSecondaryColor3bv) (const GLbyte*); -extern pfn_glSecondaryColor3bv fp_glSecondaryColor3bv; -typedef void (APIENTRYP pfn_glSecondaryColor3d) (GLdouble, GLdouble, GLdouble); -extern pfn_glSecondaryColor3d fp_glSecondaryColor3d; -typedef void (APIENTRYP pfn_glSecondaryColor3dv) (const GLdouble*); -extern pfn_glSecondaryColor3dv fp_glSecondaryColor3dv; -typedef void (APIENTRYP pfn_glSecondaryColor3f) (GLfloat, GLfloat, GLfloat); -extern pfn_glSecondaryColor3f fp_glSecondaryColor3f; -typedef void (APIENTRYP pfn_glSecondaryColor3fv) (const GLfloat*); -extern pfn_glSecondaryColor3fv fp_glSecondaryColor3fv; -typedef void (APIENTRYP pfn_glSecondaryColor3i) (GLint, GLint, GLint); -extern pfn_glSecondaryColor3i fp_glSecondaryColor3i; -typedef void (APIENTRYP pfn_glSecondaryColor3iv) (const GLint*); -extern pfn_glSecondaryColor3iv fp_glSecondaryColor3iv; -typedef void (APIENTRYP pfn_glSecondaryColor3s) (GLshort, GLshort, GLshort); -extern pfn_glSecondaryColor3s fp_glSecondaryColor3s; -typedef void (APIENTRYP pfn_glSecondaryColor3sv) (const GLshort*); -extern pfn_glSecondaryColor3sv fp_glSecondaryColor3sv; -typedef void (APIENTRYP pfn_glSecondaryColor3ub) (GLubyte, GLubyte, GLubyte); -extern pfn_glSecondaryColor3ub fp_glSecondaryColor3ub; -typedef void (APIENTRYP pfn_glSecondaryColor3ubv) (const GLubyte*); -extern pfn_glSecondaryColor3ubv fp_glSecondaryColor3ubv; -typedef void (APIENTRYP pfn_glSecondaryColor3ui) (GLuint, GLuint, GLuint); -extern pfn_glSecondaryColor3ui fp_glSecondaryColor3ui; -typedef void (APIENTRYP pfn_glSecondaryColor3uiv) (const GLuint*); -extern pfn_glSecondaryColor3uiv fp_glSecondaryColor3uiv; -typedef void (APIENTRYP pfn_glSecondaryColor3us) (GLushort, GLushort, GLushort); -extern pfn_glSecondaryColor3us fp_glSecondaryColor3us; -typedef void (APIENTRYP pfn_glSecondaryColor3usv) (const GLushort*); -extern pfn_glSecondaryColor3usv fp_glSecondaryColor3usv; -typedef void (APIENTRYP pfn_glSecondaryColorPointer) (GLint, GLenum, GLsizei, const void*); -extern pfn_glSecondaryColorPointer fp_glSecondaryColorPointer; -typedef void (APIENTRYP pfn_glWindowPos2d) (GLdouble, GLdouble); -extern pfn_glWindowPos2d fp_glWindowPos2d; -typedef void (APIENTRYP pfn_glWindowPos2dv) (const GLdouble*); -extern pfn_glWindowPos2dv fp_glWindowPos2dv; -typedef void (APIENTRYP pfn_glWindowPos2f) (GLfloat, GLfloat); -extern pfn_glWindowPos2f fp_glWindowPos2f; -typedef void (APIENTRYP pfn_glWindowPos2fv) (const GLfloat*); -extern pfn_glWindowPos2fv fp_glWindowPos2fv; -typedef void (APIENTRYP pfn_glWindowPos2i) (GLint, GLint); -extern pfn_glWindowPos2i fp_glWindowPos2i; -typedef void (APIENTRYP pfn_glWindowPos2iv) (const GLint*); -extern pfn_glWindowPos2iv fp_glWindowPos2iv; -typedef void (APIENTRYP pfn_glWindowPos2s) (GLshort, GLshort); -extern pfn_glWindowPos2s fp_glWindowPos2s; -typedef void (APIENTRYP pfn_glWindowPos2sv) (const GLshort*); -extern pfn_glWindowPos2sv fp_glWindowPos2sv; -typedef void (APIENTRYP pfn_glWindowPos3d) (GLdouble, GLdouble, GLdouble); -extern pfn_glWindowPos3d fp_glWindowPos3d; -typedef void (APIENTRYP pfn_glWindowPos3dv) (const GLdouble*); -extern pfn_glWindowPos3dv fp_glWindowPos3dv; -typedef void (APIENTRYP pfn_glWindowPos3f) (GLfloat, GLfloat, GLfloat); -extern pfn_glWindowPos3f fp_glWindowPos3f; -typedef void (APIENTRYP pfn_glWindowPos3fv) (const GLfloat*); -extern pfn_glWindowPos3fv fp_glWindowPos3fv; -typedef void (APIENTRYP pfn_glWindowPos3i) (GLint, GLint, GLint); -extern pfn_glWindowPos3i fp_glWindowPos3i; -typedef void (APIENTRYP pfn_glWindowPos3iv) (const GLint*); -extern pfn_glWindowPos3iv fp_glWindowPos3iv; -typedef void (APIENTRYP pfn_glWindowPos3s) (GLshort, GLshort, GLshort); -extern pfn_glWindowPos3s fp_glWindowPos3s; -typedef void (APIENTRYP pfn_glWindowPos3sv) (const GLshort*); -extern pfn_glWindowPos3sv fp_glWindowPos3sv; -typedef void (APIENTRYP pfn_glBlendColor) (GLfloat, GLfloat, GLfloat, GLfloat); -extern pfn_glBlendColor fp_glBlendColor; -typedef void (APIENTRYP pfn_glBlendEquation) (GLenum); -extern pfn_glBlendEquation fp_glBlendEquation; - - /* GL_VERSION_1_5 */ -extern GLboolean GLAD_VERSION_1_5; -#define GL_BUFFER_SIZE 0x8764 -#define GL_BUFFER_USAGE 0x8765 -#define GL_QUERY_COUNTER_BITS 0x8864 -#define GL_CURRENT_QUERY 0x8865 -#define GL_QUERY_RESULT 0x8866 -#define GL_QUERY_RESULT_AVAILABLE 0x8867 -#define GL_ARRAY_BUFFER 0x8892 -#define GL_ELEMENT_ARRAY_BUFFER 0x8893 -#define GL_ARRAY_BUFFER_BINDING 0x8894 -#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 -#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F -#define GL_READ_ONLY 0x88B8 -#define GL_WRITE_ONLY 0x88B9 -#define GL_READ_WRITE 0x88BA -#define GL_BUFFER_ACCESS 0x88BB -#define GL_BUFFER_MAPPED 0x88BC -#define GL_BUFFER_MAP_POINTER 0x88BD -#define GL_STREAM_DRAW 0x88E0 -#define GL_STREAM_READ 0x88E1 -#define GL_STREAM_COPY 0x88E2 -#define GL_STATIC_DRAW 0x88E4 -#define GL_STATIC_READ 0x88E5 -#define GL_STATIC_COPY 0x88E6 -#define GL_DYNAMIC_DRAW 0x88E8 -#define GL_DYNAMIC_READ 0x88E9 -#define GL_DYNAMIC_COPY 0x88EA -#define GL_SAMPLES_PASSED 0x8914 -#define GL_SRC1_ALPHA 0x8589 -#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 -#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 -#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 -#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 -#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A -#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B -#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C -#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D -#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E -#define GL_FOG_COORD_SRC 0x8450 -#define GL_FOG_COORD 0x8451 -#define GL_CURRENT_FOG_COORD 0x8453 -#define GL_FOG_COORD_ARRAY_TYPE 0x8454 -#define GL_FOG_COORD_ARRAY_STRIDE 0x8455 -#define GL_FOG_COORD_ARRAY_POINTER 0x8456 -#define GL_FOG_COORD_ARRAY 0x8457 -#define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D -#define GL_SRC0_RGB 0x8580 -#define GL_SRC1_RGB 0x8581 -#define GL_SRC2_RGB 0x8582 -#define GL_SRC0_ALPHA 0x8588 -#define GL_SRC2_ALPHA 0x858A -typedef void (APIENTRYP pfn_glGenQueries) (GLsizei, GLuint*); -extern pfn_glGenQueries fp_glGenQueries; -typedef void (APIENTRYP pfn_glDeleteQueries) (GLsizei, const GLuint*); -extern pfn_glDeleteQueries fp_glDeleteQueries; -typedef GLboolean (APIENTRYP pfn_glIsQuery) (GLuint); -extern pfn_glIsQuery fp_glIsQuery; -typedef void (APIENTRYP pfn_glBeginQuery) (GLenum, GLuint); -extern pfn_glBeginQuery fp_glBeginQuery; -typedef void (APIENTRYP pfn_glEndQuery) (GLenum); -extern pfn_glEndQuery fp_glEndQuery; -typedef void (APIENTRYP pfn_glGetQueryiv) (GLenum, GLenum, GLint*); -extern pfn_glGetQueryiv fp_glGetQueryiv; -typedef void (APIENTRYP pfn_glGetQueryObjectiv) (GLuint, GLenum, GLint*); -extern pfn_glGetQueryObjectiv fp_glGetQueryObjectiv; -typedef void (APIENTRYP pfn_glGetQueryObjectuiv) (GLuint, GLenum, GLuint*); -extern pfn_glGetQueryObjectuiv fp_glGetQueryObjectuiv; -typedef void (APIENTRYP pfn_glBindBuffer) (GLenum, GLuint); -extern pfn_glBindBuffer fp_glBindBuffer; -typedef void (APIENTRYP pfn_glDeleteBuffers) (GLsizei, const GLuint*); -extern pfn_glDeleteBuffers fp_glDeleteBuffers; -typedef void (APIENTRYP pfn_glGenBuffers) (GLsizei, GLuint*); -extern pfn_glGenBuffers fp_glGenBuffers; -typedef GLboolean (APIENTRYP pfn_glIsBuffer) (GLuint); -extern pfn_glIsBuffer fp_glIsBuffer; -typedef void (APIENTRYP pfn_glBufferData) (GLenum, GLsizeiptr, const void*, GLenum); -extern pfn_glBufferData fp_glBufferData; -typedef void (APIENTRYP pfn_glBufferSubData) (GLenum, GLintptr, GLsizeiptr, const void*); -extern pfn_glBufferSubData fp_glBufferSubData; -typedef void (APIENTRYP pfn_glGetBufferSubData) (GLenum, GLintptr, GLsizeiptr, void*); -extern pfn_glGetBufferSubData fp_glGetBufferSubData; -typedef void* (APIENTRYP pfn_glMapBuffer) (GLenum, GLenum); -extern pfn_glMapBuffer fp_glMapBuffer; -typedef GLboolean (APIENTRYP pfn_glUnmapBuffer) (GLenum); -extern pfn_glUnmapBuffer fp_glUnmapBuffer; -typedef void (APIENTRYP pfn_glGetBufferParameteriv) (GLenum, GLenum, GLint*); -extern pfn_glGetBufferParameteriv fp_glGetBufferParameteriv; -typedef void (APIENTRYP pfn_glGetBufferPointerv) (GLenum, GLenum, void**); -extern pfn_glGetBufferPointerv fp_glGetBufferPointerv; - - /* GL_VERSION_2_0 */ -extern GLboolean GLAD_VERSION_2_0; -#define GL_BLEND_EQUATION_RGB 0x8009 -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 -#define GL_CURRENT_VERTEX_ATTRIB 0x8626 -#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 -#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 -#define GL_STENCIL_BACK_FUNC 0x8800 -#define GL_STENCIL_BACK_FAIL 0x8801 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 -#define GL_MAX_DRAW_BUFFERS 0x8824 -#define GL_DRAW_BUFFER0 0x8825 -#define GL_DRAW_BUFFER1 0x8826 -#define GL_DRAW_BUFFER2 0x8827 -#define GL_DRAW_BUFFER3 0x8828 -#define GL_DRAW_BUFFER4 0x8829 -#define GL_DRAW_BUFFER5 0x882A -#define GL_DRAW_BUFFER6 0x882B -#define GL_DRAW_BUFFER7 0x882C -#define GL_DRAW_BUFFER8 0x882D -#define GL_DRAW_BUFFER9 0x882E -#define GL_DRAW_BUFFER10 0x882F -#define GL_DRAW_BUFFER11 0x8830 -#define GL_DRAW_BUFFER12 0x8831 -#define GL_DRAW_BUFFER13 0x8832 -#define GL_DRAW_BUFFER14 0x8833 -#define GL_DRAW_BUFFER15 0x8834 -#define GL_BLEND_EQUATION_ALPHA 0x883D -#define GL_MAX_VERTEX_ATTRIBS 0x8869 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A -#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 -#define GL_FRAGMENT_SHADER 0x8B30 -#define GL_VERTEX_SHADER 0x8B31 -#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 -#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A -#define GL_MAX_VARYING_FLOATS 0x8B4B -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D -#define GL_SHADER_TYPE 0x8B4F -#define GL_FLOAT_VEC2 0x8B50 -#define GL_FLOAT_VEC3 0x8B51 -#define GL_FLOAT_VEC4 0x8B52 -#define GL_INT_VEC2 0x8B53 -#define GL_INT_VEC3 0x8B54 -#define GL_INT_VEC4 0x8B55 -#define GL_BOOL 0x8B56 -#define GL_BOOL_VEC2 0x8B57 -#define GL_BOOL_VEC3 0x8B58 -#define GL_BOOL_VEC4 0x8B59 -#define GL_FLOAT_MAT2 0x8B5A -#define GL_FLOAT_MAT3 0x8B5B -#define GL_FLOAT_MAT4 0x8B5C -#define GL_SAMPLER_1D 0x8B5D -#define GL_SAMPLER_2D 0x8B5E -#define GL_SAMPLER_3D 0x8B5F -#define GL_SAMPLER_CUBE 0x8B60 -#define GL_SAMPLER_1D_SHADOW 0x8B61 -#define GL_SAMPLER_2D_SHADOW 0x8B62 -#define GL_DELETE_STATUS 0x8B80 -#define GL_COMPILE_STATUS 0x8B81 -#define GL_LINK_STATUS 0x8B82 -#define GL_VALIDATE_STATUS 0x8B83 -#define GL_INFO_LOG_LENGTH 0x8B84 -#define GL_ATTACHED_SHADERS 0x8B85 -#define GL_ACTIVE_UNIFORMS 0x8B86 -#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 -#define GL_SHADER_SOURCE_LENGTH 0x8B88 -#define GL_ACTIVE_ATTRIBUTES 0x8B89 -#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B -#define GL_SHADING_LANGUAGE_VERSION 0x8B8C -#define GL_CURRENT_PROGRAM 0x8B8D -#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 -#define GL_LOWER_LEFT 0x8CA1 -#define GL_UPPER_LEFT 0x8CA2 -#define GL_STENCIL_BACK_REF 0x8CA3 -#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 -#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 -#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 -#define GL_POINT_SPRITE 0x8861 -#define GL_COORD_REPLACE 0x8862 -#define GL_MAX_TEXTURE_COORDS 0x8871 -typedef void (APIENTRYP pfn_glBlendEquationSeparate) (GLenum, GLenum); -extern pfn_glBlendEquationSeparate fp_glBlendEquationSeparate; -typedef void (APIENTRYP pfn_glDrawBuffers) (GLsizei, const GLenum*); -extern pfn_glDrawBuffers fp_glDrawBuffers; -typedef void (APIENTRYP pfn_glStencilOpSeparate) (GLenum, GLenum, GLenum, GLenum); -extern pfn_glStencilOpSeparate fp_glStencilOpSeparate; -typedef void (APIENTRYP pfn_glStencilFuncSeparate) (GLenum, GLenum, GLint, GLuint); -extern pfn_glStencilFuncSeparate fp_glStencilFuncSeparate; -typedef void (APIENTRYP pfn_glStencilMaskSeparate) (GLenum, GLuint); -extern pfn_glStencilMaskSeparate fp_glStencilMaskSeparate; -typedef void (APIENTRYP pfn_glAttachShader) (GLuint, GLuint); -extern pfn_glAttachShader fp_glAttachShader; -typedef void (APIENTRYP pfn_glBindAttribLocation) (GLuint, GLuint, const GLchar*); -extern pfn_glBindAttribLocation fp_glBindAttribLocation; -typedef void (APIENTRYP pfn_glCompileShader) (GLuint); -extern pfn_glCompileShader fp_glCompileShader; -typedef GLuint (APIENTRYP pfn_glCreateProgram) (); -extern pfn_glCreateProgram fp_glCreateProgram; -typedef GLuint (APIENTRYP pfn_glCreateShader) (GLenum); -extern pfn_glCreateShader fp_glCreateShader; -typedef void (APIENTRYP pfn_glDeleteProgram) (GLuint); -extern pfn_glDeleteProgram fp_glDeleteProgram; -typedef void (APIENTRYP pfn_glDeleteShader) (GLuint); -extern pfn_glDeleteShader fp_glDeleteShader; -typedef void (APIENTRYP pfn_glDetachShader) (GLuint, GLuint); -extern pfn_glDetachShader fp_glDetachShader; -typedef void (APIENTRYP pfn_glDisableVertexAttribArray) (GLuint); -extern pfn_glDisableVertexAttribArray fp_glDisableVertexAttribArray; -typedef void (APIENTRYP pfn_glEnableVertexAttribArray) (GLuint); -extern pfn_glEnableVertexAttribArray fp_glEnableVertexAttribArray; -typedef void (APIENTRYP pfn_glGetActiveAttrib) (GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*); -extern pfn_glGetActiveAttrib fp_glGetActiveAttrib; -typedef void (APIENTRYP pfn_glGetActiveUniform) (GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*); -extern pfn_glGetActiveUniform fp_glGetActiveUniform; -typedef void (APIENTRYP pfn_glGetAttachedShaders) (GLuint, GLsizei, GLsizei*, GLuint*); -extern pfn_glGetAttachedShaders fp_glGetAttachedShaders; -typedef GLint (APIENTRYP pfn_glGetAttribLocation) (GLuint, const GLchar*); -extern pfn_glGetAttribLocation fp_glGetAttribLocation; -typedef void (APIENTRYP pfn_glGetProgramiv) (GLuint, GLenum, GLint*); -extern pfn_glGetProgramiv fp_glGetProgramiv; -typedef void (APIENTRYP pfn_glGetProgramInfoLog) (GLuint, GLsizei, GLsizei*, GLchar*); -extern pfn_glGetProgramInfoLog fp_glGetProgramInfoLog; -typedef void (APIENTRYP pfn_glGetShaderiv) (GLuint, GLenum, GLint*); -extern pfn_glGetShaderiv fp_glGetShaderiv; -typedef void (APIENTRYP pfn_glGetShaderInfoLog) (GLuint, GLsizei, GLsizei*, GLchar*); -extern pfn_glGetShaderInfoLog fp_glGetShaderInfoLog; -typedef void (APIENTRYP pfn_glGetShaderSource) (GLuint, GLsizei, GLsizei*, GLchar*); -extern pfn_glGetShaderSource fp_glGetShaderSource; -typedef GLint (APIENTRYP pfn_glGetUniformLocation) (GLuint, const GLchar*); -extern pfn_glGetUniformLocation fp_glGetUniformLocation; -typedef void (APIENTRYP pfn_glGetUniformfv) (GLuint, GLint, GLfloat*); -extern pfn_glGetUniformfv fp_glGetUniformfv; -typedef void (APIENTRYP pfn_glGetUniformiv) (GLuint, GLint, GLint*); -extern pfn_glGetUniformiv fp_glGetUniformiv; -typedef void (APIENTRYP pfn_glGetVertexAttribdv) (GLuint, GLenum, GLdouble*); -extern pfn_glGetVertexAttribdv fp_glGetVertexAttribdv; -typedef void (APIENTRYP pfn_glGetVertexAttribfv) (GLuint, GLenum, GLfloat*); -extern pfn_glGetVertexAttribfv fp_glGetVertexAttribfv; -typedef void (APIENTRYP pfn_glGetVertexAttribiv) (GLuint, GLenum, GLint*); -extern pfn_glGetVertexAttribiv fp_glGetVertexAttribiv; -typedef void (APIENTRYP pfn_glGetVertexAttribPointerv) (GLuint, GLenum, void**); -extern pfn_glGetVertexAttribPointerv fp_glGetVertexAttribPointerv; -typedef GLboolean (APIENTRYP pfn_glIsProgram) (GLuint); -extern pfn_glIsProgram fp_glIsProgram; -typedef GLboolean (APIENTRYP pfn_glIsShader) (GLuint); -extern pfn_glIsShader fp_glIsShader; -typedef void (APIENTRYP pfn_glLinkProgram) (GLuint); -extern pfn_glLinkProgram fp_glLinkProgram; -typedef void (APIENTRYP pfn_glShaderSource) (GLuint, GLsizei, const GLchar**, const GLint*); -extern pfn_glShaderSource fp_glShaderSource; -typedef void (APIENTRYP pfn_glUseProgram) (GLuint); -extern pfn_glUseProgram fp_glUseProgram; -typedef void (APIENTRYP pfn_glUniform1f) (GLint, GLfloat); -extern pfn_glUniform1f fp_glUniform1f; -typedef void (APIENTRYP pfn_glUniform2f) (GLint, GLfloat, GLfloat); -extern pfn_glUniform2f fp_glUniform2f; -typedef void (APIENTRYP pfn_glUniform3f) (GLint, GLfloat, GLfloat, GLfloat); -extern pfn_glUniform3f fp_glUniform3f; -typedef void (APIENTRYP pfn_glUniform4f) (GLint, GLfloat, GLfloat, GLfloat, GLfloat); -extern pfn_glUniform4f fp_glUniform4f; -typedef void (APIENTRYP pfn_glUniform1i) (GLint, GLint); -extern pfn_glUniform1i fp_glUniform1i; -typedef void (APIENTRYP pfn_glUniform2i) (GLint, GLint, GLint); -extern pfn_glUniform2i fp_glUniform2i; -typedef void (APIENTRYP pfn_glUniform3i) (GLint, GLint, GLint, GLint); -extern pfn_glUniform3i fp_glUniform3i; -typedef void (APIENTRYP pfn_glUniform4i) (GLint, GLint, GLint, GLint, GLint); -extern pfn_glUniform4i fp_glUniform4i; -typedef void (APIENTRYP pfn_glUniform1fv) (GLint, GLsizei, const GLfloat*); -extern pfn_glUniform1fv fp_glUniform1fv; -typedef void (APIENTRYP pfn_glUniform2fv) (GLint, GLsizei, const GLfloat*); -extern pfn_glUniform2fv fp_glUniform2fv; -typedef void (APIENTRYP pfn_glUniform3fv) (GLint, GLsizei, const GLfloat*); -extern pfn_glUniform3fv fp_glUniform3fv; -typedef void (APIENTRYP pfn_glUniform4fv) (GLint, GLsizei, const GLfloat*); -extern pfn_glUniform4fv fp_glUniform4fv; -typedef void (APIENTRYP pfn_glUniform1iv) (GLint, GLsizei, const GLint*); -extern pfn_glUniform1iv fp_glUniform1iv; -typedef void (APIENTRYP pfn_glUniform2iv) (GLint, GLsizei, const GLint*); -extern pfn_glUniform2iv fp_glUniform2iv; -typedef void (APIENTRYP pfn_glUniform3iv) (GLint, GLsizei, const GLint*); -extern pfn_glUniform3iv fp_glUniform3iv; -typedef void (APIENTRYP pfn_glUniform4iv) (GLint, GLsizei, const GLint*); -extern pfn_glUniform4iv fp_glUniform4iv; -typedef void (APIENTRYP pfn_glUniformMatrix2fv) (GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glUniformMatrix2fv fp_glUniformMatrix2fv; -typedef void (APIENTRYP pfn_glUniformMatrix3fv) (GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glUniformMatrix3fv fp_glUniformMatrix3fv; -typedef void (APIENTRYP pfn_glUniformMatrix4fv) (GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glUniformMatrix4fv fp_glUniformMatrix4fv; -typedef void (APIENTRYP pfn_glValidateProgram) (GLuint); -extern pfn_glValidateProgram fp_glValidateProgram; -typedef void (APIENTRYP pfn_glVertexAttrib1d) (GLuint, GLdouble); -extern pfn_glVertexAttrib1d fp_glVertexAttrib1d; -typedef void (APIENTRYP pfn_glVertexAttrib1dv) (GLuint, const GLdouble*); -extern pfn_glVertexAttrib1dv fp_glVertexAttrib1dv; -typedef void (APIENTRYP pfn_glVertexAttrib1f) (GLuint, GLfloat); -extern pfn_glVertexAttrib1f fp_glVertexAttrib1f; -typedef void (APIENTRYP pfn_glVertexAttrib1fv) (GLuint, const GLfloat*); -extern pfn_glVertexAttrib1fv fp_glVertexAttrib1fv; -typedef void (APIENTRYP pfn_glVertexAttrib1s) (GLuint, GLshort); -extern pfn_glVertexAttrib1s fp_glVertexAttrib1s; -typedef void (APIENTRYP pfn_glVertexAttrib1sv) (GLuint, const GLshort*); -extern pfn_glVertexAttrib1sv fp_glVertexAttrib1sv; -typedef void (APIENTRYP pfn_glVertexAttrib2d) (GLuint, GLdouble, GLdouble); -extern pfn_glVertexAttrib2d fp_glVertexAttrib2d; -typedef void (APIENTRYP pfn_glVertexAttrib2dv) (GLuint, const GLdouble*); -extern pfn_glVertexAttrib2dv fp_glVertexAttrib2dv; -typedef void (APIENTRYP pfn_glVertexAttrib2f) (GLuint, GLfloat, GLfloat); -extern pfn_glVertexAttrib2f fp_glVertexAttrib2f; -typedef void (APIENTRYP pfn_glVertexAttrib2fv) (GLuint, const GLfloat*); -extern pfn_glVertexAttrib2fv fp_glVertexAttrib2fv; -typedef void (APIENTRYP pfn_glVertexAttrib2s) (GLuint, GLshort, GLshort); -extern pfn_glVertexAttrib2s fp_glVertexAttrib2s; -typedef void (APIENTRYP pfn_glVertexAttrib2sv) (GLuint, const GLshort*); -extern pfn_glVertexAttrib2sv fp_glVertexAttrib2sv; -typedef void (APIENTRYP pfn_glVertexAttrib3d) (GLuint, GLdouble, GLdouble, GLdouble); -extern pfn_glVertexAttrib3d fp_glVertexAttrib3d; -typedef void (APIENTRYP pfn_glVertexAttrib3dv) (GLuint, const GLdouble*); -extern pfn_glVertexAttrib3dv fp_glVertexAttrib3dv; -typedef void (APIENTRYP pfn_glVertexAttrib3f) (GLuint, GLfloat, GLfloat, GLfloat); -extern pfn_glVertexAttrib3f fp_glVertexAttrib3f; -typedef void (APIENTRYP pfn_glVertexAttrib3fv) (GLuint, const GLfloat*); -extern pfn_glVertexAttrib3fv fp_glVertexAttrib3fv; -typedef void (APIENTRYP pfn_glVertexAttrib3s) (GLuint, GLshort, GLshort, GLshort); -extern pfn_glVertexAttrib3s fp_glVertexAttrib3s; -typedef void (APIENTRYP pfn_glVertexAttrib3sv) (GLuint, const GLshort*); -extern pfn_glVertexAttrib3sv fp_glVertexAttrib3sv; -typedef void (APIENTRYP pfn_glVertexAttrib4Nbv) (GLuint, const GLbyte*); -extern pfn_glVertexAttrib4Nbv fp_glVertexAttrib4Nbv; -typedef void (APIENTRYP pfn_glVertexAttrib4Niv) (GLuint, const GLint*); -extern pfn_glVertexAttrib4Niv fp_glVertexAttrib4Niv; -typedef void (APIENTRYP pfn_glVertexAttrib4Nsv) (GLuint, const GLshort*); -extern pfn_glVertexAttrib4Nsv fp_glVertexAttrib4Nsv; -typedef void (APIENTRYP pfn_glVertexAttrib4Nub) (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); -extern pfn_glVertexAttrib4Nub fp_glVertexAttrib4Nub; -typedef void (APIENTRYP pfn_glVertexAttrib4Nubv) (GLuint, const GLubyte*); -extern pfn_glVertexAttrib4Nubv fp_glVertexAttrib4Nubv; -typedef void (APIENTRYP pfn_glVertexAttrib4Nuiv) (GLuint, const GLuint*); -extern pfn_glVertexAttrib4Nuiv fp_glVertexAttrib4Nuiv; -typedef void (APIENTRYP pfn_glVertexAttrib4Nusv) (GLuint, const GLushort*); -extern pfn_glVertexAttrib4Nusv fp_glVertexAttrib4Nusv; -typedef void (APIENTRYP pfn_glVertexAttrib4bv) (GLuint, const GLbyte*); -extern pfn_glVertexAttrib4bv fp_glVertexAttrib4bv; -typedef void (APIENTRYP pfn_glVertexAttrib4d) (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -extern pfn_glVertexAttrib4d fp_glVertexAttrib4d; -typedef void (APIENTRYP pfn_glVertexAttrib4dv) (GLuint, const GLdouble*); -extern pfn_glVertexAttrib4dv fp_glVertexAttrib4dv; -typedef void (APIENTRYP pfn_glVertexAttrib4f) (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -extern pfn_glVertexAttrib4f fp_glVertexAttrib4f; -typedef void (APIENTRYP pfn_glVertexAttrib4fv) (GLuint, const GLfloat*); -extern pfn_glVertexAttrib4fv fp_glVertexAttrib4fv; -typedef void (APIENTRYP pfn_glVertexAttrib4iv) (GLuint, const GLint*); -extern pfn_glVertexAttrib4iv fp_glVertexAttrib4iv; -typedef void (APIENTRYP pfn_glVertexAttrib4s) (GLuint, GLshort, GLshort, GLshort, GLshort); -extern pfn_glVertexAttrib4s fp_glVertexAttrib4s; -typedef void (APIENTRYP pfn_glVertexAttrib4sv) (GLuint, const GLshort*); -extern pfn_glVertexAttrib4sv fp_glVertexAttrib4sv; -typedef void (APIENTRYP pfn_glVertexAttrib4ubv) (GLuint, const GLubyte*); -extern pfn_glVertexAttrib4ubv fp_glVertexAttrib4ubv; -typedef void (APIENTRYP pfn_glVertexAttrib4uiv) (GLuint, const GLuint*); -extern pfn_glVertexAttrib4uiv fp_glVertexAttrib4uiv; -typedef void (APIENTRYP pfn_glVertexAttrib4usv) (GLuint, const GLushort*); -extern pfn_glVertexAttrib4usv fp_glVertexAttrib4usv; -typedef void (APIENTRYP pfn_glVertexAttribPointer) (GLuint, GLint, GLenum, GLboolean, GLsizei, const void*); -extern pfn_glVertexAttribPointer fp_glVertexAttribPointer; - - /* GL_VERSION_2_1 */ -extern GLboolean GLAD_VERSION_2_1; -#define GL_PIXEL_PACK_BUFFER 0x88EB -#define GL_PIXEL_UNPACK_BUFFER 0x88EC -#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED -#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF -#define GL_FLOAT_MAT2x3 0x8B65 -#define GL_FLOAT_MAT2x4 0x8B66 -#define GL_FLOAT_MAT3x2 0x8B67 -#define GL_FLOAT_MAT3x4 0x8B68 -#define GL_FLOAT_MAT4x2 0x8B69 -#define GL_FLOAT_MAT4x3 0x8B6A -#define GL_SRGB 0x8C40 -#define GL_SRGB8 0x8C41 -#define GL_SRGB_ALPHA 0x8C42 -#define GL_SRGB8_ALPHA8 0x8C43 -#define GL_COMPRESSED_SRGB 0x8C48 -#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 -#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F -#define GL_SLUMINANCE_ALPHA 0x8C44 -#define GL_SLUMINANCE8_ALPHA8 0x8C45 -#define GL_SLUMINANCE 0x8C46 -#define GL_SLUMINANCE8 0x8C47 -#define GL_COMPRESSED_SLUMINANCE 0x8C4A -#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B -typedef void (APIENTRYP pfn_glUniformMatrix2x3fv) (GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glUniformMatrix2x3fv fp_glUniformMatrix2x3fv; -typedef void (APIENTRYP pfn_glUniformMatrix3x2fv) (GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glUniformMatrix3x2fv fp_glUniformMatrix3x2fv; -typedef void (APIENTRYP pfn_glUniformMatrix2x4fv) (GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glUniformMatrix2x4fv fp_glUniformMatrix2x4fv; -typedef void (APIENTRYP pfn_glUniformMatrix4x2fv) (GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glUniformMatrix4x2fv fp_glUniformMatrix4x2fv; -typedef void (APIENTRYP pfn_glUniformMatrix3x4fv) (GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glUniformMatrix3x4fv fp_glUniformMatrix3x4fv; -typedef void (APIENTRYP pfn_glUniformMatrix4x3fv) (GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glUniformMatrix4x3fv fp_glUniformMatrix4x3fv; - - /* GL_VERSION_3_0 */ -extern GLboolean GLAD_VERSION_3_0; -#define GL_COMPARE_REF_TO_TEXTURE 0x884E -#define GL_CLIP_DISTANCE0 0x3000 -#define GL_CLIP_DISTANCE1 0x3001 -#define GL_CLIP_DISTANCE2 0x3002 -#define GL_CLIP_DISTANCE3 0x3003 -#define GL_CLIP_DISTANCE4 0x3004 -#define GL_CLIP_DISTANCE5 0x3005 -#define GL_CLIP_DISTANCE6 0x3006 -#define GL_CLIP_DISTANCE7 0x3007 -#define GL_MAX_CLIP_DISTANCES 0x0D32 -#define GL_MAJOR_VERSION 0x821B -#define GL_MINOR_VERSION 0x821C -#define GL_NUM_EXTENSIONS 0x821D -#define GL_CONTEXT_FLAGS 0x821E -#define GL_COMPRESSED_RED 0x8225 -#define GL_COMPRESSED_RG 0x8226 -#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001 -#define GL_RGBA32F 0x8814 -#define GL_RGB32F 0x8815 -#define GL_RGBA16F 0x881A -#define GL_RGB16F 0x881B -#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD -#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF -#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 -#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 -#define GL_CLAMP_READ_COLOR 0x891C -#define GL_FIXED_ONLY 0x891D -#define GL_MAX_VARYING_COMPONENTS 0x8B4B -#define GL_TEXTURE_1D_ARRAY 0x8C18 -#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19 -#define GL_TEXTURE_2D_ARRAY 0x8C1A -#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B -#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C -#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D -#define GL_R11F_G11F_B10F 0x8C3A -#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B -#define GL_RGB9_E5 0x8C3D -#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E -#define GL_TEXTURE_SHARED_SIZE 0x8C3F -#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76 -#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80 -#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83 -#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84 -#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85 -#define GL_PRIMITIVES_GENERATED 0x8C87 -#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 -#define GL_RASTERIZER_DISCARD 0x8C89 -#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B -#define GL_INTERLEAVED_ATTRIBS 0x8C8C -#define GL_SEPARATE_ATTRIBS 0x8C8D -#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E -#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F -#define GL_RGBA32UI 0x8D70 -#define GL_RGB32UI 0x8D71 -#define GL_RGBA16UI 0x8D76 -#define GL_RGB16UI 0x8D77 -#define GL_RGBA8UI 0x8D7C -#define GL_RGB8UI 0x8D7D -#define GL_RGBA32I 0x8D82 -#define GL_RGB32I 0x8D83 -#define GL_RGBA16I 0x8D88 -#define GL_RGB16I 0x8D89 -#define GL_RGBA8I 0x8D8E -#define GL_RGB8I 0x8D8F -#define GL_RED_INTEGER 0x8D94 -#define GL_GREEN_INTEGER 0x8D95 -#define GL_BLUE_INTEGER 0x8D96 -#define GL_RGB_INTEGER 0x8D98 -#define GL_RGBA_INTEGER 0x8D99 -#define GL_BGR_INTEGER 0x8D9A -#define GL_BGRA_INTEGER 0x8D9B -#define GL_SAMPLER_1D_ARRAY 0x8DC0 -#define GL_SAMPLER_2D_ARRAY 0x8DC1 -#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3 -#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 -#define GL_SAMPLER_CUBE_SHADOW 0x8DC5 -#define GL_UNSIGNED_INT_VEC2 0x8DC6 -#define GL_UNSIGNED_INT_VEC3 0x8DC7 -#define GL_UNSIGNED_INT_VEC4 0x8DC8 -#define GL_INT_SAMPLER_1D 0x8DC9 -#define GL_INT_SAMPLER_2D 0x8DCA -#define GL_INT_SAMPLER_3D 0x8DCB -#define GL_INT_SAMPLER_CUBE 0x8DCC -#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE -#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF -#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1 -#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 -#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 -#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 -#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6 -#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 -#define GL_QUERY_WAIT 0x8E13 -#define GL_QUERY_NO_WAIT 0x8E14 -#define GL_QUERY_BY_REGION_WAIT 0x8E15 -#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16 -#define GL_BUFFER_ACCESS_FLAGS 0x911F -#define GL_BUFFER_MAP_LENGTH 0x9120 -#define GL_BUFFER_MAP_OFFSET 0x9121 -#define GL_DEPTH_COMPONENT32F 0x8CAC -#define GL_DEPTH32F_STENCIL8 0x8CAD -#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD -#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 -#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 -#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 -#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 -#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 -#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 -#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 -#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 -#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 -#define GL_FRAMEBUFFER_DEFAULT 0x8218 -#define GL_FRAMEBUFFER_UNDEFINED 0x8219 -#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A -#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 -#define GL_DEPTH_STENCIL 0x84F9 -#define GL_UNSIGNED_INT_24_8 0x84FA -#define GL_DEPTH24_STENCIL8 0x88F0 -#define GL_TEXTURE_STENCIL_SIZE 0x88F1 -#define GL_TEXTURE_RED_TYPE 0x8C10 -#define GL_TEXTURE_GREEN_TYPE 0x8C11 -#define GL_TEXTURE_BLUE_TYPE 0x8C12 -#define GL_TEXTURE_ALPHA_TYPE 0x8C13 -#define GL_TEXTURE_DEPTH_TYPE 0x8C16 -#define GL_UNSIGNED_NORMALIZED 0x8C17 -#define GL_FRAMEBUFFER_BINDING 0x8CA6 -#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6 -#define GL_RENDERBUFFER_BINDING 0x8CA7 -#define GL_READ_FRAMEBUFFER 0x8CA8 -#define GL_DRAW_FRAMEBUFFER 0x8CA9 -#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA -#define GL_RENDERBUFFER_SAMPLES 0x8CAB -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 -#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB -#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC -#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD -#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF -#define GL_COLOR_ATTACHMENT0 0x8CE0 -#define GL_COLOR_ATTACHMENT1 0x8CE1 -#define GL_COLOR_ATTACHMENT2 0x8CE2 -#define GL_COLOR_ATTACHMENT3 0x8CE3 -#define GL_COLOR_ATTACHMENT4 0x8CE4 -#define GL_COLOR_ATTACHMENT5 0x8CE5 -#define GL_COLOR_ATTACHMENT6 0x8CE6 -#define GL_COLOR_ATTACHMENT7 0x8CE7 -#define GL_COLOR_ATTACHMENT8 0x8CE8 -#define GL_COLOR_ATTACHMENT9 0x8CE9 -#define GL_COLOR_ATTACHMENT10 0x8CEA -#define GL_COLOR_ATTACHMENT11 0x8CEB -#define GL_COLOR_ATTACHMENT12 0x8CEC -#define GL_COLOR_ATTACHMENT13 0x8CED -#define GL_COLOR_ATTACHMENT14 0x8CEE -#define GL_COLOR_ATTACHMENT15 0x8CEF -#define GL_COLOR_ATTACHMENT16 0x8CF0 -#define GL_COLOR_ATTACHMENT17 0x8CF1 -#define GL_COLOR_ATTACHMENT18 0x8CF2 -#define GL_COLOR_ATTACHMENT19 0x8CF3 -#define GL_COLOR_ATTACHMENT20 0x8CF4 -#define GL_COLOR_ATTACHMENT21 0x8CF5 -#define GL_COLOR_ATTACHMENT22 0x8CF6 -#define GL_COLOR_ATTACHMENT23 0x8CF7 -#define GL_COLOR_ATTACHMENT24 0x8CF8 -#define GL_COLOR_ATTACHMENT25 0x8CF9 -#define GL_COLOR_ATTACHMENT26 0x8CFA -#define GL_COLOR_ATTACHMENT27 0x8CFB -#define GL_COLOR_ATTACHMENT28 0x8CFC -#define GL_COLOR_ATTACHMENT29 0x8CFD -#define GL_COLOR_ATTACHMENT30 0x8CFE -#define GL_COLOR_ATTACHMENT31 0x8CFF -#define GL_DEPTH_ATTACHMENT 0x8D00 -#define GL_STENCIL_ATTACHMENT 0x8D20 -#define GL_FRAMEBUFFER 0x8D40 -#define GL_RENDERBUFFER 0x8D41 -#define GL_RENDERBUFFER_WIDTH 0x8D42 -#define GL_RENDERBUFFER_HEIGHT 0x8D43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 -#define GL_STENCIL_INDEX1 0x8D46 -#define GL_STENCIL_INDEX4 0x8D47 -#define GL_STENCIL_INDEX8 0x8D48 -#define GL_STENCIL_INDEX16 0x8D49 -#define GL_RENDERBUFFER_RED_SIZE 0x8D50 -#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 -#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 -#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 -#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 -#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 -#define GL_MAX_SAMPLES 0x8D57 -#define GL_INDEX 0x8222 -#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14 -#define GL_TEXTURE_INTENSITY_TYPE 0x8C15 -#define GL_FRAMEBUFFER_SRGB 0x8DB9 -#define GL_HALF_FLOAT 0x140B -#define GL_MAP_READ_BIT 0x0001 -#define GL_MAP_WRITE_BIT 0x0002 -#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 -#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 -#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 -#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 -#define GL_COMPRESSED_RED_RGTC1 0x8DBB -#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC -#define GL_COMPRESSED_RG_RGTC2 0x8DBD -#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE -#define GL_RG 0x8227 -#define GL_RG_INTEGER 0x8228 -#define GL_R8 0x8229 -#define GL_R16 0x822A -#define GL_RG8 0x822B -#define GL_RG16 0x822C -#define GL_R16F 0x822D -#define GL_R32F 0x822E -#define GL_RG16F 0x822F -#define GL_RG32F 0x8230 -#define GL_R8I 0x8231 -#define GL_R8UI 0x8232 -#define GL_R16I 0x8233 -#define GL_R16UI 0x8234 -#define GL_R32I 0x8235 -#define GL_R32UI 0x8236 -#define GL_RG8I 0x8237 -#define GL_RG8UI 0x8238 -#define GL_RG16I 0x8239 -#define GL_RG16UI 0x823A -#define GL_RG32I 0x823B -#define GL_RG32UI 0x823C -#define GL_VERTEX_ARRAY_BINDING 0x85B5 -#define GL_CLAMP_VERTEX_COLOR 0x891A -#define GL_CLAMP_FRAGMENT_COLOR 0x891B -#define GL_ALPHA_INTEGER 0x8D97 -typedef void (APIENTRYP pfn_glColorMaski) (GLuint, GLboolean, GLboolean, GLboolean, GLboolean); -extern pfn_glColorMaski fp_glColorMaski; -typedef void (APIENTRYP pfn_glGetBooleani_v) (GLenum, GLuint, GLboolean*); -extern pfn_glGetBooleani_v fp_glGetBooleani_v; -typedef void (APIENTRYP pfn_glGetIntegeri_v) (GLenum, GLuint, GLint*); -extern pfn_glGetIntegeri_v fp_glGetIntegeri_v; -typedef void (APIENTRYP pfn_glEnablei) (GLenum, GLuint); -extern pfn_glEnablei fp_glEnablei; -typedef void (APIENTRYP pfn_glDisablei) (GLenum, GLuint); -extern pfn_glDisablei fp_glDisablei; -typedef GLboolean (APIENTRYP pfn_glIsEnabledi) (GLenum, GLuint); -extern pfn_glIsEnabledi fp_glIsEnabledi; -typedef void (APIENTRYP pfn_glBeginTransformFeedback) (GLenum); -extern pfn_glBeginTransformFeedback fp_glBeginTransformFeedback; -typedef void (APIENTRYP pfn_glEndTransformFeedback) (); -extern pfn_glEndTransformFeedback fp_glEndTransformFeedback; -typedef void (APIENTRYP pfn_glBindBufferRange) (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr); -extern pfn_glBindBufferRange fp_glBindBufferRange; -typedef void (APIENTRYP pfn_glBindBufferBase) (GLenum, GLuint, GLuint); -extern pfn_glBindBufferBase fp_glBindBufferBase; -typedef void (APIENTRYP pfn_glTransformFeedbackVaryings) (GLuint, GLsizei, const GLchar**, GLenum); -extern pfn_glTransformFeedbackVaryings fp_glTransformFeedbackVaryings; -typedef void (APIENTRYP pfn_glGetTransformFeedbackVarying) (GLuint, GLuint, GLsizei, GLsizei*, GLsizei*, GLenum*, GLchar*); -extern pfn_glGetTransformFeedbackVarying fp_glGetTransformFeedbackVarying; -typedef void (APIENTRYP pfn_glClampColor) (GLenum, GLenum); -extern pfn_glClampColor fp_glClampColor; -typedef void (APIENTRYP pfn_glBeginConditionalRender) (GLuint, GLenum); -extern pfn_glBeginConditionalRender fp_glBeginConditionalRender; -typedef void (APIENTRYP pfn_glEndConditionalRender) (); -extern pfn_glEndConditionalRender fp_glEndConditionalRender; -typedef void (APIENTRYP pfn_glVertexAttribIPointer) (GLuint, GLint, GLenum, GLsizei, const void*); -extern pfn_glVertexAttribIPointer fp_glVertexAttribIPointer; -typedef void (APIENTRYP pfn_glGetVertexAttribIiv) (GLuint, GLenum, GLint*); -extern pfn_glGetVertexAttribIiv fp_glGetVertexAttribIiv; -typedef void (APIENTRYP pfn_glGetVertexAttribIuiv) (GLuint, GLenum, GLuint*); -extern pfn_glGetVertexAttribIuiv fp_glGetVertexAttribIuiv; -typedef void (APIENTRYP pfn_glVertexAttribI1i) (GLuint, GLint); -extern pfn_glVertexAttribI1i fp_glVertexAttribI1i; -typedef void (APIENTRYP pfn_glVertexAttribI2i) (GLuint, GLint, GLint); -extern pfn_glVertexAttribI2i fp_glVertexAttribI2i; -typedef void (APIENTRYP pfn_glVertexAttribI3i) (GLuint, GLint, GLint, GLint); -extern pfn_glVertexAttribI3i fp_glVertexAttribI3i; -typedef void (APIENTRYP pfn_glVertexAttribI4i) (GLuint, GLint, GLint, GLint, GLint); -extern pfn_glVertexAttribI4i fp_glVertexAttribI4i; -typedef void (APIENTRYP pfn_glVertexAttribI1ui) (GLuint, GLuint); -extern pfn_glVertexAttribI1ui fp_glVertexAttribI1ui; -typedef void (APIENTRYP pfn_glVertexAttribI2ui) (GLuint, GLuint, GLuint); -extern pfn_glVertexAttribI2ui fp_glVertexAttribI2ui; -typedef void (APIENTRYP pfn_glVertexAttribI3ui) (GLuint, GLuint, GLuint, GLuint); -extern pfn_glVertexAttribI3ui fp_glVertexAttribI3ui; -typedef void (APIENTRYP pfn_glVertexAttribI4ui) (GLuint, GLuint, GLuint, GLuint, GLuint); -extern pfn_glVertexAttribI4ui fp_glVertexAttribI4ui; -typedef void (APIENTRYP pfn_glVertexAttribI1iv) (GLuint, const GLint*); -extern pfn_glVertexAttribI1iv fp_glVertexAttribI1iv; -typedef void (APIENTRYP pfn_glVertexAttribI2iv) (GLuint, const GLint*); -extern pfn_glVertexAttribI2iv fp_glVertexAttribI2iv; -typedef void (APIENTRYP pfn_glVertexAttribI3iv) (GLuint, const GLint*); -extern pfn_glVertexAttribI3iv fp_glVertexAttribI3iv; -typedef void (APIENTRYP pfn_glVertexAttribI4iv) (GLuint, const GLint*); -extern pfn_glVertexAttribI4iv fp_glVertexAttribI4iv; -typedef void (APIENTRYP pfn_glVertexAttribI1uiv) (GLuint, const GLuint*); -extern pfn_glVertexAttribI1uiv fp_glVertexAttribI1uiv; -typedef void (APIENTRYP pfn_glVertexAttribI2uiv) (GLuint, const GLuint*); -extern pfn_glVertexAttribI2uiv fp_glVertexAttribI2uiv; -typedef void (APIENTRYP pfn_glVertexAttribI3uiv) (GLuint, const GLuint*); -extern pfn_glVertexAttribI3uiv fp_glVertexAttribI3uiv; -typedef void (APIENTRYP pfn_glVertexAttribI4uiv) (GLuint, const GLuint*); -extern pfn_glVertexAttribI4uiv fp_glVertexAttribI4uiv; -typedef void (APIENTRYP pfn_glVertexAttribI4bv) (GLuint, const GLbyte*); -extern pfn_glVertexAttribI4bv fp_glVertexAttribI4bv; -typedef void (APIENTRYP pfn_glVertexAttribI4sv) (GLuint, const GLshort*); -extern pfn_glVertexAttribI4sv fp_glVertexAttribI4sv; -typedef void (APIENTRYP pfn_glVertexAttribI4ubv) (GLuint, const GLubyte*); -extern pfn_glVertexAttribI4ubv fp_glVertexAttribI4ubv; -typedef void (APIENTRYP pfn_glVertexAttribI4usv) (GLuint, const GLushort*); -extern pfn_glVertexAttribI4usv fp_glVertexAttribI4usv; -typedef void (APIENTRYP pfn_glGetUniformuiv) (GLuint, GLint, GLuint*); -extern pfn_glGetUniformuiv fp_glGetUniformuiv; -typedef void (APIENTRYP pfn_glBindFragDataLocation) (GLuint, GLuint, const GLchar*); -extern pfn_glBindFragDataLocation fp_glBindFragDataLocation; -typedef GLint (APIENTRYP pfn_glGetFragDataLocation) (GLuint, const GLchar*); -extern pfn_glGetFragDataLocation fp_glGetFragDataLocation; -typedef void (APIENTRYP pfn_glUniform1ui) (GLint, GLuint); -extern pfn_glUniform1ui fp_glUniform1ui; -typedef void (APIENTRYP pfn_glUniform2ui) (GLint, GLuint, GLuint); -extern pfn_glUniform2ui fp_glUniform2ui; -typedef void (APIENTRYP pfn_glUniform3ui) (GLint, GLuint, GLuint, GLuint); -extern pfn_glUniform3ui fp_glUniform3ui; -typedef void (APIENTRYP pfn_glUniform4ui) (GLint, GLuint, GLuint, GLuint, GLuint); -extern pfn_glUniform4ui fp_glUniform4ui; -typedef void (APIENTRYP pfn_glUniform1uiv) (GLint, GLsizei, const GLuint*); -extern pfn_glUniform1uiv fp_glUniform1uiv; -typedef void (APIENTRYP pfn_glUniform2uiv) (GLint, GLsizei, const GLuint*); -extern pfn_glUniform2uiv fp_glUniform2uiv; -typedef void (APIENTRYP pfn_glUniform3uiv) (GLint, GLsizei, const GLuint*); -extern pfn_glUniform3uiv fp_glUniform3uiv; -typedef void (APIENTRYP pfn_glUniform4uiv) (GLint, GLsizei, const GLuint*); -extern pfn_glUniform4uiv fp_glUniform4uiv; -typedef void (APIENTRYP pfn_glTexParameterIiv) (GLenum, GLenum, const GLint*); -extern pfn_glTexParameterIiv fp_glTexParameterIiv; -typedef void (APIENTRYP pfn_glTexParameterIuiv) (GLenum, GLenum, const GLuint*); -extern pfn_glTexParameterIuiv fp_glTexParameterIuiv; -typedef void (APIENTRYP pfn_glGetTexParameterIiv) (GLenum, GLenum, GLint*); -extern pfn_glGetTexParameterIiv fp_glGetTexParameterIiv; -typedef void (APIENTRYP pfn_glGetTexParameterIuiv) (GLenum, GLenum, GLuint*); -extern pfn_glGetTexParameterIuiv fp_glGetTexParameterIuiv; -typedef void (APIENTRYP pfn_glClearBufferiv) (GLenum, GLint, const GLint*); -extern pfn_glClearBufferiv fp_glClearBufferiv; -typedef void (APIENTRYP pfn_glClearBufferuiv) (GLenum, GLint, const GLuint*); -extern pfn_glClearBufferuiv fp_glClearBufferuiv; -typedef void (APIENTRYP pfn_glClearBufferfv) (GLenum, GLint, const GLfloat*); -extern pfn_glClearBufferfv fp_glClearBufferfv; -typedef void (APIENTRYP pfn_glClearBufferfi) (GLenum, GLint, GLfloat, GLint); -extern pfn_glClearBufferfi fp_glClearBufferfi; -typedef const GLubyte* (APIENTRYP pfn_glGetStringi) (GLenum, GLuint); -extern pfn_glGetStringi fp_glGetStringi; -typedef GLboolean (APIENTRYP pfn_glIsRenderbuffer) (GLuint); -extern pfn_glIsRenderbuffer fp_glIsRenderbuffer; -typedef void (APIENTRYP pfn_glBindRenderbuffer) (GLenum, GLuint); -extern pfn_glBindRenderbuffer fp_glBindRenderbuffer; -typedef void (APIENTRYP pfn_glDeleteRenderbuffers) (GLsizei, const GLuint*); -extern pfn_glDeleteRenderbuffers fp_glDeleteRenderbuffers; -typedef void (APIENTRYP pfn_glGenRenderbuffers) (GLsizei, GLuint*); -extern pfn_glGenRenderbuffers fp_glGenRenderbuffers; -typedef void (APIENTRYP pfn_glRenderbufferStorage) (GLenum, GLenum, GLsizei, GLsizei); -extern pfn_glRenderbufferStorage fp_glRenderbufferStorage; -typedef void (APIENTRYP pfn_glGetRenderbufferParameteriv) (GLenum, GLenum, GLint*); -extern pfn_glGetRenderbufferParameteriv fp_glGetRenderbufferParameteriv; -typedef GLboolean (APIENTRYP pfn_glIsFramebuffer) (GLuint); -extern pfn_glIsFramebuffer fp_glIsFramebuffer; -typedef void (APIENTRYP pfn_glBindFramebuffer) (GLenum, GLuint); -extern pfn_glBindFramebuffer fp_glBindFramebuffer; -typedef void (APIENTRYP pfn_glDeleteFramebuffers) (GLsizei, const GLuint*); -extern pfn_glDeleteFramebuffers fp_glDeleteFramebuffers; -typedef void (APIENTRYP pfn_glGenFramebuffers) (GLsizei, GLuint*); -extern pfn_glGenFramebuffers fp_glGenFramebuffers; -typedef GLenum (APIENTRYP pfn_glCheckFramebufferStatus) (GLenum); -extern pfn_glCheckFramebufferStatus fp_glCheckFramebufferStatus; -typedef void (APIENTRYP pfn_glFramebufferTexture1D) (GLenum, GLenum, GLenum, GLuint, GLint); -extern pfn_glFramebufferTexture1D fp_glFramebufferTexture1D; -typedef void (APIENTRYP pfn_glFramebufferTexture2D) (GLenum, GLenum, GLenum, GLuint, GLint); -extern pfn_glFramebufferTexture2D fp_glFramebufferTexture2D; -typedef void (APIENTRYP pfn_glFramebufferTexture3D) (GLenum, GLenum, GLenum, GLuint, GLint, GLint); -extern pfn_glFramebufferTexture3D fp_glFramebufferTexture3D; -typedef void (APIENTRYP pfn_glFramebufferRenderbuffer) (GLenum, GLenum, GLenum, GLuint); -extern pfn_glFramebufferRenderbuffer fp_glFramebufferRenderbuffer; -typedef void (APIENTRYP pfn_glGetFramebufferAttachmentParameteriv) (GLenum, GLenum, GLenum, GLint*); -extern pfn_glGetFramebufferAttachmentParameteriv fp_glGetFramebufferAttachmentParameteriv; -typedef void (APIENTRYP pfn_glGenerateMipmap) (GLenum); -extern pfn_glGenerateMipmap fp_glGenerateMipmap; -typedef void (APIENTRYP pfn_glBlitFramebuffer) (GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum); -extern pfn_glBlitFramebuffer fp_glBlitFramebuffer; -typedef void (APIENTRYP pfn_glRenderbufferStorageMultisample) (GLenum, GLsizei, GLenum, GLsizei, GLsizei); -extern pfn_glRenderbufferStorageMultisample fp_glRenderbufferStorageMultisample; -typedef void (APIENTRYP pfn_glFramebufferTextureLayer) (GLenum, GLenum, GLuint, GLint, GLint); -extern pfn_glFramebufferTextureLayer fp_glFramebufferTextureLayer; -typedef void* (APIENTRYP pfn_glMapBufferRange) (GLenum, GLintptr, GLsizeiptr, GLbitfield); -extern pfn_glMapBufferRange fp_glMapBufferRange; -typedef void (APIENTRYP pfn_glFlushMappedBufferRange) (GLenum, GLintptr, GLsizeiptr); -extern pfn_glFlushMappedBufferRange fp_glFlushMappedBufferRange; -typedef void (APIENTRYP pfn_glBindVertexArray) (GLuint); -extern pfn_glBindVertexArray fp_glBindVertexArray; -typedef void (APIENTRYP pfn_glDeleteVertexArrays) (GLsizei, const GLuint*); -extern pfn_glDeleteVertexArrays fp_glDeleteVertexArrays; -typedef void (APIENTRYP pfn_glGenVertexArrays) (GLsizei, GLuint*); -extern pfn_glGenVertexArrays fp_glGenVertexArrays; -typedef GLboolean (APIENTRYP pfn_glIsVertexArray) (GLuint); -extern pfn_glIsVertexArray fp_glIsVertexArray; - - /* GL_VERSION_3_1 */ -extern GLboolean GLAD_VERSION_3_1; -#define GL_SAMPLER_2D_RECT 0x8B63 -#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 -#define GL_SAMPLER_BUFFER 0x8DC2 -#define GL_INT_SAMPLER_2D_RECT 0x8DCD -#define GL_INT_SAMPLER_BUFFER 0x8DD0 -#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 -#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 -#define GL_TEXTURE_BUFFER 0x8C2A -#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B -#define GL_TEXTURE_BINDING_BUFFER 0x8C2C -#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D -#define GL_TEXTURE_RECTANGLE 0x84F5 -#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 -#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 -#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 -#define GL_R8_SNORM 0x8F94 -#define GL_RG8_SNORM 0x8F95 -#define GL_RGB8_SNORM 0x8F96 -#define GL_RGBA8_SNORM 0x8F97 -#define GL_R16_SNORM 0x8F98 -#define GL_RG16_SNORM 0x8F99 -#define GL_RGB16_SNORM 0x8F9A -#define GL_RGBA16_SNORM 0x8F9B -#define GL_SIGNED_NORMALIZED 0x8F9C -#define GL_PRIMITIVE_RESTART 0x8F9D -#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E -#define GL_COPY_READ_BUFFER 0x8F36 -#define GL_COPY_WRITE_BUFFER 0x8F37 -#define GL_UNIFORM_BUFFER 0x8A11 -#define GL_UNIFORM_BUFFER_BINDING 0x8A28 -#define GL_UNIFORM_BUFFER_START 0x8A29 -#define GL_UNIFORM_BUFFER_SIZE 0x8A2A -#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B -#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C -#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D -#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E -#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F -#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 -#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 -#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 -#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 -#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 -#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 -#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 -#define GL_UNIFORM_TYPE 0x8A37 -#define GL_UNIFORM_SIZE 0x8A38 -#define GL_UNIFORM_NAME_LENGTH 0x8A39 -#define GL_UNIFORM_BLOCK_INDEX 0x8A3A -#define GL_UNIFORM_OFFSET 0x8A3B -#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C -#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D -#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E -#define GL_UNIFORM_BLOCK_BINDING 0x8A3F -#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 -#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 -#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 -#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 -#define GL_INVALID_INDEX 0xFFFFFFFF -typedef void (APIENTRYP pfn_glDrawArraysInstanced) (GLenum, GLint, GLsizei, GLsizei); -extern pfn_glDrawArraysInstanced fp_glDrawArraysInstanced; -typedef void (APIENTRYP pfn_glDrawElementsInstanced) (GLenum, GLsizei, GLenum, const void*, GLsizei); -extern pfn_glDrawElementsInstanced fp_glDrawElementsInstanced; -typedef void (APIENTRYP pfn_glTexBuffer) (GLenum, GLenum, GLuint); -extern pfn_glTexBuffer fp_glTexBuffer; -typedef void (APIENTRYP pfn_glPrimitiveRestartIndex) (GLuint); -extern pfn_glPrimitiveRestartIndex fp_glPrimitiveRestartIndex; -typedef void (APIENTRYP pfn_glCopyBufferSubData) (GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr); -extern pfn_glCopyBufferSubData fp_glCopyBufferSubData; -typedef void (APIENTRYP pfn_glGetUniformIndices) (GLuint, GLsizei, const GLchar**, GLuint*); -extern pfn_glGetUniformIndices fp_glGetUniformIndices; -typedef void (APIENTRYP pfn_glGetActiveUniformsiv) (GLuint, GLsizei, const GLuint*, GLenum, GLint*); -extern pfn_glGetActiveUniformsiv fp_glGetActiveUniformsiv; -typedef void (APIENTRYP pfn_glGetActiveUniformName) (GLuint, GLuint, GLsizei, GLsizei*, GLchar*); -extern pfn_glGetActiveUniformName fp_glGetActiveUniformName; -typedef GLuint (APIENTRYP pfn_glGetUniformBlockIndex) (GLuint, const GLchar*); -extern pfn_glGetUniformBlockIndex fp_glGetUniformBlockIndex; -typedef void (APIENTRYP pfn_glGetActiveUniformBlockiv) (GLuint, GLuint, GLenum, GLint*); -extern pfn_glGetActiveUniformBlockiv fp_glGetActiveUniformBlockiv; -typedef void (APIENTRYP pfn_glGetActiveUniformBlockName) (GLuint, GLuint, GLsizei, GLsizei*, GLchar*); -extern pfn_glGetActiveUniformBlockName fp_glGetActiveUniformBlockName; -typedef void (APIENTRYP pfn_glUniformBlockBinding) (GLuint, GLuint, GLuint); -extern pfn_glUniformBlockBinding fp_glUniformBlockBinding; - - /* GL_VERSION_3_2 */ -extern GLboolean GLAD_VERSION_3_2; -#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 -#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 -#define GL_LINES_ADJACENCY 0x000A -#define GL_LINE_STRIP_ADJACENCY 0x000B -#define GL_TRIANGLES_ADJACENCY 0x000C -#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D -#define GL_PROGRAM_POINT_SIZE 0x8642 -#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29 -#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7 -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8 -#define GL_GEOMETRY_SHADER 0x8DD9 -#define GL_GEOMETRY_VERTICES_OUT 0x8916 -#define GL_GEOMETRY_INPUT_TYPE 0x8917 -#define GL_GEOMETRY_OUTPUT_TYPE 0x8918 -#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF -#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0 -#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1 -#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 -#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123 -#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124 -#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 -#define GL_CONTEXT_PROFILE_MASK 0x9126 -#define GL_DEPTH_CLAMP 0x864F -#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C -#define GL_FIRST_VERTEX_CONVENTION 0x8E4D -#define GL_LAST_VERTEX_CONVENTION 0x8E4E -#define GL_PROVOKING_VERTEX 0x8E4F -#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F -#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 -#define GL_OBJECT_TYPE 0x9112 -#define GL_SYNC_CONDITION 0x9113 -#define GL_SYNC_STATUS 0x9114 -#define GL_SYNC_FLAGS 0x9115 -#define GL_SYNC_FENCE 0x9116 -#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 -#define GL_UNSIGNALED 0x9118 -#define GL_SIGNALED 0x9119 -#define GL_ALREADY_SIGNALED 0x911A -#define GL_TIMEOUT_EXPIRED 0x911B -#define GL_CONDITION_SATISFIED 0x911C -#define GL_WAIT_FAILED 0x911D -#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFF -#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 -#define GL_SAMPLE_POSITION 0x8E50 -#define GL_SAMPLE_MASK 0x8E51 -#define GL_SAMPLE_MASK_VALUE 0x8E52 -#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59 -#define GL_TEXTURE_2D_MULTISAMPLE 0x9100 -#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101 -#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 -#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103 -#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104 -#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105 -#define GL_TEXTURE_SAMPLES 0x9106 -#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107 -#define GL_SAMPLER_2D_MULTISAMPLE 0x9108 -#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 -#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A -#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B -#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C -#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D -#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E -#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F -#define GL_MAX_INTEGER_SAMPLES 0x9110 -typedef void (APIENTRYP pfn_glDrawElementsBaseVertex) (GLenum, GLsizei, GLenum, const void*, GLint); -extern pfn_glDrawElementsBaseVertex fp_glDrawElementsBaseVertex; -typedef void (APIENTRYP pfn_glDrawRangeElementsBaseVertex) (GLenum, GLuint, GLuint, GLsizei, GLenum, const void*, GLint); -extern pfn_glDrawRangeElementsBaseVertex fp_glDrawRangeElementsBaseVertex; -typedef void (APIENTRYP pfn_glDrawElementsInstancedBaseVertex) (GLenum, GLsizei, GLenum, const void*, GLsizei, GLint); -extern pfn_glDrawElementsInstancedBaseVertex fp_glDrawElementsInstancedBaseVertex; -typedef void (APIENTRYP pfn_glMultiDrawElementsBaseVertex) (GLenum, const GLsizei*, GLenum, const void**, GLsizei, const GLint*); -extern pfn_glMultiDrawElementsBaseVertex fp_glMultiDrawElementsBaseVertex; -typedef void (APIENTRYP pfn_glProvokingVertex) (GLenum); -extern pfn_glProvokingVertex fp_glProvokingVertex; -typedef GLsync (APIENTRYP pfn_glFenceSync) (GLenum, GLbitfield); -extern pfn_glFenceSync fp_glFenceSync; -typedef GLboolean (APIENTRYP pfn_glIsSync) (GLsync); -extern pfn_glIsSync fp_glIsSync; -typedef void (APIENTRYP pfn_glDeleteSync) (GLsync); -extern pfn_glDeleteSync fp_glDeleteSync; -typedef GLenum (APIENTRYP pfn_glClientWaitSync) (GLsync, GLbitfield, GLuint64); -extern pfn_glClientWaitSync fp_glClientWaitSync; -typedef void (APIENTRYP pfn_glWaitSync) (GLsync, GLbitfield, GLuint64); -extern pfn_glWaitSync fp_glWaitSync; -typedef void (APIENTRYP pfn_glGetInteger64v) (GLenum, GLint64*); -extern pfn_glGetInteger64v fp_glGetInteger64v; -typedef void (APIENTRYP pfn_glGetSynciv) (GLsync, GLenum, GLsizei, GLsizei*, GLint*); -extern pfn_glGetSynciv fp_glGetSynciv; -typedef void (APIENTRYP pfn_glGetInteger64i_v) (GLenum, GLuint, GLint64*); -extern pfn_glGetInteger64i_v fp_glGetInteger64i_v; -typedef void (APIENTRYP pfn_glGetBufferParameteri64v) (GLenum, GLenum, GLint64*); -extern pfn_glGetBufferParameteri64v fp_glGetBufferParameteri64v; -typedef void (APIENTRYP pfn_glFramebufferTexture) (GLenum, GLenum, GLuint, GLint); -extern pfn_glFramebufferTexture fp_glFramebufferTexture; -typedef void (APIENTRYP pfn_glTexImage2DMultisample) (GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLboolean); -extern pfn_glTexImage2DMultisample fp_glTexImage2DMultisample; -typedef void (APIENTRYP pfn_glTexImage3DMultisample) (GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean); -extern pfn_glTexImage3DMultisample fp_glTexImage3DMultisample; -typedef void (APIENTRYP pfn_glGetMultisamplefv) (GLenum, GLuint, GLfloat*); -extern pfn_glGetMultisamplefv fp_glGetMultisamplefv; -typedef void (APIENTRYP pfn_glSampleMaski) (GLuint, GLbitfield); -extern pfn_glSampleMaski fp_glSampleMaski; - - /* GL_VERSION_3_3 */ -extern GLboolean GLAD_VERSION_3_3; -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE -#define GL_SRC1_COLOR 0x88F9 -#define GL_ONE_MINUS_SRC1_COLOR 0x88FA -#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB -#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC -#define GL_ANY_SAMPLES_PASSED 0x8C2F -#define GL_SAMPLER_BINDING 0x8919 -#define GL_RGB10_A2UI 0x906F -#define GL_TEXTURE_SWIZZLE_R 0x8E42 -#define GL_TEXTURE_SWIZZLE_G 0x8E43 -#define GL_TEXTURE_SWIZZLE_B 0x8E44 -#define GL_TEXTURE_SWIZZLE_A 0x8E45 -#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46 -#define GL_TIME_ELAPSED 0x88BF -#define GL_TIMESTAMP 0x8E28 -#define GL_INT_2_10_10_10_REV 0x8D9F -typedef void (APIENTRYP pfn_glBindFragDataLocationIndexed) (GLuint, GLuint, GLuint, const GLchar*); -extern pfn_glBindFragDataLocationIndexed fp_glBindFragDataLocationIndexed; -typedef GLint (APIENTRYP pfn_glGetFragDataIndex) (GLuint, const GLchar*); -extern pfn_glGetFragDataIndex fp_glGetFragDataIndex; -typedef void (APIENTRYP pfn_glGenSamplers) (GLsizei, GLuint*); -extern pfn_glGenSamplers fp_glGenSamplers; -typedef void (APIENTRYP pfn_glDeleteSamplers) (GLsizei, const GLuint*); -extern pfn_glDeleteSamplers fp_glDeleteSamplers; -typedef GLboolean (APIENTRYP pfn_glIsSampler) (GLuint); -extern pfn_glIsSampler fp_glIsSampler; -typedef void (APIENTRYP pfn_glBindSampler) (GLuint, GLuint); -extern pfn_glBindSampler fp_glBindSampler; -typedef void (APIENTRYP pfn_glSamplerParameteri) (GLuint, GLenum, GLint); -extern pfn_glSamplerParameteri fp_glSamplerParameteri; -typedef void (APIENTRYP pfn_glSamplerParameteriv) (GLuint, GLenum, const GLint*); -extern pfn_glSamplerParameteriv fp_glSamplerParameteriv; -typedef void (APIENTRYP pfn_glSamplerParameterf) (GLuint, GLenum, GLfloat); -extern pfn_glSamplerParameterf fp_glSamplerParameterf; -typedef void (APIENTRYP pfn_glSamplerParameterfv) (GLuint, GLenum, const GLfloat*); -extern pfn_glSamplerParameterfv fp_glSamplerParameterfv; -typedef void (APIENTRYP pfn_glSamplerParameterIiv) (GLuint, GLenum, const GLint*); -extern pfn_glSamplerParameterIiv fp_glSamplerParameterIiv; -typedef void (APIENTRYP pfn_glSamplerParameterIuiv) (GLuint, GLenum, const GLuint*); -extern pfn_glSamplerParameterIuiv fp_glSamplerParameterIuiv; -typedef void (APIENTRYP pfn_glGetSamplerParameteriv) (GLuint, GLenum, GLint*); -extern pfn_glGetSamplerParameteriv fp_glGetSamplerParameteriv; -typedef void (APIENTRYP pfn_glGetSamplerParameterIiv) (GLuint, GLenum, GLint*); -extern pfn_glGetSamplerParameterIiv fp_glGetSamplerParameterIiv; -typedef void (APIENTRYP pfn_glGetSamplerParameterfv) (GLuint, GLenum, GLfloat*); -extern pfn_glGetSamplerParameterfv fp_glGetSamplerParameterfv; -typedef void (APIENTRYP pfn_glGetSamplerParameterIuiv) (GLuint, GLenum, GLuint*); -extern pfn_glGetSamplerParameterIuiv fp_glGetSamplerParameterIuiv; -typedef void (APIENTRYP pfn_glQueryCounter) (GLuint, GLenum); -extern pfn_glQueryCounter fp_glQueryCounter; -typedef void (APIENTRYP pfn_glGetQueryObjecti64v) (GLuint, GLenum, GLint64*); -extern pfn_glGetQueryObjecti64v fp_glGetQueryObjecti64v; -typedef void (APIENTRYP pfn_glGetQueryObjectui64v) (GLuint, GLenum, GLuint64*); -extern pfn_glGetQueryObjectui64v fp_glGetQueryObjectui64v; -typedef void (APIENTRYP pfn_glVertexAttribDivisor) (GLuint, GLuint); -extern pfn_glVertexAttribDivisor fp_glVertexAttribDivisor; -typedef void (APIENTRYP pfn_glVertexAttribP1ui) (GLuint, GLenum, GLboolean, GLuint); -extern pfn_glVertexAttribP1ui fp_glVertexAttribP1ui; -typedef void (APIENTRYP pfn_glVertexAttribP1uiv) (GLuint, GLenum, GLboolean, const GLuint*); -extern pfn_glVertexAttribP1uiv fp_glVertexAttribP1uiv; -typedef void (APIENTRYP pfn_glVertexAttribP2ui) (GLuint, GLenum, GLboolean, GLuint); -extern pfn_glVertexAttribP2ui fp_glVertexAttribP2ui; -typedef void (APIENTRYP pfn_glVertexAttribP2uiv) (GLuint, GLenum, GLboolean, const GLuint*); -extern pfn_glVertexAttribP2uiv fp_glVertexAttribP2uiv; -typedef void (APIENTRYP pfn_glVertexAttribP3ui) (GLuint, GLenum, GLboolean, GLuint); -extern pfn_glVertexAttribP3ui fp_glVertexAttribP3ui; -typedef void (APIENTRYP pfn_glVertexAttribP3uiv) (GLuint, GLenum, GLboolean, const GLuint*); -extern pfn_glVertexAttribP3uiv fp_glVertexAttribP3uiv; -typedef void (APIENTRYP pfn_glVertexAttribP4ui) (GLuint, GLenum, GLboolean, GLuint); -extern pfn_glVertexAttribP4ui fp_glVertexAttribP4ui; -typedef void (APIENTRYP pfn_glVertexAttribP4uiv) (GLuint, GLenum, GLboolean, const GLuint*); -extern pfn_glVertexAttribP4uiv fp_glVertexAttribP4uiv; -typedef void (APIENTRYP pfn_glVertexP2ui) (GLenum, GLuint); -extern pfn_glVertexP2ui fp_glVertexP2ui; -typedef void (APIENTRYP pfn_glVertexP2uiv) (GLenum, const GLuint*); -extern pfn_glVertexP2uiv fp_glVertexP2uiv; -typedef void (APIENTRYP pfn_glVertexP3ui) (GLenum, GLuint); -extern pfn_glVertexP3ui fp_glVertexP3ui; -typedef void (APIENTRYP pfn_glVertexP3uiv) (GLenum, const GLuint*); -extern pfn_glVertexP3uiv fp_glVertexP3uiv; -typedef void (APIENTRYP pfn_glVertexP4ui) (GLenum, GLuint); -extern pfn_glVertexP4ui fp_glVertexP4ui; -typedef void (APIENTRYP pfn_glVertexP4uiv) (GLenum, const GLuint*); -extern pfn_glVertexP4uiv fp_glVertexP4uiv; -typedef void (APIENTRYP pfn_glTexCoordP1ui) (GLenum, GLuint); -extern pfn_glTexCoordP1ui fp_glTexCoordP1ui; -typedef void (APIENTRYP pfn_glTexCoordP1uiv) (GLenum, const GLuint*); -extern pfn_glTexCoordP1uiv fp_glTexCoordP1uiv; -typedef void (APIENTRYP pfn_glTexCoordP2ui) (GLenum, GLuint); -extern pfn_glTexCoordP2ui fp_glTexCoordP2ui; -typedef void (APIENTRYP pfn_glTexCoordP2uiv) (GLenum, const GLuint*); -extern pfn_glTexCoordP2uiv fp_glTexCoordP2uiv; -typedef void (APIENTRYP pfn_glTexCoordP3ui) (GLenum, GLuint); -extern pfn_glTexCoordP3ui fp_glTexCoordP3ui; -typedef void (APIENTRYP pfn_glTexCoordP3uiv) (GLenum, const GLuint*); -extern pfn_glTexCoordP3uiv fp_glTexCoordP3uiv; -typedef void (APIENTRYP pfn_glTexCoordP4ui) (GLenum, GLuint); -extern pfn_glTexCoordP4ui fp_glTexCoordP4ui; -typedef void (APIENTRYP pfn_glTexCoordP4uiv) (GLenum, const GLuint*); -extern pfn_glTexCoordP4uiv fp_glTexCoordP4uiv; -typedef void (APIENTRYP pfn_glMultiTexCoordP1ui) (GLenum, GLenum, GLuint); -extern pfn_glMultiTexCoordP1ui fp_glMultiTexCoordP1ui; -typedef void (APIENTRYP pfn_glMultiTexCoordP1uiv) (GLenum, GLenum, const GLuint*); -extern pfn_glMultiTexCoordP1uiv fp_glMultiTexCoordP1uiv; -typedef void (APIENTRYP pfn_glMultiTexCoordP2ui) (GLenum, GLenum, GLuint); -extern pfn_glMultiTexCoordP2ui fp_glMultiTexCoordP2ui; -typedef void (APIENTRYP pfn_glMultiTexCoordP2uiv) (GLenum, GLenum, const GLuint*); -extern pfn_glMultiTexCoordP2uiv fp_glMultiTexCoordP2uiv; -typedef void (APIENTRYP pfn_glMultiTexCoordP3ui) (GLenum, GLenum, GLuint); -extern pfn_glMultiTexCoordP3ui fp_glMultiTexCoordP3ui; -typedef void (APIENTRYP pfn_glMultiTexCoordP3uiv) (GLenum, GLenum, const GLuint*); -extern pfn_glMultiTexCoordP3uiv fp_glMultiTexCoordP3uiv; -typedef void (APIENTRYP pfn_glMultiTexCoordP4ui) (GLenum, GLenum, GLuint); -extern pfn_glMultiTexCoordP4ui fp_glMultiTexCoordP4ui; -typedef void (APIENTRYP pfn_glMultiTexCoordP4uiv) (GLenum, GLenum, const GLuint*); -extern pfn_glMultiTexCoordP4uiv fp_glMultiTexCoordP4uiv; -typedef void (APIENTRYP pfn_glNormalP3ui) (GLenum, GLuint); -extern pfn_glNormalP3ui fp_glNormalP3ui; -typedef void (APIENTRYP pfn_glNormalP3uiv) (GLenum, const GLuint*); -extern pfn_glNormalP3uiv fp_glNormalP3uiv; -typedef void (APIENTRYP pfn_glColorP3ui) (GLenum, GLuint); -extern pfn_glColorP3ui fp_glColorP3ui; -typedef void (APIENTRYP pfn_glColorP3uiv) (GLenum, const GLuint*); -extern pfn_glColorP3uiv fp_glColorP3uiv; -typedef void (APIENTRYP pfn_glColorP4ui) (GLenum, GLuint); -extern pfn_glColorP4ui fp_glColorP4ui; -typedef void (APIENTRYP pfn_glColorP4uiv) (GLenum, const GLuint*); -extern pfn_glColorP4uiv fp_glColorP4uiv; -typedef void (APIENTRYP pfn_glSecondaryColorP3ui) (GLenum, GLuint); -extern pfn_glSecondaryColorP3ui fp_glSecondaryColorP3ui; -typedef void (APIENTRYP pfn_glSecondaryColorP3uiv) (GLenum, const GLuint*); -extern pfn_glSecondaryColorP3uiv fp_glSecondaryColorP3uiv; - - /* GL_VERSION_4_0 */ -extern GLboolean GLAD_VERSION_4_0; -#define GL_SAMPLE_SHADING 0x8C36 -#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37 -#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E -#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F -#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009 -#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A -#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B -#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C -#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D -#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E -#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F -#define GL_DRAW_INDIRECT_BUFFER 0x8F3F -#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43 -#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F -#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A -#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B -#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C -#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D -#define GL_MAX_VERTEX_STREAMS 0x8E71 -#define GL_DOUBLE_VEC2 0x8FFC -#define GL_DOUBLE_VEC3 0x8FFD -#define GL_DOUBLE_VEC4 0x8FFE -#define GL_DOUBLE_MAT2 0x8F46 -#define GL_DOUBLE_MAT3 0x8F47 -#define GL_DOUBLE_MAT4 0x8F48 -#define GL_DOUBLE_MAT2x3 0x8F49 -#define GL_DOUBLE_MAT2x4 0x8F4A -#define GL_DOUBLE_MAT3x2 0x8F4B -#define GL_DOUBLE_MAT3x4 0x8F4C -#define GL_DOUBLE_MAT4x2 0x8F4D -#define GL_DOUBLE_MAT4x3 0x8F4E -#define GL_ACTIVE_SUBROUTINES 0x8DE5 -#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6 -#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47 -#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48 -#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49 -#define GL_MAX_SUBROUTINES 0x8DE7 -#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8 -#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A -#define GL_COMPATIBLE_SUBROUTINES 0x8E4B -#define GL_PATCHES 0x000E -#define GL_PATCH_VERTICES 0x8E72 -#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73 -#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74 -#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75 -#define GL_TESS_GEN_MODE 0x8E76 -#define GL_TESS_GEN_SPACING 0x8E77 -#define GL_TESS_GEN_VERTEX_ORDER 0x8E78 -#define GL_TESS_GEN_POINT_MODE 0x8E79 -#define GL_ISOLINES 0x8E7A -#define GL_FRACTIONAL_ODD 0x8E7B -#define GL_FRACTIONAL_EVEN 0x8E7C -#define GL_MAX_PATCH_VERTICES 0x8E7D -#define GL_MAX_TESS_GEN_LEVEL 0x8E7E -#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F -#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80 -#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81 -#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82 -#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83 -#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84 -#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85 -#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86 -#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89 -#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A -#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C -#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D -#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E -#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F -#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1 -#define GL_TESS_EVALUATION_SHADER 0x8E87 -#define GL_TESS_CONTROL_SHADER 0x8E88 -#define GL_TRANSFORM_FEEDBACK 0x8E22 -#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23 -#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24 -#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25 -#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70 -typedef void (APIENTRYP pfn_glMinSampleShading) (GLfloat); -extern pfn_glMinSampleShading fp_glMinSampleShading; -typedef void (APIENTRYP pfn_glBlendEquationi) (GLuint, GLenum); -extern pfn_glBlendEquationi fp_glBlendEquationi; -typedef void (APIENTRYP pfn_glBlendEquationSeparatei) (GLuint, GLenum, GLenum); -extern pfn_glBlendEquationSeparatei fp_glBlendEquationSeparatei; -typedef void (APIENTRYP pfn_glBlendFunci) (GLuint, GLenum, GLenum); -extern pfn_glBlendFunci fp_glBlendFunci; -typedef void (APIENTRYP pfn_glBlendFuncSeparatei) (GLuint, GLenum, GLenum, GLenum, GLenum); -extern pfn_glBlendFuncSeparatei fp_glBlendFuncSeparatei; -typedef void (APIENTRYP pfn_glDrawArraysIndirect) (GLenum, const void*); -extern pfn_glDrawArraysIndirect fp_glDrawArraysIndirect; -typedef void (APIENTRYP pfn_glDrawElementsIndirect) (GLenum, GLenum, const void*); -extern pfn_glDrawElementsIndirect fp_glDrawElementsIndirect; -typedef void (APIENTRYP pfn_glUniform1d) (GLint, GLdouble); -extern pfn_glUniform1d fp_glUniform1d; -typedef void (APIENTRYP pfn_glUniform2d) (GLint, GLdouble, GLdouble); -extern pfn_glUniform2d fp_glUniform2d; -typedef void (APIENTRYP pfn_glUniform3d) (GLint, GLdouble, GLdouble, GLdouble); -extern pfn_glUniform3d fp_glUniform3d; -typedef void (APIENTRYP pfn_glUniform4d) (GLint, GLdouble, GLdouble, GLdouble, GLdouble); -extern pfn_glUniform4d fp_glUniform4d; -typedef void (APIENTRYP pfn_glUniform1dv) (GLint, GLsizei, const GLdouble*); -extern pfn_glUniform1dv fp_glUniform1dv; -typedef void (APIENTRYP pfn_glUniform2dv) (GLint, GLsizei, const GLdouble*); -extern pfn_glUniform2dv fp_glUniform2dv; -typedef void (APIENTRYP pfn_glUniform3dv) (GLint, GLsizei, const GLdouble*); -extern pfn_glUniform3dv fp_glUniform3dv; -typedef void (APIENTRYP pfn_glUniform4dv) (GLint, GLsizei, const GLdouble*); -extern pfn_glUniform4dv fp_glUniform4dv; -typedef void (APIENTRYP pfn_glUniformMatrix2dv) (GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glUniformMatrix2dv fp_glUniformMatrix2dv; -typedef void (APIENTRYP pfn_glUniformMatrix3dv) (GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glUniformMatrix3dv fp_glUniformMatrix3dv; -typedef void (APIENTRYP pfn_glUniformMatrix4dv) (GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glUniformMatrix4dv fp_glUniformMatrix4dv; -typedef void (APIENTRYP pfn_glUniformMatrix2x3dv) (GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glUniformMatrix2x3dv fp_glUniformMatrix2x3dv; -typedef void (APIENTRYP pfn_glUniformMatrix2x4dv) (GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glUniformMatrix2x4dv fp_glUniformMatrix2x4dv; -typedef void (APIENTRYP pfn_glUniformMatrix3x2dv) (GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glUniformMatrix3x2dv fp_glUniformMatrix3x2dv; -typedef void (APIENTRYP pfn_glUniformMatrix3x4dv) (GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glUniformMatrix3x4dv fp_glUniformMatrix3x4dv; -typedef void (APIENTRYP pfn_glUniformMatrix4x2dv) (GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glUniformMatrix4x2dv fp_glUniformMatrix4x2dv; -typedef void (APIENTRYP pfn_glUniformMatrix4x3dv) (GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glUniformMatrix4x3dv fp_glUniformMatrix4x3dv; -typedef void (APIENTRYP pfn_glGetUniformdv) (GLuint, GLint, GLdouble*); -extern pfn_glGetUniformdv fp_glGetUniformdv; -typedef GLint (APIENTRYP pfn_glGetSubroutineUniformLocation) (GLuint, GLenum, const GLchar*); -extern pfn_glGetSubroutineUniformLocation fp_glGetSubroutineUniformLocation; -typedef GLuint (APIENTRYP pfn_glGetSubroutineIndex) (GLuint, GLenum, const GLchar*); -extern pfn_glGetSubroutineIndex fp_glGetSubroutineIndex; -typedef void (APIENTRYP pfn_glGetActiveSubroutineUniformiv) (GLuint, GLenum, GLuint, GLenum, GLint*); -extern pfn_glGetActiveSubroutineUniformiv fp_glGetActiveSubroutineUniformiv; -typedef void (APIENTRYP pfn_glGetActiveSubroutineUniformName) (GLuint, GLenum, GLuint, GLsizei, GLsizei*, GLchar*); -extern pfn_glGetActiveSubroutineUniformName fp_glGetActiveSubroutineUniformName; -typedef void (APIENTRYP pfn_glGetActiveSubroutineName) (GLuint, GLenum, GLuint, GLsizei, GLsizei*, GLchar*); -extern pfn_glGetActiveSubroutineName fp_glGetActiveSubroutineName; -typedef void (APIENTRYP pfn_glUniformSubroutinesuiv) (GLenum, GLsizei, const GLuint*); -extern pfn_glUniformSubroutinesuiv fp_glUniformSubroutinesuiv; -typedef void (APIENTRYP pfn_glGetUniformSubroutineuiv) (GLenum, GLint, GLuint*); -extern pfn_glGetUniformSubroutineuiv fp_glGetUniformSubroutineuiv; -typedef void (APIENTRYP pfn_glGetProgramStageiv) (GLuint, GLenum, GLenum, GLint*); -extern pfn_glGetProgramStageiv fp_glGetProgramStageiv; -typedef void (APIENTRYP pfn_glPatchParameteri) (GLenum, GLint); -extern pfn_glPatchParameteri fp_glPatchParameteri; -typedef void (APIENTRYP pfn_glPatchParameterfv) (GLenum, const GLfloat*); -extern pfn_glPatchParameterfv fp_glPatchParameterfv; -typedef void (APIENTRYP pfn_glBindTransformFeedback) (GLenum, GLuint); -extern pfn_glBindTransformFeedback fp_glBindTransformFeedback; -typedef void (APIENTRYP pfn_glDeleteTransformFeedbacks) (GLsizei, const GLuint*); -extern pfn_glDeleteTransformFeedbacks fp_glDeleteTransformFeedbacks; -typedef void (APIENTRYP pfn_glGenTransformFeedbacks) (GLsizei, GLuint*); -extern pfn_glGenTransformFeedbacks fp_glGenTransformFeedbacks; -typedef GLboolean (APIENTRYP pfn_glIsTransformFeedback) (GLuint); -extern pfn_glIsTransformFeedback fp_glIsTransformFeedback; -typedef void (APIENTRYP pfn_glPauseTransformFeedback) (); -extern pfn_glPauseTransformFeedback fp_glPauseTransformFeedback; -typedef void (APIENTRYP pfn_glResumeTransformFeedback) (); -extern pfn_glResumeTransformFeedback fp_glResumeTransformFeedback; -typedef void (APIENTRYP pfn_glDrawTransformFeedback) (GLenum, GLuint); -extern pfn_glDrawTransformFeedback fp_glDrawTransformFeedback; -typedef void (APIENTRYP pfn_glDrawTransformFeedbackStream) (GLenum, GLuint, GLuint); -extern pfn_glDrawTransformFeedbackStream fp_glDrawTransformFeedbackStream; -typedef void (APIENTRYP pfn_glBeginQueryIndexed) (GLenum, GLuint, GLuint); -extern pfn_glBeginQueryIndexed fp_glBeginQueryIndexed; -typedef void (APIENTRYP pfn_glEndQueryIndexed) (GLenum, GLuint); -extern pfn_glEndQueryIndexed fp_glEndQueryIndexed; -typedef void (APIENTRYP pfn_glGetQueryIndexediv) (GLenum, GLuint, GLenum, GLint*); -extern pfn_glGetQueryIndexediv fp_glGetQueryIndexediv; - - /* GL_VERSION_4_1 */ -extern GLboolean GLAD_VERSION_4_1; -#define GL_FIXED 0x140C -#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A -#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B -#define GL_LOW_FLOAT 0x8DF0 -#define GL_MEDIUM_FLOAT 0x8DF1 -#define GL_HIGH_FLOAT 0x8DF2 -#define GL_LOW_INT 0x8DF3 -#define GL_MEDIUM_INT 0x8DF4 -#define GL_HIGH_INT 0x8DF5 -#define GL_SHADER_COMPILER 0x8DFA -#define GL_SHADER_BINARY_FORMATS 0x8DF8 -#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 -#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB -#define GL_MAX_VARYING_VECTORS 0x8DFC -#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD -#define GL_RGB565 0x8D62 -#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 -#define GL_PROGRAM_BINARY_LENGTH 0x8741 -#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE -#define GL_PROGRAM_BINARY_FORMATS 0x87FF -#define GL_VERTEX_SHADER_BIT 0x00000001 -#define GL_FRAGMENT_SHADER_BIT 0x00000002 -#define GL_GEOMETRY_SHADER_BIT 0x00000004 -#define GL_TESS_CONTROL_SHADER_BIT 0x00000008 -#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010 -#define GL_ALL_SHADER_BITS 0xFFFFFFFF -#define GL_PROGRAM_SEPARABLE 0x8258 -#define GL_ACTIVE_PROGRAM 0x8259 -#define GL_PROGRAM_PIPELINE_BINDING 0x825A -#define GL_MAX_VIEWPORTS 0x825B -#define GL_VIEWPORT_SUBPIXEL_BITS 0x825C -#define GL_VIEWPORT_BOUNDS_RANGE 0x825D -#define GL_LAYER_PROVOKING_VERTEX 0x825E -#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F -#define GL_UNDEFINED_VERTEX 0x8260 -typedef void (APIENTRYP pfn_glReleaseShaderCompiler) (); -extern pfn_glReleaseShaderCompiler fp_glReleaseShaderCompiler; -typedef void (APIENTRYP pfn_glShaderBinary) (GLsizei, const GLuint*, GLenum, const void*, GLsizei); -extern pfn_glShaderBinary fp_glShaderBinary; -typedef void (APIENTRYP pfn_glGetShaderPrecisionFormat) (GLenum, GLenum, GLint*, GLint*); -extern pfn_glGetShaderPrecisionFormat fp_glGetShaderPrecisionFormat; -typedef void (APIENTRYP pfn_glDepthRangef) (GLfloat, GLfloat); -extern pfn_glDepthRangef fp_glDepthRangef; -typedef void (APIENTRYP pfn_glClearDepthf) (GLfloat); -extern pfn_glClearDepthf fp_glClearDepthf; -typedef void (APIENTRYP pfn_glGetProgramBinary) (GLuint, GLsizei, GLsizei*, GLenum*, void*); -extern pfn_glGetProgramBinary fp_glGetProgramBinary; -typedef void (APIENTRYP pfn_glProgramBinary) (GLuint, GLenum, const void*, GLsizei); -extern pfn_glProgramBinary fp_glProgramBinary; -typedef void (APIENTRYP pfn_glProgramParameteri) (GLuint, GLenum, GLint); -extern pfn_glProgramParameteri fp_glProgramParameteri; -typedef void (APIENTRYP pfn_glUseProgramStages) (GLuint, GLbitfield, GLuint); -extern pfn_glUseProgramStages fp_glUseProgramStages; -typedef void (APIENTRYP pfn_glActiveShaderProgram) (GLuint, GLuint); -extern pfn_glActiveShaderProgram fp_glActiveShaderProgram; -typedef GLuint (APIENTRYP pfn_glCreateShaderProgramv) (GLenum, GLsizei, const GLchar**); -extern pfn_glCreateShaderProgramv fp_glCreateShaderProgramv; -typedef void (APIENTRYP pfn_glBindProgramPipeline) (GLuint); -extern pfn_glBindProgramPipeline fp_glBindProgramPipeline; -typedef void (APIENTRYP pfn_glDeleteProgramPipelines) (GLsizei, const GLuint*); -extern pfn_glDeleteProgramPipelines fp_glDeleteProgramPipelines; -typedef void (APIENTRYP pfn_glGenProgramPipelines) (GLsizei, GLuint*); -extern pfn_glGenProgramPipelines fp_glGenProgramPipelines; -typedef GLboolean (APIENTRYP pfn_glIsProgramPipeline) (GLuint); -extern pfn_glIsProgramPipeline fp_glIsProgramPipeline; -typedef void (APIENTRYP pfn_glGetProgramPipelineiv) (GLuint, GLenum, GLint*); -extern pfn_glGetProgramPipelineiv fp_glGetProgramPipelineiv; -typedef void (APIENTRYP pfn_glProgramUniform1i) (GLuint, GLint, GLint); -extern pfn_glProgramUniform1i fp_glProgramUniform1i; -typedef void (APIENTRYP pfn_glProgramUniform1iv) (GLuint, GLint, GLsizei, const GLint*); -extern pfn_glProgramUniform1iv fp_glProgramUniform1iv; -typedef void (APIENTRYP pfn_glProgramUniform1f) (GLuint, GLint, GLfloat); -extern pfn_glProgramUniform1f fp_glProgramUniform1f; -typedef void (APIENTRYP pfn_glProgramUniform1fv) (GLuint, GLint, GLsizei, const GLfloat*); -extern pfn_glProgramUniform1fv fp_glProgramUniform1fv; -typedef void (APIENTRYP pfn_glProgramUniform1d) (GLuint, GLint, GLdouble); -extern pfn_glProgramUniform1d fp_glProgramUniform1d; -typedef void (APIENTRYP pfn_glProgramUniform1dv) (GLuint, GLint, GLsizei, const GLdouble*); -extern pfn_glProgramUniform1dv fp_glProgramUniform1dv; -typedef void (APIENTRYP pfn_glProgramUniform1ui) (GLuint, GLint, GLuint); -extern pfn_glProgramUniform1ui fp_glProgramUniform1ui; -typedef void (APIENTRYP pfn_glProgramUniform1uiv) (GLuint, GLint, GLsizei, const GLuint*); -extern pfn_glProgramUniform1uiv fp_glProgramUniform1uiv; -typedef void (APIENTRYP pfn_glProgramUniform2i) (GLuint, GLint, GLint, GLint); -extern pfn_glProgramUniform2i fp_glProgramUniform2i; -typedef void (APIENTRYP pfn_glProgramUniform2iv) (GLuint, GLint, GLsizei, const GLint*); -extern pfn_glProgramUniform2iv fp_glProgramUniform2iv; -typedef void (APIENTRYP pfn_glProgramUniform2f) (GLuint, GLint, GLfloat, GLfloat); -extern pfn_glProgramUniform2f fp_glProgramUniform2f; -typedef void (APIENTRYP pfn_glProgramUniform2fv) (GLuint, GLint, GLsizei, const GLfloat*); -extern pfn_glProgramUniform2fv fp_glProgramUniform2fv; -typedef void (APIENTRYP pfn_glProgramUniform2d) (GLuint, GLint, GLdouble, GLdouble); -extern pfn_glProgramUniform2d fp_glProgramUniform2d; -typedef void (APIENTRYP pfn_glProgramUniform2dv) (GLuint, GLint, GLsizei, const GLdouble*); -extern pfn_glProgramUniform2dv fp_glProgramUniform2dv; -typedef void (APIENTRYP pfn_glProgramUniform2ui) (GLuint, GLint, GLuint, GLuint); -extern pfn_glProgramUniform2ui fp_glProgramUniform2ui; -typedef void (APIENTRYP pfn_glProgramUniform2uiv) (GLuint, GLint, GLsizei, const GLuint*); -extern pfn_glProgramUniform2uiv fp_glProgramUniform2uiv; -typedef void (APIENTRYP pfn_glProgramUniform3i) (GLuint, GLint, GLint, GLint, GLint); -extern pfn_glProgramUniform3i fp_glProgramUniform3i; -typedef void (APIENTRYP pfn_glProgramUniform3iv) (GLuint, GLint, GLsizei, const GLint*); -extern pfn_glProgramUniform3iv fp_glProgramUniform3iv; -typedef void (APIENTRYP pfn_glProgramUniform3f) (GLuint, GLint, GLfloat, GLfloat, GLfloat); -extern pfn_glProgramUniform3f fp_glProgramUniform3f; -typedef void (APIENTRYP pfn_glProgramUniform3fv) (GLuint, GLint, GLsizei, const GLfloat*); -extern pfn_glProgramUniform3fv fp_glProgramUniform3fv; -typedef void (APIENTRYP pfn_glProgramUniform3d) (GLuint, GLint, GLdouble, GLdouble, GLdouble); -extern pfn_glProgramUniform3d fp_glProgramUniform3d; -typedef void (APIENTRYP pfn_glProgramUniform3dv) (GLuint, GLint, GLsizei, const GLdouble*); -extern pfn_glProgramUniform3dv fp_glProgramUniform3dv; -typedef void (APIENTRYP pfn_glProgramUniform3ui) (GLuint, GLint, GLuint, GLuint, GLuint); -extern pfn_glProgramUniform3ui fp_glProgramUniform3ui; -typedef void (APIENTRYP pfn_glProgramUniform3uiv) (GLuint, GLint, GLsizei, const GLuint*); -extern pfn_glProgramUniform3uiv fp_glProgramUniform3uiv; -typedef void (APIENTRYP pfn_glProgramUniform4i) (GLuint, GLint, GLint, GLint, GLint, GLint); -extern pfn_glProgramUniform4i fp_glProgramUniform4i; -typedef void (APIENTRYP pfn_glProgramUniform4iv) (GLuint, GLint, GLsizei, const GLint*); -extern pfn_glProgramUniform4iv fp_glProgramUniform4iv; -typedef void (APIENTRYP pfn_glProgramUniform4f) (GLuint, GLint, GLfloat, GLfloat, GLfloat, GLfloat); -extern pfn_glProgramUniform4f fp_glProgramUniform4f; -typedef void (APIENTRYP pfn_glProgramUniform4fv) (GLuint, GLint, GLsizei, const GLfloat*); -extern pfn_glProgramUniform4fv fp_glProgramUniform4fv; -typedef void (APIENTRYP pfn_glProgramUniform4d) (GLuint, GLint, GLdouble, GLdouble, GLdouble, GLdouble); -extern pfn_glProgramUniform4d fp_glProgramUniform4d; -typedef void (APIENTRYP pfn_glProgramUniform4dv) (GLuint, GLint, GLsizei, const GLdouble*); -extern pfn_glProgramUniform4dv fp_glProgramUniform4dv; -typedef void (APIENTRYP pfn_glProgramUniform4ui) (GLuint, GLint, GLuint, GLuint, GLuint, GLuint); -extern pfn_glProgramUniform4ui fp_glProgramUniform4ui; -typedef void (APIENTRYP pfn_glProgramUniform4uiv) (GLuint, GLint, GLsizei, const GLuint*); -extern pfn_glProgramUniform4uiv fp_glProgramUniform4uiv; -typedef void (APIENTRYP pfn_glProgramUniformMatrix2fv) (GLuint, GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glProgramUniformMatrix2fv fp_glProgramUniformMatrix2fv; -typedef void (APIENTRYP pfn_glProgramUniformMatrix3fv) (GLuint, GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glProgramUniformMatrix3fv fp_glProgramUniformMatrix3fv; -typedef void (APIENTRYP pfn_glProgramUniformMatrix4fv) (GLuint, GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glProgramUniformMatrix4fv fp_glProgramUniformMatrix4fv; -typedef void (APIENTRYP pfn_glProgramUniformMatrix2dv) (GLuint, GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glProgramUniformMatrix2dv fp_glProgramUniformMatrix2dv; -typedef void (APIENTRYP pfn_glProgramUniformMatrix3dv) (GLuint, GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glProgramUniformMatrix3dv fp_glProgramUniformMatrix3dv; -typedef void (APIENTRYP pfn_glProgramUniformMatrix4dv) (GLuint, GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glProgramUniformMatrix4dv fp_glProgramUniformMatrix4dv; -typedef void (APIENTRYP pfn_glProgramUniformMatrix2x3fv) (GLuint, GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glProgramUniformMatrix2x3fv fp_glProgramUniformMatrix2x3fv; -typedef void (APIENTRYP pfn_glProgramUniformMatrix3x2fv) (GLuint, GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glProgramUniformMatrix3x2fv fp_glProgramUniformMatrix3x2fv; -typedef void (APIENTRYP pfn_glProgramUniformMatrix2x4fv) (GLuint, GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glProgramUniformMatrix2x4fv fp_glProgramUniformMatrix2x4fv; -typedef void (APIENTRYP pfn_glProgramUniformMatrix4x2fv) (GLuint, GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glProgramUniformMatrix4x2fv fp_glProgramUniformMatrix4x2fv; -typedef void (APIENTRYP pfn_glProgramUniformMatrix3x4fv) (GLuint, GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glProgramUniformMatrix3x4fv fp_glProgramUniformMatrix3x4fv; -typedef void (APIENTRYP pfn_glProgramUniformMatrix4x3fv) (GLuint, GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glProgramUniformMatrix4x3fv fp_glProgramUniformMatrix4x3fv; -typedef void (APIENTRYP pfn_glProgramUniformMatrix2x3dv) (GLuint, GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glProgramUniformMatrix2x3dv fp_glProgramUniformMatrix2x3dv; -typedef void (APIENTRYP pfn_glProgramUniformMatrix3x2dv) (GLuint, GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glProgramUniformMatrix3x2dv fp_glProgramUniformMatrix3x2dv; -typedef void (APIENTRYP pfn_glProgramUniformMatrix2x4dv) (GLuint, GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glProgramUniformMatrix2x4dv fp_glProgramUniformMatrix2x4dv; -typedef void (APIENTRYP pfn_glProgramUniformMatrix4x2dv) (GLuint, GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glProgramUniformMatrix4x2dv fp_glProgramUniformMatrix4x2dv; -typedef void (APIENTRYP pfn_glProgramUniformMatrix3x4dv) (GLuint, GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glProgramUniformMatrix3x4dv fp_glProgramUniformMatrix3x4dv; -typedef void (APIENTRYP pfn_glProgramUniformMatrix4x3dv) (GLuint, GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glProgramUniformMatrix4x3dv fp_glProgramUniformMatrix4x3dv; -typedef void (APIENTRYP pfn_glValidateProgramPipeline) (GLuint); -extern pfn_glValidateProgramPipeline fp_glValidateProgramPipeline; -typedef void (APIENTRYP pfn_glGetProgramPipelineInfoLog) (GLuint, GLsizei, GLsizei*, GLchar*); -extern pfn_glGetProgramPipelineInfoLog fp_glGetProgramPipelineInfoLog; -typedef void (APIENTRYP pfn_glVertexAttribL1d) (GLuint, GLdouble); -extern pfn_glVertexAttribL1d fp_glVertexAttribL1d; -typedef void (APIENTRYP pfn_glVertexAttribL2d) (GLuint, GLdouble, GLdouble); -extern pfn_glVertexAttribL2d fp_glVertexAttribL2d; -typedef void (APIENTRYP pfn_glVertexAttribL3d) (GLuint, GLdouble, GLdouble, GLdouble); -extern pfn_glVertexAttribL3d fp_glVertexAttribL3d; -typedef void (APIENTRYP pfn_glVertexAttribL4d) (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -extern pfn_glVertexAttribL4d fp_glVertexAttribL4d; -typedef void (APIENTRYP pfn_glVertexAttribL1dv) (GLuint, const GLdouble*); -extern pfn_glVertexAttribL1dv fp_glVertexAttribL1dv; -typedef void (APIENTRYP pfn_glVertexAttribL2dv) (GLuint, const GLdouble*); -extern pfn_glVertexAttribL2dv fp_glVertexAttribL2dv; -typedef void (APIENTRYP pfn_glVertexAttribL3dv) (GLuint, const GLdouble*); -extern pfn_glVertexAttribL3dv fp_glVertexAttribL3dv; -typedef void (APIENTRYP pfn_glVertexAttribL4dv) (GLuint, const GLdouble*); -extern pfn_glVertexAttribL4dv fp_glVertexAttribL4dv; -typedef void (APIENTRYP pfn_glVertexAttribLPointer) (GLuint, GLint, GLenum, GLsizei, const void*); -extern pfn_glVertexAttribLPointer fp_glVertexAttribLPointer; -typedef void (APIENTRYP pfn_glGetVertexAttribLdv) (GLuint, GLenum, GLdouble*); -extern pfn_glGetVertexAttribLdv fp_glGetVertexAttribLdv; -typedef void (APIENTRYP pfn_glViewportArrayv) (GLuint, GLsizei, const GLfloat*); -extern pfn_glViewportArrayv fp_glViewportArrayv; -typedef void (APIENTRYP pfn_glViewportIndexedf) (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -extern pfn_glViewportIndexedf fp_glViewportIndexedf; -typedef void (APIENTRYP pfn_glViewportIndexedfv) (GLuint, const GLfloat*); -extern pfn_glViewportIndexedfv fp_glViewportIndexedfv; -typedef void (APIENTRYP pfn_glScissorArrayv) (GLuint, GLsizei, const GLint*); -extern pfn_glScissorArrayv fp_glScissorArrayv; -typedef void (APIENTRYP pfn_glScissorIndexed) (GLuint, GLint, GLint, GLsizei, GLsizei); -extern pfn_glScissorIndexed fp_glScissorIndexed; -typedef void (APIENTRYP pfn_glScissorIndexedv) (GLuint, const GLint*); -extern pfn_glScissorIndexedv fp_glScissorIndexedv; -typedef void (APIENTRYP pfn_glDepthRangeArrayv) (GLuint, GLsizei, const GLdouble*); -extern pfn_glDepthRangeArrayv fp_glDepthRangeArrayv; -typedef void (APIENTRYP pfn_glDepthRangeIndexed) (GLuint, GLdouble, GLdouble); -extern pfn_glDepthRangeIndexed fp_glDepthRangeIndexed; -typedef void (APIENTRYP pfn_glGetFloati_v) (GLenum, GLuint, GLfloat*); -extern pfn_glGetFloati_v fp_glGetFloati_v; -typedef void (APIENTRYP pfn_glGetDoublei_v) (GLenum, GLuint, GLdouble*); -extern pfn_glGetDoublei_v fp_glGetDoublei_v; - - /* GL_VERSION_4_2 */ -extern GLboolean GLAD_VERSION_4_2; -#define GL_COPY_READ_BUFFER_BINDING 0x8F36 -#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37 -#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24 -#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23 -#define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127 -#define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128 -#define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129 -#define GL_UNPACK_COMPRESSED_BLOCK_SIZE 0x912A -#define GL_PACK_COMPRESSED_BLOCK_WIDTH 0x912B -#define GL_PACK_COMPRESSED_BLOCK_HEIGHT 0x912C -#define GL_PACK_COMPRESSED_BLOCK_DEPTH 0x912D -#define GL_PACK_COMPRESSED_BLOCK_SIZE 0x912E -#define GL_NUM_SAMPLE_COUNTS 0x9380 -#define GL_MIN_MAP_BUFFER_ALIGNMENT 0x90BC -#define GL_ATOMIC_COUNTER_BUFFER 0x92C0 -#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1 -#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2 -#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3 -#define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4 -#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5 -#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6 -#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7 -#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8 -#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9 -#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA -#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB -#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC -#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD -#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE -#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF -#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0 -#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1 -#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2 -#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3 -#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4 -#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS 0x92D5 -#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6 -#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7 -#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8 -#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC -#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9 -#define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA -#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB -#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001 -#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002 -#define GL_UNIFORM_BARRIER_BIT 0x00000004 -#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008 -#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020 -#define GL_COMMAND_BARRIER_BIT 0x00000040 -#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080 -#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100 -#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200 -#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400 -#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800 -#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000 -#define GL_ALL_BARRIER_BITS 0xFFFFFFFF -#define GL_MAX_IMAGE_UNITS 0x8F38 -#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39 -#define GL_IMAGE_BINDING_NAME 0x8F3A -#define GL_IMAGE_BINDING_LEVEL 0x8F3B -#define GL_IMAGE_BINDING_LAYERED 0x8F3C -#define GL_IMAGE_BINDING_LAYER 0x8F3D -#define GL_IMAGE_BINDING_ACCESS 0x8F3E -#define GL_IMAGE_1D 0x904C -#define GL_IMAGE_2D 0x904D -#define GL_IMAGE_3D 0x904E -#define GL_IMAGE_2D_RECT 0x904F -#define GL_IMAGE_CUBE 0x9050 -#define GL_IMAGE_BUFFER 0x9051 -#define GL_IMAGE_1D_ARRAY 0x9052 -#define GL_IMAGE_2D_ARRAY 0x9053 -#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054 -#define GL_IMAGE_2D_MULTISAMPLE 0x9055 -#define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056 -#define GL_INT_IMAGE_1D 0x9057 -#define GL_INT_IMAGE_2D 0x9058 -#define GL_INT_IMAGE_3D 0x9059 -#define GL_INT_IMAGE_2D_RECT 0x905A -#define GL_INT_IMAGE_CUBE 0x905B -#define GL_INT_IMAGE_BUFFER 0x905C -#define GL_INT_IMAGE_1D_ARRAY 0x905D -#define GL_INT_IMAGE_2D_ARRAY 0x905E -#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F -#define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060 -#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061 -#define GL_UNSIGNED_INT_IMAGE_1D 0x9062 -#define GL_UNSIGNED_INT_IMAGE_2D 0x9063 -#define GL_UNSIGNED_INT_IMAGE_3D 0x9064 -#define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065 -#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066 -#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067 -#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068 -#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069 -#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A -#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B -#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C -#define GL_MAX_IMAGE_SAMPLES 0x906D -#define GL_IMAGE_BINDING_FORMAT 0x906E -#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7 -#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8 -#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9 -#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA -#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB -#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC -#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD -#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE -#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF -#define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C -#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D -#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E -#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F -#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F -typedef void (APIENTRYP pfn_glDrawArraysInstancedBaseInstance) (GLenum, GLint, GLsizei, GLsizei, GLuint); -extern pfn_glDrawArraysInstancedBaseInstance fp_glDrawArraysInstancedBaseInstance; -typedef void (APIENTRYP pfn_glDrawElementsInstancedBaseInstance) (GLenum, GLsizei, GLenum, const void*, GLsizei, GLuint); -extern pfn_glDrawElementsInstancedBaseInstance fp_glDrawElementsInstancedBaseInstance; -typedef void (APIENTRYP pfn_glDrawElementsInstancedBaseVertexBaseInstance) (GLenum, GLsizei, GLenum, const void*, GLsizei, GLint, GLuint); -extern pfn_glDrawElementsInstancedBaseVertexBaseInstance fp_glDrawElementsInstancedBaseVertexBaseInstance; -typedef void (APIENTRYP pfn_glGetInternalformativ) (GLenum, GLenum, GLenum, GLsizei, GLint*); -extern pfn_glGetInternalformativ fp_glGetInternalformativ; -typedef void (APIENTRYP pfn_glGetActiveAtomicCounterBufferiv) (GLuint, GLuint, GLenum, GLint*); -extern pfn_glGetActiveAtomicCounterBufferiv fp_glGetActiveAtomicCounterBufferiv; -typedef void (APIENTRYP pfn_glBindImageTexture) (GLuint, GLuint, GLint, GLboolean, GLint, GLenum, GLenum); -extern pfn_glBindImageTexture fp_glBindImageTexture; -typedef void (APIENTRYP pfn_glMemoryBarrier) (GLbitfield); -extern pfn_glMemoryBarrier fp_glMemoryBarrier; -typedef void (APIENTRYP pfn_glTexStorage1D) (GLenum, GLsizei, GLenum, GLsizei); -extern pfn_glTexStorage1D fp_glTexStorage1D; -typedef void (APIENTRYP pfn_glTexStorage2D) (GLenum, GLsizei, GLenum, GLsizei, GLsizei); -extern pfn_glTexStorage2D fp_glTexStorage2D; -typedef void (APIENTRYP pfn_glTexStorage3D) (GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei); -extern pfn_glTexStorage3D fp_glTexStorage3D; -typedef void (APIENTRYP pfn_glDrawTransformFeedbackInstanced) (GLenum, GLuint, GLsizei); -extern pfn_glDrawTransformFeedbackInstanced fp_glDrawTransformFeedbackInstanced; -typedef void (APIENTRYP pfn_glDrawTransformFeedbackStreamInstanced) (GLenum, GLuint, GLuint, GLsizei); -extern pfn_glDrawTransformFeedbackStreamInstanced fp_glDrawTransformFeedbackStreamInstanced; - - /* GL_VERSION_4_3 */ -extern GLboolean GLAD_VERSION_4_3; -#define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9 -#define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E -#define GL_COMPRESSED_RGB8_ETC2 0x9274 -#define GL_COMPRESSED_SRGB8_ETC2 0x9275 -#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276 -#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 -#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 -#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 -#define GL_COMPRESSED_R11_EAC 0x9270 -#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271 -#define GL_COMPRESSED_RG11_EAC 0x9272 -#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273 -#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69 -#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A -#define GL_MAX_ELEMENT_INDEX 0x8D6B -#define GL_COMPUTE_SHADER 0x91B9 -#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB -#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC -#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD -#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262 -#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263 -#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264 -#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265 -#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266 -#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB -#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE -#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF -#define GL_COMPUTE_WORK_GROUP_SIZE 0x8267 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC -#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED -#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE -#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF -#define GL_COMPUTE_SHADER_BIT 0x00000020 -#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 -#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243 -#define GL_DEBUG_CALLBACK_FUNCTION 0x8244 -#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245 -#define GL_DEBUG_SOURCE_API 0x8246 -#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247 -#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248 -#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249 -#define GL_DEBUG_SOURCE_APPLICATION 0x824A -#define GL_DEBUG_SOURCE_OTHER 0x824B -#define GL_DEBUG_TYPE_ERROR 0x824C -#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D -#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E -#define GL_DEBUG_TYPE_PORTABILITY 0x824F -#define GL_DEBUG_TYPE_PERFORMANCE 0x8250 -#define GL_DEBUG_TYPE_OTHER 0x8251 -#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143 -#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144 -#define GL_DEBUG_LOGGED_MESSAGES 0x9145 -#define GL_DEBUG_SEVERITY_HIGH 0x9146 -#define GL_DEBUG_SEVERITY_MEDIUM 0x9147 -#define GL_DEBUG_SEVERITY_LOW 0x9148 -#define GL_DEBUG_TYPE_MARKER 0x8268 -#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269 -#define GL_DEBUG_TYPE_POP_GROUP 0x826A -#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B -#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C -#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D -#define GL_BUFFER 0x82E0 -#define GL_SHADER 0x82E1 -#define GL_PROGRAM 0x82E2 -#define GL_QUERY 0x82E3 -#define GL_PROGRAM_PIPELINE 0x82E4 -#define GL_SAMPLER 0x82E6 -#define GL_MAX_LABEL_LENGTH 0x82E8 -#define GL_DEBUG_OUTPUT 0x92E0 -#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 -#define GL_MAX_UNIFORM_LOCATIONS 0x826E -#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310 -#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311 -#define GL_FRAMEBUFFER_DEFAULT_LAYERS 0x9312 -#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313 -#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314 -#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315 -#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316 -#define GL_MAX_FRAMEBUFFER_LAYERS 0x9317 -#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318 -#define GL_INTERNALFORMAT_SUPPORTED 0x826F -#define GL_INTERNALFORMAT_PREFERRED 0x8270 -#define GL_INTERNALFORMAT_RED_SIZE 0x8271 -#define GL_INTERNALFORMAT_GREEN_SIZE 0x8272 -#define GL_INTERNALFORMAT_BLUE_SIZE 0x8273 -#define GL_INTERNALFORMAT_ALPHA_SIZE 0x8274 -#define GL_INTERNALFORMAT_DEPTH_SIZE 0x8275 -#define GL_INTERNALFORMAT_STENCIL_SIZE 0x8276 -#define GL_INTERNALFORMAT_SHARED_SIZE 0x8277 -#define GL_INTERNALFORMAT_RED_TYPE 0x8278 -#define GL_INTERNALFORMAT_GREEN_TYPE 0x8279 -#define GL_INTERNALFORMAT_BLUE_TYPE 0x827A -#define GL_INTERNALFORMAT_ALPHA_TYPE 0x827B -#define GL_INTERNALFORMAT_DEPTH_TYPE 0x827C -#define GL_INTERNALFORMAT_STENCIL_TYPE 0x827D -#define GL_MAX_WIDTH 0x827E -#define GL_MAX_HEIGHT 0x827F -#define GL_MAX_DEPTH 0x8280 -#define GL_MAX_LAYERS 0x8281 -#define GL_MAX_COMBINED_DIMENSIONS 0x8282 -#define GL_COLOR_COMPONENTS 0x8283 -#define GL_DEPTH_COMPONENTS 0x8284 -#define GL_STENCIL_COMPONENTS 0x8285 -#define GL_COLOR_RENDERABLE 0x8286 -#define GL_DEPTH_RENDERABLE 0x8287 -#define GL_STENCIL_RENDERABLE 0x8288 -#define GL_FRAMEBUFFER_RENDERABLE 0x8289 -#define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A -#define GL_FRAMEBUFFER_BLEND 0x828B -#define GL_READ_PIXELS 0x828C -#define GL_READ_PIXELS_FORMAT 0x828D -#define GL_READ_PIXELS_TYPE 0x828E -#define GL_TEXTURE_IMAGE_FORMAT 0x828F -#define GL_TEXTURE_IMAGE_TYPE 0x8290 -#define GL_GET_TEXTURE_IMAGE_FORMAT 0x8291 -#define GL_GET_TEXTURE_IMAGE_TYPE 0x8292 -#define GL_MIPMAP 0x8293 -#define GL_MANUAL_GENERATE_MIPMAP 0x8294 -#define GL_AUTO_GENERATE_MIPMAP 0x8295 -#define GL_COLOR_ENCODING 0x8296 -#define GL_SRGB_READ 0x8297 -#define GL_SRGB_WRITE 0x8298 -#define GL_FILTER 0x829A -#define GL_VERTEX_TEXTURE 0x829B -#define GL_TESS_CONTROL_TEXTURE 0x829C -#define GL_TESS_EVALUATION_TEXTURE 0x829D -#define GL_GEOMETRY_TEXTURE 0x829E -#define GL_FRAGMENT_TEXTURE 0x829F -#define GL_COMPUTE_TEXTURE 0x82A0 -#define GL_TEXTURE_SHADOW 0x82A1 -#define GL_TEXTURE_GATHER 0x82A2 -#define GL_TEXTURE_GATHER_SHADOW 0x82A3 -#define GL_SHADER_IMAGE_LOAD 0x82A4 -#define GL_SHADER_IMAGE_STORE 0x82A5 -#define GL_SHADER_IMAGE_ATOMIC 0x82A6 -#define GL_IMAGE_TEXEL_SIZE 0x82A7 -#define GL_IMAGE_COMPATIBILITY_CLASS 0x82A8 -#define GL_IMAGE_PIXEL_FORMAT 0x82A9 -#define GL_IMAGE_PIXEL_TYPE 0x82AA -#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC -#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD -#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE -#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF -#define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1 -#define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2 -#define GL_TEXTURE_COMPRESSED_BLOCK_SIZE 0x82B3 -#define GL_CLEAR_BUFFER 0x82B4 -#define GL_TEXTURE_VIEW 0x82B5 -#define GL_VIEW_COMPATIBILITY_CLASS 0x82B6 -#define GL_FULL_SUPPORT 0x82B7 -#define GL_CAVEAT_SUPPORT 0x82B8 -#define GL_IMAGE_CLASS_4_X_32 0x82B9 -#define GL_IMAGE_CLASS_2_X_32 0x82BA -#define GL_IMAGE_CLASS_1_X_32 0x82BB -#define GL_IMAGE_CLASS_4_X_16 0x82BC -#define GL_IMAGE_CLASS_2_X_16 0x82BD -#define GL_IMAGE_CLASS_1_X_16 0x82BE -#define GL_IMAGE_CLASS_4_X_8 0x82BF -#define GL_IMAGE_CLASS_2_X_8 0x82C0 -#define GL_IMAGE_CLASS_1_X_8 0x82C1 -#define GL_IMAGE_CLASS_11_11_10 0x82C2 -#define GL_IMAGE_CLASS_10_10_10_2 0x82C3 -#define GL_VIEW_CLASS_128_BITS 0x82C4 -#define GL_VIEW_CLASS_96_BITS 0x82C5 -#define GL_VIEW_CLASS_64_BITS 0x82C6 -#define GL_VIEW_CLASS_48_BITS 0x82C7 -#define GL_VIEW_CLASS_32_BITS 0x82C8 -#define GL_VIEW_CLASS_24_BITS 0x82C9 -#define GL_VIEW_CLASS_16_BITS 0x82CA -#define GL_VIEW_CLASS_8_BITS 0x82CB -#define GL_VIEW_CLASS_S3TC_DXT1_RGB 0x82CC -#define GL_VIEW_CLASS_S3TC_DXT1_RGBA 0x82CD -#define GL_VIEW_CLASS_S3TC_DXT3_RGBA 0x82CE -#define GL_VIEW_CLASS_S3TC_DXT5_RGBA 0x82CF -#define GL_VIEW_CLASS_RGTC1_RED 0x82D0 -#define GL_VIEW_CLASS_RGTC2_RG 0x82D1 -#define GL_VIEW_CLASS_BPTC_UNORM 0x82D2 -#define GL_VIEW_CLASS_BPTC_FLOAT 0x82D3 -#define GL_UNIFORM 0x92E1 -#define GL_UNIFORM_BLOCK 0x92E2 -#define GL_PROGRAM_INPUT 0x92E3 -#define GL_PROGRAM_OUTPUT 0x92E4 -#define GL_BUFFER_VARIABLE 0x92E5 -#define GL_SHADER_STORAGE_BLOCK 0x92E6 -#define GL_VERTEX_SUBROUTINE 0x92E8 -#define GL_TESS_CONTROL_SUBROUTINE 0x92E9 -#define GL_TESS_EVALUATION_SUBROUTINE 0x92EA -#define GL_GEOMETRY_SUBROUTINE 0x92EB -#define GL_FRAGMENT_SUBROUTINE 0x92EC -#define GL_COMPUTE_SUBROUTINE 0x92ED -#define GL_VERTEX_SUBROUTINE_UNIFORM 0x92EE -#define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF -#define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0 -#define GL_GEOMETRY_SUBROUTINE_UNIFORM 0x92F1 -#define GL_FRAGMENT_SUBROUTINE_UNIFORM 0x92F2 -#define GL_COMPUTE_SUBROUTINE_UNIFORM 0x92F3 -#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4 -#define GL_ACTIVE_RESOURCES 0x92F5 -#define GL_MAX_NAME_LENGTH 0x92F6 -#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7 -#define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8 -#define GL_NAME_LENGTH 0x92F9 -#define GL_TYPE 0x92FA -#define GL_ARRAY_SIZE 0x92FB -#define GL_OFFSET 0x92FC -#define GL_BLOCK_INDEX 0x92FD -#define GL_ARRAY_STRIDE 0x92FE -#define GL_MATRIX_STRIDE 0x92FF -#define GL_IS_ROW_MAJOR 0x9300 -#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301 -#define GL_BUFFER_BINDING 0x9302 -#define GL_BUFFER_DATA_SIZE 0x9303 -#define GL_NUM_ACTIVE_VARIABLES 0x9304 -#define GL_ACTIVE_VARIABLES 0x9305 -#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306 -#define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307 -#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308 -#define GL_REFERENCED_BY_GEOMETRY_SHADER 0x9309 -#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A -#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B -#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C -#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D -#define GL_LOCATION 0x930E -#define GL_LOCATION_INDEX 0x930F -#define GL_IS_PER_PATCH 0x92E7 -#define GL_SHADER_STORAGE_BUFFER 0x90D2 -#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3 -#define GL_SHADER_STORAGE_BUFFER_START 0x90D4 -#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5 -#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6 -#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7 -#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8 -#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9 -#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA -#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB -#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC -#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD -#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE -#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF -#define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000 -#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39 -#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA -#define GL_TEXTURE_BUFFER_OFFSET 0x919D -#define GL_TEXTURE_BUFFER_SIZE 0x919E -#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F -#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB -#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC -#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD -#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE -#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF -#define GL_VERTEX_ATTRIB_BINDING 0x82D4 -#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5 -#define GL_VERTEX_BINDING_DIVISOR 0x82D6 -#define GL_VERTEX_BINDING_OFFSET 0x82D7 -#define GL_VERTEX_BINDING_STRIDE 0x82D8 -#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9 -#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA -#define GL_VERTEX_BINDING_BUFFER 0x8F4F -#define GL_DISPLAY_LIST 0x82E7 -typedef void (APIENTRYP pfn_glClearBufferData) (GLenum, GLenum, GLenum, GLenum, const void*); -extern pfn_glClearBufferData fp_glClearBufferData; -typedef void (APIENTRYP pfn_glClearBufferSubData) (GLenum, GLenum, GLintptr, GLsizeiptr, GLenum, GLenum, const void*); -extern pfn_glClearBufferSubData fp_glClearBufferSubData; -typedef void (APIENTRYP pfn_glDispatchCompute) (GLuint, GLuint, GLuint); -extern pfn_glDispatchCompute fp_glDispatchCompute; -typedef void (APIENTRYP pfn_glDispatchComputeIndirect) (GLintptr); -extern pfn_glDispatchComputeIndirect fp_glDispatchComputeIndirect; -typedef void (APIENTRYP pfn_glCopyImageSubData) (GLuint, GLenum, GLint, GLint, GLint, GLint, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei); -extern pfn_glCopyImageSubData fp_glCopyImageSubData; -typedef void (APIENTRYP pfn_glFramebufferParameteri) (GLenum, GLenum, GLint); -extern pfn_glFramebufferParameteri fp_glFramebufferParameteri; -typedef void (APIENTRYP pfn_glGetFramebufferParameteriv) (GLenum, GLenum, GLint*); -extern pfn_glGetFramebufferParameteriv fp_glGetFramebufferParameteriv; -typedef void (APIENTRYP pfn_glGetInternalformati64v) (GLenum, GLenum, GLenum, GLsizei, GLint64*); -extern pfn_glGetInternalformati64v fp_glGetInternalformati64v; -typedef void (APIENTRYP pfn_glInvalidateTexSubImage) (GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei); -extern pfn_glInvalidateTexSubImage fp_glInvalidateTexSubImage; -typedef void (APIENTRYP pfn_glInvalidateTexImage) (GLuint, GLint); -extern pfn_glInvalidateTexImage fp_glInvalidateTexImage; -typedef void (APIENTRYP pfn_glInvalidateBufferSubData) (GLuint, GLintptr, GLsizeiptr); -extern pfn_glInvalidateBufferSubData fp_glInvalidateBufferSubData; -typedef void (APIENTRYP pfn_glInvalidateBufferData) (GLuint); -extern pfn_glInvalidateBufferData fp_glInvalidateBufferData; -typedef void (APIENTRYP pfn_glInvalidateFramebuffer) (GLenum, GLsizei, const GLenum*); -extern pfn_glInvalidateFramebuffer fp_glInvalidateFramebuffer; -typedef void (APIENTRYP pfn_glInvalidateSubFramebuffer) (GLenum, GLsizei, const GLenum*, GLint, GLint, GLsizei, GLsizei); -extern pfn_glInvalidateSubFramebuffer fp_glInvalidateSubFramebuffer; -typedef void (APIENTRYP pfn_glMultiDrawArraysIndirect) (GLenum, const void*, GLsizei, GLsizei); -extern pfn_glMultiDrawArraysIndirect fp_glMultiDrawArraysIndirect; -typedef void (APIENTRYP pfn_glMultiDrawElementsIndirect) (GLenum, GLenum, const void*, GLsizei, GLsizei); -extern pfn_glMultiDrawElementsIndirect fp_glMultiDrawElementsIndirect; -typedef void (APIENTRYP pfn_glGetProgramInterfaceiv) (GLuint, GLenum, GLenum, GLint*); -extern pfn_glGetProgramInterfaceiv fp_glGetProgramInterfaceiv; -typedef GLuint (APIENTRYP pfn_glGetProgramResourceIndex) (GLuint, GLenum, const GLchar*); -extern pfn_glGetProgramResourceIndex fp_glGetProgramResourceIndex; -typedef void (APIENTRYP pfn_glGetProgramResourceName) (GLuint, GLenum, GLuint, GLsizei, GLsizei*, GLchar*); -extern pfn_glGetProgramResourceName fp_glGetProgramResourceName; -typedef void (APIENTRYP pfn_glGetProgramResourceiv) (GLuint, GLenum, GLuint, GLsizei, const GLenum*, GLsizei, GLsizei*, GLint*); -extern pfn_glGetProgramResourceiv fp_glGetProgramResourceiv; -typedef GLint (APIENTRYP pfn_glGetProgramResourceLocation) (GLuint, GLenum, const GLchar*); -extern pfn_glGetProgramResourceLocation fp_glGetProgramResourceLocation; -typedef GLint (APIENTRYP pfn_glGetProgramResourceLocationIndex) (GLuint, GLenum, const GLchar*); -extern pfn_glGetProgramResourceLocationIndex fp_glGetProgramResourceLocationIndex; -typedef void (APIENTRYP pfn_glShaderStorageBlockBinding) (GLuint, GLuint, GLuint); -extern pfn_glShaderStorageBlockBinding fp_glShaderStorageBlockBinding; -typedef void (APIENTRYP pfn_glTexBufferRange) (GLenum, GLenum, GLuint, GLintptr, GLsizeiptr); -extern pfn_glTexBufferRange fp_glTexBufferRange; -typedef void (APIENTRYP pfn_glTexStorage2DMultisample) (GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLboolean); -extern pfn_glTexStorage2DMultisample fp_glTexStorage2DMultisample; -typedef void (APIENTRYP pfn_glTexStorage3DMultisample) (GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean); -extern pfn_glTexStorage3DMultisample fp_glTexStorage3DMultisample; -typedef void (APIENTRYP pfn_glTextureView) (GLuint, GLenum, GLuint, GLenum, GLuint, GLuint, GLuint, GLuint); -extern pfn_glTextureView fp_glTextureView; -typedef void (APIENTRYP pfn_glBindVertexBuffer) (GLuint, GLuint, GLintptr, GLsizei); -extern pfn_glBindVertexBuffer fp_glBindVertexBuffer; -typedef void (APIENTRYP pfn_glVertexAttribFormat) (GLuint, GLint, GLenum, GLboolean, GLuint); -extern pfn_glVertexAttribFormat fp_glVertexAttribFormat; -typedef void (APIENTRYP pfn_glVertexAttribIFormat) (GLuint, GLint, GLenum, GLuint); -extern pfn_glVertexAttribIFormat fp_glVertexAttribIFormat; -typedef void (APIENTRYP pfn_glVertexAttribLFormat) (GLuint, GLint, GLenum, GLuint); -extern pfn_glVertexAttribLFormat fp_glVertexAttribLFormat; -typedef void (APIENTRYP pfn_glVertexAttribBinding) (GLuint, GLuint); -extern pfn_glVertexAttribBinding fp_glVertexAttribBinding; -typedef void (APIENTRYP pfn_glVertexBindingDivisor) (GLuint, GLuint); -extern pfn_glVertexBindingDivisor fp_glVertexBindingDivisor; -typedef void (APIENTRYP pfn_glDebugMessageControl) (GLenum, GLenum, GLenum, GLsizei, const GLuint*, GLboolean); -extern pfn_glDebugMessageControl fp_glDebugMessageControl; -typedef void (APIENTRYP pfn_glDebugMessageInsert) (GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*); -extern pfn_glDebugMessageInsert fp_glDebugMessageInsert; -typedef void (APIENTRYP pfn_glDebugMessageCallback) (GLDEBUGPROC, const void*); -extern pfn_glDebugMessageCallback fp_glDebugMessageCallback; -typedef GLuint (APIENTRYP pfn_glGetDebugMessageLog) (GLuint, GLsizei, GLenum*, GLenum*, GLuint*, GLenum*, GLsizei*, GLchar*); -extern pfn_glGetDebugMessageLog fp_glGetDebugMessageLog; -typedef void (APIENTRYP pfn_glPushDebugGroup) (GLenum, GLuint, GLsizei, const GLchar*); -extern pfn_glPushDebugGroup fp_glPushDebugGroup; -typedef void (APIENTRYP pfn_glPopDebugGroup) (); -extern pfn_glPopDebugGroup fp_glPopDebugGroup; -typedef void (APIENTRYP pfn_glObjectLabel) (GLenum, GLuint, GLsizei, const GLchar*); -extern pfn_glObjectLabel fp_glObjectLabel; -typedef void (APIENTRYP pfn_glGetObjectLabel) (GLenum, GLuint, GLsizei, GLsizei*, GLchar*); -extern pfn_glGetObjectLabel fp_glGetObjectLabel; -typedef void (APIENTRYP pfn_glObjectPtrLabel) (const void*, GLsizei, const GLchar*); -extern pfn_glObjectPtrLabel fp_glObjectPtrLabel; -typedef void (APIENTRYP pfn_glGetObjectPtrLabel) (const void*, GLsizei, GLsizei*, GLchar*); -extern pfn_glGetObjectPtrLabel fp_glGetObjectPtrLabel; - - /* GL_VERSION_4_4 */ -extern GLboolean GLAD_VERSION_4_4; -#define GL_MAX_VERTEX_ATTRIB_STRIDE 0x82E5 -#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221 -#define GL_TEXTURE_BUFFER_BINDING 0x8C2A -#define GL_MAP_PERSISTENT_BIT 0x0040 -#define GL_MAP_COHERENT_BIT 0x0080 -#define GL_DYNAMIC_STORAGE_BIT 0x0100 -#define GL_CLIENT_STORAGE_BIT 0x0200 -#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT 0x00004000 -#define GL_BUFFER_IMMUTABLE_STORAGE 0x821F -#define GL_BUFFER_STORAGE_FLAGS 0x8220 -#define GL_CLEAR_TEXTURE 0x9365 -#define GL_LOCATION_COMPONENT 0x934A -#define GL_TRANSFORM_FEEDBACK_BUFFER_INDEX 0x934B -#define GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE 0x934C -#define GL_QUERY_BUFFER 0x9192 -#define GL_QUERY_BUFFER_BARRIER_BIT 0x00008000 -#define GL_QUERY_BUFFER_BINDING 0x9193 -#define GL_QUERY_RESULT_NO_WAIT 0x9194 -#define GL_MIRROR_CLAMP_TO_EDGE 0x8743 -typedef void (APIENTRYP pfn_glBufferStorage) (GLenum, GLsizeiptr, const void*, GLbitfield); -extern pfn_glBufferStorage fp_glBufferStorage; -typedef void (APIENTRYP pfn_glClearTexImage) (GLuint, GLint, GLenum, GLenum, const void*); -extern pfn_glClearTexImage fp_glClearTexImage; -typedef void (APIENTRYP pfn_glClearTexSubImage) (GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const void*); -extern pfn_glClearTexSubImage fp_glClearTexSubImage; -typedef void (APIENTRYP pfn_glBindBuffersBase) (GLenum, GLuint, GLsizei, const GLuint*); -extern pfn_glBindBuffersBase fp_glBindBuffersBase; -typedef void (APIENTRYP pfn_glBindBuffersRange) (GLenum, GLuint, GLsizei, const GLuint*, const GLintptr*, const GLsizeiptr*); -extern pfn_glBindBuffersRange fp_glBindBuffersRange; -typedef void (APIENTRYP pfn_glBindTextures) (GLuint, GLsizei, const GLuint*); -extern pfn_glBindTextures fp_glBindTextures; -typedef void (APIENTRYP pfn_glBindSamplers) (GLuint, GLsizei, const GLuint*); -extern pfn_glBindSamplers fp_glBindSamplers; -typedef void (APIENTRYP pfn_glBindImageTextures) (GLuint, GLsizei, const GLuint*); -extern pfn_glBindImageTextures fp_glBindImageTextures; -typedef void (APIENTRYP pfn_glBindVertexBuffers) (GLuint, GLsizei, const GLuint*, const GLintptr*, const GLsizei*); -extern pfn_glBindVertexBuffers fp_glBindVertexBuffers; - - /* GL_VERSION_4_5 */ -extern GLboolean GLAD_VERSION_4_5; -#define GL_CONTEXT_LOST 0x0507 -#define GL_NEGATIVE_ONE_TO_ONE 0x935E -#define GL_ZERO_TO_ONE 0x935F -#define GL_CLIP_ORIGIN 0x935C -#define GL_CLIP_DEPTH_MODE 0x935D -#define GL_QUERY_WAIT_INVERTED 0x8E17 -#define GL_QUERY_NO_WAIT_INVERTED 0x8E18 -#define GL_QUERY_BY_REGION_WAIT_INVERTED 0x8E19 -#define GL_QUERY_BY_REGION_NO_WAIT_INVERTED 0x8E1A -#define GL_MAX_CULL_DISTANCES 0x82F9 -#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES 0x82FA -#define GL_TEXTURE_TARGET 0x1006 -#define GL_QUERY_TARGET 0x82EA -#define GL_GUILTY_CONTEXT_RESET 0x8253 -#define GL_INNOCENT_CONTEXT_RESET 0x8254 -#define GL_UNKNOWN_CONTEXT_RESET 0x8255 -#define GL_RESET_NOTIFICATION_STRATEGY 0x8256 -#define GL_LOSE_CONTEXT_ON_RESET 0x8252 -#define GL_NO_RESET_NOTIFICATION 0x8261 -#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT 0x00000004 -#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82FB -#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82FC -typedef void (APIENTRYP pfn_glClipControl) (GLenum, GLenum); -extern pfn_glClipControl fp_glClipControl; -typedef void (APIENTRYP pfn_glCreateTransformFeedbacks) (GLsizei, GLuint*); -extern pfn_glCreateTransformFeedbacks fp_glCreateTransformFeedbacks; -typedef void (APIENTRYP pfn_glTransformFeedbackBufferBase) (GLuint, GLuint, GLuint); -extern pfn_glTransformFeedbackBufferBase fp_glTransformFeedbackBufferBase; -typedef void (APIENTRYP pfn_glTransformFeedbackBufferRange) (GLuint, GLuint, GLuint, GLintptr, GLsizeiptr); -extern pfn_glTransformFeedbackBufferRange fp_glTransformFeedbackBufferRange; -typedef void (APIENTRYP pfn_glGetTransformFeedbackiv) (GLuint, GLenum, GLint*); -extern pfn_glGetTransformFeedbackiv fp_glGetTransformFeedbackiv; -typedef void (APIENTRYP pfn_glGetTransformFeedbacki_v) (GLuint, GLenum, GLuint, GLint*); -extern pfn_glGetTransformFeedbacki_v fp_glGetTransformFeedbacki_v; -typedef void (APIENTRYP pfn_glGetTransformFeedbacki64_v) (GLuint, GLenum, GLuint, GLint64*); -extern pfn_glGetTransformFeedbacki64_v fp_glGetTransformFeedbacki64_v; -typedef void (APIENTRYP pfn_glCreateBuffers) (GLsizei, GLuint*); -extern pfn_glCreateBuffers fp_glCreateBuffers; -typedef void (APIENTRYP pfn_glNamedBufferStorage) (GLuint, GLsizeiptr, const void*, GLbitfield); -extern pfn_glNamedBufferStorage fp_glNamedBufferStorage; -typedef void (APIENTRYP pfn_glNamedBufferData) (GLuint, GLsizeiptr, const void*, GLenum); -extern pfn_glNamedBufferData fp_glNamedBufferData; -typedef void (APIENTRYP pfn_glNamedBufferSubData) (GLuint, GLintptr, GLsizeiptr, const void*); -extern pfn_glNamedBufferSubData fp_glNamedBufferSubData; -typedef void (APIENTRYP pfn_glCopyNamedBufferSubData) (GLuint, GLuint, GLintptr, GLintptr, GLsizeiptr); -extern pfn_glCopyNamedBufferSubData fp_glCopyNamedBufferSubData; -typedef void (APIENTRYP pfn_glClearNamedBufferData) (GLuint, GLenum, GLenum, GLenum, const void*); -extern pfn_glClearNamedBufferData fp_glClearNamedBufferData; -typedef void (APIENTRYP pfn_glClearNamedBufferSubData) (GLuint, GLenum, GLintptr, GLsizeiptr, GLenum, GLenum, const void*); -extern pfn_glClearNamedBufferSubData fp_glClearNamedBufferSubData; -typedef void* (APIENTRYP pfn_glMapNamedBuffer) (GLuint, GLenum); -extern pfn_glMapNamedBuffer fp_glMapNamedBuffer; -typedef void* (APIENTRYP pfn_glMapNamedBufferRange) (GLuint, GLintptr, GLsizeiptr, GLbitfield); -extern pfn_glMapNamedBufferRange fp_glMapNamedBufferRange; -typedef GLboolean (APIENTRYP pfn_glUnmapNamedBuffer) (GLuint); -extern pfn_glUnmapNamedBuffer fp_glUnmapNamedBuffer; -typedef void (APIENTRYP pfn_glFlushMappedNamedBufferRange) (GLuint, GLintptr, GLsizeiptr); -extern pfn_glFlushMappedNamedBufferRange fp_glFlushMappedNamedBufferRange; -typedef void (APIENTRYP pfn_glGetNamedBufferParameteriv) (GLuint, GLenum, GLint*); -extern pfn_glGetNamedBufferParameteriv fp_glGetNamedBufferParameteriv; -typedef void (APIENTRYP pfn_glGetNamedBufferParameteri64v) (GLuint, GLenum, GLint64*); -extern pfn_glGetNamedBufferParameteri64v fp_glGetNamedBufferParameteri64v; -typedef void (APIENTRYP pfn_glGetNamedBufferPointerv) (GLuint, GLenum, void**); -extern pfn_glGetNamedBufferPointerv fp_glGetNamedBufferPointerv; -typedef void (APIENTRYP pfn_glGetNamedBufferSubData) (GLuint, GLintptr, GLsizeiptr, void*); -extern pfn_glGetNamedBufferSubData fp_glGetNamedBufferSubData; -typedef void (APIENTRYP pfn_glCreateFramebuffers) (GLsizei, GLuint*); -extern pfn_glCreateFramebuffers fp_glCreateFramebuffers; -typedef void (APIENTRYP pfn_glNamedFramebufferRenderbuffer) (GLuint, GLenum, GLenum, GLuint); -extern pfn_glNamedFramebufferRenderbuffer fp_glNamedFramebufferRenderbuffer; -typedef void (APIENTRYP pfn_glNamedFramebufferParameteri) (GLuint, GLenum, GLint); -extern pfn_glNamedFramebufferParameteri fp_glNamedFramebufferParameteri; -typedef void (APIENTRYP pfn_glNamedFramebufferTexture) (GLuint, GLenum, GLuint, GLint); -extern pfn_glNamedFramebufferTexture fp_glNamedFramebufferTexture; -typedef void (APIENTRYP pfn_glNamedFramebufferTextureLayer) (GLuint, GLenum, GLuint, GLint, GLint); -extern pfn_glNamedFramebufferTextureLayer fp_glNamedFramebufferTextureLayer; -typedef void (APIENTRYP pfn_glNamedFramebufferDrawBuffer) (GLuint, GLenum); -extern pfn_glNamedFramebufferDrawBuffer fp_glNamedFramebufferDrawBuffer; -typedef void (APIENTRYP pfn_glNamedFramebufferDrawBuffers) (GLuint, GLsizei, const GLenum*); -extern pfn_glNamedFramebufferDrawBuffers fp_glNamedFramebufferDrawBuffers; -typedef void (APIENTRYP pfn_glNamedFramebufferReadBuffer) (GLuint, GLenum); -extern pfn_glNamedFramebufferReadBuffer fp_glNamedFramebufferReadBuffer; -typedef void (APIENTRYP pfn_glInvalidateNamedFramebufferData) (GLuint, GLsizei, const GLenum*); -extern pfn_glInvalidateNamedFramebufferData fp_glInvalidateNamedFramebufferData; -typedef void (APIENTRYP pfn_glInvalidateNamedFramebufferSubData) (GLuint, GLsizei, const GLenum*, GLint, GLint, GLsizei, GLsizei); -extern pfn_glInvalidateNamedFramebufferSubData fp_glInvalidateNamedFramebufferSubData; -typedef void (APIENTRYP pfn_glClearNamedFramebufferiv) (GLuint, GLenum, GLint, const GLint*); -extern pfn_glClearNamedFramebufferiv fp_glClearNamedFramebufferiv; -typedef void (APIENTRYP pfn_glClearNamedFramebufferuiv) (GLuint, GLenum, GLint, const GLuint*); -extern pfn_glClearNamedFramebufferuiv fp_glClearNamedFramebufferuiv; -typedef void (APIENTRYP pfn_glClearNamedFramebufferfv) (GLuint, GLenum, GLint, const GLfloat*); -extern pfn_glClearNamedFramebufferfv fp_glClearNamedFramebufferfv; -typedef void (APIENTRYP pfn_glClearNamedFramebufferfi) (GLuint, GLenum, GLint, GLfloat, GLint); -extern pfn_glClearNamedFramebufferfi fp_glClearNamedFramebufferfi; -typedef void (APIENTRYP pfn_glBlitNamedFramebuffer) (GLuint, GLuint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum); -extern pfn_glBlitNamedFramebuffer fp_glBlitNamedFramebuffer; -typedef GLenum (APIENTRYP pfn_glCheckNamedFramebufferStatus) (GLuint, GLenum); -extern pfn_glCheckNamedFramebufferStatus fp_glCheckNamedFramebufferStatus; -typedef void (APIENTRYP pfn_glGetNamedFramebufferParameteriv) (GLuint, GLenum, GLint*); -extern pfn_glGetNamedFramebufferParameteriv fp_glGetNamedFramebufferParameteriv; -typedef void (APIENTRYP pfn_glGetNamedFramebufferAttachmentParameteriv) (GLuint, GLenum, GLenum, GLint*); -extern pfn_glGetNamedFramebufferAttachmentParameteriv fp_glGetNamedFramebufferAttachmentParameteriv; -typedef void (APIENTRYP pfn_glCreateRenderbuffers) (GLsizei, GLuint*); -extern pfn_glCreateRenderbuffers fp_glCreateRenderbuffers; -typedef void (APIENTRYP pfn_glNamedRenderbufferStorage) (GLuint, GLenum, GLsizei, GLsizei); -extern pfn_glNamedRenderbufferStorage fp_glNamedRenderbufferStorage; -typedef void (APIENTRYP pfn_glNamedRenderbufferStorageMultisample) (GLuint, GLsizei, GLenum, GLsizei, GLsizei); -extern pfn_glNamedRenderbufferStorageMultisample fp_glNamedRenderbufferStorageMultisample; -typedef void (APIENTRYP pfn_glGetNamedRenderbufferParameteriv) (GLuint, GLenum, GLint*); -extern pfn_glGetNamedRenderbufferParameteriv fp_glGetNamedRenderbufferParameteriv; -typedef void (APIENTRYP pfn_glCreateTextures) (GLenum, GLsizei, GLuint*); -extern pfn_glCreateTextures fp_glCreateTextures; -typedef void (APIENTRYP pfn_glTextureBuffer) (GLuint, GLenum, GLuint); -extern pfn_glTextureBuffer fp_glTextureBuffer; -typedef void (APIENTRYP pfn_glTextureBufferRange) (GLuint, GLenum, GLuint, GLintptr, GLsizeiptr); -extern pfn_glTextureBufferRange fp_glTextureBufferRange; -typedef void (APIENTRYP pfn_glTextureStorage1D) (GLuint, GLsizei, GLenum, GLsizei); -extern pfn_glTextureStorage1D fp_glTextureStorage1D; -typedef void (APIENTRYP pfn_glTextureStorage2D) (GLuint, GLsizei, GLenum, GLsizei, GLsizei); -extern pfn_glTextureStorage2D fp_glTextureStorage2D; -typedef void (APIENTRYP pfn_glTextureStorage3D) (GLuint, GLsizei, GLenum, GLsizei, GLsizei, GLsizei); -extern pfn_glTextureStorage3D fp_glTextureStorage3D; -typedef void (APIENTRYP pfn_glTextureStorage2DMultisample) (GLuint, GLsizei, GLenum, GLsizei, GLsizei, GLboolean); -extern pfn_glTextureStorage2DMultisample fp_glTextureStorage2DMultisample; -typedef void (APIENTRYP pfn_glTextureStorage3DMultisample) (GLuint, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean); -extern pfn_glTextureStorage3DMultisample fp_glTextureStorage3DMultisample; -typedef void (APIENTRYP pfn_glTextureSubImage1D) (GLuint, GLint, GLint, GLsizei, GLenum, GLenum, const void*); -extern pfn_glTextureSubImage1D fp_glTextureSubImage1D; -typedef void (APIENTRYP pfn_glTextureSubImage2D) (GLuint, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void*); -extern pfn_glTextureSubImage2D fp_glTextureSubImage2D; -typedef void (APIENTRYP pfn_glTextureSubImage3D) (GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const void*); -extern pfn_glTextureSubImage3D fp_glTextureSubImage3D; -typedef void (APIENTRYP pfn_glCompressedTextureSubImage1D) (GLuint, GLint, GLint, GLsizei, GLenum, GLsizei, const void*); -extern pfn_glCompressedTextureSubImage1D fp_glCompressedTextureSubImage1D; -typedef void (APIENTRYP pfn_glCompressedTextureSubImage2D) (GLuint, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void*); -extern pfn_glCompressedTextureSubImage2D fp_glCompressedTextureSubImage2D; -typedef void (APIENTRYP pfn_glCompressedTextureSubImage3D) (GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const void*); -extern pfn_glCompressedTextureSubImage3D fp_glCompressedTextureSubImage3D; -typedef void (APIENTRYP pfn_glCopyTextureSubImage1D) (GLuint, GLint, GLint, GLint, GLint, GLsizei); -extern pfn_glCopyTextureSubImage1D fp_glCopyTextureSubImage1D; -typedef void (APIENTRYP pfn_glCopyTextureSubImage2D) (GLuint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); -extern pfn_glCopyTextureSubImage2D fp_glCopyTextureSubImage2D; -typedef void (APIENTRYP pfn_glCopyTextureSubImage3D) (GLuint, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); -extern pfn_glCopyTextureSubImage3D fp_glCopyTextureSubImage3D; -typedef void (APIENTRYP pfn_glTextureParameterf) (GLuint, GLenum, GLfloat); -extern pfn_glTextureParameterf fp_glTextureParameterf; -typedef void (APIENTRYP pfn_glTextureParameterfv) (GLuint, GLenum, const GLfloat*); -extern pfn_glTextureParameterfv fp_glTextureParameterfv; -typedef void (APIENTRYP pfn_glTextureParameteri) (GLuint, GLenum, GLint); -extern pfn_glTextureParameteri fp_glTextureParameteri; -typedef void (APIENTRYP pfn_glTextureParameterIiv) (GLuint, GLenum, const GLint*); -extern pfn_glTextureParameterIiv fp_glTextureParameterIiv; -typedef void (APIENTRYP pfn_glTextureParameterIuiv) (GLuint, GLenum, const GLuint*); -extern pfn_glTextureParameterIuiv fp_glTextureParameterIuiv; -typedef void (APIENTRYP pfn_glTextureParameteriv) (GLuint, GLenum, const GLint*); -extern pfn_glTextureParameteriv fp_glTextureParameteriv; -typedef void (APIENTRYP pfn_glGenerateTextureMipmap) (GLuint); -extern pfn_glGenerateTextureMipmap fp_glGenerateTextureMipmap; -typedef void (APIENTRYP pfn_glBindTextureUnit) (GLuint, GLuint); -extern pfn_glBindTextureUnit fp_glBindTextureUnit; -typedef void (APIENTRYP pfn_glGetTextureImage) (GLuint, GLint, GLenum, GLenum, GLsizei, void*); -extern pfn_glGetTextureImage fp_glGetTextureImage; -typedef void (APIENTRYP pfn_glGetCompressedTextureImage) (GLuint, GLint, GLsizei, void*); -extern pfn_glGetCompressedTextureImage fp_glGetCompressedTextureImage; -typedef void (APIENTRYP pfn_glGetTextureLevelParameterfv) (GLuint, GLint, GLenum, GLfloat*); -extern pfn_glGetTextureLevelParameterfv fp_glGetTextureLevelParameterfv; -typedef void (APIENTRYP pfn_glGetTextureLevelParameteriv) (GLuint, GLint, GLenum, GLint*); -extern pfn_glGetTextureLevelParameteriv fp_glGetTextureLevelParameteriv; -typedef void (APIENTRYP pfn_glGetTextureParameterfv) (GLuint, GLenum, GLfloat*); -extern pfn_glGetTextureParameterfv fp_glGetTextureParameterfv; -typedef void (APIENTRYP pfn_glGetTextureParameterIiv) (GLuint, GLenum, GLint*); -extern pfn_glGetTextureParameterIiv fp_glGetTextureParameterIiv; -typedef void (APIENTRYP pfn_glGetTextureParameterIuiv) (GLuint, GLenum, GLuint*); -extern pfn_glGetTextureParameterIuiv fp_glGetTextureParameterIuiv; -typedef void (APIENTRYP pfn_glGetTextureParameteriv) (GLuint, GLenum, GLint*); -extern pfn_glGetTextureParameteriv fp_glGetTextureParameteriv; -typedef void (APIENTRYP pfn_glCreateVertexArrays) (GLsizei, GLuint*); -extern pfn_glCreateVertexArrays fp_glCreateVertexArrays; -typedef void (APIENTRYP pfn_glDisableVertexArrayAttrib) (GLuint, GLuint); -extern pfn_glDisableVertexArrayAttrib fp_glDisableVertexArrayAttrib; -typedef void (APIENTRYP pfn_glEnableVertexArrayAttrib) (GLuint, GLuint); -extern pfn_glEnableVertexArrayAttrib fp_glEnableVertexArrayAttrib; -typedef void (APIENTRYP pfn_glVertexArrayElementBuffer) (GLuint, GLuint); -extern pfn_glVertexArrayElementBuffer fp_glVertexArrayElementBuffer; -typedef void (APIENTRYP pfn_glVertexArrayVertexBuffer) (GLuint, GLuint, GLuint, GLintptr, GLsizei); -extern pfn_glVertexArrayVertexBuffer fp_glVertexArrayVertexBuffer; -typedef void (APIENTRYP pfn_glVertexArrayVertexBuffers) (GLuint, GLuint, GLsizei, const GLuint*, const GLintptr*, const GLsizei*); -extern pfn_glVertexArrayVertexBuffers fp_glVertexArrayVertexBuffers; -typedef void (APIENTRYP pfn_glVertexArrayAttribBinding) (GLuint, GLuint, GLuint); -extern pfn_glVertexArrayAttribBinding fp_glVertexArrayAttribBinding; -typedef void (APIENTRYP pfn_glVertexArrayAttribFormat) (GLuint, GLuint, GLint, GLenum, GLboolean, GLuint); -extern pfn_glVertexArrayAttribFormat fp_glVertexArrayAttribFormat; -typedef void (APIENTRYP pfn_glVertexArrayAttribIFormat) (GLuint, GLuint, GLint, GLenum, GLuint); -extern pfn_glVertexArrayAttribIFormat fp_glVertexArrayAttribIFormat; -typedef void (APIENTRYP pfn_glVertexArrayAttribLFormat) (GLuint, GLuint, GLint, GLenum, GLuint); -extern pfn_glVertexArrayAttribLFormat fp_glVertexArrayAttribLFormat; -typedef void (APIENTRYP pfn_glVertexArrayBindingDivisor) (GLuint, GLuint, GLuint); -extern pfn_glVertexArrayBindingDivisor fp_glVertexArrayBindingDivisor; -typedef void (APIENTRYP pfn_glGetVertexArrayiv) (GLuint, GLenum, GLint*); -extern pfn_glGetVertexArrayiv fp_glGetVertexArrayiv; -typedef void (APIENTRYP pfn_glGetVertexArrayIndexediv) (GLuint, GLuint, GLenum, GLint*); -extern pfn_glGetVertexArrayIndexediv fp_glGetVertexArrayIndexediv; -typedef void (APIENTRYP pfn_glGetVertexArrayIndexed64iv) (GLuint, GLuint, GLenum, GLint64*); -extern pfn_glGetVertexArrayIndexed64iv fp_glGetVertexArrayIndexed64iv; -typedef void (APIENTRYP pfn_glCreateSamplers) (GLsizei, GLuint*); -extern pfn_glCreateSamplers fp_glCreateSamplers; -typedef void (APIENTRYP pfn_glCreateProgramPipelines) (GLsizei, GLuint*); -extern pfn_glCreateProgramPipelines fp_glCreateProgramPipelines; -typedef void (APIENTRYP pfn_glCreateQueries) (GLenum, GLsizei, GLuint*); -extern pfn_glCreateQueries fp_glCreateQueries; -typedef void (APIENTRYP pfn_glGetQueryBufferObjecti64v) (GLuint, GLuint, GLenum, GLintptr); -extern pfn_glGetQueryBufferObjecti64v fp_glGetQueryBufferObjecti64v; -typedef void (APIENTRYP pfn_glGetQueryBufferObjectiv) (GLuint, GLuint, GLenum, GLintptr); -extern pfn_glGetQueryBufferObjectiv fp_glGetQueryBufferObjectiv; -typedef void (APIENTRYP pfn_glGetQueryBufferObjectui64v) (GLuint, GLuint, GLenum, GLintptr); -extern pfn_glGetQueryBufferObjectui64v fp_glGetQueryBufferObjectui64v; -typedef void (APIENTRYP pfn_glGetQueryBufferObjectuiv) (GLuint, GLuint, GLenum, GLintptr); -extern pfn_glGetQueryBufferObjectuiv fp_glGetQueryBufferObjectuiv; -typedef void (APIENTRYP pfn_glMemoryBarrierByRegion) (GLbitfield); -extern pfn_glMemoryBarrierByRegion fp_glMemoryBarrierByRegion; -typedef void (APIENTRYP pfn_glGetTextureSubImage) (GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, GLsizei, void*); -extern pfn_glGetTextureSubImage fp_glGetTextureSubImage; -typedef void (APIENTRYP pfn_glGetCompressedTextureSubImage) (GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, void*); -extern pfn_glGetCompressedTextureSubImage fp_glGetCompressedTextureSubImage; -typedef GLenum (APIENTRYP pfn_glGetGraphicsResetStatus) (); -extern pfn_glGetGraphicsResetStatus fp_glGetGraphicsResetStatus; -typedef void (APIENTRYP pfn_glGetnCompressedTexImage) (GLenum, GLint, GLsizei, void*); -extern pfn_glGetnCompressedTexImage fp_glGetnCompressedTexImage; -typedef void (APIENTRYP pfn_glGetnTexImage) (GLenum, GLint, GLenum, GLenum, GLsizei, void*); -extern pfn_glGetnTexImage fp_glGetnTexImage; -typedef void (APIENTRYP pfn_glGetnUniformdv) (GLuint, GLint, GLsizei, GLdouble*); -extern pfn_glGetnUniformdv fp_glGetnUniformdv; -typedef void (APIENTRYP pfn_glGetnUniformfv) (GLuint, GLint, GLsizei, GLfloat*); -extern pfn_glGetnUniformfv fp_glGetnUniformfv; -typedef void (APIENTRYP pfn_glGetnUniformiv) (GLuint, GLint, GLsizei, GLint*); -extern pfn_glGetnUniformiv fp_glGetnUniformiv; -typedef void (APIENTRYP pfn_glGetnUniformuiv) (GLuint, GLint, GLsizei, GLuint*); -extern pfn_glGetnUniformuiv fp_glGetnUniformuiv; -typedef void (APIENTRYP pfn_glReadnPixels) (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLsizei, void*); -extern pfn_glReadnPixels fp_glReadnPixels; -typedef void (APIENTRYP pfn_glGetnMapdv) (GLenum, GLenum, GLsizei, GLdouble*); -extern pfn_glGetnMapdv fp_glGetnMapdv; -typedef void (APIENTRYP pfn_glGetnMapfv) (GLenum, GLenum, GLsizei, GLfloat*); -extern pfn_glGetnMapfv fp_glGetnMapfv; -typedef void (APIENTRYP pfn_glGetnMapiv) (GLenum, GLenum, GLsizei, GLint*); -extern pfn_glGetnMapiv fp_glGetnMapiv; -typedef void (APIENTRYP pfn_glGetnPixelMapfv) (GLenum, GLsizei, GLfloat*); -extern pfn_glGetnPixelMapfv fp_glGetnPixelMapfv; -typedef void (APIENTRYP pfn_glGetnPixelMapuiv) (GLenum, GLsizei, GLuint*); -extern pfn_glGetnPixelMapuiv fp_glGetnPixelMapuiv; -typedef void (APIENTRYP pfn_glGetnPixelMapusv) (GLenum, GLsizei, GLushort*); -extern pfn_glGetnPixelMapusv fp_glGetnPixelMapusv; -typedef void (APIENTRYP pfn_glGetnPolygonStipple) (GLsizei, GLubyte*); -extern pfn_glGetnPolygonStipple fp_glGetnPolygonStipple; -typedef void (APIENTRYP pfn_glGetnColorTable) (GLenum, GLenum, GLenum, GLsizei, void*); -extern pfn_glGetnColorTable fp_glGetnColorTable; -typedef void (APIENTRYP pfn_glGetnConvolutionFilter) (GLenum, GLenum, GLenum, GLsizei, void*); -extern pfn_glGetnConvolutionFilter fp_glGetnConvolutionFilter; -typedef void (APIENTRYP pfn_glGetnSeparableFilter) (GLenum, GLenum, GLenum, GLsizei, void*, GLsizei, void*, void*); -extern pfn_glGetnSeparableFilter fp_glGetnSeparableFilter; -typedef void (APIENTRYP pfn_glGetnHistogram) (GLenum, GLboolean, GLenum, GLenum, GLsizei, void*); -extern pfn_glGetnHistogram fp_glGetnHistogram; -typedef void (APIENTRYP pfn_glGetnMinmax) (GLenum, GLboolean, GLenum, GLenum, GLsizei, void*); -extern pfn_glGetnMinmax fp_glGetnMinmax; -typedef void (APIENTRYP pfn_glTextureBarrier) (); -extern pfn_glTextureBarrier fp_glTextureBarrier; - - /* GL_ES_VERSION_2_0 */ -extern GLboolean GLAD_ES_VERSION_2_0; -#define GL_BLEND_EQUATION 0x8009 -#define GL_BLEND_COLOR 0x8005 -#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 - - /* GL_ES_VERSION_3_0 */ -extern GLboolean GLAD_ES_VERSION_3_0; - - /* GL_ES_VERSION_3_1 */ -extern GLboolean GLAD_ES_VERSION_3_1; - - /* GL_ES_VERSION_3_2 */ -extern GLboolean GLAD_ES_VERSION_3_2; -#define GL_MULTISAMPLE_LINE_WIDTH_RANGE 0x9381 -#define GL_MULTISAMPLE_LINE_WIDTH_GRANULARITY 0x9382 -#define GL_MULTIPLY 0x9294 -#define GL_SCREEN 0x9295 -#define GL_OVERLAY 0x9296 -#define GL_DARKEN 0x9297 -#define GL_LIGHTEN 0x9298 -#define GL_COLORDODGE 0x9299 -#define GL_COLORBURN 0x929A -#define GL_HARDLIGHT 0x929B -#define GL_SOFTLIGHT 0x929C -#define GL_DIFFERENCE 0x929E -#define GL_EXCLUSION 0x92A0 -#define GL_HSL_HUE 0x92AD -#define GL_HSL_SATURATION 0x92AE -#define GL_HSL_COLOR 0x92AF -#define GL_HSL_LUMINOSITY 0x92B0 -#define GL_PRIMITIVE_BOUNDING_BOX 0x92BE -#define GL_COMPRESSED_RGBA_ASTC_4x4 0x93B0 -#define GL_COMPRESSED_RGBA_ASTC_5x4 0x93B1 -#define GL_COMPRESSED_RGBA_ASTC_5x5 0x93B2 -#define GL_COMPRESSED_RGBA_ASTC_6x5 0x93B3 -#define GL_COMPRESSED_RGBA_ASTC_6x6 0x93B4 -#define GL_COMPRESSED_RGBA_ASTC_8x5 0x93B5 -#define GL_COMPRESSED_RGBA_ASTC_8x6 0x93B6 -#define GL_COMPRESSED_RGBA_ASTC_8x8 0x93B7 -#define GL_COMPRESSED_RGBA_ASTC_10x5 0x93B8 -#define GL_COMPRESSED_RGBA_ASTC_10x6 0x93B9 -#define GL_COMPRESSED_RGBA_ASTC_10x8 0x93BA -#define GL_COMPRESSED_RGBA_ASTC_10x10 0x93BB -#define GL_COMPRESSED_RGBA_ASTC_12x10 0x93BC -#define GL_COMPRESSED_RGBA_ASTC_12x12 0x93BD -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4 0x93D0 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4 0x93D1 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5 0x93D2 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5 0x93D3 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6 0x93D4 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5 0x93D5 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6 0x93D6 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8 0x93D7 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5 0x93D8 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6 0x93D9 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8 0x93DA -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10 0x93DB -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10 0x93DC -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12 0x93DD -typedef void (APIENTRYP pfn_glBlendBarrier) (); -extern pfn_glBlendBarrier fp_glBlendBarrier; -typedef void (APIENTRYP pfn_glPrimitiveBoundingBox) (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -extern pfn_glPrimitiveBoundingBox fp_glPrimitiveBoundingBox; - - /* GL_KHR_blend_equation_advanced */ -extern GLboolean GLAD_KHR_blend_equation_advanced; -#define GL_MULTIPLY_KHR 0x9294 -#define GL_SCREEN_KHR 0x9295 -#define GL_OVERLAY_KHR 0x9296 -#define GL_DARKEN_KHR 0x9297 -#define GL_LIGHTEN_KHR 0x9298 -#define GL_COLORDODGE_KHR 0x9299 -#define GL_COLORBURN_KHR 0x929A -#define GL_HARDLIGHT_KHR 0x929B -#define GL_SOFTLIGHT_KHR 0x929C -#define GL_DIFFERENCE_KHR 0x929E -#define GL_EXCLUSION_KHR 0x92A0 -#define GL_HSL_HUE_KHR 0x92AD -#define GL_HSL_SATURATION_KHR 0x92AE -#define GL_HSL_COLOR_KHR 0x92AF -#define GL_HSL_LUMINOSITY_KHR 0x92B0 -typedef void (APIENTRYP pfn_glBlendBarrierKHR) (); -extern pfn_glBlendBarrierKHR fp_glBlendBarrierKHR; - - /* GL_KHR_blend_equation_advanced_coherent */ -extern GLboolean GLAD_KHR_blend_equation_advanced_coherent; -#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285 - - /* GL_KHR_context_flush_control */ -extern GLboolean GLAD_KHR_context_flush_control; -#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB -#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x82FC - - /* GL_KHR_debug */ -extern GLboolean GLAD_KHR_debug; -#define GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR 0x8242 -#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR 0x8243 -#define GL_DEBUG_CALLBACK_FUNCTION_KHR 0x8244 -#define GL_DEBUG_CALLBACK_USER_PARAM_KHR 0x8245 -#define GL_DEBUG_SOURCE_API_KHR 0x8246 -#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR 0x8247 -#define GL_DEBUG_SOURCE_SHADER_COMPILER_KHR 0x8248 -#define GL_DEBUG_SOURCE_THIRD_PARTY_KHR 0x8249 -#define GL_DEBUG_SOURCE_APPLICATION_KHR 0x824A -#define GL_DEBUG_SOURCE_OTHER_KHR 0x824B -#define GL_DEBUG_TYPE_ERROR_KHR 0x824C -#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR 0x824D -#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR 0x824E -#define GL_DEBUG_TYPE_PORTABILITY_KHR 0x824F -#define GL_DEBUG_TYPE_PERFORMANCE_KHR 0x8250 -#define GL_DEBUG_TYPE_OTHER_KHR 0x8251 -#define GL_DEBUG_TYPE_MARKER_KHR 0x8268 -#define GL_DEBUG_TYPE_PUSH_GROUP_KHR 0x8269 -#define GL_DEBUG_TYPE_POP_GROUP_KHR 0x826A -#define GL_DEBUG_SEVERITY_NOTIFICATION_KHR 0x826B -#define GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR 0x826C -#define GL_DEBUG_GROUP_STACK_DEPTH_KHR 0x826D -#define GL_BUFFER_KHR 0x82E0 -#define GL_SHADER_KHR 0x82E1 -#define GL_PROGRAM_KHR 0x82E2 -#define GL_VERTEX_ARRAY_KHR 0x8074 -#define GL_QUERY_KHR 0x82E3 -#define GL_PROGRAM_PIPELINE_KHR 0x82E4 -#define GL_SAMPLER_KHR 0x82E6 -#define GL_MAX_LABEL_LENGTH_KHR 0x82E8 -#define GL_MAX_DEBUG_MESSAGE_LENGTH_KHR 0x9143 -#define GL_MAX_DEBUG_LOGGED_MESSAGES_KHR 0x9144 -#define GL_DEBUG_LOGGED_MESSAGES_KHR 0x9145 -#define GL_DEBUG_SEVERITY_HIGH_KHR 0x9146 -#define GL_DEBUG_SEVERITY_MEDIUM_KHR 0x9147 -#define GL_DEBUG_SEVERITY_LOW_KHR 0x9148 -#define GL_DEBUG_OUTPUT_KHR 0x92E0 -#define GL_CONTEXT_FLAG_DEBUG_BIT_KHR 0x00000002 -#define GL_STACK_OVERFLOW_KHR 0x0503 -#define GL_STACK_UNDERFLOW_KHR 0x0504 -typedef void (APIENTRYP pfn_glDebugMessageControlKHR) (GLenum, GLenum, GLenum, GLsizei, const GLuint*, GLboolean); -extern pfn_glDebugMessageControlKHR fp_glDebugMessageControlKHR; -typedef void (APIENTRYP pfn_glDebugMessageInsertKHR) (GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*); -extern pfn_glDebugMessageInsertKHR fp_glDebugMessageInsertKHR; -typedef void (APIENTRYP pfn_glDebugMessageCallbackKHR) (GLDEBUGPROCKHR, const void*); -extern pfn_glDebugMessageCallbackKHR fp_glDebugMessageCallbackKHR; -typedef GLuint (APIENTRYP pfn_glGetDebugMessageLogKHR) (GLuint, GLsizei, GLenum*, GLenum*, GLuint*, GLenum*, GLsizei*, GLchar*); -extern pfn_glGetDebugMessageLogKHR fp_glGetDebugMessageLogKHR; -typedef void (APIENTRYP pfn_glPushDebugGroupKHR) (GLenum, GLuint, GLsizei, const GLchar*); -extern pfn_glPushDebugGroupKHR fp_glPushDebugGroupKHR; -typedef void (APIENTRYP pfn_glPopDebugGroupKHR) (); -extern pfn_glPopDebugGroupKHR fp_glPopDebugGroupKHR; -typedef void (APIENTRYP pfn_glObjectLabelKHR) (GLenum, GLuint, GLsizei, const GLchar*); -extern pfn_glObjectLabelKHR fp_glObjectLabelKHR; -typedef void (APIENTRYP pfn_glGetObjectLabelKHR) (GLenum, GLuint, GLsizei, GLsizei*, GLchar*); -extern pfn_glGetObjectLabelKHR fp_glGetObjectLabelKHR; -typedef void (APIENTRYP pfn_glObjectPtrLabelKHR) (const void*, GLsizei, const GLchar*); -extern pfn_glObjectPtrLabelKHR fp_glObjectPtrLabelKHR; -typedef void (APIENTRYP pfn_glGetObjectPtrLabelKHR) (const void*, GLsizei, GLsizei*, GLchar*); -extern pfn_glGetObjectPtrLabelKHR fp_glGetObjectPtrLabelKHR; -typedef void (APIENTRYP pfn_glGetPointervKHR) (GLenum, void**); -extern pfn_glGetPointervKHR fp_glGetPointervKHR; - - /* GL_KHR_no_error */ -extern GLboolean GLAD_KHR_no_error; -#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008 - - /* GL_KHR_robust_buffer_access_behavior */ -extern GLboolean GLAD_KHR_robust_buffer_access_behavior; - - /* GL_KHR_robustness */ -extern GLboolean GLAD_KHR_robustness; -#define GL_CONTEXT_ROBUST_ACCESS 0x90F3 -#define GL_CONTEXT_ROBUST_ACCESS_KHR 0x90F3 -#define GL_LOSE_CONTEXT_ON_RESET_KHR 0x8252 -#define GL_GUILTY_CONTEXT_RESET_KHR 0x8253 -#define GL_INNOCENT_CONTEXT_RESET_KHR 0x8254 -#define GL_UNKNOWN_CONTEXT_RESET_KHR 0x8255 -#define GL_RESET_NOTIFICATION_STRATEGY_KHR 0x8256 -#define GL_NO_RESET_NOTIFICATION_KHR 0x8261 -#define GL_CONTEXT_LOST_KHR 0x0507 -typedef GLenum (APIENTRYP pfn_glGetGraphicsResetStatusKHR) (); -extern pfn_glGetGraphicsResetStatusKHR fp_glGetGraphicsResetStatusKHR; -typedef void (APIENTRYP pfn_glReadnPixelsKHR) (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLsizei, void*); -extern pfn_glReadnPixelsKHR fp_glReadnPixelsKHR; -typedef void (APIENTRYP pfn_glGetnUniformfvKHR) (GLuint, GLint, GLsizei, GLfloat*); -extern pfn_glGetnUniformfvKHR fp_glGetnUniformfvKHR; -typedef void (APIENTRYP pfn_glGetnUniformivKHR) (GLuint, GLint, GLsizei, GLint*); -extern pfn_glGetnUniformivKHR fp_glGetnUniformivKHR; -typedef void (APIENTRYP pfn_glGetnUniformuivKHR) (GLuint, GLint, GLsizei, GLuint*); -extern pfn_glGetnUniformuivKHR fp_glGetnUniformuivKHR; - - /* GL_KHR_texture_compression_astc_hdr */ -extern GLboolean GLAD_KHR_texture_compression_astc_hdr; -#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 -#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 -#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 -#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 -#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 -#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 -#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 -#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 -#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 -#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 -#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA -#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB -#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC -#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD - - /* GL_KHR_texture_compression_astc_ldr */ -extern GLboolean GLAD_KHR_texture_compression_astc_ldr; - - /* GL_KHR_texture_compression_astc_sliced_3d */ -extern GLboolean GLAD_KHR_texture_compression_astc_sliced_3d; - - /* GL_ARB_arrays_of_arrays */ -extern GLboolean GLAD_ARB_arrays_of_arrays; - - /* GL_ARB_base_instance */ -extern GLboolean GLAD_ARB_base_instance; - - /* GL_ARB_bindless_texture */ -extern GLboolean GLAD_ARB_bindless_texture; -#define GL_UNSIGNED_INT64_ARB 0x140F -typedef GLuint64 (APIENTRYP pfn_glGetTextureHandleARB) (GLuint); -extern pfn_glGetTextureHandleARB fp_glGetTextureHandleARB; -typedef GLuint64 (APIENTRYP pfn_glGetTextureSamplerHandleARB) (GLuint, GLuint); -extern pfn_glGetTextureSamplerHandleARB fp_glGetTextureSamplerHandleARB; -typedef void (APIENTRYP pfn_glMakeTextureHandleResidentARB) (GLuint64); -extern pfn_glMakeTextureHandleResidentARB fp_glMakeTextureHandleResidentARB; -typedef void (APIENTRYP pfn_glMakeTextureHandleNonResidentARB) (GLuint64); -extern pfn_glMakeTextureHandleNonResidentARB fp_glMakeTextureHandleNonResidentARB; -typedef GLuint64 (APIENTRYP pfn_glGetImageHandleARB) (GLuint, GLint, GLboolean, GLint, GLenum); -extern pfn_glGetImageHandleARB fp_glGetImageHandleARB; -typedef void (APIENTRYP pfn_glMakeImageHandleResidentARB) (GLuint64, GLenum); -extern pfn_glMakeImageHandleResidentARB fp_glMakeImageHandleResidentARB; -typedef void (APIENTRYP pfn_glMakeImageHandleNonResidentARB) (GLuint64); -extern pfn_glMakeImageHandleNonResidentARB fp_glMakeImageHandleNonResidentARB; -typedef void (APIENTRYP pfn_glUniformHandleui64ARB) (GLint, GLuint64); -extern pfn_glUniformHandleui64ARB fp_glUniformHandleui64ARB; -typedef void (APIENTRYP pfn_glUniformHandleui64vARB) (GLint, GLsizei, const GLuint64*); -extern pfn_glUniformHandleui64vARB fp_glUniformHandleui64vARB; -typedef void (APIENTRYP pfn_glProgramUniformHandleui64ARB) (GLuint, GLint, GLuint64); -extern pfn_glProgramUniformHandleui64ARB fp_glProgramUniformHandleui64ARB; -typedef void (APIENTRYP pfn_glProgramUniformHandleui64vARB) (GLuint, GLint, GLsizei, const GLuint64*); -extern pfn_glProgramUniformHandleui64vARB fp_glProgramUniformHandleui64vARB; -typedef GLboolean (APIENTRYP pfn_glIsTextureHandleResidentARB) (GLuint64); -extern pfn_glIsTextureHandleResidentARB fp_glIsTextureHandleResidentARB; -typedef GLboolean (APIENTRYP pfn_glIsImageHandleResidentARB) (GLuint64); -extern pfn_glIsImageHandleResidentARB fp_glIsImageHandleResidentARB; -typedef void (APIENTRYP pfn_glVertexAttribL1ui64ARB) (GLuint, GLuint64EXT); -extern pfn_glVertexAttribL1ui64ARB fp_glVertexAttribL1ui64ARB; -typedef void (APIENTRYP pfn_glVertexAttribL1ui64vARB) (GLuint, const GLuint64EXT*); -extern pfn_glVertexAttribL1ui64vARB fp_glVertexAttribL1ui64vARB; -typedef void (APIENTRYP pfn_glGetVertexAttribLui64vARB) (GLuint, GLenum, GLuint64EXT*); -extern pfn_glGetVertexAttribLui64vARB fp_glGetVertexAttribLui64vARB; - - /* GL_ARB_blend_func_extended */ -extern GLboolean GLAD_ARB_blend_func_extended; - - /* GL_ARB_buffer_storage */ -extern GLboolean GLAD_ARB_buffer_storage; - - /* GL_ARB_cl_event */ -extern GLboolean GLAD_ARB_cl_event; -#define GL_SYNC_CL_EVENT_ARB 0x8240 -#define GL_SYNC_CL_EVENT_COMPLETE_ARB 0x8241 -typedef GLsync (APIENTRYP pfn_glCreateSyncFromCLeventARB) (struct _cl_context*, struct _cl_event*, GLbitfield); -extern pfn_glCreateSyncFromCLeventARB fp_glCreateSyncFromCLeventARB; - - /* GL_ARB_clear_buffer_object */ -extern GLboolean GLAD_ARB_clear_buffer_object; - - /* GL_ARB_clear_texture */ -extern GLboolean GLAD_ARB_clear_texture; - - /* GL_ARB_clip_control */ -extern GLboolean GLAD_ARB_clip_control; - - /* GL_ARB_color_buffer_float */ -extern GLboolean GLAD_ARB_color_buffer_float; -#define GL_RGBA_FLOAT_MODE_ARB 0x8820 -#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A -#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B -#define GL_CLAMP_READ_COLOR_ARB 0x891C -#define GL_FIXED_ONLY_ARB 0x891D -typedef void (APIENTRYP pfn_glClampColorARB) (GLenum, GLenum); -extern pfn_glClampColorARB fp_glClampColorARB; - - /* GL_ARB_compatibility */ -extern GLboolean GLAD_ARB_compatibility; - - /* GL_ARB_compressed_texture_pixel_storage */ -extern GLboolean GLAD_ARB_compressed_texture_pixel_storage; - - /* GL_ARB_compute_shader */ -extern GLboolean GLAD_ARB_compute_shader; - - /* GL_ARB_compute_variable_group_size */ -extern GLboolean GLAD_ARB_compute_variable_group_size; -#define GL_MAX_COMPUTE_VARIABLE_GROUP_INVOCATIONS_ARB 0x9344 -#define GL_MAX_COMPUTE_FIXED_GROUP_INVOCATIONS_ARB 0x90EB -#define GL_MAX_COMPUTE_VARIABLE_GROUP_SIZE_ARB 0x9345 -#define GL_MAX_COMPUTE_FIXED_GROUP_SIZE_ARB 0x91BF -typedef void (APIENTRYP pfn_glDispatchComputeGroupSizeARB) (GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); -extern pfn_glDispatchComputeGroupSizeARB fp_glDispatchComputeGroupSizeARB; - - /* GL_ARB_conditional_render_inverted */ -extern GLboolean GLAD_ARB_conditional_render_inverted; - - /* GL_ARB_conservative_depth */ -extern GLboolean GLAD_ARB_conservative_depth; - - /* GL_ARB_copy_buffer */ -extern GLboolean GLAD_ARB_copy_buffer; - - /* GL_ARB_copy_image */ -extern GLboolean GLAD_ARB_copy_image; - - /* GL_ARB_cull_distance */ -extern GLboolean GLAD_ARB_cull_distance; - - /* GL_ARB_debug_output */ -extern GLboolean GLAD_ARB_debug_output; -#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242 -#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243 -#define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244 -#define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245 -#define GL_DEBUG_SOURCE_API_ARB 0x8246 -#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247 -#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248 -#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249 -#define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A -#define GL_DEBUG_SOURCE_OTHER_ARB 0x824B -#define GL_DEBUG_TYPE_ERROR_ARB 0x824C -#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D -#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E -#define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F -#define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250 -#define GL_DEBUG_TYPE_OTHER_ARB 0x8251 -#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143 -#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144 -#define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145 -#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146 -#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147 -#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148 -typedef void (APIENTRYP pfn_glDebugMessageControlARB) (GLenum, GLenum, GLenum, GLsizei, const GLuint*, GLboolean); -extern pfn_glDebugMessageControlARB fp_glDebugMessageControlARB; -typedef void (APIENTRYP pfn_glDebugMessageInsertARB) (GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*); -extern pfn_glDebugMessageInsertARB fp_glDebugMessageInsertARB; -typedef void (APIENTRYP pfn_glDebugMessageCallbackARB) (GLDEBUGPROCARB, const void*); -extern pfn_glDebugMessageCallbackARB fp_glDebugMessageCallbackARB; -typedef GLuint (APIENTRYP pfn_glGetDebugMessageLogARB) (GLuint, GLsizei, GLenum*, GLenum*, GLuint*, GLenum*, GLsizei*, GLchar*); -extern pfn_glGetDebugMessageLogARB fp_glGetDebugMessageLogARB; - - /* GL_ARB_depth_buffer_float */ -extern GLboolean GLAD_ARB_depth_buffer_float; - - /* GL_ARB_depth_clamp */ -extern GLboolean GLAD_ARB_depth_clamp; - - /* GL_ARB_derivative_control */ -extern GLboolean GLAD_ARB_derivative_control; - - /* GL_ARB_direct_state_access */ -extern GLboolean GLAD_ARB_direct_state_access; - - /* GL_ARB_draw_buffers_blend */ -extern GLboolean GLAD_ARB_draw_buffers_blend; -typedef void (APIENTRYP pfn_glBlendEquationiARB) (GLuint, GLenum); -extern pfn_glBlendEquationiARB fp_glBlendEquationiARB; -typedef void (APIENTRYP pfn_glBlendEquationSeparateiARB) (GLuint, GLenum, GLenum); -extern pfn_glBlendEquationSeparateiARB fp_glBlendEquationSeparateiARB; -typedef void (APIENTRYP pfn_glBlendFunciARB) (GLuint, GLenum, GLenum); -extern pfn_glBlendFunciARB fp_glBlendFunciARB; -typedef void (APIENTRYP pfn_glBlendFuncSeparateiARB) (GLuint, GLenum, GLenum, GLenum, GLenum); -extern pfn_glBlendFuncSeparateiARB fp_glBlendFuncSeparateiARB; - - /* GL_ARB_draw_elements_base_vertex */ -extern GLboolean GLAD_ARB_draw_elements_base_vertex; - - /* GL_ARB_draw_indirect */ -extern GLboolean GLAD_ARB_draw_indirect; - - /* GL_ARB_draw_instanced */ -extern GLboolean GLAD_ARB_draw_instanced; -typedef void (APIENTRYP pfn_glDrawArraysInstancedARB) (GLenum, GLint, GLsizei, GLsizei); -extern pfn_glDrawArraysInstancedARB fp_glDrawArraysInstancedARB; -typedef void (APIENTRYP pfn_glDrawElementsInstancedARB) (GLenum, GLsizei, GLenum, const void*, GLsizei); -extern pfn_glDrawElementsInstancedARB fp_glDrawElementsInstancedARB; - - /* GL_ARB_enhanced_layouts */ -extern GLboolean GLAD_ARB_enhanced_layouts; - - /* GL_ARB_ES2_compatibility */ -extern GLboolean GLAD_ARB_ES2_compatibility; - - /* GL_ARB_ES3_1_compatibility */ -extern GLboolean GLAD_ARB_ES3_1_compatibility; - - /* GL_ARB_ES3_2_compatibility */ -extern GLboolean GLAD_ARB_ES3_2_compatibility; -#define GL_PRIMITIVE_BOUNDING_BOX_ARB 0x92BE -#define GL_MULTISAMPLE_LINE_WIDTH_RANGE_ARB 0x9381 -#define GL_MULTISAMPLE_LINE_WIDTH_GRANULARITY_ARB 0x9382 -typedef void (APIENTRYP pfn_glPrimitiveBoundingBoxARB) (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -extern pfn_glPrimitiveBoundingBoxARB fp_glPrimitiveBoundingBoxARB; - - /* GL_ARB_ES3_compatibility */ -extern GLboolean GLAD_ARB_ES3_compatibility; - - /* GL_ARB_explicit_attrib_location */ -extern GLboolean GLAD_ARB_explicit_attrib_location; - - /* GL_ARB_explicit_uniform_location */ -extern GLboolean GLAD_ARB_explicit_uniform_location; - - /* GL_ARB_fragment_coord_conventions */ -extern GLboolean GLAD_ARB_fragment_coord_conventions; - - /* GL_ARB_fragment_layer_viewport */ -extern GLboolean GLAD_ARB_fragment_layer_viewport; - - /* GL_ARB_fragment_shader_interlock */ -extern GLboolean GLAD_ARB_fragment_shader_interlock; - - /* GL_ARB_framebuffer_no_attachments */ -extern GLboolean GLAD_ARB_framebuffer_no_attachments; - - /* GL_ARB_framebuffer_object */ -extern GLboolean GLAD_ARB_framebuffer_object; - - /* GL_ARB_framebuffer_sRGB */ -extern GLboolean GLAD_ARB_framebuffer_sRGB; - - /* GL_ARB_geometry_shader4 */ -extern GLboolean GLAD_ARB_geometry_shader4; -#define GL_LINES_ADJACENCY_ARB 0x000A -#define GL_LINE_STRIP_ADJACENCY_ARB 0x000B -#define GL_TRIANGLES_ADJACENCY_ARB 0x000C -#define GL_TRIANGLE_STRIP_ADJACENCY_ARB 0x000D -#define GL_PROGRAM_POINT_SIZE_ARB 0x8642 -#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB 0x8C29 -#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB 0x8DA7 -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB 0x8DA8 -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB 0x8DA9 -#define GL_GEOMETRY_SHADER_ARB 0x8DD9 -#define GL_GEOMETRY_VERTICES_OUT_ARB 0x8DDA -#define GL_GEOMETRY_INPUT_TYPE_ARB 0x8DDB -#define GL_GEOMETRY_OUTPUT_TYPE_ARB 0x8DDC -#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB 0x8DDD -#define GL_MAX_VERTEX_VARYING_COMPONENTS_ARB 0x8DDE -#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB 0x8DDF -#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB 0x8DE0 -#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB 0x8DE1 -typedef void (APIENTRYP pfn_glProgramParameteriARB) (GLuint, GLenum, GLint); -extern pfn_glProgramParameteriARB fp_glProgramParameteriARB; -typedef void (APIENTRYP pfn_glFramebufferTextureARB) (GLenum, GLenum, GLuint, GLint); -extern pfn_glFramebufferTextureARB fp_glFramebufferTextureARB; -typedef void (APIENTRYP pfn_glFramebufferTextureLayerARB) (GLenum, GLenum, GLuint, GLint, GLint); -extern pfn_glFramebufferTextureLayerARB fp_glFramebufferTextureLayerARB; -typedef void (APIENTRYP pfn_glFramebufferTextureFaceARB) (GLenum, GLenum, GLuint, GLint, GLenum); -extern pfn_glFramebufferTextureFaceARB fp_glFramebufferTextureFaceARB; - - /* GL_ARB_get_program_binary */ -extern GLboolean GLAD_ARB_get_program_binary; - - /* GL_ARB_get_texture_sub_image */ -extern GLboolean GLAD_ARB_get_texture_sub_image; - - /* GL_ARB_gpu_shader5 */ -extern GLboolean GLAD_ARB_gpu_shader5; - - /* GL_ARB_gpu_shader_fp64 */ -extern GLboolean GLAD_ARB_gpu_shader_fp64; - - /* GL_ARB_gpu_shader_int64 */ -extern GLboolean GLAD_ARB_gpu_shader_int64; -#define GL_INT64_ARB 0x140E -#define GL_INT64_VEC2_ARB 0x8FE9 -#define GL_INT64_VEC3_ARB 0x8FEA -#define GL_INT64_VEC4_ARB 0x8FEB -#define GL_UNSIGNED_INT64_VEC2_ARB 0x8FF5 -#define GL_UNSIGNED_INT64_VEC3_ARB 0x8FF6 -#define GL_UNSIGNED_INT64_VEC4_ARB 0x8FF7 -typedef void (APIENTRYP pfn_glUniform1i64ARB) (GLint, GLint64); -extern pfn_glUniform1i64ARB fp_glUniform1i64ARB; -typedef void (APIENTRYP pfn_glUniform2i64ARB) (GLint, GLint64, GLint64); -extern pfn_glUniform2i64ARB fp_glUniform2i64ARB; -typedef void (APIENTRYP pfn_glUniform3i64ARB) (GLint, GLint64, GLint64, GLint64); -extern pfn_glUniform3i64ARB fp_glUniform3i64ARB; -typedef void (APIENTRYP pfn_glUniform4i64ARB) (GLint, GLint64, GLint64, GLint64, GLint64); -extern pfn_glUniform4i64ARB fp_glUniform4i64ARB; -typedef void (APIENTRYP pfn_glUniform1i64vARB) (GLint, GLsizei, const GLint64*); -extern pfn_glUniform1i64vARB fp_glUniform1i64vARB; -typedef void (APIENTRYP pfn_glUniform2i64vARB) (GLint, GLsizei, const GLint64*); -extern pfn_glUniform2i64vARB fp_glUniform2i64vARB; -typedef void (APIENTRYP pfn_glUniform3i64vARB) (GLint, GLsizei, const GLint64*); -extern pfn_glUniform3i64vARB fp_glUniform3i64vARB; -typedef void (APIENTRYP pfn_glUniform4i64vARB) (GLint, GLsizei, const GLint64*); -extern pfn_glUniform4i64vARB fp_glUniform4i64vARB; -typedef void (APIENTRYP pfn_glUniform1ui64ARB) (GLint, GLuint64); -extern pfn_glUniform1ui64ARB fp_glUniform1ui64ARB; -typedef void (APIENTRYP pfn_glUniform2ui64ARB) (GLint, GLuint64, GLuint64); -extern pfn_glUniform2ui64ARB fp_glUniform2ui64ARB; -typedef void (APIENTRYP pfn_glUniform3ui64ARB) (GLint, GLuint64, GLuint64, GLuint64); -extern pfn_glUniform3ui64ARB fp_glUniform3ui64ARB; -typedef void (APIENTRYP pfn_glUniform4ui64ARB) (GLint, GLuint64, GLuint64, GLuint64, GLuint64); -extern pfn_glUniform4ui64ARB fp_glUniform4ui64ARB; -typedef void (APIENTRYP pfn_glUniform1ui64vARB) (GLint, GLsizei, const GLuint64*); -extern pfn_glUniform1ui64vARB fp_glUniform1ui64vARB; -typedef void (APIENTRYP pfn_glUniform2ui64vARB) (GLint, GLsizei, const GLuint64*); -extern pfn_glUniform2ui64vARB fp_glUniform2ui64vARB; -typedef void (APIENTRYP pfn_glUniform3ui64vARB) (GLint, GLsizei, const GLuint64*); -extern pfn_glUniform3ui64vARB fp_glUniform3ui64vARB; -typedef void (APIENTRYP pfn_glUniform4ui64vARB) (GLint, GLsizei, const GLuint64*); -extern pfn_glUniform4ui64vARB fp_glUniform4ui64vARB; -typedef void (APIENTRYP pfn_glGetUniformi64vARB) (GLuint, GLint, GLint64*); -extern pfn_glGetUniformi64vARB fp_glGetUniformi64vARB; -typedef void (APIENTRYP pfn_glGetUniformui64vARB) (GLuint, GLint, GLuint64*); -extern pfn_glGetUniformui64vARB fp_glGetUniformui64vARB; -typedef void (APIENTRYP pfn_glGetnUniformi64vARB) (GLuint, GLint, GLsizei, GLint64*); -extern pfn_glGetnUniformi64vARB fp_glGetnUniformi64vARB; -typedef void (APIENTRYP pfn_glGetnUniformui64vARB) (GLuint, GLint, GLsizei, GLuint64*); -extern pfn_glGetnUniformui64vARB fp_glGetnUniformui64vARB; -typedef void (APIENTRYP pfn_glProgramUniform1i64ARB) (GLuint, GLint, GLint64); -extern pfn_glProgramUniform1i64ARB fp_glProgramUniform1i64ARB; -typedef void (APIENTRYP pfn_glProgramUniform2i64ARB) (GLuint, GLint, GLint64, GLint64); -extern pfn_glProgramUniform2i64ARB fp_glProgramUniform2i64ARB; -typedef void (APIENTRYP pfn_glProgramUniform3i64ARB) (GLuint, GLint, GLint64, GLint64, GLint64); -extern pfn_glProgramUniform3i64ARB fp_glProgramUniform3i64ARB; -typedef void (APIENTRYP pfn_glProgramUniform4i64ARB) (GLuint, GLint, GLint64, GLint64, GLint64, GLint64); -extern pfn_glProgramUniform4i64ARB fp_glProgramUniform4i64ARB; -typedef void (APIENTRYP pfn_glProgramUniform1i64vARB) (GLuint, GLint, GLsizei, const GLint64*); -extern pfn_glProgramUniform1i64vARB fp_glProgramUniform1i64vARB; -typedef void (APIENTRYP pfn_glProgramUniform2i64vARB) (GLuint, GLint, GLsizei, const GLint64*); -extern pfn_glProgramUniform2i64vARB fp_glProgramUniform2i64vARB; -typedef void (APIENTRYP pfn_glProgramUniform3i64vARB) (GLuint, GLint, GLsizei, const GLint64*); -extern pfn_glProgramUniform3i64vARB fp_glProgramUniform3i64vARB; -typedef void (APIENTRYP pfn_glProgramUniform4i64vARB) (GLuint, GLint, GLsizei, const GLint64*); -extern pfn_glProgramUniform4i64vARB fp_glProgramUniform4i64vARB; -typedef void (APIENTRYP pfn_glProgramUniform1ui64ARB) (GLuint, GLint, GLuint64); -extern pfn_glProgramUniform1ui64ARB fp_glProgramUniform1ui64ARB; -typedef void (APIENTRYP pfn_glProgramUniform2ui64ARB) (GLuint, GLint, GLuint64, GLuint64); -extern pfn_glProgramUniform2ui64ARB fp_glProgramUniform2ui64ARB; -typedef void (APIENTRYP pfn_glProgramUniform3ui64ARB) (GLuint, GLint, GLuint64, GLuint64, GLuint64); -extern pfn_glProgramUniform3ui64ARB fp_glProgramUniform3ui64ARB; -typedef void (APIENTRYP pfn_glProgramUniform4ui64ARB) (GLuint, GLint, GLuint64, GLuint64, GLuint64, GLuint64); -extern pfn_glProgramUniform4ui64ARB fp_glProgramUniform4ui64ARB; -typedef void (APIENTRYP pfn_glProgramUniform1ui64vARB) (GLuint, GLint, GLsizei, const GLuint64*); -extern pfn_glProgramUniform1ui64vARB fp_glProgramUniform1ui64vARB; -typedef void (APIENTRYP pfn_glProgramUniform2ui64vARB) (GLuint, GLint, GLsizei, const GLuint64*); -extern pfn_glProgramUniform2ui64vARB fp_glProgramUniform2ui64vARB; -typedef void (APIENTRYP pfn_glProgramUniform3ui64vARB) (GLuint, GLint, GLsizei, const GLuint64*); -extern pfn_glProgramUniform3ui64vARB fp_glProgramUniform3ui64vARB; -typedef void (APIENTRYP pfn_glProgramUniform4ui64vARB) (GLuint, GLint, GLsizei, const GLuint64*); -extern pfn_glProgramUniform4ui64vARB fp_glProgramUniform4ui64vARB; - - /* GL_ARB_half_float_pixel */ -extern GLboolean GLAD_ARB_half_float_pixel; -#define GL_HALF_FLOAT_ARB 0x140B - - /* GL_ARB_half_float_vertex */ -extern GLboolean GLAD_ARB_half_float_vertex; - - /* GL_ARB_indirect_parameters */ -extern GLboolean GLAD_ARB_indirect_parameters; -#define GL_PARAMETER_BUFFER_ARB 0x80EE -#define GL_PARAMETER_BUFFER_BINDING_ARB 0x80EF -typedef void (APIENTRYP pfn_glMultiDrawArraysIndirectCountARB) (GLenum, GLintptr, GLintptr, GLsizei, GLsizei); -extern pfn_glMultiDrawArraysIndirectCountARB fp_glMultiDrawArraysIndirectCountARB; -typedef void (APIENTRYP pfn_glMultiDrawElementsIndirectCountARB) (GLenum, GLenum, GLintptr, GLintptr, GLsizei, GLsizei); -extern pfn_glMultiDrawElementsIndirectCountARB fp_glMultiDrawElementsIndirectCountARB; - - /* GL_ARB_instanced_arrays */ -extern GLboolean GLAD_ARB_instanced_arrays; -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE -typedef void (APIENTRYP pfn_glVertexAttribDivisorARB) (GLuint, GLuint); -extern pfn_glVertexAttribDivisorARB fp_glVertexAttribDivisorARB; - - /* GL_ARB_internalformat_query */ -extern GLboolean GLAD_ARB_internalformat_query; - - /* GL_ARB_internalformat_query2 */ -extern GLboolean GLAD_ARB_internalformat_query2; -#define GL_SRGB_DECODE_ARB 0x8299 - - /* GL_ARB_invalidate_subdata */ -extern GLboolean GLAD_ARB_invalidate_subdata; - - /* GL_ARB_map_buffer_alignment */ -extern GLboolean GLAD_ARB_map_buffer_alignment; - - /* GL_ARB_map_buffer_range */ -extern GLboolean GLAD_ARB_map_buffer_range; - - /* GL_ARB_multi_bind */ -extern GLboolean GLAD_ARB_multi_bind; - - /* GL_ARB_multi_draw_indirect */ -extern GLboolean GLAD_ARB_multi_draw_indirect; - - /* GL_ARB_occlusion_query2 */ -extern GLboolean GLAD_ARB_occlusion_query2; - - /* GL_ARB_parallel_shader_compile */ -extern GLboolean GLAD_ARB_parallel_shader_compile; -#define GL_MAX_SHADER_COMPILER_THREADS_ARB 0x91B0 -#define GL_COMPLETION_STATUS_ARB 0x91B1 -typedef void (APIENTRYP pfn_glMaxShaderCompilerThreadsARB) (GLuint); -extern pfn_glMaxShaderCompilerThreadsARB fp_glMaxShaderCompilerThreadsARB; - - /* GL_ARB_pipeline_statistics_query */ -extern GLboolean GLAD_ARB_pipeline_statistics_query; -#define GL_VERTICES_SUBMITTED_ARB 0x82EE -#define GL_PRIMITIVES_SUBMITTED_ARB 0x82EF -#define GL_VERTEX_SHADER_INVOCATIONS_ARB 0x82F0 -#define GL_TESS_CONTROL_SHADER_PATCHES_ARB 0x82F1 -#define GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB 0x82F2 -#define GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB 0x82F3 -#define GL_FRAGMENT_SHADER_INVOCATIONS_ARB 0x82F4 -#define GL_COMPUTE_SHADER_INVOCATIONS_ARB 0x82F5 -#define GL_CLIPPING_INPUT_PRIMITIVES_ARB 0x82F6 -#define GL_CLIPPING_OUTPUT_PRIMITIVES_ARB 0x82F7 - - /* GL_ARB_pixel_buffer_object */ -extern GLboolean GLAD_ARB_pixel_buffer_object; -#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB -#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC -#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED -#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF - - /* GL_ARB_post_depth_coverage */ -extern GLboolean GLAD_ARB_post_depth_coverage; - - /* GL_ARB_program_interface_query */ -extern GLboolean GLAD_ARB_program_interface_query; - - /* GL_ARB_provoking_vertex */ -extern GLboolean GLAD_ARB_provoking_vertex; - - /* GL_ARB_query_buffer_object */ -extern GLboolean GLAD_ARB_query_buffer_object; - - /* GL_ARB_robust_buffer_access_behavior */ -extern GLboolean GLAD_ARB_robust_buffer_access_behavior; - - /* GL_ARB_robustness */ -extern GLboolean GLAD_ARB_robustness; -#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004 -#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 -#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253 -#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254 -#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255 -#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 -#define GL_NO_RESET_NOTIFICATION_ARB 0x8261 -typedef GLenum (APIENTRYP pfn_glGetGraphicsResetStatusARB) (); -extern pfn_glGetGraphicsResetStatusARB fp_glGetGraphicsResetStatusARB; -typedef void (APIENTRYP pfn_glGetnTexImageARB) (GLenum, GLint, GLenum, GLenum, GLsizei, void*); -extern pfn_glGetnTexImageARB fp_glGetnTexImageARB; -typedef void (APIENTRYP pfn_glReadnPixelsARB) (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLsizei, void*); -extern pfn_glReadnPixelsARB fp_glReadnPixelsARB; -typedef void (APIENTRYP pfn_glGetnCompressedTexImageARB) (GLenum, GLint, GLsizei, void*); -extern pfn_glGetnCompressedTexImageARB fp_glGetnCompressedTexImageARB; -typedef void (APIENTRYP pfn_glGetnUniformfvARB) (GLuint, GLint, GLsizei, GLfloat*); -extern pfn_glGetnUniformfvARB fp_glGetnUniformfvARB; -typedef void (APIENTRYP pfn_glGetnUniformivARB) (GLuint, GLint, GLsizei, GLint*); -extern pfn_glGetnUniformivARB fp_glGetnUniformivARB; -typedef void (APIENTRYP pfn_glGetnUniformuivARB) (GLuint, GLint, GLsizei, GLuint*); -extern pfn_glGetnUniformuivARB fp_glGetnUniformuivARB; -typedef void (APIENTRYP pfn_glGetnUniformdvARB) (GLuint, GLint, GLsizei, GLdouble*); -extern pfn_glGetnUniformdvARB fp_glGetnUniformdvARB; -typedef void (APIENTRYP pfn_glGetnMapdvARB) (GLenum, GLenum, GLsizei, GLdouble*); -extern pfn_glGetnMapdvARB fp_glGetnMapdvARB; -typedef void (APIENTRYP pfn_glGetnMapfvARB) (GLenum, GLenum, GLsizei, GLfloat*); -extern pfn_glGetnMapfvARB fp_glGetnMapfvARB; -typedef void (APIENTRYP pfn_glGetnMapivARB) (GLenum, GLenum, GLsizei, GLint*); -extern pfn_glGetnMapivARB fp_glGetnMapivARB; -typedef void (APIENTRYP pfn_glGetnPixelMapfvARB) (GLenum, GLsizei, GLfloat*); -extern pfn_glGetnPixelMapfvARB fp_glGetnPixelMapfvARB; -typedef void (APIENTRYP pfn_glGetnPixelMapuivARB) (GLenum, GLsizei, GLuint*); -extern pfn_glGetnPixelMapuivARB fp_glGetnPixelMapuivARB; -typedef void (APIENTRYP pfn_glGetnPixelMapusvARB) (GLenum, GLsizei, GLushort*); -extern pfn_glGetnPixelMapusvARB fp_glGetnPixelMapusvARB; -typedef void (APIENTRYP pfn_glGetnPolygonStippleARB) (GLsizei, GLubyte*); -extern pfn_glGetnPolygonStippleARB fp_glGetnPolygonStippleARB; -typedef void (APIENTRYP pfn_glGetnColorTableARB) (GLenum, GLenum, GLenum, GLsizei, void*); -extern pfn_glGetnColorTableARB fp_glGetnColorTableARB; -typedef void (APIENTRYP pfn_glGetnConvolutionFilterARB) (GLenum, GLenum, GLenum, GLsizei, void*); -extern pfn_glGetnConvolutionFilterARB fp_glGetnConvolutionFilterARB; -typedef void (APIENTRYP pfn_glGetnSeparableFilterARB) (GLenum, GLenum, GLenum, GLsizei, void*, GLsizei, void*, void*); -extern pfn_glGetnSeparableFilterARB fp_glGetnSeparableFilterARB; -typedef void (APIENTRYP pfn_glGetnHistogramARB) (GLenum, GLboolean, GLenum, GLenum, GLsizei, void*); -extern pfn_glGetnHistogramARB fp_glGetnHistogramARB; -typedef void (APIENTRYP pfn_glGetnMinmaxARB) (GLenum, GLboolean, GLenum, GLenum, GLsizei, void*); -extern pfn_glGetnMinmaxARB fp_glGetnMinmaxARB; - - /* GL_ARB_robustness_isolation */ -extern GLboolean GLAD_ARB_robustness_isolation; - - /* GL_ARB_sample_locations */ -extern GLboolean GLAD_ARB_sample_locations; -#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_ARB 0x933D -#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_ARB 0x933E -#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_ARB 0x933F -#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_ARB 0x9340 -#define GL_SAMPLE_LOCATION_ARB 0x8E50 -#define GL_PROGRAMMABLE_SAMPLE_LOCATION_ARB 0x9341 -#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_ARB 0x9342 -#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_ARB 0x9343 -typedef void (APIENTRYP pfn_glFramebufferSampleLocationsfvARB) (GLenum, GLuint, GLsizei, const GLfloat*); -extern pfn_glFramebufferSampleLocationsfvARB fp_glFramebufferSampleLocationsfvARB; -typedef void (APIENTRYP pfn_glNamedFramebufferSampleLocationsfvARB) (GLuint, GLuint, GLsizei, const GLfloat*); -extern pfn_glNamedFramebufferSampleLocationsfvARB fp_glNamedFramebufferSampleLocationsfvARB; -typedef void (APIENTRYP pfn_glEvaluateDepthValuesARB) (); -extern pfn_glEvaluateDepthValuesARB fp_glEvaluateDepthValuesARB; - - /* GL_ARB_sample_shading */ -extern GLboolean GLAD_ARB_sample_shading; -#define GL_SAMPLE_SHADING_ARB 0x8C36 -#define GL_MIN_SAMPLE_SHADING_VALUE_ARB 0x8C37 -typedef void (APIENTRYP pfn_glMinSampleShadingARB) (GLfloat); -extern pfn_glMinSampleShadingARB fp_glMinSampleShadingARB; - - /* GL_ARB_sampler_objects */ -extern GLboolean GLAD_ARB_sampler_objects; - - /* GL_ARB_seamless_cube_map */ -extern GLboolean GLAD_ARB_seamless_cube_map; - - /* GL_ARB_seamless_cubemap_per_texture */ -extern GLboolean GLAD_ARB_seamless_cubemap_per_texture; - - /* GL_ARB_separate_shader_objects */ -extern GLboolean GLAD_ARB_separate_shader_objects; - - /* GL_ARB_shader_atomic_counter_ops */ -extern GLboolean GLAD_ARB_shader_atomic_counter_ops; - - /* GL_ARB_shader_atomic_counters */ -extern GLboolean GLAD_ARB_shader_atomic_counters; - - /* GL_ARB_shader_ballot */ -extern GLboolean GLAD_ARB_shader_ballot; - - /* GL_ARB_shader_bit_encoding */ -extern GLboolean GLAD_ARB_shader_bit_encoding; - - /* GL_ARB_shader_clock */ -extern GLboolean GLAD_ARB_shader_clock; - - /* GL_ARB_shader_draw_parameters */ -extern GLboolean GLAD_ARB_shader_draw_parameters; - - /* GL_ARB_shader_group_vote */ -extern GLboolean GLAD_ARB_shader_group_vote; - - /* GL_ARB_shader_image_load_store */ -extern GLboolean GLAD_ARB_shader_image_load_store; - - /* GL_ARB_shader_image_size */ -extern GLboolean GLAD_ARB_shader_image_size; - - /* GL_ARB_shader_precision */ -extern GLboolean GLAD_ARB_shader_precision; - - /* GL_ARB_shader_stencil_export */ -extern GLboolean GLAD_ARB_shader_stencil_export; - - /* GL_ARB_shader_storage_buffer_object */ -extern GLboolean GLAD_ARB_shader_storage_buffer_object; - - /* GL_ARB_shader_subroutine */ -extern GLboolean GLAD_ARB_shader_subroutine; - - /* GL_ARB_shader_texture_image_samples */ -extern GLboolean GLAD_ARB_shader_texture_image_samples; - - /* GL_ARB_shader_texture_lod */ -extern GLboolean GLAD_ARB_shader_texture_lod; - - /* GL_ARB_shader_viewport_layer_array */ -extern GLboolean GLAD_ARB_shader_viewport_layer_array; - - /* GL_ARB_shading_language_420pack */ -extern GLboolean GLAD_ARB_shading_language_420pack; - - /* GL_ARB_shading_language_include */ -extern GLboolean GLAD_ARB_shading_language_include; -#define GL_SHADER_INCLUDE_ARB 0x8DAE -#define GL_NAMED_STRING_LENGTH_ARB 0x8DE9 -#define GL_NAMED_STRING_TYPE_ARB 0x8DEA -typedef void (APIENTRYP pfn_glNamedStringARB) (GLenum, GLint, const GLchar*, GLint, const GLchar*); -extern pfn_glNamedStringARB fp_glNamedStringARB; -typedef void (APIENTRYP pfn_glDeleteNamedStringARB) (GLint, const GLchar*); -extern pfn_glDeleteNamedStringARB fp_glDeleteNamedStringARB; -typedef void (APIENTRYP pfn_glCompileShaderIncludeARB) (GLuint, GLsizei, const GLchar**, const GLint*); -extern pfn_glCompileShaderIncludeARB fp_glCompileShaderIncludeARB; -typedef GLboolean (APIENTRYP pfn_glIsNamedStringARB) (GLint, const GLchar*); -extern pfn_glIsNamedStringARB fp_glIsNamedStringARB; -typedef void (APIENTRYP pfn_glGetNamedStringARB) (GLint, const GLchar*, GLsizei, GLint*, GLchar*); -extern pfn_glGetNamedStringARB fp_glGetNamedStringARB; -typedef void (APIENTRYP pfn_glGetNamedStringivARB) (GLint, const GLchar*, GLenum, GLint*); -extern pfn_glGetNamedStringivARB fp_glGetNamedStringivARB; - - /* GL_ARB_shading_language_packing */ -extern GLboolean GLAD_ARB_shading_language_packing; - - /* GL_ARB_sparse_buffer */ -extern GLboolean GLAD_ARB_sparse_buffer; -#define GL_SPARSE_STORAGE_BIT_ARB 0x0400 -#define GL_SPARSE_BUFFER_PAGE_SIZE_ARB 0x82F8 -typedef void (APIENTRYP pfn_glBufferPageCommitmentARB) (GLenum, GLintptr, GLsizeiptr, GLboolean); -extern pfn_glBufferPageCommitmentARB fp_glBufferPageCommitmentARB; -typedef void (APIENTRYP pfn_glNamedBufferPageCommitmentEXT) (GLuint, GLintptr, GLsizeiptr, GLboolean); -extern pfn_glNamedBufferPageCommitmentEXT fp_glNamedBufferPageCommitmentEXT; -typedef void (APIENTRYP pfn_glNamedBufferPageCommitmentARB) (GLuint, GLintptr, GLsizeiptr, GLboolean); -extern pfn_glNamedBufferPageCommitmentARB fp_glNamedBufferPageCommitmentARB; - - /* GL_ARB_sparse_texture */ -extern GLboolean GLAD_ARB_sparse_texture; -#define GL_TEXTURE_SPARSE_ARB 0x91A6 -#define GL_VIRTUAL_PAGE_SIZE_INDEX_ARB 0x91A7 -#define GL_NUM_SPARSE_LEVELS_ARB 0x91AA -#define GL_NUM_VIRTUAL_PAGE_SIZES_ARB 0x91A8 -#define GL_VIRTUAL_PAGE_SIZE_X_ARB 0x9195 -#define GL_VIRTUAL_PAGE_SIZE_Y_ARB 0x9196 -#define GL_VIRTUAL_PAGE_SIZE_Z_ARB 0x9197 -#define GL_MAX_SPARSE_TEXTURE_SIZE_ARB 0x9198 -#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_ARB 0x9199 -#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB 0x919A -#define GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB 0x91A9 -typedef void (APIENTRYP pfn_glTexPageCommitmentARB) (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLboolean); -extern pfn_glTexPageCommitmentARB fp_glTexPageCommitmentARB; - - /* GL_ARB_sparse_texture2 */ -extern GLboolean GLAD_ARB_sparse_texture2; - - /* GL_ARB_sparse_texture_clamp */ -extern GLboolean GLAD_ARB_sparse_texture_clamp; - - /* GL_ARB_stencil_texturing */ -extern GLboolean GLAD_ARB_stencil_texturing; - - /* GL_ARB_sync */ -extern GLboolean GLAD_ARB_sync; - - /* GL_ARB_tessellation_shader */ -extern GLboolean GLAD_ARB_tessellation_shader; - - /* GL_ARB_texture_barrier */ -extern GLboolean GLAD_ARB_texture_barrier; - - /* GL_ARB_texture_buffer_object */ -extern GLboolean GLAD_ARB_texture_buffer_object; -#define GL_TEXTURE_BUFFER_ARB 0x8C2A -#define GL_MAX_TEXTURE_BUFFER_SIZE_ARB 0x8C2B -#define GL_TEXTURE_BINDING_BUFFER_ARB 0x8C2C -#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB 0x8C2D -#define GL_TEXTURE_BUFFER_FORMAT_ARB 0x8C2E -typedef void (APIENTRYP pfn_glTexBufferARB) (GLenum, GLenum, GLuint); -extern pfn_glTexBufferARB fp_glTexBufferARB; - - /* GL_ARB_texture_buffer_object_rgb32 */ -extern GLboolean GLAD_ARB_texture_buffer_object_rgb32; - - /* GL_ARB_texture_buffer_range */ -extern GLboolean GLAD_ARB_texture_buffer_range; - - /* GL_ARB_texture_compression_bptc */ -extern GLboolean GLAD_ARB_texture_compression_bptc; -#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C -#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D -#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E -#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F - - /* GL_ARB_texture_compression_rgtc */ -extern GLboolean GLAD_ARB_texture_compression_rgtc; - - /* GL_ARB_texture_cube_map_array */ -extern GLboolean GLAD_ARB_texture_cube_map_array; -#define GL_TEXTURE_CUBE_MAP_ARRAY_ARB 0x9009 -#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A -#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B -#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C -#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D -#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E -#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F - - /* GL_ARB_texture_filter_minmax */ -extern GLboolean GLAD_ARB_texture_filter_minmax; -#define GL_TEXTURE_REDUCTION_MODE_ARB 0x9366 -#define GL_WEIGHTED_AVERAGE_ARB 0x9367 - - /* GL_ARB_texture_float */ -extern GLboolean GLAD_ARB_texture_float; -#define GL_TEXTURE_RED_TYPE_ARB 0x8C10 -#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11 -#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12 -#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13 -#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14 -#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15 -#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16 -#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17 -#define GL_RGBA32F_ARB 0x8814 -#define GL_RGB32F_ARB 0x8815 -#define GL_ALPHA32F_ARB 0x8816 -#define GL_INTENSITY32F_ARB 0x8817 -#define GL_LUMINANCE32F_ARB 0x8818 -#define GL_LUMINANCE_ALPHA32F_ARB 0x8819 -#define GL_RGBA16F_ARB 0x881A -#define GL_RGB16F_ARB 0x881B -#define GL_ALPHA16F_ARB 0x881C -#define GL_INTENSITY16F_ARB 0x881D -#define GL_LUMINANCE16F_ARB 0x881E -#define GL_LUMINANCE_ALPHA16F_ARB 0x881F - - /* GL_ARB_texture_gather */ -extern GLboolean GLAD_ARB_texture_gather; -#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E -#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F -#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 0x8F9F - - /* GL_ARB_texture_mirror_clamp_to_edge */ -extern GLboolean GLAD_ARB_texture_mirror_clamp_to_edge; - - /* GL_ARB_texture_multisample */ -extern GLboolean GLAD_ARB_texture_multisample; - - /* GL_ARB_texture_query_levels */ -extern GLboolean GLAD_ARB_texture_query_levels; - - /* GL_ARB_texture_query_lod */ -extern GLboolean GLAD_ARB_texture_query_lod; - - /* GL_ARB_texture_rectangle */ -extern GLboolean GLAD_ARB_texture_rectangle; -#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 -#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 -#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 -#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 - - /* GL_ARB_texture_rg */ -extern GLboolean GLAD_ARB_texture_rg; - - /* GL_ARB_texture_rgb10_a2ui */ -extern GLboolean GLAD_ARB_texture_rgb10_a2ui; - - /* GL_ARB_texture_stencil8 */ -extern GLboolean GLAD_ARB_texture_stencil8; - - /* GL_ARB_texture_storage */ -extern GLboolean GLAD_ARB_texture_storage; - - /* GL_ARB_texture_storage_multisample */ -extern GLboolean GLAD_ARB_texture_storage_multisample; - - /* GL_ARB_texture_swizzle */ -extern GLboolean GLAD_ARB_texture_swizzle; - - /* GL_ARB_texture_view */ -extern GLboolean GLAD_ARB_texture_view; - - /* GL_ARB_timer_query */ -extern GLboolean GLAD_ARB_timer_query; - - /* GL_ARB_transform_feedback2 */ -extern GLboolean GLAD_ARB_transform_feedback2; - - /* GL_ARB_transform_feedback3 */ -extern GLboolean GLAD_ARB_transform_feedback3; - - /* GL_ARB_transform_feedback_instanced */ -extern GLboolean GLAD_ARB_transform_feedback_instanced; - - /* GL_ARB_transform_feedback_overflow_query */ -extern GLboolean GLAD_ARB_transform_feedback_overflow_query; -#define GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB 0x82EC -#define GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB 0x82ED - - /* GL_ARB_uniform_buffer_object */ -extern GLboolean GLAD_ARB_uniform_buffer_object; - - /* GL_ARB_vertex_array_bgra */ -extern GLboolean GLAD_ARB_vertex_array_bgra; - - /* GL_ARB_vertex_array_object */ -extern GLboolean GLAD_ARB_vertex_array_object; - - /* GL_ARB_vertex_attrib_64bit */ -extern GLboolean GLAD_ARB_vertex_attrib_64bit; - - /* GL_ARB_vertex_attrib_binding */ -extern GLboolean GLAD_ARB_vertex_attrib_binding; - - /* GL_ARB_vertex_type_10f_11f_11f_rev */ -extern GLboolean GLAD_ARB_vertex_type_10f_11f_11f_rev; - - /* GL_ARB_vertex_type_2_10_10_10_rev */ -extern GLboolean GLAD_ARB_vertex_type_2_10_10_10_rev; - - /* GL_ARB_viewport_array */ -extern GLboolean GLAD_ARB_viewport_array; - - /* GL_EXT_base_instance */ -extern GLboolean GLAD_EXT_base_instance; -typedef void (APIENTRYP pfn_glDrawArraysInstancedBaseInstanceEXT) (GLenum, GLint, GLsizei, GLsizei, GLuint); -extern pfn_glDrawArraysInstancedBaseInstanceEXT fp_glDrawArraysInstancedBaseInstanceEXT; -typedef void (APIENTRYP pfn_glDrawElementsInstancedBaseInstanceEXT) (GLenum, GLsizei, GLenum, const void*, GLsizei, GLuint); -extern pfn_glDrawElementsInstancedBaseInstanceEXT fp_glDrawElementsInstancedBaseInstanceEXT; -typedef void (APIENTRYP pfn_glDrawElementsInstancedBaseVertexBaseInstanceEXT) (GLenum, GLsizei, GLenum, const void*, GLsizei, GLint, GLuint); -extern pfn_glDrawElementsInstancedBaseVertexBaseInstanceEXT fp_glDrawElementsInstancedBaseVertexBaseInstanceEXT; - - /* GL_EXT_bgra */ -extern GLboolean GLAD_EXT_bgra; -#define GL_BGR_EXT 0x80E0 -#define GL_BGRA_EXT 0x80E1 - - /* GL_EXT_bindable_uniform */ -extern GLboolean GLAD_EXT_bindable_uniform; -#define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2 -#define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3 -#define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4 -#define GL_MAX_BINDABLE_UNIFORM_SIZE_EXT 0x8DED -#define GL_UNIFORM_BUFFER_EXT 0x8DEE -#define GL_UNIFORM_BUFFER_BINDING_EXT 0x8DEF -typedef void (APIENTRYP pfn_glUniformBufferEXT) (GLuint, GLint, GLuint); -extern pfn_glUniformBufferEXT fp_glUniformBufferEXT; -typedef GLint (APIENTRYP pfn_glGetUniformBufferSizeEXT) (GLuint, GLint); -extern pfn_glGetUniformBufferSizeEXT fp_glGetUniformBufferSizeEXT; -typedef GLintptr (APIENTRYP pfn_glGetUniformOffsetEXT) (GLuint, GLint); -extern pfn_glGetUniformOffsetEXT fp_glGetUniformOffsetEXT; - - /* GL_EXT_blend_func_extended */ -extern GLboolean GLAD_EXT_blend_func_extended; -#define GL_SRC1_COLOR_EXT 0x88F9 -#define GL_SRC1_ALPHA_EXT 0x8589 -#define GL_ONE_MINUS_SRC1_COLOR_EXT 0x88FA -#define GL_ONE_MINUS_SRC1_ALPHA_EXT 0x88FB -#define GL_SRC_ALPHA_SATURATE_EXT 0x0308 -#define GL_LOCATION_INDEX_EXT 0x930F -#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT 0x88FC -typedef void (APIENTRYP pfn_glBindFragDataLocationIndexedEXT) (GLuint, GLuint, GLuint, const GLchar*); -extern pfn_glBindFragDataLocationIndexedEXT fp_glBindFragDataLocationIndexedEXT; -typedef void (APIENTRYP pfn_glBindFragDataLocationEXT) (GLuint, GLuint, const GLchar*); -extern pfn_glBindFragDataLocationEXT fp_glBindFragDataLocationEXT; -typedef GLint (APIENTRYP pfn_glGetProgramResourceLocationIndexEXT) (GLuint, GLenum, const GLchar*); -extern pfn_glGetProgramResourceLocationIndexEXT fp_glGetProgramResourceLocationIndexEXT; -typedef GLint (APIENTRYP pfn_glGetFragDataIndexEXT) (GLuint, const GLchar*); -extern pfn_glGetFragDataIndexEXT fp_glGetFragDataIndexEXT; - - /* GL_EXT_blend_minmax */ -extern GLboolean GLAD_EXT_blend_minmax; -#define GL_MIN_EXT 0x8007 -#define GL_MAX_EXT 0x8008 -#define GL_FUNC_ADD_EXT 0x8006 -#define GL_BLEND_EQUATION_EXT 0x8009 -typedef void (APIENTRYP pfn_glBlendEquationEXT) (GLenum); -extern pfn_glBlendEquationEXT fp_glBlendEquationEXT; - - /* GL_EXT_buffer_storage */ -extern GLboolean GLAD_EXT_buffer_storage; -#define GL_MAP_PERSISTENT_BIT_EXT 0x0040 -#define GL_MAP_COHERENT_BIT_EXT 0x0080 -#define GL_DYNAMIC_STORAGE_BIT_EXT 0x0100 -#define GL_CLIENT_STORAGE_BIT_EXT 0x0200 -#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT_EXT 0x00004000 -#define GL_BUFFER_IMMUTABLE_STORAGE_EXT 0x821F -#define GL_BUFFER_STORAGE_FLAGS_EXT 0x8220 -typedef void (APIENTRYP pfn_glBufferStorageEXT) (GLenum, GLsizeiptr, const void*, GLbitfield); -extern pfn_glBufferStorageEXT fp_glBufferStorageEXT; - - /* GL_EXT_color_buffer_float */ -extern GLboolean GLAD_EXT_color_buffer_float; - - /* GL_EXT_color_buffer_half_float */ -extern GLboolean GLAD_EXT_color_buffer_half_float; -#define GL_RGBA16F_EXT 0x881A -#define GL_RGB16F_EXT 0x881B -#define GL_RG16F_EXT 0x822F -#define GL_R16F_EXT 0x822D -#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211 -#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17 - - /* GL_EXT_copy_image */ -extern GLboolean GLAD_EXT_copy_image; -typedef void (APIENTRYP pfn_glCopyImageSubDataEXT) (GLuint, GLenum, GLint, GLint, GLint, GLint, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei); -extern pfn_glCopyImageSubDataEXT fp_glCopyImageSubDataEXT; - - /* GL_EXT_debug_label */ -extern GLboolean GLAD_EXT_debug_label; -#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F -#define GL_PROGRAM_OBJECT_EXT 0x8B40 -#define GL_SHADER_OBJECT_EXT 0x8B48 -#define GL_BUFFER_OBJECT_EXT 0x9151 -#define GL_QUERY_OBJECT_EXT 0x9153 -#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154 -typedef void (APIENTRYP pfn_glLabelObjectEXT) (GLenum, GLuint, GLsizei, const GLchar*); -extern pfn_glLabelObjectEXT fp_glLabelObjectEXT; -typedef void (APIENTRYP pfn_glGetObjectLabelEXT) (GLenum, GLuint, GLsizei, GLsizei*, GLchar*); -extern pfn_glGetObjectLabelEXT fp_glGetObjectLabelEXT; - - /* GL_EXT_debug_marker */ -extern GLboolean GLAD_EXT_debug_marker; -typedef void (APIENTRYP pfn_glInsertEventMarkerEXT) (GLsizei, const GLchar*); -extern pfn_glInsertEventMarkerEXT fp_glInsertEventMarkerEXT; -typedef void (APIENTRYP pfn_glPushGroupMarkerEXT) (GLsizei, const GLchar*); -extern pfn_glPushGroupMarkerEXT fp_glPushGroupMarkerEXT; -typedef void (APIENTRYP pfn_glPopGroupMarkerEXT) (); -extern pfn_glPopGroupMarkerEXT fp_glPopGroupMarkerEXT; - - /* GL_EXT_direct_state_access */ -extern GLboolean GLAD_EXT_direct_state_access; -#define GL_PROGRAM_MATRIX_EXT 0x8E2D -#define GL_TRANSPOSE_PROGRAM_MATRIX_EXT 0x8E2E -#define GL_PROGRAM_MATRIX_STACK_DEPTH_EXT 0x8E2F -typedef void (APIENTRYP pfn_glMatrixLoadfEXT) (GLenum, const GLfloat*); -extern pfn_glMatrixLoadfEXT fp_glMatrixLoadfEXT; -typedef void (APIENTRYP pfn_glMatrixLoaddEXT) (GLenum, const GLdouble*); -extern pfn_glMatrixLoaddEXT fp_glMatrixLoaddEXT; -typedef void (APIENTRYP pfn_glMatrixMultfEXT) (GLenum, const GLfloat*); -extern pfn_glMatrixMultfEXT fp_glMatrixMultfEXT; -typedef void (APIENTRYP pfn_glMatrixMultdEXT) (GLenum, const GLdouble*); -extern pfn_glMatrixMultdEXT fp_glMatrixMultdEXT; -typedef void (APIENTRYP pfn_glMatrixLoadIdentityEXT) (GLenum); -extern pfn_glMatrixLoadIdentityEXT fp_glMatrixLoadIdentityEXT; -typedef void (APIENTRYP pfn_glMatrixRotatefEXT) (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); -extern pfn_glMatrixRotatefEXT fp_glMatrixRotatefEXT; -typedef void (APIENTRYP pfn_glMatrixRotatedEXT) (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); -extern pfn_glMatrixRotatedEXT fp_glMatrixRotatedEXT; -typedef void (APIENTRYP pfn_glMatrixScalefEXT) (GLenum, GLfloat, GLfloat, GLfloat); -extern pfn_glMatrixScalefEXT fp_glMatrixScalefEXT; -typedef void (APIENTRYP pfn_glMatrixScaledEXT) (GLenum, GLdouble, GLdouble, GLdouble); -extern pfn_glMatrixScaledEXT fp_glMatrixScaledEXT; -typedef void (APIENTRYP pfn_glMatrixTranslatefEXT) (GLenum, GLfloat, GLfloat, GLfloat); -extern pfn_glMatrixTranslatefEXT fp_glMatrixTranslatefEXT; -typedef void (APIENTRYP pfn_glMatrixTranslatedEXT) (GLenum, GLdouble, GLdouble, GLdouble); -extern pfn_glMatrixTranslatedEXT fp_glMatrixTranslatedEXT; -typedef void (APIENTRYP pfn_glMatrixFrustumEXT) (GLenum, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble); -extern pfn_glMatrixFrustumEXT fp_glMatrixFrustumEXT; -typedef void (APIENTRYP pfn_glMatrixOrthoEXT) (GLenum, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble); -extern pfn_glMatrixOrthoEXT fp_glMatrixOrthoEXT; -typedef void (APIENTRYP pfn_glMatrixPopEXT) (GLenum); -extern pfn_glMatrixPopEXT fp_glMatrixPopEXT; -typedef void (APIENTRYP pfn_glMatrixPushEXT) (GLenum); -extern pfn_glMatrixPushEXT fp_glMatrixPushEXT; -typedef void (APIENTRYP pfn_glClientAttribDefaultEXT) (GLbitfield); -extern pfn_glClientAttribDefaultEXT fp_glClientAttribDefaultEXT; -typedef void (APIENTRYP pfn_glPushClientAttribDefaultEXT) (GLbitfield); -extern pfn_glPushClientAttribDefaultEXT fp_glPushClientAttribDefaultEXT; -typedef void (APIENTRYP pfn_glTextureParameterfEXT) (GLuint, GLenum, GLenum, GLfloat); -extern pfn_glTextureParameterfEXT fp_glTextureParameterfEXT; -typedef void (APIENTRYP pfn_glTextureParameterfvEXT) (GLuint, GLenum, GLenum, const GLfloat*); -extern pfn_glTextureParameterfvEXT fp_glTextureParameterfvEXT; -typedef void (APIENTRYP pfn_glTextureParameteriEXT) (GLuint, GLenum, GLenum, GLint); -extern pfn_glTextureParameteriEXT fp_glTextureParameteriEXT; -typedef void (APIENTRYP pfn_glTextureParameterivEXT) (GLuint, GLenum, GLenum, const GLint*); -extern pfn_glTextureParameterivEXT fp_glTextureParameterivEXT; -typedef void (APIENTRYP pfn_glTextureImage1DEXT) (GLuint, GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const void*); -extern pfn_glTextureImage1DEXT fp_glTextureImage1DEXT; -typedef void (APIENTRYP pfn_glTextureImage2DEXT) (GLuint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void*); -extern pfn_glTextureImage2DEXT fp_glTextureImage2DEXT; -typedef void (APIENTRYP pfn_glTextureSubImage1DEXT) (GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const void*); -extern pfn_glTextureSubImage1DEXT fp_glTextureSubImage1DEXT; -typedef void (APIENTRYP pfn_glTextureSubImage2DEXT) (GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void*); -extern pfn_glTextureSubImage2DEXT fp_glTextureSubImage2DEXT; -typedef void (APIENTRYP pfn_glCopyTextureImage1DEXT) (GLuint, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint); -extern pfn_glCopyTextureImage1DEXT fp_glCopyTextureImage1DEXT; -typedef void (APIENTRYP pfn_glCopyTextureImage2DEXT) (GLuint, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); -extern pfn_glCopyTextureImage2DEXT fp_glCopyTextureImage2DEXT; -typedef void (APIENTRYP pfn_glCopyTextureSubImage1DEXT) (GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei); -extern pfn_glCopyTextureSubImage1DEXT fp_glCopyTextureSubImage1DEXT; -typedef void (APIENTRYP pfn_glCopyTextureSubImage2DEXT) (GLuint, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); -extern pfn_glCopyTextureSubImage2DEXT fp_glCopyTextureSubImage2DEXT; -typedef void (APIENTRYP pfn_glGetTextureImageEXT) (GLuint, GLenum, GLint, GLenum, GLenum, void*); -extern pfn_glGetTextureImageEXT fp_glGetTextureImageEXT; -typedef void (APIENTRYP pfn_glGetTextureParameterfvEXT) (GLuint, GLenum, GLenum, GLfloat*); -extern pfn_glGetTextureParameterfvEXT fp_glGetTextureParameterfvEXT; -typedef void (APIENTRYP pfn_glGetTextureParameterivEXT) (GLuint, GLenum, GLenum, GLint*); -extern pfn_glGetTextureParameterivEXT fp_glGetTextureParameterivEXT; -typedef void (APIENTRYP pfn_glGetTextureLevelParameterfvEXT) (GLuint, GLenum, GLint, GLenum, GLfloat*); -extern pfn_glGetTextureLevelParameterfvEXT fp_glGetTextureLevelParameterfvEXT; -typedef void (APIENTRYP pfn_glGetTextureLevelParameterivEXT) (GLuint, GLenum, GLint, GLenum, GLint*); -extern pfn_glGetTextureLevelParameterivEXT fp_glGetTextureLevelParameterivEXT; -typedef void (APIENTRYP pfn_glTextureImage3DEXT) (GLuint, GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const void*); -extern pfn_glTextureImage3DEXT fp_glTextureImage3DEXT; -typedef void (APIENTRYP pfn_glTextureSubImage3DEXT) (GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const void*); -extern pfn_glTextureSubImage3DEXT fp_glTextureSubImage3DEXT; -typedef void (APIENTRYP pfn_glCopyTextureSubImage3DEXT) (GLuint, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); -extern pfn_glCopyTextureSubImage3DEXT fp_glCopyTextureSubImage3DEXT; -typedef void (APIENTRYP pfn_glBindMultiTextureEXT) (GLenum, GLenum, GLuint); -extern pfn_glBindMultiTextureEXT fp_glBindMultiTextureEXT; -typedef void (APIENTRYP pfn_glMultiTexCoordPointerEXT) (GLenum, GLint, GLenum, GLsizei, const void*); -extern pfn_glMultiTexCoordPointerEXT fp_glMultiTexCoordPointerEXT; -typedef void (APIENTRYP pfn_glMultiTexEnvfEXT) (GLenum, GLenum, GLenum, GLfloat); -extern pfn_glMultiTexEnvfEXT fp_glMultiTexEnvfEXT; -typedef void (APIENTRYP pfn_glMultiTexEnvfvEXT) (GLenum, GLenum, GLenum, const GLfloat*); -extern pfn_glMultiTexEnvfvEXT fp_glMultiTexEnvfvEXT; -typedef void (APIENTRYP pfn_glMultiTexEnviEXT) (GLenum, GLenum, GLenum, GLint); -extern pfn_glMultiTexEnviEXT fp_glMultiTexEnviEXT; -typedef void (APIENTRYP pfn_glMultiTexEnvivEXT) (GLenum, GLenum, GLenum, const GLint*); -extern pfn_glMultiTexEnvivEXT fp_glMultiTexEnvivEXT; -typedef void (APIENTRYP pfn_glMultiTexGendEXT) (GLenum, GLenum, GLenum, GLdouble); -extern pfn_glMultiTexGendEXT fp_glMultiTexGendEXT; -typedef void (APIENTRYP pfn_glMultiTexGendvEXT) (GLenum, GLenum, GLenum, const GLdouble*); -extern pfn_glMultiTexGendvEXT fp_glMultiTexGendvEXT; -typedef void (APIENTRYP pfn_glMultiTexGenfEXT) (GLenum, GLenum, GLenum, GLfloat); -extern pfn_glMultiTexGenfEXT fp_glMultiTexGenfEXT; -typedef void (APIENTRYP pfn_glMultiTexGenfvEXT) (GLenum, GLenum, GLenum, const GLfloat*); -extern pfn_glMultiTexGenfvEXT fp_glMultiTexGenfvEXT; -typedef void (APIENTRYP pfn_glMultiTexGeniEXT) (GLenum, GLenum, GLenum, GLint); -extern pfn_glMultiTexGeniEXT fp_glMultiTexGeniEXT; -typedef void (APIENTRYP pfn_glMultiTexGenivEXT) (GLenum, GLenum, GLenum, const GLint*); -extern pfn_glMultiTexGenivEXT fp_glMultiTexGenivEXT; -typedef void (APIENTRYP pfn_glGetMultiTexEnvfvEXT) (GLenum, GLenum, GLenum, GLfloat*); -extern pfn_glGetMultiTexEnvfvEXT fp_glGetMultiTexEnvfvEXT; -typedef void (APIENTRYP pfn_glGetMultiTexEnvivEXT) (GLenum, GLenum, GLenum, GLint*); -extern pfn_glGetMultiTexEnvivEXT fp_glGetMultiTexEnvivEXT; -typedef void (APIENTRYP pfn_glGetMultiTexGendvEXT) (GLenum, GLenum, GLenum, GLdouble*); -extern pfn_glGetMultiTexGendvEXT fp_glGetMultiTexGendvEXT; -typedef void (APIENTRYP pfn_glGetMultiTexGenfvEXT) (GLenum, GLenum, GLenum, GLfloat*); -extern pfn_glGetMultiTexGenfvEXT fp_glGetMultiTexGenfvEXT; -typedef void (APIENTRYP pfn_glGetMultiTexGenivEXT) (GLenum, GLenum, GLenum, GLint*); -extern pfn_glGetMultiTexGenivEXT fp_glGetMultiTexGenivEXT; -typedef void (APIENTRYP pfn_glMultiTexParameteriEXT) (GLenum, GLenum, GLenum, GLint); -extern pfn_glMultiTexParameteriEXT fp_glMultiTexParameteriEXT; -typedef void (APIENTRYP pfn_glMultiTexParameterivEXT) (GLenum, GLenum, GLenum, const GLint*); -extern pfn_glMultiTexParameterivEXT fp_glMultiTexParameterivEXT; -typedef void (APIENTRYP pfn_glMultiTexParameterfEXT) (GLenum, GLenum, GLenum, GLfloat); -extern pfn_glMultiTexParameterfEXT fp_glMultiTexParameterfEXT; -typedef void (APIENTRYP pfn_glMultiTexParameterfvEXT) (GLenum, GLenum, GLenum, const GLfloat*); -extern pfn_glMultiTexParameterfvEXT fp_glMultiTexParameterfvEXT; -typedef void (APIENTRYP pfn_glMultiTexImage1DEXT) (GLenum, GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const void*); -extern pfn_glMultiTexImage1DEXT fp_glMultiTexImage1DEXT; -typedef void (APIENTRYP pfn_glMultiTexImage2DEXT) (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void*); -extern pfn_glMultiTexImage2DEXT fp_glMultiTexImage2DEXT; -typedef void (APIENTRYP pfn_glMultiTexSubImage1DEXT) (GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const void*); -extern pfn_glMultiTexSubImage1DEXT fp_glMultiTexSubImage1DEXT; -typedef void (APIENTRYP pfn_glMultiTexSubImage2DEXT) (GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void*); -extern pfn_glMultiTexSubImage2DEXT fp_glMultiTexSubImage2DEXT; -typedef void (APIENTRYP pfn_glCopyMultiTexImage1DEXT) (GLenum, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint); -extern pfn_glCopyMultiTexImage1DEXT fp_glCopyMultiTexImage1DEXT; -typedef void (APIENTRYP pfn_glCopyMultiTexImage2DEXT) (GLenum, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); -extern pfn_glCopyMultiTexImage2DEXT fp_glCopyMultiTexImage2DEXT; -typedef void (APIENTRYP pfn_glCopyMultiTexSubImage1DEXT) (GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei); -extern pfn_glCopyMultiTexSubImage1DEXT fp_glCopyMultiTexSubImage1DEXT; -typedef void (APIENTRYP pfn_glCopyMultiTexSubImage2DEXT) (GLenum, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); -extern pfn_glCopyMultiTexSubImage2DEXT fp_glCopyMultiTexSubImage2DEXT; -typedef void (APIENTRYP pfn_glGetMultiTexImageEXT) (GLenum, GLenum, GLint, GLenum, GLenum, void*); -extern pfn_glGetMultiTexImageEXT fp_glGetMultiTexImageEXT; -typedef void (APIENTRYP pfn_glGetMultiTexParameterfvEXT) (GLenum, GLenum, GLenum, GLfloat*); -extern pfn_glGetMultiTexParameterfvEXT fp_glGetMultiTexParameterfvEXT; -typedef void (APIENTRYP pfn_glGetMultiTexParameterivEXT) (GLenum, GLenum, GLenum, GLint*); -extern pfn_glGetMultiTexParameterivEXT fp_glGetMultiTexParameterivEXT; -typedef void (APIENTRYP pfn_glGetMultiTexLevelParameterfvEXT) (GLenum, GLenum, GLint, GLenum, GLfloat*); -extern pfn_glGetMultiTexLevelParameterfvEXT fp_glGetMultiTexLevelParameterfvEXT; -typedef void (APIENTRYP pfn_glGetMultiTexLevelParameterivEXT) (GLenum, GLenum, GLint, GLenum, GLint*); -extern pfn_glGetMultiTexLevelParameterivEXT fp_glGetMultiTexLevelParameterivEXT; -typedef void (APIENTRYP pfn_glMultiTexImage3DEXT) (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const void*); -extern pfn_glMultiTexImage3DEXT fp_glMultiTexImage3DEXT; -typedef void (APIENTRYP pfn_glMultiTexSubImage3DEXT) (GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const void*); -extern pfn_glMultiTexSubImage3DEXT fp_glMultiTexSubImage3DEXT; -typedef void (APIENTRYP pfn_glCopyMultiTexSubImage3DEXT) (GLenum, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); -extern pfn_glCopyMultiTexSubImage3DEXT fp_glCopyMultiTexSubImage3DEXT; -typedef void (APIENTRYP pfn_glEnableClientStateIndexedEXT) (GLenum, GLuint); -extern pfn_glEnableClientStateIndexedEXT fp_glEnableClientStateIndexedEXT; -typedef void (APIENTRYP pfn_glDisableClientStateIndexedEXT) (GLenum, GLuint); -extern pfn_glDisableClientStateIndexedEXT fp_glDisableClientStateIndexedEXT; -typedef void (APIENTRYP pfn_glGetFloatIndexedvEXT) (GLenum, GLuint, GLfloat*); -extern pfn_glGetFloatIndexedvEXT fp_glGetFloatIndexedvEXT; -typedef void (APIENTRYP pfn_glGetDoubleIndexedvEXT) (GLenum, GLuint, GLdouble*); -extern pfn_glGetDoubleIndexedvEXT fp_glGetDoubleIndexedvEXT; -typedef void (APIENTRYP pfn_glGetPointerIndexedvEXT) (GLenum, GLuint, void**); -extern pfn_glGetPointerIndexedvEXT fp_glGetPointerIndexedvEXT; -typedef void (APIENTRYP pfn_glEnableIndexedEXT) (GLenum, GLuint); -extern pfn_glEnableIndexedEXT fp_glEnableIndexedEXT; -typedef void (APIENTRYP pfn_glDisableIndexedEXT) (GLenum, GLuint); -extern pfn_glDisableIndexedEXT fp_glDisableIndexedEXT; -typedef GLboolean (APIENTRYP pfn_glIsEnabledIndexedEXT) (GLenum, GLuint); -extern pfn_glIsEnabledIndexedEXT fp_glIsEnabledIndexedEXT; -typedef void (APIENTRYP pfn_glGetIntegerIndexedvEXT) (GLenum, GLuint, GLint*); -extern pfn_glGetIntegerIndexedvEXT fp_glGetIntegerIndexedvEXT; -typedef void (APIENTRYP pfn_glGetBooleanIndexedvEXT) (GLenum, GLuint, GLboolean*); -extern pfn_glGetBooleanIndexedvEXT fp_glGetBooleanIndexedvEXT; -typedef void (APIENTRYP pfn_glCompressedTextureImage3DEXT) (GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const void*); -extern pfn_glCompressedTextureImage3DEXT fp_glCompressedTextureImage3DEXT; -typedef void (APIENTRYP pfn_glCompressedTextureImage2DEXT) (GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void*); -extern pfn_glCompressedTextureImage2DEXT fp_glCompressedTextureImage2DEXT; -typedef void (APIENTRYP pfn_glCompressedTextureImage1DEXT) (GLuint, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const void*); -extern pfn_glCompressedTextureImage1DEXT fp_glCompressedTextureImage1DEXT; -typedef void (APIENTRYP pfn_glCompressedTextureSubImage3DEXT) (GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const void*); -extern pfn_glCompressedTextureSubImage3DEXT fp_glCompressedTextureSubImage3DEXT; -typedef void (APIENTRYP pfn_glCompressedTextureSubImage2DEXT) (GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void*); -extern pfn_glCompressedTextureSubImage2DEXT fp_glCompressedTextureSubImage2DEXT; -typedef void (APIENTRYP pfn_glCompressedTextureSubImage1DEXT) (GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const void*); -extern pfn_glCompressedTextureSubImage1DEXT fp_glCompressedTextureSubImage1DEXT; -typedef void (APIENTRYP pfn_glGetCompressedTextureImageEXT) (GLuint, GLenum, GLint, void*); -extern pfn_glGetCompressedTextureImageEXT fp_glGetCompressedTextureImageEXT; -typedef void (APIENTRYP pfn_glCompressedMultiTexImage3DEXT) (GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const void*); -extern pfn_glCompressedMultiTexImage3DEXT fp_glCompressedMultiTexImage3DEXT; -typedef void (APIENTRYP pfn_glCompressedMultiTexImage2DEXT) (GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void*); -extern pfn_glCompressedMultiTexImage2DEXT fp_glCompressedMultiTexImage2DEXT; -typedef void (APIENTRYP pfn_glCompressedMultiTexImage1DEXT) (GLenum, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const void*); -extern pfn_glCompressedMultiTexImage1DEXT fp_glCompressedMultiTexImage1DEXT; -typedef void (APIENTRYP pfn_glCompressedMultiTexSubImage3DEXT) (GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const void*); -extern pfn_glCompressedMultiTexSubImage3DEXT fp_glCompressedMultiTexSubImage3DEXT; -typedef void (APIENTRYP pfn_glCompressedMultiTexSubImage2DEXT) (GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void*); -extern pfn_glCompressedMultiTexSubImage2DEXT fp_glCompressedMultiTexSubImage2DEXT; -typedef void (APIENTRYP pfn_glCompressedMultiTexSubImage1DEXT) (GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const void*); -extern pfn_glCompressedMultiTexSubImage1DEXT fp_glCompressedMultiTexSubImage1DEXT; -typedef void (APIENTRYP pfn_glGetCompressedMultiTexImageEXT) (GLenum, GLenum, GLint, void*); -extern pfn_glGetCompressedMultiTexImageEXT fp_glGetCompressedMultiTexImageEXT; -typedef void (APIENTRYP pfn_glMatrixLoadTransposefEXT) (GLenum, const GLfloat*); -extern pfn_glMatrixLoadTransposefEXT fp_glMatrixLoadTransposefEXT; -typedef void (APIENTRYP pfn_glMatrixLoadTransposedEXT) (GLenum, const GLdouble*); -extern pfn_glMatrixLoadTransposedEXT fp_glMatrixLoadTransposedEXT; -typedef void (APIENTRYP pfn_glMatrixMultTransposefEXT) (GLenum, const GLfloat*); -extern pfn_glMatrixMultTransposefEXT fp_glMatrixMultTransposefEXT; -typedef void (APIENTRYP pfn_glMatrixMultTransposedEXT) (GLenum, const GLdouble*); -extern pfn_glMatrixMultTransposedEXT fp_glMatrixMultTransposedEXT; -typedef void (APIENTRYP pfn_glNamedBufferDataEXT) (GLuint, GLsizeiptr, const void*, GLenum); -extern pfn_glNamedBufferDataEXT fp_glNamedBufferDataEXT; -typedef void (APIENTRYP pfn_glNamedBufferSubDataEXT) (GLuint, GLintptr, GLsizeiptr, const void*); -extern pfn_glNamedBufferSubDataEXT fp_glNamedBufferSubDataEXT; -typedef void* (APIENTRYP pfn_glMapNamedBufferEXT) (GLuint, GLenum); -extern pfn_glMapNamedBufferEXT fp_glMapNamedBufferEXT; -typedef GLboolean (APIENTRYP pfn_glUnmapNamedBufferEXT) (GLuint); -extern pfn_glUnmapNamedBufferEXT fp_glUnmapNamedBufferEXT; -typedef void (APIENTRYP pfn_glGetNamedBufferParameterivEXT) (GLuint, GLenum, GLint*); -extern pfn_glGetNamedBufferParameterivEXT fp_glGetNamedBufferParameterivEXT; -typedef void (APIENTRYP pfn_glGetNamedBufferPointervEXT) (GLuint, GLenum, void**); -extern pfn_glGetNamedBufferPointervEXT fp_glGetNamedBufferPointervEXT; -typedef void (APIENTRYP pfn_glGetNamedBufferSubDataEXT) (GLuint, GLintptr, GLsizeiptr, void*); -extern pfn_glGetNamedBufferSubDataEXT fp_glGetNamedBufferSubDataEXT; -typedef void (APIENTRYP pfn_glProgramUniform1fEXT) (GLuint, GLint, GLfloat); -extern pfn_glProgramUniform1fEXT fp_glProgramUniform1fEXT; -typedef void (APIENTRYP pfn_glProgramUniform2fEXT) (GLuint, GLint, GLfloat, GLfloat); -extern pfn_glProgramUniform2fEXT fp_glProgramUniform2fEXT; -typedef void (APIENTRYP pfn_glProgramUniform3fEXT) (GLuint, GLint, GLfloat, GLfloat, GLfloat); -extern pfn_glProgramUniform3fEXT fp_glProgramUniform3fEXT; -typedef void (APIENTRYP pfn_glProgramUniform4fEXT) (GLuint, GLint, GLfloat, GLfloat, GLfloat, GLfloat); -extern pfn_glProgramUniform4fEXT fp_glProgramUniform4fEXT; -typedef void (APIENTRYP pfn_glProgramUniform1iEXT) (GLuint, GLint, GLint); -extern pfn_glProgramUniform1iEXT fp_glProgramUniform1iEXT; -typedef void (APIENTRYP pfn_glProgramUniform2iEXT) (GLuint, GLint, GLint, GLint); -extern pfn_glProgramUniform2iEXT fp_glProgramUniform2iEXT; -typedef void (APIENTRYP pfn_glProgramUniform3iEXT) (GLuint, GLint, GLint, GLint, GLint); -extern pfn_glProgramUniform3iEXT fp_glProgramUniform3iEXT; -typedef void (APIENTRYP pfn_glProgramUniform4iEXT) (GLuint, GLint, GLint, GLint, GLint, GLint); -extern pfn_glProgramUniform4iEXT fp_glProgramUniform4iEXT; -typedef void (APIENTRYP pfn_glProgramUniform1fvEXT) (GLuint, GLint, GLsizei, const GLfloat*); -extern pfn_glProgramUniform1fvEXT fp_glProgramUniform1fvEXT; -typedef void (APIENTRYP pfn_glProgramUniform2fvEXT) (GLuint, GLint, GLsizei, const GLfloat*); -extern pfn_glProgramUniform2fvEXT fp_glProgramUniform2fvEXT; -typedef void (APIENTRYP pfn_glProgramUniform3fvEXT) (GLuint, GLint, GLsizei, const GLfloat*); -extern pfn_glProgramUniform3fvEXT fp_glProgramUniform3fvEXT; -typedef void (APIENTRYP pfn_glProgramUniform4fvEXT) (GLuint, GLint, GLsizei, const GLfloat*); -extern pfn_glProgramUniform4fvEXT fp_glProgramUniform4fvEXT; -typedef void (APIENTRYP pfn_glProgramUniform1ivEXT) (GLuint, GLint, GLsizei, const GLint*); -extern pfn_glProgramUniform1ivEXT fp_glProgramUniform1ivEXT; -typedef void (APIENTRYP pfn_glProgramUniform2ivEXT) (GLuint, GLint, GLsizei, const GLint*); -extern pfn_glProgramUniform2ivEXT fp_glProgramUniform2ivEXT; -typedef void (APIENTRYP pfn_glProgramUniform3ivEXT) (GLuint, GLint, GLsizei, const GLint*); -extern pfn_glProgramUniform3ivEXT fp_glProgramUniform3ivEXT; -typedef void (APIENTRYP pfn_glProgramUniform4ivEXT) (GLuint, GLint, GLsizei, const GLint*); -extern pfn_glProgramUniform4ivEXT fp_glProgramUniform4ivEXT; -typedef void (APIENTRYP pfn_glProgramUniformMatrix2fvEXT) (GLuint, GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glProgramUniformMatrix2fvEXT fp_glProgramUniformMatrix2fvEXT; -typedef void (APIENTRYP pfn_glProgramUniformMatrix3fvEXT) (GLuint, GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glProgramUniformMatrix3fvEXT fp_glProgramUniformMatrix3fvEXT; -typedef void (APIENTRYP pfn_glProgramUniformMatrix4fvEXT) (GLuint, GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glProgramUniformMatrix4fvEXT fp_glProgramUniformMatrix4fvEXT; -typedef void (APIENTRYP pfn_glProgramUniformMatrix2x3fvEXT) (GLuint, GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glProgramUniformMatrix2x3fvEXT fp_glProgramUniformMatrix2x3fvEXT; -typedef void (APIENTRYP pfn_glProgramUniformMatrix3x2fvEXT) (GLuint, GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glProgramUniformMatrix3x2fvEXT fp_glProgramUniformMatrix3x2fvEXT; -typedef void (APIENTRYP pfn_glProgramUniformMatrix2x4fvEXT) (GLuint, GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glProgramUniformMatrix2x4fvEXT fp_glProgramUniformMatrix2x4fvEXT; -typedef void (APIENTRYP pfn_glProgramUniformMatrix4x2fvEXT) (GLuint, GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glProgramUniformMatrix4x2fvEXT fp_glProgramUniformMatrix4x2fvEXT; -typedef void (APIENTRYP pfn_glProgramUniformMatrix3x4fvEXT) (GLuint, GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glProgramUniformMatrix3x4fvEXT fp_glProgramUniformMatrix3x4fvEXT; -typedef void (APIENTRYP pfn_glProgramUniformMatrix4x3fvEXT) (GLuint, GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glProgramUniformMatrix4x3fvEXT fp_glProgramUniformMatrix4x3fvEXT; -typedef void (APIENTRYP pfn_glTextureBufferEXT) (GLuint, GLenum, GLenum, GLuint); -extern pfn_glTextureBufferEXT fp_glTextureBufferEXT; -typedef void (APIENTRYP pfn_glMultiTexBufferEXT) (GLenum, GLenum, GLenum, GLuint); -extern pfn_glMultiTexBufferEXT fp_glMultiTexBufferEXT; -typedef void (APIENTRYP pfn_glTextureParameterIivEXT) (GLuint, GLenum, GLenum, const GLint*); -extern pfn_glTextureParameterIivEXT fp_glTextureParameterIivEXT; -typedef void (APIENTRYP pfn_glTextureParameterIuivEXT) (GLuint, GLenum, GLenum, const GLuint*); -extern pfn_glTextureParameterIuivEXT fp_glTextureParameterIuivEXT; -typedef void (APIENTRYP pfn_glGetTextureParameterIivEXT) (GLuint, GLenum, GLenum, GLint*); -extern pfn_glGetTextureParameterIivEXT fp_glGetTextureParameterIivEXT; -typedef void (APIENTRYP pfn_glGetTextureParameterIuivEXT) (GLuint, GLenum, GLenum, GLuint*); -extern pfn_glGetTextureParameterIuivEXT fp_glGetTextureParameterIuivEXT; -typedef void (APIENTRYP pfn_glMultiTexParameterIivEXT) (GLenum, GLenum, GLenum, const GLint*); -extern pfn_glMultiTexParameterIivEXT fp_glMultiTexParameterIivEXT; -typedef void (APIENTRYP pfn_glMultiTexParameterIuivEXT) (GLenum, GLenum, GLenum, const GLuint*); -extern pfn_glMultiTexParameterIuivEXT fp_glMultiTexParameterIuivEXT; -typedef void (APIENTRYP pfn_glGetMultiTexParameterIivEXT) (GLenum, GLenum, GLenum, GLint*); -extern pfn_glGetMultiTexParameterIivEXT fp_glGetMultiTexParameterIivEXT; -typedef void (APIENTRYP pfn_glGetMultiTexParameterIuivEXT) (GLenum, GLenum, GLenum, GLuint*); -extern pfn_glGetMultiTexParameterIuivEXT fp_glGetMultiTexParameterIuivEXT; -typedef void (APIENTRYP pfn_glProgramUniform1uiEXT) (GLuint, GLint, GLuint); -extern pfn_glProgramUniform1uiEXT fp_glProgramUniform1uiEXT; -typedef void (APIENTRYP pfn_glProgramUniform2uiEXT) (GLuint, GLint, GLuint, GLuint); -extern pfn_glProgramUniform2uiEXT fp_glProgramUniform2uiEXT; -typedef void (APIENTRYP pfn_glProgramUniform3uiEXT) (GLuint, GLint, GLuint, GLuint, GLuint); -extern pfn_glProgramUniform3uiEXT fp_glProgramUniform3uiEXT; -typedef void (APIENTRYP pfn_glProgramUniform4uiEXT) (GLuint, GLint, GLuint, GLuint, GLuint, GLuint); -extern pfn_glProgramUniform4uiEXT fp_glProgramUniform4uiEXT; -typedef void (APIENTRYP pfn_glProgramUniform1uivEXT) (GLuint, GLint, GLsizei, const GLuint*); -extern pfn_glProgramUniform1uivEXT fp_glProgramUniform1uivEXT; -typedef void (APIENTRYP pfn_glProgramUniform2uivEXT) (GLuint, GLint, GLsizei, const GLuint*); -extern pfn_glProgramUniform2uivEXT fp_glProgramUniform2uivEXT; -typedef void (APIENTRYP pfn_glProgramUniform3uivEXT) (GLuint, GLint, GLsizei, const GLuint*); -extern pfn_glProgramUniform3uivEXT fp_glProgramUniform3uivEXT; -typedef void (APIENTRYP pfn_glProgramUniform4uivEXT) (GLuint, GLint, GLsizei, const GLuint*); -extern pfn_glProgramUniform4uivEXT fp_glProgramUniform4uivEXT; -typedef void (APIENTRYP pfn_glNamedProgramLocalParameters4fvEXT) (GLuint, GLenum, GLuint, GLsizei, const GLfloat*); -extern pfn_glNamedProgramLocalParameters4fvEXT fp_glNamedProgramLocalParameters4fvEXT; -typedef void (APIENTRYP pfn_glNamedProgramLocalParameterI4iEXT) (GLuint, GLenum, GLuint, GLint, GLint, GLint, GLint); -extern pfn_glNamedProgramLocalParameterI4iEXT fp_glNamedProgramLocalParameterI4iEXT; -typedef void (APIENTRYP pfn_glNamedProgramLocalParameterI4ivEXT) (GLuint, GLenum, GLuint, const GLint*); -extern pfn_glNamedProgramLocalParameterI4ivEXT fp_glNamedProgramLocalParameterI4ivEXT; -typedef void (APIENTRYP pfn_glNamedProgramLocalParametersI4ivEXT) (GLuint, GLenum, GLuint, GLsizei, const GLint*); -extern pfn_glNamedProgramLocalParametersI4ivEXT fp_glNamedProgramLocalParametersI4ivEXT; -typedef void (APIENTRYP pfn_glNamedProgramLocalParameterI4uiEXT) (GLuint, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint); -extern pfn_glNamedProgramLocalParameterI4uiEXT fp_glNamedProgramLocalParameterI4uiEXT; -typedef void (APIENTRYP pfn_glNamedProgramLocalParameterI4uivEXT) (GLuint, GLenum, GLuint, const GLuint*); -extern pfn_glNamedProgramLocalParameterI4uivEXT fp_glNamedProgramLocalParameterI4uivEXT; -typedef void (APIENTRYP pfn_glNamedProgramLocalParametersI4uivEXT) (GLuint, GLenum, GLuint, GLsizei, const GLuint*); -extern pfn_glNamedProgramLocalParametersI4uivEXT fp_glNamedProgramLocalParametersI4uivEXT; -typedef void (APIENTRYP pfn_glGetNamedProgramLocalParameterIivEXT) (GLuint, GLenum, GLuint, GLint*); -extern pfn_glGetNamedProgramLocalParameterIivEXT fp_glGetNamedProgramLocalParameterIivEXT; -typedef void (APIENTRYP pfn_glGetNamedProgramLocalParameterIuivEXT) (GLuint, GLenum, GLuint, GLuint*); -extern pfn_glGetNamedProgramLocalParameterIuivEXT fp_glGetNamedProgramLocalParameterIuivEXT; -typedef void (APIENTRYP pfn_glEnableClientStateiEXT) (GLenum, GLuint); -extern pfn_glEnableClientStateiEXT fp_glEnableClientStateiEXT; -typedef void (APIENTRYP pfn_glDisableClientStateiEXT) (GLenum, GLuint); -extern pfn_glDisableClientStateiEXT fp_glDisableClientStateiEXT; -typedef void (APIENTRYP pfn_glGetFloati_vEXT) (GLenum, GLuint, GLfloat*); -extern pfn_glGetFloati_vEXT fp_glGetFloati_vEXT; -typedef void (APIENTRYP pfn_glGetDoublei_vEXT) (GLenum, GLuint, GLdouble*); -extern pfn_glGetDoublei_vEXT fp_glGetDoublei_vEXT; -typedef void (APIENTRYP pfn_glGetPointeri_vEXT) (GLenum, GLuint, void**); -extern pfn_glGetPointeri_vEXT fp_glGetPointeri_vEXT; -typedef void (APIENTRYP pfn_glNamedProgramStringEXT) (GLuint, GLenum, GLenum, GLsizei, const void*); -extern pfn_glNamedProgramStringEXT fp_glNamedProgramStringEXT; -typedef void (APIENTRYP pfn_glNamedProgramLocalParameter4dEXT) (GLuint, GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -extern pfn_glNamedProgramLocalParameter4dEXT fp_glNamedProgramLocalParameter4dEXT; -typedef void (APIENTRYP pfn_glNamedProgramLocalParameter4dvEXT) (GLuint, GLenum, GLuint, const GLdouble*); -extern pfn_glNamedProgramLocalParameter4dvEXT fp_glNamedProgramLocalParameter4dvEXT; -typedef void (APIENTRYP pfn_glNamedProgramLocalParameter4fEXT) (GLuint, GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -extern pfn_glNamedProgramLocalParameter4fEXT fp_glNamedProgramLocalParameter4fEXT; -typedef void (APIENTRYP pfn_glNamedProgramLocalParameter4fvEXT) (GLuint, GLenum, GLuint, const GLfloat*); -extern pfn_glNamedProgramLocalParameter4fvEXT fp_glNamedProgramLocalParameter4fvEXT; -typedef void (APIENTRYP pfn_glGetNamedProgramLocalParameterdvEXT) (GLuint, GLenum, GLuint, GLdouble*); -extern pfn_glGetNamedProgramLocalParameterdvEXT fp_glGetNamedProgramLocalParameterdvEXT; -typedef void (APIENTRYP pfn_glGetNamedProgramLocalParameterfvEXT) (GLuint, GLenum, GLuint, GLfloat*); -extern pfn_glGetNamedProgramLocalParameterfvEXT fp_glGetNamedProgramLocalParameterfvEXT; -typedef void (APIENTRYP pfn_glGetNamedProgramivEXT) (GLuint, GLenum, GLenum, GLint*); -extern pfn_glGetNamedProgramivEXT fp_glGetNamedProgramivEXT; -typedef void (APIENTRYP pfn_glGetNamedProgramStringEXT) (GLuint, GLenum, GLenum, void*); -extern pfn_glGetNamedProgramStringEXT fp_glGetNamedProgramStringEXT; -typedef void (APIENTRYP pfn_glNamedRenderbufferStorageEXT) (GLuint, GLenum, GLsizei, GLsizei); -extern pfn_glNamedRenderbufferStorageEXT fp_glNamedRenderbufferStorageEXT; -typedef void (APIENTRYP pfn_glGetNamedRenderbufferParameterivEXT) (GLuint, GLenum, GLint*); -extern pfn_glGetNamedRenderbufferParameterivEXT fp_glGetNamedRenderbufferParameterivEXT; -typedef void (APIENTRYP pfn_glNamedRenderbufferStorageMultisampleEXT) (GLuint, GLsizei, GLenum, GLsizei, GLsizei); -extern pfn_glNamedRenderbufferStorageMultisampleEXT fp_glNamedRenderbufferStorageMultisampleEXT; -typedef void (APIENTRYP pfn_glNamedRenderbufferStorageMultisampleCoverageEXT) (GLuint, GLsizei, GLsizei, GLenum, GLsizei, GLsizei); -extern pfn_glNamedRenderbufferStorageMultisampleCoverageEXT fp_glNamedRenderbufferStorageMultisampleCoverageEXT; -typedef GLenum (APIENTRYP pfn_glCheckNamedFramebufferStatusEXT) (GLuint, GLenum); -extern pfn_glCheckNamedFramebufferStatusEXT fp_glCheckNamedFramebufferStatusEXT; -typedef void (APIENTRYP pfn_glNamedFramebufferTexture1DEXT) (GLuint, GLenum, GLenum, GLuint, GLint); -extern pfn_glNamedFramebufferTexture1DEXT fp_glNamedFramebufferTexture1DEXT; -typedef void (APIENTRYP pfn_glNamedFramebufferTexture2DEXT) (GLuint, GLenum, GLenum, GLuint, GLint); -extern pfn_glNamedFramebufferTexture2DEXT fp_glNamedFramebufferTexture2DEXT; -typedef void (APIENTRYP pfn_glNamedFramebufferTexture3DEXT) (GLuint, GLenum, GLenum, GLuint, GLint, GLint); -extern pfn_glNamedFramebufferTexture3DEXT fp_glNamedFramebufferTexture3DEXT; -typedef void (APIENTRYP pfn_glNamedFramebufferRenderbufferEXT) (GLuint, GLenum, GLenum, GLuint); -extern pfn_glNamedFramebufferRenderbufferEXT fp_glNamedFramebufferRenderbufferEXT; -typedef void (APIENTRYP pfn_glGetNamedFramebufferAttachmentParameterivEXT) (GLuint, GLenum, GLenum, GLint*); -extern pfn_glGetNamedFramebufferAttachmentParameterivEXT fp_glGetNamedFramebufferAttachmentParameterivEXT; -typedef void (APIENTRYP pfn_glGenerateTextureMipmapEXT) (GLuint, GLenum); -extern pfn_glGenerateTextureMipmapEXT fp_glGenerateTextureMipmapEXT; -typedef void (APIENTRYP pfn_glGenerateMultiTexMipmapEXT) (GLenum, GLenum); -extern pfn_glGenerateMultiTexMipmapEXT fp_glGenerateMultiTexMipmapEXT; -typedef void (APIENTRYP pfn_glFramebufferDrawBufferEXT) (GLuint, GLenum); -extern pfn_glFramebufferDrawBufferEXT fp_glFramebufferDrawBufferEXT; -typedef void (APIENTRYP pfn_glFramebufferDrawBuffersEXT) (GLuint, GLsizei, const GLenum*); -extern pfn_glFramebufferDrawBuffersEXT fp_glFramebufferDrawBuffersEXT; -typedef void (APIENTRYP pfn_glFramebufferReadBufferEXT) (GLuint, GLenum); -extern pfn_glFramebufferReadBufferEXT fp_glFramebufferReadBufferEXT; -typedef void (APIENTRYP pfn_glGetFramebufferParameterivEXT) (GLuint, GLenum, GLint*); -extern pfn_glGetFramebufferParameterivEXT fp_glGetFramebufferParameterivEXT; -typedef void (APIENTRYP pfn_glNamedCopyBufferSubDataEXT) (GLuint, GLuint, GLintptr, GLintptr, GLsizeiptr); -extern pfn_glNamedCopyBufferSubDataEXT fp_glNamedCopyBufferSubDataEXT; -typedef void (APIENTRYP pfn_glNamedFramebufferTextureEXT) (GLuint, GLenum, GLuint, GLint); -extern pfn_glNamedFramebufferTextureEXT fp_glNamedFramebufferTextureEXT; -typedef void (APIENTRYP pfn_glNamedFramebufferTextureLayerEXT) (GLuint, GLenum, GLuint, GLint, GLint); -extern pfn_glNamedFramebufferTextureLayerEXT fp_glNamedFramebufferTextureLayerEXT; -typedef void (APIENTRYP pfn_glNamedFramebufferTextureFaceEXT) (GLuint, GLenum, GLuint, GLint, GLenum); -extern pfn_glNamedFramebufferTextureFaceEXT fp_glNamedFramebufferTextureFaceEXT; -typedef void (APIENTRYP pfn_glTextureRenderbufferEXT) (GLuint, GLenum, GLuint); -extern pfn_glTextureRenderbufferEXT fp_glTextureRenderbufferEXT; -typedef void (APIENTRYP pfn_glMultiTexRenderbufferEXT) (GLenum, GLenum, GLuint); -extern pfn_glMultiTexRenderbufferEXT fp_glMultiTexRenderbufferEXT; -typedef void (APIENTRYP pfn_glVertexArrayVertexOffsetEXT) (GLuint, GLuint, GLint, GLenum, GLsizei, GLintptr); -extern pfn_glVertexArrayVertexOffsetEXT fp_glVertexArrayVertexOffsetEXT; -typedef void (APIENTRYP pfn_glVertexArrayColorOffsetEXT) (GLuint, GLuint, GLint, GLenum, GLsizei, GLintptr); -extern pfn_glVertexArrayColorOffsetEXT fp_glVertexArrayColorOffsetEXT; -typedef void (APIENTRYP pfn_glVertexArrayEdgeFlagOffsetEXT) (GLuint, GLuint, GLsizei, GLintptr); -extern pfn_glVertexArrayEdgeFlagOffsetEXT fp_glVertexArrayEdgeFlagOffsetEXT; -typedef void (APIENTRYP pfn_glVertexArrayIndexOffsetEXT) (GLuint, GLuint, GLenum, GLsizei, GLintptr); -extern pfn_glVertexArrayIndexOffsetEXT fp_glVertexArrayIndexOffsetEXT; -typedef void (APIENTRYP pfn_glVertexArrayNormalOffsetEXT) (GLuint, GLuint, GLenum, GLsizei, GLintptr); -extern pfn_glVertexArrayNormalOffsetEXT fp_glVertexArrayNormalOffsetEXT; -typedef void (APIENTRYP pfn_glVertexArrayTexCoordOffsetEXT) (GLuint, GLuint, GLint, GLenum, GLsizei, GLintptr); -extern pfn_glVertexArrayTexCoordOffsetEXT fp_glVertexArrayTexCoordOffsetEXT; -typedef void (APIENTRYP pfn_glVertexArrayMultiTexCoordOffsetEXT) (GLuint, GLuint, GLenum, GLint, GLenum, GLsizei, GLintptr); -extern pfn_glVertexArrayMultiTexCoordOffsetEXT fp_glVertexArrayMultiTexCoordOffsetEXT; -typedef void (APIENTRYP pfn_glVertexArrayFogCoordOffsetEXT) (GLuint, GLuint, GLenum, GLsizei, GLintptr); -extern pfn_glVertexArrayFogCoordOffsetEXT fp_glVertexArrayFogCoordOffsetEXT; -typedef void (APIENTRYP pfn_glVertexArraySecondaryColorOffsetEXT) (GLuint, GLuint, GLint, GLenum, GLsizei, GLintptr); -extern pfn_glVertexArraySecondaryColorOffsetEXT fp_glVertexArraySecondaryColorOffsetEXT; -typedef void (APIENTRYP pfn_glVertexArrayVertexAttribOffsetEXT) (GLuint, GLuint, GLuint, GLint, GLenum, GLboolean, GLsizei, GLintptr); -extern pfn_glVertexArrayVertexAttribOffsetEXT fp_glVertexArrayVertexAttribOffsetEXT; -typedef void (APIENTRYP pfn_glVertexArrayVertexAttribIOffsetEXT) (GLuint, GLuint, GLuint, GLint, GLenum, GLsizei, GLintptr); -extern pfn_glVertexArrayVertexAttribIOffsetEXT fp_glVertexArrayVertexAttribIOffsetEXT; -typedef void (APIENTRYP pfn_glEnableVertexArrayEXT) (GLuint, GLenum); -extern pfn_glEnableVertexArrayEXT fp_glEnableVertexArrayEXT; -typedef void (APIENTRYP pfn_glDisableVertexArrayEXT) (GLuint, GLenum); -extern pfn_glDisableVertexArrayEXT fp_glDisableVertexArrayEXT; -typedef void (APIENTRYP pfn_glEnableVertexArrayAttribEXT) (GLuint, GLuint); -extern pfn_glEnableVertexArrayAttribEXT fp_glEnableVertexArrayAttribEXT; -typedef void (APIENTRYP pfn_glDisableVertexArrayAttribEXT) (GLuint, GLuint); -extern pfn_glDisableVertexArrayAttribEXT fp_glDisableVertexArrayAttribEXT; -typedef void (APIENTRYP pfn_glGetVertexArrayIntegervEXT) (GLuint, GLenum, GLint*); -extern pfn_glGetVertexArrayIntegervEXT fp_glGetVertexArrayIntegervEXT; -typedef void (APIENTRYP pfn_glGetVertexArrayPointervEXT) (GLuint, GLenum, void**); -extern pfn_glGetVertexArrayPointervEXT fp_glGetVertexArrayPointervEXT; -typedef void (APIENTRYP pfn_glGetVertexArrayIntegeri_vEXT) (GLuint, GLuint, GLenum, GLint*); -extern pfn_glGetVertexArrayIntegeri_vEXT fp_glGetVertexArrayIntegeri_vEXT; -typedef void (APIENTRYP pfn_glGetVertexArrayPointeri_vEXT) (GLuint, GLuint, GLenum, void**); -extern pfn_glGetVertexArrayPointeri_vEXT fp_glGetVertexArrayPointeri_vEXT; -typedef void* (APIENTRYP pfn_glMapNamedBufferRangeEXT) (GLuint, GLintptr, GLsizeiptr, GLbitfield); -extern pfn_glMapNamedBufferRangeEXT fp_glMapNamedBufferRangeEXT; -typedef void (APIENTRYP pfn_glFlushMappedNamedBufferRangeEXT) (GLuint, GLintptr, GLsizeiptr); -extern pfn_glFlushMappedNamedBufferRangeEXT fp_glFlushMappedNamedBufferRangeEXT; -typedef void (APIENTRYP pfn_glNamedBufferStorageEXT) (GLuint, GLsizeiptr, const void*, GLbitfield); -extern pfn_glNamedBufferStorageEXT fp_glNamedBufferStorageEXT; -typedef void (APIENTRYP pfn_glClearNamedBufferDataEXT) (GLuint, GLenum, GLenum, GLenum, const void*); -extern pfn_glClearNamedBufferDataEXT fp_glClearNamedBufferDataEXT; -typedef void (APIENTRYP pfn_glClearNamedBufferSubDataEXT) (GLuint, GLenum, GLsizeiptr, GLsizeiptr, GLenum, GLenum, const void*); -extern pfn_glClearNamedBufferSubDataEXT fp_glClearNamedBufferSubDataEXT; -typedef void (APIENTRYP pfn_glNamedFramebufferParameteriEXT) (GLuint, GLenum, GLint); -extern pfn_glNamedFramebufferParameteriEXT fp_glNamedFramebufferParameteriEXT; -typedef void (APIENTRYP pfn_glGetNamedFramebufferParameterivEXT) (GLuint, GLenum, GLint*); -extern pfn_glGetNamedFramebufferParameterivEXT fp_glGetNamedFramebufferParameterivEXT; -typedef void (APIENTRYP pfn_glProgramUniform1dEXT) (GLuint, GLint, GLdouble); -extern pfn_glProgramUniform1dEXT fp_glProgramUniform1dEXT; -typedef void (APIENTRYP pfn_glProgramUniform2dEXT) (GLuint, GLint, GLdouble, GLdouble); -extern pfn_glProgramUniform2dEXT fp_glProgramUniform2dEXT; -typedef void (APIENTRYP pfn_glProgramUniform3dEXT) (GLuint, GLint, GLdouble, GLdouble, GLdouble); -extern pfn_glProgramUniform3dEXT fp_glProgramUniform3dEXT; -typedef void (APIENTRYP pfn_glProgramUniform4dEXT) (GLuint, GLint, GLdouble, GLdouble, GLdouble, GLdouble); -extern pfn_glProgramUniform4dEXT fp_glProgramUniform4dEXT; -typedef void (APIENTRYP pfn_glProgramUniform1dvEXT) (GLuint, GLint, GLsizei, const GLdouble*); -extern pfn_glProgramUniform1dvEXT fp_glProgramUniform1dvEXT; -typedef void (APIENTRYP pfn_glProgramUniform2dvEXT) (GLuint, GLint, GLsizei, const GLdouble*); -extern pfn_glProgramUniform2dvEXT fp_glProgramUniform2dvEXT; -typedef void (APIENTRYP pfn_glProgramUniform3dvEXT) (GLuint, GLint, GLsizei, const GLdouble*); -extern pfn_glProgramUniform3dvEXT fp_glProgramUniform3dvEXT; -typedef void (APIENTRYP pfn_glProgramUniform4dvEXT) (GLuint, GLint, GLsizei, const GLdouble*); -extern pfn_glProgramUniform4dvEXT fp_glProgramUniform4dvEXT; -typedef void (APIENTRYP pfn_glProgramUniformMatrix2dvEXT) (GLuint, GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glProgramUniformMatrix2dvEXT fp_glProgramUniformMatrix2dvEXT; -typedef void (APIENTRYP pfn_glProgramUniformMatrix3dvEXT) (GLuint, GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glProgramUniformMatrix3dvEXT fp_glProgramUniformMatrix3dvEXT; -typedef void (APIENTRYP pfn_glProgramUniformMatrix4dvEXT) (GLuint, GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glProgramUniformMatrix4dvEXT fp_glProgramUniformMatrix4dvEXT; -typedef void (APIENTRYP pfn_glProgramUniformMatrix2x3dvEXT) (GLuint, GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glProgramUniformMatrix2x3dvEXT fp_glProgramUniformMatrix2x3dvEXT; -typedef void (APIENTRYP pfn_glProgramUniformMatrix2x4dvEXT) (GLuint, GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glProgramUniformMatrix2x4dvEXT fp_glProgramUniformMatrix2x4dvEXT; -typedef void (APIENTRYP pfn_glProgramUniformMatrix3x2dvEXT) (GLuint, GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glProgramUniformMatrix3x2dvEXT fp_glProgramUniformMatrix3x2dvEXT; -typedef void (APIENTRYP pfn_glProgramUniformMatrix3x4dvEXT) (GLuint, GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glProgramUniformMatrix3x4dvEXT fp_glProgramUniformMatrix3x4dvEXT; -typedef void (APIENTRYP pfn_glProgramUniformMatrix4x2dvEXT) (GLuint, GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glProgramUniformMatrix4x2dvEXT fp_glProgramUniformMatrix4x2dvEXT; -typedef void (APIENTRYP pfn_glProgramUniformMatrix4x3dvEXT) (GLuint, GLint, GLsizei, GLboolean, const GLdouble*); -extern pfn_glProgramUniformMatrix4x3dvEXT fp_glProgramUniformMatrix4x3dvEXT; -typedef void (APIENTRYP pfn_glTextureBufferRangeEXT) (GLuint, GLenum, GLenum, GLuint, GLintptr, GLsizeiptr); -extern pfn_glTextureBufferRangeEXT fp_glTextureBufferRangeEXT; -typedef void (APIENTRYP pfn_glTextureStorage1DEXT) (GLuint, GLenum, GLsizei, GLenum, GLsizei); -extern pfn_glTextureStorage1DEXT fp_glTextureStorage1DEXT; -typedef void (APIENTRYP pfn_glTextureStorage2DEXT) (GLuint, GLenum, GLsizei, GLenum, GLsizei, GLsizei); -extern pfn_glTextureStorage2DEXT fp_glTextureStorage2DEXT; -typedef void (APIENTRYP pfn_glTextureStorage3DEXT) (GLuint, GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei); -extern pfn_glTextureStorage3DEXT fp_glTextureStorage3DEXT; -typedef void (APIENTRYP pfn_glTextureStorage2DMultisampleEXT) (GLuint, GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLboolean); -extern pfn_glTextureStorage2DMultisampleEXT fp_glTextureStorage2DMultisampleEXT; -typedef void (APIENTRYP pfn_glTextureStorage3DMultisampleEXT) (GLuint, GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean); -extern pfn_glTextureStorage3DMultisampleEXT fp_glTextureStorage3DMultisampleEXT; -typedef void (APIENTRYP pfn_glVertexArrayBindVertexBufferEXT) (GLuint, GLuint, GLuint, GLintptr, GLsizei); -extern pfn_glVertexArrayBindVertexBufferEXT fp_glVertexArrayBindVertexBufferEXT; -typedef void (APIENTRYP pfn_glVertexArrayVertexAttribFormatEXT) (GLuint, GLuint, GLint, GLenum, GLboolean, GLuint); -extern pfn_glVertexArrayVertexAttribFormatEXT fp_glVertexArrayVertexAttribFormatEXT; -typedef void (APIENTRYP pfn_glVertexArrayVertexAttribIFormatEXT) (GLuint, GLuint, GLint, GLenum, GLuint); -extern pfn_glVertexArrayVertexAttribIFormatEXT fp_glVertexArrayVertexAttribIFormatEXT; -typedef void (APIENTRYP pfn_glVertexArrayVertexAttribLFormatEXT) (GLuint, GLuint, GLint, GLenum, GLuint); -extern pfn_glVertexArrayVertexAttribLFormatEXT fp_glVertexArrayVertexAttribLFormatEXT; -typedef void (APIENTRYP pfn_glVertexArrayVertexAttribBindingEXT) (GLuint, GLuint, GLuint); -extern pfn_glVertexArrayVertexAttribBindingEXT fp_glVertexArrayVertexAttribBindingEXT; -typedef void (APIENTRYP pfn_glVertexArrayVertexBindingDivisorEXT) (GLuint, GLuint, GLuint); -extern pfn_glVertexArrayVertexBindingDivisorEXT fp_glVertexArrayVertexBindingDivisorEXT; -typedef void (APIENTRYP pfn_glVertexArrayVertexAttribLOffsetEXT) (GLuint, GLuint, GLuint, GLint, GLenum, GLsizei, GLintptr); -extern pfn_glVertexArrayVertexAttribLOffsetEXT fp_glVertexArrayVertexAttribLOffsetEXT; -typedef void (APIENTRYP pfn_glTexturePageCommitmentEXT) (GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLboolean); -extern pfn_glTexturePageCommitmentEXT fp_glTexturePageCommitmentEXT; -typedef void (APIENTRYP pfn_glVertexArrayVertexAttribDivisorEXT) (GLuint, GLuint, GLuint); -extern pfn_glVertexArrayVertexAttribDivisorEXT fp_glVertexArrayVertexAttribDivisorEXT; - - /* GL_EXT_discard_framebuffer */ -extern GLboolean GLAD_EXT_discard_framebuffer; -#define GL_COLOR_EXT 0x1800 -#define GL_DEPTH_EXT 0x1801 -#define GL_STENCIL_EXT 0x1802 -typedef void (APIENTRYP pfn_glDiscardFramebufferEXT) (GLenum, GLsizei, const GLenum*); -extern pfn_glDiscardFramebufferEXT fp_glDiscardFramebufferEXT; - - /* GL_EXT_disjoint_timer_query */ -extern GLboolean GLAD_EXT_disjoint_timer_query; -#define GL_QUERY_COUNTER_BITS_EXT 0x8864 -#define GL_CURRENT_QUERY_EXT 0x8865 -#define GL_QUERY_RESULT_EXT 0x8866 -#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867 -#define GL_TIME_ELAPSED_EXT 0x88BF -#define GL_TIMESTAMP_EXT 0x8E28 -#define GL_GPU_DISJOINT_EXT 0x8FBB -typedef void (APIENTRYP pfn_glGenQueriesEXT) (GLsizei, GLuint*); -extern pfn_glGenQueriesEXT fp_glGenQueriesEXT; -typedef void (APIENTRYP pfn_glDeleteQueriesEXT) (GLsizei, const GLuint*); -extern pfn_glDeleteQueriesEXT fp_glDeleteQueriesEXT; -typedef GLboolean (APIENTRYP pfn_glIsQueryEXT) (GLuint); -extern pfn_glIsQueryEXT fp_glIsQueryEXT; -typedef void (APIENTRYP pfn_glBeginQueryEXT) (GLenum, GLuint); -extern pfn_glBeginQueryEXT fp_glBeginQueryEXT; -typedef void (APIENTRYP pfn_glEndQueryEXT) (GLenum); -extern pfn_glEndQueryEXT fp_glEndQueryEXT; -typedef void (APIENTRYP pfn_glQueryCounterEXT) (GLuint, GLenum); -extern pfn_glQueryCounterEXT fp_glQueryCounterEXT; -typedef void (APIENTRYP pfn_glGetQueryivEXT) (GLenum, GLenum, GLint*); -extern pfn_glGetQueryivEXT fp_glGetQueryivEXT; -typedef void (APIENTRYP pfn_glGetQueryObjectivEXT) (GLuint, GLenum, GLint*); -extern pfn_glGetQueryObjectivEXT fp_glGetQueryObjectivEXT; -typedef void (APIENTRYP pfn_glGetQueryObjectuivEXT) (GLuint, GLenum, GLuint*); -extern pfn_glGetQueryObjectuivEXT fp_glGetQueryObjectuivEXT; -typedef void (APIENTRYP pfn_glGetQueryObjecti64vEXT) (GLuint, GLenum, GLint64*); -extern pfn_glGetQueryObjecti64vEXT fp_glGetQueryObjecti64vEXT; -typedef void (APIENTRYP pfn_glGetQueryObjectui64vEXT) (GLuint, GLenum, GLuint64*); -extern pfn_glGetQueryObjectui64vEXT fp_glGetQueryObjectui64vEXT; - - /* GL_EXT_draw_buffers */ -extern GLboolean GLAD_EXT_draw_buffers; -#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF -#define GL_MAX_DRAW_BUFFERS_EXT 0x8824 -#define GL_DRAW_BUFFER0_EXT 0x8825 -#define GL_DRAW_BUFFER1_EXT 0x8826 -#define GL_DRAW_BUFFER2_EXT 0x8827 -#define GL_DRAW_BUFFER3_EXT 0x8828 -#define GL_DRAW_BUFFER4_EXT 0x8829 -#define GL_DRAW_BUFFER5_EXT 0x882A -#define GL_DRAW_BUFFER6_EXT 0x882B -#define GL_DRAW_BUFFER7_EXT 0x882C -#define GL_DRAW_BUFFER8_EXT 0x882D -#define GL_DRAW_BUFFER9_EXT 0x882E -#define GL_DRAW_BUFFER10_EXT 0x882F -#define GL_DRAW_BUFFER11_EXT 0x8830 -#define GL_DRAW_BUFFER12_EXT 0x8831 -#define GL_DRAW_BUFFER13_EXT 0x8832 -#define GL_DRAW_BUFFER14_EXT 0x8833 -#define GL_DRAW_BUFFER15_EXT 0x8834 -#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 -#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 -#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 -#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 -#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 -#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 -#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 -#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 -#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 -#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 -#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA -#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB -#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC -#define GL_COLOR_ATTACHMENT13_EXT 0x8CED -#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE -#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF -typedef void (APIENTRYP pfn_glDrawBuffersEXT) (GLsizei, const GLenum*); -extern pfn_glDrawBuffersEXT fp_glDrawBuffersEXT; - - /* GL_EXT_draw_buffers2 */ -extern GLboolean GLAD_EXT_draw_buffers2; -typedef void (APIENTRYP pfn_glColorMaskIndexedEXT) (GLuint, GLboolean, GLboolean, GLboolean, GLboolean); -extern pfn_glColorMaskIndexedEXT fp_glColorMaskIndexedEXT; - - /* GL_EXT_draw_buffers_indexed */ -extern GLboolean GLAD_EXT_draw_buffers_indexed; -typedef void (APIENTRYP pfn_glEnableiEXT) (GLenum, GLuint); -extern pfn_glEnableiEXT fp_glEnableiEXT; -typedef void (APIENTRYP pfn_glDisableiEXT) (GLenum, GLuint); -extern pfn_glDisableiEXT fp_glDisableiEXT; -typedef void (APIENTRYP pfn_glBlendEquationiEXT) (GLuint, GLenum); -extern pfn_glBlendEquationiEXT fp_glBlendEquationiEXT; -typedef void (APIENTRYP pfn_glBlendEquationSeparateiEXT) (GLuint, GLenum, GLenum); -extern pfn_glBlendEquationSeparateiEXT fp_glBlendEquationSeparateiEXT; -typedef void (APIENTRYP pfn_glBlendFunciEXT) (GLuint, GLenum, GLenum); -extern pfn_glBlendFunciEXT fp_glBlendFunciEXT; -typedef void (APIENTRYP pfn_glBlendFuncSeparateiEXT) (GLuint, GLenum, GLenum, GLenum, GLenum); -extern pfn_glBlendFuncSeparateiEXT fp_glBlendFuncSeparateiEXT; -typedef void (APIENTRYP pfn_glColorMaskiEXT) (GLuint, GLboolean, GLboolean, GLboolean, GLboolean); -extern pfn_glColorMaskiEXT fp_glColorMaskiEXT; -typedef GLboolean (APIENTRYP pfn_glIsEnablediEXT) (GLenum, GLuint); -extern pfn_glIsEnablediEXT fp_glIsEnablediEXT; - - /* GL_EXT_draw_elements_base_vertex */ -extern GLboolean GLAD_EXT_draw_elements_base_vertex; -typedef void (APIENTRYP pfn_glDrawElementsBaseVertexEXT) (GLenum, GLsizei, GLenum, const void*, GLint); -extern pfn_glDrawElementsBaseVertexEXT fp_glDrawElementsBaseVertexEXT; -typedef void (APIENTRYP pfn_glDrawRangeElementsBaseVertexEXT) (GLenum, GLuint, GLuint, GLsizei, GLenum, const void*, GLint); -extern pfn_glDrawRangeElementsBaseVertexEXT fp_glDrawRangeElementsBaseVertexEXT; -typedef void (APIENTRYP pfn_glDrawElementsInstancedBaseVertexEXT) (GLenum, GLsizei, GLenum, const void*, GLsizei, GLint); -extern pfn_glDrawElementsInstancedBaseVertexEXT fp_glDrawElementsInstancedBaseVertexEXT; -typedef void (APIENTRYP pfn_glMultiDrawElementsBaseVertexEXT) (GLenum, const GLsizei*, GLenum, const void**, GLsizei, const GLint*); -extern pfn_glMultiDrawElementsBaseVertexEXT fp_glMultiDrawElementsBaseVertexEXT; - - /* GL_EXT_draw_instanced */ -extern GLboolean GLAD_EXT_draw_instanced; -typedef void (APIENTRYP pfn_glDrawArraysInstancedEXT) (GLenum, GLint, GLsizei, GLsizei); -extern pfn_glDrawArraysInstancedEXT fp_glDrawArraysInstancedEXT; -typedef void (APIENTRYP pfn_glDrawElementsInstancedEXT) (GLenum, GLsizei, GLenum, const void*, GLsizei); -extern pfn_glDrawElementsInstancedEXT fp_glDrawElementsInstancedEXT; - - /* GL_EXT_float_blend */ -extern GLboolean GLAD_EXT_float_blend; - - /* GL_EXT_framebuffer_blit */ -extern GLboolean GLAD_EXT_framebuffer_blit; -#define GL_READ_FRAMEBUFFER_EXT 0x8CA8 -#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9 -#define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CA6 -#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA -typedef void (APIENTRYP pfn_glBlitFramebufferEXT) (GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum); -extern pfn_glBlitFramebufferEXT fp_glBlitFramebufferEXT; - - /* GL_EXT_framebuffer_multisample */ -extern GLboolean GLAD_EXT_framebuffer_multisample; -#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 -#define GL_MAX_SAMPLES_EXT 0x8D57 -typedef void (APIENTRYP pfn_glRenderbufferStorageMultisampleEXT) (GLenum, GLsizei, GLenum, GLsizei, GLsizei); -extern pfn_glRenderbufferStorageMultisampleEXT fp_glRenderbufferStorageMultisampleEXT; - - /* GL_EXT_framebuffer_multisample_blit_scaled */ -extern GLboolean GLAD_EXT_framebuffer_multisample_blit_scaled; -#define GL_SCALED_RESOLVE_FASTEST_EXT 0x90BA -#define GL_SCALED_RESOLVE_NICEST_EXT 0x90BB - - /* GL_EXT_framebuffer_object */ -extern GLboolean GLAD_EXT_framebuffer_object; -#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 -#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 -#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 -#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 -#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 -#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA -#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB -#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC -#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD -#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 -#define GL_STENCIL_ATTACHMENT_EXT 0x8D20 -#define GL_FRAMEBUFFER_EXT 0x8D40 -#define GL_RENDERBUFFER_EXT 0x8D41 -#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 -#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 -#define GL_STENCIL_INDEX1_EXT 0x8D46 -#define GL_STENCIL_INDEX4_EXT 0x8D47 -#define GL_STENCIL_INDEX8_EXT 0x8D48 -#define GL_STENCIL_INDEX16_EXT 0x8D49 -#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 -#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 -#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 -#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 -#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 -#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 -typedef GLboolean (APIENTRYP pfn_glIsRenderbufferEXT) (GLuint); -extern pfn_glIsRenderbufferEXT fp_glIsRenderbufferEXT; -typedef void (APIENTRYP pfn_glBindRenderbufferEXT) (GLenum, GLuint); -extern pfn_glBindRenderbufferEXT fp_glBindRenderbufferEXT; -typedef void (APIENTRYP pfn_glDeleteRenderbuffersEXT) (GLsizei, const GLuint*); -extern pfn_glDeleteRenderbuffersEXT fp_glDeleteRenderbuffersEXT; -typedef void (APIENTRYP pfn_glGenRenderbuffersEXT) (GLsizei, GLuint*); -extern pfn_glGenRenderbuffersEXT fp_glGenRenderbuffersEXT; -typedef void (APIENTRYP pfn_glRenderbufferStorageEXT) (GLenum, GLenum, GLsizei, GLsizei); -extern pfn_glRenderbufferStorageEXT fp_glRenderbufferStorageEXT; -typedef void (APIENTRYP pfn_glGetRenderbufferParameterivEXT) (GLenum, GLenum, GLint*); -extern pfn_glGetRenderbufferParameterivEXT fp_glGetRenderbufferParameterivEXT; -typedef GLboolean (APIENTRYP pfn_glIsFramebufferEXT) (GLuint); -extern pfn_glIsFramebufferEXT fp_glIsFramebufferEXT; -typedef void (APIENTRYP pfn_glBindFramebufferEXT) (GLenum, GLuint); -extern pfn_glBindFramebufferEXT fp_glBindFramebufferEXT; -typedef void (APIENTRYP pfn_glDeleteFramebuffersEXT) (GLsizei, const GLuint*); -extern pfn_glDeleteFramebuffersEXT fp_glDeleteFramebuffersEXT; -typedef void (APIENTRYP pfn_glGenFramebuffersEXT) (GLsizei, GLuint*); -extern pfn_glGenFramebuffersEXT fp_glGenFramebuffersEXT; -typedef GLenum (APIENTRYP pfn_glCheckFramebufferStatusEXT) (GLenum); -extern pfn_glCheckFramebufferStatusEXT fp_glCheckFramebufferStatusEXT; -typedef void (APIENTRYP pfn_glFramebufferTexture1DEXT) (GLenum, GLenum, GLenum, GLuint, GLint); -extern pfn_glFramebufferTexture1DEXT fp_glFramebufferTexture1DEXT; -typedef void (APIENTRYP pfn_glFramebufferTexture2DEXT) (GLenum, GLenum, GLenum, GLuint, GLint); -extern pfn_glFramebufferTexture2DEXT fp_glFramebufferTexture2DEXT; -typedef void (APIENTRYP pfn_glFramebufferTexture3DEXT) (GLenum, GLenum, GLenum, GLuint, GLint, GLint); -extern pfn_glFramebufferTexture3DEXT fp_glFramebufferTexture3DEXT; -typedef void (APIENTRYP pfn_glFramebufferRenderbufferEXT) (GLenum, GLenum, GLenum, GLuint); -extern pfn_glFramebufferRenderbufferEXT fp_glFramebufferRenderbufferEXT; -typedef void (APIENTRYP pfn_glGetFramebufferAttachmentParameterivEXT) (GLenum, GLenum, GLenum, GLint*); -extern pfn_glGetFramebufferAttachmentParameterivEXT fp_glGetFramebufferAttachmentParameterivEXT; -typedef void (APIENTRYP pfn_glGenerateMipmapEXT) (GLenum); -extern pfn_glGenerateMipmapEXT fp_glGenerateMipmapEXT; - - /* GL_EXT_framebuffer_sRGB */ -extern GLboolean GLAD_EXT_framebuffer_sRGB; -#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9 -#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA - - /* GL_EXT_geometry_point_size */ -extern GLboolean GLAD_EXT_geometry_point_size; - - /* GL_EXT_geometry_shader */ -extern GLboolean GLAD_EXT_geometry_shader; -#define GL_GEOMETRY_SHADER_EXT 0x8DD9 -#define GL_GEOMETRY_SHADER_BIT_EXT 0x00000004 -#define GL_GEOMETRY_LINKED_VERTICES_OUT_EXT 0x8916 -#define GL_GEOMETRY_LINKED_INPUT_TYPE_EXT 0x8917 -#define GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT 0x8918 -#define GL_GEOMETRY_SHADER_INVOCATIONS_EXT 0x887F -#define GL_LAYER_PROVOKING_VERTEX_EXT 0x825E -#define GL_LINES_ADJACENCY_EXT 0x000A -#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B -#define GL_TRIANGLES_ADJACENCY_EXT 0x000C -#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D -#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF -#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT 0x8A2C -#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8A32 -#define GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT 0x9123 -#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT 0x9124 -#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0 -#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1 -#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT 0x8E5A -#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29 -#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT 0x92CF -#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT 0x92D5 -#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT 0x90CD -#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT 0x90D7 -#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D -#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E -#define GL_UNDEFINED_VERTEX_EXT 0x8260 -#define GL_PRIMITIVES_GENERATED_EXT 0x8C87 -#define GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT 0x9312 -#define GL_MAX_FRAMEBUFFER_LAYERS_EXT 0x9317 -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8 -#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7 -#define GL_REFERENCED_BY_GEOMETRY_SHADER_EXT 0x9309 -typedef void (APIENTRYP pfn_glFramebufferTextureEXT) (GLenum, GLenum, GLuint, GLint); -extern pfn_glFramebufferTextureEXT fp_glFramebufferTextureEXT; - - /* GL_EXT_geometry_shader4 */ -extern GLboolean GLAD_EXT_geometry_shader4; -#define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA -#define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB -#define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC -#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD -#define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE -#define GL_MAX_VARYING_COMPONENTS_EXT 0x8B4B -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4 -#define GL_PROGRAM_POINT_SIZE_EXT 0x8642 -typedef void (APIENTRYP pfn_glProgramParameteriEXT) (GLuint, GLenum, GLint); -extern pfn_glProgramParameteriEXT fp_glProgramParameteriEXT; - - /* GL_EXT_gpu_program_parameters */ -extern GLboolean GLAD_EXT_gpu_program_parameters; -typedef void (APIENTRYP pfn_glProgramEnvParameters4fvEXT) (GLenum, GLuint, GLsizei, const GLfloat*); -extern pfn_glProgramEnvParameters4fvEXT fp_glProgramEnvParameters4fvEXT; -typedef void (APIENTRYP pfn_glProgramLocalParameters4fvEXT) (GLenum, GLuint, GLsizei, const GLfloat*); -extern pfn_glProgramLocalParameters4fvEXT fp_glProgramLocalParameters4fvEXT; - - /* GL_EXT_gpu_shader4 */ -extern GLboolean GLAD_EXT_gpu_shader4; -#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT 0x88FD -#define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0 -#define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1 -#define GL_SAMPLER_BUFFER_EXT 0x8DC2 -#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8DC3 -#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4 -#define GL_SAMPLER_CUBE_SHADOW_EXT 0x8DC5 -#define GL_UNSIGNED_INT_VEC2_EXT 0x8DC6 -#define GL_UNSIGNED_INT_VEC3_EXT 0x8DC7 -#define GL_UNSIGNED_INT_VEC4_EXT 0x8DC8 -#define GL_INT_SAMPLER_1D_EXT 0x8DC9 -#define GL_INT_SAMPLER_2D_EXT 0x8DCA -#define GL_INT_SAMPLER_3D_EXT 0x8DCB -#define GL_INT_SAMPLER_CUBE_EXT 0x8DCC -#define GL_INT_SAMPLER_2D_RECT_EXT 0x8DCD -#define GL_INT_SAMPLER_1D_ARRAY_EXT 0x8DCE -#define GL_INT_SAMPLER_2D_ARRAY_EXT 0x8DCF -#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0 -#define GL_UNSIGNED_INT_SAMPLER_1D_EXT 0x8DD1 -#define GL_UNSIGNED_INT_SAMPLER_2D_EXT 0x8DD2 -#define GL_UNSIGNED_INT_SAMPLER_3D_EXT 0x8DD3 -#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT 0x8DD4 -#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8DD5 -#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8DD6 -#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8DD7 -#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8 -#define GL_MIN_PROGRAM_TEXEL_OFFSET_EXT 0x8904 -#define GL_MAX_PROGRAM_TEXEL_OFFSET_EXT 0x8905 -typedef void (APIENTRYP pfn_glGetUniformuivEXT) (GLuint, GLint, GLuint*); -extern pfn_glGetUniformuivEXT fp_glGetUniformuivEXT; -typedef GLint (APIENTRYP pfn_glGetFragDataLocationEXT) (GLuint, const GLchar*); -extern pfn_glGetFragDataLocationEXT fp_glGetFragDataLocationEXT; -typedef void (APIENTRYP pfn_glUniform1uiEXT) (GLint, GLuint); -extern pfn_glUniform1uiEXT fp_glUniform1uiEXT; -typedef void (APIENTRYP pfn_glUniform2uiEXT) (GLint, GLuint, GLuint); -extern pfn_glUniform2uiEXT fp_glUniform2uiEXT; -typedef void (APIENTRYP pfn_glUniform3uiEXT) (GLint, GLuint, GLuint, GLuint); -extern pfn_glUniform3uiEXT fp_glUniform3uiEXT; -typedef void (APIENTRYP pfn_glUniform4uiEXT) (GLint, GLuint, GLuint, GLuint, GLuint); -extern pfn_glUniform4uiEXT fp_glUniform4uiEXT; -typedef void (APIENTRYP pfn_glUniform1uivEXT) (GLint, GLsizei, const GLuint*); -extern pfn_glUniform1uivEXT fp_glUniform1uivEXT; -typedef void (APIENTRYP pfn_glUniform2uivEXT) (GLint, GLsizei, const GLuint*); -extern pfn_glUniform2uivEXT fp_glUniform2uivEXT; -typedef void (APIENTRYP pfn_glUniform3uivEXT) (GLint, GLsizei, const GLuint*); -extern pfn_glUniform3uivEXT fp_glUniform3uivEXT; -typedef void (APIENTRYP pfn_glUniform4uivEXT) (GLint, GLsizei, const GLuint*); -extern pfn_glUniform4uivEXT fp_glUniform4uivEXT; - - /* GL_EXT_gpu_shader5 */ -extern GLboolean GLAD_EXT_gpu_shader5; - - /* GL_EXT_instanced_arrays */ -extern GLboolean GLAD_EXT_instanced_arrays; -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_EXT 0x88FE -typedef void (APIENTRYP pfn_glVertexAttribDivisorEXT) (GLuint, GLuint); -extern pfn_glVertexAttribDivisorEXT fp_glVertexAttribDivisorEXT; - - /* GL_EXT_map_buffer_range */ -extern GLboolean GLAD_EXT_map_buffer_range; -#define GL_MAP_READ_BIT_EXT 0x0001 -#define GL_MAP_WRITE_BIT_EXT 0x0002 -#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004 -#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008 -#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010 -#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020 -typedef void* (APIENTRYP pfn_glMapBufferRangeEXT) (GLenum, GLintptr, GLsizeiptr, GLbitfield); -extern pfn_glMapBufferRangeEXT fp_glMapBufferRangeEXT; -typedef void (APIENTRYP pfn_glFlushMappedBufferRangeEXT) (GLenum, GLintptr, GLsizeiptr); -extern pfn_glFlushMappedBufferRangeEXT fp_glFlushMappedBufferRangeEXT; - - /* GL_EXT_multi_draw_indirect */ -extern GLboolean GLAD_EXT_multi_draw_indirect; -typedef void (APIENTRYP pfn_glMultiDrawArraysIndirectEXT) (GLenum, const void*, GLsizei, GLsizei); -extern pfn_glMultiDrawArraysIndirectEXT fp_glMultiDrawArraysIndirectEXT; -typedef void (APIENTRYP pfn_glMultiDrawElementsIndirectEXT) (GLenum, GLenum, const void*, GLsizei, GLsizei); -extern pfn_glMultiDrawElementsIndirectEXT fp_glMultiDrawElementsIndirectEXT; - - /* GL_EXT_multisampled_compatibility */ -extern GLboolean GLAD_EXT_multisampled_compatibility; -#define GL_MULTISAMPLE_EXT 0x809D -#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F - - /* GL_EXT_multisampled_render_to_texture */ -extern GLboolean GLAD_EXT_multisampled_render_to_texture; -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C -typedef void (APIENTRYP pfn_glFramebufferTexture2DMultisampleEXT) (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); -extern pfn_glFramebufferTexture2DMultisampleEXT fp_glFramebufferTexture2DMultisampleEXT; - - /* GL_EXT_multiview_draw_buffers */ -extern GLboolean GLAD_EXT_multiview_draw_buffers; -#define GL_COLOR_ATTACHMENT_EXT 0x90F0 -#define GL_MULTIVIEW_EXT 0x90F1 -#define GL_DRAW_BUFFER_EXT 0x0C01 -#define GL_READ_BUFFER_EXT 0x0C02 -#define GL_MAX_MULTIVIEW_BUFFERS_EXT 0x90F2 -typedef void (APIENTRYP pfn_glReadBufferIndexedEXT) (GLenum, GLint); -extern pfn_glReadBufferIndexedEXT fp_glReadBufferIndexedEXT; -typedef void (APIENTRYP pfn_glDrawBuffersIndexedEXT) (GLint, const GLenum*, const GLint*); -extern pfn_glDrawBuffersIndexedEXT fp_glDrawBuffersIndexedEXT; -typedef void (APIENTRYP pfn_glGetIntegeri_vEXT) (GLenum, GLuint, GLint*); -extern pfn_glGetIntegeri_vEXT fp_glGetIntegeri_vEXT; - - /* GL_EXT_occlusion_query_boolean */ -extern GLboolean GLAD_EXT_occlusion_query_boolean; -#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F -#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A - - /* GL_EXT_packed_depth_stencil */ -extern GLboolean GLAD_EXT_packed_depth_stencil; -#define GL_DEPTH_STENCIL_EXT 0x84F9 -#define GL_UNSIGNED_INT_24_8_EXT 0x84FA -#define GL_DEPTH24_STENCIL8_EXT 0x88F0 -#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1 - - /* GL_EXT_packed_float */ -extern GLboolean GLAD_EXT_packed_float; -#define GL_R11F_G11F_B10F_EXT 0x8C3A -#define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B -#define GL_RGBA_SIGNED_COMPONENTS_EXT 0x8C3C - - /* GL_EXT_pixel_buffer_object */ -extern GLboolean GLAD_EXT_pixel_buffer_object; -#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB -#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC -#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED -#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF - - /* GL_EXT_polygon_offset_clamp */ -extern GLboolean GLAD_EXT_polygon_offset_clamp; -#define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B -typedef void (APIENTRYP pfn_glPolygonOffsetClampEXT) (GLfloat, GLfloat, GLfloat); -extern pfn_glPolygonOffsetClampEXT fp_glPolygonOffsetClampEXT; - - /* GL_EXT_post_depth_coverage */ -extern GLboolean GLAD_EXT_post_depth_coverage; - - /* GL_EXT_primitive_bounding_box */ -extern GLboolean GLAD_EXT_primitive_bounding_box; -#define GL_PRIMITIVE_BOUNDING_BOX_EXT 0x92BE -typedef void (APIENTRYP pfn_glPrimitiveBoundingBoxEXT) (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -extern pfn_glPrimitiveBoundingBoxEXT fp_glPrimitiveBoundingBoxEXT; - - /* GL_EXT_provoking_vertex */ -extern GLboolean GLAD_EXT_provoking_vertex; -#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C -#define GL_PROVOKING_VERTEX_EXT 0x8E4F -typedef void (APIENTRYP pfn_glProvokingVertexEXT) (GLenum); -extern pfn_glProvokingVertexEXT fp_glProvokingVertexEXT; - - /* GL_EXT_pvrtc_sRGB */ -extern GLboolean GLAD_EXT_pvrtc_sRGB; -#define GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54 -#define GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55 -#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56 -#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57 -#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG 0x93F0 -#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG 0x93F1 - - /* GL_EXT_raster_multisample */ -extern GLboolean GLAD_EXT_raster_multisample; -#define GL_RASTER_MULTISAMPLE_EXT 0x9327 -#define GL_RASTER_SAMPLES_EXT 0x9328 -#define GL_MAX_RASTER_SAMPLES_EXT 0x9329 -#define GL_RASTER_FIXED_SAMPLE_LOCATIONS_EXT 0x932A -#define GL_MULTISAMPLE_RASTERIZATION_ALLOWED_EXT 0x932B -#define GL_EFFECTIVE_RASTER_SAMPLES_EXT 0x932C -typedef void (APIENTRYP pfn_glRasterSamplesEXT) (GLuint, GLboolean); -extern pfn_glRasterSamplesEXT fp_glRasterSamplesEXT; - - /* GL_EXT_read_format_bgra */ -extern GLboolean GLAD_EXT_read_format_bgra; -#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365 -#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366 - - /* GL_EXT_render_snorm */ -extern GLboolean GLAD_EXT_render_snorm; -#define GL_R16_SNORM_EXT 0x8F98 -#define GL_RG16_SNORM_EXT 0x8F99 -#define GL_RGBA16_SNORM_EXT 0x8F9B - - /* GL_EXT_robustness */ -extern GLboolean GLAD_EXT_robustness; -#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253 -#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254 -#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255 -#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3 -#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256 -#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252 -#define GL_NO_RESET_NOTIFICATION_EXT 0x8261 -typedef GLenum (APIENTRYP pfn_glGetGraphicsResetStatusEXT) (); -extern pfn_glGetGraphicsResetStatusEXT fp_glGetGraphicsResetStatusEXT; -typedef void (APIENTRYP pfn_glReadnPixelsEXT) (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLsizei, void*); -extern pfn_glReadnPixelsEXT fp_glReadnPixelsEXT; -typedef void (APIENTRYP pfn_glGetnUniformfvEXT) (GLuint, GLint, GLsizei, GLfloat*); -extern pfn_glGetnUniformfvEXT fp_glGetnUniformfvEXT; -typedef void (APIENTRYP pfn_glGetnUniformivEXT) (GLuint, GLint, GLsizei, GLint*); -extern pfn_glGetnUniformivEXT fp_glGetnUniformivEXT; - - /* GL_EXT_separate_shader_objects */ -extern GLboolean GLAD_EXT_separate_shader_objects; -#define GL_ACTIVE_PROGRAM_EXT 0x8B8D -#define GL_VERTEX_SHADER_BIT_EXT 0x00000001 -#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002 -#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF -#define GL_PROGRAM_SEPARABLE_EXT 0x8258 -#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A -typedef void (APIENTRYP pfn_glUseShaderProgramEXT) (GLenum, GLuint); -extern pfn_glUseShaderProgramEXT fp_glUseShaderProgramEXT; -typedef void (APIENTRYP pfn_glActiveProgramEXT) (GLuint); -extern pfn_glActiveProgramEXT fp_glActiveProgramEXT; -typedef GLuint (APIENTRYP pfn_glCreateShaderProgramEXT) (GLenum, const GLchar*); -extern pfn_glCreateShaderProgramEXT fp_glCreateShaderProgramEXT; -typedef void (APIENTRYP pfn_glActiveShaderProgramEXT) (GLuint, GLuint); -extern pfn_glActiveShaderProgramEXT fp_glActiveShaderProgramEXT; -typedef void (APIENTRYP pfn_glBindProgramPipelineEXT) (GLuint); -extern pfn_glBindProgramPipelineEXT fp_glBindProgramPipelineEXT; -typedef GLuint (APIENTRYP pfn_glCreateShaderProgramvEXT) (GLenum, GLsizei, const GLchar**); -extern pfn_glCreateShaderProgramvEXT fp_glCreateShaderProgramvEXT; -typedef void (APIENTRYP pfn_glDeleteProgramPipelinesEXT) (GLsizei, const GLuint*); -extern pfn_glDeleteProgramPipelinesEXT fp_glDeleteProgramPipelinesEXT; -typedef void (APIENTRYP pfn_glGenProgramPipelinesEXT) (GLsizei, GLuint*); -extern pfn_glGenProgramPipelinesEXT fp_glGenProgramPipelinesEXT; -typedef void (APIENTRYP pfn_glGetProgramPipelineInfoLogEXT) (GLuint, GLsizei, GLsizei*, GLchar*); -extern pfn_glGetProgramPipelineInfoLogEXT fp_glGetProgramPipelineInfoLogEXT; -typedef void (APIENTRYP pfn_glGetProgramPipelineivEXT) (GLuint, GLenum, GLint*); -extern pfn_glGetProgramPipelineivEXT fp_glGetProgramPipelineivEXT; -typedef GLboolean (APIENTRYP pfn_glIsProgramPipelineEXT) (GLuint); -extern pfn_glIsProgramPipelineEXT fp_glIsProgramPipelineEXT; -typedef void (APIENTRYP pfn_glUseProgramStagesEXT) (GLuint, GLbitfield, GLuint); -extern pfn_glUseProgramStagesEXT fp_glUseProgramStagesEXT; -typedef void (APIENTRYP pfn_glValidateProgramPipelineEXT) (GLuint); -extern pfn_glValidateProgramPipelineEXT fp_glValidateProgramPipelineEXT; - - /* GL_EXT_shader_framebuffer_fetch */ -extern GLboolean GLAD_EXT_shader_framebuffer_fetch; -#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52 - - /* GL_EXT_shader_image_load_formatted */ -extern GLboolean GLAD_EXT_shader_image_load_formatted; - - /* GL_EXT_shader_image_load_store */ -extern GLboolean GLAD_EXT_shader_image_load_store; -#define GL_MAX_IMAGE_UNITS_EXT 0x8F38 -#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS_EXT 0x8F39 -#define GL_IMAGE_BINDING_NAME_EXT 0x8F3A -#define GL_IMAGE_BINDING_LEVEL_EXT 0x8F3B -#define GL_IMAGE_BINDING_LAYERED_EXT 0x8F3C -#define GL_IMAGE_BINDING_LAYER_EXT 0x8F3D -#define GL_IMAGE_BINDING_ACCESS_EXT 0x8F3E -#define GL_IMAGE_1D_EXT 0x904C -#define GL_IMAGE_2D_EXT 0x904D -#define GL_IMAGE_3D_EXT 0x904E -#define GL_IMAGE_2D_RECT_EXT 0x904F -#define GL_IMAGE_CUBE_EXT 0x9050 -#define GL_IMAGE_BUFFER_EXT 0x9051 -#define GL_IMAGE_1D_ARRAY_EXT 0x9052 -#define GL_IMAGE_2D_ARRAY_EXT 0x9053 -#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054 -#define GL_IMAGE_2D_MULTISAMPLE_EXT 0x9055 -#define GL_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9056 -#define GL_INT_IMAGE_1D_EXT 0x9057 -#define GL_INT_IMAGE_2D_EXT 0x9058 -#define GL_INT_IMAGE_3D_EXT 0x9059 -#define GL_INT_IMAGE_2D_RECT_EXT 0x905A -#define GL_INT_IMAGE_CUBE_EXT 0x905B -#define GL_INT_IMAGE_BUFFER_EXT 0x905C -#define GL_INT_IMAGE_1D_ARRAY_EXT 0x905D -#define GL_INT_IMAGE_2D_ARRAY_EXT 0x905E -#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F -#define GL_INT_IMAGE_2D_MULTISAMPLE_EXT 0x9060 -#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9061 -#define GL_UNSIGNED_INT_IMAGE_1D_EXT 0x9062 -#define GL_UNSIGNED_INT_IMAGE_2D_EXT 0x9063 -#define GL_UNSIGNED_INT_IMAGE_3D_EXT 0x9064 -#define GL_UNSIGNED_INT_IMAGE_2D_RECT_EXT 0x9065 -#define GL_UNSIGNED_INT_IMAGE_CUBE_EXT 0x9066 -#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067 -#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY_EXT 0x9068 -#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT 0x9069 -#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A -#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_EXT 0x906B -#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x906C -#define GL_MAX_IMAGE_SAMPLES_EXT 0x906D -#define GL_IMAGE_BINDING_FORMAT_EXT 0x906E -#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT 0x00000001 -#define GL_ELEMENT_ARRAY_BARRIER_BIT_EXT 0x00000002 -#define GL_UNIFORM_BARRIER_BIT_EXT 0x00000004 -#define GL_TEXTURE_FETCH_BARRIER_BIT_EXT 0x00000008 -#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT 0x00000020 -#define GL_COMMAND_BARRIER_BIT_EXT 0x00000040 -#define GL_PIXEL_BUFFER_BARRIER_BIT_EXT 0x00000080 -#define GL_TEXTURE_UPDATE_BARRIER_BIT_EXT 0x00000100 -#define GL_BUFFER_UPDATE_BARRIER_BIT_EXT 0x00000200 -#define GL_FRAMEBUFFER_BARRIER_BIT_EXT 0x00000400 -#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT 0x00000800 -#define GL_ATOMIC_COUNTER_BARRIER_BIT_EXT 0x00001000 -#define GL_ALL_BARRIER_BITS_EXT 0xFFFFFFFF -typedef void (APIENTRYP pfn_glBindImageTextureEXT) (GLuint, GLuint, GLint, GLboolean, GLint, GLenum, GLint); -extern pfn_glBindImageTextureEXT fp_glBindImageTextureEXT; -typedef void (APIENTRYP pfn_glMemoryBarrierEXT) (GLbitfield); -extern pfn_glMemoryBarrierEXT fp_glMemoryBarrierEXT; - - /* GL_EXT_shader_implicit_conversions */ -extern GLboolean GLAD_EXT_shader_implicit_conversions; - - /* GL_EXT_shader_integer_mix */ -extern GLboolean GLAD_EXT_shader_integer_mix; - - /* GL_EXT_shader_io_blocks */ -extern GLboolean GLAD_EXT_shader_io_blocks; - - /* GL_EXT_shader_pixel_local_storage */ -extern GLboolean GLAD_EXT_shader_pixel_local_storage; -#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT 0x8F63 -#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_SIZE_EXT 0x8F67 -#define GL_SHADER_PIXEL_LOCAL_STORAGE_EXT 0x8F64 - - /* GL_EXT_shader_texture_lod */ -extern GLboolean GLAD_EXT_shader_texture_lod; - - /* GL_EXT_shadow_samplers */ -extern GLboolean GLAD_EXT_shadow_samplers; -#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C -#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D -#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E -#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62 - - /* GL_EXT_sparse_texture */ -extern GLboolean GLAD_EXT_sparse_texture; -#define GL_TEXTURE_SPARSE_EXT 0x91A6 -#define GL_VIRTUAL_PAGE_SIZE_INDEX_EXT 0x91A7 -#define GL_NUM_SPARSE_LEVELS_EXT 0x91AA -#define GL_NUM_VIRTUAL_PAGE_SIZES_EXT 0x91A8 -#define GL_VIRTUAL_PAGE_SIZE_X_EXT 0x9195 -#define GL_VIRTUAL_PAGE_SIZE_Y_EXT 0x9196 -#define GL_VIRTUAL_PAGE_SIZE_Z_EXT 0x9197 -#define GL_TEXTURE_CUBE_MAP_ARRAY_OES 0x9009 -#define GL_MAX_SPARSE_TEXTURE_SIZE_EXT 0x9198 -#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_EXT 0x9199 -#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_EXT 0x919A -#define GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_EXT 0x91A9 -typedef void (APIENTRYP pfn_glTexPageCommitmentEXT) (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLboolean); -extern pfn_glTexPageCommitmentEXT fp_glTexPageCommitmentEXT; - - /* GL_EXT_sparse_texture2 */ -extern GLboolean GLAD_EXT_sparse_texture2; - - /* GL_EXT_sRGB */ -extern GLboolean GLAD_EXT_sRGB; -#define GL_SRGB_EXT 0x8C40 -#define GL_SRGB_ALPHA_EXT 0x8C42 -#define GL_SRGB8_ALPHA8_EXT 0x8C43 -#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210 - - /* GL_EXT_sRGB_write_control */ -extern GLboolean GLAD_EXT_sRGB_write_control; - - /* GL_EXT_stencil_clear_tag */ -extern GLboolean GLAD_EXT_stencil_clear_tag; -#define GL_STENCIL_TAG_BITS_EXT 0x88F2 -#define GL_STENCIL_CLEAR_TAG_VALUE_EXT 0x88F3 -typedef void (APIENTRYP pfn_glStencilClearTagEXT) (GLsizei, GLuint); -extern pfn_glStencilClearTagEXT fp_glStencilClearTagEXT; - - /* GL_EXT_tessellation_point_size */ -extern GLboolean GLAD_EXT_tessellation_point_size; - - /* GL_EXT_tessellation_shader */ -extern GLboolean GLAD_EXT_tessellation_shader; -#define GL_PATCHES_EXT 0x000E -#define GL_PATCH_VERTICES_EXT 0x8E72 -#define GL_TESS_CONTROL_OUTPUT_VERTICES_EXT 0x8E75 -#define GL_TESS_GEN_MODE_EXT 0x8E76 -#define GL_TESS_GEN_SPACING_EXT 0x8E77 -#define GL_TESS_GEN_VERTEX_ORDER_EXT 0x8E78 -#define GL_TESS_GEN_POINT_MODE_EXT 0x8E79 -#define GL_ISOLINES_EXT 0x8E7A -#define GL_QUADS_EXT 0x0007 -#define GL_FRACTIONAL_ODD_EXT 0x8E7B -#define GL_FRACTIONAL_EVEN_EXT 0x8E7C -#define GL_MAX_PATCH_VERTICES_EXT 0x8E7D -#define GL_MAX_TESS_GEN_LEVEL_EXT 0x8E7E -#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E7F -#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E80 -#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_EXT 0x8E81 -#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_EXT 0x8E82 -#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_EXT 0x8E83 -#define GL_MAX_TESS_PATCH_COMPONENTS_EXT 0x8E84 -#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_EXT 0x8E85 -#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_EXT 0x8E86 -#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_EXT 0x8E89 -#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_EXT 0x8E8A -#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_EXT 0x886C -#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_EXT 0x886D -#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E1E -#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E1F -#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_EXT 0x92CD -#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_EXT 0x92CE -#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_EXT 0x92D3 -#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_EXT 0x92D4 -#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_EXT 0x90CB -#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_EXT 0x90CC -#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_EXT 0x90D8 -#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_EXT 0x90D9 -#define GL_IS_PER_PATCH_EXT 0x92E7 -#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_EXT 0x9307 -#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_EXT 0x9308 -#define GL_TESS_CONTROL_SHADER_EXT 0x8E88 -#define GL_TESS_EVALUATION_SHADER_EXT 0x8E87 -#define GL_TESS_CONTROL_SHADER_BIT_EXT 0x00000008 -#define GL_TESS_EVALUATION_SHADER_BIT_EXT 0x00000010 -typedef void (APIENTRYP pfn_glPatchParameteriEXT) (GLenum, GLint); -extern pfn_glPatchParameteriEXT fp_glPatchParameteriEXT; - - /* GL_EXT_texture_array */ -extern GLboolean GLAD_EXT_texture_array; -#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18 -#define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19 -#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A -#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B -#define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C -#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D -#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF -#define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E -typedef void (APIENTRYP pfn_glFramebufferTextureLayerEXT) (GLenum, GLenum, GLuint, GLint, GLint); -extern pfn_glFramebufferTextureLayerEXT fp_glFramebufferTextureLayerEXT; - - /* GL_EXT_texture_border_clamp */ -extern GLboolean GLAD_EXT_texture_border_clamp; -#define GL_TEXTURE_BORDER_COLOR_EXT 0x1004 -#define GL_CLAMP_TO_BORDER_EXT 0x812D -typedef void (APIENTRYP pfn_glTexParameterIivEXT) (GLenum, GLenum, const GLint*); -extern pfn_glTexParameterIivEXT fp_glTexParameterIivEXT; -typedef void (APIENTRYP pfn_glTexParameterIuivEXT) (GLenum, GLenum, const GLuint*); -extern pfn_glTexParameterIuivEXT fp_glTexParameterIuivEXT; -typedef void (APIENTRYP pfn_glGetTexParameterIivEXT) (GLenum, GLenum, GLint*); -extern pfn_glGetTexParameterIivEXT fp_glGetTexParameterIivEXT; -typedef void (APIENTRYP pfn_glGetTexParameterIuivEXT) (GLenum, GLenum, GLuint*); -extern pfn_glGetTexParameterIuivEXT fp_glGetTexParameterIuivEXT; -typedef void (APIENTRYP pfn_glSamplerParameterIivEXT) (GLuint, GLenum, const GLint*); -extern pfn_glSamplerParameterIivEXT fp_glSamplerParameterIivEXT; -typedef void (APIENTRYP pfn_glSamplerParameterIuivEXT) (GLuint, GLenum, const GLuint*); -extern pfn_glSamplerParameterIuivEXT fp_glSamplerParameterIuivEXT; -typedef void (APIENTRYP pfn_glGetSamplerParameterIivEXT) (GLuint, GLenum, GLint*); -extern pfn_glGetSamplerParameterIivEXT fp_glGetSamplerParameterIivEXT; -typedef void (APIENTRYP pfn_glGetSamplerParameterIuivEXT) (GLuint, GLenum, GLuint*); -extern pfn_glGetSamplerParameterIuivEXT fp_glGetSamplerParameterIuivEXT; - - /* GL_EXT_texture_buffer */ -extern GLboolean GLAD_EXT_texture_buffer; -#define GL_TEXTURE_BUFFER_EXT 0x8C2A -#define GL_TEXTURE_BUFFER_BINDING_EXT 0x8C2A -#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B -#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C -#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D -#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_EXT 0x919F -#define GL_TEXTURE_BUFFER_OFFSET_EXT 0x919D -#define GL_TEXTURE_BUFFER_SIZE_EXT 0x919E -typedef void (APIENTRYP pfn_glTexBufferEXT) (GLenum, GLenum, GLuint); -extern pfn_glTexBufferEXT fp_glTexBufferEXT; -typedef void (APIENTRYP pfn_glTexBufferRangeEXT) (GLenum, GLenum, GLuint, GLintptr, GLsizeiptr); -extern pfn_glTexBufferRangeEXT fp_glTexBufferRangeEXT; - - /* GL_EXT_texture_buffer_object */ -extern GLboolean GLAD_EXT_texture_buffer_object; -#define GL_TEXTURE_BUFFER_FORMAT_EXT 0x8C2E - - /* GL_EXT_texture_compression_dxt1 */ -extern GLboolean GLAD_EXT_texture_compression_dxt1; -#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 -#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 - - /* GL_EXT_texture_compression_latc */ -extern GLboolean GLAD_EXT_texture_compression_latc; -#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70 -#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71 -#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72 -#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73 - - /* GL_EXT_texture_compression_rgtc */ -extern GLboolean GLAD_EXT_texture_compression_rgtc; -#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB -#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC -#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD -#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE - - /* GL_EXT_texture_compression_s3tc */ -extern GLboolean GLAD_EXT_texture_compression_s3tc; -#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 -#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 - - /* GL_EXT_texture_cube_map */ -extern GLboolean GLAD_EXT_texture_cube_map; -#define GL_NORMAL_MAP_EXT 0x8511 -#define GL_REFLECTION_MAP_EXT 0x8512 -#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A -#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C - - /* GL_EXT_texture_cube_map_array */ -extern GLboolean GLAD_EXT_texture_cube_map_array; -#define GL_TEXTURE_CUBE_MAP_ARRAY_EXT 0x9009 -#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_EXT 0x900A -#define GL_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900C -#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_EXT 0x900D -#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900E -#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900F - - /* GL_EXT_texture_filter_anisotropic */ -extern GLboolean GLAD_EXT_texture_filter_anisotropic; -#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE -#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF - - /* GL_EXT_texture_filter_minmax */ -extern GLboolean GLAD_EXT_texture_filter_minmax; - - /* GL_EXT_texture_format_BGRA8888 */ -extern GLboolean GLAD_EXT_texture_format_BGRA8888; - - /* GL_EXT_texture_integer */ -extern GLboolean GLAD_EXT_texture_integer; -#define GL_RGBA32UI_EXT 0x8D70 -#define GL_RGB32UI_EXT 0x8D71 -#define GL_ALPHA32UI_EXT 0x8D72 -#define GL_INTENSITY32UI_EXT 0x8D73 -#define GL_LUMINANCE32UI_EXT 0x8D74 -#define GL_LUMINANCE_ALPHA32UI_EXT 0x8D75 -#define GL_RGBA16UI_EXT 0x8D76 -#define GL_RGB16UI_EXT 0x8D77 -#define GL_ALPHA16UI_EXT 0x8D78 -#define GL_INTENSITY16UI_EXT 0x8D79 -#define GL_LUMINANCE16UI_EXT 0x8D7A -#define GL_LUMINANCE_ALPHA16UI_EXT 0x8D7B -#define GL_RGBA8UI_EXT 0x8D7C -#define GL_RGB8UI_EXT 0x8D7D -#define GL_ALPHA8UI_EXT 0x8D7E -#define GL_INTENSITY8UI_EXT 0x8D7F -#define GL_LUMINANCE8UI_EXT 0x8D80 -#define GL_LUMINANCE_ALPHA8UI_EXT 0x8D81 -#define GL_RGBA32I_EXT 0x8D82 -#define GL_RGB32I_EXT 0x8D83 -#define GL_ALPHA32I_EXT 0x8D84 -#define GL_INTENSITY32I_EXT 0x8D85 -#define GL_LUMINANCE32I_EXT 0x8D86 -#define GL_LUMINANCE_ALPHA32I_EXT 0x8D87 -#define GL_RGBA16I_EXT 0x8D88 -#define GL_RGB16I_EXT 0x8D89 -#define GL_ALPHA16I_EXT 0x8D8A -#define GL_INTENSITY16I_EXT 0x8D8B -#define GL_LUMINANCE16I_EXT 0x8D8C -#define GL_LUMINANCE_ALPHA16I_EXT 0x8D8D -#define GL_RGBA8I_EXT 0x8D8E -#define GL_RGB8I_EXT 0x8D8F -#define GL_ALPHA8I_EXT 0x8D90 -#define GL_INTENSITY8I_EXT 0x8D91 -#define GL_LUMINANCE8I_EXT 0x8D92 -#define GL_LUMINANCE_ALPHA8I_EXT 0x8D93 -#define GL_RED_INTEGER_EXT 0x8D94 -#define GL_GREEN_INTEGER_EXT 0x8D95 -#define GL_BLUE_INTEGER_EXT 0x8D96 -#define GL_ALPHA_INTEGER_EXT 0x8D97 -#define GL_RGB_INTEGER_EXT 0x8D98 -#define GL_RGBA_INTEGER_EXT 0x8D99 -#define GL_BGR_INTEGER_EXT 0x8D9A -#define GL_BGRA_INTEGER_EXT 0x8D9B -#define GL_LUMINANCE_INTEGER_EXT 0x8D9C -#define GL_LUMINANCE_ALPHA_INTEGER_EXT 0x8D9D -#define GL_RGBA_INTEGER_MODE_EXT 0x8D9E -typedef void (APIENTRYP pfn_glClearColorIiEXT) (GLint, GLint, GLint, GLint); -extern pfn_glClearColorIiEXT fp_glClearColorIiEXT; -typedef void (APIENTRYP pfn_glClearColorIuiEXT) (GLuint, GLuint, GLuint, GLuint); -extern pfn_glClearColorIuiEXT fp_glClearColorIuiEXT; - - /* GL_EXT_texture_norm16 */ -extern GLboolean GLAD_EXT_texture_norm16; -#define GL_R16_EXT 0x822A -#define GL_RG16_EXT 0x822C -#define GL_RGBA16_EXT 0x805B -#define GL_RGB16_EXT 0x8054 -#define GL_RGB16_SNORM_EXT 0x8F9A - - /* GL_EXT_texture_rg */ -extern GLboolean GLAD_EXT_texture_rg; -#define GL_RED_EXT 0x1903 -#define GL_RG_EXT 0x8227 -#define GL_R8_EXT 0x8229 -#define GL_RG8_EXT 0x822B - - /* GL_EXT_texture_shared_exponent */ -extern GLboolean GLAD_EXT_texture_shared_exponent; -#define GL_RGB9_E5_EXT 0x8C3D -#define GL_UNSIGNED_INT_5_9_9_9_REV_EXT 0x8C3E -#define GL_TEXTURE_SHARED_SIZE_EXT 0x8C3F - - /* GL_EXT_texture_snorm */ -extern GLboolean GLAD_EXT_texture_snorm; -#define GL_ALPHA_SNORM 0x9010 -#define GL_LUMINANCE_SNORM 0x9011 -#define GL_LUMINANCE_ALPHA_SNORM 0x9012 -#define GL_INTENSITY_SNORM 0x9013 -#define GL_ALPHA8_SNORM 0x9014 -#define GL_LUMINANCE8_SNORM 0x9015 -#define GL_LUMINANCE8_ALPHA8_SNORM 0x9016 -#define GL_INTENSITY8_SNORM 0x9017 -#define GL_ALPHA16_SNORM 0x9018 -#define GL_LUMINANCE16_SNORM 0x9019 -#define GL_LUMINANCE16_ALPHA16_SNORM 0x901A -#define GL_INTENSITY16_SNORM 0x901B -#define GL_RED_SNORM 0x8F90 -#define GL_RG_SNORM 0x8F91 -#define GL_RGB_SNORM 0x8F92 -#define GL_RGBA_SNORM 0x8F93 - - /* GL_EXT_texture_sRGB */ -extern GLboolean GLAD_EXT_texture_sRGB; -#define GL_SRGB8_EXT 0x8C41 -#define GL_SLUMINANCE_ALPHA_EXT 0x8C44 -#define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45 -#define GL_SLUMINANCE_EXT 0x8C46 -#define GL_SLUMINANCE8_EXT 0x8C47 -#define GL_COMPRESSED_SRGB_EXT 0x8C48 -#define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49 -#define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A -#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B -#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F - - /* GL_EXT_texture_sRGB_decode */ -extern GLboolean GLAD_EXT_texture_sRGB_decode; -#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48 -#define GL_DECODE_EXT 0x8A49 -#define GL_SKIP_DECODE_EXT 0x8A4A - - /* GL_EXT_texture_sRGB_R8 */ -extern GLboolean GLAD_EXT_texture_sRGB_R8; -#define GL_SR8_EXT 0x8FBD - - /* GL_EXT_texture_sRGB_RG8 */ -extern GLboolean GLAD_EXT_texture_sRGB_RG8; -#define GL_SRG8_EXT 0x8FBE - - /* GL_EXT_texture_storage */ -extern GLboolean GLAD_EXT_texture_storage; -#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F -#define GL_ALPHA8_EXT 0x803C -#define GL_LUMINANCE8_EXT 0x8040 -#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 -#define GL_RGBA32F_EXT 0x8814 -#define GL_RGB32F_EXT 0x8815 -#define GL_ALPHA32F_EXT 0x8816 -#define GL_LUMINANCE32F_EXT 0x8818 -#define GL_LUMINANCE_ALPHA32F_EXT 0x8819 -#define GL_ALPHA16F_EXT 0x881C -#define GL_LUMINANCE16F_EXT 0x881E -#define GL_LUMINANCE_ALPHA16F_EXT 0x881F -#define GL_RGB10_A2_EXT 0x8059 -#define GL_RGB10_EXT 0x8052 -#define GL_BGRA8_EXT 0x93A1 -#define GL_R32F_EXT 0x822E -#define GL_RG32F_EXT 0x8230 -typedef void (APIENTRYP pfn_glTexStorage1DEXT) (GLenum, GLsizei, GLenum, GLsizei); -extern pfn_glTexStorage1DEXT fp_glTexStorage1DEXT; -typedef void (APIENTRYP pfn_glTexStorage2DEXT) (GLenum, GLsizei, GLenum, GLsizei, GLsizei); -extern pfn_glTexStorage2DEXT fp_glTexStorage2DEXT; -typedef void (APIENTRYP pfn_glTexStorage3DEXT) (GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei); -extern pfn_glTexStorage3DEXT fp_glTexStorage3DEXT; - - /* GL_EXT_texture_swizzle */ -extern GLboolean GLAD_EXT_texture_swizzle; -#define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42 -#define GL_TEXTURE_SWIZZLE_G_EXT 0x8E43 -#define GL_TEXTURE_SWIZZLE_B_EXT 0x8E44 -#define GL_TEXTURE_SWIZZLE_A_EXT 0x8E45 -#define GL_TEXTURE_SWIZZLE_RGBA_EXT 0x8E46 - - /* GL_EXT_texture_type_2_10_10_10_REV */ -extern GLboolean GLAD_EXT_texture_type_2_10_10_10_REV; -#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368 - - /* GL_EXT_texture_view */ -extern GLboolean GLAD_EXT_texture_view; -#define GL_TEXTURE_VIEW_MIN_LEVEL_EXT 0x82DB -#define GL_TEXTURE_VIEW_NUM_LEVELS_EXT 0x82DC -#define GL_TEXTURE_VIEW_MIN_LAYER_EXT 0x82DD -#define GL_TEXTURE_VIEW_NUM_LAYERS_EXT 0x82DE -typedef void (APIENTRYP pfn_glTextureViewEXT) (GLuint, GLenum, GLuint, GLenum, GLuint, GLuint, GLuint, GLuint); -extern pfn_glTextureViewEXT fp_glTextureViewEXT; - - /* GL_EXT_timer_query */ -extern GLboolean GLAD_EXT_timer_query; - - /* GL_EXT_transform_feedback */ -extern GLboolean GLAD_EXT_transform_feedback; -#define GL_TRANSFORM_FEEDBACK_BUFFER_EXT 0x8C8E -#define GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT 0x8C84 -#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT 0x8C85 -#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT 0x8C8F -#define GL_INTERLEAVED_ATTRIBS_EXT 0x8C8C -#define GL_SEPARATE_ATTRIBS_EXT 0x8C8D -#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT 0x8C88 -#define GL_RASTERIZER_DISCARD_EXT 0x8C89 -#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT 0x8C8A -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT 0x8C8B -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT 0x8C80 -#define GL_TRANSFORM_FEEDBACK_VARYINGS_EXT 0x8C83 -#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT 0x8C7F -#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT 0x8C76 -typedef void (APIENTRYP pfn_glBeginTransformFeedbackEXT) (GLenum); -extern pfn_glBeginTransformFeedbackEXT fp_glBeginTransformFeedbackEXT; -typedef void (APIENTRYP pfn_glEndTransformFeedbackEXT) (); -extern pfn_glEndTransformFeedbackEXT fp_glEndTransformFeedbackEXT; -typedef void (APIENTRYP pfn_glBindBufferRangeEXT) (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr); -extern pfn_glBindBufferRangeEXT fp_glBindBufferRangeEXT; -typedef void (APIENTRYP pfn_glBindBufferOffsetEXT) (GLenum, GLuint, GLuint, GLintptr); -extern pfn_glBindBufferOffsetEXT fp_glBindBufferOffsetEXT; -typedef void (APIENTRYP pfn_glBindBufferBaseEXT) (GLenum, GLuint, GLuint); -extern pfn_glBindBufferBaseEXT fp_glBindBufferBaseEXT; -typedef void (APIENTRYP pfn_glTransformFeedbackVaryingsEXT) (GLuint, GLsizei, const GLchar**, GLenum); -extern pfn_glTransformFeedbackVaryingsEXT fp_glTransformFeedbackVaryingsEXT; -typedef void (APIENTRYP pfn_glGetTransformFeedbackVaryingEXT) (GLuint, GLuint, GLsizei, GLsizei*, GLsizei*, GLenum*, GLchar*); -extern pfn_glGetTransformFeedbackVaryingEXT fp_glGetTransformFeedbackVaryingEXT; - - /* GL_EXT_unpack_subimage */ -extern GLboolean GLAD_EXT_unpack_subimage; -#define GL_UNPACK_ROW_LENGTH_EXT 0x0CF2 -#define GL_UNPACK_SKIP_ROWS_EXT 0x0CF3 -#define GL_UNPACK_SKIP_PIXELS_EXT 0x0CF4 - - /* GL_EXT_vertex_array_bgra */ -extern GLboolean GLAD_EXT_vertex_array_bgra; - - /* GL_EXT_vertex_attrib_64bit */ -extern GLboolean GLAD_EXT_vertex_attrib_64bit; -#define GL_DOUBLE_VEC2_EXT 0x8FFC -#define GL_DOUBLE_VEC3_EXT 0x8FFD -#define GL_DOUBLE_VEC4_EXT 0x8FFE -#define GL_DOUBLE_MAT2_EXT 0x8F46 -#define GL_DOUBLE_MAT3_EXT 0x8F47 -#define GL_DOUBLE_MAT4_EXT 0x8F48 -#define GL_DOUBLE_MAT2x3_EXT 0x8F49 -#define GL_DOUBLE_MAT2x4_EXT 0x8F4A -#define GL_DOUBLE_MAT3x2_EXT 0x8F4B -#define GL_DOUBLE_MAT3x4_EXT 0x8F4C -#define GL_DOUBLE_MAT4x2_EXT 0x8F4D -#define GL_DOUBLE_MAT4x3_EXT 0x8F4E -typedef void (APIENTRYP pfn_glVertexAttribL1dEXT) (GLuint, GLdouble); -extern pfn_glVertexAttribL1dEXT fp_glVertexAttribL1dEXT; -typedef void (APIENTRYP pfn_glVertexAttribL2dEXT) (GLuint, GLdouble, GLdouble); -extern pfn_glVertexAttribL2dEXT fp_glVertexAttribL2dEXT; -typedef void (APIENTRYP pfn_glVertexAttribL3dEXT) (GLuint, GLdouble, GLdouble, GLdouble); -extern pfn_glVertexAttribL3dEXT fp_glVertexAttribL3dEXT; -typedef void (APIENTRYP pfn_glVertexAttribL4dEXT) (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -extern pfn_glVertexAttribL4dEXT fp_glVertexAttribL4dEXT; -typedef void (APIENTRYP pfn_glVertexAttribL1dvEXT) (GLuint, const GLdouble*); -extern pfn_glVertexAttribL1dvEXT fp_glVertexAttribL1dvEXT; -typedef void (APIENTRYP pfn_glVertexAttribL2dvEXT) (GLuint, const GLdouble*); -extern pfn_glVertexAttribL2dvEXT fp_glVertexAttribL2dvEXT; -typedef void (APIENTRYP pfn_glVertexAttribL3dvEXT) (GLuint, const GLdouble*); -extern pfn_glVertexAttribL3dvEXT fp_glVertexAttribL3dvEXT; -typedef void (APIENTRYP pfn_glVertexAttribL4dvEXT) (GLuint, const GLdouble*); -extern pfn_glVertexAttribL4dvEXT fp_glVertexAttribL4dvEXT; -typedef void (APIENTRYP pfn_glVertexAttribLPointerEXT) (GLuint, GLint, GLenum, GLsizei, const void*); -extern pfn_glVertexAttribLPointerEXT fp_glVertexAttribLPointerEXT; -typedef void (APIENTRYP pfn_glGetVertexAttribLdvEXT) (GLuint, GLenum, GLdouble*); -extern pfn_glGetVertexAttribLdvEXT fp_glGetVertexAttribLdvEXT; - - /* GL_EXT_x11_sync_object */ -extern GLboolean GLAD_EXT_x11_sync_object; -#define GL_SYNC_X11_FENCE_EXT 0x90E1 -typedef GLsync (APIENTRYP pfn_glImportSyncEXT) (GLenum, GLintptr, GLbitfield); -extern pfn_glImportSyncEXT fp_glImportSyncEXT; - - /* GL_EXT_YUV_target */ -extern GLboolean GLAD_EXT_YUV_target; -#define GL_SAMPLER_EXTERNAL_2D_Y2Y_EXT 0x8BE7 -#define GL_TEXTURE_EXTERNAL_OES 0x8D65 -#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67 -#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68 - - /* GL_OES_compressed_ETC1_RGB8_sub_texture */ -extern GLboolean GLAD_OES_compressed_ETC1_RGB8_sub_texture; - - /* GL_OES_compressed_ETC1_RGB8_texture */ -extern GLboolean GLAD_OES_compressed_ETC1_RGB8_texture; -#define GL_ETC1_RGB8_OES 0x8D64 - - /* GL_OES_copy_image */ -extern GLboolean GLAD_OES_copy_image; -typedef void (APIENTRYP pfn_glCopyImageSubDataOES) (GLuint, GLenum, GLint, GLint, GLint, GLint, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei); -extern pfn_glCopyImageSubDataOES fp_glCopyImageSubDataOES; - - /* GL_OES_depth24 */ -extern GLboolean GLAD_OES_depth24; -#define GL_DEPTH_COMPONENT24_OES 0x81A6 - - /* GL_OES_depth32 */ -extern GLboolean GLAD_OES_depth32; -#define GL_DEPTH_COMPONENT32_OES 0x81A7 - - /* GL_OES_depth_texture */ -extern GLboolean GLAD_OES_depth_texture; - - /* GL_OES_draw_buffers_indexed */ -extern GLboolean GLAD_OES_draw_buffers_indexed; -typedef void (APIENTRYP pfn_glEnableiOES) (GLenum, GLuint); -extern pfn_glEnableiOES fp_glEnableiOES; -typedef void (APIENTRYP pfn_glDisableiOES) (GLenum, GLuint); -extern pfn_glDisableiOES fp_glDisableiOES; -typedef void (APIENTRYP pfn_glBlendEquationiOES) (GLuint, GLenum); -extern pfn_glBlendEquationiOES fp_glBlendEquationiOES; -typedef void (APIENTRYP pfn_glBlendEquationSeparateiOES) (GLuint, GLenum, GLenum); -extern pfn_glBlendEquationSeparateiOES fp_glBlendEquationSeparateiOES; -typedef void (APIENTRYP pfn_glBlendFunciOES) (GLuint, GLenum, GLenum); -extern pfn_glBlendFunciOES fp_glBlendFunciOES; -typedef void (APIENTRYP pfn_glBlendFuncSeparateiOES) (GLuint, GLenum, GLenum, GLenum, GLenum); -extern pfn_glBlendFuncSeparateiOES fp_glBlendFuncSeparateiOES; -typedef void (APIENTRYP pfn_glColorMaskiOES) (GLuint, GLboolean, GLboolean, GLboolean, GLboolean); -extern pfn_glColorMaskiOES fp_glColorMaskiOES; -typedef GLboolean (APIENTRYP pfn_glIsEnablediOES) (GLenum, GLuint); -extern pfn_glIsEnablediOES fp_glIsEnablediOES; - - /* GL_OES_draw_elements_base_vertex */ -extern GLboolean GLAD_OES_draw_elements_base_vertex; -typedef void (APIENTRYP pfn_glDrawElementsBaseVertexOES) (GLenum, GLsizei, GLenum, const void*, GLint); -extern pfn_glDrawElementsBaseVertexOES fp_glDrawElementsBaseVertexOES; -typedef void (APIENTRYP pfn_glDrawRangeElementsBaseVertexOES) (GLenum, GLuint, GLuint, GLsizei, GLenum, const void*, GLint); -extern pfn_glDrawRangeElementsBaseVertexOES fp_glDrawRangeElementsBaseVertexOES; -typedef void (APIENTRYP pfn_glDrawElementsInstancedBaseVertexOES) (GLenum, GLsizei, GLenum, const void*, GLsizei, GLint); -extern pfn_glDrawElementsInstancedBaseVertexOES fp_glDrawElementsInstancedBaseVertexOES; -typedef void (APIENTRYP pfn_glMultiDrawElementsBaseVertexOES) (GLenum, const GLsizei*, GLenum, const void**, GLsizei, const GLint*); -extern pfn_glMultiDrawElementsBaseVertexOES fp_glMultiDrawElementsBaseVertexOES; - - /* GL_OES_EGL_image */ -extern GLboolean GLAD_OES_EGL_image; -typedef void (APIENTRYP pfn_glEGLImageTargetTexture2DOES) (GLenum, GLeglImageOES); -extern pfn_glEGLImageTargetTexture2DOES fp_glEGLImageTargetTexture2DOES; -typedef void (APIENTRYP pfn_glEGLImageTargetRenderbufferStorageOES) (GLenum, GLeglImageOES); -extern pfn_glEGLImageTargetRenderbufferStorageOES fp_glEGLImageTargetRenderbufferStorageOES; - - /* GL_OES_EGL_image_external */ -extern GLboolean GLAD_OES_EGL_image_external; -#define GL_SAMPLER_EXTERNAL_OES 0x8D66 - - /* GL_OES_EGL_image_external_essl3 */ -extern GLboolean GLAD_OES_EGL_image_external_essl3; - - /* GL_OES_element_index_uint */ -extern GLboolean GLAD_OES_element_index_uint; - - /* GL_OES_fbo_render_mipmap */ -extern GLboolean GLAD_OES_fbo_render_mipmap; - - /* GL_OES_fragment_precision_high */ -extern GLboolean GLAD_OES_fragment_precision_high; - - /* GL_OES_geometry_point_size */ -extern GLboolean GLAD_OES_geometry_point_size; - - /* GL_OES_geometry_shader */ -extern GLboolean GLAD_OES_geometry_shader; -#define GL_GEOMETRY_SHADER_OES 0x8DD9 -#define GL_GEOMETRY_SHADER_BIT_OES 0x00000004 -#define GL_GEOMETRY_LINKED_VERTICES_OUT_OES 0x8916 -#define GL_GEOMETRY_LINKED_INPUT_TYPE_OES 0x8917 -#define GL_GEOMETRY_LINKED_OUTPUT_TYPE_OES 0x8918 -#define GL_GEOMETRY_SHADER_INVOCATIONS_OES 0x887F -#define GL_LAYER_PROVOKING_VERTEX_OES 0x825E -#define GL_LINES_ADJACENCY_OES 0x000A -#define GL_LINE_STRIP_ADJACENCY_OES 0x000B -#define GL_TRIANGLES_ADJACENCY_OES 0x000C -#define GL_TRIANGLE_STRIP_ADJACENCY_OES 0x000D -#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_OES 0x8DDF -#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS_OES 0x8A2C -#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_OES 0x8A32 -#define GL_MAX_GEOMETRY_INPUT_COMPONENTS_OES 0x9123 -#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_OES 0x9124 -#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_OES 0x8DE0 -#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_OES 0x8DE1 -#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS_OES 0x8E5A -#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_OES 0x8C29 -#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_OES 0x92CF -#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS_OES 0x92D5 -#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS_OES 0x90CD -#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_OES 0x90D7 -#define GL_FIRST_VERTEX_CONVENTION_OES 0x8E4D -#define GL_LAST_VERTEX_CONVENTION_OES 0x8E4E -#define GL_UNDEFINED_VERTEX_OES 0x8260 -#define GL_PRIMITIVES_GENERATED_OES 0x8C87 -#define GL_FRAMEBUFFER_DEFAULT_LAYERS_OES 0x9312 -#define GL_MAX_FRAMEBUFFER_LAYERS_OES 0x9317 -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_OES 0x8DA8 -#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_OES 0x8DA7 -#define GL_REFERENCED_BY_GEOMETRY_SHADER_OES 0x9309 -typedef void (APIENTRYP pfn_glFramebufferTextureOES) (GLenum, GLenum, GLuint, GLint); -extern pfn_glFramebufferTextureOES fp_glFramebufferTextureOES; - - /* GL_OES_get_program_binary */ -extern GLboolean GLAD_OES_get_program_binary; -#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 -#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE -#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF -typedef void (APIENTRYP pfn_glGetProgramBinaryOES) (GLuint, GLsizei, GLsizei*, GLenum*, void*); -extern pfn_glGetProgramBinaryOES fp_glGetProgramBinaryOES; -typedef void (APIENTRYP pfn_glProgramBinaryOES) (GLuint, GLenum, const void*, GLint); -extern pfn_glProgramBinaryOES fp_glProgramBinaryOES; - - /* GL_OES_gpu_shader5 */ -extern GLboolean GLAD_OES_gpu_shader5; - - /* GL_OES_mapbuffer */ -extern GLboolean GLAD_OES_mapbuffer; -#define GL_WRITE_ONLY_OES 0x88B9 -#define GL_BUFFER_ACCESS_OES 0x88BB -#define GL_BUFFER_MAPPED_OES 0x88BC -#define GL_BUFFER_MAP_POINTER_OES 0x88BD -typedef void* (APIENTRYP pfn_glMapBufferOES) (GLenum, GLenum); -extern pfn_glMapBufferOES fp_glMapBufferOES; -typedef GLboolean (APIENTRYP pfn_glUnmapBufferOES) (GLenum); -extern pfn_glUnmapBufferOES fp_glUnmapBufferOES; -typedef void (APIENTRYP pfn_glGetBufferPointervOES) (GLenum, GLenum, void**); -extern pfn_glGetBufferPointervOES fp_glGetBufferPointervOES; - - /* GL_OES_packed_depth_stencil */ -extern GLboolean GLAD_OES_packed_depth_stencil; -#define GL_DEPTH_STENCIL_OES 0x84F9 -#define GL_UNSIGNED_INT_24_8_OES 0x84FA -#define GL_DEPTH24_STENCIL8_OES 0x88F0 - - /* GL_OES_primitive_bounding_box */ -extern GLboolean GLAD_OES_primitive_bounding_box; -#define GL_PRIMITIVE_BOUNDING_BOX_OES 0x92BE -typedef void (APIENTRYP pfn_glPrimitiveBoundingBoxOES) (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -extern pfn_glPrimitiveBoundingBoxOES fp_glPrimitiveBoundingBoxOES; - - /* GL_OES_required_internalformat */ -extern GLboolean GLAD_OES_required_internalformat; -#define GL_ALPHA8_OES 0x803C -#define GL_DEPTH_COMPONENT16_OES 0x81A5 -#define GL_LUMINANCE4_ALPHA4_OES 0x8043 -#define GL_LUMINANCE8_ALPHA8_OES 0x8045 -#define GL_LUMINANCE8_OES 0x8040 -#define GL_RGBA4_OES 0x8056 -#define GL_RGB5_A1_OES 0x8057 -#define GL_RGB565_OES 0x8D62 -#define GL_RGB8_OES 0x8051 -#define GL_RGBA8_OES 0x8058 - - /* GL_OES_rgb8_rgba8 */ -extern GLboolean GLAD_OES_rgb8_rgba8; - - /* GL_OES_sample_shading */ -extern GLboolean GLAD_OES_sample_shading; -#define GL_SAMPLE_SHADING_OES 0x8C36 -#define GL_MIN_SAMPLE_SHADING_VALUE_OES 0x8C37 -typedef void (APIENTRYP pfn_glMinSampleShadingOES) (GLfloat); -extern pfn_glMinSampleShadingOES fp_glMinSampleShadingOES; - - /* GL_OES_sample_variables */ -extern GLboolean GLAD_OES_sample_variables; - - /* GL_OES_shader_image_atomic */ -extern GLboolean GLAD_OES_shader_image_atomic; - - /* GL_OES_shader_io_blocks */ -extern GLboolean GLAD_OES_shader_io_blocks; - - /* GL_OES_shader_multisample_interpolation */ -extern GLboolean GLAD_OES_shader_multisample_interpolation; -#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5B -#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5C -#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS_OES 0x8E5D - - /* GL_OES_standard_derivatives */ -extern GLboolean GLAD_OES_standard_derivatives; -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B - - /* GL_OES_stencil1 */ -extern GLboolean GLAD_OES_stencil1; -#define GL_STENCIL_INDEX1_OES 0x8D46 - - /* GL_OES_stencil4 */ -extern GLboolean GLAD_OES_stencil4; -#define GL_STENCIL_INDEX4_OES 0x8D47 - - /* GL_OES_surfaceless_context */ -extern GLboolean GLAD_OES_surfaceless_context; -#define GL_FRAMEBUFFER_UNDEFINED_OES 0x8219 - - /* GL_OES_tessellation_point_size */ -extern GLboolean GLAD_OES_tessellation_point_size; - - /* GL_OES_tessellation_shader */ -extern GLboolean GLAD_OES_tessellation_shader; -#define GL_PATCHES_OES 0x000E -#define GL_PATCH_VERTICES_OES 0x8E72 -#define GL_TESS_CONTROL_OUTPUT_VERTICES_OES 0x8E75 -#define GL_TESS_GEN_MODE_OES 0x8E76 -#define GL_TESS_GEN_SPACING_OES 0x8E77 -#define GL_TESS_GEN_VERTEX_ORDER_OES 0x8E78 -#define GL_TESS_GEN_POINT_MODE_OES 0x8E79 -#define GL_ISOLINES_OES 0x8E7A -#define GL_QUADS_OES 0x0007 -#define GL_FRACTIONAL_ODD_OES 0x8E7B -#define GL_FRACTIONAL_EVEN_OES 0x8E7C -#define GL_MAX_PATCH_VERTICES_OES 0x8E7D -#define GL_MAX_TESS_GEN_LEVEL_OES 0x8E7E -#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_OES 0x8E7F -#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_OES 0x8E80 -#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_OES 0x8E81 -#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_OES 0x8E82 -#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_OES 0x8E83 -#define GL_MAX_TESS_PATCH_COMPONENTS_OES 0x8E84 -#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_OES 0x8E85 -#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_OES 0x8E86 -#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_OES 0x8E89 -#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_OES 0x8E8A -#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_OES 0x886C -#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_OES 0x886D -#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_OES 0x8E1E -#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_OES 0x8E1F -#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_OES 0x92CD -#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_OES 0x92CE -#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_OES 0x92D3 -#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_OES 0x92D4 -#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_OES 0x90CB -#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_OES 0x90CC -#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_OES 0x90D8 -#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_OES 0x90D9 -#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED_OES 0x8221 -#define GL_IS_PER_PATCH_OES 0x92E7 -#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_OES 0x9307 -#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_OES 0x9308 -#define GL_TESS_CONTROL_SHADER_OES 0x8E88 -#define GL_TESS_EVALUATION_SHADER_OES 0x8E87 -#define GL_TESS_CONTROL_SHADER_BIT_OES 0x00000008 -#define GL_TESS_EVALUATION_SHADER_BIT_OES 0x00000010 -typedef void (APIENTRYP pfn_glPatchParameteriOES) (GLenum, GLint); -extern pfn_glPatchParameteriOES fp_glPatchParameteriOES; - - /* GL_OES_texture_3D */ -extern GLboolean GLAD_OES_texture_3D; -#define GL_TEXTURE_WRAP_R_OES 0x8072 -#define GL_TEXTURE_3D_OES 0x806F -#define GL_TEXTURE_BINDING_3D_OES 0x806A -#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073 -#define GL_SAMPLER_3D_OES 0x8B5F -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4 -typedef void (APIENTRYP pfn_glTexImage3DOES) (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const void*); -extern pfn_glTexImage3DOES fp_glTexImage3DOES; -typedef void (APIENTRYP pfn_glTexSubImage3DOES) (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const void*); -extern pfn_glTexSubImage3DOES fp_glTexSubImage3DOES; -typedef void (APIENTRYP pfn_glCopyTexSubImage3DOES) (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); -extern pfn_glCopyTexSubImage3DOES fp_glCopyTexSubImage3DOES; -typedef void (APIENTRYP pfn_glCompressedTexImage3DOES) (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const void*); -extern pfn_glCompressedTexImage3DOES fp_glCompressedTexImage3DOES; -typedef void (APIENTRYP pfn_glCompressedTexSubImage3DOES) (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const void*); -extern pfn_glCompressedTexSubImage3DOES fp_glCompressedTexSubImage3DOES; -typedef void (APIENTRYP pfn_glFramebufferTexture3DOES) (GLenum, GLenum, GLenum, GLuint, GLint, GLint); -extern pfn_glFramebufferTexture3DOES fp_glFramebufferTexture3DOES; - - /* GL_OES_texture_border_clamp */ -extern GLboolean GLAD_OES_texture_border_clamp; -#define GL_TEXTURE_BORDER_COLOR_OES 0x1004 -#define GL_CLAMP_TO_BORDER_OES 0x812D -typedef void (APIENTRYP pfn_glTexParameterIivOES) (GLenum, GLenum, const GLint*); -extern pfn_glTexParameterIivOES fp_glTexParameterIivOES; -typedef void (APIENTRYP pfn_glTexParameterIuivOES) (GLenum, GLenum, const GLuint*); -extern pfn_glTexParameterIuivOES fp_glTexParameterIuivOES; -typedef void (APIENTRYP pfn_glGetTexParameterIivOES) (GLenum, GLenum, GLint*); -extern pfn_glGetTexParameterIivOES fp_glGetTexParameterIivOES; -typedef void (APIENTRYP pfn_glGetTexParameterIuivOES) (GLenum, GLenum, GLuint*); -extern pfn_glGetTexParameterIuivOES fp_glGetTexParameterIuivOES; -typedef void (APIENTRYP pfn_glSamplerParameterIivOES) (GLuint, GLenum, const GLint*); -extern pfn_glSamplerParameterIivOES fp_glSamplerParameterIivOES; -typedef void (APIENTRYP pfn_glSamplerParameterIuivOES) (GLuint, GLenum, const GLuint*); -extern pfn_glSamplerParameterIuivOES fp_glSamplerParameterIuivOES; -typedef void (APIENTRYP pfn_glGetSamplerParameterIivOES) (GLuint, GLenum, GLint*); -extern pfn_glGetSamplerParameterIivOES fp_glGetSamplerParameterIivOES; -typedef void (APIENTRYP pfn_glGetSamplerParameterIuivOES) (GLuint, GLenum, GLuint*); -extern pfn_glGetSamplerParameterIuivOES fp_glGetSamplerParameterIuivOES; - - /* GL_OES_texture_buffer */ -extern GLboolean GLAD_OES_texture_buffer; -#define GL_TEXTURE_BUFFER_OES 0x8C2A -#define GL_TEXTURE_BUFFER_BINDING_OES 0x8C2A -#define GL_MAX_TEXTURE_BUFFER_SIZE_OES 0x8C2B -#define GL_TEXTURE_BINDING_BUFFER_OES 0x8C2C -#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_OES 0x8C2D -#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_OES 0x919F -#define GL_SAMPLER_BUFFER_OES 0x8DC2 -#define GL_INT_SAMPLER_BUFFER_OES 0x8DD0 -#define GL_UNSIGNED_INT_SAMPLER_BUFFER_OES 0x8DD8 -#define GL_IMAGE_BUFFER_OES 0x9051 -#define GL_INT_IMAGE_BUFFER_OES 0x905C -#define GL_UNSIGNED_INT_IMAGE_BUFFER_OES 0x9067 -#define GL_TEXTURE_BUFFER_OFFSET_OES 0x919D -#define GL_TEXTURE_BUFFER_SIZE_OES 0x919E -typedef void (APIENTRYP pfn_glTexBufferOES) (GLenum, GLenum, GLuint); -extern pfn_glTexBufferOES fp_glTexBufferOES; -typedef void (APIENTRYP pfn_glTexBufferRangeOES) (GLenum, GLenum, GLuint, GLintptr, GLsizeiptr); -extern pfn_glTexBufferRangeOES fp_glTexBufferRangeOES; - - /* GL_OES_texture_compression_astc */ -extern GLboolean GLAD_OES_texture_compression_astc; -#define GL_COMPRESSED_RGBA_ASTC_3x3x3_OES 0x93C0 -#define GL_COMPRESSED_RGBA_ASTC_4x3x3_OES 0x93C1 -#define GL_COMPRESSED_RGBA_ASTC_4x4x3_OES 0x93C2 -#define GL_COMPRESSED_RGBA_ASTC_4x4x4_OES 0x93C3 -#define GL_COMPRESSED_RGBA_ASTC_5x4x4_OES 0x93C4 -#define GL_COMPRESSED_RGBA_ASTC_5x5x4_OES 0x93C5 -#define GL_COMPRESSED_RGBA_ASTC_5x5x5_OES 0x93C6 -#define GL_COMPRESSED_RGBA_ASTC_6x5x5_OES 0x93C7 -#define GL_COMPRESSED_RGBA_ASTC_6x6x5_OES 0x93C8 -#define GL_COMPRESSED_RGBA_ASTC_6x6x6_OES 0x93C9 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES 0x93E0 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES 0x93E1 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES 0x93E2 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES 0x93E3 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES 0x93E4 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES 0x93E5 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES 0x93E6 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES 0x93E7 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES 0x93E8 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES 0x93E9 - - /* GL_OES_texture_cube_map_array */ -extern GLboolean GLAD_OES_texture_cube_map_array; -#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_OES 0x900A -#define GL_SAMPLER_CUBE_MAP_ARRAY_OES 0x900C -#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_OES 0x900D -#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_OES 0x900E -#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_OES 0x900F -#define GL_IMAGE_CUBE_MAP_ARRAY_OES 0x9054 -#define GL_INT_IMAGE_CUBE_MAP_ARRAY_OES 0x905F -#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_OES 0x906A - - /* GL_OES_texture_float */ -extern GLboolean GLAD_OES_texture_float; - - /* GL_OES_texture_float_linear */ -extern GLboolean GLAD_OES_texture_float_linear; - - /* GL_OES_texture_half_float */ -extern GLboolean GLAD_OES_texture_half_float; -#define GL_HALF_FLOAT_OES 0x8D61 - - /* GL_OES_texture_half_float_linear */ -extern GLboolean GLAD_OES_texture_half_float_linear; - - /* GL_OES_texture_npot */ -extern GLboolean GLAD_OES_texture_npot; - - /* GL_OES_texture_stencil8 */ -extern GLboolean GLAD_OES_texture_stencil8; -#define GL_STENCIL_INDEX_OES 0x1901 -#define GL_STENCIL_INDEX8_OES 0x8D48 - - /* GL_OES_texture_storage_multisample_2d_array */ -extern GLboolean GLAD_OES_texture_storage_multisample_2d_array; -#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES 0x9102 -#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY_OES 0x9105 -#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910B -#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910C -#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910D -typedef void (APIENTRYP pfn_glTexStorage3DMultisampleOES) (GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean); -extern pfn_glTexStorage3DMultisampleOES fp_glTexStorage3DMultisampleOES; - - /* GL_OES_texture_view */ -extern GLboolean GLAD_OES_texture_view; -#define GL_TEXTURE_VIEW_MIN_LEVEL_OES 0x82DB -#define GL_TEXTURE_VIEW_NUM_LEVELS_OES 0x82DC -#define GL_TEXTURE_VIEW_MIN_LAYER_OES 0x82DD -#define GL_TEXTURE_VIEW_NUM_LAYERS_OES 0x82DE -typedef void (APIENTRYP pfn_glTextureViewOES) (GLuint, GLenum, GLuint, GLenum, GLuint, GLuint, GLuint, GLuint); -extern pfn_glTextureViewOES fp_glTextureViewOES; - - /* GL_OES_vertex_array_object */ -extern GLboolean GLAD_OES_vertex_array_object; -#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5 -typedef void (APIENTRYP pfn_glBindVertexArrayOES) (GLuint); -extern pfn_glBindVertexArrayOES fp_glBindVertexArrayOES; -typedef void (APIENTRYP pfn_glDeleteVertexArraysOES) (GLsizei, const GLuint*); -extern pfn_glDeleteVertexArraysOES fp_glDeleteVertexArraysOES; -typedef void (APIENTRYP pfn_glGenVertexArraysOES) (GLsizei, GLuint*); -extern pfn_glGenVertexArraysOES fp_glGenVertexArraysOES; -typedef GLboolean (APIENTRYP pfn_glIsVertexArrayOES) (GLuint); -extern pfn_glIsVertexArrayOES fp_glIsVertexArrayOES; - - /* GL_OES_vertex_half_float */ -extern GLboolean GLAD_OES_vertex_half_float; - - /* GL_OES_vertex_type_10_10_10_2 */ -extern GLboolean GLAD_OES_vertex_type_10_10_10_2; -#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6 -#define GL_INT_10_10_10_2_OES 0x8DF7 - - /* GL_AMD_blend_minmax_factor */ -extern GLboolean GLAD_AMD_blend_minmax_factor; -#define GL_FACTOR_MIN_AMD 0x901C -#define GL_FACTOR_MAX_AMD 0x901D - - /* GL_AMD_compressed_3DC_texture */ -extern GLboolean GLAD_AMD_compressed_3DC_texture; -#define GL_3DC_X_AMD 0x87F9 -#define GL_3DC_XY_AMD 0x87FA - - /* GL_AMD_compressed_ATC_texture */ -extern GLboolean GLAD_AMD_compressed_ATC_texture; -#define GL_ATC_RGB_AMD 0x8C92 -#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 -#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE - - /* GL_AMD_conservative_depth */ -extern GLboolean GLAD_AMD_conservative_depth; - - /* GL_AMD_debug_output */ -extern GLboolean GLAD_AMD_debug_output; -#define GL_MAX_DEBUG_MESSAGE_LENGTH_AMD 0x9143 -#define GL_MAX_DEBUG_LOGGED_MESSAGES_AMD 0x9144 -#define GL_DEBUG_LOGGED_MESSAGES_AMD 0x9145 -#define GL_DEBUG_SEVERITY_HIGH_AMD 0x9146 -#define GL_DEBUG_SEVERITY_MEDIUM_AMD 0x9147 -#define GL_DEBUG_SEVERITY_LOW_AMD 0x9148 -#define GL_DEBUG_CATEGORY_API_ERROR_AMD 0x9149 -#define GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD 0x914A -#define GL_DEBUG_CATEGORY_DEPRECATION_AMD 0x914B -#define GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD 0x914C -#define GL_DEBUG_CATEGORY_PERFORMANCE_AMD 0x914D -#define GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD 0x914E -#define GL_DEBUG_CATEGORY_APPLICATION_AMD 0x914F -#define GL_DEBUG_CATEGORY_OTHER_AMD 0x9150 -typedef void (APIENTRYP pfn_glDebugMessageEnableAMD) (GLenum, GLenum, GLsizei, const GLuint*, GLboolean); -extern pfn_glDebugMessageEnableAMD fp_glDebugMessageEnableAMD; -typedef void (APIENTRYP pfn_glDebugMessageInsertAMD) (GLenum, GLenum, GLuint, GLsizei, const GLchar*); -extern pfn_glDebugMessageInsertAMD fp_glDebugMessageInsertAMD; -typedef void (APIENTRYP pfn_glDebugMessageCallbackAMD) (GLDEBUGPROCAMD, void*); -extern pfn_glDebugMessageCallbackAMD fp_glDebugMessageCallbackAMD; -typedef GLuint (APIENTRYP pfn_glGetDebugMessageLogAMD) (GLuint, GLsizei, GLenum*, GLuint*, GLuint*, GLsizei*, GLchar*); -extern pfn_glGetDebugMessageLogAMD fp_glGetDebugMessageLogAMD; - - /* GL_AMD_depth_clamp_separate */ -extern GLboolean GLAD_AMD_depth_clamp_separate; -#define GL_DEPTH_CLAMP_NEAR_AMD 0x901E -#define GL_DEPTH_CLAMP_FAR_AMD 0x901F - - /* GL_AMD_draw_buffers_blend */ -extern GLboolean GLAD_AMD_draw_buffers_blend; -typedef void (APIENTRYP pfn_glBlendFuncIndexedAMD) (GLuint, GLenum, GLenum); -extern pfn_glBlendFuncIndexedAMD fp_glBlendFuncIndexedAMD; -typedef void (APIENTRYP pfn_glBlendFuncSeparateIndexedAMD) (GLuint, GLenum, GLenum, GLenum, GLenum); -extern pfn_glBlendFuncSeparateIndexedAMD fp_glBlendFuncSeparateIndexedAMD; -typedef void (APIENTRYP pfn_glBlendEquationIndexedAMD) (GLuint, GLenum); -extern pfn_glBlendEquationIndexedAMD fp_glBlendEquationIndexedAMD; -typedef void (APIENTRYP pfn_glBlendEquationSeparateIndexedAMD) (GLuint, GLenum, GLenum); -extern pfn_glBlendEquationSeparateIndexedAMD fp_glBlendEquationSeparateIndexedAMD; - - /* GL_AMD_gcn_shader */ -extern GLboolean GLAD_AMD_gcn_shader; - - /* GL_AMD_gpu_shader_int64 */ -extern GLboolean GLAD_AMD_gpu_shader_int64; -#define GL_INT64_NV 0x140E -#define GL_UNSIGNED_INT64_NV 0x140F -#define GL_INT8_NV 0x8FE0 -#define GL_INT8_VEC2_NV 0x8FE1 -#define GL_INT8_VEC3_NV 0x8FE2 -#define GL_INT8_VEC4_NV 0x8FE3 -#define GL_INT16_NV 0x8FE4 -#define GL_INT16_VEC2_NV 0x8FE5 -#define GL_INT16_VEC3_NV 0x8FE6 -#define GL_INT16_VEC4_NV 0x8FE7 -#define GL_INT64_VEC2_NV 0x8FE9 -#define GL_INT64_VEC3_NV 0x8FEA -#define GL_INT64_VEC4_NV 0x8FEB -#define GL_UNSIGNED_INT8_NV 0x8FEC -#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED -#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE -#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF -#define GL_UNSIGNED_INT16_NV 0x8FF0 -#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1 -#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2 -#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3 -#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5 -#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6 -#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7 -#define GL_FLOAT16_NV 0x8FF8 -#define GL_FLOAT16_VEC2_NV 0x8FF9 -#define GL_FLOAT16_VEC3_NV 0x8FFA -#define GL_FLOAT16_VEC4_NV 0x8FFB -typedef void (APIENTRYP pfn_glUniform1i64NV) (GLint, GLint64EXT); -extern pfn_glUniform1i64NV fp_glUniform1i64NV; -typedef void (APIENTRYP pfn_glUniform2i64NV) (GLint, GLint64EXT, GLint64EXT); -extern pfn_glUniform2i64NV fp_glUniform2i64NV; -typedef void (APIENTRYP pfn_glUniform3i64NV) (GLint, GLint64EXT, GLint64EXT, GLint64EXT); -extern pfn_glUniform3i64NV fp_glUniform3i64NV; -typedef void (APIENTRYP pfn_glUniform4i64NV) (GLint, GLint64EXT, GLint64EXT, GLint64EXT, GLint64EXT); -extern pfn_glUniform4i64NV fp_glUniform4i64NV; -typedef void (APIENTRYP pfn_glUniform1i64vNV) (GLint, GLsizei, const GLint64EXT*); -extern pfn_glUniform1i64vNV fp_glUniform1i64vNV; -typedef void (APIENTRYP pfn_glUniform2i64vNV) (GLint, GLsizei, const GLint64EXT*); -extern pfn_glUniform2i64vNV fp_glUniform2i64vNV; -typedef void (APIENTRYP pfn_glUniform3i64vNV) (GLint, GLsizei, const GLint64EXT*); -extern pfn_glUniform3i64vNV fp_glUniform3i64vNV; -typedef void (APIENTRYP pfn_glUniform4i64vNV) (GLint, GLsizei, const GLint64EXT*); -extern pfn_glUniform4i64vNV fp_glUniform4i64vNV; -typedef void (APIENTRYP pfn_glUniform1ui64NV) (GLint, GLuint64EXT); -extern pfn_glUniform1ui64NV fp_glUniform1ui64NV; -typedef void (APIENTRYP pfn_glUniform2ui64NV) (GLint, GLuint64EXT, GLuint64EXT); -extern pfn_glUniform2ui64NV fp_glUniform2ui64NV; -typedef void (APIENTRYP pfn_glUniform3ui64NV) (GLint, GLuint64EXT, GLuint64EXT, GLuint64EXT); -extern pfn_glUniform3ui64NV fp_glUniform3ui64NV; -typedef void (APIENTRYP pfn_glUniform4ui64NV) (GLint, GLuint64EXT, GLuint64EXT, GLuint64EXT, GLuint64EXT); -extern pfn_glUniform4ui64NV fp_glUniform4ui64NV; -typedef void (APIENTRYP pfn_glUniform1ui64vNV) (GLint, GLsizei, const GLuint64EXT*); -extern pfn_glUniform1ui64vNV fp_glUniform1ui64vNV; -typedef void (APIENTRYP pfn_glUniform2ui64vNV) (GLint, GLsizei, const GLuint64EXT*); -extern pfn_glUniform2ui64vNV fp_glUniform2ui64vNV; -typedef void (APIENTRYP pfn_glUniform3ui64vNV) (GLint, GLsizei, const GLuint64EXT*); -extern pfn_glUniform3ui64vNV fp_glUniform3ui64vNV; -typedef void (APIENTRYP pfn_glUniform4ui64vNV) (GLint, GLsizei, const GLuint64EXT*); -extern pfn_glUniform4ui64vNV fp_glUniform4ui64vNV; -typedef void (APIENTRYP pfn_glGetUniformi64vNV) (GLuint, GLint, GLint64EXT*); -extern pfn_glGetUniformi64vNV fp_glGetUniformi64vNV; -typedef void (APIENTRYP pfn_glGetUniformui64vNV) (GLuint, GLint, GLuint64EXT*); -extern pfn_glGetUniformui64vNV fp_glGetUniformui64vNV; -typedef void (APIENTRYP pfn_glProgramUniform1i64NV) (GLuint, GLint, GLint64EXT); -extern pfn_glProgramUniform1i64NV fp_glProgramUniform1i64NV; -typedef void (APIENTRYP pfn_glProgramUniform2i64NV) (GLuint, GLint, GLint64EXT, GLint64EXT); -extern pfn_glProgramUniform2i64NV fp_glProgramUniform2i64NV; -typedef void (APIENTRYP pfn_glProgramUniform3i64NV) (GLuint, GLint, GLint64EXT, GLint64EXT, GLint64EXT); -extern pfn_glProgramUniform3i64NV fp_glProgramUniform3i64NV; -typedef void (APIENTRYP pfn_glProgramUniform4i64NV) (GLuint, GLint, GLint64EXT, GLint64EXT, GLint64EXT, GLint64EXT); -extern pfn_glProgramUniform4i64NV fp_glProgramUniform4i64NV; -typedef void (APIENTRYP pfn_glProgramUniform1i64vNV) (GLuint, GLint, GLsizei, const GLint64EXT*); -extern pfn_glProgramUniform1i64vNV fp_glProgramUniform1i64vNV; -typedef void (APIENTRYP pfn_glProgramUniform2i64vNV) (GLuint, GLint, GLsizei, const GLint64EXT*); -extern pfn_glProgramUniform2i64vNV fp_glProgramUniform2i64vNV; -typedef void (APIENTRYP pfn_glProgramUniform3i64vNV) (GLuint, GLint, GLsizei, const GLint64EXT*); -extern pfn_glProgramUniform3i64vNV fp_glProgramUniform3i64vNV; -typedef void (APIENTRYP pfn_glProgramUniform4i64vNV) (GLuint, GLint, GLsizei, const GLint64EXT*); -extern pfn_glProgramUniform4i64vNV fp_glProgramUniform4i64vNV; -typedef void (APIENTRYP pfn_glProgramUniform1ui64NV) (GLuint, GLint, GLuint64EXT); -extern pfn_glProgramUniform1ui64NV fp_glProgramUniform1ui64NV; -typedef void (APIENTRYP pfn_glProgramUniform2ui64NV) (GLuint, GLint, GLuint64EXT, GLuint64EXT); -extern pfn_glProgramUniform2ui64NV fp_glProgramUniform2ui64NV; -typedef void (APIENTRYP pfn_glProgramUniform3ui64NV) (GLuint, GLint, GLuint64EXT, GLuint64EXT, GLuint64EXT); -extern pfn_glProgramUniform3ui64NV fp_glProgramUniform3ui64NV; -typedef void (APIENTRYP pfn_glProgramUniform4ui64NV) (GLuint, GLint, GLuint64EXT, GLuint64EXT, GLuint64EXT, GLuint64EXT); -extern pfn_glProgramUniform4ui64NV fp_glProgramUniform4ui64NV; -typedef void (APIENTRYP pfn_glProgramUniform1ui64vNV) (GLuint, GLint, GLsizei, const GLuint64EXT*); -extern pfn_glProgramUniform1ui64vNV fp_glProgramUniform1ui64vNV; -typedef void (APIENTRYP pfn_glProgramUniform2ui64vNV) (GLuint, GLint, GLsizei, const GLuint64EXT*); -extern pfn_glProgramUniform2ui64vNV fp_glProgramUniform2ui64vNV; -typedef void (APIENTRYP pfn_glProgramUniform3ui64vNV) (GLuint, GLint, GLsizei, const GLuint64EXT*); -extern pfn_glProgramUniform3ui64vNV fp_glProgramUniform3ui64vNV; -typedef void (APIENTRYP pfn_glProgramUniform4ui64vNV) (GLuint, GLint, GLsizei, const GLuint64EXT*); -extern pfn_glProgramUniform4ui64vNV fp_glProgramUniform4ui64vNV; - - /* GL_AMD_interleaved_elements */ -extern GLboolean GLAD_AMD_interleaved_elements; -#define GL_VERTEX_ELEMENT_SWIZZLE_AMD 0x91A4 -#define GL_VERTEX_ID_SWIZZLE_AMD 0x91A5 -typedef void (APIENTRYP pfn_glVertexAttribParameteriAMD) (GLuint, GLenum, GLint); -extern pfn_glVertexAttribParameteriAMD fp_glVertexAttribParameteriAMD; - - /* GL_AMD_multi_draw_indirect */ -extern GLboolean GLAD_AMD_multi_draw_indirect; -typedef void (APIENTRYP pfn_glMultiDrawArraysIndirectAMD) (GLenum, const void*, GLsizei, GLsizei); -extern pfn_glMultiDrawArraysIndirectAMD fp_glMultiDrawArraysIndirectAMD; -typedef void (APIENTRYP pfn_glMultiDrawElementsIndirectAMD) (GLenum, GLenum, const void*, GLsizei, GLsizei); -extern pfn_glMultiDrawElementsIndirectAMD fp_glMultiDrawElementsIndirectAMD; - - /* GL_AMD_name_gen_delete */ -extern GLboolean GLAD_AMD_name_gen_delete; -#define GL_DATA_BUFFER_AMD 0x9151 -#define GL_PERFORMANCE_MONITOR_AMD 0x9152 -#define GL_QUERY_OBJECT_AMD 0x9153 -#define GL_VERTEX_ARRAY_OBJECT_AMD 0x9154 -#define GL_SAMPLER_OBJECT_AMD 0x9155 -typedef void (APIENTRYP pfn_glGenNamesAMD) (GLenum, GLuint, GLuint*); -extern pfn_glGenNamesAMD fp_glGenNamesAMD; -typedef void (APIENTRYP pfn_glDeleteNamesAMD) (GLenum, GLuint, const GLuint*); -extern pfn_glDeleteNamesAMD fp_glDeleteNamesAMD; -typedef GLboolean (APIENTRYP pfn_glIsNameAMD) (GLenum, GLuint); -extern pfn_glIsNameAMD fp_glIsNameAMD; - - /* GL_AMD_occlusion_query_event */ -extern GLboolean GLAD_AMD_occlusion_query_event; -#define GL_OCCLUSION_QUERY_EVENT_MASK_AMD 0x874F -#define GL_QUERY_DEPTH_PASS_EVENT_BIT_AMD 0x00000001 -#define GL_QUERY_DEPTH_FAIL_EVENT_BIT_AMD 0x00000002 -#define GL_QUERY_STENCIL_FAIL_EVENT_BIT_AMD 0x00000004 -#define GL_QUERY_DEPTH_BOUNDS_FAIL_EVENT_BIT_AMD 0x00000008 -#define GL_QUERY_ALL_EVENT_BITS_AMD 0xFFFFFFFF -typedef void (APIENTRYP pfn_glQueryObjectParameteruiAMD) (GLenum, GLuint, GLenum, GLuint); -extern pfn_glQueryObjectParameteruiAMD fp_glQueryObjectParameteruiAMD; - - /* GL_AMD_performance_monitor */ -extern GLboolean GLAD_AMD_performance_monitor; -#define GL_COUNTER_TYPE_AMD 0x8BC0 -#define GL_COUNTER_RANGE_AMD 0x8BC1 -#define GL_UNSIGNED_INT64_AMD 0x8BC2 -#define GL_PERCENTAGE_AMD 0x8BC3 -#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 -#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 -#define GL_PERFMON_RESULT_AMD 0x8BC6 -typedef void (APIENTRYP pfn_glGetPerfMonitorGroupsAMD) (GLint*, GLsizei, GLuint*); -extern pfn_glGetPerfMonitorGroupsAMD fp_glGetPerfMonitorGroupsAMD; -typedef void (APIENTRYP pfn_glGetPerfMonitorCountersAMD) (GLuint, GLint*, GLint*, GLsizei, GLuint*); -extern pfn_glGetPerfMonitorCountersAMD fp_glGetPerfMonitorCountersAMD; -typedef void (APIENTRYP pfn_glGetPerfMonitorGroupStringAMD) (GLuint, GLsizei, GLsizei*, GLchar*); -extern pfn_glGetPerfMonitorGroupStringAMD fp_glGetPerfMonitorGroupStringAMD; -typedef void (APIENTRYP pfn_glGetPerfMonitorCounterStringAMD) (GLuint, GLuint, GLsizei, GLsizei*, GLchar*); -extern pfn_glGetPerfMonitorCounterStringAMD fp_glGetPerfMonitorCounterStringAMD; -typedef void (APIENTRYP pfn_glGetPerfMonitorCounterInfoAMD) (GLuint, GLuint, GLenum, void*); -extern pfn_glGetPerfMonitorCounterInfoAMD fp_glGetPerfMonitorCounterInfoAMD; -typedef void (APIENTRYP pfn_glGenPerfMonitorsAMD) (GLsizei, GLuint*); -extern pfn_glGenPerfMonitorsAMD fp_glGenPerfMonitorsAMD; -typedef void (APIENTRYP pfn_glDeletePerfMonitorsAMD) (GLsizei, GLuint*); -extern pfn_glDeletePerfMonitorsAMD fp_glDeletePerfMonitorsAMD; -typedef void (APIENTRYP pfn_glSelectPerfMonitorCountersAMD) (GLuint, GLboolean, GLuint, GLint, GLuint*); -extern pfn_glSelectPerfMonitorCountersAMD fp_glSelectPerfMonitorCountersAMD; -typedef void (APIENTRYP pfn_glBeginPerfMonitorAMD) (GLuint); -extern pfn_glBeginPerfMonitorAMD fp_glBeginPerfMonitorAMD; -typedef void (APIENTRYP pfn_glEndPerfMonitorAMD) (GLuint); -extern pfn_glEndPerfMonitorAMD fp_glEndPerfMonitorAMD; -typedef void (APIENTRYP pfn_glGetPerfMonitorCounterDataAMD) (GLuint, GLenum, GLsizei, GLuint*, GLint*); -extern pfn_glGetPerfMonitorCounterDataAMD fp_glGetPerfMonitorCounterDataAMD; - - /* GL_AMD_pinned_memory */ -extern GLboolean GLAD_AMD_pinned_memory; -#define GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD 0x9160 - - /* GL_AMD_program_binary_Z400 */ -extern GLboolean GLAD_AMD_program_binary_Z400; -#define GL_Z400_BINARY_AMD 0x8740 - - /* GL_AMD_query_buffer_object */ -extern GLboolean GLAD_AMD_query_buffer_object; -#define GL_QUERY_BUFFER_AMD 0x9192 -#define GL_QUERY_BUFFER_BINDING_AMD 0x9193 -#define GL_QUERY_RESULT_NO_WAIT_AMD 0x9194 - - /* GL_AMD_sample_positions */ -extern GLboolean GLAD_AMD_sample_positions; -#define GL_SUBSAMPLE_DISTANCE_AMD 0x883F -typedef void (APIENTRYP pfn_glSetMultisamplefvAMD) (GLenum, GLuint, const GLfloat*); -extern pfn_glSetMultisamplefvAMD fp_glSetMultisamplefvAMD; - - /* GL_AMD_seamless_cubemap_per_texture */ -extern GLboolean GLAD_AMD_seamless_cubemap_per_texture; - - /* GL_AMD_shader_atomic_counter_ops */ -extern GLboolean GLAD_AMD_shader_atomic_counter_ops; - - /* GL_AMD_shader_stencil_export */ -extern GLboolean GLAD_AMD_shader_stencil_export; - - /* GL_AMD_shader_trinary_minmax */ -extern GLboolean GLAD_AMD_shader_trinary_minmax; - - /* GL_AMD_sparse_texture */ -extern GLboolean GLAD_AMD_sparse_texture; -#define GL_VIRTUAL_PAGE_SIZE_X_AMD 0x9195 -#define GL_VIRTUAL_PAGE_SIZE_Y_AMD 0x9196 -#define GL_VIRTUAL_PAGE_SIZE_Z_AMD 0x9197 -#define GL_MAX_SPARSE_TEXTURE_SIZE_AMD 0x9198 -#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_AMD 0x9199 -#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS 0x919A -#define GL_MIN_SPARSE_LEVEL_AMD 0x919B -#define GL_MIN_LOD_WARNING_AMD 0x919C -#define GL_TEXTURE_STORAGE_SPARSE_BIT_AMD 0x00000001 -typedef void (APIENTRYP pfn_glTexStorageSparseAMD) (GLenum, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLbitfield); -extern pfn_glTexStorageSparseAMD fp_glTexStorageSparseAMD; -typedef void (APIENTRYP pfn_glTextureStorageSparseAMD) (GLuint, GLenum, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLbitfield); -extern pfn_glTextureStorageSparseAMD fp_glTextureStorageSparseAMD; - - /* GL_AMD_stencil_operation_extended */ -extern GLboolean GLAD_AMD_stencil_operation_extended; -#define GL_SET_AMD 0x874A -#define GL_REPLACE_VALUE_AMD 0x874B -#define GL_STENCIL_OP_VALUE_AMD 0x874C -#define GL_STENCIL_BACK_OP_VALUE_AMD 0x874D -typedef void (APIENTRYP pfn_glStencilOpValueAMD) (GLenum, GLuint); -extern pfn_glStencilOpValueAMD fp_glStencilOpValueAMD; - - /* GL_AMD_texture_texture4 */ -extern GLboolean GLAD_AMD_texture_texture4; - - /* GL_AMD_transform_feedback3_lines_triangles */ -extern GLboolean GLAD_AMD_transform_feedback3_lines_triangles; - - /* GL_AMD_transform_feedback4 */ -extern GLboolean GLAD_AMD_transform_feedback4; -#define GL_STREAM_RASTERIZATION_AMD 0x91A0 - - /* GL_AMD_vertex_shader_layer */ -extern GLboolean GLAD_AMD_vertex_shader_layer; - - /* GL_AMD_vertex_shader_tessellator */ -extern GLboolean GLAD_AMD_vertex_shader_tessellator; -#define GL_SAMPLER_BUFFER_AMD 0x9001 -#define GL_INT_SAMPLER_BUFFER_AMD 0x9002 -#define GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD 0x9003 -#define GL_TESSELLATION_MODE_AMD 0x9004 -#define GL_TESSELLATION_FACTOR_AMD 0x9005 -#define GL_DISCRETE_AMD 0x9006 -#define GL_CONTINUOUS_AMD 0x9007 -typedef void (APIENTRYP pfn_glTessellationFactorAMD) (GLfloat); -extern pfn_glTessellationFactorAMD fp_glTessellationFactorAMD; -typedef void (APIENTRYP pfn_glTessellationModeAMD) (GLenum); -extern pfn_glTessellationModeAMD fp_glTessellationModeAMD; - - /* GL_AMD_vertex_shader_viewport_index */ -extern GLboolean GLAD_AMD_vertex_shader_viewport_index; - - /* GL_ANDROID_extension_pack_es31a */ -extern GLboolean GLAD_ANDROID_extension_pack_es31a; - - /* GL_ANGLE_depth_texture */ -extern GLboolean GLAD_ANGLE_depth_texture; - - /* GL_ANGLE_framebuffer_blit */ -extern GLboolean GLAD_ANGLE_framebuffer_blit; -#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8 -#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9 -#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6 -#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA -typedef void (APIENTRYP pfn_glBlitFramebufferANGLE) (GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum); -extern pfn_glBlitFramebufferANGLE fp_glBlitFramebufferANGLE; - - /* GL_ANGLE_framebuffer_multisample */ -extern GLboolean GLAD_ANGLE_framebuffer_multisample; -#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56 -#define GL_MAX_SAMPLES_ANGLE 0x8D57 -typedef void (APIENTRYP pfn_glRenderbufferStorageMultisampleANGLE) (GLenum, GLsizei, GLenum, GLsizei, GLsizei); -extern pfn_glRenderbufferStorageMultisampleANGLE fp_glRenderbufferStorageMultisampleANGLE; - - /* GL_ANGLE_instanced_arrays */ -extern GLboolean GLAD_ANGLE_instanced_arrays; -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE -typedef void (APIENTRYP pfn_glDrawArraysInstancedANGLE) (GLenum, GLint, GLsizei, GLsizei); -extern pfn_glDrawArraysInstancedANGLE fp_glDrawArraysInstancedANGLE; -typedef void (APIENTRYP pfn_glDrawElementsInstancedANGLE) (GLenum, GLsizei, GLenum, const void*, GLsizei); -extern pfn_glDrawElementsInstancedANGLE fp_glDrawElementsInstancedANGLE; -typedef void (APIENTRYP pfn_glVertexAttribDivisorANGLE) (GLuint, GLuint); -extern pfn_glVertexAttribDivisorANGLE fp_glVertexAttribDivisorANGLE; - - /* GL_ANGLE_pack_reverse_row_order */ -extern GLboolean GLAD_ANGLE_pack_reverse_row_order; -#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4 - - /* GL_ANGLE_program_binary */ -extern GLboolean GLAD_ANGLE_program_binary; -#define GL_PROGRAM_BINARY_ANGLE 0x93A6 - - /* GL_ANGLE_texture_compression_dxt3 */ -extern GLboolean GLAD_ANGLE_texture_compression_dxt3; -#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2 - - /* GL_ANGLE_texture_compression_dxt5 */ -extern GLboolean GLAD_ANGLE_texture_compression_dxt5; -#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3 - - /* GL_ANGLE_texture_usage */ -extern GLboolean GLAD_ANGLE_texture_usage; -#define GL_TEXTURE_USAGE_ANGLE 0x93A2 -#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3 - - /* GL_ANGLE_translated_shader_source */ -extern GLboolean GLAD_ANGLE_translated_shader_source; -#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0 -typedef void (APIENTRYP pfn_glGetTranslatedShaderSourceANGLE) (GLuint, GLsizei, GLsizei*, GLchar*); -extern pfn_glGetTranslatedShaderSourceANGLE fp_glGetTranslatedShaderSourceANGLE; - - /* GL_APPLE_aux_depth_stencil */ -extern GLboolean GLAD_APPLE_aux_depth_stencil; -#define GL_AUX_DEPTH_STENCIL_APPLE 0x8A14 - - /* GL_APPLE_client_storage */ -extern GLboolean GLAD_APPLE_client_storage; -#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 - - /* GL_APPLE_clip_distance */ -extern GLboolean GLAD_APPLE_clip_distance; -#define GL_MAX_CLIP_DISTANCES_APPLE 0x0D32 -#define GL_CLIP_DISTANCE0_APPLE 0x3000 -#define GL_CLIP_DISTANCE1_APPLE 0x3001 -#define GL_CLIP_DISTANCE2_APPLE 0x3002 -#define GL_CLIP_DISTANCE3_APPLE 0x3003 -#define GL_CLIP_DISTANCE4_APPLE 0x3004 -#define GL_CLIP_DISTANCE5_APPLE 0x3005 -#define GL_CLIP_DISTANCE6_APPLE 0x3006 -#define GL_CLIP_DISTANCE7_APPLE 0x3007 - - /* GL_APPLE_color_buffer_packed_float */ -extern GLboolean GLAD_APPLE_color_buffer_packed_float; - - /* GL_APPLE_copy_texture_levels */ -extern GLboolean GLAD_APPLE_copy_texture_levels; -typedef void (APIENTRYP pfn_glCopyTextureLevelsAPPLE) (GLuint, GLuint, GLint, GLsizei); -extern pfn_glCopyTextureLevelsAPPLE fp_glCopyTextureLevelsAPPLE; - - /* GL_APPLE_element_array */ -extern GLboolean GLAD_APPLE_element_array; -#define GL_ELEMENT_ARRAY_APPLE 0x8A0C -#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8A0D -#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x8A0E -typedef void (APIENTRYP pfn_glElementPointerAPPLE) (GLenum, const void*); -extern pfn_glElementPointerAPPLE fp_glElementPointerAPPLE; -typedef void (APIENTRYP pfn_glDrawElementArrayAPPLE) (GLenum, GLint, GLsizei); -extern pfn_glDrawElementArrayAPPLE fp_glDrawElementArrayAPPLE; -typedef void (APIENTRYP pfn_glDrawRangeElementArrayAPPLE) (GLenum, GLuint, GLuint, GLint, GLsizei); -extern pfn_glDrawRangeElementArrayAPPLE fp_glDrawRangeElementArrayAPPLE; -typedef void (APIENTRYP pfn_glMultiDrawElementArrayAPPLE) (GLenum, const GLint*, const GLsizei*, GLsizei); -extern pfn_glMultiDrawElementArrayAPPLE fp_glMultiDrawElementArrayAPPLE; -typedef void (APIENTRYP pfn_glMultiDrawRangeElementArrayAPPLE) (GLenum, GLuint, GLuint, const GLint*, const GLsizei*, GLsizei); -extern pfn_glMultiDrawRangeElementArrayAPPLE fp_glMultiDrawRangeElementArrayAPPLE; - - /* GL_APPLE_fence */ -extern GLboolean GLAD_APPLE_fence; -#define GL_DRAW_PIXELS_APPLE 0x8A0A -#define GL_FENCE_APPLE 0x8A0B -typedef void (APIENTRYP pfn_glGenFencesAPPLE) (GLsizei, GLuint*); -extern pfn_glGenFencesAPPLE fp_glGenFencesAPPLE; -typedef void (APIENTRYP pfn_glDeleteFencesAPPLE) (GLsizei, const GLuint*); -extern pfn_glDeleteFencesAPPLE fp_glDeleteFencesAPPLE; -typedef void (APIENTRYP pfn_glSetFenceAPPLE) (GLuint); -extern pfn_glSetFenceAPPLE fp_glSetFenceAPPLE; -typedef GLboolean (APIENTRYP pfn_glIsFenceAPPLE) (GLuint); -extern pfn_glIsFenceAPPLE fp_glIsFenceAPPLE; -typedef GLboolean (APIENTRYP pfn_glTestFenceAPPLE) (GLuint); -extern pfn_glTestFenceAPPLE fp_glTestFenceAPPLE; -typedef void (APIENTRYP pfn_glFinishFenceAPPLE) (GLuint); -extern pfn_glFinishFenceAPPLE fp_glFinishFenceAPPLE; -typedef GLboolean (APIENTRYP pfn_glTestObjectAPPLE) (GLenum, GLuint); -extern pfn_glTestObjectAPPLE fp_glTestObjectAPPLE; -typedef void (APIENTRYP pfn_glFinishObjectAPPLE) (GLenum, GLint); -extern pfn_glFinishObjectAPPLE fp_glFinishObjectAPPLE; - - /* GL_APPLE_float_pixels */ -extern GLboolean GLAD_APPLE_float_pixels; -#define GL_HALF_APPLE 0x140B -#define GL_RGBA_FLOAT32_APPLE 0x8814 -#define GL_RGB_FLOAT32_APPLE 0x8815 -#define GL_ALPHA_FLOAT32_APPLE 0x8816 -#define GL_INTENSITY_FLOAT32_APPLE 0x8817 -#define GL_LUMINANCE_FLOAT32_APPLE 0x8818 -#define GL_LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819 -#define GL_RGBA_FLOAT16_APPLE 0x881A -#define GL_RGB_FLOAT16_APPLE 0x881B -#define GL_ALPHA_FLOAT16_APPLE 0x881C -#define GL_INTENSITY_FLOAT16_APPLE 0x881D -#define GL_LUMINANCE_FLOAT16_APPLE 0x881E -#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F -#define GL_COLOR_FLOAT_APPLE 0x8A0F - - /* GL_APPLE_flush_buffer_range */ -extern GLboolean GLAD_APPLE_flush_buffer_range; -#define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12 -#define GL_BUFFER_FLUSHING_UNMAP_APPLE 0x8A13 -typedef void (APIENTRYP pfn_glBufferParameteriAPPLE) (GLenum, GLenum, GLint); -extern pfn_glBufferParameteriAPPLE fp_glBufferParameteriAPPLE; -typedef void (APIENTRYP pfn_glFlushMappedBufferRangeAPPLE) (GLenum, GLintptr, GLsizeiptr); -extern pfn_glFlushMappedBufferRangeAPPLE fp_glFlushMappedBufferRangeAPPLE; - - /* GL_APPLE_framebuffer_multisample */ -extern GLboolean GLAD_APPLE_framebuffer_multisample; -#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56 -#define GL_MAX_SAMPLES_APPLE 0x8D57 -#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8 -#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9 -#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6 -#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA -typedef void (APIENTRYP pfn_glRenderbufferStorageMultisampleAPPLE) (GLenum, GLsizei, GLenum, GLsizei, GLsizei); -extern pfn_glRenderbufferStorageMultisampleAPPLE fp_glRenderbufferStorageMultisampleAPPLE; -typedef void (APIENTRYP pfn_glResolveMultisampleFramebufferAPPLE) (); -extern pfn_glResolveMultisampleFramebufferAPPLE fp_glResolveMultisampleFramebufferAPPLE; - - /* GL_APPLE_object_purgeable */ -extern GLboolean GLAD_APPLE_object_purgeable; -#define GL_BUFFER_OBJECT_APPLE 0x85B3 -#define GL_RELEASED_APPLE 0x8A19 -#define GL_VOLATILE_APPLE 0x8A1A -#define GL_RETAINED_APPLE 0x8A1B -#define GL_UNDEFINED_APPLE 0x8A1C -#define GL_PURGEABLE_APPLE 0x8A1D -typedef GLenum (APIENTRYP pfn_glObjectPurgeableAPPLE) (GLenum, GLuint, GLenum); -extern pfn_glObjectPurgeableAPPLE fp_glObjectPurgeableAPPLE; -typedef GLenum (APIENTRYP pfn_glObjectUnpurgeableAPPLE) (GLenum, GLuint, GLenum); -extern pfn_glObjectUnpurgeableAPPLE fp_glObjectUnpurgeableAPPLE; -typedef void (APIENTRYP pfn_glGetObjectParameterivAPPLE) (GLenum, GLuint, GLenum, GLint*); -extern pfn_glGetObjectParameterivAPPLE fp_glGetObjectParameterivAPPLE; - - /* GL_APPLE_rgb_422 */ -extern GLboolean GLAD_APPLE_rgb_422; -#define GL_RGB_422_APPLE 0x8A1F -#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA -#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB -#define GL_RGB_RAW_422_APPLE 0x8A51 - - /* GL_APPLE_row_bytes */ -extern GLboolean GLAD_APPLE_row_bytes; -#define GL_PACK_ROW_BYTES_APPLE 0x8A15 -#define GL_UNPACK_ROW_BYTES_APPLE 0x8A16 - - /* GL_APPLE_sync */ -extern GLboolean GLAD_APPLE_sync; -#define GL_SYNC_OBJECT_APPLE 0x8A53 -#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE 0x9111 -#define GL_OBJECT_TYPE_APPLE 0x9112 -#define GL_SYNC_CONDITION_APPLE 0x9113 -#define GL_SYNC_STATUS_APPLE 0x9114 -#define GL_SYNC_FLAGS_APPLE 0x9115 -#define GL_SYNC_FENCE_APPLE 0x9116 -#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117 -#define GL_UNSIGNALED_APPLE 0x9118 -#define GL_SIGNALED_APPLE 0x9119 -#define GL_ALREADY_SIGNALED_APPLE 0x911A -#define GL_TIMEOUT_EXPIRED_APPLE 0x911B -#define GL_CONDITION_SATISFIED_APPLE 0x911C -#define GL_WAIT_FAILED_APPLE 0x911D -#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE 0x00000001 -#define GL_TIMEOUT_IGNORED_APPLE 0xFFFFFFFFFFFFFFFF -typedef GLsync (APIENTRYP pfn_glFenceSyncAPPLE) (GLenum, GLbitfield); -extern pfn_glFenceSyncAPPLE fp_glFenceSyncAPPLE; -typedef GLboolean (APIENTRYP pfn_glIsSyncAPPLE) (GLsync); -extern pfn_glIsSyncAPPLE fp_glIsSyncAPPLE; -typedef void (APIENTRYP pfn_glDeleteSyncAPPLE) (GLsync); -extern pfn_glDeleteSyncAPPLE fp_glDeleteSyncAPPLE; -typedef GLenum (APIENTRYP pfn_glClientWaitSyncAPPLE) (GLsync, GLbitfield, GLuint64); -extern pfn_glClientWaitSyncAPPLE fp_glClientWaitSyncAPPLE; -typedef void (APIENTRYP pfn_glWaitSyncAPPLE) (GLsync, GLbitfield, GLuint64); -extern pfn_glWaitSyncAPPLE fp_glWaitSyncAPPLE; -typedef void (APIENTRYP pfn_glGetInteger64vAPPLE) (GLenum, GLint64*); -extern pfn_glGetInteger64vAPPLE fp_glGetInteger64vAPPLE; -typedef void (APIENTRYP pfn_glGetSyncivAPPLE) (GLsync, GLenum, GLsizei, GLsizei*, GLint*); -extern pfn_glGetSyncivAPPLE fp_glGetSyncivAPPLE; - - /* GL_APPLE_texture_format_BGRA8888 */ -extern GLboolean GLAD_APPLE_texture_format_BGRA8888; - - /* GL_APPLE_texture_max_level */ -extern GLboolean GLAD_APPLE_texture_max_level; -#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D - - /* GL_APPLE_texture_packed_float */ -extern GLboolean GLAD_APPLE_texture_packed_float; -#define GL_UNSIGNED_INT_10F_11F_11F_REV_APPLE 0x8C3B -#define GL_UNSIGNED_INT_5_9_9_9_REV_APPLE 0x8C3E -#define GL_R11F_G11F_B10F_APPLE 0x8C3A -#define GL_RGB9_E5_APPLE 0x8C3D - - /* GL_APPLE_texture_range */ -extern GLboolean GLAD_APPLE_texture_range; -#define GL_TEXTURE_RANGE_LENGTH_APPLE 0x85B7 -#define GL_TEXTURE_RANGE_POINTER_APPLE 0x85B8 -#define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC -#define GL_STORAGE_PRIVATE_APPLE 0x85BD -#define GL_STORAGE_CACHED_APPLE 0x85BE -#define GL_STORAGE_SHARED_APPLE 0x85BF -typedef void (APIENTRYP pfn_glTextureRangeAPPLE) (GLenum, GLsizei, const void*); -extern pfn_glTextureRangeAPPLE fp_glTextureRangeAPPLE; -typedef void (APIENTRYP pfn_glGetTexParameterPointervAPPLE) (GLenum, GLenum, void**); -extern pfn_glGetTexParameterPointervAPPLE fp_glGetTexParameterPointervAPPLE; - - /* GL_APPLE_vertex_array_object */ -extern GLboolean GLAD_APPLE_vertex_array_object; -#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5 -typedef void (APIENTRYP pfn_glBindVertexArrayAPPLE) (GLuint); -extern pfn_glBindVertexArrayAPPLE fp_glBindVertexArrayAPPLE; -typedef void (APIENTRYP pfn_glDeleteVertexArraysAPPLE) (GLsizei, const GLuint*); -extern pfn_glDeleteVertexArraysAPPLE fp_glDeleteVertexArraysAPPLE; -typedef void (APIENTRYP pfn_glGenVertexArraysAPPLE) (GLsizei, GLuint*); -extern pfn_glGenVertexArraysAPPLE fp_glGenVertexArraysAPPLE; -typedef GLboolean (APIENTRYP pfn_glIsVertexArrayAPPLE) (GLuint); -extern pfn_glIsVertexArrayAPPLE fp_glIsVertexArrayAPPLE; - - /* GL_APPLE_vertex_array_range */ -extern GLboolean GLAD_APPLE_vertex_array_range; -#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D -#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E -#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F -#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521 -#define GL_STORAGE_CLIENT_APPLE 0x85B4 -typedef void (APIENTRYP pfn_glVertexArrayRangeAPPLE) (GLsizei, void*); -extern pfn_glVertexArrayRangeAPPLE fp_glVertexArrayRangeAPPLE; -typedef void (APIENTRYP pfn_glFlushVertexArrayRangeAPPLE) (GLsizei, void*); -extern pfn_glFlushVertexArrayRangeAPPLE fp_glFlushVertexArrayRangeAPPLE; -typedef void (APIENTRYP pfn_glVertexArrayParameteriAPPLE) (GLenum, GLint); -extern pfn_glVertexArrayParameteriAPPLE fp_glVertexArrayParameteriAPPLE; - - /* GL_APPLE_vertex_program_evaluators */ -extern GLboolean GLAD_APPLE_vertex_program_evaluators; -#define GL_VERTEX_ATTRIB_MAP1_APPLE 0x8A00 -#define GL_VERTEX_ATTRIB_MAP2_APPLE 0x8A01 -#define GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE 0x8A02 -#define GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE 0x8A03 -#define GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE 0x8A04 -#define GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE 0x8A05 -#define GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE 0x8A06 -#define GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE 0x8A07 -#define GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE 0x8A08 -#define GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE 0x8A09 -typedef void (APIENTRYP pfn_glEnableVertexAttribAPPLE) (GLuint, GLenum); -extern pfn_glEnableVertexAttribAPPLE fp_glEnableVertexAttribAPPLE; -typedef void (APIENTRYP pfn_glDisableVertexAttribAPPLE) (GLuint, GLenum); -extern pfn_glDisableVertexAttribAPPLE fp_glDisableVertexAttribAPPLE; -typedef GLboolean (APIENTRYP pfn_glIsVertexAttribEnabledAPPLE) (GLuint, GLenum); -extern pfn_glIsVertexAttribEnabledAPPLE fp_glIsVertexAttribEnabledAPPLE; -typedef void (APIENTRYP pfn_glMapVertexAttrib1dAPPLE) (GLuint, GLuint, GLdouble, GLdouble, GLint, GLint, const GLdouble*); -extern pfn_glMapVertexAttrib1dAPPLE fp_glMapVertexAttrib1dAPPLE; -typedef void (APIENTRYP pfn_glMapVertexAttrib1fAPPLE) (GLuint, GLuint, GLfloat, GLfloat, GLint, GLint, const GLfloat*); -extern pfn_glMapVertexAttrib1fAPPLE fp_glMapVertexAttrib1fAPPLE; -typedef void (APIENTRYP pfn_glMapVertexAttrib2dAPPLE) (GLuint, GLuint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble*); -extern pfn_glMapVertexAttrib2dAPPLE fp_glMapVertexAttrib2dAPPLE; -typedef void (APIENTRYP pfn_glMapVertexAttrib2fAPPLE) (GLuint, GLuint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat*); -extern pfn_glMapVertexAttrib2fAPPLE fp_glMapVertexAttrib2fAPPLE; - - /* GL_APPLE_ycbcr_422 */ -extern GLboolean GLAD_APPLE_ycbcr_422; -#define GL_YCBCR_422_APPLE 0x85B9 - - /* GL_ARM_mali_program_binary */ -extern GLboolean GLAD_ARM_mali_program_binary; -#define GL_MALI_PROGRAM_BINARY_ARM 0x8F61 - - /* GL_ARM_mali_shader_binary */ -extern GLboolean GLAD_ARM_mali_shader_binary; -#define GL_MALI_SHADER_BINARY_ARM 0x8F60 - - /* GL_ARM_rgba8 */ -extern GLboolean GLAD_ARM_rgba8; - - /* GL_ARM_shader_framebuffer_fetch */ -extern GLboolean GLAD_ARM_shader_framebuffer_fetch; -#define GL_FETCH_PER_SAMPLE_ARM 0x8F65 -#define GL_FRAGMENT_SHADER_FRAMEBUFFER_FETCH_MRT_ARM 0x8F66 - - /* GL_ARM_shader_framebuffer_fetch_depth_stencil */ -extern GLboolean GLAD_ARM_shader_framebuffer_fetch_depth_stencil; - - /* GL_ATI_meminfo */ -extern GLboolean GLAD_ATI_meminfo; -#define GL_VBO_FREE_MEMORY_ATI 0x87FB -#define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC -#define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD - - /* GL_ATI_pixel_format_float */ -extern GLboolean GLAD_ATI_pixel_format_float; -#define GL_RGBA_FLOAT_MODE_ATI 0x8820 -#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 - - /* GL_DMP_program_binary */ -extern GLboolean GLAD_DMP_program_binary; -#define GL_SMAPHS30_PROGRAM_BINARY_DMP 0x9251 -#define GL_SMAPHS_PROGRAM_BINARY_DMP 0x9252 -#define GL_DMP_PROGRAM_BINARY_DMP 0x9253 - - /* GL_DMP_shader_binary */ -extern GLboolean GLAD_DMP_shader_binary; -#define GL_SHADER_BINARY_DMP 0x9250 - - /* GL_FJ_shader_binary_GCCSO */ -extern GLboolean GLAD_FJ_shader_binary_GCCSO; -#define GL_GCCSO_SHADER_BINARY_FJ 0x9260 - - /* GL_GREMEDY_frame_terminator */ -extern GLboolean GLAD_GREMEDY_frame_terminator; -typedef void (APIENTRYP pfn_glFrameTerminatorGREMEDY) (); -extern pfn_glFrameTerminatorGREMEDY fp_glFrameTerminatorGREMEDY; - - /* GL_GREMEDY_string_marker */ -extern GLboolean GLAD_GREMEDY_string_marker; -typedef void (APIENTRYP pfn_glStringMarkerGREMEDY) (GLsizei, const void*); -extern pfn_glStringMarkerGREMEDY fp_glStringMarkerGREMEDY; - - /* GL_IMG_multisampled_render_to_texture */ -extern GLboolean GLAD_IMG_multisampled_render_to_texture; -#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133 -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134 -#define GL_MAX_SAMPLES_IMG 0x9135 -#define GL_TEXTURE_SAMPLES_IMG 0x9136 -typedef void (APIENTRYP pfn_glRenderbufferStorageMultisampleIMG) (GLenum, GLsizei, GLenum, GLsizei, GLsizei); -extern pfn_glRenderbufferStorageMultisampleIMG fp_glRenderbufferStorageMultisampleIMG; -typedef void (APIENTRYP pfn_glFramebufferTexture2DMultisampleIMG) (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); -extern pfn_glFramebufferTexture2DMultisampleIMG fp_glFramebufferTexture2DMultisampleIMG; - - /* GL_IMG_program_binary */ -extern GLboolean GLAD_IMG_program_binary; -#define GL_SGX_PROGRAM_BINARY_IMG 0x9130 - - /* GL_IMG_read_format */ -extern GLboolean GLAD_IMG_read_format; -#define GL_BGRA_IMG 0x80E1 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365 - - /* GL_IMG_shader_binary */ -extern GLboolean GLAD_IMG_shader_binary; -#define GL_SGX_BINARY_IMG 0x8C0A - - /* GL_IMG_texture_compression_pvrtc */ -extern GLboolean GLAD_IMG_texture_compression_pvrtc; -#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 -#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 -#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 -#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 - - /* GL_IMG_texture_compression_pvrtc2 */ -extern GLboolean GLAD_IMG_texture_compression_pvrtc2; -#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137 -#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138 - - /* GL_IMG_texture_filter_cubic */ -extern GLboolean GLAD_IMG_texture_filter_cubic; -#define GL_CUBIC_IMG 0x9139 -#define GL_CUBIC_MIPMAP_NEAREST_IMG 0x913A -#define GL_CUBIC_MIPMAP_LINEAR_IMG 0x913B - - /* GL_INGR_blend_func_separate */ -extern GLboolean GLAD_INGR_blend_func_separate; -typedef void (APIENTRYP pfn_glBlendFuncSeparateINGR) (GLenum, GLenum, GLenum, GLenum); -extern pfn_glBlendFuncSeparateINGR fp_glBlendFuncSeparateINGR; - - /* GL_INTEL_fragment_shader_ordering */ -extern GLboolean GLAD_INTEL_fragment_shader_ordering; - - /* GL_INTEL_framebuffer_CMAA */ -extern GLboolean GLAD_INTEL_framebuffer_CMAA; -typedef void (APIENTRYP pfn_glApplyFramebufferAttachmentCMAAINTEL) (); -extern pfn_glApplyFramebufferAttachmentCMAAINTEL fp_glApplyFramebufferAttachmentCMAAINTEL; - - /* GL_INTEL_map_texture */ -extern GLboolean GLAD_INTEL_map_texture; -#define GL_TEXTURE_MEMORY_LAYOUT_INTEL 0x83FF -#define GL_LAYOUT_DEFAULT_INTEL 0 -#define GL_LAYOUT_LINEAR_INTEL 1 -#define GL_LAYOUT_LINEAR_CPU_CACHED_INTEL 2 -typedef void (APIENTRYP pfn_glSyncTextureINTEL) (GLuint); -extern pfn_glSyncTextureINTEL fp_glSyncTextureINTEL; -typedef void (APIENTRYP pfn_glUnmapTexture2DINTEL) (GLuint, GLint); -extern pfn_glUnmapTexture2DINTEL fp_glUnmapTexture2DINTEL; -typedef void* (APIENTRYP pfn_glMapTexture2DINTEL) (GLuint, GLint, GLbitfield, GLint*, GLenum*); -extern pfn_glMapTexture2DINTEL fp_glMapTexture2DINTEL; - - /* GL_INTEL_performance_query */ -extern GLboolean GLAD_INTEL_performance_query; -#define GL_PERFQUERY_SINGLE_CONTEXT_INTEL 0x00000000 -#define GL_PERFQUERY_GLOBAL_CONTEXT_INTEL 0x00000001 -#define GL_PERFQUERY_WAIT_INTEL 0x83FB -#define GL_PERFQUERY_FLUSH_INTEL 0x83FA -#define GL_PERFQUERY_DONOT_FLUSH_INTEL 0x83F9 -#define GL_PERFQUERY_COUNTER_EVENT_INTEL 0x94F0 -#define GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL 0x94F1 -#define GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL 0x94F2 -#define GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL 0x94F3 -#define GL_PERFQUERY_COUNTER_RAW_INTEL 0x94F4 -#define GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL 0x94F5 -#define GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL 0x94F8 -#define GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL 0x94F9 -#define GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL 0x94FA -#define GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL 0x94FB -#define GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL 0x94FC -#define GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL 0x94FD -#define GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL 0x94FE -#define GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL 0x94FF -#define GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL 0x9500 -typedef void (APIENTRYP pfn_glBeginPerfQueryINTEL) (GLuint); -extern pfn_glBeginPerfQueryINTEL fp_glBeginPerfQueryINTEL; -typedef void (APIENTRYP pfn_glCreatePerfQueryINTEL) (GLuint, GLuint*); -extern pfn_glCreatePerfQueryINTEL fp_glCreatePerfQueryINTEL; -typedef void (APIENTRYP pfn_glDeletePerfQueryINTEL) (GLuint); -extern pfn_glDeletePerfQueryINTEL fp_glDeletePerfQueryINTEL; -typedef void (APIENTRYP pfn_glEndPerfQueryINTEL) (GLuint); -extern pfn_glEndPerfQueryINTEL fp_glEndPerfQueryINTEL; -typedef void (APIENTRYP pfn_glGetFirstPerfQueryIdINTEL) (GLuint*); -extern pfn_glGetFirstPerfQueryIdINTEL fp_glGetFirstPerfQueryIdINTEL; -typedef void (APIENTRYP pfn_glGetNextPerfQueryIdINTEL) (GLuint, GLuint*); -extern pfn_glGetNextPerfQueryIdINTEL fp_glGetNextPerfQueryIdINTEL; -typedef void (APIENTRYP pfn_glGetPerfCounterInfoINTEL) (GLuint, GLuint, GLuint, GLchar*, GLuint, GLchar*, GLuint*, GLuint*, GLuint*, GLuint*, GLuint64*); -extern pfn_glGetPerfCounterInfoINTEL fp_glGetPerfCounterInfoINTEL; -typedef void (APIENTRYP pfn_glGetPerfQueryDataINTEL) (GLuint, GLuint, GLsizei, GLvoid*, GLuint*); -extern pfn_glGetPerfQueryDataINTEL fp_glGetPerfQueryDataINTEL; -typedef void (APIENTRYP pfn_glGetPerfQueryIdByNameINTEL) (GLchar*, GLuint*); -extern pfn_glGetPerfQueryIdByNameINTEL fp_glGetPerfQueryIdByNameINTEL; -typedef void (APIENTRYP pfn_glGetPerfQueryInfoINTEL) (GLuint, GLuint, GLchar*, GLuint*, GLuint*, GLuint*, GLuint*); -extern pfn_glGetPerfQueryInfoINTEL fp_glGetPerfQueryInfoINTEL; - - /* GL_MESA_pack_invert */ -extern GLboolean GLAD_MESA_pack_invert; -#define GL_PACK_INVERT_MESA 0x8758 - - /* GL_MESA_ycbcr_texture */ -extern GLboolean GLAD_MESA_ycbcr_texture; -#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA -#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB -#define GL_YCBCR_MESA 0x8757 - - /* GL_MESAX_texture_stack */ -extern GLboolean GLAD_MESAX_texture_stack; -#define GL_TEXTURE_1D_STACK_MESAX 0x8759 -#define GL_TEXTURE_2D_STACK_MESAX 0x875A -#define GL_PROXY_TEXTURE_1D_STACK_MESAX 0x875B -#define GL_PROXY_TEXTURE_2D_STACK_MESAX 0x875C -#define GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D -#define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E - - /* GL_NV_bindless_multi_draw_indirect */ -extern GLboolean GLAD_NV_bindless_multi_draw_indirect; -typedef void (APIENTRYP pfn_glMultiDrawArraysIndirectBindlessNV) (GLenum, const void*, GLsizei, GLsizei, GLint); -extern pfn_glMultiDrawArraysIndirectBindlessNV fp_glMultiDrawArraysIndirectBindlessNV; -typedef void (APIENTRYP pfn_glMultiDrawElementsIndirectBindlessNV) (GLenum, GLenum, const void*, GLsizei, GLsizei, GLint); -extern pfn_glMultiDrawElementsIndirectBindlessNV fp_glMultiDrawElementsIndirectBindlessNV; - - /* GL_NV_bindless_multi_draw_indirect_count */ -extern GLboolean GLAD_NV_bindless_multi_draw_indirect_count; -typedef void (APIENTRYP pfn_glMultiDrawArraysIndirectBindlessCountNV) (GLenum, const void*, GLsizei, GLsizei, GLsizei, GLint); -extern pfn_glMultiDrawArraysIndirectBindlessCountNV fp_glMultiDrawArraysIndirectBindlessCountNV; -typedef void (APIENTRYP pfn_glMultiDrawElementsIndirectBindlessCountNV) (GLenum, GLenum, const void*, GLsizei, GLsizei, GLsizei, GLint); -extern pfn_glMultiDrawElementsIndirectBindlessCountNV fp_glMultiDrawElementsIndirectBindlessCountNV; - - /* GL_NV_bindless_texture */ -extern GLboolean GLAD_NV_bindless_texture; -typedef GLuint64 (APIENTRYP pfn_glGetTextureHandleNV) (GLuint); -extern pfn_glGetTextureHandleNV fp_glGetTextureHandleNV; -typedef GLuint64 (APIENTRYP pfn_glGetTextureSamplerHandleNV) (GLuint, GLuint); -extern pfn_glGetTextureSamplerHandleNV fp_glGetTextureSamplerHandleNV; -typedef void (APIENTRYP pfn_glMakeTextureHandleResidentNV) (GLuint64); -extern pfn_glMakeTextureHandleResidentNV fp_glMakeTextureHandleResidentNV; -typedef void (APIENTRYP pfn_glMakeTextureHandleNonResidentNV) (GLuint64); -extern pfn_glMakeTextureHandleNonResidentNV fp_glMakeTextureHandleNonResidentNV; -typedef GLuint64 (APIENTRYP pfn_glGetImageHandleNV) (GLuint, GLint, GLboolean, GLint, GLenum); -extern pfn_glGetImageHandleNV fp_glGetImageHandleNV; -typedef void (APIENTRYP pfn_glMakeImageHandleResidentNV) (GLuint64, GLenum); -extern pfn_glMakeImageHandleResidentNV fp_glMakeImageHandleResidentNV; -typedef void (APIENTRYP pfn_glMakeImageHandleNonResidentNV) (GLuint64); -extern pfn_glMakeImageHandleNonResidentNV fp_glMakeImageHandleNonResidentNV; -typedef void (APIENTRYP pfn_glUniformHandleui64NV) (GLint, GLuint64); -extern pfn_glUniformHandleui64NV fp_glUniformHandleui64NV; -typedef void (APIENTRYP pfn_glUniformHandleui64vNV) (GLint, GLsizei, const GLuint64*); -extern pfn_glUniformHandleui64vNV fp_glUniformHandleui64vNV; -typedef void (APIENTRYP pfn_glProgramUniformHandleui64NV) (GLuint, GLint, GLuint64); -extern pfn_glProgramUniformHandleui64NV fp_glProgramUniformHandleui64NV; -typedef void (APIENTRYP pfn_glProgramUniformHandleui64vNV) (GLuint, GLint, GLsizei, const GLuint64*); -extern pfn_glProgramUniformHandleui64vNV fp_glProgramUniformHandleui64vNV; -typedef GLboolean (APIENTRYP pfn_glIsTextureHandleResidentNV) (GLuint64); -extern pfn_glIsTextureHandleResidentNV fp_glIsTextureHandleResidentNV; -typedef GLboolean (APIENTRYP pfn_glIsImageHandleResidentNV) (GLuint64); -extern pfn_glIsImageHandleResidentNV fp_glIsImageHandleResidentNV; - - /* GL_NV_blend_equation_advanced */ -extern GLboolean GLAD_NV_blend_equation_advanced; -#define GL_BLEND_OVERLAP_NV 0x9281 -#define GL_BLEND_PREMULTIPLIED_SRC_NV 0x9280 -#define GL_BLUE_NV 0x1905 -#define GL_COLORBURN_NV 0x929A -#define GL_COLORDODGE_NV 0x9299 -#define GL_CONJOINT_NV 0x9284 -#define GL_CONTRAST_NV 0x92A1 -#define GL_DARKEN_NV 0x9297 -#define GL_DIFFERENCE_NV 0x929E -#define GL_DISJOINT_NV 0x9283 -#define GL_DST_ATOP_NV 0x928F -#define GL_DST_IN_NV 0x928B -#define GL_DST_NV 0x9287 -#define GL_DST_OUT_NV 0x928D -#define GL_DST_OVER_NV 0x9289 -#define GL_EXCLUSION_NV 0x92A0 -#define GL_GREEN_NV 0x1904 -#define GL_HARDLIGHT_NV 0x929B -#define GL_HARDMIX_NV 0x92A9 -#define GL_HSL_COLOR_NV 0x92AF -#define GL_HSL_HUE_NV 0x92AD -#define GL_HSL_LUMINOSITY_NV 0x92B0 -#define GL_HSL_SATURATION_NV 0x92AE -#define GL_INVERT_OVG_NV 0x92B4 -#define GL_INVERT_RGB_NV 0x92A3 -#define GL_LIGHTEN_NV 0x9298 -#define GL_LINEARBURN_NV 0x92A5 -#define GL_LINEARDODGE_NV 0x92A4 -#define GL_LINEARLIGHT_NV 0x92A7 -#define GL_MINUS_CLAMPED_NV 0x92B3 -#define GL_MINUS_NV 0x929F -#define GL_MULTIPLY_NV 0x9294 -#define GL_OVERLAY_NV 0x9296 -#define GL_PINLIGHT_NV 0x92A8 -#define GL_PLUS_CLAMPED_ALPHA_NV 0x92B2 -#define GL_PLUS_CLAMPED_NV 0x92B1 -#define GL_PLUS_DARKER_NV 0x9292 -#define GL_PLUS_NV 0x9291 -#define GL_RED_NV 0x1903 -#define GL_SCREEN_NV 0x9295 -#define GL_SOFTLIGHT_NV 0x929C -#define GL_SRC_ATOP_NV 0x928E -#define GL_SRC_IN_NV 0x928A -#define GL_SRC_NV 0x9286 -#define GL_SRC_OUT_NV 0x928C -#define GL_SRC_OVER_NV 0x9288 -#define GL_UNCORRELATED_NV 0x9282 -#define GL_VIVIDLIGHT_NV 0x92A6 -#define GL_XOR_NV 0x1506 -typedef void (APIENTRYP pfn_glBlendParameteriNV) (GLenum, GLint); -extern pfn_glBlendParameteriNV fp_glBlendParameteriNV; -typedef void (APIENTRYP pfn_glBlendBarrierNV) (); -extern pfn_glBlendBarrierNV fp_glBlendBarrierNV; - - /* GL_NV_blend_equation_advanced_coherent */ -extern GLboolean GLAD_NV_blend_equation_advanced_coherent; -#define GL_BLEND_ADVANCED_COHERENT_NV 0x9285 - - /* GL_NV_command_list */ -extern GLboolean GLAD_NV_command_list; -#define GL_TERMINATE_SEQUENCE_COMMAND_NV 0x0000 -#define GL_NOP_COMMAND_NV 0x0001 -#define GL_DRAW_ELEMENTS_COMMAND_NV 0x0002 -#define GL_DRAW_ARRAYS_COMMAND_NV 0x0003 -#define GL_DRAW_ELEMENTS_STRIP_COMMAND_NV 0x0004 -#define GL_DRAW_ARRAYS_STRIP_COMMAND_NV 0x0005 -#define GL_DRAW_ELEMENTS_INSTANCED_COMMAND_NV 0x0006 -#define GL_DRAW_ARRAYS_INSTANCED_COMMAND_NV 0x0007 -#define GL_ELEMENT_ADDRESS_COMMAND_NV 0x0008 -#define GL_ATTRIBUTE_ADDRESS_COMMAND_NV 0x0009 -#define GL_UNIFORM_ADDRESS_COMMAND_NV 0x000A -#define GL_BLEND_COLOR_COMMAND_NV 0x000B -#define GL_STENCIL_REF_COMMAND_NV 0x000C -#define GL_LINE_WIDTH_COMMAND_NV 0x000D -#define GL_POLYGON_OFFSET_COMMAND_NV 0x000E -#define GL_ALPHA_REF_COMMAND_NV 0x000F -#define GL_VIEWPORT_COMMAND_NV 0x0010 -#define GL_SCISSOR_COMMAND_NV 0x0011 -#define GL_FRONT_FACE_COMMAND_NV 0x0012 -typedef void (APIENTRYP pfn_glCreateStatesNV) (GLsizei, GLuint*); -extern pfn_glCreateStatesNV fp_glCreateStatesNV; -typedef void (APIENTRYP pfn_glDeleteStatesNV) (GLsizei, const GLuint*); -extern pfn_glDeleteStatesNV fp_glDeleteStatesNV; -typedef GLboolean (APIENTRYP pfn_glIsStateNV) (GLuint); -extern pfn_glIsStateNV fp_glIsStateNV; -typedef void (APIENTRYP pfn_glStateCaptureNV) (GLuint, GLenum); -extern pfn_glStateCaptureNV fp_glStateCaptureNV; -typedef GLuint (APIENTRYP pfn_glGetCommandHeaderNV) (GLenum, GLuint); -extern pfn_glGetCommandHeaderNV fp_glGetCommandHeaderNV; -typedef GLushort (APIENTRYP pfn_glGetStageIndexNV) (GLenum); -extern pfn_glGetStageIndexNV fp_glGetStageIndexNV; -typedef void (APIENTRYP pfn_glDrawCommandsNV) (GLenum, GLuint, const GLintptr*, const GLsizei*, GLuint); -extern pfn_glDrawCommandsNV fp_glDrawCommandsNV; -typedef void (APIENTRYP pfn_glDrawCommandsAddressNV) (GLenum, const GLuint64*, const GLsizei*, GLuint); -extern pfn_glDrawCommandsAddressNV fp_glDrawCommandsAddressNV; -typedef void (APIENTRYP pfn_glDrawCommandsStatesNV) (GLuint, const GLintptr*, const GLsizei*, const GLuint*, const GLuint*, GLuint); -extern pfn_glDrawCommandsStatesNV fp_glDrawCommandsStatesNV; -typedef void (APIENTRYP pfn_glDrawCommandsStatesAddressNV) (const GLuint64*, const GLsizei*, const GLuint*, const GLuint*, GLuint); -extern pfn_glDrawCommandsStatesAddressNV fp_glDrawCommandsStatesAddressNV; -typedef void (APIENTRYP pfn_glCreateCommandListsNV) (GLsizei, GLuint*); -extern pfn_glCreateCommandListsNV fp_glCreateCommandListsNV; -typedef void (APIENTRYP pfn_glDeleteCommandListsNV) (GLsizei, const GLuint*); -extern pfn_glDeleteCommandListsNV fp_glDeleteCommandListsNV; -typedef GLboolean (APIENTRYP pfn_glIsCommandListNV) (GLuint); -extern pfn_glIsCommandListNV fp_glIsCommandListNV; -typedef void (APIENTRYP pfn_glListDrawCommandsStatesClientNV) (GLuint, GLuint, const void**, const GLsizei*, const GLuint*, const GLuint*, GLuint); -extern pfn_glListDrawCommandsStatesClientNV fp_glListDrawCommandsStatesClientNV; -typedef void (APIENTRYP pfn_glCommandListSegmentsNV) (GLuint, GLuint); -extern pfn_glCommandListSegmentsNV fp_glCommandListSegmentsNV; -typedef void (APIENTRYP pfn_glCompileCommandListNV) (GLuint); -extern pfn_glCompileCommandListNV fp_glCompileCommandListNV; -typedef void (APIENTRYP pfn_glCallCommandListNV) (GLuint); -extern pfn_glCallCommandListNV fp_glCallCommandListNV; - - /* GL_NV_compute_program5 */ -extern GLboolean GLAD_NV_compute_program5; -#define GL_COMPUTE_PROGRAM_NV 0x90FB -#define GL_COMPUTE_PROGRAM_PARAMETER_BUFFER_NV 0x90FC - - /* GL_NV_conditional_render */ -extern GLboolean GLAD_NV_conditional_render; -#define GL_QUERY_WAIT_NV 0x8E13 -#define GL_QUERY_NO_WAIT_NV 0x8E14 -#define GL_QUERY_BY_REGION_WAIT_NV 0x8E15 -#define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16 -typedef void (APIENTRYP pfn_glBeginConditionalRenderNV) (GLuint, GLenum); -extern pfn_glBeginConditionalRenderNV fp_glBeginConditionalRenderNV; -typedef void (APIENTRYP pfn_glEndConditionalRenderNV) (); -extern pfn_glEndConditionalRenderNV fp_glEndConditionalRenderNV; - - /* GL_NV_conservative_raster */ -extern GLboolean GLAD_NV_conservative_raster; -#define GL_CONSERVATIVE_RASTERIZATION_NV 0x9346 -#define GL_SUBPIXEL_PRECISION_BIAS_X_BITS_NV 0x9347 -#define GL_SUBPIXEL_PRECISION_BIAS_Y_BITS_NV 0x9348 -#define GL_MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV 0x9349 -typedef void (APIENTRYP pfn_glSubpixelPrecisionBiasNV) (GLuint, GLuint); -extern pfn_glSubpixelPrecisionBiasNV fp_glSubpixelPrecisionBiasNV; - - /* GL_NV_conservative_raster_dilate */ -extern GLboolean GLAD_NV_conservative_raster_dilate; -#define GL_CONSERVATIVE_RASTER_DILATE_NV 0x9379 -#define GL_CONSERVATIVE_RASTER_DILATE_RANGE_NV 0x937A -#define GL_CONSERVATIVE_RASTER_DILATE_GRANULARITY_NV 0x937B -typedef void (APIENTRYP pfn_glConservativeRasterParameterfNV) (GLenum, GLfloat); -extern pfn_glConservativeRasterParameterfNV fp_glConservativeRasterParameterfNV; - - /* GL_NV_copy_buffer */ -extern GLboolean GLAD_NV_copy_buffer; -#define GL_COPY_READ_BUFFER_NV 0x8F36 -#define GL_COPY_WRITE_BUFFER_NV 0x8F37 -typedef void (APIENTRYP pfn_glCopyBufferSubDataNV) (GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr); -extern pfn_glCopyBufferSubDataNV fp_glCopyBufferSubDataNV; - - /* GL_NV_copy_image */ -extern GLboolean GLAD_NV_copy_image; -typedef void (APIENTRYP pfn_glCopyImageSubDataNV) (GLuint, GLenum, GLint, GLint, GLint, GLint, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei); -extern pfn_glCopyImageSubDataNV fp_glCopyImageSubDataNV; - - /* GL_NV_coverage_sample */ -extern GLboolean GLAD_NV_coverage_sample; -#define GL_COVERAGE_COMPONENT_NV 0x8ED0 -#define GL_COVERAGE_COMPONENT4_NV 0x8ED1 -#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2 -#define GL_COVERAGE_BUFFERS_NV 0x8ED3 -#define GL_COVERAGE_SAMPLES_NV 0x8ED4 -#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5 -#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6 -#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7 -#define GL_COVERAGE_BUFFER_BIT_NV 0x00008000 -typedef void (APIENTRYP pfn_glCoverageMaskNV) (GLboolean); -extern pfn_glCoverageMaskNV fp_glCoverageMaskNV; -typedef void (APIENTRYP pfn_glCoverageOperationNV) (GLenum); -extern pfn_glCoverageOperationNV fp_glCoverageOperationNV; - - /* GL_NV_deep_texture3D */ -extern GLboolean GLAD_NV_deep_texture3D; -#define GL_MAX_DEEP_3D_TEXTURE_WIDTH_HEIGHT_NV 0x90D0 -#define GL_MAX_DEEP_3D_TEXTURE_DEPTH_NV 0x90D1 - - /* GL_NV_depth_buffer_float */ -extern GLboolean GLAD_NV_depth_buffer_float; -#define GL_DEPTH_COMPONENT32F_NV 0x8DAB -#define GL_DEPTH32F_STENCIL8_NV 0x8DAC -#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD -#define GL_DEPTH_BUFFER_FLOAT_MODE_NV 0x8DAF -typedef void (APIENTRYP pfn_glDepthRangedNV) (GLdouble, GLdouble); -extern pfn_glDepthRangedNV fp_glDepthRangedNV; -typedef void (APIENTRYP pfn_glClearDepthdNV) (GLdouble); -extern pfn_glClearDepthdNV fp_glClearDepthdNV; -typedef void (APIENTRYP pfn_glDepthBoundsdNV) (GLdouble, GLdouble); -extern pfn_glDepthBoundsdNV fp_glDepthBoundsdNV; - - /* GL_NV_depth_clamp */ -extern GLboolean GLAD_NV_depth_clamp; -#define GL_DEPTH_CLAMP_NV 0x864F - - /* GL_NV_depth_nonlinear */ -extern GLboolean GLAD_NV_depth_nonlinear; -#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C - - /* GL_NV_draw_buffers */ -extern GLboolean GLAD_NV_draw_buffers; -#define GL_MAX_DRAW_BUFFERS_NV 0x8824 -#define GL_DRAW_BUFFER0_NV 0x8825 -#define GL_DRAW_BUFFER1_NV 0x8826 -#define GL_DRAW_BUFFER2_NV 0x8827 -#define GL_DRAW_BUFFER3_NV 0x8828 -#define GL_DRAW_BUFFER4_NV 0x8829 -#define GL_DRAW_BUFFER5_NV 0x882A -#define GL_DRAW_BUFFER6_NV 0x882B -#define GL_DRAW_BUFFER7_NV 0x882C -#define GL_DRAW_BUFFER8_NV 0x882D -#define GL_DRAW_BUFFER9_NV 0x882E -#define GL_DRAW_BUFFER10_NV 0x882F -#define GL_DRAW_BUFFER11_NV 0x8830 -#define GL_DRAW_BUFFER12_NV 0x8831 -#define GL_DRAW_BUFFER13_NV 0x8832 -#define GL_DRAW_BUFFER14_NV 0x8833 -#define GL_DRAW_BUFFER15_NV 0x8834 -#define GL_COLOR_ATTACHMENT0_NV 0x8CE0 -#define GL_COLOR_ATTACHMENT1_NV 0x8CE1 -#define GL_COLOR_ATTACHMENT2_NV 0x8CE2 -#define GL_COLOR_ATTACHMENT3_NV 0x8CE3 -#define GL_COLOR_ATTACHMENT4_NV 0x8CE4 -#define GL_COLOR_ATTACHMENT5_NV 0x8CE5 -#define GL_COLOR_ATTACHMENT6_NV 0x8CE6 -#define GL_COLOR_ATTACHMENT7_NV 0x8CE7 -#define GL_COLOR_ATTACHMENT8_NV 0x8CE8 -#define GL_COLOR_ATTACHMENT9_NV 0x8CE9 -#define GL_COLOR_ATTACHMENT10_NV 0x8CEA -#define GL_COLOR_ATTACHMENT11_NV 0x8CEB -#define GL_COLOR_ATTACHMENT12_NV 0x8CEC -#define GL_COLOR_ATTACHMENT13_NV 0x8CED -#define GL_COLOR_ATTACHMENT14_NV 0x8CEE -#define GL_COLOR_ATTACHMENT15_NV 0x8CEF -typedef void (APIENTRYP pfn_glDrawBuffersNV) (GLsizei, const GLenum*); -extern pfn_glDrawBuffersNV fp_glDrawBuffersNV; - - /* GL_NV_draw_instanced */ -extern GLboolean GLAD_NV_draw_instanced; -typedef void (APIENTRYP pfn_glDrawArraysInstancedNV) (GLenum, GLint, GLsizei, GLsizei); -extern pfn_glDrawArraysInstancedNV fp_glDrawArraysInstancedNV; -typedef void (APIENTRYP pfn_glDrawElementsInstancedNV) (GLenum, GLsizei, GLenum, const void*, GLsizei); -extern pfn_glDrawElementsInstancedNV fp_glDrawElementsInstancedNV; - - /* GL_NV_draw_texture */ -extern GLboolean GLAD_NV_draw_texture; -typedef void (APIENTRYP pfn_glDrawTextureNV) (GLuint, GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -extern pfn_glDrawTextureNV fp_glDrawTextureNV; - - /* GL_NV_explicit_attrib_location */ -extern GLboolean GLAD_NV_explicit_attrib_location; - - /* GL_NV_explicit_multisample */ -extern GLboolean GLAD_NV_explicit_multisample; -#define GL_SAMPLE_POSITION_NV 0x8E50 -#define GL_SAMPLE_MASK_NV 0x8E51 -#define GL_SAMPLE_MASK_VALUE_NV 0x8E52 -#define GL_TEXTURE_BINDING_RENDERBUFFER_NV 0x8E53 -#define GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV 0x8E54 -#define GL_TEXTURE_RENDERBUFFER_NV 0x8E55 -#define GL_SAMPLER_RENDERBUFFER_NV 0x8E56 -#define GL_INT_SAMPLER_RENDERBUFFER_NV 0x8E57 -#define GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV 0x8E58 -#define GL_MAX_SAMPLE_MASK_WORDS_NV 0x8E59 -typedef void (APIENTRYP pfn_glGetMultisamplefvNV) (GLenum, GLuint, GLfloat*); -extern pfn_glGetMultisamplefvNV fp_glGetMultisamplefvNV; -typedef void (APIENTRYP pfn_glSampleMaskIndexedNV) (GLuint, GLbitfield); -extern pfn_glSampleMaskIndexedNV fp_glSampleMaskIndexedNV; -typedef void (APIENTRYP pfn_glTexRenderbufferNV) (GLenum, GLuint); -extern pfn_glTexRenderbufferNV fp_glTexRenderbufferNV; - - /* GL_NV_fbo_color_attachments */ -extern GLboolean GLAD_NV_fbo_color_attachments; -#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF - - /* GL_NV_fence */ -extern GLboolean GLAD_NV_fence; -#define GL_ALL_COMPLETED_NV 0x84F2 -#define GL_FENCE_STATUS_NV 0x84F3 -#define GL_FENCE_CONDITION_NV 0x84F4 -typedef void (APIENTRYP pfn_glDeleteFencesNV) (GLsizei, const GLuint*); -extern pfn_glDeleteFencesNV fp_glDeleteFencesNV; -typedef void (APIENTRYP pfn_glGenFencesNV) (GLsizei, GLuint*); -extern pfn_glGenFencesNV fp_glGenFencesNV; -typedef GLboolean (APIENTRYP pfn_glIsFenceNV) (GLuint); -extern pfn_glIsFenceNV fp_glIsFenceNV; -typedef GLboolean (APIENTRYP pfn_glTestFenceNV) (GLuint); -extern pfn_glTestFenceNV fp_glTestFenceNV; -typedef void (APIENTRYP pfn_glGetFenceivNV) (GLuint, GLenum, GLint*); -extern pfn_glGetFenceivNV fp_glGetFenceivNV; -typedef void (APIENTRYP pfn_glFinishFenceNV) (GLuint); -extern pfn_glFinishFenceNV fp_glFinishFenceNV; -typedef void (APIENTRYP pfn_glSetFenceNV) (GLuint, GLenum); -extern pfn_glSetFenceNV fp_glSetFenceNV; - - /* GL_NV_fill_rectangle */ -extern GLboolean GLAD_NV_fill_rectangle; -#define GL_FILL_RECTANGLE_NV 0x933C - - /* GL_NV_float_buffer */ -extern GLboolean GLAD_NV_float_buffer; -#define GL_FLOAT_R_NV 0x8880 -#define GL_FLOAT_RG_NV 0x8881 -#define GL_FLOAT_RGB_NV 0x8882 -#define GL_FLOAT_RGBA_NV 0x8883 -#define GL_FLOAT_R16_NV 0x8884 -#define GL_FLOAT_R32_NV 0x8885 -#define GL_FLOAT_RG16_NV 0x8886 -#define GL_FLOAT_RG32_NV 0x8887 -#define GL_FLOAT_RGB16_NV 0x8888 -#define GL_FLOAT_RGB32_NV 0x8889 -#define GL_FLOAT_RGBA16_NV 0x888A -#define GL_FLOAT_RGBA32_NV 0x888B -#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C -#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D -#define GL_FLOAT_RGBA_MODE_NV 0x888E - - /* GL_NV_fragment_coverage_to_color */ -extern GLboolean GLAD_NV_fragment_coverage_to_color; -#define GL_FRAGMENT_COVERAGE_TO_COLOR_NV 0x92DD -#define GL_FRAGMENT_COVERAGE_COLOR_NV 0x92DE -typedef void (APIENTRYP pfn_glFragmentCoverageColorNV) (GLuint); -extern pfn_glFragmentCoverageColorNV fp_glFragmentCoverageColorNV; - - /* GL_NV_fragment_program4 */ -extern GLboolean GLAD_NV_fragment_program4; - - /* GL_NV_fragment_shader_interlock */ -extern GLboolean GLAD_NV_fragment_shader_interlock; - - /* GL_NV_framebuffer_blit */ -extern GLboolean GLAD_NV_framebuffer_blit; -#define GL_READ_FRAMEBUFFER_NV 0x8CA8 -#define GL_DRAW_FRAMEBUFFER_NV 0x8CA9 -#define GL_DRAW_FRAMEBUFFER_BINDING_NV 0x8CA6 -#define GL_READ_FRAMEBUFFER_BINDING_NV 0x8CAA -typedef void (APIENTRYP pfn_glBlitFramebufferNV) (GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum); -extern pfn_glBlitFramebufferNV fp_glBlitFramebufferNV; - - /* GL_NV_framebuffer_mixed_samples */ -extern GLboolean GLAD_NV_framebuffer_mixed_samples; -#define GL_COVERAGE_MODULATION_TABLE_NV 0x9331 -#define GL_COLOR_SAMPLES_NV 0x8E20 -#define GL_DEPTH_SAMPLES_NV 0x932D -#define GL_STENCIL_SAMPLES_NV 0x932E -#define GL_MIXED_DEPTH_SAMPLES_SUPPORTED_NV 0x932F -#define GL_MIXED_STENCIL_SAMPLES_SUPPORTED_NV 0x9330 -#define GL_COVERAGE_MODULATION_NV 0x9332 -#define GL_COVERAGE_MODULATION_TABLE_SIZE_NV 0x9333 -typedef void (APIENTRYP pfn_glCoverageModulationTableNV) (GLsizei, const GLfloat*); -extern pfn_glCoverageModulationTableNV fp_glCoverageModulationTableNV; -typedef void (APIENTRYP pfn_glGetCoverageModulationTableNV) (GLsizei, GLfloat*); -extern pfn_glGetCoverageModulationTableNV fp_glGetCoverageModulationTableNV; -typedef void (APIENTRYP pfn_glCoverageModulationNV) (GLenum); -extern pfn_glCoverageModulationNV fp_glCoverageModulationNV; - - /* GL_NV_framebuffer_multisample */ -extern GLboolean GLAD_NV_framebuffer_multisample; -#define GL_RENDERBUFFER_SAMPLES_NV 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV 0x8D56 -#define GL_MAX_SAMPLES_NV 0x8D57 -typedef void (APIENTRYP pfn_glRenderbufferStorageMultisampleNV) (GLenum, GLsizei, GLenum, GLsizei, GLsizei); -extern pfn_glRenderbufferStorageMultisampleNV fp_glRenderbufferStorageMultisampleNV; - - /* GL_NV_framebuffer_multisample_coverage */ -extern GLboolean GLAD_NV_framebuffer_multisample_coverage; -#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB -#define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10 -#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11 -#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12 -typedef void (APIENTRYP pfn_glRenderbufferStorageMultisampleCoverageNV) (GLenum, GLsizei, GLsizei, GLenum, GLsizei, GLsizei); -extern pfn_glRenderbufferStorageMultisampleCoverageNV fp_glRenderbufferStorageMultisampleCoverageNV; - - /* GL_NV_generate_mipmap_sRGB */ -extern GLboolean GLAD_NV_generate_mipmap_sRGB; - - /* GL_NV_geometry_program4 */ -extern GLboolean GLAD_NV_geometry_program4; -#define GL_GEOMETRY_PROGRAM_NV 0x8C26 -#define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27 -#define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28 -typedef void (APIENTRYP pfn_glProgramVertexLimitNV) (GLenum, GLint); -extern pfn_glProgramVertexLimitNV fp_glProgramVertexLimitNV; -typedef void (APIENTRYP pfn_glFramebufferTextureFaceEXT) (GLenum, GLenum, GLuint, GLint, GLenum); -extern pfn_glFramebufferTextureFaceEXT fp_glFramebufferTextureFaceEXT; - - /* GL_NV_geometry_shader4 */ -extern GLboolean GLAD_NV_geometry_shader4; - - /* GL_NV_geometry_shader_passthrough */ -extern GLboolean GLAD_NV_geometry_shader_passthrough; - - /* GL_NV_gpu_program4 */ -extern GLboolean GLAD_NV_gpu_program4; -#define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904 -#define GL_MAX_PROGRAM_TEXEL_OFFSET_NV 0x8905 -#define GL_PROGRAM_ATTRIB_COMPONENTS_NV 0x8906 -#define GL_PROGRAM_RESULT_COMPONENTS_NV 0x8907 -#define GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV 0x8908 -#define GL_MAX_PROGRAM_RESULT_COMPONENTS_NV 0x8909 -#define GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV 0x8DA5 -#define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6 -typedef void (APIENTRYP pfn_glProgramLocalParameterI4iNV) (GLenum, GLuint, GLint, GLint, GLint, GLint); -extern pfn_glProgramLocalParameterI4iNV fp_glProgramLocalParameterI4iNV; -typedef void (APIENTRYP pfn_glProgramLocalParameterI4ivNV) (GLenum, GLuint, const GLint*); -extern pfn_glProgramLocalParameterI4ivNV fp_glProgramLocalParameterI4ivNV; -typedef void (APIENTRYP pfn_glProgramLocalParametersI4ivNV) (GLenum, GLuint, GLsizei, const GLint*); -extern pfn_glProgramLocalParametersI4ivNV fp_glProgramLocalParametersI4ivNV; -typedef void (APIENTRYP pfn_glProgramLocalParameterI4uiNV) (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint); -extern pfn_glProgramLocalParameterI4uiNV fp_glProgramLocalParameterI4uiNV; -typedef void (APIENTRYP pfn_glProgramLocalParameterI4uivNV) (GLenum, GLuint, const GLuint*); -extern pfn_glProgramLocalParameterI4uivNV fp_glProgramLocalParameterI4uivNV; -typedef void (APIENTRYP pfn_glProgramLocalParametersI4uivNV) (GLenum, GLuint, GLsizei, const GLuint*); -extern pfn_glProgramLocalParametersI4uivNV fp_glProgramLocalParametersI4uivNV; -typedef void (APIENTRYP pfn_glProgramEnvParameterI4iNV) (GLenum, GLuint, GLint, GLint, GLint, GLint); -extern pfn_glProgramEnvParameterI4iNV fp_glProgramEnvParameterI4iNV; -typedef void (APIENTRYP pfn_glProgramEnvParameterI4ivNV) (GLenum, GLuint, const GLint*); -extern pfn_glProgramEnvParameterI4ivNV fp_glProgramEnvParameterI4ivNV; -typedef void (APIENTRYP pfn_glProgramEnvParametersI4ivNV) (GLenum, GLuint, GLsizei, const GLint*); -extern pfn_glProgramEnvParametersI4ivNV fp_glProgramEnvParametersI4ivNV; -typedef void (APIENTRYP pfn_glProgramEnvParameterI4uiNV) (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint); -extern pfn_glProgramEnvParameterI4uiNV fp_glProgramEnvParameterI4uiNV; -typedef void (APIENTRYP pfn_glProgramEnvParameterI4uivNV) (GLenum, GLuint, const GLuint*); -extern pfn_glProgramEnvParameterI4uivNV fp_glProgramEnvParameterI4uivNV; -typedef void (APIENTRYP pfn_glProgramEnvParametersI4uivNV) (GLenum, GLuint, GLsizei, const GLuint*); -extern pfn_glProgramEnvParametersI4uivNV fp_glProgramEnvParametersI4uivNV; -typedef void (APIENTRYP pfn_glGetProgramLocalParameterIivNV) (GLenum, GLuint, GLint*); -extern pfn_glGetProgramLocalParameterIivNV fp_glGetProgramLocalParameterIivNV; -typedef void (APIENTRYP pfn_glGetProgramLocalParameterIuivNV) (GLenum, GLuint, GLuint*); -extern pfn_glGetProgramLocalParameterIuivNV fp_glGetProgramLocalParameterIuivNV; -typedef void (APIENTRYP pfn_glGetProgramEnvParameterIivNV) (GLenum, GLuint, GLint*); -extern pfn_glGetProgramEnvParameterIivNV fp_glGetProgramEnvParameterIivNV; -typedef void (APIENTRYP pfn_glGetProgramEnvParameterIuivNV) (GLenum, GLuint, GLuint*); -extern pfn_glGetProgramEnvParameterIuivNV fp_glGetProgramEnvParameterIuivNV; - - /* GL_NV_gpu_program5 */ -extern GLboolean GLAD_NV_gpu_program5; -#define GL_MAX_GEOMETRY_PROGRAM_INVOCATIONS_NV 0x8E5A -#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5B -#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5C -#define GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV 0x8E5D -#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5E -#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5F -#define GL_MAX_PROGRAM_SUBROUTINE_PARAMETERS_NV 0x8F44 -#define GL_MAX_PROGRAM_SUBROUTINE_NUM_NV 0x8F45 -typedef void (APIENTRYP pfn_glProgramSubroutineParametersuivNV) (GLenum, GLsizei, const GLuint*); -extern pfn_glProgramSubroutineParametersuivNV fp_glProgramSubroutineParametersuivNV; -typedef void (APIENTRYP pfn_glGetProgramSubroutineParameteruivNV) (GLenum, GLuint, GLuint*); -extern pfn_glGetProgramSubroutineParameteruivNV fp_glGetProgramSubroutineParameteruivNV; - - /* GL_NV_gpu_program5_mem_extended */ -extern GLboolean GLAD_NV_gpu_program5_mem_extended; - - /* GL_NV_gpu_shader5 */ -extern GLboolean GLAD_NV_gpu_shader5; - - /* GL_NV_half_float */ -extern GLboolean GLAD_NV_half_float; -#define GL_HALF_FLOAT_NV 0x140B -typedef void (APIENTRYP pfn_glVertex2hNV) (GLhalfNV, GLhalfNV); -extern pfn_glVertex2hNV fp_glVertex2hNV; -typedef void (APIENTRYP pfn_glVertex2hvNV) (const GLhalfNV*); -extern pfn_glVertex2hvNV fp_glVertex2hvNV; -typedef void (APIENTRYP pfn_glVertex3hNV) (GLhalfNV, GLhalfNV, GLhalfNV); -extern pfn_glVertex3hNV fp_glVertex3hNV; -typedef void (APIENTRYP pfn_glVertex3hvNV) (const GLhalfNV*); -extern pfn_glVertex3hvNV fp_glVertex3hvNV; -typedef void (APIENTRYP pfn_glVertex4hNV) (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); -extern pfn_glVertex4hNV fp_glVertex4hNV; -typedef void (APIENTRYP pfn_glVertex4hvNV) (const GLhalfNV*); -extern pfn_glVertex4hvNV fp_glVertex4hvNV; -typedef void (APIENTRYP pfn_glNormal3hNV) (GLhalfNV, GLhalfNV, GLhalfNV); -extern pfn_glNormal3hNV fp_glNormal3hNV; -typedef void (APIENTRYP pfn_glNormal3hvNV) (const GLhalfNV*); -extern pfn_glNormal3hvNV fp_glNormal3hvNV; -typedef void (APIENTRYP pfn_glColor3hNV) (GLhalfNV, GLhalfNV, GLhalfNV); -extern pfn_glColor3hNV fp_glColor3hNV; -typedef void (APIENTRYP pfn_glColor3hvNV) (const GLhalfNV*); -extern pfn_glColor3hvNV fp_glColor3hvNV; -typedef void (APIENTRYP pfn_glColor4hNV) (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); -extern pfn_glColor4hNV fp_glColor4hNV; -typedef void (APIENTRYP pfn_glColor4hvNV) (const GLhalfNV*); -extern pfn_glColor4hvNV fp_glColor4hvNV; -typedef void (APIENTRYP pfn_glTexCoord1hNV) (GLhalfNV); -extern pfn_glTexCoord1hNV fp_glTexCoord1hNV; -typedef void (APIENTRYP pfn_glTexCoord1hvNV) (const GLhalfNV*); -extern pfn_glTexCoord1hvNV fp_glTexCoord1hvNV; -typedef void (APIENTRYP pfn_glTexCoord2hNV) (GLhalfNV, GLhalfNV); -extern pfn_glTexCoord2hNV fp_glTexCoord2hNV; -typedef void (APIENTRYP pfn_glTexCoord2hvNV) (const GLhalfNV*); -extern pfn_glTexCoord2hvNV fp_glTexCoord2hvNV; -typedef void (APIENTRYP pfn_glTexCoord3hNV) (GLhalfNV, GLhalfNV, GLhalfNV); -extern pfn_glTexCoord3hNV fp_glTexCoord3hNV; -typedef void (APIENTRYP pfn_glTexCoord3hvNV) (const GLhalfNV*); -extern pfn_glTexCoord3hvNV fp_glTexCoord3hvNV; -typedef void (APIENTRYP pfn_glTexCoord4hNV) (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); -extern pfn_glTexCoord4hNV fp_glTexCoord4hNV; -typedef void (APIENTRYP pfn_glTexCoord4hvNV) (const GLhalfNV*); -extern pfn_glTexCoord4hvNV fp_glTexCoord4hvNV; -typedef void (APIENTRYP pfn_glMultiTexCoord1hNV) (GLenum, GLhalfNV); -extern pfn_glMultiTexCoord1hNV fp_glMultiTexCoord1hNV; -typedef void (APIENTRYP pfn_glMultiTexCoord1hvNV) (GLenum, const GLhalfNV*); -extern pfn_glMultiTexCoord1hvNV fp_glMultiTexCoord1hvNV; -typedef void (APIENTRYP pfn_glMultiTexCoord2hNV) (GLenum, GLhalfNV, GLhalfNV); -extern pfn_glMultiTexCoord2hNV fp_glMultiTexCoord2hNV; -typedef void (APIENTRYP pfn_glMultiTexCoord2hvNV) (GLenum, const GLhalfNV*); -extern pfn_glMultiTexCoord2hvNV fp_glMultiTexCoord2hvNV; -typedef void (APIENTRYP pfn_glMultiTexCoord3hNV) (GLenum, GLhalfNV, GLhalfNV, GLhalfNV); -extern pfn_glMultiTexCoord3hNV fp_glMultiTexCoord3hNV; -typedef void (APIENTRYP pfn_glMultiTexCoord3hvNV) (GLenum, const GLhalfNV*); -extern pfn_glMultiTexCoord3hvNV fp_glMultiTexCoord3hvNV; -typedef void (APIENTRYP pfn_glMultiTexCoord4hNV) (GLenum, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); -extern pfn_glMultiTexCoord4hNV fp_glMultiTexCoord4hNV; -typedef void (APIENTRYP pfn_glMultiTexCoord4hvNV) (GLenum, const GLhalfNV*); -extern pfn_glMultiTexCoord4hvNV fp_glMultiTexCoord4hvNV; -typedef void (APIENTRYP pfn_glFogCoordhNV) (GLhalfNV); -extern pfn_glFogCoordhNV fp_glFogCoordhNV; -typedef void (APIENTRYP pfn_glFogCoordhvNV) (const GLhalfNV*); -extern pfn_glFogCoordhvNV fp_glFogCoordhvNV; -typedef void (APIENTRYP pfn_glSecondaryColor3hNV) (GLhalfNV, GLhalfNV, GLhalfNV); -extern pfn_glSecondaryColor3hNV fp_glSecondaryColor3hNV; -typedef void (APIENTRYP pfn_glSecondaryColor3hvNV) (const GLhalfNV*); -extern pfn_glSecondaryColor3hvNV fp_glSecondaryColor3hvNV; -typedef void (APIENTRYP pfn_glVertexWeighthNV) (GLhalfNV); -extern pfn_glVertexWeighthNV fp_glVertexWeighthNV; -typedef void (APIENTRYP pfn_glVertexWeighthvNV) (const GLhalfNV*); -extern pfn_glVertexWeighthvNV fp_glVertexWeighthvNV; -typedef void (APIENTRYP pfn_glVertexAttrib1hNV) (GLuint, GLhalfNV); -extern pfn_glVertexAttrib1hNV fp_glVertexAttrib1hNV; -typedef void (APIENTRYP pfn_glVertexAttrib1hvNV) (GLuint, const GLhalfNV*); -extern pfn_glVertexAttrib1hvNV fp_glVertexAttrib1hvNV; -typedef void (APIENTRYP pfn_glVertexAttrib2hNV) (GLuint, GLhalfNV, GLhalfNV); -extern pfn_glVertexAttrib2hNV fp_glVertexAttrib2hNV; -typedef void (APIENTRYP pfn_glVertexAttrib2hvNV) (GLuint, const GLhalfNV*); -extern pfn_glVertexAttrib2hvNV fp_glVertexAttrib2hvNV; -typedef void (APIENTRYP pfn_glVertexAttrib3hNV) (GLuint, GLhalfNV, GLhalfNV, GLhalfNV); -extern pfn_glVertexAttrib3hNV fp_glVertexAttrib3hNV; -typedef void (APIENTRYP pfn_glVertexAttrib3hvNV) (GLuint, const GLhalfNV*); -extern pfn_glVertexAttrib3hvNV fp_glVertexAttrib3hvNV; -typedef void (APIENTRYP pfn_glVertexAttrib4hNV) (GLuint, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); -extern pfn_glVertexAttrib4hNV fp_glVertexAttrib4hNV; -typedef void (APIENTRYP pfn_glVertexAttrib4hvNV) (GLuint, const GLhalfNV*); -extern pfn_glVertexAttrib4hvNV fp_glVertexAttrib4hvNV; -typedef void (APIENTRYP pfn_glVertexAttribs1hvNV) (GLuint, GLsizei, const GLhalfNV*); -extern pfn_glVertexAttribs1hvNV fp_glVertexAttribs1hvNV; -typedef void (APIENTRYP pfn_glVertexAttribs2hvNV) (GLuint, GLsizei, const GLhalfNV*); -extern pfn_glVertexAttribs2hvNV fp_glVertexAttribs2hvNV; -typedef void (APIENTRYP pfn_glVertexAttribs3hvNV) (GLuint, GLsizei, const GLhalfNV*); -extern pfn_glVertexAttribs3hvNV fp_glVertexAttribs3hvNV; -typedef void (APIENTRYP pfn_glVertexAttribs4hvNV) (GLuint, GLsizei, const GLhalfNV*); -extern pfn_glVertexAttribs4hvNV fp_glVertexAttribs4hvNV; - - /* GL_NV_image_formats */ -extern GLboolean GLAD_NV_image_formats; - - /* GL_NV_instanced_arrays */ -extern GLboolean GLAD_NV_instanced_arrays; -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV 0x88FE -typedef void (APIENTRYP pfn_glVertexAttribDivisorNV) (GLuint, GLuint); -extern pfn_glVertexAttribDivisorNV fp_glVertexAttribDivisorNV; - - /* GL_NV_internalformat_sample_query */ -extern GLboolean GLAD_NV_internalformat_sample_query; -#define GL_MULTISAMPLES_NV 0x9371 -#define GL_SUPERSAMPLE_SCALE_X_NV 0x9372 -#define GL_SUPERSAMPLE_SCALE_Y_NV 0x9373 -#define GL_CONFORMANT_NV 0x9374 -typedef void (APIENTRYP pfn_glGetInternalformatSampleivNV) (GLenum, GLenum, GLsizei, GLenum, GLsizei, GLint*); -extern pfn_glGetInternalformatSampleivNV fp_glGetInternalformatSampleivNV; - - /* GL_NV_multisample_coverage */ -extern GLboolean GLAD_NV_multisample_coverage; -#define GL_SAMPLES_ARB 0x80A9 - - /* GL_NV_non_square_matrices */ -extern GLboolean GLAD_NV_non_square_matrices; -#define GL_FLOAT_MAT2x3_NV 0x8B65 -#define GL_FLOAT_MAT2x4_NV 0x8B66 -#define GL_FLOAT_MAT3x2_NV 0x8B67 -#define GL_FLOAT_MAT3x4_NV 0x8B68 -#define GL_FLOAT_MAT4x2_NV 0x8B69 -#define GL_FLOAT_MAT4x3_NV 0x8B6A -typedef void (APIENTRYP pfn_glUniformMatrix2x3fvNV) (GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glUniformMatrix2x3fvNV fp_glUniformMatrix2x3fvNV; -typedef void (APIENTRYP pfn_glUniformMatrix3x2fvNV) (GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glUniformMatrix3x2fvNV fp_glUniformMatrix3x2fvNV; -typedef void (APIENTRYP pfn_glUniformMatrix2x4fvNV) (GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glUniformMatrix2x4fvNV fp_glUniformMatrix2x4fvNV; -typedef void (APIENTRYP pfn_glUniformMatrix4x2fvNV) (GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glUniformMatrix4x2fvNV fp_glUniformMatrix4x2fvNV; -typedef void (APIENTRYP pfn_glUniformMatrix3x4fvNV) (GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glUniformMatrix3x4fvNV fp_glUniformMatrix3x4fvNV; -typedef void (APIENTRYP pfn_glUniformMatrix4x3fvNV) (GLint, GLsizei, GLboolean, const GLfloat*); -extern pfn_glUniformMatrix4x3fvNV fp_glUniformMatrix4x3fvNV; - - /* GL_NV_occlusion_query */ -extern GLboolean GLAD_NV_occlusion_query; -#define GL_PIXEL_COUNTER_BITS_NV 0x8864 -#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 -#define GL_PIXEL_COUNT_NV 0x8866 -#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 -typedef void (APIENTRYP pfn_glGenOcclusionQueriesNV) (GLsizei, GLuint*); -extern pfn_glGenOcclusionQueriesNV fp_glGenOcclusionQueriesNV; -typedef void (APIENTRYP pfn_glDeleteOcclusionQueriesNV) (GLsizei, const GLuint*); -extern pfn_glDeleteOcclusionQueriesNV fp_glDeleteOcclusionQueriesNV; -typedef GLboolean (APIENTRYP pfn_glIsOcclusionQueryNV) (GLuint); -extern pfn_glIsOcclusionQueryNV fp_glIsOcclusionQueryNV; -typedef void (APIENTRYP pfn_glBeginOcclusionQueryNV) (GLuint); -extern pfn_glBeginOcclusionQueryNV fp_glBeginOcclusionQueryNV; -typedef void (APIENTRYP pfn_glEndOcclusionQueryNV) (); -extern pfn_glEndOcclusionQueryNV fp_glEndOcclusionQueryNV; -typedef void (APIENTRYP pfn_glGetOcclusionQueryivNV) (GLuint, GLenum, GLint*); -extern pfn_glGetOcclusionQueryivNV fp_glGetOcclusionQueryivNV; -typedef void (APIENTRYP pfn_glGetOcclusionQueryuivNV) (GLuint, GLenum, GLuint*); -extern pfn_glGetOcclusionQueryuivNV fp_glGetOcclusionQueryuivNV; - - /* GL_NV_parameter_buffer_object */ -extern GLboolean GLAD_NV_parameter_buffer_object; -#define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0 -#define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1 -#define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2 -#define GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV 0x8DA3 -#define GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV 0x8DA4 -typedef void (APIENTRYP pfn_glProgramBufferParametersfvNV) (GLenum, GLuint, GLuint, GLsizei, const GLfloat*); -extern pfn_glProgramBufferParametersfvNV fp_glProgramBufferParametersfvNV; -typedef void (APIENTRYP pfn_glProgramBufferParametersIivNV) (GLenum, GLuint, GLuint, GLsizei, const GLint*); -extern pfn_glProgramBufferParametersIivNV fp_glProgramBufferParametersIivNV; -typedef void (APIENTRYP pfn_glProgramBufferParametersIuivNV) (GLenum, GLuint, GLuint, GLsizei, const GLuint*); -extern pfn_glProgramBufferParametersIuivNV fp_glProgramBufferParametersIuivNV; - - /* GL_NV_parameter_buffer_object2 */ -extern GLboolean GLAD_NV_parameter_buffer_object2; - - /* GL_NV_path_rendering */ -extern GLboolean GLAD_NV_path_rendering; -#define GL_PATH_FORMAT_SVG_NV 0x9070 -#define GL_PATH_FORMAT_PS_NV 0x9071 -#define GL_STANDARD_FONT_NAME_NV 0x9072 -#define GL_SYSTEM_FONT_NAME_NV 0x9073 -#define GL_FILE_NAME_NV 0x9074 -#define GL_PATH_STROKE_WIDTH_NV 0x9075 -#define GL_PATH_END_CAPS_NV 0x9076 -#define GL_PATH_INITIAL_END_CAP_NV 0x9077 -#define GL_PATH_TERMINAL_END_CAP_NV 0x9078 -#define GL_PATH_JOIN_STYLE_NV 0x9079 -#define GL_PATH_MITER_LIMIT_NV 0x907A -#define GL_PATH_DASH_CAPS_NV 0x907B -#define GL_PATH_INITIAL_DASH_CAP_NV 0x907C -#define GL_PATH_TERMINAL_DASH_CAP_NV 0x907D -#define GL_PATH_DASH_OFFSET_NV 0x907E -#define GL_PATH_CLIENT_LENGTH_NV 0x907F -#define GL_PATH_FILL_MODE_NV 0x9080 -#define GL_PATH_FILL_MASK_NV 0x9081 -#define GL_PATH_FILL_COVER_MODE_NV 0x9082 -#define GL_PATH_STROKE_COVER_MODE_NV 0x9083 -#define GL_PATH_STROKE_MASK_NV 0x9084 -#define GL_COUNT_UP_NV 0x9088 -#define GL_COUNT_DOWN_NV 0x9089 -#define GL_PATH_OBJECT_BOUNDING_BOX_NV 0x908A -#define GL_CONVEX_HULL_NV 0x908B -#define GL_BOUNDING_BOX_NV 0x908D -#define GL_TRANSLATE_X_NV 0x908E -#define GL_TRANSLATE_Y_NV 0x908F -#define GL_TRANSLATE_2D_NV 0x9090 -#define GL_TRANSLATE_3D_NV 0x9091 -#define GL_AFFINE_2D_NV 0x9092 -#define GL_AFFINE_3D_NV 0x9094 -#define GL_TRANSPOSE_AFFINE_2D_NV 0x9096 -#define GL_TRANSPOSE_AFFINE_3D_NV 0x9098 -#define GL_UTF8_NV 0x909A -#define GL_UTF16_NV 0x909B -#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C -#define GL_PATH_COMMAND_COUNT_NV 0x909D -#define GL_PATH_COORD_COUNT_NV 0x909E -#define GL_PATH_DASH_ARRAY_COUNT_NV 0x909F -#define GL_PATH_COMPUTED_LENGTH_NV 0x90A0 -#define GL_PATH_FILL_BOUNDING_BOX_NV 0x90A1 -#define GL_PATH_STROKE_BOUNDING_BOX_NV 0x90A2 -#define GL_SQUARE_NV 0x90A3 -#define GL_ROUND_NV 0x90A4 -#define GL_TRIANGULAR_NV 0x90A5 -#define GL_BEVEL_NV 0x90A6 -#define GL_MITER_REVERT_NV 0x90A7 -#define GL_MITER_TRUNCATE_NV 0x90A8 -#define GL_SKIP_MISSING_GLYPH_NV 0x90A9 -#define GL_USE_MISSING_GLYPH_NV 0x90AA -#define GL_PATH_ERROR_POSITION_NV 0x90AB -#define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD -#define GL_ADJACENT_PAIRS_NV 0x90AE -#define GL_FIRST_TO_REST_NV 0x90AF -#define GL_PATH_GEN_MODE_NV 0x90B0 -#define GL_PATH_GEN_COEFF_NV 0x90B1 -#define GL_PATH_GEN_COMPONENTS_NV 0x90B3 -#define GL_PATH_STENCIL_FUNC_NV 0x90B7 -#define GL_PATH_STENCIL_REF_NV 0x90B8 -#define GL_PATH_STENCIL_VALUE_MASK_NV 0x90B9 -#define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD -#define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE -#define GL_PATH_COVER_DEPTH_FUNC_NV 0x90BF -#define GL_PATH_DASH_OFFSET_RESET_NV 0x90B4 -#define GL_MOVE_TO_RESETS_NV 0x90B5 -#define GL_MOVE_TO_CONTINUES_NV 0x90B6 -#define GL_CLOSE_PATH_NV 0x00 -#define GL_MOVE_TO_NV 0x02 -#define GL_RELATIVE_MOVE_TO_NV 0x03 -#define GL_LINE_TO_NV 0x04 -#define GL_RELATIVE_LINE_TO_NV 0x05 -#define GL_HORIZONTAL_LINE_TO_NV 0x06 -#define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07 -#define GL_VERTICAL_LINE_TO_NV 0x08 -#define GL_RELATIVE_VERTICAL_LINE_TO_NV 0x09 -#define GL_QUADRATIC_CURVE_TO_NV 0x0A -#define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B -#define GL_CUBIC_CURVE_TO_NV 0x0C -#define GL_RELATIVE_CUBIC_CURVE_TO_NV 0x0D -#define GL_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0E -#define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F -#define GL_SMOOTH_CUBIC_CURVE_TO_NV 0x10 -#define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11 -#define GL_SMALL_CCW_ARC_TO_NV 0x12 -#define GL_RELATIVE_SMALL_CCW_ARC_TO_NV 0x13 -#define GL_SMALL_CW_ARC_TO_NV 0x14 -#define GL_RELATIVE_SMALL_CW_ARC_TO_NV 0x15 -#define GL_LARGE_CCW_ARC_TO_NV 0x16 -#define GL_RELATIVE_LARGE_CCW_ARC_TO_NV 0x17 -#define GL_LARGE_CW_ARC_TO_NV 0x18 -#define GL_RELATIVE_LARGE_CW_ARC_TO_NV 0x19 -#define GL_RESTART_PATH_NV 0xF0 -#define GL_DUP_FIRST_CUBIC_CURVE_TO_NV 0xF2 -#define GL_DUP_LAST_CUBIC_CURVE_TO_NV 0xF4 -#define GL_RECT_NV 0xF6 -#define GL_CIRCULAR_CCW_ARC_TO_NV 0xF8 -#define GL_CIRCULAR_CW_ARC_TO_NV 0xFA -#define GL_CIRCULAR_TANGENT_ARC_TO_NV 0xFC -#define GL_ARC_TO_NV 0xFE -#define GL_RELATIVE_ARC_TO_NV 0xFF -#define GL_BOLD_BIT_NV 0x01 -#define GL_ITALIC_BIT_NV 0x02 -#define GL_GLYPH_WIDTH_BIT_NV 0x01 -#define GL_GLYPH_HEIGHT_BIT_NV 0x02 -#define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04 -#define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08 -#define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10 -#define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20 -#define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40 -#define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80 -#define GL_GLYPH_HAS_KERNING_BIT_NV 0x100 -#define GL_FONT_X_MIN_BOUNDS_BIT_NV 0x00010000 -#define GL_FONT_Y_MIN_BOUNDS_BIT_NV 0x00020000 -#define GL_FONT_X_MAX_BOUNDS_BIT_NV 0x00040000 -#define GL_FONT_Y_MAX_BOUNDS_BIT_NV 0x00080000 -#define GL_FONT_UNITS_PER_EM_BIT_NV 0x00100000 -#define GL_FONT_ASCENDER_BIT_NV 0x00200000 -#define GL_FONT_DESCENDER_BIT_NV 0x00400000 -#define GL_FONT_HEIGHT_BIT_NV 0x00800000 -#define GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV 0x01000000 -#define GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV 0x02000000 -#define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000 -#define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000 -#define GL_FONT_HAS_KERNING_BIT_NV 0x10000000 -#define GL_ROUNDED_RECT_NV 0xE8 -#define GL_RELATIVE_ROUNDED_RECT_NV 0xE9 -#define GL_ROUNDED_RECT2_NV 0xEA -#define GL_RELATIVE_ROUNDED_RECT2_NV 0xEB -#define GL_ROUNDED_RECT4_NV 0xEC -#define GL_RELATIVE_ROUNDED_RECT4_NV 0xED -#define GL_ROUNDED_RECT8_NV 0xEE -#define GL_RELATIVE_ROUNDED_RECT8_NV 0xEF -#define GL_RELATIVE_RECT_NV 0xF7 -#define GL_FONT_GLYPHS_AVAILABLE_NV 0x9368 -#define GL_FONT_TARGET_UNAVAILABLE_NV 0x9369 -#define GL_FONT_UNAVAILABLE_NV 0x936A -#define GL_FONT_UNINTELLIGIBLE_NV 0x936B -#define GL_CONIC_CURVE_TO_NV 0x1A -#define GL_RELATIVE_CONIC_CURVE_TO_NV 0x1B -#define GL_FONT_NUM_GLYPH_INDICES_BIT_NV 0x20000000 -#define GL_STANDARD_FONT_FORMAT_NV 0x936C -#define GL_2_BYTES_NV 0x1407 -#define GL_3_BYTES_NV 0x1408 -#define GL_4_BYTES_NV 0x1409 -#define GL_EYE_LINEAR_NV 0x2400 -#define GL_OBJECT_LINEAR_NV 0x2401 -#define GL_CONSTANT_NV 0x8576 -#define GL_PATH_FOG_GEN_MODE_NV 0x90AC -#define GL_PRIMARY_COLOR_NV 0x852C -#define GL_SECONDARY_COLOR_NV 0x852D -#define GL_PATH_GEN_COLOR_FORMAT_NV 0x90B2 -#define GL_PATH_PROJECTION_NV 0x1701 -#define GL_PATH_MODELVIEW_NV 0x1700 -#define GL_PATH_MODELVIEW_STACK_DEPTH_NV 0x0BA3 -#define GL_PATH_MODELVIEW_MATRIX_NV 0x0BA6 -#define GL_PATH_MAX_MODELVIEW_STACK_DEPTH_NV 0x0D36 -#define GL_PATH_TRANSPOSE_MODELVIEW_MATRIX_NV 0x84E3 -#define GL_PATH_PROJECTION_STACK_DEPTH_NV 0x0BA4 -#define GL_PATH_PROJECTION_MATRIX_NV 0x0BA7 -#define GL_PATH_MAX_PROJECTION_STACK_DEPTH_NV 0x0D38 -#define GL_PATH_TRANSPOSE_PROJECTION_MATRIX_NV 0x84E4 -#define GL_FRAGMENT_INPUT_NV 0x936D -typedef GLuint (APIENTRYP pfn_glGenPathsNV) (GLsizei); -extern pfn_glGenPathsNV fp_glGenPathsNV; -typedef void (APIENTRYP pfn_glDeletePathsNV) (GLuint, GLsizei); -extern pfn_glDeletePathsNV fp_glDeletePathsNV; -typedef GLboolean (APIENTRYP pfn_glIsPathNV) (GLuint); -extern pfn_glIsPathNV fp_glIsPathNV; -typedef void (APIENTRYP pfn_glPathCommandsNV) (GLuint, GLsizei, const GLubyte*, GLsizei, GLenum, const void*); -extern pfn_glPathCommandsNV fp_glPathCommandsNV; -typedef void (APIENTRYP pfn_glPathCoordsNV) (GLuint, GLsizei, GLenum, const void*); -extern pfn_glPathCoordsNV fp_glPathCoordsNV; -typedef void (APIENTRYP pfn_glPathSubCommandsNV) (GLuint, GLsizei, GLsizei, GLsizei, const GLubyte*, GLsizei, GLenum, const void*); -extern pfn_glPathSubCommandsNV fp_glPathSubCommandsNV; -typedef void (APIENTRYP pfn_glPathSubCoordsNV) (GLuint, GLsizei, GLsizei, GLenum, const void*); -extern pfn_glPathSubCoordsNV fp_glPathSubCoordsNV; -typedef void (APIENTRYP pfn_glPathStringNV) (GLuint, GLenum, GLsizei, const void*); -extern pfn_glPathStringNV fp_glPathStringNV; -typedef void (APIENTRYP pfn_glPathGlyphsNV) (GLuint, GLenum, const void*, GLbitfield, GLsizei, GLenum, const void*, GLenum, GLuint, GLfloat); -extern pfn_glPathGlyphsNV fp_glPathGlyphsNV; -typedef void (APIENTRYP pfn_glPathGlyphRangeNV) (GLuint, GLenum, const void*, GLbitfield, GLuint, GLsizei, GLenum, GLuint, GLfloat); -extern pfn_glPathGlyphRangeNV fp_glPathGlyphRangeNV; -typedef void (APIENTRYP pfn_glWeightPathsNV) (GLuint, GLsizei, const GLuint*, const GLfloat*); -extern pfn_glWeightPathsNV fp_glWeightPathsNV; -typedef void (APIENTRYP pfn_glCopyPathNV) (GLuint, GLuint); -extern pfn_glCopyPathNV fp_glCopyPathNV; -typedef void (APIENTRYP pfn_glInterpolatePathsNV) (GLuint, GLuint, GLuint, GLfloat); -extern pfn_glInterpolatePathsNV fp_glInterpolatePathsNV; -typedef void (APIENTRYP pfn_glTransformPathNV) (GLuint, GLuint, GLenum, const GLfloat*); -extern pfn_glTransformPathNV fp_glTransformPathNV; -typedef void (APIENTRYP pfn_glPathParameterivNV) (GLuint, GLenum, const GLint*); -extern pfn_glPathParameterivNV fp_glPathParameterivNV; -typedef void (APIENTRYP pfn_glPathParameteriNV) (GLuint, GLenum, GLint); -extern pfn_glPathParameteriNV fp_glPathParameteriNV; -typedef void (APIENTRYP pfn_glPathParameterfvNV) (GLuint, GLenum, const GLfloat*); -extern pfn_glPathParameterfvNV fp_glPathParameterfvNV; -typedef void (APIENTRYP pfn_glPathParameterfNV) (GLuint, GLenum, GLfloat); -extern pfn_glPathParameterfNV fp_glPathParameterfNV; -typedef void (APIENTRYP pfn_glPathDashArrayNV) (GLuint, GLsizei, const GLfloat*); -extern pfn_glPathDashArrayNV fp_glPathDashArrayNV; -typedef void (APIENTRYP pfn_glPathStencilFuncNV) (GLenum, GLint, GLuint); -extern pfn_glPathStencilFuncNV fp_glPathStencilFuncNV; -typedef void (APIENTRYP pfn_glPathStencilDepthOffsetNV) (GLfloat, GLfloat); -extern pfn_glPathStencilDepthOffsetNV fp_glPathStencilDepthOffsetNV; -typedef void (APIENTRYP pfn_glStencilFillPathNV) (GLuint, GLenum, GLuint); -extern pfn_glStencilFillPathNV fp_glStencilFillPathNV; -typedef void (APIENTRYP pfn_glStencilStrokePathNV) (GLuint, GLint, GLuint); -extern pfn_glStencilStrokePathNV fp_glStencilStrokePathNV; -typedef void (APIENTRYP pfn_glStencilFillPathInstancedNV) (GLsizei, GLenum, const void*, GLuint, GLenum, GLuint, GLenum, const GLfloat*); -extern pfn_glStencilFillPathInstancedNV fp_glStencilFillPathInstancedNV; -typedef void (APIENTRYP pfn_glStencilStrokePathInstancedNV) (GLsizei, GLenum, const void*, GLuint, GLint, GLuint, GLenum, const GLfloat*); -extern pfn_glStencilStrokePathInstancedNV fp_glStencilStrokePathInstancedNV; -typedef void (APIENTRYP pfn_glPathCoverDepthFuncNV) (GLenum); -extern pfn_glPathCoverDepthFuncNV fp_glPathCoverDepthFuncNV; -typedef void (APIENTRYP pfn_glCoverFillPathNV) (GLuint, GLenum); -extern pfn_glCoverFillPathNV fp_glCoverFillPathNV; -typedef void (APIENTRYP pfn_glCoverStrokePathNV) (GLuint, GLenum); -extern pfn_glCoverStrokePathNV fp_glCoverStrokePathNV; -typedef void (APIENTRYP pfn_glCoverFillPathInstancedNV) (GLsizei, GLenum, const void*, GLuint, GLenum, GLenum, const GLfloat*); -extern pfn_glCoverFillPathInstancedNV fp_glCoverFillPathInstancedNV; -typedef void (APIENTRYP pfn_glCoverStrokePathInstancedNV) (GLsizei, GLenum, const void*, GLuint, GLenum, GLenum, const GLfloat*); -extern pfn_glCoverStrokePathInstancedNV fp_glCoverStrokePathInstancedNV; -typedef void (APIENTRYP pfn_glGetPathParameterivNV) (GLuint, GLenum, GLint*); -extern pfn_glGetPathParameterivNV fp_glGetPathParameterivNV; -typedef void (APIENTRYP pfn_glGetPathParameterfvNV) (GLuint, GLenum, GLfloat*); -extern pfn_glGetPathParameterfvNV fp_glGetPathParameterfvNV; -typedef void (APIENTRYP pfn_glGetPathCommandsNV) (GLuint, GLubyte*); -extern pfn_glGetPathCommandsNV fp_glGetPathCommandsNV; -typedef void (APIENTRYP pfn_glGetPathCoordsNV) (GLuint, GLfloat*); -extern pfn_glGetPathCoordsNV fp_glGetPathCoordsNV; -typedef void (APIENTRYP pfn_glGetPathDashArrayNV) (GLuint, GLfloat*); -extern pfn_glGetPathDashArrayNV fp_glGetPathDashArrayNV; -typedef void (APIENTRYP pfn_glGetPathMetricsNV) (GLbitfield, GLsizei, GLenum, const void*, GLuint, GLsizei, GLfloat*); -extern pfn_glGetPathMetricsNV fp_glGetPathMetricsNV; -typedef void (APIENTRYP pfn_glGetPathMetricRangeNV) (GLbitfield, GLuint, GLsizei, GLsizei, GLfloat*); -extern pfn_glGetPathMetricRangeNV fp_glGetPathMetricRangeNV; -typedef void (APIENTRYP pfn_glGetPathSpacingNV) (GLenum, GLsizei, GLenum, const void*, GLuint, GLfloat, GLfloat, GLenum, GLfloat*); -extern pfn_glGetPathSpacingNV fp_glGetPathSpacingNV; -typedef GLboolean (APIENTRYP pfn_glIsPointInFillPathNV) (GLuint, GLuint, GLfloat, GLfloat); -extern pfn_glIsPointInFillPathNV fp_glIsPointInFillPathNV; -typedef GLboolean (APIENTRYP pfn_glIsPointInStrokePathNV) (GLuint, GLfloat, GLfloat); -extern pfn_glIsPointInStrokePathNV fp_glIsPointInStrokePathNV; -typedef GLfloat (APIENTRYP pfn_glGetPathLengthNV) (GLuint, GLsizei, GLsizei); -extern pfn_glGetPathLengthNV fp_glGetPathLengthNV; -typedef GLboolean (APIENTRYP pfn_glPointAlongPathNV) (GLuint, GLsizei, GLsizei, GLfloat, GLfloat*, GLfloat*, GLfloat*, GLfloat*); -extern pfn_glPointAlongPathNV fp_glPointAlongPathNV; -typedef void (APIENTRYP pfn_glMatrixLoad3x2fNV) (GLenum, const GLfloat*); -extern pfn_glMatrixLoad3x2fNV fp_glMatrixLoad3x2fNV; -typedef void (APIENTRYP pfn_glMatrixLoad3x3fNV) (GLenum, const GLfloat*); -extern pfn_glMatrixLoad3x3fNV fp_glMatrixLoad3x3fNV; -typedef void (APIENTRYP pfn_glMatrixLoadTranspose3x3fNV) (GLenum, const GLfloat*); -extern pfn_glMatrixLoadTranspose3x3fNV fp_glMatrixLoadTranspose3x3fNV; -typedef void (APIENTRYP pfn_glMatrixMult3x2fNV) (GLenum, const GLfloat*); -extern pfn_glMatrixMult3x2fNV fp_glMatrixMult3x2fNV; -typedef void (APIENTRYP pfn_glMatrixMult3x3fNV) (GLenum, const GLfloat*); -extern pfn_glMatrixMult3x3fNV fp_glMatrixMult3x3fNV; -typedef void (APIENTRYP pfn_glMatrixMultTranspose3x3fNV) (GLenum, const GLfloat*); -extern pfn_glMatrixMultTranspose3x3fNV fp_glMatrixMultTranspose3x3fNV; -typedef void (APIENTRYP pfn_glStencilThenCoverFillPathNV) (GLuint, GLenum, GLuint, GLenum); -extern pfn_glStencilThenCoverFillPathNV fp_glStencilThenCoverFillPathNV; -typedef void (APIENTRYP pfn_glStencilThenCoverStrokePathNV) (GLuint, GLint, GLuint, GLenum); -extern pfn_glStencilThenCoverStrokePathNV fp_glStencilThenCoverStrokePathNV; -typedef void (APIENTRYP pfn_glStencilThenCoverFillPathInstancedNV) (GLsizei, GLenum, const void*, GLuint, GLenum, GLuint, GLenum, GLenum, const GLfloat*); -extern pfn_glStencilThenCoverFillPathInstancedNV fp_glStencilThenCoverFillPathInstancedNV; -typedef void (APIENTRYP pfn_glStencilThenCoverStrokePathInstancedNV) (GLsizei, GLenum, const void*, GLuint, GLint, GLuint, GLenum, GLenum, const GLfloat*); -extern pfn_glStencilThenCoverStrokePathInstancedNV fp_glStencilThenCoverStrokePathInstancedNV; -typedef GLenum (APIENTRYP pfn_glPathGlyphIndexRangeNV) (GLenum, const void*, GLbitfield, GLuint, GLfloat, GLuint); -extern pfn_glPathGlyphIndexRangeNV fp_glPathGlyphIndexRangeNV; -typedef GLenum (APIENTRYP pfn_glPathGlyphIndexArrayNV) (GLuint, GLenum, const void*, GLbitfield, GLuint, GLsizei, GLuint, GLfloat); -extern pfn_glPathGlyphIndexArrayNV fp_glPathGlyphIndexArrayNV; -typedef GLenum (APIENTRYP pfn_glPathMemoryGlyphIndexArrayNV) (GLuint, GLenum, GLsizeiptr, const void*, GLsizei, GLuint, GLsizei, GLuint, GLfloat); -extern pfn_glPathMemoryGlyphIndexArrayNV fp_glPathMemoryGlyphIndexArrayNV; -typedef void (APIENTRYP pfn_glProgramPathFragmentInputGenNV) (GLuint, GLint, GLenum, GLint, const GLfloat*); -extern pfn_glProgramPathFragmentInputGenNV fp_glProgramPathFragmentInputGenNV; -typedef void (APIENTRYP pfn_glGetProgramResourcefvNV) (GLuint, GLenum, GLuint, GLsizei, const GLenum*, GLsizei, GLsizei*, GLfloat*); -extern pfn_glGetProgramResourcefvNV fp_glGetProgramResourcefvNV; -typedef void (APIENTRYP pfn_glPathColorGenNV) (GLenum, GLenum, GLenum, const GLfloat*); -extern pfn_glPathColorGenNV fp_glPathColorGenNV; -typedef void (APIENTRYP pfn_glPathTexGenNV) (GLenum, GLenum, GLint, const GLfloat*); -extern pfn_glPathTexGenNV fp_glPathTexGenNV; -typedef void (APIENTRYP pfn_glPathFogGenNV) (GLenum); -extern pfn_glPathFogGenNV fp_glPathFogGenNV; -typedef void (APIENTRYP pfn_glGetPathColorGenivNV) (GLenum, GLenum, GLint*); -extern pfn_glGetPathColorGenivNV fp_glGetPathColorGenivNV; -typedef void (APIENTRYP pfn_glGetPathColorGenfvNV) (GLenum, GLenum, GLfloat*); -extern pfn_glGetPathColorGenfvNV fp_glGetPathColorGenfvNV; -typedef void (APIENTRYP pfn_glGetPathTexGenivNV) (GLenum, GLenum, GLint*); -extern pfn_glGetPathTexGenivNV fp_glGetPathTexGenivNV; -typedef void (APIENTRYP pfn_glGetPathTexGenfvNV) (GLenum, GLenum, GLfloat*); -extern pfn_glGetPathTexGenfvNV fp_glGetPathTexGenfvNV; - - /* GL_NV_path_rendering_shared_edge */ -extern GLboolean GLAD_NV_path_rendering_shared_edge; -#define GL_SHARED_EDGE_NV 0xC0 - - /* GL_NV_polygon_mode */ -extern GLboolean GLAD_NV_polygon_mode; -#define GL_POLYGON_MODE_NV 0x0B40 -#define GL_POLYGON_OFFSET_POINT_NV 0x2A01 -#define GL_POLYGON_OFFSET_LINE_NV 0x2A02 -#define GL_POINT_NV 0x1B00 -#define GL_LINE_NV 0x1B01 -#define GL_FILL_NV 0x1B02 -typedef void (APIENTRYP pfn_glPolygonModeNV) (GLenum, GLenum); -extern pfn_glPolygonModeNV fp_glPolygonModeNV; - - /* GL_NV_present_video */ -extern GLboolean GLAD_NV_present_video; -#define GL_FRAME_NV 0x8E26 -#define GL_FIELDS_NV 0x8E27 -#define GL_CURRENT_TIME_NV 0x8E28 -#define GL_NUM_FILL_STREAMS_NV 0x8E29 -#define GL_PRESENT_TIME_NV 0x8E2A -#define GL_PRESENT_DURATION_NV 0x8E2B -typedef void (APIENTRYP pfn_glPresentFrameKeyedNV) (GLuint, GLuint64EXT, GLuint, GLuint, GLenum, GLenum, GLuint, GLuint, GLenum, GLuint, GLuint); -extern pfn_glPresentFrameKeyedNV fp_glPresentFrameKeyedNV; -typedef void (APIENTRYP pfn_glPresentFrameDualFillNV) (GLuint, GLuint64EXT, GLuint, GLuint, GLenum, GLenum, GLuint, GLenum, GLuint, GLenum, GLuint, GLenum, GLuint); -extern pfn_glPresentFrameDualFillNV fp_glPresentFrameDualFillNV; -typedef void (APIENTRYP pfn_glGetVideoivNV) (GLuint, GLenum, GLint*); -extern pfn_glGetVideoivNV fp_glGetVideoivNV; -typedef void (APIENTRYP pfn_glGetVideouivNV) (GLuint, GLenum, GLuint*); -extern pfn_glGetVideouivNV fp_glGetVideouivNV; -typedef void (APIENTRYP pfn_glGetVideoi64vNV) (GLuint, GLenum, GLint64EXT*); -extern pfn_glGetVideoi64vNV fp_glGetVideoi64vNV; -typedef void (APIENTRYP pfn_glGetVideoui64vNV) (GLuint, GLenum, GLuint64EXT*); -extern pfn_glGetVideoui64vNV fp_glGetVideoui64vNV; - - /* GL_NV_primitive_restart */ -extern GLboolean GLAD_NV_primitive_restart; -#define GL_PRIMITIVE_RESTART_NV 0x8558 -#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 -typedef void (APIENTRYP pfn_glPrimitiveRestartNV) (); -extern pfn_glPrimitiveRestartNV fp_glPrimitiveRestartNV; -typedef void (APIENTRYP pfn_glPrimitiveRestartIndexNV) (GLuint); -extern pfn_glPrimitiveRestartIndexNV fp_glPrimitiveRestartIndexNV; - - /* GL_NV_read_buffer */ -extern GLboolean GLAD_NV_read_buffer; -#define GL_READ_BUFFER_NV 0x0C02 -typedef void (APIENTRYP pfn_glReadBufferNV) (GLenum); -extern pfn_glReadBufferNV fp_glReadBufferNV; - - /* GL_NV_read_buffer_front */ -extern GLboolean GLAD_NV_read_buffer_front; - - /* GL_NV_read_depth */ -extern GLboolean GLAD_NV_read_depth; - - /* GL_NV_read_depth_stencil */ -extern GLboolean GLAD_NV_read_depth_stencil; - - /* GL_NV_read_stencil */ -extern GLboolean GLAD_NV_read_stencil; - - /* GL_NV_sample_locations */ -extern GLboolean GLAD_NV_sample_locations; -#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_NV 0x933D -#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_NV 0x933E -#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_NV 0x933F -#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_NV 0x9340 -#define GL_SAMPLE_LOCATION_NV 0x8E50 -#define GL_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9341 -#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_NV 0x9342 -#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_NV 0x9343 -typedef void (APIENTRYP pfn_glFramebufferSampleLocationsfvNV) (GLenum, GLuint, GLsizei, const GLfloat*); -extern pfn_glFramebufferSampleLocationsfvNV fp_glFramebufferSampleLocationsfvNV; -typedef void (APIENTRYP pfn_glNamedFramebufferSampleLocationsfvNV) (GLuint, GLuint, GLsizei, const GLfloat*); -extern pfn_glNamedFramebufferSampleLocationsfvNV fp_glNamedFramebufferSampleLocationsfvNV; -typedef void (APIENTRYP pfn_glResolveDepthValuesNV) (); -extern pfn_glResolveDepthValuesNV fp_glResolveDepthValuesNV; - - /* GL_NV_sample_mask_override_coverage */ -extern GLboolean GLAD_NV_sample_mask_override_coverage; - - /* GL_NV_shader_atomic_counters */ -extern GLboolean GLAD_NV_shader_atomic_counters; - - /* GL_NV_shader_atomic_float */ -extern GLboolean GLAD_NV_shader_atomic_float; - - /* GL_NV_shader_atomic_fp16_vector */ -extern GLboolean GLAD_NV_shader_atomic_fp16_vector; - - /* GL_NV_shader_atomic_int64 */ -extern GLboolean GLAD_NV_shader_atomic_int64; - - /* GL_NV_shader_buffer_load */ -extern GLboolean GLAD_NV_shader_buffer_load; -#define GL_BUFFER_GPU_ADDRESS_NV 0x8F1D -#define GL_GPU_ADDRESS_NV 0x8F34 -#define GL_MAX_SHADER_BUFFER_ADDRESS_NV 0x8F35 -typedef void (APIENTRYP pfn_glMakeBufferResidentNV) (GLenum, GLenum); -extern pfn_glMakeBufferResidentNV fp_glMakeBufferResidentNV; -typedef void (APIENTRYP pfn_glMakeBufferNonResidentNV) (GLenum); -extern pfn_glMakeBufferNonResidentNV fp_glMakeBufferNonResidentNV; -typedef GLboolean (APIENTRYP pfn_glIsBufferResidentNV) (GLenum); -extern pfn_glIsBufferResidentNV fp_glIsBufferResidentNV; -typedef void (APIENTRYP pfn_glMakeNamedBufferResidentNV) (GLuint, GLenum); -extern pfn_glMakeNamedBufferResidentNV fp_glMakeNamedBufferResidentNV; -typedef void (APIENTRYP pfn_glMakeNamedBufferNonResidentNV) (GLuint); -extern pfn_glMakeNamedBufferNonResidentNV fp_glMakeNamedBufferNonResidentNV; -typedef GLboolean (APIENTRYP pfn_glIsNamedBufferResidentNV) (GLuint); -extern pfn_glIsNamedBufferResidentNV fp_glIsNamedBufferResidentNV; -typedef void (APIENTRYP pfn_glGetBufferParameterui64vNV) (GLenum, GLenum, GLuint64EXT*); -extern pfn_glGetBufferParameterui64vNV fp_glGetBufferParameterui64vNV; -typedef void (APIENTRYP pfn_glGetNamedBufferParameterui64vNV) (GLuint, GLenum, GLuint64EXT*); -extern pfn_glGetNamedBufferParameterui64vNV fp_glGetNamedBufferParameterui64vNV; -typedef void (APIENTRYP pfn_glGetIntegerui64vNV) (GLenum, GLuint64EXT*); -extern pfn_glGetIntegerui64vNV fp_glGetIntegerui64vNV; -typedef void (APIENTRYP pfn_glUniformui64NV) (GLint, GLuint64EXT); -extern pfn_glUniformui64NV fp_glUniformui64NV; -typedef void (APIENTRYP pfn_glUniformui64vNV) (GLint, GLsizei, const GLuint64EXT*); -extern pfn_glUniformui64vNV fp_glUniformui64vNV; -typedef void (APIENTRYP pfn_glProgramUniformui64NV) (GLuint, GLint, GLuint64EXT); -extern pfn_glProgramUniformui64NV fp_glProgramUniformui64NV; -typedef void (APIENTRYP pfn_glProgramUniformui64vNV) (GLuint, GLint, GLsizei, const GLuint64EXT*); -extern pfn_glProgramUniformui64vNV fp_glProgramUniformui64vNV; - - /* GL_NV_shader_buffer_store */ -extern GLboolean GLAD_NV_shader_buffer_store; -#define GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV 0x00000010 - - /* GL_NV_shader_noperspective_interpolation */ -extern GLboolean GLAD_NV_shader_noperspective_interpolation; - - /* GL_NV_shader_storage_buffer_object */ -extern GLboolean GLAD_NV_shader_storage_buffer_object; - - /* GL_NV_shader_thread_group */ -extern GLboolean GLAD_NV_shader_thread_group; -#define GL_WARP_SIZE_NV 0x9339 -#define GL_WARPS_PER_SM_NV 0x933A -#define GL_SM_COUNT_NV 0x933B - - /* GL_NV_shader_thread_shuffle */ -extern GLboolean GLAD_NV_shader_thread_shuffle; - - /* GL_NV_shadow_samplers_array */ -extern GLboolean GLAD_NV_shadow_samplers_array; -#define GL_SAMPLER_2D_ARRAY_SHADOW_NV 0x8DC4 - - /* GL_NV_shadow_samplers_cube */ -extern GLboolean GLAD_NV_shadow_samplers_cube; -#define GL_SAMPLER_CUBE_SHADOW_NV 0x8DC5 - - /* GL_NV_sRGB_formats */ -extern GLboolean GLAD_NV_sRGB_formats; -#define GL_SLUMINANCE_NV 0x8C46 -#define GL_SLUMINANCE_ALPHA_NV 0x8C44 -#define GL_SRGB8_NV 0x8C41 -#define GL_SLUMINANCE8_NV 0x8C47 -#define GL_SLUMINANCE8_ALPHA8_NV 0x8C45 -#define GL_COMPRESSED_SRGB_S3TC_DXT1_NV 0x8C4C -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 0x8C4D -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV 0x8C4E -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV 0x8C4F -#define GL_ETC1_SRGB8_NV 0x88EE - - /* GL_NV_tessellation_program5 */ -extern GLboolean GLAD_NV_tessellation_program5; -#define GL_MAX_PROGRAM_PATCH_ATTRIBS_NV 0x86D8 -#define GL_TESS_CONTROL_PROGRAM_NV 0x891E -#define GL_TESS_EVALUATION_PROGRAM_NV 0x891F -#define GL_TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV 0x8C74 -#define GL_TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV 0x8C75 - - /* GL_NV_texture_barrier */ -extern GLboolean GLAD_NV_texture_barrier; -typedef void (APIENTRYP pfn_glTextureBarrierNV) (); -extern pfn_glTextureBarrierNV fp_glTextureBarrierNV; - - /* GL_NV_texture_border_clamp */ -extern GLboolean GLAD_NV_texture_border_clamp; -#define GL_TEXTURE_BORDER_COLOR_NV 0x1004 -#define GL_CLAMP_TO_BORDER_NV 0x812D - - /* GL_NV_texture_compression_s3tc_update */ -extern GLboolean GLAD_NV_texture_compression_s3tc_update; - - /* GL_NV_texture_multisample */ -extern GLboolean GLAD_NV_texture_multisample; -#define GL_TEXTURE_COVERAGE_SAMPLES_NV 0x9045 -#define GL_TEXTURE_COLOR_SAMPLES_NV 0x9046 -typedef void (APIENTRYP pfn_glTexImage2DMultisampleCoverageNV) (GLenum, GLsizei, GLsizei, GLint, GLsizei, GLsizei, GLboolean); -extern pfn_glTexImage2DMultisampleCoverageNV fp_glTexImage2DMultisampleCoverageNV; -typedef void (APIENTRYP pfn_glTexImage3DMultisampleCoverageNV) (GLenum, GLsizei, GLsizei, GLint, GLsizei, GLsizei, GLsizei, GLboolean); -extern pfn_glTexImage3DMultisampleCoverageNV fp_glTexImage3DMultisampleCoverageNV; -typedef void (APIENTRYP pfn_glTextureImage2DMultisampleNV) (GLuint, GLenum, GLsizei, GLint, GLsizei, GLsizei, GLboolean); -extern pfn_glTextureImage2DMultisampleNV fp_glTextureImage2DMultisampleNV; -typedef void (APIENTRYP pfn_glTextureImage3DMultisampleNV) (GLuint, GLenum, GLsizei, GLint, GLsizei, GLsizei, GLsizei, GLboolean); -extern pfn_glTextureImage3DMultisampleNV fp_glTextureImage3DMultisampleNV; -typedef void (APIENTRYP pfn_glTextureImage2DMultisampleCoverageNV) (GLuint, GLenum, GLsizei, GLsizei, GLint, GLsizei, GLsizei, GLboolean); -extern pfn_glTextureImage2DMultisampleCoverageNV fp_glTextureImage2DMultisampleCoverageNV; -typedef void (APIENTRYP pfn_glTextureImage3DMultisampleCoverageNV) (GLuint, GLenum, GLsizei, GLsizei, GLint, GLsizei, GLsizei, GLsizei, GLboolean); -extern pfn_glTextureImage3DMultisampleCoverageNV fp_glTextureImage3DMultisampleCoverageNV; - - /* GL_NV_texture_npot_2D_mipmap */ -extern GLboolean GLAD_NV_texture_npot_2D_mipmap; - - /* GL_NV_transform_feedback */ -extern GLboolean GLAD_NV_transform_feedback; -#define GL_BACK_PRIMARY_COLOR_NV 0x8C77 -#define GL_BACK_SECONDARY_COLOR_NV 0x8C78 -#define GL_TEXTURE_COORD_NV 0x8C79 -#define GL_CLIP_DISTANCE_NV 0x8C7A -#define GL_VERTEX_ID_NV 0x8C7B -#define GL_PRIMITIVE_ID_NV 0x8C7C -#define GL_GENERIC_ATTRIB_NV 0x8C7D -#define GL_TRANSFORM_FEEDBACK_ATTRIBS_NV 0x8C7E -#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV 0x8C7F -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV 0x8C80 -#define GL_ACTIVE_VARYINGS_NV 0x8C81 -#define GL_ACTIVE_VARYING_MAX_LENGTH_NV 0x8C82 -#define GL_TRANSFORM_FEEDBACK_VARYINGS_NV 0x8C83 -#define GL_TRANSFORM_FEEDBACK_BUFFER_START_NV 0x8C84 -#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV 0x8C85 -#define GL_TRANSFORM_FEEDBACK_RECORD_NV 0x8C86 -#define GL_PRIMITIVES_GENERATED_NV 0x8C87 -#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88 -#define GL_RASTERIZER_DISCARD_NV 0x8C89 -#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_NV 0x8C8A -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B -#define GL_INTERLEAVED_ATTRIBS_NV 0x8C8C -#define GL_SEPARATE_ATTRIBS_NV 0x8C8D -#define GL_TRANSFORM_FEEDBACK_BUFFER_NV 0x8C8E -#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F -#define GL_LAYER_NV 0x8DAA -#define GL_NEXT_BUFFER_NV -2 -#define GL_SKIP_COMPONENTS4_NV -3 -#define GL_SKIP_COMPONENTS3_NV -4 -#define GL_SKIP_COMPONENTS2_NV -5 -#define GL_SKIP_COMPONENTS1_NV -6 -typedef void (APIENTRYP pfn_glBeginTransformFeedbackNV) (GLenum); -extern pfn_glBeginTransformFeedbackNV fp_glBeginTransformFeedbackNV; -typedef void (APIENTRYP pfn_glEndTransformFeedbackNV) (); -extern pfn_glEndTransformFeedbackNV fp_glEndTransformFeedbackNV; -typedef void (APIENTRYP pfn_glTransformFeedbackAttribsNV) (GLsizei, const GLint*, GLenum); -extern pfn_glTransformFeedbackAttribsNV fp_glTransformFeedbackAttribsNV; -typedef void (APIENTRYP pfn_glBindBufferRangeNV) (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr); -extern pfn_glBindBufferRangeNV fp_glBindBufferRangeNV; -typedef void (APIENTRYP pfn_glBindBufferOffsetNV) (GLenum, GLuint, GLuint, GLintptr); -extern pfn_glBindBufferOffsetNV fp_glBindBufferOffsetNV; -typedef void (APIENTRYP pfn_glBindBufferBaseNV) (GLenum, GLuint, GLuint); -extern pfn_glBindBufferBaseNV fp_glBindBufferBaseNV; -typedef void (APIENTRYP pfn_glTransformFeedbackVaryingsNV) (GLuint, GLsizei, const GLint*, GLenum); -extern pfn_glTransformFeedbackVaryingsNV fp_glTransformFeedbackVaryingsNV; -typedef void (APIENTRYP pfn_glActiveVaryingNV) (GLuint, const GLchar*); -extern pfn_glActiveVaryingNV fp_glActiveVaryingNV; -typedef GLint (APIENTRYP pfn_glGetVaryingLocationNV) (GLuint, const GLchar*); -extern pfn_glGetVaryingLocationNV fp_glGetVaryingLocationNV; -typedef void (APIENTRYP pfn_glGetActiveVaryingNV) (GLuint, GLuint, GLsizei, GLsizei*, GLsizei*, GLenum*, GLchar*); -extern pfn_glGetActiveVaryingNV fp_glGetActiveVaryingNV; -typedef void (APIENTRYP pfn_glGetTransformFeedbackVaryingNV) (GLuint, GLuint, GLint*); -extern pfn_glGetTransformFeedbackVaryingNV fp_glGetTransformFeedbackVaryingNV; -typedef void (APIENTRYP pfn_glTransformFeedbackStreamAttribsNV) (GLsizei, const GLint*, GLsizei, const GLint*, GLenum); -extern pfn_glTransformFeedbackStreamAttribsNV fp_glTransformFeedbackStreamAttribsNV; - - /* GL_NV_transform_feedback2 */ -extern GLboolean GLAD_NV_transform_feedback2; -#define GL_TRANSFORM_FEEDBACK_NV 0x8E22 -#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV 0x8E23 -#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV 0x8E24 -#define GL_TRANSFORM_FEEDBACK_BINDING_NV 0x8E25 -typedef void (APIENTRYP pfn_glBindTransformFeedbackNV) (GLenum, GLuint); -extern pfn_glBindTransformFeedbackNV fp_glBindTransformFeedbackNV; -typedef void (APIENTRYP pfn_glDeleteTransformFeedbacksNV) (GLsizei, const GLuint*); -extern pfn_glDeleteTransformFeedbacksNV fp_glDeleteTransformFeedbacksNV; -typedef void (APIENTRYP pfn_glGenTransformFeedbacksNV) (GLsizei, GLuint*); -extern pfn_glGenTransformFeedbacksNV fp_glGenTransformFeedbacksNV; -typedef GLboolean (APIENTRYP pfn_glIsTransformFeedbackNV) (GLuint); -extern pfn_glIsTransformFeedbackNV fp_glIsTransformFeedbackNV; -typedef void (APIENTRYP pfn_glPauseTransformFeedbackNV) (); -extern pfn_glPauseTransformFeedbackNV fp_glPauseTransformFeedbackNV; -typedef void (APIENTRYP pfn_glResumeTransformFeedbackNV) (); -extern pfn_glResumeTransformFeedbackNV fp_glResumeTransformFeedbackNV; -typedef void (APIENTRYP pfn_glDrawTransformFeedbackNV) (GLenum, GLuint); -extern pfn_glDrawTransformFeedbackNV fp_glDrawTransformFeedbackNV; - - /* GL_NV_uniform_buffer_unified_memory */ -extern GLboolean GLAD_NV_uniform_buffer_unified_memory; -#define GL_UNIFORM_BUFFER_UNIFIED_NV 0x936E -#define GL_UNIFORM_BUFFER_ADDRESS_NV 0x936F -#define GL_UNIFORM_BUFFER_LENGTH_NV 0x9370 - - /* GL_NV_vdpau_interop */ -extern GLboolean GLAD_NV_vdpau_interop; -#define GL_SURFACE_STATE_NV 0x86EB -#define GL_SURFACE_REGISTERED_NV 0x86FD -#define GL_SURFACE_MAPPED_NV 0x8700 -#define GL_WRITE_DISCARD_NV 0x88BE -typedef void (APIENTRYP pfn_glVDPAUInitNV) (const void*, const void*); -extern pfn_glVDPAUInitNV fp_glVDPAUInitNV; -typedef void (APIENTRYP pfn_glVDPAUFiniNV) (); -extern pfn_glVDPAUFiniNV fp_glVDPAUFiniNV; -typedef GLvdpauSurfaceNV (APIENTRYP pfn_glVDPAURegisterVideoSurfaceNV) (const void*, GLenum, GLsizei, const GLuint*); -extern pfn_glVDPAURegisterVideoSurfaceNV fp_glVDPAURegisterVideoSurfaceNV; -typedef GLvdpauSurfaceNV (APIENTRYP pfn_glVDPAURegisterOutputSurfaceNV) (const void*, GLenum, GLsizei, const GLuint*); -extern pfn_glVDPAURegisterOutputSurfaceNV fp_glVDPAURegisterOutputSurfaceNV; -typedef GLboolean (APIENTRYP pfn_glVDPAUIsSurfaceNV) (GLvdpauSurfaceNV); -extern pfn_glVDPAUIsSurfaceNV fp_glVDPAUIsSurfaceNV; -typedef void (APIENTRYP pfn_glVDPAUUnregisterSurfaceNV) (GLvdpauSurfaceNV); -extern pfn_glVDPAUUnregisterSurfaceNV fp_glVDPAUUnregisterSurfaceNV; -typedef void (APIENTRYP pfn_glVDPAUGetSurfaceivNV) (GLvdpauSurfaceNV, GLenum, GLsizei, GLsizei*, GLint*); -extern pfn_glVDPAUGetSurfaceivNV fp_glVDPAUGetSurfaceivNV; -typedef void (APIENTRYP pfn_glVDPAUSurfaceAccessNV) (GLvdpauSurfaceNV, GLenum); -extern pfn_glVDPAUSurfaceAccessNV fp_glVDPAUSurfaceAccessNV; -typedef void (APIENTRYP pfn_glVDPAUMapSurfacesNV) (GLsizei, const GLvdpauSurfaceNV*); -extern pfn_glVDPAUMapSurfacesNV fp_glVDPAUMapSurfacesNV; -typedef void (APIENTRYP pfn_glVDPAUUnmapSurfacesNV) (GLsizei, const GLvdpauSurfaceNV*); -extern pfn_glVDPAUUnmapSurfacesNV fp_glVDPAUUnmapSurfacesNV; - - /* GL_NV_vertex_attrib_integer_64bit */ -extern GLboolean GLAD_NV_vertex_attrib_integer_64bit; -typedef void (APIENTRYP pfn_glVertexAttribL1i64NV) (GLuint, GLint64EXT); -extern pfn_glVertexAttribL1i64NV fp_glVertexAttribL1i64NV; -typedef void (APIENTRYP pfn_glVertexAttribL2i64NV) (GLuint, GLint64EXT, GLint64EXT); -extern pfn_glVertexAttribL2i64NV fp_glVertexAttribL2i64NV; -typedef void (APIENTRYP pfn_glVertexAttribL3i64NV) (GLuint, GLint64EXT, GLint64EXT, GLint64EXT); -extern pfn_glVertexAttribL3i64NV fp_glVertexAttribL3i64NV; -typedef void (APIENTRYP pfn_glVertexAttribL4i64NV) (GLuint, GLint64EXT, GLint64EXT, GLint64EXT, GLint64EXT); -extern pfn_glVertexAttribL4i64NV fp_glVertexAttribL4i64NV; -typedef void (APIENTRYP pfn_glVertexAttribL1i64vNV) (GLuint, const GLint64EXT*); -extern pfn_glVertexAttribL1i64vNV fp_glVertexAttribL1i64vNV; -typedef void (APIENTRYP pfn_glVertexAttribL2i64vNV) (GLuint, const GLint64EXT*); -extern pfn_glVertexAttribL2i64vNV fp_glVertexAttribL2i64vNV; -typedef void (APIENTRYP pfn_glVertexAttribL3i64vNV) (GLuint, const GLint64EXT*); -extern pfn_glVertexAttribL3i64vNV fp_glVertexAttribL3i64vNV; -typedef void (APIENTRYP pfn_glVertexAttribL4i64vNV) (GLuint, const GLint64EXT*); -extern pfn_glVertexAttribL4i64vNV fp_glVertexAttribL4i64vNV; -typedef void (APIENTRYP pfn_glVertexAttribL1ui64NV) (GLuint, GLuint64EXT); -extern pfn_glVertexAttribL1ui64NV fp_glVertexAttribL1ui64NV; -typedef void (APIENTRYP pfn_glVertexAttribL2ui64NV) (GLuint, GLuint64EXT, GLuint64EXT); -extern pfn_glVertexAttribL2ui64NV fp_glVertexAttribL2ui64NV; -typedef void (APIENTRYP pfn_glVertexAttribL3ui64NV) (GLuint, GLuint64EXT, GLuint64EXT, GLuint64EXT); -extern pfn_glVertexAttribL3ui64NV fp_glVertexAttribL3ui64NV; -typedef void (APIENTRYP pfn_glVertexAttribL4ui64NV) (GLuint, GLuint64EXT, GLuint64EXT, GLuint64EXT, GLuint64EXT); -extern pfn_glVertexAttribL4ui64NV fp_glVertexAttribL4ui64NV; -typedef void (APIENTRYP pfn_glVertexAttribL1ui64vNV) (GLuint, const GLuint64EXT*); -extern pfn_glVertexAttribL1ui64vNV fp_glVertexAttribL1ui64vNV; -typedef void (APIENTRYP pfn_glVertexAttribL2ui64vNV) (GLuint, const GLuint64EXT*); -extern pfn_glVertexAttribL2ui64vNV fp_glVertexAttribL2ui64vNV; -typedef void (APIENTRYP pfn_glVertexAttribL3ui64vNV) (GLuint, const GLuint64EXT*); -extern pfn_glVertexAttribL3ui64vNV fp_glVertexAttribL3ui64vNV; -typedef void (APIENTRYP pfn_glVertexAttribL4ui64vNV) (GLuint, const GLuint64EXT*); -extern pfn_glVertexAttribL4ui64vNV fp_glVertexAttribL4ui64vNV; -typedef void (APIENTRYP pfn_glGetVertexAttribLi64vNV) (GLuint, GLenum, GLint64EXT*); -extern pfn_glGetVertexAttribLi64vNV fp_glGetVertexAttribLi64vNV; -typedef void (APIENTRYP pfn_glGetVertexAttribLui64vNV) (GLuint, GLenum, GLuint64EXT*); -extern pfn_glGetVertexAttribLui64vNV fp_glGetVertexAttribLui64vNV; -typedef void (APIENTRYP pfn_glVertexAttribLFormatNV) (GLuint, GLint, GLenum, GLsizei); -extern pfn_glVertexAttribLFormatNV fp_glVertexAttribLFormatNV; - - /* GL_NV_vertex_buffer_unified_memory */ -extern GLboolean GLAD_NV_vertex_buffer_unified_memory; -#define GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV 0x8F1E -#define GL_ELEMENT_ARRAY_UNIFIED_NV 0x8F1F -#define GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV 0x8F20 -#define GL_VERTEX_ARRAY_ADDRESS_NV 0x8F21 -#define GL_NORMAL_ARRAY_ADDRESS_NV 0x8F22 -#define GL_COLOR_ARRAY_ADDRESS_NV 0x8F23 -#define GL_INDEX_ARRAY_ADDRESS_NV 0x8F24 -#define GL_TEXTURE_COORD_ARRAY_ADDRESS_NV 0x8F25 -#define GL_EDGE_FLAG_ARRAY_ADDRESS_NV 0x8F26 -#define GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV 0x8F27 -#define GL_FOG_COORD_ARRAY_ADDRESS_NV 0x8F28 -#define GL_ELEMENT_ARRAY_ADDRESS_NV 0x8F29 -#define GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV 0x8F2A -#define GL_VERTEX_ARRAY_LENGTH_NV 0x8F2B -#define GL_NORMAL_ARRAY_LENGTH_NV 0x8F2C -#define GL_COLOR_ARRAY_LENGTH_NV 0x8F2D -#define GL_INDEX_ARRAY_LENGTH_NV 0x8F2E -#define GL_TEXTURE_COORD_ARRAY_LENGTH_NV 0x8F2F -#define GL_EDGE_FLAG_ARRAY_LENGTH_NV 0x8F30 -#define GL_SECONDARY_COLOR_ARRAY_LENGTH_NV 0x8F31 -#define GL_FOG_COORD_ARRAY_LENGTH_NV 0x8F32 -#define GL_ELEMENT_ARRAY_LENGTH_NV 0x8F33 -#define GL_DRAW_INDIRECT_UNIFIED_NV 0x8F40 -#define GL_DRAW_INDIRECT_ADDRESS_NV 0x8F41 -#define GL_DRAW_INDIRECT_LENGTH_NV 0x8F42 -typedef void (APIENTRYP pfn_glBufferAddressRangeNV) (GLenum, GLuint, GLuint64EXT, GLsizeiptr); -extern pfn_glBufferAddressRangeNV fp_glBufferAddressRangeNV; -typedef void (APIENTRYP pfn_glVertexFormatNV) (GLint, GLenum, GLsizei); -extern pfn_glVertexFormatNV fp_glVertexFormatNV; -typedef void (APIENTRYP pfn_glNormalFormatNV) (GLenum, GLsizei); -extern pfn_glNormalFormatNV fp_glNormalFormatNV; -typedef void (APIENTRYP pfn_glColorFormatNV) (GLint, GLenum, GLsizei); -extern pfn_glColorFormatNV fp_glColorFormatNV; -typedef void (APIENTRYP pfn_glIndexFormatNV) (GLenum, GLsizei); -extern pfn_glIndexFormatNV fp_glIndexFormatNV; -typedef void (APIENTRYP pfn_glTexCoordFormatNV) (GLint, GLenum, GLsizei); -extern pfn_glTexCoordFormatNV fp_glTexCoordFormatNV; -typedef void (APIENTRYP pfn_glEdgeFlagFormatNV) (GLsizei); -extern pfn_glEdgeFlagFormatNV fp_glEdgeFlagFormatNV; -typedef void (APIENTRYP pfn_glSecondaryColorFormatNV) (GLint, GLenum, GLsizei); -extern pfn_glSecondaryColorFormatNV fp_glSecondaryColorFormatNV; -typedef void (APIENTRYP pfn_glFogCoordFormatNV) (GLenum, GLsizei); -extern pfn_glFogCoordFormatNV fp_glFogCoordFormatNV; -typedef void (APIENTRYP pfn_glVertexAttribFormatNV) (GLuint, GLint, GLenum, GLboolean, GLsizei); -extern pfn_glVertexAttribFormatNV fp_glVertexAttribFormatNV; -typedef void (APIENTRYP pfn_glVertexAttribIFormatNV) (GLuint, GLint, GLenum, GLsizei); -extern pfn_glVertexAttribIFormatNV fp_glVertexAttribIFormatNV; -typedef void (APIENTRYP pfn_glGetIntegerui64i_vNV) (GLenum, GLuint, GLuint64EXT*); -extern pfn_glGetIntegerui64i_vNV fp_glGetIntegerui64i_vNV; - - /* GL_NV_vertex_program4 */ -extern GLboolean GLAD_NV_vertex_program4; -#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD -typedef void (APIENTRYP pfn_glVertexAttribI1iEXT) (GLuint, GLint); -extern pfn_glVertexAttribI1iEXT fp_glVertexAttribI1iEXT; -typedef void (APIENTRYP pfn_glVertexAttribI2iEXT) (GLuint, GLint, GLint); -extern pfn_glVertexAttribI2iEXT fp_glVertexAttribI2iEXT; -typedef void (APIENTRYP pfn_glVertexAttribI3iEXT) (GLuint, GLint, GLint, GLint); -extern pfn_glVertexAttribI3iEXT fp_glVertexAttribI3iEXT; -typedef void (APIENTRYP pfn_glVertexAttribI4iEXT) (GLuint, GLint, GLint, GLint, GLint); -extern pfn_glVertexAttribI4iEXT fp_glVertexAttribI4iEXT; -typedef void (APIENTRYP pfn_glVertexAttribI1uiEXT) (GLuint, GLuint); -extern pfn_glVertexAttribI1uiEXT fp_glVertexAttribI1uiEXT; -typedef void (APIENTRYP pfn_glVertexAttribI2uiEXT) (GLuint, GLuint, GLuint); -extern pfn_glVertexAttribI2uiEXT fp_glVertexAttribI2uiEXT; -typedef void (APIENTRYP pfn_glVertexAttribI3uiEXT) (GLuint, GLuint, GLuint, GLuint); -extern pfn_glVertexAttribI3uiEXT fp_glVertexAttribI3uiEXT; -typedef void (APIENTRYP pfn_glVertexAttribI4uiEXT) (GLuint, GLuint, GLuint, GLuint, GLuint); -extern pfn_glVertexAttribI4uiEXT fp_glVertexAttribI4uiEXT; -typedef void (APIENTRYP pfn_glVertexAttribI1ivEXT) (GLuint, const GLint*); -extern pfn_glVertexAttribI1ivEXT fp_glVertexAttribI1ivEXT; -typedef void (APIENTRYP pfn_glVertexAttribI2ivEXT) (GLuint, const GLint*); -extern pfn_glVertexAttribI2ivEXT fp_glVertexAttribI2ivEXT; -typedef void (APIENTRYP pfn_glVertexAttribI3ivEXT) (GLuint, const GLint*); -extern pfn_glVertexAttribI3ivEXT fp_glVertexAttribI3ivEXT; -typedef void (APIENTRYP pfn_glVertexAttribI4ivEXT) (GLuint, const GLint*); -extern pfn_glVertexAttribI4ivEXT fp_glVertexAttribI4ivEXT; -typedef void (APIENTRYP pfn_glVertexAttribI1uivEXT) (GLuint, const GLuint*); -extern pfn_glVertexAttribI1uivEXT fp_glVertexAttribI1uivEXT; -typedef void (APIENTRYP pfn_glVertexAttribI2uivEXT) (GLuint, const GLuint*); -extern pfn_glVertexAttribI2uivEXT fp_glVertexAttribI2uivEXT; -typedef void (APIENTRYP pfn_glVertexAttribI3uivEXT) (GLuint, const GLuint*); -extern pfn_glVertexAttribI3uivEXT fp_glVertexAttribI3uivEXT; -typedef void (APIENTRYP pfn_glVertexAttribI4uivEXT) (GLuint, const GLuint*); -extern pfn_glVertexAttribI4uivEXT fp_glVertexAttribI4uivEXT; -typedef void (APIENTRYP pfn_glVertexAttribI4bvEXT) (GLuint, const GLbyte*); -extern pfn_glVertexAttribI4bvEXT fp_glVertexAttribI4bvEXT; -typedef void (APIENTRYP pfn_glVertexAttribI4svEXT) (GLuint, const GLshort*); -extern pfn_glVertexAttribI4svEXT fp_glVertexAttribI4svEXT; -typedef void (APIENTRYP pfn_glVertexAttribI4ubvEXT) (GLuint, const GLubyte*); -extern pfn_glVertexAttribI4ubvEXT fp_glVertexAttribI4ubvEXT; -typedef void (APIENTRYP pfn_glVertexAttribI4usvEXT) (GLuint, const GLushort*); -extern pfn_glVertexAttribI4usvEXT fp_glVertexAttribI4usvEXT; -typedef void (APIENTRYP pfn_glVertexAttribIPointerEXT) (GLuint, GLint, GLenum, GLsizei, const void*); -extern pfn_glVertexAttribIPointerEXT fp_glVertexAttribIPointerEXT; -typedef void (APIENTRYP pfn_glGetVertexAttribIivEXT) (GLuint, GLenum, GLint*); -extern pfn_glGetVertexAttribIivEXT fp_glGetVertexAttribIivEXT; -typedef void (APIENTRYP pfn_glGetVertexAttribIuivEXT) (GLuint, GLenum, GLuint*); -extern pfn_glGetVertexAttribIuivEXT fp_glGetVertexAttribIuivEXT; - - /* GL_NV_video_capture */ -extern GLboolean GLAD_NV_video_capture; -#define GL_VIDEO_BUFFER_NV 0x9020 -#define GL_VIDEO_BUFFER_BINDING_NV 0x9021 -#define GL_FIELD_UPPER_NV 0x9022 -#define GL_FIELD_LOWER_NV 0x9023 -#define GL_NUM_VIDEO_CAPTURE_STREAMS_NV 0x9024 -#define GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV 0x9025 -#define GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV 0x9026 -#define GL_LAST_VIDEO_CAPTURE_STATUS_NV 0x9027 -#define GL_VIDEO_BUFFER_PITCH_NV 0x9028 -#define GL_VIDEO_COLOR_CONVERSION_MATRIX_NV 0x9029 -#define GL_VIDEO_COLOR_CONVERSION_MAX_NV 0x902A -#define GL_VIDEO_COLOR_CONVERSION_MIN_NV 0x902B -#define GL_VIDEO_COLOR_CONVERSION_OFFSET_NV 0x902C -#define GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV 0x902D -#define GL_PARTIAL_SUCCESS_NV 0x902E -#define GL_SUCCESS_NV 0x902F -#define GL_FAILURE_NV 0x9030 -#define GL_YCBYCR8_422_NV 0x9031 -#define GL_YCBAYCR8A_4224_NV 0x9032 -#define GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV 0x9033 -#define GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV 0x9034 -#define GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV 0x9035 -#define GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV 0x9036 -#define GL_Z4Y12Z4CB12Z4CR12_444_NV 0x9037 -#define GL_VIDEO_CAPTURE_FRAME_WIDTH_NV 0x9038 -#define GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV 0x9039 -#define GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV 0x903A -#define GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV 0x903B -#define GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV 0x903C -typedef void (APIENTRYP pfn_glBeginVideoCaptureNV) (GLuint); -extern pfn_glBeginVideoCaptureNV fp_glBeginVideoCaptureNV; -typedef void (APIENTRYP pfn_glBindVideoCaptureStreamBufferNV) (GLuint, GLuint, GLenum, GLintptrARB); -extern pfn_glBindVideoCaptureStreamBufferNV fp_glBindVideoCaptureStreamBufferNV; -typedef void (APIENTRYP pfn_glBindVideoCaptureStreamTextureNV) (GLuint, GLuint, GLenum, GLenum, GLuint); -extern pfn_glBindVideoCaptureStreamTextureNV fp_glBindVideoCaptureStreamTextureNV; -typedef void (APIENTRYP pfn_glEndVideoCaptureNV) (GLuint); -extern pfn_glEndVideoCaptureNV fp_glEndVideoCaptureNV; -typedef void (APIENTRYP pfn_glGetVideoCaptureivNV) (GLuint, GLenum, GLint*); -extern pfn_glGetVideoCaptureivNV fp_glGetVideoCaptureivNV; -typedef void (APIENTRYP pfn_glGetVideoCaptureStreamivNV) (GLuint, GLuint, GLenum, GLint*); -extern pfn_glGetVideoCaptureStreamivNV fp_glGetVideoCaptureStreamivNV; -typedef void (APIENTRYP pfn_glGetVideoCaptureStreamfvNV) (GLuint, GLuint, GLenum, GLfloat*); -extern pfn_glGetVideoCaptureStreamfvNV fp_glGetVideoCaptureStreamfvNV; -typedef void (APIENTRYP pfn_glGetVideoCaptureStreamdvNV) (GLuint, GLuint, GLenum, GLdouble*); -extern pfn_glGetVideoCaptureStreamdvNV fp_glGetVideoCaptureStreamdvNV; -typedef GLenum (APIENTRYP pfn_glVideoCaptureNV) (GLuint, GLuint*, GLuint64EXT*); -extern pfn_glVideoCaptureNV fp_glVideoCaptureNV; -typedef void (APIENTRYP pfn_glVideoCaptureStreamParameterivNV) (GLuint, GLuint, GLenum, const GLint*); -extern pfn_glVideoCaptureStreamParameterivNV fp_glVideoCaptureStreamParameterivNV; -typedef void (APIENTRYP pfn_glVideoCaptureStreamParameterfvNV) (GLuint, GLuint, GLenum, const GLfloat*); -extern pfn_glVideoCaptureStreamParameterfvNV fp_glVideoCaptureStreamParameterfvNV; -typedef void (APIENTRYP pfn_glVideoCaptureStreamParameterdvNV) (GLuint, GLuint, GLenum, const GLdouble*); -extern pfn_glVideoCaptureStreamParameterdvNV fp_glVideoCaptureStreamParameterdvNV; - - /* GL_NV_viewport_array */ -extern GLboolean GLAD_NV_viewport_array; -#define GL_MAX_VIEWPORTS_NV 0x825B -#define GL_VIEWPORT_SUBPIXEL_BITS_NV 0x825C -#define GL_VIEWPORT_BOUNDS_RANGE_NV 0x825D -#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX_NV 0x825F -typedef void (APIENTRYP pfn_glViewportArrayvNV) (GLuint, GLsizei, const GLfloat*); -extern pfn_glViewportArrayvNV fp_glViewportArrayvNV; -typedef void (APIENTRYP pfn_glViewportIndexedfNV) (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -extern pfn_glViewportIndexedfNV fp_glViewportIndexedfNV; -typedef void (APIENTRYP pfn_glViewportIndexedfvNV) (GLuint, const GLfloat*); -extern pfn_glViewportIndexedfvNV fp_glViewportIndexedfvNV; -typedef void (APIENTRYP pfn_glScissorArrayvNV) (GLuint, GLsizei, const GLint*); -extern pfn_glScissorArrayvNV fp_glScissorArrayvNV; -typedef void (APIENTRYP pfn_glScissorIndexedNV) (GLuint, GLint, GLint, GLsizei, GLsizei); -extern pfn_glScissorIndexedNV fp_glScissorIndexedNV; -typedef void (APIENTRYP pfn_glScissorIndexedvNV) (GLuint, const GLint*); -extern pfn_glScissorIndexedvNV fp_glScissorIndexedvNV; -typedef void (APIENTRYP pfn_glDepthRangeArrayfvNV) (GLuint, GLsizei, const GLfloat*); -extern pfn_glDepthRangeArrayfvNV fp_glDepthRangeArrayfvNV; -typedef void (APIENTRYP pfn_glDepthRangeIndexedfNV) (GLuint, GLfloat, GLfloat); -extern pfn_glDepthRangeIndexedfNV fp_glDepthRangeIndexedfNV; -typedef void (APIENTRYP pfn_glGetFloati_vNV) (GLenum, GLuint, GLfloat*); -extern pfn_glGetFloati_vNV fp_glGetFloati_vNV; -typedef void (APIENTRYP pfn_glEnableiNV) (GLenum, GLuint); -extern pfn_glEnableiNV fp_glEnableiNV; -typedef void (APIENTRYP pfn_glDisableiNV) (GLenum, GLuint); -extern pfn_glDisableiNV fp_glDisableiNV; -typedef GLboolean (APIENTRYP pfn_glIsEnablediNV) (GLenum, GLuint); -extern pfn_glIsEnablediNV fp_glIsEnablediNV; - - /* GL_NV_viewport_array2 */ -extern GLboolean GLAD_NV_viewport_array2; - - /* GL_NVX_conditional_render */ -extern GLboolean GLAD_NVX_conditional_render; -typedef void (APIENTRYP pfn_glBeginConditionalRenderNVX) (GLuint); -extern pfn_glBeginConditionalRenderNVX fp_glBeginConditionalRenderNVX; -typedef void (APIENTRYP pfn_glEndConditionalRenderNVX) (); -extern pfn_glEndConditionalRenderNVX fp_glEndConditionalRenderNVX; - - /* GL_NVX_gpu_memory_info */ -extern GLboolean GLAD_NVX_gpu_memory_info; -#define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047 -#define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048 -#define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049 -#define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A -#define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B - - /* GL_OVR_multiview */ -extern GLboolean GLAD_OVR_multiview; -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR 0x9630 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR 0x9632 -#define GL_MAX_VIEWS_OVR 0x9631 -typedef void (APIENTRYP pfn_glFramebufferTextureMultiviewOVR) (GLenum, GLenum, GLuint, GLint, GLint, GLsizei); -extern pfn_glFramebufferTextureMultiviewOVR fp_glFramebufferTextureMultiviewOVR; - - /* GL_OVR_multiview2 */ -extern GLboolean GLAD_OVR_multiview2; - - /* GL_OVR_multiview_multisampled_render_to_texture */ -extern GLboolean GLAD_OVR_multiview_multisampled_render_to_texture; -typedef void (APIENTRYP pfn_glFramebufferTextureMultisampleMultiviewOVR) (GLenum, GLenum, GLuint, GLint, GLsizei, GLint, GLsizei); -extern pfn_glFramebufferTextureMultisampleMultiviewOVR fp_glFramebufferTextureMultisampleMultiviewOVR; - - /* GL_QCOM_alpha_test */ -extern GLboolean GLAD_QCOM_alpha_test; -#define GL_ALPHA_TEST_QCOM 0x0BC0 -#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1 -#define GL_ALPHA_TEST_REF_QCOM 0x0BC2 -typedef void (APIENTRYP pfn_glAlphaFuncQCOM) (GLenum, GLclampf); -extern pfn_glAlphaFuncQCOM fp_glAlphaFuncQCOM; - - /* GL_QCOM_binning_control */ -extern GLboolean GLAD_QCOM_binning_control; -#define GL_BINNING_CONTROL_HINT_QCOM 0x8FB0 -#define GL_CPU_OPTIMIZED_QCOM 0x8FB1 -#define GL_GPU_OPTIMIZED_QCOM 0x8FB2 -#define GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM 0x8FB3 - - /* GL_QCOM_driver_control */ -extern GLboolean GLAD_QCOM_driver_control; -typedef void (APIENTRYP pfn_glGetDriverControlsQCOM) (GLint*, GLsizei, GLuint*); -extern pfn_glGetDriverControlsQCOM fp_glGetDriverControlsQCOM; -typedef void (APIENTRYP pfn_glGetDriverControlStringQCOM) (GLuint, GLsizei, GLsizei*, GLchar*); -extern pfn_glGetDriverControlStringQCOM fp_glGetDriverControlStringQCOM; -typedef void (APIENTRYP pfn_glEnableDriverControlQCOM) (GLuint); -extern pfn_glEnableDriverControlQCOM fp_glEnableDriverControlQCOM; -typedef void (APIENTRYP pfn_glDisableDriverControlQCOM) (GLuint); -extern pfn_glDisableDriverControlQCOM fp_glDisableDriverControlQCOM; - - /* GL_QCOM_extended_get */ -extern GLboolean GLAD_QCOM_extended_get; -#define GL_TEXTURE_WIDTH_QCOM 0x8BD2 -#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3 -#define GL_TEXTURE_DEPTH_QCOM 0x8BD4 -#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5 -#define GL_TEXTURE_FORMAT_QCOM 0x8BD6 -#define GL_TEXTURE_TYPE_QCOM 0x8BD7 -#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8 -#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9 -#define GL_TEXTURE_TARGET_QCOM 0x8BDA -#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB -#define GL_STATE_RESTORE 0x8BDC -typedef void (APIENTRYP pfn_glExtGetTexturesQCOM) (GLuint*, GLint, GLint*); -extern pfn_glExtGetTexturesQCOM fp_glExtGetTexturesQCOM; -typedef void (APIENTRYP pfn_glExtGetBuffersQCOM) (GLuint*, GLint, GLint*); -extern pfn_glExtGetBuffersQCOM fp_glExtGetBuffersQCOM; -typedef void (APIENTRYP pfn_glExtGetRenderbuffersQCOM) (GLuint*, GLint, GLint*); -extern pfn_glExtGetRenderbuffersQCOM fp_glExtGetRenderbuffersQCOM; -typedef void (APIENTRYP pfn_glExtGetFramebuffersQCOM) (GLuint*, GLint, GLint*); -extern pfn_glExtGetFramebuffersQCOM fp_glExtGetFramebuffersQCOM; -typedef void (APIENTRYP pfn_glExtGetTexLevelParameterivQCOM) (GLuint, GLenum, GLint, GLenum, GLint*); -extern pfn_glExtGetTexLevelParameterivQCOM fp_glExtGetTexLevelParameterivQCOM; -typedef void (APIENTRYP pfn_glExtTexObjectStateOverrideiQCOM) (GLenum, GLenum, GLint); -extern pfn_glExtTexObjectStateOverrideiQCOM fp_glExtTexObjectStateOverrideiQCOM; -typedef void (APIENTRYP pfn_glExtGetTexSubImageQCOM) (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, void*); -extern pfn_glExtGetTexSubImageQCOM fp_glExtGetTexSubImageQCOM; -typedef void (APIENTRYP pfn_glExtGetBufferPointervQCOM) (GLenum, void**); -extern pfn_glExtGetBufferPointervQCOM fp_glExtGetBufferPointervQCOM; - - /* GL_QCOM_extended_get2 */ -extern GLboolean GLAD_QCOM_extended_get2; -typedef void (APIENTRYP pfn_glExtGetShadersQCOM) (GLuint*, GLint, GLint*); -extern pfn_glExtGetShadersQCOM fp_glExtGetShadersQCOM; -typedef void (APIENTRYP pfn_glExtGetProgramsQCOM) (GLuint*, GLint, GLint*); -extern pfn_glExtGetProgramsQCOM fp_glExtGetProgramsQCOM; -typedef GLboolean (APIENTRYP pfn_glExtIsProgramBinaryQCOM) (GLuint); -extern pfn_glExtIsProgramBinaryQCOM fp_glExtIsProgramBinaryQCOM; -typedef void (APIENTRYP pfn_glExtGetProgramBinarySourceQCOM) (GLuint, GLenum, GLchar*, GLint*); -extern pfn_glExtGetProgramBinarySourceQCOM fp_glExtGetProgramBinarySourceQCOM; - - /* GL_QCOM_perfmon_global_mode */ -extern GLboolean GLAD_QCOM_perfmon_global_mode; -#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0 - - /* GL_QCOM_tiled_rendering */ -extern GLboolean GLAD_QCOM_tiled_rendering; -#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001 -#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002 -#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004 -#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008 -#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010 -#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020 -#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040 -#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080 -#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100 -#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200 -#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400 -#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800 -#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000 -#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000 -#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000 -#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000 -#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000 -#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000 -#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000 -#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000 -#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000 -#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000 -#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000 -#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000 -#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000 -#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000 -#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000 -#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000 -#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000 -#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000 -#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000 -#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000 -typedef void (APIENTRYP pfn_glStartTilingQCOM) (GLuint, GLuint, GLuint, GLuint, GLbitfield); -extern pfn_glStartTilingQCOM fp_glStartTilingQCOM; -typedef void (APIENTRYP pfn_glEndTilingQCOM) (GLbitfield); -extern pfn_glEndTilingQCOM fp_glEndTilingQCOM; - - /* GL_QCOM_writeonly_rendering */ -extern GLboolean GLAD_QCOM_writeonly_rendering; -#define GL_WRITEONLY_RENDERING_QCOM 0x8823 - - /* GL_VIV_shader_binary */ -extern GLboolean GLAD_VIV_shader_binary; -#define GL_SHADER_BINARY_VIV 0x8FC4 - -} /* namespace glad */ - -#endif /* __glad_hpp_ */ diff --git a/love/src/jni/love/src/libraries/glad/gladfuncs.hpp b/love/src/jni/love/src/libraries/glad/gladfuncs.hpp deleted file mode 100644 index 050e127b..00000000 --- a/love/src/jni/love/src/libraries/glad/gladfuncs.hpp +++ /dev/null @@ -1,2562 +0,0 @@ - -/** - * The MIT License (MIT) - * - * Copyright (c) 2013 David Herberth, modified by Alex Szpakowski - * - * 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 __glad_funcs_hpp_ -#define __glad_funcs_hpp_ - -#include "glad.hpp" - -namespace glad { - - -/* GL_VERSION_1_0 */ -inline void glCullFace(GLenum mode) { fp_glCullFace(mode); } -inline void glFrontFace(GLenum mode) { fp_glFrontFace(mode); } -inline void glHint(GLenum target, GLenum mode) { fp_glHint(target, mode); } -inline void glLineWidth(GLfloat width) { fp_glLineWidth(width); } -inline void glPointSize(GLfloat size) { fp_glPointSize(size); } -inline void glPolygonMode(GLenum face, GLenum mode) { fp_glPolygonMode(face, mode); } -inline void glScissor(GLint x, GLint y, GLsizei width, GLsizei height) { fp_glScissor(x, y, width, height); } -inline void glTexParameterf(GLenum target, GLenum pname, GLfloat param) { fp_glTexParameterf(target, pname, param); } -inline void glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params) { fp_glTexParameterfv(target, pname, params); } -inline void glTexParameteri(GLenum target, GLenum pname, GLint param) { fp_glTexParameteri(target, pname, param); } -inline void glTexParameteriv(GLenum target, GLenum pname, const GLint* params) { fp_glTexParameteriv(target, pname, params); } -inline void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void* pixels) { fp_glTexImage1D(target, level, internalformat, width, border, format, type, pixels); } -inline void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) { fp_glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); } -inline void glDrawBuffer(GLenum buf) { fp_glDrawBuffer(buf); } -inline void glClear(GLbitfield mask) { fp_glClear(mask); } -inline void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { fp_glClearColor(red, green, blue, alpha); } -inline void glClearStencil(GLint s) { fp_glClearStencil(s); } -inline void glClearDepth(GLdouble depth) { fp_glClearDepth(depth); } -inline void glStencilMask(GLuint mask) { fp_glStencilMask(mask); } -inline void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { fp_glColorMask(red, green, blue, alpha); } -inline void glDepthMask(GLboolean flag) { fp_glDepthMask(flag); } -inline void glDisable(GLenum cap) { fp_glDisable(cap); } -inline void glEnable(GLenum cap) { fp_glEnable(cap); } -inline void glFinish() { fp_glFinish(); } -inline void glFlush() { fp_glFlush(); } -inline void glBlendFunc(GLenum sfactor, GLenum dfactor) { fp_glBlendFunc(sfactor, dfactor); } -inline void glLogicOp(GLenum opcode) { fp_glLogicOp(opcode); } -inline void glStencilFunc(GLenum func, GLint ref, GLuint mask) { fp_glStencilFunc(func, ref, mask); } -inline void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) { fp_glStencilOp(fail, zfail, zpass); } -inline void glDepthFunc(GLenum func) { fp_glDepthFunc(func); } -inline void glPixelStoref(GLenum pname, GLfloat param) { fp_glPixelStoref(pname, param); } -inline void glPixelStorei(GLenum pname, GLint param) { fp_glPixelStorei(pname, param); } -inline void glReadBuffer(GLenum src) { fp_glReadBuffer(src); } -inline void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) { fp_glReadPixels(x, y, width, height, format, type, pixels); } -inline void glGetBooleanv(GLenum pname, GLboolean* data) { fp_glGetBooleanv(pname, data); } -inline void glGetDoublev(GLenum pname, GLdouble* data) { fp_glGetDoublev(pname, data); } -inline GLenum glGetError() { return fp_glGetError(); } -inline void glGetFloatv(GLenum pname, GLfloat* data) { fp_glGetFloatv(pname, data); } -inline void glGetIntegerv(GLenum pname, GLint* data) { fp_glGetIntegerv(pname, data); } -inline const GLubyte* glGetString(GLenum name) { return fp_glGetString(name); } -inline void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, void* pixels) { fp_glGetTexImage(target, level, format, type, pixels); } -inline void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) { fp_glGetTexParameterfv(target, pname, params); } -inline void glGetTexParameteriv(GLenum target, GLenum pname, GLint* params) { fp_glGetTexParameteriv(target, pname, params); } -inline void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat* params) { fp_glGetTexLevelParameterfv(target, level, pname, params); } -inline void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint* params) { fp_glGetTexLevelParameteriv(target, level, pname, params); } -inline GLboolean glIsEnabled(GLenum cap) { return fp_glIsEnabled(cap); } -inline void glDepthRange(GLdouble near, GLdouble far) { fp_glDepthRange(near, far); } -inline void glViewport(GLint x, GLint y, GLsizei width, GLsizei height) { fp_glViewport(x, y, width, height); } -inline void glNewList(GLuint list, GLenum mode) { fp_glNewList(list, mode); } -inline void glEndList() { fp_glEndList(); } -inline void glCallList(GLuint list) { fp_glCallList(list); } -inline void glCallLists(GLsizei n, GLenum type, const void* lists) { fp_glCallLists(n, type, lists); } -inline void glDeleteLists(GLuint list, GLsizei range) { fp_glDeleteLists(list, range); } -inline GLuint glGenLists(GLsizei range) { return fp_glGenLists(range); } -inline void glListBase(GLuint base) { fp_glListBase(base); } -inline void glBegin(GLenum mode) { fp_glBegin(mode); } -inline void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte* bitmap) { fp_glBitmap(width, height, xorig, yorig, xmove, ymove, bitmap); } -inline void glColor3b(GLbyte red, GLbyte green, GLbyte blue) { fp_glColor3b(red, green, blue); } -inline void glColor3bv(const GLbyte* v) { fp_glColor3bv(v); } -inline void glColor3d(GLdouble red, GLdouble green, GLdouble blue) { fp_glColor3d(red, green, blue); } -inline void glColor3dv(const GLdouble* v) { fp_glColor3dv(v); } -inline void glColor3f(GLfloat red, GLfloat green, GLfloat blue) { fp_glColor3f(red, green, blue); } -inline void glColor3fv(const GLfloat* v) { fp_glColor3fv(v); } -inline void glColor3i(GLint red, GLint green, GLint blue) { fp_glColor3i(red, green, blue); } -inline void glColor3iv(const GLint* v) { fp_glColor3iv(v); } -inline void glColor3s(GLshort red, GLshort green, GLshort blue) { fp_glColor3s(red, green, blue); } -inline void glColor3sv(const GLshort* v) { fp_glColor3sv(v); } -inline void glColor3ub(GLubyte red, GLubyte green, GLubyte blue) { fp_glColor3ub(red, green, blue); } -inline void glColor3ubv(const GLubyte* v) { fp_glColor3ubv(v); } -inline void glColor3ui(GLuint red, GLuint green, GLuint blue) { fp_glColor3ui(red, green, blue); } -inline void glColor3uiv(const GLuint* v) { fp_glColor3uiv(v); } -inline void glColor3us(GLushort red, GLushort green, GLushort blue) { fp_glColor3us(red, green, blue); } -inline void glColor3usv(const GLushort* v) { fp_glColor3usv(v); } -inline void glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha) { fp_glColor4b(red, green, blue, alpha); } -inline void glColor4bv(const GLbyte* v) { fp_glColor4bv(v); } -inline void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha) { fp_glColor4d(red, green, blue, alpha); } -inline void glColor4dv(const GLdouble* v) { fp_glColor4dv(v); } -inline void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { fp_glColor4f(red, green, blue, alpha); } -inline void glColor4fv(const GLfloat* v) { fp_glColor4fv(v); } -inline void glColor4i(GLint red, GLint green, GLint blue, GLint alpha) { fp_glColor4i(red, green, blue, alpha); } -inline void glColor4iv(const GLint* v) { fp_glColor4iv(v); } -inline void glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha) { fp_glColor4s(red, green, blue, alpha); } -inline void glColor4sv(const GLshort* v) { fp_glColor4sv(v); } -inline void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) { fp_glColor4ub(red, green, blue, alpha); } -inline void glColor4ubv(const GLubyte* v) { fp_glColor4ubv(v); } -inline void glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha) { fp_glColor4ui(red, green, blue, alpha); } -inline void glColor4uiv(const GLuint* v) { fp_glColor4uiv(v); } -inline void glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha) { fp_glColor4us(red, green, blue, alpha); } -inline void glColor4usv(const GLushort* v) { fp_glColor4usv(v); } -inline void glEdgeFlag(GLboolean flag) { fp_glEdgeFlag(flag); } -inline void glEdgeFlagv(const GLboolean* flag) { fp_glEdgeFlagv(flag); } -inline void glEnd() { fp_glEnd(); } -inline void glIndexd(GLdouble c) { fp_glIndexd(c); } -inline void glIndexdv(const GLdouble* c) { fp_glIndexdv(c); } -inline void glIndexf(GLfloat c) { fp_glIndexf(c); } -inline void glIndexfv(const GLfloat* c) { fp_glIndexfv(c); } -inline void glIndexi(GLint c) { fp_glIndexi(c); } -inline void glIndexiv(const GLint* c) { fp_glIndexiv(c); } -inline void glIndexs(GLshort c) { fp_glIndexs(c); } -inline void glIndexsv(const GLshort* c) { fp_glIndexsv(c); } -inline void glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz) { fp_glNormal3b(nx, ny, nz); } -inline void glNormal3bv(const GLbyte* v) { fp_glNormal3bv(v); } -inline void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz) { fp_glNormal3d(nx, ny, nz); } -inline void glNormal3dv(const GLdouble* v) { fp_glNormal3dv(v); } -inline void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz) { fp_glNormal3f(nx, ny, nz); } -inline void glNormal3fv(const GLfloat* v) { fp_glNormal3fv(v); } -inline void glNormal3i(GLint nx, GLint ny, GLint nz) { fp_glNormal3i(nx, ny, nz); } -inline void glNormal3iv(const GLint* v) { fp_glNormal3iv(v); } -inline void glNormal3s(GLshort nx, GLshort ny, GLshort nz) { fp_glNormal3s(nx, ny, nz); } -inline void glNormal3sv(const GLshort* v) { fp_glNormal3sv(v); } -inline void glRasterPos2d(GLdouble x, GLdouble y) { fp_glRasterPos2d(x, y); } -inline void glRasterPos2dv(const GLdouble* v) { fp_glRasterPos2dv(v); } -inline void glRasterPos2f(GLfloat x, GLfloat y) { fp_glRasterPos2f(x, y); } -inline void glRasterPos2fv(const GLfloat* v) { fp_glRasterPos2fv(v); } -inline void glRasterPos2i(GLint x, GLint y) { fp_glRasterPos2i(x, y); } -inline void glRasterPos2iv(const GLint* v) { fp_glRasterPos2iv(v); } -inline void glRasterPos2s(GLshort x, GLshort y) { fp_glRasterPos2s(x, y); } -inline void glRasterPos2sv(const GLshort* v) { fp_glRasterPos2sv(v); } -inline void glRasterPos3d(GLdouble x, GLdouble y, GLdouble z) { fp_glRasterPos3d(x, y, z); } -inline void glRasterPos3dv(const GLdouble* v) { fp_glRasterPos3dv(v); } -inline void glRasterPos3f(GLfloat x, GLfloat y, GLfloat z) { fp_glRasterPos3f(x, y, z); } -inline void glRasterPos3fv(const GLfloat* v) { fp_glRasterPos3fv(v); } -inline void glRasterPos3i(GLint x, GLint y, GLint z) { fp_glRasterPos3i(x, y, z); } -inline void glRasterPos3iv(const GLint* v) { fp_glRasterPos3iv(v); } -inline void glRasterPos3s(GLshort x, GLshort y, GLshort z) { fp_glRasterPos3s(x, y, z); } -inline void glRasterPos3sv(const GLshort* v) { fp_glRasterPos3sv(v); } -inline void glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w) { fp_glRasterPos4d(x, y, z, w); } -inline void glRasterPos4dv(const GLdouble* v) { fp_glRasterPos4dv(v); } -inline void glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { fp_glRasterPos4f(x, y, z, w); } -inline void glRasterPos4fv(const GLfloat* v) { fp_glRasterPos4fv(v); } -inline void glRasterPos4i(GLint x, GLint y, GLint z, GLint w) { fp_glRasterPos4i(x, y, z, w); } -inline void glRasterPos4iv(const GLint* v) { fp_glRasterPos4iv(v); } -inline void glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w) { fp_glRasterPos4s(x, y, z, w); } -inline void glRasterPos4sv(const GLshort* v) { fp_glRasterPos4sv(v); } -inline void glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) { fp_glRectd(x1, y1, x2, y2); } -inline void glRectdv(const GLdouble* v1, const GLdouble* v2) { fp_glRectdv(v1, v2); } -inline void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) { fp_glRectf(x1, y1, x2, y2); } -inline void glRectfv(const GLfloat* v1, const GLfloat* v2) { fp_glRectfv(v1, v2); } -inline void glRecti(GLint x1, GLint y1, GLint x2, GLint y2) { fp_glRecti(x1, y1, x2, y2); } -inline void glRectiv(const GLint* v1, const GLint* v2) { fp_glRectiv(v1, v2); } -inline void glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2) { fp_glRects(x1, y1, x2, y2); } -inline void glRectsv(const GLshort* v1, const GLshort* v2) { fp_glRectsv(v1, v2); } -inline void glTexCoord1d(GLdouble s) { fp_glTexCoord1d(s); } -inline void glTexCoord1dv(const GLdouble* v) { fp_glTexCoord1dv(v); } -inline void glTexCoord1f(GLfloat s) { fp_glTexCoord1f(s); } -inline void glTexCoord1fv(const GLfloat* v) { fp_glTexCoord1fv(v); } -inline void glTexCoord1i(GLint s) { fp_glTexCoord1i(s); } -inline void glTexCoord1iv(const GLint* v) { fp_glTexCoord1iv(v); } -inline void glTexCoord1s(GLshort s) { fp_glTexCoord1s(s); } -inline void glTexCoord1sv(const GLshort* v) { fp_glTexCoord1sv(v); } -inline void glTexCoord2d(GLdouble s, GLdouble t) { fp_glTexCoord2d(s, t); } -inline void glTexCoord2dv(const GLdouble* v) { fp_glTexCoord2dv(v); } -inline void glTexCoord2f(GLfloat s, GLfloat t) { fp_glTexCoord2f(s, t); } -inline void glTexCoord2fv(const GLfloat* v) { fp_glTexCoord2fv(v); } -inline void glTexCoord2i(GLint s, GLint t) { fp_glTexCoord2i(s, t); } -inline void glTexCoord2iv(const GLint* v) { fp_glTexCoord2iv(v); } -inline void glTexCoord2s(GLshort s, GLshort t) { fp_glTexCoord2s(s, t); } -inline void glTexCoord2sv(const GLshort* v) { fp_glTexCoord2sv(v); } -inline void glTexCoord3d(GLdouble s, GLdouble t, GLdouble r) { fp_glTexCoord3d(s, t, r); } -inline void glTexCoord3dv(const GLdouble* v) { fp_glTexCoord3dv(v); } -inline void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r) { fp_glTexCoord3f(s, t, r); } -inline void glTexCoord3fv(const GLfloat* v) { fp_glTexCoord3fv(v); } -inline void glTexCoord3i(GLint s, GLint t, GLint r) { fp_glTexCoord3i(s, t, r); } -inline void glTexCoord3iv(const GLint* v) { fp_glTexCoord3iv(v); } -inline void glTexCoord3s(GLshort s, GLshort t, GLshort r) { fp_glTexCoord3s(s, t, r); } -inline void glTexCoord3sv(const GLshort* v) { fp_glTexCoord3sv(v); } -inline void glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q) { fp_glTexCoord4d(s, t, r, q); } -inline void glTexCoord4dv(const GLdouble* v) { fp_glTexCoord4dv(v); } -inline void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q) { fp_glTexCoord4f(s, t, r, q); } -inline void glTexCoord4fv(const GLfloat* v) { fp_glTexCoord4fv(v); } -inline void glTexCoord4i(GLint s, GLint t, GLint r, GLint q) { fp_glTexCoord4i(s, t, r, q); } -inline void glTexCoord4iv(const GLint* v) { fp_glTexCoord4iv(v); } -inline void glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q) { fp_glTexCoord4s(s, t, r, q); } -inline void glTexCoord4sv(const GLshort* v) { fp_glTexCoord4sv(v); } -inline void glVertex2d(GLdouble x, GLdouble y) { fp_glVertex2d(x, y); } -inline void glVertex2dv(const GLdouble* v) { fp_glVertex2dv(v); } -inline void glVertex2f(GLfloat x, GLfloat y) { fp_glVertex2f(x, y); } -inline void glVertex2fv(const GLfloat* v) { fp_glVertex2fv(v); } -inline void glVertex2i(GLint x, GLint y) { fp_glVertex2i(x, y); } -inline void glVertex2iv(const GLint* v) { fp_glVertex2iv(v); } -inline void glVertex2s(GLshort x, GLshort y) { fp_glVertex2s(x, y); } -inline void glVertex2sv(const GLshort* v) { fp_glVertex2sv(v); } -inline void glVertex3d(GLdouble x, GLdouble y, GLdouble z) { fp_glVertex3d(x, y, z); } -inline void glVertex3dv(const GLdouble* v) { fp_glVertex3dv(v); } -inline void glVertex3f(GLfloat x, GLfloat y, GLfloat z) { fp_glVertex3f(x, y, z); } -inline void glVertex3fv(const GLfloat* v) { fp_glVertex3fv(v); } -inline void glVertex3i(GLint x, GLint y, GLint z) { fp_glVertex3i(x, y, z); } -inline void glVertex3iv(const GLint* v) { fp_glVertex3iv(v); } -inline void glVertex3s(GLshort x, GLshort y, GLshort z) { fp_glVertex3s(x, y, z); } -inline void glVertex3sv(const GLshort* v) { fp_glVertex3sv(v); } -inline void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w) { fp_glVertex4d(x, y, z, w); } -inline void glVertex4dv(const GLdouble* v) { fp_glVertex4dv(v); } -inline void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { fp_glVertex4f(x, y, z, w); } -inline void glVertex4fv(const GLfloat* v) { fp_glVertex4fv(v); } -inline void glVertex4i(GLint x, GLint y, GLint z, GLint w) { fp_glVertex4i(x, y, z, w); } -inline void glVertex4iv(const GLint* v) { fp_glVertex4iv(v); } -inline void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w) { fp_glVertex4s(x, y, z, w); } -inline void glVertex4sv(const GLshort* v) { fp_glVertex4sv(v); } -inline void glClipPlane(GLenum plane, const GLdouble* equation) { fp_glClipPlane(plane, equation); } -inline void glColorMaterial(GLenum face, GLenum mode) { fp_glColorMaterial(face, mode); } -inline void glFogf(GLenum pname, GLfloat param) { fp_glFogf(pname, param); } -inline void glFogfv(GLenum pname, const GLfloat* params) { fp_glFogfv(pname, params); } -inline void glFogi(GLenum pname, GLint param) { fp_glFogi(pname, param); } -inline void glFogiv(GLenum pname, const GLint* params) { fp_glFogiv(pname, params); } -inline void glLightf(GLenum light, GLenum pname, GLfloat param) { fp_glLightf(light, pname, param); } -inline void glLightfv(GLenum light, GLenum pname, const GLfloat* params) { fp_glLightfv(light, pname, params); } -inline void glLighti(GLenum light, GLenum pname, GLint param) { fp_glLighti(light, pname, param); } -inline void glLightiv(GLenum light, GLenum pname, const GLint* params) { fp_glLightiv(light, pname, params); } -inline void glLightModelf(GLenum pname, GLfloat param) { fp_glLightModelf(pname, param); } -inline void glLightModelfv(GLenum pname, const GLfloat* params) { fp_glLightModelfv(pname, params); } -inline void glLightModeli(GLenum pname, GLint param) { fp_glLightModeli(pname, param); } -inline void glLightModeliv(GLenum pname, const GLint* params) { fp_glLightModeliv(pname, params); } -inline void glLineStipple(GLint factor, GLushort pattern) { fp_glLineStipple(factor, pattern); } -inline void glMaterialf(GLenum face, GLenum pname, GLfloat param) { fp_glMaterialf(face, pname, param); } -inline void glMaterialfv(GLenum face, GLenum pname, const GLfloat* params) { fp_glMaterialfv(face, pname, params); } -inline void glMateriali(GLenum face, GLenum pname, GLint param) { fp_glMateriali(face, pname, param); } -inline void glMaterialiv(GLenum face, GLenum pname, const GLint* params) { fp_glMaterialiv(face, pname, params); } -inline void glPolygonStipple(const GLubyte* mask) { fp_glPolygonStipple(mask); } -inline void glShadeModel(GLenum mode) { fp_glShadeModel(mode); } -inline void glTexEnvf(GLenum target, GLenum pname, GLfloat param) { fp_glTexEnvf(target, pname, param); } -inline void glTexEnvfv(GLenum target, GLenum pname, const GLfloat* params) { fp_glTexEnvfv(target, pname, params); } -inline void glTexEnvi(GLenum target, GLenum pname, GLint param) { fp_glTexEnvi(target, pname, param); } -inline void glTexEnviv(GLenum target, GLenum pname, const GLint* params) { fp_glTexEnviv(target, pname, params); } -inline void glTexGend(GLenum coord, GLenum pname, GLdouble param) { fp_glTexGend(coord, pname, param); } -inline void glTexGendv(GLenum coord, GLenum pname, const GLdouble* params) { fp_glTexGendv(coord, pname, params); } -inline void glTexGenf(GLenum coord, GLenum pname, GLfloat param) { fp_glTexGenf(coord, pname, param); } -inline void glTexGenfv(GLenum coord, GLenum pname, const GLfloat* params) { fp_glTexGenfv(coord, pname, params); } -inline void glTexGeni(GLenum coord, GLenum pname, GLint param) { fp_glTexGeni(coord, pname, param); } -inline void glTexGeniv(GLenum coord, GLenum pname, const GLint* params) { fp_glTexGeniv(coord, pname, params); } -inline void glFeedbackBuffer(GLsizei size, GLenum type, GLfloat* buffer) { fp_glFeedbackBuffer(size, type, buffer); } -inline void glSelectBuffer(GLsizei size, GLuint* buffer) { fp_glSelectBuffer(size, buffer); } -inline GLint glRenderMode(GLenum mode) { return fp_glRenderMode(mode); } -inline void glInitNames() { fp_glInitNames(); } -inline void glLoadName(GLuint name) { fp_glLoadName(name); } -inline void glPassThrough(GLfloat token) { fp_glPassThrough(token); } -inline void glPopName() { fp_glPopName(); } -inline void glPushName(GLuint name) { fp_glPushName(name); } -inline void glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { fp_glClearAccum(red, green, blue, alpha); } -inline void glClearIndex(GLfloat c) { fp_glClearIndex(c); } -inline void glIndexMask(GLuint mask) { fp_glIndexMask(mask); } -inline void glAccum(GLenum op, GLfloat value) { fp_glAccum(op, value); } -inline void glPopAttrib() { fp_glPopAttrib(); } -inline void glPushAttrib(GLbitfield mask) { fp_glPushAttrib(mask); } -inline void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble* points) { fp_glMap1d(target, u1, u2, stride, order, points); } -inline void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat* points) { fp_glMap1f(target, u1, u2, stride, order, points); } -inline void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble* points) { fp_glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); } -inline void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat* points) { fp_glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); } -inline void glMapGrid1d(GLint un, GLdouble u1, GLdouble u2) { fp_glMapGrid1d(un, u1, u2); } -inline void glMapGrid1f(GLint un, GLfloat u1, GLfloat u2) { fp_glMapGrid1f(un, u1, u2); } -inline void glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2) { fp_glMapGrid2d(un, u1, u2, vn, v1, v2); } -inline void glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2) { fp_glMapGrid2f(un, u1, u2, vn, v1, v2); } -inline void glEvalCoord1d(GLdouble u) { fp_glEvalCoord1d(u); } -inline void glEvalCoord1dv(const GLdouble* u) { fp_glEvalCoord1dv(u); } -inline void glEvalCoord1f(GLfloat u) { fp_glEvalCoord1f(u); } -inline void glEvalCoord1fv(const GLfloat* u) { fp_glEvalCoord1fv(u); } -inline void glEvalCoord2d(GLdouble u, GLdouble v) { fp_glEvalCoord2d(u, v); } -inline void glEvalCoord2dv(const GLdouble* u) { fp_glEvalCoord2dv(u); } -inline void glEvalCoord2f(GLfloat u, GLfloat v) { fp_glEvalCoord2f(u, v); } -inline void glEvalCoord2fv(const GLfloat* u) { fp_glEvalCoord2fv(u); } -inline void glEvalMesh1(GLenum mode, GLint i1, GLint i2) { fp_glEvalMesh1(mode, i1, i2); } -inline void glEvalPoint1(GLint i) { fp_glEvalPoint1(i); } -inline void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) { fp_glEvalMesh2(mode, i1, i2, j1, j2); } -inline void glEvalPoint2(GLint i, GLint j) { fp_glEvalPoint2(i, j); } -inline void glAlphaFunc(GLenum func, GLfloat ref) { fp_glAlphaFunc(func, ref); } -inline void glPixelZoom(GLfloat xfactor, GLfloat yfactor) { fp_glPixelZoom(xfactor, yfactor); } -inline void glPixelTransferf(GLenum pname, GLfloat param) { fp_glPixelTransferf(pname, param); } -inline void glPixelTransferi(GLenum pname, GLint param) { fp_glPixelTransferi(pname, param); } -inline void glPixelMapfv(GLenum map, GLsizei mapsize, const GLfloat* values) { fp_glPixelMapfv(map, mapsize, values); } -inline void glPixelMapuiv(GLenum map, GLsizei mapsize, const GLuint* values) { fp_glPixelMapuiv(map, mapsize, values); } -inline void glPixelMapusv(GLenum map, GLsizei mapsize, const GLushort* values) { fp_glPixelMapusv(map, mapsize, values); } -inline void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type) { fp_glCopyPixels(x, y, width, height, type); } -inline void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) { fp_glDrawPixels(width, height, format, type, pixels); } -inline void glGetClipPlane(GLenum plane, GLdouble* equation) { fp_glGetClipPlane(plane, equation); } -inline void glGetLightfv(GLenum light, GLenum pname, GLfloat* params) { fp_glGetLightfv(light, pname, params); } -inline void glGetLightiv(GLenum light, GLenum pname, GLint* params) { fp_glGetLightiv(light, pname, params); } -inline void glGetMapdv(GLenum target, GLenum query, GLdouble* v) { fp_glGetMapdv(target, query, v); } -inline void glGetMapfv(GLenum target, GLenum query, GLfloat* v) { fp_glGetMapfv(target, query, v); } -inline void glGetMapiv(GLenum target, GLenum query, GLint* v) { fp_glGetMapiv(target, query, v); } -inline void glGetMaterialfv(GLenum face, GLenum pname, GLfloat* params) { fp_glGetMaterialfv(face, pname, params); } -inline void glGetMaterialiv(GLenum face, GLenum pname, GLint* params) { fp_glGetMaterialiv(face, pname, params); } -inline void glGetPixelMapfv(GLenum map, GLfloat* values) { fp_glGetPixelMapfv(map, values); } -inline void glGetPixelMapuiv(GLenum map, GLuint* values) { fp_glGetPixelMapuiv(map, values); } -inline void glGetPixelMapusv(GLenum map, GLushort* values) { fp_glGetPixelMapusv(map, values); } -inline void glGetPolygonStipple(GLubyte* mask) { fp_glGetPolygonStipple(mask); } -inline void glGetTexEnvfv(GLenum target, GLenum pname, GLfloat* params) { fp_glGetTexEnvfv(target, pname, params); } -inline void glGetTexEnviv(GLenum target, GLenum pname, GLint* params) { fp_glGetTexEnviv(target, pname, params); } -inline void glGetTexGendv(GLenum coord, GLenum pname, GLdouble* params) { fp_glGetTexGendv(coord, pname, params); } -inline void glGetTexGenfv(GLenum coord, GLenum pname, GLfloat* params) { fp_glGetTexGenfv(coord, pname, params); } -inline void glGetTexGeniv(GLenum coord, GLenum pname, GLint* params) { fp_glGetTexGeniv(coord, pname, params); } -inline GLboolean glIsList(GLuint list) { return fp_glIsList(list); } -inline void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) { fp_glFrustum(left, right, bottom, top, zNear, zFar); } -inline void glLoadIdentity() { fp_glLoadIdentity(); } -inline void glLoadMatrixf(const GLfloat* m) { fp_glLoadMatrixf(m); } -inline void glLoadMatrixd(const GLdouble* m) { fp_glLoadMatrixd(m); } -inline void glMatrixMode(GLenum mode) { fp_glMatrixMode(mode); } -inline void glMultMatrixf(const GLfloat* m) { fp_glMultMatrixf(m); } -inline void glMultMatrixd(const GLdouble* m) { fp_glMultMatrixd(m); } -inline void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) { fp_glOrtho(left, right, bottom, top, zNear, zFar); } -inline void glPopMatrix() { fp_glPopMatrix(); } -inline void glPushMatrix() { fp_glPushMatrix(); } -inline void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z) { fp_glRotated(angle, x, y, z); } -inline void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) { fp_glRotatef(angle, x, y, z); } -inline void glScaled(GLdouble x, GLdouble y, GLdouble z) { fp_glScaled(x, y, z); } -inline void glScalef(GLfloat x, GLfloat y, GLfloat z) { fp_glScalef(x, y, z); } -inline void glTranslated(GLdouble x, GLdouble y, GLdouble z) { fp_glTranslated(x, y, z); } -inline void glTranslatef(GLfloat x, GLfloat y, GLfloat z) { fp_glTranslatef(x, y, z); } - -/* GL_VERSION_1_1 */ -inline void glDrawArrays(GLenum mode, GLint first, GLsizei count) { fp_glDrawArrays(mode, first, count); } -inline void glDrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices) { fp_glDrawElements(mode, count, type, indices); } -inline void glGetPointerv(GLenum pname, void** params) { fp_glGetPointerv(pname, params); } -inline void glPolygonOffset(GLfloat factor, GLfloat units) { fp_glPolygonOffset(factor, units); } -inline void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) { fp_glCopyTexImage1D(target, level, internalformat, x, y, width, border); } -inline void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { fp_glCopyTexImage2D(target, level, internalformat, x, y, width, height, border); } -inline void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) { fp_glCopyTexSubImage1D(target, level, xoffset, x, y, width); } -inline void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { fp_glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); } -inline void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void* pixels) { fp_glTexSubImage1D(target, level, xoffset, width, format, type, pixels); } -inline void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) { fp_glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); } -inline void glBindTexture(GLenum target, GLuint texture) { fp_glBindTexture(target, texture); } -inline void glDeleteTextures(GLsizei n, const GLuint* textures) { fp_glDeleteTextures(n, textures); } -inline void glGenTextures(GLsizei n, GLuint* textures) { fp_glGenTextures(n, textures); } -inline GLboolean glIsTexture(GLuint texture) { return fp_glIsTexture(texture); } -inline void glArrayElement(GLint i) { fp_glArrayElement(i); } -inline void glColorPointer(GLint size, GLenum type, GLsizei stride, const void* pointer) { fp_glColorPointer(size, type, stride, pointer); } -inline void glDisableClientState(GLenum array) { fp_glDisableClientState(array); } -inline void glEdgeFlagPointer(GLsizei stride, const void* pointer) { fp_glEdgeFlagPointer(stride, pointer); } -inline void glEnableClientState(GLenum array) { fp_glEnableClientState(array); } -inline void glIndexPointer(GLenum type, GLsizei stride, const void* pointer) { fp_glIndexPointer(type, stride, pointer); } -inline void glInterleavedArrays(GLenum format, GLsizei stride, const void* pointer) { fp_glInterleavedArrays(format, stride, pointer); } -inline void glNormalPointer(GLenum type, GLsizei stride, const void* pointer) { fp_glNormalPointer(type, stride, pointer); } -inline void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const void* pointer) { fp_glTexCoordPointer(size, type, stride, pointer); } -inline void glVertexPointer(GLint size, GLenum type, GLsizei stride, const void* pointer) { fp_glVertexPointer(size, type, stride, pointer); } -inline GLboolean glAreTexturesResident(GLsizei n, const GLuint* textures, GLboolean* residences) { return fp_glAreTexturesResident(n, textures, residences); } -inline void glPrioritizeTextures(GLsizei n, const GLuint* textures, const GLfloat* priorities) { fp_glPrioritizeTextures(n, textures, priorities); } -inline void glIndexub(GLubyte c) { fp_glIndexub(c); } -inline void glIndexubv(const GLubyte* c) { fp_glIndexubv(c); } -inline void glPopClientAttrib() { fp_glPopClientAttrib(); } -inline void glPushClientAttrib(GLbitfield mask) { fp_glPushClientAttrib(mask); } - -/* GL_VERSION_1_2 */ -inline void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void* indices) { fp_glDrawRangeElements(mode, start, end, count, type, indices); } -inline void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void* pixels) { fp_glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels); } -inline void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels) { fp_glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); } -inline void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) { fp_glCopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height); } - -/* GL_VERSION_1_3 */ -inline void glActiveTexture(GLenum texture) { fp_glActiveTexture(texture); } -inline void glSampleCoverage(GLfloat value, GLboolean invert) { fp_glSampleCoverage(value, invert); } -inline void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data) { fp_glCompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data); } -inline void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) { fp_glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data); } -inline void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void* data) { fp_glCompressedTexImage1D(target, level, internalformat, width, border, imageSize, data); } -inline void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data) { fp_glCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); } -inline void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) { fp_glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data); } -inline void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void* data) { fp_glCompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data); } -inline void glGetCompressedTexImage(GLenum target, GLint level, void* img) { fp_glGetCompressedTexImage(target, level, img); } -inline void glClientActiveTexture(GLenum texture) { fp_glClientActiveTexture(texture); } -inline void glMultiTexCoord1d(GLenum target, GLdouble s) { fp_glMultiTexCoord1d(target, s); } -inline void glMultiTexCoord1dv(GLenum target, const GLdouble* v) { fp_glMultiTexCoord1dv(target, v); } -inline void glMultiTexCoord1f(GLenum target, GLfloat s) { fp_glMultiTexCoord1f(target, s); } -inline void glMultiTexCoord1fv(GLenum target, const GLfloat* v) { fp_glMultiTexCoord1fv(target, v); } -inline void glMultiTexCoord1i(GLenum target, GLint s) { fp_glMultiTexCoord1i(target, s); } -inline void glMultiTexCoord1iv(GLenum target, const GLint* v) { fp_glMultiTexCoord1iv(target, v); } -inline void glMultiTexCoord1s(GLenum target, GLshort s) { fp_glMultiTexCoord1s(target, s); } -inline void glMultiTexCoord1sv(GLenum target, const GLshort* v) { fp_glMultiTexCoord1sv(target, v); } -inline void glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t) { fp_glMultiTexCoord2d(target, s, t); } -inline void glMultiTexCoord2dv(GLenum target, const GLdouble* v) { fp_glMultiTexCoord2dv(target, v); } -inline void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t) { fp_glMultiTexCoord2f(target, s, t); } -inline void glMultiTexCoord2fv(GLenum target, const GLfloat* v) { fp_glMultiTexCoord2fv(target, v); } -inline void glMultiTexCoord2i(GLenum target, GLint s, GLint t) { fp_glMultiTexCoord2i(target, s, t); } -inline void glMultiTexCoord2iv(GLenum target, const GLint* v) { fp_glMultiTexCoord2iv(target, v); } -inline void glMultiTexCoord2s(GLenum target, GLshort s, GLshort t) { fp_glMultiTexCoord2s(target, s, t); } -inline void glMultiTexCoord2sv(GLenum target, const GLshort* v) { fp_glMultiTexCoord2sv(target, v); } -inline void glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r) { fp_glMultiTexCoord3d(target, s, t, r); } -inline void glMultiTexCoord3dv(GLenum target, const GLdouble* v) { fp_glMultiTexCoord3dv(target, v); } -inline void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r) { fp_glMultiTexCoord3f(target, s, t, r); } -inline void glMultiTexCoord3fv(GLenum target, const GLfloat* v) { fp_glMultiTexCoord3fv(target, v); } -inline void glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r) { fp_glMultiTexCoord3i(target, s, t, r); } -inline void glMultiTexCoord3iv(GLenum target, const GLint* v) { fp_glMultiTexCoord3iv(target, v); } -inline void glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r) { fp_glMultiTexCoord3s(target, s, t, r); } -inline void glMultiTexCoord3sv(GLenum target, const GLshort* v) { fp_glMultiTexCoord3sv(target, v); } -inline void glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) { fp_glMultiTexCoord4d(target, s, t, r, q); } -inline void glMultiTexCoord4dv(GLenum target, const GLdouble* v) { fp_glMultiTexCoord4dv(target, v); } -inline void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) { fp_glMultiTexCoord4f(target, s, t, r, q); } -inline void glMultiTexCoord4fv(GLenum target, const GLfloat* v) { fp_glMultiTexCoord4fv(target, v); } -inline void glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q) { fp_glMultiTexCoord4i(target, s, t, r, q); } -inline void glMultiTexCoord4iv(GLenum target, const GLint* v) { fp_glMultiTexCoord4iv(target, v); } -inline void glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) { fp_glMultiTexCoord4s(target, s, t, r, q); } -inline void glMultiTexCoord4sv(GLenum target, const GLshort* v) { fp_glMultiTexCoord4sv(target, v); } -inline void glLoadTransposeMatrixf(const GLfloat* m) { fp_glLoadTransposeMatrixf(m); } -inline void glLoadTransposeMatrixd(const GLdouble* m) { fp_glLoadTransposeMatrixd(m); } -inline void glMultTransposeMatrixf(const GLfloat* m) { fp_glMultTransposeMatrixf(m); } -inline void glMultTransposeMatrixd(const GLdouble* m) { fp_glMultTransposeMatrixd(m); } - -/* GL_VERSION_1_4 */ -inline void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) { fp_glBlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha); } -inline void glMultiDrawArrays(GLenum mode, const GLint* first, const GLsizei* count, GLsizei drawcount) { fp_glMultiDrawArrays(mode, first, count, drawcount); } -inline void glMultiDrawElements(GLenum mode, const GLsizei* count, GLenum type, const void** indices, GLsizei drawcount) { fp_glMultiDrawElements(mode, count, type, indices, drawcount); } -inline void glPointParameterf(GLenum pname, GLfloat param) { fp_glPointParameterf(pname, param); } -inline void glPointParameterfv(GLenum pname, const GLfloat* params) { fp_glPointParameterfv(pname, params); } -inline void glPointParameteri(GLenum pname, GLint param) { fp_glPointParameteri(pname, param); } -inline void glPointParameteriv(GLenum pname, const GLint* params) { fp_glPointParameteriv(pname, params); } -inline void glFogCoordf(GLfloat coord) { fp_glFogCoordf(coord); } -inline void glFogCoordfv(const GLfloat* coord) { fp_glFogCoordfv(coord); } -inline void glFogCoordd(GLdouble coord) { fp_glFogCoordd(coord); } -inline void glFogCoorddv(const GLdouble* coord) { fp_glFogCoorddv(coord); } -inline void glFogCoordPointer(GLenum type, GLsizei stride, const void* pointer) { fp_glFogCoordPointer(type, stride, pointer); } -inline void glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue) { fp_glSecondaryColor3b(red, green, blue); } -inline void glSecondaryColor3bv(const GLbyte* v) { fp_glSecondaryColor3bv(v); } -inline void glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue) { fp_glSecondaryColor3d(red, green, blue); } -inline void glSecondaryColor3dv(const GLdouble* v) { fp_glSecondaryColor3dv(v); } -inline void glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue) { fp_glSecondaryColor3f(red, green, blue); } -inline void glSecondaryColor3fv(const GLfloat* v) { fp_glSecondaryColor3fv(v); } -inline void glSecondaryColor3i(GLint red, GLint green, GLint blue) { fp_glSecondaryColor3i(red, green, blue); } -inline void glSecondaryColor3iv(const GLint* v) { fp_glSecondaryColor3iv(v); } -inline void glSecondaryColor3s(GLshort red, GLshort green, GLshort blue) { fp_glSecondaryColor3s(red, green, blue); } -inline void glSecondaryColor3sv(const GLshort* v) { fp_glSecondaryColor3sv(v); } -inline void glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue) { fp_glSecondaryColor3ub(red, green, blue); } -inline void glSecondaryColor3ubv(const GLubyte* v) { fp_glSecondaryColor3ubv(v); } -inline void glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue) { fp_glSecondaryColor3ui(red, green, blue); } -inline void glSecondaryColor3uiv(const GLuint* v) { fp_glSecondaryColor3uiv(v); } -inline void glSecondaryColor3us(GLushort red, GLushort green, GLushort blue) { fp_glSecondaryColor3us(red, green, blue); } -inline void glSecondaryColor3usv(const GLushort* v) { fp_glSecondaryColor3usv(v); } -inline void glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const void* pointer) { fp_glSecondaryColorPointer(size, type, stride, pointer); } -inline void glWindowPos2d(GLdouble x, GLdouble y) { fp_glWindowPos2d(x, y); } -inline void glWindowPos2dv(const GLdouble* v) { fp_glWindowPos2dv(v); } -inline void glWindowPos2f(GLfloat x, GLfloat y) { fp_glWindowPos2f(x, y); } -inline void glWindowPos2fv(const GLfloat* v) { fp_glWindowPos2fv(v); } -inline void glWindowPos2i(GLint x, GLint y) { fp_glWindowPos2i(x, y); } -inline void glWindowPos2iv(const GLint* v) { fp_glWindowPos2iv(v); } -inline void glWindowPos2s(GLshort x, GLshort y) { fp_glWindowPos2s(x, y); } -inline void glWindowPos2sv(const GLshort* v) { fp_glWindowPos2sv(v); } -inline void glWindowPos3d(GLdouble x, GLdouble y, GLdouble z) { fp_glWindowPos3d(x, y, z); } -inline void glWindowPos3dv(const GLdouble* v) { fp_glWindowPos3dv(v); } -inline void glWindowPos3f(GLfloat x, GLfloat y, GLfloat z) { fp_glWindowPos3f(x, y, z); } -inline void glWindowPos3fv(const GLfloat* v) { fp_glWindowPos3fv(v); } -inline void glWindowPos3i(GLint x, GLint y, GLint z) { fp_glWindowPos3i(x, y, z); } -inline void glWindowPos3iv(const GLint* v) { fp_glWindowPos3iv(v); } -inline void glWindowPos3s(GLshort x, GLshort y, GLshort z) { fp_glWindowPos3s(x, y, z); } -inline void glWindowPos3sv(const GLshort* v) { fp_glWindowPos3sv(v); } -inline void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { fp_glBlendColor(red, green, blue, alpha); } -inline void glBlendEquation(GLenum mode) { fp_glBlendEquation(mode); } - -/* GL_VERSION_1_5 */ -inline void glGenQueries(GLsizei n, GLuint* ids) { fp_glGenQueries(n, ids); } -inline void glDeleteQueries(GLsizei n, const GLuint* ids) { fp_glDeleteQueries(n, ids); } -inline GLboolean glIsQuery(GLuint id) { return fp_glIsQuery(id); } -inline void glBeginQuery(GLenum target, GLuint id) { fp_glBeginQuery(target, id); } -inline void glEndQuery(GLenum target) { fp_glEndQuery(target); } -inline void glGetQueryiv(GLenum target, GLenum pname, GLint* params) { fp_glGetQueryiv(target, pname, params); } -inline void glGetQueryObjectiv(GLuint id, GLenum pname, GLint* params) { fp_glGetQueryObjectiv(id, pname, params); } -inline void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params) { fp_glGetQueryObjectuiv(id, pname, params); } -inline void glBindBuffer(GLenum target, GLuint buffer) { fp_glBindBuffer(target, buffer); } -inline void glDeleteBuffers(GLsizei n, const GLuint* buffers) { fp_glDeleteBuffers(n, buffers); } -inline void glGenBuffers(GLsizei n, GLuint* buffers) { fp_glGenBuffers(n, buffers); } -inline GLboolean glIsBuffer(GLuint buffer) { return fp_glIsBuffer(buffer); } -inline void glBufferData(GLenum target, GLsizeiptr size, const void* data, GLenum usage) { fp_glBufferData(target, size, data, usage); } -inline void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void* data) { fp_glBufferSubData(target, offset, size, data); } -inline void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, void* data) { fp_glGetBufferSubData(target, offset, size, data); } -inline void* glMapBuffer(GLenum target, GLenum access) { return fp_glMapBuffer(target, access); } -inline GLboolean glUnmapBuffer(GLenum target) { return fp_glUnmapBuffer(target); } -inline void glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) { fp_glGetBufferParameteriv(target, pname, params); } -inline void glGetBufferPointerv(GLenum target, GLenum pname, void** params) { fp_glGetBufferPointerv(target, pname, params); } - -/* GL_VERSION_2_0 */ -inline void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) { fp_glBlendEquationSeparate(modeRGB, modeAlpha); } -inline void glDrawBuffers(GLsizei n, const GLenum* bufs) { fp_glDrawBuffers(n, bufs); } -inline void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass) { fp_glStencilOpSeparate(face, sfail, dpfail, dppass); } -inline void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) { fp_glStencilFuncSeparate(face, func, ref, mask); } -inline void glStencilMaskSeparate(GLenum face, GLuint mask) { fp_glStencilMaskSeparate(face, mask); } -inline void glAttachShader(GLuint program, GLuint shader) { fp_glAttachShader(program, shader); } -inline void glBindAttribLocation(GLuint program, GLuint index, const GLchar* name) { fp_glBindAttribLocation(program, index, name); } -inline void glCompileShader(GLuint shader) { fp_glCompileShader(shader); } -inline GLuint glCreateProgram() { return fp_glCreateProgram(); } -inline GLuint glCreateShader(GLenum type) { return fp_glCreateShader(type); } -inline void glDeleteProgram(GLuint program) { fp_glDeleteProgram(program); } -inline void glDeleteShader(GLuint shader) { fp_glDeleteShader(shader); } -inline void glDetachShader(GLuint program, GLuint shader) { fp_glDetachShader(program, shader); } -inline void glDisableVertexAttribArray(GLuint index) { fp_glDisableVertexAttribArray(index); } -inline void glEnableVertexAttribArray(GLuint index) { fp_glEnableVertexAttribArray(index); } -inline void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) { fp_glGetActiveAttrib(program, index, bufSize, length, size, type, name); } -inline void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) { fp_glGetActiveUniform(program, index, bufSize, length, size, type, name); } -inline void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei* count, GLuint* shaders) { fp_glGetAttachedShaders(program, maxCount, count, shaders); } -inline GLint glGetAttribLocation(GLuint program, const GLchar* name) { return fp_glGetAttribLocation(program, name); } -inline void glGetProgramiv(GLuint program, GLenum pname, GLint* params) { fp_glGetProgramiv(program, pname, params); } -inline void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei* length, GLchar* infoLog) { fp_glGetProgramInfoLog(program, bufSize, length, infoLog); } -inline void glGetShaderiv(GLuint shader, GLenum pname, GLint* params) { fp_glGetShaderiv(shader, pname, params); } -inline void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei* length, GLchar* infoLog) { fp_glGetShaderInfoLog(shader, bufSize, length, infoLog); } -inline void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei* length, GLchar* source) { fp_glGetShaderSource(shader, bufSize, length, source); } -inline GLint glGetUniformLocation(GLuint program, const GLchar* name) { return fp_glGetUniformLocation(program, name); } -inline void glGetUniformfv(GLuint program, GLint location, GLfloat* params) { fp_glGetUniformfv(program, location, params); } -inline void glGetUniformiv(GLuint program, GLint location, GLint* params) { fp_glGetUniformiv(program, location, params); } -inline void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble* params) { fp_glGetVertexAttribdv(index, pname, params); } -inline void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) { fp_glGetVertexAttribfv(index, pname, params); } -inline void glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) { fp_glGetVertexAttribiv(index, pname, params); } -inline void glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer) { fp_glGetVertexAttribPointerv(index, pname, pointer); } -inline GLboolean glIsProgram(GLuint program) { return fp_glIsProgram(program); } -inline GLboolean glIsShader(GLuint shader) { return fp_glIsShader(shader); } -inline void glLinkProgram(GLuint program) { fp_glLinkProgram(program); } -inline void glShaderSource(GLuint shader, GLsizei count, const GLchar** string, const GLint* length) { fp_glShaderSource(shader, count, string, length); } -inline void glUseProgram(GLuint program) { fp_glUseProgram(program); } -inline void glUniform1f(GLint location, GLfloat v0) { fp_glUniform1f(location, v0); } -inline void glUniform2f(GLint location, GLfloat v0, GLfloat v1) { fp_glUniform2f(location, v0, v1); } -inline void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) { fp_glUniform3f(location, v0, v1, v2); } -inline void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) { fp_glUniform4f(location, v0, v1, v2, v3); } -inline void glUniform1i(GLint location, GLint v0) { fp_glUniform1i(location, v0); } -inline void glUniform2i(GLint location, GLint v0, GLint v1) { fp_glUniform2i(location, v0, v1); } -inline void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2) { fp_glUniform3i(location, v0, v1, v2); } -inline void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) { fp_glUniform4i(location, v0, v1, v2, v3); } -inline void glUniform1fv(GLint location, GLsizei count, const GLfloat* value) { fp_glUniform1fv(location, count, value); } -inline void glUniform2fv(GLint location, GLsizei count, const GLfloat* value) { fp_glUniform2fv(location, count, value); } -inline void glUniform3fv(GLint location, GLsizei count, const GLfloat* value) { fp_glUniform3fv(location, count, value); } -inline void glUniform4fv(GLint location, GLsizei count, const GLfloat* value) { fp_glUniform4fv(location, count, value); } -inline void glUniform1iv(GLint location, GLsizei count, const GLint* value) { fp_glUniform1iv(location, count, value); } -inline void glUniform2iv(GLint location, GLsizei count, const GLint* value) { fp_glUniform2iv(location, count, value); } -inline void glUniform3iv(GLint location, GLsizei count, const GLint* value) { fp_glUniform3iv(location, count, value); } -inline void glUniform4iv(GLint location, GLsizei count, const GLint* value) { fp_glUniform4iv(location, count, value); } -inline void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glUniformMatrix2fv(location, count, transpose, value); } -inline void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glUniformMatrix3fv(location, count, transpose, value); } -inline void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glUniformMatrix4fv(location, count, transpose, value); } -inline void glValidateProgram(GLuint program) { fp_glValidateProgram(program); } -inline void glVertexAttrib1d(GLuint index, GLdouble x) { fp_glVertexAttrib1d(index, x); } -inline void glVertexAttrib1dv(GLuint index, const GLdouble* v) { fp_glVertexAttrib1dv(index, v); } -inline void glVertexAttrib1f(GLuint index, GLfloat x) { fp_glVertexAttrib1f(index, x); } -inline void glVertexAttrib1fv(GLuint index, const GLfloat* v) { fp_glVertexAttrib1fv(index, v); } -inline void glVertexAttrib1s(GLuint index, GLshort x) { fp_glVertexAttrib1s(index, x); } -inline void glVertexAttrib1sv(GLuint index, const GLshort* v) { fp_glVertexAttrib1sv(index, v); } -inline void glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y) { fp_glVertexAttrib2d(index, x, y); } -inline void glVertexAttrib2dv(GLuint index, const GLdouble* v) { fp_glVertexAttrib2dv(index, v); } -inline void glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y) { fp_glVertexAttrib2f(index, x, y); } -inline void glVertexAttrib2fv(GLuint index, const GLfloat* v) { fp_glVertexAttrib2fv(index, v); } -inline void glVertexAttrib2s(GLuint index, GLshort x, GLshort y) { fp_glVertexAttrib2s(index, x, y); } -inline void glVertexAttrib2sv(GLuint index, const GLshort* v) { fp_glVertexAttrib2sv(index, v); } -inline void glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z) { fp_glVertexAttrib3d(index, x, y, z); } -inline void glVertexAttrib3dv(GLuint index, const GLdouble* v) { fp_glVertexAttrib3dv(index, v); } -inline void glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z) { fp_glVertexAttrib3f(index, x, y, z); } -inline void glVertexAttrib3fv(GLuint index, const GLfloat* v) { fp_glVertexAttrib3fv(index, v); } -inline void glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z) { fp_glVertexAttrib3s(index, x, y, z); } -inline void glVertexAttrib3sv(GLuint index, const GLshort* v) { fp_glVertexAttrib3sv(index, v); } -inline void glVertexAttrib4Nbv(GLuint index, const GLbyte* v) { fp_glVertexAttrib4Nbv(index, v); } -inline void glVertexAttrib4Niv(GLuint index, const GLint* v) { fp_glVertexAttrib4Niv(index, v); } -inline void glVertexAttrib4Nsv(GLuint index, const GLshort* v) { fp_glVertexAttrib4Nsv(index, v); } -inline void glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) { fp_glVertexAttrib4Nub(index, x, y, z, w); } -inline void glVertexAttrib4Nubv(GLuint index, const GLubyte* v) { fp_glVertexAttrib4Nubv(index, v); } -inline void glVertexAttrib4Nuiv(GLuint index, const GLuint* v) { fp_glVertexAttrib4Nuiv(index, v); } -inline void glVertexAttrib4Nusv(GLuint index, const GLushort* v) { fp_glVertexAttrib4Nusv(index, v); } -inline void glVertexAttrib4bv(GLuint index, const GLbyte* v) { fp_glVertexAttrib4bv(index, v); } -inline void glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { fp_glVertexAttrib4d(index, x, y, z, w); } -inline void glVertexAttrib4dv(GLuint index, const GLdouble* v) { fp_glVertexAttrib4dv(index, v); } -inline void glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { fp_glVertexAttrib4f(index, x, y, z, w); } -inline void glVertexAttrib4fv(GLuint index, const GLfloat* v) { fp_glVertexAttrib4fv(index, v); } -inline void glVertexAttrib4iv(GLuint index, const GLint* v) { fp_glVertexAttrib4iv(index, v); } -inline void glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) { fp_glVertexAttrib4s(index, x, y, z, w); } -inline void glVertexAttrib4sv(GLuint index, const GLshort* v) { fp_glVertexAttrib4sv(index, v); } -inline void glVertexAttrib4ubv(GLuint index, const GLubyte* v) { fp_glVertexAttrib4ubv(index, v); } -inline void glVertexAttrib4uiv(GLuint index, const GLuint* v) { fp_glVertexAttrib4uiv(index, v); } -inline void glVertexAttrib4usv(GLuint index, const GLushort* v) { fp_glVertexAttrib4usv(index, v); } -inline void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* pointer) { fp_glVertexAttribPointer(index, size, type, normalized, stride, pointer); } - -/* GL_VERSION_2_1 */ -inline void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glUniformMatrix2x3fv(location, count, transpose, value); } -inline void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glUniformMatrix3x2fv(location, count, transpose, value); } -inline void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glUniformMatrix2x4fv(location, count, transpose, value); } -inline void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glUniformMatrix4x2fv(location, count, transpose, value); } -inline void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glUniformMatrix3x4fv(location, count, transpose, value); } -inline void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glUniformMatrix4x3fv(location, count, transpose, value); } - -/* GL_VERSION_3_0 */ -inline void glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a) { fp_glColorMaski(index, r, g, b, a); } -inline void glGetBooleani_v(GLenum target, GLuint index, GLboolean* data) { fp_glGetBooleani_v(target, index, data); } -inline void glGetIntegeri_v(GLenum target, GLuint index, GLint* data) { fp_glGetIntegeri_v(target, index, data); } -inline void glEnablei(GLenum target, GLuint index) { fp_glEnablei(target, index); } -inline void glDisablei(GLenum target, GLuint index) { fp_glDisablei(target, index); } -inline GLboolean glIsEnabledi(GLenum target, GLuint index) { return fp_glIsEnabledi(target, index); } -inline void glBeginTransformFeedback(GLenum primitiveMode) { fp_glBeginTransformFeedback(primitiveMode); } -inline void glEndTransformFeedback() { fp_glEndTransformFeedback(); } -inline void glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) { fp_glBindBufferRange(target, index, buffer, offset, size); } -inline void glBindBufferBase(GLenum target, GLuint index, GLuint buffer) { fp_glBindBufferBase(target, index, buffer); } -inline void glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar** varyings, GLenum bufferMode) { fp_glTransformFeedbackVaryings(program, count, varyings, bufferMode); } -inline void glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name) { fp_glGetTransformFeedbackVarying(program, index, bufSize, length, size, type, name); } -inline void glClampColor(GLenum target, GLenum clamp) { fp_glClampColor(target, clamp); } -inline void glBeginConditionalRender(GLuint id, GLenum mode) { fp_glBeginConditionalRender(id, mode); } -inline void glEndConditionalRender() { fp_glEndConditionalRender(); } -inline void glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void* pointer) { fp_glVertexAttribIPointer(index, size, type, stride, pointer); } -inline void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint* params) { fp_glGetVertexAttribIiv(index, pname, params); } -inline void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params) { fp_glGetVertexAttribIuiv(index, pname, params); } -inline void glVertexAttribI1i(GLuint index, GLint x) { fp_glVertexAttribI1i(index, x); } -inline void glVertexAttribI2i(GLuint index, GLint x, GLint y) { fp_glVertexAttribI2i(index, x, y); } -inline void glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z) { fp_glVertexAttribI3i(index, x, y, z); } -inline void glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w) { fp_glVertexAttribI4i(index, x, y, z, w); } -inline void glVertexAttribI1ui(GLuint index, GLuint x) { fp_glVertexAttribI1ui(index, x); } -inline void glVertexAttribI2ui(GLuint index, GLuint x, GLuint y) { fp_glVertexAttribI2ui(index, x, y); } -inline void glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z) { fp_glVertexAttribI3ui(index, x, y, z); } -inline void glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) { fp_glVertexAttribI4ui(index, x, y, z, w); } -inline void glVertexAttribI1iv(GLuint index, const GLint* v) { fp_glVertexAttribI1iv(index, v); } -inline void glVertexAttribI2iv(GLuint index, const GLint* v) { fp_glVertexAttribI2iv(index, v); } -inline void glVertexAttribI3iv(GLuint index, const GLint* v) { fp_glVertexAttribI3iv(index, v); } -inline void glVertexAttribI4iv(GLuint index, const GLint* v) { fp_glVertexAttribI4iv(index, v); } -inline void glVertexAttribI1uiv(GLuint index, const GLuint* v) { fp_glVertexAttribI1uiv(index, v); } -inline void glVertexAttribI2uiv(GLuint index, const GLuint* v) { fp_glVertexAttribI2uiv(index, v); } -inline void glVertexAttribI3uiv(GLuint index, const GLuint* v) { fp_glVertexAttribI3uiv(index, v); } -inline void glVertexAttribI4uiv(GLuint index, const GLuint* v) { fp_glVertexAttribI4uiv(index, v); } -inline void glVertexAttribI4bv(GLuint index, const GLbyte* v) { fp_glVertexAttribI4bv(index, v); } -inline void glVertexAttribI4sv(GLuint index, const GLshort* v) { fp_glVertexAttribI4sv(index, v); } -inline void glVertexAttribI4ubv(GLuint index, const GLubyte* v) { fp_glVertexAttribI4ubv(index, v); } -inline void glVertexAttribI4usv(GLuint index, const GLushort* v) { fp_glVertexAttribI4usv(index, v); } -inline void glGetUniformuiv(GLuint program, GLint location, GLuint* params) { fp_glGetUniformuiv(program, location, params); } -inline void glBindFragDataLocation(GLuint program, GLuint color, const GLchar* name) { fp_glBindFragDataLocation(program, color, name); } -inline GLint glGetFragDataLocation(GLuint program, const GLchar* name) { return fp_glGetFragDataLocation(program, name); } -inline void glUniform1ui(GLint location, GLuint v0) { fp_glUniform1ui(location, v0); } -inline void glUniform2ui(GLint location, GLuint v0, GLuint v1) { fp_glUniform2ui(location, v0, v1); } -inline void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) { fp_glUniform3ui(location, v0, v1, v2); } -inline void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { fp_glUniform4ui(location, v0, v1, v2, v3); } -inline void glUniform1uiv(GLint location, GLsizei count, const GLuint* value) { fp_glUniform1uiv(location, count, value); } -inline void glUniform2uiv(GLint location, GLsizei count, const GLuint* value) { fp_glUniform2uiv(location, count, value); } -inline void glUniform3uiv(GLint location, GLsizei count, const GLuint* value) { fp_glUniform3uiv(location, count, value); } -inline void glUniform4uiv(GLint location, GLsizei count, const GLuint* value) { fp_glUniform4uiv(location, count, value); } -inline void glTexParameterIiv(GLenum target, GLenum pname, const GLint* params) { fp_glTexParameterIiv(target, pname, params); } -inline void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint* params) { fp_glTexParameterIuiv(target, pname, params); } -inline void glGetTexParameterIiv(GLenum target, GLenum pname, GLint* params) { fp_glGetTexParameterIiv(target, pname, params); } -inline void glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint* params) { fp_glGetTexParameterIuiv(target, pname, params); } -inline void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value) { fp_glClearBufferiv(buffer, drawbuffer, value); } -inline void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value) { fp_glClearBufferuiv(buffer, drawbuffer, value); } -inline void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value) { fp_glClearBufferfv(buffer, drawbuffer, value); } -inline void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) { fp_glClearBufferfi(buffer, drawbuffer, depth, stencil); } -inline const GLubyte* glGetStringi(GLenum name, GLuint index) { return fp_glGetStringi(name, index); } -inline GLboolean glIsRenderbuffer(GLuint renderbuffer) { return fp_glIsRenderbuffer(renderbuffer); } -inline void glBindRenderbuffer(GLenum target, GLuint renderbuffer) { fp_glBindRenderbuffer(target, renderbuffer); } -inline void glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) { fp_glDeleteRenderbuffers(n, renderbuffers); } -inline void glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) { fp_glGenRenderbuffers(n, renderbuffers); } -inline void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { fp_glRenderbufferStorage(target, internalformat, width, height); } -inline void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) { fp_glGetRenderbufferParameteriv(target, pname, params); } -inline GLboolean glIsFramebuffer(GLuint framebuffer) { return fp_glIsFramebuffer(framebuffer); } -inline void glBindFramebuffer(GLenum target, GLuint framebuffer) { fp_glBindFramebuffer(target, framebuffer); } -inline void glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) { fp_glDeleteFramebuffers(n, framebuffers); } -inline void glGenFramebuffers(GLsizei n, GLuint* framebuffers) { fp_glGenFramebuffers(n, framebuffers); } -inline GLenum glCheckFramebufferStatus(GLenum target) { return fp_glCheckFramebufferStatus(target); } -inline void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { fp_glFramebufferTexture1D(target, attachment, textarget, texture, level); } -inline void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { fp_glFramebufferTexture2D(target, attachment, textarget, texture, level); } -inline void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) { fp_glFramebufferTexture3D(target, attachment, textarget, texture, level, zoffset); } -inline void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { fp_glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer); } -inline void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) { fp_glGetFramebufferAttachmentParameteriv(target, attachment, pname, params); } -inline void glGenerateMipmap(GLenum target) { fp_glGenerateMipmap(target); } -inline void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { fp_glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); } -inline void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { fp_glRenderbufferStorageMultisample(target, samples, internalformat, width, height); } -inline void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) { fp_glFramebufferTextureLayer(target, attachment, texture, level, layer); } -inline void* glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) { return fp_glMapBufferRange(target, offset, length, access); } -inline void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) { fp_glFlushMappedBufferRange(target, offset, length); } -inline void glBindVertexArray(GLuint array) { fp_glBindVertexArray(array); } -inline void glDeleteVertexArrays(GLsizei n, const GLuint* arrays) { fp_glDeleteVertexArrays(n, arrays); } -inline void glGenVertexArrays(GLsizei n, GLuint* arrays) { fp_glGenVertexArrays(n, arrays); } -inline GLboolean glIsVertexArray(GLuint array) { return fp_glIsVertexArray(array); } - -/* GL_VERSION_3_1 */ -inline void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount) { fp_glDrawArraysInstanced(mode, first, count, instancecount); } -inline void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei instancecount) { fp_glDrawElementsInstanced(mode, count, type, indices, instancecount); } -inline void glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer) { fp_glTexBuffer(target, internalformat, buffer); } -inline void glPrimitiveRestartIndex(GLuint index) { fp_glPrimitiveRestartIndex(index); } -inline void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) { fp_glCopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size); } -inline void glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar** uniformNames, GLuint* uniformIndices) { fp_glGetUniformIndices(program, uniformCount, uniformNames, uniformIndices); } -inline void glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params) { fp_glGetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params); } -inline void glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformName) { fp_glGetActiveUniformName(program, uniformIndex, bufSize, length, uniformName); } -inline GLuint glGetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName) { return fp_glGetUniformBlockIndex(program, uniformBlockName); } -inline void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params) { fp_glGetActiveUniformBlockiv(program, uniformBlockIndex, pname, params); } -inline void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName) { fp_glGetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName); } -inline void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) { fp_glUniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding); } - -/* GL_VERSION_3_2 */ -inline void glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const void* indices, GLint basevertex) { fp_glDrawElementsBaseVertex(mode, count, type, indices, basevertex); } -inline void glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void* indices, GLint basevertex) { fp_glDrawRangeElementsBaseVertex(mode, start, end, count, type, indices, basevertex); } -inline void glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei instancecount, GLint basevertex) { fp_glDrawElementsInstancedBaseVertex(mode, count, type, indices, instancecount, basevertex); } -inline void glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei* count, GLenum type, const void** indices, GLsizei drawcount, const GLint* basevertex) { fp_glMultiDrawElementsBaseVertex(mode, count, type, indices, drawcount, basevertex); } -inline void glProvokingVertex(GLenum mode) { fp_glProvokingVertex(mode); } -inline GLsync glFenceSync(GLenum condition, GLbitfield flags) { return fp_glFenceSync(condition, flags); } -inline GLboolean glIsSync(GLsync sync) { return fp_glIsSync(sync); } -inline void glDeleteSync(GLsync sync) { fp_glDeleteSync(sync); } -inline GLenum glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) { return fp_glClientWaitSync(sync, flags, timeout); } -inline void glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) { fp_glWaitSync(sync, flags, timeout); } -inline void glGetInteger64v(GLenum pname, GLint64* data) { fp_glGetInteger64v(pname, data); } -inline void glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values) { fp_glGetSynciv(sync, pname, bufSize, length, values); } -inline void glGetInteger64i_v(GLenum target, GLuint index, GLint64* data) { fp_glGetInteger64i_v(target, index, data); } -inline void glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params) { fp_glGetBufferParameteri64v(target, pname, params); } -inline void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level) { fp_glFramebufferTexture(target, attachment, texture, level); } -inline void glTexImage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations) { fp_glTexImage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations); } -inline void glTexImage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations) { fp_glTexImage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations); } -inline void glGetMultisamplefv(GLenum pname, GLuint index, GLfloat* val) { fp_glGetMultisamplefv(pname, index, val); } -inline void glSampleMaski(GLuint maskNumber, GLbitfield mask) { fp_glSampleMaski(maskNumber, mask); } - -/* GL_VERSION_3_3 */ -inline void glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar* name) { fp_glBindFragDataLocationIndexed(program, colorNumber, index, name); } -inline GLint glGetFragDataIndex(GLuint program, const GLchar* name) { return fp_glGetFragDataIndex(program, name); } -inline void glGenSamplers(GLsizei count, GLuint* samplers) { fp_glGenSamplers(count, samplers); } -inline void glDeleteSamplers(GLsizei count, const GLuint* samplers) { fp_glDeleteSamplers(count, samplers); } -inline GLboolean glIsSampler(GLuint sampler) { return fp_glIsSampler(sampler); } -inline void glBindSampler(GLuint unit, GLuint sampler) { fp_glBindSampler(unit, sampler); } -inline void glSamplerParameteri(GLuint sampler, GLenum pname, GLint param) { fp_glSamplerParameteri(sampler, pname, param); } -inline void glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param) { fp_glSamplerParameteriv(sampler, pname, param); } -inline void glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param) { fp_glSamplerParameterf(sampler, pname, param); } -inline void glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param) { fp_glSamplerParameterfv(sampler, pname, param); } -inline void glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint* param) { fp_glSamplerParameterIiv(sampler, pname, param); } -inline void glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint* param) { fp_glSamplerParameterIuiv(sampler, pname, param); } -inline void glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params) { fp_glGetSamplerParameteriv(sampler, pname, params); } -inline void glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint* params) { fp_glGetSamplerParameterIiv(sampler, pname, params); } -inline void glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params) { fp_glGetSamplerParameterfv(sampler, pname, params); } -inline void glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint* params) { fp_glGetSamplerParameterIuiv(sampler, pname, params); } -inline void glQueryCounter(GLuint id, GLenum target) { fp_glQueryCounter(id, target); } -inline void glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64* params) { fp_glGetQueryObjecti64v(id, pname, params); } -inline void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64* params) { fp_glGetQueryObjectui64v(id, pname, params); } -inline void glVertexAttribDivisor(GLuint index, GLuint divisor) { fp_glVertexAttribDivisor(index, divisor); } -inline void glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value) { fp_glVertexAttribP1ui(index, type, normalized, value); } -inline void glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint* value) { fp_glVertexAttribP1uiv(index, type, normalized, value); } -inline void glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value) { fp_glVertexAttribP2ui(index, type, normalized, value); } -inline void glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint* value) { fp_glVertexAttribP2uiv(index, type, normalized, value); } -inline void glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value) { fp_glVertexAttribP3ui(index, type, normalized, value); } -inline void glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint* value) { fp_glVertexAttribP3uiv(index, type, normalized, value); } -inline void glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value) { fp_glVertexAttribP4ui(index, type, normalized, value); } -inline void glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint* value) { fp_glVertexAttribP4uiv(index, type, normalized, value); } -inline void glVertexP2ui(GLenum type, GLuint value) { fp_glVertexP2ui(type, value); } -inline void glVertexP2uiv(GLenum type, const GLuint* value) { fp_glVertexP2uiv(type, value); } -inline void glVertexP3ui(GLenum type, GLuint value) { fp_glVertexP3ui(type, value); } -inline void glVertexP3uiv(GLenum type, const GLuint* value) { fp_glVertexP3uiv(type, value); } -inline void glVertexP4ui(GLenum type, GLuint value) { fp_glVertexP4ui(type, value); } -inline void glVertexP4uiv(GLenum type, const GLuint* value) { fp_glVertexP4uiv(type, value); } -inline void glTexCoordP1ui(GLenum type, GLuint coords) { fp_glTexCoordP1ui(type, coords); } -inline void glTexCoordP1uiv(GLenum type, const GLuint* coords) { fp_glTexCoordP1uiv(type, coords); } -inline void glTexCoordP2ui(GLenum type, GLuint coords) { fp_glTexCoordP2ui(type, coords); } -inline void glTexCoordP2uiv(GLenum type, const GLuint* coords) { fp_glTexCoordP2uiv(type, coords); } -inline void glTexCoordP3ui(GLenum type, GLuint coords) { fp_glTexCoordP3ui(type, coords); } -inline void glTexCoordP3uiv(GLenum type, const GLuint* coords) { fp_glTexCoordP3uiv(type, coords); } -inline void glTexCoordP4ui(GLenum type, GLuint coords) { fp_glTexCoordP4ui(type, coords); } -inline void glTexCoordP4uiv(GLenum type, const GLuint* coords) { fp_glTexCoordP4uiv(type, coords); } -inline void glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords) { fp_glMultiTexCoordP1ui(texture, type, coords); } -inline void glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint* coords) { fp_glMultiTexCoordP1uiv(texture, type, coords); } -inline void glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords) { fp_glMultiTexCoordP2ui(texture, type, coords); } -inline void glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint* coords) { fp_glMultiTexCoordP2uiv(texture, type, coords); } -inline void glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords) { fp_glMultiTexCoordP3ui(texture, type, coords); } -inline void glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint* coords) { fp_glMultiTexCoordP3uiv(texture, type, coords); } -inline void glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords) { fp_glMultiTexCoordP4ui(texture, type, coords); } -inline void glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint* coords) { fp_glMultiTexCoordP4uiv(texture, type, coords); } -inline void glNormalP3ui(GLenum type, GLuint coords) { fp_glNormalP3ui(type, coords); } -inline void glNormalP3uiv(GLenum type, const GLuint* coords) { fp_glNormalP3uiv(type, coords); } -inline void glColorP3ui(GLenum type, GLuint color) { fp_glColorP3ui(type, color); } -inline void glColorP3uiv(GLenum type, const GLuint* color) { fp_glColorP3uiv(type, color); } -inline void glColorP4ui(GLenum type, GLuint color) { fp_glColorP4ui(type, color); } -inline void glColorP4uiv(GLenum type, const GLuint* color) { fp_glColorP4uiv(type, color); } -inline void glSecondaryColorP3ui(GLenum type, GLuint color) { fp_glSecondaryColorP3ui(type, color); } -inline void glSecondaryColorP3uiv(GLenum type, const GLuint* color) { fp_glSecondaryColorP3uiv(type, color); } - -/* GL_VERSION_4_0 */ -inline void glMinSampleShading(GLfloat value) { fp_glMinSampleShading(value); } -inline void glBlendEquationi(GLuint buf, GLenum mode) { fp_glBlendEquationi(buf, mode); } -inline void glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha) { fp_glBlendEquationSeparatei(buf, modeRGB, modeAlpha); } -inline void glBlendFunci(GLuint buf, GLenum src, GLenum dst) { fp_glBlendFunci(buf, src, dst); } -inline void glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { fp_glBlendFuncSeparatei(buf, srcRGB, dstRGB, srcAlpha, dstAlpha); } -inline void glDrawArraysIndirect(GLenum mode, const void* indirect) { fp_glDrawArraysIndirect(mode, indirect); } -inline void glDrawElementsIndirect(GLenum mode, GLenum type, const void* indirect) { fp_glDrawElementsIndirect(mode, type, indirect); } -inline void glUniform1d(GLint location, GLdouble x) { fp_glUniform1d(location, x); } -inline void glUniform2d(GLint location, GLdouble x, GLdouble y) { fp_glUniform2d(location, x, y); } -inline void glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z) { fp_glUniform3d(location, x, y, z); } -inline void glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { fp_glUniform4d(location, x, y, z, w); } -inline void glUniform1dv(GLint location, GLsizei count, const GLdouble* value) { fp_glUniform1dv(location, count, value); } -inline void glUniform2dv(GLint location, GLsizei count, const GLdouble* value) { fp_glUniform2dv(location, count, value); } -inline void glUniform3dv(GLint location, GLsizei count, const GLdouble* value) { fp_glUniform3dv(location, count, value); } -inline void glUniform4dv(GLint location, GLsizei count, const GLdouble* value) { fp_glUniform4dv(location, count, value); } -inline void glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glUniformMatrix2dv(location, count, transpose, value); } -inline void glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glUniformMatrix3dv(location, count, transpose, value); } -inline void glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glUniformMatrix4dv(location, count, transpose, value); } -inline void glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glUniformMatrix2x3dv(location, count, transpose, value); } -inline void glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glUniformMatrix2x4dv(location, count, transpose, value); } -inline void glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glUniformMatrix3x2dv(location, count, transpose, value); } -inline void glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glUniformMatrix3x4dv(location, count, transpose, value); } -inline void glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glUniformMatrix4x2dv(location, count, transpose, value); } -inline void glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glUniformMatrix4x3dv(location, count, transpose, value); } -inline void glGetUniformdv(GLuint program, GLint location, GLdouble* params) { fp_glGetUniformdv(program, location, params); } -inline GLint glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar* name) { return fp_glGetSubroutineUniformLocation(program, shadertype, name); } -inline GLuint glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar* name) { return fp_glGetSubroutineIndex(program, shadertype, name); } -inline void glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint* values) { fp_glGetActiveSubroutineUniformiv(program, shadertype, index, pname, values); } -inline void glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei* length, GLchar* name) { fp_glGetActiveSubroutineUniformName(program, shadertype, index, bufsize, length, name); } -inline void glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei* length, GLchar* name) { fp_glGetActiveSubroutineName(program, shadertype, index, bufsize, length, name); } -inline void glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint* indices) { fp_glUniformSubroutinesuiv(shadertype, count, indices); } -inline void glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint* params) { fp_glGetUniformSubroutineuiv(shadertype, location, params); } -inline void glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint* values) { fp_glGetProgramStageiv(program, shadertype, pname, values); } -inline void glPatchParameteri(GLenum pname, GLint value) { fp_glPatchParameteri(pname, value); } -inline void glPatchParameterfv(GLenum pname, const GLfloat* values) { fp_glPatchParameterfv(pname, values); } -inline void glBindTransformFeedback(GLenum target, GLuint id) { fp_glBindTransformFeedback(target, id); } -inline void glDeleteTransformFeedbacks(GLsizei n, const GLuint* ids) { fp_glDeleteTransformFeedbacks(n, ids); } -inline void glGenTransformFeedbacks(GLsizei n, GLuint* ids) { fp_glGenTransformFeedbacks(n, ids); } -inline GLboolean glIsTransformFeedback(GLuint id) { return fp_glIsTransformFeedback(id); } -inline void glPauseTransformFeedback() { fp_glPauseTransformFeedback(); } -inline void glResumeTransformFeedback() { fp_glResumeTransformFeedback(); } -inline void glDrawTransformFeedback(GLenum mode, GLuint id) { fp_glDrawTransformFeedback(mode, id); } -inline void glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream) { fp_glDrawTransformFeedbackStream(mode, id, stream); } -inline void glBeginQueryIndexed(GLenum target, GLuint index, GLuint id) { fp_glBeginQueryIndexed(target, index, id); } -inline void glEndQueryIndexed(GLenum target, GLuint index) { fp_glEndQueryIndexed(target, index); } -inline void glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint* params) { fp_glGetQueryIndexediv(target, index, pname, params); } - -/* GL_VERSION_4_1 */ -inline void glReleaseShaderCompiler() { fp_glReleaseShaderCompiler(); } -inline void glShaderBinary(GLsizei count, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length) { fp_glShaderBinary(count, shaders, binaryformat, binary, length); } -inline void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) { fp_glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision); } -inline void glDepthRangef(GLfloat n, GLfloat f) { fp_glDepthRangef(n, f); } -inline void glClearDepthf(GLfloat d) { fp_glClearDepthf(d); } -inline void glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, void* binary) { fp_glGetProgramBinary(program, bufSize, length, binaryFormat, binary); } -inline void glProgramBinary(GLuint program, GLenum binaryFormat, const void* binary, GLsizei length) { fp_glProgramBinary(program, binaryFormat, binary, length); } -inline void glProgramParameteri(GLuint program, GLenum pname, GLint value) { fp_glProgramParameteri(program, pname, value); } -inline void glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program) { fp_glUseProgramStages(pipeline, stages, program); } -inline void glActiveShaderProgram(GLuint pipeline, GLuint program) { fp_glActiveShaderProgram(pipeline, program); } -inline GLuint glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar** strings) { return fp_glCreateShaderProgramv(type, count, strings); } -inline void glBindProgramPipeline(GLuint pipeline) { fp_glBindProgramPipeline(pipeline); } -inline void glDeleteProgramPipelines(GLsizei n, const GLuint* pipelines) { fp_glDeleteProgramPipelines(n, pipelines); } -inline void glGenProgramPipelines(GLsizei n, GLuint* pipelines) { fp_glGenProgramPipelines(n, pipelines); } -inline GLboolean glIsProgramPipeline(GLuint pipeline) { return fp_glIsProgramPipeline(pipeline); } -inline void glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint* params) { fp_glGetProgramPipelineiv(pipeline, pname, params); } -inline void glProgramUniform1i(GLuint program, GLint location, GLint v0) { fp_glProgramUniform1i(program, location, v0); } -inline void glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint* value) { fp_glProgramUniform1iv(program, location, count, value); } -inline void glProgramUniform1f(GLuint program, GLint location, GLfloat v0) { fp_glProgramUniform1f(program, location, v0); } -inline void glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat* value) { fp_glProgramUniform1fv(program, location, count, value); } -inline void glProgramUniform1d(GLuint program, GLint location, GLdouble v0) { fp_glProgramUniform1d(program, location, v0); } -inline void glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble* value) { fp_glProgramUniform1dv(program, location, count, value); } -inline void glProgramUniform1ui(GLuint program, GLint location, GLuint v0) { fp_glProgramUniform1ui(program, location, v0); } -inline void glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint* value) { fp_glProgramUniform1uiv(program, location, count, value); } -inline void glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1) { fp_glProgramUniform2i(program, location, v0, v1); } -inline void glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint* value) { fp_glProgramUniform2iv(program, location, count, value); } -inline void glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1) { fp_glProgramUniform2f(program, location, v0, v1); } -inline void glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat* value) { fp_glProgramUniform2fv(program, location, count, value); } -inline void glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1) { fp_glProgramUniform2d(program, location, v0, v1); } -inline void glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble* value) { fp_glProgramUniform2dv(program, location, count, value); } -inline void glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1) { fp_glProgramUniform2ui(program, location, v0, v1); } -inline void glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint* value) { fp_glProgramUniform2uiv(program, location, count, value); } -inline void glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2) { fp_glProgramUniform3i(program, location, v0, v1, v2); } -inline void glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint* value) { fp_glProgramUniform3iv(program, location, count, value); } -inline void glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2) { fp_glProgramUniform3f(program, location, v0, v1, v2); } -inline void glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat* value) { fp_glProgramUniform3fv(program, location, count, value); } -inline void glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2) { fp_glProgramUniform3d(program, location, v0, v1, v2); } -inline void glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble* value) { fp_glProgramUniform3dv(program, location, count, value); } -inline void glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2) { fp_glProgramUniform3ui(program, location, v0, v1, v2); } -inline void glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint* value) { fp_glProgramUniform3uiv(program, location, count, value); } -inline void glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3) { fp_glProgramUniform4i(program, location, v0, v1, v2, v3); } -inline void glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint* value) { fp_glProgramUniform4iv(program, location, count, value); } -inline void glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) { fp_glProgramUniform4f(program, location, v0, v1, v2, v3); } -inline void glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat* value) { fp_glProgramUniform4fv(program, location, count, value); } -inline void glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3) { fp_glProgramUniform4d(program, location, v0, v1, v2, v3); } -inline void glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble* value) { fp_glProgramUniform4dv(program, location, count, value); } -inline void glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { fp_glProgramUniform4ui(program, location, v0, v1, v2, v3); } -inline void glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint* value) { fp_glProgramUniform4uiv(program, location, count, value); } -inline void glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glProgramUniformMatrix2fv(program, location, count, transpose, value); } -inline void glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glProgramUniformMatrix3fv(program, location, count, transpose, value); } -inline void glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glProgramUniformMatrix4fv(program, location, count, transpose, value); } -inline void glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glProgramUniformMatrix2dv(program, location, count, transpose, value); } -inline void glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glProgramUniformMatrix3dv(program, location, count, transpose, value); } -inline void glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glProgramUniformMatrix4dv(program, location, count, transpose, value); } -inline void glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glProgramUniformMatrix2x3fv(program, location, count, transpose, value); } -inline void glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glProgramUniformMatrix3x2fv(program, location, count, transpose, value); } -inline void glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glProgramUniformMatrix2x4fv(program, location, count, transpose, value); } -inline void glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glProgramUniformMatrix4x2fv(program, location, count, transpose, value); } -inline void glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glProgramUniformMatrix3x4fv(program, location, count, transpose, value); } -inline void glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glProgramUniformMatrix4x3fv(program, location, count, transpose, value); } -inline void glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glProgramUniformMatrix2x3dv(program, location, count, transpose, value); } -inline void glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glProgramUniformMatrix3x2dv(program, location, count, transpose, value); } -inline void glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glProgramUniformMatrix2x4dv(program, location, count, transpose, value); } -inline void glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glProgramUniformMatrix4x2dv(program, location, count, transpose, value); } -inline void glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glProgramUniformMatrix3x4dv(program, location, count, transpose, value); } -inline void glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glProgramUniformMatrix4x3dv(program, location, count, transpose, value); } -inline void glValidateProgramPipeline(GLuint pipeline) { fp_glValidateProgramPipeline(pipeline); } -inline void glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei* length, GLchar* infoLog) { fp_glGetProgramPipelineInfoLog(pipeline, bufSize, length, infoLog); } -inline void glVertexAttribL1d(GLuint index, GLdouble x) { fp_glVertexAttribL1d(index, x); } -inline void glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y) { fp_glVertexAttribL2d(index, x, y); } -inline void glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z) { fp_glVertexAttribL3d(index, x, y, z); } -inline void glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { fp_glVertexAttribL4d(index, x, y, z, w); } -inline void glVertexAttribL1dv(GLuint index, const GLdouble* v) { fp_glVertexAttribL1dv(index, v); } -inline void glVertexAttribL2dv(GLuint index, const GLdouble* v) { fp_glVertexAttribL2dv(index, v); } -inline void glVertexAttribL3dv(GLuint index, const GLdouble* v) { fp_glVertexAttribL3dv(index, v); } -inline void glVertexAttribL4dv(GLuint index, const GLdouble* v) { fp_glVertexAttribL4dv(index, v); } -inline void glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void* pointer) { fp_glVertexAttribLPointer(index, size, type, stride, pointer); } -inline void glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble* params) { fp_glGetVertexAttribLdv(index, pname, params); } -inline void glViewportArrayv(GLuint first, GLsizei count, const GLfloat* v) { fp_glViewportArrayv(first, count, v); } -inline void glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h) { fp_glViewportIndexedf(index, x, y, w, h); } -inline void glViewportIndexedfv(GLuint index, const GLfloat* v) { fp_glViewportIndexedfv(index, v); } -inline void glScissorArrayv(GLuint first, GLsizei count, const GLint* v) { fp_glScissorArrayv(first, count, v); } -inline void glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height) { fp_glScissorIndexed(index, left, bottom, width, height); } -inline void glScissorIndexedv(GLuint index, const GLint* v) { fp_glScissorIndexedv(index, v); } -inline void glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble* v) { fp_glDepthRangeArrayv(first, count, v); } -inline void glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f) { fp_glDepthRangeIndexed(index, n, f); } -inline void glGetFloati_v(GLenum target, GLuint index, GLfloat* data) { fp_glGetFloati_v(target, index, data); } -inline void glGetDoublei_v(GLenum target, GLuint index, GLdouble* data) { fp_glGetDoublei_v(target, index, data); } - -/* GL_VERSION_4_2 */ -inline void glDrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance) { fp_glDrawArraysInstancedBaseInstance(mode, first, count, instancecount, baseinstance); } -inline void glDrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei instancecount, GLuint baseinstance) { fp_glDrawElementsInstancedBaseInstance(mode, count, type, indices, instancecount, baseinstance); } -inline void glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance) { fp_glDrawElementsInstancedBaseVertexBaseInstance(mode, count, type, indices, instancecount, basevertex, baseinstance); } -inline void glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params) { fp_glGetInternalformativ(target, internalformat, pname, bufSize, params); } -inline void glGetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint* params) { fp_glGetActiveAtomicCounterBufferiv(program, bufferIndex, pname, params); } -inline void glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format) { fp_glBindImageTexture(unit, texture, level, layered, layer, access, format); } -inline void glMemoryBarrier(GLbitfield barriers) { fp_glMemoryBarrier(barriers); } -inline void glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width) { fp_glTexStorage1D(target, levels, internalformat, width); } -inline void glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) { fp_glTexStorage2D(target, levels, internalformat, width, height); } -inline void glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) { fp_glTexStorage3D(target, levels, internalformat, width, height, depth); } -inline void glDrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount) { fp_glDrawTransformFeedbackInstanced(mode, id, instancecount); } -inline void glDrawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount) { fp_glDrawTransformFeedbackStreamInstanced(mode, id, stream, instancecount); } - -/* GL_VERSION_4_3 */ -inline void glClearBufferData(GLenum target, GLenum internalformat, GLenum format, GLenum type, const void* data) { fp_glClearBufferData(target, internalformat, format, type, data); } -inline void glClearBufferSubData(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void* data) { fp_glClearBufferSubData(target, internalformat, offset, size, format, type, data); } -inline void glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z) { fp_glDispatchCompute(num_groups_x, num_groups_y, num_groups_z); } -inline void glDispatchComputeIndirect(GLintptr indirect) { fp_glDispatchComputeIndirect(indirect); } -inline void glCopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth) { fp_glCopyImageSubData(srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth); } -inline void glFramebufferParameteri(GLenum target, GLenum pname, GLint param) { fp_glFramebufferParameteri(target, pname, param); } -inline void glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint* params) { fp_glGetFramebufferParameteriv(target, pname, params); } -inline void glGetInternalformati64v(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64* params) { fp_glGetInternalformati64v(target, internalformat, pname, bufSize, params); } -inline void glInvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth) { fp_glInvalidateTexSubImage(texture, level, xoffset, yoffset, zoffset, width, height, depth); } -inline void glInvalidateTexImage(GLuint texture, GLint level) { fp_glInvalidateTexImage(texture, level); } -inline void glInvalidateBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr length) { fp_glInvalidateBufferSubData(buffer, offset, length); } -inline void glInvalidateBufferData(GLuint buffer) { fp_glInvalidateBufferData(buffer); } -inline void glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments) { fp_glInvalidateFramebuffer(target, numAttachments, attachments); } -inline void glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height) { fp_glInvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height); } -inline void glMultiDrawArraysIndirect(GLenum mode, const void* indirect, GLsizei drawcount, GLsizei stride) { fp_glMultiDrawArraysIndirect(mode, indirect, drawcount, stride); } -inline void glMultiDrawElementsIndirect(GLenum mode, GLenum type, const void* indirect, GLsizei drawcount, GLsizei stride) { fp_glMultiDrawElementsIndirect(mode, type, indirect, drawcount, stride); } -inline void glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint* params) { fp_glGetProgramInterfaceiv(program, programInterface, pname, params); } -inline GLuint glGetProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar* name) { return fp_glGetProgramResourceIndex(program, programInterface, name); } -inline void glGetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei* length, GLchar* name) { fp_glGetProgramResourceName(program, programInterface, index, bufSize, length, name); } -inline void glGetProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum* props, GLsizei bufSize, GLsizei* length, GLint* params) { fp_glGetProgramResourceiv(program, programInterface, index, propCount, props, bufSize, length, params); } -inline GLint glGetProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar* name) { return fp_glGetProgramResourceLocation(program, programInterface, name); } -inline GLint glGetProgramResourceLocationIndex(GLuint program, GLenum programInterface, const GLchar* name) { return fp_glGetProgramResourceLocationIndex(program, programInterface, name); } -inline void glShaderStorageBlockBinding(GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding) { fp_glShaderStorageBlockBinding(program, storageBlockIndex, storageBlockBinding); } -inline void glTexBufferRange(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size) { fp_glTexBufferRange(target, internalformat, buffer, offset, size); } -inline void glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations) { fp_glTexStorage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations); } -inline void glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations) { fp_glTexStorage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations); } -inline void glTextureView(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers) { fp_glTextureView(texture, target, origtexture, internalformat, minlevel, numlevels, minlayer, numlayers); } -inline void glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride) { fp_glBindVertexBuffer(bindingindex, buffer, offset, stride); } -inline void glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset) { fp_glVertexAttribFormat(attribindex, size, type, normalized, relativeoffset); } -inline void glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset) { fp_glVertexAttribIFormat(attribindex, size, type, relativeoffset); } -inline void glVertexAttribLFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset) { fp_glVertexAttribLFormat(attribindex, size, type, relativeoffset); } -inline void glVertexAttribBinding(GLuint attribindex, GLuint bindingindex) { fp_glVertexAttribBinding(attribindex, bindingindex); } -inline void glVertexBindingDivisor(GLuint bindingindex, GLuint divisor) { fp_glVertexBindingDivisor(bindingindex, divisor); } -inline void glDebugMessageControl(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled) { fp_glDebugMessageControl(source, type, severity, count, ids, enabled); } -inline void glDebugMessageInsert(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* buf) { fp_glDebugMessageInsert(source, type, id, severity, length, buf); } -inline void glDebugMessageCallback(GLDEBUGPROC callback, const void* userParam) { fp_glDebugMessageCallback(callback, userParam); } -inline GLuint glGetDebugMessageLog(GLuint count, GLsizei bufSize, GLenum* sources, GLenum* types, GLuint* ids, GLenum* severities, GLsizei* lengths, GLchar* messageLog) { return fp_glGetDebugMessageLog(count, bufSize, sources, types, ids, severities, lengths, messageLog); } -inline void glPushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar* message) { fp_glPushDebugGroup(source, id, length, message); } -inline void glPopDebugGroup() { fp_glPopDebugGroup(); } -inline void glObjectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar* label) { fp_glObjectLabel(identifier, name, length, label); } -inline void glGetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei* length, GLchar* label) { fp_glGetObjectLabel(identifier, name, bufSize, length, label); } -inline void glObjectPtrLabel(const void* ptr, GLsizei length, const GLchar* label) { fp_glObjectPtrLabel(ptr, length, label); } -inline void glGetObjectPtrLabel(const void* ptr, GLsizei bufSize, GLsizei* length, GLchar* label) { fp_glGetObjectPtrLabel(ptr, bufSize, length, label); } - -/* GL_VERSION_4_4 */ -inline void glBufferStorage(GLenum target, GLsizeiptr size, const void* data, GLbitfield flags) { fp_glBufferStorage(target, size, data, flags); } -inline void glClearTexImage(GLuint texture, GLint level, GLenum format, GLenum type, const void* data) { fp_glClearTexImage(texture, level, format, type, data); } -inline void glClearTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* data) { fp_glClearTexSubImage(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, data); } -inline void glBindBuffersBase(GLenum target, GLuint first, GLsizei count, const GLuint* buffers) { fp_glBindBuffersBase(target, first, count, buffers); } -inline void glBindBuffersRange(GLenum target, GLuint first, GLsizei count, const GLuint* buffers, const GLintptr* offsets, const GLsizeiptr* sizes) { fp_glBindBuffersRange(target, first, count, buffers, offsets, sizes); } -inline void glBindTextures(GLuint first, GLsizei count, const GLuint* textures) { fp_glBindTextures(first, count, textures); } -inline void glBindSamplers(GLuint first, GLsizei count, const GLuint* samplers) { fp_glBindSamplers(first, count, samplers); } -inline void glBindImageTextures(GLuint first, GLsizei count, const GLuint* textures) { fp_glBindImageTextures(first, count, textures); } -inline void glBindVertexBuffers(GLuint first, GLsizei count, const GLuint* buffers, const GLintptr* offsets, const GLsizei* strides) { fp_glBindVertexBuffers(first, count, buffers, offsets, strides); } - -/* GL_VERSION_4_5 */ -inline void glClipControl(GLenum origin, GLenum depth) { fp_glClipControl(origin, depth); } -inline void glCreateTransformFeedbacks(GLsizei n, GLuint* ids) { fp_glCreateTransformFeedbacks(n, ids); } -inline void glTransformFeedbackBufferBase(GLuint xfb, GLuint index, GLuint buffer) { fp_glTransformFeedbackBufferBase(xfb, index, buffer); } -inline void glTransformFeedbackBufferRange(GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) { fp_glTransformFeedbackBufferRange(xfb, index, buffer, offset, size); } -inline void glGetTransformFeedbackiv(GLuint xfb, GLenum pname, GLint* param) { fp_glGetTransformFeedbackiv(xfb, pname, param); } -inline void glGetTransformFeedbacki_v(GLuint xfb, GLenum pname, GLuint index, GLint* param) { fp_glGetTransformFeedbacki_v(xfb, pname, index, param); } -inline void glGetTransformFeedbacki64_v(GLuint xfb, GLenum pname, GLuint index, GLint64* param) { fp_glGetTransformFeedbacki64_v(xfb, pname, index, param); } -inline void glCreateBuffers(GLsizei n, GLuint* buffers) { fp_glCreateBuffers(n, buffers); } -inline void glNamedBufferStorage(GLuint buffer, GLsizeiptr size, const void* data, GLbitfield flags) { fp_glNamedBufferStorage(buffer, size, data, flags); } -inline void glNamedBufferData(GLuint buffer, GLsizeiptr size, const void* data, GLenum usage) { fp_glNamedBufferData(buffer, size, data, usage); } -inline void glNamedBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr size, const void* data) { fp_glNamedBufferSubData(buffer, offset, size, data); } -inline void glCopyNamedBufferSubData(GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) { fp_glCopyNamedBufferSubData(readBuffer, writeBuffer, readOffset, writeOffset, size); } -inline void glClearNamedBufferData(GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void* data) { fp_glClearNamedBufferData(buffer, internalformat, format, type, data); } -inline void glClearNamedBufferSubData(GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void* data) { fp_glClearNamedBufferSubData(buffer, internalformat, offset, size, format, type, data); } -inline void* glMapNamedBuffer(GLuint buffer, GLenum access) { return fp_glMapNamedBuffer(buffer, access); } -inline void* glMapNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access) { return fp_glMapNamedBufferRange(buffer, offset, length, access); } -inline GLboolean glUnmapNamedBuffer(GLuint buffer) { return fp_glUnmapNamedBuffer(buffer); } -inline void glFlushMappedNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length) { fp_glFlushMappedNamedBufferRange(buffer, offset, length); } -inline void glGetNamedBufferParameteriv(GLuint buffer, GLenum pname, GLint* params) { fp_glGetNamedBufferParameteriv(buffer, pname, params); } -inline void glGetNamedBufferParameteri64v(GLuint buffer, GLenum pname, GLint64* params) { fp_glGetNamedBufferParameteri64v(buffer, pname, params); } -inline void glGetNamedBufferPointerv(GLuint buffer, GLenum pname, void** params) { fp_glGetNamedBufferPointerv(buffer, pname, params); } -inline void glGetNamedBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr size, void* data) { fp_glGetNamedBufferSubData(buffer, offset, size, data); } -inline void glCreateFramebuffers(GLsizei n, GLuint* framebuffers) { fp_glCreateFramebuffers(n, framebuffers); } -inline void glNamedFramebufferRenderbuffer(GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { fp_glNamedFramebufferRenderbuffer(framebuffer, attachment, renderbuffertarget, renderbuffer); } -inline void glNamedFramebufferParameteri(GLuint framebuffer, GLenum pname, GLint param) { fp_glNamedFramebufferParameteri(framebuffer, pname, param); } -inline void glNamedFramebufferTexture(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level) { fp_glNamedFramebufferTexture(framebuffer, attachment, texture, level); } -inline void glNamedFramebufferTextureLayer(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer) { fp_glNamedFramebufferTextureLayer(framebuffer, attachment, texture, level, layer); } -inline void glNamedFramebufferDrawBuffer(GLuint framebuffer, GLenum buf) { fp_glNamedFramebufferDrawBuffer(framebuffer, buf); } -inline void glNamedFramebufferDrawBuffers(GLuint framebuffer, GLsizei n, const GLenum* bufs) { fp_glNamedFramebufferDrawBuffers(framebuffer, n, bufs); } -inline void glNamedFramebufferReadBuffer(GLuint framebuffer, GLenum src) { fp_glNamedFramebufferReadBuffer(framebuffer, src); } -inline void glInvalidateNamedFramebufferData(GLuint framebuffer, GLsizei numAttachments, const GLenum* attachments) { fp_glInvalidateNamedFramebufferData(framebuffer, numAttachments, attachments); } -inline void glInvalidateNamedFramebufferSubData(GLuint framebuffer, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height) { fp_glInvalidateNamedFramebufferSubData(framebuffer, numAttachments, attachments, x, y, width, height); } -inline void glClearNamedFramebufferiv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint* value) { fp_glClearNamedFramebufferiv(framebuffer, buffer, drawbuffer, value); } -inline void glClearNamedFramebufferuiv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint* value) { fp_glClearNamedFramebufferuiv(framebuffer, buffer, drawbuffer, value); } -inline void glClearNamedFramebufferfv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat* value) { fp_glClearNamedFramebufferfv(framebuffer, buffer, drawbuffer, value); } -inline void glClearNamedFramebufferfi(GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) { fp_glClearNamedFramebufferfi(framebuffer, buffer, drawbuffer, depth, stencil); } -inline void glBlitNamedFramebuffer(GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { fp_glBlitNamedFramebuffer(readFramebuffer, drawFramebuffer, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); } -inline GLenum glCheckNamedFramebufferStatus(GLuint framebuffer, GLenum target) { return fp_glCheckNamedFramebufferStatus(framebuffer, target); } -inline void glGetNamedFramebufferParameteriv(GLuint framebuffer, GLenum pname, GLint* param) { fp_glGetNamedFramebufferParameteriv(framebuffer, pname, param); } -inline void glGetNamedFramebufferAttachmentParameteriv(GLuint framebuffer, GLenum attachment, GLenum pname, GLint* params) { fp_glGetNamedFramebufferAttachmentParameteriv(framebuffer, attachment, pname, params); } -inline void glCreateRenderbuffers(GLsizei n, GLuint* renderbuffers) { fp_glCreateRenderbuffers(n, renderbuffers); } -inline void glNamedRenderbufferStorage(GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height) { fp_glNamedRenderbufferStorage(renderbuffer, internalformat, width, height); } -inline void glNamedRenderbufferStorageMultisample(GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { fp_glNamedRenderbufferStorageMultisample(renderbuffer, samples, internalformat, width, height); } -inline void glGetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname, GLint* params) { fp_glGetNamedRenderbufferParameteriv(renderbuffer, pname, params); } -inline void glCreateTextures(GLenum target, GLsizei n, GLuint* textures) { fp_glCreateTextures(target, n, textures); } -inline void glTextureBuffer(GLuint texture, GLenum internalformat, GLuint buffer) { fp_glTextureBuffer(texture, internalformat, buffer); } -inline void glTextureBufferRange(GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size) { fp_glTextureBufferRange(texture, internalformat, buffer, offset, size); } -inline void glTextureStorage1D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width) { fp_glTextureStorage1D(texture, levels, internalformat, width); } -inline void glTextureStorage2D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) { fp_glTextureStorage2D(texture, levels, internalformat, width, height); } -inline void glTextureStorage3D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) { fp_glTextureStorage3D(texture, levels, internalformat, width, height, depth); } -inline void glTextureStorage2DMultisample(GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations) { fp_glTextureStorage2DMultisample(texture, samples, internalformat, width, height, fixedsamplelocations); } -inline void glTextureStorage3DMultisample(GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations) { fp_glTextureStorage3DMultisample(texture, samples, internalformat, width, height, depth, fixedsamplelocations); } -inline void glTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void* pixels) { fp_glTextureSubImage1D(texture, level, xoffset, width, format, type, pixels); } -inline void glTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) { fp_glTextureSubImage2D(texture, level, xoffset, yoffset, width, height, format, type, pixels); } -inline void glTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels) { fp_glTextureSubImage3D(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); } -inline void glCompressedTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void* data) { fp_glCompressedTextureSubImage1D(texture, level, xoffset, width, format, imageSize, data); } -inline void glCompressedTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) { fp_glCompressedTextureSubImage2D(texture, level, xoffset, yoffset, width, height, format, imageSize, data); } -inline void glCompressedTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data) { fp_glCompressedTextureSubImage3D(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); } -inline void glCopyTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) { fp_glCopyTextureSubImage1D(texture, level, xoffset, x, y, width); } -inline void glCopyTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { fp_glCopyTextureSubImage2D(texture, level, xoffset, yoffset, x, y, width, height); } -inline void glCopyTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) { fp_glCopyTextureSubImage3D(texture, level, xoffset, yoffset, zoffset, x, y, width, height); } -inline void glTextureParameterf(GLuint texture, GLenum pname, GLfloat param) { fp_glTextureParameterf(texture, pname, param); } -inline void glTextureParameterfv(GLuint texture, GLenum pname, const GLfloat* param) { fp_glTextureParameterfv(texture, pname, param); } -inline void glTextureParameteri(GLuint texture, GLenum pname, GLint param) { fp_glTextureParameteri(texture, pname, param); } -inline void glTextureParameterIiv(GLuint texture, GLenum pname, const GLint* params) { fp_glTextureParameterIiv(texture, pname, params); } -inline void glTextureParameterIuiv(GLuint texture, GLenum pname, const GLuint* params) { fp_glTextureParameterIuiv(texture, pname, params); } -inline void glTextureParameteriv(GLuint texture, GLenum pname, const GLint* param) { fp_glTextureParameteriv(texture, pname, param); } -inline void glGenerateTextureMipmap(GLuint texture) { fp_glGenerateTextureMipmap(texture); } -inline void glBindTextureUnit(GLuint unit, GLuint texture) { fp_glBindTextureUnit(unit, texture); } -inline void glGetTextureImage(GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void* pixels) { fp_glGetTextureImage(texture, level, format, type, bufSize, pixels); } -inline void glGetCompressedTextureImage(GLuint texture, GLint level, GLsizei bufSize, void* pixels) { fp_glGetCompressedTextureImage(texture, level, bufSize, pixels); } -inline void glGetTextureLevelParameterfv(GLuint texture, GLint level, GLenum pname, GLfloat* params) { fp_glGetTextureLevelParameterfv(texture, level, pname, params); } -inline void glGetTextureLevelParameteriv(GLuint texture, GLint level, GLenum pname, GLint* params) { fp_glGetTextureLevelParameteriv(texture, level, pname, params); } -inline void glGetTextureParameterfv(GLuint texture, GLenum pname, GLfloat* params) { fp_glGetTextureParameterfv(texture, pname, params); } -inline void glGetTextureParameterIiv(GLuint texture, GLenum pname, GLint* params) { fp_glGetTextureParameterIiv(texture, pname, params); } -inline void glGetTextureParameterIuiv(GLuint texture, GLenum pname, GLuint* params) { fp_glGetTextureParameterIuiv(texture, pname, params); } -inline void glGetTextureParameteriv(GLuint texture, GLenum pname, GLint* params) { fp_glGetTextureParameteriv(texture, pname, params); } -inline void glCreateVertexArrays(GLsizei n, GLuint* arrays) { fp_glCreateVertexArrays(n, arrays); } -inline void glDisableVertexArrayAttrib(GLuint vaobj, GLuint index) { fp_glDisableVertexArrayAttrib(vaobj, index); } -inline void glEnableVertexArrayAttrib(GLuint vaobj, GLuint index) { fp_glEnableVertexArrayAttrib(vaobj, index); } -inline void glVertexArrayElementBuffer(GLuint vaobj, GLuint buffer) { fp_glVertexArrayElementBuffer(vaobj, buffer); } -inline void glVertexArrayVertexBuffer(GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride) { fp_glVertexArrayVertexBuffer(vaobj, bindingindex, buffer, offset, stride); } -inline void glVertexArrayVertexBuffers(GLuint vaobj, GLuint first, GLsizei count, const GLuint* buffers, const GLintptr* offsets, const GLsizei* strides) { fp_glVertexArrayVertexBuffers(vaobj, first, count, buffers, offsets, strides); } -inline void glVertexArrayAttribBinding(GLuint vaobj, GLuint attribindex, GLuint bindingindex) { fp_glVertexArrayAttribBinding(vaobj, attribindex, bindingindex); } -inline void glVertexArrayAttribFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset) { fp_glVertexArrayAttribFormat(vaobj, attribindex, size, type, normalized, relativeoffset); } -inline void glVertexArrayAttribIFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset) { fp_glVertexArrayAttribIFormat(vaobj, attribindex, size, type, relativeoffset); } -inline void glVertexArrayAttribLFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset) { fp_glVertexArrayAttribLFormat(vaobj, attribindex, size, type, relativeoffset); } -inline void glVertexArrayBindingDivisor(GLuint vaobj, GLuint bindingindex, GLuint divisor) { fp_glVertexArrayBindingDivisor(vaobj, bindingindex, divisor); } -inline void glGetVertexArrayiv(GLuint vaobj, GLenum pname, GLint* param) { fp_glGetVertexArrayiv(vaobj, pname, param); } -inline void glGetVertexArrayIndexediv(GLuint vaobj, GLuint index, GLenum pname, GLint* param) { fp_glGetVertexArrayIndexediv(vaobj, index, pname, param); } -inline void glGetVertexArrayIndexed64iv(GLuint vaobj, GLuint index, GLenum pname, GLint64* param) { fp_glGetVertexArrayIndexed64iv(vaobj, index, pname, param); } -inline void glCreateSamplers(GLsizei n, GLuint* samplers) { fp_glCreateSamplers(n, samplers); } -inline void glCreateProgramPipelines(GLsizei n, GLuint* pipelines) { fp_glCreateProgramPipelines(n, pipelines); } -inline void glCreateQueries(GLenum target, GLsizei n, GLuint* ids) { fp_glCreateQueries(target, n, ids); } -inline void glGetQueryBufferObjecti64v(GLuint id, GLuint buffer, GLenum pname, GLintptr offset) { fp_glGetQueryBufferObjecti64v(id, buffer, pname, offset); } -inline void glGetQueryBufferObjectiv(GLuint id, GLuint buffer, GLenum pname, GLintptr offset) { fp_glGetQueryBufferObjectiv(id, buffer, pname, offset); } -inline void glGetQueryBufferObjectui64v(GLuint id, GLuint buffer, GLenum pname, GLintptr offset) { fp_glGetQueryBufferObjectui64v(id, buffer, pname, offset); } -inline void glGetQueryBufferObjectuiv(GLuint id, GLuint buffer, GLenum pname, GLintptr offset) { fp_glGetQueryBufferObjectuiv(id, buffer, pname, offset); } -inline void glMemoryBarrierByRegion(GLbitfield barriers) { fp_glMemoryBarrierByRegion(barriers); } -inline void glGetTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void* pixels) { fp_glGetTextureSubImage(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, bufSize, pixels); } -inline void glGetCompressedTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void* pixels) { fp_glGetCompressedTextureSubImage(texture, level, xoffset, yoffset, zoffset, width, height, depth, bufSize, pixels); } -inline GLenum glGetGraphicsResetStatus() { return fp_glGetGraphicsResetStatus(); } -inline void glGetnCompressedTexImage(GLenum target, GLint lod, GLsizei bufSize, void* pixels) { fp_glGetnCompressedTexImage(target, lod, bufSize, pixels); } -inline void glGetnTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void* pixels) { fp_glGetnTexImage(target, level, format, type, bufSize, pixels); } -inline void glGetnUniformdv(GLuint program, GLint location, GLsizei bufSize, GLdouble* params) { fp_glGetnUniformdv(program, location, bufSize, params); } -inline void glGetnUniformfv(GLuint program, GLint location, GLsizei bufSize, GLfloat* params) { fp_glGetnUniformfv(program, location, bufSize, params); } -inline void glGetnUniformiv(GLuint program, GLint location, GLsizei bufSize, GLint* params) { fp_glGetnUniformiv(program, location, bufSize, params); } -inline void glGetnUniformuiv(GLuint program, GLint location, GLsizei bufSize, GLuint* params) { fp_glGetnUniformuiv(program, location, bufSize, params); } -inline void glReadnPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void* data) { fp_glReadnPixels(x, y, width, height, format, type, bufSize, data); } -inline void glGetnMapdv(GLenum target, GLenum query, GLsizei bufSize, GLdouble* v) { fp_glGetnMapdv(target, query, bufSize, v); } -inline void glGetnMapfv(GLenum target, GLenum query, GLsizei bufSize, GLfloat* v) { fp_glGetnMapfv(target, query, bufSize, v); } -inline void glGetnMapiv(GLenum target, GLenum query, GLsizei bufSize, GLint* v) { fp_glGetnMapiv(target, query, bufSize, v); } -inline void glGetnPixelMapfv(GLenum map, GLsizei bufSize, GLfloat* values) { fp_glGetnPixelMapfv(map, bufSize, values); } -inline void glGetnPixelMapuiv(GLenum map, GLsizei bufSize, GLuint* values) { fp_glGetnPixelMapuiv(map, bufSize, values); } -inline void glGetnPixelMapusv(GLenum map, GLsizei bufSize, GLushort* values) { fp_glGetnPixelMapusv(map, bufSize, values); } -inline void glGetnPolygonStipple(GLsizei bufSize, GLubyte* pattern) { fp_glGetnPolygonStipple(bufSize, pattern); } -inline void glGetnColorTable(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void* table) { fp_glGetnColorTable(target, format, type, bufSize, table); } -inline void glGetnConvolutionFilter(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void* image) { fp_glGetnConvolutionFilter(target, format, type, bufSize, image); } -inline void glGetnSeparableFilter(GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void* row, GLsizei columnBufSize, void* column, void* span) { fp_glGetnSeparableFilter(target, format, type, rowBufSize, row, columnBufSize, column, span); } -inline void glGetnHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void* values) { fp_glGetnHistogram(target, reset, format, type, bufSize, values); } -inline void glGetnMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void* values) { fp_glGetnMinmax(target, reset, format, type, bufSize, values); } -inline void glTextureBarrier() { fp_glTextureBarrier(); } - -/* GL_ES_VERSION_3_2 */ -inline void glBlendBarrier() { fp_glBlendBarrier(); } -inline void glPrimitiveBoundingBox(GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW) { fp_glPrimitiveBoundingBox(minX, minY, minZ, minW, maxX, maxY, maxZ, maxW); } - -/* GL_KHR_blend_equation_advanced */ -inline void glBlendBarrierKHR() { fp_glBlendBarrierKHR(); } - -/* GL_KHR_debug */ -inline void glDebugMessageControlKHR(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled) { fp_glDebugMessageControlKHR(source, type, severity, count, ids, enabled); } -inline void glDebugMessageInsertKHR(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* buf) { fp_glDebugMessageInsertKHR(source, type, id, severity, length, buf); } -inline void glDebugMessageCallbackKHR(GLDEBUGPROCKHR callback, const void* userParam) { fp_glDebugMessageCallbackKHR(callback, userParam); } -inline GLuint glGetDebugMessageLogKHR(GLuint count, GLsizei bufSize, GLenum* sources, GLenum* types, GLuint* ids, GLenum* severities, GLsizei* lengths, GLchar* messageLog) { return fp_glGetDebugMessageLogKHR(count, bufSize, sources, types, ids, severities, lengths, messageLog); } -inline void glPushDebugGroupKHR(GLenum source, GLuint id, GLsizei length, const GLchar* message) { fp_glPushDebugGroupKHR(source, id, length, message); } -inline void glPopDebugGroupKHR() { fp_glPopDebugGroupKHR(); } -inline void glObjectLabelKHR(GLenum identifier, GLuint name, GLsizei length, const GLchar* label) { fp_glObjectLabelKHR(identifier, name, length, label); } -inline void glGetObjectLabelKHR(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei* length, GLchar* label) { fp_glGetObjectLabelKHR(identifier, name, bufSize, length, label); } -inline void glObjectPtrLabelKHR(const void* ptr, GLsizei length, const GLchar* label) { fp_glObjectPtrLabelKHR(ptr, length, label); } -inline void glGetObjectPtrLabelKHR(const void* ptr, GLsizei bufSize, GLsizei* length, GLchar* label) { fp_glGetObjectPtrLabelKHR(ptr, bufSize, length, label); } -inline void glGetPointervKHR(GLenum pname, void** params) { fp_glGetPointervKHR(pname, params); } - -/* GL_KHR_robustness */ -inline GLenum glGetGraphicsResetStatusKHR() { return fp_glGetGraphicsResetStatusKHR(); } -inline void glReadnPixelsKHR(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void* data) { fp_glReadnPixelsKHR(x, y, width, height, format, type, bufSize, data); } -inline void glGetnUniformfvKHR(GLuint program, GLint location, GLsizei bufSize, GLfloat* params) { fp_glGetnUniformfvKHR(program, location, bufSize, params); } -inline void glGetnUniformivKHR(GLuint program, GLint location, GLsizei bufSize, GLint* params) { fp_glGetnUniformivKHR(program, location, bufSize, params); } -inline void glGetnUniformuivKHR(GLuint program, GLint location, GLsizei bufSize, GLuint* params) { fp_glGetnUniformuivKHR(program, location, bufSize, params); } - -/* GL_ARB_bindless_texture */ -inline GLuint64 glGetTextureHandleARB(GLuint texture) { return fp_glGetTextureHandleARB(texture); } -inline GLuint64 glGetTextureSamplerHandleARB(GLuint texture, GLuint sampler) { return fp_glGetTextureSamplerHandleARB(texture, sampler); } -inline void glMakeTextureHandleResidentARB(GLuint64 handle) { fp_glMakeTextureHandleResidentARB(handle); } -inline void glMakeTextureHandleNonResidentARB(GLuint64 handle) { fp_glMakeTextureHandleNonResidentARB(handle); } -inline GLuint64 glGetImageHandleARB(GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format) { return fp_glGetImageHandleARB(texture, level, layered, layer, format); } -inline void glMakeImageHandleResidentARB(GLuint64 handle, GLenum access) { fp_glMakeImageHandleResidentARB(handle, access); } -inline void glMakeImageHandleNonResidentARB(GLuint64 handle) { fp_glMakeImageHandleNonResidentARB(handle); } -inline void glUniformHandleui64ARB(GLint location, GLuint64 value) { fp_glUniformHandleui64ARB(location, value); } -inline void glUniformHandleui64vARB(GLint location, GLsizei count, const GLuint64* value) { fp_glUniformHandleui64vARB(location, count, value); } -inline void glProgramUniformHandleui64ARB(GLuint program, GLint location, GLuint64 value) { fp_glProgramUniformHandleui64ARB(program, location, value); } -inline void glProgramUniformHandleui64vARB(GLuint program, GLint location, GLsizei count, const GLuint64* values) { fp_glProgramUniformHandleui64vARB(program, location, count, values); } -inline GLboolean glIsTextureHandleResidentARB(GLuint64 handle) { return fp_glIsTextureHandleResidentARB(handle); } -inline GLboolean glIsImageHandleResidentARB(GLuint64 handle) { return fp_glIsImageHandleResidentARB(handle); } -inline void glVertexAttribL1ui64ARB(GLuint index, GLuint64EXT x) { fp_glVertexAttribL1ui64ARB(index, x); } -inline void glVertexAttribL1ui64vARB(GLuint index, const GLuint64EXT* v) { fp_glVertexAttribL1ui64vARB(index, v); } -inline void glGetVertexAttribLui64vARB(GLuint index, GLenum pname, GLuint64EXT* params) { fp_glGetVertexAttribLui64vARB(index, pname, params); } - -/* GL_ARB_cl_event */ -inline GLsync glCreateSyncFromCLeventARB(struct _cl_context* context, struct _cl_event* event, GLbitfield flags) { return fp_glCreateSyncFromCLeventARB(context, event, flags); } - -/* GL_ARB_color_buffer_float */ -inline void glClampColorARB(GLenum target, GLenum clamp) { fp_glClampColorARB(target, clamp); } - -/* GL_ARB_compute_variable_group_size */ -inline void glDispatchComputeGroupSizeARB(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z) { fp_glDispatchComputeGroupSizeARB(num_groups_x, num_groups_y, num_groups_z, group_size_x, group_size_y, group_size_z); } - -/* GL_ARB_debug_output */ -inline void glDebugMessageControlARB(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled) { fp_glDebugMessageControlARB(source, type, severity, count, ids, enabled); } -inline void glDebugMessageInsertARB(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* buf) { fp_glDebugMessageInsertARB(source, type, id, severity, length, buf); } -inline void glDebugMessageCallbackARB(GLDEBUGPROCARB callback, const void* userParam) { fp_glDebugMessageCallbackARB(callback, userParam); } -inline GLuint glGetDebugMessageLogARB(GLuint count, GLsizei bufSize, GLenum* sources, GLenum* types, GLuint* ids, GLenum* severities, GLsizei* lengths, GLchar* messageLog) { return fp_glGetDebugMessageLogARB(count, bufSize, sources, types, ids, severities, lengths, messageLog); } - -/* GL_ARB_draw_buffers_blend */ -inline void glBlendEquationiARB(GLuint buf, GLenum mode) { fp_glBlendEquationiARB(buf, mode); } -inline void glBlendEquationSeparateiARB(GLuint buf, GLenum modeRGB, GLenum modeAlpha) { fp_glBlendEquationSeparateiARB(buf, modeRGB, modeAlpha); } -inline void glBlendFunciARB(GLuint buf, GLenum src, GLenum dst) { fp_glBlendFunciARB(buf, src, dst); } -inline void glBlendFuncSeparateiARB(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { fp_glBlendFuncSeparateiARB(buf, srcRGB, dstRGB, srcAlpha, dstAlpha); } - -/* GL_ARB_draw_instanced */ -inline void glDrawArraysInstancedARB(GLenum mode, GLint first, GLsizei count, GLsizei primcount) { fp_glDrawArraysInstancedARB(mode, first, count, primcount); } -inline void glDrawElementsInstancedARB(GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount) { fp_glDrawElementsInstancedARB(mode, count, type, indices, primcount); } - -/* GL_ARB_ES3_2_compatibility */ -inline void glPrimitiveBoundingBoxARB(GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW) { fp_glPrimitiveBoundingBoxARB(minX, minY, minZ, minW, maxX, maxY, maxZ, maxW); } - -/* GL_ARB_geometry_shader4 */ -inline void glProgramParameteriARB(GLuint program, GLenum pname, GLint value) { fp_glProgramParameteriARB(program, pname, value); } -inline void glFramebufferTextureARB(GLenum target, GLenum attachment, GLuint texture, GLint level) { fp_glFramebufferTextureARB(target, attachment, texture, level); } -inline void glFramebufferTextureLayerARB(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) { fp_glFramebufferTextureLayerARB(target, attachment, texture, level, layer); } -inline void glFramebufferTextureFaceARB(GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face) { fp_glFramebufferTextureFaceARB(target, attachment, texture, level, face); } - -/* GL_ARB_gpu_shader_int64 */ -inline void glUniform1i64ARB(GLint location, GLint64 x) { fp_glUniform1i64ARB(location, x); } -inline void glUniform2i64ARB(GLint location, GLint64 x, GLint64 y) { fp_glUniform2i64ARB(location, x, y); } -inline void glUniform3i64ARB(GLint location, GLint64 x, GLint64 y, GLint64 z) { fp_glUniform3i64ARB(location, x, y, z); } -inline void glUniform4i64ARB(GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w) { fp_glUniform4i64ARB(location, x, y, z, w); } -inline void glUniform1i64vARB(GLint location, GLsizei count, const GLint64* value) { fp_glUniform1i64vARB(location, count, value); } -inline void glUniform2i64vARB(GLint location, GLsizei count, const GLint64* value) { fp_glUniform2i64vARB(location, count, value); } -inline void glUniform3i64vARB(GLint location, GLsizei count, const GLint64* value) { fp_glUniform3i64vARB(location, count, value); } -inline void glUniform4i64vARB(GLint location, GLsizei count, const GLint64* value) { fp_glUniform4i64vARB(location, count, value); } -inline void glUniform1ui64ARB(GLint location, GLuint64 x) { fp_glUniform1ui64ARB(location, x); } -inline void glUniform2ui64ARB(GLint location, GLuint64 x, GLuint64 y) { fp_glUniform2ui64ARB(location, x, y); } -inline void glUniform3ui64ARB(GLint location, GLuint64 x, GLuint64 y, GLuint64 z) { fp_glUniform3ui64ARB(location, x, y, z); } -inline void glUniform4ui64ARB(GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w) { fp_glUniform4ui64ARB(location, x, y, z, w); } -inline void glUniform1ui64vARB(GLint location, GLsizei count, const GLuint64* value) { fp_glUniform1ui64vARB(location, count, value); } -inline void glUniform2ui64vARB(GLint location, GLsizei count, const GLuint64* value) { fp_glUniform2ui64vARB(location, count, value); } -inline void glUniform3ui64vARB(GLint location, GLsizei count, const GLuint64* value) { fp_glUniform3ui64vARB(location, count, value); } -inline void glUniform4ui64vARB(GLint location, GLsizei count, const GLuint64* value) { fp_glUniform4ui64vARB(location, count, value); } -inline void glGetUniformi64vARB(GLuint program, GLint location, GLint64* params) { fp_glGetUniformi64vARB(program, location, params); } -inline void glGetUniformui64vARB(GLuint program, GLint location, GLuint64* params) { fp_glGetUniformui64vARB(program, location, params); } -inline void glGetnUniformi64vARB(GLuint program, GLint location, GLsizei bufSize, GLint64* params) { fp_glGetnUniformi64vARB(program, location, bufSize, params); } -inline void glGetnUniformui64vARB(GLuint program, GLint location, GLsizei bufSize, GLuint64* params) { fp_glGetnUniformui64vARB(program, location, bufSize, params); } -inline void glProgramUniform1i64ARB(GLuint program, GLint location, GLint64 x) { fp_glProgramUniform1i64ARB(program, location, x); } -inline void glProgramUniform2i64ARB(GLuint program, GLint location, GLint64 x, GLint64 y) { fp_glProgramUniform2i64ARB(program, location, x, y); } -inline void glProgramUniform3i64ARB(GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z) { fp_glProgramUniform3i64ARB(program, location, x, y, z); } -inline void glProgramUniform4i64ARB(GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w) { fp_glProgramUniform4i64ARB(program, location, x, y, z, w); } -inline void glProgramUniform1i64vARB(GLuint program, GLint location, GLsizei count, const GLint64* value) { fp_glProgramUniform1i64vARB(program, location, count, value); } -inline void glProgramUniform2i64vARB(GLuint program, GLint location, GLsizei count, const GLint64* value) { fp_glProgramUniform2i64vARB(program, location, count, value); } -inline void glProgramUniform3i64vARB(GLuint program, GLint location, GLsizei count, const GLint64* value) { fp_glProgramUniform3i64vARB(program, location, count, value); } -inline void glProgramUniform4i64vARB(GLuint program, GLint location, GLsizei count, const GLint64* value) { fp_glProgramUniform4i64vARB(program, location, count, value); } -inline void glProgramUniform1ui64ARB(GLuint program, GLint location, GLuint64 x) { fp_glProgramUniform1ui64ARB(program, location, x); } -inline void glProgramUniform2ui64ARB(GLuint program, GLint location, GLuint64 x, GLuint64 y) { fp_glProgramUniform2ui64ARB(program, location, x, y); } -inline void glProgramUniform3ui64ARB(GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z) { fp_glProgramUniform3ui64ARB(program, location, x, y, z); } -inline void glProgramUniform4ui64ARB(GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w) { fp_glProgramUniform4ui64ARB(program, location, x, y, z, w); } -inline void glProgramUniform1ui64vARB(GLuint program, GLint location, GLsizei count, const GLuint64* value) { fp_glProgramUniform1ui64vARB(program, location, count, value); } -inline void glProgramUniform2ui64vARB(GLuint program, GLint location, GLsizei count, const GLuint64* value) { fp_glProgramUniform2ui64vARB(program, location, count, value); } -inline void glProgramUniform3ui64vARB(GLuint program, GLint location, GLsizei count, const GLuint64* value) { fp_glProgramUniform3ui64vARB(program, location, count, value); } -inline void glProgramUniform4ui64vARB(GLuint program, GLint location, GLsizei count, const GLuint64* value) { fp_glProgramUniform4ui64vARB(program, location, count, value); } - -/* GL_ARB_indirect_parameters */ -inline void glMultiDrawArraysIndirectCountARB(GLenum mode, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride) { fp_glMultiDrawArraysIndirectCountARB(mode, indirect, drawcount, maxdrawcount, stride); } -inline void glMultiDrawElementsIndirectCountARB(GLenum mode, GLenum type, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride) { fp_glMultiDrawElementsIndirectCountARB(mode, type, indirect, drawcount, maxdrawcount, stride); } - -/* GL_ARB_instanced_arrays */ -inline void glVertexAttribDivisorARB(GLuint index, GLuint divisor) { fp_glVertexAttribDivisorARB(index, divisor); } - -/* GL_ARB_parallel_shader_compile */ -inline void glMaxShaderCompilerThreadsARB(GLuint count) { fp_glMaxShaderCompilerThreadsARB(count); } - -/* GL_ARB_robustness */ -inline GLenum glGetGraphicsResetStatusARB() { return fp_glGetGraphicsResetStatusARB(); } -inline void glGetnTexImageARB(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void* img) { fp_glGetnTexImageARB(target, level, format, type, bufSize, img); } -inline void glReadnPixelsARB(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void* data) { fp_glReadnPixelsARB(x, y, width, height, format, type, bufSize, data); } -inline void glGetnCompressedTexImageARB(GLenum target, GLint lod, GLsizei bufSize, void* img) { fp_glGetnCompressedTexImageARB(target, lod, bufSize, img); } -inline void glGetnUniformfvARB(GLuint program, GLint location, GLsizei bufSize, GLfloat* params) { fp_glGetnUniformfvARB(program, location, bufSize, params); } -inline void glGetnUniformivARB(GLuint program, GLint location, GLsizei bufSize, GLint* params) { fp_glGetnUniformivARB(program, location, bufSize, params); } -inline void glGetnUniformuivARB(GLuint program, GLint location, GLsizei bufSize, GLuint* params) { fp_glGetnUniformuivARB(program, location, bufSize, params); } -inline void glGetnUniformdvARB(GLuint program, GLint location, GLsizei bufSize, GLdouble* params) { fp_glGetnUniformdvARB(program, location, bufSize, params); } -inline void glGetnMapdvARB(GLenum target, GLenum query, GLsizei bufSize, GLdouble* v) { fp_glGetnMapdvARB(target, query, bufSize, v); } -inline void glGetnMapfvARB(GLenum target, GLenum query, GLsizei bufSize, GLfloat* v) { fp_glGetnMapfvARB(target, query, bufSize, v); } -inline void glGetnMapivARB(GLenum target, GLenum query, GLsizei bufSize, GLint* v) { fp_glGetnMapivARB(target, query, bufSize, v); } -inline void glGetnPixelMapfvARB(GLenum map, GLsizei bufSize, GLfloat* values) { fp_glGetnPixelMapfvARB(map, bufSize, values); } -inline void glGetnPixelMapuivARB(GLenum map, GLsizei bufSize, GLuint* values) { fp_glGetnPixelMapuivARB(map, bufSize, values); } -inline void glGetnPixelMapusvARB(GLenum map, GLsizei bufSize, GLushort* values) { fp_glGetnPixelMapusvARB(map, bufSize, values); } -inline void glGetnPolygonStippleARB(GLsizei bufSize, GLubyte* pattern) { fp_glGetnPolygonStippleARB(bufSize, pattern); } -inline void glGetnColorTableARB(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void* table) { fp_glGetnColorTableARB(target, format, type, bufSize, table); } -inline void glGetnConvolutionFilterARB(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void* image) { fp_glGetnConvolutionFilterARB(target, format, type, bufSize, image); } -inline void glGetnSeparableFilterARB(GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void* row, GLsizei columnBufSize, void* column, void* span) { fp_glGetnSeparableFilterARB(target, format, type, rowBufSize, row, columnBufSize, column, span); } -inline void glGetnHistogramARB(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void* values) { fp_glGetnHistogramARB(target, reset, format, type, bufSize, values); } -inline void glGetnMinmaxARB(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void* values) { fp_glGetnMinmaxARB(target, reset, format, type, bufSize, values); } - -/* GL_ARB_sample_locations */ -inline void glFramebufferSampleLocationsfvARB(GLenum target, GLuint start, GLsizei count, const GLfloat* v) { fp_glFramebufferSampleLocationsfvARB(target, start, count, v); } -inline void glNamedFramebufferSampleLocationsfvARB(GLuint framebuffer, GLuint start, GLsizei count, const GLfloat* v) { fp_glNamedFramebufferSampleLocationsfvARB(framebuffer, start, count, v); } -inline void glEvaluateDepthValuesARB() { fp_glEvaluateDepthValuesARB(); } - -/* GL_ARB_sample_shading */ -inline void glMinSampleShadingARB(GLfloat value) { fp_glMinSampleShadingARB(value); } - -/* GL_ARB_shading_language_include */ -inline void glNamedStringARB(GLenum type, GLint namelen, const GLchar* name, GLint stringlen, const GLchar* string) { fp_glNamedStringARB(type, namelen, name, stringlen, string); } -inline void glDeleteNamedStringARB(GLint namelen, const GLchar* name) { fp_glDeleteNamedStringARB(namelen, name); } -inline void glCompileShaderIncludeARB(GLuint shader, GLsizei count, const GLchar** path, const GLint* length) { fp_glCompileShaderIncludeARB(shader, count, path, length); } -inline GLboolean glIsNamedStringARB(GLint namelen, const GLchar* name) { return fp_glIsNamedStringARB(namelen, name); } -inline void glGetNamedStringARB(GLint namelen, const GLchar* name, GLsizei bufSize, GLint* stringlen, GLchar* string) { fp_glGetNamedStringARB(namelen, name, bufSize, stringlen, string); } -inline void glGetNamedStringivARB(GLint namelen, const GLchar* name, GLenum pname, GLint* params) { fp_glGetNamedStringivARB(namelen, name, pname, params); } - -/* GL_ARB_sparse_buffer */ -inline void glBufferPageCommitmentARB(GLenum target, GLintptr offset, GLsizeiptr size, GLboolean commit) { fp_glBufferPageCommitmentARB(target, offset, size, commit); } -inline void glNamedBufferPageCommitmentEXT(GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit) { fp_glNamedBufferPageCommitmentEXT(buffer, offset, size, commit); } -inline void glNamedBufferPageCommitmentARB(GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit) { fp_glNamedBufferPageCommitmentARB(buffer, offset, size, commit); } - -/* GL_ARB_sparse_texture */ -inline void glTexPageCommitmentARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit) { fp_glTexPageCommitmentARB(target, level, xoffset, yoffset, zoffset, width, height, depth, commit); } - -/* GL_ARB_texture_buffer_object */ -inline void glTexBufferARB(GLenum target, GLenum internalformat, GLuint buffer) { fp_glTexBufferARB(target, internalformat, buffer); } - -/* GL_EXT_base_instance */ -inline void glDrawArraysInstancedBaseInstanceEXT(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance) { fp_glDrawArraysInstancedBaseInstanceEXT(mode, first, count, instancecount, baseinstance); } -inline void glDrawElementsInstancedBaseInstanceEXT(GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei instancecount, GLuint baseinstance) { fp_glDrawElementsInstancedBaseInstanceEXT(mode, count, type, indices, instancecount, baseinstance); } -inline void glDrawElementsInstancedBaseVertexBaseInstanceEXT(GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance) { fp_glDrawElementsInstancedBaseVertexBaseInstanceEXT(mode, count, type, indices, instancecount, basevertex, baseinstance); } - -/* GL_EXT_bindable_uniform */ -inline void glUniformBufferEXT(GLuint program, GLint location, GLuint buffer) { fp_glUniformBufferEXT(program, location, buffer); } -inline GLint glGetUniformBufferSizeEXT(GLuint program, GLint location) { return fp_glGetUniformBufferSizeEXT(program, location); } -inline GLintptr glGetUniformOffsetEXT(GLuint program, GLint location) { return fp_glGetUniformOffsetEXT(program, location); } - -/* GL_EXT_blend_func_extended */ -inline void glBindFragDataLocationIndexedEXT(GLuint program, GLuint colorNumber, GLuint index, const GLchar* name) { fp_glBindFragDataLocationIndexedEXT(program, colorNumber, index, name); } -inline void glBindFragDataLocationEXT(GLuint program, GLuint color, const GLchar* name) { fp_glBindFragDataLocationEXT(program, color, name); } -inline GLint glGetProgramResourceLocationIndexEXT(GLuint program, GLenum programInterface, const GLchar* name) { return fp_glGetProgramResourceLocationIndexEXT(program, programInterface, name); } -inline GLint glGetFragDataIndexEXT(GLuint program, const GLchar* name) { return fp_glGetFragDataIndexEXT(program, name); } - -/* GL_EXT_blend_minmax */ -inline void glBlendEquationEXT(GLenum mode) { fp_glBlendEquationEXT(mode); } - -/* GL_EXT_buffer_storage */ -inline void glBufferStorageEXT(GLenum target, GLsizeiptr size, const void* data, GLbitfield flags) { fp_glBufferStorageEXT(target, size, data, flags); } - -/* GL_EXT_copy_image */ -inline void glCopyImageSubDataEXT(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth) { fp_glCopyImageSubDataEXT(srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth); } - -/* GL_EXT_debug_label */ -inline void glLabelObjectEXT(GLenum type, GLuint object, GLsizei length, const GLchar* label) { fp_glLabelObjectEXT(type, object, length, label); } -inline void glGetObjectLabelEXT(GLenum type, GLuint object, GLsizei bufSize, GLsizei* length, GLchar* label) { fp_glGetObjectLabelEXT(type, object, bufSize, length, label); } - -/* GL_EXT_debug_marker */ -inline void glInsertEventMarkerEXT(GLsizei length, const GLchar* marker) { fp_glInsertEventMarkerEXT(length, marker); } -inline void glPushGroupMarkerEXT(GLsizei length, const GLchar* marker) { fp_glPushGroupMarkerEXT(length, marker); } -inline void glPopGroupMarkerEXT() { fp_glPopGroupMarkerEXT(); } - -/* GL_EXT_direct_state_access */ -inline void glMatrixLoadfEXT(GLenum mode, const GLfloat* m) { fp_glMatrixLoadfEXT(mode, m); } -inline void glMatrixLoaddEXT(GLenum mode, const GLdouble* m) { fp_glMatrixLoaddEXT(mode, m); } -inline void glMatrixMultfEXT(GLenum mode, const GLfloat* m) { fp_glMatrixMultfEXT(mode, m); } -inline void glMatrixMultdEXT(GLenum mode, const GLdouble* m) { fp_glMatrixMultdEXT(mode, m); } -inline void glMatrixLoadIdentityEXT(GLenum mode) { fp_glMatrixLoadIdentityEXT(mode); } -inline void glMatrixRotatefEXT(GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z) { fp_glMatrixRotatefEXT(mode, angle, x, y, z); } -inline void glMatrixRotatedEXT(GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z) { fp_glMatrixRotatedEXT(mode, angle, x, y, z); } -inline void glMatrixScalefEXT(GLenum mode, GLfloat x, GLfloat y, GLfloat z) { fp_glMatrixScalefEXT(mode, x, y, z); } -inline void glMatrixScaledEXT(GLenum mode, GLdouble x, GLdouble y, GLdouble z) { fp_glMatrixScaledEXT(mode, x, y, z); } -inline void glMatrixTranslatefEXT(GLenum mode, GLfloat x, GLfloat y, GLfloat z) { fp_glMatrixTranslatefEXT(mode, x, y, z); } -inline void glMatrixTranslatedEXT(GLenum mode, GLdouble x, GLdouble y, GLdouble z) { fp_glMatrixTranslatedEXT(mode, x, y, z); } -inline void glMatrixFrustumEXT(GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) { fp_glMatrixFrustumEXT(mode, left, right, bottom, top, zNear, zFar); } -inline void glMatrixOrthoEXT(GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) { fp_glMatrixOrthoEXT(mode, left, right, bottom, top, zNear, zFar); } -inline void glMatrixPopEXT(GLenum mode) { fp_glMatrixPopEXT(mode); } -inline void glMatrixPushEXT(GLenum mode) { fp_glMatrixPushEXT(mode); } -inline void glClientAttribDefaultEXT(GLbitfield mask) { fp_glClientAttribDefaultEXT(mask); } -inline void glPushClientAttribDefaultEXT(GLbitfield mask) { fp_glPushClientAttribDefaultEXT(mask); } -inline void glTextureParameterfEXT(GLuint texture, GLenum target, GLenum pname, GLfloat param) { fp_glTextureParameterfEXT(texture, target, pname, param); } -inline void glTextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname, const GLfloat* params) { fp_glTextureParameterfvEXT(texture, target, pname, params); } -inline void glTextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, GLint param) { fp_glTextureParameteriEXT(texture, target, pname, param); } -inline void glTextureParameterivEXT(GLuint texture, GLenum target, GLenum pname, const GLint* params) { fp_glTextureParameterivEXT(texture, target, pname, params); } -inline void glTextureImage1DEXT(GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void* pixels) { fp_glTextureImage1DEXT(texture, target, level, internalformat, width, border, format, type, pixels); } -inline void glTextureImage2DEXT(GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) { fp_glTextureImage2DEXT(texture, target, level, internalformat, width, height, border, format, type, pixels); } -inline void glTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void* pixels) { fp_glTextureSubImage1DEXT(texture, target, level, xoffset, width, format, type, pixels); } -inline void glTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) { fp_glTextureSubImage2DEXT(texture, target, level, xoffset, yoffset, width, height, format, type, pixels); } -inline void glCopyTextureImage1DEXT(GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) { fp_glCopyTextureImage1DEXT(texture, target, level, internalformat, x, y, width, border); } -inline void glCopyTextureImage2DEXT(GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { fp_glCopyTextureImage2DEXT(texture, target, level, internalformat, x, y, width, height, border); } -inline void glCopyTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) { fp_glCopyTextureSubImage1DEXT(texture, target, level, xoffset, x, y, width); } -inline void glCopyTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { fp_glCopyTextureSubImage2DEXT(texture, target, level, xoffset, yoffset, x, y, width, height); } -inline void glGetTextureImageEXT(GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, void* pixels) { fp_glGetTextureImageEXT(texture, target, level, format, type, pixels); } -inline void glGetTextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname, GLfloat* params) { fp_glGetTextureParameterfvEXT(texture, target, pname, params); } -inline void glGetTextureParameterivEXT(GLuint texture, GLenum target, GLenum pname, GLint* params) { fp_glGetTextureParameterivEXT(texture, target, pname, params); } -inline void glGetTextureLevelParameterfvEXT(GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat* params) { fp_glGetTextureLevelParameterfvEXT(texture, target, level, pname, params); } -inline void glGetTextureLevelParameterivEXT(GLuint texture, GLenum target, GLint level, GLenum pname, GLint* params) { fp_glGetTextureLevelParameterivEXT(texture, target, level, pname, params); } -inline void glTextureImage3DEXT(GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void* pixels) { fp_glTextureImage3DEXT(texture, target, level, internalformat, width, height, depth, border, format, type, pixels); } -inline void glTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels) { fp_glTextureSubImage3DEXT(texture, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); } -inline void glCopyTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) { fp_glCopyTextureSubImage3DEXT(texture, target, level, xoffset, yoffset, zoffset, x, y, width, height); } -inline void glBindMultiTextureEXT(GLenum texunit, GLenum target, GLuint texture) { fp_glBindMultiTextureEXT(texunit, target, texture); } -inline void glMultiTexCoordPointerEXT(GLenum texunit, GLint size, GLenum type, GLsizei stride, const void* pointer) { fp_glMultiTexCoordPointerEXT(texunit, size, type, stride, pointer); } -inline void glMultiTexEnvfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param) { fp_glMultiTexEnvfEXT(texunit, target, pname, param); } -inline void glMultiTexEnvfvEXT(GLenum texunit, GLenum target, GLenum pname, const GLfloat* params) { fp_glMultiTexEnvfvEXT(texunit, target, pname, params); } -inline void glMultiTexEnviEXT(GLenum texunit, GLenum target, GLenum pname, GLint param) { fp_glMultiTexEnviEXT(texunit, target, pname, param); } -inline void glMultiTexEnvivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint* params) { fp_glMultiTexEnvivEXT(texunit, target, pname, params); } -inline void glMultiTexGendEXT(GLenum texunit, GLenum coord, GLenum pname, GLdouble param) { fp_glMultiTexGendEXT(texunit, coord, pname, param); } -inline void glMultiTexGendvEXT(GLenum texunit, GLenum coord, GLenum pname, const GLdouble* params) { fp_glMultiTexGendvEXT(texunit, coord, pname, params); } -inline void glMultiTexGenfEXT(GLenum texunit, GLenum coord, GLenum pname, GLfloat param) { fp_glMultiTexGenfEXT(texunit, coord, pname, param); } -inline void glMultiTexGenfvEXT(GLenum texunit, GLenum coord, GLenum pname, const GLfloat* params) { fp_glMultiTexGenfvEXT(texunit, coord, pname, params); } -inline void glMultiTexGeniEXT(GLenum texunit, GLenum coord, GLenum pname, GLint param) { fp_glMultiTexGeniEXT(texunit, coord, pname, param); } -inline void glMultiTexGenivEXT(GLenum texunit, GLenum coord, GLenum pname, const GLint* params) { fp_glMultiTexGenivEXT(texunit, coord, pname, params); } -inline void glGetMultiTexEnvfvEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat* params) { fp_glGetMultiTexEnvfvEXT(texunit, target, pname, params); } -inline void glGetMultiTexEnvivEXT(GLenum texunit, GLenum target, GLenum pname, GLint* params) { fp_glGetMultiTexEnvivEXT(texunit, target, pname, params); } -inline void glGetMultiTexGendvEXT(GLenum texunit, GLenum coord, GLenum pname, GLdouble* params) { fp_glGetMultiTexGendvEXT(texunit, coord, pname, params); } -inline void glGetMultiTexGenfvEXT(GLenum texunit, GLenum coord, GLenum pname, GLfloat* params) { fp_glGetMultiTexGenfvEXT(texunit, coord, pname, params); } -inline void glGetMultiTexGenivEXT(GLenum texunit, GLenum coord, GLenum pname, GLint* params) { fp_glGetMultiTexGenivEXT(texunit, coord, pname, params); } -inline void glMultiTexParameteriEXT(GLenum texunit, GLenum target, GLenum pname, GLint param) { fp_glMultiTexParameteriEXT(texunit, target, pname, param); } -inline void glMultiTexParameterivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint* params) { fp_glMultiTexParameterivEXT(texunit, target, pname, params); } -inline void glMultiTexParameterfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param) { fp_glMultiTexParameterfEXT(texunit, target, pname, param); } -inline void glMultiTexParameterfvEXT(GLenum texunit, GLenum target, GLenum pname, const GLfloat* params) { fp_glMultiTexParameterfvEXT(texunit, target, pname, params); } -inline void glMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void* pixels) { fp_glMultiTexImage1DEXT(texunit, target, level, internalformat, width, border, format, type, pixels); } -inline void glMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) { fp_glMultiTexImage2DEXT(texunit, target, level, internalformat, width, height, border, format, type, pixels); } -inline void glMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void* pixels) { fp_glMultiTexSubImage1DEXT(texunit, target, level, xoffset, width, format, type, pixels); } -inline void glMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) { fp_glMultiTexSubImage2DEXT(texunit, target, level, xoffset, yoffset, width, height, format, type, pixels); } -inline void glCopyMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) { fp_glCopyMultiTexImage1DEXT(texunit, target, level, internalformat, x, y, width, border); } -inline void glCopyMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { fp_glCopyMultiTexImage2DEXT(texunit, target, level, internalformat, x, y, width, height, border); } -inline void glCopyMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) { fp_glCopyMultiTexSubImage1DEXT(texunit, target, level, xoffset, x, y, width); } -inline void glCopyMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { fp_glCopyMultiTexSubImage2DEXT(texunit, target, level, xoffset, yoffset, x, y, width, height); } -inline void glGetMultiTexImageEXT(GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, void* pixels) { fp_glGetMultiTexImageEXT(texunit, target, level, format, type, pixels); } -inline void glGetMultiTexParameterfvEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat* params) { fp_glGetMultiTexParameterfvEXT(texunit, target, pname, params); } -inline void glGetMultiTexParameterivEXT(GLenum texunit, GLenum target, GLenum pname, GLint* params) { fp_glGetMultiTexParameterivEXT(texunit, target, pname, params); } -inline void glGetMultiTexLevelParameterfvEXT(GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat* params) { fp_glGetMultiTexLevelParameterfvEXT(texunit, target, level, pname, params); } -inline void glGetMultiTexLevelParameterivEXT(GLenum texunit, GLenum target, GLint level, GLenum pname, GLint* params) { fp_glGetMultiTexLevelParameterivEXT(texunit, target, level, pname, params); } -inline void glMultiTexImage3DEXT(GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void* pixels) { fp_glMultiTexImage3DEXT(texunit, target, level, internalformat, width, height, depth, border, format, type, pixels); } -inline void glMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels) { fp_glMultiTexSubImage3DEXT(texunit, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); } -inline void glCopyMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) { fp_glCopyMultiTexSubImage3DEXT(texunit, target, level, xoffset, yoffset, zoffset, x, y, width, height); } -inline void glEnableClientStateIndexedEXT(GLenum array, GLuint index) { fp_glEnableClientStateIndexedEXT(array, index); } -inline void glDisableClientStateIndexedEXT(GLenum array, GLuint index) { fp_glDisableClientStateIndexedEXT(array, index); } -inline void glGetFloatIndexedvEXT(GLenum target, GLuint index, GLfloat* data) { fp_glGetFloatIndexedvEXT(target, index, data); } -inline void glGetDoubleIndexedvEXT(GLenum target, GLuint index, GLdouble* data) { fp_glGetDoubleIndexedvEXT(target, index, data); } -inline void glGetPointerIndexedvEXT(GLenum target, GLuint index, void** data) { fp_glGetPointerIndexedvEXT(target, index, data); } -inline void glEnableIndexedEXT(GLenum target, GLuint index) { fp_glEnableIndexedEXT(target, index); } -inline void glDisableIndexedEXT(GLenum target, GLuint index) { fp_glDisableIndexedEXT(target, index); } -inline GLboolean glIsEnabledIndexedEXT(GLenum target, GLuint index) { return fp_glIsEnabledIndexedEXT(target, index); } -inline void glGetIntegerIndexedvEXT(GLenum target, GLuint index, GLint* data) { fp_glGetIntegerIndexedvEXT(target, index, data); } -inline void glGetBooleanIndexedvEXT(GLenum target, GLuint index, GLboolean* data) { fp_glGetBooleanIndexedvEXT(target, index, data); } -inline void glCompressedTextureImage3DEXT(GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* bits) { fp_glCompressedTextureImage3DEXT(texture, target, level, internalformat, width, height, depth, border, imageSize, bits); } -inline void glCompressedTextureImage2DEXT(GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* bits) { fp_glCompressedTextureImage2DEXT(texture, target, level, internalformat, width, height, border, imageSize, bits); } -inline void glCompressedTextureImage1DEXT(GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void* bits) { fp_glCompressedTextureImage1DEXT(texture, target, level, internalformat, width, border, imageSize, bits); } -inline void glCompressedTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* bits) { fp_glCompressedTextureSubImage3DEXT(texture, target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, bits); } -inline void glCompressedTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* bits) { fp_glCompressedTextureSubImage2DEXT(texture, target, level, xoffset, yoffset, width, height, format, imageSize, bits); } -inline void glCompressedTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void* bits) { fp_glCompressedTextureSubImage1DEXT(texture, target, level, xoffset, width, format, imageSize, bits); } -inline void glGetCompressedTextureImageEXT(GLuint texture, GLenum target, GLint lod, void* img) { fp_glGetCompressedTextureImageEXT(texture, target, lod, img); } -inline void glCompressedMultiTexImage3DEXT(GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* bits) { fp_glCompressedMultiTexImage3DEXT(texunit, target, level, internalformat, width, height, depth, border, imageSize, bits); } -inline void glCompressedMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* bits) { fp_glCompressedMultiTexImage2DEXT(texunit, target, level, internalformat, width, height, border, imageSize, bits); } -inline void glCompressedMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void* bits) { fp_glCompressedMultiTexImage1DEXT(texunit, target, level, internalformat, width, border, imageSize, bits); } -inline void glCompressedMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* bits) { fp_glCompressedMultiTexSubImage3DEXT(texunit, target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, bits); } -inline void glCompressedMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* bits) { fp_glCompressedMultiTexSubImage2DEXT(texunit, target, level, xoffset, yoffset, width, height, format, imageSize, bits); } -inline void glCompressedMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void* bits) { fp_glCompressedMultiTexSubImage1DEXT(texunit, target, level, xoffset, width, format, imageSize, bits); } -inline void glGetCompressedMultiTexImageEXT(GLenum texunit, GLenum target, GLint lod, void* img) { fp_glGetCompressedMultiTexImageEXT(texunit, target, lod, img); } -inline void glMatrixLoadTransposefEXT(GLenum mode, const GLfloat* m) { fp_glMatrixLoadTransposefEXT(mode, m); } -inline void glMatrixLoadTransposedEXT(GLenum mode, const GLdouble* m) { fp_glMatrixLoadTransposedEXT(mode, m); } -inline void glMatrixMultTransposefEXT(GLenum mode, const GLfloat* m) { fp_glMatrixMultTransposefEXT(mode, m); } -inline void glMatrixMultTransposedEXT(GLenum mode, const GLdouble* m) { fp_glMatrixMultTransposedEXT(mode, m); } -inline void glNamedBufferDataEXT(GLuint buffer, GLsizeiptr size, const void* data, GLenum usage) { fp_glNamedBufferDataEXT(buffer, size, data, usage); } -inline void glNamedBufferSubDataEXT(GLuint buffer, GLintptr offset, GLsizeiptr size, const void* data) { fp_glNamedBufferSubDataEXT(buffer, offset, size, data); } -inline void* glMapNamedBufferEXT(GLuint buffer, GLenum access) { return fp_glMapNamedBufferEXT(buffer, access); } -inline GLboolean glUnmapNamedBufferEXT(GLuint buffer) { return fp_glUnmapNamedBufferEXT(buffer); } -inline void glGetNamedBufferParameterivEXT(GLuint buffer, GLenum pname, GLint* params) { fp_glGetNamedBufferParameterivEXT(buffer, pname, params); } -inline void glGetNamedBufferPointervEXT(GLuint buffer, GLenum pname, void** params) { fp_glGetNamedBufferPointervEXT(buffer, pname, params); } -inline void glGetNamedBufferSubDataEXT(GLuint buffer, GLintptr offset, GLsizeiptr size, void* data) { fp_glGetNamedBufferSubDataEXT(buffer, offset, size, data); } -inline void glProgramUniform1fEXT(GLuint program, GLint location, GLfloat v0) { fp_glProgramUniform1fEXT(program, location, v0); } -inline void glProgramUniform2fEXT(GLuint program, GLint location, GLfloat v0, GLfloat v1) { fp_glProgramUniform2fEXT(program, location, v0, v1); } -inline void glProgramUniform3fEXT(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2) { fp_glProgramUniform3fEXT(program, location, v0, v1, v2); } -inline void glProgramUniform4fEXT(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) { fp_glProgramUniform4fEXT(program, location, v0, v1, v2, v3); } -inline void glProgramUniform1iEXT(GLuint program, GLint location, GLint v0) { fp_glProgramUniform1iEXT(program, location, v0); } -inline void glProgramUniform2iEXT(GLuint program, GLint location, GLint v0, GLint v1) { fp_glProgramUniform2iEXT(program, location, v0, v1); } -inline void glProgramUniform3iEXT(GLuint program, GLint location, GLint v0, GLint v1, GLint v2) { fp_glProgramUniform3iEXT(program, location, v0, v1, v2); } -inline void glProgramUniform4iEXT(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3) { fp_glProgramUniform4iEXT(program, location, v0, v1, v2, v3); } -inline void glProgramUniform1fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat* value) { fp_glProgramUniform1fvEXT(program, location, count, value); } -inline void glProgramUniform2fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat* value) { fp_glProgramUniform2fvEXT(program, location, count, value); } -inline void glProgramUniform3fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat* value) { fp_glProgramUniform3fvEXT(program, location, count, value); } -inline void glProgramUniform4fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat* value) { fp_glProgramUniform4fvEXT(program, location, count, value); } -inline void glProgramUniform1ivEXT(GLuint program, GLint location, GLsizei count, const GLint* value) { fp_glProgramUniform1ivEXT(program, location, count, value); } -inline void glProgramUniform2ivEXT(GLuint program, GLint location, GLsizei count, const GLint* value) { fp_glProgramUniform2ivEXT(program, location, count, value); } -inline void glProgramUniform3ivEXT(GLuint program, GLint location, GLsizei count, const GLint* value) { fp_glProgramUniform3ivEXT(program, location, count, value); } -inline void glProgramUniform4ivEXT(GLuint program, GLint location, GLsizei count, const GLint* value) { fp_glProgramUniform4ivEXT(program, location, count, value); } -inline void glProgramUniformMatrix2fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glProgramUniformMatrix2fvEXT(program, location, count, transpose, value); } -inline void glProgramUniformMatrix3fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glProgramUniformMatrix3fvEXT(program, location, count, transpose, value); } -inline void glProgramUniformMatrix4fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glProgramUniformMatrix4fvEXT(program, location, count, transpose, value); } -inline void glProgramUniformMatrix2x3fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glProgramUniformMatrix2x3fvEXT(program, location, count, transpose, value); } -inline void glProgramUniformMatrix3x2fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glProgramUniformMatrix3x2fvEXT(program, location, count, transpose, value); } -inline void glProgramUniformMatrix2x4fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glProgramUniformMatrix2x4fvEXT(program, location, count, transpose, value); } -inline void glProgramUniformMatrix4x2fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glProgramUniformMatrix4x2fvEXT(program, location, count, transpose, value); } -inline void glProgramUniformMatrix3x4fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glProgramUniformMatrix3x4fvEXT(program, location, count, transpose, value); } -inline void glProgramUniformMatrix4x3fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glProgramUniformMatrix4x3fvEXT(program, location, count, transpose, value); } -inline void glTextureBufferEXT(GLuint texture, GLenum target, GLenum internalformat, GLuint buffer) { fp_glTextureBufferEXT(texture, target, internalformat, buffer); } -inline void glMultiTexBufferEXT(GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer) { fp_glMultiTexBufferEXT(texunit, target, internalformat, buffer); } -inline void glTextureParameterIivEXT(GLuint texture, GLenum target, GLenum pname, const GLint* params) { fp_glTextureParameterIivEXT(texture, target, pname, params); } -inline void glTextureParameterIuivEXT(GLuint texture, GLenum target, GLenum pname, const GLuint* params) { fp_glTextureParameterIuivEXT(texture, target, pname, params); } -inline void glGetTextureParameterIivEXT(GLuint texture, GLenum target, GLenum pname, GLint* params) { fp_glGetTextureParameterIivEXT(texture, target, pname, params); } -inline void glGetTextureParameterIuivEXT(GLuint texture, GLenum target, GLenum pname, GLuint* params) { fp_glGetTextureParameterIuivEXT(texture, target, pname, params); } -inline void glMultiTexParameterIivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint* params) { fp_glMultiTexParameterIivEXT(texunit, target, pname, params); } -inline void glMultiTexParameterIuivEXT(GLenum texunit, GLenum target, GLenum pname, const GLuint* params) { fp_glMultiTexParameterIuivEXT(texunit, target, pname, params); } -inline void glGetMultiTexParameterIivEXT(GLenum texunit, GLenum target, GLenum pname, GLint* params) { fp_glGetMultiTexParameterIivEXT(texunit, target, pname, params); } -inline void glGetMultiTexParameterIuivEXT(GLenum texunit, GLenum target, GLenum pname, GLuint* params) { fp_glGetMultiTexParameterIuivEXT(texunit, target, pname, params); } -inline void glProgramUniform1uiEXT(GLuint program, GLint location, GLuint v0) { fp_glProgramUniform1uiEXT(program, location, v0); } -inline void glProgramUniform2uiEXT(GLuint program, GLint location, GLuint v0, GLuint v1) { fp_glProgramUniform2uiEXT(program, location, v0, v1); } -inline void glProgramUniform3uiEXT(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2) { fp_glProgramUniform3uiEXT(program, location, v0, v1, v2); } -inline void glProgramUniform4uiEXT(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { fp_glProgramUniform4uiEXT(program, location, v0, v1, v2, v3); } -inline void glProgramUniform1uivEXT(GLuint program, GLint location, GLsizei count, const GLuint* value) { fp_glProgramUniform1uivEXT(program, location, count, value); } -inline void glProgramUniform2uivEXT(GLuint program, GLint location, GLsizei count, const GLuint* value) { fp_glProgramUniform2uivEXT(program, location, count, value); } -inline void glProgramUniform3uivEXT(GLuint program, GLint location, GLsizei count, const GLuint* value) { fp_glProgramUniform3uivEXT(program, location, count, value); } -inline void glProgramUniform4uivEXT(GLuint program, GLint location, GLsizei count, const GLuint* value) { fp_glProgramUniform4uivEXT(program, location, count, value); } -inline void glNamedProgramLocalParameters4fvEXT(GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat* params) { fp_glNamedProgramLocalParameters4fvEXT(program, target, index, count, params); } -inline void glNamedProgramLocalParameterI4iEXT(GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w) { fp_glNamedProgramLocalParameterI4iEXT(program, target, index, x, y, z, w); } -inline void glNamedProgramLocalParameterI4ivEXT(GLuint program, GLenum target, GLuint index, const GLint* params) { fp_glNamedProgramLocalParameterI4ivEXT(program, target, index, params); } -inline void glNamedProgramLocalParametersI4ivEXT(GLuint program, GLenum target, GLuint index, GLsizei count, const GLint* params) { fp_glNamedProgramLocalParametersI4ivEXT(program, target, index, count, params); } -inline void glNamedProgramLocalParameterI4uiEXT(GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) { fp_glNamedProgramLocalParameterI4uiEXT(program, target, index, x, y, z, w); } -inline void glNamedProgramLocalParameterI4uivEXT(GLuint program, GLenum target, GLuint index, const GLuint* params) { fp_glNamedProgramLocalParameterI4uivEXT(program, target, index, params); } -inline void glNamedProgramLocalParametersI4uivEXT(GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint* params) { fp_glNamedProgramLocalParametersI4uivEXT(program, target, index, count, params); } -inline void glGetNamedProgramLocalParameterIivEXT(GLuint program, GLenum target, GLuint index, GLint* params) { fp_glGetNamedProgramLocalParameterIivEXT(program, target, index, params); } -inline void glGetNamedProgramLocalParameterIuivEXT(GLuint program, GLenum target, GLuint index, GLuint* params) { fp_glGetNamedProgramLocalParameterIuivEXT(program, target, index, params); } -inline void glEnableClientStateiEXT(GLenum array, GLuint index) { fp_glEnableClientStateiEXT(array, index); } -inline void glDisableClientStateiEXT(GLenum array, GLuint index) { fp_glDisableClientStateiEXT(array, index); } -inline void glGetFloati_vEXT(GLenum pname, GLuint index, GLfloat* params) { fp_glGetFloati_vEXT(pname, index, params); } -inline void glGetDoublei_vEXT(GLenum pname, GLuint index, GLdouble* params) { fp_glGetDoublei_vEXT(pname, index, params); } -inline void glGetPointeri_vEXT(GLenum pname, GLuint index, void** params) { fp_glGetPointeri_vEXT(pname, index, params); } -inline void glNamedProgramStringEXT(GLuint program, GLenum target, GLenum format, GLsizei len, const void* string) { fp_glNamedProgramStringEXT(program, target, format, len, string); } -inline void glNamedProgramLocalParameter4dEXT(GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { fp_glNamedProgramLocalParameter4dEXT(program, target, index, x, y, z, w); } -inline void glNamedProgramLocalParameter4dvEXT(GLuint program, GLenum target, GLuint index, const GLdouble* params) { fp_glNamedProgramLocalParameter4dvEXT(program, target, index, params); } -inline void glNamedProgramLocalParameter4fEXT(GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { fp_glNamedProgramLocalParameter4fEXT(program, target, index, x, y, z, w); } -inline void glNamedProgramLocalParameter4fvEXT(GLuint program, GLenum target, GLuint index, const GLfloat* params) { fp_glNamedProgramLocalParameter4fvEXT(program, target, index, params); } -inline void glGetNamedProgramLocalParameterdvEXT(GLuint program, GLenum target, GLuint index, GLdouble* params) { fp_glGetNamedProgramLocalParameterdvEXT(program, target, index, params); } -inline void glGetNamedProgramLocalParameterfvEXT(GLuint program, GLenum target, GLuint index, GLfloat* params) { fp_glGetNamedProgramLocalParameterfvEXT(program, target, index, params); } -inline void glGetNamedProgramivEXT(GLuint program, GLenum target, GLenum pname, GLint* params) { fp_glGetNamedProgramivEXT(program, target, pname, params); } -inline void glGetNamedProgramStringEXT(GLuint program, GLenum target, GLenum pname, void* string) { fp_glGetNamedProgramStringEXT(program, target, pname, string); } -inline void glNamedRenderbufferStorageEXT(GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height) { fp_glNamedRenderbufferStorageEXT(renderbuffer, internalformat, width, height); } -inline void glGetNamedRenderbufferParameterivEXT(GLuint renderbuffer, GLenum pname, GLint* params) { fp_glGetNamedRenderbufferParameterivEXT(renderbuffer, pname, params); } -inline void glNamedRenderbufferStorageMultisampleEXT(GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { fp_glNamedRenderbufferStorageMultisampleEXT(renderbuffer, samples, internalformat, width, height); } -inline void glNamedRenderbufferStorageMultisampleCoverageEXT(GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height) { fp_glNamedRenderbufferStorageMultisampleCoverageEXT(renderbuffer, coverageSamples, colorSamples, internalformat, width, height); } -inline GLenum glCheckNamedFramebufferStatusEXT(GLuint framebuffer, GLenum target) { return fp_glCheckNamedFramebufferStatusEXT(framebuffer, target); } -inline void glNamedFramebufferTexture1DEXT(GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { fp_glNamedFramebufferTexture1DEXT(framebuffer, attachment, textarget, texture, level); } -inline void glNamedFramebufferTexture2DEXT(GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { fp_glNamedFramebufferTexture2DEXT(framebuffer, attachment, textarget, texture, level); } -inline void glNamedFramebufferTexture3DEXT(GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) { fp_glNamedFramebufferTexture3DEXT(framebuffer, attachment, textarget, texture, level, zoffset); } -inline void glNamedFramebufferRenderbufferEXT(GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { fp_glNamedFramebufferRenderbufferEXT(framebuffer, attachment, renderbuffertarget, renderbuffer); } -inline void glGetNamedFramebufferAttachmentParameterivEXT(GLuint framebuffer, GLenum attachment, GLenum pname, GLint* params) { fp_glGetNamedFramebufferAttachmentParameterivEXT(framebuffer, attachment, pname, params); } -inline void glGenerateTextureMipmapEXT(GLuint texture, GLenum target) { fp_glGenerateTextureMipmapEXT(texture, target); } -inline void glGenerateMultiTexMipmapEXT(GLenum texunit, GLenum target) { fp_glGenerateMultiTexMipmapEXT(texunit, target); } -inline void glFramebufferDrawBufferEXT(GLuint framebuffer, GLenum mode) { fp_glFramebufferDrawBufferEXT(framebuffer, mode); } -inline void glFramebufferDrawBuffersEXT(GLuint framebuffer, GLsizei n, const GLenum* bufs) { fp_glFramebufferDrawBuffersEXT(framebuffer, n, bufs); } -inline void glFramebufferReadBufferEXT(GLuint framebuffer, GLenum mode) { fp_glFramebufferReadBufferEXT(framebuffer, mode); } -inline void glGetFramebufferParameterivEXT(GLuint framebuffer, GLenum pname, GLint* params) { fp_glGetFramebufferParameterivEXT(framebuffer, pname, params); } -inline void glNamedCopyBufferSubDataEXT(GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) { fp_glNamedCopyBufferSubDataEXT(readBuffer, writeBuffer, readOffset, writeOffset, size); } -inline void glNamedFramebufferTextureEXT(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level) { fp_glNamedFramebufferTextureEXT(framebuffer, attachment, texture, level); } -inline void glNamedFramebufferTextureLayerEXT(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer) { fp_glNamedFramebufferTextureLayerEXT(framebuffer, attachment, texture, level, layer); } -inline void glNamedFramebufferTextureFaceEXT(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face) { fp_glNamedFramebufferTextureFaceEXT(framebuffer, attachment, texture, level, face); } -inline void glTextureRenderbufferEXT(GLuint texture, GLenum target, GLuint renderbuffer) { fp_glTextureRenderbufferEXT(texture, target, renderbuffer); } -inline void glMultiTexRenderbufferEXT(GLenum texunit, GLenum target, GLuint renderbuffer) { fp_glMultiTexRenderbufferEXT(texunit, target, renderbuffer); } -inline void glVertexArrayVertexOffsetEXT(GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset) { fp_glVertexArrayVertexOffsetEXT(vaobj, buffer, size, type, stride, offset); } -inline void glVertexArrayColorOffsetEXT(GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset) { fp_glVertexArrayColorOffsetEXT(vaobj, buffer, size, type, stride, offset); } -inline void glVertexArrayEdgeFlagOffsetEXT(GLuint vaobj, GLuint buffer, GLsizei stride, GLintptr offset) { fp_glVertexArrayEdgeFlagOffsetEXT(vaobj, buffer, stride, offset); } -inline void glVertexArrayIndexOffsetEXT(GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset) { fp_glVertexArrayIndexOffsetEXT(vaobj, buffer, type, stride, offset); } -inline void glVertexArrayNormalOffsetEXT(GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset) { fp_glVertexArrayNormalOffsetEXT(vaobj, buffer, type, stride, offset); } -inline void glVertexArrayTexCoordOffsetEXT(GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset) { fp_glVertexArrayTexCoordOffsetEXT(vaobj, buffer, size, type, stride, offset); } -inline void glVertexArrayMultiTexCoordOffsetEXT(GLuint vaobj, GLuint buffer, GLenum texunit, GLint size, GLenum type, GLsizei stride, GLintptr offset) { fp_glVertexArrayMultiTexCoordOffsetEXT(vaobj, buffer, texunit, size, type, stride, offset); } -inline void glVertexArrayFogCoordOffsetEXT(GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset) { fp_glVertexArrayFogCoordOffsetEXT(vaobj, buffer, type, stride, offset); } -inline void glVertexArraySecondaryColorOffsetEXT(GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset) { fp_glVertexArraySecondaryColorOffsetEXT(vaobj, buffer, size, type, stride, offset); } -inline void glVertexArrayVertexAttribOffsetEXT(GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset) { fp_glVertexArrayVertexAttribOffsetEXT(vaobj, buffer, index, size, type, normalized, stride, offset); } -inline void glVertexArrayVertexAttribIOffsetEXT(GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset) { fp_glVertexArrayVertexAttribIOffsetEXT(vaobj, buffer, index, size, type, stride, offset); } -inline void glEnableVertexArrayEXT(GLuint vaobj, GLenum array) { fp_glEnableVertexArrayEXT(vaobj, array); } -inline void glDisableVertexArrayEXT(GLuint vaobj, GLenum array) { fp_glDisableVertexArrayEXT(vaobj, array); } -inline void glEnableVertexArrayAttribEXT(GLuint vaobj, GLuint index) { fp_glEnableVertexArrayAttribEXT(vaobj, index); } -inline void glDisableVertexArrayAttribEXT(GLuint vaobj, GLuint index) { fp_glDisableVertexArrayAttribEXT(vaobj, index); } -inline void glGetVertexArrayIntegervEXT(GLuint vaobj, GLenum pname, GLint* param) { fp_glGetVertexArrayIntegervEXT(vaobj, pname, param); } -inline void glGetVertexArrayPointervEXT(GLuint vaobj, GLenum pname, void** param) { fp_glGetVertexArrayPointervEXT(vaobj, pname, param); } -inline void glGetVertexArrayIntegeri_vEXT(GLuint vaobj, GLuint index, GLenum pname, GLint* param) { fp_glGetVertexArrayIntegeri_vEXT(vaobj, index, pname, param); } -inline void glGetVertexArrayPointeri_vEXT(GLuint vaobj, GLuint index, GLenum pname, void** param) { fp_glGetVertexArrayPointeri_vEXT(vaobj, index, pname, param); } -inline void* glMapNamedBufferRangeEXT(GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access) { return fp_glMapNamedBufferRangeEXT(buffer, offset, length, access); } -inline void glFlushMappedNamedBufferRangeEXT(GLuint buffer, GLintptr offset, GLsizeiptr length) { fp_glFlushMappedNamedBufferRangeEXT(buffer, offset, length); } -inline void glNamedBufferStorageEXT(GLuint buffer, GLsizeiptr size, const void* data, GLbitfield flags) { fp_glNamedBufferStorageEXT(buffer, size, data, flags); } -inline void glClearNamedBufferDataEXT(GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void* data) { fp_glClearNamedBufferDataEXT(buffer, internalformat, format, type, data); } -inline void glClearNamedBufferSubDataEXT(GLuint buffer, GLenum internalformat, GLsizeiptr offset, GLsizeiptr size, GLenum format, GLenum type, const void* data) { fp_glClearNamedBufferSubDataEXT(buffer, internalformat, offset, size, format, type, data); } -inline void glNamedFramebufferParameteriEXT(GLuint framebuffer, GLenum pname, GLint param) { fp_glNamedFramebufferParameteriEXT(framebuffer, pname, param); } -inline void glGetNamedFramebufferParameterivEXT(GLuint framebuffer, GLenum pname, GLint* params) { fp_glGetNamedFramebufferParameterivEXT(framebuffer, pname, params); } -inline void glProgramUniform1dEXT(GLuint program, GLint location, GLdouble x) { fp_glProgramUniform1dEXT(program, location, x); } -inline void glProgramUniform2dEXT(GLuint program, GLint location, GLdouble x, GLdouble y) { fp_glProgramUniform2dEXT(program, location, x, y); } -inline void glProgramUniform3dEXT(GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z) { fp_glProgramUniform3dEXT(program, location, x, y, z); } -inline void glProgramUniform4dEXT(GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { fp_glProgramUniform4dEXT(program, location, x, y, z, w); } -inline void glProgramUniform1dvEXT(GLuint program, GLint location, GLsizei count, const GLdouble* value) { fp_glProgramUniform1dvEXT(program, location, count, value); } -inline void glProgramUniform2dvEXT(GLuint program, GLint location, GLsizei count, const GLdouble* value) { fp_glProgramUniform2dvEXT(program, location, count, value); } -inline void glProgramUniform3dvEXT(GLuint program, GLint location, GLsizei count, const GLdouble* value) { fp_glProgramUniform3dvEXT(program, location, count, value); } -inline void glProgramUniform4dvEXT(GLuint program, GLint location, GLsizei count, const GLdouble* value) { fp_glProgramUniform4dvEXT(program, location, count, value); } -inline void glProgramUniformMatrix2dvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glProgramUniformMatrix2dvEXT(program, location, count, transpose, value); } -inline void glProgramUniformMatrix3dvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glProgramUniformMatrix3dvEXT(program, location, count, transpose, value); } -inline void glProgramUniformMatrix4dvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glProgramUniformMatrix4dvEXT(program, location, count, transpose, value); } -inline void glProgramUniformMatrix2x3dvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glProgramUniformMatrix2x3dvEXT(program, location, count, transpose, value); } -inline void glProgramUniformMatrix2x4dvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glProgramUniformMatrix2x4dvEXT(program, location, count, transpose, value); } -inline void glProgramUniformMatrix3x2dvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glProgramUniformMatrix3x2dvEXT(program, location, count, transpose, value); } -inline void glProgramUniformMatrix3x4dvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glProgramUniformMatrix3x4dvEXT(program, location, count, transpose, value); } -inline void glProgramUniformMatrix4x2dvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glProgramUniformMatrix4x2dvEXT(program, location, count, transpose, value); } -inline void glProgramUniformMatrix4x3dvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value) { fp_glProgramUniformMatrix4x3dvEXT(program, location, count, transpose, value); } -inline void glTextureBufferRangeEXT(GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size) { fp_glTextureBufferRangeEXT(texture, target, internalformat, buffer, offset, size); } -inline void glTextureStorage1DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width) { fp_glTextureStorage1DEXT(texture, target, levels, internalformat, width); } -inline void glTextureStorage2DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) { fp_glTextureStorage2DEXT(texture, target, levels, internalformat, width, height); } -inline void glTextureStorage3DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) { fp_glTextureStorage3DEXT(texture, target, levels, internalformat, width, height, depth); } -inline void glTextureStorage2DMultisampleEXT(GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations) { fp_glTextureStorage2DMultisampleEXT(texture, target, samples, internalformat, width, height, fixedsamplelocations); } -inline void glTextureStorage3DMultisampleEXT(GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations) { fp_glTextureStorage3DMultisampleEXT(texture, target, samples, internalformat, width, height, depth, fixedsamplelocations); } -inline void glVertexArrayBindVertexBufferEXT(GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride) { fp_glVertexArrayBindVertexBufferEXT(vaobj, bindingindex, buffer, offset, stride); } -inline void glVertexArrayVertexAttribFormatEXT(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset) { fp_glVertexArrayVertexAttribFormatEXT(vaobj, attribindex, size, type, normalized, relativeoffset); } -inline void glVertexArrayVertexAttribIFormatEXT(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset) { fp_glVertexArrayVertexAttribIFormatEXT(vaobj, attribindex, size, type, relativeoffset); } -inline void glVertexArrayVertexAttribLFormatEXT(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset) { fp_glVertexArrayVertexAttribLFormatEXT(vaobj, attribindex, size, type, relativeoffset); } -inline void glVertexArrayVertexAttribBindingEXT(GLuint vaobj, GLuint attribindex, GLuint bindingindex) { fp_glVertexArrayVertexAttribBindingEXT(vaobj, attribindex, bindingindex); } -inline void glVertexArrayVertexBindingDivisorEXT(GLuint vaobj, GLuint bindingindex, GLuint divisor) { fp_glVertexArrayVertexBindingDivisorEXT(vaobj, bindingindex, divisor); } -inline void glVertexArrayVertexAttribLOffsetEXT(GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset) { fp_glVertexArrayVertexAttribLOffsetEXT(vaobj, buffer, index, size, type, stride, offset); } -inline void glTexturePageCommitmentEXT(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit) { fp_glTexturePageCommitmentEXT(texture, level, xoffset, yoffset, zoffset, width, height, depth, commit); } -inline void glVertexArrayVertexAttribDivisorEXT(GLuint vaobj, GLuint index, GLuint divisor) { fp_glVertexArrayVertexAttribDivisorEXT(vaobj, index, divisor); } - -/* GL_EXT_discard_framebuffer */ -inline void glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum* attachments) { fp_glDiscardFramebufferEXT(target, numAttachments, attachments); } - -/* GL_EXT_disjoint_timer_query */ -inline void glGenQueriesEXT(GLsizei n, GLuint* ids) { fp_glGenQueriesEXT(n, ids); } -inline void glDeleteQueriesEXT(GLsizei n, const GLuint* ids) { fp_glDeleteQueriesEXT(n, ids); } -inline GLboolean glIsQueryEXT(GLuint id) { return fp_glIsQueryEXT(id); } -inline void glBeginQueryEXT(GLenum target, GLuint id) { fp_glBeginQueryEXT(target, id); } -inline void glEndQueryEXT(GLenum target) { fp_glEndQueryEXT(target); } -inline void glQueryCounterEXT(GLuint id, GLenum target) { fp_glQueryCounterEXT(id, target); } -inline void glGetQueryivEXT(GLenum target, GLenum pname, GLint* params) { fp_glGetQueryivEXT(target, pname, params); } -inline void glGetQueryObjectivEXT(GLuint id, GLenum pname, GLint* params) { fp_glGetQueryObjectivEXT(id, pname, params); } -inline void glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint* params) { fp_glGetQueryObjectuivEXT(id, pname, params); } -inline void glGetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64* params) { fp_glGetQueryObjecti64vEXT(id, pname, params); } -inline void glGetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64* params) { fp_glGetQueryObjectui64vEXT(id, pname, params); } - -/* GL_EXT_draw_buffers */ -inline void glDrawBuffersEXT(GLsizei n, const GLenum* bufs) { fp_glDrawBuffersEXT(n, bufs); } - -/* GL_EXT_draw_buffers2 */ -inline void glColorMaskIndexedEXT(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a) { fp_glColorMaskIndexedEXT(index, r, g, b, a); } - -/* GL_EXT_draw_buffers_indexed */ -inline void glEnableiEXT(GLenum target, GLuint index) { fp_glEnableiEXT(target, index); } -inline void glDisableiEXT(GLenum target, GLuint index) { fp_glDisableiEXT(target, index); } -inline void glBlendEquationiEXT(GLuint buf, GLenum mode) { fp_glBlendEquationiEXT(buf, mode); } -inline void glBlendEquationSeparateiEXT(GLuint buf, GLenum modeRGB, GLenum modeAlpha) { fp_glBlendEquationSeparateiEXT(buf, modeRGB, modeAlpha); } -inline void glBlendFunciEXT(GLuint buf, GLenum src, GLenum dst) { fp_glBlendFunciEXT(buf, src, dst); } -inline void glBlendFuncSeparateiEXT(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { fp_glBlendFuncSeparateiEXT(buf, srcRGB, dstRGB, srcAlpha, dstAlpha); } -inline void glColorMaskiEXT(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a) { fp_glColorMaskiEXT(index, r, g, b, a); } -inline GLboolean glIsEnablediEXT(GLenum target, GLuint index) { return fp_glIsEnablediEXT(target, index); } - -/* GL_EXT_draw_elements_base_vertex */ -inline void glDrawElementsBaseVertexEXT(GLenum mode, GLsizei count, GLenum type, const void* indices, GLint basevertex) { fp_glDrawElementsBaseVertexEXT(mode, count, type, indices, basevertex); } -inline void glDrawRangeElementsBaseVertexEXT(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void* indices, GLint basevertex) { fp_glDrawRangeElementsBaseVertexEXT(mode, start, end, count, type, indices, basevertex); } -inline void glDrawElementsInstancedBaseVertexEXT(GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei instancecount, GLint basevertex) { fp_glDrawElementsInstancedBaseVertexEXT(mode, count, type, indices, instancecount, basevertex); } -inline void glMultiDrawElementsBaseVertexEXT(GLenum mode, const GLsizei* count, GLenum type, const void** indices, GLsizei primcount, const GLint* basevertex) { fp_glMultiDrawElementsBaseVertexEXT(mode, count, type, indices, primcount, basevertex); } - -/* GL_EXT_draw_instanced */ -inline void glDrawArraysInstancedEXT(GLenum mode, GLint start, GLsizei count, GLsizei primcount) { fp_glDrawArraysInstancedEXT(mode, start, count, primcount); } -inline void glDrawElementsInstancedEXT(GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount) { fp_glDrawElementsInstancedEXT(mode, count, type, indices, primcount); } - -/* GL_EXT_framebuffer_blit */ -inline void glBlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { fp_glBlitFramebufferEXT(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); } - -/* GL_EXT_framebuffer_multisample */ -inline void glRenderbufferStorageMultisampleEXT(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { fp_glRenderbufferStorageMultisampleEXT(target, samples, internalformat, width, height); } - -/* GL_EXT_framebuffer_object */ -inline GLboolean glIsRenderbufferEXT(GLuint renderbuffer) { return fp_glIsRenderbufferEXT(renderbuffer); } -inline void glBindRenderbufferEXT(GLenum target, GLuint renderbuffer) { fp_glBindRenderbufferEXT(target, renderbuffer); } -inline void glDeleteRenderbuffersEXT(GLsizei n, const GLuint* renderbuffers) { fp_glDeleteRenderbuffersEXT(n, renderbuffers); } -inline void glGenRenderbuffersEXT(GLsizei n, GLuint* renderbuffers) { fp_glGenRenderbuffersEXT(n, renderbuffers); } -inline void glRenderbufferStorageEXT(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { fp_glRenderbufferStorageEXT(target, internalformat, width, height); } -inline void glGetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint* params) { fp_glGetRenderbufferParameterivEXT(target, pname, params); } -inline GLboolean glIsFramebufferEXT(GLuint framebuffer) { return fp_glIsFramebufferEXT(framebuffer); } -inline void glBindFramebufferEXT(GLenum target, GLuint framebuffer) { fp_glBindFramebufferEXT(target, framebuffer); } -inline void glDeleteFramebuffersEXT(GLsizei n, const GLuint* framebuffers) { fp_glDeleteFramebuffersEXT(n, framebuffers); } -inline void glGenFramebuffersEXT(GLsizei n, GLuint* framebuffers) { fp_glGenFramebuffersEXT(n, framebuffers); } -inline GLenum glCheckFramebufferStatusEXT(GLenum target) { return fp_glCheckFramebufferStatusEXT(target); } -inline void glFramebufferTexture1DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { fp_glFramebufferTexture1DEXT(target, attachment, textarget, texture, level); } -inline void glFramebufferTexture2DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { fp_glFramebufferTexture2DEXT(target, attachment, textarget, texture, level); } -inline void glFramebufferTexture3DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) { fp_glFramebufferTexture3DEXT(target, attachment, textarget, texture, level, zoffset); } -inline void glFramebufferRenderbufferEXT(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { fp_glFramebufferRenderbufferEXT(target, attachment, renderbuffertarget, renderbuffer); } -inline void glGetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, GLenum pname, GLint* params) { fp_glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, params); } -inline void glGenerateMipmapEXT(GLenum target) { fp_glGenerateMipmapEXT(target); } - -/* GL_EXT_geometry_shader */ -inline void glFramebufferTextureEXT(GLenum target, GLenum attachment, GLuint texture, GLint level) { fp_glFramebufferTextureEXT(target, attachment, texture, level); } - -/* GL_EXT_geometry_shader4 */ -inline void glProgramParameteriEXT(GLuint program, GLenum pname, GLint value) { fp_glProgramParameteriEXT(program, pname, value); } - -/* GL_EXT_gpu_program_parameters */ -inline void glProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count, const GLfloat* params) { fp_glProgramEnvParameters4fvEXT(target, index, count, params); } -inline void glProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count, const GLfloat* params) { fp_glProgramLocalParameters4fvEXT(target, index, count, params); } - -/* GL_EXT_gpu_shader4 */ -inline void glGetUniformuivEXT(GLuint program, GLint location, GLuint* params) { fp_glGetUniformuivEXT(program, location, params); } -inline GLint glGetFragDataLocationEXT(GLuint program, const GLchar* name) { return fp_glGetFragDataLocationEXT(program, name); } -inline void glUniform1uiEXT(GLint location, GLuint v0) { fp_glUniform1uiEXT(location, v0); } -inline void glUniform2uiEXT(GLint location, GLuint v0, GLuint v1) { fp_glUniform2uiEXT(location, v0, v1); } -inline void glUniform3uiEXT(GLint location, GLuint v0, GLuint v1, GLuint v2) { fp_glUniform3uiEXT(location, v0, v1, v2); } -inline void glUniform4uiEXT(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { fp_glUniform4uiEXT(location, v0, v1, v2, v3); } -inline void glUniform1uivEXT(GLint location, GLsizei count, const GLuint* value) { fp_glUniform1uivEXT(location, count, value); } -inline void glUniform2uivEXT(GLint location, GLsizei count, const GLuint* value) { fp_glUniform2uivEXT(location, count, value); } -inline void glUniform3uivEXT(GLint location, GLsizei count, const GLuint* value) { fp_glUniform3uivEXT(location, count, value); } -inline void glUniform4uivEXT(GLint location, GLsizei count, const GLuint* value) { fp_glUniform4uivEXT(location, count, value); } - -/* GL_EXT_instanced_arrays */ -inline void glVertexAttribDivisorEXT(GLuint index, GLuint divisor) { fp_glVertexAttribDivisorEXT(index, divisor); } - -/* GL_EXT_map_buffer_range */ -inline void* glMapBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) { return fp_glMapBufferRangeEXT(target, offset, length, access); } -inline void glFlushMappedBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length) { fp_glFlushMappedBufferRangeEXT(target, offset, length); } - -/* GL_EXT_multi_draw_indirect */ -inline void glMultiDrawArraysIndirectEXT(GLenum mode, const void* indirect, GLsizei drawcount, GLsizei stride) { fp_glMultiDrawArraysIndirectEXT(mode, indirect, drawcount, stride); } -inline void glMultiDrawElementsIndirectEXT(GLenum mode, GLenum type, const void* indirect, GLsizei drawcount, GLsizei stride) { fp_glMultiDrawElementsIndirectEXT(mode, type, indirect, drawcount, stride); } - -/* GL_EXT_multisampled_render_to_texture */ -inline void glFramebufferTexture2DMultisampleEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) { fp_glFramebufferTexture2DMultisampleEXT(target, attachment, textarget, texture, level, samples); } - -/* GL_EXT_multiview_draw_buffers */ -inline void glReadBufferIndexedEXT(GLenum src, GLint index) { fp_glReadBufferIndexedEXT(src, index); } -inline void glDrawBuffersIndexedEXT(GLint n, const GLenum* location, const GLint* indices) { fp_glDrawBuffersIndexedEXT(n, location, indices); } -inline void glGetIntegeri_vEXT(GLenum target, GLuint index, GLint* data) { fp_glGetIntegeri_vEXT(target, index, data); } - -/* GL_EXT_polygon_offset_clamp */ -inline void glPolygonOffsetClampEXT(GLfloat factor, GLfloat units, GLfloat clamp) { fp_glPolygonOffsetClampEXT(factor, units, clamp); } - -/* GL_EXT_primitive_bounding_box */ -inline void glPrimitiveBoundingBoxEXT(GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW) { fp_glPrimitiveBoundingBoxEXT(minX, minY, minZ, minW, maxX, maxY, maxZ, maxW); } - -/* GL_EXT_provoking_vertex */ -inline void glProvokingVertexEXT(GLenum mode) { fp_glProvokingVertexEXT(mode); } - -/* GL_EXT_raster_multisample */ -inline void glRasterSamplesEXT(GLuint samples, GLboolean fixedsamplelocations) { fp_glRasterSamplesEXT(samples, fixedsamplelocations); } - -/* GL_EXT_robustness */ -inline GLenum glGetGraphicsResetStatusEXT() { return fp_glGetGraphicsResetStatusEXT(); } -inline void glReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void* data) { fp_glReadnPixelsEXT(x, y, width, height, format, type, bufSize, data); } -inline void glGetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, GLfloat* params) { fp_glGetnUniformfvEXT(program, location, bufSize, params); } -inline void glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint* params) { fp_glGetnUniformivEXT(program, location, bufSize, params); } - -/* GL_EXT_separate_shader_objects */ -inline void glUseShaderProgramEXT(GLenum type, GLuint program) { fp_glUseShaderProgramEXT(type, program); } -inline void glActiveProgramEXT(GLuint program) { fp_glActiveProgramEXT(program); } -inline GLuint glCreateShaderProgramEXT(GLenum type, const GLchar* string) { return fp_glCreateShaderProgramEXT(type, string); } -inline void glActiveShaderProgramEXT(GLuint pipeline, GLuint program) { fp_glActiveShaderProgramEXT(pipeline, program); } -inline void glBindProgramPipelineEXT(GLuint pipeline) { fp_glBindProgramPipelineEXT(pipeline); } -inline GLuint glCreateShaderProgramvEXT(GLenum type, GLsizei count, const GLchar** strings) { return fp_glCreateShaderProgramvEXT(type, count, strings); } -inline void glDeleteProgramPipelinesEXT(GLsizei n, const GLuint* pipelines) { fp_glDeleteProgramPipelinesEXT(n, pipelines); } -inline void glGenProgramPipelinesEXT(GLsizei n, GLuint* pipelines) { fp_glGenProgramPipelinesEXT(n, pipelines); } -inline void glGetProgramPipelineInfoLogEXT(GLuint pipeline, GLsizei bufSize, GLsizei* length, GLchar* infoLog) { fp_glGetProgramPipelineInfoLogEXT(pipeline, bufSize, length, infoLog); } -inline void glGetProgramPipelineivEXT(GLuint pipeline, GLenum pname, GLint* params) { fp_glGetProgramPipelineivEXT(pipeline, pname, params); } -inline GLboolean glIsProgramPipelineEXT(GLuint pipeline) { return fp_glIsProgramPipelineEXT(pipeline); } -inline void glUseProgramStagesEXT(GLuint pipeline, GLbitfield stages, GLuint program) { fp_glUseProgramStagesEXT(pipeline, stages, program); } -inline void glValidateProgramPipelineEXT(GLuint pipeline) { fp_glValidateProgramPipelineEXT(pipeline); } - -/* GL_EXT_shader_image_load_store */ -inline void glBindImageTextureEXT(GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format) { fp_glBindImageTextureEXT(index, texture, level, layered, layer, access, format); } -inline void glMemoryBarrierEXT(GLbitfield barriers) { fp_glMemoryBarrierEXT(barriers); } - -/* GL_EXT_sparse_texture */ -inline void glTexPageCommitmentEXT(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit) { fp_glTexPageCommitmentEXT(target, level, xoffset, yoffset, zoffset, width, height, depth, commit); } - -/* GL_EXT_stencil_clear_tag */ -inline void glStencilClearTagEXT(GLsizei stencilTagBits, GLuint stencilClearTag) { fp_glStencilClearTagEXT(stencilTagBits, stencilClearTag); } - -/* GL_EXT_tessellation_shader */ -inline void glPatchParameteriEXT(GLenum pname, GLint value) { fp_glPatchParameteriEXT(pname, value); } - -/* GL_EXT_texture_array */ -inline void glFramebufferTextureLayerEXT(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) { fp_glFramebufferTextureLayerEXT(target, attachment, texture, level, layer); } - -/* GL_EXT_texture_border_clamp */ -inline void glTexParameterIivEXT(GLenum target, GLenum pname, const GLint* params) { fp_glTexParameterIivEXT(target, pname, params); } -inline void glTexParameterIuivEXT(GLenum target, GLenum pname, const GLuint* params) { fp_glTexParameterIuivEXT(target, pname, params); } -inline void glGetTexParameterIivEXT(GLenum target, GLenum pname, GLint* params) { fp_glGetTexParameterIivEXT(target, pname, params); } -inline void glGetTexParameterIuivEXT(GLenum target, GLenum pname, GLuint* params) { fp_glGetTexParameterIuivEXT(target, pname, params); } -inline void glSamplerParameterIivEXT(GLuint sampler, GLenum pname, const GLint* param) { fp_glSamplerParameterIivEXT(sampler, pname, param); } -inline void glSamplerParameterIuivEXT(GLuint sampler, GLenum pname, const GLuint* param) { fp_glSamplerParameterIuivEXT(sampler, pname, param); } -inline void glGetSamplerParameterIivEXT(GLuint sampler, GLenum pname, GLint* params) { fp_glGetSamplerParameterIivEXT(sampler, pname, params); } -inline void glGetSamplerParameterIuivEXT(GLuint sampler, GLenum pname, GLuint* params) { fp_glGetSamplerParameterIuivEXT(sampler, pname, params); } - -/* GL_EXT_texture_buffer */ -inline void glTexBufferEXT(GLenum target, GLenum internalformat, GLuint buffer) { fp_glTexBufferEXT(target, internalformat, buffer); } -inline void glTexBufferRangeEXT(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size) { fp_glTexBufferRangeEXT(target, internalformat, buffer, offset, size); } - -/* GL_EXT_texture_integer */ -inline void glClearColorIiEXT(GLint red, GLint green, GLint blue, GLint alpha) { fp_glClearColorIiEXT(red, green, blue, alpha); } -inline void glClearColorIuiEXT(GLuint red, GLuint green, GLuint blue, GLuint alpha) { fp_glClearColorIuiEXT(red, green, blue, alpha); } - -/* GL_EXT_texture_storage */ -inline void glTexStorage1DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width) { fp_glTexStorage1DEXT(target, levels, internalformat, width); } -inline void glTexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) { fp_glTexStorage2DEXT(target, levels, internalformat, width, height); } -inline void glTexStorage3DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) { fp_glTexStorage3DEXT(target, levels, internalformat, width, height, depth); } - -/* GL_EXT_texture_view */ -inline void glTextureViewEXT(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers) { fp_glTextureViewEXT(texture, target, origtexture, internalformat, minlevel, numlevels, minlayer, numlayers); } - -/* GL_EXT_transform_feedback */ -inline void glBeginTransformFeedbackEXT(GLenum primitiveMode) { fp_glBeginTransformFeedbackEXT(primitiveMode); } -inline void glEndTransformFeedbackEXT() { fp_glEndTransformFeedbackEXT(); } -inline void glBindBufferRangeEXT(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) { fp_glBindBufferRangeEXT(target, index, buffer, offset, size); } -inline void glBindBufferOffsetEXT(GLenum target, GLuint index, GLuint buffer, GLintptr offset) { fp_glBindBufferOffsetEXT(target, index, buffer, offset); } -inline void glBindBufferBaseEXT(GLenum target, GLuint index, GLuint buffer) { fp_glBindBufferBaseEXT(target, index, buffer); } -inline void glTransformFeedbackVaryingsEXT(GLuint program, GLsizei count, const GLchar** varyings, GLenum bufferMode) { fp_glTransformFeedbackVaryingsEXT(program, count, varyings, bufferMode); } -inline void glGetTransformFeedbackVaryingEXT(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name) { fp_glGetTransformFeedbackVaryingEXT(program, index, bufSize, length, size, type, name); } - -/* GL_EXT_vertex_attrib_64bit */ -inline void glVertexAttribL1dEXT(GLuint index, GLdouble x) { fp_glVertexAttribL1dEXT(index, x); } -inline void glVertexAttribL2dEXT(GLuint index, GLdouble x, GLdouble y) { fp_glVertexAttribL2dEXT(index, x, y); } -inline void glVertexAttribL3dEXT(GLuint index, GLdouble x, GLdouble y, GLdouble z) { fp_glVertexAttribL3dEXT(index, x, y, z); } -inline void glVertexAttribL4dEXT(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { fp_glVertexAttribL4dEXT(index, x, y, z, w); } -inline void glVertexAttribL1dvEXT(GLuint index, const GLdouble* v) { fp_glVertexAttribL1dvEXT(index, v); } -inline void glVertexAttribL2dvEXT(GLuint index, const GLdouble* v) { fp_glVertexAttribL2dvEXT(index, v); } -inline void glVertexAttribL3dvEXT(GLuint index, const GLdouble* v) { fp_glVertexAttribL3dvEXT(index, v); } -inline void glVertexAttribL4dvEXT(GLuint index, const GLdouble* v) { fp_glVertexAttribL4dvEXT(index, v); } -inline void glVertexAttribLPointerEXT(GLuint index, GLint size, GLenum type, GLsizei stride, const void* pointer) { fp_glVertexAttribLPointerEXT(index, size, type, stride, pointer); } -inline void glGetVertexAttribLdvEXT(GLuint index, GLenum pname, GLdouble* params) { fp_glGetVertexAttribLdvEXT(index, pname, params); } - -/* GL_EXT_x11_sync_object */ -inline GLsync glImportSyncEXT(GLenum external_sync_type, GLintptr external_sync, GLbitfield flags) { return fp_glImportSyncEXT(external_sync_type, external_sync, flags); } - -/* GL_OES_copy_image */ -inline void glCopyImageSubDataOES(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth) { fp_glCopyImageSubDataOES(srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth); } - -/* GL_OES_draw_buffers_indexed */ -inline void glEnableiOES(GLenum target, GLuint index) { fp_glEnableiOES(target, index); } -inline void glDisableiOES(GLenum target, GLuint index) { fp_glDisableiOES(target, index); } -inline void glBlendEquationiOES(GLuint buf, GLenum mode) { fp_glBlendEquationiOES(buf, mode); } -inline void glBlendEquationSeparateiOES(GLuint buf, GLenum modeRGB, GLenum modeAlpha) { fp_glBlendEquationSeparateiOES(buf, modeRGB, modeAlpha); } -inline void glBlendFunciOES(GLuint buf, GLenum src, GLenum dst) { fp_glBlendFunciOES(buf, src, dst); } -inline void glBlendFuncSeparateiOES(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { fp_glBlendFuncSeparateiOES(buf, srcRGB, dstRGB, srcAlpha, dstAlpha); } -inline void glColorMaskiOES(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a) { fp_glColorMaskiOES(index, r, g, b, a); } -inline GLboolean glIsEnablediOES(GLenum target, GLuint index) { return fp_glIsEnablediOES(target, index); } - -/* GL_OES_draw_elements_base_vertex */ -inline void glDrawElementsBaseVertexOES(GLenum mode, GLsizei count, GLenum type, const void* indices, GLint basevertex) { fp_glDrawElementsBaseVertexOES(mode, count, type, indices, basevertex); } -inline void glDrawRangeElementsBaseVertexOES(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void* indices, GLint basevertex) { fp_glDrawRangeElementsBaseVertexOES(mode, start, end, count, type, indices, basevertex); } -inline void glDrawElementsInstancedBaseVertexOES(GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei instancecount, GLint basevertex) { fp_glDrawElementsInstancedBaseVertexOES(mode, count, type, indices, instancecount, basevertex); } -inline void glMultiDrawElementsBaseVertexOES(GLenum mode, const GLsizei* count, GLenum type, const void** indices, GLsizei primcount, const GLint* basevertex) { fp_glMultiDrawElementsBaseVertexOES(mode, count, type, indices, primcount, basevertex); } - -/* GL_OES_EGL_image */ -inline void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image) { fp_glEGLImageTargetTexture2DOES(target, image); } -inline void glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image) { fp_glEGLImageTargetRenderbufferStorageOES(target, image); } - -/* GL_OES_geometry_shader */ -inline void glFramebufferTextureOES(GLenum target, GLenum attachment, GLuint texture, GLint level) { fp_glFramebufferTextureOES(target, attachment, texture, level); } - -/* GL_OES_get_program_binary */ -inline void glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, void* binary) { fp_glGetProgramBinaryOES(program, bufSize, length, binaryFormat, binary); } -inline void glProgramBinaryOES(GLuint program, GLenum binaryFormat, const void* binary, GLint length) { fp_glProgramBinaryOES(program, binaryFormat, binary, length); } - -/* GL_OES_mapbuffer */ -inline void* glMapBufferOES(GLenum target, GLenum access) { return fp_glMapBufferOES(target, access); } -inline GLboolean glUnmapBufferOES(GLenum target) { return fp_glUnmapBufferOES(target); } -inline void glGetBufferPointervOES(GLenum target, GLenum pname, void** params) { fp_glGetBufferPointervOES(target, pname, params); } - -/* GL_OES_primitive_bounding_box */ -inline void glPrimitiveBoundingBoxOES(GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW) { fp_glPrimitiveBoundingBoxOES(minX, minY, minZ, minW, maxX, maxY, maxZ, maxW); } - -/* GL_OES_sample_shading */ -inline void glMinSampleShadingOES(GLfloat value) { fp_glMinSampleShadingOES(value); } - -/* GL_OES_tessellation_shader */ -inline void glPatchParameteriOES(GLenum pname, GLint value) { fp_glPatchParameteriOES(pname, value); } - -/* GL_OES_texture_3D */ -inline void glTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void* pixels) { fp_glTexImage3DOES(target, level, internalformat, width, height, depth, border, format, type, pixels); } -inline void glTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels) { fp_glTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); } -inline void glCopyTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) { fp_glCopyTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, x, y, width, height); } -inline void glCompressedTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data) { fp_glCompressedTexImage3DOES(target, level, internalformat, width, height, depth, border, imageSize, data); } -inline void glCompressedTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data) { fp_glCompressedTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); } -inline void glFramebufferTexture3DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) { fp_glFramebufferTexture3DOES(target, attachment, textarget, texture, level, zoffset); } - -/* GL_OES_texture_border_clamp */ -inline void glTexParameterIivOES(GLenum target, GLenum pname, const GLint* params) { fp_glTexParameterIivOES(target, pname, params); } -inline void glTexParameterIuivOES(GLenum target, GLenum pname, const GLuint* params) { fp_glTexParameterIuivOES(target, pname, params); } -inline void glGetTexParameterIivOES(GLenum target, GLenum pname, GLint* params) { fp_glGetTexParameterIivOES(target, pname, params); } -inline void glGetTexParameterIuivOES(GLenum target, GLenum pname, GLuint* params) { fp_glGetTexParameterIuivOES(target, pname, params); } -inline void glSamplerParameterIivOES(GLuint sampler, GLenum pname, const GLint* param) { fp_glSamplerParameterIivOES(sampler, pname, param); } -inline void glSamplerParameterIuivOES(GLuint sampler, GLenum pname, const GLuint* param) { fp_glSamplerParameterIuivOES(sampler, pname, param); } -inline void glGetSamplerParameterIivOES(GLuint sampler, GLenum pname, GLint* params) { fp_glGetSamplerParameterIivOES(sampler, pname, params); } -inline void glGetSamplerParameterIuivOES(GLuint sampler, GLenum pname, GLuint* params) { fp_glGetSamplerParameterIuivOES(sampler, pname, params); } - -/* GL_OES_texture_buffer */ -inline void glTexBufferOES(GLenum target, GLenum internalformat, GLuint buffer) { fp_glTexBufferOES(target, internalformat, buffer); } -inline void glTexBufferRangeOES(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size) { fp_glTexBufferRangeOES(target, internalformat, buffer, offset, size); } - -/* GL_OES_texture_storage_multisample_2d_array */ -inline void glTexStorage3DMultisampleOES(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations) { fp_glTexStorage3DMultisampleOES(target, samples, internalformat, width, height, depth, fixedsamplelocations); } - -/* GL_OES_texture_view */ -inline void glTextureViewOES(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers) { fp_glTextureViewOES(texture, target, origtexture, internalformat, minlevel, numlevels, minlayer, numlayers); } - -/* GL_OES_vertex_array_object */ -inline void glBindVertexArrayOES(GLuint array) { fp_glBindVertexArrayOES(array); } -inline void glDeleteVertexArraysOES(GLsizei n, const GLuint* arrays) { fp_glDeleteVertexArraysOES(n, arrays); } -inline void glGenVertexArraysOES(GLsizei n, GLuint* arrays) { fp_glGenVertexArraysOES(n, arrays); } -inline GLboolean glIsVertexArrayOES(GLuint array) { return fp_glIsVertexArrayOES(array); } - -/* GL_AMD_debug_output */ -inline void glDebugMessageEnableAMD(GLenum category, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled) { fp_glDebugMessageEnableAMD(category, severity, count, ids, enabled); } -inline void glDebugMessageInsertAMD(GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar* buf) { fp_glDebugMessageInsertAMD(category, severity, id, length, buf); } -inline void glDebugMessageCallbackAMD(GLDEBUGPROCAMD callback, void* userParam) { fp_glDebugMessageCallbackAMD(callback, userParam); } -inline GLuint glGetDebugMessageLogAMD(GLuint count, GLsizei bufsize, GLenum* categories, GLuint* severities, GLuint* ids, GLsizei* lengths, GLchar* message) { return fp_glGetDebugMessageLogAMD(count, bufsize, categories, severities, ids, lengths, message); } - -/* GL_AMD_draw_buffers_blend */ -inline void glBlendFuncIndexedAMD(GLuint buf, GLenum src, GLenum dst) { fp_glBlendFuncIndexedAMD(buf, src, dst); } -inline void glBlendFuncSeparateIndexedAMD(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { fp_glBlendFuncSeparateIndexedAMD(buf, srcRGB, dstRGB, srcAlpha, dstAlpha); } -inline void glBlendEquationIndexedAMD(GLuint buf, GLenum mode) { fp_glBlendEquationIndexedAMD(buf, mode); } -inline void glBlendEquationSeparateIndexedAMD(GLuint buf, GLenum modeRGB, GLenum modeAlpha) { fp_glBlendEquationSeparateIndexedAMD(buf, modeRGB, modeAlpha); } - -/* GL_AMD_gpu_shader_int64 */ -inline void glUniform1i64NV(GLint location, GLint64EXT x) { fp_glUniform1i64NV(location, x); } -inline void glUniform2i64NV(GLint location, GLint64EXT x, GLint64EXT y) { fp_glUniform2i64NV(location, x, y); } -inline void glUniform3i64NV(GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z) { fp_glUniform3i64NV(location, x, y, z); } -inline void glUniform4i64NV(GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w) { fp_glUniform4i64NV(location, x, y, z, w); } -inline void glUniform1i64vNV(GLint location, GLsizei count, const GLint64EXT* value) { fp_glUniform1i64vNV(location, count, value); } -inline void glUniform2i64vNV(GLint location, GLsizei count, const GLint64EXT* value) { fp_glUniform2i64vNV(location, count, value); } -inline void glUniform3i64vNV(GLint location, GLsizei count, const GLint64EXT* value) { fp_glUniform3i64vNV(location, count, value); } -inline void glUniform4i64vNV(GLint location, GLsizei count, const GLint64EXT* value) { fp_glUniform4i64vNV(location, count, value); } -inline void glUniform1ui64NV(GLint location, GLuint64EXT x) { fp_glUniform1ui64NV(location, x); } -inline void glUniform2ui64NV(GLint location, GLuint64EXT x, GLuint64EXT y) { fp_glUniform2ui64NV(location, x, y); } -inline void glUniform3ui64NV(GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z) { fp_glUniform3ui64NV(location, x, y, z); } -inline void glUniform4ui64NV(GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w) { fp_glUniform4ui64NV(location, x, y, z, w); } -inline void glUniform1ui64vNV(GLint location, GLsizei count, const GLuint64EXT* value) { fp_glUniform1ui64vNV(location, count, value); } -inline void glUniform2ui64vNV(GLint location, GLsizei count, const GLuint64EXT* value) { fp_glUniform2ui64vNV(location, count, value); } -inline void glUniform3ui64vNV(GLint location, GLsizei count, const GLuint64EXT* value) { fp_glUniform3ui64vNV(location, count, value); } -inline void glUniform4ui64vNV(GLint location, GLsizei count, const GLuint64EXT* value) { fp_glUniform4ui64vNV(location, count, value); } -inline void glGetUniformi64vNV(GLuint program, GLint location, GLint64EXT* params) { fp_glGetUniformi64vNV(program, location, params); } -inline void glGetUniformui64vNV(GLuint program, GLint location, GLuint64EXT* params) { fp_glGetUniformui64vNV(program, location, params); } -inline void glProgramUniform1i64NV(GLuint program, GLint location, GLint64EXT x) { fp_glProgramUniform1i64NV(program, location, x); } -inline void glProgramUniform2i64NV(GLuint program, GLint location, GLint64EXT x, GLint64EXT y) { fp_glProgramUniform2i64NV(program, location, x, y); } -inline void glProgramUniform3i64NV(GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z) { fp_glProgramUniform3i64NV(program, location, x, y, z); } -inline void glProgramUniform4i64NV(GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w) { fp_glProgramUniform4i64NV(program, location, x, y, z, w); } -inline void glProgramUniform1i64vNV(GLuint program, GLint location, GLsizei count, const GLint64EXT* value) { fp_glProgramUniform1i64vNV(program, location, count, value); } -inline void glProgramUniform2i64vNV(GLuint program, GLint location, GLsizei count, const GLint64EXT* value) { fp_glProgramUniform2i64vNV(program, location, count, value); } -inline void glProgramUniform3i64vNV(GLuint program, GLint location, GLsizei count, const GLint64EXT* value) { fp_glProgramUniform3i64vNV(program, location, count, value); } -inline void glProgramUniform4i64vNV(GLuint program, GLint location, GLsizei count, const GLint64EXT* value) { fp_glProgramUniform4i64vNV(program, location, count, value); } -inline void glProgramUniform1ui64NV(GLuint program, GLint location, GLuint64EXT x) { fp_glProgramUniform1ui64NV(program, location, x); } -inline void glProgramUniform2ui64NV(GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y) { fp_glProgramUniform2ui64NV(program, location, x, y); } -inline void glProgramUniform3ui64NV(GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z) { fp_glProgramUniform3ui64NV(program, location, x, y, z); } -inline void glProgramUniform4ui64NV(GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w) { fp_glProgramUniform4ui64NV(program, location, x, y, z, w); } -inline void glProgramUniform1ui64vNV(GLuint program, GLint location, GLsizei count, const GLuint64EXT* value) { fp_glProgramUniform1ui64vNV(program, location, count, value); } -inline void glProgramUniform2ui64vNV(GLuint program, GLint location, GLsizei count, const GLuint64EXT* value) { fp_glProgramUniform2ui64vNV(program, location, count, value); } -inline void glProgramUniform3ui64vNV(GLuint program, GLint location, GLsizei count, const GLuint64EXT* value) { fp_glProgramUniform3ui64vNV(program, location, count, value); } -inline void glProgramUniform4ui64vNV(GLuint program, GLint location, GLsizei count, const GLuint64EXT* value) { fp_glProgramUniform4ui64vNV(program, location, count, value); } - -/* GL_AMD_interleaved_elements */ -inline void glVertexAttribParameteriAMD(GLuint index, GLenum pname, GLint param) { fp_glVertexAttribParameteriAMD(index, pname, param); } - -/* GL_AMD_multi_draw_indirect */ -inline void glMultiDrawArraysIndirectAMD(GLenum mode, const void* indirect, GLsizei primcount, GLsizei stride) { fp_glMultiDrawArraysIndirectAMD(mode, indirect, primcount, stride); } -inline void glMultiDrawElementsIndirectAMD(GLenum mode, GLenum type, const void* indirect, GLsizei primcount, GLsizei stride) { fp_glMultiDrawElementsIndirectAMD(mode, type, indirect, primcount, stride); } - -/* GL_AMD_name_gen_delete */ -inline void glGenNamesAMD(GLenum identifier, GLuint num, GLuint* names) { fp_glGenNamesAMD(identifier, num, names); } -inline void glDeleteNamesAMD(GLenum identifier, GLuint num, const GLuint* names) { fp_glDeleteNamesAMD(identifier, num, names); } -inline GLboolean glIsNameAMD(GLenum identifier, GLuint name) { return fp_glIsNameAMD(identifier, name); } - -/* GL_AMD_occlusion_query_event */ -inline void glQueryObjectParameteruiAMD(GLenum target, GLuint id, GLenum pname, GLuint param) { fp_glQueryObjectParameteruiAMD(target, id, pname, param); } - -/* GL_AMD_performance_monitor */ -inline void glGetPerfMonitorGroupsAMD(GLint* numGroups, GLsizei groupsSize, GLuint* groups) { fp_glGetPerfMonitorGroupsAMD(numGroups, groupsSize, groups); } -inline void glGetPerfMonitorCountersAMD(GLuint group, GLint* numCounters, GLint* maxActiveCounters, GLsizei counterSize, GLuint* counters) { fp_glGetPerfMonitorCountersAMD(group, numCounters, maxActiveCounters, counterSize, counters); } -inline void glGetPerfMonitorGroupStringAMD(GLuint group, GLsizei bufSize, GLsizei* length, GLchar* groupString) { fp_glGetPerfMonitorGroupStringAMD(group, bufSize, length, groupString); } -inline void glGetPerfMonitorCounterStringAMD(GLuint group, GLuint counter, GLsizei bufSize, GLsizei* length, GLchar* counterString) { fp_glGetPerfMonitorCounterStringAMD(group, counter, bufSize, length, counterString); } -inline void glGetPerfMonitorCounterInfoAMD(GLuint group, GLuint counter, GLenum pname, void* data) { fp_glGetPerfMonitorCounterInfoAMD(group, counter, pname, data); } -inline void glGenPerfMonitorsAMD(GLsizei n, GLuint* monitors) { fp_glGenPerfMonitorsAMD(n, monitors); } -inline void glDeletePerfMonitorsAMD(GLsizei n, GLuint* monitors) { fp_glDeletePerfMonitorsAMD(n, monitors); } -inline void glSelectPerfMonitorCountersAMD(GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint* counterList) { fp_glSelectPerfMonitorCountersAMD(monitor, enable, group, numCounters, counterList); } -inline void glBeginPerfMonitorAMD(GLuint monitor) { fp_glBeginPerfMonitorAMD(monitor); } -inline void glEndPerfMonitorAMD(GLuint monitor) { fp_glEndPerfMonitorAMD(monitor); } -inline void glGetPerfMonitorCounterDataAMD(GLuint monitor, GLenum pname, GLsizei dataSize, GLuint* data, GLint* bytesWritten) { fp_glGetPerfMonitorCounterDataAMD(monitor, pname, dataSize, data, bytesWritten); } - -/* GL_AMD_sample_positions */ -inline void glSetMultisamplefvAMD(GLenum pname, GLuint index, const GLfloat* val) { fp_glSetMultisamplefvAMD(pname, index, val); } - -/* GL_AMD_sparse_texture */ -inline void glTexStorageSparseAMD(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags) { fp_glTexStorageSparseAMD(target, internalFormat, width, height, depth, layers, flags); } -inline void glTextureStorageSparseAMD(GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags) { fp_glTextureStorageSparseAMD(texture, target, internalFormat, width, height, depth, layers, flags); } - -/* GL_AMD_stencil_operation_extended */ -inline void glStencilOpValueAMD(GLenum face, GLuint value) { fp_glStencilOpValueAMD(face, value); } - -/* GL_AMD_vertex_shader_tessellator */ -inline void glTessellationFactorAMD(GLfloat factor) { fp_glTessellationFactorAMD(factor); } -inline void glTessellationModeAMD(GLenum mode) { fp_glTessellationModeAMD(mode); } - -/* GL_ANGLE_framebuffer_blit */ -inline void glBlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { fp_glBlitFramebufferANGLE(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); } - -/* GL_ANGLE_framebuffer_multisample */ -inline void glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { fp_glRenderbufferStorageMultisampleANGLE(target, samples, internalformat, width, height); } - -/* GL_ANGLE_instanced_arrays */ -inline void glDrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount) { fp_glDrawArraysInstancedANGLE(mode, first, count, primcount); } -inline void glDrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount) { fp_glDrawElementsInstancedANGLE(mode, count, type, indices, primcount); } -inline void glVertexAttribDivisorANGLE(GLuint index, GLuint divisor) { fp_glVertexAttribDivisorANGLE(index, divisor); } - -/* GL_ANGLE_translated_shader_source */ -inline void glGetTranslatedShaderSourceANGLE(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) { fp_glGetTranslatedShaderSourceANGLE(shader, bufsize, length, source); } - -/* GL_APPLE_copy_texture_levels */ -inline void glCopyTextureLevelsAPPLE(GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount) { fp_glCopyTextureLevelsAPPLE(destinationTexture, sourceTexture, sourceBaseLevel, sourceLevelCount); } - -/* GL_APPLE_element_array */ -inline void glElementPointerAPPLE(GLenum type, const void* pointer) { fp_glElementPointerAPPLE(type, pointer); } -inline void glDrawElementArrayAPPLE(GLenum mode, GLint first, GLsizei count) { fp_glDrawElementArrayAPPLE(mode, first, count); } -inline void glDrawRangeElementArrayAPPLE(GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count) { fp_glDrawRangeElementArrayAPPLE(mode, start, end, first, count); } -inline void glMultiDrawElementArrayAPPLE(GLenum mode, const GLint* first, const GLsizei* count, GLsizei primcount) { fp_glMultiDrawElementArrayAPPLE(mode, first, count, primcount); } -inline void glMultiDrawRangeElementArrayAPPLE(GLenum mode, GLuint start, GLuint end, const GLint* first, const GLsizei* count, GLsizei primcount) { fp_glMultiDrawRangeElementArrayAPPLE(mode, start, end, first, count, primcount); } - -/* GL_APPLE_fence */ -inline void glGenFencesAPPLE(GLsizei n, GLuint* fences) { fp_glGenFencesAPPLE(n, fences); } -inline void glDeleteFencesAPPLE(GLsizei n, const GLuint* fences) { fp_glDeleteFencesAPPLE(n, fences); } -inline void glSetFenceAPPLE(GLuint fence) { fp_glSetFenceAPPLE(fence); } -inline GLboolean glIsFenceAPPLE(GLuint fence) { return fp_glIsFenceAPPLE(fence); } -inline GLboolean glTestFenceAPPLE(GLuint fence) { return fp_glTestFenceAPPLE(fence); } -inline void glFinishFenceAPPLE(GLuint fence) { fp_glFinishFenceAPPLE(fence); } -inline GLboolean glTestObjectAPPLE(GLenum object, GLuint name) { return fp_glTestObjectAPPLE(object, name); } -inline void glFinishObjectAPPLE(GLenum object, GLint name) { fp_glFinishObjectAPPLE(object, name); } - -/* GL_APPLE_flush_buffer_range */ -inline void glBufferParameteriAPPLE(GLenum target, GLenum pname, GLint param) { fp_glBufferParameteriAPPLE(target, pname, param); } -inline void glFlushMappedBufferRangeAPPLE(GLenum target, GLintptr offset, GLsizeiptr size) { fp_glFlushMappedBufferRangeAPPLE(target, offset, size); } - -/* GL_APPLE_framebuffer_multisample */ -inline void glRenderbufferStorageMultisampleAPPLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { fp_glRenderbufferStorageMultisampleAPPLE(target, samples, internalformat, width, height); } -inline void glResolveMultisampleFramebufferAPPLE() { fp_glResolveMultisampleFramebufferAPPLE(); } - -/* GL_APPLE_object_purgeable */ -inline GLenum glObjectPurgeableAPPLE(GLenum objectType, GLuint name, GLenum option) { return fp_glObjectPurgeableAPPLE(objectType, name, option); } -inline GLenum glObjectUnpurgeableAPPLE(GLenum objectType, GLuint name, GLenum option) { return fp_glObjectUnpurgeableAPPLE(objectType, name, option); } -inline void glGetObjectParameterivAPPLE(GLenum objectType, GLuint name, GLenum pname, GLint* params) { fp_glGetObjectParameterivAPPLE(objectType, name, pname, params); } - -/* GL_APPLE_sync */ -inline GLsync glFenceSyncAPPLE(GLenum condition, GLbitfield flags) { return fp_glFenceSyncAPPLE(condition, flags); } -inline GLboolean glIsSyncAPPLE(GLsync sync) { return fp_glIsSyncAPPLE(sync); } -inline void glDeleteSyncAPPLE(GLsync sync) { fp_glDeleteSyncAPPLE(sync); } -inline GLenum glClientWaitSyncAPPLE(GLsync sync, GLbitfield flags, GLuint64 timeout) { return fp_glClientWaitSyncAPPLE(sync, flags, timeout); } -inline void glWaitSyncAPPLE(GLsync sync, GLbitfield flags, GLuint64 timeout) { fp_glWaitSyncAPPLE(sync, flags, timeout); } -inline void glGetInteger64vAPPLE(GLenum pname, GLint64* params) { fp_glGetInteger64vAPPLE(pname, params); } -inline void glGetSyncivAPPLE(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values) { fp_glGetSyncivAPPLE(sync, pname, bufSize, length, values); } - -/* GL_APPLE_texture_range */ -inline void glTextureRangeAPPLE(GLenum target, GLsizei length, const void* pointer) { fp_glTextureRangeAPPLE(target, length, pointer); } -inline void glGetTexParameterPointervAPPLE(GLenum target, GLenum pname, void** params) { fp_glGetTexParameterPointervAPPLE(target, pname, params); } - -/* GL_APPLE_vertex_array_object */ -inline void glBindVertexArrayAPPLE(GLuint array) { fp_glBindVertexArrayAPPLE(array); } -inline void glDeleteVertexArraysAPPLE(GLsizei n, const GLuint* arrays) { fp_glDeleteVertexArraysAPPLE(n, arrays); } -inline void glGenVertexArraysAPPLE(GLsizei n, GLuint* arrays) { fp_glGenVertexArraysAPPLE(n, arrays); } -inline GLboolean glIsVertexArrayAPPLE(GLuint array) { return fp_glIsVertexArrayAPPLE(array); } - -/* GL_APPLE_vertex_array_range */ -inline void glVertexArrayRangeAPPLE(GLsizei length, void* pointer) { fp_glVertexArrayRangeAPPLE(length, pointer); } -inline void glFlushVertexArrayRangeAPPLE(GLsizei length, void* pointer) { fp_glFlushVertexArrayRangeAPPLE(length, pointer); } -inline void glVertexArrayParameteriAPPLE(GLenum pname, GLint param) { fp_glVertexArrayParameteriAPPLE(pname, param); } - -/* GL_APPLE_vertex_program_evaluators */ -inline void glEnableVertexAttribAPPLE(GLuint index, GLenum pname) { fp_glEnableVertexAttribAPPLE(index, pname); } -inline void glDisableVertexAttribAPPLE(GLuint index, GLenum pname) { fp_glDisableVertexAttribAPPLE(index, pname); } -inline GLboolean glIsVertexAttribEnabledAPPLE(GLuint index, GLenum pname) { return fp_glIsVertexAttribEnabledAPPLE(index, pname); } -inline void glMapVertexAttrib1dAPPLE(GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble* points) { fp_glMapVertexAttrib1dAPPLE(index, size, u1, u2, stride, order, points); } -inline void glMapVertexAttrib1fAPPLE(GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat* points) { fp_glMapVertexAttrib1fAPPLE(index, size, u1, u2, stride, order, points); } -inline void glMapVertexAttrib2dAPPLE(GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble* points) { fp_glMapVertexAttrib2dAPPLE(index, size, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); } -inline void glMapVertexAttrib2fAPPLE(GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat* points) { fp_glMapVertexAttrib2fAPPLE(index, size, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); } - -/* GL_GREMEDY_frame_terminator */ -inline void glFrameTerminatorGREMEDY() { fp_glFrameTerminatorGREMEDY(); } - -/* GL_GREMEDY_string_marker */ -inline void glStringMarkerGREMEDY(GLsizei len, const void* string) { fp_glStringMarkerGREMEDY(len, string); } - -/* GL_IMG_multisampled_render_to_texture */ -inline void glRenderbufferStorageMultisampleIMG(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { fp_glRenderbufferStorageMultisampleIMG(target, samples, internalformat, width, height); } -inline void glFramebufferTexture2DMultisampleIMG(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) { fp_glFramebufferTexture2DMultisampleIMG(target, attachment, textarget, texture, level, samples); } - -/* GL_INGR_blend_func_separate */ -inline void glBlendFuncSeparateINGR(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) { fp_glBlendFuncSeparateINGR(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha); } - -/* GL_INTEL_framebuffer_CMAA */ -inline void glApplyFramebufferAttachmentCMAAINTEL() { fp_glApplyFramebufferAttachmentCMAAINTEL(); } - -/* GL_INTEL_map_texture */ -inline void glSyncTextureINTEL(GLuint texture) { fp_glSyncTextureINTEL(texture); } -inline void glUnmapTexture2DINTEL(GLuint texture, GLint level) { fp_glUnmapTexture2DINTEL(texture, level); } -inline void* glMapTexture2DINTEL(GLuint texture, GLint level, GLbitfield access, GLint* stride, GLenum* layout) { return fp_glMapTexture2DINTEL(texture, level, access, stride, layout); } - -/* GL_INTEL_performance_query */ -inline void glBeginPerfQueryINTEL(GLuint queryHandle) { fp_glBeginPerfQueryINTEL(queryHandle); } -inline void glCreatePerfQueryINTEL(GLuint queryId, GLuint* queryHandle) { fp_glCreatePerfQueryINTEL(queryId, queryHandle); } -inline void glDeletePerfQueryINTEL(GLuint queryHandle) { fp_glDeletePerfQueryINTEL(queryHandle); } -inline void glEndPerfQueryINTEL(GLuint queryHandle) { fp_glEndPerfQueryINTEL(queryHandle); } -inline void glGetFirstPerfQueryIdINTEL(GLuint* queryId) { fp_glGetFirstPerfQueryIdINTEL(queryId); } -inline void glGetNextPerfQueryIdINTEL(GLuint queryId, GLuint* nextQueryId) { fp_glGetNextPerfQueryIdINTEL(queryId, nextQueryId); } -inline void glGetPerfCounterInfoINTEL(GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar* counterName, GLuint counterDescLength, GLchar* counterDesc, GLuint* counterOffset, GLuint* counterDataSize, GLuint* counterTypeEnum, GLuint* counterDataTypeEnum, GLuint64* rawCounterMaxValue) { fp_glGetPerfCounterInfoINTEL(queryId, counterId, counterNameLength, counterName, counterDescLength, counterDesc, counterOffset, counterDataSize, counterTypeEnum, counterDataTypeEnum, rawCounterMaxValue); } -inline void glGetPerfQueryDataINTEL(GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid* data, GLuint* bytesWritten) { fp_glGetPerfQueryDataINTEL(queryHandle, flags, dataSize, data, bytesWritten); } -inline void glGetPerfQueryIdByNameINTEL(GLchar* queryName, GLuint* queryId) { fp_glGetPerfQueryIdByNameINTEL(queryName, queryId); } -inline void glGetPerfQueryInfoINTEL(GLuint queryId, GLuint queryNameLength, GLchar* queryName, GLuint* dataSize, GLuint* noCounters, GLuint* noInstances, GLuint* capsMask) { fp_glGetPerfQueryInfoINTEL(queryId, queryNameLength, queryName, dataSize, noCounters, noInstances, capsMask); } - -/* GL_NV_bindless_multi_draw_indirect */ -inline void glMultiDrawArraysIndirectBindlessNV(GLenum mode, const void* indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount) { fp_glMultiDrawArraysIndirectBindlessNV(mode, indirect, drawCount, stride, vertexBufferCount); } -inline void glMultiDrawElementsIndirectBindlessNV(GLenum mode, GLenum type, const void* indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount) { fp_glMultiDrawElementsIndirectBindlessNV(mode, type, indirect, drawCount, stride, vertexBufferCount); } - -/* GL_NV_bindless_multi_draw_indirect_count */ -inline void glMultiDrawArraysIndirectBindlessCountNV(GLenum mode, const void* indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount) { fp_glMultiDrawArraysIndirectBindlessCountNV(mode, indirect, drawCount, maxDrawCount, stride, vertexBufferCount); } -inline void glMultiDrawElementsIndirectBindlessCountNV(GLenum mode, GLenum type, const void* indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount) { fp_glMultiDrawElementsIndirectBindlessCountNV(mode, type, indirect, drawCount, maxDrawCount, stride, vertexBufferCount); } - -/* GL_NV_bindless_texture */ -inline GLuint64 glGetTextureHandleNV(GLuint texture) { return fp_glGetTextureHandleNV(texture); } -inline GLuint64 glGetTextureSamplerHandleNV(GLuint texture, GLuint sampler) { return fp_glGetTextureSamplerHandleNV(texture, sampler); } -inline void glMakeTextureHandleResidentNV(GLuint64 handle) { fp_glMakeTextureHandleResidentNV(handle); } -inline void glMakeTextureHandleNonResidentNV(GLuint64 handle) { fp_glMakeTextureHandleNonResidentNV(handle); } -inline GLuint64 glGetImageHandleNV(GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format) { return fp_glGetImageHandleNV(texture, level, layered, layer, format); } -inline void glMakeImageHandleResidentNV(GLuint64 handle, GLenum access) { fp_glMakeImageHandleResidentNV(handle, access); } -inline void glMakeImageHandleNonResidentNV(GLuint64 handle) { fp_glMakeImageHandleNonResidentNV(handle); } -inline void glUniformHandleui64NV(GLint location, GLuint64 value) { fp_glUniformHandleui64NV(location, value); } -inline void glUniformHandleui64vNV(GLint location, GLsizei count, const GLuint64* value) { fp_glUniformHandleui64vNV(location, count, value); } -inline void glProgramUniformHandleui64NV(GLuint program, GLint location, GLuint64 value) { fp_glProgramUniformHandleui64NV(program, location, value); } -inline void glProgramUniformHandleui64vNV(GLuint program, GLint location, GLsizei count, const GLuint64* values) { fp_glProgramUniformHandleui64vNV(program, location, count, values); } -inline GLboolean glIsTextureHandleResidentNV(GLuint64 handle) { return fp_glIsTextureHandleResidentNV(handle); } -inline GLboolean glIsImageHandleResidentNV(GLuint64 handle) { return fp_glIsImageHandleResidentNV(handle); } - -/* GL_NV_blend_equation_advanced */ -inline void glBlendParameteriNV(GLenum pname, GLint value) { fp_glBlendParameteriNV(pname, value); } -inline void glBlendBarrierNV() { fp_glBlendBarrierNV(); } - -/* GL_NV_command_list */ -inline void glCreateStatesNV(GLsizei n, GLuint* states) { fp_glCreateStatesNV(n, states); } -inline void glDeleteStatesNV(GLsizei n, const GLuint* states) { fp_glDeleteStatesNV(n, states); } -inline GLboolean glIsStateNV(GLuint state) { return fp_glIsStateNV(state); } -inline void glStateCaptureNV(GLuint state, GLenum mode) { fp_glStateCaptureNV(state, mode); } -inline GLuint glGetCommandHeaderNV(GLenum tokenID, GLuint size) { return fp_glGetCommandHeaderNV(tokenID, size); } -inline GLushort glGetStageIndexNV(GLenum shadertype) { return fp_glGetStageIndexNV(shadertype); } -inline void glDrawCommandsNV(GLenum primitiveMode, GLuint buffer, const GLintptr* indirects, const GLsizei* sizes, GLuint count) { fp_glDrawCommandsNV(primitiveMode, buffer, indirects, sizes, count); } -inline void glDrawCommandsAddressNV(GLenum primitiveMode, const GLuint64* indirects, const GLsizei* sizes, GLuint count) { fp_glDrawCommandsAddressNV(primitiveMode, indirects, sizes, count); } -inline void glDrawCommandsStatesNV(GLuint buffer, const GLintptr* indirects, const GLsizei* sizes, const GLuint* states, const GLuint* fbos, GLuint count) { fp_glDrawCommandsStatesNV(buffer, indirects, sizes, states, fbos, count); } -inline void glDrawCommandsStatesAddressNV(const GLuint64* indirects, const GLsizei* sizes, const GLuint* states, const GLuint* fbos, GLuint count) { fp_glDrawCommandsStatesAddressNV(indirects, sizes, states, fbos, count); } -inline void glCreateCommandListsNV(GLsizei n, GLuint* lists) { fp_glCreateCommandListsNV(n, lists); } -inline void glDeleteCommandListsNV(GLsizei n, const GLuint* lists) { fp_glDeleteCommandListsNV(n, lists); } -inline GLboolean glIsCommandListNV(GLuint list) { return fp_glIsCommandListNV(list); } -inline void glListDrawCommandsStatesClientNV(GLuint list, GLuint segment, const void** indirects, const GLsizei* sizes, const GLuint* states, const GLuint* fbos, GLuint count) { fp_glListDrawCommandsStatesClientNV(list, segment, indirects, sizes, states, fbos, count); } -inline void glCommandListSegmentsNV(GLuint list, GLuint segments) { fp_glCommandListSegmentsNV(list, segments); } -inline void glCompileCommandListNV(GLuint list) { fp_glCompileCommandListNV(list); } -inline void glCallCommandListNV(GLuint list) { fp_glCallCommandListNV(list); } - -/* GL_NV_conditional_render */ -inline void glBeginConditionalRenderNV(GLuint id, GLenum mode) { fp_glBeginConditionalRenderNV(id, mode); } -inline void glEndConditionalRenderNV() { fp_glEndConditionalRenderNV(); } - -/* GL_NV_conservative_raster */ -inline void glSubpixelPrecisionBiasNV(GLuint xbits, GLuint ybits) { fp_glSubpixelPrecisionBiasNV(xbits, ybits); } - -/* GL_NV_conservative_raster_dilate */ -inline void glConservativeRasterParameterfNV(GLenum pname, GLfloat value) { fp_glConservativeRasterParameterfNV(pname, value); } - -/* GL_NV_copy_buffer */ -inline void glCopyBufferSubDataNV(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) { fp_glCopyBufferSubDataNV(readTarget, writeTarget, readOffset, writeOffset, size); } - -/* GL_NV_copy_image */ -inline void glCopyImageSubDataNV(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth) { fp_glCopyImageSubDataNV(srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, width, height, depth); } - -/* GL_NV_coverage_sample */ -inline void glCoverageMaskNV(GLboolean mask) { fp_glCoverageMaskNV(mask); } -inline void glCoverageOperationNV(GLenum operation) { fp_glCoverageOperationNV(operation); } - -/* GL_NV_depth_buffer_float */ -inline void glDepthRangedNV(GLdouble zNear, GLdouble zFar) { fp_glDepthRangedNV(zNear, zFar); } -inline void glClearDepthdNV(GLdouble depth) { fp_glClearDepthdNV(depth); } -inline void glDepthBoundsdNV(GLdouble zmin, GLdouble zmax) { fp_glDepthBoundsdNV(zmin, zmax); } - -/* GL_NV_draw_buffers */ -inline void glDrawBuffersNV(GLsizei n, const GLenum* bufs) { fp_glDrawBuffersNV(n, bufs); } - -/* GL_NV_draw_instanced */ -inline void glDrawArraysInstancedNV(GLenum mode, GLint first, GLsizei count, GLsizei primcount) { fp_glDrawArraysInstancedNV(mode, first, count, primcount); } -inline void glDrawElementsInstancedNV(GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount) { fp_glDrawElementsInstancedNV(mode, count, type, indices, primcount); } - -/* GL_NV_draw_texture */ -inline void glDrawTextureNV(GLuint texture, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1) { fp_glDrawTextureNV(texture, sampler, x0, y0, x1, y1, z, s0, t0, s1, t1); } - -/* GL_NV_explicit_multisample */ -inline void glGetMultisamplefvNV(GLenum pname, GLuint index, GLfloat* val) { fp_glGetMultisamplefvNV(pname, index, val); } -inline void glSampleMaskIndexedNV(GLuint index, GLbitfield mask) { fp_glSampleMaskIndexedNV(index, mask); } -inline void glTexRenderbufferNV(GLenum target, GLuint renderbuffer) { fp_glTexRenderbufferNV(target, renderbuffer); } - -/* GL_NV_fence */ -inline void glDeleteFencesNV(GLsizei n, const GLuint* fences) { fp_glDeleteFencesNV(n, fences); } -inline void glGenFencesNV(GLsizei n, GLuint* fences) { fp_glGenFencesNV(n, fences); } -inline GLboolean glIsFenceNV(GLuint fence) { return fp_glIsFenceNV(fence); } -inline GLboolean glTestFenceNV(GLuint fence) { return fp_glTestFenceNV(fence); } -inline void glGetFenceivNV(GLuint fence, GLenum pname, GLint* params) { fp_glGetFenceivNV(fence, pname, params); } -inline void glFinishFenceNV(GLuint fence) { fp_glFinishFenceNV(fence); } -inline void glSetFenceNV(GLuint fence, GLenum condition) { fp_glSetFenceNV(fence, condition); } - -/* GL_NV_fragment_coverage_to_color */ -inline void glFragmentCoverageColorNV(GLuint color) { fp_glFragmentCoverageColorNV(color); } - -/* GL_NV_framebuffer_blit */ -inline void glBlitFramebufferNV(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { fp_glBlitFramebufferNV(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); } - -/* GL_NV_framebuffer_mixed_samples */ -inline void glCoverageModulationTableNV(GLsizei n, const GLfloat* v) { fp_glCoverageModulationTableNV(n, v); } -inline void glGetCoverageModulationTableNV(GLsizei bufsize, GLfloat* v) { fp_glGetCoverageModulationTableNV(bufsize, v); } -inline void glCoverageModulationNV(GLenum components) { fp_glCoverageModulationNV(components); } - -/* GL_NV_framebuffer_multisample */ -inline void glRenderbufferStorageMultisampleNV(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { fp_glRenderbufferStorageMultisampleNV(target, samples, internalformat, width, height); } - -/* GL_NV_framebuffer_multisample_coverage */ -inline void glRenderbufferStorageMultisampleCoverageNV(GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height) { fp_glRenderbufferStorageMultisampleCoverageNV(target, coverageSamples, colorSamples, internalformat, width, height); } - -/* GL_NV_geometry_program4 */ -inline void glProgramVertexLimitNV(GLenum target, GLint limit) { fp_glProgramVertexLimitNV(target, limit); } -inline void glFramebufferTextureFaceEXT(GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face) { fp_glFramebufferTextureFaceEXT(target, attachment, texture, level, face); } - -/* GL_NV_gpu_program4 */ -inline void glProgramLocalParameterI4iNV(GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w) { fp_glProgramLocalParameterI4iNV(target, index, x, y, z, w); } -inline void glProgramLocalParameterI4ivNV(GLenum target, GLuint index, const GLint* params) { fp_glProgramLocalParameterI4ivNV(target, index, params); } -inline void glProgramLocalParametersI4ivNV(GLenum target, GLuint index, GLsizei count, const GLint* params) { fp_glProgramLocalParametersI4ivNV(target, index, count, params); } -inline void glProgramLocalParameterI4uiNV(GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) { fp_glProgramLocalParameterI4uiNV(target, index, x, y, z, w); } -inline void glProgramLocalParameterI4uivNV(GLenum target, GLuint index, const GLuint* params) { fp_glProgramLocalParameterI4uivNV(target, index, params); } -inline void glProgramLocalParametersI4uivNV(GLenum target, GLuint index, GLsizei count, const GLuint* params) { fp_glProgramLocalParametersI4uivNV(target, index, count, params); } -inline void glProgramEnvParameterI4iNV(GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w) { fp_glProgramEnvParameterI4iNV(target, index, x, y, z, w); } -inline void glProgramEnvParameterI4ivNV(GLenum target, GLuint index, const GLint* params) { fp_glProgramEnvParameterI4ivNV(target, index, params); } -inline void glProgramEnvParametersI4ivNV(GLenum target, GLuint index, GLsizei count, const GLint* params) { fp_glProgramEnvParametersI4ivNV(target, index, count, params); } -inline void glProgramEnvParameterI4uiNV(GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) { fp_glProgramEnvParameterI4uiNV(target, index, x, y, z, w); } -inline void glProgramEnvParameterI4uivNV(GLenum target, GLuint index, const GLuint* params) { fp_glProgramEnvParameterI4uivNV(target, index, params); } -inline void glProgramEnvParametersI4uivNV(GLenum target, GLuint index, GLsizei count, const GLuint* params) { fp_glProgramEnvParametersI4uivNV(target, index, count, params); } -inline void glGetProgramLocalParameterIivNV(GLenum target, GLuint index, GLint* params) { fp_glGetProgramLocalParameterIivNV(target, index, params); } -inline void glGetProgramLocalParameterIuivNV(GLenum target, GLuint index, GLuint* params) { fp_glGetProgramLocalParameterIuivNV(target, index, params); } -inline void glGetProgramEnvParameterIivNV(GLenum target, GLuint index, GLint* params) { fp_glGetProgramEnvParameterIivNV(target, index, params); } -inline void glGetProgramEnvParameterIuivNV(GLenum target, GLuint index, GLuint* params) { fp_glGetProgramEnvParameterIuivNV(target, index, params); } - -/* GL_NV_gpu_program5 */ -inline void glProgramSubroutineParametersuivNV(GLenum target, GLsizei count, const GLuint* params) { fp_glProgramSubroutineParametersuivNV(target, count, params); } -inline void glGetProgramSubroutineParameteruivNV(GLenum target, GLuint index, GLuint* param) { fp_glGetProgramSubroutineParameteruivNV(target, index, param); } - -/* GL_NV_half_float */ -inline void glVertex2hNV(GLhalfNV x, GLhalfNV y) { fp_glVertex2hNV(x, y); } -inline void glVertex2hvNV(const GLhalfNV* v) { fp_glVertex2hvNV(v); } -inline void glVertex3hNV(GLhalfNV x, GLhalfNV y, GLhalfNV z) { fp_glVertex3hNV(x, y, z); } -inline void glVertex3hvNV(const GLhalfNV* v) { fp_glVertex3hvNV(v); } -inline void glVertex4hNV(GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w) { fp_glVertex4hNV(x, y, z, w); } -inline void glVertex4hvNV(const GLhalfNV* v) { fp_glVertex4hvNV(v); } -inline void glNormal3hNV(GLhalfNV nx, GLhalfNV ny, GLhalfNV nz) { fp_glNormal3hNV(nx, ny, nz); } -inline void glNormal3hvNV(const GLhalfNV* v) { fp_glNormal3hvNV(v); } -inline void glColor3hNV(GLhalfNV red, GLhalfNV green, GLhalfNV blue) { fp_glColor3hNV(red, green, blue); } -inline void glColor3hvNV(const GLhalfNV* v) { fp_glColor3hvNV(v); } -inline void glColor4hNV(GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha) { fp_glColor4hNV(red, green, blue, alpha); } -inline void glColor4hvNV(const GLhalfNV* v) { fp_glColor4hvNV(v); } -inline void glTexCoord1hNV(GLhalfNV s) { fp_glTexCoord1hNV(s); } -inline void glTexCoord1hvNV(const GLhalfNV* v) { fp_glTexCoord1hvNV(v); } -inline void glTexCoord2hNV(GLhalfNV s, GLhalfNV t) { fp_glTexCoord2hNV(s, t); } -inline void glTexCoord2hvNV(const GLhalfNV* v) { fp_glTexCoord2hvNV(v); } -inline void glTexCoord3hNV(GLhalfNV s, GLhalfNV t, GLhalfNV r) { fp_glTexCoord3hNV(s, t, r); } -inline void glTexCoord3hvNV(const GLhalfNV* v) { fp_glTexCoord3hvNV(v); } -inline void glTexCoord4hNV(GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q) { fp_glTexCoord4hNV(s, t, r, q); } -inline void glTexCoord4hvNV(const GLhalfNV* v) { fp_glTexCoord4hvNV(v); } -inline void glMultiTexCoord1hNV(GLenum target, GLhalfNV s) { fp_glMultiTexCoord1hNV(target, s); } -inline void glMultiTexCoord1hvNV(GLenum target, const GLhalfNV* v) { fp_glMultiTexCoord1hvNV(target, v); } -inline void glMultiTexCoord2hNV(GLenum target, GLhalfNV s, GLhalfNV t) { fp_glMultiTexCoord2hNV(target, s, t); } -inline void glMultiTexCoord2hvNV(GLenum target, const GLhalfNV* v) { fp_glMultiTexCoord2hvNV(target, v); } -inline void glMultiTexCoord3hNV(GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r) { fp_glMultiTexCoord3hNV(target, s, t, r); } -inline void glMultiTexCoord3hvNV(GLenum target, const GLhalfNV* v) { fp_glMultiTexCoord3hvNV(target, v); } -inline void glMultiTexCoord4hNV(GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q) { fp_glMultiTexCoord4hNV(target, s, t, r, q); } -inline void glMultiTexCoord4hvNV(GLenum target, const GLhalfNV* v) { fp_glMultiTexCoord4hvNV(target, v); } -inline void glFogCoordhNV(GLhalfNV fog) { fp_glFogCoordhNV(fog); } -inline void glFogCoordhvNV(const GLhalfNV* fog) { fp_glFogCoordhvNV(fog); } -inline void glSecondaryColor3hNV(GLhalfNV red, GLhalfNV green, GLhalfNV blue) { fp_glSecondaryColor3hNV(red, green, blue); } -inline void glSecondaryColor3hvNV(const GLhalfNV* v) { fp_glSecondaryColor3hvNV(v); } -inline void glVertexWeighthNV(GLhalfNV weight) { fp_glVertexWeighthNV(weight); } -inline void glVertexWeighthvNV(const GLhalfNV* weight) { fp_glVertexWeighthvNV(weight); } -inline void glVertexAttrib1hNV(GLuint index, GLhalfNV x) { fp_glVertexAttrib1hNV(index, x); } -inline void glVertexAttrib1hvNV(GLuint index, const GLhalfNV* v) { fp_glVertexAttrib1hvNV(index, v); } -inline void glVertexAttrib2hNV(GLuint index, GLhalfNV x, GLhalfNV y) { fp_glVertexAttrib2hNV(index, x, y); } -inline void glVertexAttrib2hvNV(GLuint index, const GLhalfNV* v) { fp_glVertexAttrib2hvNV(index, v); } -inline void glVertexAttrib3hNV(GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z) { fp_glVertexAttrib3hNV(index, x, y, z); } -inline void glVertexAttrib3hvNV(GLuint index, const GLhalfNV* v) { fp_glVertexAttrib3hvNV(index, v); } -inline void glVertexAttrib4hNV(GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w) { fp_glVertexAttrib4hNV(index, x, y, z, w); } -inline void glVertexAttrib4hvNV(GLuint index, const GLhalfNV* v) { fp_glVertexAttrib4hvNV(index, v); } -inline void glVertexAttribs1hvNV(GLuint index, GLsizei n, const GLhalfNV* v) { fp_glVertexAttribs1hvNV(index, n, v); } -inline void glVertexAttribs2hvNV(GLuint index, GLsizei n, const GLhalfNV* v) { fp_glVertexAttribs2hvNV(index, n, v); } -inline void glVertexAttribs3hvNV(GLuint index, GLsizei n, const GLhalfNV* v) { fp_glVertexAttribs3hvNV(index, n, v); } -inline void glVertexAttribs4hvNV(GLuint index, GLsizei n, const GLhalfNV* v) { fp_glVertexAttribs4hvNV(index, n, v); } - -/* GL_NV_instanced_arrays */ -inline void glVertexAttribDivisorNV(GLuint index, GLuint divisor) { fp_glVertexAttribDivisorNV(index, divisor); } - -/* GL_NV_internalformat_sample_query */ -inline void glGetInternalformatSampleivNV(GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint* params) { fp_glGetInternalformatSampleivNV(target, internalformat, samples, pname, bufSize, params); } - -/* GL_NV_non_square_matrices */ -inline void glUniformMatrix2x3fvNV(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glUniformMatrix2x3fvNV(location, count, transpose, value); } -inline void glUniformMatrix3x2fvNV(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glUniformMatrix3x2fvNV(location, count, transpose, value); } -inline void glUniformMatrix2x4fvNV(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glUniformMatrix2x4fvNV(location, count, transpose, value); } -inline void glUniformMatrix4x2fvNV(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glUniformMatrix4x2fvNV(location, count, transpose, value); } -inline void glUniformMatrix3x4fvNV(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glUniformMatrix3x4fvNV(location, count, transpose, value); } -inline void glUniformMatrix4x3fvNV(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { fp_glUniformMatrix4x3fvNV(location, count, transpose, value); } - -/* GL_NV_occlusion_query */ -inline void glGenOcclusionQueriesNV(GLsizei n, GLuint* ids) { fp_glGenOcclusionQueriesNV(n, ids); } -inline void glDeleteOcclusionQueriesNV(GLsizei n, const GLuint* ids) { fp_glDeleteOcclusionQueriesNV(n, ids); } -inline GLboolean glIsOcclusionQueryNV(GLuint id) { return fp_glIsOcclusionQueryNV(id); } -inline void glBeginOcclusionQueryNV(GLuint id) { fp_glBeginOcclusionQueryNV(id); } -inline void glEndOcclusionQueryNV() { fp_glEndOcclusionQueryNV(); } -inline void glGetOcclusionQueryivNV(GLuint id, GLenum pname, GLint* params) { fp_glGetOcclusionQueryivNV(id, pname, params); } -inline void glGetOcclusionQueryuivNV(GLuint id, GLenum pname, GLuint* params) { fp_glGetOcclusionQueryuivNV(id, pname, params); } - -/* GL_NV_parameter_buffer_object */ -inline void glProgramBufferParametersfvNV(GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLfloat* params) { fp_glProgramBufferParametersfvNV(target, bindingIndex, wordIndex, count, params); } -inline void glProgramBufferParametersIivNV(GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLint* params) { fp_glProgramBufferParametersIivNV(target, bindingIndex, wordIndex, count, params); } -inline void glProgramBufferParametersIuivNV(GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLuint* params) { fp_glProgramBufferParametersIuivNV(target, bindingIndex, wordIndex, count, params); } - -/* GL_NV_path_rendering */ -inline GLuint glGenPathsNV(GLsizei range) { return fp_glGenPathsNV(range); } -inline void glDeletePathsNV(GLuint path, GLsizei range) { fp_glDeletePathsNV(path, range); } -inline GLboolean glIsPathNV(GLuint path) { return fp_glIsPathNV(path); } -inline void glPathCommandsNV(GLuint path, GLsizei numCommands, const GLubyte* commands, GLsizei numCoords, GLenum coordType, const void* coords) { fp_glPathCommandsNV(path, numCommands, commands, numCoords, coordType, coords); } -inline void glPathCoordsNV(GLuint path, GLsizei numCoords, GLenum coordType, const void* coords) { fp_glPathCoordsNV(path, numCoords, coordType, coords); } -inline void glPathSubCommandsNV(GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte* commands, GLsizei numCoords, GLenum coordType, const void* coords) { fp_glPathSubCommandsNV(path, commandStart, commandsToDelete, numCommands, commands, numCoords, coordType, coords); } -inline void glPathSubCoordsNV(GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void* coords) { fp_glPathSubCoordsNV(path, coordStart, numCoords, coordType, coords); } -inline void glPathStringNV(GLuint path, GLenum format, GLsizei length, const void* pathString) { fp_glPathStringNV(path, format, length, pathString); } -inline void glPathGlyphsNV(GLuint firstPathName, GLenum fontTarget, const void* fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void* charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale) { fp_glPathGlyphsNV(firstPathName, fontTarget, fontName, fontStyle, numGlyphs, type, charcodes, handleMissingGlyphs, pathParameterTemplate, emScale); } -inline void glPathGlyphRangeNV(GLuint firstPathName, GLenum fontTarget, const void* fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale) { fp_glPathGlyphRangeNV(firstPathName, fontTarget, fontName, fontStyle, firstGlyph, numGlyphs, handleMissingGlyphs, pathParameterTemplate, emScale); } -inline void glWeightPathsNV(GLuint resultPath, GLsizei numPaths, const GLuint* paths, const GLfloat* weights) { fp_glWeightPathsNV(resultPath, numPaths, paths, weights); } -inline void glCopyPathNV(GLuint resultPath, GLuint srcPath) { fp_glCopyPathNV(resultPath, srcPath); } -inline void glInterpolatePathsNV(GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight) { fp_glInterpolatePathsNV(resultPath, pathA, pathB, weight); } -inline void glTransformPathNV(GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat* transformValues) { fp_glTransformPathNV(resultPath, srcPath, transformType, transformValues); } -inline void glPathParameterivNV(GLuint path, GLenum pname, const GLint* value) { fp_glPathParameterivNV(path, pname, value); } -inline void glPathParameteriNV(GLuint path, GLenum pname, GLint value) { fp_glPathParameteriNV(path, pname, value); } -inline void glPathParameterfvNV(GLuint path, GLenum pname, const GLfloat* value) { fp_glPathParameterfvNV(path, pname, value); } -inline void glPathParameterfNV(GLuint path, GLenum pname, GLfloat value) { fp_glPathParameterfNV(path, pname, value); } -inline void glPathDashArrayNV(GLuint path, GLsizei dashCount, const GLfloat* dashArray) { fp_glPathDashArrayNV(path, dashCount, dashArray); } -inline void glPathStencilFuncNV(GLenum func, GLint ref, GLuint mask) { fp_glPathStencilFuncNV(func, ref, mask); } -inline void glPathStencilDepthOffsetNV(GLfloat factor, GLfloat units) { fp_glPathStencilDepthOffsetNV(factor, units); } -inline void glStencilFillPathNV(GLuint path, GLenum fillMode, GLuint mask) { fp_glStencilFillPathNV(path, fillMode, mask); } -inline void glStencilStrokePathNV(GLuint path, GLint reference, GLuint mask) { fp_glStencilStrokePathNV(path, reference, mask); } -inline void glStencilFillPathInstancedNV(GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat* transformValues) { fp_glStencilFillPathInstancedNV(numPaths, pathNameType, paths, pathBase, fillMode, mask, transformType, transformValues); } -inline void glStencilStrokePathInstancedNV(GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat* transformValues) { fp_glStencilStrokePathInstancedNV(numPaths, pathNameType, paths, pathBase, reference, mask, transformType, transformValues); } -inline void glPathCoverDepthFuncNV(GLenum func) { fp_glPathCoverDepthFuncNV(func); } -inline void glCoverFillPathNV(GLuint path, GLenum coverMode) { fp_glCoverFillPathNV(path, coverMode); } -inline void glCoverStrokePathNV(GLuint path, GLenum coverMode) { fp_glCoverStrokePathNV(path, coverMode); } -inline void glCoverFillPathInstancedNV(GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat* transformValues) { fp_glCoverFillPathInstancedNV(numPaths, pathNameType, paths, pathBase, coverMode, transformType, transformValues); } -inline void glCoverStrokePathInstancedNV(GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat* transformValues) { fp_glCoverStrokePathInstancedNV(numPaths, pathNameType, paths, pathBase, coverMode, transformType, transformValues); } -inline void glGetPathParameterivNV(GLuint path, GLenum pname, GLint* value) { fp_glGetPathParameterivNV(path, pname, value); } -inline void glGetPathParameterfvNV(GLuint path, GLenum pname, GLfloat* value) { fp_glGetPathParameterfvNV(path, pname, value); } -inline void glGetPathCommandsNV(GLuint path, GLubyte* commands) { fp_glGetPathCommandsNV(path, commands); } -inline void glGetPathCoordsNV(GLuint path, GLfloat* coords) { fp_glGetPathCoordsNV(path, coords); } -inline void glGetPathDashArrayNV(GLuint path, GLfloat* dashArray) { fp_glGetPathDashArrayNV(path, dashArray); } -inline void glGetPathMetricsNV(GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLsizei stride, GLfloat* metrics) { fp_glGetPathMetricsNV(metricQueryMask, numPaths, pathNameType, paths, pathBase, stride, metrics); } -inline void glGetPathMetricRangeNV(GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat* metrics) { fp_glGetPathMetricRangeNV(metricQueryMask, firstPathName, numPaths, stride, metrics); } -inline void glGetPathSpacingNV(GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat* returnedSpacing) { fp_glGetPathSpacingNV(pathListMode, numPaths, pathNameType, paths, pathBase, advanceScale, kerningScale, transformType, returnedSpacing); } -inline GLboolean glIsPointInFillPathNV(GLuint path, GLuint mask, GLfloat x, GLfloat y) { return fp_glIsPointInFillPathNV(path, mask, x, y); } -inline GLboolean glIsPointInStrokePathNV(GLuint path, GLfloat x, GLfloat y) { return fp_glIsPointInStrokePathNV(path, x, y); } -inline GLfloat glGetPathLengthNV(GLuint path, GLsizei startSegment, GLsizei numSegments) { return fp_glGetPathLengthNV(path, startSegment, numSegments); } -inline GLboolean glPointAlongPathNV(GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat* x, GLfloat* y, GLfloat* tangentX, GLfloat* tangentY) { return fp_glPointAlongPathNV(path, startSegment, numSegments, distance, x, y, tangentX, tangentY); } -inline void glMatrixLoad3x2fNV(GLenum matrixMode, const GLfloat* m) { fp_glMatrixLoad3x2fNV(matrixMode, m); } -inline void glMatrixLoad3x3fNV(GLenum matrixMode, const GLfloat* m) { fp_glMatrixLoad3x3fNV(matrixMode, m); } -inline void glMatrixLoadTranspose3x3fNV(GLenum matrixMode, const GLfloat* m) { fp_glMatrixLoadTranspose3x3fNV(matrixMode, m); } -inline void glMatrixMult3x2fNV(GLenum matrixMode, const GLfloat* m) { fp_glMatrixMult3x2fNV(matrixMode, m); } -inline void glMatrixMult3x3fNV(GLenum matrixMode, const GLfloat* m) { fp_glMatrixMult3x3fNV(matrixMode, m); } -inline void glMatrixMultTranspose3x3fNV(GLenum matrixMode, const GLfloat* m) { fp_glMatrixMultTranspose3x3fNV(matrixMode, m); } -inline void glStencilThenCoverFillPathNV(GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode) { fp_glStencilThenCoverFillPathNV(path, fillMode, mask, coverMode); } -inline void glStencilThenCoverStrokePathNV(GLuint path, GLint reference, GLuint mask, GLenum coverMode) { fp_glStencilThenCoverStrokePathNV(path, reference, mask, coverMode); } -inline void glStencilThenCoverFillPathInstancedNV(GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat* transformValues) { fp_glStencilThenCoverFillPathInstancedNV(numPaths, pathNameType, paths, pathBase, fillMode, mask, coverMode, transformType, transformValues); } -inline void glStencilThenCoverStrokePathInstancedNV(GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat* transformValues) { fp_glStencilThenCoverStrokePathInstancedNV(numPaths, pathNameType, paths, pathBase, reference, mask, coverMode, transformType, transformValues); } -inline GLenum glPathGlyphIndexRangeNV(GLenum fontTarget, const void* fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount) { return fp_glPathGlyphIndexRangeNV(fontTarget, fontName, fontStyle, pathParameterTemplate, emScale, baseAndCount); } -inline GLenum glPathGlyphIndexArrayNV(GLuint firstPathName, GLenum fontTarget, const void* fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale) { return fp_glPathGlyphIndexArrayNV(firstPathName, fontTarget, fontName, fontStyle, firstGlyphIndex, numGlyphs, pathParameterTemplate, emScale); } -inline GLenum glPathMemoryGlyphIndexArrayNV(GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void* fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale) { return fp_glPathMemoryGlyphIndexArrayNV(firstPathName, fontTarget, fontSize, fontData, faceIndex, firstGlyphIndex, numGlyphs, pathParameterTemplate, emScale); } -inline void glProgramPathFragmentInputGenNV(GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat* coeffs) { fp_glProgramPathFragmentInputGenNV(program, location, genMode, components, coeffs); } -inline void glGetProgramResourcefvNV(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum* props, GLsizei bufSize, GLsizei* length, GLfloat* params) { fp_glGetProgramResourcefvNV(program, programInterface, index, propCount, props, bufSize, length, params); } -inline void glPathColorGenNV(GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat* coeffs) { fp_glPathColorGenNV(color, genMode, colorFormat, coeffs); } -inline void glPathTexGenNV(GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat* coeffs) { fp_glPathTexGenNV(texCoordSet, genMode, components, coeffs); } -inline void glPathFogGenNV(GLenum genMode) { fp_glPathFogGenNV(genMode); } -inline void glGetPathColorGenivNV(GLenum color, GLenum pname, GLint* value) { fp_glGetPathColorGenivNV(color, pname, value); } -inline void glGetPathColorGenfvNV(GLenum color, GLenum pname, GLfloat* value) { fp_glGetPathColorGenfvNV(color, pname, value); } -inline void glGetPathTexGenivNV(GLenum texCoordSet, GLenum pname, GLint* value) { fp_glGetPathTexGenivNV(texCoordSet, pname, value); } -inline void glGetPathTexGenfvNV(GLenum texCoordSet, GLenum pname, GLfloat* value) { fp_glGetPathTexGenfvNV(texCoordSet, pname, value); } - -/* GL_NV_polygon_mode */ -inline void glPolygonModeNV(GLenum face, GLenum mode) { fp_glPolygonModeNV(face, mode); } - -/* GL_NV_present_video */ -inline void glPresentFrameKeyedNV(GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1) { fp_glPresentFrameKeyedNV(video_slot, minPresentTime, beginPresentTimeId, presentDurationId, type, target0, fill0, key0, target1, fill1, key1); } -inline void glPresentFrameDualFillNV(GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3) { fp_glPresentFrameDualFillNV(video_slot, minPresentTime, beginPresentTimeId, presentDurationId, type, target0, fill0, target1, fill1, target2, fill2, target3, fill3); } -inline void glGetVideoivNV(GLuint video_slot, GLenum pname, GLint* params) { fp_glGetVideoivNV(video_slot, pname, params); } -inline void glGetVideouivNV(GLuint video_slot, GLenum pname, GLuint* params) { fp_glGetVideouivNV(video_slot, pname, params); } -inline void glGetVideoi64vNV(GLuint video_slot, GLenum pname, GLint64EXT* params) { fp_glGetVideoi64vNV(video_slot, pname, params); } -inline void glGetVideoui64vNV(GLuint video_slot, GLenum pname, GLuint64EXT* params) { fp_glGetVideoui64vNV(video_slot, pname, params); } - -/* GL_NV_primitive_restart */ -inline void glPrimitiveRestartNV() { fp_glPrimitiveRestartNV(); } -inline void glPrimitiveRestartIndexNV(GLuint index) { fp_glPrimitiveRestartIndexNV(index); } - -/* GL_NV_read_buffer */ -inline void glReadBufferNV(GLenum mode) { fp_glReadBufferNV(mode); } - -/* GL_NV_sample_locations */ -inline void glFramebufferSampleLocationsfvNV(GLenum target, GLuint start, GLsizei count, const GLfloat* v) { fp_glFramebufferSampleLocationsfvNV(target, start, count, v); } -inline void glNamedFramebufferSampleLocationsfvNV(GLuint framebuffer, GLuint start, GLsizei count, const GLfloat* v) { fp_glNamedFramebufferSampleLocationsfvNV(framebuffer, start, count, v); } -inline void glResolveDepthValuesNV() { fp_glResolveDepthValuesNV(); } - -/* GL_NV_shader_buffer_load */ -inline void glMakeBufferResidentNV(GLenum target, GLenum access) { fp_glMakeBufferResidentNV(target, access); } -inline void glMakeBufferNonResidentNV(GLenum target) { fp_glMakeBufferNonResidentNV(target); } -inline GLboolean glIsBufferResidentNV(GLenum target) { return fp_glIsBufferResidentNV(target); } -inline void glMakeNamedBufferResidentNV(GLuint buffer, GLenum access) { fp_glMakeNamedBufferResidentNV(buffer, access); } -inline void glMakeNamedBufferNonResidentNV(GLuint buffer) { fp_glMakeNamedBufferNonResidentNV(buffer); } -inline GLboolean glIsNamedBufferResidentNV(GLuint buffer) { return fp_glIsNamedBufferResidentNV(buffer); } -inline void glGetBufferParameterui64vNV(GLenum target, GLenum pname, GLuint64EXT* params) { fp_glGetBufferParameterui64vNV(target, pname, params); } -inline void glGetNamedBufferParameterui64vNV(GLuint buffer, GLenum pname, GLuint64EXT* params) { fp_glGetNamedBufferParameterui64vNV(buffer, pname, params); } -inline void glGetIntegerui64vNV(GLenum value, GLuint64EXT* result) { fp_glGetIntegerui64vNV(value, result); } -inline void glUniformui64NV(GLint location, GLuint64EXT value) { fp_glUniformui64NV(location, value); } -inline void glUniformui64vNV(GLint location, GLsizei count, const GLuint64EXT* value) { fp_glUniformui64vNV(location, count, value); } -inline void glProgramUniformui64NV(GLuint program, GLint location, GLuint64EXT value) { fp_glProgramUniformui64NV(program, location, value); } -inline void glProgramUniformui64vNV(GLuint program, GLint location, GLsizei count, const GLuint64EXT* value) { fp_glProgramUniformui64vNV(program, location, count, value); } - -/* GL_NV_texture_barrier */ -inline void glTextureBarrierNV() { fp_glTextureBarrierNV(); } - -/* GL_NV_texture_multisample */ -inline void glTexImage2DMultisampleCoverageNV(GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations) { fp_glTexImage2DMultisampleCoverageNV(target, coverageSamples, colorSamples, internalFormat, width, height, fixedSampleLocations); } -inline void glTexImage3DMultisampleCoverageNV(GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations) { fp_glTexImage3DMultisampleCoverageNV(target, coverageSamples, colorSamples, internalFormat, width, height, depth, fixedSampleLocations); } -inline void glTextureImage2DMultisampleNV(GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations) { fp_glTextureImage2DMultisampleNV(texture, target, samples, internalFormat, width, height, fixedSampleLocations); } -inline void glTextureImage3DMultisampleNV(GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations) { fp_glTextureImage3DMultisampleNV(texture, target, samples, internalFormat, width, height, depth, fixedSampleLocations); } -inline void glTextureImage2DMultisampleCoverageNV(GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations) { fp_glTextureImage2DMultisampleCoverageNV(texture, target, coverageSamples, colorSamples, internalFormat, width, height, fixedSampleLocations); } -inline void glTextureImage3DMultisampleCoverageNV(GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations) { fp_glTextureImage3DMultisampleCoverageNV(texture, target, coverageSamples, colorSamples, internalFormat, width, height, depth, fixedSampleLocations); } - -/* GL_NV_transform_feedback */ -inline void glBeginTransformFeedbackNV(GLenum primitiveMode) { fp_glBeginTransformFeedbackNV(primitiveMode); } -inline void glEndTransformFeedbackNV() { fp_glEndTransformFeedbackNV(); } -inline void glTransformFeedbackAttribsNV(GLsizei count, const GLint* attribs, GLenum bufferMode) { fp_glTransformFeedbackAttribsNV(count, attribs, bufferMode); } -inline void glBindBufferRangeNV(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) { fp_glBindBufferRangeNV(target, index, buffer, offset, size); } -inline void glBindBufferOffsetNV(GLenum target, GLuint index, GLuint buffer, GLintptr offset) { fp_glBindBufferOffsetNV(target, index, buffer, offset); } -inline void glBindBufferBaseNV(GLenum target, GLuint index, GLuint buffer) { fp_glBindBufferBaseNV(target, index, buffer); } -inline void glTransformFeedbackVaryingsNV(GLuint program, GLsizei count, const GLint* locations, GLenum bufferMode) { fp_glTransformFeedbackVaryingsNV(program, count, locations, bufferMode); } -inline void glActiveVaryingNV(GLuint program, const GLchar* name) { fp_glActiveVaryingNV(program, name); } -inline GLint glGetVaryingLocationNV(GLuint program, const GLchar* name) { return fp_glGetVaryingLocationNV(program, name); } -inline void glGetActiveVaryingNV(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name) { fp_glGetActiveVaryingNV(program, index, bufSize, length, size, type, name); } -inline void glGetTransformFeedbackVaryingNV(GLuint program, GLuint index, GLint* location) { fp_glGetTransformFeedbackVaryingNV(program, index, location); } -inline void glTransformFeedbackStreamAttribsNV(GLsizei count, const GLint* attribs, GLsizei nbuffers, const GLint* bufstreams, GLenum bufferMode) { fp_glTransformFeedbackStreamAttribsNV(count, attribs, nbuffers, bufstreams, bufferMode); } - -/* GL_NV_transform_feedback2 */ -inline void glBindTransformFeedbackNV(GLenum target, GLuint id) { fp_glBindTransformFeedbackNV(target, id); } -inline void glDeleteTransformFeedbacksNV(GLsizei n, const GLuint* ids) { fp_glDeleteTransformFeedbacksNV(n, ids); } -inline void glGenTransformFeedbacksNV(GLsizei n, GLuint* ids) { fp_glGenTransformFeedbacksNV(n, ids); } -inline GLboolean glIsTransformFeedbackNV(GLuint id) { return fp_glIsTransformFeedbackNV(id); } -inline void glPauseTransformFeedbackNV() { fp_glPauseTransformFeedbackNV(); } -inline void glResumeTransformFeedbackNV() { fp_glResumeTransformFeedbackNV(); } -inline void glDrawTransformFeedbackNV(GLenum mode, GLuint id) { fp_glDrawTransformFeedbackNV(mode, id); } - -/* GL_NV_vdpau_interop */ -inline void glVDPAUInitNV(const void* vdpDevice, const void* getProcAddress) { fp_glVDPAUInitNV(vdpDevice, getProcAddress); } -inline void glVDPAUFiniNV() { fp_glVDPAUFiniNV(); } -inline GLvdpauSurfaceNV glVDPAURegisterVideoSurfaceNV(const void* vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint* textureNames) { return fp_glVDPAURegisterVideoSurfaceNV(vdpSurface, target, numTextureNames, textureNames); } -inline GLvdpauSurfaceNV glVDPAURegisterOutputSurfaceNV(const void* vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint* textureNames) { return fp_glVDPAURegisterOutputSurfaceNV(vdpSurface, target, numTextureNames, textureNames); } -inline GLboolean glVDPAUIsSurfaceNV(GLvdpauSurfaceNV surface) { return fp_glVDPAUIsSurfaceNV(surface); } -inline void glVDPAUUnregisterSurfaceNV(GLvdpauSurfaceNV surface) { fp_glVDPAUUnregisterSurfaceNV(surface); } -inline void glVDPAUGetSurfaceivNV(GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values) { fp_glVDPAUGetSurfaceivNV(surface, pname, bufSize, length, values); } -inline void glVDPAUSurfaceAccessNV(GLvdpauSurfaceNV surface, GLenum access) { fp_glVDPAUSurfaceAccessNV(surface, access); } -inline void glVDPAUMapSurfacesNV(GLsizei numSurfaces, const GLvdpauSurfaceNV* surfaces) { fp_glVDPAUMapSurfacesNV(numSurfaces, surfaces); } -inline void glVDPAUUnmapSurfacesNV(GLsizei numSurface, const GLvdpauSurfaceNV* surfaces) { fp_glVDPAUUnmapSurfacesNV(numSurface, surfaces); } - -/* GL_NV_vertex_attrib_integer_64bit */ -inline void glVertexAttribL1i64NV(GLuint index, GLint64EXT x) { fp_glVertexAttribL1i64NV(index, x); } -inline void glVertexAttribL2i64NV(GLuint index, GLint64EXT x, GLint64EXT y) { fp_glVertexAttribL2i64NV(index, x, y); } -inline void glVertexAttribL3i64NV(GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z) { fp_glVertexAttribL3i64NV(index, x, y, z); } -inline void glVertexAttribL4i64NV(GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w) { fp_glVertexAttribL4i64NV(index, x, y, z, w); } -inline void glVertexAttribL1i64vNV(GLuint index, const GLint64EXT* v) { fp_glVertexAttribL1i64vNV(index, v); } -inline void glVertexAttribL2i64vNV(GLuint index, const GLint64EXT* v) { fp_glVertexAttribL2i64vNV(index, v); } -inline void glVertexAttribL3i64vNV(GLuint index, const GLint64EXT* v) { fp_glVertexAttribL3i64vNV(index, v); } -inline void glVertexAttribL4i64vNV(GLuint index, const GLint64EXT* v) { fp_glVertexAttribL4i64vNV(index, v); } -inline void glVertexAttribL1ui64NV(GLuint index, GLuint64EXT x) { fp_glVertexAttribL1ui64NV(index, x); } -inline void glVertexAttribL2ui64NV(GLuint index, GLuint64EXT x, GLuint64EXT y) { fp_glVertexAttribL2ui64NV(index, x, y); } -inline void glVertexAttribL3ui64NV(GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z) { fp_glVertexAttribL3ui64NV(index, x, y, z); } -inline void glVertexAttribL4ui64NV(GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w) { fp_glVertexAttribL4ui64NV(index, x, y, z, w); } -inline void glVertexAttribL1ui64vNV(GLuint index, const GLuint64EXT* v) { fp_glVertexAttribL1ui64vNV(index, v); } -inline void glVertexAttribL2ui64vNV(GLuint index, const GLuint64EXT* v) { fp_glVertexAttribL2ui64vNV(index, v); } -inline void glVertexAttribL3ui64vNV(GLuint index, const GLuint64EXT* v) { fp_glVertexAttribL3ui64vNV(index, v); } -inline void glVertexAttribL4ui64vNV(GLuint index, const GLuint64EXT* v) { fp_glVertexAttribL4ui64vNV(index, v); } -inline void glGetVertexAttribLi64vNV(GLuint index, GLenum pname, GLint64EXT* params) { fp_glGetVertexAttribLi64vNV(index, pname, params); } -inline void glGetVertexAttribLui64vNV(GLuint index, GLenum pname, GLuint64EXT* params) { fp_glGetVertexAttribLui64vNV(index, pname, params); } -inline void glVertexAttribLFormatNV(GLuint index, GLint size, GLenum type, GLsizei stride) { fp_glVertexAttribLFormatNV(index, size, type, stride); } - -/* GL_NV_vertex_buffer_unified_memory */ -inline void glBufferAddressRangeNV(GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length) { fp_glBufferAddressRangeNV(pname, index, address, length); } -inline void glVertexFormatNV(GLint size, GLenum type, GLsizei stride) { fp_glVertexFormatNV(size, type, stride); } -inline void glNormalFormatNV(GLenum type, GLsizei stride) { fp_glNormalFormatNV(type, stride); } -inline void glColorFormatNV(GLint size, GLenum type, GLsizei stride) { fp_glColorFormatNV(size, type, stride); } -inline void glIndexFormatNV(GLenum type, GLsizei stride) { fp_glIndexFormatNV(type, stride); } -inline void glTexCoordFormatNV(GLint size, GLenum type, GLsizei stride) { fp_glTexCoordFormatNV(size, type, stride); } -inline void glEdgeFlagFormatNV(GLsizei stride) { fp_glEdgeFlagFormatNV(stride); } -inline void glSecondaryColorFormatNV(GLint size, GLenum type, GLsizei stride) { fp_glSecondaryColorFormatNV(size, type, stride); } -inline void glFogCoordFormatNV(GLenum type, GLsizei stride) { fp_glFogCoordFormatNV(type, stride); } -inline void glVertexAttribFormatNV(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride) { fp_glVertexAttribFormatNV(index, size, type, normalized, stride); } -inline void glVertexAttribIFormatNV(GLuint index, GLint size, GLenum type, GLsizei stride) { fp_glVertexAttribIFormatNV(index, size, type, stride); } -inline void glGetIntegerui64i_vNV(GLenum value, GLuint index, GLuint64EXT* result) { fp_glGetIntegerui64i_vNV(value, index, result); } - -/* GL_NV_vertex_program4 */ -inline void glVertexAttribI1iEXT(GLuint index, GLint x) { fp_glVertexAttribI1iEXT(index, x); } -inline void glVertexAttribI2iEXT(GLuint index, GLint x, GLint y) { fp_glVertexAttribI2iEXT(index, x, y); } -inline void glVertexAttribI3iEXT(GLuint index, GLint x, GLint y, GLint z) { fp_glVertexAttribI3iEXT(index, x, y, z); } -inline void glVertexAttribI4iEXT(GLuint index, GLint x, GLint y, GLint z, GLint w) { fp_glVertexAttribI4iEXT(index, x, y, z, w); } -inline void glVertexAttribI1uiEXT(GLuint index, GLuint x) { fp_glVertexAttribI1uiEXT(index, x); } -inline void glVertexAttribI2uiEXT(GLuint index, GLuint x, GLuint y) { fp_glVertexAttribI2uiEXT(index, x, y); } -inline void glVertexAttribI3uiEXT(GLuint index, GLuint x, GLuint y, GLuint z) { fp_glVertexAttribI3uiEXT(index, x, y, z); } -inline void glVertexAttribI4uiEXT(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) { fp_glVertexAttribI4uiEXT(index, x, y, z, w); } -inline void glVertexAttribI1ivEXT(GLuint index, const GLint* v) { fp_glVertexAttribI1ivEXT(index, v); } -inline void glVertexAttribI2ivEXT(GLuint index, const GLint* v) { fp_glVertexAttribI2ivEXT(index, v); } -inline void glVertexAttribI3ivEXT(GLuint index, const GLint* v) { fp_glVertexAttribI3ivEXT(index, v); } -inline void glVertexAttribI4ivEXT(GLuint index, const GLint* v) { fp_glVertexAttribI4ivEXT(index, v); } -inline void glVertexAttribI1uivEXT(GLuint index, const GLuint* v) { fp_glVertexAttribI1uivEXT(index, v); } -inline void glVertexAttribI2uivEXT(GLuint index, const GLuint* v) { fp_glVertexAttribI2uivEXT(index, v); } -inline void glVertexAttribI3uivEXT(GLuint index, const GLuint* v) { fp_glVertexAttribI3uivEXT(index, v); } -inline void glVertexAttribI4uivEXT(GLuint index, const GLuint* v) { fp_glVertexAttribI4uivEXT(index, v); } -inline void glVertexAttribI4bvEXT(GLuint index, const GLbyte* v) { fp_glVertexAttribI4bvEXT(index, v); } -inline void glVertexAttribI4svEXT(GLuint index, const GLshort* v) { fp_glVertexAttribI4svEXT(index, v); } -inline void glVertexAttribI4ubvEXT(GLuint index, const GLubyte* v) { fp_glVertexAttribI4ubvEXT(index, v); } -inline void glVertexAttribI4usvEXT(GLuint index, const GLushort* v) { fp_glVertexAttribI4usvEXT(index, v); } -inline void glVertexAttribIPointerEXT(GLuint index, GLint size, GLenum type, GLsizei stride, const void* pointer) { fp_glVertexAttribIPointerEXT(index, size, type, stride, pointer); } -inline void glGetVertexAttribIivEXT(GLuint index, GLenum pname, GLint* params) { fp_glGetVertexAttribIivEXT(index, pname, params); } -inline void glGetVertexAttribIuivEXT(GLuint index, GLenum pname, GLuint* params) { fp_glGetVertexAttribIuivEXT(index, pname, params); } - -/* GL_NV_video_capture */ -inline void glBeginVideoCaptureNV(GLuint video_capture_slot) { fp_glBeginVideoCaptureNV(video_capture_slot); } -inline void glBindVideoCaptureStreamBufferNV(GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset) { fp_glBindVideoCaptureStreamBufferNV(video_capture_slot, stream, frame_region, offset); } -inline void glBindVideoCaptureStreamTextureNV(GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture) { fp_glBindVideoCaptureStreamTextureNV(video_capture_slot, stream, frame_region, target, texture); } -inline void glEndVideoCaptureNV(GLuint video_capture_slot) { fp_glEndVideoCaptureNV(video_capture_slot); } -inline void glGetVideoCaptureivNV(GLuint video_capture_slot, GLenum pname, GLint* params) { fp_glGetVideoCaptureivNV(video_capture_slot, pname, params); } -inline void glGetVideoCaptureStreamivNV(GLuint video_capture_slot, GLuint stream, GLenum pname, GLint* params) { fp_glGetVideoCaptureStreamivNV(video_capture_slot, stream, pname, params); } -inline void glGetVideoCaptureStreamfvNV(GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat* params) { fp_glGetVideoCaptureStreamfvNV(video_capture_slot, stream, pname, params); } -inline void glGetVideoCaptureStreamdvNV(GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble* params) { fp_glGetVideoCaptureStreamdvNV(video_capture_slot, stream, pname, params); } -inline GLenum glVideoCaptureNV(GLuint video_capture_slot, GLuint* sequence_num, GLuint64EXT* capture_time) { return fp_glVideoCaptureNV(video_capture_slot, sequence_num, capture_time); } -inline void glVideoCaptureStreamParameterivNV(GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint* params) { fp_glVideoCaptureStreamParameterivNV(video_capture_slot, stream, pname, params); } -inline void glVideoCaptureStreamParameterfvNV(GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat* params) { fp_glVideoCaptureStreamParameterfvNV(video_capture_slot, stream, pname, params); } -inline void glVideoCaptureStreamParameterdvNV(GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble* params) { fp_glVideoCaptureStreamParameterdvNV(video_capture_slot, stream, pname, params); } - -/* GL_NV_viewport_array */ -inline void glViewportArrayvNV(GLuint first, GLsizei count, const GLfloat* v) { fp_glViewportArrayvNV(first, count, v); } -inline void glViewportIndexedfNV(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h) { fp_glViewportIndexedfNV(index, x, y, w, h); } -inline void glViewportIndexedfvNV(GLuint index, const GLfloat* v) { fp_glViewportIndexedfvNV(index, v); } -inline void glScissorArrayvNV(GLuint first, GLsizei count, const GLint* v) { fp_glScissorArrayvNV(first, count, v); } -inline void glScissorIndexedNV(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height) { fp_glScissorIndexedNV(index, left, bottom, width, height); } -inline void glScissorIndexedvNV(GLuint index, const GLint* v) { fp_glScissorIndexedvNV(index, v); } -inline void glDepthRangeArrayfvNV(GLuint first, GLsizei count, const GLfloat* v) { fp_glDepthRangeArrayfvNV(first, count, v); } -inline void glDepthRangeIndexedfNV(GLuint index, GLfloat n, GLfloat f) { fp_glDepthRangeIndexedfNV(index, n, f); } -inline void glGetFloati_vNV(GLenum target, GLuint index, GLfloat* data) { fp_glGetFloati_vNV(target, index, data); } -inline void glEnableiNV(GLenum target, GLuint index) { fp_glEnableiNV(target, index); } -inline void glDisableiNV(GLenum target, GLuint index) { fp_glDisableiNV(target, index); } -inline GLboolean glIsEnablediNV(GLenum target, GLuint index) { return fp_glIsEnablediNV(target, index); } - -/* GL_NVX_conditional_render */ -inline void glBeginConditionalRenderNVX(GLuint id) { fp_glBeginConditionalRenderNVX(id); } -inline void glEndConditionalRenderNVX() { fp_glEndConditionalRenderNVX(); } - -/* GL_OVR_multiview */ -inline void glFramebufferTextureMultiviewOVR(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews) { fp_glFramebufferTextureMultiviewOVR(target, attachment, texture, level, baseViewIndex, numViews); } - -/* GL_OVR_multiview_multisampled_render_to_texture */ -inline void glFramebufferTextureMultisampleMultiviewOVR(GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei samples, GLint baseViewIndex, GLsizei numViews) { fp_glFramebufferTextureMultisampleMultiviewOVR(target, attachment, texture, level, samples, baseViewIndex, numViews); } - -/* GL_QCOM_alpha_test */ -inline void glAlphaFuncQCOM(GLenum func, GLclampf ref) { fp_glAlphaFuncQCOM(func, ref); } - -/* GL_QCOM_driver_control */ -inline void glGetDriverControlsQCOM(GLint* num, GLsizei size, GLuint* driverControls) { fp_glGetDriverControlsQCOM(num, size, driverControls); } -inline void glGetDriverControlStringQCOM(GLuint driverControl, GLsizei bufSize, GLsizei* length, GLchar* driverControlString) { fp_glGetDriverControlStringQCOM(driverControl, bufSize, length, driverControlString); } -inline void glEnableDriverControlQCOM(GLuint driverControl) { fp_glEnableDriverControlQCOM(driverControl); } -inline void glDisableDriverControlQCOM(GLuint driverControl) { fp_glDisableDriverControlQCOM(driverControl); } - -/* GL_QCOM_extended_get */ -inline void glExtGetTexturesQCOM(GLuint* textures, GLint maxTextures, GLint* numTextures) { fp_glExtGetTexturesQCOM(textures, maxTextures, numTextures); } -inline void glExtGetBuffersQCOM(GLuint* buffers, GLint maxBuffers, GLint* numBuffers) { fp_glExtGetBuffersQCOM(buffers, maxBuffers, numBuffers); } -inline void glExtGetRenderbuffersQCOM(GLuint* renderbuffers, GLint maxRenderbuffers, GLint* numRenderbuffers) { fp_glExtGetRenderbuffersQCOM(renderbuffers, maxRenderbuffers, numRenderbuffers); } -inline void glExtGetFramebuffersQCOM(GLuint* framebuffers, GLint maxFramebuffers, GLint* numFramebuffers) { fp_glExtGetFramebuffersQCOM(framebuffers, maxFramebuffers, numFramebuffers); } -inline void glExtGetTexLevelParameterivQCOM(GLuint texture, GLenum face, GLint level, GLenum pname, GLint* params) { fp_glExtGetTexLevelParameterivQCOM(texture, face, level, pname, params); } -inline void glExtTexObjectStateOverrideiQCOM(GLenum target, GLenum pname, GLint param) { fp_glExtTexObjectStateOverrideiQCOM(target, pname, param); } -inline void glExtGetTexSubImageQCOM(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void* texels) { fp_glExtGetTexSubImageQCOM(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, texels); } -inline void glExtGetBufferPointervQCOM(GLenum target, void** params) { fp_glExtGetBufferPointervQCOM(target, params); } - -/* GL_QCOM_extended_get2 */ -inline void glExtGetShadersQCOM(GLuint* shaders, GLint maxShaders, GLint* numShaders) { fp_glExtGetShadersQCOM(shaders, maxShaders, numShaders); } -inline void glExtGetProgramsQCOM(GLuint* programs, GLint maxPrograms, GLint* numPrograms) { fp_glExtGetProgramsQCOM(programs, maxPrograms, numPrograms); } -inline GLboolean glExtIsProgramBinaryQCOM(GLuint program) { return fp_glExtIsProgramBinaryQCOM(program); } -inline void glExtGetProgramBinarySourceQCOM(GLuint program, GLenum shadertype, GLchar* source, GLint* length) { fp_glExtGetProgramBinarySourceQCOM(program, shadertype, source, length); } - -/* GL_QCOM_tiled_rendering */ -inline void glStartTilingQCOM(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask) { fp_glStartTilingQCOM(x, y, width, height, preserveMask); } -inline void glEndTilingQCOM(GLbitfield preserveMask) { fp_glEndTilingQCOM(preserveMask); } - -} /* namespace glad */ - -#endif /* __glad_funcs_hpp_ */ diff --git a/love/src/jni/love/src/libraries/glslang/OGLCompilersDLL/InitializeDll.cpp b/love/src/jni/love/src/libraries/glslang/OGLCompilersDLL/InitializeDll.cpp deleted file mode 100644 index abea9108..00000000 --- a/love/src/jni/love/src/libraries/glslang/OGLCompilersDLL/InitializeDll.cpp +++ /dev/null @@ -1,165 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#define SH_EXPORTING - -#include - -#include "InitializeDll.h" -#include "../glslang/Include/InitializeGlobals.h" -#include "../glslang/Public/ShaderLang.h" -#include "../glslang/Include/PoolAlloc.h" - -namespace glslang { - -OS_TLSIndex ThreadInitializeIndex = OS_INVALID_TLS_INDEX; - -// Per-process initialization. -// Needs to be called at least once before parsing, etc. is done. -// Will also do thread initialization for the calling thread; other -// threads will need to do that explicitly. -bool InitProcess() -{ - glslang::GetGlobalLock(); - - if (ThreadInitializeIndex != OS_INVALID_TLS_INDEX) { - // - // Function is re-entrant. - // - - glslang::ReleaseGlobalLock(); - return true; - } - - ThreadInitializeIndex = OS_AllocTLSIndex(); - - if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX) { - assert(0 && "InitProcess(): Failed to allocate TLS area for init flag"); - - glslang::ReleaseGlobalLock(); - return false; - } - - if (! InitializePoolIndex()) { - assert(0 && "InitProcess(): Failed to initialize global pool"); - - glslang::ReleaseGlobalLock(); - return false; - } - - if (! InitThread()) { - assert(0 && "InitProcess(): Failed to initialize thread"); - - glslang::ReleaseGlobalLock(); - return false; - } - - glslang::ReleaseGlobalLock(); - return true; -} - -// Per-thread scoped initialization. -// Must be called at least once by each new thread sharing the -// symbol tables, etc., needed to parse. -bool InitThread() -{ - // - // This function is re-entrant - // - if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX) { - assert(0 && "InitThread(): Process hasn't been initalised."); - return false; - } - - if (OS_GetTLSValue(ThreadInitializeIndex) != 0) - return true; - - if (! OS_SetTLSValue(ThreadInitializeIndex, (void *)1)) { - assert(0 && "InitThread(): Unable to set init flag."); - return false; - } - - glslang::SetThreadPoolAllocator(nullptr); - - return true; -} - -// Not necessary to call this: InitThread() is reentrant, and the need -// to do per thread tear down has been removed. -// -// This is kept, with memory management removed, to satisfy any exiting -// calls to it that rely on it. -bool DetachThread() -{ - bool success = true; - - if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX) - return true; - - // - // Function is re-entrant and this thread may not have been initialized. - // - if (OS_GetTLSValue(ThreadInitializeIndex) != 0) { - if (!OS_SetTLSValue(ThreadInitializeIndex, (void *)0)) { - assert(0 && "DetachThread(): Unable to clear init flag."); - success = false; - } - } - - return success; -} - -// Not necessary to call this: InitProcess() is reentrant. -// -// This is kept, with memory management removed, to satisfy any exiting -// calls to it that rely on it. -// -// Users of glslang should call shFinalize() or glslang::FinalizeProcess() for -// process-scoped memory tear down. -bool DetachProcess() -{ - bool success = true; - - if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX) - return true; - - success = DetachThread(); - - OS_FreeTLSIndex(ThreadInitializeIndex); - ThreadInitializeIndex = OS_INVALID_TLS_INDEX; - - return success; -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/OGLCompilersDLL/InitializeDll.h b/love/src/jni/love/src/libraries/glslang/OGLCompilersDLL/InitializeDll.h deleted file mode 100644 index 661cee4d..00000000 --- a/love/src/jni/love/src/libraries/glslang/OGLCompilersDLL/InitializeDll.h +++ /dev/null @@ -1,49 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// -#ifndef __INITIALIZEDLL_H -#define __INITIALIZEDLL_H - -#include "../glslang/OSDependent/osinclude.h" - -namespace glslang { - -bool InitProcess(); -bool InitThread(); -bool DetachThread(); // not called from standalone, perhaps other tools rely on parts of it -bool DetachProcess(); // not called from standalone, perhaps other tools rely on parts of it - -} // end namespace glslang - -#endif // __INITIALIZEDLL_H - diff --git a/love/src/jni/love/src/libraries/glslang/glslang/GenericCodeGen/CodeGen.cpp b/love/src/jni/love/src/libraries/glslang/glslang/GenericCodeGen/CodeGen.cpp deleted file mode 100644 index b3c7226d..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/GenericCodeGen/CodeGen.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#include "../Include/Common.h" -#include "../Include/ShHandle.h" -#include "../MachineIndependent/Versions.h" - -// -// Here is where real machine specific high-level data would be defined. -// -class TGenericCompiler : public TCompiler { -public: - TGenericCompiler(EShLanguage l, int dOptions) : TCompiler(l, infoSink), debugOptions(dOptions) { } - virtual bool compile(TIntermNode* root, int version = 0, EProfile profile = ENoProfile); - TInfoSink infoSink; - int debugOptions; -}; - -// -// This function must be provided to create the actual -// compile object used by higher level code. It returns -// a subclass of TCompiler. -// -TCompiler* ConstructCompiler(EShLanguage language, int debugOptions) -{ - return new TGenericCompiler(language, debugOptions); -} - -// -// Delete the compiler made by ConstructCompiler -// -void DeleteCompiler(TCompiler* compiler) -{ - delete compiler; -} - -// -// Generate code from the given parse tree -// -bool TGenericCompiler::compile(TIntermNode* /*root*/, int /*version*/, EProfile /*profile*/) -{ - haveValidObjectCode = true; - - return haveValidObjectCode; -} diff --git a/love/src/jni/love/src/libraries/glslang/glslang/GenericCodeGen/Link.cpp b/love/src/jni/love/src/libraries/glslang/glslang/GenericCodeGen/Link.cpp deleted file mode 100644 index c38db0f6..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/GenericCodeGen/Link.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -// -// The top level algorithms for linking multiple -// shaders together. -// -#include "../Include/Common.h" -#include "../Include/ShHandle.h" - -// -// Actual link object, derived from the shader handle base classes. -// -class TGenericLinker : public TLinker { -public: - TGenericLinker(EShExecutable e, int dOptions) : TLinker(e, infoSink), debugOptions(dOptions) { } - bool link(TCompilerList&, TUniformMap*) { return true; } - void getAttributeBindings(ShBindingTable const **) const { } - TInfoSink infoSink; - int debugOptions; -}; - -// -// The internal view of a uniform/float object exchanged with the driver. -// -class TUniformLinkedMap : public TUniformMap { -public: - TUniformLinkedMap() { } - virtual int getLocation(const char*) { return 0; } -}; - -TShHandleBase* ConstructLinker(EShExecutable executable, int debugOptions) -{ - return new TGenericLinker(executable, debugOptions); -} - -void DeleteLinker(TShHandleBase* linker) -{ - delete linker; -} - -TUniformMap* ConstructUniformMap() -{ - return new TUniformLinkedMap(); -} - -void DeleteUniformMap(TUniformMap* map) -{ - delete map; -} - -TShHandleBase* ConstructBindings() -{ - return 0; -} - -void DeleteBindingList(TShHandleBase* bindingList) -{ - delete bindingList; -} diff --git a/love/src/jni/love/src/libraries/glslang/glslang/Include/BaseTypes.h b/love/src/jni/love/src/libraries/glslang/glslang/Include/BaseTypes.h deleted file mode 100644 index 050c2c4b..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/Include/BaseTypes.h +++ /dev/null @@ -1,387 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2012-2013 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#ifndef _BASICTYPES_INCLUDED_ -#define _BASICTYPES_INCLUDED_ - -namespace glslang { - -// -// Basic type. Arrays, vectors, sampler details, etc., are orthogonal to this. -// -enum TBasicType { - EbtVoid, - EbtFloat, - EbtDouble, -#ifdef AMD_EXTENSIONS - EbtFloat16, -#endif - EbtInt, - EbtUint, - EbtInt64, - EbtUint64, -#ifdef AMD_EXTENSIONS - EbtInt16, - EbtUint16, -#endif - EbtBool, - EbtAtomicUint, - EbtSampler, - EbtStruct, - EbtBlock, - - // HLSL types that live only temporarily. - EbtString, - - EbtNumTypes -}; - -// -// Storage qualifiers. Should align with different kinds of storage or -// resource or GLSL storage qualifier. Expansion is deprecated. -// -// N.B.: You probably DON'T want to add anything here, but rather just add it -// to the built-in variables. See the comment above TBuiltInVariable. -// -// A new built-in variable will normally be an existing qualifier, like 'in', 'out', etc. -// DO NOT follow the design pattern of, say EvqInstanceId, etc. -// -enum TStorageQualifier { - EvqTemporary, // For temporaries (within a function), read/write - EvqGlobal, // For globals read/write - EvqConst, // User-defined constant values, will be semantically constant and constant folded - EvqVaryingIn, // pipeline input, read only, also supercategory for all built-ins not included in this enum (see TBuiltInVariable) - EvqVaryingOut, // pipeline output, read/write, also supercategory for all built-ins not included in this enum (see TBuiltInVariable) - EvqUniform, // read only, shared with app - EvqBuffer, // read/write, shared with app - EvqShared, // compute shader's read/write 'shared' qualifier - - // parameters - EvqIn, // also, for 'in' in the grammar before we know if it's a pipeline input or an 'in' parameter - EvqOut, // also, for 'out' in the grammar before we know if it's a pipeline output or an 'out' parameter - EvqInOut, - EvqConstReadOnly, // input; also other read-only types having neither a constant value nor constant-value semantics - - // built-ins read by vertex shader - EvqVertexId, - EvqInstanceId, - - // built-ins written by vertex shader - EvqPosition, - EvqPointSize, - EvqClipVertex, - - // built-ins read by fragment shader - EvqFace, - EvqFragCoord, - EvqPointCoord, - - // built-ins written by fragment shader - EvqFragColor, - EvqFragDepth, - - // end of list - EvqLast -}; - -// -// Subcategories of the TStorageQualifier, simply to give a direct mapping -// between built-in variable names and an numerical value (the enum). -// -// For backward compatibility, there is some redundancy between the -// TStorageQualifier and these. Existing members should both be maintained accurately. -// However, any new built-in variable (and any existing non-redundant one) -// must follow the pattern that the specific built-in is here, and only its -// general qualifier is in TStorageQualifier. -// -// Something like gl_Position, which is sometimes 'in' and sometimes 'out' -// shows up as two different built-in variables in a single stage, but -// only has a single enum in TBuiltInVariable, so both the -// TStorageQualifier and the TBuitinVariable are needed to distinguish -// between them. -// -enum TBuiltInVariable { - EbvNone, - EbvNumWorkGroups, - EbvWorkGroupSize, - EbvWorkGroupId, - EbvLocalInvocationId, - EbvGlobalInvocationId, - EbvLocalInvocationIndex, - EbvSubGroupSize, - EbvSubGroupInvocation, - EbvSubGroupEqMask, - EbvSubGroupGeMask, - EbvSubGroupGtMask, - EbvSubGroupLeMask, - EbvSubGroupLtMask, - EbvVertexId, - EbvInstanceId, - EbvVertexIndex, - EbvInstanceIndex, - EbvBaseVertex, - EbvBaseInstance, - EbvDrawId, - EbvPosition, - EbvPointSize, - EbvClipVertex, - EbvClipDistance, - EbvCullDistance, - EbvNormal, - EbvVertex, - EbvMultiTexCoord0, - EbvMultiTexCoord1, - EbvMultiTexCoord2, - EbvMultiTexCoord3, - EbvMultiTexCoord4, - EbvMultiTexCoord5, - EbvMultiTexCoord6, - EbvMultiTexCoord7, - EbvFrontColor, - EbvBackColor, - EbvFrontSecondaryColor, - EbvBackSecondaryColor, - EbvTexCoord, - EbvFogFragCoord, - EbvInvocationId, - EbvPrimitiveId, - EbvLayer, - EbvViewportIndex, - EbvPatchVertices, - EbvTessLevelOuter, - EbvTessLevelInner, - EbvBoundingBox, - EbvTessCoord, - EbvColor, - EbvSecondaryColor, - EbvFace, - EbvFragCoord, - EbvPointCoord, - EbvFragColor, - EbvFragData, - EbvFragDepth, - EbvFragStencilRef, - EbvSampleId, - EbvSamplePosition, - EbvSampleMask, - EbvHelperInvocation, - -#ifdef AMD_EXTENSIONS - EbvBaryCoordNoPersp, - EbvBaryCoordNoPerspCentroid, - EbvBaryCoordNoPerspSample, - EbvBaryCoordSmooth, - EbvBaryCoordSmoothCentroid, - EbvBaryCoordSmoothSample, - EbvBaryCoordPullModel, -#endif - - EbvViewIndex, - EbvDeviceIndex, - -#ifdef NV_EXTENSIONS - EbvViewportMaskNV, - EbvSecondaryPositionNV, - EbvSecondaryViewportMaskNV, - EbvPositionPerViewNV, - EbvViewportMaskPerViewNV, - EbvFragFullyCoveredNV, -#endif - - // HLSL built-ins that live only temporarily, until they get remapped - // to one of the above. - EbvFragDepthGreater, - EbvFragDepthLesser, - EbvGsOutputStream, - EbvOutputPatch, - EbvInputPatch, - - // structbuffer types - EbvAppendConsume, // no need to differentiate append and consume - EbvRWStructuredBuffer, - EbvStructuredBuffer, - EbvByteAddressBuffer, - EbvRWByteAddressBuffer, - - EbvLast -}; - -// These will show up in error messages -__inline const char* GetStorageQualifierString(TStorageQualifier q) -{ - switch (q) { - case EvqTemporary: return "temp"; break; - case EvqGlobal: return "global"; break; - case EvqConst: return "const"; break; - case EvqConstReadOnly: return "const (read only)"; break; - case EvqVaryingIn: return "in"; break; - case EvqVaryingOut: return "out"; break; - case EvqUniform: return "uniform"; break; - case EvqBuffer: return "buffer"; break; - case EvqShared: return "shared"; break; - case EvqIn: return "in"; break; - case EvqOut: return "out"; break; - case EvqInOut: return "inout"; break; - case EvqVertexId: return "gl_VertexId"; break; - case EvqInstanceId: return "gl_InstanceId"; break; - case EvqPosition: return "gl_Position"; break; - case EvqPointSize: return "gl_PointSize"; break; - case EvqClipVertex: return "gl_ClipVertex"; break; - case EvqFace: return "gl_FrontFacing"; break; - case EvqFragCoord: return "gl_FragCoord"; break; - case EvqPointCoord: return "gl_PointCoord"; break; - case EvqFragColor: return "fragColor"; break; - case EvqFragDepth: return "gl_FragDepth"; break; - default: return "unknown qualifier"; - } -} - -__inline const char* GetBuiltInVariableString(TBuiltInVariable v) -{ - switch (v) { - case EbvNone: return ""; - case EbvNumWorkGroups: return "NumWorkGroups"; - case EbvWorkGroupSize: return "WorkGroupSize"; - case EbvWorkGroupId: return "WorkGroupID"; - case EbvLocalInvocationId: return "LocalInvocationID"; - case EbvGlobalInvocationId: return "GlobalInvocationID"; - case EbvLocalInvocationIndex: return "LocalInvocationIndex"; - case EbvSubGroupSize: return "SubGroupSize"; - case EbvSubGroupInvocation: return "SubGroupInvocation"; - case EbvSubGroupEqMask: return "SubGroupEqMask"; - case EbvSubGroupGeMask: return "SubGroupGeMask"; - case EbvSubGroupGtMask: return "SubGroupGtMask"; - case EbvSubGroupLeMask: return "SubGroupLeMask"; - case EbvSubGroupLtMask: return "SubGroupLtMask"; - case EbvVertexId: return "VertexId"; - case EbvInstanceId: return "InstanceId"; - case EbvVertexIndex: return "VertexIndex"; - case EbvInstanceIndex: return "InstanceIndex"; - case EbvBaseVertex: return "BaseVertex"; - case EbvBaseInstance: return "BaseInstance"; - case EbvDrawId: return "DrawId"; - case EbvPosition: return "Position"; - case EbvPointSize: return "PointSize"; - case EbvClipVertex: return "ClipVertex"; - case EbvClipDistance: return "ClipDistance"; - case EbvCullDistance: return "CullDistance"; - case EbvNormal: return "Normal"; - case EbvVertex: return "Vertex"; - case EbvMultiTexCoord0: return "MultiTexCoord0"; - case EbvMultiTexCoord1: return "MultiTexCoord1"; - case EbvMultiTexCoord2: return "MultiTexCoord2"; - case EbvMultiTexCoord3: return "MultiTexCoord3"; - case EbvMultiTexCoord4: return "MultiTexCoord4"; - case EbvMultiTexCoord5: return "MultiTexCoord5"; - case EbvMultiTexCoord6: return "MultiTexCoord6"; - case EbvMultiTexCoord7: return "MultiTexCoord7"; - case EbvFrontColor: return "FrontColor"; - case EbvBackColor: return "BackColor"; - case EbvFrontSecondaryColor: return "FrontSecondaryColor"; - case EbvBackSecondaryColor: return "BackSecondaryColor"; - case EbvTexCoord: return "TexCoord"; - case EbvFogFragCoord: return "FogFragCoord"; - case EbvInvocationId: return "InvocationID"; - case EbvPrimitiveId: return "PrimitiveID"; - case EbvLayer: return "Layer"; - case EbvViewportIndex: return "ViewportIndex"; - case EbvPatchVertices: return "PatchVertices"; - case EbvTessLevelOuter: return "TessLevelOuter"; - case EbvTessLevelInner: return "TessLevelInner"; - case EbvBoundingBox: return "BoundingBox"; - case EbvTessCoord: return "TessCoord"; - case EbvColor: return "Color"; - case EbvSecondaryColor: return "SecondaryColor"; - case EbvFace: return "Face"; - case EbvFragCoord: return "FragCoord"; - case EbvPointCoord: return "PointCoord"; - case EbvFragColor: return "FragColor"; - case EbvFragData: return "FragData"; - case EbvFragDepth: return "FragDepth"; - case EbvFragStencilRef: return "FragStencilRef"; - case EbvSampleId: return "SampleId"; - case EbvSamplePosition: return "SamplePosition"; - case EbvSampleMask: return "SampleMaskIn"; - case EbvHelperInvocation: return "HelperInvocation"; - -#ifdef AMD_EXTENSIONS - case EbvBaryCoordNoPersp: return "BaryCoordNoPersp"; - case EbvBaryCoordNoPerspCentroid: return "BaryCoordNoPerspCentroid"; - case EbvBaryCoordNoPerspSample: return "BaryCoordNoPerspSample"; - case EbvBaryCoordSmooth: return "BaryCoordSmooth"; - case EbvBaryCoordSmoothCentroid: return "BaryCoordSmoothCentroid"; - case EbvBaryCoordSmoothSample: return "BaryCoordSmoothSample"; - case EbvBaryCoordPullModel: return "BaryCoordPullModel"; -#endif - - case EbvViewIndex: return "ViewIndex"; - case EbvDeviceIndex: return "DeviceIndex"; - -#ifdef NV_EXTENSIONS - case EbvViewportMaskNV: return "ViewportMaskNV"; - case EbvSecondaryPositionNV: return "SecondaryPositionNV"; - case EbvSecondaryViewportMaskNV: return "SecondaryViewportMaskNV"; - case EbvPositionPerViewNV: return "PositionPerViewNV"; - case EbvViewportMaskPerViewNV: return "ViewportMaskPerViewNV"; - case EbvFragFullyCoveredNV: return "FragFullyCoveredNV"; -#endif - default: return "unknown built-in variable"; - } -} - -// In this enum, order matters; users can assume higher precision is a bigger value -// and EpqNone is 0. -enum TPrecisionQualifier { - EpqNone = 0, - EpqLow, - EpqMedium, - EpqHigh -}; - -__inline const char* GetPrecisionQualifierString(TPrecisionQualifier p) -{ - switch(p) { - case EpqNone: return ""; break; - case EpqLow: return "lowp"; break; - case EpqMedium: return "mediump"; break; - case EpqHigh: return "highp"; break; - default: return "unknown precision qualifier"; - } -} - -} // end namespace glslang - -#endif // _BASICTYPES_INCLUDED_ diff --git a/love/src/jni/love/src/libraries/glslang/glslang/Include/Common.h b/love/src/jni/love/src/libraries/glslang/glslang/Include/Common.h deleted file mode 100644 index 06a94755..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/Include/Common.h +++ /dev/null @@ -1,274 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2012-2013 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#ifndef _COMMON_INCLUDED_ -#define _COMMON_INCLUDED_ - -#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) || defined MINGW_HAS_SECURE_API - #include - #define snprintf sprintf_s - #define safe_vsprintf(buf,max,format,args) vsnprintf_s((buf), (max), (max), (format), (args)) -#elif defined (solaris) - #define safe_vsprintf(buf,max,format,args) vsnprintf((buf), (max), (format), (args)) - #include - #define UINT_PTR uintptr_t -#else - #define safe_vsprintf(buf,max,format,args) vsnprintf((buf), (max), (format), (args)) - #include - #define UINT_PTR uintptr_t -#endif - -#if defined(__ANDROID__) || _MSC_VER < 1700 -#include -namespace std { -template -std::string to_string(const T& val) { - std::ostringstream os; - os << val; - return os.str(); -} -} -#endif - -#if defined(_MSC_VER) && _MSC_VER < 1800 -inline long long int strtoll (const char* str, char** endptr, int base) -{ - return _strtoi64(str, endptr, base); -} -inline unsigned long long int strtoull (const char* str, char** endptr, int base) -{ - return _strtoui64(str, endptr, base); -} -inline long long int atoll (const char* str) -{ - return strtoll(str, NULL, 10); -} -#endif - -#if defined(_MSC_VER) -#define strdup _strdup -#endif - -/* windows only pragma */ -#ifdef _MSC_VER - #pragma warning(disable : 4786) // Don't warn about too long identifiers - #pragma warning(disable : 4514) // unused inline method - #pragma warning(disable : 4201) // nameless union -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "PoolAlloc.h" - -// -// Put POOL_ALLOCATOR_NEW_DELETE in base classes to make them use this scheme. -// -#define POOL_ALLOCATOR_NEW_DELETE(A) \ - void* operator new(size_t s) { return (A).allocate(s); } \ - void* operator new(size_t, void *_Where) { return (_Where); } \ - void operator delete(void*) { } \ - void operator delete(void *, void *) { } \ - void* operator new[](size_t s) { return (A).allocate(s); } \ - void* operator new[](size_t, void *_Where) { return (_Where); } \ - void operator delete[](void*) { } \ - void operator delete[](void *, void *) { } - -namespace glslang { - - // - // Pool version of string. - // - typedef pool_allocator TStringAllocator; - typedef std::basic_string , TStringAllocator> TString; - -} // end namespace glslang - -// Repackage the std::hash for use by unordered map/set with a TString key. -namespace std { - - template<> struct hash { - std::size_t operator()(const glslang::TString& s) const - { - const unsigned _FNV_offset_basis = 2166136261U; - const unsigned _FNV_prime = 16777619U; - unsigned _Val = _FNV_offset_basis; - size_t _Count = s.size(); - const char* _First = s.c_str(); - for (size_t _Next = 0; _Next < _Count; ++_Next) - { - _Val ^= (unsigned)_First[_Next]; - _Val *= _FNV_prime; - } - - return _Val; - } - }; -} - -namespace glslang { - -inline TString* NewPoolTString(const char* s) -{ - void* memory = GetThreadPoolAllocator().allocate(sizeof(TString)); - return new(memory) TString(s); -} - -template inline T* NewPoolObject(T) -{ - return new(GetThreadPoolAllocator().allocate(sizeof(T))) T; -} - -template inline T* NewPoolObject(T, int instances) -{ - return new(GetThreadPoolAllocator().allocate(instances * sizeof(T))) T[instances]; -} - -// -// Pool allocator versions of vectors, lists, and maps -// -template class TVector : public std::vector > { -public: - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - - typedef typename std::vector >::size_type size_type; - TVector() : std::vector >() {} - TVector(const pool_allocator& a) : std::vector >(a) {} - TVector(size_type i) : std::vector >(i) {} - TVector(size_type i, const T& val) : std::vector >(i, val) {} -}; - -template class TList : public std::list > { -}; - -template > -class TMap : public std::map > > { -}; - -template , class PRED = std::equal_to > -class TUnorderedMap : public std::unordered_map > > { -}; - -// -// Persistent string memory. Should only be used for strings that survive -// across compiles/links. -// -typedef std::basic_string TPersistString; - -// -// templatized min and max functions. -// -template T Min(const T a, const T b) { return a < b ? a : b; } -template T Max(const T a, const T b) { return a > b ? a : b; } - -// -// Create a TString object from an integer. -// -#if defined _MSC_VER || defined MINGW_HAS_SECURE_API -inline const TString String(const int i, const int base = 10) -{ - char text[16]; // 32 bit ints are at most 10 digits in base 10 - _itoa_s(i, text, sizeof(text), base); - return text; -} -#else -inline const TString String(const int i, const int /*base*/ = 10) -{ - char text[16]; // 32 bit ints are at most 10 digits in base 10 - - // we assume base 10 for all cases - snprintf(text, sizeof(text), "%d", i); - - return text; -} -#endif - -struct TSourceLoc { - void init() { name = nullptr; string = 0; line = 0; column = 0; } - void init(int stringNum) { init(); string = stringNum; } - // Returns the name if it exists. Otherwise, returns the string number. - std::string getStringNameOrNum(bool quoteStringName = true) const - { - if (name != nullptr) - return quoteStringName ? ("\"" + std::string(name) + "\"") : name; - return std::to_string((long long)string); - } - const char* name; // descriptive name for this string - int string; - int line; - int column; -}; - -class TPragmaTable : public TMap { -public: - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) -}; - -const int MaxTokenLength = 1024; - -template bool IsPow2(T powerOf2) -{ - if (powerOf2 <= 0) - return false; - - return (powerOf2 & (powerOf2 - 1)) == 0; -} - -// Round number up to a multiple of the given powerOf2, which is not -// a power, just a number that must be a power of 2. -template void RoundToPow2(T& number, int powerOf2) -{ - assert(IsPow2(powerOf2)); - number = (number + powerOf2 - 1) & ~(powerOf2 - 1); -} - -template bool IsMultipleOfPow2(T number, int powerOf2) -{ - assert(IsPow2(powerOf2)); - return ! (number & (powerOf2 - 1)); -} - -} // end namespace glslang - -#endif // _COMMON_INCLUDED_ diff --git a/love/src/jni/love/src/libraries/glslang/glslang/Include/ConstantUnion.h b/love/src/jni/love/src/libraries/glslang/glslang/Include/ConstantUnion.h deleted file mode 100644 index f66a7ff5..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/Include/ConstantUnion.h +++ /dev/null @@ -1,625 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2013 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#ifndef _CONSTANT_UNION_INCLUDED_ -#define _CONSTANT_UNION_INCLUDED_ - -namespace glslang { - -class TConstUnion { -public: - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - - TConstUnion() : iConst(0), type(EbtInt) { } - - void setIConst(int i) - { - iConst = i; - type = EbtInt; - } - - void setUConst(unsigned int u) - { - uConst = u; - type = EbtUint; - } - - void setI64Const(long long i64) - { - i64Const = i64; - type = EbtInt64; - } - - void setU64Const(unsigned long long u64) - { - u64Const = u64; - type = EbtUint64; - } - - void setDConst(double d) - { - dConst = d; - type = EbtDouble; - } - - void setBConst(bool b) - { - bConst = b; - type = EbtBool; - } - - void setSConst(const TString* s) - { - sConst = s; - type = EbtString; - } - - int getIConst() const { return iConst; } - unsigned int getUConst() const { return uConst; } - long long getI64Const() const { return i64Const; } - unsigned long long getU64Const() const { return u64Const; } - double getDConst() const { return dConst; } - bool getBConst() const { return bConst; } - const TString* getSConst() const { return sConst; } - - bool operator==(const int i) const - { - if (i == iConst) - return true; - - return false; - } - - bool operator==(const unsigned int u) const - { - if (u == uConst) - return true; - - return false; - } - - bool operator==(const long long i64) const - { - if (i64 == i64Const) - return true; - - return false; - } - - bool operator==(const unsigned long long u64) const - { - if (u64 == u64Const) - return true; - - return false; - } - - bool operator==(const double d) const - { - if (d == dConst) - return true; - - return false; - } - - bool operator==(const bool b) const - { - if (b == bConst) - return true; - - return false; - } - - bool operator==(const TConstUnion& constant) const - { - if (constant.type != type) - return false; - - switch (type) { - case EbtInt: - if (constant.iConst == iConst) - return true; - - break; - case EbtUint: - if (constant.uConst == uConst) - return true; - - break; - case EbtInt64: - if (constant.i64Const == i64Const) - return true; - - break; - case EbtUint64: - if (constant.u64Const == u64Const) - return true; - - break; - case EbtDouble: - if (constant.dConst == dConst) - return true; - - break; - case EbtBool: - if (constant.bConst == bConst) - return true; - - break; - default: - assert(false && "Default missing"); - } - - return false; - } - - bool operator!=(const int i) const - { - return !operator==(i); - } - - bool operator!=(const unsigned int u) const - { - return !operator==(u); - } - - bool operator!=(const long long i) const - { - return !operator==(i); - } - - bool operator!=(const unsigned long long u) const - { - return !operator==(u); - } - - bool operator!=(const float f) const - { - return !operator==(f); - } - - bool operator!=(const bool b) const - { - return !operator==(b); - } - - bool operator!=(const TConstUnion& constant) const - { - return !operator==(constant); - } - - bool operator>(const TConstUnion& constant) const - { - assert(type == constant.type); - switch (type) { - case EbtInt: - if (iConst > constant.iConst) - return true; - - return false; - case EbtUint: - if (uConst > constant.uConst) - return true; - - return false; - case EbtInt64: - if (i64Const > constant.i64Const) - return true; - - return false; - case EbtUint64: - if (u64Const > constant.u64Const) - return true; - - return false; - case EbtDouble: - if (dConst > constant.dConst) - return true; - - return false; - default: - assert(false && "Default missing"); - return false; - } - } - - bool operator<(const TConstUnion& constant) const - { - assert(type == constant.type); - switch (type) { - case EbtInt: - if (iConst < constant.iConst) - return true; - - return false; - case EbtUint: - if (uConst < constant.uConst) - return true; - - return false; - case EbtInt64: - if (i64Const < constant.i64Const) - return true; - - return false; - case EbtUint64: - if (u64Const < constant.u64Const) - return true; - - return false; - case EbtDouble: - if (dConst < constant.dConst) - return true; - - return false; - default: - assert(false && "Default missing"); - return false; - } - } - - TConstUnion operator+(const TConstUnion& constant) const - { - TConstUnion returnValue; - assert(type == constant.type); - switch (type) { - case EbtInt: returnValue.setIConst(iConst + constant.iConst); break; - case EbtInt64: returnValue.setI64Const(i64Const + constant.i64Const); break; - case EbtUint: returnValue.setUConst(uConst + constant.uConst); break; - case EbtUint64: returnValue.setU64Const(u64Const + constant.u64Const); break; - case EbtDouble: returnValue.setDConst(dConst + constant.dConst); break; - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TConstUnion operator-(const TConstUnion& constant) const - { - TConstUnion returnValue; - assert(type == constant.type); - switch (type) { - case EbtInt: returnValue.setIConst(iConst - constant.iConst); break; - case EbtInt64: returnValue.setI64Const(i64Const - constant.i64Const); break; - case EbtUint: returnValue.setUConst(uConst - constant.uConst); break; - case EbtUint64: returnValue.setU64Const(u64Const - constant.u64Const); break; - case EbtDouble: returnValue.setDConst(dConst - constant.dConst); break; - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TConstUnion operator*(const TConstUnion& constant) const - { - TConstUnion returnValue; - assert(type == constant.type); - switch (type) { - case EbtInt: returnValue.setIConst(iConst * constant.iConst); break; - case EbtInt64: returnValue.setI64Const(i64Const * constant.i64Const); break; - case EbtUint: returnValue.setUConst(uConst * constant.uConst); break; - case EbtUint64: returnValue.setU64Const(u64Const * constant.u64Const); break; - case EbtDouble: returnValue.setDConst(dConst * constant.dConst); break; - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TConstUnion operator%(const TConstUnion& constant) const - { - TConstUnion returnValue; - assert(type == constant.type); - switch (type) { - case EbtInt: returnValue.setIConst(iConst % constant.iConst); break; - case EbtInt64: returnValue.setI64Const(i64Const % constant.i64Const); break; - case EbtUint: returnValue.setUConst(uConst % constant.uConst); break; - case EbtUint64: returnValue.setU64Const(u64Const % constant.u64Const); break; - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TConstUnion operator>>(const TConstUnion& constant) const - { - TConstUnion returnValue; - switch (type) { - case EbtInt: - switch (constant.type) { - case EbtInt: returnValue.setIConst(iConst >> constant.iConst); break; - case EbtUint: returnValue.setIConst(iConst >> constant.uConst); break; - case EbtInt64: returnValue.setIConst(iConst >> constant.i64Const); break; - case EbtUint64: returnValue.setIConst(iConst >> constant.u64Const); break; - default: assert(false && "Default missing"); - } - break; - case EbtUint: - switch (constant.type) { - case EbtInt: returnValue.setUConst(uConst >> constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst >> constant.uConst); break; - case EbtInt64: returnValue.setUConst(uConst >> constant.i64Const); break; - case EbtUint64: returnValue.setUConst(uConst >> constant.u64Const); break; - default: assert(false && "Default missing"); - } - break; - case EbtInt64: - switch (constant.type) { - case EbtInt: returnValue.setI64Const(i64Const >> constant.iConst); break; - case EbtUint: returnValue.setI64Const(i64Const >> constant.uConst); break; - case EbtInt64: returnValue.setI64Const(i64Const >> constant.i64Const); break; - case EbtUint64: returnValue.setI64Const(i64Const >> constant.u64Const); break; - default: assert(false && "Default missing"); - } - break; - case EbtUint64: - switch (constant.type) { - case EbtInt: returnValue.setU64Const(u64Const >> constant.iConst); break; - case EbtUint: returnValue.setU64Const(u64Const >> constant.uConst); break; - case EbtInt64: returnValue.setU64Const(u64Const >> constant.i64Const); break; - case EbtUint64: returnValue.setU64Const(u64Const >> constant.u64Const); break; - default: assert(false && "Default missing"); - } - break; - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TConstUnion operator<<(const TConstUnion& constant) const - { - TConstUnion returnValue; - switch (type) { - case EbtInt: - switch (constant.type) { - case EbtInt: returnValue.setIConst(iConst << constant.iConst); break; - case EbtUint: returnValue.setIConst(iConst << constant.uConst); break; - case EbtInt64: returnValue.setIConst(iConst << constant.i64Const); break; - case EbtUint64: returnValue.setIConst(iConst << constant.u64Const); break; - default: assert(false && "Default missing"); - } - break; - case EbtUint: - switch (constant.type) { - case EbtInt: returnValue.setUConst(uConst << constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst << constant.uConst); break; - case EbtInt64: returnValue.setUConst(uConst << constant.i64Const); break; - case EbtUint64: returnValue.setUConst(uConst << constant.u64Const); break; - default: assert(false && "Default missing"); - } - break; - case EbtInt64: - switch (constant.type) { - case EbtInt: returnValue.setI64Const(i64Const << constant.iConst); break; - case EbtUint: returnValue.setI64Const(i64Const << constant.uConst); break; - case EbtInt64: returnValue.setI64Const(i64Const << constant.i64Const); break; - case EbtUint64: returnValue.setI64Const(i64Const << constant.u64Const); break; - default: assert(false && "Default missing"); - } - break; - case EbtUint64: - switch (constant.type) { - case EbtInt: returnValue.setU64Const(u64Const << constant.iConst); break; - case EbtUint: returnValue.setU64Const(u64Const << constant.uConst); break; - case EbtInt64: returnValue.setU64Const(u64Const << constant.i64Const); break; - case EbtUint64: returnValue.setU64Const(u64Const << constant.u64Const); break; - default: assert(false && "Default missing"); - } - break; - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TConstUnion operator&(const TConstUnion& constant) const - { - TConstUnion returnValue; - assert(type == constant.type); - switch (type) { - case EbtInt: returnValue.setIConst(iConst & constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst & constant.uConst); break; - case EbtInt64: returnValue.setI64Const(i64Const & constant.i64Const); break; - case EbtUint64: returnValue.setU64Const(u64Const & constant.u64Const); break; - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TConstUnion operator|(const TConstUnion& constant) const - { - TConstUnion returnValue; - assert(type == constant.type); - switch (type) { - case EbtInt: returnValue.setIConst(iConst | constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst | constant.uConst); break; - case EbtInt64: returnValue.setI64Const(i64Const | constant.i64Const); break; - case EbtUint64: returnValue.setU64Const(u64Const | constant.u64Const); break; - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TConstUnion operator^(const TConstUnion& constant) const - { - TConstUnion returnValue; - assert(type == constant.type); - switch (type) { - case EbtInt: returnValue.setIConst(iConst ^ constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst ^ constant.uConst); break; - case EbtInt64: returnValue.setI64Const(i64Const ^ constant.i64Const); break; - case EbtUint64: returnValue.setU64Const(u64Const ^ constant.u64Const); break; - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TConstUnion operator~() const - { - TConstUnion returnValue; - switch (type) { - case EbtInt: returnValue.setIConst(~iConst); break; - case EbtUint: returnValue.setUConst(~uConst); break; - case EbtInt64: returnValue.setI64Const(~i64Const); break; - case EbtUint64: returnValue.setU64Const(~u64Const); break; - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TConstUnion operator&&(const TConstUnion& constant) const - { - TConstUnion returnValue; - assert(type == constant.type); - switch (type) { - case EbtBool: returnValue.setBConst(bConst && constant.bConst); break; - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TConstUnion operator||(const TConstUnion& constant) const - { - TConstUnion returnValue; - assert(type == constant.type); - switch (type) { - case EbtBool: returnValue.setBConst(bConst || constant.bConst); break; - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TBasicType getType() const { return type; } - -private: - union { - int iConst; // used for ivec, scalar ints - unsigned int uConst; // used for uvec, scalar uints - long long i64Const; // used for i64vec, scalar int64s - unsigned long long u64Const; // used for u64vec, scalar uint64s - bool bConst; // used for bvec, scalar bools - double dConst; // used for vec, dvec, mat, dmat, scalar floats and doubles - const TString* sConst; // string constant - }; - - TBasicType type; -}; - -// Encapsulate having a pointer to an array of TConstUnion, -// which only needs to be allocated if its size is going to be -// bigger than 0. -// -// One convenience is being able to use [] to go inside the array, instead -// of C++ assuming it as an array of pointers to vectors. -// -// General usage is that the size is known up front, and it is -// created once with the proper size. -// -class TConstUnionArray { -public: - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - - TConstUnionArray() : unionArray(nullptr) { } - virtual ~TConstUnionArray() { } - - explicit TConstUnionArray(int size) - { - if (size == 0) - unionArray = nullptr; - else - unionArray = new TConstUnionVector(size); - } - TConstUnionArray(const TConstUnionArray& a) : unionArray(a.unionArray) { } - TConstUnionArray(const TConstUnionArray& a, int start, int size) - { - unionArray = new TConstUnionVector(size); - for (int i = 0; i < size; ++i) - (*unionArray)[i] = a[start + i]; - } - - // Use this constructor for a smear operation - TConstUnionArray(int size, const TConstUnion& val) - { - unionArray = new TConstUnionVector(size, val); - } - - int size() const { return unionArray ? (int)unionArray->size() : 0; } - TConstUnion& operator[](size_t index) { return (*unionArray)[index]; } - const TConstUnion& operator[](size_t index) const { return (*unionArray)[index]; } - bool operator==(const TConstUnionArray& rhs) const - { - // this includes the case that both are unallocated - if (unionArray == rhs.unionArray) - return true; - - if (! unionArray || ! rhs.unionArray) - return false; - - if (! unionArray || ! rhs.unionArray) - return false; - - return *unionArray == *rhs.unionArray; - } - bool operator!=(const TConstUnionArray& rhs) const { return ! operator==(rhs); } - - double dot(const TConstUnionArray& rhs) - { - assert(rhs.unionArray->size() == unionArray->size()); - double sum = 0.0; - - for (size_t comp = 0; comp < unionArray->size(); ++comp) - sum += (*this)[comp].getDConst() * rhs[comp].getDConst(); - - return sum; - } - - bool empty() const { return unionArray == nullptr; } - -protected: - typedef TVector TConstUnionVector; - TConstUnionVector* unionArray; -}; - -} // end namespace glslang - -#endif // _CONSTANT_UNION_INCLUDED_ diff --git a/love/src/jni/love/src/libraries/glslang/glslang/Include/InfoSink.h b/love/src/jni/love/src/libraries/glslang/glslang/Include/InfoSink.h deleted file mode 100644 index dceb603c..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/Include/InfoSink.h +++ /dev/null @@ -1,144 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#ifndef _INFOSINK_INCLUDED_ -#define _INFOSINK_INCLUDED_ - -#include "../Include/Common.h" -#include - -namespace glslang { - -// -// TPrefixType is used to centralize how info log messages start. -// See below. -// -enum TPrefixType { - EPrefixNone, - EPrefixWarning, - EPrefixError, - EPrefixInternalError, - EPrefixUnimplemented, - EPrefixNote -}; - -enum TOutputStream { - ENull = 0, - EDebugger = 0x01, - EStdOut = 0x02, - EString = 0x04, -}; -// -// Encapsulate info logs for all objects that have them. -// -// The methods are a general set of tools for getting a variety of -// messages and types inserted into the log. -// -class TInfoSinkBase { -public: - TInfoSinkBase() : outputStream(4) {} - void erase() { sink.erase(); } - TInfoSinkBase& operator<<(const TPersistString& t) { append(t); return *this; } - TInfoSinkBase& operator<<(char c) { append(1, c); return *this; } - TInfoSinkBase& operator<<(const char* s) { append(s); return *this; } - TInfoSinkBase& operator<<(int n) { append(String(n)); return *this; } - TInfoSinkBase& operator<<(unsigned int n) { append(String(n)); return *this; } - TInfoSinkBase& operator<<(float n) { const int size = 40; char buf[size]; - snprintf(buf, size, (fabs(n) > 1e-8 && fabs(n) < 1e8) || n == 0.0f ? "%f" : "%g", n); - append(buf); - return *this; } - TInfoSinkBase& operator+(const TPersistString& t) { append(t); return *this; } - TInfoSinkBase& operator+(const TString& t) { append(t); return *this; } - TInfoSinkBase& operator<<(const TString& t) { append(t); return *this; } - TInfoSinkBase& operator+(const char* s) { append(s); return *this; } - const char* c_str() const { return sink.c_str(); } - void prefix(TPrefixType message) { - switch(message) { - case EPrefixNone: break; - case EPrefixWarning: append("WARNING: "); break; - case EPrefixError: append("ERROR: "); break; - case EPrefixInternalError: append("INTERNAL ERROR: "); break; - case EPrefixUnimplemented: append("UNIMPLEMENTED: "); break; - case EPrefixNote: append("NOTE: "); break; - default: append("UNKNOWN ERROR: "); break; - } - } - void location(const TSourceLoc& loc) { - const int maxSize = 24; - char locText[maxSize]; - snprintf(locText, maxSize, ":%d", loc.line); - append(loc.getStringNameOrNum(false).c_str()); - append(locText); - append(": "); - } - void message(TPrefixType message, const char* s) { - prefix(message); - append(s); - append("\n"); - } - void message(TPrefixType message, const char* s, const TSourceLoc& loc) { - prefix(message); - location(loc); - append(s); - append("\n"); - } - - void setOutputStream(int output = 4) - { - outputStream = output; - } - -protected: - void append(const char* s); - - void append(int count, char c); - void append(const TPersistString& t); - void append(const TString& t); - - void checkMem(size_t growth) { if (sink.capacity() < sink.size() + growth + 2) - sink.reserve(sink.capacity() + sink.capacity() / 2); } - void appendToStream(const char* s); - TPersistString sink; - int outputStream; -}; - -} // end namespace glslang - -class TInfoSink { -public: - glslang::TInfoSinkBase info; - glslang::TInfoSinkBase debug; -}; - -#endif // _INFOSINK_INCLUDED_ diff --git a/love/src/jni/love/src/libraries/glslang/glslang/Include/InitializeGlobals.h b/love/src/jni/love/src/libraries/glslang/glslang/Include/InitializeGlobals.h deleted file mode 100644 index 95d0a40e..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/Include/InitializeGlobals.h +++ /dev/null @@ -1,44 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#ifndef __INITIALIZE_GLOBALS_INCLUDED_ -#define __INITIALIZE_GLOBALS_INCLUDED_ - -namespace glslang { - -bool InitializePoolIndex(); - -} // end namespace glslang - -#endif // __INITIALIZE_GLOBALS_INCLUDED_ diff --git a/love/src/jni/love/src/libraries/glslang/glslang/Include/PoolAlloc.h b/love/src/jni/love/src/libraries/glslang/glslang/Include/PoolAlloc.h deleted file mode 100644 index cc7f4000..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/Include/PoolAlloc.h +++ /dev/null @@ -1,318 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2012-2013 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#ifndef _POOLALLOC_INCLUDED_ -#define _POOLALLOC_INCLUDED_ - -#ifdef _DEBUG -# define GUARD_BLOCKS // define to enable guard block sanity checking -#endif - -// -// This header defines an allocator that can be used to efficiently -// allocate a large number of small requests for heap memory, with the -// intention that they are not individually deallocated, but rather -// collectively deallocated at one time. -// -// This simultaneously -// -// * Makes each individual allocation much more efficient; the -// typical allocation is trivial. -// * Completely avoids the cost of doing individual deallocation. -// * Saves the trouble of tracking down and plugging a large class of leaks. -// -// Individual classes can use this allocator by supplying their own -// new and delete methods. -// -// STL containers can use this allocator by using the pool_allocator -// class as the allocator (second) template argument. -// - -#include -#include -#include - -namespace glslang { - -// If we are using guard blocks, we must track each individual -// allocation. If we aren't using guard blocks, these -// never get instantiated, so won't have any impact. -// - -class TAllocation { -public: - TAllocation(size_t size, unsigned char* mem, TAllocation* prev = 0) : - size(size), mem(mem), prevAlloc(prev) { - // Allocations are bracketed: - // [allocationHeader][initialGuardBlock][userData][finalGuardBlock] - // This would be cleaner with if (guardBlockSize)..., but that - // makes the compiler print warnings about 0 length memsets, - // even with the if() protecting them. -# ifdef GUARD_BLOCKS - memset(preGuard(), guardBlockBeginVal, guardBlockSize); - memset(data(), userDataFill, size); - memset(postGuard(), guardBlockEndVal, guardBlockSize); -# endif - } - - void check() const { - checkGuardBlock(preGuard(), guardBlockBeginVal, "before"); - checkGuardBlock(postGuard(), guardBlockEndVal, "after"); - } - - void checkAllocList() const; - - // Return total size needed to accommodate user buffer of 'size', - // plus our tracking data. - inline static size_t allocationSize(size_t size) { - return size + 2 * guardBlockSize + headerSize(); - } - - // Offset from surrounding buffer to get to user data buffer. - inline static unsigned char* offsetAllocation(unsigned char* m) { - return m + guardBlockSize + headerSize(); - } - -private: - void checkGuardBlock(unsigned char* blockMem, unsigned char val, const char* locText) const; - - // Find offsets to pre and post guard blocks, and user data buffer - unsigned char* preGuard() const { return mem + headerSize(); } - unsigned char* data() const { return preGuard() + guardBlockSize; } - unsigned char* postGuard() const { return data() + size; } - - size_t size; // size of the user data area - unsigned char* mem; // beginning of our allocation (pts to header) - TAllocation* prevAlloc; // prior allocation in the chain - - const static unsigned char guardBlockBeginVal; - const static unsigned char guardBlockEndVal; - const static unsigned char userDataFill; - - const static size_t guardBlockSize; -# ifdef GUARD_BLOCKS - inline static size_t headerSize() { return sizeof(TAllocation); } -# else - inline static size_t headerSize() { return 0; } -# endif -}; - -// -// There are several stacks. One is to track the pushing and popping -// of the user, and not yet implemented. The others are simply a -// repositories of free pages or used pages. -// -// Page stacks are linked together with a simple header at the beginning -// of each allocation obtained from the underlying OS. Multi-page allocations -// are returned to the OS. Individual page allocations are kept for future -// re-use. -// -// The "page size" used is not, nor must it match, the underlying OS -// page size. But, having it be about that size or equal to a set of -// pages is likely most optimal. -// -class TPoolAllocator { -public: - TPoolAllocator(int growthIncrement = 8*1024, int allocationAlignment = 16); - - // - // Don't call the destructor just to free up the memory, call pop() - // - ~TPoolAllocator(); - - // - // Call push() to establish a new place to pop memory too. Does not - // have to be called to get things started. - // - void push(); - - // - // Call pop() to free all memory allocated since the last call to push(), - // or if no last call to push, frees all memory since first allocation. - // - void pop(); - - // - // Call popAll() to free all memory allocated. - // - void popAll(); - - // - // Call allocate() to actually acquire memory. Returns 0 if no memory - // available, otherwise a properly aligned pointer to 'numBytes' of memory. - // - void* allocate(size_t numBytes); - - // - // There is no deallocate. The point of this class is that - // deallocation can be skipped by the user of it, as the model - // of use is to simultaneously deallocate everything at once - // by calling pop(), and to not have to solve memory leak problems. - // - -protected: - friend struct tHeader; - - struct tHeader { - tHeader(tHeader* nextPage, size_t pageCount) : -#ifdef GUARD_BLOCKS - lastAllocation(0), -#endif - nextPage(nextPage), pageCount(pageCount) { } - - ~tHeader() { -#ifdef GUARD_BLOCKS - if (lastAllocation) - lastAllocation->checkAllocList(); -#endif - } - -#ifdef GUARD_BLOCKS - TAllocation* lastAllocation; -#endif - tHeader* nextPage; - size_t pageCount; - }; - - struct tAllocState { - size_t offset; - tHeader* page; - }; - typedef std::vector tAllocStack; - - // Track allocations if and only if we're using guard blocks -#ifndef GUARD_BLOCKS - void* initializeAllocation(tHeader*, unsigned char* memory, size_t) { -#else - void* initializeAllocation(tHeader* block, unsigned char* memory, size_t numBytes) { - new(memory) TAllocation(numBytes, memory, block->lastAllocation); - block->lastAllocation = reinterpret_cast(memory); -#endif - - // This is optimized entirely away if GUARD_BLOCKS is not defined. - return TAllocation::offsetAllocation(memory); - } - - size_t pageSize; // granularity of allocation from the OS - size_t alignment; // all returned allocations will be aligned at - // this granularity, which will be a power of 2 - size_t alignmentMask; - size_t headerSkip; // amount of memory to skip to make room for the - // header (basically, size of header, rounded - // up to make it aligned - size_t currentPageOffset; // next offset in top of inUseList to allocate from - tHeader* freeList; // list of popped memory - tHeader* inUseList; // list of all memory currently being used - tAllocStack stack; // stack of where to allocate from, to partition pool - - int numCalls; // just an interesting statistic - size_t totalBytes; // just an interesting statistic -private: - TPoolAllocator& operator=(const TPoolAllocator&); // don't allow assignment operator - TPoolAllocator(const TPoolAllocator&); // don't allow default copy constructor -}; - -// -// There could potentially be many pools with pops happening at -// different times. But a simple use is to have a global pop -// with everyone using the same global allocator. -// -extern TPoolAllocator& GetThreadPoolAllocator(); -void SetThreadPoolAllocator(TPoolAllocator* poolAllocator); - -// -// This STL compatible allocator is intended to be used as the allocator -// parameter to templatized STL containers, like vector and map. -// -// It will use the pools for allocation, and not -// do any deallocation, but will still do destruction. -// -template -class pool_allocator { -public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef T *pointer; - typedef const T *const_pointer; - typedef T& reference; - typedef const T& const_reference; - typedef T value_type; - template - struct rebind { - typedef pool_allocator other; - }; - pointer address(reference x) const { return &x; } - const_pointer address(const_reference x) const { return &x; } - - pool_allocator() : allocator(GetThreadPoolAllocator()) { } - pool_allocator(TPoolAllocator& a) : allocator(a) { } - pool_allocator(const pool_allocator& p) : allocator(p.allocator) { } - - pool_allocator& operator=(const pool_allocator&) { return *this; } - - template - pool_allocator(const pool_allocator& p) : allocator(p.getAllocator()) { } - - pointer allocate(size_type n) { - return reinterpret_cast(getAllocator().allocate(n * sizeof(T))); } - pointer allocate(size_type n, const void*) { - return reinterpret_cast(getAllocator().allocate(n * sizeof(T))); } - - void deallocate(void*, size_type) { } - void deallocate(pointer, size_type) { } - - pointer _Charalloc(size_t n) { - return reinterpret_cast(getAllocator().allocate(n)); } - - void construct(pointer p, const T& val) { new ((void *)p) T(val); } - void destroy(pointer p) { p->T::~T(); } - - bool operator==(const pool_allocator& rhs) const { return &getAllocator() == &rhs.getAllocator(); } - bool operator!=(const pool_allocator& rhs) const { return &getAllocator() != &rhs.getAllocator(); } - - size_type max_size() const { return static_cast(-1) / sizeof(T); } - size_type max_size(int size) const { return static_cast(-1) / size; } - - void setAllocator(TPoolAllocator* a) { allocator = *a; } - TPoolAllocator& getAllocator() const { return allocator; } - -protected: - TPoolAllocator& allocator; -}; - -} // end namespace glslang - -#endif // _POOLALLOC_INCLUDED_ diff --git a/love/src/jni/love/src/libraries/glslang/glslang/Include/ResourceLimits.h b/love/src/jni/love/src/libraries/glslang/glslang/Include/ResourceLimits.h deleted file mode 100644 index 0d07b8c8..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/Include/ResourceLimits.h +++ /dev/null @@ -1,140 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2013 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#ifndef _RESOURCE_LIMITS_INCLUDED_ -#define _RESOURCE_LIMITS_INCLUDED_ - -struct TLimits { - bool nonInductiveForLoops; - bool whileLoops; - bool doWhileLoops; - bool generalUniformIndexing; - bool generalAttributeMatrixVectorIndexing; - bool generalVaryingIndexing; - bool generalSamplerIndexing; - bool generalVariableIndexing; - bool generalConstantMatrixVectorIndexing; -}; - -struct TBuiltInResource { - int maxLights; - int maxClipPlanes; - int maxTextureUnits; - int maxTextureCoords; - int maxVertexAttribs; - int maxVertexUniformComponents; - int maxVaryingFloats; - int maxVertexTextureImageUnits; - int maxCombinedTextureImageUnits; - int maxTextureImageUnits; - int maxFragmentUniformComponents; - int maxDrawBuffers; - int maxVertexUniformVectors; - int maxVaryingVectors; - int maxFragmentUniformVectors; - int maxVertexOutputVectors; - int maxFragmentInputVectors; - int minProgramTexelOffset; - int maxProgramTexelOffset; - int maxClipDistances; - int maxComputeWorkGroupCountX; - int maxComputeWorkGroupCountY; - int maxComputeWorkGroupCountZ; - int maxComputeWorkGroupSizeX; - int maxComputeWorkGroupSizeY; - int maxComputeWorkGroupSizeZ; - int maxComputeUniformComponents; - int maxComputeTextureImageUnits; - int maxComputeImageUniforms; - int maxComputeAtomicCounters; - int maxComputeAtomicCounterBuffers; - int maxVaryingComponents; - int maxVertexOutputComponents; - int maxGeometryInputComponents; - int maxGeometryOutputComponents; - int maxFragmentInputComponents; - int maxImageUnits; - int maxCombinedImageUnitsAndFragmentOutputs; - int maxCombinedShaderOutputResources; - int maxImageSamples; - int maxVertexImageUniforms; - int maxTessControlImageUniforms; - int maxTessEvaluationImageUniforms; - int maxGeometryImageUniforms; - int maxFragmentImageUniforms; - int maxCombinedImageUniforms; - int maxGeometryTextureImageUnits; - int maxGeometryOutputVertices; - int maxGeometryTotalOutputComponents; - int maxGeometryUniformComponents; - int maxGeometryVaryingComponents; - int maxTessControlInputComponents; - int maxTessControlOutputComponents; - int maxTessControlTextureImageUnits; - int maxTessControlUniformComponents; - int maxTessControlTotalOutputComponents; - int maxTessEvaluationInputComponents; - int maxTessEvaluationOutputComponents; - int maxTessEvaluationTextureImageUnits; - int maxTessEvaluationUniformComponents; - int maxTessPatchComponents; - int maxPatchVertices; - int maxTessGenLevel; - int maxViewports; - int maxVertexAtomicCounters; - int maxTessControlAtomicCounters; - int maxTessEvaluationAtomicCounters; - int maxGeometryAtomicCounters; - int maxFragmentAtomicCounters; - int maxCombinedAtomicCounters; - int maxAtomicCounterBindings; - int maxVertexAtomicCounterBuffers; - int maxTessControlAtomicCounterBuffers; - int maxTessEvaluationAtomicCounterBuffers; - int maxGeometryAtomicCounterBuffers; - int maxFragmentAtomicCounterBuffers; - int maxCombinedAtomicCounterBuffers; - int maxAtomicCounterBufferSize; - int maxTransformFeedbackBuffers; - int maxTransformFeedbackInterleavedComponents; - int maxCullDistances; - int maxCombinedClipAndCullDistances; - int maxSamples; - - TLimits limits; -}; - -#endif // _RESOURCE_LIMITS_INCLUDED_ diff --git a/love/src/jni/love/src/libraries/glslang/glslang/Include/ShHandle.h b/love/src/jni/love/src/libraries/glslang/glslang/Include/ShHandle.h deleted file mode 100644 index df07bd8e..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/Include/ShHandle.h +++ /dev/null @@ -1,176 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#ifndef _SHHANDLE_INCLUDED_ -#define _SHHANDLE_INCLUDED_ - -// -// Machine independent part of the compiler private objects -// sent as ShHandle to the driver. -// -// This should not be included by driver code. -// - -#define SH_EXPORTING -#include "../Public/ShaderLang.h" -#include "../MachineIndependent/Versions.h" -#include "InfoSink.h" - -class TCompiler; -class TLinker; -class TUniformMap; - -// -// The base class used to back handles returned to the driver. -// -class TShHandleBase { -public: - TShHandleBase() { pool = new glslang::TPoolAllocator; } - virtual ~TShHandleBase() { delete pool; } - virtual TCompiler* getAsCompiler() { return 0; } - virtual TLinker* getAsLinker() { return 0; } - virtual TUniformMap* getAsUniformMap() { return 0; } - virtual glslang::TPoolAllocator* getPool() const { return pool; } -private: - glslang::TPoolAllocator* pool; -}; - -// -// The base class for the machine dependent linker to derive from -// for managing where uniforms live. -// -class TUniformMap : public TShHandleBase { -public: - TUniformMap() { } - virtual ~TUniformMap() { } - virtual TUniformMap* getAsUniformMap() { return this; } - virtual int getLocation(const char* name) = 0; - virtual TInfoSink& getInfoSink() { return infoSink; } - TInfoSink infoSink; -}; - -class TIntermNode; - -// -// The base class for the machine dependent compiler to derive from -// for managing object code from the compile. -// -class TCompiler : public TShHandleBase { -public: - TCompiler(EShLanguage l, TInfoSink& sink) : infoSink(sink) , language(l), haveValidObjectCode(false) { } - virtual ~TCompiler() { } - EShLanguage getLanguage() { return language; } - virtual TInfoSink& getInfoSink() { return infoSink; } - - virtual bool compile(TIntermNode* root, int version = 0, EProfile profile = ENoProfile) = 0; - - virtual TCompiler* getAsCompiler() { return this; } - virtual bool linkable() { return haveValidObjectCode; } - - TInfoSink& infoSink; -protected: - TCompiler& operator=(TCompiler&); - - EShLanguage language; - bool haveValidObjectCode; -}; - -// -// Link operations are based on a list of compile results... -// -typedef glslang::TVector TCompilerList; -typedef glslang::TVector THandleList; - -// -// The base class for the machine dependent linker to derive from -// to manage the resulting executable. -// - -class TLinker : public TShHandleBase { -public: - TLinker(EShExecutable e, TInfoSink& iSink) : - infoSink(iSink), - executable(e), - haveReturnableObjectCode(false), - appAttributeBindings(0), - fixedAttributeBindings(0), - excludedAttributes(0), - excludedCount(0), - uniformBindings(0) { } - virtual TLinker* getAsLinker() { return this; } - virtual ~TLinker() { } - virtual bool link(TCompilerList&, TUniformMap*) = 0; - virtual bool link(THandleList&) { return false; } - virtual void setAppAttributeBindings(const ShBindingTable* t) { appAttributeBindings = t; } - virtual void setFixedAttributeBindings(const ShBindingTable* t) { fixedAttributeBindings = t; } - virtual void getAttributeBindings(ShBindingTable const **t) const = 0; - virtual void setExcludedAttributes(const int* attributes, int count) { excludedAttributes = attributes; excludedCount = count; } - virtual ShBindingTable* getUniformBindings() const { return uniformBindings; } - virtual const void* getObjectCode() const { return 0; } // a real compiler would be returning object code here - virtual TInfoSink& getInfoSink() { return infoSink; } - TInfoSink& infoSink; -protected: - TLinker& operator=(TLinker&); - EShExecutable executable; - bool haveReturnableObjectCode; // true when objectCode is acceptable to send to driver - - const ShBindingTable* appAttributeBindings; - const ShBindingTable* fixedAttributeBindings; - const int* excludedAttributes; - int excludedCount; - ShBindingTable* uniformBindings; // created by the linker -}; - -// -// This is the interface between the machine independent code -// and the machine dependent code. -// -// The machine dependent code should derive from the classes -// above. Then Construct*() and Delete*() will create and -// destroy the machine dependent objects, which contain the -// above machine independent information. -// -TCompiler* ConstructCompiler(EShLanguage, int); - -TShHandleBase* ConstructLinker(EShExecutable, int); -TShHandleBase* ConstructBindings(); -void DeleteLinker(TShHandleBase*); -void DeleteBindingList(TShHandleBase* bindingList); - -TUniformMap* ConstructUniformMap(); -void DeleteCompiler(TCompiler*); - -void DeleteUniformMap(TUniformMap*); - -#endif // _SHHANDLE_INCLUDED_ diff --git a/love/src/jni/love/src/libraries/glslang/glslang/Include/Types.h b/love/src/jni/love/src/libraries/glslang/glslang/Include/Types.h deleted file mode 100644 index cc847b5e..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/Include/Types.h +++ /dev/null @@ -1,1924 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2012-2016 LunarG, Inc. -// Copyright (C) 2015-2016 Google, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#ifndef _TYPES_INCLUDED -#define _TYPES_INCLUDED - -#include "../Include/Common.h" -#include "../Include/BaseTypes.h" -#include "../Public/ShaderLang.h" -#include "arrays.h" - -#include - -namespace glslang { - -const int GlslangMaxTypeLength = 200; // TODO: need to print block/struct one member per line, so this can stay bounded - -const char* const AnonymousPrefix = "anon@"; // for something like a block whose members can be directly accessed -inline bool IsAnonymous(const TString& name) -{ - return name.compare(0, 5, AnonymousPrefix) == 0; -} - -// -// Details within a sampler type -// -enum TSamplerDim { - EsdNone, - Esd1D, - Esd2D, - Esd3D, - EsdCube, - EsdRect, - EsdBuffer, - EsdSubpass, // goes only with non-sampled image (image is true) - EsdNumDims -}; - -struct TSampler { // misnomer now; includes images, textures without sampler, and textures with sampler - TBasicType type : 8; // type returned by sampler - TSamplerDim dim : 8; - bool arrayed : 1; - bool shadow : 1; - bool ms : 1; - bool image : 1; // image, combined should be false - bool combined : 1; // true means texture is combined with a sampler, false means texture with no sampler - bool sampler : 1; // true means a pure sampler, other fields should be clear() - bool external : 1; // GL_OES_EGL_image_external - unsigned int vectorSize : 3; // vector return type size. - - // Some languages support structures as sample results. Storing the whole structure in the - // TSampler is too large, so there is an index to a separate table. - static const unsigned structReturnIndexBits = 4; // number of index bits to use. - static const unsigned structReturnSlots = (1< TTypeList; - -typedef TVector TIdentifierList; - -// -// Following are a series of helper enums for managing layouts and qualifiers, -// used for TPublicType, TType, others. -// - -enum TLayoutPacking { - ElpNone, - ElpShared, // default, but different than saying nothing - ElpStd140, - ElpStd430, - ElpPacked, - ElpCount // If expanding, see bitfield width below -}; - -enum TLayoutMatrix { - ElmNone, - ElmRowMajor, - ElmColumnMajor, // default, but different than saying nothing - ElmCount // If expanding, see bitfield width below -}; - -// Union of geometry shader and tessellation shader geometry types. -// They don't go into TType, but rather have current state per shader or -// active parser type (TPublicType). -enum TLayoutGeometry { - ElgNone, - ElgPoints, - ElgLines, - ElgLinesAdjacency, - ElgLineStrip, - ElgTriangles, - ElgTrianglesAdjacency, - ElgTriangleStrip, - ElgQuads, - ElgIsolines, -}; - -enum TVertexSpacing { - EvsNone, - EvsEqual, - EvsFractionalEven, - EvsFractionalOdd -}; - -enum TVertexOrder { - EvoNone, - EvoCw, - EvoCcw -}; - -// Note: order matters, as type of format is done by comparison. -enum TLayoutFormat { - ElfNone, - - // Float image - ElfRgba32f, - ElfRgba16f, - ElfR32f, - ElfRgba8, - ElfRgba8Snorm, - - ElfEsFloatGuard, // to help with comparisons - - ElfRg32f, - ElfRg16f, - ElfR11fG11fB10f, - ElfR16f, - ElfRgba16, - ElfRgb10A2, - ElfRg16, - ElfRg8, - ElfR16, - ElfR8, - ElfRgba16Snorm, - ElfRg16Snorm, - ElfRg8Snorm, - ElfR16Snorm, - ElfR8Snorm, - - ElfFloatGuard, // to help with comparisons - - // Int image - ElfRgba32i, - ElfRgba16i, - ElfRgba8i, - ElfR32i, - - ElfEsIntGuard, // to help with comparisons - - ElfRg32i, - ElfRg16i, - ElfRg8i, - ElfR16i, - ElfR8i, - - ElfIntGuard, // to help with comparisons - - // Uint image - ElfRgba32ui, - ElfRgba16ui, - ElfRgba8ui, - ElfR32ui, - - ElfEsUintGuard, // to help with comparisons - - ElfRg32ui, - ElfRg16ui, - ElfRgb10a2ui, - ElfRg8ui, - ElfR16ui, - ElfR8ui, - - ElfCount -}; - -enum TLayoutDepth { - EldNone, - EldAny, - EldGreater, - EldLess, - EldUnchanged, - - EldCount -}; - -enum TBlendEquationShift { - // No 'EBlendNone': - // These are used as bit-shift amounts. A mask of such shifts will have type 'int', - // and in that space, 0 means no bits set, or none. In this enum, 0 means (1 << 0), a bit is set. - EBlendMultiply, - EBlendScreen, - EBlendOverlay, - EBlendDarken, - EBlendLighten, - EBlendColordodge, - EBlendColorburn, - EBlendHardlight, - EBlendSoftlight, - EBlendDifference, - EBlendExclusion, - EBlendHslHue, - EBlendHslSaturation, - EBlendHslColor, - EBlendHslLuminosity, - EBlendAllEquations, - - EBlendCount -}; - -class TQualifier { -public: - static const int layoutNotSet = -1; - - void clear() - { - precision = EpqNone; - invariant = false; - noContraction = false; - makeTemporary(); - declaredBuiltIn = EbvNone; - } - - // drop qualifiers that don't belong in a temporary variable - void makeTemporary() - { - semanticName = nullptr; - storage = EvqTemporary; - builtIn = EbvNone; - clearInterstage(); - clearMemory(); - specConstant = false; - clearLayout(); - } - - void clearInterstage() - { - clearInterpolation(); - patch = false; - sample = false; - } - - void clearInterpolation() - { - centroid = false; - smooth = false; - flat = false; - nopersp = false; -#ifdef AMD_EXTENSIONS - explicitInterp = false; -#endif - } - - void clearMemory() - { - coherent = false; - volatil = false; - restrict = false; - readonly = false; - writeonly = false; - } - - // Drop just the storage qualification, which perhaps should - // never be done, as it is fundamentally inconsistent, but need to - // explore what downstream consumers need. - // E.g., in a deference, it is an inconsistency between: - // A) partially dereferenced resource is still in the storage class it started in - // B) partially dereferenced resource is a new temporary object - // If A, then nothing should change, if B, then everything should change, but this is half way. - void makePartialTemporary() - { - storage = EvqTemporary; - specConstant = false; - } - - const char* semanticName; - TStorageQualifier storage : 6; - TBuiltInVariable builtIn : 8; - TBuiltInVariable declaredBuiltIn : 8; - TPrecisionQualifier precision : 3; - bool invariant : 1; // require canonical treatment for cross-shader invariance - bool noContraction: 1; // prevent contraction and reassociation, e.g., for 'precise' keyword, and expressions it affects - bool centroid : 1; - bool smooth : 1; - bool flat : 1; - bool nopersp : 1; -#ifdef AMD_EXTENSIONS - bool explicitInterp : 1; -#endif - bool patch : 1; - bool sample : 1; - bool coherent : 1; - bool volatil : 1; - bool restrict : 1; - bool readonly : 1; - bool writeonly : 1; - bool specConstant : 1; // having a constant_id is not sufficient: expressions have no id, but are still specConstant - - bool isMemory() const - { - return coherent || volatil || restrict || readonly || writeonly; - } - bool isInterpolation() const - { -#ifdef AMD_EXTENSIONS - return flat || smooth || nopersp || explicitInterp; -#else - return flat || smooth || nopersp; -#endif - } - bool isAuxiliary() const - { - return centroid || patch || sample; - } - - bool isPipeInput() const - { - switch (storage) { - case EvqVaryingIn: - case EvqFragCoord: - case EvqPointCoord: - case EvqFace: - case EvqVertexId: - case EvqInstanceId: - return true; - default: - return false; - } - } - - bool isPipeOutput() const - { - switch (storage) { - case EvqPosition: - case EvqPointSize: - case EvqClipVertex: - case EvqVaryingOut: - case EvqFragColor: - case EvqFragDepth: - return true; - default: - return false; - } - } - - bool isParamInput() const - { - switch (storage) { - case EvqIn: - case EvqInOut: - case EvqConstReadOnly: - return true; - default: - return false; - } - } - - bool isParamOutput() const - { - switch (storage) { - case EvqOut: - case EvqInOut: - return true; - default: - return false; - } - } - - bool isUniformOrBuffer() const - { - switch (storage) { - case EvqUniform: - case EvqBuffer: - return true; - default: - return false; - } - } - - bool isIo() const - { - switch (storage) { - case EvqUniform: - case EvqBuffer: - case EvqVaryingIn: - case EvqFragCoord: - case EvqPointCoord: - case EvqFace: - case EvqVertexId: - case EvqInstanceId: - case EvqPosition: - case EvqPointSize: - case EvqClipVertex: - case EvqVaryingOut: - case EvqFragColor: - case EvqFragDepth: - return true; - default: - return false; - } - } - - // True if this type of IO is supposed to be arrayed with extra level for per-vertex data - bool isArrayedIo(EShLanguage language) const - { - switch (language) { - case EShLangGeometry: - return isPipeInput(); - case EShLangTessControl: - return ! patch && (isPipeInput() || isPipeOutput()); - case EShLangTessEvaluation: - return ! patch && isPipeInput(); - default: - return false; - } - } - - // Implementing an embedded layout-qualifier class here, since C++ can't have a real class bitfield - void clearLayout() // all layout - { - clearUniformLayout(); - - layoutPushConstant = false; -#ifdef NV_EXTENSIONS - layoutPassthrough = false; - layoutViewportRelative = false; - // -2048 as the default value indicating layoutSecondaryViewportRelative is not set - layoutSecondaryViewportRelativeOffset = -2048; -#endif - - clearInterstageLayout(); - - layoutSpecConstantId = layoutSpecConstantIdEnd; - - layoutFormat = ElfNone; - } - void clearInterstageLayout() - { - layoutLocation = layoutLocationEnd; - layoutComponent = layoutComponentEnd; - layoutIndex = layoutIndexEnd; - clearStreamLayout(); - clearXfbLayout(); - } - void clearStreamLayout() - { - layoutStream = layoutStreamEnd; - } - void clearXfbLayout() - { - layoutXfbBuffer = layoutXfbBufferEnd; - layoutXfbStride = layoutXfbStrideEnd; - layoutXfbOffset = layoutXfbOffsetEnd; - } - - bool hasNonXfbLayout() const - { - return hasUniformLayout() || - hasAnyLocation() || - hasStream() || - hasFormat() || - layoutPushConstant; - } - bool hasLayout() const - { - return hasNonXfbLayout() || - hasXfb(); - } - TLayoutMatrix layoutMatrix : 3; - TLayoutPacking layoutPacking : 4; - int layoutOffset; - int layoutAlign; - - unsigned int layoutLocation :12; - static const unsigned int layoutLocationEnd = 0xFFF; - - unsigned int layoutComponent : 3; - static const unsigned int layoutComponentEnd = 4; - - unsigned int layoutSet : 7; - static const unsigned int layoutSetEnd = 0x3F; - - unsigned int layoutBinding : 16; - static const unsigned int layoutBindingEnd = 0xFFFF; - - unsigned int layoutIndex : 8; - static const unsigned int layoutIndexEnd = 0xFF; - - unsigned int layoutStream : 8; - static const unsigned int layoutStreamEnd = 0xFF; - - unsigned int layoutXfbBuffer : 4; - static const unsigned int layoutXfbBufferEnd = 0xF; - - unsigned int layoutXfbStride : 10; - static const unsigned int layoutXfbStrideEnd = 0x3FF; - - unsigned int layoutXfbOffset : 10; - static const unsigned int layoutXfbOffsetEnd = 0x3FF; - - unsigned int layoutAttachment : 8; // for input_attachment_index - static const unsigned int layoutAttachmentEnd = 0XFF; - - unsigned int layoutSpecConstantId : 11; - static const unsigned int layoutSpecConstantIdEnd = 0x7FF; - - TLayoutFormat layoutFormat : 8; - - bool layoutPushConstant; - -#ifdef NV_EXTENSIONS - bool layoutPassthrough; - bool layoutViewportRelative; - int layoutSecondaryViewportRelativeOffset; -#endif - - bool hasUniformLayout() const - { - return hasMatrix() || - hasPacking() || - hasOffset() || - hasBinding() || - hasSet() || - hasAlign(); - } - void clearUniformLayout() // only uniform specific - { - layoutMatrix = ElmNone; - layoutPacking = ElpNone; - layoutOffset = layoutNotSet; - layoutAlign = layoutNotSet; - - layoutSet = layoutSetEnd; - layoutBinding = layoutBindingEnd; - layoutAttachment = layoutAttachmentEnd; - } - - bool hasMatrix() const - { - return layoutMatrix != ElmNone; - } - bool hasPacking() const - { - return layoutPacking != ElpNone; - } - bool hasOffset() const - { - return layoutOffset != layoutNotSet; - } - bool hasAlign() const - { - return layoutAlign != layoutNotSet; - } - bool hasAnyLocation() const - { - return hasLocation() || - hasComponent() || - hasIndex(); - } - bool hasLocation() const - { - return layoutLocation != layoutLocationEnd; - } - bool hasComponent() const - { - return layoutComponent != layoutComponentEnd; - } - bool hasIndex() const - { - return layoutIndex != layoutIndexEnd; - } - bool hasSet() const - { - return layoutSet != layoutSetEnd; - } - bool hasBinding() const - { - return layoutBinding != layoutBindingEnd; - } - bool hasStream() const - { - return layoutStream != layoutStreamEnd; - } - bool hasFormat() const - { - return layoutFormat != ElfNone; - } - bool hasXfb() const - { - return hasXfbBuffer() || - hasXfbStride() || - hasXfbOffset(); - } - bool hasXfbBuffer() const - { - return layoutXfbBuffer != layoutXfbBufferEnd; - } - bool hasXfbStride() const - { - return layoutXfbStride != layoutXfbStrideEnd; - } - bool hasXfbOffset() const - { - return layoutXfbOffset != layoutXfbOffsetEnd; - } - bool hasAttachment() const - { - return layoutAttachment != layoutAttachmentEnd; - } - bool hasSpecConstantId() const - { - // Not the same thing as being a specialization constant, this - // is just whether or not it was declared with an ID. - return layoutSpecConstantId != layoutSpecConstantIdEnd; - } - bool isSpecConstant() const - { - // True if type is a specialization constant, whether or not it - // had a specialization-constant ID, and false if it is not a - // true front-end constant. - return specConstant; - } - bool isFrontEndConstant() const - { - // True if the front-end knows the final constant value. - // This allows front-end constant folding. - return storage == EvqConst && ! specConstant; - } - bool isConstant() const - { - // True if is either kind of constant; specialization or regular. - return isFrontEndConstant() || isSpecConstant(); - } - void makeSpecConstant() - { - storage = EvqConst; - specConstant = true; - } - static const char* getLayoutPackingString(TLayoutPacking packing) - { - switch (packing) { - case ElpPacked: return "packed"; - case ElpShared: return "shared"; - case ElpStd140: return "std140"; - case ElpStd430: return "std430"; - default: return "none"; - } - } - static const char* getLayoutMatrixString(TLayoutMatrix m) - { - switch (m) { - case ElmColumnMajor: return "column_major"; - case ElmRowMajor: return "row_major"; - default: return "none"; - } - } - static const char* getLayoutFormatString(TLayoutFormat f) - { - switch (f) { - case ElfRgba32f: return "rgba32f"; - case ElfRgba16f: return "rgba16f"; - case ElfRg32f: return "rg32f"; - case ElfRg16f: return "rg16f"; - case ElfR11fG11fB10f: return "r11f_g11f_b10f"; - case ElfR32f: return "r32f"; - case ElfR16f: return "r16f"; - case ElfRgba16: return "rgba16"; - case ElfRgb10A2: return "rgb10_a2"; - case ElfRgba8: return "rgba8"; - case ElfRg16: return "rg16"; - case ElfRg8: return "rg8"; - case ElfR16: return "r16"; - case ElfR8: return "r8"; - case ElfRgba16Snorm: return "rgba16_snorm"; - case ElfRgba8Snorm: return "rgba8_snorm"; - case ElfRg16Snorm: return "rg16_snorm"; - case ElfRg8Snorm: return "rg8_snorm"; - case ElfR16Snorm: return "r16_snorm"; - case ElfR8Snorm: return "r8_snorm"; - - case ElfRgba32i: return "rgba32i"; - case ElfRgba16i: return "rgba16i"; - case ElfRgba8i: return "rgba8i"; - case ElfRg32i: return "rg32i"; - case ElfRg16i: return "rg16i"; - case ElfRg8i: return "rg8i"; - case ElfR32i: return "r32i"; - case ElfR16i: return "r16i"; - case ElfR8i: return "r8i"; - - case ElfRgba32ui: return "rgba32ui"; - case ElfRgba16ui: return "rgba16ui"; - case ElfRgba8ui: return "rgba8ui"; - case ElfRg32ui: return "rg32ui"; - case ElfRg16ui: return "rg16ui"; - case ElfRgb10a2ui: return "rgb10_a2ui"; - case ElfRg8ui: return "rg8ui"; - case ElfR32ui: return "r32ui"; - case ElfR16ui: return "r16ui"; - case ElfR8ui: return "r8ui"; - default: return "none"; - } - } - static const char* getLayoutDepthString(TLayoutDepth d) - { - switch (d) { - case EldAny: return "depth_any"; - case EldGreater: return "depth_greater"; - case EldLess: return "depth_less"; - case EldUnchanged: return "depth_unchanged"; - default: return "none"; - } - } - static const char* getBlendEquationString(TBlendEquationShift e) - { - switch (e) { - case EBlendMultiply: return "blend_support_multiply"; - case EBlendScreen: return "blend_support_screen"; - case EBlendOverlay: return "blend_support_overlay"; - case EBlendDarken: return "blend_support_darken"; - case EBlendLighten: return "blend_support_lighten"; - case EBlendColordodge: return "blend_support_colordodge"; - case EBlendColorburn: return "blend_support_colorburn"; - case EBlendHardlight: return "blend_support_hardlight"; - case EBlendSoftlight: return "blend_support_softlight"; - case EBlendDifference: return "blend_support_difference"; - case EBlendExclusion: return "blend_support_exclusion"; - case EBlendHslHue: return "blend_support_hsl_hue"; - case EBlendHslSaturation: return "blend_support_hsl_saturation"; - case EBlendHslColor: return "blend_support_hsl_color"; - case EBlendHslLuminosity: return "blend_support_hsl_luminosity"; - case EBlendAllEquations: return "blend_support_all_equations"; - default: return "unknown"; - } - } - static const char* getGeometryString(TLayoutGeometry geometry) - { - switch (geometry) { - case ElgPoints: return "points"; - case ElgLines: return "lines"; - case ElgLinesAdjacency: return "lines_adjacency"; - case ElgLineStrip: return "line_strip"; - case ElgTriangles: return "triangles"; - case ElgTrianglesAdjacency: return "triangles_adjacency"; - case ElgTriangleStrip: return "triangle_strip"; - case ElgQuads: return "quads"; - case ElgIsolines: return "isolines"; - default: return "none"; - } - } - static const char* getVertexSpacingString(TVertexSpacing spacing) - { - switch (spacing) { - case EvsEqual: return "equal_spacing"; - case EvsFractionalEven: return "fractional_even_spacing"; - case EvsFractionalOdd: return "fractional_odd_spacing"; - default: return "none"; - } - } - static const char* getVertexOrderString(TVertexOrder order) - { - switch (order) { - case EvoCw: return "cw"; - case EvoCcw: return "ccw"; - default: return "none"; - } - } - static int mapGeometryToSize(TLayoutGeometry geometry) - { - switch (geometry) { - case ElgPoints: return 1; - case ElgLines: return 2; - case ElgLinesAdjacency: return 4; - case ElgTriangles: return 3; - case ElgTrianglesAdjacency: return 6; - default: return 0; - } - } -}; - -// Qualifiers that don't need to be keep per object. They have shader scope, not object scope. -// So, they will not be part of TType, TQualifier, etc. -struct TShaderQualifiers { - TLayoutGeometry geometry; // geometry/tessellation shader in/out primitives - bool pixelCenterInteger; // fragment shader - bool originUpperLeft; // fragment shader - int invocations; - int vertices; // both for tessellation "vertices" and geometry "max_vertices" - TVertexSpacing spacing; - TVertexOrder order; - bool pointMode; - int localSize[3]; // compute shader - int localSizeSpecId[3]; // compute shader specialization id for gl_WorkGroupSize - bool earlyFragmentTests; // fragment input - bool postDepthCoverage; // fragment input - TLayoutDepth layoutDepth; - bool blendEquation; // true if any blend equation was specified - int numViews; // multiview extenstions - -#ifdef NV_EXTENSIONS - bool layoutOverrideCoverage; // true if layout override_coverage set -#endif - - void init() - { - geometry = ElgNone; - originUpperLeft = false; - pixelCenterInteger = false; - invocations = TQualifier::layoutNotSet; - vertices = TQualifier::layoutNotSet; - spacing = EvsNone; - order = EvoNone; - pointMode = false; - localSize[0] = 1; - localSize[1] = 1; - localSize[2] = 1; - localSizeSpecId[0] = TQualifier::layoutNotSet; - localSizeSpecId[1] = TQualifier::layoutNotSet; - localSizeSpecId[2] = TQualifier::layoutNotSet; - earlyFragmentTests = false; - postDepthCoverage = false; - layoutDepth = EldNone; - blendEquation = false; - numViews = TQualifier::layoutNotSet; -#ifdef NV_EXTENSIONS - layoutOverrideCoverage = false; -#endif - } - - // Merge in characteristics from the 'src' qualifier. They can override when - // set, but never erase when not set. - void merge(const TShaderQualifiers& src) - { - if (src.geometry != ElgNone) - geometry = src.geometry; - if (src.pixelCenterInteger) - pixelCenterInteger = src.pixelCenterInteger; - if (src.originUpperLeft) - originUpperLeft = src.originUpperLeft; - if (src.invocations != TQualifier::layoutNotSet) - invocations = src.invocations; - if (src.vertices != TQualifier::layoutNotSet) - vertices = src.vertices; - if (src.spacing != EvsNone) - spacing = src.spacing; - if (src.order != EvoNone) - order = src.order; - if (src.pointMode) - pointMode = true; - for (int i = 0; i < 3; ++i) { - if (src.localSize[i] > 1) - localSize[i] = src.localSize[i]; - } - for (int i = 0; i < 3; ++i) { - if (src.localSizeSpecId[i] != TQualifier::layoutNotSet) - localSizeSpecId[i] = src.localSizeSpecId[i]; - } - if (src.earlyFragmentTests) - earlyFragmentTests = true; - if (src.postDepthCoverage) - postDepthCoverage = true; - if (src.layoutDepth) - layoutDepth = src.layoutDepth; - if (src.blendEquation) - blendEquation = src.blendEquation; - if (src.numViews != TQualifier::layoutNotSet) - numViews = src.numViews; -#ifdef NV_EXTENSIONS - if (src.layoutOverrideCoverage) - layoutOverrideCoverage = src.layoutOverrideCoverage; -#endif - } -}; - -// -// TPublicType is just temporarily used while parsing and not quite the same -// information kept per node in TType. Due to the bison stack, it can't have -// types that it thinks have non-trivial constructors. It should -// just be used while recognizing the grammar, not anything else. -// Once enough is known about the situation, the proper information -// moved into a TType, or the parse context, etc. -// -class TPublicType { -public: - TBasicType basicType; - TSampler sampler; - TQualifier qualifier; - TShaderQualifiers shaderQualifiers; - int vectorSize : 4; - int matrixCols : 4; - int matrixRows : 4; - TArraySizes* arraySizes; - const TType* userDef; - TSourceLoc loc; - - void initType(const TSourceLoc& l) - { - basicType = EbtVoid; - vectorSize = 1; - matrixRows = 0; - matrixCols = 0; - arraySizes = nullptr; - userDef = nullptr; - loc = l; - } - - void initQualifiers(bool global = false) - { - qualifier.clear(); - if (global) - qualifier.storage = EvqGlobal; - } - - void init(const TSourceLoc& l, bool global = false) - { - initType(l); - sampler.clear(); - initQualifiers(global); - shaderQualifiers.init(); - } - - void setVector(int s) - { - matrixRows = 0; - matrixCols = 0; - vectorSize = s; - } - - void setMatrix(int c, int r) - { - matrixRows = r; - matrixCols = c; - vectorSize = 0; - } - - bool isScalar() const - { - return matrixCols == 0 && vectorSize == 1 && arraySizes == nullptr && userDef == nullptr; - } - - // "Image" is a superset of "Subpass" - bool isImage() const { return basicType == EbtSampler && sampler.isImage(); } - bool isSubpass() const { return basicType == EbtSampler && sampler.isSubpass(); } -}; - -// -// Base class for things that have a type. -// -class TType { -public: - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - - // for "empty" type (no args) or simple scalar/vector/matrix - explicit TType(TBasicType t = EbtVoid, TStorageQualifier q = EvqTemporary, int vs = 1, int mc = 0, int mr = 0, - bool isVector = false) : - basicType(t), vectorSize(vs), matrixCols(mc), matrixRows(mr), vector1(isVector && vs == 1), - arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr) - { - sampler.clear(); - qualifier.clear(); - qualifier.storage = q; - assert(!(isMatrix() && vectorSize != 0)); // prevent vectorSize != 0 on matrices - } - // for explicit precision qualifier - TType(TBasicType t, TStorageQualifier q, TPrecisionQualifier p, int vs = 1, int mc = 0, int mr = 0, - bool isVector = false) : - basicType(t), vectorSize(vs), matrixCols(mc), matrixRows(mr), vector1(isVector && vs == 1), - arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr) - { - sampler.clear(); - qualifier.clear(); - qualifier.storage = q; - qualifier.precision = p; - assert(p >= EpqNone && p <= EpqHigh); - assert(!(isMatrix() && vectorSize != 0)); // prevent vectorSize != 0 on matrices - } - // for turning a TPublicType into a TType, using a shallow copy - explicit TType(const TPublicType& p) : - basicType(p.basicType), - vectorSize(p.vectorSize), matrixCols(p.matrixCols), matrixRows(p.matrixRows), vector1(false), - arraySizes(p.arraySizes), structure(nullptr), fieldName(nullptr), typeName(nullptr) - { - if (basicType == EbtSampler) - sampler = p.sampler; - else - sampler.clear(); - qualifier = p.qualifier; - if (p.userDef) { - structure = p.userDef->getWritableStruct(); // public type is short-lived; there are no sharing issues - typeName = NewPoolTString(p.userDef->getTypeName().c_str()); - } - } - // for construction of sampler types - TType(const TSampler& sampler, TStorageQualifier q = EvqUniform, TArraySizes* as = nullptr) : - basicType(EbtSampler), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), - arraySizes(as), structure(nullptr), fieldName(nullptr), typeName(nullptr), - sampler(sampler) - { - qualifier.clear(); - qualifier.storage = q; - } - // to efficiently make a dereferenced type - // without ever duplicating the outer structure that will be thrown away - // and using only shallow copy - TType(const TType& type, int derefIndex, bool rowMajor = false) - { - if (type.isArray()) { - shallowCopy(type); - if (type.getArraySizes()->getNumDims() == 1) { - arraySizes = nullptr; - } else { - // want our own copy of the array, so we can edit it - arraySizes = new TArraySizes; - arraySizes->copyDereferenced(*type.arraySizes); - } - } else if (type.basicType == EbtStruct || type.basicType == EbtBlock) { - // do a structure dereference - const TTypeList& memberList = *type.getStruct(); - shallowCopy(*memberList[derefIndex].type); - return; - } else { - // do a vector/matrix dereference - shallowCopy(type); - if (matrixCols > 0) { - // dereference from matrix to vector - if (rowMajor) - vectorSize = matrixCols; - else - vectorSize = matrixRows; - matrixCols = 0; - matrixRows = 0; - if (vectorSize == 1) - vector1 = true; - } else if (isVector()) { - // dereference from vector to scalar - vectorSize = 1; - vector1 = false; - } - } - } - // for making structures, ... - TType(TTypeList* userDef, const TString& n) : - basicType(EbtStruct), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), - arraySizes(nullptr), structure(userDef), fieldName(nullptr) - { - sampler.clear(); - qualifier.clear(); - typeName = NewPoolTString(n.c_str()); - } - // For interface blocks - TType(TTypeList* userDef, const TString& n, const TQualifier& q) : - basicType(EbtBlock), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), - qualifier(q), arraySizes(nullptr), structure(userDef), fieldName(nullptr) - { - sampler.clear(); - typeName = NewPoolTString(n.c_str()); - } - virtual ~TType() {} - - // Not for use across pool pops; it will cause multiple instances of TType to point to the same information. - // This only works if that information (like a structure's list of types) does not change and - // the instances are sharing the same pool. - void shallowCopy(const TType& copyOf) - { - basicType = copyOf.basicType; - sampler = copyOf.sampler; - qualifier = copyOf.qualifier; - vectorSize = copyOf.vectorSize; - matrixCols = copyOf.matrixCols; - matrixRows = copyOf.matrixRows; - vector1 = copyOf.vector1; - arraySizes = copyOf.arraySizes; // copying the pointer only, not the contents - structure = copyOf.structure; - fieldName = copyOf.fieldName; - typeName = copyOf.typeName; - } - - // Make complete copy of the whole type graph rooted at 'copyOf'. - void deepCopy(const TType& copyOf) - { - TMap copied; // to enable copying a type graph as a graph, not a tree - deepCopy(copyOf, copied); - } - - // Recursively make temporary - void makeTemporary() - { - getQualifier().makeTemporary(); - - if (isStruct()) - for (unsigned int i = 0; i < structure->size(); ++i) - (*structure)[i].type->makeTemporary(); - } - - TType* clone() const - { - TType *newType = new TType(); - newType->deepCopy(*this); - - return newType; - } - - void makeVector() { vector1 = true; } - - // Merge type from parent, where a parentType is at the beginning of a declaration, - // establishing some characteristics for all subsequent names, while this type - // is on the individual names. - void mergeType(const TPublicType& parentType) - { - // arrayness is currently the only child aspect that has to be preserved - basicType = parentType.basicType; - vectorSize = parentType.vectorSize; - matrixCols = parentType.matrixCols; - matrixRows = parentType.matrixRows; - vector1 = false; // TPublicType is only GLSL which so far has no vec1 - qualifier = parentType.qualifier; - sampler = parentType.sampler; - if (parentType.arraySizes) - newArraySizes(*parentType.arraySizes); - if (parentType.userDef) { - structure = parentType.userDef->getWritableStruct(); - setTypeName(parentType.userDef->getTypeName()); - } - } - - virtual void hideMember() { basicType = EbtVoid; vectorSize = 1; } - virtual bool hiddenMember() const { return basicType == EbtVoid; } - - virtual void setTypeName(const TString& n) { typeName = NewPoolTString(n.c_str()); } - virtual void setFieldName(const TString& n) { fieldName = NewPoolTString(n.c_str()); } - virtual const TString& getTypeName() const - { - assert(typeName); - return *typeName; - } - - virtual const TString& getFieldName() const - { - assert(fieldName); - return *fieldName; - } - - virtual TBasicType getBasicType() const { return basicType; } - virtual const TSampler& getSampler() const { return sampler; } - virtual TSampler& getSampler() { return sampler; } - - virtual TQualifier& getQualifier() { return qualifier; } - virtual const TQualifier& getQualifier() const { return qualifier; } - - virtual int getVectorSize() const { return vectorSize; } // returns 1 for either scalar or vector of size 1, valid for both - virtual int getMatrixCols() const { return matrixCols; } - virtual int getMatrixRows() const { return matrixRows; } - virtual int getOuterArraySize() const { return arraySizes->getOuterSize(); } - virtual TIntermTyped* getOuterArrayNode() const { return arraySizes->getOuterNode(); } - virtual int getCumulativeArraySize() const { return arraySizes->getCumulativeSize(); } - virtual bool isArrayOfArrays() const { return arraySizes != nullptr && arraySizes->getNumDims() > 1; } - virtual int getImplicitArraySize() const { return arraySizes->getImplicitSize(); } - virtual const TArraySizes* getArraySizes() const { return arraySizes; } - virtual TArraySizes& getArraySizes() { assert(arraySizes != nullptr); return *arraySizes; } - - virtual bool isScalar() const { return ! isVector() && ! isMatrix() && ! isStruct() && ! isArray(); } - virtual bool isScalarOrVec1() const { return isScalar() || vector1; } - virtual bool isVector() const { return vectorSize > 1 || vector1; } - virtual bool isMatrix() const { return matrixCols ? true : false; } - virtual bool isArray() const { return arraySizes != nullptr; } - virtual bool isExplicitlySizedArray() const { return isArray() && getOuterArraySize() != UnsizedArraySize; } - virtual bool isImplicitlySizedArray() const { return isArray() && getOuterArraySize() == UnsizedArraySize && qualifier.storage != EvqBuffer; } - virtual bool isRuntimeSizedArray() const { return isArray() && getOuterArraySize() == UnsizedArraySize && qualifier.storage == EvqBuffer; } - virtual bool isStruct() const { return structure != nullptr; } -#ifdef AMD_EXTENSIONS - virtual bool isFloatingDomain() const { return basicType == EbtFloat || basicType == EbtDouble || basicType == EbtFloat16; } -#else - virtual bool isFloatingDomain() const { return basicType == EbtFloat || basicType == EbtDouble; } -#endif - virtual bool isIntegerDomain() const - { - switch (basicType) { - case EbtInt: - case EbtUint: - case EbtInt64: - case EbtUint64: -#ifdef AMD_EXTENSIONS - case EbtInt16: - case EbtUint16: -#endif - case EbtAtomicUint: - return true; - default: - break; - } - return false; - } - virtual bool isOpaque() const { return basicType == EbtSampler || basicType == EbtAtomicUint; } - virtual bool isBuiltIn() const { return getQualifier().builtIn != EbvNone; } - - // "Image" is a superset of "Subpass" - virtual bool isImage() const { return basicType == EbtSampler && getSampler().isImage(); } - virtual bool isSubpass() const { return basicType == EbtSampler && getSampler().isSubpass(); } - - // return true if this type contains any subtype which satisfies the given predicate. - template - bool contains(P predicate) const - { - if (predicate(this)) - return true; - - const auto hasa = [predicate](const TTypeLoc& tl) { return tl.type->contains(predicate); }; - - return structure && std::any_of(structure->begin(), structure->end(), hasa); - } - - // Recursively checks if the type contains the given basic type - virtual bool containsBasicType(TBasicType checkType) const - { - return contains([checkType](const TType* t) { return t->basicType == checkType; } ); - } - - // Recursively check the structure for any arrays, needed for some error checks - virtual bool containsArray() const - { - return contains([](const TType* t) { return t->isArray(); } ); - } - - // Check the structure for any structures, needed for some error checks - virtual bool containsStructure() const - { - return contains([this](const TType* t) { return t != this && t->isStruct(); } ); - } - - // Recursively check the structure for any implicitly-sized arrays, needed for triggering a copyUp(). - virtual bool containsImplicitlySizedArray() const - { - return contains([](const TType* t) { return t->isImplicitlySizedArray(); } ); - } - - virtual bool containsOpaque() const - { - return contains([](const TType* t) { return t->isOpaque(); } ); - } - - // Recursively checks if the type contains a built-in variable - virtual bool containsBuiltIn() const - { - return contains([](const TType* t) { return t->isBuiltIn(); } ); - } - - virtual bool containsNonOpaque() const - { - const auto nonOpaque = [](const TType* t) { - switch (t->basicType) { - case EbtVoid: - case EbtFloat: - case EbtDouble: -#ifdef AMD_EXTENSIONS - case EbtFloat16: -#endif - case EbtInt: - case EbtUint: - case EbtInt64: - case EbtUint64: -#ifdef AMD_EXTENSIONS - case EbtInt16: - case EbtUint16: -#endif - case EbtBool: - return true; - default: - return false; - } - }; - - return contains(nonOpaque); - } - - virtual bool containsSpecializationSize() const - { - return contains([](const TType* t) { return t->isArray() && t->arraySizes->isOuterSpecialization(); } ); - } - - // Array editing methods. Array descriptors can be shared across - // type instances. This allows all uses of the same array - // to be updated at once. E.g., all nodes can be explicitly sized - // by tracking and correcting one implicit size. Or, all nodes - // can get the explicit size on a redeclaration that gives size. - // - // N.B.: Don't share with the shared symbol tables (symbols are - // marked as isReadOnly(). Such symbols with arrays that will be - // edited need to copyUp() on first use, so that - // A) the edits don't effect the shared symbol table, and - // B) the edits are shared across all users. - void updateArraySizes(const TType& type) - { - // For when we may already be sharing existing array descriptors, - // keeping the pointers the same, just updating the contents. - assert(arraySizes != nullptr); - assert(type.arraySizes != nullptr); - *arraySizes = *type.arraySizes; - } - void newArraySizes(const TArraySizes& s) - { - // For setting a fresh new set of array sizes, not yet worrying about sharing. - arraySizes = new TArraySizes; - *arraySizes = s; - } - void clearArraySizes() - { - arraySizes = 0; - } - void addArrayOuterSizes(const TArraySizes& s) - { - if (arraySizes == nullptr) - newArraySizes(s); - else - arraySizes->addOuterSizes(s); - } - void changeOuterArraySize(int s) { arraySizes->changeOuterSize(s); } - void setImplicitArraySize(int s) { arraySizes->setImplicitSize(s); } - - // Recursively make the implicit array size the explicit array size, through the type tree. - void adoptImplicitArraySizes() - { - if (isImplicitlySizedArray()) - changeOuterArraySize(getImplicitArraySize()); - if (isStruct()) { - for (int i = 0; i < (int)structure->size(); ++i) - (*structure)[i].type->adoptImplicitArraySizes(); - } - } - - const char* getBasicString() const - { - return TType::getBasicString(basicType); - } - - static const char* getBasicString(TBasicType t) - { - switch (t) { - case EbtVoid: return "void"; - case EbtFloat: return "float"; - case EbtDouble: return "double"; -#ifdef AMD_EXTENSIONS - case EbtFloat16: return "float16_t"; -#endif - case EbtInt: return "int"; - case EbtUint: return "uint"; - case EbtInt64: return "int64_t"; - case EbtUint64: return "uint64_t"; -#ifdef AMD_EXTENSIONS - case EbtInt16: return "int16_t"; - case EbtUint16: return "uint16_t"; -#endif - case EbtBool: return "bool"; - case EbtAtomicUint: return "atomic_uint"; - case EbtSampler: return "sampler/image"; - case EbtStruct: return "structure"; - case EbtBlock: return "block"; - default: return "unknown type"; - } - } - - TString getCompleteString() const - { - TString typeString; - - const auto appendStr = [&](const char* s) { typeString.append(s); }; - const auto appendUint = [&](unsigned int u) { typeString.append(std::to_string(u).c_str()); }; - const auto appendInt = [&](int i) { typeString.append(std::to_string(i).c_str()); }; - - if (qualifier.hasLayout()) { - // To reduce noise, skip this if the only layout is an xfb_buffer - // with no triggering xfb_offset. - TQualifier noXfbBuffer = qualifier; - noXfbBuffer.layoutXfbBuffer = TQualifier::layoutXfbBufferEnd; - if (noXfbBuffer.hasLayout()) { - appendStr("layout("); - if (qualifier.hasAnyLocation()) { - appendStr(" location="); - appendUint(qualifier.layoutLocation); - if (qualifier.hasComponent()) { - appendStr(" component="); - appendUint(qualifier.layoutComponent); - } - if (qualifier.hasIndex()) { - appendStr(" index="); - appendUint(qualifier.layoutIndex); - } - } - if (qualifier.hasSet()) { - appendStr(" set="); - appendUint(qualifier.layoutSet); - } - if (qualifier.hasBinding()) { - appendStr(" binding="); - appendUint(qualifier.layoutBinding); - } - if (qualifier.hasStream()) { - appendStr(" stream="); - appendUint(qualifier.layoutStream); - } - if (qualifier.hasMatrix()) { - appendStr(" "); - appendStr(TQualifier::getLayoutMatrixString(qualifier.layoutMatrix)); - } - if (qualifier.hasPacking()) { - appendStr(" "); - appendStr(TQualifier::getLayoutPackingString(qualifier.layoutPacking)); - } - if (qualifier.hasOffset()) { - appendStr(" offset="); - appendInt(qualifier.layoutOffset); - } - if (qualifier.hasAlign()) { - appendStr(" align="); - appendInt(qualifier.layoutAlign); - } - if (qualifier.hasFormat()) { - appendStr(" "); - appendStr(TQualifier::getLayoutFormatString(qualifier.layoutFormat)); - } - if (qualifier.hasXfbBuffer() && qualifier.hasXfbOffset()) { - appendStr(" xfb_buffer="); - appendUint(qualifier.layoutXfbBuffer); - } - if (qualifier.hasXfbOffset()) { - appendStr(" xfb_offset="); - appendUint(qualifier.layoutXfbOffset); - } - if (qualifier.hasXfbStride()) { - appendStr(" xfb_stride="); - appendUint(qualifier.layoutXfbStride); - } - if (qualifier.hasAttachment()) { - appendStr(" input_attachment_index="); - appendUint(qualifier.layoutAttachment); - } - if (qualifier.hasSpecConstantId()) { - appendStr(" constant_id="); - appendUint(qualifier.layoutSpecConstantId); - } - if (qualifier.layoutPushConstant) - appendStr(" push_constant"); - -#ifdef NV_EXTENSIONS - if (qualifier.layoutPassthrough) - appendStr(" passthrough"); - if (qualifier.layoutViewportRelative) - appendStr(" layoutViewportRelative"); - if (qualifier.layoutSecondaryViewportRelativeOffset != -2048) { - appendStr(" layoutSecondaryViewportRelativeOffset="); - appendInt(qualifier.layoutSecondaryViewportRelativeOffset); - } -#endif - - appendStr(")"); - } - } - - if (qualifier.invariant) - appendStr(" invariant"); - if (qualifier.noContraction) - appendStr(" noContraction"); - if (qualifier.centroid) - appendStr(" centroid"); - if (qualifier.smooth) - appendStr(" smooth"); - if (qualifier.flat) - appendStr(" flat"); - if (qualifier.nopersp) - appendStr(" noperspective"); -#ifdef AMD_EXTENSIONS - if (qualifier.explicitInterp) - appendStr(" __explicitInterpAMD"); -#endif - if (qualifier.patch) - appendStr(" patch"); - if (qualifier.sample) - appendStr(" sample"); - if (qualifier.coherent) - appendStr(" coherent"); - if (qualifier.volatil) - appendStr(" volatile"); - if (qualifier.restrict) - appendStr(" restrict"); - if (qualifier.readonly) - appendStr(" readonly"); - if (qualifier.writeonly) - appendStr(" writeonly"); - if (qualifier.specConstant) - appendStr(" specialization-constant"); - appendStr(" "); - appendStr(getStorageQualifierString()); - if (isArray()) { - for(int i = 0; i < (int)arraySizes->getNumDims(); ++i) { - int size = arraySizes->getDimSize(i); - if (size == 0) - appendStr(" implicitly-sized array of"); - else { - appendStr(" "); - appendInt(arraySizes->getDimSize(i)); - appendStr("-element array of"); - } - } - } - if (qualifier.precision != EpqNone) { - appendStr(" "); - appendStr(getPrecisionQualifierString()); - } - if (isMatrix()) { - appendStr(" "); - appendInt(matrixCols); - appendStr("X"); - appendInt(matrixRows); - appendStr(" matrix of"); - } else if (isVector()) { - appendStr(" "); - appendInt(vectorSize); - appendStr("-component vector of"); - } - - appendStr(" "); - typeString.append(getBasicTypeString()); - - if (qualifier.builtIn != EbvNone) { - appendStr(" "); - appendStr(getBuiltInVariableString()); - } - - // Add struct/block members - if (structure) { - appendStr("{"); - for (size_t i = 0; i < structure->size(); ++i) { - if (! (*structure)[i].type->hiddenMember()) { - typeString.append((*structure)[i].type->getCompleteString()); - typeString.append(" "); - typeString.append((*structure)[i].type->getFieldName()); - if (i < structure->size() - 1) - appendStr(", "); - } - } - appendStr("}"); - } - - return typeString; - } - - TString getBasicTypeString() const - { - if (basicType == EbtSampler) - return sampler.getString(); - else - return getBasicString(); - } - - const char* getStorageQualifierString() const { return GetStorageQualifierString(qualifier.storage); } - const char* getBuiltInVariableString() const { return GetBuiltInVariableString(qualifier.builtIn); } - const char* getPrecisionQualifierString() const { return GetPrecisionQualifierString(qualifier.precision); } - const TTypeList* getStruct() const { return structure; } - void setStruct(TTypeList* s) { structure = s; } - TTypeList* getWritableStruct() const { return structure; } // This should only be used when known to not be sharing with other threads - - int computeNumComponents() const - { - int components = 0; - - if (getBasicType() == EbtStruct || getBasicType() == EbtBlock) { - for (TTypeList::const_iterator tl = getStruct()->begin(); tl != getStruct()->end(); tl++) - components += ((*tl).type)->computeNumComponents(); - } else if (matrixCols) - components = matrixCols * matrixRows; - else - components = vectorSize; - - if (arraySizes != nullptr) { - components *= arraySizes->getCumulativeSize(); - } - - return components; - } - - // append this type's mangled name to the passed in 'name' - void appendMangledName(TString& name) const - { - buildMangledName(name); - name += ';' ; - } - - // Do two structure types match? They could be declared independently, - // in different places, but still might satisfy the definition of matching. - // From the spec: - // - // "Structures must have the same name, sequence of type names, and - // type definitions, and member names to be considered the same type. - // This rule applies recursively for nested or embedded types." - // - bool sameStructType(const TType& right) const - { - // Most commonly, they are both nullptr, or the same pointer to the same actual structure - if (structure == right.structure) - return true; - - // Both being nullptr was caught above, now they both have to be structures of the same number of elements - if (structure == nullptr || right.structure == nullptr || - structure->size() != right.structure->size()) - return false; - - // Structure names have to match - if (*typeName != *right.typeName) - return false; - - // Compare the names and types of all the members, which have to match - for (unsigned int i = 0; i < structure->size(); ++i) { - if ((*structure)[i].type->getFieldName() != (*right.structure)[i].type->getFieldName()) - return false; - - if (*(*structure)[i].type != *(*right.structure)[i].type) - return false; - } - - return true; - } - - // See if two types match, in all aspects except arrayness - bool sameElementType(const TType& right) const - { - return basicType == right.basicType && sameElementShape(right); - } - - // See if two type's arrayness match - bool sameArrayness(const TType& right) const - { - return ((arraySizes == nullptr && right.arraySizes == nullptr) || - (arraySizes != nullptr && right.arraySizes != nullptr && *arraySizes == *right.arraySizes)); - } - - // See if two type's arrayness match in everything except their outer dimension - bool sameInnerArrayness(const TType& right) const - { - assert(arraySizes != nullptr && right.arraySizes != nullptr); - return arraySizes->sameInnerArrayness(*right.arraySizes); - } - - // See if two type's elements match in all ways except basic type - bool sameElementShape(const TType& right) const - { - return sampler == right.sampler && - vectorSize == right.vectorSize && - matrixCols == right.matrixCols && - matrixRows == right.matrixRows && - vector1 == right.vector1 && - sameStructType(right); - } - - // See if two types match in all ways (just the actual type, not qualification) - bool operator==(const TType& right) const - { - return sameElementType(right) && sameArrayness(right); - } - - bool operator!=(const TType& right) const - { - return ! operator==(right); - } - -protected: - // Require consumer to pick between deep copy and shallow copy. - TType(const TType& type); - TType& operator=(const TType& type); - - // Recursively copy a type graph, while preserving the graph-like - // quality. That is, don't make more than one copy of a structure that - // gets reused multiple times in the type graph. - void deepCopy(const TType& copyOf, TMap& copiedMap) - { - shallowCopy(copyOf); - - if (copyOf.arraySizes) { - arraySizes = new TArraySizes; - *arraySizes = *copyOf.arraySizes; - } - - if (copyOf.structure) { - auto prevCopy = copiedMap.find(copyOf.structure); - if (prevCopy != copiedMap.end()) - structure = prevCopy->second; - else { - structure = new TTypeList; - copiedMap[copyOf.structure] = structure; - for (unsigned int i = 0; i < copyOf.structure->size(); ++i) { - TTypeLoc typeLoc; - typeLoc.loc = (*copyOf.structure)[i].loc; - typeLoc.type = new TType(); - typeLoc.type->deepCopy(*(*copyOf.structure)[i].type, copiedMap); - structure->push_back(typeLoc); - } - } - } - - if (copyOf.fieldName) - fieldName = NewPoolTString(copyOf.fieldName->c_str()); - if (copyOf.typeName) - typeName = NewPoolTString(copyOf.typeName->c_str()); - } - - - void buildMangledName(TString&) const; - - TBasicType basicType : 8; - int vectorSize : 4; // 1 means either scalar or 1-component vector; see vector1 to disambiguate. - int matrixCols : 4; - int matrixRows : 4; - bool vector1 : 1; // Backward-compatible tracking of a 1-component vector distinguished from a scalar. - // GLSL 4.5 never has a 1-component vector; so this will always be false until such - // functionality is added. - // HLSL does have a 1-component vectors, so this will be true to disambiguate - // from a scalar. - TQualifier qualifier; - - TArraySizes* arraySizes; // nullptr unless an array; can be shared across types - TTypeList* structure; // nullptr unless this is a struct; can be shared across types - TString *fieldName; // for structure field names - TString *typeName; // for structure type name - TSampler sampler; -}; - -} // end namespace glslang - -#endif // _TYPES_INCLUDED_ diff --git a/love/src/jni/love/src/libraries/glslang/glslang/Include/arrays.h b/love/src/jni/love/src/libraries/glslang/glslang/Include/arrays.h deleted file mode 100644 index 1660a99f..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/Include/arrays.h +++ /dev/null @@ -1,329 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2012-2013 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -// -// Implement types for tracking GLSL arrays, arrays of arrays, etc. -// - -#ifndef _ARRAYS_INCLUDED -#define _ARRAYS_INCLUDED - -namespace glslang { - -// This is used to mean there is no size yet (unsized), it is waiting to get a size from somewhere else. -const int UnsizedArraySize = 0; - -class TIntermTyped; -extern bool SameSpecializationConstants(TIntermTyped*, TIntermTyped*); - -// Specialization constants need both a nominal size and a node that defines -// the specialization constant being used. Array types are the same when their -// size and specialization constant nodes are the same. -struct TArraySize { - unsigned int size; - TIntermTyped* node; // nullptr means no specialization constant node - bool operator==(const TArraySize& rhs) const - { - if (size != rhs.size) - return false; - if (node == nullptr || rhs.node == nullptr) - return node == rhs.node; - - return SameSpecializationConstants(node, rhs.node); - } -}; - -// -// TSmallArrayVector is used as the container for the set of sizes in TArraySizes. -// It has generic-container semantics, while TArraySizes has array-of-array semantics. -// That is, TSmallArrayVector should be more focused on mechanism and TArraySizes on policy. -// -struct TSmallArrayVector { - // - // TODO: memory: TSmallArrayVector is intended to be smaller. - // Almost all arrays could be handled by two sizes each fitting - // in 16 bits, needing a real vector only in the cases where there - // are more than 3 sizes or a size needing more than 16 bits. - // - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - - TSmallArrayVector() : sizes(nullptr) { } - virtual ~TSmallArrayVector() { dealloc(); } - - // For breaking into two non-shared copies, independently modifiable. - TSmallArrayVector& operator=(const TSmallArrayVector& from) - { - if (from.sizes == nullptr) - sizes = nullptr; - else { - alloc(); - *sizes = *from.sizes; - } - - return *this; - } - - int size() const - { - if (sizes == nullptr) - return 0; - return (int)sizes->size(); - } - - unsigned int frontSize() const - { - assert(sizes != nullptr && sizes->size() > 0); - return sizes->front().size; - } - - TIntermTyped* frontNode() const - { - assert(sizes != nullptr && sizes->size() > 0); - return sizes->front().node; - } - - void changeFront(unsigned int s) - { - assert(sizes != nullptr); - // this should only happen for implicitly sized arrays, not specialization constants - assert(sizes->front().node == nullptr); - sizes->front().size = s; - } - - void push_back(unsigned int e, TIntermTyped* n) - { - alloc(); - TArraySize pair = { e, n }; - sizes->push_back(pair); - } - - void push_front(const TSmallArrayVector& newDims) - { - alloc(); - sizes->insert(sizes->begin(), newDims.sizes->begin(), newDims.sizes->end()); - } - - void pop_front() - { - assert(sizes != nullptr && sizes->size() > 0); - if (sizes->size() == 1) - dealloc(); - else - sizes->erase(sizes->begin()); - } - - // 'this' should currently not be holding anything, and copyNonFront - // will make it hold a copy of all but the first element of rhs. - // (This would be useful for making a type that is dereferenced by - // one dimension.) - void copyNonFront(const TSmallArrayVector& rhs) - { - assert(sizes == nullptr); - if (rhs.size() > 1) { - alloc(); - sizes->insert(sizes->begin(), rhs.sizes->begin() + 1, rhs.sizes->end()); - } - } - - unsigned int getDimSize(int i) const - { - assert(sizes != nullptr && (int)sizes->size() > i); - return (*sizes)[i].size; - } - - void setDimSize(int i, unsigned int size) const - { - assert(sizes != nullptr && (int)sizes->size() > i); - assert((*sizes)[i].node == nullptr); - (*sizes)[i].size = size; - } - - TIntermTyped* getDimNode(int i) const - { - assert(sizes != nullptr && (int)sizes->size() > i); - return (*sizes)[i].node; - } - - bool operator==(const TSmallArrayVector& rhs) const - { - if (sizes == nullptr && rhs.sizes == nullptr) - return true; - if (sizes == nullptr || rhs.sizes == nullptr) - return false; - return *sizes == *rhs.sizes; - } - bool operator!=(const TSmallArrayVector& rhs) const { return ! operator==(rhs); } - -protected: - TSmallArrayVector(const TSmallArrayVector&); - - void alloc() - { - if (sizes == nullptr) - sizes = new TVector; - } - void dealloc() - { - delete sizes; - sizes = nullptr; - } - - TVector* sizes; // will either hold such a pointer, or in the future, hold the two array sizes -}; - -// -// Represent an array, or array of arrays, to arbitrary depth. This is not -// done through a hierarchy of types in a type tree, rather all contiguous arrayness -// in the type hierarchy is localized into this single cumulative object. -// -// The arrayness in TTtype is a pointer, so that it can be non-allocated and zero -// for the vast majority of types that are non-array types. -// -// Order Policy: these are all identical: -// - left to right order within a contiguous set of ...[..][..][..]... in the source language -// - index order 0, 1, 2, ... within the 'sizes' member below -// - outer-most to inner-most -// -struct TArraySizes { - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - - TArraySizes() : implicitArraySize(1) { } - - // For breaking into two non-shared copies, independently modifiable. - TArraySizes& operator=(const TArraySizes& from) - { - implicitArraySize = from.implicitArraySize; - sizes = from.sizes; - - return *this; - } - - // translate from array-of-array semantics to container semantics - int getNumDims() const { return sizes.size(); } - int getDimSize(int dim) const { return sizes.getDimSize(dim); } - TIntermTyped* getDimNode(int dim) const { return sizes.getDimNode(dim); } - void setDimSize(int dim, int size) { sizes.setDimSize(dim, size); } - int getOuterSize() const { return sizes.frontSize(); } - TIntermTyped* getOuterNode() const { return sizes.frontNode(); } - int getCumulativeSize() const - { - int size = 1; - for (int d = 0; d < sizes.size(); ++d) { - // this only makes sense in paths that have a known array size - assert(sizes.getDimSize(d) != UnsizedArraySize); - size *= sizes.getDimSize(d); - } - return size; - } - void addInnerSize() { addInnerSize((unsigned)UnsizedArraySize); } - void addInnerSize(int s) { addInnerSize((unsigned)s, nullptr); } - void addInnerSize(int s, TIntermTyped* n) { sizes.push_back((unsigned)s, n); } - void addInnerSize(TArraySize pair) { sizes.push_back(pair.size, pair.node); } - void changeOuterSize(int s) { sizes.changeFront((unsigned)s); } - int getImplicitSize() const { return (int)implicitArraySize; } - void setImplicitSize(int s) { implicitArraySize = s; } - bool isInnerImplicit() const - { - for (int d = 1; d < sizes.size(); ++d) { - if (sizes.getDimSize(d) == (unsigned)UnsizedArraySize) - return true; - } - - return false; - } - bool clearInnerImplicit() - { - for (int d = 1; d < sizes.size(); ++d) { - if (sizes.getDimSize(d) == (unsigned)UnsizedArraySize) - setDimSize(d, 1); - } - - return false; - } - bool isInnerSpecialization() const - { - for (int d = 1; d < sizes.size(); ++d) { - if (sizes.getDimNode(d) != nullptr) - return true; - } - - return false; - } - bool isOuterSpecialization() - { - return sizes.getDimNode(0) != nullptr; - } - - bool isImplicit() const { return getOuterSize() == UnsizedArraySize || isInnerImplicit(); } - void addOuterSizes(const TArraySizes& s) { sizes.push_front(s.sizes); } - void dereference() { sizes.pop_front(); } - void copyDereferenced(const TArraySizes& rhs) - { - assert(sizes.size() == 0); - if (rhs.sizes.size() > 1) - sizes.copyNonFront(rhs.sizes); - } - - bool sameInnerArrayness(const TArraySizes& rhs) const - { - if (sizes.size() != rhs.sizes.size()) - return false; - - for (int d = 1; d < sizes.size(); ++d) { - if (sizes.getDimSize(d) != rhs.sizes.getDimSize(d) || - sizes.getDimNode(d) != rhs.sizes.getDimNode(d)) - return false; - } - - return true; - } - - bool operator==(const TArraySizes& rhs) { return sizes == rhs.sizes; } - bool operator!=(const TArraySizes& rhs) { return sizes != rhs.sizes; } - -protected: - TSmallArrayVector sizes; - - TArraySizes(const TArraySizes&); - - // for tracking maximum referenced index, before an explicit size is given - // applies only to the outer-most dimension - int implicitArraySize; -}; - -} // end namespace glslang - -#endif // _ARRAYS_INCLUDED_ diff --git a/love/src/jni/love/src/libraries/glslang/glslang/Include/intermediate.h b/love/src/jni/love/src/libraries/glslang/glslang/Include/intermediate.h deleted file mode 100644 index 58760195..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/Include/intermediate.h +++ /dev/null @@ -1,1481 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2012-2016 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -// -// Definition of the in-memory high-level intermediate representation -// of shaders. This is a tree that parser creates. -// -// Nodes in the tree are defined as a hierarchy of classes derived from -// TIntermNode. Each is a node in a tree. There is no preset branching factor; -// each node can have it's own type of list of children. -// - -#ifndef __INTERMEDIATE_H -#define __INTERMEDIATE_H - -#if _MSC_VER >= 1900 - #pragma warning(disable : 4464) // relative include path contains '..' - #pragma warning(disable : 5026) // 'glslang::TIntermUnary': move constructor was implicitly defined as deleted -#endif - -#include "../Include/Common.h" -#include "../Include/Types.h" -#include "../Include/ConstantUnion.h" - -namespace glslang { - -class TIntermediate; - -// -// Operators used by the high-level (parse tree) representation. -// -enum TOperator { - EOpNull, // if in a node, should only mean a node is still being built - EOpSequence, // denotes a list of statements, or parameters, etc. - EOpLinkerObjects, // for aggregate node of objects the linker may need, if not reference by the rest of the AST - EOpFunctionCall, - EOpFunction, // For function definition - EOpParameters, // an aggregate listing the parameters to a function - - // - // Unary operators - // - - EOpNegative, - EOpLogicalNot, - EOpVectorLogicalNot, - EOpBitwiseNot, - - EOpPostIncrement, - EOpPostDecrement, - EOpPreIncrement, - EOpPreDecrement, - - EOpConvIntToBool, - EOpConvUintToBool, - EOpConvFloatToBool, - EOpConvDoubleToBool, - EOpConvInt64ToBool, - EOpConvUint64ToBool, - EOpConvBoolToFloat, - EOpConvIntToFloat, - EOpConvUintToFloat, - EOpConvDoubleToFloat, - EOpConvInt64ToFloat, - EOpConvUint64ToFloat, - EOpConvUintToInt, - EOpConvFloatToInt, - EOpConvBoolToInt, - EOpConvDoubleToInt, - EOpConvInt64ToInt, - EOpConvUint64ToInt, - EOpConvIntToUint, - EOpConvFloatToUint, - EOpConvBoolToUint, - EOpConvDoubleToUint, - EOpConvInt64ToUint, - EOpConvUint64ToUint, - EOpConvIntToDouble, - EOpConvUintToDouble, - EOpConvFloatToDouble, - EOpConvBoolToDouble, - EOpConvInt64ToDouble, - EOpConvUint64ToDouble, - EOpConvBoolToInt64, - EOpConvIntToInt64, - EOpConvUintToInt64, - EOpConvFloatToInt64, - EOpConvDoubleToInt64, - EOpConvUint64ToInt64, - EOpConvBoolToUint64, - EOpConvIntToUint64, - EOpConvUintToUint64, - EOpConvFloatToUint64, - EOpConvDoubleToUint64, - EOpConvInt64ToUint64, -#ifdef AMD_EXTENSIONS - EOpConvBoolToFloat16, - EOpConvIntToFloat16, - EOpConvUintToFloat16, - EOpConvFloatToFloat16, - EOpConvDoubleToFloat16, - EOpConvInt64ToFloat16, - EOpConvUint64ToFloat16, - EOpConvFloat16ToBool, - EOpConvFloat16ToInt, - EOpConvFloat16ToUint, - EOpConvFloat16ToFloat, - EOpConvFloat16ToDouble, - EOpConvFloat16ToInt64, - EOpConvFloat16ToUint64, - - EOpConvBoolToInt16, - EOpConvIntToInt16, - EOpConvUintToInt16, - EOpConvFloatToInt16, - EOpConvDoubleToInt16, - EOpConvFloat16ToInt16, - EOpConvInt64ToInt16, - EOpConvUint64ToInt16, - EOpConvUint16ToInt16, - EOpConvInt16ToBool, - EOpConvInt16ToInt, - EOpConvInt16ToUint, - EOpConvInt16ToFloat, - EOpConvInt16ToDouble, - EOpConvInt16ToFloat16, - EOpConvInt16ToInt64, - EOpConvInt16ToUint64, - - EOpConvBoolToUint16, - EOpConvIntToUint16, - EOpConvUintToUint16, - EOpConvFloatToUint16, - EOpConvDoubleToUint16, - EOpConvFloat16ToUint16, - EOpConvInt64ToUint16, - EOpConvUint64ToUint16, - EOpConvInt16ToUint16, - EOpConvUint16ToBool, - EOpConvUint16ToInt, - EOpConvUint16ToUint, - EOpConvUint16ToFloat, - EOpConvUint16ToDouble, - EOpConvUint16ToFloat16, - EOpConvUint16ToInt64, - EOpConvUint16ToUint64, -#endif - - // - // binary operations - // - - EOpAdd, - EOpSub, - EOpMul, - EOpDiv, - EOpMod, - EOpRightShift, - EOpLeftShift, - EOpAnd, - EOpInclusiveOr, - EOpExclusiveOr, - EOpEqual, - EOpNotEqual, - EOpVectorEqual, - EOpVectorNotEqual, - EOpLessThan, - EOpGreaterThan, - EOpLessThanEqual, - EOpGreaterThanEqual, - EOpComma, - - EOpVectorTimesScalar, - EOpVectorTimesMatrix, - EOpMatrixTimesVector, - EOpMatrixTimesScalar, - - EOpLogicalOr, - EOpLogicalXor, - EOpLogicalAnd, - - EOpIndexDirect, - EOpIndexIndirect, - EOpIndexDirectStruct, - - EOpVectorSwizzle, - - EOpMethod, - EOpScoping, - - // - // Built-in functions mapped to operators - // - - EOpRadians, - EOpDegrees, - EOpSin, - EOpCos, - EOpTan, - EOpAsin, - EOpAcos, - EOpAtan, - EOpSinh, - EOpCosh, - EOpTanh, - EOpAsinh, - EOpAcosh, - EOpAtanh, - - EOpPow, - EOpExp, - EOpLog, - EOpExp2, - EOpLog2, - EOpSqrt, - EOpInverseSqrt, - - EOpAbs, - EOpSign, - EOpFloor, - EOpTrunc, - EOpRound, - EOpRoundEven, - EOpCeil, - EOpFract, - EOpModf, - EOpMin, - EOpMax, - EOpClamp, - EOpMix, - EOpStep, - EOpSmoothStep, - - EOpIsNan, - EOpIsInf, - - EOpFma, - - EOpFrexp, - EOpLdexp, - - EOpFloatBitsToInt, - EOpFloatBitsToUint, - EOpIntBitsToFloat, - EOpUintBitsToFloat, - EOpDoubleBitsToInt64, - EOpDoubleBitsToUint64, - EOpInt64BitsToDouble, - EOpUint64BitsToDouble, -#ifdef AMD_EXTENSIONS - EOpFloat16BitsToInt16, - EOpFloat16BitsToUint16, - EOpInt16BitsToFloat16, - EOpUint16BitsToFloat16, -#endif - EOpPackSnorm2x16, - EOpUnpackSnorm2x16, - EOpPackUnorm2x16, - EOpUnpackUnorm2x16, - EOpPackSnorm4x8, - EOpUnpackSnorm4x8, - EOpPackUnorm4x8, - EOpUnpackUnorm4x8, - EOpPackHalf2x16, - EOpUnpackHalf2x16, - EOpPackDouble2x32, - EOpUnpackDouble2x32, - EOpPackInt2x32, - EOpUnpackInt2x32, - EOpPackUint2x32, - EOpUnpackUint2x32, -#ifdef AMD_EXTENSIONS - EOpPackFloat2x16, - EOpUnpackFloat2x16, - EOpPackInt2x16, - EOpUnpackInt2x16, - EOpPackUint2x16, - EOpUnpackUint2x16, - EOpPackInt4x16, - EOpUnpackInt4x16, - EOpPackUint4x16, - EOpUnpackUint4x16, -#endif - - EOpLength, - EOpDistance, - EOpDot, - EOpCross, - EOpNormalize, - EOpFaceForward, - EOpReflect, - EOpRefract, - -#ifdef AMD_EXTENSIONS - EOpMin3, - EOpMax3, - EOpMid3, -#endif - - EOpDPdx, // Fragment only - EOpDPdy, // Fragment only - EOpFwidth, // Fragment only - EOpDPdxFine, // Fragment only - EOpDPdyFine, // Fragment only - EOpFwidthFine, // Fragment only - EOpDPdxCoarse, // Fragment only - EOpDPdyCoarse, // Fragment only - EOpFwidthCoarse, // Fragment only - - EOpInterpolateAtCentroid, // Fragment only - EOpInterpolateAtSample, // Fragment only - EOpInterpolateAtOffset, // Fragment only - -#ifdef AMD_EXTENSIONS - EOpInterpolateAtVertex, -#endif - - EOpMatrixTimesMatrix, - EOpOuterProduct, - EOpDeterminant, - EOpMatrixInverse, - EOpTranspose, - - EOpFtransform, - - EOpNoise, - - EOpEmitVertex, // geometry only - EOpEndPrimitive, // geometry only - EOpEmitStreamVertex, // geometry only - EOpEndStreamPrimitive, // geometry only - - EOpBarrier, - EOpMemoryBarrier, - EOpMemoryBarrierAtomicCounter, - EOpMemoryBarrierBuffer, - EOpMemoryBarrierImage, - EOpMemoryBarrierShared, // compute only - EOpGroupMemoryBarrier, // compute only - - EOpBallot, - EOpReadInvocation, - EOpReadFirstInvocation, - - EOpAnyInvocation, - EOpAllInvocations, - EOpAllInvocationsEqual, - -#ifdef AMD_EXTENSIONS - EOpMinInvocations, - EOpMaxInvocations, - EOpAddInvocations, - EOpMinInvocationsNonUniform, - EOpMaxInvocationsNonUniform, - EOpAddInvocationsNonUniform, - EOpMinInvocationsInclusiveScan, - EOpMaxInvocationsInclusiveScan, - EOpAddInvocationsInclusiveScan, - EOpMinInvocationsInclusiveScanNonUniform, - EOpMaxInvocationsInclusiveScanNonUniform, - EOpAddInvocationsInclusiveScanNonUniform, - EOpMinInvocationsExclusiveScan, - EOpMaxInvocationsExclusiveScan, - EOpAddInvocationsExclusiveScan, - EOpMinInvocationsExclusiveScanNonUniform, - EOpMaxInvocationsExclusiveScanNonUniform, - EOpAddInvocationsExclusiveScanNonUniform, - EOpSwizzleInvocations, - EOpSwizzleInvocationsMasked, - EOpWriteInvocation, - EOpMbcnt, - - EOpCubeFaceIndex, - EOpCubeFaceCoord, - EOpTime, -#endif - - EOpAtomicAdd, - EOpAtomicMin, - EOpAtomicMax, - EOpAtomicAnd, - EOpAtomicOr, - EOpAtomicXor, - EOpAtomicExchange, - EOpAtomicCompSwap, - - EOpAtomicCounterIncrement, // results in pre-increment value - EOpAtomicCounterDecrement, // results in post-decrement value - EOpAtomicCounter, - EOpAtomicCounterAdd, - EOpAtomicCounterSubtract, - EOpAtomicCounterMin, - EOpAtomicCounterMax, - EOpAtomicCounterAnd, - EOpAtomicCounterOr, - EOpAtomicCounterXor, - EOpAtomicCounterExchange, - EOpAtomicCounterCompSwap, - - EOpAny, - EOpAll, - - // - // Branch - // - - EOpKill, // Fragment only - EOpReturn, - EOpBreak, - EOpContinue, - EOpCase, - EOpDefault, - - // - // Constructors - // - - EOpConstructGuardStart, - EOpConstructInt, // these first scalar forms also identify what implicit conversion is needed - EOpConstructUint, - EOpConstructInt64, - EOpConstructUint64, -#ifdef AMD_EXTENSIONS - EOpConstructInt16, - EOpConstructUint16, -#endif - EOpConstructBool, - EOpConstructFloat, - EOpConstructDouble, -#ifdef AMD_EXTENSIONS - EOpConstructFloat16, -#endif - EOpConstructVec2, - EOpConstructVec3, - EOpConstructVec4, - EOpConstructDVec2, - EOpConstructDVec3, - EOpConstructDVec4, -#ifdef AMD_EXTENSIONS - EOpConstructF16Vec2, - EOpConstructF16Vec3, - EOpConstructF16Vec4, -#endif - EOpConstructBVec2, - EOpConstructBVec3, - EOpConstructBVec4, - EOpConstructIVec2, - EOpConstructIVec3, - EOpConstructIVec4, - EOpConstructUVec2, - EOpConstructUVec3, - EOpConstructUVec4, - EOpConstructI64Vec2, - EOpConstructI64Vec3, - EOpConstructI64Vec4, - EOpConstructU64Vec2, - EOpConstructU64Vec3, - EOpConstructU64Vec4, -#ifdef AMD_EXTENSIONS - EOpConstructI16Vec2, - EOpConstructI16Vec3, - EOpConstructI16Vec4, - EOpConstructU16Vec2, - EOpConstructU16Vec3, - EOpConstructU16Vec4, -#endif - EOpConstructMat2x2, - EOpConstructMat2x3, - EOpConstructMat2x4, - EOpConstructMat3x2, - EOpConstructMat3x3, - EOpConstructMat3x4, - EOpConstructMat4x2, - EOpConstructMat4x3, - EOpConstructMat4x4, - EOpConstructDMat2x2, - EOpConstructDMat2x3, - EOpConstructDMat2x4, - EOpConstructDMat3x2, - EOpConstructDMat3x3, - EOpConstructDMat3x4, - EOpConstructDMat4x2, - EOpConstructDMat4x3, - EOpConstructDMat4x4, - EOpConstructIMat2x2, - EOpConstructIMat2x3, - EOpConstructIMat2x4, - EOpConstructIMat3x2, - EOpConstructIMat3x3, - EOpConstructIMat3x4, - EOpConstructIMat4x2, - EOpConstructIMat4x3, - EOpConstructIMat4x4, - EOpConstructUMat2x2, - EOpConstructUMat2x3, - EOpConstructUMat2x4, - EOpConstructUMat3x2, - EOpConstructUMat3x3, - EOpConstructUMat3x4, - EOpConstructUMat4x2, - EOpConstructUMat4x3, - EOpConstructUMat4x4, - EOpConstructBMat2x2, - EOpConstructBMat2x3, - EOpConstructBMat2x4, - EOpConstructBMat3x2, - EOpConstructBMat3x3, - EOpConstructBMat3x4, - EOpConstructBMat4x2, - EOpConstructBMat4x3, - EOpConstructBMat4x4, -#ifdef AMD_EXTENSIONS - EOpConstructF16Mat2x2, - EOpConstructF16Mat2x3, - EOpConstructF16Mat2x4, - EOpConstructF16Mat3x2, - EOpConstructF16Mat3x3, - EOpConstructF16Mat3x4, - EOpConstructF16Mat4x2, - EOpConstructF16Mat4x3, - EOpConstructF16Mat4x4, -#endif - EOpConstructStruct, - EOpConstructTextureSampler, - EOpConstructGuardEnd, - - // - // moves - // - - EOpAssign, - EOpAddAssign, - EOpSubAssign, - EOpMulAssign, - EOpVectorTimesMatrixAssign, - EOpVectorTimesScalarAssign, - EOpMatrixTimesScalarAssign, - EOpMatrixTimesMatrixAssign, - EOpDivAssign, - EOpModAssign, - EOpAndAssign, - EOpInclusiveOrAssign, - EOpExclusiveOrAssign, - EOpLeftShiftAssign, - EOpRightShiftAssign, - - // - // Array operators - // - - EOpArrayLength, // "Array" distinguishes from length(v) built-in function, but it applies to vectors and matrices as well. - - // - // Image operations - // - - EOpImageGuardBegin, - - EOpImageQuerySize, - EOpImageQuerySamples, - EOpImageLoad, - EOpImageStore, -#ifdef AMD_EXTENSIONS - EOpImageLoadLod, - EOpImageStoreLod, -#endif - EOpImageAtomicAdd, - EOpImageAtomicMin, - EOpImageAtomicMax, - EOpImageAtomicAnd, - EOpImageAtomicOr, - EOpImageAtomicXor, - EOpImageAtomicExchange, - EOpImageAtomicCompSwap, - - EOpSubpassLoad, - EOpSubpassLoadMS, - EOpSparseImageLoad, -#ifdef AMD_EXTENSIONS - EOpSparseImageLoadLod, -#endif - - EOpImageGuardEnd, - - // - // Texture operations - // - - EOpTextureGuardBegin, - - EOpTextureQuerySize, - EOpTextureQueryLod, - EOpTextureQueryLevels, - EOpTextureQuerySamples, - - EOpSamplingGuardBegin, - - EOpTexture, - EOpTextureProj, - EOpTextureLod, - EOpTextureOffset, - EOpTextureFetch, - EOpTextureFetchOffset, - EOpTextureProjOffset, - EOpTextureLodOffset, - EOpTextureProjLod, - EOpTextureProjLodOffset, - EOpTextureGrad, - EOpTextureGradOffset, - EOpTextureProjGrad, - EOpTextureProjGradOffset, - EOpTextureGather, - EOpTextureGatherOffset, - EOpTextureGatherOffsets, - EOpTextureClamp, - EOpTextureOffsetClamp, - EOpTextureGradClamp, - EOpTextureGradOffsetClamp, -#ifdef AMD_EXTENSIONS - EOpTextureGatherLod, - EOpTextureGatherLodOffset, - EOpTextureGatherLodOffsets, - EOpFragmentMaskFetch, - EOpFragmentFetch, -#endif - - EOpSparseTextureGuardBegin, - - EOpSparseTexture, - EOpSparseTextureLod, - EOpSparseTextureOffset, - EOpSparseTextureFetch, - EOpSparseTextureFetchOffset, - EOpSparseTextureLodOffset, - EOpSparseTextureGrad, - EOpSparseTextureGradOffset, - EOpSparseTextureGather, - EOpSparseTextureGatherOffset, - EOpSparseTextureGatherOffsets, - EOpSparseTexelsResident, - EOpSparseTextureClamp, - EOpSparseTextureOffsetClamp, - EOpSparseTextureGradClamp, - EOpSparseTextureGradOffsetClamp, -#ifdef AMD_EXTENSIONS - EOpSparseTextureGatherLod, - EOpSparseTextureGatherLodOffset, - EOpSparseTextureGatherLodOffsets, -#endif - - EOpSparseTextureGuardEnd, - EOpSamplingGuardEnd, - EOpTextureGuardEnd, - - // - // Integer operations - // - - EOpAddCarry, - EOpSubBorrow, - EOpUMulExtended, - EOpIMulExtended, - EOpBitfieldExtract, - EOpBitfieldInsert, - EOpBitFieldReverse, - EOpBitCount, - EOpFindLSB, - EOpFindMSB, - - // - // HLSL operations - // - - EOpClip, // discard if input value < 0 - EOpIsFinite, - EOpLog10, // base 10 log - EOpRcp, // 1/x - EOpSaturate, // clamp from 0 to 1 - EOpSinCos, // sin and cos in out parameters - EOpGenMul, // mul(x,y) on any of mat/vec/scalars - EOpDst, // x = 1, y=src0.y * src1.y, z=src0.z, w=src1.w - EOpInterlockedAdd, // atomic ops, but uses [optional] out arg instead of return - EOpInterlockedAnd, // ... - EOpInterlockedCompareExchange, // ... - EOpInterlockedCompareStore, // ... - EOpInterlockedExchange, // ... - EOpInterlockedMax, // ... - EOpInterlockedMin, // ... - EOpInterlockedOr, // ... - EOpInterlockedXor, // ... - EOpAllMemoryBarrierWithGroupSync, // memory barriers without non-hlsl AST equivalents - EOpDeviceMemoryBarrier, // ... - EOpDeviceMemoryBarrierWithGroupSync, // ... - EOpWorkgroupMemoryBarrier, // ... - EOpWorkgroupMemoryBarrierWithGroupSync, // ... - EOpEvaluateAttributeSnapped, // InterpolateAtOffset with int position on 16x16 grid - EOpF32tof16, // HLSL conversion: half of a PackHalf2x16 - EOpF16tof32, // HLSL conversion: half of an UnpackHalf2x16 - EOpLit, // HLSL lighting coefficient vector - EOpTextureBias, // HLSL texture bias: will be lowered to EOpTexture - EOpAsDouble, // slightly different from EOpUint64BitsToDouble - EOpD3DCOLORtoUBYTE4, // convert and swizzle 4-component color to UBYTE4 range - - EOpMethodSample, // Texture object methods. These are translated to existing - EOpMethodSampleBias, // AST methods, and exist to represent HLSL semantics until that - EOpMethodSampleCmp, // translation is performed. See HlslParseContext::decomposeSampleMethods(). - EOpMethodSampleCmpLevelZero, // ... - EOpMethodSampleGrad, // ... - EOpMethodSampleLevel, // ... - EOpMethodLoad, // ... - EOpMethodGetDimensions, // ... - EOpMethodGetSamplePosition, // ... - EOpMethodGather, // ... - EOpMethodCalculateLevelOfDetail, // ... - EOpMethodCalculateLevelOfDetailUnclamped, // ... - - // Load already defined above for textures - EOpMethodLoad2, // Structure buffer object methods. These are translated to existing - EOpMethodLoad3, // AST methods, and exist to represent HLSL semantics until that - EOpMethodLoad4, // translation is performed. See HlslParseContext::decomposeSampleMethods(). - EOpMethodStore, // ... - EOpMethodStore2, // ... - EOpMethodStore3, // ... - EOpMethodStore4, // ... - EOpMethodIncrementCounter, // ... - EOpMethodDecrementCounter, // ... - // EOpMethodAppend is defined for geo shaders below - EOpMethodConsume, - - // SM5 texture methods - EOpMethodGatherRed, // These are covered under the above EOpMethodSample comment about - EOpMethodGatherGreen, // translation to existing AST opcodes. They exist temporarily - EOpMethodGatherBlue, // because HLSL arguments are slightly different. - EOpMethodGatherAlpha, // ... - EOpMethodGatherCmp, // ... - EOpMethodGatherCmpRed, // ... - EOpMethodGatherCmpGreen, // ... - EOpMethodGatherCmpBlue, // ... - EOpMethodGatherCmpAlpha, // ... - - // geometry methods - EOpMethodAppend, // Geometry shader methods - EOpMethodRestartStrip, // ... - - // matrix - EOpMatrixSwizzle, // select multiple matrix components (non-column) -}; - -class TIntermTraverser; -class TIntermOperator; -class TIntermAggregate; -class TIntermUnary; -class TIntermBinary; -class TIntermConstantUnion; -class TIntermSelection; -class TIntermSwitch; -class TIntermBranch; -class TIntermTyped; -class TIntermMethod; -class TIntermSymbol; -class TIntermLoop; - -} // end namespace glslang - -// -// Base class for the tree nodes -// -// (Put outside the glslang namespace, as it's used as part of the external interface.) -// -class TIntermNode { -public: - POOL_ALLOCATOR_NEW_DELETE(glslang::GetThreadPoolAllocator()) - - TIntermNode() { loc.init(); } - virtual const glslang::TSourceLoc& getLoc() const { return loc; } - virtual void setLoc(const glslang::TSourceLoc& l) { loc = l; } - virtual void traverse(glslang::TIntermTraverser*) = 0; - virtual glslang::TIntermTyped* getAsTyped() { return 0; } - virtual glslang::TIntermOperator* getAsOperator() { return 0; } - virtual glslang::TIntermConstantUnion* getAsConstantUnion() { return 0; } - virtual glslang::TIntermAggregate* getAsAggregate() { return 0; } - virtual glslang::TIntermUnary* getAsUnaryNode() { return 0; } - virtual glslang::TIntermBinary* getAsBinaryNode() { return 0; } - virtual glslang::TIntermSelection* getAsSelectionNode() { return 0; } - virtual glslang::TIntermSwitch* getAsSwitchNode() { return 0; } - virtual glslang::TIntermMethod* getAsMethodNode() { return 0; } - virtual glslang::TIntermSymbol* getAsSymbolNode() { return 0; } - virtual glslang::TIntermBranch* getAsBranchNode() { return 0; } - virtual glslang::TIntermLoop* getAsLoopNode() { return 0; } - - virtual const glslang::TIntermTyped* getAsTyped() const { return 0; } - virtual const glslang::TIntermOperator* getAsOperator() const { return 0; } - virtual const glslang::TIntermConstantUnion* getAsConstantUnion() const { return 0; } - virtual const glslang::TIntermAggregate* getAsAggregate() const { return 0; } - virtual const glslang::TIntermUnary* getAsUnaryNode() const { return 0; } - virtual const glslang::TIntermBinary* getAsBinaryNode() const { return 0; } - virtual const glslang::TIntermSelection* getAsSelectionNode() const { return 0; } - virtual const glslang::TIntermSwitch* getAsSwitchNode() const { return 0; } - virtual const glslang::TIntermMethod* getAsMethodNode() const { return 0; } - virtual const glslang::TIntermSymbol* getAsSymbolNode() const { return 0; } - virtual const glslang::TIntermBranch* getAsBranchNode() const { return 0; } - virtual const glslang::TIntermLoop* getAsLoopNode() const { return 0; } - virtual ~TIntermNode() { } - -protected: - TIntermNode(const TIntermNode&); - TIntermNode& operator=(const TIntermNode&); - glslang::TSourceLoc loc; -}; - -namespace glslang { - -// -// This is just to help yacc. -// -struct TIntermNodePair { - TIntermNode* node1; - TIntermNode* node2; -}; - -// -// Intermediate class for nodes that have a type. -// -class TIntermTyped : public TIntermNode { -public: - TIntermTyped(const TType& t) { type.shallowCopy(t); } - TIntermTyped(TBasicType basicType) { TType bt(basicType); type.shallowCopy(bt); } - virtual TIntermTyped* getAsTyped() { return this; } - virtual const TIntermTyped* getAsTyped() const { return this; } - virtual void setType(const TType& t) { type.shallowCopy(t); } - virtual const TType& getType() const { return type; } - virtual TType& getWritableType() { return type; } - - virtual TBasicType getBasicType() const { return type.getBasicType(); } - virtual TQualifier& getQualifier() { return type.getQualifier(); } - virtual const TQualifier& getQualifier() const { return type.getQualifier(); } - virtual void propagatePrecision(TPrecisionQualifier); - virtual int getVectorSize() const { return type.getVectorSize(); } - virtual int getMatrixCols() const { return type.getMatrixCols(); } - virtual int getMatrixRows() const { return type.getMatrixRows(); } - virtual bool isMatrix() const { return type.isMatrix(); } - virtual bool isArray() const { return type.isArray(); } - virtual bool isVector() const { return type.isVector(); } - virtual bool isScalar() const { return type.isScalar(); } - virtual bool isStruct() const { return type.isStruct(); } - virtual bool isFloatingDomain() const { return type.isFloatingDomain(); } - virtual bool isIntegerDomain() const { return type.isIntegerDomain(); } - TString getCompleteString() const { return type.getCompleteString(); } - -protected: - TIntermTyped& operator=(const TIntermTyped&); - TType type; -}; - -// -// Selection control hints -// -enum TSelectionControl { - ESelectionControlNone, - ESelectionControlFlatten, - ESelectionControlDontFlatten, -}; - -// -// Loop control hints -// -enum TLoopControl { - ELoopControlNone, - ELoopControlUnroll, - ELoopControlDontUnroll, -}; - -// -// Handle for, do-while, and while loops. -// -class TIntermLoop : public TIntermNode { -public: - TIntermLoop(TIntermNode* aBody, TIntermTyped* aTest, TIntermTyped* aTerminal, bool testFirst) : - body(aBody), - test(aTest), - terminal(aTerminal), - first(testFirst), - control(ELoopControlNone) - { } - - virtual TIntermLoop* getAsLoopNode() { return this; } - virtual const TIntermLoop* getAsLoopNode() const { return this; } - virtual void traverse(TIntermTraverser*); - TIntermNode* getBody() const { return body; } - TIntermTyped* getTest() const { return test; } - TIntermTyped* getTerminal() const { return terminal; } - bool testFirst() const { return first; } - - void setLoopControl(TLoopControl c) { control = c; } - TLoopControl getLoopControl() const { return control; } - -protected: - TIntermNode* body; // code to loop over - TIntermTyped* test; // exit condition associated with loop, could be 0 for 'for' loops - TIntermTyped* terminal; // exists for for-loops - bool first; // true for while and for, not for do-while - TLoopControl control; // loop control hint -}; - -// -// Handle case, break, continue, return, and kill. -// -class TIntermBranch : public TIntermNode { -public: - TIntermBranch(TOperator op, TIntermTyped* e) : - flowOp(op), - expression(e) { } - virtual TIntermBranch* getAsBranchNode() { return this; } - virtual const TIntermBranch* getAsBranchNode() const { return this; } - virtual void traverse(TIntermTraverser*); - TOperator getFlowOp() const { return flowOp; } - TIntermTyped* getExpression() const { return expression; } -protected: - TOperator flowOp; - TIntermTyped* expression; -}; - -// -// Represent method names before seeing their calling signature -// or resolving them to operations. Just an expression as the base object -// and a textural name. -// -class TIntermMethod : public TIntermTyped { -public: - TIntermMethod(TIntermTyped* o, const TType& t, const TString& m) : TIntermTyped(t), object(o), method(m) { } - virtual TIntermMethod* getAsMethodNode() { return this; } - virtual const TIntermMethod* getAsMethodNode() const { return this; } - virtual const TString& getMethodName() const { return method; } - virtual TIntermTyped* getObject() const { return object; } - virtual void traverse(TIntermTraverser*); -protected: - TIntermTyped* object; - TString method; -}; - -// -// Nodes that correspond to symbols or constants in the source code. -// -class TIntermSymbol : public TIntermTyped { -public: - // if symbol is initialized as symbol(sym), the memory comes from the pool allocator of sym. If sym comes from - // per process threadPoolAllocator, then it causes increased memory usage per compile - // it is essential to use "symbol = sym" to assign to symbol - TIntermSymbol(int i, const TString& n, const TType& t) - : TIntermTyped(t), id(i), -#ifdef ENABLE_HLSL - flattenSubset(-1), -#endif - constSubtree(nullptr) - { name = n; } - virtual int getId() const { return id; } - virtual const TString& getName() const { return name; } - virtual void traverse(TIntermTraverser*); - virtual TIntermSymbol* getAsSymbolNode() { return this; } - virtual const TIntermSymbol* getAsSymbolNode() const { return this; } - void setConstArray(const TConstUnionArray& c) { constArray = c; } - const TConstUnionArray& getConstArray() const { return constArray; } - void setConstSubtree(TIntermTyped* subtree) { constSubtree = subtree; } - TIntermTyped* getConstSubtree() const { return constSubtree; } -#ifdef ENABLE_HLSL - void setFlattenSubset(int subset) { flattenSubset = subset; } - int getFlattenSubset() const { return flattenSubset; } // -1 means full object -#endif - - // This is meant for cases where a node has already been constructed, and - // later on, it becomes necessary to switch to a different symbol. - virtual void switchId(int newId) { id = newId; } - -protected: - int id; // the unique id of the symbol this node represents -#ifdef ENABLE_HLSL - int flattenSubset; // how deeply the flattened object rooted at id has been dereferenced -#endif - TString name; // the name of the symbol this node represents - TConstUnionArray constArray; // if the symbol is a front-end compile-time constant, this is its value - TIntermTyped* constSubtree; -}; - -class TIntermConstantUnion : public TIntermTyped { -public: - TIntermConstantUnion(const TConstUnionArray& ua, const TType& t) : TIntermTyped(t), constArray(ua), literal(false) { } - const TConstUnionArray& getConstArray() const { return constArray; } - virtual TIntermConstantUnion* getAsConstantUnion() { return this; } - virtual const TIntermConstantUnion* getAsConstantUnion() const { return this; } - virtual void traverse(TIntermTraverser*); - virtual TIntermTyped* fold(TOperator, const TIntermTyped*) const; - virtual TIntermTyped* fold(TOperator, const TType&) const; - void setLiteral() { literal = true; } - void setExpression() { literal = false; } - bool isLiteral() const { return literal; } - -protected: - TIntermConstantUnion& operator=(const TIntermConstantUnion&); - - const TConstUnionArray constArray; - bool literal; // true if node represents a literal in the source code -}; - -// Represent the independent aspects of a texturing TOperator -struct TCrackedTextureOp { - bool query; - bool proj; - bool lod; - bool fetch; - bool offset; - bool offsets; - bool gather; - bool grad; - bool subpass; - bool lodClamp; -#ifdef AMD_EXTENSIONS - bool fragMask; -#endif -}; - -// -// Intermediate class for node types that hold operators. -// -class TIntermOperator : public TIntermTyped { -public: - virtual TIntermOperator* getAsOperator() { return this; } - virtual const TIntermOperator* getAsOperator() const { return this; } - TOperator getOp() const { return op; } - void setOp(TOperator newOp) { op = newOp; } - bool modifiesState() const; - bool isConstructor() const; - bool isTexture() const { return op > EOpTextureGuardBegin && op < EOpTextureGuardEnd; } - bool isSampling() const { return op > EOpSamplingGuardBegin && op < EOpSamplingGuardEnd; } - bool isImage() const { return op > EOpImageGuardBegin && op < EOpImageGuardEnd; } - bool isSparseTexture() const { return op > EOpSparseTextureGuardBegin && op < EOpSparseTextureGuardEnd; } - bool isSparseImage() const { return op == EOpSparseImageLoad; } - - void setOperationPrecision(TPrecisionQualifier p) { operationPrecision = p; } - TPrecisionQualifier getOperationPrecision() const { return operationPrecision != EpqNone ? - operationPrecision : - type.getQualifier().precision; } - TString getCompleteString() const - { - TString cs = type.getCompleteString(); - if (getOperationPrecision() != type.getQualifier().precision) { - cs += ", operation at "; - cs += GetPrecisionQualifierString(getOperationPrecision()); - } - - return cs; - } - - // Crack the op into the individual dimensions of texturing operation. - void crackTexture(TSampler sampler, TCrackedTextureOp& cracked) const - { - cracked.query = false; - cracked.proj = false; - cracked.lod = false; - cracked.fetch = false; - cracked.offset = false; - cracked.offsets = false; - cracked.gather = false; - cracked.grad = false; - cracked.subpass = false; - cracked.lodClamp = false; -#ifdef AMD_EXTENSIONS - cracked.fragMask = false; -#endif - - switch (op) { - case EOpImageQuerySize: - case EOpImageQuerySamples: - case EOpTextureQuerySize: - case EOpTextureQueryLod: - case EOpTextureQueryLevels: - case EOpTextureQuerySamples: - case EOpSparseTexelsResident: - cracked.query = true; - break; - case EOpTexture: - case EOpSparseTexture: - break; - case EOpTextureClamp: - case EOpSparseTextureClamp: - cracked.lodClamp = true; - break; - case EOpTextureProj: - cracked.proj = true; - break; - case EOpTextureLod: - case EOpSparseTextureLod: - cracked.lod = true; - break; - case EOpTextureOffset: - case EOpSparseTextureOffset: - cracked.offset = true; - break; - case EOpTextureOffsetClamp: - case EOpSparseTextureOffsetClamp: - cracked.offset = true; - cracked.lodClamp = true; - break; - case EOpTextureFetch: - case EOpSparseTextureFetch: - cracked.fetch = true; - if (sampler.dim == Esd1D || (sampler.dim == Esd2D && ! sampler.ms) || sampler.dim == Esd3D) - cracked.lod = true; - break; - case EOpTextureFetchOffset: - case EOpSparseTextureFetchOffset: - cracked.fetch = true; - cracked.offset = true; - if (sampler.dim == Esd1D || (sampler.dim == Esd2D && ! sampler.ms) || sampler.dim == Esd3D) - cracked.lod = true; - break; - case EOpTextureProjOffset: - cracked.offset = true; - cracked.proj = true; - break; - case EOpTextureLodOffset: - case EOpSparseTextureLodOffset: - cracked.offset = true; - cracked.lod = true; - break; - case EOpTextureProjLod: - cracked.lod = true; - cracked.proj = true; - break; - case EOpTextureProjLodOffset: - cracked.offset = true; - cracked.lod = true; - cracked.proj = true; - break; - case EOpTextureGrad: - case EOpSparseTextureGrad: - cracked.grad = true; - break; - case EOpTextureGradClamp: - case EOpSparseTextureGradClamp: - cracked.grad = true; - cracked.lodClamp = true; - break; - case EOpTextureGradOffset: - case EOpSparseTextureGradOffset: - cracked.grad = true; - cracked.offset = true; - break; - case EOpTextureProjGrad: - cracked.grad = true; - cracked.proj = true; - break; - case EOpTextureProjGradOffset: - cracked.grad = true; - cracked.offset = true; - cracked.proj = true; - break; - case EOpTextureGradOffsetClamp: - case EOpSparseTextureGradOffsetClamp: - cracked.grad = true; - cracked.offset = true; - cracked.lodClamp = true; - break; - case EOpTextureGather: - case EOpSparseTextureGather: - cracked.gather = true; - break; - case EOpTextureGatherOffset: - case EOpSparseTextureGatherOffset: - cracked.gather = true; - cracked.offset = true; - break; - case EOpTextureGatherOffsets: - case EOpSparseTextureGatherOffsets: - cracked.gather = true; - cracked.offsets = true; - break; -#ifdef AMD_EXTENSIONS - case EOpTextureGatherLod: - case EOpSparseTextureGatherLod: - cracked.gather = true; - cracked.lod = true; - break; - case EOpTextureGatherLodOffset: - case EOpSparseTextureGatherLodOffset: - cracked.gather = true; - cracked.offset = true; - cracked.lod = true; - break; - case EOpTextureGatherLodOffsets: - case EOpSparseTextureGatherLodOffsets: - cracked.gather = true; - cracked.offsets = true; - cracked.lod = true; - break; - case EOpImageLoadLod: - case EOpImageStoreLod: - case EOpSparseImageLoadLod: - cracked.lod = true; - break; - case EOpFragmentMaskFetch: - cracked.subpass = sampler.dim == EsdSubpass; - cracked.fragMask = true; - break; - case EOpFragmentFetch: - cracked.subpass = sampler.dim == EsdSubpass; - cracked.fragMask = true; - break; -#endif - case EOpSubpassLoad: - case EOpSubpassLoadMS: - cracked.subpass = true; - break; - default: - break; - } - } - -protected: - TIntermOperator(TOperator o) : TIntermTyped(EbtFloat), op(o), operationPrecision(EpqNone) {} - TIntermOperator(TOperator o, TType& t) : TIntermTyped(t), op(o), operationPrecision(EpqNone) {} - TOperator op; - // The result precision is in the inherited TType, and is usually meant to be both - // the operation precision and the result precision. However, some more complex things, - // like built-in function calls, distinguish between the two, in which case non-EqpNone - // 'operationPrecision' overrides the result precision as far as operation precision - // is concerned. - TPrecisionQualifier operationPrecision; -}; - -// -// Nodes for all the basic binary math operators. -// -class TIntermBinary : public TIntermOperator { -public: - TIntermBinary(TOperator o) : TIntermOperator(o) {} - virtual void traverse(TIntermTraverser*); - virtual void setLeft(TIntermTyped* n) { left = n; } - virtual void setRight(TIntermTyped* n) { right = n; } - virtual TIntermTyped* getLeft() const { return left; } - virtual TIntermTyped* getRight() const { return right; } - virtual TIntermBinary* getAsBinaryNode() { return this; } - virtual const TIntermBinary* getAsBinaryNode() const { return this; } - virtual void updatePrecision(); -protected: - TIntermTyped* left; - TIntermTyped* right; -}; - -// -// Nodes for unary math operators. -// -class TIntermUnary : public TIntermOperator { -public: - TIntermUnary(TOperator o, TType& t) : TIntermOperator(o, t), operand(0) {} - TIntermUnary(TOperator o) : TIntermOperator(o), operand(0) {} - virtual void traverse(TIntermTraverser*); - virtual void setOperand(TIntermTyped* o) { operand = o; } - virtual TIntermTyped* getOperand() { return operand; } - virtual const TIntermTyped* getOperand() const { return operand; } - virtual TIntermUnary* getAsUnaryNode() { return this; } - virtual const TIntermUnary* getAsUnaryNode() const { return this; } - virtual void updatePrecision(); -protected: - TIntermTyped* operand; -}; - -typedef TVector TIntermSequence; -typedef TVector TQualifierList; -// -// Nodes that operate on an arbitrary sized set of children. -// -class TIntermAggregate : public TIntermOperator { -public: - TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), pragmaTable(nullptr) { } - TIntermAggregate(TOperator o) : TIntermOperator(o), pragmaTable(nullptr) { } - ~TIntermAggregate() { delete pragmaTable; } - virtual TIntermAggregate* getAsAggregate() { return this; } - virtual const TIntermAggregate* getAsAggregate() const { return this; } - virtual void setOperator(TOperator o) { op = o; } - virtual TIntermSequence& getSequence() { return sequence; } - virtual const TIntermSequence& getSequence() const { return sequence; } - virtual void setName(const TString& n) { name = n; } - virtual const TString& getName() const { return name; } - virtual void traverse(TIntermTraverser*); - virtual void setUserDefined() { userDefined = true; } - virtual bool isUserDefined() { return userDefined; } - virtual TQualifierList& getQualifierList() { return qualifier; } - virtual const TQualifierList& getQualifierList() const { return qualifier; } - void setOptimize(bool o) { optimize = o; } - void setDebug(bool d) { debug = d; } - bool getOptimize() const { return optimize; } - bool getDebug() const { return debug; } - void setPragmaTable(const TPragmaTable& pTable); - const TPragmaTable& getPragmaTable() const { return *pragmaTable; } -protected: - TIntermAggregate(const TIntermAggregate&); // disallow copy constructor - TIntermAggregate& operator=(const TIntermAggregate&); // disallow assignment operator - TIntermSequence sequence; - TQualifierList qualifier; - TString name; - bool userDefined; // used for user defined function names - bool optimize; - bool debug; - TPragmaTable* pragmaTable; -}; - -// -// For if tests. -// -class TIntermSelection : public TIntermTyped { -public: - TIntermSelection(TIntermTyped* cond, TIntermNode* trueB, TIntermNode* falseB) : - TIntermTyped(EbtVoid), condition(cond), trueBlock(trueB), falseBlock(falseB), control(ESelectionControlNone) {} - TIntermSelection(TIntermTyped* cond, TIntermNode* trueB, TIntermNode* falseB, const TType& type) : - TIntermTyped(type), condition(cond), trueBlock(trueB), falseBlock(falseB), control(ESelectionControlNone) {} - virtual void traverse(TIntermTraverser*); - virtual TIntermTyped* getCondition() const { return condition; } - virtual TIntermNode* getTrueBlock() const { return trueBlock; } - virtual TIntermNode* getFalseBlock() const { return falseBlock; } - virtual TIntermSelection* getAsSelectionNode() { return this; } - virtual const TIntermSelection* getAsSelectionNode() const { return this; } - void setSelectionControl(TSelectionControl c) { control = c; } - TSelectionControl getSelectionControl() const { return control; } -protected: - TIntermTyped* condition; - TIntermNode* trueBlock; - TIntermNode* falseBlock; - TSelectionControl control; // selection control hint -}; - -// -// For switch statements. Designed use is that a switch will have sequence of nodes -// that are either case/default nodes or a *single* node that represents all the code -// in between (if any) consecutive case/defaults. So, a traversal need only deal with -// 0 or 1 nodes per case/default statement. -// -class TIntermSwitch : public TIntermNode { -public: - TIntermSwitch(TIntermTyped* cond, TIntermAggregate* b) : condition(cond), body(b), control(ESelectionControlNone) { } - virtual void traverse(TIntermTraverser*); - virtual TIntermNode* getCondition() const { return condition; } - virtual TIntermAggregate* getBody() const { return body; } - virtual TIntermSwitch* getAsSwitchNode() { return this; } - virtual const TIntermSwitch* getAsSwitchNode() const { return this; } - void setSelectionControl(TSelectionControl c) { control = c; } - TSelectionControl getSelectionControl() const { return control; } -protected: - TIntermTyped* condition; - TIntermAggregate* body; - TSelectionControl control; // selection control hint -}; - -enum TVisit -{ - EvPreVisit, - EvInVisit, - EvPostVisit -}; - -// -// For traversing the tree. User should derive from this, -// put their traversal specific data in it, and then pass -// it to a Traverse method. -// -// When using this, just fill in the methods for nodes you want visited. -// Return false from a pre-visit to skip visiting that node's subtree. -// -// Explicitly set postVisit to true if you want post visiting, otherwise, -// filled in methods will only be called at pre-visit time (before processing -// the subtree). Similarly for inVisit for in-order visiting of nodes with -// multiple children. -// -// If you only want post-visits, explicitly turn off preVisit (and inVisit) -// and turn on postVisit. -// -// In general, for the visit*() methods, return true from interior nodes -// to have the traversal continue on to children. -// -// If you process children yourself, or don't want them processed, return false. -// -class TIntermTraverser { -public: - POOL_ALLOCATOR_NEW_DELETE(glslang::GetThreadPoolAllocator()) - TIntermTraverser(bool preVisit = true, bool inVisit = false, bool postVisit = false, bool rightToLeft = false) : - preVisit(preVisit), - inVisit(inVisit), - postVisit(postVisit), - rightToLeft(rightToLeft), - depth(0), - maxDepth(0) { } - virtual ~TIntermTraverser() { } - - virtual void visitSymbol(TIntermSymbol*) { } - virtual void visitConstantUnion(TIntermConstantUnion*) { } - virtual bool visitBinary(TVisit, TIntermBinary*) { return true; } - virtual bool visitUnary(TVisit, TIntermUnary*) { return true; } - virtual bool visitSelection(TVisit, TIntermSelection*) { return true; } - virtual bool visitAggregate(TVisit, TIntermAggregate*) { return true; } - virtual bool visitLoop(TVisit, TIntermLoop*) { return true; } - virtual bool visitBranch(TVisit, TIntermBranch*) { return true; } - virtual bool visitSwitch(TVisit, TIntermSwitch*) { return true; } - - int getMaxDepth() const { return maxDepth; } - - void incrementDepth(TIntermNode *current) - { - depth++; - maxDepth = (std::max)(maxDepth, depth); - path.push_back(current); - } - - void decrementDepth() - { - depth--; - path.pop_back(); - } - - TIntermNode *getParentNode() - { - return path.size() == 0 ? NULL : path.back(); - } - - const bool preVisit; - const bool inVisit; - const bool postVisit; - const bool rightToLeft; - -protected: - TIntermTraverser& operator=(TIntermTraverser&); - - int depth; - int maxDepth; - - // All the nodes from root to the current node's parent during traversing. - TVector path; -}; - -// KHR_vulkan_glsl says "Two arrays sized with specialization constants are the same type only if -// sized with the same symbol, involving no operations" -inline bool SameSpecializationConstants(TIntermTyped* node1, TIntermTyped* node2) -{ - return node1->getAsSymbolNode() && node2->getAsSymbolNode() && - node1->getAsSymbolNode()->getId() == node2->getAsSymbolNode()->getId(); -} - -} // end namespace glslang - -#endif // __INTERMEDIATE_H diff --git a/love/src/jni/love/src/libraries/glslang/glslang/Include/revision.h b/love/src/jni/love/src/libraries/glslang/glslang/Include/revision.h deleted file mode 100644 index 218f8b67..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/Include/revision.h +++ /dev/null @@ -1,6 +0,0 @@ -// This header is generated by the make-revision script. -// For the version, it uses the latest git tag followed by the number of commits. -// For the date, it uses the current date (when then script is run). - -#define GLSLANG_REVISION "Overload400-PrecQual.2000" -#define GLSLANG_DATE "12-Apr-2017" diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Constant.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Constant.cpp deleted file mode 100644 index 1b73d969..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Constant.cpp +++ /dev/null @@ -1,1053 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2012-2013 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#include "localintermediate.h" -#include -#include -#include -#include - -namespace { - -using namespace glslang; - -typedef union { - double d; - int i[2]; -} DoubleIntUnion; - -// Some helper functions - -bool isNan(double x) -{ - DoubleIntUnion u; - // tough to find a platform independent library function, do it directly - u.d = x; - int bitPatternL = u.i[0]; - int bitPatternH = u.i[1]; - return (bitPatternH & 0x7ff80000) == 0x7ff80000 && - ((bitPatternH & 0xFFFFF) != 0 || bitPatternL != 0); -} - -bool isInf(double x) -{ - DoubleIntUnion u; - // tough to find a platform independent library function, do it directly - u.d = x; - int bitPatternL = u.i[0]; - int bitPatternH = u.i[1]; - return (bitPatternH & 0x7ff00000) == 0x7ff00000 && - (bitPatternH & 0xFFFFF) == 0 && bitPatternL == 0; -} - -const double pi = 3.1415926535897932384626433832795; - -} // end anonymous namespace - - -namespace glslang { - -// -// The fold functions see if an operation on a constant can be done in place, -// without generating run-time code. -// -// Returns the node to keep using, which may or may not be the node passed in. -// -// Note: As of version 1.2, all constant operations must be folded. It is -// not opportunistic, but rather a semantic requirement. -// - -// -// Do folding between a pair of nodes. -// 'this' is the left-hand operand and 'rightConstantNode' is the right-hand operand. -// -// Returns a new node representing the result. -// -TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* rightConstantNode) const -{ - // For most cases, the return type matches the argument type, so set that - // up and just code to exceptions below. - TType returnType; - returnType.shallowCopy(getType()); - - // - // A pair of nodes is to be folded together - // - - const TIntermConstantUnion *rightNode = rightConstantNode->getAsConstantUnion(); - TConstUnionArray leftUnionArray = getConstArray(); - TConstUnionArray rightUnionArray = rightNode->getConstArray(); - - // Figure out the size of the result - int newComps; - int constComps; - switch(op) { - case EOpMatrixTimesMatrix: - newComps = rightNode->getMatrixCols() * getMatrixRows(); - break; - case EOpMatrixTimesVector: - newComps = getMatrixRows(); - break; - case EOpVectorTimesMatrix: - newComps = rightNode->getMatrixCols(); - break; - default: - newComps = getType().computeNumComponents(); - constComps = rightConstantNode->getType().computeNumComponents(); - if (constComps == 1 && newComps > 1) { - // for a case like vec4 f = vec4(2,3,4,5) + 1.2; - TConstUnionArray smearedArray(newComps, rightNode->getConstArray()[0]); - rightUnionArray = smearedArray; - } else if (constComps > 1 && newComps == 1) { - // for a case like vec4 f = 1.2 + vec4(2,3,4,5); - newComps = constComps; - rightUnionArray = rightNode->getConstArray(); - TConstUnionArray smearedArray(newComps, getConstArray()[0]); - leftUnionArray = smearedArray; - returnType.shallowCopy(rightNode->getType()); - } - break; - } - - TConstUnionArray newConstArray(newComps); - TType constBool(EbtBool, EvqConst); - - switch(op) { - case EOpAdd: - for (int i = 0; i < newComps; i++) - newConstArray[i] = leftUnionArray[i] + rightUnionArray[i]; - break; - case EOpSub: - for (int i = 0; i < newComps; i++) - newConstArray[i] = leftUnionArray[i] - rightUnionArray[i]; - break; - - case EOpMul: - case EOpVectorTimesScalar: - case EOpMatrixTimesScalar: - for (int i = 0; i < newComps; i++) - newConstArray[i] = leftUnionArray[i] * rightUnionArray[i]; - break; - case EOpMatrixTimesMatrix: - for (int row = 0; row < getMatrixRows(); row++) { - for (int column = 0; column < rightNode->getMatrixCols(); column++) { - double sum = 0.0f; - for (int i = 0; i < rightNode->getMatrixRows(); i++) - sum += leftUnionArray[i * getMatrixRows() + row].getDConst() * rightUnionArray[column * rightNode->getMatrixRows() + i].getDConst(); - newConstArray[column * getMatrixRows() + row].setDConst(sum); - } - } - returnType.shallowCopy(TType(getType().getBasicType(), EvqConst, 0, rightNode->getMatrixCols(), getMatrixRows())); - break; - case EOpDiv: - for (int i = 0; i < newComps; i++) { - switch (getType().getBasicType()) { - case EbtDouble: - case EbtFloat: -#ifdef AMD_EXTENSIONS - case EbtFloat16: -#endif - newConstArray[i].setDConst(leftUnionArray[i].getDConst() / rightUnionArray[i].getDConst()); - break; - - case EbtInt: - if (rightUnionArray[i] == 0) - newConstArray[i].setIConst(0x7FFFFFFF); - else if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == (int)0x80000000) - newConstArray[i].setIConst(0x80000000); - else - newConstArray[i].setIConst(leftUnionArray[i].getIConst() / rightUnionArray[i].getIConst()); - break; - - case EbtUint: - if (rightUnionArray[i] == 0) { - newConstArray[i].setUConst(0xFFFFFFFFu); - } else - newConstArray[i].setUConst(leftUnionArray[i].getUConst() / rightUnionArray[i].getUConst()); - break; - - case EbtInt64: - if (rightUnionArray[i] == 0) - newConstArray[i].setI64Const(0x7FFFFFFFFFFFFFFFll); - else if (rightUnionArray[i].getI64Const() == -1 && leftUnionArray[i].getI64Const() == (long long)0x8000000000000000) - newConstArray[i].setI64Const(0x8000000000000000); - else - newConstArray[i].setI64Const(leftUnionArray[i].getI64Const() / rightUnionArray[i].getI64Const()); - break; - - case EbtUint64: - if (rightUnionArray[i] == 0) { - newConstArray[i].setU64Const(0xFFFFFFFFFFFFFFFFull); - } else - newConstArray[i].setU64Const(leftUnionArray[i].getU64Const() / rightUnionArray[i].getU64Const()); - break; -#ifdef AMD_EXTENSIONS - case EbtInt16: - if (rightUnionArray[i] == 0) - newConstArray[i].setIConst(0x7FFF); - else if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == (int)0x8000) - newConstArray[i].setIConst(0x8000); - else - newConstArray[i].setIConst(leftUnionArray[i].getIConst() / rightUnionArray[i].getIConst()); - break; - - case EbtUint16: - if (rightUnionArray[i] == 0) { - newConstArray[i].setUConst(0xFFFFu); - } else - newConstArray[i].setUConst(leftUnionArray[i].getUConst() / rightUnionArray[i].getUConst()); - break; -#endif - default: - return 0; - } - } - break; - - case EOpMatrixTimesVector: - for (int i = 0; i < getMatrixRows(); i++) { - double sum = 0.0f; - for (int j = 0; j < rightNode->getVectorSize(); j++) { - sum += leftUnionArray[j*getMatrixRows() + i].getDConst() * rightUnionArray[j].getDConst(); - } - newConstArray[i].setDConst(sum); - } - - returnType.shallowCopy(TType(getBasicType(), EvqConst, getMatrixRows())); - break; - - case EOpVectorTimesMatrix: - for (int i = 0; i < rightNode->getMatrixCols(); i++) { - double sum = 0.0f; - for (int j = 0; j < getVectorSize(); j++) - sum += leftUnionArray[j].getDConst() * rightUnionArray[i*rightNode->getMatrixRows() + j].getDConst(); - newConstArray[i].setDConst(sum); - } - - returnType.shallowCopy(TType(getBasicType(), EvqConst, rightNode->getMatrixCols())); - break; - - case EOpMod: - for (int i = 0; i < newComps; i++) { - if (rightUnionArray[i] == 0) - newConstArray[i] = leftUnionArray[i]; - else { - switch (getType().getBasicType()) { - case EbtInt: - if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == INT_MIN) { - newConstArray[i].setIConst(0); - break; - } else goto modulo_default; - - case EbtInt64: - if (rightUnionArray[i].getI64Const() == -1 && leftUnionArray[i].getI64Const() == LLONG_MIN) { - newConstArray[i].setI64Const(0); - break; - } else goto modulo_default; -#ifdef AMD_EXTENSIONS - case EbtInt16: - if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == SHRT_MIN) { - newConstArray[i].setIConst(0); - break; - } else goto modulo_default; -#endif - default: - modulo_default: - newConstArray[i] = leftUnionArray[i] % rightUnionArray[i]; - } - } - } - break; - - case EOpRightShift: - for (int i = 0; i < newComps; i++) - newConstArray[i] = leftUnionArray[i] >> rightUnionArray[i]; - break; - - case EOpLeftShift: - for (int i = 0; i < newComps; i++) - newConstArray[i] = leftUnionArray[i] << rightUnionArray[i]; - break; - - case EOpAnd: - for (int i = 0; i < newComps; i++) - newConstArray[i] = leftUnionArray[i] & rightUnionArray[i]; - break; - case EOpInclusiveOr: - for (int i = 0; i < newComps; i++) - newConstArray[i] = leftUnionArray[i] | rightUnionArray[i]; - break; - case EOpExclusiveOr: - for (int i = 0; i < newComps; i++) - newConstArray[i] = leftUnionArray[i] ^ rightUnionArray[i]; - break; - - case EOpLogicalAnd: // this code is written for possible future use, will not get executed currently - for (int i = 0; i < newComps; i++) - newConstArray[i] = leftUnionArray[i] && rightUnionArray[i]; - break; - - case EOpLogicalOr: // this code is written for possible future use, will not get executed currently - for (int i = 0; i < newComps; i++) - newConstArray[i] = leftUnionArray[i] || rightUnionArray[i]; - break; - - case EOpLogicalXor: - for (int i = 0; i < newComps; i++) { - switch (getType().getBasicType()) { - case EbtBool: newConstArray[i].setBConst((leftUnionArray[i] == rightUnionArray[i]) ? false : true); break; - default: assert(false && "Default missing"); - } - } - break; - - case EOpLessThan: - newConstArray[0].setBConst(leftUnionArray[0] < rightUnionArray[0]); - returnType.shallowCopy(constBool); - break; - case EOpGreaterThan: - newConstArray[0].setBConst(leftUnionArray[0] > rightUnionArray[0]); - returnType.shallowCopy(constBool); - break; - case EOpLessThanEqual: - newConstArray[0].setBConst(! (leftUnionArray[0] > rightUnionArray[0])); - returnType.shallowCopy(constBool); - break; - case EOpGreaterThanEqual: - newConstArray[0].setBConst(! (leftUnionArray[0] < rightUnionArray[0])); - returnType.shallowCopy(constBool); - break; - case EOpEqual: - newConstArray[0].setBConst(rightNode->getConstArray() == leftUnionArray); - returnType.shallowCopy(constBool); - break; - case EOpNotEqual: - newConstArray[0].setBConst(rightNode->getConstArray() != leftUnionArray); - returnType.shallowCopy(constBool); - break; - - default: - return 0; - } - - TIntermConstantUnion *newNode = new TIntermConstantUnion(newConstArray, returnType); - newNode->setLoc(getLoc()); - - return newNode; -} - -// -// Do single unary node folding -// -// Returns a new node representing the result. -// -TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) const -{ - // First, size the result, which is mostly the same as the argument's size, - // but not always, and classify what is componentwise. - // Also, eliminate cases that can't be compile-time constant. - int resultSize; - bool componentWise = true; - - int objectSize = getType().computeNumComponents(); - switch (op) { - case EOpDeterminant: - case EOpAny: - case EOpAll: - case EOpLength: - componentWise = false; - resultSize = 1; - break; - - case EOpEmitStreamVertex: - case EOpEndStreamPrimitive: - // These don't actually fold - return 0; - - case EOpPackSnorm2x16: - case EOpPackUnorm2x16: - case EOpPackHalf2x16: - componentWise = false; - resultSize = 1; - break; - - case EOpUnpackSnorm2x16: - case EOpUnpackUnorm2x16: - case EOpUnpackHalf2x16: - componentWise = false; - resultSize = 2; - break; - - case EOpNormalize: - componentWise = false; - resultSize = objectSize; - break; - - default: - resultSize = objectSize; - break; - } - - // Set up for processing - TConstUnionArray newConstArray(resultSize); - const TConstUnionArray& unionArray = getConstArray(); - - // Process non-component-wise operations - switch (op) { - case EOpLength: - case EOpNormalize: - { - double sum = 0; - for (int i = 0; i < objectSize; i++) - sum += unionArray[i].getDConst() * unionArray[i].getDConst(); - double length = sqrt(sum); - if (op == EOpLength) - newConstArray[0].setDConst(length); - else { - for (int i = 0; i < objectSize; i++) - newConstArray[i].setDConst(unionArray[i].getDConst() / length); - } - break; - } - - case EOpAny: - { - bool result = false; - for (int i = 0; i < objectSize; i++) { - if (unionArray[i].getBConst()) - result = true; - } - newConstArray[0].setBConst(result); - break; - } - case EOpAll: - { - bool result = true; - for (int i = 0; i < objectSize; i++) { - if (! unionArray[i].getBConst()) - result = false; - } - newConstArray[0].setBConst(result); - break; - } - - // TODO: 3.0 Functionality: unary constant folding: the rest of the ops have to be fleshed out - - case EOpPackSnorm2x16: - case EOpPackUnorm2x16: - case EOpPackHalf2x16: - - case EOpUnpackSnorm2x16: - case EOpUnpackUnorm2x16: - case EOpUnpackHalf2x16: - - case EOpDeterminant: - case EOpMatrixInverse: - case EOpTranspose: - return 0; - - default: - assert(componentWise); - break; - } - - // Turn off the componentwise loop - if (! componentWise) - objectSize = 0; - - // Process component-wise operations - for (int i = 0; i < objectSize; i++) { - switch (op) { - case EOpNegative: - switch (getType().getBasicType()) { - case EbtDouble: -#ifdef AMD_EXTENSIONS - case EbtFloat16: -#endif - case EbtFloat: newConstArray[i].setDConst(-unionArray[i].getDConst()); break; -#ifdef AMD_EXTENSIONS - case EbtInt16: -#endif - case EbtInt: newConstArray[i].setIConst(-unionArray[i].getIConst()); break; -#ifdef AMD_EXTENSIONS - case EbtUint16: -#endif - case EbtUint: newConstArray[i].setUConst(static_cast(-static_cast(unionArray[i].getUConst()))); break; - case EbtInt64: newConstArray[i].setI64Const(-unionArray[i].getI64Const()); break; - case EbtUint64: newConstArray[i].setU64Const(static_cast(-static_cast(unionArray[i].getU64Const()))); break; - default: - return 0; - } - break; - case EOpLogicalNot: - case EOpVectorLogicalNot: - switch (getType().getBasicType()) { - case EbtBool: newConstArray[i].setBConst(!unionArray[i].getBConst()); break; - default: - return 0; - } - break; - case EOpBitwiseNot: - newConstArray[i] = ~unionArray[i]; - break; - case EOpRadians: - newConstArray[i].setDConst(unionArray[i].getDConst() * pi / 180.0); - break; - case EOpDegrees: - newConstArray[i].setDConst(unionArray[i].getDConst() * 180.0 / pi); - break; - case EOpSin: - newConstArray[i].setDConst(sin(unionArray[i].getDConst())); - break; - case EOpCos: - newConstArray[i].setDConst(cos(unionArray[i].getDConst())); - break; - case EOpTan: - newConstArray[i].setDConst(tan(unionArray[i].getDConst())); - break; - case EOpAsin: - newConstArray[i].setDConst(asin(unionArray[i].getDConst())); - break; - case EOpAcos: - newConstArray[i].setDConst(acos(unionArray[i].getDConst())); - break; - case EOpAtan: - newConstArray[i].setDConst(atan(unionArray[i].getDConst())); - break; - - case EOpDPdx: - case EOpDPdy: - case EOpFwidth: - case EOpDPdxFine: - case EOpDPdyFine: - case EOpFwidthFine: - case EOpDPdxCoarse: - case EOpDPdyCoarse: - case EOpFwidthCoarse: - // The derivatives are all mandated to create a constant 0. - newConstArray[i].setDConst(0.0); - break; - - case EOpExp: - newConstArray[i].setDConst(exp(unionArray[i].getDConst())); - break; - case EOpLog: - newConstArray[i].setDConst(log(unionArray[i].getDConst())); - break; - case EOpExp2: - { - const double inv_log2_e = 0.69314718055994530941723212145818; - newConstArray[i].setDConst(exp(unionArray[i].getDConst() * inv_log2_e)); - break; - } - case EOpLog2: - { - const double log2_e = 1.4426950408889634073599246810019; - newConstArray[i].setDConst(log2_e * log(unionArray[i].getDConst())); - break; - } - case EOpSqrt: - newConstArray[i].setDConst(sqrt(unionArray[i].getDConst())); - break; - case EOpInverseSqrt: - newConstArray[i].setDConst(1.0 / sqrt(unionArray[i].getDConst())); - break; - - case EOpAbs: - if (unionArray[i].getType() == EbtDouble) - newConstArray[i].setDConst(fabs(unionArray[i].getDConst())); - else if (unionArray[i].getType() == EbtInt) - newConstArray[i].setIConst(abs(unionArray[i].getIConst())); - else - newConstArray[i] = unionArray[i]; - break; - case EOpSign: - #define SIGN(X) (X == 0 ? 0 : (X < 0 ? -1 : 1)) - if (unionArray[i].getType() == EbtDouble) - newConstArray[i].setDConst(SIGN(unionArray[i].getDConst())); - else - newConstArray[i].setIConst(SIGN(unionArray[i].getIConst())); - break; - case EOpFloor: - newConstArray[i].setDConst(floor(unionArray[i].getDConst())); - break; - case EOpTrunc: - if (unionArray[i].getDConst() > 0) - newConstArray[i].setDConst(floor(unionArray[i].getDConst())); - else - newConstArray[i].setDConst(ceil(unionArray[i].getDConst())); - break; - case EOpRound: - newConstArray[i].setDConst(floor(0.5 + unionArray[i].getDConst())); - break; - case EOpRoundEven: - { - double flr = floor(unionArray[i].getDConst()); - bool even = flr / 2.0 == floor(flr / 2.0); - double rounded = even ? ceil(unionArray[i].getDConst() - 0.5) : floor(unionArray[i].getDConst() + 0.5); - newConstArray[i].setDConst(rounded); - break; - } - case EOpCeil: - newConstArray[i].setDConst(ceil(unionArray[i].getDConst())); - break; - case EOpFract: - { - double x = unionArray[i].getDConst(); - newConstArray[i].setDConst(x - floor(x)); - break; - } - - case EOpIsNan: - { - newConstArray[i].setBConst(isNan(unionArray[i].getDConst())); - break; - } - case EOpIsInf: - { - newConstArray[i].setBConst(isInf(unionArray[i].getDConst())); - break; - } - - // TODO: 3.0 Functionality: unary constant folding: the rest of the ops have to be fleshed out - - case EOpSinh: - case EOpCosh: - case EOpTanh: - case EOpAsinh: - case EOpAcosh: - case EOpAtanh: - - case EOpFloatBitsToInt: - case EOpFloatBitsToUint: - case EOpIntBitsToFloat: - case EOpUintBitsToFloat: - case EOpDoubleBitsToInt64: - case EOpDoubleBitsToUint64: - case EOpInt64BitsToDouble: - case EOpUint64BitsToDouble: -#ifdef AMD_EXTENSIONS - case EOpFloat16BitsToInt16: - case EOpFloat16BitsToUint16: - case EOpInt16BitsToFloat16: - case EOpUint16BitsToFloat16: -#endif - - default: - return 0; - } - } - - TIntermConstantUnion *newNode = new TIntermConstantUnion(newConstArray, returnType); - newNode->getWritableType().getQualifier().storage = EvqConst; - newNode->setLoc(getLoc()); - - return newNode; -} - -// -// Do constant folding for an aggregate node that has all its children -// as constants and an operator that requires constant folding. -// -TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) -{ - if (aggrNode == nullptr) - return aggrNode; - - if (! areAllChildConst(aggrNode)) - return aggrNode; - - if (aggrNode->isConstructor()) - return foldConstructor(aggrNode); - - TIntermSequence& children = aggrNode->getSequence(); - - // First, see if this is an operation to constant fold, kick out if not, - // see what size the result is if so. - - bool componentwise = false; // will also say componentwise if a scalar argument gets repeated to make per-component results - int objectSize; - switch (aggrNode->getOp()) { - case EOpAtan: - case EOpPow: - case EOpMin: - case EOpMax: - case EOpMix: - case EOpClamp: - case EOpLessThan: - case EOpGreaterThan: - case EOpLessThanEqual: - case EOpGreaterThanEqual: - case EOpVectorEqual: - case EOpVectorNotEqual: - componentwise = true; - objectSize = children[0]->getAsConstantUnion()->getType().computeNumComponents(); - break; - case EOpCross: - case EOpReflect: - case EOpRefract: - case EOpFaceForward: - objectSize = children[0]->getAsConstantUnion()->getType().computeNumComponents(); - break; - case EOpDistance: - case EOpDot: - objectSize = 1; - break; - case EOpOuterProduct: - objectSize = children[0]->getAsTyped()->getType().getVectorSize() * - children[1]->getAsTyped()->getType().getVectorSize(); - break; - case EOpStep: - componentwise = true; - objectSize = std::max(children[0]->getAsTyped()->getType().getVectorSize(), - children[1]->getAsTyped()->getType().getVectorSize()); - break; - case EOpSmoothStep: - componentwise = true; - objectSize = std::max(children[0]->getAsTyped()->getType().getVectorSize(), - children[2]->getAsTyped()->getType().getVectorSize()); - break; - default: - return aggrNode; - } - TConstUnionArray newConstArray(objectSize); - - TVector childConstUnions; - for (unsigned int arg = 0; arg < children.size(); ++arg) - childConstUnions.push_back(children[arg]->getAsConstantUnion()->getConstArray()); - - // Second, do the actual folding - - bool isFloatingPoint = children[0]->getAsTyped()->getBasicType() == EbtFloat || -#ifdef AMD_EXTENSIONS - children[0]->getAsTyped()->getBasicType() == EbtFloat16 || -#endif - children[0]->getAsTyped()->getBasicType() == EbtDouble; - bool isSigned = children[0]->getAsTyped()->getBasicType() == EbtInt || -#ifdef AMD_EXTENSIONS - children[0]->getAsTyped()->getBasicType() == EbtInt16 || -#endif - children[0]->getAsTyped()->getBasicType() == EbtInt64; - bool isInt64 = children[0]->getAsTyped()->getBasicType() == EbtInt64 || - children[0]->getAsTyped()->getBasicType() == EbtUint64; - if (componentwise) { - for (int comp = 0; comp < objectSize; comp++) { - - // some arguments are scalars instead of matching vectors; simulate a smear - int arg0comp = std::min(comp, children[0]->getAsTyped()->getType().getVectorSize() - 1); - int arg1comp = 0; - if (children.size() > 1) - arg1comp = std::min(comp, children[1]->getAsTyped()->getType().getVectorSize() - 1); - int arg2comp = 0; - if (children.size() > 2) - arg2comp = std::min(comp, children[2]->getAsTyped()->getType().getVectorSize() - 1); - - switch (aggrNode->getOp()) { - case EOpAtan: - newConstArray[comp].setDConst(atan2(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst())); - break; - case EOpPow: - newConstArray[comp].setDConst(pow(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst())); - break; - case EOpMin: - if (isFloatingPoint) - newConstArray[comp].setDConst(std::min(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst())); - else if (isSigned) { - if (isInt64) - newConstArray[comp].setI64Const(std::min(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const())); - else - newConstArray[comp].setIConst(std::min(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst())); - } else { - if (isInt64) - newConstArray[comp].setU64Const(std::min(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const())); - else - newConstArray[comp].setUConst(std::min(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst())); - } - break; - case EOpMax: - if (isFloatingPoint) - newConstArray[comp].setDConst(std::max(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst())); - else if (isSigned) { - if (isInt64) - newConstArray[comp].setI64Const(std::max(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const())); - else - newConstArray[comp].setIConst(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst())); - } else { - if (isInt64) - newConstArray[comp].setU64Const(std::max(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const())); - else - newConstArray[comp].setUConst(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst())); - } - break; - case EOpClamp: - if (isFloatingPoint) - newConstArray[comp].setDConst(std::min(std::max(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst()), - childConstUnions[2][arg2comp].getDConst())); - else if (isSigned) { - if (isInt64) - newConstArray[comp].setI64Const(std::min(std::max(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const()), - childConstUnions[2][arg2comp].getI64Const())); - else - newConstArray[comp].setIConst(std::min(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()), - childConstUnions[2][arg2comp].getIConst())); - } else { - if (isInt64) - newConstArray[comp].setU64Const(std::min(std::max(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const()), - childConstUnions[2][arg2comp].getU64Const())); - else - newConstArray[comp].setUConst(std::min(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()), - childConstUnions[2][arg2comp].getUConst())); - } - break; - case EOpLessThan: - newConstArray[comp].setBConst(childConstUnions[0][arg0comp] < childConstUnions[1][arg1comp]); - break; - case EOpGreaterThan: - newConstArray[comp].setBConst(childConstUnions[0][arg0comp] > childConstUnions[1][arg1comp]); - break; - case EOpLessThanEqual: - newConstArray[comp].setBConst(! (childConstUnions[0][arg0comp] > childConstUnions[1][arg1comp])); - break; - case EOpGreaterThanEqual: - newConstArray[comp].setBConst(! (childConstUnions[0][arg0comp] < childConstUnions[1][arg1comp])); - break; - case EOpVectorEqual: - newConstArray[comp].setBConst(childConstUnions[0][arg0comp] == childConstUnions[1][arg1comp]); - break; - case EOpVectorNotEqual: - newConstArray[comp].setBConst(childConstUnions[0][arg0comp] != childConstUnions[1][arg1comp]); - break; - case EOpMix: - if (children[2]->getAsTyped()->getBasicType() == EbtBool) - newConstArray[comp].setDConst(childConstUnions[2][arg2comp].getBConst() ? childConstUnions[1][arg1comp].getDConst() : - childConstUnions[0][arg0comp].getDConst()); - else - newConstArray[comp].setDConst(childConstUnions[0][arg0comp].getDConst() * (1.0 - childConstUnions[2][arg2comp].getDConst()) + - childConstUnions[1][arg1comp].getDConst() * childConstUnions[2][arg2comp].getDConst()); - break; - case EOpStep: - newConstArray[comp].setDConst(childConstUnions[1][arg1comp].getDConst() < childConstUnions[0][arg0comp].getDConst() ? 0.0 : 1.0); - break; - case EOpSmoothStep: - { - double t = (childConstUnions[2][arg2comp].getDConst() - childConstUnions[0][arg0comp].getDConst()) / - (childConstUnions[1][arg1comp].getDConst() - childConstUnions[0][arg0comp].getDConst()); - if (t < 0.0) - t = 0.0; - if (t > 1.0) - t = 1.0; - newConstArray[comp].setDConst(t * t * (3.0 - 2.0 * t)); - break; - } - default: - return aggrNode; - } - } - } else { - // Non-componentwise... - - int numComps = children[0]->getAsConstantUnion()->getType().computeNumComponents(); - double dot; - - switch (aggrNode->getOp()) { - case EOpDistance: - { - double sum = 0.0; - for (int comp = 0; comp < numComps; ++comp) { - double diff = childConstUnions[1][comp].getDConst() - childConstUnions[0][comp].getDConst(); - sum += diff * diff; - } - newConstArray[0].setDConst(sqrt(sum)); - break; - } - case EOpDot: - newConstArray[0].setDConst(childConstUnions[0].dot(childConstUnions[1])); - break; - case EOpCross: - newConstArray[0] = childConstUnions[0][1] * childConstUnions[1][2] - childConstUnions[0][2] * childConstUnions[1][1]; - newConstArray[1] = childConstUnions[0][2] * childConstUnions[1][0] - childConstUnions[0][0] * childConstUnions[1][2]; - newConstArray[2] = childConstUnions[0][0] * childConstUnions[1][1] - childConstUnions[0][1] * childConstUnions[1][0]; - break; - case EOpFaceForward: - // If dot(Nref, I) < 0 return N, otherwise return -N: Arguments are (N, I, Nref). - dot = childConstUnions[1].dot(childConstUnions[2]); - for (int comp = 0; comp < numComps; ++comp) { - if (dot < 0.0) - newConstArray[comp] = childConstUnions[0][comp]; - else - newConstArray[comp].setDConst(-childConstUnions[0][comp].getDConst()); - } - break; - case EOpReflect: - // I - 2 * dot(N, I) * N: Arguments are (I, N). - dot = childConstUnions[0].dot(childConstUnions[1]); - dot *= 2.0; - for (int comp = 0; comp < numComps; ++comp) - newConstArray[comp].setDConst(childConstUnions[0][comp].getDConst() - dot * childConstUnions[1][comp].getDConst()); - break; - case EOpRefract: - { - // Arguments are (I, N, eta). - // k = 1.0 - eta * eta * (1.0 - dot(N, I) * dot(N, I)) - // if (k < 0.0) - // return dvec(0.0) - // else - // return eta * I - (eta * dot(N, I) + sqrt(k)) * N - dot = childConstUnions[0].dot(childConstUnions[1]); - double eta = childConstUnions[2][0].getDConst(); - double k = 1.0 - eta * eta * (1.0 - dot * dot); - if (k < 0.0) { - for (int comp = 0; comp < numComps; ++comp) - newConstArray[comp].setDConst(0.0); - } else { - for (int comp = 0; comp < numComps; ++comp) - newConstArray[comp].setDConst(eta * childConstUnions[0][comp].getDConst() - (eta * dot + sqrt(k)) * childConstUnions[1][comp].getDConst()); - } - break; - } - case EOpOuterProduct: - { - int numRows = numComps; - int numCols = children[1]->getAsConstantUnion()->getType().computeNumComponents(); - for (int row = 0; row < numRows; ++row) - for (int col = 0; col < numCols; ++col) - newConstArray[col * numRows + row] = childConstUnions[0][row] * childConstUnions[1][col]; - break; - } - default: - return aggrNode; - } - } - - TIntermConstantUnion *newNode = new TIntermConstantUnion(newConstArray, aggrNode->getType()); - newNode->getWritableType().getQualifier().storage = EvqConst; - newNode->setLoc(aggrNode->getLoc()); - - return newNode; -} - -bool TIntermediate::areAllChildConst(TIntermAggregate* aggrNode) -{ - bool allConstant = true; - - // check if all the child nodes are constants so that they can be inserted into - // the parent node - if (aggrNode) { - TIntermSequence& childSequenceVector = aggrNode->getSequence(); - for (TIntermSequence::iterator p = childSequenceVector.begin(); - p != childSequenceVector.end(); p++) { - if (!(*p)->getAsTyped()->getAsConstantUnion()) - return false; - } - } - - return allConstant; -} - -TIntermTyped* TIntermediate::foldConstructor(TIntermAggregate* aggrNode) -{ - bool error = false; - - TConstUnionArray unionArray(aggrNode->getType().computeNumComponents()); - if (aggrNode->getSequence().size() == 1) - error = parseConstTree(aggrNode, unionArray, aggrNode->getOp(), aggrNode->getType(), true); - else - error = parseConstTree(aggrNode, unionArray, aggrNode->getOp(), aggrNode->getType()); - - if (error) - return aggrNode; - - return addConstantUnion(unionArray, aggrNode->getType(), aggrNode->getLoc()); -} - -// -// Constant folding of a bracket (array-style) dereference or struct-like dot -// dereference. Can handle anything except a multi-character swizzle, though -// all swizzles may go to foldSwizzle(). -// -TIntermTyped* TIntermediate::foldDereference(TIntermTyped* node, int index, const TSourceLoc& loc) -{ - TType dereferencedType(node->getType(), index); - dereferencedType.getQualifier().storage = EvqConst; - TIntermTyped* result = 0; - int size = dereferencedType.computeNumComponents(); - - // arrays, vectors, matrices, all use simple multiplicative math - // while structures need to add up heterogeneous members - int start; - if (node->isArray() || ! node->isStruct()) - start = size * index; - else { - // it is a structure - assert(node->isStruct()); - start = 0; - for (int i = 0; i < index; ++i) - start += (*node->getType().getStruct())[i].type->computeNumComponents(); - } - - result = addConstantUnion(TConstUnionArray(node->getAsConstantUnion()->getConstArray(), start, size), node->getType(), loc); - - if (result == 0) - result = node; - else - result->setType(dereferencedType); - - return result; -} - -// -// Make a constant vector node or constant scalar node, representing a given -// constant vector and constant swizzle into it. -// -TIntermTyped* TIntermediate::foldSwizzle(TIntermTyped* node, TSwizzleSelectors& selectors, const TSourceLoc& loc) -{ - const TConstUnionArray& unionArray = node->getAsConstantUnion()->getConstArray(); - TConstUnionArray constArray(selectors.size()); - - for (int i = 0; i < selectors.size(); i++) - constArray[i] = unionArray[selectors[i]]; - - TIntermTyped* result = addConstantUnion(constArray, node->getType(), loc); - - if (result == 0) - result = node; - else - result->setType(TType(node->getBasicType(), EvqConst, selectors.size())); - - return result; -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/InfoSink.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/InfoSink.cpp deleted file mode 100644 index d00c4225..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/InfoSink.cpp +++ /dev/null @@ -1,113 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#include "../Include/InfoSink.h" - -#include - -namespace glslang { - -void TInfoSinkBase::append(const char* s) -{ - if (outputStream & EString) { - if (s == nullptr) - sink.append("(null)"); - else { - checkMem(strlen(s)); - sink.append(s); - } - } - -//#ifdef _WIN32 -// if (outputStream & EDebugger) -// OutputDebugString(s); -//#endif - - if (outputStream & EStdOut) - fprintf(stdout, "%s", s); -} - -void TInfoSinkBase::append(int count, char c) -{ - if (outputStream & EString) { - checkMem(count); - sink.append(count, c); - } - -//#ifdef _WIN32 -// if (outputStream & EDebugger) { -// char str[2]; -// str[0] = c; -// str[1] = '\0'; -// OutputDebugString(str); -// } -//#endif - - if (outputStream & EStdOut) - fprintf(stdout, "%c", c); -} - -void TInfoSinkBase::append(const TPersistString& t) -{ - if (outputStream & EString) { - checkMem(t.size()); - sink.append(t); - } - -//#ifdef _WIN32 -// if (outputStream & EDebugger) -// OutputDebugString(t.c_str()); -//#endif - - if (outputStream & EStdOut) - fprintf(stdout, "%s", t.c_str()); -} - -void TInfoSinkBase::append(const TString& t) -{ - if (outputStream & EString) { - checkMem(t.size()); - sink.append(t.c_str()); - } - -//#ifdef _WIN32 -// if (outputStream & EDebugger) -// OutputDebugString(t.c_str()); -//#endif - - if (outputStream & EStdOut) - fprintf(stdout, "%s", t.c_str()); -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Initialize.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Initialize.cpp deleted file mode 100644 index 4364bb66..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Initialize.cpp +++ /dev/null @@ -1,6478 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2012-2016 LunarG, Inc. -// Copyright (C) 2015-2017 Google, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -// -// Create strings that declare built-in definitions, add built-ins programmatically -// that cannot be expressed in the strings, and establish mappings between -// built-in functions and operators. -// -// Where to put a built-in: -// TBuiltIns::initialize(version,profile) context-independent textual built-ins; add them to the right string -// TBuiltIns::initialize(resources,...) context-dependent textual built-ins; add them to the right string -// TBuiltIns::identifyBuiltIns(...,symbolTable) context-independent programmatic additions/mappings to the symbol table, -// including identifying what extensions are needed if a version does not allow a symbol -// TBuiltIns::identifyBuiltIns(...,symbolTable, resources) context-dependent programmatic additions/mappings to the symbol table, -// including identifying what extensions are needed if a version does not allow a symbol -// - -#include "../Include/intermediate.h" -#include "Initialize.h" - -namespace glslang { - -// TODO: ARB_Compatability: do full extension support -const bool ARBCompatibility = true; - -const bool ForwardCompatibility = false; - -// change this back to false if depending on textual spellings of texturing calls when consuming the AST -// Using PureOperatorBuiltins=false is deprecated. -bool PureOperatorBuiltins = true; - -inline bool IncludeLegacy(int version, EProfile profile, const SpvVersion& spvVersion) -{ - return profile != EEsProfile && (version <= 130 || (spvVersion.spv == 0 && ARBCompatibility) || profile == ECompatibilityProfile); -} - -// Construct TBuiltInParseables base class. This can be used for language-common constructs. -TBuiltInParseables::TBuiltInParseables() -{ -} - -// Destroy TBuiltInParseables. -TBuiltInParseables::~TBuiltInParseables() -{ -} - -TBuiltIns::TBuiltIns() -{ - // Set up textual representations for making all the permutations - // of texturing/imaging functions. - prefixes[EbtFloat] = ""; - prefixes[EbtInt] = "i"; - prefixes[EbtUint] = "u"; - postfixes[2] = "2"; - postfixes[3] = "3"; - postfixes[4] = "4"; - - // Map from symbolic class of texturing dimension to numeric dimensions. - dimMap[Esd1D] = 1; - dimMap[Esd2D] = 2; - dimMap[EsdRect] = 2; - dimMap[Esd3D] = 3; - dimMap[EsdCube] = 3; - dimMap[EsdBuffer] = 1; - dimMap[EsdSubpass] = 2; // potientially unused for now -} - -TBuiltIns::~TBuiltIns() -{ -} - - -// -// Add all context-independent built-in functions and variables that are present -// for the given version and profile. Share common ones across stages, otherwise -// make stage-specific entries. -// -// Most built-ins variables can be added as simple text strings. Some need to -// be added programmatically, which is done later in IdentifyBuiltIns() below. -// -void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvVersion) -{ - //============================================================================ - // - // Prototypes for built-in functions seen by both vertex and fragment shaders. - // - //============================================================================ - - // - // Angle and Trigonometric Functions. - // - commonBuiltins.append( - "float radians(float degrees);" - "vec2 radians(vec2 degrees);" - "vec3 radians(vec3 degrees);" - "vec4 radians(vec4 degrees);" - - "float degrees(float radians);" - "vec2 degrees(vec2 radians);" - "vec3 degrees(vec3 radians);" - "vec4 degrees(vec4 radians);" - - "float sin(float angle);" - "vec2 sin(vec2 angle);" - "vec3 sin(vec3 angle);" - "vec4 sin(vec4 angle);" - - "float cos(float angle);" - "vec2 cos(vec2 angle);" - "vec3 cos(vec3 angle);" - "vec4 cos(vec4 angle);" - - "float tan(float angle);" - "vec2 tan(vec2 angle);" - "vec3 tan(vec3 angle);" - "vec4 tan(vec4 angle);" - - "float asin(float x);" - "vec2 asin(vec2 x);" - "vec3 asin(vec3 x);" - "vec4 asin(vec4 x);" - - "float acos(float x);" - "vec2 acos(vec2 x);" - "vec3 acos(vec3 x);" - "vec4 acos(vec4 x);" - - "float atan(float y, float x);" - "vec2 atan(vec2 y, vec2 x);" - "vec3 atan(vec3 y, vec3 x);" - "vec4 atan(vec4 y, vec4 x);" - - "float atan(float y_over_x);" - "vec2 atan(vec2 y_over_x);" - "vec3 atan(vec3 y_over_x);" - "vec4 atan(vec4 y_over_x);" - - "\n"); - - if (version >= 130) { - commonBuiltins.append( - "float sinh(float angle);" - "vec2 sinh(vec2 angle);" - "vec3 sinh(vec3 angle);" - "vec4 sinh(vec4 angle);" - - "float cosh(float angle);" - "vec2 cosh(vec2 angle);" - "vec3 cosh(vec3 angle);" - "vec4 cosh(vec4 angle);" - - "float tanh(float angle);" - "vec2 tanh(vec2 angle);" - "vec3 tanh(vec3 angle);" - "vec4 tanh(vec4 angle);" - - "float asinh(float x);" - "vec2 asinh(vec2 x);" - "vec3 asinh(vec3 x);" - "vec4 asinh(vec4 x);" - - "float acosh(float x);" - "vec2 acosh(vec2 x);" - "vec3 acosh(vec3 x);" - "vec4 acosh(vec4 x);" - - "float atanh(float y_over_x);" - "vec2 atanh(vec2 y_over_x);" - "vec3 atanh(vec3 y_over_x);" - "vec4 atanh(vec4 y_over_x);" - - "\n"); - } - - // - // Exponential Functions. - // - commonBuiltins.append( - "float pow(float x, float y);" - "vec2 pow(vec2 x, vec2 y);" - "vec3 pow(vec3 x, vec3 y);" - "vec4 pow(vec4 x, vec4 y);" - - "float exp(float x);" - "vec2 exp(vec2 x);" - "vec3 exp(vec3 x);" - "vec4 exp(vec4 x);" - - "float log(float x);" - "vec2 log(vec2 x);" - "vec3 log(vec3 x);" - "vec4 log(vec4 x);" - - "float exp2(float x);" - "vec2 exp2(vec2 x);" - "vec3 exp2(vec3 x);" - "vec4 exp2(vec4 x);" - - "float log2(float x);" - "vec2 log2(vec2 x);" - "vec3 log2(vec3 x);" - "vec4 log2(vec4 x);" - - "float sqrt(float x);" - "vec2 sqrt(vec2 x);" - "vec3 sqrt(vec3 x);" - "vec4 sqrt(vec4 x);" - - "float inversesqrt(float x);" - "vec2 inversesqrt(vec2 x);" - "vec3 inversesqrt(vec3 x);" - "vec4 inversesqrt(vec4 x);" - - "\n"); - - // - // Common Functions. - // - commonBuiltins.append( - "float abs(float x);" - "vec2 abs(vec2 x);" - "vec3 abs(vec3 x);" - "vec4 abs(vec4 x);" - - "float sign(float x);" - "vec2 sign(vec2 x);" - "vec3 sign(vec3 x);" - "vec4 sign(vec4 x);" - - "float floor(float x);" - "vec2 floor(vec2 x);" - "vec3 floor(vec3 x);" - "vec4 floor(vec4 x);" - - "float ceil(float x);" - "vec2 ceil(vec2 x);" - "vec3 ceil(vec3 x);" - "vec4 ceil(vec4 x);" - - "float fract(float x);" - "vec2 fract(vec2 x);" - "vec3 fract(vec3 x);" - "vec4 fract(vec4 x);" - - "float mod(float x, float y);" - "vec2 mod(vec2 x, float y);" - "vec3 mod(vec3 x, float y);" - "vec4 mod(vec4 x, float y);" - "vec2 mod(vec2 x, vec2 y);" - "vec3 mod(vec3 x, vec3 y);" - "vec4 mod(vec4 x, vec4 y);" - - "float min(float x, float y);" - "vec2 min(vec2 x, float y);" - "vec3 min(vec3 x, float y);" - "vec4 min(vec4 x, float y);" - "vec2 min(vec2 x, vec2 y);" - "vec3 min(vec3 x, vec3 y);" - "vec4 min(vec4 x, vec4 y);" - - "float max(float x, float y);" - "vec2 max(vec2 x, float y);" - "vec3 max(vec3 x, float y);" - "vec4 max(vec4 x, float y);" - "vec2 max(vec2 x, vec2 y);" - "vec3 max(vec3 x, vec3 y);" - "vec4 max(vec4 x, vec4 y);" - - "float clamp(float x, float minVal, float maxVal);" - "vec2 clamp(vec2 x, float minVal, float maxVal);" - "vec3 clamp(vec3 x, float minVal, float maxVal);" - "vec4 clamp(vec4 x, float minVal, float maxVal);" - "vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal);" - "vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal);" - "vec4 clamp(vec4 x, vec4 minVal, vec4 maxVal);" - - "float mix(float x, float y, float a);" - "vec2 mix(vec2 x, vec2 y, float a);" - "vec3 mix(vec3 x, vec3 y, float a);" - "vec4 mix(vec4 x, vec4 y, float a);" - "vec2 mix(vec2 x, vec2 y, vec2 a);" - "vec3 mix(vec3 x, vec3 y, vec3 a);" - "vec4 mix(vec4 x, vec4 y, vec4 a);" - - "float step(float edge, float x);" - "vec2 step(vec2 edge, vec2 x);" - "vec3 step(vec3 edge, vec3 x);" - "vec4 step(vec4 edge, vec4 x);" - "vec2 step(float edge, vec2 x);" - "vec3 step(float edge, vec3 x);" - "vec4 step(float edge, vec4 x);" - - "float smoothstep(float edge0, float edge1, float x);" - "vec2 smoothstep(vec2 edge0, vec2 edge1, vec2 x);" - "vec3 smoothstep(vec3 edge0, vec3 edge1, vec3 x);" - "vec4 smoothstep(vec4 edge0, vec4 edge1, vec4 x);" - "vec2 smoothstep(float edge0, float edge1, vec2 x);" - "vec3 smoothstep(float edge0, float edge1, vec3 x);" - "vec4 smoothstep(float edge0, float edge1, vec4 x);" - - "\n"); - - if (version >= 130) { - commonBuiltins.append( - " int abs( int x);" - "ivec2 abs(ivec2 x);" - "ivec3 abs(ivec3 x);" - "ivec4 abs(ivec4 x);" - - " int sign( int x);" - "ivec2 sign(ivec2 x);" - "ivec3 sign(ivec3 x);" - "ivec4 sign(ivec4 x);" - - "float trunc(float x);" - "vec2 trunc(vec2 x);" - "vec3 trunc(vec3 x);" - "vec4 trunc(vec4 x);" - - "float round(float x);" - "vec2 round(vec2 x);" - "vec3 round(vec3 x);" - "vec4 round(vec4 x);" - - "float roundEven(float x);" - "vec2 roundEven(vec2 x);" - "vec3 roundEven(vec3 x);" - "vec4 roundEven(vec4 x);" - - "float modf(float, out float);" - "vec2 modf(vec2, out vec2 );" - "vec3 modf(vec3, out vec3 );" - "vec4 modf(vec4, out vec4 );" - - " int min(int x, int y);" - "ivec2 min(ivec2 x, int y);" - "ivec3 min(ivec3 x, int y);" - "ivec4 min(ivec4 x, int y);" - "ivec2 min(ivec2 x, ivec2 y);" - "ivec3 min(ivec3 x, ivec3 y);" - "ivec4 min(ivec4 x, ivec4 y);" - - " uint min(uint x, uint y);" - "uvec2 min(uvec2 x, uint y);" - "uvec3 min(uvec3 x, uint y);" - "uvec4 min(uvec4 x, uint y);" - "uvec2 min(uvec2 x, uvec2 y);" - "uvec3 min(uvec3 x, uvec3 y);" - "uvec4 min(uvec4 x, uvec4 y);" - - " int max(int x, int y);" - "ivec2 max(ivec2 x, int y);" - "ivec3 max(ivec3 x, int y);" - "ivec4 max(ivec4 x, int y);" - "ivec2 max(ivec2 x, ivec2 y);" - "ivec3 max(ivec3 x, ivec3 y);" - "ivec4 max(ivec4 x, ivec4 y);" - - " uint max(uint x, uint y);" - "uvec2 max(uvec2 x, uint y);" - "uvec3 max(uvec3 x, uint y);" - "uvec4 max(uvec4 x, uint y);" - "uvec2 max(uvec2 x, uvec2 y);" - "uvec3 max(uvec3 x, uvec3 y);" - "uvec4 max(uvec4 x, uvec4 y);" - - "int clamp(int x, int minVal, int maxVal);" - "ivec2 clamp(ivec2 x, int minVal, int maxVal);" - "ivec3 clamp(ivec3 x, int minVal, int maxVal);" - "ivec4 clamp(ivec4 x, int minVal, int maxVal);" - "ivec2 clamp(ivec2 x, ivec2 minVal, ivec2 maxVal);" - "ivec3 clamp(ivec3 x, ivec3 minVal, ivec3 maxVal);" - "ivec4 clamp(ivec4 x, ivec4 minVal, ivec4 maxVal);" - - "uint clamp(uint x, uint minVal, uint maxVal);" - "uvec2 clamp(uvec2 x, uint minVal, uint maxVal);" - "uvec3 clamp(uvec3 x, uint minVal, uint maxVal);" - "uvec4 clamp(uvec4 x, uint minVal, uint maxVal);" - "uvec2 clamp(uvec2 x, uvec2 minVal, uvec2 maxVal);" - "uvec3 clamp(uvec3 x, uvec3 minVal, uvec3 maxVal);" - "uvec4 clamp(uvec4 x, uvec4 minVal, uvec4 maxVal);" - - "float mix(float x, float y, bool a);" - "vec2 mix(vec2 x, vec2 y, bvec2 a);" - "vec3 mix(vec3 x, vec3 y, bvec3 a);" - "vec4 mix(vec4 x, vec4 y, bvec4 a);" - - "bool isnan(float x);" - "bvec2 isnan(vec2 x);" - "bvec3 isnan(vec3 x);" - "bvec4 isnan(vec4 x);" - - "bool isinf(float x);" - "bvec2 isinf(vec2 x);" - "bvec3 isinf(vec3 x);" - "bvec4 isinf(vec4 x);" - - "\n"); - } - - // - // double functions added to desktop 4.00, but not fma, frexp, ldexp, or pack/unpack - // - if (profile != EEsProfile && version >= 400) { - commonBuiltins.append( - - "double sqrt(double);" - "dvec2 sqrt(dvec2);" - "dvec3 sqrt(dvec3);" - "dvec4 sqrt(dvec4);" - - "double inversesqrt(double);" - "dvec2 inversesqrt(dvec2);" - "dvec3 inversesqrt(dvec3);" - "dvec4 inversesqrt(dvec4);" - - "double abs(double);" - "dvec2 abs(dvec2);" - "dvec3 abs(dvec3);" - "dvec4 abs(dvec4);" - - "double sign(double);" - "dvec2 sign(dvec2);" - "dvec3 sign(dvec3);" - "dvec4 sign(dvec4);" - - "double floor(double);" - "dvec2 floor(dvec2);" - "dvec3 floor(dvec3);" - "dvec4 floor(dvec4);" - - "double trunc(double);" - "dvec2 trunc(dvec2);" - "dvec3 trunc(dvec3);" - "dvec4 trunc(dvec4);" - - "double round(double);" - "dvec2 round(dvec2);" - "dvec3 round(dvec3);" - "dvec4 round(dvec4);" - - "double roundEven(double);" - "dvec2 roundEven(dvec2);" - "dvec3 roundEven(dvec3);" - "dvec4 roundEven(dvec4);" - - "double ceil(double);" - "dvec2 ceil(dvec2);" - "dvec3 ceil(dvec3);" - "dvec4 ceil(dvec4);" - - "double fract(double);" - "dvec2 fract(dvec2);" - "dvec3 fract(dvec3);" - "dvec4 fract(dvec4);" - - "double mod(double, double);" - "dvec2 mod(dvec2 , double);" - "dvec3 mod(dvec3 , double);" - "dvec4 mod(dvec4 , double);" - "dvec2 mod(dvec2 , dvec2);" - "dvec3 mod(dvec3 , dvec3);" - "dvec4 mod(dvec4 , dvec4);" - - "double modf(double, out double);" - "dvec2 modf(dvec2, out dvec2);" - "dvec3 modf(dvec3, out dvec3);" - "dvec4 modf(dvec4, out dvec4);" - - "double min(double, double);" - "dvec2 min(dvec2, double);" - "dvec3 min(dvec3, double);" - "dvec4 min(dvec4, double);" - "dvec2 min(dvec2, dvec2);" - "dvec3 min(dvec3, dvec3);" - "dvec4 min(dvec4, dvec4);" - - "double max(double, double);" - "dvec2 max(dvec2 , double);" - "dvec3 max(dvec3 , double);" - "dvec4 max(dvec4 , double);" - "dvec2 max(dvec2 , dvec2);" - "dvec3 max(dvec3 , dvec3);" - "dvec4 max(dvec4 , dvec4);" - - "double clamp(double, double, double);" - "dvec2 clamp(dvec2 , double, double);" - "dvec3 clamp(dvec3 , double, double);" - "dvec4 clamp(dvec4 , double, double);" - "dvec2 clamp(dvec2 , dvec2 , dvec2);" - "dvec3 clamp(dvec3 , dvec3 , dvec3);" - "dvec4 clamp(dvec4 , dvec4 , dvec4);" - - "double mix(double, double, double);" - "dvec2 mix(dvec2, dvec2, double);" - "dvec3 mix(dvec3, dvec3, double);" - "dvec4 mix(dvec4, dvec4, double);" - "dvec2 mix(dvec2, dvec2, dvec2);" - "dvec3 mix(dvec3, dvec3, dvec3);" - "dvec4 mix(dvec4, dvec4, dvec4);" - "double mix(double, double, bool);" - "dvec2 mix(dvec2, dvec2, bvec2);" - "dvec3 mix(dvec3, dvec3, bvec3);" - "dvec4 mix(dvec4, dvec4, bvec4);" - - "double step(double, double);" - "dvec2 step(dvec2 , dvec2);" - "dvec3 step(dvec3 , dvec3);" - "dvec4 step(dvec4 , dvec4);" - "dvec2 step(double, dvec2);" - "dvec3 step(double, dvec3);" - "dvec4 step(double, dvec4);" - - "double smoothstep(double, double, double);" - "dvec2 smoothstep(dvec2 , dvec2 , dvec2);" - "dvec3 smoothstep(dvec3 , dvec3 , dvec3);" - "dvec4 smoothstep(dvec4 , dvec4 , dvec4);" - "dvec2 smoothstep(double, double, dvec2);" - "dvec3 smoothstep(double, double, dvec3);" - "dvec4 smoothstep(double, double, dvec4);" - - "bool isnan(double);" - "bvec2 isnan(dvec2);" - "bvec3 isnan(dvec3);" - "bvec4 isnan(dvec4);" - - "bool isinf(double);" - "bvec2 isinf(dvec2);" - "bvec3 isinf(dvec3);" - "bvec4 isinf(dvec4);" - - "double length(double);" - "double length(dvec2);" - "double length(dvec3);" - "double length(dvec4);" - - "double distance(double, double);" - "double distance(dvec2 , dvec2);" - "double distance(dvec3 , dvec3);" - "double distance(dvec4 , dvec4);" - - "double dot(double, double);" - "double dot(dvec2 , dvec2);" - "double dot(dvec3 , dvec3);" - "double dot(dvec4 , dvec4);" - - "dvec3 cross(dvec3, dvec3);" - - "double normalize(double);" - "dvec2 normalize(dvec2);" - "dvec3 normalize(dvec3);" - "dvec4 normalize(dvec4);" - - "double faceforward(double, double, double);" - "dvec2 faceforward(dvec2, dvec2, dvec2);" - "dvec3 faceforward(dvec3, dvec3, dvec3);" - "dvec4 faceforward(dvec4, dvec4, dvec4);" - - "double reflect(double, double);" - "dvec2 reflect(dvec2 , dvec2 );" - "dvec3 reflect(dvec3 , dvec3 );" - "dvec4 reflect(dvec4 , dvec4 );" - - "double refract(double, double, double);" - "dvec2 refract(dvec2 , dvec2 , double);" - "dvec3 refract(dvec3 , dvec3 , double);" - "dvec4 refract(dvec4 , dvec4 , double);" - - "dmat2 matrixCompMult(dmat2, dmat2);" - "dmat3 matrixCompMult(dmat3, dmat3);" - "dmat4 matrixCompMult(dmat4, dmat4);" - "dmat2x3 matrixCompMult(dmat2x3, dmat2x3);" - "dmat2x4 matrixCompMult(dmat2x4, dmat2x4);" - "dmat3x2 matrixCompMult(dmat3x2, dmat3x2);" - "dmat3x4 matrixCompMult(dmat3x4, dmat3x4);" - "dmat4x2 matrixCompMult(dmat4x2, dmat4x2);" - "dmat4x3 matrixCompMult(dmat4x3, dmat4x3);" - - "dmat2 outerProduct(dvec2, dvec2);" - "dmat3 outerProduct(dvec3, dvec3);" - "dmat4 outerProduct(dvec4, dvec4);" - "dmat2x3 outerProduct(dvec3, dvec2);" - "dmat3x2 outerProduct(dvec2, dvec3);" - "dmat2x4 outerProduct(dvec4, dvec2);" - "dmat4x2 outerProduct(dvec2, dvec4);" - "dmat3x4 outerProduct(dvec4, dvec3);" - "dmat4x3 outerProduct(dvec3, dvec4);" - - "dmat2 transpose(dmat2);" - "dmat3 transpose(dmat3);" - "dmat4 transpose(dmat4);" - "dmat2x3 transpose(dmat3x2);" - "dmat3x2 transpose(dmat2x3);" - "dmat2x4 transpose(dmat4x2);" - "dmat4x2 transpose(dmat2x4);" - "dmat3x4 transpose(dmat4x3);" - "dmat4x3 transpose(dmat3x4);" - - "double determinant(dmat2);" - "double determinant(dmat3);" - "double determinant(dmat4);" - - "dmat2 inverse(dmat2);" - "dmat3 inverse(dmat3);" - "dmat4 inverse(dmat4);" - - "bvec2 lessThan(dvec2, dvec2);" - "bvec3 lessThan(dvec3, dvec3);" - "bvec4 lessThan(dvec4, dvec4);" - - "bvec2 lessThanEqual(dvec2, dvec2);" - "bvec3 lessThanEqual(dvec3, dvec3);" - "bvec4 lessThanEqual(dvec4, dvec4);" - - "bvec2 greaterThan(dvec2, dvec2);" - "bvec3 greaterThan(dvec3, dvec3);" - "bvec4 greaterThan(dvec4, dvec4);" - - "bvec2 greaterThanEqual(dvec2, dvec2);" - "bvec3 greaterThanEqual(dvec3, dvec3);" - "bvec4 greaterThanEqual(dvec4, dvec4);" - - "bvec2 equal(dvec2, dvec2);" - "bvec3 equal(dvec3, dvec3);" - "bvec4 equal(dvec4, dvec4);" - - "bvec2 notEqual(dvec2, dvec2);" - "bvec3 notEqual(dvec3, dvec3);" - "bvec4 notEqual(dvec4, dvec4);" - - "\n"); - } - - if (profile != EEsProfile && version >= 450) { - commonBuiltins.append( - - "int64_t abs(int64_t);" - "i64vec2 abs(i64vec2);" - "i64vec3 abs(i64vec3);" - "i64vec4 abs(i64vec4);" - - "int64_t sign(int64_t);" - "i64vec2 sign(i64vec2);" - "i64vec3 sign(i64vec3);" - "i64vec4 sign(i64vec4);" - - "int64_t min(int64_t, int64_t);" - "i64vec2 min(i64vec2, int64_t);" - "i64vec3 min(i64vec3, int64_t);" - "i64vec4 min(i64vec4, int64_t);" - "i64vec2 min(i64vec2, i64vec2);" - "i64vec3 min(i64vec3, i64vec3);" - "i64vec4 min(i64vec4, i64vec4);" - "uint64_t min(uint64_t, uint64_t);" - "u64vec2 min(u64vec2, uint64_t);" - "u64vec3 min(u64vec3, uint64_t);" - "u64vec4 min(u64vec4, uint64_t);" - "u64vec2 min(u64vec2, u64vec2);" - "u64vec3 min(u64vec3, u64vec3);" - "u64vec4 min(u64vec4, u64vec4);" - - "int64_t max(int64_t, int64_t);" - "i64vec2 max(i64vec2, int64_t);" - "i64vec3 max(i64vec3, int64_t);" - "i64vec4 max(i64vec4, int64_t);" - "i64vec2 max(i64vec2, i64vec2);" - "i64vec3 max(i64vec3, i64vec3);" - "i64vec4 max(i64vec4, i64vec4);" - "uint64_t max(uint64_t, uint64_t);" - "u64vec2 max(u64vec2, uint64_t);" - "u64vec3 max(u64vec3, uint64_t);" - "u64vec4 max(u64vec4, uint64_t);" - "u64vec2 max(u64vec2, u64vec2);" - "u64vec3 max(u64vec3, u64vec3);" - "u64vec4 max(u64vec4, u64vec4);" - - "int64_t clamp(int64_t, int64_t, int64_t);" - "i64vec2 clamp(i64vec2, int64_t, int64_t);" - "i64vec3 clamp(i64vec3, int64_t, int64_t);" - "i64vec4 clamp(i64vec4, int64_t, int64_t);" - "i64vec2 clamp(i64vec2, i64vec2, i64vec2);" - "i64vec3 clamp(i64vec3, i64vec3, i64vec3);" - "i64vec4 clamp(i64vec4, i64vec4, i64vec4);" - "uint64_t clamp(uint64_t, uint64_t, uint64_t);" - "u64vec2 clamp(u64vec2, uint64_t, uint64_t);" - "u64vec3 clamp(u64vec3, uint64_t, uint64_t);" - "u64vec4 clamp(u64vec4, uint64_t, uint64_t);" - "u64vec2 clamp(u64vec2, u64vec2, u64vec2);" - "u64vec3 clamp(u64vec3, u64vec3, u64vec3);" - "u64vec4 clamp(u64vec4, u64vec4, u64vec4);" - - "int64_t mix(int64_t, int64_t, bool);" - "i64vec2 mix(i64vec2, i64vec2, bvec2);" - "i64vec3 mix(i64vec3, i64vec3, bvec3);" - "i64vec4 mix(i64vec4, i64vec4, bvec4);" - "uint64_t mix(uint64_t, uint64_t, bool);" - "u64vec2 mix(u64vec2, u64vec2, bvec2);" - "u64vec3 mix(u64vec3, u64vec3, bvec3);" - "u64vec4 mix(u64vec4, u64vec4, bvec4);" - - "int64_t doubleBitsToInt64(double);" - "i64vec2 doubleBitsToInt64(dvec2);" - "i64vec3 doubleBitsToInt64(dvec3);" - "i64vec4 doubleBitsToInt64(dvec4);" - - "uint64_t doubleBitsToUint64(double);" - "u64vec2 doubleBitsToUint64(dvec2);" - "u64vec3 doubleBitsToUint64(dvec3);" - "u64vec4 doubleBitsToUint64(dvec4);" - - "double int64BitsToDouble(int64_t);" - "dvec2 int64BitsToDouble(i64vec2);" - "dvec3 int64BitsToDouble(i64vec3);" - "dvec4 int64BitsToDouble(i64vec4);" - - "double uint64BitsToDouble(uint64_t);" - "dvec2 uint64BitsToDouble(u64vec2);" - "dvec3 uint64BitsToDouble(u64vec3);" - "dvec4 uint64BitsToDouble(u64vec4);" - - "int64_t packInt2x32(ivec2);" - "uint64_t packUint2x32(uvec2);" - "ivec2 unpackInt2x32(int64_t);" - "uvec2 unpackUint2x32(uint64_t);" - - "bvec2 lessThan(i64vec2, i64vec2);" - "bvec3 lessThan(i64vec3, i64vec3);" - "bvec4 lessThan(i64vec4, i64vec4);" - "bvec2 lessThan(u64vec2, u64vec2);" - "bvec3 lessThan(u64vec3, u64vec3);" - "bvec4 lessThan(u64vec4, u64vec4);" - - "bvec2 lessThanEqual(i64vec2, i64vec2);" - "bvec3 lessThanEqual(i64vec3, i64vec3);" - "bvec4 lessThanEqual(i64vec4, i64vec4);" - "bvec2 lessThanEqual(u64vec2, u64vec2);" - "bvec3 lessThanEqual(u64vec3, u64vec3);" - "bvec4 lessThanEqual(u64vec4, u64vec4);" - - "bvec2 greaterThan(i64vec2, i64vec2);" - "bvec3 greaterThan(i64vec3, i64vec3);" - "bvec4 greaterThan(i64vec4, i64vec4);" - "bvec2 greaterThan(u64vec2, u64vec2);" - "bvec3 greaterThan(u64vec3, u64vec3);" - "bvec4 greaterThan(u64vec4, u64vec4);" - - "bvec2 greaterThanEqual(i64vec2, i64vec2);" - "bvec3 greaterThanEqual(i64vec3, i64vec3);" - "bvec4 greaterThanEqual(i64vec4, i64vec4);" - "bvec2 greaterThanEqual(u64vec2, u64vec2);" - "bvec3 greaterThanEqual(u64vec3, u64vec3);" - "bvec4 greaterThanEqual(u64vec4, u64vec4);" - - "bvec2 equal(i64vec2, i64vec2);" - "bvec3 equal(i64vec3, i64vec3);" - "bvec4 equal(i64vec4, i64vec4);" - "bvec2 equal(u64vec2, u64vec2);" - "bvec3 equal(u64vec3, u64vec3);" - "bvec4 equal(u64vec4, u64vec4);" - - "bvec2 notEqual(i64vec2, i64vec2);" - "bvec3 notEqual(i64vec3, i64vec3);" - "bvec4 notEqual(i64vec4, i64vec4);" - "bvec2 notEqual(u64vec2, u64vec2);" - "bvec3 notEqual(u64vec3, u64vec3);" - "bvec4 notEqual(u64vec4, u64vec4);" - -#ifdef AMD_EXTENSIONS - "int findLSB(int64_t);" - "ivec2 findLSB(i64vec2);" - "ivec3 findLSB(i64vec3);" - "ivec4 findLSB(i64vec4);" - - "int findLSB(uint64_t);" - "ivec2 findLSB(u64vec2);" - "ivec3 findLSB(u64vec3);" - "ivec4 findLSB(u64vec4);" - - "int findMSB(int64_t);" - "ivec2 findMSB(i64vec2);" - "ivec3 findMSB(i64vec3);" - "ivec4 findMSB(i64vec4);" - - "int findMSB(uint64_t);" - "ivec2 findMSB(u64vec2);" - "ivec3 findMSB(u64vec3);" - "ivec4 findMSB(u64vec4);" -#endif - "\n" - ); - } - -#ifdef AMD_EXTENSIONS - // GL_AMD_shader_trinary_minmax - if (profile != EEsProfile && version >= 430) { - commonBuiltins.append( - "float min3(float, float, float);" - "vec2 min3(vec2, vec2, vec2);" - "vec3 min3(vec3, vec3, vec3);" - "vec4 min3(vec4, vec4, vec4);" - - "int min3(int, int, int);" - "ivec2 min3(ivec2, ivec2, ivec2);" - "ivec3 min3(ivec3, ivec3, ivec3);" - "ivec4 min3(ivec4, ivec4, ivec4);" - - "uint min3(uint, uint, uint);" - "uvec2 min3(uvec2, uvec2, uvec2);" - "uvec3 min3(uvec3, uvec3, uvec3);" - "uvec4 min3(uvec4, uvec4, uvec4);" - - "float max3(float, float, float);" - "vec2 max3(vec2, vec2, vec2);" - "vec3 max3(vec3, vec3, vec3);" - "vec4 max3(vec4, vec4, vec4);" - - "int max3(int, int, int);" - "ivec2 max3(ivec2, ivec2, ivec2);" - "ivec3 max3(ivec3, ivec3, ivec3);" - "ivec4 max3(ivec4, ivec4, ivec4);" - - "uint max3(uint, uint, uint);" - "uvec2 max3(uvec2, uvec2, uvec2);" - "uvec3 max3(uvec3, uvec3, uvec3);" - "uvec4 max3(uvec4, uvec4, uvec4);" - - "float mid3(float, float, float);" - "vec2 mid3(vec2, vec2, vec2);" - "vec3 mid3(vec3, vec3, vec3);" - "vec4 mid3(vec4, vec4, vec4);" - - "int mid3(int, int, int);" - "ivec2 mid3(ivec2, ivec2, ivec2);" - "ivec3 mid3(ivec3, ivec3, ivec3);" - "ivec4 mid3(ivec4, ivec4, ivec4);" - - "uint mid3(uint, uint, uint);" - "uvec2 mid3(uvec2, uvec2, uvec2);" - "uvec3 mid3(uvec3, uvec3, uvec3);" - "uvec4 mid3(uvec4, uvec4, uvec4);" - - "float16_t min3(float16_t, float16_t, float16_t);" - "f16vec2 min3(f16vec2, f16vec2, f16vec2);" - "f16vec3 min3(f16vec3, f16vec3, f16vec3);" - "f16vec4 min3(f16vec4, f16vec4, f16vec4);" - - "float16_t max3(float16_t, float16_t, float16_t);" - "f16vec2 max3(f16vec2, f16vec2, f16vec2);" - "f16vec3 max3(f16vec3, f16vec3, f16vec3);" - "f16vec4 max3(f16vec4, f16vec4, f16vec4);" - - "float16_t mid3(float16_t, float16_t, float16_t);" - "f16vec2 mid3(f16vec2, f16vec2, f16vec2);" - "f16vec3 mid3(f16vec3, f16vec3, f16vec3);" - "f16vec4 mid3(f16vec4, f16vec4, f16vec4);" - - "\n" - ); - } -#endif - - if ((profile == EEsProfile && version >= 310) || - (profile != EEsProfile && version >= 430)) { - commonBuiltins.append( - "uint atomicAdd(coherent volatile inout uint, uint);" - " int atomicAdd(coherent volatile inout int, int);" - - "uint atomicMin(coherent volatile inout uint, uint);" - " int atomicMin(coherent volatile inout int, int);" - - "uint atomicMax(coherent volatile inout uint, uint);" - " int atomicMax(coherent volatile inout int, int);" - - "uint atomicAnd(coherent volatile inout uint, uint);" - " int atomicAnd(coherent volatile inout int, int);" - - "uint atomicOr (coherent volatile inout uint, uint);" - " int atomicOr (coherent volatile inout int, int);" - - "uint atomicXor(coherent volatile inout uint, uint);" - " int atomicXor(coherent volatile inout int, int);" - - "uint atomicExchange(coherent volatile inout uint, uint);" - " int atomicExchange(coherent volatile inout int, int);" - - "uint atomicCompSwap(coherent volatile inout uint, uint, uint);" - " int atomicCompSwap(coherent volatile inout int, int, int);" - - "\n"); - } - -#ifdef NV_EXTENSIONS - if (profile != EEsProfile && version >= 440) { - commonBuiltins.append( - "uint64_t atomicMin(coherent volatile inout uint64_t, uint64_t);" - " int64_t atomicMin(coherent volatile inout int64_t, int64_t);" - - "uint64_t atomicMax(coherent volatile inout uint64_t, uint64_t);" - " int64_t atomicMax(coherent volatile inout int64_t, int64_t);" - - "uint64_t atomicAnd(coherent volatile inout uint64_t, uint64_t);" - " int64_t atomicAnd(coherent volatile inout int64_t, int64_t);" - - "uint64_t atomicOr (coherent volatile inout uint64_t, uint64_t);" - " int64_t atomicOr (coherent volatile inout int64_t, int64_t);" - - "uint64_t atomicXor(coherent volatile inout uint64_t, uint64_t);" - " int64_t atomicXor(coherent volatile inout int64_t, int64_t);" - - " int64_t atomicAdd(coherent volatile inout int64_t, int64_t);" - " int64_t atomicExchange(coherent volatile inout int64_t, int64_t);" - " int64_t atomicCompSwap(coherent volatile inout int64_t, int64_t, int64_t);" - - "\n"); - } -#endif - - if ((profile == EEsProfile && version >= 310) || - (profile != EEsProfile && version >= 450)) { - commonBuiltins.append( - "int mix(int x, int y, bool a);" - "ivec2 mix(ivec2 x, ivec2 y, bvec2 a);" - "ivec3 mix(ivec3 x, ivec3 y, bvec3 a);" - "ivec4 mix(ivec4 x, ivec4 y, bvec4 a);" - - "uint mix(uint x, uint y, bool a);" - "uvec2 mix(uvec2 x, uvec2 y, bvec2 a);" - "uvec3 mix(uvec3 x, uvec3 y, bvec3 a);" - "uvec4 mix(uvec4 x, uvec4 y, bvec4 a);" - - "bool mix(bool x, bool y, bool a);" - "bvec2 mix(bvec2 x, bvec2 y, bvec2 a);" - "bvec3 mix(bvec3 x, bvec3 y, bvec3 a);" - "bvec4 mix(bvec4 x, bvec4 y, bvec4 a);" - - "\n"); - } - - if ((profile == EEsProfile && version >= 300) || - (profile != EEsProfile && version >= 330)) { - commonBuiltins.append( - "int floatBitsToInt(highp float value);" - "ivec2 floatBitsToInt(highp vec2 value);" - "ivec3 floatBitsToInt(highp vec3 value);" - "ivec4 floatBitsToInt(highp vec4 value);" - - "uint floatBitsToUint(highp float value);" - "uvec2 floatBitsToUint(highp vec2 value);" - "uvec3 floatBitsToUint(highp vec3 value);" - "uvec4 floatBitsToUint(highp vec4 value);" - - "float intBitsToFloat(highp int value);" - "vec2 intBitsToFloat(highp ivec2 value);" - "vec3 intBitsToFloat(highp ivec3 value);" - "vec4 intBitsToFloat(highp ivec4 value);" - - "float uintBitsToFloat(highp uint value);" - "vec2 uintBitsToFloat(highp uvec2 value);" - "vec3 uintBitsToFloat(highp uvec3 value);" - "vec4 uintBitsToFloat(highp uvec4 value);" - - "\n"); - } - - if ((profile != EEsProfile && version >= 400) || - (profile == EEsProfile && version >= 310)) { // GL_OES_gpu_shader5 - - commonBuiltins.append( - "float fma(float, float, float );" - "vec2 fma(vec2, vec2, vec2 );" - "vec3 fma(vec3, vec3, vec3 );" - "vec4 fma(vec4, vec4, vec4 );" - "\n"); - - if (profile != EEsProfile) { - commonBuiltins.append( - "double fma(double, double, double);" - "dvec2 fma(dvec2, dvec2, dvec2 );" - "dvec3 fma(dvec3, dvec3, dvec3 );" - "dvec4 fma(dvec4, dvec4, dvec4 );" - "\n"); - } - } - - if ((profile == EEsProfile && version >= 310) || - (profile != EEsProfile && version >= 400)) { - commonBuiltins.append( - "float frexp(highp float, out highp int);" - "vec2 frexp(highp vec2, out highp ivec2);" - "vec3 frexp(highp vec3, out highp ivec3);" - "vec4 frexp(highp vec4, out highp ivec4);" - - "float ldexp(highp float, highp int);" - "vec2 ldexp(highp vec2, highp ivec2);" - "vec3 ldexp(highp vec3, highp ivec3);" - "vec4 ldexp(highp vec4, highp ivec4);" - - "\n"); - } - - if (profile != EEsProfile && version >= 400) { - commonBuiltins.append( - "double frexp(double, out int);" - "dvec2 frexp( dvec2, out ivec2);" - "dvec3 frexp( dvec3, out ivec3);" - "dvec4 frexp( dvec4, out ivec4);" - - "double ldexp(double, int);" - "dvec2 ldexp( dvec2, ivec2);" - "dvec3 ldexp( dvec3, ivec3);" - "dvec4 ldexp( dvec4, ivec4);" - - "double packDouble2x32(uvec2);" - "uvec2 unpackDouble2x32(double);" - - "\n"); - } - - if ((profile == EEsProfile && version >= 300) || - (profile != EEsProfile && version >= 400)) { - commonBuiltins.append( - "highp uint packUnorm2x16(vec2);" - "vec2 unpackUnorm2x16(highp uint);" - "\n"); - } - - if ((profile == EEsProfile && version >= 300) || - (profile != EEsProfile && version >= 420)) { - commonBuiltins.append( - "highp uint packSnorm2x16(vec2);" - " vec2 unpackSnorm2x16(highp uint);" - "highp uint packHalf2x16(vec2);" - "\n"); - } - - if (profile == EEsProfile && version >= 300) { - commonBuiltins.append( - "mediump vec2 unpackHalf2x16(highp uint);" - "\n"); - } else if (profile != EEsProfile && version >= 420) { - commonBuiltins.append( - " vec2 unpackHalf2x16(highp uint);" - "\n"); - } - - if ((profile == EEsProfile && version >= 310) || - (profile != EEsProfile && version >= 400)) { - commonBuiltins.append( - "highp uint packSnorm4x8(vec4);" - "highp uint packUnorm4x8(vec4);" - "\n"); - } - - if (profile == EEsProfile && version >= 310) { - commonBuiltins.append( - "mediump vec4 unpackSnorm4x8(highp uint);" - "mediump vec4 unpackUnorm4x8(highp uint);" - "\n"); - } else if (profile != EEsProfile && version >= 400) { - commonBuiltins.append( - "vec4 unpackSnorm4x8(highp uint);" - "vec4 unpackUnorm4x8(highp uint);" - "\n"); - } - - // - // Geometric Functions. - // - commonBuiltins.append( - "float length(float x);" - "float length(vec2 x);" - "float length(vec3 x);" - "float length(vec4 x);" - - "float distance(float p0, float p1);" - "float distance(vec2 p0, vec2 p1);" - "float distance(vec3 p0, vec3 p1);" - "float distance(vec4 p0, vec4 p1);" - - "float dot(float x, float y);" - "float dot(vec2 x, vec2 y);" - "float dot(vec3 x, vec3 y);" - "float dot(vec4 x, vec4 y);" - - "vec3 cross(vec3 x, vec3 y);" - "float normalize(float x);" - "vec2 normalize(vec2 x);" - "vec3 normalize(vec3 x);" - "vec4 normalize(vec4 x);" - - "float faceforward(float N, float I, float Nref);" - "vec2 faceforward(vec2 N, vec2 I, vec2 Nref);" - "vec3 faceforward(vec3 N, vec3 I, vec3 Nref);" - "vec4 faceforward(vec4 N, vec4 I, vec4 Nref);" - - "float reflect(float I, float N);" - "vec2 reflect(vec2 I, vec2 N);" - "vec3 reflect(vec3 I, vec3 N);" - "vec4 reflect(vec4 I, vec4 N);" - - "float refract(float I, float N, float eta);" - "vec2 refract(vec2 I, vec2 N, float eta);" - "vec3 refract(vec3 I, vec3 N, float eta);" - "vec4 refract(vec4 I, vec4 N, float eta);" - - "\n"); - - // - // Matrix Functions. - // - commonBuiltins.append( - "mat2 matrixCompMult(mat2 x, mat2 y);" - "mat3 matrixCompMult(mat3 x, mat3 y);" - "mat4 matrixCompMult(mat4 x, mat4 y);" - - "\n"); - - // 120 is correct for both ES and desktop - if (version >= 120) { - commonBuiltins.append( - "mat2 outerProduct(vec2 c, vec2 r);" - "mat3 outerProduct(vec3 c, vec3 r);" - "mat4 outerProduct(vec4 c, vec4 r);" - "mat2x3 outerProduct(vec3 c, vec2 r);" - "mat3x2 outerProduct(vec2 c, vec3 r);" - "mat2x4 outerProduct(vec4 c, vec2 r);" - "mat4x2 outerProduct(vec2 c, vec4 r);" - "mat3x4 outerProduct(vec4 c, vec3 r);" - "mat4x3 outerProduct(vec3 c, vec4 r);" - - "mat2 transpose(mat2 m);" - "mat3 transpose(mat3 m);" - "mat4 transpose(mat4 m);" - "mat2x3 transpose(mat3x2 m);" - "mat3x2 transpose(mat2x3 m);" - "mat2x4 transpose(mat4x2 m);" - "mat4x2 transpose(mat2x4 m);" - "mat3x4 transpose(mat4x3 m);" - "mat4x3 transpose(mat3x4 m);" - - "mat2x3 matrixCompMult(mat2x3, mat2x3);" - "mat2x4 matrixCompMult(mat2x4, mat2x4);" - "mat3x2 matrixCompMult(mat3x2, mat3x2);" - "mat3x4 matrixCompMult(mat3x4, mat3x4);" - "mat4x2 matrixCompMult(mat4x2, mat4x2);" - "mat4x3 matrixCompMult(mat4x3, mat4x3);" - - "\n"); - - // 150 is correct for both ES and desktop - if (version >= 150) { - commonBuiltins.append( - "float determinant(mat2 m);" - "float determinant(mat3 m);" - "float determinant(mat4 m);" - - "mat2 inverse(mat2 m);" - "mat3 inverse(mat3 m);" - "mat4 inverse(mat4 m);" - - "\n"); - } - } - - // - // Vector relational functions. - // - commonBuiltins.append( - "bvec2 lessThan(vec2 x, vec2 y);" - "bvec3 lessThan(vec3 x, vec3 y);" - "bvec4 lessThan(vec4 x, vec4 y);" - - "bvec2 lessThan(ivec2 x, ivec2 y);" - "bvec3 lessThan(ivec3 x, ivec3 y);" - "bvec4 lessThan(ivec4 x, ivec4 y);" - - "bvec2 lessThanEqual(vec2 x, vec2 y);" - "bvec3 lessThanEqual(vec3 x, vec3 y);" - "bvec4 lessThanEqual(vec4 x, vec4 y);" - - "bvec2 lessThanEqual(ivec2 x, ivec2 y);" - "bvec3 lessThanEqual(ivec3 x, ivec3 y);" - "bvec4 lessThanEqual(ivec4 x, ivec4 y);" - - "bvec2 greaterThan(vec2 x, vec2 y);" - "bvec3 greaterThan(vec3 x, vec3 y);" - "bvec4 greaterThan(vec4 x, vec4 y);" - - "bvec2 greaterThan(ivec2 x, ivec2 y);" - "bvec3 greaterThan(ivec3 x, ivec3 y);" - "bvec4 greaterThan(ivec4 x, ivec4 y);" - - "bvec2 greaterThanEqual(vec2 x, vec2 y);" - "bvec3 greaterThanEqual(vec3 x, vec3 y);" - "bvec4 greaterThanEqual(vec4 x, vec4 y);" - - "bvec2 greaterThanEqual(ivec2 x, ivec2 y);" - "bvec3 greaterThanEqual(ivec3 x, ivec3 y);" - "bvec4 greaterThanEqual(ivec4 x, ivec4 y);" - - "bvec2 equal(vec2 x, vec2 y);" - "bvec3 equal(vec3 x, vec3 y);" - "bvec4 equal(vec4 x, vec4 y);" - - "bvec2 equal(ivec2 x, ivec2 y);" - "bvec3 equal(ivec3 x, ivec3 y);" - "bvec4 equal(ivec4 x, ivec4 y);" - - "bvec2 equal(bvec2 x, bvec2 y);" - "bvec3 equal(bvec3 x, bvec3 y);" - "bvec4 equal(bvec4 x, bvec4 y);" - - "bvec2 notEqual(vec2 x, vec2 y);" - "bvec3 notEqual(vec3 x, vec3 y);" - "bvec4 notEqual(vec4 x, vec4 y);" - - "bvec2 notEqual(ivec2 x, ivec2 y);" - "bvec3 notEqual(ivec3 x, ivec3 y);" - "bvec4 notEqual(ivec4 x, ivec4 y);" - - "bvec2 notEqual(bvec2 x, bvec2 y);" - "bvec3 notEqual(bvec3 x, bvec3 y);" - "bvec4 notEqual(bvec4 x, bvec4 y);" - - "bool any(bvec2 x);" - "bool any(bvec3 x);" - "bool any(bvec4 x);" - - "bool all(bvec2 x);" - "bool all(bvec3 x);" - "bool all(bvec4 x);" - - "bvec2 not(bvec2 x);" - "bvec3 not(bvec3 x);" - "bvec4 not(bvec4 x);" - - "\n"); - - if (version >= 130) { - commonBuiltins.append( - "bvec2 lessThan(uvec2 x, uvec2 y);" - "bvec3 lessThan(uvec3 x, uvec3 y);" - "bvec4 lessThan(uvec4 x, uvec4 y);" - - "bvec2 lessThanEqual(uvec2 x, uvec2 y);" - "bvec3 lessThanEqual(uvec3 x, uvec3 y);" - "bvec4 lessThanEqual(uvec4 x, uvec4 y);" - - "bvec2 greaterThan(uvec2 x, uvec2 y);" - "bvec3 greaterThan(uvec3 x, uvec3 y);" - "bvec4 greaterThan(uvec4 x, uvec4 y);" - - "bvec2 greaterThanEqual(uvec2 x, uvec2 y);" - "bvec3 greaterThanEqual(uvec3 x, uvec3 y);" - "bvec4 greaterThanEqual(uvec4 x, uvec4 y);" - - "bvec2 equal(uvec2 x, uvec2 y);" - "bvec3 equal(uvec3 x, uvec3 y);" - "bvec4 equal(uvec4 x, uvec4 y);" - - "bvec2 notEqual(uvec2 x, uvec2 y);" - "bvec3 notEqual(uvec3 x, uvec3 y);" - "bvec4 notEqual(uvec4 x, uvec4 y);" - - "\n"); - } - - // - // Original-style texture functions existing in all stages. - // (Per-stage functions below.) - // - if ((profile == EEsProfile && version == 100) || - profile == ECompatibilityProfile || - (profile == ECoreProfile && version < 420) || - profile == ENoProfile) { - if (spvVersion.spv == 0) { - commonBuiltins.append( - "vec4 texture2D(sampler2D, vec2);" - - "vec4 texture2DProj(sampler2D, vec3);" - "vec4 texture2DProj(sampler2D, vec4);" - - "vec4 texture3D(sampler3D, vec3);" // OES_texture_3D, but caught by keyword check - "vec4 texture3DProj(sampler3D, vec4);" // OES_texture_3D, but caught by keyword check - - "vec4 textureCube(samplerCube, vec3);" - - "vec4 texture2DArray(sampler2DArray, vec3);" // GL_EXT_texture_array - - "\n"); - } - } - - if ( profile == ECompatibilityProfile || - (profile == ECoreProfile && version < 420) || - profile == ENoProfile) { - if (spvVersion.spv == 0) { - commonBuiltins.append( - "vec4 texture1D(sampler1D, float);" - - "vec4 texture1DProj(sampler1D, vec2);" - "vec4 texture1DProj(sampler1D, vec4);" - - "vec4 shadow1D(sampler1DShadow, vec3);" - "vec4 shadow2D(sampler2DShadow, vec3);" - "vec4 shadow1DProj(sampler1DShadow, vec4);" - "vec4 shadow2DProj(sampler2DShadow, vec4);" - - "vec4 texture2DRect(sampler2DRect, vec2);" // GL_ARB_texture_rectangle, caught by keyword check - "vec4 texture2DRectProj(sampler2DRect, vec3);" // GL_ARB_texture_rectangle, caught by keyword check - "vec4 texture2DRectProj(sampler2DRect, vec4);" // GL_ARB_texture_rectangle, caught by keyword check - "vec4 shadow2DRect(sampler2DRectShadow, vec3);" // GL_ARB_texture_rectangle, caught by keyword check - "vec4 shadow2DRectProj(sampler2DRectShadow, vec4);" // GL_ARB_texture_rectangle, caught by keyword check - - "vec4 texture1DArray(sampler1DArray, vec2);" // GL_EXT_texture_array - "vec4 shadow1DArray(sampler1DArrayShadow, vec3);" // GL_EXT_texture_array - "vec4 shadow2DArray(sampler2DArrayShadow, vec4);" // GL_EXT_texture_array - - "\n"); - } - } - - if (profile == EEsProfile) { - if (spvVersion.spv == 0) { - if (version < 300) { - commonBuiltins.append( - "vec4 texture2D(samplerExternalOES, vec2 coord);" // GL_OES_EGL_image_external - "vec4 texture2DProj(samplerExternalOES, vec3);" // GL_OES_EGL_image_external - "vec4 texture2DProj(samplerExternalOES, vec4);" // GL_OES_EGL_image_external - "\n"); - } else { - commonBuiltins.append( - "highp ivec2 textureSize(samplerExternalOES, int lod);" // GL_OES_EGL_image_external_essl3 - "vec4 texture(samplerExternalOES, vec2);" // GL_OES_EGL_image_external_essl3 - "vec4 texture(samplerExternalOES, vec2, float bias);" // GL_OES_EGL_image_external_essl3 - "vec4 textureProj(samplerExternalOES, vec3);" // GL_OES_EGL_image_external_essl3 - "vec4 textureProj(samplerExternalOES, vec3, float bias);" // GL_OES_EGL_image_external_essl3 - "vec4 textureProj(samplerExternalOES, vec4);" // GL_OES_EGL_image_external_essl3 - "vec4 textureProj(samplerExternalOES, vec4, float bias);" // GL_OES_EGL_image_external_essl3 - "vec4 texelFetch(samplerExternalOES, ivec2, int lod);" // GL_OES_EGL_image_external_essl3 - "\n"); - } - commonBuiltins.append( - "vec4 texture2DGradEXT(sampler2D, vec2, vec2, vec2);" // GL_EXT_shader_texture_lod - "vec4 texture2DProjGradEXT(sampler2D, vec3, vec2, vec2);" // GL_EXT_shader_texture_lod - "vec4 texture2DProjGradEXT(sampler2D, vec4, vec2, vec2);" // GL_EXT_shader_texture_lod - "vec4 textureCubeGradEXT(samplerCube, vec3, vec3, vec3);" // GL_EXT_shader_texture_lod - - "float shadow2DEXT(sampler2DShadow, vec3);" // GL_EXT_shadow_samplers - "float shadow2DProjEXT(sampler2DShadow, vec4);" // GL_EXT_shadow_samplers - - "\n"); - } - } - - // - // Noise functions. - // - if (spvVersion.spv == 0 && profile != EEsProfile) { - commonBuiltins.append( - "float noise1(float x);" - "float noise1(vec2 x);" - "float noise1(vec3 x);" - "float noise1(vec4 x);" - - "vec2 noise2(float x);" - "vec2 noise2(vec2 x);" - "vec2 noise2(vec3 x);" - "vec2 noise2(vec4 x);" - - "vec3 noise3(float x);" - "vec3 noise3(vec2 x);" - "vec3 noise3(vec3 x);" - "vec3 noise3(vec4 x);" - - "vec4 noise4(float x);" - "vec4 noise4(vec2 x);" - "vec4 noise4(vec3 x);" - "vec4 noise4(vec4 x);" - - "\n"); - } - - if (spvVersion.vulkan == 0) { - // - // Atomic counter functions. - // - if ((profile != EEsProfile && version >= 300) || - (profile == EEsProfile && version >= 310)) { - commonBuiltins.append( - "uint atomicCounterIncrement(atomic_uint);" - "uint atomicCounterDecrement(atomic_uint);" - "uint atomicCounter(atomic_uint);" - - "\n"); - } - if (profile != EEsProfile && version >= 460) { - commonBuiltins.append( - "uint atomicCounterAdd(atomic_uint, uint);" - "uint atomicCounterSubtract(atomic_uint, uint);" - "uint atomicCounterMin(atomic_uint, uint);" - "uint atomicCounterMax(atomic_uint, uint);" - "uint atomicCounterAnd(atomic_uint, uint);" - "uint atomicCounterOr(atomic_uint, uint);" - "uint atomicCounterXor(atomic_uint, uint);" - "uint atomicCounterExchange(atomic_uint, uint);" - "uint atomicCounterCompSwap(atomic_uint, uint, uint);" - - "\n"); - } - } - - // Bitfield - if ((profile == EEsProfile && version >= 310) || - (profile != EEsProfile && version >= 400)) { - commonBuiltins.append( - " int bitfieldExtract( int, int, int);" - "ivec2 bitfieldExtract(ivec2, int, int);" - "ivec3 bitfieldExtract(ivec3, int, int);" - "ivec4 bitfieldExtract(ivec4, int, int);" - - " uint bitfieldExtract( uint, int, int);" - "uvec2 bitfieldExtract(uvec2, int, int);" - "uvec3 bitfieldExtract(uvec3, int, int);" - "uvec4 bitfieldExtract(uvec4, int, int);" - - " int bitfieldInsert( int base, int, int, int);" - "ivec2 bitfieldInsert(ivec2 base, ivec2, int, int);" - "ivec3 bitfieldInsert(ivec3 base, ivec3, int, int);" - "ivec4 bitfieldInsert(ivec4 base, ivec4, int, int);" - - " uint bitfieldInsert( uint base, uint, int, int);" - "uvec2 bitfieldInsert(uvec2 base, uvec2, int, int);" - "uvec3 bitfieldInsert(uvec3 base, uvec3, int, int);" - "uvec4 bitfieldInsert(uvec4 base, uvec4, int, int);" - - "\n"); - } - - if (profile != EEsProfile && version >= 400) { - commonBuiltins.append( - " int findLSB( int);" - "ivec2 findLSB(ivec2);" - "ivec3 findLSB(ivec3);" - "ivec4 findLSB(ivec4);" - - " int findLSB( uint);" - "ivec2 findLSB(uvec2);" - "ivec3 findLSB(uvec3);" - "ivec4 findLSB(uvec4);" - - "\n"); - } else if (profile == EEsProfile && version >= 310) { - commonBuiltins.append( - "lowp int findLSB( int);" - "lowp ivec2 findLSB(ivec2);" - "lowp ivec3 findLSB(ivec3);" - "lowp ivec4 findLSB(ivec4);" - - "lowp int findLSB( uint);" - "lowp ivec2 findLSB(uvec2);" - "lowp ivec3 findLSB(uvec3);" - "lowp ivec4 findLSB(uvec4);" - - "\n"); - } - - if (profile != EEsProfile && version >= 400) { - commonBuiltins.append( - " int bitCount( int);" - "ivec2 bitCount(ivec2);" - "ivec3 bitCount(ivec3);" - "ivec4 bitCount(ivec4);" - - " int bitCount( uint);" - "ivec2 bitCount(uvec2);" - "ivec3 bitCount(uvec3);" - "ivec4 bitCount(uvec4);" - - " int findMSB(highp int);" - "ivec2 findMSB(highp ivec2);" - "ivec3 findMSB(highp ivec3);" - "ivec4 findMSB(highp ivec4);" - - " int findMSB(highp uint);" - "ivec2 findMSB(highp uvec2);" - "ivec3 findMSB(highp uvec3);" - "ivec4 findMSB(highp uvec4);" - - "\n"); - } - - if ((profile == EEsProfile && version >= 310) || - (profile != EEsProfile && version >= 400)) { - commonBuiltins.append( - " uint uaddCarry(highp uint, highp uint, out lowp uint carry);" - "uvec2 uaddCarry(highp uvec2, highp uvec2, out lowp uvec2 carry);" - "uvec3 uaddCarry(highp uvec3, highp uvec3, out lowp uvec3 carry);" - "uvec4 uaddCarry(highp uvec4, highp uvec4, out lowp uvec4 carry);" - - " uint usubBorrow(highp uint, highp uint, out lowp uint borrow);" - "uvec2 usubBorrow(highp uvec2, highp uvec2, out lowp uvec2 borrow);" - "uvec3 usubBorrow(highp uvec3, highp uvec3, out lowp uvec3 borrow);" - "uvec4 usubBorrow(highp uvec4, highp uvec4, out lowp uvec4 borrow);" - - "void umulExtended(highp uint, highp uint, out highp uint, out highp uint lsb);" - "void umulExtended(highp uvec2, highp uvec2, out highp uvec2, out highp uvec2 lsb);" - "void umulExtended(highp uvec3, highp uvec3, out highp uvec3, out highp uvec3 lsb);" - "void umulExtended(highp uvec4, highp uvec4, out highp uvec4, out highp uvec4 lsb);" - - "void imulExtended(highp int, highp int, out highp int, out highp int lsb);" - "void imulExtended(highp ivec2, highp ivec2, out highp ivec2, out highp ivec2 lsb);" - "void imulExtended(highp ivec3, highp ivec3, out highp ivec3, out highp ivec3 lsb);" - "void imulExtended(highp ivec4, highp ivec4, out highp ivec4, out highp ivec4 lsb);" - - " int bitfieldReverse(highp int);" - "ivec2 bitfieldReverse(highp ivec2);" - "ivec3 bitfieldReverse(highp ivec3);" - "ivec4 bitfieldReverse(highp ivec4);" - - " uint bitfieldReverse(highp uint);" - "uvec2 bitfieldReverse(highp uvec2);" - "uvec3 bitfieldReverse(highp uvec3);" - "uvec4 bitfieldReverse(highp uvec4);" - - "\n"); - } - - if (profile == EEsProfile && version >= 310) { - commonBuiltins.append( - "lowp int bitCount( int);" - "lowp ivec2 bitCount(ivec2);" - "lowp ivec3 bitCount(ivec3);" - "lowp ivec4 bitCount(ivec4);" - - "lowp int bitCount( uint);" - "lowp ivec2 bitCount(uvec2);" - "lowp ivec3 bitCount(uvec3);" - "lowp ivec4 bitCount(uvec4);" - - "lowp int findMSB(highp int);" - "lowp ivec2 findMSB(highp ivec2);" - "lowp ivec3 findMSB(highp ivec3);" - "lowp ivec4 findMSB(highp ivec4);" - - "lowp int findMSB(highp uint);" - "lowp ivec2 findMSB(highp uvec2);" - "lowp ivec3 findMSB(highp uvec3);" - "lowp ivec4 findMSB(highp uvec4);" - - "\n"); - } - - // GL_ARB_shader_ballot - if (profile != EEsProfile && version >= 450) { - commonBuiltins.append( - "uint64_t ballotARB(bool);" - - "float readInvocationARB(float, uint);" - "vec2 readInvocationARB(vec2, uint);" - "vec3 readInvocationARB(vec3, uint);" - "vec4 readInvocationARB(vec4, uint);" - - "int readInvocationARB(int, uint);" - "ivec2 readInvocationARB(ivec2, uint);" - "ivec3 readInvocationARB(ivec3, uint);" - "ivec4 readInvocationARB(ivec4, uint);" - - "uint readInvocationARB(uint, uint);" - "uvec2 readInvocationARB(uvec2, uint);" - "uvec3 readInvocationARB(uvec3, uint);" - "uvec4 readInvocationARB(uvec4, uint);" - - "float readFirstInvocationARB(float);" - "vec2 readFirstInvocationARB(vec2);" - "vec3 readFirstInvocationARB(vec3);" - "vec4 readFirstInvocationARB(vec4);" - - "int readFirstInvocationARB(int);" - "ivec2 readFirstInvocationARB(ivec2);" - "ivec3 readFirstInvocationARB(ivec3);" - "ivec4 readFirstInvocationARB(ivec4);" - - "uint readFirstInvocationARB(uint);" - "uvec2 readFirstInvocationARB(uvec2);" - "uvec3 readFirstInvocationARB(uvec3);" - "uvec4 readFirstInvocationARB(uvec4);" - - "\n"); - } - - // GL_ARB_shader_group_vote - if (profile != EEsProfile && version >= 430) { - commonBuiltins.append( - "bool anyInvocationARB(bool);" - "bool allInvocationsARB(bool);" - "bool allInvocationsEqualARB(bool);" - - "\n"); - } - - if (profile != EEsProfile && version >= 460) { - commonBuiltins.append( - "bool anyInvocation(bool);" - "bool allInvocations(bool);" - "bool allInvocationsEqual(bool);" - - "\n"); - } - -#ifdef AMD_EXTENSIONS - // GL_AMD_shader_ballot - if (profile != EEsProfile && version >= 450) { - commonBuiltins.append( - "float minInvocationsAMD(float);" - "vec2 minInvocationsAMD(vec2);" - "vec3 minInvocationsAMD(vec3);" - "vec4 minInvocationsAMD(vec4);" - - "int minInvocationsAMD(int);" - "ivec2 minInvocationsAMD(ivec2);" - "ivec3 minInvocationsAMD(ivec3);" - "ivec4 minInvocationsAMD(ivec4);" - - "uint minInvocationsAMD(uint);" - "uvec2 minInvocationsAMD(uvec2);" - "uvec3 minInvocationsAMD(uvec3);" - "uvec4 minInvocationsAMD(uvec4);" - - "double minInvocationsAMD(double);" - "dvec2 minInvocationsAMD(dvec2);" - "dvec3 minInvocationsAMD(dvec3);" - "dvec4 minInvocationsAMD(dvec4);" - - "int64_t minInvocationsAMD(int64_t);" - "i64vec2 minInvocationsAMD(i64vec2);" - "i64vec3 minInvocationsAMD(i64vec3);" - "i64vec4 minInvocationsAMD(i64vec4);" - - "uint64_t minInvocationsAMD(uint64_t);" - "u64vec2 minInvocationsAMD(u64vec2);" - "u64vec3 minInvocationsAMD(u64vec3);" - "u64vec4 minInvocationsAMD(u64vec4);" - - "float16_t minInvocationsAMD(float16_t);" - "f16vec2 minInvocationsAMD(f16vec2);" - "f16vec3 minInvocationsAMD(f16vec3);" - "f16vec4 minInvocationsAMD(f16vec4);" - - "float minInvocationsInclusiveScanAMD(float);" - "vec2 minInvocationsInclusiveScanAMD(vec2);" - "vec3 minInvocationsInclusiveScanAMD(vec3);" - "vec4 minInvocationsInclusiveScanAMD(vec4);" - - "int minInvocationsInclusiveScanAMD(int);" - "ivec2 minInvocationsInclusiveScanAMD(ivec2);" - "ivec3 minInvocationsInclusiveScanAMD(ivec3);" - "ivec4 minInvocationsInclusiveScanAMD(ivec4);" - - "uint minInvocationsInclusiveScanAMD(uint);" - "uvec2 minInvocationsInclusiveScanAMD(uvec2);" - "uvec3 minInvocationsInclusiveScanAMD(uvec3);" - "uvec4 minInvocationsInclusiveScanAMD(uvec4);" - - "double minInvocationsInclusiveScanAMD(double);" - "dvec2 minInvocationsInclusiveScanAMD(dvec2);" - "dvec3 minInvocationsInclusiveScanAMD(dvec3);" - "dvec4 minInvocationsInclusiveScanAMD(dvec4);" - - "int64_t minInvocationsInclusiveScanAMD(int64_t);" - "i64vec2 minInvocationsInclusiveScanAMD(i64vec2);" - "i64vec3 minInvocationsInclusiveScanAMD(i64vec3);" - "i64vec4 minInvocationsInclusiveScanAMD(i64vec4);" - - "uint64_t minInvocationsInclusiveScanAMD(uint64_t);" - "u64vec2 minInvocationsInclusiveScanAMD(u64vec2);" - "u64vec3 minInvocationsInclusiveScanAMD(u64vec3);" - "u64vec4 minInvocationsInclusiveScanAMD(u64vec4);" - - "float16_t minInvocationsInclusiveScanAMD(float16_t);" - "f16vec2 minInvocationsInclusiveScanAMD(f16vec2);" - "f16vec3 minInvocationsInclusiveScanAMD(f16vec3);" - "f16vec4 minInvocationsInclusiveScanAMD(f16vec4);" - - "float minInvocationsExclusiveScanAMD(float);" - "vec2 minInvocationsExclusiveScanAMD(vec2);" - "vec3 minInvocationsExclusiveScanAMD(vec3);" - "vec4 minInvocationsExclusiveScanAMD(vec4);" - - "int minInvocationsExclusiveScanAMD(int);" - "ivec2 minInvocationsExclusiveScanAMD(ivec2);" - "ivec3 minInvocationsExclusiveScanAMD(ivec3);" - "ivec4 minInvocationsExclusiveScanAMD(ivec4);" - - "uint minInvocationsExclusiveScanAMD(uint);" - "uvec2 minInvocationsExclusiveScanAMD(uvec2);" - "uvec3 minInvocationsExclusiveScanAMD(uvec3);" - "uvec4 minInvocationsExclusiveScanAMD(uvec4);" - - "double minInvocationsExclusiveScanAMD(double);" - "dvec2 minInvocationsExclusiveScanAMD(dvec2);" - "dvec3 minInvocationsExclusiveScanAMD(dvec3);" - "dvec4 minInvocationsExclusiveScanAMD(dvec4);" - - "int64_t minInvocationsExclusiveScanAMD(int64_t);" - "i64vec2 minInvocationsExclusiveScanAMD(i64vec2);" - "i64vec3 minInvocationsExclusiveScanAMD(i64vec3);" - "i64vec4 minInvocationsExclusiveScanAMD(i64vec4);" - - "uint64_t minInvocationsExclusiveScanAMD(uint64_t);" - "u64vec2 minInvocationsExclusiveScanAMD(u64vec2);" - "u64vec3 minInvocationsExclusiveScanAMD(u64vec3);" - "u64vec4 minInvocationsExclusiveScanAMD(u64vec4);" - - "float16_t minInvocationsExclusiveScanAMD(float16_t);" - "f16vec2 minInvocationsExclusiveScanAMD(f16vec2);" - "f16vec3 minInvocationsExclusiveScanAMD(f16vec3);" - "f16vec4 minInvocationsExclusiveScanAMD(f16vec4);" - - "float maxInvocationsAMD(float);" - "vec2 maxInvocationsAMD(vec2);" - "vec3 maxInvocationsAMD(vec3);" - "vec4 maxInvocationsAMD(vec4);" - - "int maxInvocationsAMD(int);" - "ivec2 maxInvocationsAMD(ivec2);" - "ivec3 maxInvocationsAMD(ivec3);" - "ivec4 maxInvocationsAMD(ivec4);" - - "uint maxInvocationsAMD(uint);" - "uvec2 maxInvocationsAMD(uvec2);" - "uvec3 maxInvocationsAMD(uvec3);" - "uvec4 maxInvocationsAMD(uvec4);" - - "double maxInvocationsAMD(double);" - "dvec2 maxInvocationsAMD(dvec2);" - "dvec3 maxInvocationsAMD(dvec3);" - "dvec4 maxInvocationsAMD(dvec4);" - - "int64_t maxInvocationsAMD(int64_t);" - "i64vec2 maxInvocationsAMD(i64vec2);" - "i64vec3 maxInvocationsAMD(i64vec3);" - "i64vec4 maxInvocationsAMD(i64vec4);" - - "uint64_t maxInvocationsAMD(uint64_t);" - "u64vec2 maxInvocationsAMD(u64vec2);" - "u64vec3 maxInvocationsAMD(u64vec3);" - "u64vec4 maxInvocationsAMD(u64vec4);" - - "float16_t maxInvocationsAMD(float16_t);" - "f16vec2 maxInvocationsAMD(f16vec2);" - "f16vec3 maxInvocationsAMD(f16vec3);" - "f16vec4 maxInvocationsAMD(f16vec4);" - - "float maxInvocationsInclusiveScanAMD(float);" - "vec2 maxInvocationsInclusiveScanAMD(vec2);" - "vec3 maxInvocationsInclusiveScanAMD(vec3);" - "vec4 maxInvocationsInclusiveScanAMD(vec4);" - - "int maxInvocationsInclusiveScanAMD(int);" - "ivec2 maxInvocationsInclusiveScanAMD(ivec2);" - "ivec3 maxInvocationsInclusiveScanAMD(ivec3);" - "ivec4 maxInvocationsInclusiveScanAMD(ivec4);" - - "uint maxInvocationsInclusiveScanAMD(uint);" - "uvec2 maxInvocationsInclusiveScanAMD(uvec2);" - "uvec3 maxInvocationsInclusiveScanAMD(uvec3);" - "uvec4 maxInvocationsInclusiveScanAMD(uvec4);" - - "double maxInvocationsInclusiveScanAMD(double);" - "dvec2 maxInvocationsInclusiveScanAMD(dvec2);" - "dvec3 maxInvocationsInclusiveScanAMD(dvec3);" - "dvec4 maxInvocationsInclusiveScanAMD(dvec4);" - - "int64_t maxInvocationsInclusiveScanAMD(int64_t);" - "i64vec2 maxInvocationsInclusiveScanAMD(i64vec2);" - "i64vec3 maxInvocationsInclusiveScanAMD(i64vec3);" - "i64vec4 maxInvocationsInclusiveScanAMD(i64vec4);" - - "uint64_t maxInvocationsInclusiveScanAMD(uint64_t);" - "u64vec2 maxInvocationsInclusiveScanAMD(u64vec2);" - "u64vec3 maxInvocationsInclusiveScanAMD(u64vec3);" - "u64vec4 maxInvocationsInclusiveScanAMD(u64vec4);" - - "float16_t maxInvocationsInclusiveScanAMD(float16_t);" - "f16vec2 maxInvocationsInclusiveScanAMD(f16vec2);" - "f16vec3 maxInvocationsInclusiveScanAMD(f16vec3);" - "f16vec4 maxInvocationsInclusiveScanAMD(f16vec4);" - - "float maxInvocationsExclusiveScanAMD(float);" - "vec2 maxInvocationsExclusiveScanAMD(vec2);" - "vec3 maxInvocationsExclusiveScanAMD(vec3);" - "vec4 maxInvocationsExclusiveScanAMD(vec4);" - - "int maxInvocationsExclusiveScanAMD(int);" - "ivec2 maxInvocationsExclusiveScanAMD(ivec2);" - "ivec3 maxInvocationsExclusiveScanAMD(ivec3);" - "ivec4 maxInvocationsExclusiveScanAMD(ivec4);" - - "uint maxInvocationsExclusiveScanAMD(uint);" - "uvec2 maxInvocationsExclusiveScanAMD(uvec2);" - "uvec3 maxInvocationsExclusiveScanAMD(uvec3);" - "uvec4 maxInvocationsExclusiveScanAMD(uvec4);" - - "double maxInvocationsExclusiveScanAMD(double);" - "dvec2 maxInvocationsExclusiveScanAMD(dvec2);" - "dvec3 maxInvocationsExclusiveScanAMD(dvec3);" - "dvec4 maxInvocationsExclusiveScanAMD(dvec4);" - - "int64_t maxInvocationsExclusiveScanAMD(int64_t);" - "i64vec2 maxInvocationsExclusiveScanAMD(i64vec2);" - "i64vec3 maxInvocationsExclusiveScanAMD(i64vec3);" - "i64vec4 maxInvocationsExclusiveScanAMD(i64vec4);" - - "uint64_t maxInvocationsExclusiveScanAMD(uint64_t);" - "u64vec2 maxInvocationsExclusiveScanAMD(u64vec2);" - "u64vec3 maxInvocationsExclusiveScanAMD(u64vec3);" - "u64vec4 maxInvocationsExclusiveScanAMD(u64vec4);" - - "float16_t maxInvocationsExclusiveScanAMD(float16_t);" - "f16vec2 maxInvocationsExclusiveScanAMD(f16vec2);" - "f16vec3 maxInvocationsExclusiveScanAMD(f16vec3);" - "f16vec4 maxInvocationsExclusiveScanAMD(f16vec4);" - - "float addInvocationsAMD(float);" - "vec2 addInvocationsAMD(vec2);" - "vec3 addInvocationsAMD(vec3);" - "vec4 addInvocationsAMD(vec4);" - - "int addInvocationsAMD(int);" - "ivec2 addInvocationsAMD(ivec2);" - "ivec3 addInvocationsAMD(ivec3);" - "ivec4 addInvocationsAMD(ivec4);" - - "uint addInvocationsAMD(uint);" - "uvec2 addInvocationsAMD(uvec2);" - "uvec3 addInvocationsAMD(uvec3);" - "uvec4 addInvocationsAMD(uvec4);" - - "double addInvocationsAMD(double);" - "dvec2 addInvocationsAMD(dvec2);" - "dvec3 addInvocationsAMD(dvec3);" - "dvec4 addInvocationsAMD(dvec4);" - - "int64_t addInvocationsAMD(int64_t);" - "i64vec2 addInvocationsAMD(i64vec2);" - "i64vec3 addInvocationsAMD(i64vec3);" - "i64vec4 addInvocationsAMD(i64vec4);" - - "uint64_t addInvocationsAMD(uint64_t);" - "u64vec2 addInvocationsAMD(u64vec2);" - "u64vec3 addInvocationsAMD(u64vec3);" - "u64vec4 addInvocationsAMD(u64vec4);" - - "float16_t addInvocationsAMD(float16_t);" - "f16vec2 addInvocationsAMD(f16vec2);" - "f16vec3 addInvocationsAMD(f16vec3);" - "f16vec4 addInvocationsAMD(f16vec4);" - - "float addInvocationsInclusiveScanAMD(float);" - "vec2 addInvocationsInclusiveScanAMD(vec2);" - "vec3 addInvocationsInclusiveScanAMD(vec3);" - "vec4 addInvocationsInclusiveScanAMD(vec4);" - - "int addInvocationsInclusiveScanAMD(int);" - "ivec2 addInvocationsInclusiveScanAMD(ivec2);" - "ivec3 addInvocationsInclusiveScanAMD(ivec3);" - "ivec4 addInvocationsInclusiveScanAMD(ivec4);" - - "uint addInvocationsInclusiveScanAMD(uint);" - "uvec2 addInvocationsInclusiveScanAMD(uvec2);" - "uvec3 addInvocationsInclusiveScanAMD(uvec3);" - "uvec4 addInvocationsInclusiveScanAMD(uvec4);" - - "double addInvocationsInclusiveScanAMD(double);" - "dvec2 addInvocationsInclusiveScanAMD(dvec2);" - "dvec3 addInvocationsInclusiveScanAMD(dvec3);" - "dvec4 addInvocationsInclusiveScanAMD(dvec4);" - - "int64_t addInvocationsInclusiveScanAMD(int64_t);" - "i64vec2 addInvocationsInclusiveScanAMD(i64vec2);" - "i64vec3 addInvocationsInclusiveScanAMD(i64vec3);" - "i64vec4 addInvocationsInclusiveScanAMD(i64vec4);" - - "uint64_t addInvocationsInclusiveScanAMD(uint64_t);" - "u64vec2 addInvocationsInclusiveScanAMD(u64vec2);" - "u64vec3 addInvocationsInclusiveScanAMD(u64vec3);" - "u64vec4 addInvocationsInclusiveScanAMD(u64vec4);" - - "float16_t addInvocationsInclusiveScanAMD(float16_t);" - "f16vec2 addInvocationsInclusiveScanAMD(f16vec2);" - "f16vec3 addInvocationsInclusiveScanAMD(f16vec3);" - "f16vec4 addInvocationsInclusiveScanAMD(f16vec4);" - - "float addInvocationsExclusiveScanAMD(float);" - "vec2 addInvocationsExclusiveScanAMD(vec2);" - "vec3 addInvocationsExclusiveScanAMD(vec3);" - "vec4 addInvocationsExclusiveScanAMD(vec4);" - - "int addInvocationsExclusiveScanAMD(int);" - "ivec2 addInvocationsExclusiveScanAMD(ivec2);" - "ivec3 addInvocationsExclusiveScanAMD(ivec3);" - "ivec4 addInvocationsExclusiveScanAMD(ivec4);" - - "uint addInvocationsExclusiveScanAMD(uint);" - "uvec2 addInvocationsExclusiveScanAMD(uvec2);" - "uvec3 addInvocationsExclusiveScanAMD(uvec3);" - "uvec4 addInvocationsExclusiveScanAMD(uvec4);" - - "double addInvocationsExclusiveScanAMD(double);" - "dvec2 addInvocationsExclusiveScanAMD(dvec2);" - "dvec3 addInvocationsExclusiveScanAMD(dvec3);" - "dvec4 addInvocationsExclusiveScanAMD(dvec4);" - - "int64_t addInvocationsExclusiveScanAMD(int64_t);" - "i64vec2 addInvocationsExclusiveScanAMD(i64vec2);" - "i64vec3 addInvocationsExclusiveScanAMD(i64vec3);" - "i64vec4 addInvocationsExclusiveScanAMD(i64vec4);" - - "uint64_t addInvocationsExclusiveScanAMD(uint64_t);" - "u64vec2 addInvocationsExclusiveScanAMD(u64vec2);" - "u64vec3 addInvocationsExclusiveScanAMD(u64vec3);" - "u64vec4 addInvocationsExclusiveScanAMD(u64vec4);" - - "float16_t addInvocationsExclusiveScanAMD(float16_t);" - "f16vec2 addInvocationsExclusiveScanAMD(f16vec2);" - "f16vec3 addInvocationsExclusiveScanAMD(f16vec3);" - "f16vec4 addInvocationsExclusiveScanAMD(f16vec4);" - - "float minInvocationsNonUniformAMD(float);" - "vec2 minInvocationsNonUniformAMD(vec2);" - "vec3 minInvocationsNonUniformAMD(vec3);" - "vec4 minInvocationsNonUniformAMD(vec4);" - - "int minInvocationsNonUniformAMD(int);" - "ivec2 minInvocationsNonUniformAMD(ivec2);" - "ivec3 minInvocationsNonUniformAMD(ivec3);" - "ivec4 minInvocationsNonUniformAMD(ivec4);" - - "uint minInvocationsNonUniformAMD(uint);" - "uvec2 minInvocationsNonUniformAMD(uvec2);" - "uvec3 minInvocationsNonUniformAMD(uvec3);" - "uvec4 minInvocationsNonUniformAMD(uvec4);" - - "double minInvocationsNonUniformAMD(double);" - "dvec2 minInvocationsNonUniformAMD(dvec2);" - "dvec3 minInvocationsNonUniformAMD(dvec3);" - "dvec4 minInvocationsNonUniformAMD(dvec4);" - - "int64_t minInvocationsNonUniformAMD(int64_t);" - "i64vec2 minInvocationsNonUniformAMD(i64vec2);" - "i64vec3 minInvocationsNonUniformAMD(i64vec3);" - "i64vec4 minInvocationsNonUniformAMD(i64vec4);" - - "uint64_t minInvocationsNonUniformAMD(uint64_t);" - "u64vec2 minInvocationsNonUniformAMD(u64vec2);" - "u64vec3 minInvocationsNonUniformAMD(u64vec3);" - "u64vec4 minInvocationsNonUniformAMD(u64vec4);" - - "float16_t minInvocationsNonUniformAMD(float16_t);" - "f16vec2 minInvocationsNonUniformAMD(f16vec2);" - "f16vec3 minInvocationsNonUniformAMD(f16vec3);" - "f16vec4 minInvocationsNonUniformAMD(f16vec4);" - - "float minInvocationsInclusiveScanNonUniformAMD(float);" - "vec2 minInvocationsInclusiveScanNonUniformAMD(vec2);" - "vec3 minInvocationsInclusiveScanNonUniformAMD(vec3);" - "vec4 minInvocationsInclusiveScanNonUniformAMD(vec4);" - - "int minInvocationsInclusiveScanNonUniformAMD(int);" - "ivec2 minInvocationsInclusiveScanNonUniformAMD(ivec2);" - "ivec3 minInvocationsInclusiveScanNonUniformAMD(ivec3);" - "ivec4 minInvocationsInclusiveScanNonUniformAMD(ivec4);" - - "uint minInvocationsInclusiveScanNonUniformAMD(uint);" - "uvec2 minInvocationsInclusiveScanNonUniformAMD(uvec2);" - "uvec3 minInvocationsInclusiveScanNonUniformAMD(uvec3);" - "uvec4 minInvocationsInclusiveScanNonUniformAMD(uvec4);" - - "double minInvocationsInclusiveScanNonUniformAMD(double);" - "dvec2 minInvocationsInclusiveScanNonUniformAMD(dvec2);" - "dvec3 minInvocationsInclusiveScanNonUniformAMD(dvec3);" - "dvec4 minInvocationsInclusiveScanNonUniformAMD(dvec4);" - - "int64_t minInvocationsInclusiveScanNonUniformAMD(int64_t);" - "i64vec2 minInvocationsInclusiveScanNonUniformAMD(i64vec2);" - "i64vec3 minInvocationsInclusiveScanNonUniformAMD(i64vec3);" - "i64vec4 minInvocationsInclusiveScanNonUniformAMD(i64vec4);" - - "uint64_t minInvocationsInclusiveScanNonUniformAMD(uint64_t);" - "u64vec2 minInvocationsInclusiveScanNonUniformAMD(u64vec2);" - "u64vec3 minInvocationsInclusiveScanNonUniformAMD(u64vec3);" - "u64vec4 minInvocationsInclusiveScanNonUniformAMD(u64vec4);" - - "float16_t minInvocationsInclusiveScanNonUniformAMD(float16_t);" - "f16vec2 minInvocationsInclusiveScanNonUniformAMD(f16vec2);" - "f16vec3 minInvocationsInclusiveScanNonUniformAMD(f16vec3);" - "f16vec4 minInvocationsInclusiveScanNonUniformAMD(f16vec4);" - - "float minInvocationsExclusiveScanNonUniformAMD(float);" - "vec2 minInvocationsExclusiveScanNonUniformAMD(vec2);" - "vec3 minInvocationsExclusiveScanNonUniformAMD(vec3);" - "vec4 minInvocationsExclusiveScanNonUniformAMD(vec4);" - - "int minInvocationsExclusiveScanNonUniformAMD(int);" - "ivec2 minInvocationsExclusiveScanNonUniformAMD(ivec2);" - "ivec3 minInvocationsExclusiveScanNonUniformAMD(ivec3);" - "ivec4 minInvocationsExclusiveScanNonUniformAMD(ivec4);" - - "uint minInvocationsExclusiveScanNonUniformAMD(uint);" - "uvec2 minInvocationsExclusiveScanNonUniformAMD(uvec2);" - "uvec3 minInvocationsExclusiveScanNonUniformAMD(uvec3);" - "uvec4 minInvocationsExclusiveScanNonUniformAMD(uvec4);" - - "double minInvocationsExclusiveScanNonUniformAMD(double);" - "dvec2 minInvocationsExclusiveScanNonUniformAMD(dvec2);" - "dvec3 minInvocationsExclusiveScanNonUniformAMD(dvec3);" - "dvec4 minInvocationsExclusiveScanNonUniformAMD(dvec4);" - - "int64_t minInvocationsExclusiveScanNonUniformAMD(int64_t);" - "i64vec2 minInvocationsExclusiveScanNonUniformAMD(i64vec2);" - "i64vec3 minInvocationsExclusiveScanNonUniformAMD(i64vec3);" - "i64vec4 minInvocationsExclusiveScanNonUniformAMD(i64vec4);" - - "uint64_t minInvocationsExclusiveScanNonUniformAMD(uint64_t);" - "u64vec2 minInvocationsExclusiveScanNonUniformAMD(u64vec2);" - "u64vec3 minInvocationsExclusiveScanNonUniformAMD(u64vec3);" - "u64vec4 minInvocationsExclusiveScanNonUniformAMD(u64vec4);" - - "float16_t minInvocationsExclusiveScanNonUniformAMD(float16_t);" - "f16vec2 minInvocationsExclusiveScanNonUniformAMD(f16vec2);" - "f16vec3 minInvocationsExclusiveScanNonUniformAMD(f16vec3);" - "f16vec4 minInvocationsExclusiveScanNonUniformAMD(f16vec4);" - - "float maxInvocationsNonUniformAMD(float);" - "vec2 maxInvocationsNonUniformAMD(vec2);" - "vec3 maxInvocationsNonUniformAMD(vec3);" - "vec4 maxInvocationsNonUniformAMD(vec4);" - - "int maxInvocationsNonUniformAMD(int);" - "ivec2 maxInvocationsNonUniformAMD(ivec2);" - "ivec3 maxInvocationsNonUniformAMD(ivec3);" - "ivec4 maxInvocationsNonUniformAMD(ivec4);" - - "uint maxInvocationsNonUniformAMD(uint);" - "uvec2 maxInvocationsNonUniformAMD(uvec2);" - "uvec3 maxInvocationsNonUniformAMD(uvec3);" - "uvec4 maxInvocationsNonUniformAMD(uvec4);" - - "double maxInvocationsNonUniformAMD(double);" - "dvec2 maxInvocationsNonUniformAMD(dvec2);" - "dvec3 maxInvocationsNonUniformAMD(dvec3);" - "dvec4 maxInvocationsNonUniformAMD(dvec4);" - - "int64_t maxInvocationsNonUniformAMD(int64_t);" - "i64vec2 maxInvocationsNonUniformAMD(i64vec2);" - "i64vec3 maxInvocationsNonUniformAMD(i64vec3);" - "i64vec4 maxInvocationsNonUniformAMD(i64vec4);" - - "uint64_t maxInvocationsNonUniformAMD(uint64_t);" - "u64vec2 maxInvocationsNonUniformAMD(u64vec2);" - "u64vec3 maxInvocationsNonUniformAMD(u64vec3);" - "u64vec4 maxInvocationsNonUniformAMD(u64vec4);" - - "float16_t maxInvocationsNonUniformAMD(float16_t);" - "f16vec2 maxInvocationsNonUniformAMD(f16vec2);" - "f16vec3 maxInvocationsNonUniformAMD(f16vec3);" - "f16vec4 maxInvocationsNonUniformAMD(f16vec4);" - - "float maxInvocationsInclusiveScanNonUniformAMD(float);" - "vec2 maxInvocationsInclusiveScanNonUniformAMD(vec2);" - "vec3 maxInvocationsInclusiveScanNonUniformAMD(vec3);" - "vec4 maxInvocationsInclusiveScanNonUniformAMD(vec4);" - - "int maxInvocationsInclusiveScanNonUniformAMD(int);" - "ivec2 maxInvocationsInclusiveScanNonUniformAMD(ivec2);" - "ivec3 maxInvocationsInclusiveScanNonUniformAMD(ivec3);" - "ivec4 maxInvocationsInclusiveScanNonUniformAMD(ivec4);" - - "uint maxInvocationsInclusiveScanNonUniformAMD(uint);" - "uvec2 maxInvocationsInclusiveScanNonUniformAMD(uvec2);" - "uvec3 maxInvocationsInclusiveScanNonUniformAMD(uvec3);" - "uvec4 maxInvocationsInclusiveScanNonUniformAMD(uvec4);" - - "double maxInvocationsInclusiveScanNonUniformAMD(double);" - "dvec2 maxInvocationsInclusiveScanNonUniformAMD(dvec2);" - "dvec3 maxInvocationsInclusiveScanNonUniformAMD(dvec3);" - "dvec4 maxInvocationsInclusiveScanNonUniformAMD(dvec4);" - - "int64_t maxInvocationsInclusiveScanNonUniformAMD(int64_t);" - "i64vec2 maxInvocationsInclusiveScanNonUniformAMD(i64vec2);" - "i64vec3 maxInvocationsInclusiveScanNonUniformAMD(i64vec3);" - "i64vec4 maxInvocationsInclusiveScanNonUniformAMD(i64vec4);" - - "uint64_t maxInvocationsInclusiveScanNonUniformAMD(uint64_t);" - "u64vec2 maxInvocationsInclusiveScanNonUniformAMD(u64vec2);" - "u64vec3 maxInvocationsInclusiveScanNonUniformAMD(u64vec3);" - "u64vec4 maxInvocationsInclusiveScanNonUniformAMD(u64vec4);" - - "float16_t maxInvocationsInclusiveScanNonUniformAMD(float16_t);" - "f16vec2 maxInvocationsInclusiveScanNonUniformAMD(f16vec2);" - "f16vec3 maxInvocationsInclusiveScanNonUniformAMD(f16vec3);" - "f16vec4 maxInvocationsInclusiveScanNonUniformAMD(f16vec4);" - - "float maxInvocationsExclusiveScanNonUniformAMD(float);" - "vec2 maxInvocationsExclusiveScanNonUniformAMD(vec2);" - "vec3 maxInvocationsExclusiveScanNonUniformAMD(vec3);" - "vec4 maxInvocationsExclusiveScanNonUniformAMD(vec4);" - - "int maxInvocationsExclusiveScanNonUniformAMD(int);" - "ivec2 maxInvocationsExclusiveScanNonUniformAMD(ivec2);" - "ivec3 maxInvocationsExclusiveScanNonUniformAMD(ivec3);" - "ivec4 maxInvocationsExclusiveScanNonUniformAMD(ivec4);" - - "uint maxInvocationsExclusiveScanNonUniformAMD(uint);" - "uvec2 maxInvocationsExclusiveScanNonUniformAMD(uvec2);" - "uvec3 maxInvocationsExclusiveScanNonUniformAMD(uvec3);" - "uvec4 maxInvocationsExclusiveScanNonUniformAMD(uvec4);" - - "double maxInvocationsExclusiveScanNonUniformAMD(double);" - "dvec2 maxInvocationsExclusiveScanNonUniformAMD(dvec2);" - "dvec3 maxInvocationsExclusiveScanNonUniformAMD(dvec3);" - "dvec4 maxInvocationsExclusiveScanNonUniformAMD(dvec4);" - - "int64_t maxInvocationsExclusiveScanNonUniformAMD(int64_t);" - "i64vec2 maxInvocationsExclusiveScanNonUniformAMD(i64vec2);" - "i64vec3 maxInvocationsExclusiveScanNonUniformAMD(i64vec3);" - "i64vec4 maxInvocationsExclusiveScanNonUniformAMD(i64vec4);" - - "uint64_t maxInvocationsExclusiveScanNonUniformAMD(uint64_t);" - "u64vec2 maxInvocationsExclusiveScanNonUniformAMD(u64vec2);" - "u64vec3 maxInvocationsExclusiveScanNonUniformAMD(u64vec3);" - "u64vec4 maxInvocationsExclusiveScanNonUniformAMD(u64vec4);" - - "float16_t maxInvocationsExclusiveScanNonUniformAMD(float16_t);" - "f16vec2 maxInvocationsExclusiveScanNonUniformAMD(f16vec2);" - "f16vec3 maxInvocationsExclusiveScanNonUniformAMD(f16vec3);" - "f16vec4 maxInvocationsExclusiveScanNonUniformAMD(f16vec4);" - - "float addInvocationsNonUniformAMD(float);" - "vec2 addInvocationsNonUniformAMD(vec2);" - "vec3 addInvocationsNonUniformAMD(vec3);" - "vec4 addInvocationsNonUniformAMD(vec4);" - - "int addInvocationsNonUniformAMD(int);" - "ivec2 addInvocationsNonUniformAMD(ivec2);" - "ivec3 addInvocationsNonUniformAMD(ivec3);" - "ivec4 addInvocationsNonUniformAMD(ivec4);" - - "uint addInvocationsNonUniformAMD(uint);" - "uvec2 addInvocationsNonUniformAMD(uvec2);" - "uvec3 addInvocationsNonUniformAMD(uvec3);" - "uvec4 addInvocationsNonUniformAMD(uvec4);" - - "double addInvocationsNonUniformAMD(double);" - "dvec2 addInvocationsNonUniformAMD(dvec2);" - "dvec3 addInvocationsNonUniformAMD(dvec3);" - "dvec4 addInvocationsNonUniformAMD(dvec4);" - - "int64_t addInvocationsNonUniformAMD(int64_t);" - "i64vec2 addInvocationsNonUniformAMD(i64vec2);" - "i64vec3 addInvocationsNonUniformAMD(i64vec3);" - "i64vec4 addInvocationsNonUniformAMD(i64vec4);" - - "uint64_t addInvocationsNonUniformAMD(uint64_t);" - "u64vec2 addInvocationsNonUniformAMD(u64vec2);" - "u64vec3 addInvocationsNonUniformAMD(u64vec3);" - "u64vec4 addInvocationsNonUniformAMD(u64vec4);" - - "float16_t addInvocationsNonUniformAMD(float16_t);" - "f16vec2 addInvocationsNonUniformAMD(f16vec2);" - "f16vec3 addInvocationsNonUniformAMD(f16vec3);" - "f16vec4 addInvocationsNonUniformAMD(f16vec4);" - - "float addInvocationsInclusiveScanNonUniformAMD(float);" - "vec2 addInvocationsInclusiveScanNonUniformAMD(vec2);" - "vec3 addInvocationsInclusiveScanNonUniformAMD(vec3);" - "vec4 addInvocationsInclusiveScanNonUniformAMD(vec4);" - - "int addInvocationsInclusiveScanNonUniformAMD(int);" - "ivec2 addInvocationsInclusiveScanNonUniformAMD(ivec2);" - "ivec3 addInvocationsInclusiveScanNonUniformAMD(ivec3);" - "ivec4 addInvocationsInclusiveScanNonUniformAMD(ivec4);" - - "uint addInvocationsInclusiveScanNonUniformAMD(uint);" - "uvec2 addInvocationsInclusiveScanNonUniformAMD(uvec2);" - "uvec3 addInvocationsInclusiveScanNonUniformAMD(uvec3);" - "uvec4 addInvocationsInclusiveScanNonUniformAMD(uvec4);" - - "double addInvocationsInclusiveScanNonUniformAMD(double);" - "dvec2 addInvocationsInclusiveScanNonUniformAMD(dvec2);" - "dvec3 addInvocationsInclusiveScanNonUniformAMD(dvec3);" - "dvec4 addInvocationsInclusiveScanNonUniformAMD(dvec4);" - - "int64_t addInvocationsInclusiveScanNonUniformAMD(int64_t);" - "i64vec2 addInvocationsInclusiveScanNonUniformAMD(i64vec2);" - "i64vec3 addInvocationsInclusiveScanNonUniformAMD(i64vec3);" - "i64vec4 addInvocationsInclusiveScanNonUniformAMD(i64vec4);" - - "uint64_t addInvocationsInclusiveScanNonUniformAMD(uint64_t);" - "u64vec2 addInvocationsInclusiveScanNonUniformAMD(u64vec2);" - "u64vec3 addInvocationsInclusiveScanNonUniformAMD(u64vec3);" - "u64vec4 addInvocationsInclusiveScanNonUniformAMD(u64vec4);" - - "float16_t addInvocationsInclusiveScanNonUniformAMD(float16_t);" - "f16vec2 addInvocationsInclusiveScanNonUniformAMD(f16vec2);" - "f16vec3 addInvocationsInclusiveScanNonUniformAMD(f16vec3);" - "f16vec4 addInvocationsInclusiveScanNonUniformAMD(f16vec4);" - - "float addInvocationsExclusiveScanNonUniformAMD(float);" - "vec2 addInvocationsExclusiveScanNonUniformAMD(vec2);" - "vec3 addInvocationsExclusiveScanNonUniformAMD(vec3);" - "vec4 addInvocationsExclusiveScanNonUniformAMD(vec4);" - - "int addInvocationsExclusiveScanNonUniformAMD(int);" - "ivec2 addInvocationsExclusiveScanNonUniformAMD(ivec2);" - "ivec3 addInvocationsExclusiveScanNonUniformAMD(ivec3);" - "ivec4 addInvocationsExclusiveScanNonUniformAMD(ivec4);" - - "uint addInvocationsExclusiveScanNonUniformAMD(uint);" - "uvec2 addInvocationsExclusiveScanNonUniformAMD(uvec2);" - "uvec3 addInvocationsExclusiveScanNonUniformAMD(uvec3);" - "uvec4 addInvocationsExclusiveScanNonUniformAMD(uvec4);" - - "double addInvocationsExclusiveScanNonUniformAMD(double);" - "dvec2 addInvocationsExclusiveScanNonUniformAMD(dvec2);" - "dvec3 addInvocationsExclusiveScanNonUniformAMD(dvec3);" - "dvec4 addInvocationsExclusiveScanNonUniformAMD(dvec4);" - - "int64_t addInvocationsExclusiveScanNonUniformAMD(int64_t);" - "i64vec2 addInvocationsExclusiveScanNonUniformAMD(i64vec2);" - "i64vec3 addInvocationsExclusiveScanNonUniformAMD(i64vec3);" - "i64vec4 addInvocationsExclusiveScanNonUniformAMD(i64vec4);" - - "uint64_t addInvocationsExclusiveScanNonUniformAMD(uint64_t);" - "u64vec2 addInvocationsExclusiveScanNonUniformAMD(u64vec2);" - "u64vec3 addInvocationsExclusiveScanNonUniformAMD(u64vec3);" - "u64vec4 addInvocationsExclusiveScanNonUniformAMD(u64vec4);" - - "float16_t addInvocationsExclusiveScanNonUniformAMD(float16_t);" - "f16vec2 addInvocationsExclusiveScanNonUniformAMD(f16vec2);" - "f16vec3 addInvocationsExclusiveScanNonUniformAMD(f16vec3);" - "f16vec4 addInvocationsExclusiveScanNonUniformAMD(f16vec4);" - - "float swizzleInvocationsAMD(float, uvec4);" - "vec2 swizzleInvocationsAMD(vec2, uvec4);" - "vec3 swizzleInvocationsAMD(vec3, uvec4);" - "vec4 swizzleInvocationsAMD(vec4, uvec4);" - - "int swizzleInvocationsAMD(int, uvec4);" - "ivec2 swizzleInvocationsAMD(ivec2, uvec4);" - "ivec3 swizzleInvocationsAMD(ivec3, uvec4);" - "ivec4 swizzleInvocationsAMD(ivec4, uvec4);" - - "uint swizzleInvocationsAMD(uint, uvec4);" - "uvec2 swizzleInvocationsAMD(uvec2, uvec4);" - "uvec3 swizzleInvocationsAMD(uvec3, uvec4);" - "uvec4 swizzleInvocationsAMD(uvec4, uvec4);" - - "float swizzleInvocationsMaskedAMD(float, uvec3);" - "vec2 swizzleInvocationsMaskedAMD(vec2, uvec3);" - "vec3 swizzleInvocationsMaskedAMD(vec3, uvec3);" - "vec4 swizzleInvocationsMaskedAMD(vec4, uvec3);" - - "int swizzleInvocationsMaskedAMD(int, uvec3);" - "ivec2 swizzleInvocationsMaskedAMD(ivec2, uvec3);" - "ivec3 swizzleInvocationsMaskedAMD(ivec3, uvec3);" - "ivec4 swizzleInvocationsMaskedAMD(ivec4, uvec3);" - - "uint swizzleInvocationsMaskedAMD(uint, uvec3);" - "uvec2 swizzleInvocationsMaskedAMD(uvec2, uvec3);" - "uvec3 swizzleInvocationsMaskedAMD(uvec3, uvec3);" - "uvec4 swizzleInvocationsMaskedAMD(uvec4, uvec3);" - - "float writeInvocationAMD(float, float, uint);" - "vec2 writeInvocationAMD(vec2, vec2, uint);" - "vec3 writeInvocationAMD(vec3, vec3, uint);" - "vec4 writeInvocationAMD(vec4, vec4, uint);" - - "int writeInvocationAMD(int, int, uint);" - "ivec2 writeInvocationAMD(ivec2, ivec2, uint);" - "ivec3 writeInvocationAMD(ivec3, ivec3, uint);" - "ivec4 writeInvocationAMD(ivec4, ivec4, uint);" - - "uint writeInvocationAMD(uint, uint, uint);" - "uvec2 writeInvocationAMD(uvec2, uvec2, uint);" - "uvec3 writeInvocationAMD(uvec3, uvec3, uint);" - "uvec4 writeInvocationAMD(uvec4, uvec4, uint);" - - "uint mbcntAMD(uint64_t);" - - "\n"); - } - - // GL_AMD_gcn_shader - if (profile != EEsProfile && version >= 450) { - commonBuiltins.append( - "float cubeFaceIndexAMD(vec3);" - "vec2 cubeFaceCoordAMD(vec3);" - "uint64_t timeAMD();" - - "\n"); - } - - // GL_AMD_gpu_shader_half_float - if (profile != EEsProfile && version >= 450) { - commonBuiltins.append( - "float16_t radians(float16_t);" - "f16vec2 radians(f16vec2);" - "f16vec3 radians(f16vec3);" - "f16vec4 radians(f16vec4);" - - "float16_t degrees(float16_t);" - "f16vec2 degrees(f16vec2);" - "f16vec3 degrees(f16vec3);" - "f16vec4 degrees(f16vec4);" - - "float16_t sin(float16_t);" - "f16vec2 sin(f16vec2);" - "f16vec3 sin(f16vec3);" - "f16vec4 sin(f16vec4);" - - "float16_t cos(float16_t);" - "f16vec2 cos(f16vec2);" - "f16vec3 cos(f16vec3);" - "f16vec4 cos(f16vec4);" - - "float16_t tan(float16_t);" - "f16vec2 tan(f16vec2);" - "f16vec3 tan(f16vec3);" - "f16vec4 tan(f16vec4);" - - "float16_t asin(float16_t);" - "f16vec2 asin(f16vec2);" - "f16vec3 asin(f16vec3);" - "f16vec4 asin(f16vec4);" - - "float16_t acos(float16_t);" - "f16vec2 acos(f16vec2);" - "f16vec3 acos(f16vec3);" - "f16vec4 acos(f16vec4);" - - "float16_t atan(float16_t, float16_t);" - "f16vec2 atan(f16vec2, f16vec2);" - "f16vec3 atan(f16vec3, f16vec3);" - "f16vec4 atan(f16vec4, f16vec4);" - - "float16_t atan(float16_t);" - "f16vec2 atan(f16vec2);" - "f16vec3 atan(f16vec3);" - "f16vec4 atan(f16vec4);" - - "float16_t sinh(float16_t);" - "f16vec2 sinh(f16vec2);" - "f16vec3 sinh(f16vec3);" - "f16vec4 sinh(f16vec4);" - - "float16_t cosh(float16_t);" - "f16vec2 cosh(f16vec2);" - "f16vec3 cosh(f16vec3);" - "f16vec4 cosh(f16vec4);" - - "float16_t tanh(float16_t);" - "f16vec2 tanh(f16vec2);" - "f16vec3 tanh(f16vec3);" - "f16vec4 tanh(f16vec4);" - - "float16_t asinh(float16_t);" - "f16vec2 asinh(f16vec2);" - "f16vec3 asinh(f16vec3);" - "f16vec4 asinh(f16vec4);" - - "float16_t acosh(float16_t);" - "f16vec2 acosh(f16vec2);" - "f16vec3 acosh(f16vec3);" - "f16vec4 acosh(f16vec4);" - - "float16_t atanh(float16_t);" - "f16vec2 atanh(f16vec2);" - "f16vec3 atanh(f16vec3);" - "f16vec4 atanh(f16vec4);" - - "float16_t pow(float16_t, float16_t);" - "f16vec2 pow(f16vec2, f16vec2);" - "f16vec3 pow(f16vec3, f16vec3);" - "f16vec4 pow(f16vec4, f16vec4);" - - "float16_t exp(float16_t);" - "f16vec2 exp(f16vec2);" - "f16vec3 exp(f16vec3);" - "f16vec4 exp(f16vec4);" - - "float16_t log(float16_t);" - "f16vec2 log(f16vec2);" - "f16vec3 log(f16vec3);" - "f16vec4 log(f16vec4);" - - "float16_t exp2(float16_t);" - "f16vec2 exp2(f16vec2);" - "f16vec3 exp2(f16vec3);" - "f16vec4 exp2(f16vec4);" - - "float16_t log2(float16_t);" - "f16vec2 log2(f16vec2);" - "f16vec3 log2(f16vec3);" - "f16vec4 log2(f16vec4);" - - "float16_t sqrt(float16_t);" - "f16vec2 sqrt(f16vec2);" - "f16vec3 sqrt(f16vec3);" - "f16vec4 sqrt(f16vec4);" - - "float16_t inversesqrt(float16_t);" - "f16vec2 inversesqrt(f16vec2);" - "f16vec3 inversesqrt(f16vec3);" - "f16vec4 inversesqrt(f16vec4);" - - "float16_t abs(float16_t);" - "f16vec2 abs(f16vec2);" - "f16vec3 abs(f16vec3);" - "f16vec4 abs(f16vec4);" - - "float16_t sign(float16_t);" - "f16vec2 sign(f16vec2);" - "f16vec3 sign(f16vec3);" - "f16vec4 sign(f16vec4);" - - "float16_t floor(float16_t);" - "f16vec2 floor(f16vec2);" - "f16vec3 floor(f16vec3);" - "f16vec4 floor(f16vec4);" - - "float16_t trunc(float16_t);" - "f16vec2 trunc(f16vec2);" - "f16vec3 trunc(f16vec3);" - "f16vec4 trunc(f16vec4);" - - "float16_t round(float16_t);" - "f16vec2 round(f16vec2);" - "f16vec3 round(f16vec3);" - "f16vec4 round(f16vec4);" - - "float16_t roundEven(float16_t);" - "f16vec2 roundEven(f16vec2);" - "f16vec3 roundEven(f16vec3);" - "f16vec4 roundEven(f16vec4);" - - "float16_t ceil(float16_t);" - "f16vec2 ceil(f16vec2);" - "f16vec3 ceil(f16vec3);" - "f16vec4 ceil(f16vec4);" - - "float16_t fract(float16_t);" - "f16vec2 fract(f16vec2);" - "f16vec3 fract(f16vec3);" - "f16vec4 fract(f16vec4);" - - "float16_t mod(float16_t, float16_t);" - "f16vec2 mod(f16vec2, float16_t);" - "f16vec3 mod(f16vec3, float16_t);" - "f16vec4 mod(f16vec4, float16_t);" - "f16vec2 mod(f16vec2, f16vec2);" - "f16vec3 mod(f16vec3, f16vec3);" - "f16vec4 mod(f16vec4, f16vec4);" - - "float16_t modf(float16_t, out float16_t);" - "f16vec2 modf(f16vec2, out f16vec2);" - "f16vec3 modf(f16vec3, out f16vec3);" - "f16vec4 modf(f16vec4, out f16vec4);" - - "float16_t min(float16_t, float16_t);" - "f16vec2 min(f16vec2, float16_t);" - "f16vec3 min(f16vec3, float16_t);" - "f16vec4 min(f16vec4, float16_t);" - "f16vec2 min(f16vec2, f16vec2);" - "f16vec3 min(f16vec3, f16vec3);" - "f16vec4 min(f16vec4, f16vec4);" - - "float16_t max(float16_t, float16_t);" - "f16vec2 max(f16vec2, float16_t);" - "f16vec3 max(f16vec3, float16_t);" - "f16vec4 max(f16vec4, float16_t);" - "f16vec2 max(f16vec2, f16vec2);" - "f16vec3 max(f16vec3, f16vec3);" - "f16vec4 max(f16vec4, f16vec4);" - - "float16_t clamp(float16_t, float16_t, float16_t);" - "f16vec2 clamp(f16vec2, float16_t, float16_t);" - "f16vec3 clamp(f16vec3, float16_t, float16_t);" - "f16vec4 clamp(f16vec4, float16_t, float16_t);" - "f16vec2 clamp(f16vec2, f16vec2, f16vec2);" - "f16vec3 clamp(f16vec3, f16vec3, f16vec3);" - "f16vec4 clamp(f16vec4, f16vec4, f16vec4);" - - "float16_t mix(float16_t, float16_t, float16_t);" - "f16vec2 mix(f16vec2, f16vec2, float16_t);" - "f16vec3 mix(f16vec3, f16vec3, float16_t);" - "f16vec4 mix(f16vec4, f16vec4, float16_t);" - "f16vec2 mix(f16vec2, f16vec2, f16vec2);" - "f16vec3 mix(f16vec3, f16vec3, f16vec3);" - "f16vec4 mix(f16vec4, f16vec4, f16vec4);" - "float16_t mix(float16_t, float16_t, bool);" - "f16vec2 mix(f16vec2, f16vec2, bvec2);" - "f16vec3 mix(f16vec3, f16vec3, bvec3);" - "f16vec4 mix(f16vec4, f16vec4, bvec4);" - - "float16_t step(float16_t, float16_t);" - "f16vec2 step(f16vec2, f16vec2);" - "f16vec3 step(f16vec3, f16vec3);" - "f16vec4 step(f16vec4, f16vec4);" - "f16vec2 step(float16_t, f16vec2);" - "f16vec3 step(float16_t, f16vec3);" - "f16vec4 step(float16_t, f16vec4);" - - "float16_t smoothstep(float16_t, float16_t, float16_t);" - "f16vec2 smoothstep(f16vec2, f16vec2, f16vec2);" - "f16vec3 smoothstep(f16vec3, f16vec3, f16vec3);" - "f16vec4 smoothstep(f16vec4, f16vec4, f16vec4);" - "f16vec2 smoothstep(float16_t, float16_t, f16vec2);" - "f16vec3 smoothstep(float16_t, float16_t, f16vec3);" - "f16vec4 smoothstep(float16_t, float16_t, f16vec4);" - - "bool isnan(float16_t);" - "bvec2 isnan(f16vec2);" - "bvec3 isnan(f16vec3);" - "bvec4 isnan(f16vec4);" - - "bool isinf(float16_t);" - "bvec2 isinf(f16vec2);" - "bvec3 isinf(f16vec3);" - "bvec4 isinf(f16vec4);" - - "float16_t fma(float16_t, float16_t, float16_t);" - "f16vec2 fma(f16vec2, f16vec2, f16vec2);" - "f16vec3 fma(f16vec3, f16vec3, f16vec3);" - "f16vec4 fma(f16vec4, f16vec4, f16vec4);" - - "float16_t frexp(float16_t, out int);" - "f16vec2 frexp(f16vec2, out ivec2);" - "f16vec3 frexp(f16vec3, out ivec3);" - "f16vec4 frexp(f16vec4, out ivec4);" - - "float16_t ldexp(float16_t, in int);" - "f16vec2 ldexp(f16vec2, in ivec2);" - "f16vec3 ldexp(f16vec3, in ivec3);" - "f16vec4 ldexp(f16vec4, in ivec4);" - - "uint packFloat2x16(f16vec2);" - "f16vec2 unpackFloat2x16(uint);" - - "float16_t length(float16_t);" - "float16_t length(f16vec2);" - "float16_t length(f16vec3);" - "float16_t length(f16vec4);" - - "float16_t distance(float16_t, float16_t);" - "float16_t distance(f16vec2, f16vec2);" - "float16_t distance(f16vec3, f16vec3);" - "float16_t distance(f16vec4, f16vec4);" - - "float16_t dot(float16_t, float16_t);" - "float16_t dot(f16vec2, f16vec2);" - "float16_t dot(f16vec3, f16vec3);" - "float16_t dot(f16vec4, f16vec4);" - - "f16vec3 cross(f16vec3, f16vec3);" - - "float16_t normalize(float16_t);" - "f16vec2 normalize(f16vec2);" - "f16vec3 normalize(f16vec3);" - "f16vec4 normalize(f16vec4);" - - "float16_t faceforward(float16_t, float16_t, float16_t);" - "f16vec2 faceforward(f16vec2, f16vec2, f16vec2);" - "f16vec3 faceforward(f16vec3, f16vec3, f16vec3);" - "f16vec4 faceforward(f16vec4, f16vec4, f16vec4);" - - "float16_t reflect(float16_t, float16_t);" - "f16vec2 reflect(f16vec2, f16vec2);" - "f16vec3 reflect(f16vec3, f16vec3);" - "f16vec4 reflect(f16vec4, f16vec4);" - - "float16_t refract(float16_t, float16_t, float16_t);" - "f16vec2 refract(f16vec2, f16vec2, float16_t);" - "f16vec3 refract(f16vec3, f16vec3, float16_t);" - "f16vec4 refract(f16vec4, f16vec4, float16_t);" - - "f16mat2 matrixCompMult(f16mat2, f16mat2);" - "f16mat3 matrixCompMult(f16mat3, f16mat3);" - "f16mat4 matrixCompMult(f16mat4, f16mat4);" - "f16mat2x3 matrixCompMult(f16mat2x3, f16mat2x3);" - "f16mat2x4 matrixCompMult(f16mat2x4, f16mat2x4);" - "f16mat3x2 matrixCompMult(f16mat3x2, f16mat3x2);" - "f16mat3x4 matrixCompMult(f16mat3x4, f16mat3x4);" - "f16mat4x2 matrixCompMult(f16mat4x2, f16mat4x2);" - "f16mat4x3 matrixCompMult(f16mat4x3, f16mat4x3);" - - "f16mat2 outerProduct(f16vec2, f16vec2);" - "f16mat3 outerProduct(f16vec3, f16vec3);" - "f16mat4 outerProduct(f16vec4, f16vec4);" - "f16mat2x3 outerProduct(f16vec3, f16vec2);" - "f16mat3x2 outerProduct(f16vec2, f16vec3);" - "f16mat2x4 outerProduct(f16vec4, f16vec2);" - "f16mat4x2 outerProduct(f16vec2, f16vec4);" - "f16mat3x4 outerProduct(f16vec4, f16vec3);" - "f16mat4x3 outerProduct(f16vec3, f16vec4);" - - "f16mat2 transpose(f16mat2);" - "f16mat3 transpose(f16mat3);" - "f16mat4 transpose(f16mat4);" - "f16mat2x3 transpose(f16mat3x2);" - "f16mat3x2 transpose(f16mat2x3);" - "f16mat2x4 transpose(f16mat4x2);" - "f16mat4x2 transpose(f16mat2x4);" - "f16mat3x4 transpose(f16mat4x3);" - "f16mat4x3 transpose(f16mat3x4);" - - "float16_t determinant(f16mat2);" - "float16_t determinant(f16mat3);" - "float16_t determinant(f16mat4);" - - "f16mat2 inverse(f16mat2);" - "f16mat3 inverse(f16mat3);" - "f16mat4 inverse(f16mat4);" - - "bvec2 lessThan(f16vec2, f16vec2);" - "bvec3 lessThan(f16vec3, f16vec3);" - "bvec4 lessThan(f16vec4, f16vec4);" - - "bvec2 lessThanEqual(f16vec2, f16vec2);" - "bvec3 lessThanEqual(f16vec3, f16vec3);" - "bvec4 lessThanEqual(f16vec4, f16vec4);" - - "bvec2 greaterThan(f16vec2, f16vec2);" - "bvec3 greaterThan(f16vec3, f16vec3);" - "bvec4 greaterThan(f16vec4, f16vec4);" - - "bvec2 greaterThanEqual(f16vec2, f16vec2);" - "bvec3 greaterThanEqual(f16vec3, f16vec3);" - "bvec4 greaterThanEqual(f16vec4, f16vec4);" - - "bvec2 equal(f16vec2, f16vec2);" - "bvec3 equal(f16vec3, f16vec3);" - "bvec4 equal(f16vec4, f16vec4);" - - "bvec2 notEqual(f16vec2, f16vec2);" - "bvec3 notEqual(f16vec3, f16vec3);" - "bvec4 notEqual(f16vec4, f16vec4);" - - "\n"); - } - - // GL_AMD_gpu_shader_int16 - if (profile != EEsProfile && version >= 450) { - commonBuiltins.append( - "int16_t abs(int16_t);" - "i16vec2 abs(i16vec2);" - "i16vec3 abs(i16vec3);" - "i16vec4 abs(i16vec4);" - - "int16_t sign(int16_t);" - "i16vec2 sign(i16vec2);" - "i16vec3 sign(i16vec3);" - "i16vec4 sign(i16vec4);" - - "int16_t min(int16_t, int16_t);" - "i16vec2 min(i16vec2, int16_t);" - "i16vec3 min(i16vec3, int16_t);" - "i16vec4 min(i16vec4, int16_t);" - "i16vec2 min(i16vec2, i16vec2);" - "i16vec3 min(i16vec3, i16vec3);" - "i16vec4 min(i16vec4, i16vec4);" - "uint16_t min(uint16_t, uint16_t);" - "u16vec2 min(u16vec2, uint16_t);" - "u16vec3 min(u16vec3, uint16_t);" - "u16vec4 min(u16vec4, uint16_t);" - "u16vec2 min(u16vec2, u16vec2);" - "u16vec3 min(u16vec3, u16vec3);" - "u16vec4 min(u16vec4, u16vec4);" - - "int16_t max(int16_t, int16_t);" - "i16vec2 max(i16vec2, int16_t);" - "i16vec3 max(i16vec3, int16_t);" - "i16vec4 max(i16vec4, int16_t);" - "i16vec2 max(i16vec2, i16vec2);" - "i16vec3 max(i16vec3, i16vec3);" - "i16vec4 max(i16vec4, i16vec4);" - "uint16_t max(uint16_t, uint16_t);" - "u16vec2 max(u16vec2, uint16_t);" - "u16vec3 max(u16vec3, uint16_t);" - "u16vec4 max(u16vec4, uint16_t);" - "u16vec2 max(u16vec2, u16vec2);" - "u16vec3 max(u16vec3, u16vec3);" - "u16vec4 max(u16vec4, u16vec4);" - - "int16_t clamp(int16_t, int16_t, int16_t);" - "i16vec2 clamp(i16vec2, int16_t, int16_t);" - "i16vec3 clamp(i16vec3, int16_t, int16_t);" - "i16vec4 clamp(i16vec4, int16_t, int16_t);" - "i16vec2 clamp(i16vec2, i16vec2, i16vec2);" - "i16vec3 clamp(i16vec3, i16vec3, i16vec3);" - "i16vec4 clamp(i16vec4, i16vec4, i16vec4);" - "uint16_t clamp(uint16_t, uint16_t, uint16_t);" - "u16vec2 clamp(u16vec2, uint16_t, uint16_t);" - "u16vec3 clamp(u16vec3, uint16_t, uint16_t);" - "u16vec4 clamp(u16vec4, uint16_t, uint16_t);" - "u16vec2 clamp(u16vec2, u16vec2, u16vec2);" - "u16vec3 clamp(u16vec3, u16vec3, u16vec3);" - "u16vec4 clamp(u16vec4, u16vec4, u16vec4);" - - "int16_t mix(int16_t, int16_t, bool);" - "i16vec2 mix(i16vec2, i16vec2, bvec2);" - "i16vec3 mix(i16vec3, i16vec3, bvec3);" - "i16vec4 mix(i16vec4, i16vec4, bvec4);" - "uint16_t mix(uint16_t, uint16_t, bool);" - "u16vec2 mix(u16vec2, u16vec2, bvec2);" - "u16vec3 mix(u16vec3, u16vec3, bvec3);" - "u16vec4 mix(u16vec4, u16vec4, bvec4);" - - "float16_t frexp(float16_t, out int16_t);" - "f16vec2 frexp(f16vec2, out i16vec2);" - "f16vec3 frexp(f16vec3, out i16vec3);" - "f16vec4 frexp(f16vec4, out i16vec4);" - - "float16_t ldexp(float16_t, int16_t);" - "f16vec2 ldexp(f16vec2, i16vec2);" - "f16vec3 ldexp(f16vec3, i16vec3);" - "f16vec4 ldexp(f16vec4, i16vec4);" - - "int16_t float16BitsToInt16(float16_t);" - "i16vec2 float16BitsToInt16(f16vec2);" - "i16vec3 float16BitsToInt16(f16vec3);" - "i16vec4 float16BitsToInt16(f16vec4);" - - "uint16_t float16BitsToUint16(float16_t);" - "u16vec2 float16BitsToUint16(f16vec2);" - "u16vec3 float16BitsToUint16(f16vec3);" - "u16vec4 float16BitsToUint16(f16vec4);" - - "float16_t int16BitsToFloat16(int16_t);" - "f16vec2 int16BitsToFloat16(i16vec2);" - "f16vec3 int16BitsToFloat16(i16vec3);" - "f16vec4 int16BitsToFloat16(i16vec4);" - - "float16_t uint16BitsToFloat16(uint16_t);" - "f16vec2 uint16BitsToFloat16(u16vec2);" - "f16vec3 uint16BitsToFloat16(u16vec3);" - "f16vec4 uint16BitsToFloat16(u16vec4);" - - "int packInt2x16(i16vec2);" - "uint packUint2x16(u16vec2);" - "int64_t packInt4x16(i16vec4);" - "uint64_t packUint4x16(u16vec4);" - "i16vec2 unpackInt2x16(int);" - "u16vec2 unpackUint2x16(uint);" - "i16vec4 unpackInt4x16(int64_t);" - "u16vec4 unpackUint4x16(uint64_t);" - - "bvec2 lessThan(i16vec2, i16vec2);" - "bvec3 lessThan(i16vec3, i16vec3);" - "bvec4 lessThan(i16vec4, i16vec4);" - "bvec2 lessThan(u16vec2, u16vec2);" - "bvec3 lessThan(u16vec3, u16vec3);" - "bvec4 lessThan(u16vec4, u16vec4);" - - "bvec2 lessThanEqual(i16vec2, i16vec2);" - "bvec3 lessThanEqual(i16vec3, i16vec3);" - "bvec4 lessThanEqual(i16vec4, i16vec4);" - "bvec2 lessThanEqual(u16vec2, u16vec2);" - "bvec3 lessThanEqual(u16vec3, u16vec3);" - "bvec4 lessThanEqual(u16vec4, u16vec4);" - - "bvec2 greaterThan(i16vec2, i16vec2);" - "bvec3 greaterThan(i16vec3, i16vec3);" - "bvec4 greaterThan(i16vec4, i16vec4);" - "bvec2 greaterThan(u16vec2, u16vec2);" - "bvec3 greaterThan(u16vec3, u16vec3);" - "bvec4 greaterThan(u16vec4, u16vec4);" - - "bvec2 greaterThanEqual(i16vec2, i16vec2);" - "bvec3 greaterThanEqual(i16vec3, i16vec3);" - "bvec4 greaterThanEqual(i16vec4, i16vec4);" - "bvec2 greaterThanEqual(u16vec2, u16vec2);" - "bvec3 greaterThanEqual(u16vec3, u16vec3);" - "bvec4 greaterThanEqual(u16vec4, u16vec4);" - - "bvec2 equal(i16vec2, i16vec2);" - "bvec3 equal(i16vec3, i16vec3);" - "bvec4 equal(i16vec4, i16vec4);" - "bvec2 equal(u16vec2, u16vec2);" - "bvec3 equal(u16vec3, u16vec3);" - "bvec4 equal(u16vec4, u16vec4);" - - "bvec2 notEqual(i16vec2, i16vec2);" - "bvec3 notEqual(i16vec3, i16vec3);" - "bvec4 notEqual(i16vec4, i16vec4);" - "bvec2 notEqual(u16vec2, u16vec2);" - "bvec3 notEqual(u16vec3, u16vec3);" - "bvec4 notEqual(u16vec4, u16vec4);" - - "\n"); - } - - // GL_AMD_shader_fragment_mask - if (profile != EEsProfile && version >= 450) { - commonBuiltins.append( - "uint fragmentMaskFetchAMD(sampler2DMS, ivec2);" - "uint fragmentMaskFetchAMD(isampler2DMS, ivec2);" - "uint fragmentMaskFetchAMD(usampler2DMS, ivec2);" - - "uint fragmentMaskFetchAMD(sampler2DMSArray, ivec3);" - "uint fragmentMaskFetchAMD(isampler2DMSArray, ivec3);" - "uint fragmentMaskFetchAMD(usampler2DMSArray, ivec3);" - - "vec4 fragmentFetchAMD(sampler2DMS, ivec2, uint);" - "ivec4 fragmentFetchAMD(isampler2DMS, ivec2, uint);" - "uvec4 fragmentFetchAMD(usampler2DMS, ivec2, uint);" - - "vec4 fragmentFetchAMD(sampler2DMSArray, ivec3, uint);" - "ivec4 fragmentFetchAMD(isampler2DMSArray, ivec3, uint);" - "uvec4 fragmentFetchAMD(usampler2DMSArray, ivec3, uint);" - - "\n"); - } - -#endif - - //============================================================================ - // - // Prototypes for built-in functions seen by vertex shaders only. - // (Except legacy lod functions, where it depends which release they are - // vertex only.) - // - //============================================================================ - - // - // Geometric Functions. - // - if (IncludeLegacy(version, profile, spvVersion)) - stageBuiltins[EShLangVertex].append("vec4 ftransform();"); - - // - // Original-style texture Functions with lod. - // - TString* s; - if (version == 100) - s = &stageBuiltins[EShLangVertex]; - else - s = &commonBuiltins; - if ((profile == EEsProfile && version == 100) || - profile == ECompatibilityProfile || - (profile == ECoreProfile && version < 420) || - profile == ENoProfile) { - if (spvVersion.spv == 0) { - s->append( - "vec4 texture2DLod(sampler2D, vec2, float);" // GL_ARB_shader_texture_lod - "vec4 texture2DProjLod(sampler2D, vec3, float);" // GL_ARB_shader_texture_lod - "vec4 texture2DProjLod(sampler2D, vec4, float);" // GL_ARB_shader_texture_lod - "vec4 texture3DLod(sampler3D, vec3, float);" // GL_ARB_shader_texture_lod // OES_texture_3D, but caught by keyword check - "vec4 texture3DProjLod(sampler3D, vec4, float);" // GL_ARB_shader_texture_lod // OES_texture_3D, but caught by keyword check - "vec4 textureCubeLod(samplerCube, vec3, float);" // GL_ARB_shader_texture_lod - - "vec4 texture2DArrayLod(sampler2DArray, vec3, float);" // GL_EXT_texture_array - - "\n"); - } - } - if ( profile == ECompatibilityProfile || - (profile == ECoreProfile && version < 420) || - profile == ENoProfile) { - if (spvVersion.spv == 0) { - s->append( - "vec4 texture1DLod(sampler1D, float, float);" // GL_ARB_shader_texture_lod - "vec4 texture1DProjLod(sampler1D, vec2, float);" // GL_ARB_shader_texture_lod - "vec4 texture1DProjLod(sampler1D, vec4, float);" // GL_ARB_shader_texture_lod - "vec4 shadow1DLod(sampler1DShadow, vec3, float);" // GL_ARB_shader_texture_lod - "vec4 shadow2DLod(sampler2DShadow, vec3, float);" // GL_ARB_shader_texture_lod - "vec4 shadow1DProjLod(sampler1DShadow, vec4, float);" // GL_ARB_shader_texture_lod - "vec4 shadow2DProjLod(sampler2DShadow, vec4, float);" // GL_ARB_shader_texture_lod - - "vec4 texture1DGradARB(sampler1D, float, float, float);" // GL_ARB_shader_texture_lod - "vec4 texture1DProjGradARB(sampler1D, vec2, float, float);" // GL_ARB_shader_texture_lod - "vec4 texture1DProjGradARB(sampler1D, vec4, float, float);" // GL_ARB_shader_texture_lod - "vec4 texture2DGradARB(sampler2D, vec2, vec2, vec2);" // GL_ARB_shader_texture_lod - "vec4 texture2DProjGradARB(sampler2D, vec3, vec2, vec2);" // GL_ARB_shader_texture_lod - "vec4 texture2DProjGradARB(sampler2D, vec4, vec2, vec2);" // GL_ARB_shader_texture_lod - "vec4 texture3DGradARB(sampler3D, vec3, vec3, vec3);" // GL_ARB_shader_texture_lod - "vec4 texture3DProjGradARB(sampler3D, vec4, vec3, vec3);" // GL_ARB_shader_texture_lod - "vec4 textureCubeGradARB(samplerCube, vec3, vec3, vec3);" // GL_ARB_shader_texture_lod - "vec4 shadow1DGradARB(sampler1DShadow, vec3, float, float);" // GL_ARB_shader_texture_lod - "vec4 shadow1DProjGradARB( sampler1DShadow, vec4, float, float);" // GL_ARB_shader_texture_lod - "vec4 shadow2DGradARB(sampler2DShadow, vec3, vec2, vec2);" // GL_ARB_shader_texture_lod - "vec4 shadow2DProjGradARB( sampler2DShadow, vec4, vec2, vec2);" // GL_ARB_shader_texture_lod - "vec4 texture2DRectGradARB(sampler2DRect, vec2, vec2, vec2);" // GL_ARB_shader_texture_lod - "vec4 texture2DRectProjGradARB( sampler2DRect, vec3, vec2, vec2);" // GL_ARB_shader_texture_lod - "vec4 texture2DRectProjGradARB( sampler2DRect, vec4, vec2, vec2);" // GL_ARB_shader_texture_lod - "vec4 shadow2DRectGradARB( sampler2DRectShadow, vec3, vec2, vec2);" // GL_ARB_shader_texture_lod - "vec4 shadow2DRectProjGradARB(sampler2DRectShadow, vec4, vec2, vec2);" // GL_ARB_shader_texture_lod - - "vec4 texture1DArrayLod(sampler1DArray, vec2, float);" // GL_EXT_texture_array - "vec4 shadow1DArrayLod(sampler1DArrayShadow, vec3, float);" // GL_EXT_texture_array - "vec4 shadow2DArrayLod(sampler2DArrayShadow, vec4, float);" // GL_EXT_texture_array - - "\n"); - } - } - - if ((profile != EEsProfile && version >= 150) || - (profile == EEsProfile && version >= 310)) { - //============================================================================ - // - // Prototypes for built-in functions seen by geometry shaders only. - // - //============================================================================ - - if (profile != EEsProfile && version >= 400) { - stageBuiltins[EShLangGeometry].append( - "void EmitStreamVertex(int);" - "void EndStreamPrimitive(int);" - ); - } - stageBuiltins[EShLangGeometry].append( - "void EmitVertex();" - "void EndPrimitive();" - "\n"); - } - - //============================================================================ - // - // Prototypes for all control functions. - // - //============================================================================ - bool esBarrier = (profile == EEsProfile && version >= 310); - if ((profile != EEsProfile && version >= 150) || esBarrier) - stageBuiltins[EShLangTessControl].append( - "void barrier();" - ); - if ((profile != EEsProfile && version >= 420) || esBarrier) - stageBuiltins[EShLangCompute].append( - "void barrier();" - ); - if ((profile != EEsProfile && version >= 130) || esBarrier) - commonBuiltins.append( - "void memoryBarrier();" - ); - if ((profile != EEsProfile && version >= 420) || esBarrier) { - commonBuiltins.append( - "void memoryBarrierAtomicCounter();" - "void memoryBarrierBuffer();" - "void memoryBarrierImage();" - ); - stageBuiltins[EShLangCompute].append( - "void memoryBarrierShared();" - "void groupMemoryBarrier();" - ); - } - - //============================================================================ - // - // Prototypes for built-in functions seen by fragment shaders only. - // - //============================================================================ - - // - // Original-style texture Functions with bias. - // - if (spvVersion.spv == 0 && (profile != EEsProfile || version == 100)) { - stageBuiltins[EShLangFragment].append( - "vec4 texture2D(sampler2D, vec2, float);" - "vec4 texture2DProj(sampler2D, vec3, float);" - "vec4 texture2DProj(sampler2D, vec4, float);" - "vec4 texture3D(sampler3D, vec3, float);" // OES_texture_3D - "vec4 texture3DProj(sampler3D, vec4, float);" // OES_texture_3D - "vec4 textureCube(samplerCube, vec3, float);" - "vec4 texture2DArray(sampler2DArray, vec3, float);" // GL_EXT_texture_array - - "\n"); - } - if (spvVersion.spv == 0 && (profile != EEsProfile && version > 100)) { - stageBuiltins[EShLangFragment].append( - "vec4 texture1D(sampler1D, float, float);" - "vec4 texture1DProj(sampler1D, vec2, float);" - "vec4 texture1DProj(sampler1D, vec4, float);" - "vec4 shadow1D(sampler1DShadow, vec3, float);" - "vec4 shadow2D(sampler2DShadow, vec3, float);" - "vec4 shadow1DProj(sampler1DShadow, vec4, float);" - "vec4 shadow2DProj(sampler2DShadow, vec4, float);" - "vec4 texture1DArray(sampler1DArray, vec2, float);" // GL_EXT_texture_array - "vec4 shadow1DArray(sampler1DArrayShadow, vec3, float);" // GL_EXT_texture_array - "vec4 shadow2DArray(sampler2DArrayShadow, vec4, float);" // GL_EXT_texture_array - "\n"); - } - if (spvVersion.spv == 0 && profile == EEsProfile) { - stageBuiltins[EShLangFragment].append( - "vec4 texture2DLodEXT(sampler2D, vec2, float);" // GL_EXT_shader_texture_lod - "vec4 texture2DProjLodEXT(sampler2D, vec3, float);" // GL_EXT_shader_texture_lod - "vec4 texture2DProjLodEXT(sampler2D, vec4, float);" // GL_EXT_shader_texture_lod - "vec4 textureCubeLodEXT(samplerCube, vec3, float);" // GL_EXT_shader_texture_lod - - "\n"); - } - - stageBuiltins[EShLangFragment].append( - "float dFdx(float p);" - "vec2 dFdx(vec2 p);" - "vec3 dFdx(vec3 p);" - "vec4 dFdx(vec4 p);" - - "float dFdy(float p);" - "vec2 dFdy(vec2 p);" - "vec3 dFdy(vec3 p);" - "vec4 dFdy(vec4 p);" - - "float fwidth(float p);" - "vec2 fwidth(vec2 p);" - "vec3 fwidth(vec3 p);" - "vec4 fwidth(vec4 p);" - - "\n"); - - // GL_ARB_derivative_control - if (profile != EEsProfile && version >= 400) { - stageBuiltins[EShLangFragment].append( - "float dFdxFine(float p);" - "vec2 dFdxFine(vec2 p);" - "vec3 dFdxFine(vec3 p);" - "vec4 dFdxFine(vec4 p);" - - "float dFdyFine(float p);" - "vec2 dFdyFine(vec2 p);" - "vec3 dFdyFine(vec3 p);" - "vec4 dFdyFine(vec4 p);" - - "float fwidthFine(float p);" - "vec2 fwidthFine(vec2 p);" - "vec3 fwidthFine(vec3 p);" - "vec4 fwidthFine(vec4 p);" - - "\n"); - - stageBuiltins[EShLangFragment].append( - "float dFdxCoarse(float p);" - "vec2 dFdxCoarse(vec2 p);" - "vec3 dFdxCoarse(vec3 p);" - "vec4 dFdxCoarse(vec4 p);" - - "float dFdyCoarse(float p);" - "vec2 dFdyCoarse(vec2 p);" - "vec3 dFdyCoarse(vec3 p);" - "vec4 dFdyCoarse(vec4 p);" - - "float fwidthCoarse(float p);" - "vec2 fwidthCoarse(vec2 p);" - "vec3 fwidthCoarse(vec3 p);" - "vec4 fwidthCoarse(vec4 p);" - - "\n"); - } - - // GL_OES_shader_multisample_interpolation - if ((profile == EEsProfile && version >= 310) || - (profile != EEsProfile && version >= 400)) { - stageBuiltins[EShLangFragment].append( - "float interpolateAtCentroid(float);" - "vec2 interpolateAtCentroid(vec2);" - "vec3 interpolateAtCentroid(vec3);" - "vec4 interpolateAtCentroid(vec4);" - - "float interpolateAtSample(float, int);" - "vec2 interpolateAtSample(vec2, int);" - "vec3 interpolateAtSample(vec3, int);" - "vec4 interpolateAtSample(vec4, int);" - - "float interpolateAtOffset(float, vec2);" - "vec2 interpolateAtOffset(vec2, vec2);" - "vec3 interpolateAtOffset(vec3, vec2);" - "vec4 interpolateAtOffset(vec4, vec2);" - - "\n"); - } - -#ifdef AMD_EXTENSIONS - // GL_AMD_shader_explicit_vertex_parameter - if (profile != EEsProfile && version >= 450) { - stageBuiltins[EShLangFragment].append( - "float interpolateAtVertexAMD(float, uint);" - "vec2 interpolateAtVertexAMD(vec2, uint);" - "vec3 interpolateAtVertexAMD(vec3, uint);" - "vec4 interpolateAtVertexAMD(vec4, uint);" - - "int interpolateAtVertexAMD(int, uint);" - "ivec2 interpolateAtVertexAMD(ivec2, uint);" - "ivec3 interpolateAtVertexAMD(ivec3, uint);" - "ivec4 interpolateAtVertexAMD(ivec4, uint);" - - "uint interpolateAtVertexAMD(uint, uint);" - "uvec2 interpolateAtVertexAMD(uvec2, uint);" - "uvec3 interpolateAtVertexAMD(uvec3, uint);" - "uvec4 interpolateAtVertexAMD(uvec4, uint);" - - "float16_t interpolateAtVertexAMD(float16_t, uint);" - "f16vec2 interpolateAtVertexAMD(f16vec2, uint);" - "f16vec3 interpolateAtVertexAMD(f16vec3, uint);" - "f16vec4 interpolateAtVertexAMD(f16vec4, uint);" - - "\n"); - } - - // GL_AMD_gpu_shader_half_float - if (profile != EEsProfile && version >= 450) { - stageBuiltins[EShLangFragment].append( - "float16_t dFdx(float16_t);" - "f16vec2 dFdx(f16vec2);" - "f16vec3 dFdx(f16vec3);" - "f16vec4 dFdx(f16vec4);" - - "float16_t dFdy(float16_t);" - "f16vec2 dFdy(f16vec2);" - "f16vec3 dFdy(f16vec3);" - "f16vec4 dFdy(f16vec4);" - - "float16_t dFdxFine(float16_t);" - "f16vec2 dFdxFine(f16vec2);" - "f16vec3 dFdxFine(f16vec3);" - "f16vec4 dFdxFine(f16vec4);" - - "float16_t dFdyFine(float16_t);" - "f16vec2 dFdyFine(f16vec2);" - "f16vec3 dFdyFine(f16vec3);" - "f16vec4 dFdyFine(f16vec4);" - - "float16_t dFdxCoarse(float16_t);" - "f16vec2 dFdxCoarse(f16vec2);" - "f16vec3 dFdxCoarse(f16vec3);" - "f16vec4 dFdxCoarse(f16vec4);" - - "float16_t dFdyCoarse(float16_t);" - "f16vec2 dFdyCoarse(f16vec2);" - "f16vec3 dFdyCoarse(f16vec3);" - "f16vec4 dFdyCoarse(f16vec4);" - - "float16_t fwidth(float16_t);" - "f16vec2 fwidth(f16vec2);" - "f16vec3 fwidth(f16vec3);" - "f16vec4 fwidth(f16vec4);" - - "float16_t fwidthFine(float16_t);" - "f16vec2 fwidthFine(f16vec2);" - "f16vec3 fwidthFine(f16vec3);" - "f16vec4 fwidthFine(f16vec4);" - - "float16_t fwidthCoarse(float16_t);" - "f16vec2 fwidthCoarse(f16vec2);" - "f16vec3 fwidthCoarse(f16vec3);" - "f16vec4 fwidthCoarse(f16vec4);" - - "float16_t interpolateAtCentroid(float16_t);" - "f16vec2 interpolateAtCentroid(f16vec2);" - "f16vec3 interpolateAtCentroid(f16vec3);" - "f16vec4 interpolateAtCentroid(f16vec4);" - - "float16_t interpolateAtSample(float16_t, int);" - "f16vec2 interpolateAtSample(f16vec2, int);" - "f16vec3 interpolateAtSample(f16vec3, int);" - "f16vec4 interpolateAtSample(f16vec4, int);" - - "float16_t interpolateAtOffset(float16_t, f16vec2);" - "f16vec2 interpolateAtOffset(f16vec2, f16vec2);" - "f16vec3 interpolateAtOffset(f16vec3, f16vec2);" - "f16vec4 interpolateAtOffset(f16vec4, f16vec2);" - - "\n"); - } - - // GL_AMD_shader_fragment_mask - if (profile != EEsProfile && version >= 450 && spvVersion.vulkan >= 100) { - stageBuiltins[EShLangFragment].append( - "uint fragmentMaskFetchAMD(subpassInputMS);" - "uint fragmentMaskFetchAMD(isubpassInputMS);" - "uint fragmentMaskFetchAMD(usubpassInputMS);" - - "vec4 fragmentFetchAMD(subpassInputMS, uint);" - "ivec4 fragmentFetchAMD(isubpassInputMS, uint);" - "uvec4 fragmentFetchAMD(usubpassInputMS, uint);" - - "\n"); - } -#endif - - //============================================================================ - // - // Standard Uniforms - // - //============================================================================ - - // - // Depth range in window coordinates, p. 33 - // - if (spvVersion.spv == 0) { - commonBuiltins.append( - "struct gl_DepthRangeParameters {" - ); - if (profile == EEsProfile) { - commonBuiltins.append( - "highp float near;" // n - "highp float far;" // f - "highp float diff;" // f - n - ); - } else { - commonBuiltins.append( - "float near;" // n - "float far;" // f - "float diff;" // f - n - ); - } - - commonBuiltins.append( - "};" - "uniform gl_DepthRangeParameters gl_DepthRange;" - "\n"); - } - - if (spvVersion.spv == 0 && IncludeLegacy(version, profile, spvVersion)) { - // - // Matrix state. p. 31, 32, 37, 39, 40. - // - commonBuiltins.append( - "uniform mat4 gl_ModelViewMatrix;" - "uniform mat4 gl_ProjectionMatrix;" - "uniform mat4 gl_ModelViewProjectionMatrix;" - - // - // Derived matrix state that provides inverse and transposed versions - // of the matrices above. - // - "uniform mat3 gl_NormalMatrix;" - - "uniform mat4 gl_ModelViewMatrixInverse;" - "uniform mat4 gl_ProjectionMatrixInverse;" - "uniform mat4 gl_ModelViewProjectionMatrixInverse;" - - "uniform mat4 gl_ModelViewMatrixTranspose;" - "uniform mat4 gl_ProjectionMatrixTranspose;" - "uniform mat4 gl_ModelViewProjectionMatrixTranspose;" - - "uniform mat4 gl_ModelViewMatrixInverseTranspose;" - "uniform mat4 gl_ProjectionMatrixInverseTranspose;" - "uniform mat4 gl_ModelViewProjectionMatrixInverseTranspose;" - - // - // Normal scaling p. 39. - // - "uniform float gl_NormalScale;" - - // - // Point Size, p. 66, 67. - // - "struct gl_PointParameters {" - "float size;" - "float sizeMin;" - "float sizeMax;" - "float fadeThresholdSize;" - "float distanceConstantAttenuation;" - "float distanceLinearAttenuation;" - "float distanceQuadraticAttenuation;" - "};" - - "uniform gl_PointParameters gl_Point;" - - // - // Material State p. 50, 55. - // - "struct gl_MaterialParameters {" - "vec4 emission;" // Ecm - "vec4 ambient;" // Acm - "vec4 diffuse;" // Dcm - "vec4 specular;" // Scm - "float shininess;" // Srm - "};" - "uniform gl_MaterialParameters gl_FrontMaterial;" - "uniform gl_MaterialParameters gl_BackMaterial;" - - // - // Light State p 50, 53, 55. - // - "struct gl_LightSourceParameters {" - "vec4 ambient;" // Acli - "vec4 diffuse;" // Dcli - "vec4 specular;" // Scli - "vec4 position;" // Ppli - "vec4 halfVector;" // Derived: Hi - "vec3 spotDirection;" // Sdli - "float spotExponent;" // Srli - "float spotCutoff;" // Crli - // (range: [0.0,90.0], 180.0) - "float spotCosCutoff;" // Derived: cos(Crli) - // (range: [1.0,0.0],-1.0) - "float constantAttenuation;" // K0 - "float linearAttenuation;" // K1 - "float quadraticAttenuation;"// K2 - "};" - - "struct gl_LightModelParameters {" - "vec4 ambient;" // Acs - "};" - - "uniform gl_LightModelParameters gl_LightModel;" - - // - // Derived state from products of light and material. - // - "struct gl_LightModelProducts {" - "vec4 sceneColor;" // Derived. Ecm + Acm * Acs - "};" - - "uniform gl_LightModelProducts gl_FrontLightModelProduct;" - "uniform gl_LightModelProducts gl_BackLightModelProduct;" - - "struct gl_LightProducts {" - "vec4 ambient;" // Acm * Acli - "vec4 diffuse;" // Dcm * Dcli - "vec4 specular;" // Scm * Scli - "};" - - // - // Fog p. 161 - // - "struct gl_FogParameters {" - "vec4 color;" - "float density;" - "float start;" - "float end;" - "float scale;" // 1 / (gl_FogEnd - gl_FogStart) - "};" - - "uniform gl_FogParameters gl_Fog;" - - "\n"); - } - - //============================================================================ - // - // Define the interface to the compute shader. - // - //============================================================================ - - if ((profile != EEsProfile && version >= 420) || - (profile == EEsProfile && version >= 310)) { - stageBuiltins[EShLangCompute].append( - "in highp uvec3 gl_NumWorkGroups;" - "const highp uvec3 gl_WorkGroupSize = uvec3(1,1,1);" - - "in highp uvec3 gl_WorkGroupID;" - "in highp uvec3 gl_LocalInvocationID;" - - "in highp uvec3 gl_GlobalInvocationID;" - "in highp uint gl_LocalInvocationIndex;" - - "\n"); - } - - if ((profile != EEsProfile && version >= 140) || - (profile == EEsProfile && version >= 310)) { - stageBuiltins[EShLangCompute].append( - "in highp int gl_DeviceIndex;" // GL_EXT_device_group - "\n"); - } - - //============================================================================ - // - // Define the interface to the vertex shader. - // - //============================================================================ - - if (profile != EEsProfile) { - if (version < 130) { - stageBuiltins[EShLangVertex].append( - "attribute vec4 gl_Color;" - "attribute vec4 gl_SecondaryColor;" - "attribute vec3 gl_Normal;" - "attribute vec4 gl_Vertex;" - "attribute vec4 gl_MultiTexCoord0;" - "attribute vec4 gl_MultiTexCoord1;" - "attribute vec4 gl_MultiTexCoord2;" - "attribute vec4 gl_MultiTexCoord3;" - "attribute vec4 gl_MultiTexCoord4;" - "attribute vec4 gl_MultiTexCoord5;" - "attribute vec4 gl_MultiTexCoord6;" - "attribute vec4 gl_MultiTexCoord7;" - "attribute float gl_FogCoord;" - "\n"); - } else if (IncludeLegacy(version, profile, spvVersion)) { - stageBuiltins[EShLangVertex].append( - "in vec4 gl_Color;" - "in vec4 gl_SecondaryColor;" - "in vec3 gl_Normal;" - "in vec4 gl_Vertex;" - "in vec4 gl_MultiTexCoord0;" - "in vec4 gl_MultiTexCoord1;" - "in vec4 gl_MultiTexCoord2;" - "in vec4 gl_MultiTexCoord3;" - "in vec4 gl_MultiTexCoord4;" - "in vec4 gl_MultiTexCoord5;" - "in vec4 gl_MultiTexCoord6;" - "in vec4 gl_MultiTexCoord7;" - "in float gl_FogCoord;" - "\n"); - } - - if (version < 150) { - if (version < 130) { - stageBuiltins[EShLangVertex].append( - " vec4 gl_ClipVertex;" // needs qualifier fixed later - "varying vec4 gl_FrontColor;" - "varying vec4 gl_BackColor;" - "varying vec4 gl_FrontSecondaryColor;" - "varying vec4 gl_BackSecondaryColor;" - "varying vec4 gl_TexCoord[];" - "varying float gl_FogFragCoord;" - "\n"); - } else if (IncludeLegacy(version, profile, spvVersion)) { - stageBuiltins[EShLangVertex].append( - " vec4 gl_ClipVertex;" // needs qualifier fixed later - "out vec4 gl_FrontColor;" - "out vec4 gl_BackColor;" - "out vec4 gl_FrontSecondaryColor;" - "out vec4 gl_BackSecondaryColor;" - "out vec4 gl_TexCoord[];" - "out float gl_FogFragCoord;" - "\n"); - } - stageBuiltins[EShLangVertex].append( - "vec4 gl_Position;" // needs qualifier fixed later - "float gl_PointSize;" // needs qualifier fixed later - ); - - if (version == 130 || version == 140) - stageBuiltins[EShLangVertex].append( - "out float gl_ClipDistance[];" - ); - } else { - // version >= 150 - stageBuiltins[EShLangVertex].append( - "out gl_PerVertex {" - "vec4 gl_Position;" // needs qualifier fixed later - "float gl_PointSize;" // needs qualifier fixed later - "float gl_ClipDistance[];" - ); - if (IncludeLegacy(version, profile, spvVersion)) - stageBuiltins[EShLangVertex].append( - "vec4 gl_ClipVertex;" // needs qualifier fixed later - "vec4 gl_FrontColor;" - "vec4 gl_BackColor;" - "vec4 gl_FrontSecondaryColor;" - "vec4 gl_BackSecondaryColor;" - "vec4 gl_TexCoord[];" - "float gl_FogFragCoord;" - ); - if (version >= 450) - stageBuiltins[EShLangVertex].append( - "float gl_CullDistance[];" - ); - stageBuiltins[EShLangVertex].append( - "};" - "\n"); - } - if (version >= 130 && spvVersion.vulkan == 0) - stageBuiltins[EShLangVertex].append( - "int gl_VertexID;" // needs qualifier fixed later - ); - if (version >= 140 && spvVersion.vulkan == 0) - stageBuiltins[EShLangVertex].append( - "int gl_InstanceID;" // needs qualifier fixed later - ); - if (spvVersion.vulkan >= 100 && version >= 140) - stageBuiltins[EShLangVertex].append( - "in int gl_VertexIndex;" - "in int gl_InstanceIndex;" - ); - if (version >= 440) { - stageBuiltins[EShLangVertex].append( - "in int gl_BaseVertexARB;" - "in int gl_BaseInstanceARB;" - "in int gl_DrawIDARB;" - ); - } - if (version >= 410) { - stageBuiltins[EShLangVertex].append( - "out int gl_ViewportIndex;" - "out int gl_Layer;" - ); - } - if (version >= 460) { - stageBuiltins[EShLangVertex].append( - "in int gl_BaseVertex;" - "in int gl_BaseInstance;" - "in int gl_DrawID;" - ); - } - -#ifdef NV_EXTENSIONS - if (version >= 450) - stageBuiltins[EShLangVertex].append( - "out int gl_ViewportMask[];" // GL_NV_viewport_array2 - "out int gl_SecondaryViewportMaskNV[];" // GL_NV_stereo_view_rendering - "out vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering - "out vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes - "out int gl_ViewportMaskPerViewNV[];" // GL_NVX_multiview_per_view_attributes - ); -#endif - - } else { - // ES profile - if (version == 100) { - stageBuiltins[EShLangVertex].append( - "highp vec4 gl_Position;" // needs qualifier fixed later - "mediump float gl_PointSize;" // needs qualifier fixed later - ); - } else { - if (spvVersion.vulkan == 0) - stageBuiltins[EShLangVertex].append( - "in highp int gl_VertexID;" // needs qualifier fixed later - "in highp int gl_InstanceID;" // needs qualifier fixed later - ); - if (spvVersion.vulkan >= 100) - stageBuiltins[EShLangVertex].append( - "in highp int gl_VertexIndex;" - "in highp int gl_InstanceIndex;" - ); - if (version < 310) - stageBuiltins[EShLangVertex].append( - "highp vec4 gl_Position;" // needs qualifier fixed later - "highp float gl_PointSize;" // needs qualifier fixed later - ); - else - stageBuiltins[EShLangVertex].append( - "out gl_PerVertex {" - "highp vec4 gl_Position;" // needs qualifier fixed later - "highp float gl_PointSize;" // needs qualifier fixed later - "};" - ); - } - } - - if ((profile != EEsProfile && version >= 140) || - (profile == EEsProfile && version >= 310)) { - stageBuiltins[EShLangVertex].append( - "in highp int gl_DeviceIndex;" // GL_EXT_device_group - "in highp int gl_ViewIndex;" // GL_EXT_multiview - "\n"); - } - - if (version >= 300 /* both ES and non-ES */) { - stageBuiltins[EShLangVertex].append( - "in highp uint gl_ViewID_OVR;" // GL_OVR_multiview, GL_OVR_multiview2 - "\n"); - } - - - //============================================================================ - // - // Define the interface to the geometry shader. - // - //============================================================================ - - if (profile == ECoreProfile || profile == ECompatibilityProfile) { - stageBuiltins[EShLangGeometry].append( - "in gl_PerVertex {" - "vec4 gl_Position;" - "float gl_PointSize;" - "float gl_ClipDistance[];" - ); - if (profile == ECompatibilityProfile) - stageBuiltins[EShLangGeometry].append( - "vec4 gl_ClipVertex;" - "vec4 gl_FrontColor;" - "vec4 gl_BackColor;" - "vec4 gl_FrontSecondaryColor;" - "vec4 gl_BackSecondaryColor;" - "vec4 gl_TexCoord[];" - "float gl_FogFragCoord;" - ); - if (version >= 450) - stageBuiltins[EShLangGeometry].append( - "float gl_CullDistance[];" -#ifdef NV_EXTENSIONS - "vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering - "vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes -#endif - ); - stageBuiltins[EShLangGeometry].append( - "} gl_in[];" - - "in int gl_PrimitiveIDIn;" - "out gl_PerVertex {" - "vec4 gl_Position;" - "float gl_PointSize;" - "float gl_ClipDistance[];" - "\n"); - if (profile == ECompatibilityProfile && version >= 400) - stageBuiltins[EShLangGeometry].append( - "vec4 gl_ClipVertex;" - "vec4 gl_FrontColor;" - "vec4 gl_BackColor;" - "vec4 gl_FrontSecondaryColor;" - "vec4 gl_BackSecondaryColor;" - "vec4 gl_TexCoord[];" - "float gl_FogFragCoord;" - ); - if (version >= 450) - stageBuiltins[EShLangGeometry].append( - "float gl_CullDistance[];" - ); - stageBuiltins[EShLangGeometry].append( - "};" - - "out int gl_PrimitiveID;" - "out int gl_Layer;"); - - if (version >= 150) - stageBuiltins[EShLangGeometry].append( - "out int gl_ViewportIndex;" - ); - - if (profile == ECompatibilityProfile && version < 400) - stageBuiltins[EShLangGeometry].append( - "out vec4 gl_ClipVertex;" - ); - - if (version >= 400) - stageBuiltins[EShLangGeometry].append( - "in int gl_InvocationID;" - ); - -#ifdef NV_EXTENSIONS - if (version >= 450) - stageBuiltins[EShLangGeometry].append( - "out int gl_ViewportMask[];" // GL_NV_viewport_array2 - "out int gl_SecondaryViewportMaskNV[];" // GL_NV_stereo_view_rendering - "out vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering - "out vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes - "out int gl_ViewportMaskPerViewNV[];" // GL_NVX_multiview_per_view_attributes - ); -#endif - - stageBuiltins[EShLangGeometry].append("\n"); - } else if (profile == EEsProfile && version >= 310) { - stageBuiltins[EShLangGeometry].append( - "in gl_PerVertex {" - "highp vec4 gl_Position;" - "highp float gl_PointSize;" - "} gl_in[];" - "\n" - "in highp int gl_PrimitiveIDIn;" - "in highp int gl_InvocationID;" - "\n" - "out gl_PerVertex {" - "highp vec4 gl_Position;" - "highp float gl_PointSize;" - "};" - "\n" - "out highp int gl_PrimitiveID;" - "out highp int gl_Layer;" - "\n" - ); - } - - if ((profile != EEsProfile && version >= 140) || - (profile == EEsProfile && version >= 310)) { - stageBuiltins[EShLangGeometry].append( - "in highp int gl_DeviceIndex;" // GL_EXT_device_group - "in highp int gl_ViewIndex;" // GL_EXT_multiview - "\n"); - } - - //============================================================================ - // - // Define the interface to the tessellation control shader. - // - //============================================================================ - - if (profile != EEsProfile && version >= 150) { - // Note: "in gl_PerVertex {...} gl_in[gl_MaxPatchVertices];" is declared in initialize() below, - // as it depends on the resource sizing of gl_MaxPatchVertices. - - stageBuiltins[EShLangTessControl].append( - "in int gl_PatchVerticesIn;" - "in int gl_PrimitiveID;" - "in int gl_InvocationID;" - - "out gl_PerVertex {" - "vec4 gl_Position;" - "float gl_PointSize;" - "float gl_ClipDistance[];" - ); - if (profile == ECompatibilityProfile) - stageBuiltins[EShLangTessControl].append( - "vec4 gl_ClipVertex;" - "vec4 gl_FrontColor;" - "vec4 gl_BackColor;" - "vec4 gl_FrontSecondaryColor;" - "vec4 gl_BackSecondaryColor;" - "vec4 gl_TexCoord[];" - "float gl_FogFragCoord;" - ); - if (version >= 450) - stageBuiltins[EShLangTessControl].append( - "float gl_CullDistance[];" -#ifdef NV_EXTENSIONS - "int gl_ViewportMask[];" // GL_NV_viewport_array2 - "vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering - "int gl_SecondaryViewportMaskNV[];" // GL_NV_stereo_view_rendering - "vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes - "int gl_ViewportMaskPerViewNV[];" // GL_NVX_multiview_per_view_attributes -#endif - ); - stageBuiltins[EShLangTessControl].append( - "} gl_out[];" - - "patch out float gl_TessLevelOuter[4];" - "patch out float gl_TessLevelInner[2];" - "\n"); - - if (version >= 410) - stageBuiltins[EShLangTessControl].append( - "out int gl_ViewportIndex;" - "out int gl_Layer;" - "\n"); - - } else { - // Note: "in gl_PerVertex {...} gl_in[gl_MaxPatchVertices];" is declared in initialize() below, - // as it depends on the resource sizing of gl_MaxPatchVertices. - - stageBuiltins[EShLangTessControl].append( - "in highp int gl_PatchVerticesIn;" - "in highp int gl_PrimitiveID;" - "in highp int gl_InvocationID;" - - "out gl_PerVertex {" - "highp vec4 gl_Position;" - "highp float gl_PointSize;" - ); - stageBuiltins[EShLangTessControl].append( - "} gl_out[];" - - "patch out highp float gl_TessLevelOuter[4];" - "patch out highp float gl_TessLevelInner[2];" - "patch out highp vec4 gl_BoundingBoxOES[2];" - "\n"); - } - - if ((profile != EEsProfile && version >= 140) || - (profile == EEsProfile && version >= 310)) { - stageBuiltins[EShLangTessControl].append( - "in highp int gl_DeviceIndex;" // GL_EXT_device_group - "in highp int gl_ViewIndex;" // GL_EXT_multiview - "\n"); - } - - //============================================================================ - // - // Define the interface to the tessellation evaluation shader. - // - //============================================================================ - - if (profile != EEsProfile && version >= 150) { - // Note: "in gl_PerVertex {...} gl_in[gl_MaxPatchVertices];" is declared in initialize() below, - // as it depends on the resource sizing of gl_MaxPatchVertices. - - stageBuiltins[EShLangTessEvaluation].append( - "in int gl_PatchVerticesIn;" - "in int gl_PrimitiveID;" - "in vec3 gl_TessCoord;" - - "patch in float gl_TessLevelOuter[4];" - "patch in float gl_TessLevelInner[2];" - - "out gl_PerVertex {" - "vec4 gl_Position;" - "float gl_PointSize;" - "float gl_ClipDistance[];" - ); - if (version >= 400 && profile == ECompatibilityProfile) - stageBuiltins[EShLangTessEvaluation].append( - "vec4 gl_ClipVertex;" - "vec4 gl_FrontColor;" - "vec4 gl_BackColor;" - "vec4 gl_FrontSecondaryColor;" - "vec4 gl_BackSecondaryColor;" - "vec4 gl_TexCoord[];" - "float gl_FogFragCoord;" - ); - if (version >= 450) - stageBuiltins[EShLangTessEvaluation].append( - "float gl_CullDistance[];" - ); - stageBuiltins[EShLangTessEvaluation].append( - "};" - "\n"); - - if (version >= 410) - stageBuiltins[EShLangTessEvaluation].append( - "out int gl_ViewportIndex;" - "out int gl_Layer;" - "\n"); - -#ifdef NV_EXTENSIONS - if (version >= 450) - stageBuiltins[EShLangTessEvaluation].append( - "out int gl_ViewportMask[];" // GL_NV_viewport_array2 - "out vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering - "out int gl_SecondaryViewportMaskNV[];" // GL_NV_stereo_view_rendering - "out vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes - "out int gl_ViewportMaskPerViewNV[];" // GL_NVX_multiview_per_view_attributes - ); -#endif - - } else if (profile == EEsProfile && version >= 310) { - // Note: "in gl_PerVertex {...} gl_in[gl_MaxPatchVertices];" is declared in initialize() below, - // as it depends on the resource sizing of gl_MaxPatchVertices. - - stageBuiltins[EShLangTessEvaluation].append( - "in highp int gl_PatchVerticesIn;" - "in highp int gl_PrimitiveID;" - "in highp vec3 gl_TessCoord;" - - "patch in highp float gl_TessLevelOuter[4];" - "patch in highp float gl_TessLevelInner[2];" - - "out gl_PerVertex {" - "highp vec4 gl_Position;" - "highp float gl_PointSize;" - ); - stageBuiltins[EShLangTessEvaluation].append( - "};" - "\n"); - } - - if ((profile != EEsProfile && version >= 140) || - (profile == EEsProfile && version >= 310)) { - stageBuiltins[EShLangTessEvaluation].append( - "in highp int gl_DeviceIndex;" // GL_EXT_device_group - "in highp int gl_ViewIndex;" // GL_EXT_multiview - "\n"); - } - - //============================================================================ - // - // Define the interface to the fragment shader. - // - //============================================================================ - - if (profile != EEsProfile) { - - stageBuiltins[EShLangFragment].append( - "vec4 gl_FragCoord;" // needs qualifier fixed later - "bool gl_FrontFacing;" // needs qualifier fixed later - "float gl_FragDepth;" // needs qualifier fixed later - ); - if (version >= 120) - stageBuiltins[EShLangFragment].append( - "vec2 gl_PointCoord;" // needs qualifier fixed later - ); - if (version >= 140) - stageBuiltins[EShLangFragment].append( - "out int gl_FragStencilRefARB;" - ); - if (IncludeLegacy(version, profile, spvVersion) || (! ForwardCompatibility && version < 420)) - stageBuiltins[EShLangFragment].append( - "vec4 gl_FragColor;" // needs qualifier fixed later - ); - - if (version < 130) { - stageBuiltins[EShLangFragment].append( - "varying vec4 gl_Color;" - "varying vec4 gl_SecondaryColor;" - "varying vec4 gl_TexCoord[];" - "varying float gl_FogFragCoord;" - ); - } else { - stageBuiltins[EShLangFragment].append( - "in float gl_ClipDistance[];" - ); - - if (IncludeLegacy(version, profile, spvVersion)) { - if (version < 150) - stageBuiltins[EShLangFragment].append( - "in float gl_FogFragCoord;" - "in vec4 gl_TexCoord[];" - "in vec4 gl_Color;" - "in vec4 gl_SecondaryColor;" - ); - else - stageBuiltins[EShLangFragment].append( - "in gl_PerFragment {" - "in float gl_FogFragCoord;" - "in vec4 gl_TexCoord[];" - "in vec4 gl_Color;" - "in vec4 gl_SecondaryColor;" - "};" - ); - } - } - - if (version >= 150) - stageBuiltins[EShLangFragment].append( - "flat in int gl_PrimitiveID;" - ); - - if (version >= 400) { - stageBuiltins[EShLangFragment].append( - "flat in int gl_SampleID;" - " in vec2 gl_SamplePosition;" - "flat in int gl_SampleMaskIn[];" - " out int gl_SampleMask[];" - ); - if (spvVersion.spv == 0) - stageBuiltins[EShLangFragment].append( - "uniform int gl_NumSamples;" - ); - } - - if (version >= 430) - stageBuiltins[EShLangFragment].append( - "flat in int gl_Layer;" - "flat in int gl_ViewportIndex;" - ); - - if (version >= 450) - stageBuiltins[EShLangFragment].append( - "in float gl_CullDistance[];" - "bool gl_HelperInvocation;" // needs qualifier fixed later - ); - -#ifdef AMD_EXTENSIONS - if (version >= 450) - stageBuiltins[EShLangFragment].append( - "in vec2 gl_BaryCoordNoPerspAMD;" - "in vec2 gl_BaryCoordNoPerspCentroidAMD;" - "in vec2 gl_BaryCoordNoPerspSampleAMD;" - "in vec2 gl_BaryCoordSmoothAMD;" - "in vec2 gl_BaryCoordSmoothCentroidAMD;" - "in vec2 gl_BaryCoordSmoothSampleAMD;" - "in vec3 gl_BaryCoordPullModelAMD;" - ); -#endif - -#ifdef NV_EXTENSIONS - if (version >= 430) - stageBuiltins[EShLangFragment].append( - "in bool gl_FragFullyCoveredNV;" - ); -#endif - } else { - // ES profile - - if (version == 100) { - stageBuiltins[EShLangFragment].append( - "mediump vec4 gl_FragCoord;" // needs qualifier fixed later - " bool gl_FrontFacing;" // needs qualifier fixed later - "mediump vec4 gl_FragColor;" // needs qualifier fixed later - "mediump vec2 gl_PointCoord;" // needs qualifier fixed later - ); - } - if (version >= 300) { - stageBuiltins[EShLangFragment].append( - "highp vec4 gl_FragCoord;" // needs qualifier fixed later - " bool gl_FrontFacing;" // needs qualifier fixed later - "mediump vec2 gl_PointCoord;" // needs qualifier fixed later - "highp float gl_FragDepth;" // needs qualifier fixed later - ); - } - if (version >= 310) { - stageBuiltins[EShLangFragment].append( - "bool gl_HelperInvocation;" // needs qualifier fixed later - "flat in highp int gl_PrimitiveID;" // needs qualifier fixed later - "flat in highp int gl_Layer;" // needs qualifier fixed later - ); - - stageBuiltins[EShLangFragment].append( // GL_OES_sample_variables - "flat in lowp int gl_SampleID;" - " in mediump vec2 gl_SamplePosition;" - "flat in highp int gl_SampleMaskIn[];" - " out highp int gl_SampleMask[];" - ); - if (spvVersion.spv == 0) - stageBuiltins[EShLangFragment].append( // GL_OES_sample_variables - "uniform lowp int gl_NumSamples;" - ); - } - stageBuiltins[EShLangFragment].append( - "highp float gl_FragDepthEXT;" // GL_EXT_frag_depth - ); - } - stageBuiltins[EShLangFragment].append("\n"); - - if (version >= 130) - add2ndGenerationSamplingImaging(version, profile, spvVersion); - - // GL_ARB_shader_ballot - if (profile != EEsProfile && version >= 450) { - commonBuiltins.append( - "uniform uint gl_SubGroupSizeARB;" - - "in uint gl_SubGroupInvocationARB;" - "in uint64_t gl_SubGroupEqMaskARB;" - "in uint64_t gl_SubGroupGeMaskARB;" - "in uint64_t gl_SubGroupGtMaskARB;" - "in uint64_t gl_SubGroupLeMaskARB;" - "in uint64_t gl_SubGroupLtMaskARB;" - - "\n"); - } - - if ((profile != EEsProfile && version >= 140) || - (profile == EEsProfile && version >= 310)) { - stageBuiltins[EShLangFragment].append( - "flat in highp int gl_DeviceIndex;" // GL_EXT_device_group - "flat in highp int gl_ViewIndex;" // GL_EXT_multiview - "\n"); - } - - if (version >= 300 /* both ES and non-ES */) { - stageBuiltins[EShLangFragment].append( - "flat in highp uint gl_ViewID_OVR;" // GL_OVR_multiview, GL_OVR_multiview2 - "\n"); - } - - // printf("%s\n", commonBuiltins.c_str()); - // printf("%s\n", stageBuiltins[EShLangFragment].c_str()); -} - -// -// Helper function for initialize(), to add the second set of names for texturing, -// when adding context-independent built-in functions. -// -void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, const SpvVersion& spvVersion) -{ - // - // In this function proper, enumerate the types, then calls the next set of functions - // to enumerate all the uses for that type. - // - - TBasicType bTypes[3] = { EbtFloat, EbtInt, EbtUint }; - bool skipBuffer = (profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 140); - bool skipCubeArrayed = (profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 130); - - // enumerate all the types - for (int image = 0; image <= 1; ++image) { // loop over "bool" image vs sampler - - for (int shadow = 0; shadow <= 1; ++shadow) { // loop over "bool" shadow or not - for (int ms = 0; ms <=1; ++ms) { - if ((ms || image) && shadow) - continue; - if (ms && profile != EEsProfile && version < 150) - continue; - if (ms && image && profile == EEsProfile) - continue; - if (ms && profile == EEsProfile && version < 310) - continue; - - for (int arrayed = 0; arrayed <= 1; ++arrayed) { // loop over "bool" arrayed or not - for (int dim = Esd1D; dim < EsdNumDims; ++dim) { // 1D, 2D, ..., buffer - if (dim == EsdSubpass && spvVersion.vulkan == 0) - continue; - if (dim == EsdSubpass && (image || shadow || arrayed)) - continue; - if ((dim == Esd1D || dim == EsdRect) && profile == EEsProfile) - continue; - if (dim != Esd2D && dim != EsdSubpass && ms) - continue; - if ((dim == Esd3D || dim == EsdRect) && arrayed) - continue; - if (dim == Esd3D && shadow) - continue; - if (dim == EsdCube && arrayed && skipCubeArrayed) - continue; - if (dim == EsdBuffer && skipBuffer) - continue; - if (dim == EsdBuffer && (shadow || arrayed || ms)) - continue; - if (ms && arrayed && profile == EEsProfile && version < 310) - continue; - - for (int bType = 0; bType < 3; ++bType) { // float, int, uint results - - if (shadow && bType > 0) - continue; - - if (dim == EsdRect && version < 140 && bType > 0) - continue; - - // - // Now, make all the function prototypes for the type we just built... - // - - TSampler sampler; - if (dim == EsdSubpass) { - sampler.setSubpass(bTypes[bType], ms ? true : false); - } else if (image) { - sampler.setImage(bTypes[bType], (TSamplerDim)dim, arrayed ? true : false, - shadow ? true : false, - ms ? true : false); - } else { - sampler.set(bTypes[bType], (TSamplerDim)dim, arrayed ? true : false, - shadow ? true : false, - ms ? true : false); - } - - TString typeName = sampler.getString(); - - if (dim == EsdSubpass) { - addSubpassSampling(sampler, typeName, version, profile); - continue; - } - - addQueryFunctions(sampler, typeName, version, profile); - - if (image) - addImageFunctions(sampler, typeName, version, profile); - else { - addSamplingFunctions(sampler, typeName, version, profile); - addGatherFunctions(sampler, typeName, version, profile); - - if (spvVersion.vulkan > 0 && sampler.dim == EsdBuffer && sampler.isCombined()) { - // Vulkan wants a textureBuffer to allow texelFetch() -- - // a sampled image with no sampler. - // So, add sampling functions for both the - // samplerBuffer and textureBuffer types. - sampler.setTexture(sampler.type, sampler.dim, sampler.arrayed, sampler.shadow, - sampler.ms); - TString textureTypeName = sampler.getString(); - addSamplingFunctions(sampler, textureTypeName, version, profile); - } - } - } - } - } - } - } - } - - // - // sparseTexelsResidentARB() - // - - if (profile != EEsProfile && version >= 450) { - commonBuiltins.append("bool sparseTexelsResidentARB(int code);\n"); - } -} - -// -// Helper function for add2ndGenerationSamplingImaging(), -// when adding context-independent built-in functions. -// -// Add all the query functions for the given type. -// -void TBuiltIns::addQueryFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile) -{ - if (sampler.image && ((profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 430))) - return; - - // - // textureSize() and imageSize() - // - - int sizeDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0) - (sampler.dim == EsdCube ? 1 : 0); - if (profile == EEsProfile) - commonBuiltins.append("highp "); - if (sizeDims == 1) - commonBuiltins.append("int"); - else { - commonBuiltins.append("ivec"); - commonBuiltins.append(postfixes[sizeDims]); - } - if (sampler.image) - commonBuiltins.append(" imageSize(readonly writeonly volatile coherent "); - else - commonBuiltins.append(" textureSize("); - commonBuiltins.append(typeName); - if (! sampler.image && sampler.dim != EsdRect && sampler.dim != EsdBuffer && ! sampler.ms) - commonBuiltins.append(",int);\n"); - else - commonBuiltins.append(");\n"); - - // - // textureSamples() and imageSamples() - // - - // GL_ARB_shader_texture_image_samples - // TODO: spec issue? there are no memory qualifiers; how to query a writeonly/readonly image, etc? - if (profile != EEsProfile && version >= 430 && sampler.ms) { - commonBuiltins.append("int "); - if (sampler.image) - commonBuiltins.append("imageSamples(readonly writeonly volatile coherent "); - else - commonBuiltins.append("textureSamples("); - commonBuiltins.append(typeName); - commonBuiltins.append(");\n"); - } - - // - // textureQueryLod(), fragment stage only - // - - if (profile != EEsProfile && version >= 400 && ! sampler.image && sampler.dim != EsdRect && ! sampler.ms && sampler.dim != EsdBuffer) { - stageBuiltins[EShLangFragment].append("vec2 textureQueryLod("); - stageBuiltins[EShLangFragment].append(typeName); - if (dimMap[sampler.dim] == 1) - stageBuiltins[EShLangFragment].append(", float"); - else { - stageBuiltins[EShLangFragment].append(", vec"); - stageBuiltins[EShLangFragment].append(postfixes[dimMap[sampler.dim]]); - } - stageBuiltins[EShLangFragment].append(");\n"); - } - - // - // textureQueryLevels() - // - - if (profile != EEsProfile && version >= 430 && ! sampler.image && sampler.dim != EsdRect && ! sampler.ms && sampler.dim != EsdBuffer) { - commonBuiltins.append("int textureQueryLevels("); - commonBuiltins.append(typeName); - commonBuiltins.append(");\n"); - } -} - -// -// Helper function for add2ndGenerationSamplingImaging(), -// when adding context-independent built-in functions. -// -// Add all the image access functions for the given type. -// -void TBuiltIns::addImageFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile) -{ - int dims = dimMap[sampler.dim]; - // most things with an array add a dimension, except for cubemaps - if (sampler.arrayed && sampler.dim != EsdCube) - ++dims; - - TString imageParams = typeName; - if (dims == 1) - imageParams.append(", int"); - else { - imageParams.append(", ivec"); - imageParams.append(postfixes[dims]); - } - if (sampler.ms) - imageParams.append(", int"); - - if (profile == EEsProfile) - commonBuiltins.append("highp "); - commonBuiltins.append(prefixes[sampler.type]); - commonBuiltins.append("vec4 imageLoad(readonly volatile coherent "); - commonBuiltins.append(imageParams); - commonBuiltins.append(");\n"); - - commonBuiltins.append("void imageStore(writeonly volatile coherent "); - commonBuiltins.append(imageParams); - commonBuiltins.append(", "); - commonBuiltins.append(prefixes[sampler.type]); - commonBuiltins.append("vec4);\n"); - - if (sampler.dim != Esd1D && sampler.dim != EsdBuffer && profile != EEsProfile && version >= 450) { - commonBuiltins.append("int sparseImageLoadARB(readonly volatile coherent "); - commonBuiltins.append(imageParams); - commonBuiltins.append(", out "); - commonBuiltins.append(prefixes[sampler.type]); - commonBuiltins.append("vec4"); - commonBuiltins.append(");\n"); - } - - if ( profile != EEsProfile || - (profile == EEsProfile && version >= 310)) { - if (sampler.type == EbtInt || sampler.type == EbtUint) { - const char* dataType = sampler.type == EbtInt ? "highp int" : "highp uint"; - - const int numBuiltins = 7; - - static const char* atomicFunc[numBuiltins] = { - " imageAtomicAdd(volatile coherent ", - " imageAtomicMin(volatile coherent ", - " imageAtomicMax(volatile coherent ", - " imageAtomicAnd(volatile coherent ", - " imageAtomicOr(volatile coherent ", - " imageAtomicXor(volatile coherent ", - " imageAtomicExchange(volatile coherent " - }; - - for (size_t i = 0; i < numBuiltins; ++i) { - commonBuiltins.append(dataType); - commonBuiltins.append(atomicFunc[i]); - commonBuiltins.append(imageParams); - commonBuiltins.append(", "); - commonBuiltins.append(dataType); - commonBuiltins.append(");\n"); - } - - commonBuiltins.append(dataType); - commonBuiltins.append(" imageAtomicCompSwap(volatile coherent "); - commonBuiltins.append(imageParams); - commonBuiltins.append(", "); - commonBuiltins.append(dataType); - commonBuiltins.append(", "); - commonBuiltins.append(dataType); - commonBuiltins.append(");\n"); - } else { - // not int or uint - // GL_ARB_ES3_1_compatibility - // TODO: spec issue: are there restrictions on the kind of layout() that can be used? what about dropping memory qualifiers? - if ((profile != EEsProfile && version >= 450) || - (profile == EEsProfile && version >= 310)) { - commonBuiltins.append("float imageAtomicExchange(volatile coherent "); - commonBuiltins.append(imageParams); - commonBuiltins.append(", float);\n"); - } - } - } - -#ifdef AMD_EXTENSIONS - if (sampler.dim == EsdRect || sampler.dim == EsdBuffer || sampler.shadow || sampler.ms) - return; - - if (profile == EEsProfile || version < 450) - return; - - TString imageLodParams = typeName; - if (dims == 1) - imageLodParams.append(", int"); - else { - imageLodParams.append(", ivec"); - imageLodParams.append(postfixes[dims]); - } - imageLodParams.append(", int"); - - commonBuiltins.append(prefixes[sampler.type]); - commonBuiltins.append("vec4 imageLoadLodAMD(readonly volatile coherent "); - commonBuiltins.append(imageLodParams); - commonBuiltins.append(");\n"); - - commonBuiltins.append("void imageStoreLodAMD(writeonly volatile coherent "); - commonBuiltins.append(imageLodParams); - commonBuiltins.append(", "); - commonBuiltins.append(prefixes[sampler.type]); - commonBuiltins.append("vec4);\n"); - - if (sampler.dim != Esd1D) { - commonBuiltins.append("int sparseImageLoadLodAMD(readonly volatile coherent "); - commonBuiltins.append(imageLodParams); - commonBuiltins.append(", out "); - commonBuiltins.append(prefixes[sampler.type]); - commonBuiltins.append("vec4"); - commonBuiltins.append(");\n"); - } -#endif -} - -// -// Helper function for initialize(), -// when adding context-independent built-in functions. -// -// Add all the subpass access functions for the given type. -// -void TBuiltIns::addSubpassSampling(TSampler sampler, const TString& typeName, int /*version*/, EProfile /*profile*/) -{ - stageBuiltins[EShLangFragment].append(prefixes[sampler.type]); - stageBuiltins[EShLangFragment].append("vec4 subpassLoad"); - stageBuiltins[EShLangFragment].append("("); - stageBuiltins[EShLangFragment].append(typeName.c_str()); - if (sampler.ms) - stageBuiltins[EShLangFragment].append(", int"); - stageBuiltins[EShLangFragment].append(");\n"); -} - -// -// Helper function for add2ndGenerationSamplingImaging(), -// when adding context-independent built-in functions. -// -// Add all the texture lookup functions for the given type. -// -void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile) -{ - // - // texturing - // - for (int proj = 0; proj <= 1; ++proj) { // loop over "bool" projective or not - - if (proj && (sampler.dim == EsdCube || sampler.dim == EsdBuffer || sampler.arrayed || sampler.ms)) - continue; - - for (int lod = 0; lod <= 1; ++lod) { - - if (lod && (sampler.dim == EsdBuffer || sampler.dim == EsdRect || sampler.ms)) - continue; - if (lod && sampler.dim == Esd2D && sampler.arrayed && sampler.shadow) - continue; - if (lod && sampler.dim == EsdCube && sampler.shadow) - continue; - - for (int bias = 0; bias <= 1; ++bias) { - - if (bias && (lod || sampler.ms)) - continue; - if (bias && sampler.dim == Esd2D && sampler.shadow && sampler.arrayed) - continue; - if (bias && (sampler.dim == EsdRect || sampler.dim == EsdBuffer)) - continue; - - for (int offset = 0; offset <= 1; ++offset) { // loop over "bool" offset or not - - if (proj + offset + bias + lod > 3) - continue; - if (offset && (sampler.dim == EsdCube || sampler.dim == EsdBuffer || sampler.ms)) - continue; - - for (int fetch = 0; fetch <= 1; ++fetch) { // loop over "bool" fetch or not - - if (proj + offset + fetch + bias + lod > 3) - continue; - if (fetch && (lod || bias)) - continue; - if (fetch && (sampler.shadow || sampler.dim == EsdCube)) - continue; - if (fetch == 0 && (sampler.ms || sampler.dim == EsdBuffer)) - continue; - - for (int grad = 0; grad <= 1; ++grad) { // loop over "bool" grad or not - - if (grad && (lod || bias || sampler.ms)) - continue; - if (grad && sampler.dim == EsdBuffer) - continue; - if (proj + offset + fetch + grad + bias + lod > 3) - continue; - - for (int extraProj = 0; extraProj <= 1; ++extraProj) { - bool compare = false; - int totalDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0); - // skip dummy unused second component for 1D non-array shadows - if (sampler.shadow && totalDims < 2) - totalDims = 2; - totalDims += (sampler.shadow ? 1 : 0) + proj; - if (totalDims > 4 && sampler.shadow) { - compare = true; - totalDims = 4; - } - assert(totalDims <= 4); - - if (extraProj && ! proj) - continue; - if (extraProj && (sampler.dim == Esd3D || sampler.shadow)) - continue; - - for (int lodClamp = 0; lodClamp <= 1 ;++lodClamp) { // loop over "bool" lod clamp - - if (lodClamp && (profile == EEsProfile || version < 450)) - continue; - if (lodClamp && (proj || lod || fetch)) - continue; - - for (int sparse = 0; sparse <= 1; ++sparse) { // loop over "bool" sparse or not - - if (sparse && (profile == EEsProfile || version < 450)) - continue; - // Sparse sampling is not for 1D/1D array texture, buffer texture, and projective texture - if (sparse && (sampler.dim == Esd1D || sampler.dim == EsdBuffer || proj)) - continue; - - TString s; - - // return type - if (sparse) - s.append("int "); - else { - if (sampler.shadow) - s.append("float "); - else { - s.append(prefixes[sampler.type]); - s.append("vec4 "); - } - } - - // name - if (sparse) { - if (fetch) - s.append("sparseTexel"); - else - s.append("sparseTexture"); - } else { - if (fetch) - s.append("texel"); - else - s.append("texture"); - } - if (proj) - s.append("Proj"); - if (lod) - s.append("Lod"); - if (grad) - s.append("Grad"); - if (fetch) - s.append("Fetch"); - if (offset) - s.append("Offset"); - if (lodClamp) - s.append("Clamp"); - if (lodClamp || sparse) - s.append("ARB"); - s.append("("); - - // sampler type - s.append(typeName); - - // P coordinate - if (extraProj) - s.append(",vec4"); - else { - s.append(","); - TBasicType t = fetch ? EbtInt : EbtFloat; - if (totalDims == 1) - s.append(TType::getBasicString(t)); - else { - s.append(prefixes[t]); - s.append("vec"); - s.append(postfixes[totalDims]); - } - } - - if (bias && compare) - continue; - - // non-optional lod argument (lod that's not driven by lod loop) or sample - if ((fetch && sampler.dim != EsdBuffer && sampler.dim != EsdRect && !sampler.ms) || - (sampler.ms && fetch)) - s.append(",int"); - - // non-optional lod - if (lod) - s.append(",float"); - - // gradient arguments - if (grad) { - if (dimMap[sampler.dim] == 1) - s.append(",float,float"); - else { - s.append(",vec"); - s.append(postfixes[dimMap[sampler.dim]]); - s.append(",vec"); - s.append(postfixes[dimMap[sampler.dim]]); - } - } - - // offset - if (offset) { - if (dimMap[sampler.dim] == 1) - s.append(",int"); - else { - s.append(",ivec"); - s.append(postfixes[dimMap[sampler.dim]]); - } - } - - // non-optional compare - if (compare) - s.append(",float"); - - // lod clamp - if (lodClamp) - s.append(",float"); - - // texel out (for sparse texture) - if (sparse) { - s.append(",out "); - if (sampler.shadow) - s.append("float "); - else { - s.append(prefixes[sampler.type]); - s.append("vec4 "); - } - } - - // optional bias - if (bias) - s.append(",float"); - - s.append(");\n"); - - // Add to the per-language set of built-ins - - if (bias || lodClamp) - stageBuiltins[EShLangFragment].append(s); - else - commonBuiltins.append(s); - } - } - } - } - } - } - } - } - } -} - -// -// Helper function for add2ndGenerationSamplingImaging(), -// when adding context-independent built-in functions. -// -// Add all the texture gather functions for the given type. -// -void TBuiltIns::addGatherFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile) -{ - switch (sampler.dim) { - case Esd2D: - case EsdRect: - case EsdCube: - break; - default: - return; - } - - if (sampler.ms) - return; - - if (version < 140 && sampler.dim == EsdRect && sampler.type != EbtFloat) - return; - - for (int offset = 0; offset < 3; ++offset) { // loop over three forms of offset in the call name: none, Offset, and Offsets - - for (int comp = 0; comp < 2; ++comp) { // loop over presence of comp argument - - if (comp > 0 && sampler.shadow) - continue; - - if (offset > 0 && sampler.dim == EsdCube) - continue; - - for (int sparse = 0; sparse <= 1; ++sparse) { // loop over "bool" sparse or not - if (sparse && (profile == EEsProfile || version < 450)) - continue; - - TString s; - - // return type - if (sparse) - s.append("int "); - else { - s.append(prefixes[sampler.type]); - s.append("vec4 "); - } - - // name - if (sparse) - s.append("sparseTextureGather"); - else - s.append("textureGather"); - switch (offset) { - case 1: - s.append("Offset"); - break; - case 2: - s.append("Offsets"); - default: - break; - } - - if (sparse) - s.append("ARB"); - s.append("("); - - // sampler type argument - s.append(typeName); - - // P coordinate argument - s.append(",vec"); - int totalDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0); - s.append(postfixes[totalDims]); - - // refZ argument - if (sampler.shadow) - s.append(",float"); - - // offset argument - if (offset > 0) { - s.append(",ivec2"); - if (offset == 2) - s.append("[4]"); - } - - // texel out (for sparse texture) - if (sparse) { - s.append(",out "); - s.append(prefixes[sampler.type]); - s.append("vec4 "); - } - - // comp argument - if (comp) - s.append(",int"); - - s.append(");\n"); - commonBuiltins.append(s); - } - } - } - -#ifdef AMD_EXTENSIONS - if (sampler.dim == EsdRect || sampler.shadow) - return; - - if (profile == EEsProfile || version < 450) - return; - - for (int bias = 0; bias < 2; ++bias) { // loop over presence of bias argument - - for (int lod = 0; lod < 2; ++lod) { // loop over presence of lod argument - - if ((lod && bias) || (lod == 0 && bias == 0)) - continue; - - for (int offset = 0; offset < 3; ++offset) { // loop over three forms of offset in the call name: none, Offset, and Offsets - - for (int comp = 0; comp < 2; ++comp) { // loop over presence of comp argument - - if (comp == 0 && bias) - continue; - - if (offset > 0 && sampler.dim == EsdCube) - continue; - - for (int sparse = 0; sparse <= 1; ++sparse) { // loop over "bool" sparse or not - if (sparse && (profile == EEsProfile || version < 450)) - continue; - - TString s; - - // return type - if (sparse) - s.append("int "); - else { - s.append(prefixes[sampler.type]); - s.append("vec4 "); - } - - // name - if (sparse) - s.append("sparseTextureGather"); - else - s.append("textureGather"); - - if (lod) - s.append("Lod"); - - switch (offset) { - case 1: - s.append("Offset"); - break; - case 2: - s.append("Offsets"); - default: - break; - } - - if (lod) - s.append("AMD"); - else if (sparse) - s.append("ARB"); - - s.append("("); - - // sampler type argument - s.append(typeName); - - // P coordinate argument - s.append(",vec"); - int totalDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0); - s.append(postfixes[totalDims]); - - // lod argument - if (lod) - s.append(",float"); - - // offset argument - if (offset > 0) { - s.append(",ivec2"); - if (offset == 2) - s.append("[4]"); - } - - // texel out (for sparse texture) - if (sparse) { - s.append(",out "); - s.append(prefixes[sampler.type]); - s.append("vec4 "); - } - - // comp argument - if (comp) - s.append(",int"); - - // bias argument - if (bias) - s.append(",float"); - - s.append(");\n"); - if (bias) - stageBuiltins[EShLangFragment].append(s); - else - commonBuiltins.append(s); - } - } - } - } - } -#endif -} - -// -// Add context-dependent built-in functions and variables that are present -// for the given version and profile. All the results are put into just the -// commonBuiltins, because it is called for just a specific stage. So, -// add stage-specific entries to the commonBuiltins, and only if that stage -// was requested. -// -void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language) -{ - // - // Initialize the context-dependent (resource-dependent) built-in strings for parsing. - // - - //============================================================================ - // - // Standard Uniforms - // - //============================================================================ - - TString& s = commonBuiltins; - const int maxSize = 80; - char builtInConstant[maxSize]; - - // - // Build string of implementation dependent constants. - // - - if (profile == EEsProfile) { - snprintf(builtInConstant, maxSize, "const mediump int gl_MaxVertexAttribs = %d;", resources.maxVertexAttribs); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const mediump int gl_MaxVertexUniformVectors = %d;", resources.maxVertexUniformVectors); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const mediump int gl_MaxVertexTextureImageUnits = %d;", resources.maxVertexTextureImageUnits); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const mediump int gl_MaxCombinedTextureImageUnits = %d;", resources.maxCombinedTextureImageUnits); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const mediump int gl_MaxTextureImageUnits = %d;", resources.maxTextureImageUnits); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const mediump int gl_MaxFragmentUniformVectors = %d;", resources.maxFragmentUniformVectors); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const mediump int gl_MaxDrawBuffers = %d;", resources.maxDrawBuffers); - s.append(builtInConstant); - - if (version == 100) { - snprintf(builtInConstant, maxSize, "const mediump int gl_MaxVaryingVectors = %d;", resources.maxVaryingVectors); - s.append(builtInConstant); - } else { - snprintf(builtInConstant, maxSize, "const mediump int gl_MaxVertexOutputVectors = %d;", resources.maxVertexOutputVectors); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const mediump int gl_MaxFragmentInputVectors = %d;", resources.maxFragmentInputVectors); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const mediump int gl_MinProgramTexelOffset = %d;", resources.minProgramTexelOffset); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const mediump int gl_MaxProgramTexelOffset = %d;", resources.maxProgramTexelOffset); - s.append(builtInConstant); - } - - if (version >= 310) { - // geometry - - snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryInputComponents = %d;", resources.maxGeometryInputComponents); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryOutputComponents = %d;", resources.maxGeometryOutputComponents); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryImageUniforms = %d;", resources.maxGeometryImageUniforms); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryTextureImageUnits = %d;", resources.maxGeometryTextureImageUnits); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryOutputVertices = %d;", resources.maxGeometryOutputVertices); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryTotalOutputComponents = %d;", resources.maxGeometryTotalOutputComponents); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryUniformComponents = %d;", resources.maxGeometryUniformComponents); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryAtomicCounters = %d;", resources.maxGeometryAtomicCounters); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryAtomicCounterBuffers = %d;", resources.maxGeometryAtomicCounterBuffers); - s.append(builtInConstant); - - // tessellation - - snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlInputComponents = %d;", resources.maxTessControlInputComponents); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlOutputComponents = %d;", resources.maxTessControlOutputComponents); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlTextureImageUnits = %d;", resources.maxTessControlTextureImageUnits); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlUniformComponents = %d;", resources.maxTessControlUniformComponents); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlTotalOutputComponents = %d;", resources.maxTessControlTotalOutputComponents); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationInputComponents = %d;", resources.maxTessEvaluationInputComponents); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationOutputComponents = %d;", resources.maxTessEvaluationOutputComponents); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationTextureImageUnits = %d;", resources.maxTessEvaluationTextureImageUnits); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationUniformComponents = %d;", resources.maxTessEvaluationUniformComponents); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const int gl_MaxTessPatchComponents = %d;", resources.maxTessPatchComponents); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const int gl_MaxPatchVertices = %d;", resources.maxPatchVertices); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxTessGenLevel = %d;", resources.maxTessGenLevel); - s.append(builtInConstant); - - // this is here instead of with the others in initialize(version, profile) due to the dependence on gl_MaxPatchVertices - if (language == EShLangTessControl || language == EShLangTessEvaluation) { - s.append( - "in gl_PerVertex {" - "highp vec4 gl_Position;" - "highp float gl_PointSize;" -#ifdef NV_EXTENSIONS - "highp vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering - "highp vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes -#endif - "} gl_in[gl_MaxPatchVertices];" - "\n"); - } - } - - } else { - // non-ES profile - - snprintf(builtInConstant, maxSize, "const int gl_MaxVertexAttribs = %d;", resources.maxVertexAttribs); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const int gl_MaxVertexTextureImageUnits = %d;", resources.maxVertexTextureImageUnits); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const int gl_MaxCombinedTextureImageUnits = %d;", resources.maxCombinedTextureImageUnits); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const int gl_MaxTextureImageUnits = %d;", resources.maxTextureImageUnits); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const int gl_MaxDrawBuffers = %d;", resources.maxDrawBuffers); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const int gl_MaxLights = %d;", resources.maxLights); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const int gl_MaxClipPlanes = %d;", resources.maxClipPlanes); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const int gl_MaxTextureUnits = %d;", resources.maxTextureUnits); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const int gl_MaxTextureCoords = %d;", resources.maxTextureCoords); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const int gl_MaxVertexUniformComponents = %d;", resources.maxVertexUniformComponents); - s.append(builtInConstant); - - if (version < 150 || ARBCompatibility) { - snprintf(builtInConstant, maxSize, "const int gl_MaxVaryingFloats = %d;", resources.maxVaryingFloats); - s.append(builtInConstant); - } - - snprintf(builtInConstant, maxSize, "const int gl_MaxFragmentUniformComponents = %d;", resources.maxFragmentUniformComponents); - s.append(builtInConstant); - - if (spvVersion.spv == 0 && IncludeLegacy(version, profile, spvVersion)) { - // - // OpenGL'uniform' state. Page numbers are in reference to version - // 1.4 of the OpenGL specification. - // - - // - // Matrix state. p. 31, 32, 37, 39, 40. - // - s.append("uniform mat4 gl_TextureMatrix[gl_MaxTextureCoords];" - - // - // Derived matrix state that provides inverse and transposed versions - // of the matrices above. - // - "uniform mat4 gl_TextureMatrixInverse[gl_MaxTextureCoords];" - - "uniform mat4 gl_TextureMatrixTranspose[gl_MaxTextureCoords];" - - "uniform mat4 gl_TextureMatrixInverseTranspose[gl_MaxTextureCoords];" - - // - // Clip planes p. 42. - // - "uniform vec4 gl_ClipPlane[gl_MaxClipPlanes];" - - // - // Light State p 50, 53, 55. - // - "uniform gl_LightSourceParameters gl_LightSource[gl_MaxLights];" - - // - // Derived state from products of light. - // - "uniform gl_LightProducts gl_FrontLightProduct[gl_MaxLights];" - "uniform gl_LightProducts gl_BackLightProduct[gl_MaxLights];" - - // - // Texture Environment and Generation, p. 152, p. 40-42. - // - "uniform vec4 gl_TextureEnvColor[gl_MaxTextureImageUnits];" - "uniform vec4 gl_EyePlaneS[gl_MaxTextureCoords];" - "uniform vec4 gl_EyePlaneT[gl_MaxTextureCoords];" - "uniform vec4 gl_EyePlaneR[gl_MaxTextureCoords];" - "uniform vec4 gl_EyePlaneQ[gl_MaxTextureCoords];" - "uniform vec4 gl_ObjectPlaneS[gl_MaxTextureCoords];" - "uniform vec4 gl_ObjectPlaneT[gl_MaxTextureCoords];" - "uniform vec4 gl_ObjectPlaneR[gl_MaxTextureCoords];" - "uniform vec4 gl_ObjectPlaneQ[gl_MaxTextureCoords];"); - } - - if (version >= 130) { - snprintf(builtInConstant, maxSize, "const int gl_MaxClipDistances = %d;", resources.maxClipDistances); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxVaryingComponents = %d;", resources.maxVaryingComponents); - s.append(builtInConstant); - - // GL_ARB_shading_language_420pack - snprintf(builtInConstant, maxSize, "const mediump int gl_MinProgramTexelOffset = %d;", resources.minProgramTexelOffset); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const mediump int gl_MaxProgramTexelOffset = %d;", resources.maxProgramTexelOffset); - s.append(builtInConstant); - } - - // geometry - if (version >= 150) { - snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryInputComponents = %d;", resources.maxGeometryInputComponents); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryOutputComponents = %d;", resources.maxGeometryOutputComponents); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryTextureImageUnits = %d;", resources.maxGeometryTextureImageUnits); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryOutputVertices = %d;", resources.maxGeometryOutputVertices); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryTotalOutputComponents = %d;", resources.maxGeometryTotalOutputComponents); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryUniformComponents = %d;", resources.maxGeometryUniformComponents); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryVaryingComponents = %d;", resources.maxGeometryVaryingComponents); - s.append(builtInConstant); - - } - - if (version >= 150) { - snprintf(builtInConstant, maxSize, "const int gl_MaxVertexOutputComponents = %d;", resources.maxVertexOutputComponents); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxFragmentInputComponents = %d;", resources.maxFragmentInputComponents); - s.append(builtInConstant); - } - - // tessellation - if (version >= 150) { - snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlInputComponents = %d;", resources.maxTessControlInputComponents); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlOutputComponents = %d;", resources.maxTessControlOutputComponents); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlTextureImageUnits = %d;", resources.maxTessControlTextureImageUnits); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlUniformComponents = %d;", resources.maxTessControlUniformComponents); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlTotalOutputComponents = %d;", resources.maxTessControlTotalOutputComponents); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationInputComponents = %d;", resources.maxTessEvaluationInputComponents); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationOutputComponents = %d;", resources.maxTessEvaluationOutputComponents); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationTextureImageUnits = %d;", resources.maxTessEvaluationTextureImageUnits); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationUniformComponents = %d;", resources.maxTessEvaluationUniformComponents); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const int gl_MaxTessPatchComponents = %d;", resources.maxTessPatchComponents); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxTessGenLevel = %d;", resources.maxTessGenLevel); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxPatchVertices = %d;", resources.maxPatchVertices); - s.append(builtInConstant); - - // this is here instead of with the others in initialize(version, profile) due to the dependence on gl_MaxPatchVertices - if (language == EShLangTessControl || language == EShLangTessEvaluation) { - s.append( - "in gl_PerVertex {" - "vec4 gl_Position;" - "float gl_PointSize;" - "float gl_ClipDistance[];" - ); - if (profile == ECompatibilityProfile) - s.append( - "vec4 gl_ClipVertex;" - "vec4 gl_FrontColor;" - "vec4 gl_BackColor;" - "vec4 gl_FrontSecondaryColor;" - "vec4 gl_BackSecondaryColor;" - "vec4 gl_TexCoord[];" - "float gl_FogFragCoord;" - ); - if (profile != EEsProfile && version >= 450) - s.append( - "float gl_CullDistance[];" -#ifdef NV_EXTENSIONS - "vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering - "vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes -#endif - ); - s.append( - "} gl_in[gl_MaxPatchVertices];" - "\n"); - } - } - - if (version >= 150) { - snprintf(builtInConstant, maxSize, "const int gl_MaxViewports = %d;", resources.maxViewports); - s.append(builtInConstant); - } - - // images - if (version >= 130) { - snprintf(builtInConstant, maxSize, "const int gl_MaxCombinedImageUnitsAndFragmentOutputs = %d;", resources.maxCombinedImageUnitsAndFragmentOutputs); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxImageSamples = %d;", resources.maxImageSamples); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlImageUniforms = %d;", resources.maxTessControlImageUniforms); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationImageUniforms = %d;", resources.maxTessEvaluationImageUniforms); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryImageUniforms = %d;", resources.maxGeometryImageUniforms); - s.append(builtInConstant); - } - - // enhanced layouts - if (version >= 430) { - snprintf(builtInConstant, maxSize, "const int gl_MaxTransformFeedbackBuffers = %d;", resources.maxTransformFeedbackBuffers); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxTransformFeedbackInterleavedComponents = %d;", resources.maxTransformFeedbackInterleavedComponents); - s.append(builtInConstant); - } - } - - // images (some in compute below) - if ((profile == EEsProfile && version >= 310) || - (profile != EEsProfile && version >= 130)) { - snprintf(builtInConstant, maxSize, "const int gl_MaxImageUnits = %d;", resources.maxImageUnits); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxCombinedShaderOutputResources = %d;", resources.maxCombinedShaderOutputResources); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxVertexImageUniforms = %d;", resources.maxVertexImageUniforms); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxFragmentImageUniforms = %d;", resources.maxFragmentImageUniforms); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxCombinedImageUniforms = %d;", resources.maxCombinedImageUniforms); - s.append(builtInConstant); - } - - // atomic counters (some in compute below) - if ((profile == EEsProfile && version >= 310) || - (profile != EEsProfile && version >= 420)) { - snprintf(builtInConstant, maxSize, "const int gl_MaxVertexAtomicCounters = %d;", resources. maxVertexAtomicCounters); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxFragmentAtomicCounters = %d;", resources. maxFragmentAtomicCounters); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxCombinedAtomicCounters = %d;", resources. maxCombinedAtomicCounters); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxAtomicCounterBindings = %d;", resources. maxAtomicCounterBindings); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxVertexAtomicCounterBuffers = %d;", resources. maxVertexAtomicCounterBuffers); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxFragmentAtomicCounterBuffers = %d;", resources. maxFragmentAtomicCounterBuffers); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxCombinedAtomicCounterBuffers = %d;", resources. maxCombinedAtomicCounterBuffers); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxAtomicCounterBufferSize = %d;", resources. maxAtomicCounterBufferSize); - s.append(builtInConstant); - } - if (profile != EEsProfile && version >= 420) { - snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlAtomicCounters = %d;", resources. maxTessControlAtomicCounters); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationAtomicCounters = %d;", resources. maxTessEvaluationAtomicCounters); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryAtomicCounters = %d;", resources. maxGeometryAtomicCounters); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlAtomicCounterBuffers = %d;", resources. maxTessControlAtomicCounterBuffers); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationAtomicCounterBuffers = %d;", resources. maxTessEvaluationAtomicCounterBuffers); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryAtomicCounterBuffers = %d;", resources. maxGeometryAtomicCounterBuffers); - s.append(builtInConstant); - - s.append("\n"); - } - - // compute - if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 420)) { - snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupCount = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupCountX, - resources.maxComputeWorkGroupCountY, - resources.maxComputeWorkGroupCountZ); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupSize = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupSizeX, - resources.maxComputeWorkGroupSizeY, - resources.maxComputeWorkGroupSizeZ); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const int gl_MaxComputeUniformComponents = %d;", resources.maxComputeUniformComponents); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxComputeTextureImageUnits = %d;", resources.maxComputeTextureImageUnits); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxComputeImageUniforms = %d;", resources.maxComputeImageUniforms); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounters = %d;", resources.maxComputeAtomicCounters); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounterBuffers = %d;", resources.maxComputeAtomicCounterBuffers); - s.append(builtInConstant); - - s.append("\n"); - } - - // GL_ARB_cull_distance - if (profile != EEsProfile && version >= 450) { - snprintf(builtInConstant, maxSize, "const int gl_MaxCullDistances = %d;", resources.maxCullDistances); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxCombinedClipAndCullDistances = %d;", resources.maxCombinedClipAndCullDistances); - s.append(builtInConstant); - } - - // GL_ARB_ES3_1_compatibility - if ((profile != EEsProfile && version >= 450) || - (profile == EEsProfile && version >= 310)) { - snprintf(builtInConstant, maxSize, "const int gl_MaxSamples = %d;", resources.maxSamples); - s.append(builtInConstant); - } - -#ifdef AMD_EXTENSIONS - // GL_AMD_gcn_shader - if (profile != EEsProfile && version >= 450) { - snprintf(builtInConstant, maxSize, "const int gl_SIMDGroupSizeAMD = 64;"); - s.append(builtInConstant); - } -#endif - - s.append("\n"); -} - -// -// To support special built-ins that have a special qualifier that cannot be declared textually -// in a shader, like gl_Position. -// -// This lets the type of the built-in be declared textually, and then have just its qualifier be -// updated afterward. -// -// Safe to call even if name is not present. -// -// Only use this for built-in variables that have a special qualifier in TStorageQualifier. -// New built-in variables should use a generic (textually declarable) qualifier in -// TStoraregQualifier and only call BuiltInVariable(). -// -static void SpecialQualifier(const char* name, TStorageQualifier qualifier, TBuiltInVariable builtIn, TSymbolTable& symbolTable) -{ - TSymbol* symbol = symbolTable.find(name); - if (symbol) { - TQualifier& symQualifier = symbol->getWritableType().getQualifier(); - symQualifier.storage = qualifier; - symQualifier.builtIn = builtIn; - } -} - -// -// To tag built-in variables with their TBuiltInVariable enum. Use this when the -// normal declaration text already gets the qualifier right, and all that's needed -// is setting the builtIn field. This should be the normal way for all new -// built-in variables. -// -// If SpecialQualifier() was called, this does not need to be called. -// -// Safe to call even if name is not present. -// -static void BuiltInVariable(const char* name, TBuiltInVariable builtIn, TSymbolTable& symbolTable) -{ - TSymbol* symbol = symbolTable.find(name); - if (! symbol) - return; - - TQualifier& symQualifier = symbol->getWritableType().getQualifier(); - symQualifier.builtIn = builtIn; -} - -// -// For built-in variables inside a named block. -// SpecialQualifier() won't ever go inside a block; their member's qualifier come -// from the qualification of the block. -// -// See comments above for other detail. -// -static void BuiltInVariable(const char* blockName, const char* name, TBuiltInVariable builtIn, TSymbolTable& symbolTable) -{ - TSymbol* symbol = symbolTable.find(blockName); - if (! symbol) - return; - - TTypeList& structure = *symbol->getWritableType().getWritableStruct(); - for (int i = 0; i < (int)structure.size(); ++i) { - if (structure[i].type->getFieldName().compare(name) == 0) { - structure[i].type->getQualifier().builtIn = builtIn; - return; - } - } -} - -// -// Finish adding/processing context-independent built-in symbols. -// 1) Programmatically add symbols that could not be added by simple text strings above. -// 2) Map built-in functions to operators, for those that will turn into an operation node -// instead of remaining a function call. -// 3) Tag extension-related symbols added to their base version with their extensions, so -// that if an early version has the extension turned off, there is an error reported on use. -// -void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable) -{ - // - // Tag built-in variables and functions with additional qualifier and extension information - // that cannot be declared with the text strings. - // - - // N.B.: a symbol should only be tagged once, and this function is called multiple times, once - // per stage that's used for this profile. So - // - generally, stick common ones in the fragment stage to ensure they are tagged exactly once - // - for ES, which has different precisions for different stages, the coarsest-grained tagging - // for a built-in used in many stages needs to be once for the fragment stage and once for - // the vertex stage - - switch(language) { - case EShLangVertex: - if (profile != EEsProfile) { - if (version >= 440) { - symbolTable.setVariableExtensions("gl_BaseVertexARB", 1, &E_GL_ARB_shader_draw_parameters); - symbolTable.setVariableExtensions("gl_BaseInstanceARB", 1, &E_GL_ARB_shader_draw_parameters); - symbolTable.setVariableExtensions("gl_DrawIDARB", 1, &E_GL_ARB_shader_draw_parameters); - BuiltInVariable("gl_BaseVertexARB", EbvBaseVertex, symbolTable); - BuiltInVariable("gl_BaseInstanceARB", EbvBaseInstance, symbolTable); - BuiltInVariable("gl_DrawIDARB", EbvDrawId, symbolTable); - } - if (version >= 460) { - BuiltInVariable("gl_BaseVertex", EbvBaseVertex, symbolTable); - BuiltInVariable("gl_BaseInstance", EbvBaseInstance, symbolTable); - BuiltInVariable("gl_DrawID", EbvDrawId, symbolTable); - } - symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot); - symbolTable.setVariableExtensions("gl_SubGroupInvocationARB", 1, &E_GL_ARB_shader_ballot); - symbolTable.setVariableExtensions("gl_SubGroupEqMaskARB", 1, &E_GL_ARB_shader_ballot); - symbolTable.setVariableExtensions("gl_SubGroupGeMaskARB", 1, &E_GL_ARB_shader_ballot); - symbolTable.setVariableExtensions("gl_SubGroupGtMaskARB", 1, &E_GL_ARB_shader_ballot); - symbolTable.setVariableExtensions("gl_SubGroupLeMaskARB", 1, &E_GL_ARB_shader_ballot); - symbolTable.setVariableExtensions("gl_SubGroupLtMaskARB", 1, &E_GL_ARB_shader_ballot); - - symbolTable.setFunctionExtensions("ballotARB", 1, &E_GL_ARB_shader_ballot); - symbolTable.setFunctionExtensions("readInvocationARB", 1, &E_GL_ARB_shader_ballot); - symbolTable.setFunctionExtensions("readFirstInvocationARB", 1, &E_GL_ARB_shader_ballot); - - BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable); - BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable); - BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable); - BuiltInVariable("gl_SubGroupGtMaskARB", EbvSubGroupGtMask, symbolTable); - BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable); - BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable); - - if (spvVersion.vulkan >= 100) - // Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan - SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable); - - if (version >= 430) { - symbolTable.setFunctionExtensions("anyInvocationARB", 1, &E_GL_ARB_shader_group_vote); - symbolTable.setFunctionExtensions("allInvocationsARB", 1, &E_GL_ARB_shader_group_vote); - symbolTable.setFunctionExtensions("allInvocationsEqualARB", 1, &E_GL_ARB_shader_group_vote); - } - } - -#ifdef AMD_EXTENSIONS - if (profile != EEsProfile) { - symbolTable.setFunctionExtensions("minInvocationsAMD", 1, &E_GL_AMD_shader_ballot); - symbolTable.setFunctionExtensions("maxInvocationsAMD", 1, &E_GL_AMD_shader_ballot); - symbolTable.setFunctionExtensions("addInvocationsAMD", 1, &E_GL_AMD_shader_ballot); - symbolTable.setFunctionExtensions("minInvocationsNonUniformAMD", 1, &E_GL_AMD_shader_ballot); - symbolTable.setFunctionExtensions("maxInvocationsNonUniformAMD", 1, &E_GL_AMD_shader_ballot); - symbolTable.setFunctionExtensions("addInvocationsNonUniformAMD", 1, &E_GL_AMD_shader_ballot); - symbolTable.setFunctionExtensions("swizzleInvocationsAMD", 1, &E_GL_AMD_shader_ballot); - symbolTable.setFunctionExtensions("swizzleInvocationsWithPatternAMD", 1, &E_GL_AMD_shader_ballot); - symbolTable.setFunctionExtensions("writeInvocationAMD", 1, &E_GL_AMD_shader_ballot); - symbolTable.setFunctionExtensions("mbcntAMD", 1, &E_GL_AMD_shader_ballot); - - symbolTable.setFunctionExtensions("minInvocationsInclusiveScanAMD", 1, &E_GL_AMD_shader_ballot); - symbolTable.setFunctionExtensions("maxInvocationsInclusiveScanAMD", 1, &E_GL_AMD_shader_ballot); - symbolTable.setFunctionExtensions("addInvocationsInclusiveScanAMD", 1, &E_GL_AMD_shader_ballot); - symbolTable.setFunctionExtensions("minInvocationsInclusiveScanNonUniformAMD", 1, &E_GL_AMD_shader_ballot); - symbolTable.setFunctionExtensions("maxInvocationsInclusiveScanNonUniformAMD", 1, &E_GL_AMD_shader_ballot); - symbolTable.setFunctionExtensions("addInvocationsInclusiveScanNonUniformAMD", 1, &E_GL_AMD_shader_ballot); - symbolTable.setFunctionExtensions("minInvocationsExclusiveScanAMD", 1, &E_GL_AMD_shader_ballot); - symbolTable.setFunctionExtensions("maxInvocationsExclusiveScanAMD", 1, &E_GL_AMD_shader_ballot); - symbolTable.setFunctionExtensions("addInvocationsExclusiveScanAMD", 1, &E_GL_AMD_shader_ballot); - symbolTable.setFunctionExtensions("minInvocationsExclusiveScanNonUniformAMD", 1, &E_GL_AMD_shader_ballot); - symbolTable.setFunctionExtensions("maxInvocationsExclusiveScanNonUniformAMD", 1, &E_GL_AMD_shader_ballot); - symbolTable.setFunctionExtensions("addInvocationsExclusiveScanNonUniformAMD", 1, &E_GL_AMD_shader_ballot); - } - - if (profile != EEsProfile) { - symbolTable.setFunctionExtensions("min3", 1, &E_GL_AMD_shader_trinary_minmax); - symbolTable.setFunctionExtensions("max3", 1, &E_GL_AMD_shader_trinary_minmax); - symbolTable.setFunctionExtensions("mid3", 1, &E_GL_AMD_shader_trinary_minmax); - } - - if (profile != EEsProfile) { - symbolTable.setFunctionExtensions("cubeFaceIndexAMD", 1, &E_GL_AMD_gcn_shader); - symbolTable.setFunctionExtensions("cubeFaceCoordAMD", 1, &E_GL_AMD_gcn_shader); - symbolTable.setFunctionExtensions("timeAMD", 1, &E_GL_AMD_gcn_shader); - } - - if (profile != EEsProfile) { - symbolTable.setFunctionExtensions("fragmentMaskFetchAMD", 1, &E_GL_AMD_shader_fragment_mask); - symbolTable.setFunctionExtensions("fragmentFetchAMD", 1, &E_GL_AMD_shader_fragment_mask); - } -#endif - - // Compatibility variables, vertex only - if (spvVersion.spv == 0) { - BuiltInVariable("gl_Color", EbvColor, symbolTable); - BuiltInVariable("gl_SecondaryColor", EbvSecondaryColor, symbolTable); - BuiltInVariable("gl_Normal", EbvNormal, symbolTable); - BuiltInVariable("gl_Vertex", EbvVertex, symbolTable); - BuiltInVariable("gl_MultiTexCoord0", EbvMultiTexCoord0, symbolTable); - BuiltInVariable("gl_MultiTexCoord1", EbvMultiTexCoord1, symbolTable); - BuiltInVariable("gl_MultiTexCoord2", EbvMultiTexCoord2, symbolTable); - BuiltInVariable("gl_MultiTexCoord3", EbvMultiTexCoord3, symbolTable); - BuiltInVariable("gl_MultiTexCoord4", EbvMultiTexCoord4, symbolTable); - BuiltInVariable("gl_MultiTexCoord5", EbvMultiTexCoord5, symbolTable); - BuiltInVariable("gl_MultiTexCoord6", EbvMultiTexCoord6, symbolTable); - BuiltInVariable("gl_MultiTexCoord7", EbvMultiTexCoord7, symbolTable); - BuiltInVariable("gl_FogCoord", EbvFogFragCoord, symbolTable); - } - - if (profile == EEsProfile) { - if (spvVersion.spv == 0) { - symbolTable.setFunctionExtensions("texture2DGradEXT", 1, &E_GL_EXT_shader_texture_lod); - symbolTable.setFunctionExtensions("texture2DProjGradEXT", 1, &E_GL_EXT_shader_texture_lod); - symbolTable.setFunctionExtensions("textureCubeGradEXT", 1, &E_GL_EXT_shader_texture_lod); - if (version == 310) - symbolTable.setFunctionExtensions("textureGatherOffsets", Num_AEP_gpu_shader5, AEP_gpu_shader5); - } - if (version == 310) - symbolTable.setFunctionExtensions("fma", Num_AEP_gpu_shader5, AEP_gpu_shader5); - } - - if (profile == EEsProfile && version < 320) { - symbolTable.setFunctionExtensions("imageAtomicAdd", 1, &E_GL_OES_shader_image_atomic); - symbolTable.setFunctionExtensions("imageAtomicMin", 1, &E_GL_OES_shader_image_atomic); - symbolTable.setFunctionExtensions("imageAtomicMax", 1, &E_GL_OES_shader_image_atomic); - symbolTable.setFunctionExtensions("imageAtomicAnd", 1, &E_GL_OES_shader_image_atomic); - symbolTable.setFunctionExtensions("imageAtomicOr", 1, &E_GL_OES_shader_image_atomic); - symbolTable.setFunctionExtensions("imageAtomicXor", 1, &E_GL_OES_shader_image_atomic); - symbolTable.setFunctionExtensions("imageAtomicExchange", 1, &E_GL_OES_shader_image_atomic); - symbolTable.setFunctionExtensions("imageAtomicCompSwap", 1, &E_GL_OES_shader_image_atomic); - } - - if (spvVersion.vulkan == 0) { - SpecialQualifier("gl_VertexID", EvqVertexId, EbvVertexId, symbolTable); - SpecialQualifier("gl_InstanceID", EvqInstanceId, EbvInstanceId, symbolTable); - } - - if (spvVersion.vulkan >= 100) { - BuiltInVariable("gl_VertexIndex", EbvVertexIndex, symbolTable); - BuiltInVariable("gl_InstanceIndex", EbvInstanceIndex, symbolTable); - } - - if (version >= 300 /* both ES and non-ES */) { - symbolTable.setVariableExtensions("gl_ViewID_OVR", Num_OVR_multiview_EXTs, OVR_multiview_EXTs); - BuiltInVariable("gl_ViewID_OVR", EbvViewIndex, symbolTable); - } - - if (profile == EEsProfile) { - symbolTable.setFunctionExtensions("shadow2DEXT", 1, &E_GL_EXT_shadow_samplers); - symbolTable.setFunctionExtensions("shadow2DProjEXT", 1, &E_GL_EXT_shadow_samplers); - } - - // Fall through - - case EShLangTessControl: - if (profile == EEsProfile && version >= 310) { - BuiltInVariable("gl_BoundingBoxOES", EbvBoundingBox, symbolTable); - if (version < 320) - symbolTable.setVariableExtensions("gl_BoundingBoxOES", Num_AEP_primitive_bounding_box, - AEP_primitive_bounding_box); - } - - // Fall through - - case EShLangTessEvaluation: - case EShLangGeometry: - SpecialQualifier("gl_Position", EvqPosition, EbvPosition, symbolTable); - SpecialQualifier("gl_PointSize", EvqPointSize, EbvPointSize, symbolTable); - SpecialQualifier("gl_ClipVertex", EvqClipVertex, EbvClipVertex, symbolTable); - - BuiltInVariable("gl_in", "gl_Position", EbvPosition, symbolTable); - BuiltInVariable("gl_in", "gl_PointSize", EbvPointSize, symbolTable); - BuiltInVariable("gl_in", "gl_ClipDistance", EbvClipDistance, symbolTable); - BuiltInVariable("gl_in", "gl_CullDistance", EbvCullDistance, symbolTable); - - BuiltInVariable("gl_out", "gl_Position", EbvPosition, symbolTable); - BuiltInVariable("gl_out", "gl_PointSize", EbvPointSize, symbolTable); - BuiltInVariable("gl_out", "gl_ClipDistance", EbvClipDistance, symbolTable); - BuiltInVariable("gl_out", "gl_CullDistance", EbvCullDistance, symbolTable); - - BuiltInVariable("gl_ClipDistance", EbvClipDistance, symbolTable); - BuiltInVariable("gl_CullDistance", EbvCullDistance, symbolTable); - BuiltInVariable("gl_PrimitiveIDIn", EbvPrimitiveId, symbolTable); - BuiltInVariable("gl_PrimitiveID", EbvPrimitiveId, symbolTable); - BuiltInVariable("gl_InvocationID", EbvInvocationId, symbolTable); - BuiltInVariable("gl_Layer", EbvLayer, symbolTable); - BuiltInVariable("gl_ViewportIndex", EbvViewportIndex, symbolTable); - -#ifdef NV_EXTENSIONS - if (language != EShLangGeometry) { - symbolTable.setVariableExtensions("gl_Layer", Num_viewportEXTs, viewportEXTs); - symbolTable.setVariableExtensions("gl_ViewportIndex", Num_viewportEXTs, viewportEXTs); - } -#else - if (language != EShLangGeometry && version >= 410) { - symbolTable.setVariableExtensions("gl_Layer", 1, &E_GL_ARB_shader_viewport_layer_array); - symbolTable.setVariableExtensions("gl_ViewportIndex", 1, &E_GL_ARB_shader_viewport_layer_array); - } -#endif - -#ifdef NV_EXTENSIONS - symbolTable.setVariableExtensions("gl_ViewportMask", 1, &E_GL_NV_viewport_array2); - symbolTable.setVariableExtensions("gl_SecondaryPositionNV", 1, &E_GL_NV_stereo_view_rendering); - symbolTable.setVariableExtensions("gl_SecondaryViewportMaskNV", 1, &E_GL_NV_stereo_view_rendering); - symbolTable.setVariableExtensions("gl_PositionPerViewNV", 1, &E_GL_NVX_multiview_per_view_attributes); - symbolTable.setVariableExtensions("gl_ViewportMaskPerViewNV", 1, &E_GL_NVX_multiview_per_view_attributes); - - BuiltInVariable("gl_ViewportMask", EbvViewportMaskNV, symbolTable); - BuiltInVariable("gl_SecondaryPositionNV", EbvSecondaryPositionNV, symbolTable); - BuiltInVariable("gl_SecondaryViewportMaskNV", EbvSecondaryViewportMaskNV, symbolTable); - BuiltInVariable("gl_PositionPerViewNV", EbvPositionPerViewNV, symbolTable); - BuiltInVariable("gl_ViewportMaskPerViewNV", EbvViewportMaskPerViewNV, symbolTable); - - if (language != EShLangVertex) { - BuiltInVariable("gl_in", "gl_SecondaryPositionNV", EbvSecondaryPositionNV, symbolTable); - BuiltInVariable("gl_in", "gl_PositionPerViewNV", EbvPositionPerViewNV, symbolTable); - } - BuiltInVariable("gl_out", "gl_ViewportMask", EbvViewportMaskNV, symbolTable); - BuiltInVariable("gl_out", "gl_SecondaryPositionNV", EbvSecondaryPositionNV, symbolTable); - BuiltInVariable("gl_out", "gl_SecondaryViewportMaskNV", EbvSecondaryViewportMaskNV, symbolTable); - BuiltInVariable("gl_out", "gl_PositionPerViewNV", EbvPositionPerViewNV, symbolTable); - BuiltInVariable("gl_out", "gl_ViewportMaskPerViewNV", EbvViewportMaskPerViewNV, symbolTable); -#endif - - BuiltInVariable("gl_PatchVerticesIn", EbvPatchVertices, symbolTable); - BuiltInVariable("gl_TessLevelOuter", EbvTessLevelOuter, symbolTable); - BuiltInVariable("gl_TessLevelInner", EbvTessLevelInner, symbolTable); - BuiltInVariable("gl_TessCoord", EbvTessCoord, symbolTable); - - if (version < 410) - symbolTable.setVariableExtensions("gl_ViewportIndex", 1, &E_GL_ARB_viewport_array); - - // Compatibility variables - - BuiltInVariable("gl_in", "gl_ClipVertex", EbvClipVertex, symbolTable); - BuiltInVariable("gl_in", "gl_FrontColor", EbvFrontColor, symbolTable); - BuiltInVariable("gl_in", "gl_BackColor", EbvBackColor, symbolTable); - BuiltInVariable("gl_in", "gl_FrontSecondaryColor", EbvFrontSecondaryColor, symbolTable); - BuiltInVariable("gl_in", "gl_BackSecondaryColor", EbvBackSecondaryColor, symbolTable); - BuiltInVariable("gl_in", "gl_TexCoord", EbvTexCoord, symbolTable); - BuiltInVariable("gl_in", "gl_FogFragCoord", EbvFogFragCoord, symbolTable); - - BuiltInVariable("gl_out", "gl_ClipVertex", EbvClipVertex, symbolTable); - BuiltInVariable("gl_out", "gl_FrontColor", EbvFrontColor, symbolTable); - BuiltInVariable("gl_out", "gl_BackColor", EbvBackColor, symbolTable); - BuiltInVariable("gl_out", "gl_FrontSecondaryColor", EbvFrontSecondaryColor, symbolTable); - BuiltInVariable("gl_out", "gl_BackSecondaryColor", EbvBackSecondaryColor, symbolTable); - BuiltInVariable("gl_out", "gl_TexCoord", EbvTexCoord, symbolTable); - BuiltInVariable("gl_out", "gl_FogFragCoord", EbvFogFragCoord, symbolTable); - - BuiltInVariable("gl_ClipVertex", EbvClipVertex, symbolTable); - BuiltInVariable("gl_FrontColor", EbvFrontColor, symbolTable); - BuiltInVariable("gl_BackColor", EbvBackColor, symbolTable); - BuiltInVariable("gl_FrontSecondaryColor", EbvFrontSecondaryColor, symbolTable); - BuiltInVariable("gl_BackSecondaryColor", EbvBackSecondaryColor, symbolTable); - BuiltInVariable("gl_TexCoord", EbvTexCoord, symbolTable); - BuiltInVariable("gl_FogFragCoord", EbvFogFragCoord, symbolTable); - - // gl_PointSize, when it needs to be tied to an extension, is always a member of a block. - // (Sometimes with an instance name, sometimes anonymous). - // However, the current automatic extension scheme does not work per block member, - // so for now check when parsing. - // - // if (profile == EEsProfile) { - // if (language == EShLangGeometry) - // symbolTable.setVariableExtensions("gl_PointSize", Num_AEP_geometry_point_size, AEP_geometry_point_size); - // else if (language == EShLangTessEvaluation || language == EShLangTessControl) - // symbolTable.setVariableExtensions("gl_PointSize", Num_AEP_tessellation_point_size, AEP_tessellation_point_size); - //} - - if ((profile != EEsProfile && version >= 140) || - (profile == EEsProfile && version >= 310)) { - symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group); - BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable); - symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview); - BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable); - } - - break; - - case EShLangFragment: - SpecialQualifier("gl_FrontFacing", EvqFace, EbvFace, symbolTable); - SpecialQualifier("gl_FragCoord", EvqFragCoord, EbvFragCoord, symbolTable); - SpecialQualifier("gl_PointCoord", EvqPointCoord, EbvPointCoord, symbolTable); - if (spvVersion.spv == 0) - SpecialQualifier("gl_FragColor", EvqFragColor, EbvFragColor, symbolTable); - else { - TSymbol* symbol = symbolTable.find("gl_FragColor"); - if (symbol) { - symbol->getWritableType().getQualifier().storage = EvqVaryingOut; - symbol->getWritableType().getQualifier().layoutLocation = 0; - } - } - SpecialQualifier("gl_FragDepth", EvqFragDepth, EbvFragDepth, symbolTable); - SpecialQualifier("gl_FragDepthEXT", EvqFragDepth, EbvFragDepth, symbolTable); - SpecialQualifier("gl_HelperInvocation", EvqVaryingIn, EbvHelperInvocation, symbolTable); - - BuiltInVariable("gl_ClipDistance", EbvClipDistance, symbolTable); - BuiltInVariable("gl_CullDistance", EbvCullDistance, symbolTable); - BuiltInVariable("gl_PrimitiveID", EbvPrimitiveId, symbolTable); - - if (profile != EEsProfile && version >= 140) { - symbolTable.setVariableExtensions("gl_FragStencilRefARB", 1, &E_GL_ARB_shader_stencil_export); - BuiltInVariable("gl_FragStencilRefARB", EbvFragStencilRef, symbolTable); - } - - if ((profile != EEsProfile && version >= 400) || - (profile == EEsProfile && version >= 310)) { - BuiltInVariable("gl_SampleID", EbvSampleId, symbolTable); - BuiltInVariable("gl_SamplePosition", EbvSamplePosition, symbolTable); - BuiltInVariable("gl_SampleMaskIn", EbvSampleMask, symbolTable); - BuiltInVariable("gl_SampleMask", EbvSampleMask, symbolTable); - if (profile == EEsProfile && version < 320) { - symbolTable.setVariableExtensions("gl_SampleID", 1, &E_GL_OES_sample_variables); - symbolTable.setVariableExtensions("gl_SamplePosition", 1, &E_GL_OES_sample_variables); - symbolTable.setVariableExtensions("gl_SampleMaskIn", 1, &E_GL_OES_sample_variables); - symbolTable.setVariableExtensions("gl_SampleMask", 1, &E_GL_OES_sample_variables); - symbolTable.setVariableExtensions("gl_NumSamples", 1, &E_GL_OES_sample_variables); - } - } - - BuiltInVariable("gl_Layer", EbvLayer, symbolTable); - BuiltInVariable("gl_ViewportIndex", EbvViewportIndex, symbolTable); - - // Compatibility variables - - BuiltInVariable("gl_in", "gl_FogFragCoord", EbvFogFragCoord, symbolTable); - BuiltInVariable("gl_in", "gl_TexCoord", EbvTexCoord, symbolTable); - BuiltInVariable("gl_in", "gl_Color", EbvColor, symbolTable); - BuiltInVariable("gl_in", "gl_SecondaryColor", EbvSecondaryColor, symbolTable); - - BuiltInVariable("gl_FogFragCoord", EbvFogFragCoord, symbolTable); - BuiltInVariable("gl_TexCoord", EbvTexCoord, symbolTable); - BuiltInVariable("gl_Color", EbvColor, symbolTable); - BuiltInVariable("gl_SecondaryColor", EbvSecondaryColor, symbolTable); - - // built-in functions - - if (profile == EEsProfile) { - if (spvVersion.spv == 0) { - symbolTable.setFunctionExtensions("texture2DLodEXT", 1, &E_GL_EXT_shader_texture_lod); - symbolTable.setFunctionExtensions("texture2DProjLodEXT", 1, &E_GL_EXT_shader_texture_lod); - symbolTable.setFunctionExtensions("textureCubeLodEXT", 1, &E_GL_EXT_shader_texture_lod); - symbolTable.setFunctionExtensions("texture2DGradEXT", 1, &E_GL_EXT_shader_texture_lod); - symbolTable.setFunctionExtensions("texture2DProjGradEXT", 1, &E_GL_EXT_shader_texture_lod); - symbolTable.setFunctionExtensions("textureCubeGradEXT", 1, &E_GL_EXT_shader_texture_lod); - if (version < 320) - symbolTable.setFunctionExtensions("textureGatherOffsets", Num_AEP_gpu_shader5, AEP_gpu_shader5); - } - if (version == 100) { - symbolTable.setFunctionExtensions("dFdx", 1, &E_GL_OES_standard_derivatives); - symbolTable.setFunctionExtensions("dFdy", 1, &E_GL_OES_standard_derivatives); - symbolTable.setFunctionExtensions("fwidth", 1, &E_GL_OES_standard_derivatives); - } - if (version == 310) { - symbolTable.setFunctionExtensions("fma", Num_AEP_gpu_shader5, AEP_gpu_shader5); - symbolTable.setFunctionExtensions("interpolateAtCentroid", 1, &E_GL_OES_shader_multisample_interpolation); - symbolTable.setFunctionExtensions("interpolateAtSample", 1, &E_GL_OES_shader_multisample_interpolation); - symbolTable.setFunctionExtensions("interpolateAtOffset", 1, &E_GL_OES_shader_multisample_interpolation); - } - } else if (version < 130) { - if (spvVersion.spv == 0) { - symbolTable.setFunctionExtensions("texture1DLod", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("texture2DLod", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("texture3DLod", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("textureCubeLod", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("texture1DProjLod", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("texture2DProjLod", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("texture3DProjLod", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("shadow1DLod", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("shadow2DLod", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("shadow1DProjLod", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("shadow2DProjLod", 1, &E_GL_ARB_shader_texture_lod); - } - } - - // E_GL_ARB_shader_texture_lod functions usable only with the extension enabled - if (profile != EEsProfile && spvVersion.spv == 0) { - symbolTable.setFunctionExtensions("texture1DGradARB", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("texture1DProjGradARB", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("texture2DGradARB", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("texture2DProjGradARB", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("texture3DGradARB", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("texture3DProjGradARB", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("textureCubeGradARB", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("shadow1DGradARB", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("shadow1DProjGradARB", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("shadow2DGradARB", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("shadow2DProjGradARB", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("texture2DRectGradARB", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("texture2DRectProjGradARB", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("shadow2DRectGradARB", 1, &E_GL_ARB_shader_texture_lod); - symbolTable.setFunctionExtensions("shadow2DRectProjGradARB", 1, &E_GL_ARB_shader_texture_lod); - } - - // E_GL_EXT_texture_array - if (spvVersion.spv == 0) { - symbolTable.setFunctionExtensions("texture2DArray", 1, &E_GL_EXT_texture_array); - } - if (profile != EEsProfile && spvVersion.spv == 0) { - int nLodExtensions = 2; - const char *lodExtensions[] = {E_GL_EXT_texture_array, E_GL_ARB_shader_texture_lod}; - - if (version >= 130) - nLodExtensions = 1; - - symbolTable.setFunctionExtensions("texture1DArray", 1, &E_GL_EXT_texture_array); - symbolTable.setFunctionExtensions("shadow1DArray", 1, &E_GL_EXT_texture_array); - symbolTable.setFunctionExtensions("shadow2DArray", 1, &E_GL_EXT_texture_array); - - symbolTable.setFunctionExtensions("texture1DArrayLod", nLodExtensions, lodExtensions); - symbolTable.setFunctionExtensions("texture2DArrayLod", nLodExtensions, lodExtensions); - symbolTable.setFunctionExtensions("shadow1DArrayLod", nLodExtensions, lodExtensions); - symbolTable.setFunctionExtensions("shadow2DArrayLod", nLodExtensions, lodExtensions); - } - - // E_GL_ARB_shader_image_load_store - if (profile != EEsProfile && version < 420) - symbolTable.setFunctionExtensions("memoryBarrier", 1, &E_GL_ARB_shader_image_load_store); - // All the image access functions are protected by checks on the type of the first argument. - - // E_GL_ARB_shader_atomic_counters - if (profile != EEsProfile && version < 420) { - symbolTable.setFunctionExtensions("atomicCounterIncrement", 1, &E_GL_ARB_shader_atomic_counters); - symbolTable.setFunctionExtensions("atomicCounterDecrement", 1, &E_GL_ARB_shader_atomic_counters); - symbolTable.setFunctionExtensions("atomicCounter" , 1, &E_GL_ARB_shader_atomic_counters); - } - - // E_GL_ARB_derivative_control - if (profile != EEsProfile && version < 450) { - symbolTable.setFunctionExtensions("dFdxFine", 1, &E_GL_ARB_derivative_control); - symbolTable.setFunctionExtensions("dFdyFine", 1, &E_GL_ARB_derivative_control); - symbolTable.setFunctionExtensions("fwidthFine", 1, &E_GL_ARB_derivative_control); - symbolTable.setFunctionExtensions("dFdxCoarse", 1, &E_GL_ARB_derivative_control); - symbolTable.setFunctionExtensions("dFdyCoarse", 1, &E_GL_ARB_derivative_control); - symbolTable.setFunctionExtensions("fwidthCoarse", 1, &E_GL_ARB_derivative_control); - } - - // E_GL_ARB_sparse_texture2 - if (profile != EEsProfile) - { - symbolTable.setFunctionExtensions("sparseTextureARB", 1, &E_GL_ARB_sparse_texture2); - symbolTable.setFunctionExtensions("sparseTextureLodARB", 1, &E_GL_ARB_sparse_texture2); - symbolTable.setFunctionExtensions("sparseTextureOffsetARB", 1, &E_GL_ARB_sparse_texture2); - symbolTable.setFunctionExtensions("sparseTexelFetchARB", 1, &E_GL_ARB_sparse_texture2); - symbolTable.setFunctionExtensions("sparseTexelFetchOffsetARB", 1, &E_GL_ARB_sparse_texture2); - symbolTable.setFunctionExtensions("sparseTextureLodOffsetARB", 1, &E_GL_ARB_sparse_texture2); - symbolTable.setFunctionExtensions("sparseTextureGradARB", 1, &E_GL_ARB_sparse_texture2); - symbolTable.setFunctionExtensions("sparseTextureGradOffsetARB", 1, &E_GL_ARB_sparse_texture2); - symbolTable.setFunctionExtensions("sparseTextureGatherARB", 1, &E_GL_ARB_sparse_texture2); - symbolTable.setFunctionExtensions("sparseTextureGatherOffsetARB", 1, &E_GL_ARB_sparse_texture2); - symbolTable.setFunctionExtensions("sparseTextureGatherOffsetsARB", 1, &E_GL_ARB_sparse_texture2); - symbolTable.setFunctionExtensions("sparseImageLoadARB", 1, &E_GL_ARB_sparse_texture2); - symbolTable.setFunctionExtensions("sparseTexelsResident", 1, &E_GL_ARB_sparse_texture2); - } - - // E_GL_ARB_sparse_texture_clamp - if (profile != EEsProfile) - { - symbolTable.setFunctionExtensions("sparseTextureClampARB", 1, &E_GL_ARB_sparse_texture_clamp); - symbolTable.setFunctionExtensions("sparseTextureOffsetClampARB", 1, &E_GL_ARB_sparse_texture_clamp); - symbolTable.setFunctionExtensions("sparseTextureGradClampARB", 1, &E_GL_ARB_sparse_texture_clamp); - symbolTable.setFunctionExtensions("sparseTextureGradOffsetClampARB", 1, &E_GL_ARB_sparse_texture_clamp); - symbolTable.setFunctionExtensions("textureClampARB", 1, &E_GL_ARB_sparse_texture_clamp); - symbolTable.setFunctionExtensions("textureOffsetClampARB", 1, &E_GL_ARB_sparse_texture_clamp); - symbolTable.setFunctionExtensions("textureGradClampARB", 1, &E_GL_ARB_sparse_texture_clamp); - symbolTable.setFunctionExtensions("textureGradOffsetClampARB", 1, &E_GL_ARB_sparse_texture_clamp); - } - -#ifdef AMD_EXTENSIONS - // E_GL_AMD_shader_explicit_vertex_parameter - if (profile != EEsProfile) { - symbolTable.setVariableExtensions("gl_BaryCoordNoPerspAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter); - symbolTable.setVariableExtensions("gl_BaryCoordNoPerspCentroidAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter); - symbolTable.setVariableExtensions("gl_BaryCoordNoPerspSampleAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter); - symbolTable.setVariableExtensions("gl_BaryCoordSmoothAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter); - symbolTable.setVariableExtensions("gl_BaryCoordSmoothCentroidAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter); - symbolTable.setVariableExtensions("gl_BaryCoordSmoothSampleAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter); - symbolTable.setVariableExtensions("gl_BaryCoordPullModelAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter); - - symbolTable.setFunctionExtensions("interpolateAtVertexAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter); - - BuiltInVariable("gl_BaryCoordNoPerspAMD", EbvBaryCoordNoPersp, symbolTable); - BuiltInVariable("gl_BaryCoordNoPerspCentroidAMD", EbvBaryCoordNoPerspCentroid, symbolTable); - BuiltInVariable("gl_BaryCoordNoPerspSampleAMD", EbvBaryCoordNoPerspSample, symbolTable); - BuiltInVariable("gl_BaryCoordSmoothAMD", EbvBaryCoordSmooth, symbolTable); - BuiltInVariable("gl_BaryCoordSmoothCentroidAMD", EbvBaryCoordSmoothCentroid, symbolTable); - BuiltInVariable("gl_BaryCoordSmoothSampleAMD", EbvBaryCoordSmoothSample, symbolTable); - BuiltInVariable("gl_BaryCoordPullModelAMD", EbvBaryCoordPullModel, symbolTable); - } - - // E_GL_AMD_texture_gather_bias_lod - if (profile != EEsProfile) { - symbolTable.setFunctionExtensions("textureGatherLodAMD", 1, &E_GL_AMD_texture_gather_bias_lod); - symbolTable.setFunctionExtensions("textureGatherLodOffsetAMD", 1, &E_GL_AMD_texture_gather_bias_lod); - symbolTable.setFunctionExtensions("textureGatherLodOffsetsAMD", 1, &E_GL_AMD_texture_gather_bias_lod); - symbolTable.setFunctionExtensions("sparseTextureGatherLodAMD", 1, &E_GL_AMD_texture_gather_bias_lod); - symbolTable.setFunctionExtensions("sparseTextureGatherLodOffsetAMD", 1, &E_GL_AMD_texture_gather_bias_lod); - symbolTable.setFunctionExtensions("sparseTextureGatherLodOffsetsAMD", 1, &E_GL_AMD_texture_gather_bias_lod); - } - - // E_GL_AMD_shader_image_load_store_lod - if (profile != EEsProfile) { - symbolTable.setFunctionExtensions("imageLoadLodAMD", 1, &E_GL_AMD_shader_image_load_store_lod); - symbolTable.setFunctionExtensions("imageStoreLodAMD", 1, &E_GL_AMD_shader_image_load_store_lod); - symbolTable.setFunctionExtensions("sparseImageLoadLodAMD", 1, &E_GL_AMD_shader_image_load_store_lod); - } -#endif - -#ifdef NV_EXTENSIONS - if (profile != EEsProfile && version >= 430) { - symbolTable.setVariableExtensions("gl_FragFullyCoveredNV", 1, &E_GL_NV_conservative_raster_underestimation); - BuiltInVariable("gl_FragFullyCoveredNV", EbvFragFullyCoveredNV, symbolTable); - } -#endif - - symbolTable.setVariableExtensions("gl_FragDepthEXT", 1, &E_GL_EXT_frag_depth); - - if (profile == EEsProfile && version < 320) { - symbolTable.setVariableExtensions("gl_PrimitiveID", Num_AEP_geometry_shader, AEP_geometry_shader); - symbolTable.setVariableExtensions("gl_Layer", Num_AEP_geometry_shader, AEP_geometry_shader); - } - - if (profile == EEsProfile && version < 320) { - symbolTable.setFunctionExtensions("imageAtomicAdd", 1, &E_GL_OES_shader_image_atomic); - symbolTable.setFunctionExtensions("imageAtomicMin", 1, &E_GL_OES_shader_image_atomic); - symbolTable.setFunctionExtensions("imageAtomicMax", 1, &E_GL_OES_shader_image_atomic); - symbolTable.setFunctionExtensions("imageAtomicAnd", 1, &E_GL_OES_shader_image_atomic); - symbolTable.setFunctionExtensions("imageAtomicOr", 1, &E_GL_OES_shader_image_atomic); - symbolTable.setFunctionExtensions("imageAtomicXor", 1, &E_GL_OES_shader_image_atomic); - symbolTable.setFunctionExtensions("imageAtomicExchange", 1, &E_GL_OES_shader_image_atomic); - symbolTable.setFunctionExtensions("imageAtomicCompSwap", 1, &E_GL_OES_shader_image_atomic); - } - - symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group); - BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable); - symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview); - BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable); - if (version >= 300 /* both ES and non-ES */) { - symbolTable.setVariableExtensions("gl_ViewID_OVR", Num_OVR_multiview_EXTs, OVR_multiview_EXTs); - BuiltInVariable("gl_ViewID_OVR", EbvViewIndex, symbolTable); - } - - if (profile == EEsProfile) { - symbolTable.setFunctionExtensions("shadow2DEXT", 1, &E_GL_EXT_shadow_samplers); - symbolTable.setFunctionExtensions("shadow2DProjEXT", 1, &E_GL_EXT_shadow_samplers); - } - break; - - case EShLangCompute: - BuiltInVariable("gl_NumWorkGroups", EbvNumWorkGroups, symbolTable); - BuiltInVariable("gl_WorkGroupSize", EbvWorkGroupSize, symbolTable); - BuiltInVariable("gl_WorkGroupID", EbvWorkGroupId, symbolTable); - BuiltInVariable("gl_LocalInvocationID", EbvLocalInvocationId, symbolTable); - BuiltInVariable("gl_GlobalInvocationID", EbvGlobalInvocationId, symbolTable); - BuiltInVariable("gl_LocalInvocationIndex", EbvLocalInvocationIndex, symbolTable); - - if (profile != EEsProfile && version < 430) { - symbolTable.setVariableExtensions("gl_NumWorkGroups", 1, &E_GL_ARB_compute_shader); - symbolTable.setVariableExtensions("gl_WorkGroupSize", 1, &E_GL_ARB_compute_shader); - symbolTable.setVariableExtensions("gl_WorkGroupID", 1, &E_GL_ARB_compute_shader); - symbolTable.setVariableExtensions("gl_LocalInvocationID", 1, &E_GL_ARB_compute_shader); - symbolTable.setVariableExtensions("gl_GlobalInvocationID", 1, &E_GL_ARB_compute_shader); - symbolTable.setVariableExtensions("gl_LocalInvocationIndex", 1, &E_GL_ARB_compute_shader); - - symbolTable.setVariableExtensions("gl_MaxComputeWorkGroupCount", 1, &E_GL_ARB_compute_shader); - symbolTable.setVariableExtensions("gl_MaxComputeWorkGroupSize", 1, &E_GL_ARB_compute_shader); - symbolTable.setVariableExtensions("gl_MaxComputeUniformComponents", 1, &E_GL_ARB_compute_shader); - symbolTable.setVariableExtensions("gl_MaxComputeTextureImageUnits", 1, &E_GL_ARB_compute_shader); - symbolTable.setVariableExtensions("gl_MaxComputeImageUniforms", 1, &E_GL_ARB_compute_shader); - symbolTable.setVariableExtensions("gl_MaxComputeAtomicCounters", 1, &E_GL_ARB_compute_shader); - symbolTable.setVariableExtensions("gl_MaxComputeAtomicCounterBuffers", 1, &E_GL_ARB_compute_shader); - - symbolTable.setFunctionExtensions("barrier", 1, &E_GL_ARB_compute_shader); - symbolTable.setFunctionExtensions("memoryBarrierAtomicCounter", 1, &E_GL_ARB_compute_shader); - symbolTable.setFunctionExtensions("memoryBarrierBuffer", 1, &E_GL_ARB_compute_shader); - symbolTable.setFunctionExtensions("memoryBarrierImage", 1, &E_GL_ARB_compute_shader); - symbolTable.setFunctionExtensions("memoryBarrierShared", 1, &E_GL_ARB_compute_shader); - symbolTable.setFunctionExtensions("groupMemoryBarrier", 1, &E_GL_ARB_compute_shader); - } - - if ((profile != EEsProfile && version >= 140) || - (profile == EEsProfile && version >= 310)) { - symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group); - BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable); - symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview); - BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable); - } - - break; - - default: - assert(false && "Language not supported"); - break; - } - - // - // Next, identify which built-ins have a mapping to an operator. - // If PureOperatorBuiltins is false, those that are not identified as such are - // expected to be resolved through a library of functions, versus as - // operations. - // - symbolTable.relateToOperator("not", EOpVectorLogicalNot); - - symbolTable.relateToOperator("matrixCompMult", EOpMul); - // 120 and 150 are correct for both ES and desktop - if (version >= 120) { - symbolTable.relateToOperator("outerProduct", EOpOuterProduct); - symbolTable.relateToOperator("transpose", EOpTranspose); - if (version >= 150) { - symbolTable.relateToOperator("determinant", EOpDeterminant); - symbolTable.relateToOperator("inverse", EOpMatrixInverse); - } - } - - symbolTable.relateToOperator("mod", EOpMod); - symbolTable.relateToOperator("modf", EOpModf); - - symbolTable.relateToOperator("equal", EOpVectorEqual); - symbolTable.relateToOperator("notEqual", EOpVectorNotEqual); - symbolTable.relateToOperator("lessThan", EOpLessThan); - symbolTable.relateToOperator("greaterThan", EOpGreaterThan); - symbolTable.relateToOperator("lessThanEqual", EOpLessThanEqual); - symbolTable.relateToOperator("greaterThanEqual", EOpGreaterThanEqual); - - symbolTable.relateToOperator("radians", EOpRadians); - symbolTable.relateToOperator("degrees", EOpDegrees); - symbolTable.relateToOperator("sin", EOpSin); - symbolTable.relateToOperator("cos", EOpCos); - symbolTable.relateToOperator("tan", EOpTan); - symbolTable.relateToOperator("asin", EOpAsin); - symbolTable.relateToOperator("acos", EOpAcos); - symbolTable.relateToOperator("atan", EOpAtan); - symbolTable.relateToOperator("sinh", EOpSinh); - symbolTable.relateToOperator("cosh", EOpCosh); - symbolTable.relateToOperator("tanh", EOpTanh); - symbolTable.relateToOperator("asinh", EOpAsinh); - symbolTable.relateToOperator("acosh", EOpAcosh); - symbolTable.relateToOperator("atanh", EOpAtanh); - - symbolTable.relateToOperator("pow", EOpPow); - symbolTable.relateToOperator("exp2", EOpExp2); - symbolTable.relateToOperator("log", EOpLog); - symbolTable.relateToOperator("exp", EOpExp); - symbolTable.relateToOperator("log2", EOpLog2); - symbolTable.relateToOperator("sqrt", EOpSqrt); - symbolTable.relateToOperator("inversesqrt", EOpInverseSqrt); - - symbolTable.relateToOperator("abs", EOpAbs); - symbolTable.relateToOperator("sign", EOpSign); - symbolTable.relateToOperator("floor", EOpFloor); - symbolTable.relateToOperator("trunc", EOpTrunc); - symbolTable.relateToOperator("round", EOpRound); - symbolTable.relateToOperator("roundEven", EOpRoundEven); - symbolTable.relateToOperator("ceil", EOpCeil); - symbolTable.relateToOperator("fract", EOpFract); - symbolTable.relateToOperator("min", EOpMin); - symbolTable.relateToOperator("max", EOpMax); - symbolTable.relateToOperator("clamp", EOpClamp); - symbolTable.relateToOperator("mix", EOpMix); - symbolTable.relateToOperator("step", EOpStep); - symbolTable.relateToOperator("smoothstep", EOpSmoothStep); - - symbolTable.relateToOperator("isnan", EOpIsNan); - symbolTable.relateToOperator("isinf", EOpIsInf); - - symbolTable.relateToOperator("floatBitsToInt", EOpFloatBitsToInt); - symbolTable.relateToOperator("floatBitsToUint", EOpFloatBitsToUint); - symbolTable.relateToOperator("intBitsToFloat", EOpIntBitsToFloat); - symbolTable.relateToOperator("uintBitsToFloat", EOpUintBitsToFloat); - symbolTable.relateToOperator("doubleBitsToInt64", EOpDoubleBitsToInt64); - symbolTable.relateToOperator("doubleBitsToUint64", EOpDoubleBitsToUint64); - symbolTable.relateToOperator("int64BitsToDouble", EOpInt64BitsToDouble); - symbolTable.relateToOperator("uint64BitsToDouble", EOpUint64BitsToDouble); -#ifdef AMD_EXTENSIONS - symbolTable.relateToOperator("float16BitsToInt16", EOpFloat16BitsToInt16); - symbolTable.relateToOperator("float16BitsToUint16", EOpFloat16BitsToUint16); - symbolTable.relateToOperator("int16BitsToFloat16", EOpInt16BitsToFloat16); - symbolTable.relateToOperator("uint16BitsToFloat16", EOpUint16BitsToFloat16); -#endif - - symbolTable.relateToOperator("packSnorm2x16", EOpPackSnorm2x16); - symbolTable.relateToOperator("unpackSnorm2x16", EOpUnpackSnorm2x16); - symbolTable.relateToOperator("packUnorm2x16", EOpPackUnorm2x16); - symbolTable.relateToOperator("unpackUnorm2x16", EOpUnpackUnorm2x16); - - symbolTable.relateToOperator("packSnorm4x8", EOpPackSnorm4x8); - symbolTable.relateToOperator("unpackSnorm4x8", EOpUnpackSnorm4x8); - symbolTable.relateToOperator("packUnorm4x8", EOpPackUnorm4x8); - symbolTable.relateToOperator("unpackUnorm4x8", EOpUnpackUnorm4x8); - - symbolTable.relateToOperator("packDouble2x32", EOpPackDouble2x32); - symbolTable.relateToOperator("unpackDouble2x32", EOpUnpackDouble2x32); - - symbolTable.relateToOperator("packHalf2x16", EOpPackHalf2x16); - symbolTable.relateToOperator("unpackHalf2x16", EOpUnpackHalf2x16); - - symbolTable.relateToOperator("packInt2x32", EOpPackInt2x32); - symbolTable.relateToOperator("unpackInt2x32", EOpUnpackInt2x32); - symbolTable.relateToOperator("packUint2x32", EOpPackUint2x32); - symbolTable.relateToOperator("unpackUint2x32", EOpUnpackUint2x32); - -#ifdef AMD_EXTENSIONS - symbolTable.relateToOperator("packInt2x16", EOpPackInt2x16); - symbolTable.relateToOperator("unpackInt2x16", EOpUnpackInt2x16); - symbolTable.relateToOperator("packUint2x16", EOpPackUint2x16); - symbolTable.relateToOperator("unpackUint2x16", EOpUnpackUint2x16); - - symbolTable.relateToOperator("packInt4x16", EOpPackInt4x16); - symbolTable.relateToOperator("unpackInt4x16", EOpUnpackInt4x16); - symbolTable.relateToOperator("packUint4x16", EOpPackUint4x16); - symbolTable.relateToOperator("unpackUint4x16", EOpUnpackUint4x16); - - symbolTable.relateToOperator("packFloat2x16", EOpPackFloat2x16); - symbolTable.relateToOperator("unpackFloat2x16", EOpUnpackFloat2x16); -#endif - - symbolTable.relateToOperator("length", EOpLength); - symbolTable.relateToOperator("distance", EOpDistance); - symbolTable.relateToOperator("dot", EOpDot); - symbolTable.relateToOperator("cross", EOpCross); - symbolTable.relateToOperator("normalize", EOpNormalize); - symbolTable.relateToOperator("faceforward", EOpFaceForward); - symbolTable.relateToOperator("reflect", EOpReflect); - symbolTable.relateToOperator("refract", EOpRefract); - - symbolTable.relateToOperator("any", EOpAny); - symbolTable.relateToOperator("all", EOpAll); - - symbolTable.relateToOperator("barrier", EOpBarrier); - symbolTable.relateToOperator("memoryBarrier", EOpMemoryBarrier); - symbolTable.relateToOperator("memoryBarrierAtomicCounter", EOpMemoryBarrierAtomicCounter); - symbolTable.relateToOperator("memoryBarrierBuffer", EOpMemoryBarrierBuffer); - symbolTable.relateToOperator("memoryBarrierImage", EOpMemoryBarrierImage); - - symbolTable.relateToOperator("atomicAdd", EOpAtomicAdd); - symbolTable.relateToOperator("atomicMin", EOpAtomicMin); - symbolTable.relateToOperator("atomicMax", EOpAtomicMax); - symbolTable.relateToOperator("atomicAnd", EOpAtomicAnd); - symbolTable.relateToOperator("atomicOr", EOpAtomicOr); - symbolTable.relateToOperator("atomicXor", EOpAtomicXor); - symbolTable.relateToOperator("atomicExchange", EOpAtomicExchange); - symbolTable.relateToOperator("atomicCompSwap", EOpAtomicCompSwap); - - symbolTable.relateToOperator("atomicCounterIncrement", EOpAtomicCounterIncrement); - symbolTable.relateToOperator("atomicCounterDecrement", EOpAtomicCounterDecrement); - symbolTable.relateToOperator("atomicCounter", EOpAtomicCounter); - - if (profile != EEsProfile && version >= 460) { - symbolTable.relateToOperator("atomicCounterAdd", EOpAtomicCounterAdd); - symbolTable.relateToOperator("atomicCounterSubtract", EOpAtomicCounterSubtract); - symbolTable.relateToOperator("atomicCounterMin", EOpAtomicCounterMin); - symbolTable.relateToOperator("atomicCounterMax", EOpAtomicCounterMax); - symbolTable.relateToOperator("atomicCounterAnd", EOpAtomicCounterAnd); - symbolTable.relateToOperator("atomicCounterOr", EOpAtomicCounterOr); - symbolTable.relateToOperator("atomicCounterXor", EOpAtomicCounterXor); - symbolTable.relateToOperator("atomicCounterExchange", EOpAtomicCounterExchange); - symbolTable.relateToOperator("atomicCounterCompSwap", EOpAtomicCounterCompSwap); - } - - symbolTable.relateToOperator("fma", EOpFma); - symbolTable.relateToOperator("frexp", EOpFrexp); - symbolTable.relateToOperator("ldexp", EOpLdexp); - symbolTable.relateToOperator("uaddCarry", EOpAddCarry); - symbolTable.relateToOperator("usubBorrow", EOpSubBorrow); - symbolTable.relateToOperator("umulExtended", EOpUMulExtended); - symbolTable.relateToOperator("imulExtended", EOpIMulExtended); - symbolTable.relateToOperator("bitfieldExtract", EOpBitfieldExtract); - symbolTable.relateToOperator("bitfieldInsert", EOpBitfieldInsert); - symbolTable.relateToOperator("bitfieldReverse", EOpBitFieldReverse); - symbolTable.relateToOperator("bitCount", EOpBitCount); - symbolTable.relateToOperator("findLSB", EOpFindLSB); - symbolTable.relateToOperator("findMSB", EOpFindMSB); - - if (PureOperatorBuiltins) { - symbolTable.relateToOperator("imageSize", EOpImageQuerySize); - symbolTable.relateToOperator("imageSamples", EOpImageQuerySamples); - symbolTable.relateToOperator("imageLoad", EOpImageLoad); - symbolTable.relateToOperator("imageStore", EOpImageStore); - symbolTable.relateToOperator("imageAtomicAdd", EOpImageAtomicAdd); - symbolTable.relateToOperator("imageAtomicMin", EOpImageAtomicMin); - symbolTable.relateToOperator("imageAtomicMax", EOpImageAtomicMax); - symbolTable.relateToOperator("imageAtomicAnd", EOpImageAtomicAnd); - symbolTable.relateToOperator("imageAtomicOr", EOpImageAtomicOr); - symbolTable.relateToOperator("imageAtomicXor", EOpImageAtomicXor); - symbolTable.relateToOperator("imageAtomicExchange", EOpImageAtomicExchange); - symbolTable.relateToOperator("imageAtomicCompSwap", EOpImageAtomicCompSwap); - - symbolTable.relateToOperator("subpassLoad", EOpSubpassLoad); - symbolTable.relateToOperator("subpassLoadMS", EOpSubpassLoadMS); - - symbolTable.relateToOperator("textureSize", EOpTextureQuerySize); - symbolTable.relateToOperator("textureQueryLod", EOpTextureQueryLod); - symbolTable.relateToOperator("textureQueryLevels", EOpTextureQueryLevels); - symbolTable.relateToOperator("textureSamples", EOpTextureQuerySamples); - symbolTable.relateToOperator("texture", EOpTexture); - symbolTable.relateToOperator("textureProj", EOpTextureProj); - symbolTable.relateToOperator("textureLod", EOpTextureLod); - symbolTable.relateToOperator("textureOffset", EOpTextureOffset); - symbolTable.relateToOperator("texelFetch", EOpTextureFetch); - symbolTable.relateToOperator("texelFetchOffset", EOpTextureFetchOffset); - symbolTable.relateToOperator("textureProjOffset", EOpTextureProjOffset); - symbolTable.relateToOperator("textureLodOffset", EOpTextureLodOffset); - symbolTable.relateToOperator("textureProjLod", EOpTextureProjLod); - symbolTable.relateToOperator("textureProjLodOffset", EOpTextureProjLodOffset); - symbolTable.relateToOperator("textureGrad", EOpTextureGrad); - symbolTable.relateToOperator("textureGradOffset", EOpTextureGradOffset); - symbolTable.relateToOperator("textureProjGrad", EOpTextureProjGrad); - symbolTable.relateToOperator("textureProjGradOffset", EOpTextureProjGradOffset); - symbolTable.relateToOperator("textureGather", EOpTextureGather); - symbolTable.relateToOperator("textureGatherOffset", EOpTextureGatherOffset); - symbolTable.relateToOperator("textureGatherOffsets", EOpTextureGatherOffsets); - - symbolTable.relateToOperator("noise1", EOpNoise); - symbolTable.relateToOperator("noise2", EOpNoise); - symbolTable.relateToOperator("noise3", EOpNoise); - symbolTable.relateToOperator("noise4", EOpNoise); - - if (spvVersion.spv == 0 && (IncludeLegacy(version, profile, spvVersion) || - (profile == EEsProfile && version == 100))) { - symbolTable.relateToOperator("ftransform", EOpFtransform); - - symbolTable.relateToOperator("texture1D", EOpTexture); - symbolTable.relateToOperator("texture1DGradARB", EOpTextureGrad); - symbolTable.relateToOperator("texture1DProj", EOpTextureProj); - symbolTable.relateToOperator("texture1DProjGradARB", EOpTextureProjGrad); - symbolTable.relateToOperator("texture1DLod", EOpTextureLod); - symbolTable.relateToOperator("texture1DProjLod", EOpTextureProjLod); - - symbolTable.relateToOperator("texture2DRect", EOpTexture); - symbolTable.relateToOperator("texture2DRectProj", EOpTextureProj); - symbolTable.relateToOperator("texture2DRectGradARB", EOpTextureGrad); - symbolTable.relateToOperator("texture2DRectProjGradARB", EOpTextureProjGrad); - symbolTable.relateToOperator("shadow2DRect", EOpTexture); - symbolTable.relateToOperator("shadow2DRectProj", EOpTextureProj); - symbolTable.relateToOperator("shadow2DRectGradARB", EOpTextureGrad); - symbolTable.relateToOperator("shadow2DRectProjGradARB", EOpTextureProjGrad); - - symbolTable.relateToOperator("texture2D", EOpTexture); - symbolTable.relateToOperator("texture2DProj", EOpTextureProj); - symbolTable.relateToOperator("texture2DGradEXT", EOpTextureGrad); - symbolTable.relateToOperator("texture2DGradARB", EOpTextureGrad); - symbolTable.relateToOperator("texture2DProjGradEXT", EOpTextureProjGrad); - symbolTable.relateToOperator("texture2DProjGradARB", EOpTextureProjGrad); - symbolTable.relateToOperator("texture2DLod", EOpTextureLod); - symbolTable.relateToOperator("texture2DLodEXT", EOpTextureLod); - symbolTable.relateToOperator("texture2DProjLod", EOpTextureProjLod); - symbolTable.relateToOperator("texture2DProjLodEXT", EOpTextureProjLod); - - symbolTable.relateToOperator("texture1DArray", EOpTexture); - symbolTable.relateToOperator("texture2DArray", EOpTexture); - symbolTable.relateToOperator("shadow1DArray", EOpTexture); - symbolTable.relateToOperator("shadow2DArray", EOpTexture); - symbolTable.relateToOperator("texture1DArrayLod", EOpTextureLod); - symbolTable.relateToOperator("texture2DArrayLod", EOpTextureLod); - symbolTable.relateToOperator("shadow1DArrayLod", EOpTextureLod); - symbolTable.relateToOperator("shadow2DArrayLod", EOpTextureLod); - - symbolTable.relateToOperator("texture3D", EOpTexture); - symbolTable.relateToOperator("texture3DGradARB", EOpTextureGrad); - symbolTable.relateToOperator("texture3DProj", EOpTextureProj); - symbolTable.relateToOperator("texture3DProjGradARB", EOpTextureProjGrad); - symbolTable.relateToOperator("texture3DLod", EOpTextureLod); - symbolTable.relateToOperator("texture3DProjLod", EOpTextureProjLod); - symbolTable.relateToOperator("textureCube", EOpTexture); - symbolTable.relateToOperator("textureCubeGradEXT", EOpTextureGrad); - symbolTable.relateToOperator("textureCubeGradARB", EOpTextureGrad); - symbolTable.relateToOperator("textureCubeLod", EOpTextureLod); - symbolTable.relateToOperator("textureCubeLodEXT", EOpTextureLod); - symbolTable.relateToOperator("shadow1D", EOpTexture); - symbolTable.relateToOperator("shadow1DGradARB", EOpTextureGrad); - symbolTable.relateToOperator("shadow2D", EOpTexture); - symbolTable.relateToOperator("shadow2DGradARB", EOpTextureGrad); - symbolTable.relateToOperator("shadow1DProj", EOpTextureProj); - symbolTable.relateToOperator("shadow2DProj", EOpTextureProj); - symbolTable.relateToOperator("shadow1DProjGradARB", EOpTextureProjGrad); - symbolTable.relateToOperator("shadow2DProjGradARB", EOpTextureProjGrad); - symbolTable.relateToOperator("shadow1DLod", EOpTextureLod); - symbolTable.relateToOperator("shadow2DLod", EOpTextureLod); - symbolTable.relateToOperator("shadow1DProjLod", EOpTextureProjLod); - symbolTable.relateToOperator("shadow2DProjLod", EOpTextureProjLod); - } - - if (profile != EEsProfile) { - symbolTable.relateToOperator("sparseTextureARB", EOpSparseTexture); - symbolTable.relateToOperator("sparseTextureLodARB", EOpSparseTextureLod); - symbolTable.relateToOperator("sparseTextureOffsetARB", EOpSparseTextureOffset); - symbolTable.relateToOperator("sparseTexelFetchARB", EOpSparseTextureFetch); - symbolTable.relateToOperator("sparseTexelFetchOffsetARB", EOpSparseTextureFetchOffset); - symbolTable.relateToOperator("sparseTextureLodOffsetARB", EOpSparseTextureLodOffset); - symbolTable.relateToOperator("sparseTextureGradARB", EOpSparseTextureGrad); - symbolTable.relateToOperator("sparseTextureGradOffsetARB", EOpSparseTextureGradOffset); - symbolTable.relateToOperator("sparseTextureGatherARB", EOpSparseTextureGather); - symbolTable.relateToOperator("sparseTextureGatherOffsetARB", EOpSparseTextureGatherOffset); - symbolTable.relateToOperator("sparseTextureGatherOffsetsARB", EOpSparseTextureGatherOffsets); - symbolTable.relateToOperator("sparseImageLoadARB", EOpSparseImageLoad); - symbolTable.relateToOperator("sparseTexelsResidentARB", EOpSparseTexelsResident); - - symbolTable.relateToOperator("sparseTextureClampARB", EOpSparseTextureClamp); - symbolTable.relateToOperator("sparseTextureOffsetClampARB", EOpSparseTextureOffsetClamp); - symbolTable.relateToOperator("sparseTextureGradClampARB", EOpSparseTextureGradClamp); - symbolTable.relateToOperator("sparseTextureGradOffsetClampARB", EOpSparseTextureGradOffsetClamp); - symbolTable.relateToOperator("textureClampARB", EOpTextureClamp); - symbolTable.relateToOperator("textureOffsetClampARB", EOpTextureOffsetClamp); - symbolTable.relateToOperator("textureGradClampARB", EOpTextureGradClamp); - symbolTable.relateToOperator("textureGradOffsetClampARB", EOpTextureGradOffsetClamp); - - symbolTable.relateToOperator("ballotARB", EOpBallot); - symbolTable.relateToOperator("readInvocationARB", EOpReadInvocation); - symbolTable.relateToOperator("readFirstInvocationARB", EOpReadFirstInvocation); - - if (version >= 430) { - symbolTable.relateToOperator("anyInvocationARB", EOpAnyInvocation); - symbolTable.relateToOperator("allInvocationsARB", EOpAllInvocations); - symbolTable.relateToOperator("allInvocationsEqualARB", EOpAllInvocationsEqual); - } - if (version >= 460) { - symbolTable.relateToOperator("anyInvocation", EOpAnyInvocation); - symbolTable.relateToOperator("allInvocations", EOpAllInvocations); - symbolTable.relateToOperator("allInvocationsEqual", EOpAllInvocationsEqual); - } -#ifdef AMD_EXTENSIONS - symbolTable.relateToOperator("minInvocationsAMD", EOpMinInvocations); - symbolTable.relateToOperator("maxInvocationsAMD", EOpMaxInvocations); - symbolTable.relateToOperator("addInvocationsAMD", EOpAddInvocations); - symbolTable.relateToOperator("minInvocationsNonUniformAMD", EOpMinInvocationsNonUniform); - symbolTable.relateToOperator("maxInvocationsNonUniformAMD", EOpMaxInvocationsNonUniform); - symbolTable.relateToOperator("addInvocationsNonUniformAMD", EOpAddInvocationsNonUniform); - symbolTable.relateToOperator("minInvocationsInclusiveScanAMD", EOpMinInvocationsInclusiveScan); - symbolTable.relateToOperator("maxInvocationsInclusiveScanAMD", EOpMaxInvocationsInclusiveScan); - symbolTable.relateToOperator("addInvocationsInclusiveScanAMD", EOpAddInvocationsInclusiveScan); - symbolTable.relateToOperator("minInvocationsInclusiveScanNonUniformAMD", EOpMinInvocationsInclusiveScanNonUniform); - symbolTable.relateToOperator("maxInvocationsInclusiveScanNonUniformAMD", EOpMaxInvocationsInclusiveScanNonUniform); - symbolTable.relateToOperator("addInvocationsInclusiveScanNonUniformAMD", EOpAddInvocationsInclusiveScanNonUniform); - symbolTable.relateToOperator("minInvocationsExclusiveScanAMD", EOpMinInvocationsExclusiveScan); - symbolTable.relateToOperator("maxInvocationsExclusiveScanAMD", EOpMaxInvocationsExclusiveScan); - symbolTable.relateToOperator("addInvocationsExclusiveScanAMD", EOpAddInvocationsExclusiveScan); - symbolTable.relateToOperator("minInvocationsExclusiveScanNonUniformAMD", EOpMinInvocationsExclusiveScanNonUniform); - symbolTable.relateToOperator("maxInvocationsExclusiveScanNonUniformAMD", EOpMaxInvocationsExclusiveScanNonUniform); - symbolTable.relateToOperator("addInvocationsExclusiveScanNonUniformAMD", EOpAddInvocationsExclusiveScanNonUniform); - symbolTable.relateToOperator("swizzleInvocationsAMD", EOpSwizzleInvocations); - symbolTable.relateToOperator("swizzleInvocationsMaskedAMD", EOpSwizzleInvocationsMasked); - symbolTable.relateToOperator("writeInvocationAMD", EOpWriteInvocation); - symbolTable.relateToOperator("mbcntAMD", EOpMbcnt); - - symbolTable.relateToOperator("min3", EOpMin3); - symbolTable.relateToOperator("max3", EOpMax3); - symbolTable.relateToOperator("mid3", EOpMid3); - - symbolTable.relateToOperator("cubeFaceIndexAMD", EOpCubeFaceIndex); - symbolTable.relateToOperator("cubeFaceCoordAMD", EOpCubeFaceCoord); - symbolTable.relateToOperator("timeAMD", EOpTime); - - symbolTable.relateToOperator("textureGatherLodAMD", EOpTextureGatherLod); - symbolTable.relateToOperator("textureGatherLodOffsetAMD", EOpTextureGatherLodOffset); - symbolTable.relateToOperator("textureGatherLodOffsetsAMD", EOpTextureGatherLodOffsets); - symbolTable.relateToOperator("sparseTextureGatherLodAMD", EOpSparseTextureGatherLod); - symbolTable.relateToOperator("sparseTextureGatherLodOffsetAMD", EOpSparseTextureGatherLodOffset); - symbolTable.relateToOperator("sparseTextureGatherLodOffsetsAMD", EOpSparseTextureGatherLodOffsets); - - symbolTable.relateToOperator("imageLoadLodAMD", EOpImageLoadLod); - symbolTable.relateToOperator("imageStoreLodAMD", EOpImageStoreLod); - symbolTable.relateToOperator("sparseImageLoadLodAMD", EOpSparseImageLoadLod); - - symbolTable.relateToOperator("fragmentMaskFetchAMD", EOpFragmentMaskFetch); - symbolTable.relateToOperator("fragmentFetchAMD", EOpFragmentFetch); -#endif - } - if (profile == EEsProfile) { - symbolTable.relateToOperator("shadow2DEXT", EOpTexture); - symbolTable.relateToOperator("shadow2DProjEXT", EOpTextureProj); - } - } - - switch(language) { - case EShLangVertex: - break; - - case EShLangTessControl: - case EShLangTessEvaluation: - break; - - case EShLangGeometry: - symbolTable.relateToOperator("EmitStreamVertex", EOpEmitStreamVertex); - symbolTable.relateToOperator("EndStreamPrimitive", EOpEndStreamPrimitive); - symbolTable.relateToOperator("EmitVertex", EOpEmitVertex); - symbolTable.relateToOperator("EndPrimitive", EOpEndPrimitive); - break; - - case EShLangFragment: - symbolTable.relateToOperator("dFdx", EOpDPdx); - symbolTable.relateToOperator("dFdy", EOpDPdy); - symbolTable.relateToOperator("fwidth", EOpFwidth); - if (profile != EEsProfile && version >= 400) { - symbolTable.relateToOperator("dFdxFine", EOpDPdxFine); - symbolTable.relateToOperator("dFdyFine", EOpDPdyFine); - symbolTable.relateToOperator("fwidthFine", EOpFwidthFine); - symbolTable.relateToOperator("dFdxCoarse", EOpDPdxCoarse); - symbolTable.relateToOperator("dFdyCoarse", EOpDPdyCoarse); - symbolTable.relateToOperator("fwidthCoarse", EOpFwidthCoarse); - } - symbolTable.relateToOperator("interpolateAtCentroid", EOpInterpolateAtCentroid); - symbolTable.relateToOperator("interpolateAtSample", EOpInterpolateAtSample); - symbolTable.relateToOperator("interpolateAtOffset", EOpInterpolateAtOffset); - -#ifdef AMD_EXTENSIONS - if (profile != EEsProfile) - symbolTable.relateToOperator("interpolateAtVertexAMD", EOpInterpolateAtVertex); - break; -#endif - - case EShLangCompute: - symbolTable.relateToOperator("memoryBarrierShared", EOpMemoryBarrierShared); - symbolTable.relateToOperator("groupMemoryBarrier", EOpGroupMemoryBarrier); - break; - - default: - assert(false && "Language not supported"); - } -} - -// -// Add context-dependent (resource-specific) built-ins not handled by the above. These -// would be ones that need to be programmatically added because they cannot -// be added by simple text strings. For these, also -// 1) Map built-in functions to operators, for those that will turn into an operation node -// instead of remaining a function call. -// 2) Tag extension-related symbols added to their base version with their extensions, so -// that if an early version has the extension turned off, there is an error reported on use. -// -void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources) -{ - if (profile != EEsProfile && version >= 430 && version < 440) { - symbolTable.setVariableExtensions("gl_MaxTransformFeedbackBuffers", 1, &E_GL_ARB_enhanced_layouts); - symbolTable.setVariableExtensions("gl_MaxTransformFeedbackInterleavedComponents", 1, &E_GL_ARB_enhanced_layouts); - } - if (profile != EEsProfile && version >= 130 && version < 420) { - symbolTable.setVariableExtensions("gl_MinProgramTexelOffset", 1, &E_GL_ARB_shading_language_420pack); - symbolTable.setVariableExtensions("gl_MaxProgramTexelOffset", 1, &E_GL_ARB_shading_language_420pack); - } - if (profile != EEsProfile && version >= 150 && version < 410) - symbolTable.setVariableExtensions("gl_MaxViewports", 1, &E_GL_ARB_viewport_array); - - switch(language) { - case EShLangFragment: - // Set up gl_FragData based on current array size. - if (version == 100 || IncludeLegacy(version, profile, spvVersion) || (! ForwardCompatibility && profile != EEsProfile && version < 420)) { - TPrecisionQualifier pq = profile == EEsProfile ? EpqMedium : EpqNone; - TType fragData(EbtFloat, EvqFragColor, pq, 4); - TArraySizes& arraySizes = *new TArraySizes; - arraySizes.addInnerSize(resources.maxDrawBuffers); - fragData.newArraySizes(arraySizes); - symbolTable.insert(*new TVariable(NewPoolTString("gl_FragData"), fragData)); - SpecialQualifier("gl_FragData", EvqFragColor, EbvFragData, symbolTable); - } - break; - - case EShLangTessControl: - case EShLangTessEvaluation: - // Because of the context-dependent array size (gl_MaxPatchVertices), - // these variables were added later than the others and need to be mapped now. - - // standard members - BuiltInVariable("gl_in", "gl_Position", EbvPosition, symbolTable); - BuiltInVariable("gl_in", "gl_PointSize", EbvPointSize, symbolTable); - BuiltInVariable("gl_in", "gl_ClipDistance", EbvClipDistance, symbolTable); - BuiltInVariable("gl_in", "gl_CullDistance", EbvCullDistance, symbolTable); - - // compatibility members - BuiltInVariable("gl_in", "gl_ClipVertex", EbvClipVertex, symbolTable); - BuiltInVariable("gl_in", "gl_FrontColor", EbvFrontColor, symbolTable); - BuiltInVariable("gl_in", "gl_BackColor", EbvBackColor, symbolTable); - BuiltInVariable("gl_in", "gl_FrontSecondaryColor", EbvFrontSecondaryColor, symbolTable); - BuiltInVariable("gl_in", "gl_BackSecondaryColor", EbvBackSecondaryColor, symbolTable); - BuiltInVariable("gl_in", "gl_TexCoord", EbvTexCoord, symbolTable); - BuiltInVariable("gl_in", "gl_FogFragCoord", EbvFogFragCoord, symbolTable); - break; - - default: - break; - } -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Initialize.h b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Initialize.h deleted file mode 100644 index 6b54c4da..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Initialize.h +++ /dev/null @@ -1,112 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2013-2016 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#ifndef _INITIALIZE_INCLUDED_ -#define _INITIALIZE_INCLUDED_ - -#include "../Include/ResourceLimits.h" -#include "../Include/Common.h" -#include "../Include/ShHandle.h" -#include "SymbolTable.h" -#include "Versions.h" - -namespace glslang { - -// -// This is made to hold parseable strings for almost all the built-in -// functions and variables for one specific combination of version -// and profile. (Some still need to be added programmatically.) -// This is a base class for language-specific derivations, which -// can be used for language independent builtins. -// -// The strings are organized by -// commonBuiltins: intersection of all stages' built-ins, processed just once -// stageBuiltins[]: anything a stage needs that's not in commonBuiltins -// -class TBuiltInParseables { -public: - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - TBuiltInParseables(); - virtual ~TBuiltInParseables(); - virtual void initialize(int version, EProfile, const SpvVersion& spvVersion) = 0; - virtual void initialize(const TBuiltInResource& resources, int version, EProfile, const SpvVersion& spvVersion, EShLanguage) = 0; - virtual const TString& getCommonString() const { return commonBuiltins; } - virtual const TString& getStageString(EShLanguage language) const { return stageBuiltins[language]; } - - virtual void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable) = 0; - - virtual void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources) = 0; - -protected: - TString commonBuiltins; - TString stageBuiltins[EShLangCount]; -}; - -// -// This is a GLSL specific derivation of TBuiltInParseables. To present a stable -// interface and match other similar code, it is called TBuiltIns, rather -// than TBuiltInParseablesGlsl. -// -class TBuiltIns : public TBuiltInParseables { -public: - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - TBuiltIns(); - virtual ~TBuiltIns(); - void initialize(int version, EProfile, const SpvVersion& spvVersion); - void initialize(const TBuiltInResource& resources, int version, EProfile, const SpvVersion& spvVersion, EShLanguage); - - void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable); - - void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources); - -protected: - void add2ndGenerationSamplingImaging(int version, EProfile profile, const SpvVersion& spvVersion); - void addSubpassSampling(TSampler, const TString& typeName, int version, EProfile profile); - void addQueryFunctions(TSampler, const TString& typeName, int version, EProfile profile); - void addImageFunctions(TSampler, const TString& typeName, int version, EProfile profile); - void addSamplingFunctions(TSampler, const TString& typeName, int version, EProfile profile); - void addGatherFunctions(TSampler, const TString& typeName, int version, EProfile profile); - - // Helpers for making textual representations of the permutations - // of texturing/imaging functions. - const char* postfixes[5]; - const char* prefixes[EbtNumTypes]; - int dimMap[EsdNumDims]; -}; - -} // end namespace glslang - -#endif // _INITIALIZE_INCLUDED_ diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/IntermTraverse.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/IntermTraverse.cpp deleted file mode 100644 index f46010b7..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/IntermTraverse.cpp +++ /dev/null @@ -1,302 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2013 LunarG, Inc. -// Copyright (c) 2002-2010 The ANGLE Project Authors. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#include "../Include/intermediate.h" - -namespace glslang { - -// -// Traverse the intermediate representation tree, and -// call a node type specific function for each node. -// Done recursively through the member function Traverse(). -// Node types can be skipped if their function to call is 0, -// but their subtree will still be traversed. -// Nodes with children can have their whole subtree skipped -// if preVisit is turned on and the type specific function -// returns false. -// -// preVisit, postVisit, and rightToLeft control what order -// nodes are visited in. -// - -// -// Traversal functions for terminals are straightforward.... -// -void TIntermMethod::traverse(TIntermTraverser*) -{ - // Tree should always resolve all methods as a non-method. -} - -void TIntermSymbol::traverse(TIntermTraverser *it) -{ - it->visitSymbol(this); -} - -void TIntermConstantUnion::traverse(TIntermTraverser *it) -{ - it->visitConstantUnion(this); -} - -// -// Traverse a binary node. -// -void TIntermBinary::traverse(TIntermTraverser *it) -{ - bool visit = true; - - // - // visit the node before children if pre-visiting. - // - if (it->preVisit) - visit = it->visitBinary(EvPreVisit, this); - - // - // Visit the children, in the right order. - // - if (visit) { - it->incrementDepth(this); - - if (it->rightToLeft) { - if (right) - right->traverse(it); - - if (it->inVisit) - visit = it->visitBinary(EvInVisit, this); - - if (visit && left) - left->traverse(it); - } else { - if (left) - left->traverse(it); - - if (it->inVisit) - visit = it->visitBinary(EvInVisit, this); - - if (visit && right) - right->traverse(it); - } - - it->decrementDepth(); - } - - // - // Visit the node after the children, if requested and the traversal - // hasn't been canceled yet. - // - if (visit && it->postVisit) - it->visitBinary(EvPostVisit, this); -} - -// -// Traverse a unary node. Same comments in binary node apply here. -// -void TIntermUnary::traverse(TIntermTraverser *it) -{ - bool visit = true; - - if (it->preVisit) - visit = it->visitUnary(EvPreVisit, this); - - if (visit) { - it->incrementDepth(this); - operand->traverse(it); - it->decrementDepth(); - } - - if (visit && it->postVisit) - it->visitUnary(EvPostVisit, this); -} - -// -// Traverse an aggregate node. Same comments in binary node apply here. -// -void TIntermAggregate::traverse(TIntermTraverser *it) -{ - bool visit = true; - - if (it->preVisit) - visit = it->visitAggregate(EvPreVisit, this); - - if (visit) { - it->incrementDepth(this); - - if (it->rightToLeft) { - for (TIntermSequence::reverse_iterator sit = sequence.rbegin(); sit != sequence.rend(); sit++) { - (*sit)->traverse(it); - - if (visit && it->inVisit) { - if (*sit != sequence.front()) - visit = it->visitAggregate(EvInVisit, this); - } - } - } else { - for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++) { - (*sit)->traverse(it); - - if (visit && it->inVisit) { - if (*sit != sequence.back()) - visit = it->visitAggregate(EvInVisit, this); - } - } - } - - it->decrementDepth(); - } - - if (visit && it->postVisit) - it->visitAggregate(EvPostVisit, this); -} - -// -// Traverse a selection node. Same comments in binary node apply here. -// -void TIntermSelection::traverse(TIntermTraverser *it) -{ - bool visit = true; - - if (it->preVisit) - visit = it->visitSelection(EvPreVisit, this); - - if (visit) { - it->incrementDepth(this); - if (it->rightToLeft) { - if (falseBlock) - falseBlock->traverse(it); - if (trueBlock) - trueBlock->traverse(it); - condition->traverse(it); - } else { - condition->traverse(it); - if (trueBlock) - trueBlock->traverse(it); - if (falseBlock) - falseBlock->traverse(it); - } - it->decrementDepth(); - } - - if (visit && it->postVisit) - it->visitSelection(EvPostVisit, this); -} - -// -// Traverse a loop node. Same comments in binary node apply here. -// -void TIntermLoop::traverse(TIntermTraverser *it) -{ - bool visit = true; - - if (it->preVisit) - visit = it->visitLoop(EvPreVisit, this); - - if (visit) { - it->incrementDepth(this); - - if (it->rightToLeft) { - if (terminal) - terminal->traverse(it); - - if (body) - body->traverse(it); - - if (test) - test->traverse(it); - } else { - if (test) - test->traverse(it); - - if (body) - body->traverse(it); - - if (terminal) - terminal->traverse(it); - } - - it->decrementDepth(); - } - - if (visit && it->postVisit) - it->visitLoop(EvPostVisit, this); -} - -// -// Traverse a branch node. Same comments in binary node apply here. -// -void TIntermBranch::traverse(TIntermTraverser *it) -{ - bool visit = true; - - if (it->preVisit) - visit = it->visitBranch(EvPreVisit, this); - - if (visit && expression) { - it->incrementDepth(this); - expression->traverse(it); - it->decrementDepth(); - } - - if (visit && it->postVisit) - it->visitBranch(EvPostVisit, this); -} - -// -// Traverse a switch node. -// -void TIntermSwitch::traverse(TIntermTraverser* it) -{ - bool visit = true; - - if (it->preVisit) - visit = it->visitSwitch(EvPreVisit, this); - - if (visit) { - it->incrementDepth(this); - if (it->rightToLeft) { - body->traverse(it); - condition->traverse(it); - } else { - condition->traverse(it); - body->traverse(it); - } - it->decrementDepth(); - } - - if (visit && it->postVisit) - it->visitSwitch(EvPostVisit, this); -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Intermediate.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Intermediate.cpp deleted file mode 100644 index 21899abe..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Intermediate.cpp +++ /dev/null @@ -1,3246 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2012-2015 LunarG, Inc. -// Copyright (C) 2015-2016 Google, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -// -// Build the intermediate representation. -// - -#include "localintermediate.h" -#include "RemoveTree.h" -#include "SymbolTable.h" -#include "propagateNoContraction.h" - -#include -#include - -namespace glslang { - -//////////////////////////////////////////////////////////////////////////// -// -// First set of functions are to help build the intermediate representation. -// These functions are not member functions of the nodes. -// They are called from parser productions. -// -///////////////////////////////////////////////////////////////////////////// - -// -// Add a terminal node for an identifier in an expression. -// -// Returns the added node. -// - -TIntermSymbol* TIntermediate::addSymbol(int id, const TString& name, const TType& type, const TConstUnionArray& constArray, - TIntermTyped* constSubtree, const TSourceLoc& loc) -{ - TIntermSymbol* node = new TIntermSymbol(id, name, type); - node->setLoc(loc); - node->setConstArray(constArray); - node->setConstSubtree(constSubtree); - - return node; -} - -TIntermSymbol* TIntermediate::addSymbol(const TIntermSymbol& intermSymbol) -{ - return addSymbol(intermSymbol.getId(), - intermSymbol.getName(), - intermSymbol.getType(), - intermSymbol.getConstArray(), - intermSymbol.getConstSubtree(), - intermSymbol.getLoc()); -} - -TIntermSymbol* TIntermediate::addSymbol(const TVariable& variable) -{ - glslang::TSourceLoc loc; // just a null location - loc.init(); - - return addSymbol(variable, loc); -} - -TIntermSymbol* TIntermediate::addSymbol(const TVariable& variable, const TSourceLoc& loc) -{ - return addSymbol(variable.getUniqueId(), variable.getName(), variable.getType(), variable.getConstArray(), variable.getConstSubtree(), loc); -} - -TIntermSymbol* TIntermediate::addSymbol(const TType& type, const TSourceLoc& loc) -{ - TConstUnionArray unionArray; // just a null constant - - return addSymbol(0, "", type, unionArray, nullptr, loc); -} - -// -// Connect two nodes with a new parent that does a binary operation on the nodes. -// -// Returns the added node. -// -// Returns nullptr if the working conversions and promotions could not be found. -// -TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc loc) -{ - // No operations work on blocks - if (left->getType().getBasicType() == EbtBlock || right->getType().getBasicType() == EbtBlock) - return nullptr; - - // Try converting the children's base types to compatible types. - TIntermTyped* child = addConversion(op, left->getType(), right); - if (child) - right = child; - else { - child = addConversion(op, right->getType(), left); - if (child) - left = child; - else - return nullptr; - } - - // Convert the children's type shape to be compatible. - addBiShapeConversion(op, left, right); - if (left == nullptr || right == nullptr) - return nullptr; - - // - // Need a new node holding things together. Make - // one and promote it to the right type. - // - TIntermBinary* node = addBinaryNode(op, left, right, loc); - if (! promote(node)) - return nullptr; - - node->updatePrecision(); - - // - // If they are both (non-specialization) constants, they must be folded. - // (Unless it's the sequence (comma) operator, but that's handled in addComma().) - // - TIntermConstantUnion *leftTempConstant = node->getLeft()->getAsConstantUnion(); - TIntermConstantUnion *rightTempConstant = node->getRight()->getAsConstantUnion(); - if (leftTempConstant && rightTempConstant) { - TIntermTyped* folded = leftTempConstant->fold(node->getOp(), rightTempConstant); - if (folded) - return folded; - } - - // If can propagate spec-constantness and if the operation is an allowed - // specialization-constant operation, make a spec-constant. - if (specConstantPropagates(*node->getLeft(), *node->getRight()) && isSpecializationOperation(*node)) - node->getWritableType().getQualifier().makeSpecConstant(); - - return node; -} - -// -// Low level: add binary node (no promotions or other argument modifications) -// -TIntermBinary* TIntermediate::addBinaryNode(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc loc) const -{ - // build the node - TIntermBinary* node = new TIntermBinary(op); - if (loc.line == 0) - loc = left->getLoc(); - node->setLoc(loc); - node->setLeft(left); - node->setRight(right); - - return node; -} - -// -// like non-type form, but sets node's type. -// -TIntermBinary* TIntermediate::addBinaryNode(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc loc, const TType& type) const -{ - TIntermBinary* node = addBinaryNode(op, left, right, loc); - node->setType(type); - return node; -} - -// -// Low level: add unary node (no promotions or other argument modifications) -// -TIntermUnary* TIntermediate::addUnaryNode(TOperator op, TIntermTyped* child, TSourceLoc loc) const -{ - TIntermUnary* node = new TIntermUnary(op); - if (loc.line == 0) - loc = child->getLoc(); - node->setLoc(loc); - node->setOperand(child); - - return node; -} - -// -// like non-type form, but sets node's type. -// -TIntermUnary* TIntermediate::addUnaryNode(TOperator op, TIntermTyped* child, TSourceLoc loc, const TType& type) const -{ - TIntermUnary* node = addUnaryNode(op, child, loc); - node->setType(type); - return node; -} - -// -// Connect two nodes through an assignment. -// -// Returns the added node. -// -// Returns nullptr if the 'right' type could not be converted to match the 'left' type, -// or the resulting operation cannot be properly promoted. -// -TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc loc) -{ - // No block assignment - if (left->getType().getBasicType() == EbtBlock || right->getType().getBasicType() == EbtBlock) - return nullptr; - - // - // Like adding binary math, except the conversion can only go - // from right to left. - // - - // convert base types, nullptr return means not possible - right = addConversion(op, left->getType(), right); - if (right == nullptr) - return nullptr; - - // convert shape - right = addUniShapeConversion(op, left->getType(), right); - - // build the node - TIntermBinary* node = addBinaryNode(op, left, right, loc); - - if (! promote(node)) - return nullptr; - - node->updatePrecision(); - - return node; -} - -// -// Connect two nodes through an index operator, where the left node is the base -// of an array or struct, and the right node is a direct or indirect offset. -// -// Returns the added node. -// The caller should set the type of the returned node. -// -TIntermTyped* TIntermediate::addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, TSourceLoc loc) -{ - // caller should set the type - return addBinaryNode(op, base, index, loc); -} - -// -// Add one node as the parent of another that it operates on. -// -// Returns the added node. -// -TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSourceLoc loc) -{ - if (child == 0) - return nullptr; - - if (child->getType().getBasicType() == EbtBlock) - return nullptr; - - switch (op) { - case EOpLogicalNot: - if (source == EShSourceHlsl) { - break; // HLSL can promote logical not - } - - if (child->getType().getBasicType() != EbtBool || child->getType().isMatrix() || child->getType().isArray() || child->getType().isVector()) { - return nullptr; - } - break; - - case EOpPostIncrement: - case EOpPreIncrement: - case EOpPostDecrement: - case EOpPreDecrement: - case EOpNegative: - if (child->getType().getBasicType() == EbtStruct || child->getType().isArray()) - return nullptr; - default: break; // some compilers want this - } - - // - // Do we need to promote the operand? - // - TBasicType newType = EbtVoid; - switch (op) { - case EOpConstructInt: newType = EbtInt; break; - case EOpConstructUint: newType = EbtUint; break; - case EOpConstructInt64: newType = EbtInt64; break; - case EOpConstructUint64: newType = EbtUint64; break; -#ifdef AMD_EXTENSIONS - case EOpConstructInt16: newType = EbtInt16; break; - case EOpConstructUint16: newType = EbtUint16; break; -#endif - case EOpConstructBool: newType = EbtBool; break; - case EOpConstructFloat: newType = EbtFloat; break; - case EOpConstructDouble: newType = EbtDouble; break; -#ifdef AMD_EXTENSIONS - case EOpConstructFloat16: newType = EbtFloat16; break; -#endif - default: break; // some compilers want this - } - - if (newType != EbtVoid) { - child = addConversion(op, TType(newType, EvqTemporary, child->getVectorSize(), - child->getMatrixCols(), - child->getMatrixRows(), - child->isVector()), - child); - if (child == nullptr) - return nullptr; - } - - // - // For constructors, we are now done, it was all in the conversion. - // TODO: but, did this bypass constant folding? - // - switch (op) { - case EOpConstructInt: - case EOpConstructUint: - case EOpConstructInt64: - case EOpConstructUint64: -#ifdef AMD_EXTENSIONS - case EOpConstructInt16: - case EOpConstructUint16: -#endif - case EOpConstructBool: - case EOpConstructFloat: - case EOpConstructDouble: -#ifdef AMD_EXTENSIONS - case EOpConstructFloat16: -#endif - return child; - default: break; // some compilers want this - } - - // - // Make a new node for the operator. - // - TIntermUnary* node = addUnaryNode(op, child, loc); - - if (! promote(node)) - return nullptr; - - node->updatePrecision(); - - // If it's a (non-specialization) constant, it must be folded. - if (node->getOperand()->getAsConstantUnion()) - return node->getOperand()->getAsConstantUnion()->fold(op, node->getType()); - - // If it's a specialization constant, the result is too, - // if the operation is allowed for specialization constants. - if (node->getOperand()->getType().getQualifier().isSpecConstant() && isSpecializationOperation(*node)) - node->getWritableType().getQualifier().makeSpecConstant(); - - return node; -} - -TIntermTyped* TIntermediate::addBuiltInFunctionCall(const TSourceLoc& loc, TOperator op, bool unary, TIntermNode* childNode, const TType& returnType) -{ - if (unary) { - // - // Treat it like a unary operator. - // addUnaryMath() should get the type correct on its own; - // including constness (which would differ from the prototype). - // - TIntermTyped* child = childNode->getAsTyped(); - if (child == nullptr) - return nullptr; - - if (child->getAsConstantUnion()) { - TIntermTyped* folded = child->getAsConstantUnion()->fold(op, returnType); - if (folded) - return folded; - } - - return addUnaryNode(op, child, child->getLoc(), returnType); - } else { - // setAggregateOperater() calls fold() for constant folding - TIntermTyped* node = setAggregateOperator(childNode, op, returnType, loc); - - return node; - } -} - -// -// This is the safe way to change the operator on an aggregate, as it -// does lots of error checking and fixing. Especially for establishing -// a function call's operation on it's set of parameters. Sequences -// of instructions are also aggregates, but they just directly set -// their operator to EOpSequence. -// -// Returns an aggregate node, which could be the one passed in if -// it was already an aggregate. -// -TIntermTyped* TIntermediate::setAggregateOperator(TIntermNode* node, TOperator op, const TType& type, TSourceLoc loc) -{ - TIntermAggregate* aggNode; - - // - // Make sure we have an aggregate. If not turn it into one. - // - if (node) { - aggNode = node->getAsAggregate(); - if (aggNode == nullptr || aggNode->getOp() != EOpNull) { - // - // Make an aggregate containing this node. - // - aggNode = new TIntermAggregate(); - aggNode->getSequence().push_back(node); - if (loc.line == 0) - loc = node->getLoc(); - } - } else - aggNode = new TIntermAggregate(); - - // - // Set the operator. - // - aggNode->setOperator(op); - if (loc.line != 0) - aggNode->setLoc(loc); - - aggNode->setType(type); - - return fold(aggNode); -} - -// -// Convert the node's type to the given type, as allowed by the operation involved: 'op'. -// For implicit conversions, 'op' is not the requested conversion, it is the explicit -// operation requiring the implicit conversion. -// -// Returns a node representing the conversion, which could be the same -// node passed in if no conversion was needed. -// -// Generally, this is focused on basic type conversion, not shape conversion. -// See addShapeConversion(). -// -// Return nullptr if a conversion can't be done. -// -TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TIntermTyped* node) const -{ - // - // Does the base type even allow the operation? - // - switch (node->getBasicType()) { - case EbtVoid: - return nullptr; - case EbtAtomicUint: - case EbtSampler: - // opaque types can be passed to functions - if (op == EOpFunction) - break; - - // HLSL can assign samplers directly (no constructor) - if (source == EShSourceHlsl && node->getBasicType() == EbtSampler) - break; - - // samplers can get assigned via a sampler constructor - // (well, not yet, but code in the rest of this function is ready for it) - if (node->getBasicType() == EbtSampler && op == EOpAssign && - node->getAsOperator() != nullptr && node->getAsOperator()->getOp() == EOpConstructTextureSampler) - break; - - // otherwise, opaque types can't even be operated on, let alone converted - return nullptr; - default: - break; - } - - // Otherwise, if types are identical, no problem - if (type == node->getType()) - return node; - - // If one's a structure, then no conversions. - if (type.isStruct() || node->isStruct()) - return nullptr; - - // If one's an array, then no conversions. - if (type.isArray() || node->getType().isArray()) - return nullptr; - - // Note: callers are responsible for other aspects of shape, - // like vector and matrix sizes. - - TBasicType promoteTo; - - switch (op) { - // - // Explicit conversions (unary operations) - // - case EOpConstructBool: - promoteTo = EbtBool; - break; - case EOpConstructFloat: - promoteTo = EbtFloat; - break; - case EOpConstructDouble: - promoteTo = EbtDouble; - break; -#ifdef AMD_EXTENSIONS - case EOpConstructFloat16: - promoteTo = EbtFloat16; - break; -#endif - case EOpConstructInt: - promoteTo = EbtInt; - break; - case EOpConstructUint: - promoteTo = EbtUint; - break; - case EOpConstructInt64: - promoteTo = EbtInt64; - break; - case EOpConstructUint64: - promoteTo = EbtUint64; - break; -#ifdef AMD_EXTENSIONS - case EOpConstructInt16: - promoteTo = EbtInt16; - break; - case EOpConstructUint16: - promoteTo = EbtUint16; - break; -#endif - - // - // List all the binary ops that can implicitly convert one operand to the other's type; - // This implements the 'policy' for implicit type conversion. - // - case EOpLessThan: - case EOpGreaterThan: - case EOpLessThanEqual: - case EOpGreaterThanEqual: - case EOpEqual: - case EOpNotEqual: - - case EOpAdd: - case EOpSub: - case EOpMul: - case EOpDiv: - case EOpMod: - - case EOpVectorTimesScalar: - case EOpVectorTimesMatrix: - case EOpMatrixTimesVector: - case EOpMatrixTimesScalar: - - case EOpAnd: - case EOpInclusiveOr: - case EOpExclusiveOr: - case EOpAndAssign: - case EOpInclusiveOrAssign: - case EOpExclusiveOrAssign: - case EOpLogicalNot: - case EOpLogicalAnd: - case EOpLogicalOr: - case EOpLogicalXor: - - case EOpFunctionCall: - case EOpReturn: - case EOpAssign: - case EOpAddAssign: - case EOpSubAssign: - case EOpMulAssign: - case EOpVectorTimesScalarAssign: - case EOpMatrixTimesScalarAssign: - case EOpDivAssign: - case EOpModAssign: - - case EOpAtan: - case EOpClamp: - case EOpCross: - case EOpDistance: - case EOpDot: - case EOpDst: - case EOpFaceForward: - case EOpFma: - case EOpFrexp: - case EOpLdexp: - case EOpMix: - case EOpLit: - case EOpMax: - case EOpMin: - case EOpModf: - case EOpPow: - case EOpReflect: - case EOpRefract: - case EOpSmoothStep: - case EOpStep: - - case EOpSequence: - case EOpConstructStruct: - - if (type.getBasicType() == node->getType().getBasicType()) - return node; - - if (canImplicitlyPromote(node->getType().getBasicType(), type.getBasicType(), op)) - promoteTo = type.getBasicType(); - else - return nullptr; - - break; - - // Shifts can have mixed types as long as they are integer, without converting. - // It's the left operand's type that determines the resulting type, so no issue - // with assign shift ops either. - case EOpLeftShift: - case EOpRightShift: - case EOpLeftShiftAssign: - case EOpRightShiftAssign: - if ((type.getBasicType() == EbtInt || - type.getBasicType() == EbtUint || -#ifdef AMD_EXTENSIONS - type.getBasicType() == EbtInt16 || - type.getBasicType() == EbtUint16 || -#endif - type.getBasicType() == EbtInt64 || - type.getBasicType() == EbtUint64) && - (node->getType().getBasicType() == EbtInt || - node->getType().getBasicType() == EbtUint || -#ifdef AMD_EXTENSIONS - node->getType().getBasicType() == EbtInt16 || - node->getType().getBasicType() == EbtUint16 || -#endif - node->getType().getBasicType() == EbtInt64 || - node->getType().getBasicType() == EbtUint64)) - - return node; - else if (source == EShSourceHlsl && node->getType().getBasicType() == EbtBool) { - promoteTo = type.getBasicType(); - break; - } else - return nullptr; - - default: - // default is to require a match; all exceptions should have case statements above - - if (type.getBasicType() == node->getType().getBasicType()) - return node; - else - return nullptr; - } - - if (node->getAsConstantUnion()) - return promoteConstantUnion(promoteTo, node->getAsConstantUnion()); - - // - // Add a new newNode for the conversion. - // - TIntermUnary* newNode = nullptr; - - TOperator newOp = EOpNull; - - // This is 'mechanism' here, it does any conversion told. The policy comes - // from the shader or the above code. - switch (promoteTo) { - case EbtDouble: - switch (node->getBasicType()) { - case EbtInt: newOp = EOpConvIntToDouble; break; - case EbtUint: newOp = EOpConvUintToDouble; break; - case EbtBool: newOp = EOpConvBoolToDouble; break; - case EbtFloat: newOp = EOpConvFloatToDouble; break; -#ifdef AMD_EXTENSIONS - case EbtFloat16: newOp = EOpConvFloat16ToDouble; break; -#endif - case EbtInt64: newOp = EOpConvInt64ToDouble; break; - case EbtUint64: newOp = EOpConvUint64ToDouble; break; -#ifdef AMD_EXTENSIONS - case EbtInt16: newOp = EOpConvInt16ToDouble; break; - case EbtUint16: newOp = EOpConvUint16ToDouble; break; -#endif - default: - return nullptr; - } - break; - case EbtFloat: - switch (node->getBasicType()) { - case EbtInt: newOp = EOpConvIntToFloat; break; - case EbtUint: newOp = EOpConvUintToFloat; break; - case EbtBool: newOp = EOpConvBoolToFloat; break; - case EbtDouble: newOp = EOpConvDoubleToFloat; break; -#ifdef AMD_EXTENSIONS - case EbtFloat16: newOp = EOpConvFloat16ToFloat; break; -#endif - case EbtInt64: newOp = EOpConvInt64ToFloat; break; - case EbtUint64: newOp = EOpConvUint64ToFloat; break; -#ifdef AMD_EXTENSIONS - case EbtInt16: newOp = EOpConvInt16ToFloat; break; - case EbtUint16: newOp = EOpConvUint16ToFloat; break; -#endif - default: - return nullptr; - } - break; -#ifdef AMD_EXTENSIONS - case EbtFloat16: - switch (node->getBasicType()) { - case EbtInt: newOp = EOpConvIntToFloat16; break; - case EbtUint: newOp = EOpConvUintToFloat16; break; - case EbtBool: newOp = EOpConvBoolToFloat16; break; - case EbtFloat: newOp = EOpConvFloatToFloat16; break; - case EbtDouble: newOp = EOpConvDoubleToFloat16; break; - case EbtInt64: newOp = EOpConvInt64ToFloat16; break; - case EbtUint64: newOp = EOpConvUint64ToFloat16; break; - case EbtInt16: newOp = EOpConvInt16ToFloat16; break; - case EbtUint16: newOp = EOpConvUint16ToFloat16; break; - default: - return nullptr; - } - break; -#endif - case EbtBool: - switch (node->getBasicType()) { - case EbtInt: newOp = EOpConvIntToBool; break; - case EbtUint: newOp = EOpConvUintToBool; break; - case EbtFloat: newOp = EOpConvFloatToBool; break; - case EbtDouble: newOp = EOpConvDoubleToBool; break; -#ifdef AMD_EXTENSIONS - case EbtFloat16: newOp = EOpConvFloat16ToBool; break; -#endif - case EbtInt64: newOp = EOpConvInt64ToBool; break; - case EbtUint64: newOp = EOpConvUint64ToBool; break; -#ifdef AMD_EXTENSIONS - case EbtInt16: newOp = EOpConvInt16ToBool; break; - case EbtUint16: newOp = EOpConvUint16ToBool; break; -#endif - default: - return nullptr; - } - break; - case EbtInt: - switch (node->getBasicType()) { - case EbtUint: newOp = EOpConvUintToInt; break; - case EbtBool: newOp = EOpConvBoolToInt; break; - case EbtFloat: newOp = EOpConvFloatToInt; break; - case EbtDouble: newOp = EOpConvDoubleToInt; break; -#ifdef AMD_EXTENSIONS - case EbtFloat16: newOp = EOpConvFloat16ToInt; break; -#endif - case EbtInt64: newOp = EOpConvInt64ToInt; break; - case EbtUint64: newOp = EOpConvUint64ToInt; break; -#ifdef AMD_EXTENSIONS - case EbtInt16: newOp = EOpConvInt16ToInt; break; - case EbtUint16: newOp = EOpConvUint16ToInt; break; -#endif - default: - return nullptr; - } - break; - case EbtUint: - switch (node->getBasicType()) { - case EbtInt: newOp = EOpConvIntToUint; break; - case EbtBool: newOp = EOpConvBoolToUint; break; - case EbtFloat: newOp = EOpConvFloatToUint; break; - case EbtDouble: newOp = EOpConvDoubleToUint; break; -#ifdef AMD_EXTENSIONS - case EbtFloat16: newOp = EOpConvFloat16ToUint; break; -#endif - case EbtInt64: newOp = EOpConvInt64ToUint; break; - case EbtUint64: newOp = EOpConvUint64ToUint; break; -#ifdef AMD_EXTENSIONS - case EbtInt16: newOp = EOpConvInt16ToUint; break; - case EbtUint16: newOp = EOpConvUint16ToUint; break; -#endif - default: - return nullptr; - } - break; - case EbtInt64: - switch (node->getBasicType()) { - case EbtInt: newOp = EOpConvIntToInt64; break; - case EbtUint: newOp = EOpConvUintToInt64; break; - case EbtBool: newOp = EOpConvBoolToInt64; break; - case EbtFloat: newOp = EOpConvFloatToInt64; break; - case EbtDouble: newOp = EOpConvDoubleToInt64; break; -#ifdef AMD_EXTENSIONS - case EbtFloat16: newOp = EOpConvFloat16ToInt64; break; -#endif - case EbtUint64: newOp = EOpConvUint64ToInt64; break; -#ifdef AMD_EXTENSIONS - case EbtInt16: newOp = EOpConvInt16ToInt64; break; - case EbtUint16: newOp = EOpConvUint16ToInt64; break; -#endif - default: - return nullptr; - } - break; - case EbtUint64: - switch (node->getBasicType()) { - case EbtInt: newOp = EOpConvIntToUint64; break; - case EbtUint: newOp = EOpConvUintToUint64; break; - case EbtBool: newOp = EOpConvBoolToUint64; break; - case EbtFloat: newOp = EOpConvFloatToUint64; break; - case EbtDouble: newOp = EOpConvDoubleToUint64; break; -#ifdef AMD_EXTENSIONS - case EbtFloat16: newOp = EOpConvFloat16ToUint64; break; -#endif - case EbtInt64: newOp = EOpConvInt64ToUint64; break; -#ifdef AMD_EXTENSIONS - case EbtInt16: newOp = EOpConvInt16ToUint64; break; - case EbtUint16: newOp = EOpConvUint16ToUint64; break; -#endif - default: - return nullptr; - } - break; -#ifdef AMD_EXTENSIONS - case EbtInt16: - switch (node->getBasicType()) { - case EbtInt: newOp = EOpConvIntToInt16; break; - case EbtUint: newOp = EOpConvUintToInt16; break; - case EbtBool: newOp = EOpConvBoolToInt16; break; - case EbtFloat: newOp = EOpConvFloatToInt16; break; - case EbtDouble: newOp = EOpConvDoubleToInt16; break; - case EbtFloat16: newOp = EOpConvFloat16ToInt16; break; - case EbtInt64: newOp = EOpConvInt64ToInt16; break; - case EbtUint64: newOp = EOpConvUint64ToInt16; break; - case EbtUint16: newOp = EOpConvUint16ToInt16; break; - default: - return nullptr; - } - break; - case EbtUint16: - switch (node->getBasicType()) { - case EbtInt: newOp = EOpConvIntToUint16; break; - case EbtUint: newOp = EOpConvUintToUint16; break; - case EbtBool: newOp = EOpConvBoolToUint16; break; - case EbtFloat: newOp = EOpConvFloatToUint16; break; - case EbtDouble: newOp = EOpConvDoubleToUint16; break; - case EbtFloat16: newOp = EOpConvFloat16ToUint16; break; - case EbtInt64: newOp = EOpConvInt64ToUint16; break; - case EbtUint64: newOp = EOpConvUint64ToUint16; break; - case EbtInt16: newOp = EOpConvInt16ToUint16; break; - default: - return nullptr; - } - break; -#endif - default: - return nullptr; - } - - TType newType(promoteTo, EvqTemporary, node->getVectorSize(), node->getMatrixCols(), node->getMatrixRows()); - newNode = addUnaryNode(newOp, node, node->getLoc(), newType); - - // TODO: it seems that some unary folding operations should occur here, but are not - - // Propagate specialization-constant-ness, if allowed - if (node->getType().getQualifier().isSpecConstant() && isSpecializationOperation(*newNode)) - newNode->getWritableType().getQualifier().makeSpecConstant(); - - return newNode; -} - -// Convert the node's shape of type for the given type, as allowed by the -// operation involved: 'op'. This is for situations where there is only one -// direction to consider doing the shape conversion. -// -// This implements policy, it call addShapeConversion() for the mechanism. -// -// Generally, the AST represents allowed GLSL shapes, so this isn't needed -// for GLSL. Bad shapes are caught in conversion or promotion. -// -// Return 'node' if no conversion was done. Promotion handles final shape -// checking. -// -TIntermTyped* TIntermediate::addUniShapeConversion(TOperator op, const TType& type, TIntermTyped* node) -{ - // some source languages don't do this - switch (source) { - case EShSourceHlsl: - break; - case EShSourceGlsl: - default: - return node; - } - - // some operations don't do this - switch (op) { - case EOpFunctionCall: - case EOpReturn: - break; - - case EOpMulAssign: - // want to support vector *= scalar native ops in AST and lower, not smear, similarly for - // matrix *= scalar, etc. - - case EOpAddAssign: - case EOpSubAssign: - case EOpDivAssign: - case EOpAndAssign: - case EOpInclusiveOrAssign: - case EOpExclusiveOrAssign: - case EOpRightShiftAssign: - case EOpLeftShiftAssign: - if (node->getVectorSize() == 1) - return node; - break; - - case EOpAssign: - break; - - case EOpMix: - break; - - default: - return node; - } - - return addShapeConversion(type, node); -} - -// Convert the nodes' shapes to be compatible for the operation 'op'. -// -// This implements policy, it call addShapeConversion() for the mechanism. -// -// Generally, the AST represents allowed GLSL shapes, so this isn't needed -// for GLSL. Bad shapes are caught in conversion or promotion. -// -void TIntermediate::addBiShapeConversion(TOperator op, TIntermTyped*& lhsNode, TIntermTyped*& rhsNode) -{ - // some source languages don't do this - switch (source) { - case EShSourceHlsl: - break; - case EShSourceGlsl: - default: - return; - } - - // some operations don't do this - // 'break' will mean attempt bidirectional conversion - switch (op) { - case EOpMulAssign: - case EOpAssign: - case EOpAddAssign: - case EOpSubAssign: - case EOpDivAssign: - case EOpAndAssign: - case EOpInclusiveOrAssign: - case EOpExclusiveOrAssign: - case EOpRightShiftAssign: - case EOpLeftShiftAssign: - // switch to unidirectional conversion (the lhs can't change) - rhsNode = addUniShapeConversion(op, lhsNode->getType(), rhsNode); - return; - - case EOpAdd: - case EOpSub: - case EOpMul: - case EOpDiv: - // want to support vector * scalar native ops in AST and lower, not smear, similarly for - // matrix * vector, etc. - if (lhsNode->getVectorSize() == 1 || rhsNode->getVectorSize() == 1) - return; - break; - - case EOpRightShift: - case EOpLeftShift: - // can natively support the right operand being a scalar and the left a vector, - // but not the reverse - if (rhsNode->getVectorSize() == 1) - return; - break; - - case EOpLessThan: - case EOpGreaterThan: - case EOpLessThanEqual: - case EOpGreaterThanEqual: - - case EOpEqual: - case EOpNotEqual: - - case EOpLogicalAnd: - case EOpLogicalOr: - case EOpLogicalXor: - - case EOpAnd: - case EOpInclusiveOr: - case EOpExclusiveOr: - - case EOpMix: - break; - - default: - return; - } - - // Do bidirectional conversions - if (lhsNode->getType().isScalarOrVec1() || rhsNode->getType().isScalarOrVec1()) { - if (lhsNode->getType().isScalarOrVec1()) - lhsNode = addShapeConversion(rhsNode->getType(), lhsNode); - else - rhsNode = addShapeConversion(lhsNode->getType(), rhsNode); - } - lhsNode = addShapeConversion(rhsNode->getType(), lhsNode); - rhsNode = addShapeConversion(lhsNode->getType(), rhsNode); -} - -// Convert the node's shape of type for the given type. It's not necessarily -// an error if they are different and not converted, as some operations accept -// mixed types. Promotion will do final shape checking. -// -// If there is a chance of two nodes, with conversions possible in each direction, -// the policy for what to ask for must be in the caller; this will do what is asked. -// -// Return 'node' if no conversion was done. Promotion handles final shape -// checking. -// -TIntermTyped* TIntermediate::addShapeConversion(const TType& type, TIntermTyped* node) -{ - // no conversion needed - if (node->getType() == type) - return node; - - // structures and arrays don't change shape, either to or from - if (node->getType().isStruct() || node->getType().isArray() || - type.isStruct() || type.isArray()) - return node; - - // The new node that handles the conversion - TOperator constructorOp = mapTypeToConstructorOp(type); - - // HLSL has custom semantics for scalar->mat shape conversions. - if (source == EShSourceHlsl) { - if (node->getType().isScalarOrVec1() && type.isMatrix()) { - - // HLSL semantics: the scalar (or vec1) is replicated to every component of the matrix. Left to its - // own devices, the constructor from a scalar would populate the diagonal. This forces replication - // to every matrix element. - - // Note that if the node is complex (e.g, a function call), we don't want to duplicate it here - // repeatedly, so we copy it to a temp, then use the temp. - const int matSize = type.getMatrixRows() * type.getMatrixCols(); - TIntermAggregate* rhsAggregate = new TIntermAggregate(); - - const bool isSimple = (node->getAsSymbolNode() != nullptr) || (node->getAsConstantUnion() != nullptr); - - if (!isSimple) { - assert(0); // TODO: use node replicator service when available. - } - - for (int x=0; xgetSequence().push_back(node); - - return setAggregateOperator(rhsAggregate, constructorOp, type, node->getLoc()); - } - } - - // scalar -> vector or vec1 -> vector or - // vector -> scalar or - // bigger vector -> smaller vector - if ((node->getType().isScalarOrVec1() && type.isVector()) || - (node->getType().isVector() && type.isScalar()) || - (node->isVector() && type.isVector() && node->getVectorSize() > type.getVectorSize())) - return setAggregateOperator(makeAggregate(node), constructorOp, type, node->getLoc()); - - return node; -} - -// -// See if the 'from' type is allowed to be implicitly converted to the -// 'to' type. This is not about vector/array/struct, only about basic type. -// -bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperator op) const -{ - if (profile == EEsProfile || version == 110) - return false; - - if (from == to) - return true; - - // TODO: Move more policies into language-specific handlers. - // Some languages allow more general (or potentially, more specific) conversions under some conditions. - if (source == EShSourceHlsl) { - const bool fromConvertable = (from == EbtFloat || from == EbtDouble || from == EbtInt || from == EbtUint || from == EbtBool); - const bool toConvertable = (to == EbtFloat || to == EbtDouble || to == EbtInt || to == EbtUint || to == EbtBool); - - if (fromConvertable && toConvertable) { - switch (op) { - case EOpAndAssign: // assignments can perform arbitrary conversions - case EOpInclusiveOrAssign: // ... - case EOpExclusiveOrAssign: // ... - case EOpAssign: // ... - case EOpAddAssign: // ... - case EOpSubAssign: // ... - case EOpMulAssign: // ... - case EOpVectorTimesScalarAssign: // ... - case EOpMatrixTimesScalarAssign: // ... - case EOpDivAssign: // ... - case EOpModAssign: // ... - case EOpReturn: // function returns can also perform arbitrary conversions - case EOpFunctionCall: // conversion of a calling parameter - case EOpLogicalNot: - case EOpLogicalAnd: - case EOpLogicalOr: - case EOpLogicalXor: - case EOpConstructStruct: - return true; - default: - break; - } - } - } - - switch (to) { - case EbtDouble: - switch (from) { - case EbtInt: - case EbtUint: - case EbtInt64: - case EbtUint64: -#ifdef AMD_EXTENSIONS - case EbtInt16: - case EbtUint16: -#endif - case EbtFloat: - case EbtDouble: -#ifdef AMD_EXTENSIONS - case EbtFloat16: -#endif - return true; - default: - return false; - } - case EbtFloat: - switch (from) { - case EbtInt: - case EbtUint: -#ifdef AMD_EXTENSIONS - case EbtInt16: - case EbtUint16: -#endif - case EbtFloat: -#ifdef AMD_EXTENSIONS - case EbtFloat16: -#endif - return true; - case EbtBool: - return (source == EShSourceHlsl); - default: - return false; - } - case EbtUint: - switch (from) { - case EbtInt: - return version >= 400 || (source == EShSourceHlsl); - case EbtUint: -#ifdef AMD_EXTENSIONS - case EbtInt16: - case EbtUint16: -#endif - return true; - case EbtBool: - return (source == EShSourceHlsl); - default: - return false; - } - case EbtInt: - switch (from) { - case EbtInt: -#ifdef AMD_EXTENSIONS - case EbtInt16: -#endif - return true; - case EbtBool: - return (source == EShSourceHlsl); - default: - return false; - } - case EbtUint64: - switch (from) { - case EbtInt: - case EbtUint: - case EbtInt64: - case EbtUint64: -#ifdef AMD_EXTENSIONS - case EbtInt16: - case EbtUint16: -#endif - return true; - default: - return false; - } - case EbtInt64: - switch (from) { - case EbtInt: - case EbtInt64: -#ifdef AMD_EXTENSIONS - case EbtInt16: -#endif - return true; - default: - return false; - } -#ifdef AMD_EXTENSIONS - case EbtFloat16: - switch (from) { - case EbtInt16: - case EbtUint16: - case EbtFloat16: - return true; - default: - return false; - } - case EbtUint16: - switch (from) { - case EbtInt16: - case EbtUint16: - return true; - default: - return false; - } -#endif - default: - return false; - } -} - -// -// Given a type, find what operation would fully construct it. -// -TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const -{ - TOperator op = EOpNull; - - switch (type.getBasicType()) { - case EbtStruct: - op = EOpConstructStruct; - break; - case EbtSampler: - if (type.getSampler().combined) - op = EOpConstructTextureSampler; - break; - case EbtFloat: - if (type.isMatrix()) { - switch (type.getMatrixCols()) { - case 2: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructMat2x2; break; - case 3: op = EOpConstructMat2x3; break; - case 4: op = EOpConstructMat2x4; break; - default: break; // some compilers want this - } - break; - case 3: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructMat3x2; break; - case 3: op = EOpConstructMat3x3; break; - case 4: op = EOpConstructMat3x4; break; - default: break; // some compilers want this - } - break; - case 4: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructMat4x2; break; - case 3: op = EOpConstructMat4x3; break; - case 4: op = EOpConstructMat4x4; break; - default: break; // some compilers want this - } - break; - default: break; // some compilers want this - } - } else { - switch(type.getVectorSize()) { - case 1: op = EOpConstructFloat; break; - case 2: op = EOpConstructVec2; break; - case 3: op = EOpConstructVec3; break; - case 4: op = EOpConstructVec4; break; - default: break; // some compilers want this - } - } - break; - case EbtDouble: - if (type.getMatrixCols()) { - switch (type.getMatrixCols()) { - case 2: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructDMat2x2; break; - case 3: op = EOpConstructDMat2x3; break; - case 4: op = EOpConstructDMat2x4; break; - default: break; // some compilers want this - } - break; - case 3: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructDMat3x2; break; - case 3: op = EOpConstructDMat3x3; break; - case 4: op = EOpConstructDMat3x4; break; - default: break; // some compilers want this - } - break; - case 4: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructDMat4x2; break; - case 3: op = EOpConstructDMat4x3; break; - case 4: op = EOpConstructDMat4x4; break; - default: break; // some compilers want this - } - break; - } - } else { - switch(type.getVectorSize()) { - case 1: op = EOpConstructDouble; break; - case 2: op = EOpConstructDVec2; break; - case 3: op = EOpConstructDVec3; break; - case 4: op = EOpConstructDVec4; break; - default: break; // some compilers want this - } - } - break; -#ifdef AMD_EXTENSIONS - case EbtFloat16: - if (type.getMatrixCols()) { - switch (type.getMatrixCols()) { - case 2: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructF16Mat2x2; break; - case 3: op = EOpConstructF16Mat2x3; break; - case 4: op = EOpConstructF16Mat2x4; break; - default: break; // some compilers want this - } - break; - case 3: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructF16Mat3x2; break; - case 3: op = EOpConstructF16Mat3x3; break; - case 4: op = EOpConstructF16Mat3x4; break; - default: break; // some compilers want this - } - break; - case 4: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructF16Mat4x2; break; - case 3: op = EOpConstructF16Mat4x3; break; - case 4: op = EOpConstructF16Mat4x4; break; - default: break; // some compilers want this - } - break; - } - } - else { - switch (type.getVectorSize()) { - case 1: op = EOpConstructFloat16; break; - case 2: op = EOpConstructF16Vec2; break; - case 3: op = EOpConstructF16Vec3; break; - case 4: op = EOpConstructF16Vec4; break; - default: break; // some compilers want this - } - } - break; -#endif - case EbtInt: - if (type.getMatrixCols()) { - switch (type.getMatrixCols()) { - case 2: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructIMat2x2; break; - case 3: op = EOpConstructIMat2x3; break; - case 4: op = EOpConstructIMat2x4; break; - default: break; // some compilers want this - } - break; - case 3: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructIMat3x2; break; - case 3: op = EOpConstructIMat3x3; break; - case 4: op = EOpConstructIMat3x4; break; - default: break; // some compilers want this - } - break; - case 4: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructIMat4x2; break; - case 3: op = EOpConstructIMat4x3; break; - case 4: op = EOpConstructIMat4x4; break; - default: break; // some compilers want this - } - break; - } - } else { - switch(type.getVectorSize()) { - case 1: op = EOpConstructInt; break; - case 2: op = EOpConstructIVec2; break; - case 3: op = EOpConstructIVec3; break; - case 4: op = EOpConstructIVec4; break; - default: break; // some compilers want this - } - } - break; - case EbtUint: - if (type.getMatrixCols()) { - switch (type.getMatrixCols()) { - case 2: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructUMat2x2; break; - case 3: op = EOpConstructUMat2x3; break; - case 4: op = EOpConstructUMat2x4; break; - default: break; // some compilers want this - } - break; - case 3: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructUMat3x2; break; - case 3: op = EOpConstructUMat3x3; break; - case 4: op = EOpConstructUMat3x4; break; - default: break; // some compilers want this - } - break; - case 4: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructUMat4x2; break; - case 3: op = EOpConstructUMat4x3; break; - case 4: op = EOpConstructUMat4x4; break; - default: break; // some compilers want this - } - break; - } - } else { - switch(type.getVectorSize()) { - case 1: op = EOpConstructUint; break; - case 2: op = EOpConstructUVec2; break; - case 3: op = EOpConstructUVec3; break; - case 4: op = EOpConstructUVec4; break; - default: break; // some compilers want this - } - } - break; - case EbtInt64: - switch(type.getVectorSize()) { - case 1: op = EOpConstructInt64; break; - case 2: op = EOpConstructI64Vec2; break; - case 3: op = EOpConstructI64Vec3; break; - case 4: op = EOpConstructI64Vec4; break; - default: break; // some compilers want this - } - break; - case EbtUint64: - switch(type.getVectorSize()) { - case 1: op = EOpConstructUint64; break; - case 2: op = EOpConstructU64Vec2; break; - case 3: op = EOpConstructU64Vec3; break; - case 4: op = EOpConstructU64Vec4; break; - default: break; // some compilers want this - } - break; -#ifdef AMD_EXTENSIONS - case EbtInt16: - switch(type.getVectorSize()) { - case 1: op = EOpConstructInt16; break; - case 2: op = EOpConstructI16Vec2; break; - case 3: op = EOpConstructI16Vec3; break; - case 4: op = EOpConstructI16Vec4; break; - default: break; // some compilers want this - } - break; - case EbtUint16: - switch(type.getVectorSize()) { - case 1: op = EOpConstructUint16; break; - case 2: op = EOpConstructU16Vec2; break; - case 3: op = EOpConstructU16Vec3; break; - case 4: op = EOpConstructU16Vec4; break; - default: break; // some compilers want this - } - break; -#endif - case EbtBool: - if (type.getMatrixCols()) { - switch (type.getMatrixCols()) { - case 2: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructBMat2x2; break; - case 3: op = EOpConstructBMat2x3; break; - case 4: op = EOpConstructBMat2x4; break; - default: break; // some compilers want this - } - break; - case 3: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructBMat3x2; break; - case 3: op = EOpConstructBMat3x3; break; - case 4: op = EOpConstructBMat3x4; break; - default: break; // some compilers want this - } - break; - case 4: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructBMat4x2; break; - case 3: op = EOpConstructBMat4x3; break; - case 4: op = EOpConstructBMat4x4; break; - default: break; // some compilers want this - } - break; - } - } else { - switch(type.getVectorSize()) { - case 1: op = EOpConstructBool; break; - case 2: op = EOpConstructBVec2; break; - case 3: op = EOpConstructBVec3; break; - case 4: op = EOpConstructBVec4; break; - default: break; // some compilers want this - } - } - break; - default: - break; - } - - return op; -} - -// -// Safe way to combine two nodes into an aggregate. Works with null pointers, -// a node that's not a aggregate yet, etc. -// -// Returns the resulting aggregate, unless nullptr was passed in for -// both existing nodes. -// -TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* right) -{ - if (left == nullptr && right == nullptr) - return nullptr; - - TIntermAggregate* aggNode = nullptr; - if (left != nullptr) - aggNode = left->getAsAggregate(); - if (aggNode == nullptr || aggNode->getOp() != EOpNull) { - aggNode = new TIntermAggregate; - if (left != nullptr) - aggNode->getSequence().push_back(left); - } - - if (right != nullptr) - aggNode->getSequence().push_back(right); - - return aggNode; -} - -TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* right, const TSourceLoc& loc) -{ - TIntermAggregate* aggNode = growAggregate(left, right); - if (aggNode) - aggNode->setLoc(loc); - - return aggNode; -} - -// -// Turn an existing node into an aggregate. -// -// Returns an aggregate, unless nullptr was passed in for the existing node. -// -TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node) -{ - if (node == nullptr) - return nullptr; - - TIntermAggregate* aggNode = new TIntermAggregate; - aggNode->getSequence().push_back(node); - aggNode->setLoc(node->getLoc()); - - return aggNode; -} - -TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node, const TSourceLoc& loc) -{ - if (node == nullptr) - return nullptr; - - TIntermAggregate* aggNode = new TIntermAggregate; - aggNode->getSequence().push_back(node); - aggNode->setLoc(loc); - - return aggNode; -} - -// -// Make an aggregate with an empty sequence. -// -TIntermAggregate* TIntermediate::makeAggregate(const TSourceLoc& loc) -{ - TIntermAggregate* aggNode = new TIntermAggregate; - aggNode->setLoc(loc); - - return aggNode; -} - -// -// For "if" test nodes. There are three children; a condition, -// a true path, and a false path. The two paths are in the -// nodePair. -// -// Returns the selection node created. -// -TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermNodePair nodePair, const TSourceLoc& loc, TSelectionControl control) -{ - // - // Don't prune the false path for compile-time constants; it's needed - // for static access analysis. - // - - TIntermSelection* node = new TIntermSelection(cond, nodePair.node1, nodePair.node2); - node->setLoc(loc); - node->setSelectionControl(control); - - return node; -} - -TIntermTyped* TIntermediate::addComma(TIntermTyped* left, TIntermTyped* right, const TSourceLoc& loc) -{ - // However, the lowest precedence operators of the sequence operator ( , ) and the assignment operators - // ... are not included in the operators that can create a constant expression. - // - // if (left->getType().getQualifier().storage == EvqConst && - // right->getType().getQualifier().storage == EvqConst) { - - // return right; - //} - - TIntermTyped *commaAggregate = growAggregate(left, right, loc); - commaAggregate->getAsAggregate()->setOperator(EOpComma); - commaAggregate->setType(right->getType()); - commaAggregate->getWritableType().getQualifier().makeTemporary(); - - return commaAggregate; -} - -TIntermTyped* TIntermediate::addMethod(TIntermTyped* object, const TType& type, const TString* name, const TSourceLoc& loc) -{ - TIntermMethod* method = new TIntermMethod(object, type, *name); - method->setLoc(loc); - - return method; -} - -// -// For "?:" test nodes. There are three children; a condition, -// a true path, and a false path. The two paths are specified -// as separate parameters. For vector 'cond', the true and false -// are not paths, but vectors to mix. -// -// Specialization constant operations include -// - The ternary operator ( ? : ) -// -// Returns the selection node created, or nullptr if one could not be. -// -TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, const TSourceLoc& loc, TSelectionControl control) -{ - // If it's void, go to the if-then-else selection() - if (trueBlock->getBasicType() == EbtVoid && falseBlock->getBasicType() == EbtVoid) { - TIntermNodePair pair = { trueBlock, falseBlock }; - return addSelection(cond, pair, loc, control); - } - - // - // Get compatible types. - // - TIntermTyped* child = addConversion(EOpSequence, trueBlock->getType(), falseBlock); - if (child) - falseBlock = child; - else { - child = addConversion(EOpSequence, falseBlock->getType(), trueBlock); - if (child) - trueBlock = child; - else - return nullptr; - } - - // Handle a vector condition as a mix - if (!cond->getType().isScalarOrVec1()) { - TType targetVectorType(trueBlock->getType().getBasicType(), EvqTemporary, - cond->getType().getVectorSize()); - // smear true/false operands as needed - trueBlock = addUniShapeConversion(EOpMix, targetVectorType, trueBlock); - falseBlock = addUniShapeConversion(EOpMix, targetVectorType, falseBlock); - - // After conversion, types have to match. - if (falseBlock->getType() != trueBlock->getType()) - return nullptr; - - // make the mix operation - TIntermAggregate* mix = makeAggregate(loc); - mix = growAggregate(mix, falseBlock); - mix = growAggregate(mix, trueBlock); - mix = growAggregate(mix, cond); - mix->setType(targetVectorType); - mix->setOp(EOpMix); - - return mix; - } - - // Now have a scalar condition... - - // Convert true and false expressions to matching types - addBiShapeConversion(EOpMix, trueBlock, falseBlock); - - // After conversion, types have to match. - if (falseBlock->getType() != trueBlock->getType()) - return nullptr; - - // Eliminate the selection when the condition is a scalar and all operands are constant. - if (cond->getAsConstantUnion() && trueBlock->getAsConstantUnion() && falseBlock->getAsConstantUnion()) { - if (cond->getAsConstantUnion()->getConstArray()[0].getBConst()) - return trueBlock; - else - return falseBlock; - } - - // - // Make a selection node. - // - TIntermSelection* node = new TIntermSelection(cond, trueBlock, falseBlock, trueBlock->getType()); - node->setLoc(loc); - node->getQualifier().precision = std::max(trueBlock->getQualifier().precision, falseBlock->getQualifier().precision); - - if ((cond->getQualifier().isConstant() && specConstantPropagates(*trueBlock, *falseBlock)) || - (cond->getQualifier().isSpecConstant() && trueBlock->getQualifier().isConstant() && - falseBlock->getQualifier().isConstant())) - node->getQualifier().makeSpecConstant(); - else - node->getQualifier().makeTemporary(); - - return node; -} - -// -// Constant terminal nodes. Has a union that contains bool, float or int constants -// -// Returns the constant union node created. -// - -TIntermConstantUnion* TIntermediate::addConstantUnion(const TConstUnionArray& unionArray, const TType& t, const TSourceLoc& loc, bool literal) const -{ - TIntermConstantUnion* node = new TIntermConstantUnion(unionArray, t); - node->getQualifier().storage = EvqConst; - node->setLoc(loc); - if (literal) - node->setLiteral(); - - return node; -} - -TIntermConstantUnion* TIntermediate::addConstantUnion(int i, const TSourceLoc& loc, bool literal) const -{ - TConstUnionArray unionArray(1); - unionArray[0].setIConst(i); - - return addConstantUnion(unionArray, TType(EbtInt, EvqConst), loc, literal); -} - -TIntermConstantUnion* TIntermediate::addConstantUnion(unsigned int u, const TSourceLoc& loc, bool literal) const -{ - TConstUnionArray unionArray(1); - unionArray[0].setUConst(u); - - return addConstantUnion(unionArray, TType(EbtUint, EvqConst), loc, literal); -} - -TIntermConstantUnion* TIntermediate::addConstantUnion(long long i64, const TSourceLoc& loc, bool literal) const -{ - TConstUnionArray unionArray(1); - unionArray[0].setI64Const(i64); - - return addConstantUnion(unionArray, TType(EbtInt64, EvqConst), loc, literal); -} - -TIntermConstantUnion* TIntermediate::addConstantUnion(unsigned long long u64, const TSourceLoc& loc, bool literal) const -{ - TConstUnionArray unionArray(1); - unionArray[0].setU64Const(u64); - - return addConstantUnion(unionArray, TType(EbtUint64, EvqConst), loc, literal); -} - -#ifdef AMD_EXTENSIONS -TIntermConstantUnion* TIntermediate::addConstantUnion(short i16, const TSourceLoc& loc, bool literal) const -{ - TConstUnionArray unionArray(1); - unionArray[0].setIConst(i16); - - return addConstantUnion(unionArray, TType(EbtInt16, EvqConst), loc, literal); -} - -TIntermConstantUnion* TIntermediate::addConstantUnion(unsigned short u16, const TSourceLoc& loc, bool literal) const -{ - TConstUnionArray unionArray(1); - unionArray[0].setUConst(u16); - - return addConstantUnion(unionArray, TType(EbtUint16, EvqConst), loc, literal); -} -#endif - -TIntermConstantUnion* TIntermediate::addConstantUnion(bool b, const TSourceLoc& loc, bool literal) const -{ - TConstUnionArray unionArray(1); - unionArray[0].setBConst(b); - - return addConstantUnion(unionArray, TType(EbtBool, EvqConst), loc, literal); -} - -TIntermConstantUnion* TIntermediate::addConstantUnion(double d, TBasicType baseType, const TSourceLoc& loc, bool literal) const -{ -#ifdef AMD_EXTENSIONS - assert(baseType == EbtFloat || baseType == EbtDouble || baseType == EbtFloat16); -#else - assert(baseType == EbtFloat || baseType == EbtDouble); -#endif - - TConstUnionArray unionArray(1); - unionArray[0].setDConst(d); - - return addConstantUnion(unionArray, TType(baseType, EvqConst), loc, literal); -} - -TIntermConstantUnion* TIntermediate::addConstantUnion(const TString* s, const TSourceLoc& loc, bool literal) const -{ - TConstUnionArray unionArray(1); - unionArray[0].setSConst(s); - - return addConstantUnion(unionArray, TType(EbtString, EvqConst), loc, literal); -} - -// Put vector swizzle selectors onto the given sequence -void TIntermediate::pushSelector(TIntermSequence& sequence, const TVectorSelector& selector, const TSourceLoc& loc) -{ - TIntermConstantUnion* constIntNode = addConstantUnion(selector, loc); - sequence.push_back(constIntNode); -} - -// Put matrix swizzle selectors onto the given sequence -void TIntermediate::pushSelector(TIntermSequence& sequence, const TMatrixSelector& selector, const TSourceLoc& loc) -{ - TIntermConstantUnion* constIntNode = addConstantUnion(selector.coord1, loc); - sequence.push_back(constIntNode); - constIntNode = addConstantUnion(selector.coord2, loc); - sequence.push_back(constIntNode); -} - -// Make an aggregate node that has a sequence of all selectors. -template TIntermTyped* TIntermediate::addSwizzle(TSwizzleSelectors& selector, const TSourceLoc& loc); -template TIntermTyped* TIntermediate::addSwizzle(TSwizzleSelectors& selector, const TSourceLoc& loc); -template -TIntermTyped* TIntermediate::addSwizzle(TSwizzleSelectors& selector, const TSourceLoc& loc) -{ - TIntermAggregate* node = new TIntermAggregate(EOpSequence); - - node->setLoc(loc); - TIntermSequence &sequenceVector = node->getSequence(); - - for (int i = 0; i < selector.size(); i++) - pushSelector(sequenceVector, selector[i], loc); - - return node; -} - -// -// Follow the left branches down to the root of an l-value -// expression (just "." and []). -// -// Return the base of the l-value (where following indexing quits working). -// Return nullptr if a chain following dereferences cannot be followed. -// -// 'swizzleOkay' says whether or not it is okay to consider a swizzle -// a valid part of the dereference chain. -// -const TIntermTyped* TIntermediate::findLValueBase(const TIntermTyped* node, bool swizzleOkay) -{ - do { - const TIntermBinary* binary = node->getAsBinaryNode(); - if (binary == nullptr) - return node; - TOperator op = binary->getOp(); - if (op != EOpIndexDirect && op != EOpIndexIndirect && op != EOpIndexDirectStruct && op != EOpVectorSwizzle && op != EOpMatrixSwizzle) - return nullptr; - if (! swizzleOkay) { - if (op == EOpVectorSwizzle || op == EOpMatrixSwizzle) - return nullptr; - if ((op == EOpIndexDirect || op == EOpIndexIndirect) && - (binary->getLeft()->getType().isVector() || binary->getLeft()->getType().isScalar()) && - ! binary->getLeft()->getType().isArray()) - return nullptr; - } - node = node->getAsBinaryNode()->getLeft(); - } while (true); -} - -// -// Create while and do-while loop nodes. -// -TIntermLoop* TIntermediate::addLoop(TIntermNode* body, TIntermTyped* test, TIntermTyped* terminal, bool testFirst, const TSourceLoc& loc, TLoopControl control) -{ - TIntermLoop* node = new TIntermLoop(body, test, terminal, testFirst); - node->setLoc(loc); - node->setLoopControl(control); - - return node; -} - -// -// Create a for-loop sequence. -// -TIntermAggregate* TIntermediate::addForLoop(TIntermNode* body, TIntermNode* initializer, TIntermTyped* test, TIntermTyped* terminal, bool testFirst, const TSourceLoc& loc, TLoopControl control) -{ - TIntermLoop* node = new TIntermLoop(body, test, terminal, testFirst); - node->setLoc(loc); - node->setLoopControl(control); - - // make a sequence of the initializer and statement, but try to reuse the - // aggregate already created for whatever is in the initializer, if there is one - TIntermAggregate* loopSequence = (initializer == nullptr || - initializer->getAsAggregate() == nullptr) ? makeAggregate(initializer, loc) - : initializer->getAsAggregate(); - if (loopSequence != nullptr && loopSequence->getOp() == EOpSequence) - loopSequence->setOp(EOpNull); - loopSequence = growAggregate(loopSequence, node); - loopSequence->setOperator(EOpSequence); - - return loopSequence; -} - -// -// Add branches. -// -TIntermBranch* TIntermediate::addBranch(TOperator branchOp, const TSourceLoc& loc) -{ - return addBranch(branchOp, nullptr, loc); -} - -TIntermBranch* TIntermediate::addBranch(TOperator branchOp, TIntermTyped* expression, const TSourceLoc& loc) -{ - TIntermBranch* node = new TIntermBranch(branchOp, expression); - node->setLoc(loc); - - return node; -} - -// -// This is to be executed after the final root is put on top by the parsing -// process. -// -bool TIntermediate::postProcess(TIntermNode* root, EShLanguage /*language*/) -{ - if (root == nullptr) - return true; - - // Finish off the top-level sequence - TIntermAggregate* aggRoot = root->getAsAggregate(); - if (aggRoot && aggRoot->getOp() == EOpNull) - aggRoot->setOperator(EOpSequence); - - // Propagate 'noContraction' label in backward from 'precise' variables. - glslang::PropagateNoContraction(*this); - - switch (textureSamplerTransformMode) { - case EShTexSampTransKeep: - break; - case EShTexSampTransUpgradeTextureRemoveSampler: - performTextureUpgradeAndSamplerRemovalTransformation(root); - break; - } - - return true; -} - -void TIntermediate::addSymbolLinkageNodes(TIntermAggregate*& linkage, EShLanguage language, TSymbolTable& symbolTable) -{ - // Add top-level nodes for declarations that must be checked cross - // compilation unit by a linker, yet might not have been referenced - // by the AST. - // - // Almost entirely, translation of symbols is driven by what's present - // in the AST traversal, not by translating the symbol table. - // - // However, there are some special cases: - // - From the specification: "Special built-in inputs gl_VertexID and - // gl_InstanceID are also considered active vertex attributes." - // - Linker-based type mismatch error reporting needs to see all - // uniforms/ins/outs variables and blocks. - // - ftransform() can make gl_Vertex and gl_ModelViewProjectionMatrix active. - // - - // if (ftransformUsed) { - // TODO: 1.1 lowering functionality: track ftransform() usage - // addSymbolLinkageNode(root, symbolTable, "gl_Vertex"); - // addSymbolLinkageNode(root, symbolTable, "gl_ModelViewProjectionMatrix"); - //} - - if (language == EShLangVertex) { - // the names won't be found in the symbol table unless the versions are right, - // so version logic does not need to be repeated here - addSymbolLinkageNode(linkage, symbolTable, "gl_VertexID"); - addSymbolLinkageNode(linkage, symbolTable, "gl_InstanceID"); - } - - // Add a child to the root node for the linker objects - linkage->setOperator(EOpLinkerObjects); - treeRoot = growAggregate(treeRoot, linkage); -} - -// -// Add the given name or symbol to the list of nodes at the end of the tree used -// for link-time checking and external linkage. -// - -void TIntermediate::addSymbolLinkageNode(TIntermAggregate*& linkage, TSymbolTable& symbolTable, const TString& name) -{ - TSymbol* symbol = symbolTable.find(name); - if (symbol) - addSymbolLinkageNode(linkage, *symbol->getAsVariable()); -} - -void TIntermediate::addSymbolLinkageNode(TIntermAggregate*& linkage, const TSymbol& symbol) -{ - const TVariable* variable = symbol.getAsVariable(); - if (! variable) { - // This must be a member of an anonymous block, and we need to add the whole block - const TAnonMember* anon = symbol.getAsAnonMember(); - variable = &anon->getAnonContainer(); - } - TIntermSymbol* node = addSymbol(*variable); - linkage = growAggregate(linkage, node); -} - -// -// Add a caller->callee relationship to the call graph. -// Assumes the strings are unique per signature. -// -void TIntermediate::addToCallGraph(TInfoSink& /*infoSink*/, const TString& caller, const TString& callee) -{ - // Duplicates are okay, but faster to not keep them, and they come grouped by caller, - // as long as new ones are push on the same end we check on for duplicates - for (TGraph::const_iterator call = callGraph.begin(); call != callGraph.end(); ++call) { - if (call->caller != caller) - break; - if (call->callee == callee) - return; - } - - callGraph.push_front(TCall(caller, callee)); -} - -// -// This deletes the tree. -// -void TIntermediate::removeTree() -{ - if (treeRoot) - RemoveAllTreeNodes(treeRoot); -} - -// -// Implement the part of KHR_vulkan_glsl that lists the set of operations -// that can result in a specialization constant operation. -// -// "5.x Specialization Constant Operations" -// -// Only some operations discussed in this section may be applied to a -// specialization constant and still yield a result that is as -// specialization constant. The operations allowed are listed below. -// When a specialization constant is operated on with one of these -// operators and with another constant or specialization constant, the -// result is implicitly a specialization constant. -// -// - int(), uint(), and bool() constructors for type conversions -// from any of the following types to any of the following types: -// * int -// * uint -// * bool -// - vector versions of the above conversion constructors -// - allowed implicit conversions of the above -// - swizzles (e.g., foo.yx) -// - The following when applied to integer or unsigned integer types: -// * unary negative ( - ) -// * binary operations ( + , - , * , / , % ) -// * shift ( <<, >> ) -// * bitwise operations ( & , | , ^ ) -// - The following when applied to integer or unsigned integer scalar types: -// * comparison ( == , != , > , >= , < , <= ) -// - The following when applied to the Boolean scalar type: -// * not ( ! ) -// * logical operations ( && , || , ^^ ) -// * comparison ( == , != )" -// -// This function just handles binary and unary nodes. Construction -// rules are handled in construction paths that are not covered by the unary -// and binary paths, while required conversions will still show up here -// as unary converters in the from a construction operator. -// -bool TIntermediate::isSpecializationOperation(const TIntermOperator& node) const -{ - // The operations resulting in floating point are quite limited - // (However, some floating-point operations result in bool, like ">", - // so are handled later.) - if (node.getType().isFloatingDomain()) { - switch (node.getOp()) { - case EOpIndexDirect: - case EOpIndexIndirect: - case EOpIndexDirectStruct: - case EOpVectorSwizzle: - case EOpConvFloatToDouble: - case EOpConvDoubleToFloat: -#ifdef AMD_EXTENSIONS - case EOpConvFloat16ToFloat: - case EOpConvFloatToFloat16: - case EOpConvFloat16ToDouble: - case EOpConvDoubleToFloat16: -#endif - return true; - default: - return false; - } - } - - // Check for floating-point arguments - if (const TIntermBinary* bin = node.getAsBinaryNode()) - if (bin->getLeft() ->getType().isFloatingDomain() || - bin->getRight()->getType().isFloatingDomain()) - return false; - - // So, for now, we can assume everything left is non-floating-point... - - // Now check for integer/bool-based operations - switch (node.getOp()) { - - // dereference/swizzle - case EOpIndexDirect: - case EOpIndexIndirect: - case EOpIndexDirectStruct: - case EOpVectorSwizzle: - - // conversion constructors - case EOpConvIntToBool: - case EOpConvUintToBool: - case EOpConvUintToInt: - case EOpConvBoolToInt: - case EOpConvIntToUint: - case EOpConvBoolToUint: - case EOpConvInt64ToBool: - case EOpConvBoolToInt64: - case EOpConvUint64ToBool: - case EOpConvBoolToUint64: - case EOpConvInt64ToInt: - case EOpConvIntToInt64: - case EOpConvUint64ToUint: - case EOpConvUintToUint64: - case EOpConvInt64ToUint64: - case EOpConvUint64ToInt64: - case EOpConvInt64ToUint: - case EOpConvUintToInt64: - case EOpConvUint64ToInt: - case EOpConvIntToUint64: -#ifdef AMD_EXTENSIONS - case EOpConvInt16ToBool: - case EOpConvBoolToInt16: - case EOpConvInt16ToInt: - case EOpConvIntToInt16: - case EOpConvInt16ToUint: - case EOpConvUintToInt16: - case EOpConvInt16ToInt64: - case EOpConvInt64ToInt16: - case EOpConvInt16ToUint64: - case EOpConvUint64ToInt16: - case EOpConvUint16ToBool: - case EOpConvBoolToUint16: - case EOpConvUint16ToInt: - case EOpConvIntToUint16: - case EOpConvUint16ToUint: - case EOpConvUintToUint16: - case EOpConvUint16ToInt64: - case EOpConvInt64ToUint16: - case EOpConvUint16ToUint64: - case EOpConvUint64ToUint16: - case EOpConvInt16ToUint16: - case EOpConvUint16ToInt16: -#endif - - // unary operations - case EOpNegative: - case EOpLogicalNot: - case EOpBitwiseNot: - - // binary operations - case EOpAdd: - case EOpSub: - case EOpMul: - case EOpVectorTimesScalar: - case EOpDiv: - case EOpMod: - case EOpRightShift: - case EOpLeftShift: - case EOpAnd: - case EOpInclusiveOr: - case EOpExclusiveOr: - case EOpLogicalOr: - case EOpLogicalXor: - case EOpLogicalAnd: - case EOpEqual: - case EOpNotEqual: - case EOpLessThan: - case EOpGreaterThan: - case EOpLessThanEqual: - case EOpGreaterThanEqual: - return true; - default: - return false; - } -} - -//////////////////////////////////////////////////////////////// -// -// Member functions of the nodes used for building the tree. -// -//////////////////////////////////////////////////////////////// - -// -// Say whether or not an operation node changes the value of a variable. -// -// Returns true if state is modified. -// -bool TIntermOperator::modifiesState() const -{ - switch (op) { - case EOpPostIncrement: - case EOpPostDecrement: - case EOpPreIncrement: - case EOpPreDecrement: - case EOpAssign: - case EOpAddAssign: - case EOpSubAssign: - case EOpMulAssign: - case EOpVectorTimesMatrixAssign: - case EOpVectorTimesScalarAssign: - case EOpMatrixTimesScalarAssign: - case EOpMatrixTimesMatrixAssign: - case EOpDivAssign: - case EOpModAssign: - case EOpAndAssign: - case EOpInclusiveOrAssign: - case EOpExclusiveOrAssign: - case EOpLeftShiftAssign: - case EOpRightShiftAssign: - return true; - default: - return false; - } -} - -// -// returns true if the operator is for one of the constructors -// -bool TIntermOperator::isConstructor() const -{ - return op > EOpConstructGuardStart && op < EOpConstructGuardEnd; -} - -// -// Make sure the type of an operator is appropriate for its -// combination of operation and operand type. This will invoke -// promoteUnary, promoteBinary, etc as needed. -// -// Returns false if nothing makes sense. -// -bool TIntermediate::promote(TIntermOperator* node) -{ - if (node == nullptr) - return false; - - if (node->getAsUnaryNode()) - return promoteUnary(*node->getAsUnaryNode()); - - if (node->getAsBinaryNode()) - return promoteBinary(*node->getAsBinaryNode()); - - if (node->getAsAggregate()) - return promoteAggregate(*node->getAsAggregate()); - - return false; -} - -// -// See TIntermediate::promote -// -bool TIntermediate::promoteUnary(TIntermUnary& node) -{ - const TOperator op = node.getOp(); - TIntermTyped* operand = node.getOperand(); - - switch (op) { - case EOpLogicalNot: - // Convert operand to a boolean type - if (operand->getBasicType() != EbtBool) { - // Add constructor to boolean type. If that fails, we can't do it, so return false. - TIntermTyped* converted = convertToBasicType(op, EbtBool, operand); - if (converted == nullptr) - return false; - - // Use the result of converting the node to a bool. - node.setOperand(operand = converted); // also updates stack variable - } - break; - case EOpBitwiseNot: - if (operand->getBasicType() != EbtInt && - operand->getBasicType() != EbtUint && -#ifdef AMD_EXTENSIONS - operand->getBasicType() != EbtInt16 && - operand->getBasicType() != EbtUint16 && -#endif - operand->getBasicType() != EbtInt64 && - operand->getBasicType() != EbtUint64) - - return false; - break; - case EOpNegative: - case EOpPostIncrement: - case EOpPostDecrement: - case EOpPreIncrement: - case EOpPreDecrement: - if (operand->getBasicType() != EbtInt && - operand->getBasicType() != EbtUint && - operand->getBasicType() != EbtInt64 && - operand->getBasicType() != EbtUint64 && -#ifdef AMD_EXTENSIONS - operand->getBasicType() != EbtInt16 && - operand->getBasicType() != EbtUint16 && -#endif - operand->getBasicType() != EbtFloat && -#ifdef AMD_EXTENSIONS - operand->getBasicType() != EbtFloat16 && -#endif - operand->getBasicType() != EbtDouble) - - return false; - break; - - default: - if (operand->getBasicType() != EbtFloat) - - return false; - } - - node.setType(operand->getType()); - node.getWritableType().getQualifier().makeTemporary(); - - return true; -} - -void TIntermUnary::updatePrecision() -{ -#ifdef AMD_EXTENSIONS - if (getBasicType() == EbtInt || getBasicType() == EbtUint || getBasicType() == EbtFloat || getBasicType() == EbtFloat16) { -#else - if (getBasicType() == EbtInt || getBasicType() == EbtUint || getBasicType() == EbtFloat) { -#endif - if (operand->getQualifier().precision > getQualifier().precision) - getQualifier().precision = operand->getQualifier().precision; - } -} - -// If it is not already, convert this node to the given basic type. -TIntermTyped* TIntermediate::convertToBasicType(TOperator op, TBasicType basicType, TIntermTyped* node) const -{ - if (node == nullptr) - return nullptr; - - // It's already this basic type: nothing needs to be done, so use the node directly. - if (node->getBasicType() == basicType) - return node; - - const TType& type = node->getType(); - const TType newType(basicType, type.getQualifier().storage, - type.getVectorSize(), type.getMatrixCols(), type.getMatrixRows(), type.isVector()); - - // Add constructor to the right vectorness of the right type. If that fails, we can't do it, so return nullptr. - return addConversion(op, newType, node); -} - -// -// See TIntermediate::promote -// -bool TIntermediate::promoteBinary(TIntermBinary& node) -{ - TOperator op = node.getOp(); - TIntermTyped* left = node.getLeft(); - TIntermTyped* right = node.getRight(); - - // Arrays and structures have to be exact matches. - if ((left->isArray() || right->isArray() || left->getBasicType() == EbtStruct || right->getBasicType() == EbtStruct) - && left->getType() != right->getType()) - return false; - - // Base assumption: just make the type the same as the left - // operand. Only deviations from this will be coded. - node.setType(left->getType()); - node.getWritableType().getQualifier().clear(); - - // Composite and opaque types don't having pending operator changes, e.g., - // array, structure, and samplers. Just establish final type and correctness. - if (left->isArray() || left->getBasicType() == EbtStruct || left->getBasicType() == EbtSampler) { - switch (op) { - case EOpEqual: - case EOpNotEqual: - if (left->getBasicType() == EbtSampler) { - // can't compare samplers - return false; - } else { - // Promote to conditional - node.setType(TType(EbtBool)); - } - - return true; - - case EOpAssign: - // Keep type from above - - return true; - - default: - return false; - } - } - - // - // We now have only scalars, vectors, and matrices to worry about. - // - - // HLSL implicitly promotes bool -> int for numeric operations. - // (Implicit conversions to make the operands match each other's types were already done.) - if (getSource() == EShSourceHlsl && - (left->getBasicType() == EbtBool || right->getBasicType() == EbtBool)) { - switch (op) { - case EOpLessThan: - case EOpGreaterThan: - case EOpLessThanEqual: - case EOpGreaterThanEqual: - - case EOpRightShift: - case EOpLeftShift: - - case EOpMod: - - case EOpAnd: - case EOpInclusiveOr: - case EOpExclusiveOr: - - case EOpAdd: - case EOpSub: - case EOpDiv: - case EOpMul: - left = addConversion(op, TType(EbtInt, EvqTemporary, left->getVectorSize()), left); - right = addConversion(op, TType(EbtInt, EvqTemporary, right->getVectorSize()), right); - if (left == nullptr || right == nullptr) - return false; - node.setLeft(left); - node.setRight(right); - - // Update the original base assumption on result type.. - node.setType(left->getType()); - node.getWritableType().getQualifier().clear(); - - break; - - default: - break; - } - } - - // Do general type checks against individual operands (comparing left and right is coming up, checking mixed shapes after that) - switch (op) { - case EOpLessThan: - case EOpGreaterThan: - case EOpLessThanEqual: - case EOpGreaterThanEqual: - // Relational comparisons need numeric types and will promote to scalar Boolean. - if (left->getBasicType() == EbtBool) - return false; - - node.setType(TType(EbtBool, EvqTemporary, left->getVectorSize())); - break; - - case EOpEqual: - case EOpNotEqual: - if (getSource() == EShSourceHlsl) { - const int resultWidth = std::max(left->getVectorSize(), right->getVectorSize()); - - // In HLSL, == or != on vectors means component-wise comparison. - if (resultWidth > 1) { - op = (op == EOpEqual) ? EOpVectorEqual : EOpVectorNotEqual; - node.setOp(op); - } - - node.setType(TType(EbtBool, EvqTemporary, resultWidth)); - } else { - // All the above comparisons result in a bool (but not the vector compares) - node.setType(TType(EbtBool)); - } - break; - - case EOpLogicalAnd: - case EOpLogicalOr: - case EOpLogicalXor: - if (getSource() == EShSourceHlsl) { - TIntermTyped* convertedL = convertToBasicType(op, EbtBool, left); - TIntermTyped* convertedR = convertToBasicType(op, EbtBool, right); - if (convertedL == nullptr || convertedR == nullptr) - return false; - node.setLeft(left = convertedL); // also updates stack variable - node.setRight(right = convertedR); // also updates stack variable - } else { - // logical ops operate only on scalar Booleans and will promote to scalar Boolean. - if (left->getBasicType() != EbtBool || left->isVector() || left->isMatrix()) - return false; - } - - node.setType(TType(EbtBool, EvqTemporary, left->getVectorSize())); - - break; - - case EOpRightShift: - case EOpLeftShift: - case EOpRightShiftAssign: - case EOpLeftShiftAssign: - - case EOpMod: - case EOpModAssign: - - case EOpAnd: - case EOpInclusiveOr: - case EOpExclusiveOr: - case EOpAndAssign: - case EOpInclusiveOrAssign: - case EOpExclusiveOrAssign: - if (getSource() == EShSourceHlsl) - break; - - // Check for integer-only operands. - if ((left->getBasicType() != EbtInt && left->getBasicType() != EbtUint && -#ifdef AMD_EXTENSIONS - left->getBasicType() != EbtInt16 && left->getBasicType() != EbtUint16 && -#endif - left->getBasicType() != EbtInt64 && left->getBasicType() != EbtUint64) || - (right->getBasicType() != EbtInt && right->getBasicType() != EbtUint && -#ifdef AMD_EXTENSIONS - right->getBasicType() != EbtInt16 && right->getBasicType() != EbtUint16 && -#endif - right->getBasicType() != EbtInt64 && right->getBasicType() != EbtUint64)) - return false; - if (left->isMatrix() || right->isMatrix()) - return false; - - break; - - case EOpAdd: - case EOpSub: - case EOpDiv: - case EOpMul: - case EOpAddAssign: - case EOpSubAssign: - case EOpMulAssign: - case EOpDivAssign: - // check for non-Boolean operands - if (left->getBasicType() == EbtBool || right->getBasicType() == EbtBool) - return false; - - default: - break; - } - - // Compare left and right, and finish with the cases where the operand types must match - switch (op) { - case EOpLessThan: - case EOpGreaterThan: - case EOpLessThanEqual: - case EOpGreaterThanEqual: - - case EOpEqual: - case EOpNotEqual: - case EOpVectorEqual: - case EOpVectorNotEqual: - - case EOpLogicalAnd: - case EOpLogicalOr: - case EOpLogicalXor: - return left->getType() == right->getType(); - - case EOpMod: - case EOpModAssign: - - case EOpAnd: - case EOpInclusiveOr: - case EOpExclusiveOr: - case EOpAndAssign: - case EOpInclusiveOrAssign: - case EOpExclusiveOrAssign: - - case EOpAdd: - case EOpSub: - case EOpDiv: - - case EOpAddAssign: - case EOpSubAssign: - case EOpDivAssign: - // Quick out in case the types do match - if (left->getType() == right->getType()) - return true; - - // Fall through - - case EOpMul: - case EOpMulAssign: - // At least the basic type has to match - if (left->getBasicType() != right->getBasicType()) - return false; - - default: - break; - } - - // Finish handling the case, for all ops, where both operands are scalars. - if (left->isScalar() && right->isScalar()) - return true; - - // Finish handling the case, for all ops, where there are two vectors of different sizes - if (left->isVector() && right->isVector() && left->getVectorSize() != right->getVectorSize() && right->getVectorSize() > 1) - return false; - - // - // We now have a mix of scalars, vectors, or matrices, for non-relational operations. - // - - // Can these two operands be combined, what is the resulting type? - TBasicType basicType = left->getBasicType(); - switch (op) { - case EOpMul: - if (!left->isMatrix() && right->isMatrix()) { - if (left->isVector()) { - if (left->getVectorSize() != right->getMatrixRows()) - return false; - node.setOp(op = EOpVectorTimesMatrix); - node.setType(TType(basicType, EvqTemporary, right->getMatrixCols())); - } else { - node.setOp(op = EOpMatrixTimesScalar); - node.setType(TType(basicType, EvqTemporary, 0, right->getMatrixCols(), right->getMatrixRows())); - } - } else if (left->isMatrix() && !right->isMatrix()) { - if (right->isVector()) { - if (left->getMatrixCols() != right->getVectorSize()) - return false; - node.setOp(op = EOpMatrixTimesVector); - node.setType(TType(basicType, EvqTemporary, left->getMatrixRows())); - } else { - node.setOp(op = EOpMatrixTimesScalar); - } - } else if (left->isMatrix() && right->isMatrix()) { - if (left->getMatrixCols() != right->getMatrixRows()) - return false; - node.setOp(op = EOpMatrixTimesMatrix); - node.setType(TType(basicType, EvqTemporary, 0, right->getMatrixCols(), left->getMatrixRows())); - } else if (! left->isMatrix() && ! right->isMatrix()) { - if (left->isVector() && right->isVector()) { - ; // leave as component product - } else if (left->isVector() || right->isVector()) { - node.setOp(op = EOpVectorTimesScalar); - if (right->isVector()) - node.setType(TType(basicType, EvqTemporary, right->getVectorSize())); - } - } else { - return false; - } - break; - case EOpMulAssign: - if (! left->isMatrix() && right->isMatrix()) { - if (left->isVector()) { - if (left->getVectorSize() != right->getMatrixRows() || left->getVectorSize() != right->getMatrixCols()) - return false; - node.setOp(op = EOpVectorTimesMatrixAssign); - } else { - return false; - } - } else if (left->isMatrix() && !right->isMatrix()) { - if (right->isVector()) { - return false; - } else { - node.setOp(op = EOpMatrixTimesScalarAssign); - } - } else if (left->isMatrix() && right->isMatrix()) { - if (left->getMatrixCols() != left->getMatrixRows() || left->getMatrixCols() != right->getMatrixCols() || left->getMatrixCols() != right->getMatrixRows()) - return false; - node.setOp(op = EOpMatrixTimesMatrixAssign); - } else if (!left->isMatrix() && !right->isMatrix()) { - if (left->isVector() && right->isVector()) { - // leave as component product - } else if (left->isVector() || right->isVector()) { - if (! left->isVector()) - return false; - node.setOp(op = EOpVectorTimesScalarAssign); - } - } else { - return false; - } - break; - - case EOpRightShift: - case EOpLeftShift: - case EOpRightShiftAssign: - case EOpLeftShiftAssign: - if (right->isVector() && (! left->isVector() || right->getVectorSize() != left->getVectorSize())) - return false; - break; - - case EOpAssign: - if (left->getVectorSize() != right->getVectorSize() || left->getMatrixCols() != right->getMatrixCols() || left->getMatrixRows() != right->getMatrixRows()) - return false; - // fall through - - case EOpAdd: - case EOpSub: - case EOpDiv: - case EOpMod: - case EOpAnd: - case EOpInclusiveOr: - case EOpExclusiveOr: - case EOpAddAssign: - case EOpSubAssign: - case EOpDivAssign: - case EOpModAssign: - case EOpAndAssign: - case EOpInclusiveOrAssign: - case EOpExclusiveOrAssign: - - if ((left->isMatrix() && right->isVector()) || - (left->isVector() && right->isMatrix()) || - left->getBasicType() != right->getBasicType()) - return false; - if (left->isMatrix() && right->isMatrix() && (left->getMatrixCols() != right->getMatrixCols() || left->getMatrixRows() != right->getMatrixRows())) - return false; - if (left->isVector() && right->isVector() && left->getVectorSize() != right->getVectorSize()) - return false; - if (right->isVector() || right->isMatrix()) { - node.getWritableType().shallowCopy(right->getType()); - node.getWritableType().getQualifier().makeTemporary(); - } - break; - - default: - return false; - } - - // - // One more check for assignment. - // - switch (op) { - // The resulting type has to match the left operand. - case EOpAssign: - case EOpAddAssign: - case EOpSubAssign: - case EOpMulAssign: - case EOpDivAssign: - case EOpModAssign: - case EOpAndAssign: - case EOpInclusiveOrAssign: - case EOpExclusiveOrAssign: - case EOpLeftShiftAssign: - case EOpRightShiftAssign: - if (node.getType() != left->getType()) - return false; - break; - default: - break; - } - - return true; -} - -// -// See TIntermediate::promote -// -bool TIntermediate::promoteAggregate(TIntermAggregate& node) -{ - TOperator op = node.getOp(); - TIntermSequence& args = node.getSequence(); - const int numArgs = static_cast(args.size()); - - // Presently, only hlsl does intrinsic promotions. - if (getSource() != EShSourceHlsl) - return true; - - // set of opcodes that can be promoted in this manner. - switch (op) { - case EOpAtan: - case EOpClamp: - case EOpCross: - case EOpDistance: - case EOpDot: - case EOpDst: - case EOpFaceForward: - // case EOpFindMSB: TODO: - // case EOpFindLSB: TODO: - case EOpFma: - case EOpMod: - case EOpFrexp: - case EOpLdexp: - case EOpMix: - case EOpLit: - case EOpMax: - case EOpMin: - case EOpModf: - // case EOpGenMul: TODO: - case EOpPow: - case EOpReflect: - case EOpRefract: - // case EOpSinCos: TODO: - case EOpSmoothStep: - case EOpStep: - break; - default: - return true; - } - - // TODO: array and struct behavior - - // Try converting all nodes to the given node's type - TIntermSequence convertedArgs(numArgs, nullptr); - - // Try to convert all types to the nonConvArg type. - for (int nonConvArg = 0; nonConvArg < numArgs; ++nonConvArg) { - // Try converting all args to this arg's type - for (int convArg = 0; convArg < numArgs; ++convArg) { - convertedArgs[convArg] = addConversion(op, args[nonConvArg]->getAsTyped()->getType(), - args[convArg]->getAsTyped()); - } - - // If we successfully converted all the args, use the result. - if (std::all_of(convertedArgs.begin(), convertedArgs.end(), - [](const TIntermNode* node) { return node != nullptr; })) { - - std::swap(args, convertedArgs); - return true; - } - } - - return false; -} - -void TIntermBinary::updatePrecision() -{ -#ifdef AMD_EXTENSIONS - if (getBasicType() == EbtInt || getBasicType() == EbtUint || getBasicType() == EbtFloat || getBasicType() == EbtFloat16) { -#else - if (getBasicType() == EbtInt || getBasicType() == EbtUint || getBasicType() == EbtFloat) { -#endif - getQualifier().precision = std::max(right->getQualifier().precision, left->getQualifier().precision); - if (getQualifier().precision != EpqNone) { - left->propagatePrecision(getQualifier().precision); - right->propagatePrecision(getQualifier().precision); - } - } -} - -void TIntermTyped::propagatePrecision(TPrecisionQualifier newPrecision) -{ -#ifdef AMD_EXTENSIONS - if (getQualifier().precision != EpqNone || (getBasicType() != EbtInt && getBasicType() != EbtUint && getBasicType() != EbtFloat && getBasicType() != EbtFloat16)) -#else - if (getQualifier().precision != EpqNone || (getBasicType() != EbtInt && getBasicType() != EbtUint && getBasicType() != EbtFloat)) -#endif - return; - - getQualifier().precision = newPrecision; - - TIntermBinary* binaryNode = getAsBinaryNode(); - if (binaryNode) { - binaryNode->getLeft()->propagatePrecision(newPrecision); - binaryNode->getRight()->propagatePrecision(newPrecision); - - return; - } - - TIntermUnary* unaryNode = getAsUnaryNode(); - if (unaryNode) { - unaryNode->getOperand()->propagatePrecision(newPrecision); - - return; - } - - TIntermAggregate* aggregateNode = getAsAggregate(); - if (aggregateNode) { - TIntermSequence operands = aggregateNode->getSequence(); - for (unsigned int i = 0; i < operands.size(); ++i) { - TIntermTyped* typedNode = operands[i]->getAsTyped(); - if (! typedNode) - break; - typedNode->propagatePrecision(newPrecision); - } - - return; - } - - TIntermSelection* selectionNode = getAsSelectionNode(); - if (selectionNode) { - TIntermTyped* typedNode = selectionNode->getTrueBlock()->getAsTyped(); - if (typedNode) { - typedNode->propagatePrecision(newPrecision); - typedNode = selectionNode->getFalseBlock()->getAsTyped(); - if (typedNode) - typedNode->propagatePrecision(newPrecision); - } - - return; - } -} - -TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermConstantUnion* node) const -{ - const TConstUnionArray& rightUnionArray = node->getConstArray(); - int size = node->getType().computeNumComponents(); - - TConstUnionArray leftUnionArray(size); - - for (int i=0; i < size; i++) { - switch (promoteTo) { - case EbtFloat: - switch (node->getType().getBasicType()) { - case EbtInt: - leftUnionArray[i].setDConst(static_cast(rightUnionArray[i].getIConst())); - break; - case EbtUint: - leftUnionArray[i].setDConst(static_cast(rightUnionArray[i].getUConst())); - break; - case EbtInt64: - leftUnionArray[i].setDConst(static_cast(rightUnionArray[i].getI64Const())); - break; - case EbtUint64: - leftUnionArray[i].setDConst(static_cast(rightUnionArray[i].getU64Const())); - break; - case EbtBool: - leftUnionArray[i].setDConst(static_cast(rightUnionArray[i].getBConst())); - break; - case EbtFloat: - case EbtDouble: -#ifdef AMD_EXTENSIONS - case EbtFloat16: -#endif - leftUnionArray[i] = rightUnionArray[i]; - break; - default: - return node; - } - break; - case EbtDouble: - switch (node->getType().getBasicType()) { - case EbtInt: - leftUnionArray[i].setDConst(static_cast(rightUnionArray[i].getIConst())); - break; - case EbtUint: - leftUnionArray[i].setDConst(static_cast(rightUnionArray[i].getUConst())); - break; - case EbtInt64: - leftUnionArray[i].setDConst(static_cast(rightUnionArray[i].getI64Const())); - break; - case EbtUint64: - leftUnionArray[i].setDConst(static_cast(rightUnionArray[i].getU64Const())); - break; - case EbtBool: - leftUnionArray[i].setDConst(static_cast(rightUnionArray[i].getBConst())); - break; - case EbtFloat: - case EbtDouble: -#ifdef AMD_EXTENSIONS - case EbtFloat16: -#endif - leftUnionArray[i] = rightUnionArray[i]; - break; - default: - return node; - } - break; -#ifdef AMD_EXTENSIONS - case EbtFloat16: - switch (node->getType().getBasicType()) { - case EbtInt: - leftUnionArray[i].setDConst(static_cast(rightUnionArray[i].getIConst())); - break; - case EbtUint: - leftUnionArray[i].setDConst(static_cast(rightUnionArray[i].getUConst())); - break; - case EbtInt64: - leftUnionArray[i].setDConst(static_cast(rightUnionArray[i].getI64Const())); - break; - case EbtUint64: - leftUnionArray[i].setDConst(static_cast(rightUnionArray[i].getU64Const())); - break; - case EbtBool: - leftUnionArray[i].setDConst(static_cast(rightUnionArray[i].getBConst())); - break; - case EbtFloat: - case EbtDouble: - case EbtFloat16: - leftUnionArray[i] = rightUnionArray[i]; - break; - default: - return node; - } - break; -#endif - case EbtInt: - switch (node->getType().getBasicType()) { - case EbtInt: - leftUnionArray[i] = rightUnionArray[i]; - break; - case EbtUint: - leftUnionArray[i].setIConst(static_cast(rightUnionArray[i].getUConst())); - break; - case EbtInt64: - leftUnionArray[i].setIConst(static_cast(rightUnionArray[i].getI64Const())); - break; - case EbtUint64: - leftUnionArray[i].setIConst(static_cast(rightUnionArray[i].getU64Const())); - break; - case EbtBool: - leftUnionArray[i].setIConst(static_cast(rightUnionArray[i].getBConst())); - break; - case EbtFloat: - case EbtDouble: -#ifdef AMD_EXTENSIONS - case EbtFloat16: -#endif - leftUnionArray[i].setIConst(static_cast(rightUnionArray[i].getDConst())); - break; - default: - return node; - } - break; - case EbtUint: - switch (node->getType().getBasicType()) { - case EbtInt: - leftUnionArray[i].setUConst(static_cast(rightUnionArray[i].getIConst())); - break; - case EbtUint: - leftUnionArray[i] = rightUnionArray[i]; - break; - case EbtInt64: - leftUnionArray[i].setUConst(static_cast(rightUnionArray[i].getI64Const())); - break; - case EbtUint64: - leftUnionArray[i].setUConst(static_cast(rightUnionArray[i].getU64Const())); - break; - case EbtBool: - leftUnionArray[i].setUConst(static_cast(rightUnionArray[i].getBConst())); - break; - case EbtFloat: - case EbtDouble: -#ifdef AMD_EXTENSIONS - case EbtFloat16: -#endif - leftUnionArray[i].setUConst(static_cast(rightUnionArray[i].getDConst())); - break; - default: - return node; - } - break; - case EbtBool: - switch (node->getType().getBasicType()) { - case EbtInt: - leftUnionArray[i].setBConst(rightUnionArray[i].getIConst() != 0); - break; - case EbtUint: - leftUnionArray[i].setBConst(rightUnionArray[i].getUConst() != 0); - break; - case EbtInt64: - leftUnionArray[i].setBConst(rightUnionArray[i].getI64Const() != 0); - break; - case EbtUint64: - leftUnionArray[i].setBConst(rightUnionArray[i].getU64Const() != 0); - break; - case EbtBool: - leftUnionArray[i] = rightUnionArray[i]; - break; - case EbtFloat: - case EbtDouble: -#ifdef AMD_EXTENSIONS - case EbtFloat16: -#endif - leftUnionArray[i].setBConst(rightUnionArray[i].getDConst() != 0.0); - break; - default: - return node; - } - break; - case EbtInt64: - switch (node->getType().getBasicType()) { - case EbtInt: - leftUnionArray[i].setI64Const(static_cast(rightUnionArray[i].getIConst())); - break; - case EbtUint: - leftUnionArray[i].setI64Const(static_cast(rightUnionArray[i].getUConst())); - break; - case EbtInt64: - leftUnionArray[i] = rightUnionArray[i]; - break; - case EbtUint64: - leftUnionArray[i].setI64Const(static_cast(rightUnionArray[i].getU64Const())); - break; - case EbtBool: - leftUnionArray[i].setI64Const(static_cast(rightUnionArray[i].getBConst())); - break; - case EbtFloat: - case EbtDouble: -#ifdef AMD_EXTENSIONS - case EbtFloat16: -#endif - leftUnionArray[i].setI64Const(static_cast(rightUnionArray[i].getDConst())); - break; - default: - return node; - } - break; - case EbtUint64: - switch (node->getType().getBasicType()) { - case EbtInt: - leftUnionArray[i].setU64Const(static_cast(rightUnionArray[i].getIConst())); - break; - case EbtUint: - leftUnionArray[i].setU64Const(static_cast(rightUnionArray[i].getUConst())); - break; - case EbtInt64: - leftUnionArray[i].setU64Const(static_cast(rightUnionArray[i].getI64Const())); - break; - case EbtUint64: - leftUnionArray[i] = rightUnionArray[i]; - break; - case EbtBool: - leftUnionArray[i].setU64Const(static_cast(rightUnionArray[i].getBConst())); - break; - case EbtFloat: - case EbtDouble: -#ifdef AMD_EXTENSIONS - case EbtFloat16: -#endif - leftUnionArray[i].setU64Const(static_cast(rightUnionArray[i].getDConst())); - break; - default: - return node; - } - break; - default: - return node; - } - } - - const TType& t = node->getType(); - - return addConstantUnion(leftUnionArray, TType(promoteTo, t.getQualifier().storage, t.getVectorSize(), t.getMatrixCols(), t.getMatrixRows()), - node->getLoc()); -} - -void TIntermAggregate::setPragmaTable(const TPragmaTable& pTable) -{ - assert(pragmaTable == nullptr); - pragmaTable = new TPragmaTable; - *pragmaTable = pTable; -} - -// If either node is a specialization constant, while the other is -// a constant (or specialization constant), the result is still -// a specialization constant. -bool TIntermediate::specConstantPropagates(const TIntermTyped& node1, const TIntermTyped& node2) -{ - return (node1.getType().getQualifier().isSpecConstant() && node2.getType().getQualifier().isConstant()) || - (node2.getType().getQualifier().isSpecConstant() && node1.getType().getQualifier().isConstant()); -} - -struct TextureUpgradeAndSamplerRemovalTransform : public TIntermTraverser { - void visitSymbol(TIntermSymbol* symbol) override { - if (symbol->getBasicType() == EbtSampler && symbol->getType().getSampler().isTexture()) { - symbol->getWritableType().getSampler().combined = true; - } - } - bool visitAggregate(TVisit, TIntermAggregate* ag) override { - using namespace std; - TIntermSequence& seq = ag->getSequence(); - // remove pure sampler variables - TIntermSequence::iterator newEnd = remove_if(seq.begin(), seq.end(), [](TIntermNode* node) { - TIntermSymbol* symbol = node->getAsSymbolNode(); - if (!symbol) - return false; - - return (symbol->getBasicType() == EbtSampler && symbol->getType().getSampler().isPureSampler()); - }); - seq.erase(newEnd, seq.end()); - // replace constructors with sampler/textures - for_each(seq.begin(), seq.end(), [](TIntermNode*& node) { - TIntermAggregate *constructor = node->getAsAggregate(); - if (constructor && constructor->getOp() == EOpConstructTextureSampler) { - if (!constructor->getSequence().empty()) - node = constructor->getSequence()[0]; - } - }); - return true; - } -}; - -void TIntermediate::performTextureUpgradeAndSamplerRemovalTransformation(TIntermNode* root) -{ - TextureUpgradeAndSamplerRemovalTransform transform; - root->traverse(&transform); -} - -const char* TIntermediate::getResourceName(TResourceType res) -{ - switch (res) { - case EResSampler: return "shift-sampler-binding"; - case EResTexture: return "shift-texture-binding"; - case EResImage: return "shift-image-binding"; - case EResUbo: return "shift-UBO-binding"; - case EResSsbo: return "shift-ssbo-binding"; - case EResUav: return "shift-uav-binding"; - default: - assert(0); // internal error: should only be called with valid resource types. - return nullptr; - } -} - - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/LiveTraverser.h b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/LiveTraverser.h deleted file mode 100644 index 7333bc96..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/LiveTraverser.h +++ /dev/null @@ -1,138 +0,0 @@ -// -// Copyright (C) 2016 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#pragma once - -#include "../Include/Common.h" -#include "reflection.h" -#include "localintermediate.h" - -#include "gl_types.h" - -#include -#include - -namespace glslang { - -// -// The traverser: mostly pass through, except -// - processing function-call nodes to push live functions onto the stack of functions to process -// - processing selection nodes to trim semantically dead code -// -// This is in the glslang namespace directly so it can be a friend of TReflection. -// This can be derived from to implement reflection database traversers or -// binding mappers: anything that wants to traverse the live subset of the tree. -// - -class TLiveTraverser : public TIntermTraverser { -public: - TLiveTraverser(const TIntermediate& i, bool traverseAll = false, - bool preVisit = true, bool inVisit = false, bool postVisit = false) : - TIntermTraverser(preVisit, inVisit, postVisit), - intermediate(i), traverseAll(traverseAll) - { } - - // - // Given a function name, find its subroot in the tree, and push it onto the stack of - // functions left to process. - // - void pushFunction(const TString& name) - { - TIntermSequence& globals = intermediate.getTreeRoot()->getAsAggregate()->getSequence(); - for (unsigned int f = 0; f < globals.size(); ++f) { - TIntermAggregate* candidate = globals[f]->getAsAggregate(); - if (candidate && candidate->getOp() == EOpFunction && candidate->getName() == name) { - functions.push_back(candidate); - break; - } - } - } - - typedef std::list TFunctionStack; - TFunctionStack functions; - -protected: - // To catch which function calls are not dead, and hence which functions must be visited. - virtual bool visitAggregate(TVisit, TIntermAggregate* node) - { - if (!traverseAll) - if (node->getOp() == EOpFunctionCall) - addFunctionCall(node); - - return true; // traverse this subtree - } - - // To prune semantically dead paths. - virtual bool visitSelection(TVisit /* visit */, TIntermSelection* node) - { - if (traverseAll) - return true; // traverse all code - - TIntermConstantUnion* constant = node->getCondition()->getAsConstantUnion(); - if (constant) { - // cull the path that is dead - if (constant->getConstArray()[0].getBConst() == true && node->getTrueBlock()) - node->getTrueBlock()->traverse(this); - if (constant->getConstArray()[0].getBConst() == false && node->getFalseBlock()) - node->getFalseBlock()->traverse(this); - - return false; // don't traverse any more, we did it all above - } else - return true; // traverse the whole subtree - } - - // Track live functions as well as uniforms, so that we don't visit dead functions - // and only visit each function once. - void addFunctionCall(TIntermAggregate* call) - { - // // just use the map to ensure we process each function at most once - if (liveFunctions.find(call->getName()) == liveFunctions.end()) { - liveFunctions.insert(call->getName()); - pushFunction(call->getName()); - } - } - - const TIntermediate& intermediate; - typedef std::unordered_set TLiveFunctions; - TLiveFunctions liveFunctions; - bool traverseAll; - -private: - // prevent copy & copy construct - TLiveTraverser(TLiveTraverser&); - TLiveTraverser& operator=(TLiveTraverser&); -}; - -} // namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/ParseContextBase.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/ParseContextBase.cpp deleted file mode 100644 index bbc3cac0..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/ParseContextBase.cpp +++ /dev/null @@ -1,612 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2016 Google, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -// Implement the TParseContextBase class. - -#include - -#include "ParseHelper.h" - -extern int yyparse(glslang::TParseContext*); - -namespace glslang { - -// -// Used to output syntax, parsing, and semantic errors. -// - -void TParseContextBase::outputMessage(const TSourceLoc& loc, const char* szReason, - const char* szToken, - const char* szExtraInfoFormat, - TPrefixType prefix, va_list args) -{ - const int maxSize = MaxTokenLength + 200; - char szExtraInfo[maxSize]; - - safe_vsprintf(szExtraInfo, maxSize, szExtraInfoFormat, args); - - infoSink.info.prefix(prefix); - infoSink.info.location(loc); - infoSink.info << "'" << szToken << "' : " << szReason << " " << szExtraInfo << "\n"; - - if (prefix == EPrefixError) { - ++numErrors; - } -} - -void C_DECL TParseContextBase::error(const TSourceLoc& loc, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...) -{ - if (messages & EShMsgOnlyPreprocessor) - return; - va_list args; - va_start(args, szExtraInfoFormat); - outputMessage(loc, szReason, szToken, szExtraInfoFormat, EPrefixError, args); - va_end(args); - - if ((messages & EShMsgCascadingErrors) == 0) - currentScanner->setEndOfInput(); -} - -void C_DECL TParseContextBase::warn(const TSourceLoc& loc, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...) -{ - if (suppressWarnings()) - return; - va_list args; - va_start(args, szExtraInfoFormat); - outputMessage(loc, szReason, szToken, szExtraInfoFormat, EPrefixWarning, args); - va_end(args); -} - -void C_DECL TParseContextBase::ppError(const TSourceLoc& loc, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...) -{ - va_list args; - va_start(args, szExtraInfoFormat); - outputMessage(loc, szReason, szToken, szExtraInfoFormat, EPrefixError, args); - va_end(args); - - if ((messages & EShMsgCascadingErrors) == 0) - currentScanner->setEndOfInput(); -} - -void C_DECL TParseContextBase::ppWarn(const TSourceLoc& loc, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...) -{ - va_list args; - va_start(args, szExtraInfoFormat); - outputMessage(loc, szReason, szToken, szExtraInfoFormat, EPrefixWarning, args); - va_end(args); -} - -// -// Both test and if necessary, spit out an error, to see if the node is really -// an l-value that can be operated on this way. -// -// Returns true if there was an error. -// -bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op, TIntermTyped* node) -{ - TIntermBinary* binaryNode = node->getAsBinaryNode(); - - if (binaryNode) { - switch(binaryNode->getOp()) { - case EOpIndexDirect: - case EOpIndexIndirect: // fall through - case EOpIndexDirectStruct: // fall through - case EOpVectorSwizzle: - case EOpMatrixSwizzle: - return lValueErrorCheck(loc, op, binaryNode->getLeft()); - default: - break; - } - error(loc, " l-value required", op, "", ""); - - return true; - } - - const char* symbol = nullptr; - TIntermSymbol* symNode = node->getAsSymbolNode(); - if (symNode != nullptr) - symbol = symNode->getName().c_str(); - - const char* message = nullptr; - switch (node->getQualifier().storage) { - case EvqConst: message = "can't modify a const"; break; - case EvqConstReadOnly: message = "can't modify a const"; break; - case EvqUniform: message = "can't modify a uniform"; break; - case EvqBuffer: - if (node->getQualifier().readonly) - message = "can't modify a readonly buffer"; - break; - - default: - // - // Type that can't be written to? - // - switch (node->getBasicType()) { - case EbtSampler: - message = "can't modify a sampler"; - break; - case EbtAtomicUint: - message = "can't modify an atomic_uint"; - break; - case EbtVoid: - message = "can't modify void"; - break; - default: - break; - } - } - - if (message == nullptr && binaryNode == nullptr && symNode == nullptr) { - error(loc, " l-value required", op, "", ""); - - return true; - } - - // - // Everything else is okay, no error. - // - if (message == nullptr) - return false; - - // - // If we get here, we have an error and a message. - // - if (symNode) - error(loc, " l-value required", op, "\"%s\" (%s)", symbol, message); - else - error(loc, " l-value required", op, "(%s)", message); - - return true; -} - -// Test for and give an error if the node can't be read from. -void TParseContextBase::rValueErrorCheck(const TSourceLoc& loc, const char* op, TIntermTyped* node) -{ - if (! node) - return; - - TIntermBinary* binaryNode = node->getAsBinaryNode(); - if (binaryNode) { - switch(binaryNode->getOp()) { - case EOpIndexDirect: - case EOpIndexIndirect: - case EOpIndexDirectStruct: - case EOpVectorSwizzle: - case EOpMatrixSwizzle: - rValueErrorCheck(loc, op, binaryNode->getLeft()); - default: - break; - } - - return; - } - - TIntermSymbol* symNode = node->getAsSymbolNode(); - if (symNode && symNode->getQualifier().writeonly) - error(loc, "can't read from writeonly object: ", op, symNode->getName().c_str()); -} - -// Add 'symbol' to the list of deferred linkage symbols, which -// are later processed in finish(), at which point the symbol -// must still be valid. -// It is okay if the symbol's type will be subsequently edited; -// the modifications will be tracked. -void TParseContextBase::trackLinkage(TSymbol& symbol) -{ - if (!parsingBuiltins) - linkageSymbols.push_back(&symbol); -} - -// Ensure index is in bounds, correct if necessary. -// Give an error if not. -void TParseContextBase::checkIndex(const TSourceLoc& loc, const TType& type, int& index) -{ - if (index < 0) { - error(loc, "", "[", "index out of range '%d'", index); - index = 0; - } else if (type.isArray()) { - if (type.isExplicitlySizedArray() && index >= type.getOuterArraySize()) { - error(loc, "", "[", "array index out of range '%d'", index); - index = type.getOuterArraySize() - 1; - } - } else if (type.isVector()) { - if (index >= type.getVectorSize()) { - error(loc, "", "[", "vector index out of range '%d'", index); - index = type.getVectorSize() - 1; - } - } else if (type.isMatrix()) { - if (index >= type.getMatrixCols()) { - error(loc, "", "[", "matrix index out of range '%d'", index); - index = type.getMatrixCols() - 1; - } - } -} - -// Make a shared symbol have a non-shared version that can be edited by the current -// compile, such that editing its type will not change the shared version and will -// effect all nodes already sharing it (non-shallow type), -// or adopting its full type after being edited (shallow type). -void TParseContextBase::makeEditable(TSymbol*& symbol) -{ - // copyUp() does a deep copy of the type. - symbol = symbolTable.copyUp(symbol); - - // Save it (deferred, so it can be edited first) in the AST for linker use. - if (symbol) - trackLinkage(*symbol); -} - -// Return a writable version of the variable 'name'. -// -// Return nullptr if 'name' is not found. This should mean -// something is seriously wrong (e.g., compiler asking self for -// built-in that doesn't exist). -TVariable* TParseContextBase::getEditableVariable(const char* name) -{ - bool builtIn; - TSymbol* symbol = symbolTable.find(name, &builtIn); - - assert(symbol != nullptr); - if (symbol == nullptr) - return nullptr; - - if (builtIn) - makeEditable(symbol); - - return symbol->getAsVariable(); -} - -// Select the best matching function for 'call' from 'candidateList'. -// -// Assumptions -// -// There is no exact match, so a selection algorithm needs to run. That is, the -// language-specific handler should check for exact match first, to -// decide what to do, before calling this selector. -// -// Input -// -// * list of candidate signatures to select from -// * the call -// * a predicate function convertible(from, to) that says whether or not type -// 'from' can implicitly convert to type 'to' (it includes the case of what -// the calling language would consider a matching type with no conversion -// needed) -// * a predicate function better(from1, from2, to1, to2) that says whether or -// not a conversion from <-> to2 is considered better than a conversion -// from <-> to1 (both in and out directions need testing, as declared by the -// formal parameter) -// -// Output -// -// * best matching candidate (or none, if no viable candidates found) -// * whether there was a tie for the best match (ambiguous overload selection, -// caller's choice for how to report) -// -const TFunction* TParseContextBase::selectFunction( - const TVector candidateList, - const TFunction& call, - std::function convertible, - std::function better, - /* output */ bool& tie) -{ -// -// Operation -// -// 1. Prune the input list of candidates down to a list of viable candidates, -// where each viable candidate has -// -// * at least as many parameters as there are calling arguments, with any -// remaining parameters being optional or having default values -// * each parameter is true under convertible(A, B), where A is the calling -// type for in and B is the formal type, and in addition, for out B is the -// calling type and A is the formal type -// -// 2. If there are no viable candidates, return with no match. -// -// 3. If there is only one viable candidate, it is the best match. -// -// 4. If there are multiple viable candidates, select the first viable candidate -// as the incumbent. Compare the incumbent to the next viable candidate, and if -// that candidate is better (bullets below), make it the incumbent. Repeat, with -// a linear walk through the viable candidate list. The final incumbent will be -// returned as the best match. A viable candidate is better than the incumbent if -// -// * it has a function argument with a better(...) conversion than the incumbent, -// for all directions needed by in and out -// * the incumbent has no argument with a better(...) conversion then the -// candidate, for either in or out (as needed) -// -// 5. Check for ambiguity by comparing the best match against all other viable -// candidates. If any other viable candidate has a function argument with a -// better(...) conversion than the best candidate (for either in or out -// directions), return that there was a tie for best. -// - - tie = false; - - // 1. prune to viable... - TVector viableCandidates; - for (auto it = candidateList.begin(); it != candidateList.end(); ++it) { - const TFunction& candidate = *(*it); - - // to even be a potential match, number of arguments must be >= the number of - // fixed (non-default) parameters, and <= the total (including parameter with defaults). - if (call.getParamCount() < candidate.getFixedParamCount() || - call.getParamCount() > candidate.getParamCount()) - continue; - - // see if arguments are convertible - bool viable = true; - - // The call can have fewer parameters than the candidate, if some have defaults. - const int paramCount = std::min(call.getParamCount(), candidate.getParamCount()); - for (int param = 0; param < paramCount; ++param) { - if (candidate[param].type->getQualifier().isParamInput()) { - if (! convertible(*call[param].type, *candidate[param].type, candidate.getBuiltInOp(), param)) { - viable = false; - break; - } - } - if (candidate[param].type->getQualifier().isParamOutput()) { - if (! convertible(*candidate[param].type, *call[param].type, candidate.getBuiltInOp(), param)) { - viable = false; - break; - } - } - } - - if (viable) - viableCandidates.push_back(&candidate); - } - - // 2. none viable... - if (viableCandidates.size() == 0) - return nullptr; - - // 3. only one viable... - if (viableCandidates.size() == 1) - return viableCandidates.front(); - - // 4. find best... - const auto betterParam = [&call, &better](const TFunction& can1, const TFunction& can2) -> bool { - // is call -> can2 better than call -> can1 for any parameter - bool hasBetterParam = false; - for (int param = 0; param < call.getParamCount(); ++param) { - if (better(*call[param].type, *can1[param].type, *can2[param].type)) { - hasBetterParam = true; - break; - } - } - return hasBetterParam; - }; - - const auto equivalentParams = [&call, &better](const TFunction& can1, const TFunction& can2) -> bool { - // is call -> can2 equivalent to call -> can1 for all the call parameters? - for (int param = 0; param < call.getParamCount(); ++param) { - if (better(*call[param].type, *can1[param].type, *can2[param].type) || - better(*call[param].type, *can2[param].type, *can1[param].type)) - return false; - } - return true; - }; - - const TFunction* incumbent = viableCandidates.front(); - for (auto it = viableCandidates.begin() + 1; it != viableCandidates.end(); ++it) { - const TFunction& candidate = *(*it); - if (betterParam(*incumbent, candidate) && ! betterParam(candidate, *incumbent)) - incumbent = &candidate; - } - - // 5. ambiguity... - for (auto it = viableCandidates.begin(); it != viableCandidates.end(); ++it) { - if (incumbent == *it) - continue; - const TFunction& candidate = *(*it); - - // In the case of default parameters, it may have an identical initial set, which is - // also ambiguous - if (betterParam(*incumbent, candidate) || equivalentParams(*incumbent, candidate)) - tie = true; - } - - return incumbent; -} - -// -// Look at a '.' field selector string and change it into numerical selectors -// for a vector or scalar. -// -// Always return some form of swizzle, so the result is always usable. -// -void TParseContextBase::parseSwizzleSelector(const TSourceLoc& loc, const TString& compString, int vecSize, - TSwizzleSelectors& selector) -{ - // Too long? - if (compString.size() > MaxSwizzleSelectors) - error(loc, "vector swizzle too long", compString.c_str(), ""); - - // Use this to test that all swizzle characters are from the same swizzle-namespace-set - enum { - exyzw, - ergba, - estpq, - } fieldSet[MaxSwizzleSelectors]; - - // Decode the swizzle string. - int size = std::min(MaxSwizzleSelectors, (int)compString.size()); - for (int i = 0; i < size; ++i) { - switch (compString[i]) { - case 'x': - selector.push_back(0); - fieldSet[i] = exyzw; - break; - case 'r': - selector.push_back(0); - fieldSet[i] = ergba; - break; - case 's': - selector.push_back(0); - fieldSet[i] = estpq; - break; - - case 'y': - selector.push_back(1); - fieldSet[i] = exyzw; - break; - case 'g': - selector.push_back(1); - fieldSet[i] = ergba; - break; - case 't': - selector.push_back(1); - fieldSet[i] = estpq; - break; - - case 'z': - selector.push_back(2); - fieldSet[i] = exyzw; - break; - case 'b': - selector.push_back(2); - fieldSet[i] = ergba; - break; - case 'p': - selector.push_back(2); - fieldSet[i] = estpq; - break; - - case 'w': - selector.push_back(3); - fieldSet[i] = exyzw; - break; - case 'a': - selector.push_back(3); - fieldSet[i] = ergba; - break; - case 'q': - selector.push_back(3); - fieldSet[i] = estpq; - break; - - default: - error(loc, "unknown swizzle selection", compString.c_str(), ""); - break; - } - } - - // Additional error checking. - for (int i = 0; i < selector.size(); ++i) { - if (selector[i] >= vecSize) { - error(loc, "vector swizzle selection out of range", compString.c_str(), ""); - selector.resize(i); - break; - } - - if (i > 0 && fieldSet[i] != fieldSet[i-1]) { - error(loc, "vector swizzle selectors not from the same set", compString.c_str(), ""); - selector.resize(i); - break; - } - } - - // Ensure it is valid. - if (selector.size() == 0) - selector.push_back(0); -} - -// -// Make the passed-in variable information become a member of the -// global uniform block. If this doesn't exist yet, make it. -// -void TParseContextBase::growGlobalUniformBlock(const TSourceLoc& loc, TType& memberType, const TString& memberName, TTypeList* typeList) -{ - // Make the global block, if not yet made. - if (globalUniformBlock == nullptr) { - TQualifier blockQualifier; - blockQualifier.clear(); - blockQualifier.storage = EvqUniform; - TType blockType(new TTypeList, *NewPoolTString(getGlobalUniformBlockName()), blockQualifier); - setUniformBlockDefaults(blockType); - globalUniformBlock = new TVariable(NewPoolTString(""), blockType, true); - firstNewMember = 0; - } - - // Update with binding and set - globalUniformBlock->getWritableType().getQualifier().layoutBinding = globalUniformBinding; - globalUniformBlock->getWritableType().getQualifier().layoutSet = globalUniformSet; - - // Add the requested member as a member to the global block. - TType* type = new TType; - type->shallowCopy(memberType); - type->setFieldName(memberName); - if (typeList) - type->setStruct(typeList); - TTypeLoc typeLoc = {type, loc}; - globalUniformBlock->getType().getWritableStruct()->push_back(typeLoc); - - // Insert into the symbol table. - if (firstNewMember == 0) { - // This is the first request; we need a normal symbol table insert - if (symbolTable.insert(*globalUniformBlock)) - trackLinkage(*globalUniformBlock); - else - error(loc, "failed to insert the global constant buffer", "uniform", ""); - } else { - // This is a follow-on request; we need to amend the first insert - symbolTable.amend(*globalUniformBlock, firstNewMember); - } - - ++firstNewMember; -} - -void TParseContextBase::finish() -{ - if (parsingBuiltins) - return; - - // Transfer the linkage symbols to AST nodes - TIntermAggregate* linkage = new TIntermAggregate; - for (auto i = linkageSymbols.begin(); i != linkageSymbols.end(); ++i) - intermediate.addSymbolLinkageNode(linkage, **i); - intermediate.addSymbolLinkageNodes(linkage, getLanguage(), symbolTable); -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/ParseHelper.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/ParseHelper.cpp deleted file mode 100644 index d662be15..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/ParseHelper.cpp +++ /dev/null @@ -1,6494 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2012-2015 LunarG, Inc. -// Copyright (C) 2015-2016 Google, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#include "ParseHelper.h" -#include "Scan.h" - -#include "../OSDependent/osinclude.h" -#include - -#include "preprocessor/PpContext.h" - -extern int yyparse(glslang::TParseContext*); - -namespace glslang { - -TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, bool parsingBuiltins, - int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, - TInfoSink& infoSink, bool forwardCompatible, EShMessages messages, - const TString* entryPoint) : - TParseContextBase(symbolTable, interm, parsingBuiltins, version, profile, spvVersion, language, - infoSink, forwardCompatible, messages, entryPoint), - inMain(false), - blockName(nullptr), - limits(resources.limits), - atomicUintOffsets(nullptr), anyIndexLimits(false) -{ - // decide whether precision qualifiers should be ignored or respected - if (profile == EEsProfile || spvVersion.vulkan > 0) { - precisionManager.respectPrecisionQualifiers(); - if (! parsingBuiltins && language == EShLangFragment && profile != EEsProfile && spvVersion.vulkan > 0) - precisionManager.warnAboutDefaults(); - } - - setPrecisionDefaults(); - - globalUniformDefaults.clear(); - globalUniformDefaults.layoutMatrix = ElmColumnMajor; - globalUniformDefaults.layoutPacking = spvVersion.spv != 0 ? ElpStd140 : ElpShared; - - globalBufferDefaults.clear(); - globalBufferDefaults.layoutMatrix = ElmColumnMajor; - globalBufferDefaults.layoutPacking = spvVersion.spv != 0 ? ElpStd430 : ElpShared; - - globalInputDefaults.clear(); - globalOutputDefaults.clear(); - - // "Shaders in the transform - // feedback capturing mode have an initial global default of - // layout(xfb_buffer = 0) out;" - if (language == EShLangVertex || - language == EShLangTessControl || - language == EShLangTessEvaluation || - language == EShLangGeometry) - globalOutputDefaults.layoutXfbBuffer = 0; - - if (language == EShLangGeometry) - globalOutputDefaults.layoutStream = 0; - - if (entryPoint != nullptr && entryPoint->size() > 0 && *entryPoint != "main") - infoSink.info.message(EPrefixError, "Source entry point must be \"main\""); -} - -TParseContext::~TParseContext() -{ - delete [] atomicUintOffsets; -} - -// Set up all default precisions as needed by the current environment. -// Intended just as a TParseContext constructor helper. -void TParseContext::setPrecisionDefaults() -{ - // Set all precision defaults to EpqNone, which is correct for all types - // when not obeying precision qualifiers, and correct for types that don't - // have defaults (thus getting an error on use) when obeying precision - // qualifiers. - - for (int type = 0; type < EbtNumTypes; ++type) - defaultPrecision[type] = EpqNone; - - for (int type = 0; type < maxSamplerIndex; ++type) - defaultSamplerPrecision[type] = EpqNone; - - // replace with real precision defaults for those that have them - if (obeyPrecisionQualifiers()) { - if (profile == EEsProfile) { - // Most don't have defaults, a few default to lowp. - TSampler sampler; - sampler.set(EbtFloat, Esd2D); - defaultSamplerPrecision[computeSamplerTypeIndex(sampler)] = EpqLow; - sampler.set(EbtFloat, EsdCube); - defaultSamplerPrecision[computeSamplerTypeIndex(sampler)] = EpqLow; - sampler.set(EbtFloat, Esd2D); - sampler.external = true; - defaultSamplerPrecision[computeSamplerTypeIndex(sampler)] = EpqLow; - } - - // If we are parsing built-in computational variables/functions, it is meaningful to record - // whether the built-in has no precision qualifier, as that ambiguity - // is used to resolve the precision from the supplied arguments/operands instead. - // So, we don't actually want to replace EpqNone with a default precision for built-ins. - if (! parsingBuiltins) { - if (profile == EEsProfile && language == EShLangFragment) { - defaultPrecision[EbtInt] = EpqMedium; - defaultPrecision[EbtUint] = EpqMedium; - } else { - defaultPrecision[EbtInt] = EpqHigh; - defaultPrecision[EbtUint] = EpqHigh; - defaultPrecision[EbtFloat] = EpqHigh; - } - - if (profile != EEsProfile) { - // Non-ES profile - // All sampler precisions default to highp. - for (int type = 0; type < maxSamplerIndex; ++type) - defaultSamplerPrecision[type] = EpqHigh; - } - } - - defaultPrecision[EbtSampler] = EpqLow; - defaultPrecision[EbtAtomicUint] = EpqHigh; - } -} - -void TParseContext::setLimits(const TBuiltInResource& r) -{ - resources = r; - - anyIndexLimits = ! limits.generalAttributeMatrixVectorIndexing || - ! limits.generalConstantMatrixVectorIndexing || - ! limits.generalSamplerIndexing || - ! limits.generalUniformIndexing || - ! limits.generalVariableIndexing || - ! limits.generalVaryingIndexing; - - intermediate.setLimits(resources); - - // "Each binding point tracks its own current default offset for - // inheritance of subsequent variables using the same binding. The initial state of compilation is that all - // binding points have an offset of 0." - atomicUintOffsets = new int[resources.maxAtomicCounterBindings]; - for (int b = 0; b < resources.maxAtomicCounterBindings; ++b) - atomicUintOffsets[b] = 0; -} - -// -// Parse an array of strings using yyparse, going through the -// preprocessor to tokenize the shader strings, then through -// the GLSL scanner. -// -// Returns true for successful acceptance of the shader, false if any errors. -// -bool TParseContext::parseShaderStrings(TPpContext& ppContext, TInputScanner& input, bool versionWillBeError) -{ - currentScanner = &input; - ppContext.setInput(input, versionWillBeError); - yyparse(this); - - finish(); - - return numErrors == 0; -} - -// This is called from bison when it has a parse (syntax) error -// Note though that to stop cascading errors, we set EOF, which -// will usually cause a syntax error, so be more accurate that -// compilation is terminating. -void TParseContext::parserError(const char* s) -{ - if (! getScanner()->atEndOfInput() || numErrors == 0) - error(getCurrentLoc(), "", "", s, ""); - else - error(getCurrentLoc(), "compilation terminated", "", ""); -} - -void TParseContext::handlePragma(const TSourceLoc& loc, const TVector& tokens) -{ - if (pragmaCallback) - pragmaCallback(loc.line, tokens); - - if (tokens.size() == 0) - return; - - if (tokens[0].compare("optimize") == 0) { - if (tokens.size() != 4) { - error(loc, "optimize pragma syntax is incorrect", "#pragma", ""); - return; - } - - if (tokens[1].compare("(") != 0) { - error(loc, "\"(\" expected after 'optimize' keyword", "#pragma", ""); - return; - } - - if (tokens[2].compare("on") == 0) - contextPragma.optimize = true; - else if (tokens[2].compare("off") == 0) - contextPragma.optimize = false; - else { - error(loc, "\"on\" or \"off\" expected after '(' for 'optimize' pragma", "#pragma", ""); - return; - } - - if (tokens[3].compare(")") != 0) { - error(loc, "\")\" expected to end 'optimize' pragma", "#pragma", ""); - return; - } - } else if (tokens[0].compare("debug") == 0) { - if (tokens.size() != 4) { - error(loc, "debug pragma syntax is incorrect", "#pragma", ""); - return; - } - - if (tokens[1].compare("(") != 0) { - error(loc, "\"(\" expected after 'debug' keyword", "#pragma", ""); - return; - } - - if (tokens[2].compare("on") == 0) - contextPragma.debug = true; - else if (tokens[2].compare("off") == 0) - contextPragma.debug = false; - else { - error(loc, "\"on\" or \"off\" expected after '(' for 'debug' pragma", "#pragma", ""); - return; - } - - if (tokens[3].compare(")") != 0) { - error(loc, "\")\" expected to end 'debug' pragma", "#pragma", ""); - return; - } - } else if (spvVersion.spv > 0 && tokens[0].compare("use_storage_buffer") == 0) { - if (tokens.size() != 1) - error(loc, "extra tokens", "#pragma", ""); - intermediate.setUseStorageBuffer(); - } -} - -// -// Handle seeing a variable identifier in the grammar. -// -TIntermTyped* TParseContext::handleVariable(const TSourceLoc& loc, TSymbol* symbol, const TString* string) -{ - TIntermTyped* node = nullptr; - - // Error check for requiring specific extensions present. - if (symbol && symbol->getNumExtensions()) - requireExtensions(loc, symbol->getNumExtensions(), symbol->getExtensions(), symbol->getName().c_str()); - - if (symbol && symbol->isReadOnly()) { - // All shared things containing an implicitly sized array must be copied up - // on first use, so that all future references will share its array structure, - // so that editing the implicit size will effect all nodes consuming it, - // and so that editing the implicit size won't change the shared one. - // - // If this is a variable or a block, check it and all it contains, but if this - // is a member of an anonymous block, check the whole block, as the whole block - // will need to be copied up if it contains an implicitly-sized array. - if (symbol->getType().containsImplicitlySizedArray() || - (symbol->getAsAnonMember() && - symbol->getAsAnonMember()->getAnonContainer().getType().containsImplicitlySizedArray())) - makeEditable(symbol); - } - - const TVariable* variable; - const TAnonMember* anon = symbol ? symbol->getAsAnonMember() : nullptr; - if (anon) { - // It was a member of an anonymous container. - - // The "getNumExtensions()" mechanism above doesn't yet work for block members - blockMemberExtensionCheck(loc, nullptr, *string); - - // Create a subtree for its dereference. - variable = anon->getAnonContainer().getAsVariable(); - TIntermTyped* container = intermediate.addSymbol(*variable, loc); - TIntermTyped* constNode = intermediate.addConstantUnion(anon->getMemberNumber(), loc); - node = intermediate.addIndex(EOpIndexDirectStruct, container, constNode, loc); - - node->setType(*(*variable->getType().getStruct())[anon->getMemberNumber()].type); - if (node->getType().hiddenMember()) - error(loc, "member of nameless block was not redeclared", string->c_str(), ""); - } else { - // Not a member of an anonymous container. - - // The symbol table search was done in the lexical phase. - // See if it was a variable. - variable = symbol ? symbol->getAsVariable() : nullptr; - if (variable) { - if ((variable->getType().getBasicType() == EbtBlock || - variable->getType().getBasicType() == EbtStruct) && variable->getType().getStruct() == nullptr) { - error(loc, "cannot be used (maybe an instance name is needed)", string->c_str(), ""); - variable = nullptr; - } - } else { - if (symbol) - error(loc, "variable name expected", string->c_str(), ""); - } - - // Recovery, if it wasn't found or was not a variable. - if (! variable) - variable = new TVariable(string, TType(EbtVoid)); - - if (variable->getType().getQualifier().isFrontEndConstant()) - node = intermediate.addConstantUnion(variable->getConstArray(), variable->getType(), loc); - else - node = intermediate.addSymbol(*variable, loc); - } - - if (variable->getType().getQualifier().isIo()) - intermediate.addIoAccessed(*string); - - return node; -} - -// -// Handle seeing a base[index] dereference in the grammar. -// -TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIntermTyped* base, TIntermTyped* index) -{ - TIntermTyped* result = nullptr; - - int indexValue = 0; - if (index->getQualifier().isFrontEndConstant()) - indexValue = index->getAsConstantUnion()->getConstArray()[0].getIConst(); - - variableCheck(base); - if (! base->isArray() && ! base->isMatrix() && ! base->isVector()) { - if (base->getAsSymbolNode()) - error(loc, " left of '[' is not of type array, matrix, or vector ", base->getAsSymbolNode()->getName().c_str(), ""); - else - error(loc, " left of '[' is not of type array, matrix, or vector ", "expression", ""); - } else if (base->getType().getQualifier().isFrontEndConstant() && index->getQualifier().isFrontEndConstant()) { - // both base and index are front-end constants - checkIndex(loc, base->getType(), indexValue); - return intermediate.foldDereference(base, indexValue, loc); - } else { - // at least one of base and index is not a front-end constant variable... - - if (base->getAsSymbolNode() && isIoResizeArray(base->getType())) - handleIoResizeArrayAccess(loc, base); - - if (index->getQualifier().isFrontEndConstant()) { - if (base->getType().isImplicitlySizedArray()) - updateImplicitArraySize(loc, base, indexValue); - else - checkIndex(loc, base->getType(), indexValue); - result = intermediate.addIndex(EOpIndexDirect, base, index, loc); - } else { - if (base->getType().isImplicitlySizedArray()) { - if (base->getAsSymbolNode() && isIoResizeArray(base->getType())) - error(loc, "", "[", "array must be sized by a redeclaration or layout qualifier before being indexed with a variable"); - else - error(loc, "", "[", "array must be redeclared with a size before being indexed with a variable"); - } - if (base->getBasicType() == EbtBlock) { - if (base->getQualifier().storage == EvqBuffer) - requireProfile(base->getLoc(), ~EEsProfile, "variable indexing buffer block array"); - else if (base->getQualifier().storage == EvqUniform) - profileRequires(base->getLoc(), EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, - "variable indexing uniform block array"); - else { - // input/output blocks either don't exist or can be variable indexed - } - } else if (language == EShLangFragment && base->getQualifier().isPipeOutput()) - requireProfile(base->getLoc(), ~EEsProfile, "variable indexing fragment shader output array"); - else if (base->getBasicType() == EbtSampler && version >= 130) { - const char* explanation = "variable indexing sampler array"; - requireProfile(base->getLoc(), EEsProfile | ECoreProfile | ECompatibilityProfile, explanation); - profileRequires(base->getLoc(), EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, explanation); - profileRequires(base->getLoc(), ECoreProfile | ECompatibilityProfile, 400, nullptr, explanation); - } - - result = intermediate.addIndex(EOpIndexIndirect, base, index, loc); - } - } - - if (result == nullptr) { - // Insert dummy error-recovery result - result = intermediate.addConstantUnion(0.0, EbtFloat, loc); - } else { - // Insert valid dereferenced result - TType newType(base->getType(), 0); // dereferenced type - if (base->getType().getQualifier().isConstant() && index->getQualifier().isConstant()) { - newType.getQualifier().storage = EvqConst; - // If base or index is a specialization constant, the result should also be a specialization constant. - if (base->getType().getQualifier().isSpecConstant() || index->getQualifier().isSpecConstant()) { - newType.getQualifier().makeSpecConstant(); - } - } else { - newType.getQualifier().makePartialTemporary(); - } - result->setType(newType); - - if (anyIndexLimits) - handleIndexLimits(loc, base, index); - } - - return result; -} - -// for ES 2.0 (version 100) limitations for almost all index operations except vertex-shader uniforms -void TParseContext::handleIndexLimits(const TSourceLoc& /*loc*/, TIntermTyped* base, TIntermTyped* index) -{ - if ((! limits.generalSamplerIndexing && base->getBasicType() == EbtSampler) || - (! limits.generalUniformIndexing && base->getQualifier().isUniformOrBuffer() && language != EShLangVertex) || - (! limits.generalAttributeMatrixVectorIndexing && base->getQualifier().isPipeInput() && language == EShLangVertex && (base->getType().isMatrix() || base->getType().isVector())) || - (! limits.generalConstantMatrixVectorIndexing && base->getAsConstantUnion()) || - (! limits.generalVariableIndexing && ! base->getType().getQualifier().isUniformOrBuffer() && - ! base->getType().getQualifier().isPipeInput() && - ! base->getType().getQualifier().isPipeOutput() && - ! base->getType().getQualifier().isConstant()) || - (! limits.generalVaryingIndexing && (base->getType().getQualifier().isPipeInput() || - base->getType().getQualifier().isPipeOutput()))) { - // it's too early to know what the inductive variables are, save it for post processing - needsIndexLimitationChecking.push_back(index); - } -} - -// Make a shared symbol have a non-shared version that can be edited by the current -// compile, such that editing its type will not change the shared version and will -// effect all nodes sharing it. -void TParseContext::makeEditable(TSymbol*& symbol) -{ - TParseContextBase::makeEditable(symbol); - - // See if it's tied to IO resizing - if (isIoResizeArray(symbol->getType())) - ioArraySymbolResizeList.push_back(symbol); -} - -// Return true if this is a geometry shader input array or tessellation control output array. -bool TParseContext::isIoResizeArray(const TType& type) const -{ - return type.isArray() && - ((language == EShLangGeometry && type.getQualifier().storage == EvqVaryingIn) || - (language == EShLangTessControl && type.getQualifier().storage == EvqVaryingOut && ! type.getQualifier().patch)); -} - -// If an array is not isIoResizeArray() but is an io array, make sure it has the right size -void TParseContext::fixIoArraySize(const TSourceLoc& loc, TType& type) -{ - if (! type.isArray() || type.getQualifier().patch || symbolTable.atBuiltInLevel()) - return; - - assert(! isIoResizeArray(type)); - - if (type.getQualifier().storage != EvqVaryingIn || type.getQualifier().patch) - return; - - if (language == EShLangTessControl || language == EShLangTessEvaluation) { - if (type.getOuterArraySize() != resources.maxPatchVertices) { - if (type.isExplicitlySizedArray()) - error(loc, "tessellation input array size must be gl_MaxPatchVertices or implicitly sized", "[]", ""); - type.changeOuterArraySize(resources.maxPatchVertices); - } - } -} - -// Issue any errors if the non-array object is missing arrayness WRT -// shader I/O that has array requirements. -// All arrayness checking is handled in array paths, this is for -void TParseContext::ioArrayCheck(const TSourceLoc& loc, const TType& type, const TString& identifier) -{ - if (! type.isArray() && ! symbolTable.atBuiltInLevel()) { - if (type.getQualifier().isArrayedIo(language) -#ifdef NV_EXTENSIONS - && !type.getQualifier().layoutPassthrough -#endif - ) - error(loc, "type must be an array:", type.getStorageQualifierString(), identifier.c_str()); - } -} - -// Handle a dereference of a geometry shader input array or tessellation control output array. -// See ioArraySymbolResizeList comment in ParseHelper.h. -// -void TParseContext::handleIoResizeArrayAccess(const TSourceLoc& /*loc*/, TIntermTyped* base) -{ - TIntermSymbol* symbolNode = base->getAsSymbolNode(); - assert(symbolNode); - if (! symbolNode) - return; - - // fix array size, if it can be fixed and needs to be fixed (will allow variable indexing) - if (symbolNode->getType().isImplicitlySizedArray()) { - int newSize = getIoArrayImplicitSize(); - if (newSize > 0) - symbolNode->getWritableType().changeOuterArraySize(newSize); - } -} - -// If there has been an input primitive declaration (geometry shader) or an output -// number of vertices declaration(tessellation shader), make sure all input array types -// match it in size. Types come either from nodes in the AST or symbols in the -// symbol table. -// -// Types without an array size will be given one. -// Types already having a size that is wrong will get an error. -// -void TParseContext::checkIoArraysConsistency(const TSourceLoc& loc, bool tailOnly) -{ - int requiredSize = getIoArrayImplicitSize(); - if (requiredSize == 0) - return; - - const char* feature; - if (language == EShLangGeometry) - feature = TQualifier::getGeometryString(intermediate.getInputPrimitive()); - else if (language == EShLangTessControl) - feature = "vertices"; - else - feature = "unknown"; - - if (tailOnly) { - checkIoArrayConsistency(loc, requiredSize, feature, ioArraySymbolResizeList.back()->getWritableType(), ioArraySymbolResizeList.back()->getName()); - return; - } - - for (size_t i = 0; i < ioArraySymbolResizeList.size(); ++i) - checkIoArrayConsistency(loc, requiredSize, feature, ioArraySymbolResizeList[i]->getWritableType(), ioArraySymbolResizeList[i]->getName()); -} - -int TParseContext::getIoArrayImplicitSize() const -{ - if (language == EShLangGeometry) - return TQualifier::mapGeometryToSize(intermediate.getInputPrimitive()); - else if (language == EShLangTessControl) - return intermediate.getVertices() != TQualifier::layoutNotSet ? intermediate.getVertices() : 0; - else - return 0; -} - -void TParseContext::checkIoArrayConsistency(const TSourceLoc& loc, int requiredSize, const char* feature, TType& type, const TString& name) -{ - if (type.isImplicitlySizedArray()) - type.changeOuterArraySize(requiredSize); - else if (type.getOuterArraySize() != requiredSize) { - if (language == EShLangGeometry) - error(loc, "inconsistent input primitive for array size of", feature, name.c_str()); - else if (language == EShLangTessControl) - error(loc, "inconsistent output number of vertices for array size of", feature, name.c_str()); - else - assert(0); - } -} - -// Handle seeing a binary node with a math operation. -// Returns nullptr if not semantically allowed. -TIntermTyped* TParseContext::handleBinaryMath(const TSourceLoc& loc, const char* str, TOperator op, TIntermTyped* left, TIntermTyped* right) -{ - rValueErrorCheck(loc, str, left->getAsTyped()); - rValueErrorCheck(loc, str, right->getAsTyped()); - - bool allowed = true; - switch (op) { - // TODO: Bring more source language-specific checks up from intermediate.cpp - // to the specific parse helpers for that source language. - case EOpLessThan: - case EOpGreaterThan: - case EOpLessThanEqual: - case EOpGreaterThanEqual: - if (! left->isScalar() || ! right->isScalar()) - allowed = false; - break; - default: - break; - } - - TIntermTyped* result = nullptr; - if (allowed) - result = intermediate.addBinaryMath(op, left, right, loc); - - if (result == nullptr) - binaryOpError(loc, str, left->getCompleteString(), right->getCompleteString()); - - return result; -} - -// Handle seeing a unary node with a math operation. -TIntermTyped* TParseContext::handleUnaryMath(const TSourceLoc& loc, const char* str, TOperator op, TIntermTyped* childNode) -{ - rValueErrorCheck(loc, str, childNode); - - TIntermTyped* result = intermediate.addUnaryMath(op, childNode, loc); - - if (result) - return result; - else - unaryOpError(loc, str, childNode->getCompleteString()); - - return childNode; -} - -// -// Handle seeing a base.field dereference in the grammar. -// -TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TIntermTyped* base, const TString& field) -{ - variableCheck(base); - - // - // .length() can't be resolved until we later see the function-calling syntax. - // Save away the name in the AST for now. Processing is completed in - // handleLengthMethod(). - // - if (field == "length") { - if (base->isArray()) { - profileRequires(loc, ENoProfile, 120, E_GL_3DL_array_objects, ".length"); - profileRequires(loc, EEsProfile, 300, nullptr, ".length"); - } else if (base->isVector() || base->isMatrix()) { - const char* feature = ".length() on vectors and matrices"; - requireProfile(loc, ~EEsProfile, feature); - profileRequires(loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, feature); - } else { - error(loc, "does not operate on this type:", field.c_str(), base->getType().getCompleteString().c_str()); - - return base; - } - - return intermediate.addMethod(base, TType(EbtInt), &field, loc); - } - - // It's not .length() if we get to here. - - if (base->isArray()) { - error(loc, "cannot apply to an array:", ".", field.c_str()); - - return base; - } - - // It's neither an array nor .length() if we get here, - // leaving swizzles and struct/block dereferences. - - TIntermTyped* result = base; - if ((base->isVector() || base->isScalar()) && - (base->isFloatingDomain() || base->isIntegerDomain() || base->getBasicType() == EbtBool)) { - if (base->isScalar()) { - const char* dotFeature = "scalar swizzle"; - requireProfile(loc, ~EEsProfile, dotFeature); - profileRequires(loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, dotFeature); - } - - TSwizzleSelectors selectors; - parseSwizzleSelector(loc, field, base->getVectorSize(), selectors); - - if (base->isScalar()) { - if (selectors.size() == 1) - return result; - else { - TType type(base->getBasicType(), EvqTemporary, selectors.size()); - // Swizzle operations propagate specialization-constantness - if (base->getQualifier().isSpecConstant()) - type.getQualifier().makeSpecConstant(); - return addConstructor(loc, base, type); - } - } - - if (base->getType().getQualifier().isFrontEndConstant()) - result = intermediate.foldSwizzle(base, selectors, loc); - else { - if (selectors.size() == 1) { - TIntermTyped* index = intermediate.addConstantUnion(selectors[0], loc); - result = intermediate.addIndex(EOpIndexDirect, base, index, loc); - result->setType(TType(base->getBasicType(), EvqTemporary, base->getType().getQualifier().precision)); - } else { - TIntermTyped* index = intermediate.addSwizzle(selectors, loc); - result = intermediate.addIndex(EOpVectorSwizzle, base, index, loc); - result->setType(TType(base->getBasicType(), EvqTemporary, base->getType().getQualifier().precision, selectors.size())); - } - // Swizzle operations propagate specialization-constantness - if (base->getType().getQualifier().isSpecConstant()) - result->getWritableType().getQualifier().makeSpecConstant(); - } - } else if (base->getBasicType() == EbtStruct || base->getBasicType() == EbtBlock) { - const TTypeList* fields = base->getType().getStruct(); - bool fieldFound = false; - int member; - for (member = 0; member < (int)fields->size(); ++member) { - if ((*fields)[member].type->getFieldName() == field) { - fieldFound = true; - break; - } - } - if (fieldFound) { - if (base->getType().getQualifier().isFrontEndConstant()) - result = intermediate.foldDereference(base, member, loc); - else { - blockMemberExtensionCheck(loc, base, field); - TIntermTyped* index = intermediate.addConstantUnion(member, loc); - result = intermediate.addIndex(EOpIndexDirectStruct, base, index, loc); - result->setType(*(*fields)[member].type); - } - } else - error(loc, "no such field in structure", field.c_str(), ""); - } else - error(loc, "does not apply to this type:", field.c_str(), base->getType().getCompleteString().c_str()); - - // Propagate noContraction up the dereference chain - if (base->getQualifier().noContraction) - result->getWritableType().getQualifier().noContraction = true; - - return result; -} - -void TParseContext::blockMemberExtensionCheck(const TSourceLoc& loc, const TIntermTyped* /*base*/, const TString& field) -{ - if (profile == EEsProfile && field == "gl_PointSize") { - if (language == EShLangGeometry) - requireExtensions(loc, Num_AEP_geometry_point_size, AEP_geometry_point_size, "gl_PointSize"); - else if (language == EShLangTessControl || language == EShLangTessEvaluation) - requireExtensions(loc, Num_AEP_tessellation_point_size, AEP_tessellation_point_size, "gl_PointSize"); - } -} - -// -// Handle seeing a function declarator in the grammar. This is the precursor -// to recognizing a function prototype or function definition. -// -TFunction* TParseContext::handleFunctionDeclarator(const TSourceLoc& loc, TFunction& function, bool prototype) -{ - // ES can't declare prototypes inside functions - if (! symbolTable.atGlobalLevel()) - requireProfile(loc, ~EEsProfile, "local function declaration"); - - // - // Multiple declarations of the same function name are allowed. - // - // If this is a definition, the definition production code will check for redefinitions - // (we don't know at this point if it's a definition or not). - // - // Redeclarations (full signature match) are allowed. But, return types and parameter qualifiers must also match. - // - except ES 100, which only allows a single prototype - // - // ES 100 does not allow redefining, but does allow overloading of built-in functions. - // ES 300 does not allow redefining or overloading of built-in functions. - // - bool builtIn; - TSymbol* symbol = symbolTable.find(function.getMangledName(), &builtIn); - if (symbol && symbol->getAsFunction() && builtIn) - requireProfile(loc, ~EEsProfile, "redefinition of built-in function"); - const TFunction* prevDec = symbol ? symbol->getAsFunction() : 0; - if (prevDec) { - if (prevDec->isPrototyped() && prototype) - profileRequires(loc, EEsProfile, 300, nullptr, "multiple prototypes for same function"); - if (prevDec->getType() != function.getType()) - error(loc, "overloaded functions must have the same return type", function.getType().getBasicTypeString().c_str(), ""); - for (int i = 0; i < prevDec->getParamCount(); ++i) { - if ((*prevDec)[i].type->getQualifier().storage != function[i].type->getQualifier().storage) - error(loc, "overloaded functions must have the same parameter storage qualifiers for argument", function[i].type->getStorageQualifierString(), "%d", i+1); - - if ((*prevDec)[i].type->getQualifier().precision != function[i].type->getQualifier().precision) - error(loc, "overloaded functions must have the same parameter precision qualifiers for argument", function[i].type->getPrecisionQualifierString(), "%d", i+1); - } - } - - arrayObjectCheck(loc, function.getType(), "array in function return type"); - - if (prototype) { - // All built-in functions are defined, even though they don't have a body. - // Count their prototype as a definition instead. - if (symbolTable.atBuiltInLevel()) - function.setDefined(); - else { - if (prevDec && ! builtIn) - symbol->getAsFunction()->setPrototyped(); // need a writable one, but like having prevDec as a const - function.setPrototyped(); - } - } - - // This insert won't actually insert it if it's a duplicate signature, but it will still check for - // other forms of name collisions. - if (! symbolTable.insert(function)) - error(loc, "function name is redeclaration of existing name", function.getName().c_str(), ""); - - // - // If this is a redeclaration, it could also be a definition, - // in which case, we need to use the parameter names from this one, and not the one that's - // being redeclared. So, pass back this declaration, not the one in the symbol table. - // - return &function; -} - -// -// Handle seeing the function prototype in front of a function definition in the grammar. -// The body is handled after this function returns. -// -TIntermAggregate* TParseContext::handleFunctionDefinition(const TSourceLoc& loc, TFunction& function) -{ - currentCaller = function.getMangledName(); - TSymbol* symbol = symbolTable.find(function.getMangledName()); - TFunction* prevDec = symbol ? symbol->getAsFunction() : nullptr; - - if (! prevDec) - error(loc, "can't find function", function.getName().c_str(), ""); - // Note: 'prevDec' could be 'function' if this is the first time we've seen function - // as it would have just been put in the symbol table. Otherwise, we're looking up - // an earlier occurrence. - - if (prevDec && prevDec->isDefined()) { - // Then this function already has a body. - error(loc, "function already has a body", function.getName().c_str(), ""); - } - if (prevDec && ! prevDec->isDefined()) { - prevDec->setDefined(); - - // Remember the return type for later checking for RETURN statements. - currentFunctionType = &(prevDec->getType()); - } else - currentFunctionType = new TType(EbtVoid); - functionReturnsValue = false; - - // Check for entry point - if (function.getName().compare(intermediate.getEntryPointName().c_str()) == 0) { - intermediate.setEntryPointMangledName(function.getMangledName().c_str()); - intermediate.incrementEntryPointCount(); - inMain = true; - } else - inMain = false; - - // - // Raise error message if main function takes any parameters or returns anything other than void - // - if (inMain) { - if (function.getParamCount() > 0) - error(loc, "function cannot take any parameter(s)", function.getName().c_str(), ""); - if (function.getType().getBasicType() != EbtVoid) - error(loc, "", function.getType().getBasicTypeString().c_str(), "entry point cannot return a value"); - } - - // - // New symbol table scope for body of function plus its arguments - // - symbolTable.push(); - - // - // Insert parameters into the symbol table. - // If the parameter has no name, it's not an error, just don't insert it - // (could be used for unused args). - // - // Also, accumulate the list of parameters into the HIL, so lower level code - // knows where to find parameters. - // - TIntermAggregate* paramNodes = new TIntermAggregate; - for (int i = 0; i < function.getParamCount(); i++) { - TParameter& param = function[i]; - if (param.name != nullptr) { - TVariable *variable = new TVariable(param.name, *param.type); - - // Insert the parameters with name in the symbol table. - if (! symbolTable.insert(*variable)) - error(loc, "redefinition", variable->getName().c_str(), ""); - else { - // Transfer ownership of name pointer to symbol table. - param.name = nullptr; - - // Add the parameter to the HIL - paramNodes = intermediate.growAggregate(paramNodes, - intermediate.addSymbol(*variable, loc), - loc); - } - } else - paramNodes = intermediate.growAggregate(paramNodes, intermediate.addSymbol(*param.type, loc), loc); - } - intermediate.setAggregateOperator(paramNodes, EOpParameters, TType(EbtVoid), loc); - loopNestingLevel = 0; - statementNestingLevel = 0; - controlFlowNestingLevel = 0; - postEntryPointReturn = false; - - return paramNodes; -} - -// -// Handle seeing function call syntax in the grammar, which could be any of -// - .length() method -// - constructor -// - a call to a built-in function mapped to an operator -// - a call to a built-in function that will remain a function call (e.g., texturing) -// - user function -// - subroutine call (not implemented yet) -// -TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction* function, TIntermNode* arguments) -{ - TIntermTyped* result = nullptr; - - if (function->getBuiltInOp() == EOpArrayLength) - result = handleLengthMethod(loc, function, arguments); - else if (function->getBuiltInOp() != EOpNull) { - // - // Then this should be a constructor. - // Don't go through the symbol table for constructors. - // Their parameters will be verified algorithmically. - // - TType type(EbtVoid); // use this to get the type back - if (! constructorError(loc, arguments, *function, function->getBuiltInOp(), type)) { - // - // It's a constructor, of type 'type'. - // - result = addConstructor(loc, arguments, type); - if (result == nullptr) - error(loc, "cannot construct with these arguments", type.getCompleteString().c_str(), ""); - } - } else { - // - // Find it in the symbol table. - // - const TFunction* fnCandidate; - bool builtIn; - fnCandidate = findFunction(loc, *function, builtIn); - if (fnCandidate) { - // This is a declared function that might map to - // - a built-in operator, - // - a built-in function not mapped to an operator, or - // - a user function. - - // Error check for a function requiring specific extensions present. - if (builtIn && fnCandidate->getNumExtensions()) - requireExtensions(loc, fnCandidate->getNumExtensions(), fnCandidate->getExtensions(), fnCandidate->getName().c_str()); - - if (arguments) { - // Make sure qualifications work for these arguments. - TIntermAggregate* aggregate = arguments->getAsAggregate(); - for (int i = 0; i < fnCandidate->getParamCount(); ++i) { - // At this early point there is a slight ambiguity between whether an aggregate 'arguments' - // is the single argument itself or its children are the arguments. Only one argument - // means take 'arguments' itself as the one argument. - TIntermNode* arg = fnCandidate->getParamCount() == 1 ? arguments : (aggregate ? aggregate->getSequence()[i] : arguments); - TQualifier& formalQualifier = (*fnCandidate)[i].type->getQualifier(); - if (formalQualifier.isParamOutput()) { - if (lValueErrorCheck(arguments->getLoc(), "assign", arg->getAsTyped())) - error(arguments->getLoc(), "Non-L-value cannot be passed for 'out' or 'inout' parameters.", "out", ""); - } - TQualifier& argQualifier = arg->getAsTyped()->getQualifier(); - if (argQualifier.isMemory()) { - const char* message = "argument cannot drop memory qualifier when passed to formal parameter"; - if (argQualifier.volatil && ! formalQualifier.volatil) - error(arguments->getLoc(), message, "volatile", ""); - if (argQualifier.coherent && ! formalQualifier.coherent) - error(arguments->getLoc(), message, "coherent", ""); - if (argQualifier.readonly && ! formalQualifier.readonly) - error(arguments->getLoc(), message, "readonly", ""); - if (argQualifier.writeonly && ! formalQualifier.writeonly) - error(arguments->getLoc(), message, "writeonly", ""); - } - // TODO 4.5 functionality: A shader will fail to compile - // if the value passed to the memargument of an atomic memory function does not correspond to a buffer or - // shared variable. It is acceptable to pass an element of an array or a single component of a vector to the - // memargument of an atomic memory function, as long as the underlying array or vector is a buffer or - // shared variable. - } - - // Convert 'in' arguments - addInputArgumentConversions(*fnCandidate, arguments); // arguments may be modified if it's just a single argument node - } - - if (builtIn && fnCandidate->getBuiltInOp() != EOpNull) { - // A function call mapped to a built-in operation. - result = handleBuiltInFunctionCall(loc, *arguments, *fnCandidate); - } else { - // This is a function call not mapped to built-in operator. - // It could still be a built-in function, but only if PureOperatorBuiltins == false. - result = intermediate.setAggregateOperator(arguments, EOpFunctionCall, fnCandidate->getType(), loc); - TIntermAggregate* call = result->getAsAggregate(); - call->setName(fnCandidate->getMangledName()); - - // this is how we know whether the given function is a built-in function or a user-defined function - // if builtIn == false, it's a userDefined -> could be an overloaded built-in function also - // if builtIn == true, it's definitely a built-in function with EOpNull - if (! builtIn) { - call->setUserDefined(); - if (symbolTable.atGlobalLevel()) { - requireProfile(loc, ~EEsProfile, "calling user function from global scope"); - intermediate.addToCallGraph(infoSink, "main(", fnCandidate->getMangledName()); - } else - intermediate.addToCallGraph(infoSink, currentCaller, fnCandidate->getMangledName()); - } - - if (builtIn) - nonOpBuiltInCheck(loc, *fnCandidate, *call); - else - userFunctionCallCheck(loc, *call); - } - - // Convert 'out' arguments. If it was a constant folded built-in, it won't be an aggregate anymore. - // Built-ins with a single argument aren't called with an aggregate, but they also don't have an output. - // Also, build the qualifier list for user function calls, which are always called with an aggregate. - if (result->getAsAggregate()) { - TQualifierList& qualifierList = result->getAsAggregate()->getQualifierList(); - for (int i = 0; i < fnCandidate->getParamCount(); ++i) { - TStorageQualifier qual = (*fnCandidate)[i].type->getQualifier().storage; - qualifierList.push_back(qual); - } - result = addOutputArgumentConversions(*fnCandidate, *result->getAsAggregate()); - } - } - } - - // generic error recovery - // TODO: simplification: localize all the error recoveries that look like this, and taking type into account to reduce cascades - if (result == nullptr) - result = intermediate.addConstantUnion(0.0, EbtFloat, loc); - - return result; -} - -TIntermTyped* TParseContext::handleBuiltInFunctionCall(TSourceLoc loc, TIntermNode& arguments, - const TFunction& function) -{ - checkLocation(loc, function.getBuiltInOp()); - TIntermTyped *result = intermediate.addBuiltInFunctionCall(loc, function.getBuiltInOp(), - function.getParamCount() == 1, - &arguments, function.getType()); - if (obeyPrecisionQualifiers()) - computeBuiltinPrecisions(*result, function); - - if (result == nullptr) { - error(arguments.getLoc(), " wrong operand type", "Internal Error", - "built in unary operator function. Type: %s", - static_cast(&arguments)->getCompleteString().c_str()); - } else if (result->getAsOperator()) - builtInOpCheck(loc, function, *result->getAsOperator()); - - return result; -} - -// "The operation of a built-in function can have a different precision -// qualification than the precision qualification of the resulting value. -// These two precision qualifications are established as follows. -// -// The precision qualification of the operation of a built-in function is -// based on the precision qualification of its input arguments and formal -// parameters: When a formal parameter specifies a precision qualifier, -// that is used, otherwise, the precision qualification of the calling -// argument is used. The highest precision of these will be the precision -// qualification of the operation of the built-in function. Generally, -// this is applied across all arguments to a built-in function, with the -// exceptions being: -// - bitfieldExtract and bitfieldInsert ignore the 'offset' and 'bits' -// arguments. -// - interpolateAt* functions only look at the 'interpolant' argument. -// -// The precision qualification of the result of a built-in function is -// determined in one of the following ways: -// -// - For the texture sampling, image load, and image store functions, -// the precision of the return type matches the precision of the -// sampler type -// -// Otherwise: -// -// - For prototypes that do not specify a resulting precision qualifier, -// the precision will be the same as the precision of the operation. -// -// - For prototypes that do specify a resulting precision qualifier, -// the specified precision qualifier is the precision qualification of -// the result." -// -void TParseContext::computeBuiltinPrecisions(TIntermTyped& node, const TFunction& function) -{ - TPrecisionQualifier operationPrecision = EpqNone; - TPrecisionQualifier resultPrecision = EpqNone; - - TIntermOperator* opNode = node.getAsOperator(); - if (opNode == nullptr) - return; - - if (TIntermUnary* unaryNode = node.getAsUnaryNode()) { - operationPrecision = std::max(function[0].type->getQualifier().precision, - unaryNode->getOperand()->getType().getQualifier().precision); - if (function.getType().getBasicType() != EbtBool) - resultPrecision = function.getType().getQualifier().precision == EpqNone ? - operationPrecision : - function.getType().getQualifier().precision; - } else if (TIntermAggregate* agg = node.getAsAggregate()) { - TIntermSequence& sequence = agg->getSequence(); - unsigned int numArgs = (unsigned int)sequence.size(); - switch (agg->getOp()) { - case EOpBitfieldExtract: - numArgs = 1; - break; - case EOpBitfieldInsert: - numArgs = 2; - break; - case EOpInterpolateAtCentroid: - case EOpInterpolateAtOffset: - case EOpInterpolateAtSample: - numArgs = 1; - break; - default: - break; - } - // find the maximum precision from the arguments and parameters - for (unsigned int arg = 0; arg < numArgs; ++arg) { - operationPrecision = std::max(operationPrecision, sequence[arg]->getAsTyped()->getQualifier().precision); - operationPrecision = std::max(operationPrecision, function[arg].type->getQualifier().precision); - } - // compute the result precision -#ifdef AMD_EXTENSIONS - if (agg->isSampling() || - agg->getOp() == EOpImageLoad || agg->getOp() == EOpImageStore || - agg->getOp() == EOpImageLoadLod || agg->getOp() == EOpImageStoreLod) -#else - if (agg->isSampling() || agg->getOp() == EOpImageLoad || agg->getOp() == EOpImageStore) -#endif - resultPrecision = sequence[0]->getAsTyped()->getQualifier().precision; - else if (function.getType().getBasicType() != EbtBool) - resultPrecision = function.getType().getQualifier().precision == EpqNone ? - operationPrecision : - function.getType().getQualifier().precision; - } - - // Propagate precision through this node and its children. That algorithm stops - // when a precision is found, so start by clearing this subroot precision - opNode->getQualifier().precision = EpqNone; - if (operationPrecision != EpqNone) { - opNode->propagatePrecision(operationPrecision); - opNode->setOperationPrecision(operationPrecision); - } - // Now, set the result precision, which might not match - opNode->getQualifier().precision = resultPrecision; -} - -TIntermNode* TParseContext::handleReturnValue(const TSourceLoc& loc, TIntermTyped* value) -{ - functionReturnsValue = true; - if (currentFunctionType->getBasicType() == EbtVoid) { - error(loc, "void function cannot return a value", "return", ""); - return intermediate.addBranch(EOpReturn, loc); - } else if (*currentFunctionType != value->getType()) { - TIntermTyped* converted = intermediate.addConversion(EOpReturn, *currentFunctionType, value); - if (converted) { - if (*currentFunctionType != converted->getType()) - error(loc, "cannot convert return value to function return type", "return", ""); - if (version < 420) - warn(loc, "type conversion on return values was not explicitly allowed until version 420", "return", ""); - return intermediate.addBranch(EOpReturn, converted, loc); - } else { - error(loc, "type does not match, or is not convertible to, the function's return type", "return", ""); - return intermediate.addBranch(EOpReturn, value, loc); - } - } else - return intermediate.addBranch(EOpReturn, value, loc); -} - -// See if the operation is being done in an illegal location. -void TParseContext::checkLocation(const TSourceLoc& loc, TOperator op) -{ - switch (op) { - case EOpBarrier: - if (language == EShLangTessControl) { - if (controlFlowNestingLevel > 0) - error(loc, "tessellation control barrier() cannot be placed within flow control", "", ""); - if (! inMain) - error(loc, "tessellation control barrier() must be in main()", "", ""); - else if (postEntryPointReturn) - error(loc, "tessellation control barrier() cannot be placed after a return from main()", "", ""); - } - break; - default: - break; - } -} - -// Finish processing object.length(). This started earlier in handleDotDereference(), where -// the ".length" part was recognized and semantically checked, and finished here where the -// function syntax "()" is recognized. -// -// Return resulting tree node. -TIntermTyped* TParseContext::handleLengthMethod(const TSourceLoc& loc, TFunction* function, TIntermNode* intermNode) -{ - int length = 0; - - if (function->getParamCount() > 0) - error(loc, "method does not accept any arguments", function->getName().c_str(), ""); - else { - const TType& type = intermNode->getAsTyped()->getType(); - if (type.isArray()) { - if (type.isRuntimeSizedArray()) { - // Create a unary op and let the back end handle it - return intermediate.addBuiltInFunctionCall(loc, EOpArrayLength, true, intermNode, TType(EbtInt)); - } else if (type.isImplicitlySizedArray()) { - if (intermNode->getAsSymbolNode() && isIoResizeArray(type)) { - // We could be between a layout declaration that gives a built-in io array implicit size and - // a user redeclaration of that array, meaning we have to substitute its implicit size here - // without actually redeclaring the array. (It is an error to use a member before the - // redeclaration, but not an error to use the array name itself.) - const TString& name = intermNode->getAsSymbolNode()->getName(); - if (name == "gl_in" || name == "gl_out") - length = getIoArrayImplicitSize(); - } - if (length == 0) { - if (intermNode->getAsSymbolNode() && isIoResizeArray(type)) - error(loc, "", function->getName().c_str(), "array must first be sized by a redeclaration or layout qualifier"); - else - error(loc, "", function->getName().c_str(), "array must be declared with a size before using this method"); - } - } else if (type.getOuterArrayNode()) { - // If the array's outer size is specified by an intermediate node, it means the array's length - // was specified by a specialization constant. In such a case, we should return the node of the - // specialization constants to represent the length. - return type.getOuterArrayNode(); - } else - length = type.getOuterArraySize(); - } else if (type.isMatrix()) - length = type.getMatrixCols(); - else if (type.isVector()) - length = type.getVectorSize(); - else { - // we should not get here, because earlier semantic checking should have prevented this path - error(loc, ".length()", "unexpected use of .length()", ""); - } - } - - if (length == 0) - length = 1; - - return intermediate.addConstantUnion(length, loc); -} - -// -// Add any needed implicit conversions for function-call arguments to input parameters. -// -void TParseContext::addInputArgumentConversions(const TFunction& function, TIntermNode*& arguments) const -{ - TIntermAggregate* aggregate = arguments->getAsAggregate(); - - // Process each argument's conversion - for (int i = 0; i < function.getParamCount(); ++i) { - // At this early point there is a slight ambiguity between whether an aggregate 'arguments' - // is the single argument itself or its children are the arguments. Only one argument - // means take 'arguments' itself as the one argument. - TIntermTyped* arg = function.getParamCount() == 1 ? arguments->getAsTyped() : (aggregate ? aggregate->getSequence()[i]->getAsTyped() : arguments->getAsTyped()); - if (*function[i].type != arg->getType()) { - if (function[i].type->getQualifier().isParamInput()) { - // In-qualified arguments just need an extra node added above the argument to - // convert to the correct type. - arg = intermediate.addConversion(EOpFunctionCall, *function[i].type, arg); - if (arg) { - if (function.getParamCount() == 1) - arguments = arg; - else { - if (aggregate) - aggregate->getSequence()[i] = arg; - else - arguments = arg; - } - } - } - } - } -} - -// -// Add any needed implicit output conversions for function-call arguments. This -// can require a new tree topology, complicated further by whether the function -// has a return value. -// -// Returns a node of a subtree that evaluates to the return value of the function. -// -TIntermTyped* TParseContext::addOutputArgumentConversions(const TFunction& function, TIntermAggregate& intermNode) const -{ - TIntermSequence& arguments = intermNode.getSequence(); - - // Will there be any output conversions? - bool outputConversions = false; - for (int i = 0; i < function.getParamCount(); ++i) { - if (*function[i].type != arguments[i]->getAsTyped()->getType() && function[i].type->getQualifier().isParamOutput()) { - outputConversions = true; - break; - } - } - - if (! outputConversions) - return &intermNode; - - // Setup for the new tree, if needed: - // - // Output conversions need a different tree topology. - // Out-qualified arguments need a temporary of the correct type, with the call - // followed by an assignment of the temporary to the original argument: - // void: function(arg, ...) -> ( function(tempArg, ...), arg = tempArg, ...) - // ret = function(arg, ...) -> ret = (tempRet = function(tempArg, ...), arg = tempArg, ..., tempRet) - // Where the "tempArg" type needs no conversion as an argument, but will convert on assignment. - TIntermTyped* conversionTree = nullptr; - TVariable* tempRet = nullptr; - if (intermNode.getBasicType() != EbtVoid) { - // do the "tempRet = function(...), " bit from above - tempRet = makeInternalVariable("tempReturn", intermNode.getType()); - TIntermSymbol* tempRetNode = intermediate.addSymbol(*tempRet, intermNode.getLoc()); - conversionTree = intermediate.addAssign(EOpAssign, tempRetNode, &intermNode, intermNode.getLoc()); - } else - conversionTree = &intermNode; - - conversionTree = intermediate.makeAggregate(conversionTree); - - // Process each argument's conversion - for (int i = 0; i < function.getParamCount(); ++i) { - if (*function[i].type != arguments[i]->getAsTyped()->getType()) { - if (function[i].type->getQualifier().isParamOutput()) { - // Out-qualified arguments need to use the topology set up above. - // do the " ...(tempArg, ...), arg = tempArg" bit from above - TVariable* tempArg = makeInternalVariable("tempArg", *function[i].type); - tempArg->getWritableType().getQualifier().makeTemporary(); - TIntermSymbol* tempArgNode = intermediate.addSymbol(*tempArg, intermNode.getLoc()); - TIntermTyped* tempAssign = intermediate.addAssign(EOpAssign, arguments[i]->getAsTyped(), tempArgNode, arguments[i]->getLoc()); - conversionTree = intermediate.growAggregate(conversionTree, tempAssign, arguments[i]->getLoc()); - // replace the argument with another node for the same tempArg variable - arguments[i] = intermediate.addSymbol(*tempArg, intermNode.getLoc()); - } - } - } - - // Finalize the tree topology (see bigger comment above). - if (tempRet) { - // do the "..., tempRet" bit from above - TIntermSymbol* tempRetNode = intermediate.addSymbol(*tempRet, intermNode.getLoc()); - conversionTree = intermediate.growAggregate(conversionTree, tempRetNode, intermNode.getLoc()); - } - conversionTree = intermediate.setAggregateOperator(conversionTree, EOpComma, intermNode.getType(), intermNode.getLoc()); - - return conversionTree; -} - -// -// Do additional checking of built-in function calls that is not caught -// by normal semantic checks on argument type, extension tagging, etc. -// -// Assumes there has been a semantically correct match to a built-in function prototype. -// -void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCandidate, TIntermOperator& callNode) -{ - // Set up convenience accessors to the argument(s). There is almost always - // multiple arguments for the cases below, but when there might be one, - // check the unaryArg first. - const TIntermSequence* argp = nullptr; // confusing to use [] syntax on a pointer, so this is to help get a reference - const TIntermTyped* unaryArg = nullptr; - const TIntermTyped* arg0 = nullptr; - if (callNode.getAsAggregate()) { - argp = &callNode.getAsAggregate()->getSequence(); - if (argp->size() > 0) - arg0 = (*argp)[0]->getAsTyped(); - } else { - assert(callNode.getAsUnaryNode()); - unaryArg = callNode.getAsUnaryNode()->getOperand(); - arg0 = unaryArg; - } - - TString featureString; - const char* feature = nullptr; - switch (callNode.getOp()) { - case EOpTextureGather: - case EOpTextureGatherOffset: - case EOpTextureGatherOffsets: - { - // Figure out which variants are allowed by what extensions, - // and what arguments must be constant for which situations. - - featureString = fnCandidate.getName() + "(...)"; - feature = featureString.c_str(); - profileRequires(loc, EEsProfile, 310, nullptr, feature); - int compArg = -1; // track which argument, if any, is the constant component argument - switch (callNode.getOp()) { - case EOpTextureGather: - // More than two arguments needs gpu_shader5, and rectangular or shadow needs gpu_shader5, - // otherwise, need GL_ARB_texture_gather. - if (fnCandidate.getParamCount() > 2 || fnCandidate[0].type->getSampler().dim == EsdRect || fnCandidate[0].type->getSampler().shadow) { - profileRequires(loc, ~EEsProfile, 400, E_GL_ARB_gpu_shader5, feature); - if (! fnCandidate[0].type->getSampler().shadow) - compArg = 2; - } else - profileRequires(loc, ~EEsProfile, 400, E_GL_ARB_texture_gather, feature); - break; - case EOpTextureGatherOffset: - // GL_ARB_texture_gather is good enough for 2D non-shadow textures with no component argument - if (fnCandidate[0].type->getSampler().dim == Esd2D && ! fnCandidate[0].type->getSampler().shadow && fnCandidate.getParamCount() == 3) - profileRequires(loc, ~EEsProfile, 400, E_GL_ARB_texture_gather, feature); - else - profileRequires(loc, ~EEsProfile, 400, E_GL_ARB_gpu_shader5, feature); - if (! (*argp)[fnCandidate[0].type->getSampler().shadow ? 3 : 2]->getAsConstantUnion()) - profileRequires(loc, EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, - "non-constant offset argument"); - if (! fnCandidate[0].type->getSampler().shadow) - compArg = 3; - break; - case EOpTextureGatherOffsets: - profileRequires(loc, ~EEsProfile, 400, E_GL_ARB_gpu_shader5, feature); - if (! fnCandidate[0].type->getSampler().shadow) - compArg = 3; - // check for constant offsets - if (! (*argp)[fnCandidate[0].type->getSampler().shadow ? 3 : 2]->getAsConstantUnion()) - error(loc, "must be a compile-time constant:", feature, "offsets argument"); - break; - default: - break; - } - - if (compArg > 0 && compArg < fnCandidate.getParamCount()) { - if ((*argp)[compArg]->getAsConstantUnion()) { - int value = (*argp)[compArg]->getAsConstantUnion()->getConstArray()[0].getIConst(); - if (value < 0 || value > 3) - error(loc, "must be 0, 1, 2, or 3:", feature, "component argument"); - } else - error(loc, "must be a compile-time constant:", feature, "component argument"); - } - -#ifdef AMD_EXTENSIONS - bool bias = false; - if (callNode.getOp() == EOpTextureGather) - bias = fnCandidate.getParamCount() > 3; - else if (callNode.getOp() == EOpTextureGatherOffset || - callNode.getOp() == EOpTextureGatherOffsets) - bias = fnCandidate.getParamCount() > 4; - - if (bias) { - featureString = fnCandidate.getName() + "with bias argument"; - feature = featureString.c_str(); - profileRequires(loc, ~EEsProfile, 450, nullptr, feature); - requireExtensions(loc, 1, &E_GL_AMD_texture_gather_bias_lod, feature); - } -#endif - - break; - } - -#ifdef AMD_EXTENSIONS - case EOpSparseTextureGather: - case EOpSparseTextureGatherOffset: - case EOpSparseTextureGatherOffsets: - { - bool bias = false; - if (callNode.getOp() == EOpSparseTextureGather) - bias = fnCandidate.getParamCount() > 4; - else if (callNode.getOp() == EOpSparseTextureGatherOffset || - callNode.getOp() == EOpSparseTextureGatherOffsets) - bias = fnCandidate.getParamCount() > 5; - - if (bias) { - featureString = fnCandidate.getName() + "with bias argument"; - feature = featureString.c_str(); - profileRequires(loc, ~EEsProfile, 450, nullptr, feature); - requireExtensions(loc, 1, &E_GL_AMD_texture_gather_bias_lod, feature); - } - - break; - } - - case EOpSparseTextureGatherLod: - case EOpSparseTextureGatherLodOffset: - case EOpSparseTextureGatherLodOffsets: - { - requireExtensions(loc, 1, &E_GL_ARB_sparse_texture2, fnCandidate.getName().c_str()); - break; - } -#endif - - case EOpTextureOffset: - case EOpTextureFetchOffset: - case EOpTextureProjOffset: - case EOpTextureLodOffset: - case EOpTextureProjLodOffset: - case EOpTextureGradOffset: - case EOpTextureProjGradOffset: - { - // Handle texture-offset limits checking - // Pick which argument has to hold constant offsets - int arg = -1; - switch (callNode.getOp()) { - case EOpTextureOffset: arg = 2; break; - case EOpTextureFetchOffset: arg = (arg0->getType().getSampler().dim != EsdRect) ? 3 : 2; break; - case EOpTextureProjOffset: arg = 2; break; - case EOpTextureLodOffset: arg = 3; break; - case EOpTextureProjLodOffset: arg = 3; break; - case EOpTextureGradOffset: arg = 4; break; - case EOpTextureProjGradOffset: arg = 4; break; - default: - assert(0); - break; - } - - if (arg > 0) { - if (! (*argp)[arg]->getAsConstantUnion()) - error(loc, "argument must be compile-time constant", "texel offset", ""); - else { - const TType& type = (*argp)[arg]->getAsTyped()->getType(); - for (int c = 0; c < type.getVectorSize(); ++c) { - int offset = (*argp)[arg]->getAsConstantUnion()->getConstArray()[c].getIConst(); - if (offset > resources.maxProgramTexelOffset || offset < resources.minProgramTexelOffset) - error(loc, "value is out of range:", "texel offset", "[gl_MinProgramTexelOffset, gl_MaxProgramTexelOffset]"); - } - } - } - - break; - } - - case EOpTextureQuerySamples: - case EOpImageQuerySamples: - // GL_ARB_shader_texture_image_samples - profileRequires(loc, ~EEsProfile, 450, E_GL_ARB_shader_texture_image_samples, "textureSamples and imageSamples"); - break; - - case EOpImageAtomicAdd: - case EOpImageAtomicMin: - case EOpImageAtomicMax: - case EOpImageAtomicAnd: - case EOpImageAtomicOr: - case EOpImageAtomicXor: - case EOpImageAtomicExchange: - case EOpImageAtomicCompSwap: - { - // Make sure the image types have the correct layout() format and correct argument types - const TType& imageType = arg0->getType(); - if (imageType.getSampler().type == EbtInt || imageType.getSampler().type == EbtUint) { - if (imageType.getQualifier().layoutFormat != ElfR32i && imageType.getQualifier().layoutFormat != ElfR32ui) - error(loc, "only supported on image with format r32i or r32ui", fnCandidate.getName().c_str(), ""); - } else { - if (fnCandidate.getName().compare(0, 19, "imageAtomicExchange") != 0) - error(loc, "only supported on integer images", fnCandidate.getName().c_str(), ""); - else if (imageType.getQualifier().layoutFormat != ElfR32f && profile == EEsProfile) - error(loc, "only supported on image with format r32f", fnCandidate.getName().c_str(), ""); - } - - break; - } - -#ifdef NV_EXTENSIONS - case EOpAtomicAdd: - case EOpAtomicMin: - case EOpAtomicMax: - case EOpAtomicAnd: - case EOpAtomicOr: - case EOpAtomicXor: - case EOpAtomicExchange: - case EOpAtomicCompSwap: - { - if (arg0->getType().getBasicType() == EbtInt64 || arg0->getType().getBasicType() == EbtUint64) - requireExtensions(loc, 1, &E_GL_NV_shader_atomic_int64, fnCandidate.getName().c_str()); - - break; - } -#endif - - case EOpInterpolateAtCentroid: - case EOpInterpolateAtSample: - case EOpInterpolateAtOffset: - // Make sure the first argument is an interpolant, or an array element of an interpolant - if (arg0->getType().getQualifier().storage != EvqVaryingIn) { - // It might still be an array element. - // - // We could check more, but the semantics of the first argument are already met; the - // only way to turn an array into a float/vec* is array dereference and swizzle. - // - // ES and desktop 4.3 and earlier: swizzles may not be used - // desktop 4.4 and later: swizzles may be used - bool swizzleOkay = (profile != EEsProfile) && (version >= 440); - const TIntermTyped* base = TIntermediate::findLValueBase(arg0, swizzleOkay); - if (base == nullptr || base->getType().getQualifier().storage != EvqVaryingIn) - error(loc, "first argument must be an interpolant, or interpolant-array element", fnCandidate.getName().c_str(), ""); - } - break; - - case EOpEmitStreamVertex: - case EOpEndStreamPrimitive: - intermediate.setMultiStream(); - break; - - default: - break; - } -} - -extern bool PureOperatorBuiltins; - -// Deprecated! Use PureOperatorBuiltins == true instead, in which case this -// functionality is handled in builtInOpCheck() instead of here. -// -// Do additional checking of built-in function calls that were not mapped -// to built-in operations (e.g., texturing functions). -// -// Assumes there has been a semantically correct match to a built-in function. -// -void TParseContext::nonOpBuiltInCheck(const TSourceLoc& loc, const TFunction& fnCandidate, TIntermAggregate& callNode) -{ - // Further maintenance of this function is deprecated, because the "correct" - // future-oriented design is to not have to do string compares on function names. - - // If PureOperatorBuiltins == true, then all built-ins should be mapped - // to a TOperator, and this function would then never get called. - - assert(PureOperatorBuiltins == false); - - // built-in texturing functions get their return value precision from the precision of the sampler - if (fnCandidate.getType().getQualifier().precision == EpqNone && - fnCandidate.getParamCount() > 0 && fnCandidate[0].type->getBasicType() == EbtSampler) - callNode.getQualifier().precision = callNode.getSequence()[0]->getAsTyped()->getQualifier().precision; - - if (fnCandidate.getName().compare(0, 7, "texture") == 0) { - if (fnCandidate.getName().compare(0, 13, "textureGather") == 0) { - TString featureString = fnCandidate.getName() + "(...)"; - const char* feature = featureString.c_str(); - profileRequires(loc, EEsProfile, 310, nullptr, feature); - - int compArg = -1; // track which argument, if any, is the constant component argument - if (fnCandidate.getName().compare("textureGatherOffset") == 0) { - // GL_ARB_texture_gather is good enough for 2D non-shadow textures with no component argument - if (fnCandidate[0].type->getSampler().dim == Esd2D && ! fnCandidate[0].type->getSampler().shadow && fnCandidate.getParamCount() == 3) - profileRequires(loc, ~EEsProfile, 400, E_GL_ARB_texture_gather, feature); - else - profileRequires(loc, ~EEsProfile, 400, E_GL_ARB_gpu_shader5, feature); - int offsetArg = fnCandidate[0].type->getSampler().shadow ? 3 : 2; - if (! callNode.getSequence()[offsetArg]->getAsConstantUnion()) - profileRequires(loc, EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, - "non-constant offset argument"); - if (! fnCandidate[0].type->getSampler().shadow) - compArg = 3; - } else if (fnCandidate.getName().compare("textureGatherOffsets") == 0) { - profileRequires(loc, ~EEsProfile, 400, E_GL_ARB_gpu_shader5, feature); - if (! fnCandidate[0].type->getSampler().shadow) - compArg = 3; - // check for constant offsets - int offsetArg = fnCandidate[0].type->getSampler().shadow ? 3 : 2; - if (! callNode.getSequence()[offsetArg]->getAsConstantUnion()) - error(loc, "must be a compile-time constant:", feature, "offsets argument"); - } else if (fnCandidate.getName().compare("textureGather") == 0) { - // More than two arguments needs gpu_shader5, and rectangular or shadow needs gpu_shader5, - // otherwise, need GL_ARB_texture_gather. - if (fnCandidate.getParamCount() > 2 || fnCandidate[0].type->getSampler().dim == EsdRect || fnCandidate[0].type->getSampler().shadow) { - profileRequires(loc, ~EEsProfile, 400, E_GL_ARB_gpu_shader5, feature); - if (! fnCandidate[0].type->getSampler().shadow) - compArg = 2; - } else - profileRequires(loc, ~EEsProfile, 400, E_GL_ARB_texture_gather, feature); - } - - if (compArg > 0 && compArg < fnCandidate.getParamCount()) { - if (callNode.getSequence()[compArg]->getAsConstantUnion()) { - int value = callNode.getSequence()[compArg]->getAsConstantUnion()->getConstArray()[0].getIConst(); - if (value < 0 || value > 3) - error(loc, "must be 0, 1, 2, or 3:", feature, "component argument"); - } else - error(loc, "must be a compile-time constant:", feature, "component argument"); - } - } else { - // this is only for functions not starting "textureGather"... - if (fnCandidate.getName().find("Offset") != TString::npos) { - - // Handle texture-offset limits checking - int arg = -1; - if (fnCandidate.getName().compare("textureOffset") == 0) - arg = 2; - else if (fnCandidate.getName().compare("texelFetchOffset") == 0) - arg = 3; - else if (fnCandidate.getName().compare("textureProjOffset") == 0) - arg = 2; - else if (fnCandidate.getName().compare("textureLodOffset") == 0) - arg = 3; - else if (fnCandidate.getName().compare("textureProjLodOffset") == 0) - arg = 3; - else if (fnCandidate.getName().compare("textureGradOffset") == 0) - arg = 4; - else if (fnCandidate.getName().compare("textureProjGradOffset") == 0) - arg = 4; - - if (arg > 0) { - if (! callNode.getSequence()[arg]->getAsConstantUnion()) - error(loc, "argument must be compile-time constant", "texel offset", ""); - else { - const TType& type = callNode.getSequence()[arg]->getAsTyped()->getType(); - for (int c = 0; c < type.getVectorSize(); ++c) { - int offset = callNode.getSequence()[arg]->getAsConstantUnion()->getConstArray()[c].getIConst(); - if (offset > resources.maxProgramTexelOffset || offset < resources.minProgramTexelOffset) - error(loc, "value is out of range:", "texel offset", "[gl_MinProgramTexelOffset, gl_MaxProgramTexelOffset]"); - } - } - } - } - } - } - - // GL_ARB_shader_texture_image_samples - if (fnCandidate.getName().compare(0, 14, "textureSamples") == 0 || fnCandidate.getName().compare(0, 12, "imageSamples") == 0) - profileRequires(loc, ~EEsProfile, 450, E_GL_ARB_shader_texture_image_samples, "textureSamples and imageSamples"); - - if (fnCandidate.getName().compare(0, 11, "imageAtomic") == 0) { - const TType& imageType = callNode.getSequence()[0]->getAsTyped()->getType(); - if (imageType.getSampler().type == EbtInt || imageType.getSampler().type == EbtUint) { - if (imageType.getQualifier().layoutFormat != ElfR32i && imageType.getQualifier().layoutFormat != ElfR32ui) - error(loc, "only supported on image with format r32i or r32ui", fnCandidate.getName().c_str(), ""); - } else { - if (fnCandidate.getName().compare(0, 19, "imageAtomicExchange") != 0) - error(loc, "only supported on integer images", fnCandidate.getName().c_str(), ""); - else if (imageType.getQualifier().layoutFormat != ElfR32f && profile == EEsProfile) - error(loc, "only supported on image with format r32f", fnCandidate.getName().c_str(), ""); - } - } -} - -// -// Do any extra checking for a user function call. -// -void TParseContext::userFunctionCallCheck(const TSourceLoc& loc, TIntermAggregate& callNode) -{ - TIntermSequence& arguments = callNode.getSequence(); - - for (int i = 0; i < (int)arguments.size(); ++i) - samplerConstructorLocationCheck(loc, "call argument", arguments[i]); -} - -// -// Emit an error if this is a sampler constructor -// -void TParseContext::samplerConstructorLocationCheck(const TSourceLoc& loc, const char* token, TIntermNode* node) -{ - if (node->getAsOperator() && node->getAsOperator()->getOp() == EOpConstructTextureSampler) - error(loc, "sampler constructor must appear at point of use", token, ""); -} - -// -// Handle seeing a built-in constructor in a grammar production. -// -TFunction* TParseContext::handleConstructorCall(const TSourceLoc& loc, const TPublicType& publicType) -{ - TType type(publicType); - type.getQualifier().precision = EpqNone; - - if (type.isArray()) { - profileRequires(loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed constructor"); - profileRequires(loc, EEsProfile, 300, nullptr, "arrayed constructor"); - } - - TOperator op = intermediate.mapTypeToConstructorOp(type); - - if (op == EOpNull) { - error(loc, "cannot construct this type", type.getBasicString(), ""); - op = EOpConstructFloat; - TType errorType(EbtFloat); - type.shallowCopy(errorType); - } - - TString empty(""); - - return new TFunction(&empty, type, op); -} - -// Handle seeing a precision qualifier in the grammar. -void TParseContext::handlePrecisionQualifier(const TSourceLoc& /*loc*/, TQualifier& qualifier, TPrecisionQualifier precision) -{ - if (obeyPrecisionQualifiers()) - qualifier.precision = precision; -} - -// Check for messages to give on seeing a precision qualifier used in a -// declaration in the grammar. -void TParseContext::checkPrecisionQualifier(const TSourceLoc& loc, TPrecisionQualifier) -{ - if (precisionManager.shouldWarnAboutDefaults()) { - warn(loc, "all default precisions are highp; use precision statements to quiet warning, e.g.:\n" - " \"precision mediump int; precision highp float;\"", "", ""); - precisionManager.defaultWarningGiven(); - } -} - -// -// Same error message for all places assignments don't work. -// -void TParseContext::assignError(const TSourceLoc& loc, const char* op, TString left, TString right) -{ - error(loc, "", op, "cannot convert from '%s' to '%s'", - right.c_str(), left.c_str()); -} - -// -// Same error message for all places unary operations don't work. -// -void TParseContext::unaryOpError(const TSourceLoc& loc, const char* op, TString operand) -{ - error(loc, " wrong operand type", op, - "no operation '%s' exists that takes an operand of type %s (or there is no acceptable conversion)", - op, operand.c_str()); -} - -// -// Same error message for all binary operations don't work. -// -void TParseContext::binaryOpError(const TSourceLoc& loc, const char* op, TString left, TString right) -{ - error(loc, " wrong operand types:", op, - "no operation '%s' exists that takes a left-hand operand of type '%s' and " - "a right operand of type '%s' (or there is no acceptable conversion)", - op, left.c_str(), right.c_str()); -} - -// -// A basic type of EbtVoid is a key that the name string was seen in the source, but -// it was not found as a variable in the symbol table. If so, give the error -// message and insert a dummy variable in the symbol table to prevent future errors. -// -void TParseContext::variableCheck(TIntermTyped*& nodePtr) -{ - TIntermSymbol* symbol = nodePtr->getAsSymbolNode(); - if (! symbol) - return; - - if (symbol->getType().getBasicType() == EbtVoid) { - const char *extraInfoFormat = ""; - if (spvVersion.vulkan != 0 && symbol->getName() == "gl_VertexID") { - extraInfoFormat = "(Did you mean gl_VertexIndex?)"; - } else if (spvVersion.vulkan != 0 && symbol->getName() == "gl_InstanceID") { - extraInfoFormat = "(Did you mean gl_InstanceIndex?)"; - } - error(symbol->getLoc(), "undeclared identifier", symbol->getName().c_str(), extraInfoFormat); - - // Add to symbol table to prevent future error messages on the same name - if (symbol->getName().size() > 0) { - TVariable* fakeVariable = new TVariable(&symbol->getName(), TType(EbtFloat)); - symbolTable.insert(*fakeVariable); - - // substitute a symbol node for this new variable - nodePtr = intermediate.addSymbol(*fakeVariable, symbol->getLoc()); - } - } else { - switch (symbol->getQualifier().storage) { - case EvqPointCoord: - profileRequires(symbol->getLoc(), ENoProfile, 120, nullptr, "gl_PointCoord"); - break; - default: break; // some compilers want this - } - } -} - -// -// Both test and if necessary, spit out an error, to see if the node is really -// an l-value that can be operated on this way. -// -// Returns true if there was an error. -// -bool TParseContext::lValueErrorCheck(const TSourceLoc& loc, const char* op, TIntermTyped* node) -{ - TIntermBinary* binaryNode = node->getAsBinaryNode(); - - if (binaryNode) { - bool errorReturn = false; - - switch(binaryNode->getOp()) { - case EOpIndexDirect: - case EOpIndexIndirect: - // ... tessellation control shader ... - // If a per-vertex output variable is used as an l-value, it is a - // compile-time or link-time error if the expression indicating the - // vertex index is not the identifier gl_InvocationID. - if (language == EShLangTessControl) { - const TType& leftType = binaryNode->getLeft()->getType(); - if (leftType.getQualifier().storage == EvqVaryingOut && ! leftType.getQualifier().patch && binaryNode->getLeft()->getAsSymbolNode()) { - // we have a per-vertex output - const TIntermSymbol* rightSymbol = binaryNode->getRight()->getAsSymbolNode(); - if (! rightSymbol || rightSymbol->getQualifier().builtIn != EbvInvocationId) - error(loc, "tessellation-control per-vertex output l-value must be indexed with gl_InvocationID", "[]", ""); - } - } - - break; // left node is checked by base class - case EOpIndexDirectStruct: - break; // left node is checked by base class - case EOpVectorSwizzle: - errorReturn = lValueErrorCheck(loc, op, binaryNode->getLeft()); - if (!errorReturn) { - int offset[4] = {0,0,0,0}; - - TIntermTyped* rightNode = binaryNode->getRight(); - TIntermAggregate *aggrNode = rightNode->getAsAggregate(); - - for (TIntermSequence::iterator p = aggrNode->getSequence().begin(); - p != aggrNode->getSequence().end(); p++) { - int value = (*p)->getAsTyped()->getAsConstantUnion()->getConstArray()[0].getIConst(); - offset[value]++; - if (offset[value] > 1) { - error(loc, " l-value of swizzle cannot have duplicate components", op, "", ""); - - return true; - } - } - } - - return errorReturn; - default: - break; - } - - if (errorReturn) { - error(loc, " l-value required", op, "", ""); - return true; - } - } - - // Let the base class check errors - if (TParseContextBase::lValueErrorCheck(loc, op, node)) - return true; - - const char* symbol = nullptr; - TIntermSymbol* symNode = node->getAsSymbolNode(); - if (symNode != nullptr) - symbol = symNode->getName().c_str(); - - const char* message = nullptr; - switch (node->getQualifier().storage) { - case EvqVaryingIn: message = "can't modify shader input"; break; - case EvqInstanceId: message = "can't modify gl_InstanceID"; break; - case EvqVertexId: message = "can't modify gl_VertexID"; break; - case EvqFace: message = "can't modify gl_FrontFace"; break; - case EvqFragCoord: message = "can't modify gl_FragCoord"; break; - case EvqPointCoord: message = "can't modify gl_PointCoord"; break; - case EvqFragDepth: - intermediate.setDepthReplacing(); - // "In addition, it is an error to statically write to gl_FragDepth in the fragment shader." - if (profile == EEsProfile && intermediate.getEarlyFragmentTests()) - message = "can't modify gl_FragDepth if using early_fragment_tests"; - break; - - default: - break; - } - - if (message == nullptr && binaryNode == nullptr && symNode == nullptr) { - error(loc, " l-value required", op, "", ""); - - return true; - } - - // - // Everything else is okay, no error. - // - if (message == nullptr) - return false; - - // - // If we get here, we have an error and a message. - // - if (symNode) - error(loc, " l-value required", op, "\"%s\" (%s)", symbol, message); - else - error(loc, " l-value required", op, "(%s)", message); - - return true; -} - -// Test for and give an error if the node can't be read from. -void TParseContext::rValueErrorCheck(const TSourceLoc& loc, const char* op, TIntermTyped* node) -{ - // Let the base class check errors - TParseContextBase::rValueErrorCheck(loc, op, node); - -#ifdef AMD_EXTENSIONS - TIntermSymbol* symNode = node->getAsSymbolNode(); - if (!(symNode && symNode->getQualifier().writeonly)) // base class checks - if (symNode && symNode->getQualifier().explicitInterp) - error(loc, "can't read from explicitly-interpolated object: ", op, symNode->getName().c_str()); -#endif -} - -// -// Both test, and if necessary spit out an error, to see if the node is really -// a constant. -// -void TParseContext::constantValueCheck(TIntermTyped* node, const char* token) -{ - if (! node->getQualifier().isConstant()) - error(node->getLoc(), "constant expression required", token, ""); -} - -// -// Both test, and if necessary spit out an error, to see if the node is really -// an integer. -// -void TParseContext::integerCheck(const TIntermTyped* node, const char* token) -{ - if ((node->getBasicType() == EbtInt || node->getBasicType() == EbtUint) && node->isScalar()) - return; - - error(node->getLoc(), "scalar integer expression required", token, ""); -} - -// -// Both test, and if necessary spit out an error, to see if we are currently -// globally scoped. -// -void TParseContext::globalCheck(const TSourceLoc& loc, const char* token) -{ - if (! symbolTable.atGlobalLevel()) - error(loc, "not allowed in nested scope", token, ""); -} - -// -// Reserved errors for GLSL. -// -void TParseContext::reservedErrorCheck(const TSourceLoc& loc, const TString& identifier) -{ - // "Identifiers starting with "gl_" are reserved for use by OpenGL, and may not be - // declared in a shader; this results in a compile-time error." - if (! symbolTable.atBuiltInLevel()) { - if (builtInName(identifier)) - error(loc, "identifiers starting with \"gl_\" are reserved", identifier.c_str(), ""); - - // "__" are not supposed to be an error. ES 310 (and desktop) added the clarification: - // "In addition, all identifiers containing two consecutive underscores (__) are - // reserved; using such a name does not itself result in an error, but may result - // in undefined behavior." - // however, before that, ES tests required an error. - if (identifier.find("__") != TString::npos) { - if (profile == EEsProfile && version <= 300) - error(loc, "identifiers containing consecutive underscores (\"__\") are reserved, and an error if version <= 300", identifier.c_str(), ""); - else - warn(loc, "identifiers containing consecutive underscores (\"__\") are reserved", identifier.c_str(), ""); - } - } -} - -// -// Reserved errors for the preprocessor. -// -void TParseContext::reservedPpErrorCheck(const TSourceLoc& loc, const char* identifier, const char* op) -{ - // "__" are not supposed to be an error. ES 310 (and desktop) added the clarification: - // "All macro names containing two consecutive underscores ( __ ) are reserved; - // defining such a name does not itself result in an error, but may result in - // undefined behavior. All macro names prefixed with "GL_" ("GL" followed by a - // single underscore) are also reserved, and defining such a name results in a - // compile-time error." - // however, before that, ES tests required an error. - if (strncmp(identifier, "GL_", 3) == 0) - ppError(loc, "names beginning with \"GL_\" can't be (un)defined:", op, identifier); - else if (strncmp(identifier, "defined", 8) == 0) - ppError(loc, "\"defined\" can't be (un)defined:", op, identifier); - else if (strstr(identifier, "__") != 0) { - if (profile == EEsProfile && version >= 300 && - (strcmp(identifier, "__LINE__") == 0 || - strcmp(identifier, "__FILE__") == 0 || - strcmp(identifier, "__VERSION__") == 0)) - ppError(loc, "predefined names can't be (un)defined:", op, identifier); - else { - if (profile == EEsProfile && version <= 300) - ppError(loc, "names containing consecutive underscores are reserved, and an error if version <= 300:", op, identifier); - else - ppWarn(loc, "names containing consecutive underscores are reserved:", op, identifier); - } - } -} - -// -// See if this version/profile allows use of the line-continuation character '\'. -// -// Returns true if a line continuation should be done. -// -bool TParseContext::lineContinuationCheck(const TSourceLoc& loc, bool endOfComment) -{ - const char* message = "line continuation"; - - bool lineContinuationAllowed = (profile == EEsProfile && version >= 300) || - (profile != EEsProfile && (version >= 420 || extensionTurnedOn(E_GL_ARB_shading_language_420pack))); - - if (endOfComment) { - if (lineContinuationAllowed) - warn(loc, "used at end of comment; the following line is still part of the comment", message, ""); - else - warn(loc, "used at end of comment, but this version does not provide line continuation", message, ""); - - return lineContinuationAllowed; - } - - if (relaxedErrors()) { - if (! lineContinuationAllowed) - warn(loc, "not allowed in this version", message, ""); - return true; - } else { - profileRequires(loc, EEsProfile, 300, nullptr, message); - profileRequires(loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, message); - } - - return lineContinuationAllowed; -} - -bool TParseContext::builtInName(const TString& identifier) -{ - return identifier.compare(0, 3, "gl_") == 0; -} - -// -// Make sure there is enough data and not too many arguments provided to the -// constructor to build something of the type of the constructor. Also returns -// the type of the constructor. -// -// Part of establishing type is establishing specialization-constness. -// We don't yet know "top down" whether type is a specialization constant, -// but a const constructor can becomes a specialization constant if any of -// its children are, subject to KHR_vulkan_glsl rules: -// -// - int(), uint(), and bool() constructors for type conversions -// from any of the following types to any of the following types: -// * int -// * uint -// * bool -// - vector versions of the above conversion constructors -// -// Returns true if there was an error in construction. -// -bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, TFunction& function, TOperator op, TType& type) -{ - type.shallowCopy(function.getType()); - - bool constructingMatrix = false; - switch(op) { - case EOpConstructTextureSampler: - return constructorTextureSamplerError(loc, function); - case EOpConstructMat2x2: - case EOpConstructMat2x3: - case EOpConstructMat2x4: - case EOpConstructMat3x2: - case EOpConstructMat3x3: - case EOpConstructMat3x4: - case EOpConstructMat4x2: - case EOpConstructMat4x3: - case EOpConstructMat4x4: - case EOpConstructDMat2x2: - case EOpConstructDMat2x3: - case EOpConstructDMat2x4: - case EOpConstructDMat3x2: - case EOpConstructDMat3x3: - case EOpConstructDMat3x4: - case EOpConstructDMat4x2: - case EOpConstructDMat4x3: - case EOpConstructDMat4x4: -#ifdef AMD_EXTENSIONS - case EOpConstructF16Mat2x2: - case EOpConstructF16Mat2x3: - case EOpConstructF16Mat2x4: - case EOpConstructF16Mat3x2: - case EOpConstructF16Mat3x3: - case EOpConstructF16Mat3x4: - case EOpConstructF16Mat4x2: - case EOpConstructF16Mat4x3: - case EOpConstructF16Mat4x4: -#endif - constructingMatrix = true; - break; - default: - break; - } - - // - // Walk the arguments for first-pass checks and collection of information. - // - - int size = 0; - bool constType = true; - bool specConstType = false; // value is only valid if constType is true - bool full = false; - bool overFull = false; - bool matrixInMatrix = false; - bool arrayArg = false; - bool floatArgument = false; - for (int arg = 0; arg < function.getParamCount(); ++arg) { - if (function[arg].type->isArray()) { - if (! function[arg].type->isExplicitlySizedArray()) { - // Can't construct from an unsized array. - error(loc, "array argument must be sized", "constructor", ""); - return true; - } - arrayArg = true; - } - if (constructingMatrix && function[arg].type->isMatrix()) - matrixInMatrix = true; - - // 'full' will go to true when enough args have been seen. If we loop - // again, there is an extra argument. - if (full) { - // For vectors and matrices, it's okay to have too many components - // available, but not okay to have unused arguments. - overFull = true; - } - - size += function[arg].type->computeNumComponents(); - if (op != EOpConstructStruct && ! type.isArray() && size >= type.computeNumComponents()) - full = true; - - if (! function[arg].type->getQualifier().isConstant()) - constType = false; - if (function[arg].type->getQualifier().isSpecConstant()) - specConstType = true; - if (function[arg].type->isFloatingDomain()) - floatArgument = true; - } - - // inherit constness from children - if (constType) { - bool makeSpecConst; - // Finish pinning down spec-const semantics - if (specConstType) { - switch (op) { - case EOpConstructInt: - case EOpConstructUint: - case EOpConstructInt64: - case EOpConstructUint64: -#ifdef AMD_EXTENSIONS - case EOpConstructInt16: - case EOpConstructUint16: -#endif - case EOpConstructBool: - case EOpConstructBVec2: - case EOpConstructBVec3: - case EOpConstructBVec4: - case EOpConstructIVec2: - case EOpConstructIVec3: - case EOpConstructIVec4: - case EOpConstructUVec2: - case EOpConstructUVec3: - case EOpConstructUVec4: - case EOpConstructI64Vec2: - case EOpConstructI64Vec3: - case EOpConstructI64Vec4: - case EOpConstructU64Vec2: - case EOpConstructU64Vec3: - case EOpConstructU64Vec4: -#ifdef AMD_EXTENSIONS - case EOpConstructI16Vec2: - case EOpConstructI16Vec3: - case EOpConstructI16Vec4: - case EOpConstructU16Vec2: - case EOpConstructU16Vec3: - case EOpConstructU16Vec4: -#endif - // This was the list of valid ones, if they aren't converting from float - // and aren't making an array. - makeSpecConst = ! floatArgument && ! type.isArray(); - break; - default: - // anything else wasn't white-listed in the spec as a conversion - makeSpecConst = false; - break; - } - } else - makeSpecConst = false; - - if (makeSpecConst) - type.getQualifier().makeSpecConstant(); - else if (specConstType) - type.getQualifier().makeTemporary(); - else - type.getQualifier().storage = EvqConst; - } - - if (type.isArray()) { - if (function.getParamCount() == 0) { - error(loc, "array constructor must have at least one argument", "constructor", ""); - return true; - } - - if (type.isImplicitlySizedArray()) { - // auto adapt the constructor type to the number of arguments - type.changeOuterArraySize(function.getParamCount()); - } else if (type.getOuterArraySize() != function.getParamCount()) { - error(loc, "array constructor needs one argument per array element", "constructor", ""); - return true; - } - - if (type.isArrayOfArrays()) { - // Types have to match, but we're still making the type. - // Finish making the type, and the comparison is done later - // when checking for conversion. - TArraySizes& arraySizes = type.getArraySizes(); - - // At least the dimensionalities have to match. - if (! function[0].type->isArray() || arraySizes.getNumDims() != function[0].type->getArraySizes().getNumDims() + 1) { - error(loc, "array constructor argument not correct type to construct array element", "constructor", ""); - return true; - } - - if (arraySizes.isInnerImplicit()) { - // "Arrays of arrays ..., and the size for any dimension is optional" - // That means we need to adopt (from the first argument) the other array sizes into the type. - for (int d = 1; d < arraySizes.getNumDims(); ++d) { - if (arraySizes.getDimSize(d) == UnsizedArraySize) { - arraySizes.setDimSize(d, function[0].type->getArraySizes().getDimSize(d - 1)); - } - } - } - } - } - - if (arrayArg && op != EOpConstructStruct && ! type.isArrayOfArrays()) { - error(loc, "constructing non-array constituent from array argument", "constructor", ""); - return true; - } - - if (matrixInMatrix && ! type.isArray()) { - profileRequires(loc, ENoProfile, 120, nullptr, "constructing matrix from matrix"); - - // "If a matrix argument is given to a matrix constructor, - // it is a compile-time error to have any other arguments." - if (function.getParamCount() != 1) - error(loc, "matrix constructed from matrix can only have one argument", "constructor", ""); - return false; - } - - if (overFull) { - error(loc, "too many arguments", "constructor", ""); - return true; - } - - if (op == EOpConstructStruct && ! type.isArray() && (int)type.getStruct()->size() != function.getParamCount()) { - error(loc, "Number of constructor parameters does not match the number of structure fields", "constructor", ""); - return true; - } - - if ((op != EOpConstructStruct && size != 1 && size < type.computeNumComponents()) || - (op == EOpConstructStruct && size < type.computeNumComponents())) { - error(loc, "not enough data provided for construction", "constructor", ""); - return true; - } - - TIntermTyped* typed = node->getAsTyped(); - if (typed == nullptr) { - error(loc, "constructor argument does not have a type", "constructor", ""); - return true; - } - if (op != EOpConstructStruct && typed->getBasicType() == EbtSampler) { - error(loc, "cannot convert a sampler", "constructor", ""); - return true; - } - if (op != EOpConstructStruct && typed->getBasicType() == EbtAtomicUint) { - error(loc, "cannot convert an atomic_uint", "constructor", ""); - return true; - } - if (typed->getBasicType() == EbtVoid) { - error(loc, "cannot convert a void", "constructor", ""); - return true; - } - - return false; -} - -// Verify all the correct semantics for constructing a combined texture/sampler. -// Return true if the semantics are incorrect. -bool TParseContext::constructorTextureSamplerError(const TSourceLoc& loc, const TFunction& function) -{ - TString constructorName = function.getType().getBasicTypeString(); // TODO: performance: should not be making copy; interface needs to change - const char* token = constructorName.c_str(); - - // exactly two arguments needed - if (function.getParamCount() != 2) { - error(loc, "sampler-constructor requires two arguments", token, ""); - return true; - } - - // For now, not allowing arrayed constructors, the rest of this function - // is set up to allow them, if this test is removed: - if (function.getType().isArray()) { - error(loc, "sampler-constructor cannot make an array of samplers", token, ""); - return true; - } - - // first argument - // * the constructor's first argument must be a texture type - // * the dimensionality (1D, 2D, 3D, Cube, Rect, Buffer, MS, and Array) - // of the texture type must match that of the constructed sampler type - // (that is, the suffixes of the type of the first argument and the - // type of the constructor will be spelled the same way) - if (function[0].type->getBasicType() != EbtSampler || - ! function[0].type->getSampler().isTexture() || - function[0].type->isArray()) { - error(loc, "sampler-constructor first argument must be a scalar textureXXX type", token, ""); - return true; - } - // simulate the first argument's impact on the result type, so it can be compared with the encapsulated operator!=() - TSampler texture = function.getType().getSampler(); - texture.combined = false; - texture.shadow = false; - if (texture != function[0].type->getSampler()) { - error(loc, "sampler-constructor first argument must match type and dimensionality of constructor type", token, ""); - return true; - } - - // second argument - // * the constructor's second argument must be a scalar of type - // *sampler* or *samplerShadow* - // * the presence or absence of depth comparison (Shadow) must match - // between the constructed sampler type and the type of the second argument - if ( function[1].type->getBasicType() != EbtSampler || - ! function[1].type->getSampler().isPureSampler() || - function[1].type->isArray()) { - error(loc, "sampler-constructor second argument must be a scalar type 'sampler'", token, ""); - return true; - } - if (function.getType().getSampler().shadow != function[1].type->getSampler().shadow) { - error(loc, "sampler-constructor second argument presence of shadow must match constructor presence of shadow", token, ""); - return true; - } - - return false; -} - -// Checks to see if a void variable has been declared and raise an error message for such a case -// -// returns true in case of an error -// -bool TParseContext::voidErrorCheck(const TSourceLoc& loc, const TString& identifier, const TBasicType basicType) -{ - if (basicType == EbtVoid) { - error(loc, "illegal use of type 'void'", identifier.c_str(), ""); - return true; - } - - return false; -} - -// Checks to see if the node (for the expression) contains a scalar boolean expression or not -void TParseContext::boolCheck(const TSourceLoc& loc, const TIntermTyped* type) -{ - if (type->getBasicType() != EbtBool || type->isArray() || type->isMatrix() || type->isVector()) - error(loc, "boolean expression expected", "", ""); -} - -// This function checks to see if the node (for the expression) contains a scalar boolean expression or not -void TParseContext::boolCheck(const TSourceLoc& loc, const TPublicType& pType) -{ - if (pType.basicType != EbtBool || pType.arraySizes || pType.matrixCols > 1 || (pType.vectorSize > 1)) - error(loc, "boolean expression expected", "", ""); -} - -void TParseContext::samplerCheck(const TSourceLoc& loc, const TType& type, const TString& identifier, TIntermTyped* /*initializer*/) -{ - // Check that the appropriate extension is enabled if external sampler is used. - // There are two extensions. The correct one must be used based on GLSL version. - if (type.getBasicType() == EbtSampler && type.getSampler().external) { - if (version < 300) { - requireExtensions(loc, 1, &E_GL_OES_EGL_image_external, "samplerExternalOES"); - } else { - requireExtensions(loc, 1, &E_GL_OES_EGL_image_external_essl3, "samplerExternalOES"); - } - } - - if (type.getQualifier().storage == EvqUniform) - return; - - if (type.getBasicType() == EbtStruct && containsFieldWithBasicType(type, EbtSampler)) - error(loc, "non-uniform struct contains a sampler or image:", type.getBasicTypeString().c_str(), identifier.c_str()); - else if (type.getBasicType() == EbtSampler && type.getQualifier().storage != EvqUniform) { - // non-uniform sampler - // not yet: okay if it has an initializer - // if (! initializer) - error(loc, "sampler/image types can only be used in uniform variables or function parameters:", type.getBasicTypeString().c_str(), identifier.c_str()); - } -} - -void TParseContext::atomicUintCheck(const TSourceLoc& loc, const TType& type, const TString& identifier) -{ - if (type.getQualifier().storage == EvqUniform) - return; - - if (type.getBasicType() == EbtStruct && containsFieldWithBasicType(type, EbtAtomicUint)) - error(loc, "non-uniform struct contains an atomic_uint:", type.getBasicTypeString().c_str(), identifier.c_str()); - else if (type.getBasicType() == EbtAtomicUint && type.getQualifier().storage != EvqUniform) - error(loc, "atomic_uints can only be used in uniform variables or function parameters:", type.getBasicTypeString().c_str(), identifier.c_str()); -} - -void TParseContext::transparentOpaqueCheck(const TSourceLoc& loc, const TType& type, const TString& identifier) -{ - if (parsingBuiltins) - return; - - if (type.getQualifier().storage != EvqUniform) - return; - - if (type.containsNonOpaque()) { - // Vulkan doesn't allow transparent uniforms outside of blocks - if (spvVersion.vulkan > 0) - vulkanRemoved(loc, "non-opaque uniforms outside a block"); - // OpenGL wants locations on these (unless they are getting automapped) - if (spvVersion.openGl > 0 && !type.getQualifier().hasLocation() && !intermediate.getAutoMapLocations()) - error(loc, "non-opaque uniform variables need a layout(location=L)", identifier.c_str(), ""); - } -} - -// -// Check/fix just a full qualifier (no variables or types yet, but qualifier is complete) at global level. -// -void TParseContext::globalQualifierFixCheck(const TSourceLoc& loc, TQualifier& qualifier) -{ - // move from parameter/unknown qualifiers to pipeline in/out qualifiers - switch (qualifier.storage) { - case EvqIn: - profileRequires(loc, ENoProfile, 130, nullptr, "in for stage inputs"); - profileRequires(loc, EEsProfile, 300, nullptr, "in for stage inputs"); - qualifier.storage = EvqVaryingIn; - break; - case EvqOut: - profileRequires(loc, ENoProfile, 130, nullptr, "out for stage outputs"); - profileRequires(loc, EEsProfile, 300, nullptr, "out for stage outputs"); - qualifier.storage = EvqVaryingOut; - break; - case EvqInOut: - qualifier.storage = EvqVaryingIn; - error(loc, "cannot use 'inout' at global scope", "", ""); - break; - default: - break; - } - - invariantCheck(loc, qualifier); -} - -// -// Check a full qualifier and type (no variable yet) at global level. -// -void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQualifier& qualifier, const TPublicType& publicType) -{ - if (! symbolTable.atGlobalLevel()) - return; - - if (qualifier.isMemory() && ! publicType.isImage() && publicType.qualifier.storage != EvqBuffer) - error(loc, "memory qualifiers cannot be used on this type", "", ""); - - if (qualifier.storage == EvqBuffer && publicType.basicType != EbtBlock) - error(loc, "buffers can be declared only as blocks", "buffer", ""); - - if (qualifier.storage != EvqVaryingIn && qualifier.storage != EvqVaryingOut) - return; - - if (publicType.shaderQualifiers.blendEquation) - error(loc, "can only be applied to a standalone 'out'", "blend equation", ""); - - // now, knowing it is a shader in/out, do all the in/out semantic checks - - if (publicType.basicType == EbtBool && !parsingBuiltins) { - error(loc, "cannot be bool", GetStorageQualifierString(qualifier.storage), ""); - return; - } - - if (publicType.basicType == EbtInt || publicType.basicType == EbtUint || -#ifdef AMD_EXTENSIONS - publicType.basicType == EbtInt16 || publicType.basicType == EbtUint16 || -#endif - publicType.basicType == EbtInt64 || publicType.basicType == EbtUint64 || - publicType.basicType == EbtDouble) - profileRequires(loc, EEsProfile, 300, nullptr, "shader input/output"); - -#ifdef AMD_EXTENSIONS - if (! qualifier.flat && ! qualifier.explicitInterp) { -#else - if (!qualifier.flat) { -#endif - if (publicType.basicType == EbtInt || publicType.basicType == EbtUint || -#ifdef AMD_EXTENSIONS - publicType.basicType == EbtInt16 || publicType.basicType == EbtUint16 || -#endif - publicType.basicType == EbtInt64 || publicType.basicType == EbtUint64 || - publicType.basicType == EbtDouble || - (publicType.userDef && (publicType.userDef->containsBasicType(EbtInt) || - publicType.userDef->containsBasicType(EbtUint) || - publicType.userDef->containsBasicType(EbtInt64) || - publicType.userDef->containsBasicType(EbtUint64) || - publicType.userDef->containsBasicType(EbtDouble)))) { - if (qualifier.storage == EvqVaryingIn && language == EShLangFragment) - error(loc, "must be qualified as flat", TType::getBasicString(publicType.basicType), GetStorageQualifierString(qualifier.storage)); - else if (qualifier.storage == EvqVaryingOut && language == EShLangVertex && version == 300) - error(loc, "must be qualified as flat", TType::getBasicString(publicType.basicType), GetStorageQualifierString(qualifier.storage)); - } - } - - if (qualifier.patch && qualifier.isInterpolation()) - error(loc, "cannot use interpolation qualifiers with patch", "patch", ""); - - if (qualifier.storage == EvqVaryingIn) { - switch (language) { - case EShLangVertex: - if (publicType.basicType == EbtStruct) { - error(loc, "cannot be a structure or array", GetStorageQualifierString(qualifier.storage), ""); - return; - } - if (publicType.arraySizes) { - requireProfile(loc, ~EEsProfile, "vertex input arrays"); - profileRequires(loc, ENoProfile, 150, nullptr, "vertex input arrays"); - } - if (publicType.basicType == EbtDouble) - profileRequires(loc, ~EEsProfile, 410, nullptr, "vertex-shader `double` type input"); - if (qualifier.isAuxiliary() || qualifier.isInterpolation() || qualifier.isMemory() || qualifier.invariant) - error(loc, "vertex input cannot be further qualified", "", ""); - break; - - case EShLangTessControl: - if (qualifier.patch) - error(loc, "can only use on output in tessellation-control shader", "patch", ""); - break; - - case EShLangTessEvaluation: - break; - - case EShLangGeometry: - break; - - case EShLangFragment: - if (publicType.userDef) { - profileRequires(loc, EEsProfile, 300, nullptr, "fragment-shader struct input"); - profileRequires(loc, ~EEsProfile, 150, nullptr, "fragment-shader struct input"); - if (publicType.userDef->containsStructure()) - requireProfile(loc, ~EEsProfile, "fragment-shader struct input containing structure"); - if (publicType.userDef->containsArray()) - requireProfile(loc, ~EEsProfile, "fragment-shader struct input containing an array"); - } - break; - - case EShLangCompute: - if (! symbolTable.atBuiltInLevel()) - error(loc, "global storage input qualifier cannot be used in a compute shader", "in", ""); - break; - - default: - break; - } - } else { - // qualifier.storage == EvqVaryingOut - switch (language) { - case EShLangVertex: - if (publicType.userDef) { - profileRequires(loc, EEsProfile, 300, nullptr, "vertex-shader struct output"); - profileRequires(loc, ~EEsProfile, 150, nullptr, "vertex-shader struct output"); - if (publicType.userDef->containsStructure()) - requireProfile(loc, ~EEsProfile, "vertex-shader struct output containing structure"); - if (publicType.userDef->containsArray()) - requireProfile(loc, ~EEsProfile, "vertex-shader struct output containing an array"); - } - - break; - - case EShLangTessControl: - break; - - case EShLangTessEvaluation: - if (qualifier.patch) - error(loc, "can only use on input in tessellation-evaluation shader", "patch", ""); - break; - - case EShLangGeometry: - break; - - case EShLangFragment: - profileRequires(loc, EEsProfile, 300, nullptr, "fragment shader output"); - if (publicType.basicType == EbtStruct) { - error(loc, "cannot be a structure", GetStorageQualifierString(qualifier.storage), ""); - return; - } - if (publicType.matrixRows > 0) { - error(loc, "cannot be a matrix", GetStorageQualifierString(qualifier.storage), ""); - return; - } - if (qualifier.isAuxiliary()) - error(loc, "can't use auxiliary qualifier on a fragment output", "centroid/sample/patch", ""); - if (qualifier.isInterpolation()) - error(loc, "can't use interpolation qualifier on a fragment output", "flat/smooth/noperspective", ""); - if (publicType.basicType == EbtDouble) - error(loc, "cannot contain a double", GetStorageQualifierString(qualifier.storage), ""); - break; - - case EShLangCompute: - error(loc, "global storage output qualifier cannot be used in a compute shader", "out", ""); - break; - - default: - break; - } - } -} - -// -// Merge characteristics of the 'src' qualifier into the 'dst'. -// If there is duplication, issue error messages, unless 'force' -// is specified, which means to just override default settings. -// -// Also, when force is false, it will be assumed that 'src' follows -// 'dst', for the purpose of error checking order for versions -// that require specific orderings of qualifiers. -// -void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, const TQualifier& src, bool force) -{ - // Multiple auxiliary qualifiers (mostly done later by 'individual qualifiers') - if (src.isAuxiliary() && dst.isAuxiliary()) - error(loc, "can only have one auxiliary qualifier (centroid, patch, and sample)", "", ""); - - // Multiple interpolation qualifiers (mostly done later by 'individual qualifiers') - if (src.isInterpolation() && dst.isInterpolation()) -#ifdef AMD_EXTENSIONS - error(loc, "can only have one interpolation qualifier (flat, smooth, noperspective, __explicitInterpAMD)", "", ""); -#else - error(loc, "can only have one interpolation qualifier (flat, smooth, noperspective)", "", ""); -#endif - - // Ordering - if (! force && ((profile != EEsProfile && version < 420) || - (profile == EEsProfile && version < 310)) - && ! extensionTurnedOn(E_GL_ARB_shading_language_420pack)) { - // non-function parameters - if (src.noContraction && (dst.invariant || dst.isInterpolation() || dst.isAuxiliary() || dst.storage != EvqTemporary || dst.precision != EpqNone)) - error(loc, "precise qualifier must appear first", "", ""); - if (src.invariant && (dst.isInterpolation() || dst.isAuxiliary() || dst.storage != EvqTemporary || dst.precision != EpqNone)) - error(loc, "invariant qualifier must appear before interpolation, storage, and precision qualifiers ", "", ""); - else if (src.isInterpolation() && (dst.isAuxiliary() || dst.storage != EvqTemporary || dst.precision != EpqNone)) - error(loc, "interpolation qualifiers must appear before storage and precision qualifiers", "", ""); - else if (src.isAuxiliary() && (dst.storage != EvqTemporary || dst.precision != EpqNone)) - error(loc, "Auxiliary qualifiers (centroid, patch, and sample) must appear before storage and precision qualifiers", "", ""); - else if (src.storage != EvqTemporary && (dst.precision != EpqNone)) - error(loc, "precision qualifier must appear as last qualifier", "", ""); - - // function parameters - if (src.noContraction && (dst.storage == EvqConst || dst.storage == EvqIn || dst.storage == EvqOut)) - error(loc, "precise qualifier must appear first", "", ""); - if (src.storage == EvqConst && (dst.storage == EvqIn || dst.storage == EvqOut)) - error(loc, "in/out must appear before const", "", ""); - } - - // Storage qualification - if (dst.storage == EvqTemporary || dst.storage == EvqGlobal) - dst.storage = src.storage; - else if ((dst.storage == EvqIn && src.storage == EvqOut) || - (dst.storage == EvqOut && src.storage == EvqIn)) - dst.storage = EvqInOut; - else if ((dst.storage == EvqIn && src.storage == EvqConst) || - (dst.storage == EvqConst && src.storage == EvqIn)) - dst.storage = EvqConstReadOnly; - else if (src.storage != EvqTemporary && - src.storage != EvqGlobal) - error(loc, "too many storage qualifiers", GetStorageQualifierString(src.storage), ""); - - // Precision qualifiers - if (! force && src.precision != EpqNone && dst.precision != EpqNone) - error(loc, "only one precision qualifier allowed", GetPrecisionQualifierString(src.precision), ""); - if (dst.precision == EpqNone || (force && src.precision != EpqNone)) - dst.precision = src.precision; - - // Layout qualifiers - mergeObjectLayoutQualifiers(dst, src, false); - - // individual qualifiers - bool repeated = false; - #define MERGE_SINGLETON(field) repeated |= dst.field && src.field; dst.field |= src.field; - MERGE_SINGLETON(invariant); - MERGE_SINGLETON(noContraction); - MERGE_SINGLETON(centroid); - MERGE_SINGLETON(smooth); - MERGE_SINGLETON(flat); - MERGE_SINGLETON(nopersp); -#ifdef AMD_EXTENSIONS - MERGE_SINGLETON(explicitInterp); -#endif - MERGE_SINGLETON(patch); - MERGE_SINGLETON(sample); - MERGE_SINGLETON(coherent); - MERGE_SINGLETON(volatil); - MERGE_SINGLETON(restrict); - MERGE_SINGLETON(readonly); - MERGE_SINGLETON(writeonly); - MERGE_SINGLETON(specConstant); - - if (repeated) - error(loc, "replicated qualifiers", "", ""); -} - -void TParseContext::setDefaultPrecision(const TSourceLoc& loc, TPublicType& publicType, TPrecisionQualifier qualifier) -{ - TBasicType basicType = publicType.basicType; - - if (basicType == EbtSampler) { - defaultSamplerPrecision[computeSamplerTypeIndex(publicType.sampler)] = qualifier; - - return; // all is well - } - - if (basicType == EbtInt || basicType == EbtFloat) { - if (publicType.isScalar()) { - defaultPrecision[basicType] = qualifier; - if (basicType == EbtInt) { - defaultPrecision[EbtUint] = qualifier; - precisionManager.explicitIntDefaultSeen(); - } else - precisionManager.explicitFloatDefaultSeen(); - - return; // all is well - } - } - - if (basicType == EbtAtomicUint) { - if (qualifier != EpqHigh) - error(loc, "can only apply highp to atomic_uint", "precision", ""); - - return; - } - - error(loc, "cannot apply precision statement to this type; use 'float', 'int' or a sampler type", TType::getBasicString(basicType), ""); -} - -// used to flatten the sampler type space into a single dimension -// correlates with the declaration of defaultSamplerPrecision[] -int TParseContext::computeSamplerTypeIndex(TSampler& sampler) -{ - int arrayIndex = sampler.arrayed ? 1 : 0; - int shadowIndex = sampler.shadow ? 1 : 0; - int externalIndex = sampler.external? 1 : 0; - int imageIndex = sampler.image ? 1 : 0; - int msIndex = sampler.ms ? 1 : 0; - - int flattened = EsdNumDims * (EbtNumTypes * (2 * (2 * (2 * (2 * arrayIndex + msIndex) + imageIndex) + shadowIndex) + - externalIndex) + sampler.type) + sampler.dim; - assert(flattened < maxSamplerIndex); - - return flattened; -} - -TPrecisionQualifier TParseContext::getDefaultPrecision(TPublicType& publicType) -{ - if (publicType.basicType == EbtSampler) - return defaultSamplerPrecision[computeSamplerTypeIndex(publicType.sampler)]; - else - return defaultPrecision[publicType.basicType]; -} - -void TParseContext::precisionQualifierCheck(const TSourceLoc& loc, TBasicType baseType, TQualifier& qualifier) -{ - // Built-in symbols are allowed some ambiguous precisions, to be pinned down - // later by context. - if (! obeyPrecisionQualifiers() || parsingBuiltins) - return; - - if (baseType == EbtAtomicUint && qualifier.precision != EpqNone && qualifier.precision != EpqHigh) - error(loc, "atomic counters can only be highp", "atomic_uint", ""); - - if (baseType == EbtFloat || baseType == EbtUint || baseType == EbtInt || baseType == EbtSampler || baseType == EbtAtomicUint) { - if (qualifier.precision == EpqNone) { - if (relaxedErrors()) - warn(loc, "type requires declaration of default precision qualifier", TType::getBasicString(baseType), "substituting 'mediump'"); - else - error(loc, "type requires declaration of default precision qualifier", TType::getBasicString(baseType), ""); - qualifier.precision = EpqMedium; - defaultPrecision[baseType] = EpqMedium; - } - } else if (qualifier.precision != EpqNone) - error(loc, "type cannot have precision qualifier", TType::getBasicString(baseType), ""); -} - -void TParseContext::parameterTypeCheck(const TSourceLoc& loc, TStorageQualifier qualifier, const TType& type) -{ - if ((qualifier == EvqOut || qualifier == EvqInOut) && type.isOpaque()) - error(loc, "samplers and atomic_uints cannot be output parameters", type.getBasicTypeString().c_str(), ""); -} - -bool TParseContext::containsFieldWithBasicType(const TType& type, TBasicType basicType) -{ - if (type.getBasicType() == basicType) - return true; - - if (type.getBasicType() == EbtStruct) { - const TTypeList& structure = *type.getStruct(); - for (unsigned int i = 0; i < structure.size(); ++i) { - if (containsFieldWithBasicType(*structure[i].type, basicType)) - return true; - } - } - - return false; -} - -// -// Do size checking for an array type's size. -// -void TParseContext::arraySizeCheck(const TSourceLoc& loc, TIntermTyped* expr, TArraySize& sizePair) -{ - bool isConst = false; - sizePair.node = nullptr; - - int size = 1; - - TIntermConstantUnion* constant = expr->getAsConstantUnion(); - if (constant) { - // handle true (non-specialization) constant - size = constant->getConstArray()[0].getIConst(); - isConst = true; - } else { - // see if it's a specialization constant instead - if (expr->getQualifier().isSpecConstant()) { - isConst = true; - sizePair.node = expr; - TIntermSymbol* symbol = expr->getAsSymbolNode(); - if (symbol && symbol->getConstArray().size() > 0) - size = symbol->getConstArray()[0].getIConst(); - } - } - - sizePair.size = size; - - if (! isConst || (expr->getBasicType() != EbtInt && expr->getBasicType() != EbtUint)) { - error(loc, "array size must be a constant integer expression", "", ""); - return; - } - - if (size <= 0) { - error(loc, "array size must be a positive integer", "", ""); - return; - } -} - -// -// See if this qualifier can be an array. -// -// Returns true if there is an error. -// -bool TParseContext::arrayQualifierError(const TSourceLoc& loc, const TQualifier& qualifier) -{ - if (qualifier.storage == EvqConst) { - profileRequires(loc, ENoProfile, 120, E_GL_3DL_array_objects, "const array"); - profileRequires(loc, EEsProfile, 300, nullptr, "const array"); - } - - if (qualifier.storage == EvqVaryingIn && language == EShLangVertex) { - requireProfile(loc, ~EEsProfile, "vertex input arrays"); - profileRequires(loc, ENoProfile, 150, nullptr, "vertex input arrays"); - } - - return false; -} - -// -// See if this qualifier and type combination can be an array. -// Assumes arrayQualifierError() was also called to catch the type-invariant tests. -// -// Returns true if there is an error. -// -bool TParseContext::arrayError(const TSourceLoc& loc, const TType& type) -{ - if (type.getQualifier().storage == EvqVaryingOut && language == EShLangVertex) { - if (type.isArrayOfArrays()) - requireProfile(loc, ~EEsProfile, "vertex-shader array-of-array output"); - else if (type.isStruct()) - requireProfile(loc, ~EEsProfile, "vertex-shader array-of-struct output"); - } - if (type.getQualifier().storage == EvqVaryingIn && language == EShLangFragment) { - if (type.isArrayOfArrays()) - requireProfile(loc, ~EEsProfile, "fragment-shader array-of-array input"); - else if (type.isStruct()) - requireProfile(loc, ~EEsProfile, "fragment-shader array-of-struct input"); - } - if (type.getQualifier().storage == EvqVaryingOut && language == EShLangFragment) { - if (type.isArrayOfArrays()) - requireProfile(loc, ~EEsProfile, "fragment-shader array-of-array output"); - } - - return false; -} - -// -// Require array to be completely sized -// -void TParseContext::arraySizeRequiredCheck(const TSourceLoc& loc, const TArraySizes& arraySizes) -{ - if (arraySizes.isImplicit()) - error(loc, "array size required", "", ""); -} - -void TParseContext::structArrayCheck(const TSourceLoc& /*loc*/, const TType& type) -{ - const TTypeList& structure = *type.getStruct(); - for (int m = 0; m < (int)structure.size(); ++m) { - const TType& member = *structure[m].type; - if (member.isArray()) - arraySizeRequiredCheck(structure[m].loc, *member.getArraySizes()); - } -} - -void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qualifier, TArraySizes* arraySizes, bool initializer, bool lastMember) -{ - assert(arraySizes); - - // always allow special built-in ins/outs sized to topologies - if (parsingBuiltins) - return; - - // always allow an initializer to set any unknown array sizes - if (initializer) - return; - - // No environment allows any non-outer-dimension to be implicitly sized - if (arraySizes->isInnerImplicit()) { - error(loc, "only outermost dimension of an array of arrays can be implicitly sized", "[]", ""); - arraySizes->clearInnerImplicit(); - } - - if (arraySizes->isInnerSpecialization()) - error(loc, "only outermost dimension of an array of arrays can be a specialization constant", "[]", ""); - - // desktop always allows outer-dimension-unsized variable arrays, - if (profile != EEsProfile) - return; - - // for ES, if size isn't coming from an initializer, it has to be explicitly declared now, - // with very few exceptions - - // last member of ssbo block exception: - if (qualifier.storage == EvqBuffer && lastMember) - return; - - // implicitly-sized io exceptions: - switch (language) { - case EShLangGeometry: - if (qualifier.storage == EvqVaryingIn) - if ((profile == EEsProfile && version >= 320) || - extensionsTurnedOn(Num_AEP_geometry_shader, AEP_geometry_shader)) - return; - break; - case EShLangTessControl: - if ( qualifier.storage == EvqVaryingIn || - (qualifier.storage == EvqVaryingOut && ! qualifier.patch)) - if ((profile == EEsProfile && version >= 320) || - extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader)) - return; - break; - case EShLangTessEvaluation: - if ((qualifier.storage == EvqVaryingIn && ! qualifier.patch) || - qualifier.storage == EvqVaryingOut) - if ((profile == EEsProfile && version >= 320) || - extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader)) - return; - break; - default: - break; - } - - arraySizeRequiredCheck(loc, *arraySizes); -} - -void TParseContext::arrayOfArrayVersionCheck(const TSourceLoc& loc) -{ - const char* feature = "arrays of arrays"; - - requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, feature); - profileRequires(loc, EEsProfile, 310, nullptr, feature); - profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, nullptr, feature); -} - -void TParseContext::arrayDimCheck(const TSourceLoc& loc, const TArraySizes* sizes1, const TArraySizes* sizes2) -{ - if ((sizes1 && sizes2) || - (sizes1 && sizes1->getNumDims() > 1) || - (sizes2 && sizes2->getNumDims() > 1)) - arrayOfArrayVersionCheck(loc); -} - -void TParseContext::arrayDimCheck(const TSourceLoc& loc, const TType* type, const TArraySizes* sizes2) -{ - // skip checking for multiple dimensions on the type; it was caught earlier - if ((type && type->isArray() && sizes2) || - (sizes2 && sizes2->getNumDims() > 1)) - arrayOfArrayVersionCheck(loc); -} - -// Merge array dimensions listed in 'sizes' onto the type's array dimensions. -// -// From the spec: "vec4[2] a[3]; // size-3 array of size-2 array of vec4" -// -// That means, the 'sizes' go in front of the 'type' as outermost sizes. -// 'type' is the type part of the declaration (to the left) -// 'sizes' is the arrayness tagged on the identifier (to the right) -// -void TParseContext::arrayDimMerge(TType& type, const TArraySizes* sizes) -{ - if (sizes) - type.addArrayOuterSizes(*sizes); -} - -// -// Do all the semantic checking for declaring or redeclaring an array, with and -// without a size, and make the right changes to the symbol table. -// -void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifier, const TType& type, TSymbol*& symbol) -{ - if (symbol == nullptr) { - bool currentScope; - symbol = symbolTable.find(identifier, nullptr, ¤tScope); - - if (symbol && builtInName(identifier) && ! symbolTable.atBuiltInLevel()) { - // bad shader (errors already reported) trying to redeclare a built-in name as an array - symbol = nullptr; - return; - } - if (symbol == nullptr || ! currentScope) { - // - // Successfully process a new definition. - // (Redeclarations have to take place at the same scope; otherwise they are hiding declarations) - // - symbol = new TVariable(&identifier, type); - symbolTable.insert(*symbol); - if (symbolTable.atGlobalLevel()) - trackLinkage(*symbol); - - if (! symbolTable.atBuiltInLevel()) { - if (isIoResizeArray(type)) { - ioArraySymbolResizeList.push_back(symbol); - checkIoArraysConsistency(loc, true); - } else - fixIoArraySize(loc, symbol->getWritableType()); - } - - return; - } - if (symbol->getAsAnonMember()) { - error(loc, "cannot redeclare a user-block member array", identifier.c_str(), ""); - symbol = nullptr; - return; - } - } - - // - // Process a redeclaration. - // - - if (symbol == nullptr) { - error(loc, "array variable name expected", identifier.c_str(), ""); - return; - } - - // redeclareBuiltinVariable() should have already done the copyUp() - TType& existingType = symbol->getWritableType(); - - if (! existingType.isArray()) { - error(loc, "redeclaring non-array as array", identifier.c_str(), ""); - return; - } - - if (! existingType.sameElementType(type)) { - error(loc, "redeclaration of array with a different element type", identifier.c_str(), ""); - return; - } - - if (! existingType.sameInnerArrayness(type)) { - error(loc, "redeclaration of array with a different array dimensions or sizes", identifier.c_str(), ""); - return; - } - - if (existingType.isExplicitlySizedArray()) { - // be more leniant for input arrays to geometry shaders and tessellation control outputs, where the redeclaration is the same size - if (! (isIoResizeArray(type) && existingType.getOuterArraySize() == type.getOuterArraySize())) - error(loc, "redeclaration of array with size", identifier.c_str(), ""); - return; - } - - arrayLimitCheck(loc, identifier, type.getOuterArraySize()); - - existingType.updateArraySizes(type); - - if (isIoResizeArray(type)) - checkIoArraysConsistency(loc); -} - -void TParseContext::updateImplicitArraySize(const TSourceLoc& loc, TIntermNode *node, int index) -{ - // maybe there is nothing to do... - TIntermTyped* typedNode = node->getAsTyped(); - if (typedNode->getType().getImplicitArraySize() > index) - return; - - // something to do... - - // Figure out what symbol to lookup, as we will use its type to edit for the size change, - // as that type will be shared through shallow copies for future references. - TSymbol* symbol = nullptr; - int blockIndex = -1; - const TString* lookupName = nullptr; - if (node->getAsSymbolNode()) - lookupName = &node->getAsSymbolNode()->getName(); - else if (node->getAsBinaryNode()) { - const TIntermBinary* deref = node->getAsBinaryNode(); - // This has to be the result of a block dereference, unless it's bad shader code - // If it's a uniform block, then an error will be issued elsewhere, but - // return early now to avoid crashing later in this function. - if (deref->getLeft()->getBasicType() != EbtBlock || - deref->getLeft()->getType().getQualifier().storage == EvqUniform || - deref->getRight()->getAsConstantUnion() == nullptr) - return; - - const TIntermTyped* left = deref->getLeft(); - const TIntermTyped* right = deref->getRight(); - - if (left->getAsBinaryNode()) { - left = left->getAsBinaryNode()->getLeft(); // Block array access - assert(left->isArray()); - } - - if (! left->getAsSymbolNode()) - return; - - blockIndex = right->getAsConstantUnion()->getConstArray()[0].getIConst(); - - lookupName = &left->getAsSymbolNode()->getName(); - if (IsAnonymous(*lookupName)) - lookupName = &(*left->getType().getStruct())[blockIndex].type->getFieldName(); - } - - // Lookup the symbol, should only fail if shader code is incorrect - symbol = symbolTable.find(*lookupName); - if (symbol == nullptr) - return; - - if (symbol->getAsFunction()) { - error(loc, "array variable name expected", symbol->getName().c_str(), ""); - return; - } - - if (symbol->getType().isStruct() && blockIndex != -1) - (*symbol->getWritableType().getStruct())[blockIndex].type->setImplicitArraySize(index + 1); - else - symbol->getWritableType().setImplicitArraySize(index + 1); -} - -// Returns true if the first argument to the #line directive is the line number for the next line. -// -// Desktop, pre-version 3.30: "After processing this directive -// (including its new-line), the implementation will behave as if it is compiling at line number line+1 and -// source string number source-string-number." -// -// Desktop, version 3.30 and later, and ES: "After processing this directive -// (including its new-line), the implementation will behave as if it is compiling at line number line and -// source string number source-string-number. -bool TParseContext::lineDirectiveShouldSetNextLine() const -{ - return profile == EEsProfile || version >= 330; -} - -// -// Enforce non-initializer type/qualifier rules. -// -void TParseContext::nonInitConstCheck(const TSourceLoc& loc, TString& identifier, TType& type) -{ - // - // Make the qualifier make sense, given that there is not an initializer. - // - if (type.getQualifier().storage == EvqConst || - type.getQualifier().storage == EvqConstReadOnly) { - type.getQualifier().makeTemporary(); - error(loc, "variables with qualifier 'const' must be initialized", identifier.c_str(), ""); - } -} - -// -// See if the identifier is a built-in symbol that can be redeclared, and if so, -// copy the symbol table's read-only built-in variable to the current -// global level, where it can be modified based on the passed in type. -// -// Returns nullptr if no redeclaration took place; meaning a normal declaration still -// needs to occur for it, not necessarily an error. -// -// Returns a redeclared and type-modified variable if a redeclarated occurred. -// -TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TString& identifier, - const TQualifier& qualifier, const TShaderQualifiers& publicType) -{ - if (! builtInName(identifier) || symbolTable.atBuiltInLevel() || ! symbolTable.atGlobalLevel()) - return nullptr; - - bool nonEsRedecls = (profile != EEsProfile && (version >= 130 || identifier == "gl_TexCoord")); - bool esRedecls = (profile == EEsProfile && - (version >= 320 || extensionsTurnedOn(Num_AEP_shader_io_blocks, AEP_shader_io_blocks))); - if (! esRedecls && ! nonEsRedecls) - return nullptr; - - // Special case when using GL_ARB_separate_shader_objects - bool ssoPre150 = false; // means the only reason this variable is redeclared is due to this combination - if (profile != EEsProfile && version <= 140 && extensionTurnedOn(E_GL_ARB_separate_shader_objects)) { - if (identifier == "gl_Position" || - identifier == "gl_PointSize" || - identifier == "gl_ClipVertex" || - identifier == "gl_FogFragCoord") - ssoPre150 = true; - } - - // Potentially redeclaring a built-in variable... - - if (ssoPre150 || - (identifier == "gl_FragDepth" && ((nonEsRedecls && version >= 420) || esRedecls)) || - (identifier == "gl_FragCoord" && ((nonEsRedecls && version >= 150) || esRedecls)) || - identifier == "gl_ClipDistance" || - identifier == "gl_CullDistance" || - identifier == "gl_FrontColor" || - identifier == "gl_BackColor" || - identifier == "gl_FrontSecondaryColor" || - identifier == "gl_BackSecondaryColor" || - identifier == "gl_SecondaryColor" || - (identifier == "gl_Color" && language == EShLangFragment) || -#ifdef NV_EXTENSIONS - identifier == "gl_SampleMask" || - identifier == "gl_Layer" || -#endif - identifier == "gl_TexCoord") { - - // Find the existing symbol, if any. - bool builtIn; - TSymbol* symbol = symbolTable.find(identifier, &builtIn); - - // If the symbol was not found, this must be a version/profile/stage - // that doesn't have it. - if (! symbol) - return nullptr; - - // If it wasn't at a built-in level, then it's already been redeclared; - // that is, this is a redeclaration of a redeclaration; reuse that initial - // redeclaration. Otherwise, make the new one. - if (builtIn) - makeEditable(symbol); - - // Now, modify the type of the copy, as per the type of the current redeclaration. - - TQualifier& symbolQualifier = symbol->getWritableType().getQualifier(); - if (ssoPre150) { - if (intermediate.inIoAccessed(identifier)) - error(loc, "cannot redeclare after use", identifier.c_str(), ""); - if (qualifier.hasLayout()) - error(loc, "cannot apply layout qualifier to", "redeclaration", symbol->getName().c_str()); - if (qualifier.isMemory() || qualifier.isAuxiliary() || (language == EShLangVertex && qualifier.storage != EvqVaryingOut) || - (language == EShLangFragment && qualifier.storage != EvqVaryingIn)) - error(loc, "cannot change storage, memory, or auxiliary qualification of", "redeclaration", symbol->getName().c_str()); - if (! qualifier.smooth) - error(loc, "cannot change interpolation qualification of", "redeclaration", symbol->getName().c_str()); - } else if (identifier == "gl_FrontColor" || - identifier == "gl_BackColor" || - identifier == "gl_FrontSecondaryColor" || - identifier == "gl_BackSecondaryColor" || - identifier == "gl_SecondaryColor" || - identifier == "gl_Color") { - symbolQualifier.flat = qualifier.flat; - symbolQualifier.smooth = qualifier.smooth; - symbolQualifier.nopersp = qualifier.nopersp; - if (qualifier.hasLayout()) - error(loc, "cannot apply layout qualifier to", "redeclaration", symbol->getName().c_str()); - if (qualifier.isMemory() || qualifier.isAuxiliary() || symbol->getType().getQualifier().storage != qualifier.storage) - error(loc, "cannot change storage, memory, or auxiliary qualification of", "redeclaration", symbol->getName().c_str()); - } else if (identifier == "gl_TexCoord" || - identifier == "gl_ClipDistance" || - identifier == "gl_CullDistance") { - if (qualifier.hasLayout() || qualifier.isMemory() || qualifier.isAuxiliary() || - qualifier.nopersp != symbolQualifier.nopersp || qualifier.flat != symbolQualifier.flat || - symbolQualifier.storage != qualifier.storage) - error(loc, "cannot change qualification of", "redeclaration", symbol->getName().c_str()); - } else if (identifier == "gl_FragCoord") { - if (intermediate.inIoAccessed("gl_FragCoord")) - error(loc, "cannot redeclare after use", "gl_FragCoord", ""); - if (qualifier.nopersp != symbolQualifier.nopersp || qualifier.flat != symbolQualifier.flat || - qualifier.isMemory() || qualifier.isAuxiliary()) - error(loc, "can only change layout qualification of", "redeclaration", symbol->getName().c_str()); - if (qualifier.storage != EvqVaryingIn) - error(loc, "cannot change input storage qualification of", "redeclaration", symbol->getName().c_str()); - if (! builtIn && (publicType.pixelCenterInteger != intermediate.getPixelCenterInteger() || - publicType.originUpperLeft != intermediate.getOriginUpperLeft())) - error(loc, "cannot redeclare with different qualification:", "redeclaration", symbol->getName().c_str()); - if (publicType.pixelCenterInteger) - intermediate.setPixelCenterInteger(); - if (publicType.originUpperLeft) - intermediate.setOriginUpperLeft(); - } else if (identifier == "gl_FragDepth") { - if (qualifier.nopersp != symbolQualifier.nopersp || qualifier.flat != symbolQualifier.flat || - qualifier.isMemory() || qualifier.isAuxiliary()) - error(loc, "can only change layout qualification of", "redeclaration", symbol->getName().c_str()); - if (qualifier.storage != EvqVaryingOut) - error(loc, "cannot change output storage qualification of", "redeclaration", symbol->getName().c_str()); - if (publicType.layoutDepth != EldNone) { - if (intermediate.inIoAccessed("gl_FragDepth")) - error(loc, "cannot redeclare after use", "gl_FragDepth", ""); - if (! intermediate.setDepth(publicType.layoutDepth)) - error(loc, "all redeclarations must use the same depth layout on", "redeclaration", symbol->getName().c_str()); - } - } -#ifdef NV_EXTENSIONS - else if (identifier == "gl_SampleMask") { - if (!publicType.layoutOverrideCoverage) { - error(loc, "redeclaration only allowed for override_coverage layout", "redeclaration", symbol->getName().c_str()); - } - intermediate.setLayoutOverrideCoverage(); - } - else if (identifier == "gl_Layer") { - if (!qualifier.layoutViewportRelative && qualifier.layoutSecondaryViewportRelativeOffset == -2048) - error(loc, "redeclaration only allowed for viewport_relative or secondary_view_offset layout", "redeclaration", symbol->getName().c_str()); - symbolQualifier.layoutViewportRelative = qualifier.layoutViewportRelative; - symbolQualifier.layoutSecondaryViewportRelativeOffset = qualifier.layoutSecondaryViewportRelativeOffset; - } -#endif - - // TODO: semantics quality: separate smooth from nothing declared, then use IsInterpolation for several tests above - - return symbol; - } - - return nullptr; -} - -// -// Either redeclare the requested block, or give an error message why it can't be done. -// -// TODO: functionality: explicitly sizing members of redeclared blocks is not giving them an explicit size -void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newTypeList, const TString& blockName, const TString* instanceName, TArraySizes* arraySizes) -{ - const char* feature = "built-in block redeclaration"; - profileRequires(loc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, feature); - profileRequires(loc, ~EEsProfile, 410, E_GL_ARB_separate_shader_objects, feature); - - if (blockName != "gl_PerVertex" && blockName != "gl_PerFragment") { - error(loc, "cannot redeclare block: ", "block declaration", blockName.c_str()); - return; - } - - // Redeclaring a built-in block... - - if (instanceName && ! builtInName(*instanceName)) { - error(loc, "cannot redeclare a built-in block with a user name", instanceName->c_str(), ""); - return; - } - - // Blocks with instance names are easy to find, lookup the instance name, - // Anonymous blocks need to be found via a member. - bool builtIn; - TSymbol* block; - if (instanceName) - block = symbolTable.find(*instanceName, &builtIn); - else - block = symbolTable.find(newTypeList.front().type->getFieldName(), &builtIn); - - // If the block was not found, this must be a version/profile/stage - // that doesn't have it, or the instance name is wrong. - const char* errorName = instanceName ? instanceName->c_str() : newTypeList.front().type->getFieldName().c_str(); - if (! block) { - error(loc, "no declaration found for redeclaration", errorName, ""); - return; - } - // Built-in blocks cannot be redeclared more than once, which if happened, - // we'd be finding the already redeclared one here, rather than the built in. - if (! builtIn) { - error(loc, "can only redeclare a built-in block once, and before any use", blockName.c_str(), ""); - return; - } - - // Copy the block to make a writable version, to insert into the block table after editing. - block = symbolTable.copyUpDeferredInsert(block); - - if (block->getType().getBasicType() != EbtBlock) { - error(loc, "cannot redeclare a non block as a block", errorName, ""); - return; - } - - // Fix XFB stuff up, it applies to the order of the redeclaration, not - // the order of the original members. - if (currentBlockQualifier.storage == EvqVaryingOut && globalOutputDefaults.hasXfbBuffer()) { - currentBlockQualifier.layoutXfbBuffer = globalOutputDefaults.layoutXfbBuffer; - fixBlockXfbOffsets(currentBlockQualifier, newTypeList); - } - - // Edit and error check the container against the redeclaration - // - remove unused members - // - ensure remaining qualifiers/types match - - TType& type = block->getWritableType(); - -#ifdef NV_EXTENSIONS - // if gl_PerVertex is redeclared for the purpose of passing through "gl_Position" - // for passthrough purpose, the redeclared block should have the same qualifers as - // the current one - if (currentBlockQualifier.layoutPassthrough) { - type.getQualifier().layoutPassthrough = currentBlockQualifier.layoutPassthrough; - type.getQualifier().storage = currentBlockQualifier.storage; - type.getQualifier().layoutStream = currentBlockQualifier.layoutStream; - type.getQualifier().layoutXfbBuffer = currentBlockQualifier.layoutXfbBuffer; - } -#endif - - TTypeList::iterator member = type.getWritableStruct()->begin(); - size_t numOriginalMembersFound = 0; - while (member != type.getStruct()->end()) { - // look for match - bool found = false; - TTypeList::const_iterator newMember; - TSourceLoc memberLoc; - memberLoc.init(); - for (newMember = newTypeList.begin(); newMember != newTypeList.end(); ++newMember) { - if (member->type->getFieldName() == newMember->type->getFieldName()) { - found = true; - memberLoc = newMember->loc; - break; - } - } - - if (found) { - ++numOriginalMembersFound; - // - ensure match between redeclared members' types - // - check for things that can't be changed - // - update things that can be changed - TType& oldType = *member->type; - const TType& newType = *newMember->type; - if (! newType.sameElementType(oldType)) - error(memberLoc, "cannot redeclare block member with a different type", member->type->getFieldName().c_str(), ""); - if (oldType.isArray() != newType.isArray()) - error(memberLoc, "cannot change arrayness of redeclared block member", member->type->getFieldName().c_str(), ""); - else if (! oldType.sameArrayness(newType) && oldType.isExplicitlySizedArray()) - error(memberLoc, "cannot change array size of redeclared block member", member->type->getFieldName().c_str(), ""); - else if (newType.isArray()) - arrayLimitCheck(loc, member->type->getFieldName(), newType.getOuterArraySize()); - if (newType.getQualifier().isMemory()) - error(memberLoc, "cannot add memory qualifier to redeclared block member", member->type->getFieldName().c_str(), ""); - if (newType.getQualifier().hasNonXfbLayout()) - error(memberLoc, "cannot add non-XFB layout to redeclared block member", member->type->getFieldName().c_str(), ""); - if (newType.getQualifier().patch) - error(memberLoc, "cannot add patch to redeclared block member", member->type->getFieldName().c_str(), ""); - if (newType.getQualifier().hasXfbBuffer() && newType.getQualifier().layoutXfbBuffer != currentBlockQualifier.layoutXfbBuffer) - error(memberLoc, "member cannot contradict block (or what block inherited from global)", "xfb_buffer", ""); - oldType.getQualifier().centroid = newType.getQualifier().centroid; - oldType.getQualifier().sample = newType.getQualifier().sample; - oldType.getQualifier().invariant = newType.getQualifier().invariant; - oldType.getQualifier().noContraction = newType.getQualifier().noContraction; - oldType.getQualifier().smooth = newType.getQualifier().smooth; - oldType.getQualifier().flat = newType.getQualifier().flat; - oldType.getQualifier().nopersp = newType.getQualifier().nopersp; - oldType.getQualifier().layoutXfbOffset = newType.getQualifier().layoutXfbOffset; - if (oldType.getQualifier().layoutXfbOffset != TQualifier::layoutXfbBufferEnd) - type.getQualifier().layoutXfbBuffer = currentBlockQualifier.layoutXfbBuffer; - if (oldType.isImplicitlySizedArray() && newType.isExplicitlySizedArray()) - oldType.changeOuterArraySize(newType.getOuterArraySize()); - - // go to next member - ++member; - } else { - // For missing members of anonymous blocks that have been redeclared, - // hide the original (shared) declaration. - // Instance-named blocks can just have the member removed. - if (instanceName) - member = type.getWritableStruct()->erase(member); - else { - member->type->hideMember(); - ++member; - } - } - } - - if (numOriginalMembersFound < newTypeList.size()) - error(loc, "block redeclaration has extra members", blockName.c_str(), ""); - if (type.isArray() != (arraySizes != nullptr)) - error(loc, "cannot change arrayness of redeclared block", blockName.c_str(), ""); - else if (type.isArray()) { - if (type.isExplicitlySizedArray() && arraySizes->getOuterSize() == UnsizedArraySize) - error(loc, "block already declared with size, can't redeclare as implicitly-sized", blockName.c_str(), ""); - else if (type.isExplicitlySizedArray() && type.getArraySizes() != *arraySizes) - error(loc, "cannot change array size of redeclared block", blockName.c_str(), ""); - else if (type.isImplicitlySizedArray() && arraySizes->getOuterSize() != UnsizedArraySize) - type.changeOuterArraySize(arraySizes->getOuterSize()); - } - - symbolTable.insert(*block); - - // Check for general layout qualifier errors - layoutObjectCheck(loc, *block); - - // Tracking for implicit sizing of array - if (isIoResizeArray(block->getType())) { - ioArraySymbolResizeList.push_back(block); - checkIoArraysConsistency(loc, true); - } else if (block->getType().isArray()) - fixIoArraySize(loc, block->getWritableType()); - - // Save it in the AST for linker use. - trackLinkage(*block); -} - -void TParseContext::paramCheckFix(const TSourceLoc& loc, const TStorageQualifier& qualifier, TType& type) -{ - switch (qualifier) { - case EvqConst: - case EvqConstReadOnly: - type.getQualifier().storage = EvqConstReadOnly; - break; - case EvqIn: - case EvqOut: - case EvqInOut: - type.getQualifier().storage = qualifier; - break; - case EvqGlobal: - case EvqTemporary: - type.getQualifier().storage = EvqIn; - break; - default: - type.getQualifier().storage = EvqIn; - error(loc, "storage qualifier not allowed on function parameter", GetStorageQualifierString(qualifier), ""); - break; - } -} - -void TParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& qualifier, TType& type) -{ - if (qualifier.isMemory()) { - type.getQualifier().volatil = qualifier.volatil; - type.getQualifier().coherent = qualifier.coherent; - type.getQualifier().readonly = qualifier.readonly; - type.getQualifier().writeonly = qualifier.writeonly; - type.getQualifier().restrict = qualifier.restrict; - } - - if (qualifier.isAuxiliary() || - qualifier.isInterpolation()) - error(loc, "cannot use auxiliary or interpolation qualifiers on a function parameter", "", ""); - if (qualifier.hasLayout()) - error(loc, "cannot use layout qualifiers on a function parameter", "", ""); - if (qualifier.invariant) - error(loc, "cannot use invariant qualifier on a function parameter", "", ""); - if (qualifier.noContraction) { - if (qualifier.isParamOutput()) - type.getQualifier().noContraction = true; - else - warn(loc, "qualifier has no effect on non-output parameters", "precise", ""); - } - - paramCheckFix(loc, qualifier.storage, type); -} - -void TParseContext::nestedBlockCheck(const TSourceLoc& loc) -{ - if (structNestingLevel > 0) - error(loc, "cannot nest a block definition inside a structure or block", "", ""); - ++structNestingLevel; -} - -void TParseContext::nestedStructCheck(const TSourceLoc& loc) -{ - if (structNestingLevel > 0) - error(loc, "cannot nest a structure definition inside a structure or block", "", ""); - ++structNestingLevel; -} - -void TParseContext::arrayObjectCheck(const TSourceLoc& loc, const TType& type, const char* op) -{ - // Some versions don't allow comparing arrays or structures containing arrays - if (type.containsArray()) { - profileRequires(loc, ENoProfile, 120, E_GL_3DL_array_objects, op); - profileRequires(loc, EEsProfile, 300, nullptr, op); - } -} - -void TParseContext::opaqueCheck(const TSourceLoc& loc, const TType& type, const char* op) -{ - if (containsFieldWithBasicType(type, EbtSampler)) - error(loc, "can't use with samplers or structs containing samplers", op, ""); -} - -void TParseContext::specializationCheck(const TSourceLoc& loc, const TType& type, const char* op) -{ - if (type.containsSpecializationSize()) - error(loc, "can't use with types containing arrays sized with a specialization constant", op, ""); -} - -void TParseContext::structTypeCheck(const TSourceLoc& /*loc*/, TPublicType& publicType) -{ - const TTypeList& typeList = *publicType.userDef->getStruct(); - - // fix and check for member storage qualifiers and types that don't belong within a structure - for (unsigned int member = 0; member < typeList.size(); ++member) { - TQualifier& memberQualifier = typeList[member].type->getQualifier(); - const TSourceLoc& memberLoc = typeList[member].loc; - if (memberQualifier.isAuxiliary() || - memberQualifier.isInterpolation() || - (memberQualifier.storage != EvqTemporary && memberQualifier.storage != EvqGlobal)) - error(memberLoc, "cannot use storage or interpolation qualifiers on structure members", typeList[member].type->getFieldName().c_str(), ""); - if (memberQualifier.isMemory()) - error(memberLoc, "cannot use memory qualifiers on structure members", typeList[member].type->getFieldName().c_str(), ""); - if (memberQualifier.hasLayout()) { - error(memberLoc, "cannot use layout qualifiers on structure members", typeList[member].type->getFieldName().c_str(), ""); - memberQualifier.clearLayout(); - } - if (memberQualifier.invariant) - error(memberLoc, "cannot use invariant qualifier on structure members", typeList[member].type->getFieldName().c_str(), ""); - } -} - -// -// See if this loop satisfies the limitations for ES 2.0 (version 100) for loops in Appendex A: -// -// "The loop index has type int or float. -// -// "The for statement has the form: -// for ( init-declaration ; condition ; expression ) -// init-declaration has the form: type-specifier identifier = constant-expression -// condition has the form: loop-index relational_operator constant-expression -// where relational_operator is one of: > >= < <= == or != -// expression [sic] has one of the following forms: -// loop-index++ -// loop-index-- -// loop-index += constant-expression -// loop-index -= constant-expression -// -// The body is handled in an AST traversal. -// -void TParseContext::inductiveLoopCheck(const TSourceLoc& loc, TIntermNode* init, TIntermLoop* loop) -{ - // loop index init must exist and be a declaration, which shows up in the AST as an aggregate of size 1 of the declaration - bool badInit = false; - if (! init || ! init->getAsAggregate() || init->getAsAggregate()->getSequence().size() != 1) - badInit = true; - TIntermBinary* binaryInit = 0; - if (! badInit) { - // get the declaration assignment - binaryInit = init->getAsAggregate()->getSequence()[0]->getAsBinaryNode(); - if (! binaryInit) - badInit = true; - } - if (badInit) { - error(loc, "inductive-loop init-declaration requires the form \"type-specifier loop-index = constant-expression\"", "limitations", ""); - return; - } - - // loop index must be type int or float - if (! binaryInit->getType().isScalar() || (binaryInit->getBasicType() != EbtInt && binaryInit->getBasicType() != EbtFloat)) { - error(loc, "inductive loop requires a scalar 'int' or 'float' loop index", "limitations", ""); - return; - } - - // init is the form "loop-index = constant" - if (binaryInit->getOp() != EOpAssign || ! binaryInit->getLeft()->getAsSymbolNode() || ! binaryInit->getRight()->getAsConstantUnion()) { - error(loc, "inductive-loop init-declaration requires the form \"type-specifier loop-index = constant-expression\"", "limitations", ""); - return; - } - - // get the unique id of the loop index - int loopIndex = binaryInit->getLeft()->getAsSymbolNode()->getId(); - inductiveLoopIds.insert(loopIndex); - - // condition's form must be "loop-index relational-operator constant-expression" - bool badCond = ! loop->getTest(); - if (! badCond) { - TIntermBinary* binaryCond = loop->getTest()->getAsBinaryNode(); - badCond = ! binaryCond; - if (! badCond) { - switch (binaryCond->getOp()) { - case EOpGreaterThan: - case EOpGreaterThanEqual: - case EOpLessThan: - case EOpLessThanEqual: - case EOpEqual: - case EOpNotEqual: - break; - default: - badCond = true; - } - } - if (binaryCond && (! binaryCond->getLeft()->getAsSymbolNode() || - binaryCond->getLeft()->getAsSymbolNode()->getId() != loopIndex || - ! binaryCond->getRight()->getAsConstantUnion())) - badCond = true; - } - if (badCond) { - error(loc, "inductive-loop condition requires the form \"loop-index constant-expression\"", "limitations", ""); - return; - } - - // loop-index++ - // loop-index-- - // loop-index += constant-expression - // loop-index -= constant-expression - bool badTerminal = ! loop->getTerminal(); - if (! badTerminal) { - TIntermUnary* unaryTerminal = loop->getTerminal()->getAsUnaryNode(); - TIntermBinary* binaryTerminal = loop->getTerminal()->getAsBinaryNode(); - if (unaryTerminal || binaryTerminal) { - switch(loop->getTerminal()->getAsOperator()->getOp()) { - case EOpPostDecrement: - case EOpPostIncrement: - case EOpAddAssign: - case EOpSubAssign: - break; - default: - badTerminal = true; - } - } else - badTerminal = true; - if (binaryTerminal && (! binaryTerminal->getLeft()->getAsSymbolNode() || - binaryTerminal->getLeft()->getAsSymbolNode()->getId() != loopIndex || - ! binaryTerminal->getRight()->getAsConstantUnion())) - badTerminal = true; - if (unaryTerminal && (! unaryTerminal->getOperand()->getAsSymbolNode() || - unaryTerminal->getOperand()->getAsSymbolNode()->getId() != loopIndex)) - badTerminal = true; - } - if (badTerminal) { - error(loc, "inductive-loop termination requires the form \"loop-index++, loop-index--, loop-index += constant-expression, or loop-index -= constant-expression\"", "limitations", ""); - return; - } - - // the body - inductiveLoopBodyCheck(loop->getBody(), loopIndex, symbolTable); -} - -// Do limit checks for built-in arrays. -void TParseContext::arrayLimitCheck(const TSourceLoc& loc, const TString& identifier, int size) -{ - if (identifier.compare("gl_TexCoord") == 0) - limitCheck(loc, size, "gl_MaxTextureCoords", "gl_TexCoord array size"); - else if (identifier.compare("gl_ClipDistance") == 0) - limitCheck(loc, size, "gl_MaxClipDistances", "gl_ClipDistance array size"); - else if (identifier.compare("gl_CullDistance") == 0) - limitCheck(loc, size, "gl_MaxCullDistances", "gl_CullDistance array size"); -} - -// See if the provided value is less than or equal to the symbol indicated by limit, -// which should be a constant in the symbol table. -void TParseContext::limitCheck(const TSourceLoc& loc, int value, const char* limit, const char* feature) -{ - TSymbol* symbol = symbolTable.find(limit); - assert(symbol->getAsVariable()); - const TConstUnionArray& constArray = symbol->getAsVariable()->getConstArray(); - assert(! constArray.empty()); - if (value > constArray[0].getIConst()) - error(loc, "must be less than or equal to", feature, "%s (%d)", limit, constArray[0].getIConst()); -} - -// -// Do any additional error checking, etc., once we know the parsing is done. -// -void TParseContext::finish() -{ - TParseContextBase::finish(); - - if (parsingBuiltins) - return; - - // Check on array indexes for ES 2.0 (version 100) limitations. - for (size_t i = 0; i < needsIndexLimitationChecking.size(); ++i) - constantIndexExpressionCheck(needsIndexLimitationChecking[i]); - - // Check for stages that are enabled by extension. - // Can't do this at the beginning, it is chicken and egg to add a stage by - // extension. - // Stage-specific features were correctly tested for already, this is just - // about the stage itself. - switch (language) { - case EShLangGeometry: - if (profile == EEsProfile && version == 310) - requireExtensions(getCurrentLoc(), Num_AEP_geometry_shader, AEP_geometry_shader, "geometry shaders"); - break; - case EShLangTessControl: - case EShLangTessEvaluation: - if (profile == EEsProfile && version == 310) - requireExtensions(getCurrentLoc(), Num_AEP_tessellation_shader, AEP_tessellation_shader, "tessellation shaders"); - else if (profile != EEsProfile && version < 400) - requireExtensions(getCurrentLoc(), 1, &E_GL_ARB_tessellation_shader, "tessellation shaders"); - break; - case EShLangCompute: - if (profile != EEsProfile && version < 430) - requireExtensions(getCurrentLoc(), 1, &E_GL_ARB_compute_shader, "compute shaders"); - break; - default: - break; - } -} - -// -// Layout qualifier stuff. -// - -// Put the id's layout qualification into the public type, for qualifiers not having a number set. -// This is before we know any type information for error checking. -void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publicType, TString& id) -{ - std::transform(id.begin(), id.end(), id.begin(), ::tolower); - - if (id == TQualifier::getLayoutMatrixString(ElmColumnMajor)) { - publicType.qualifier.layoutMatrix = ElmColumnMajor; - return; - } - if (id == TQualifier::getLayoutMatrixString(ElmRowMajor)) { - publicType.qualifier.layoutMatrix = ElmRowMajor; - return; - } - if (id == TQualifier::getLayoutPackingString(ElpPacked)) { - if (spvVersion.spv != 0) - spvRemoved(loc, "packed"); - publicType.qualifier.layoutPacking = ElpPacked; - return; - } - if (id == TQualifier::getLayoutPackingString(ElpShared)) { - if (spvVersion.spv != 0) - spvRemoved(loc, "shared"); - publicType.qualifier.layoutPacking = ElpShared; - return; - } - if (id == TQualifier::getLayoutPackingString(ElpStd140)) { - publicType.qualifier.layoutPacking = ElpStd140; - return; - } - if (id == TQualifier::getLayoutPackingString(ElpStd430)) { - requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, "std430"); - profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, nullptr, "std430"); - profileRequires(loc, EEsProfile, 310, nullptr, "std430"); - publicType.qualifier.layoutPacking = ElpStd430; - return; - } - // TODO: compile-time performance: may need to stop doing linear searches - for (TLayoutFormat format = (TLayoutFormat)(ElfNone + 1); format < ElfCount; format = (TLayoutFormat)(format + 1)) { - if (id == TQualifier::getLayoutFormatString(format)) { - if ((format > ElfEsFloatGuard && format < ElfFloatGuard) || - (format > ElfEsIntGuard && format < ElfIntGuard) || - (format > ElfEsUintGuard && format < ElfCount)) - requireProfile(loc, ENoProfile | ECoreProfile | ECompatibilityProfile, "image load-store format"); - profileRequires(loc, ENoProfile | ECoreProfile | ECompatibilityProfile, 420, E_GL_ARB_shader_image_load_store, "image load store"); - profileRequires(loc, EEsProfile, 310, E_GL_ARB_shader_image_load_store, "image load store"); - publicType.qualifier.layoutFormat = format; - return; - } - } - if (id == "push_constant") { - requireVulkan(loc, "push_constant"); - publicType.qualifier.layoutPushConstant = true; - return; - } - if (language == EShLangGeometry || language == EShLangTessEvaluation) { - if (id == TQualifier::getGeometryString(ElgTriangles)) { - publicType.shaderQualifiers.geometry = ElgTriangles; - return; - } - if (language == EShLangGeometry) { - if (id == TQualifier::getGeometryString(ElgPoints)) { - publicType.shaderQualifiers.geometry = ElgPoints; - return; - } - if (id == TQualifier::getGeometryString(ElgLineStrip)) { - publicType.shaderQualifiers.geometry = ElgLineStrip; - return; - } - if (id == TQualifier::getGeometryString(ElgLines)) { - publicType.shaderQualifiers.geometry = ElgLines; - return; - } - if (id == TQualifier::getGeometryString(ElgLinesAdjacency)) { - publicType.shaderQualifiers.geometry = ElgLinesAdjacency; - return; - } - if (id == TQualifier::getGeometryString(ElgTrianglesAdjacency)) { - publicType.shaderQualifiers.geometry = ElgTrianglesAdjacency; - return; - } - if (id == TQualifier::getGeometryString(ElgTriangleStrip)) { - publicType.shaderQualifiers.geometry = ElgTriangleStrip; - return; - } -#ifdef NV_EXTENSIONS - if (id == "passthrough") { - requireExtensions(loc, 1, &E_SPV_NV_geometry_shader_passthrough, "geometry shader passthrough"); - publicType.qualifier.layoutPassthrough = true; - intermediate.setGeoPassthroughEXT(); - return; - } -#endif - } else { - assert(language == EShLangTessEvaluation); - - // input primitive - if (id == TQualifier::getGeometryString(ElgTriangles)) { - publicType.shaderQualifiers.geometry = ElgTriangles; - return; - } - if (id == TQualifier::getGeometryString(ElgQuads)) { - publicType.shaderQualifiers.geometry = ElgQuads; - return; - } - if (id == TQualifier::getGeometryString(ElgIsolines)) { - publicType.shaderQualifiers.geometry = ElgIsolines; - return; - } - - // vertex spacing - if (id == TQualifier::getVertexSpacingString(EvsEqual)) { - publicType.shaderQualifiers.spacing = EvsEqual; - return; - } - if (id == TQualifier::getVertexSpacingString(EvsFractionalEven)) { - publicType.shaderQualifiers.spacing = EvsFractionalEven; - return; - } - if (id == TQualifier::getVertexSpacingString(EvsFractionalOdd)) { - publicType.shaderQualifiers.spacing = EvsFractionalOdd; - return; - } - - // triangle order - if (id == TQualifier::getVertexOrderString(EvoCw)) { - publicType.shaderQualifiers.order = EvoCw; - return; - } - if (id == TQualifier::getVertexOrderString(EvoCcw)) { - publicType.shaderQualifiers.order = EvoCcw; - return; - } - - // point mode - if (id == "point_mode") { - publicType.shaderQualifiers.pointMode = true; - return; - } - } - } - if (language == EShLangFragment) { - if (id == "origin_upper_left") { - requireProfile(loc, ECoreProfile | ECompatibilityProfile, "origin_upper_left"); - publicType.shaderQualifiers.originUpperLeft = true; - return; - } - if (id == "pixel_center_integer") { - requireProfile(loc, ECoreProfile | ECompatibilityProfile, "pixel_center_integer"); - publicType.shaderQualifiers.pixelCenterInteger = true; - return; - } - if (id == "early_fragment_tests") { - profileRequires(loc, ENoProfile | ECoreProfile | ECompatibilityProfile, 420, E_GL_ARB_shader_image_load_store, "early_fragment_tests"); - profileRequires(loc, EEsProfile, 310, nullptr, "early_fragment_tests"); - publicType.shaderQualifiers.earlyFragmentTests = true; - return; - } - if (id == "post_depth_coverage") { - requireExtensions(loc, Num_post_depth_coverageEXTs, post_depth_coverageEXTs, "post depth coverage"); - if (extensionTurnedOn(E_GL_ARB_post_depth_coverage)) { - publicType.shaderQualifiers.earlyFragmentTests = true; - } - publicType.shaderQualifiers.postDepthCoverage = true; - return; - } - for (TLayoutDepth depth = (TLayoutDepth)(EldNone + 1); depth < EldCount; depth = (TLayoutDepth)(depth+1)) { - if (id == TQualifier::getLayoutDepthString(depth)) { - requireProfile(loc, ECoreProfile | ECompatibilityProfile, "depth layout qualifier"); - profileRequires(loc, ECoreProfile | ECompatibilityProfile, 420, nullptr, "depth layout qualifier"); - publicType.shaderQualifiers.layoutDepth = depth; - return; - } - } - if (id.compare(0, 13, "blend_support") == 0) { - bool found = false; - for (TBlendEquationShift be = (TBlendEquationShift)0; be < EBlendCount; be = (TBlendEquationShift)(be + 1)) { - if (id == TQualifier::getBlendEquationString(be)) { - profileRequires(loc, EEsProfile, 320, E_GL_KHR_blend_equation_advanced, "blend equation"); - profileRequires(loc, ~EEsProfile, 0, E_GL_KHR_blend_equation_advanced, "blend equation"); - intermediate.addBlendEquation(be); - publicType.shaderQualifiers.blendEquation = true; - found = true; - break; - } - } - if (! found) - error(loc, "unknown blend equation", "blend_support", ""); - return; - } -#ifdef NV_EXTENSIONS - if (id == "override_coverage") { - requireExtensions(loc, 1, &E_GL_NV_sample_mask_override_coverage, "sample mask override coverage"); - publicType.shaderQualifiers.layoutOverrideCoverage = true; - return; - } - } - if (language == EShLangVertex || - language == EShLangTessControl || - language == EShLangTessEvaluation || - language == EShLangGeometry ) { - if (id == "viewport_relative") { - requireExtensions(loc, 1, &E_GL_NV_viewport_array2, "view port array2"); - publicType.qualifier.layoutViewportRelative = true; - return; - } - } -#else - } -#endif - error(loc, "unrecognized layout identifier, or qualifier requires assignment (e.g., binding = 4)", id.c_str(), ""); -} - -// Put the id's layout qualifier value into the public type, for qualifiers having a number set. -// This is before we know any type information for error checking. -void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publicType, TString& id, const TIntermTyped* node) -{ - const char* feature = "layout-id value"; - const char* nonLiteralFeature = "non-literal layout-id value"; - - integerCheck(node, feature); - const TIntermConstantUnion* constUnion = node->getAsConstantUnion(); - int value; - if (constUnion) { - value = constUnion->getConstArray()[0].getIConst(); - if (! constUnion->isLiteral()) { - requireProfile(loc, ECoreProfile | ECompatibilityProfile, nonLiteralFeature); - profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, E_GL_ARB_enhanced_layouts, nonLiteralFeature); - } - } else { - // grammar should have give out the error message - value = 0; - } - - if (value < 0) { - error(loc, "cannot be negative", feature, ""); - return; - } - - std::transform(id.begin(), id.end(), id.begin(), ::tolower); - - if (id == "offset") { - // "offset" can be for either - // - uniform offsets - // - atomic_uint offsets - const char* feature = "offset"; - if (spvVersion.spv == 0) { - requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, feature); - const char* exts[2] = { E_GL_ARB_enhanced_layouts, E_GL_ARB_shader_atomic_counters }; - profileRequires(loc, ECoreProfile | ECompatibilityProfile, 420, 2, exts, feature); - profileRequires(loc, EEsProfile, 310, nullptr, feature); - } - publicType.qualifier.layoutOffset = value; - return; - } else if (id == "align") { - const char* feature = "uniform buffer-member align"; - if (spvVersion.spv == 0) { - requireProfile(loc, ECoreProfile | ECompatibilityProfile, feature); - profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, E_GL_ARB_enhanced_layouts, feature); - } - // "The specified alignment must be a power of 2, or a compile-time error results." - if (! IsPow2(value)) - error(loc, "must be a power of 2", "align", ""); - else - publicType.qualifier.layoutAlign = value; - return; - } else if (id == "location") { - profileRequires(loc, EEsProfile, 300, nullptr, "location"); - const char* exts[2] = { E_GL_ARB_separate_shader_objects, E_GL_ARB_explicit_attrib_location }; - profileRequires(loc, ~EEsProfile, 330, 2, exts, "location"); - if ((unsigned int)value >= TQualifier::layoutLocationEnd) - error(loc, "location is too large", id.c_str(), ""); - else - publicType.qualifier.layoutLocation = value; - return; - } else if (id == "set") { - if ((unsigned int)value >= TQualifier::layoutSetEnd) - error(loc, "set is too large", id.c_str(), ""); - else - publicType.qualifier.layoutSet = value; - if (value != 0) - requireVulkan(loc, "descriptor set"); - return; - } else if (id == "binding") { - profileRequires(loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, "binding"); - profileRequires(loc, EEsProfile, 310, nullptr, "binding"); - if ((unsigned int)value >= TQualifier::layoutBindingEnd) - error(loc, "binding is too large", id.c_str(), ""); - else - publicType.qualifier.layoutBinding = value; - return; - } else if (id == "component") { - requireProfile(loc, ECoreProfile | ECompatibilityProfile, "component"); - profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, E_GL_ARB_enhanced_layouts, "component"); - if ((unsigned)value >= TQualifier::layoutComponentEnd) - error(loc, "component is too large", id.c_str(), ""); - else - publicType.qualifier.layoutComponent = value; - return; - } else if (id.compare(0, 4, "xfb_") == 0) { - // "Any shader making any static use (after preprocessing) of any of these - // *xfb_* qualifiers will cause the shader to be in a transform feedback - // capturing mode and hence responsible for describing the transform feedback - // setup." - intermediate.setXfbMode(); - const char* feature = "transform feedback qualifier"; - requireStage(loc, (EShLanguageMask)(EShLangVertexMask | EShLangGeometryMask | EShLangTessControlMask | EShLangTessEvaluationMask), feature); - requireProfile(loc, ECoreProfile | ECompatibilityProfile, feature); - profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, E_GL_ARB_enhanced_layouts, feature); - if (id == "xfb_buffer") { - // "It is a compile-time error to specify an *xfb_buffer* that is greater than - // the implementation-dependent constant gl_MaxTransformFeedbackBuffers." - if (value >= resources.maxTransformFeedbackBuffers) - error(loc, "buffer is too large:", id.c_str(), "gl_MaxTransformFeedbackBuffers is %d", resources.maxTransformFeedbackBuffers); - if (value >= (int)TQualifier::layoutXfbBufferEnd) - error(loc, "buffer is too large:", id.c_str(), "internal max is %d", TQualifier::layoutXfbBufferEnd-1); - else - publicType.qualifier.layoutXfbBuffer = value; - return; - } else if (id == "xfb_offset") { - if (value >= (int)TQualifier::layoutXfbOffsetEnd) - error(loc, "offset is too large:", id.c_str(), "internal max is %d", TQualifier::layoutXfbOffsetEnd-1); - else - publicType.qualifier.layoutXfbOffset = value; - return; - } else if (id == "xfb_stride") { - // "The resulting stride (implicit or explicit), when divided by 4, must be less than or equal to the - // implementation-dependent constant gl_MaxTransformFeedbackInterleavedComponents." - if (value > 4 * resources.maxTransformFeedbackInterleavedComponents) - error(loc, "1/4 stride is too large:", id.c_str(), "gl_MaxTransformFeedbackInterleavedComponents is %d", resources.maxTransformFeedbackInterleavedComponents); - else if (value >= (int)TQualifier::layoutXfbStrideEnd) - error(loc, "stride is too large:", id.c_str(), "internal max is %d", TQualifier::layoutXfbStrideEnd-1); - if (value < (int)TQualifier::layoutXfbStrideEnd) - publicType.qualifier.layoutXfbStride = value; - return; - } - } - - if (id == "input_attachment_index") { - requireVulkan(loc, "input_attachment_index"); - if (value >= (int)TQualifier::layoutAttachmentEnd) - error(loc, "attachment index is too large", id.c_str(), ""); - else - publicType.qualifier.layoutAttachment = value; - return; - } - if (id == "constant_id") { - requireSpv(loc, "constant_id"); - if (value >= (int)TQualifier::layoutSpecConstantIdEnd) { - error(loc, "specialization-constant id is too large", id.c_str(), ""); - } else { - publicType.qualifier.layoutSpecConstantId = value; - publicType.qualifier.specConstant = true; - if (! intermediate.addUsedConstantId(value)) - error(loc, "specialization-constant id already used", id.c_str(), ""); - } - return; - } - if (id == "num_views") { - requireExtensions(loc, Num_OVR_multiview_EXTs, OVR_multiview_EXTs, "num_views"); - publicType.shaderQualifiers.numViews = value; - return; - } - -#if NV_EXTENSIONS - if (language == EShLangVertex || - language == EShLangTessControl || - language == EShLangTessEvaluation || - language == EShLangGeometry) { - if (id == "secondary_view_offset") { - requireExtensions(loc, 1, &E_GL_NV_stereo_view_rendering, "stereo view rendering"); - publicType.qualifier.layoutSecondaryViewportRelativeOffset = value; - return; - } - } -#endif - - switch (language) { - case EShLangVertex: - break; - - case EShLangTessControl: - if (id == "vertices") { - if (value == 0) - error(loc, "must be greater than 0", "vertices", ""); - else - publicType.shaderQualifiers.vertices = value; - return; - } - break; - - case EShLangTessEvaluation: - break; - - case EShLangGeometry: - if (id == "invocations") { - profileRequires(loc, ECompatibilityProfile | ECoreProfile, 400, nullptr, "invocations"); - if (value == 0) - error(loc, "must be at least 1", "invocations", ""); - else - publicType.shaderQualifiers.invocations = value; - return; - } - if (id == "max_vertices") { - publicType.shaderQualifiers.vertices = value; - if (value > resources.maxGeometryOutputVertices) - error(loc, "too large, must be less than gl_MaxGeometryOutputVertices", "max_vertices", ""); - return; - } - if (id == "stream") { - requireProfile(loc, ~EEsProfile, "selecting output stream"); - publicType.qualifier.layoutStream = value; - if (value > 0) - intermediate.setMultiStream(); - return; - } - break; - - case EShLangFragment: - if (id == "index") { - requireProfile(loc, ECompatibilityProfile | ECoreProfile, "index layout qualifier on fragment output"); - const char* exts[2] = { E_GL_ARB_separate_shader_objects, E_GL_ARB_explicit_attrib_location }; - profileRequires(loc, ECompatibilityProfile | ECoreProfile, 330, 2, exts, "index layout qualifier on fragment output"); - - // "It is also a compile-time error if a fragment shader sets a layout index to less than 0 or greater than 1." - if (value < 0 || value > 1) { - value = 0; - error(loc, "value must be 0 or 1", "index", ""); - } - - publicType.qualifier.layoutIndex = value; - return; - } - break; - - case EShLangCompute: - if (id.compare(0, 11, "local_size_") == 0) { - profileRequires(loc, EEsProfile, 310, 0, "gl_WorkGroupSize"); - profileRequires(loc, ~EEsProfile, 430, E_GL_ARB_compute_shader, "gl_WorkGroupSize"); - if (id.size() == 12 && value == 0) { - error(loc, "must be at least 1", id.c_str(), ""); - return; - } - if (id == "local_size_x") { - publicType.shaderQualifiers.localSize[0] = value; - return; - } - if (id == "local_size_y") { - publicType.shaderQualifiers.localSize[1] = value; - return; - } - if (id == "local_size_z") { - publicType.shaderQualifiers.localSize[2] = value; - return; - } - if (spvVersion.spv != 0) { - if (id == "local_size_x_id") { - publicType.shaderQualifiers.localSizeSpecId[0] = value; - return; - } - if (id == "local_size_y_id") { - publicType.shaderQualifiers.localSizeSpecId[1] = value; - return; - } - if (id == "local_size_z_id") { - publicType.shaderQualifiers.localSizeSpecId[2] = value; - return; - } - } - } - break; - - default: - break; - } - - error(loc, "there is no such layout identifier for this stage taking an assigned value", id.c_str(), ""); -} - -// Merge any layout qualifier information from src into dst, leaving everything else in dst alone -// -// "More than one layout qualifier may appear in a single declaration. -// Additionally, the same layout-qualifier-name can occur multiple times -// within a layout qualifier or across multiple layout qualifiers in the -// same declaration. When the same layout-qualifier-name occurs -// multiple times, in a single declaration, the last occurrence overrides -// the former occurrence(s). Further, if such a layout-qualifier-name -// will effect subsequent declarations or other observable behavior, it -// is only the last occurrence that will have any effect, behaving as if -// the earlier occurrence(s) within the declaration are not present. -// This is also true for overriding layout-qualifier-names, where one -// overrides the other (e.g., row_major vs. column_major); only the last -// occurrence has any effect." -void TParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQualifier& src, bool inheritOnly) -{ - if (src.hasMatrix()) - dst.layoutMatrix = src.layoutMatrix; - if (src.hasPacking()) - dst.layoutPacking = src.layoutPacking; - - if (src.hasStream()) - dst.layoutStream = src.layoutStream; - - if (src.hasFormat()) - dst.layoutFormat = src.layoutFormat; - - if (src.hasXfbBuffer()) - dst.layoutXfbBuffer = src.layoutXfbBuffer; - - if (src.hasAlign()) - dst.layoutAlign = src.layoutAlign; - - if (! inheritOnly) { - if (src.hasLocation()) - dst.layoutLocation = src.layoutLocation; - if (src.hasComponent()) - dst.layoutComponent = src.layoutComponent; - if (src.hasIndex()) - dst.layoutIndex = src.layoutIndex; - - if (src.hasOffset()) - dst.layoutOffset = src.layoutOffset; - - if (src.hasSet()) - dst.layoutSet = src.layoutSet; - if (src.layoutBinding != TQualifier::layoutBindingEnd) - dst.layoutBinding = src.layoutBinding; - - if (src.hasXfbStride()) - dst.layoutXfbStride = src.layoutXfbStride; - if (src.hasXfbOffset()) - dst.layoutXfbOffset = src.layoutXfbOffset; - if (src.hasAttachment()) - dst.layoutAttachment = src.layoutAttachment; - if (src.hasSpecConstantId()) - dst.layoutSpecConstantId = src.layoutSpecConstantId; - - if (src.layoutPushConstant) - dst.layoutPushConstant = true; - -#ifdef NV_EXTENSIONS - if (src.layoutPassthrough) - dst.layoutPassthrough = true; - if (src.layoutViewportRelative) - dst.layoutViewportRelative = true; - if (src.layoutSecondaryViewportRelativeOffset != -2048) - dst.layoutSecondaryViewportRelativeOffset = src.layoutSecondaryViewportRelativeOffset; -#endif - } -} - -// Do error layout error checking given a full variable/block declaration. -void TParseContext::layoutObjectCheck(const TSourceLoc& loc, const TSymbol& symbol) -{ - const TType& type = symbol.getType(); - const TQualifier& qualifier = type.getQualifier(); - - // first, cross check WRT to just the type - layoutTypeCheck(loc, type); - - // now, any remaining error checking based on the object itself - - if (qualifier.hasAnyLocation()) { - switch (qualifier.storage) { - case EvqUniform: - case EvqBuffer: - if (symbol.getAsVariable() == nullptr) - error(loc, "can only be used on variable declaration", "location", ""); - break; - default: - break; - } - } - - // user-variable location check, which are required for SPIR-V in/out: - // - variables have it directly, - // - blocks have it on each member (already enforced), so check first one - if (spvVersion.spv > 0 && !parsingBuiltins && qualifier.builtIn == EbvNone && - !qualifier.hasLocation() && !intermediate.getAutoMapLocations()) { - - switch (qualifier.storage) { - case EvqVaryingIn: - case EvqVaryingOut: - if (type.getBasicType() != EbtBlock || - (!(*type.getStruct())[0].type->getQualifier().hasLocation() && - (*type.getStruct())[0].type->getQualifier().builtIn == EbvNone)) - error(loc, "SPIR-V requires location for user input/output", "location", ""); - break; - default: - break; - } - } - - // Check packing and matrix - if (qualifier.hasUniformLayout()) { - switch (qualifier.storage) { - case EvqUniform: - case EvqBuffer: - if (type.getBasicType() != EbtBlock) { - if (qualifier.hasMatrix()) - error(loc, "cannot specify matrix layout on a variable declaration", "layout", ""); - if (qualifier.hasPacking()) - error(loc, "cannot specify packing on a variable declaration", "layout", ""); - // "The offset qualifier can only be used on block members of blocks..." - if (qualifier.hasOffset() && type.getBasicType() != EbtAtomicUint) - error(loc, "cannot specify on a variable declaration", "offset", ""); - // "The align qualifier can only be used on blocks or block members..." - if (qualifier.hasAlign()) - error(loc, "cannot specify on a variable declaration", "align", ""); - if (qualifier.layoutPushConstant) - error(loc, "can only specify on a uniform block", "push_constant", ""); - } - break; - default: - // these were already filtered by layoutTypeCheck() (or its callees) - break; - } - } -} - -// "For some blocks declared as arrays, the location can only be applied at the block level: -// When a block is declared as an array where additional locations are needed for each member -// for each block array element, it is a compile-time error to specify locations on the block -// members. That is, when locations would be under specified by applying them on block members, -// they are not allowed on block members. For arrayed interfaces (those generally having an -// extra level of arrayness due to interface expansion), the outer array is stripped before -// applying this rule." -void TParseContext::layoutMemberLocationArrayCheck(const TSourceLoc& loc, bool memberWithLocation, TArraySizes* arraySizes) -{ - if (memberWithLocation && arraySizes != nullptr) { - if (arraySizes->getNumDims() > (currentBlockQualifier.isArrayedIo(language) ? 1 : 0)) - error(loc, "cannot use in a block array where new locations are needed for each block element", - "location", ""); - } -} - -// Do layout error checking with respect to a type. -void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) -{ - const TQualifier& qualifier = type.getQualifier(); - - // first, intra-layout qualifier-only error checking - layoutQualifierCheck(loc, qualifier); - - // now, error checking combining type and qualifier - - if (qualifier.hasAnyLocation()) { - if (qualifier.hasLocation()) { - if (qualifier.storage == EvqVaryingOut && language == EShLangFragment) { - if (qualifier.layoutLocation >= (unsigned int)resources.maxDrawBuffers) - error(loc, "too large for fragment output", "location", ""); - } - } - if (qualifier.hasComponent()) { - // "It is a compile-time error if this sequence of components gets larger than 3." - if (qualifier.layoutComponent + type.getVectorSize() * (type.getBasicType() == EbtDouble ? 2 : 1) > 4) - error(loc, "type overflows the available 4 components", "component", ""); - - // "It is a compile-time error to apply the component qualifier to a matrix, a structure, a block, or an array containing any of these." - if (type.isMatrix() || type.getBasicType() == EbtBlock || type.getBasicType() == EbtStruct) - error(loc, "cannot apply to a matrix, structure, or block", "component", ""); - - // " It is a compile-time error to use component 1 or 3 as the beginning of a double or dvec2." - if (type.getBasicType() == EbtDouble) - if (qualifier.layoutComponent & 1) - error(loc, "doubles cannot start on an odd-numbered component", "component", ""); - } - - switch (qualifier.storage) { - case EvqVaryingIn: - case EvqVaryingOut: - if (type.getBasicType() == EbtBlock) - profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, E_GL_ARB_enhanced_layouts, "location qualifier on in/out block"); - break; - case EvqUniform: - case EvqBuffer: - if (type.getBasicType() == EbtBlock) - error(loc, "cannot apply to uniform or buffer block", "location", ""); - break; - default: - error(loc, "can only apply to uniform, buffer, in, or out storage qualifiers", "location", ""); - break; - } - - bool typeCollision; - int repeated = intermediate.addUsedLocation(qualifier, type, typeCollision); - if (repeated >= 0 && ! typeCollision) - error(loc, "overlapping use of location", "location", "%d", repeated); - // "fragment-shader outputs ... if two variables are placed within the same - // location, they must have the same underlying type (floating-point or integer)" - if (typeCollision && language == EShLangFragment && qualifier.isPipeOutput()) - error(loc, "fragment outputs sharing the same location must be the same basic type", "location", "%d", repeated); - } - - if (qualifier.hasXfbOffset() && qualifier.hasXfbBuffer()) { - int repeated = intermediate.addXfbBufferOffset(type); - if (repeated >= 0) - error(loc, "overlapping offsets at", "xfb_offset", "offset %d in buffer %d", repeated, qualifier.layoutXfbBuffer); - - // "The offset must be a multiple of the size of the first component of the first - // qualified variable or block member, or a compile-time error results. Further, if applied to an aggregate - // containing a double, the offset must also be a multiple of 8..." - if (type.containsBasicType(EbtDouble) && ! IsMultipleOfPow2(qualifier.layoutXfbOffset, 8)) - error(loc, "type contains double; xfb_offset must be a multiple of 8", "xfb_offset", ""); -#ifdef AMD_EXTENSIONS - // ..., if applied to an aggregate containing a float16_t, the offset must also be a multiple of 2..." - else if (type.containsBasicType(EbtFloat16) && !IsMultipleOfPow2(qualifier.layoutXfbOffset, 2)) - error(loc, "type contains half float; xfb_offset must be a multiple of 2", "xfb_offset", ""); -#endif - else if (! IsMultipleOfPow2(qualifier.layoutXfbOffset, 4)) - error(loc, "must be a multiple of size of first component", "xfb_offset", ""); - } - - if (qualifier.hasXfbStride() && qualifier.hasXfbBuffer()) { - if (! intermediate.setXfbBufferStride(qualifier.layoutXfbBuffer, qualifier.layoutXfbStride)) - error(loc, "all stride settings must match for xfb buffer", "xfb_stride", "%d", qualifier.layoutXfbBuffer); - } - - if (qualifier.hasBinding()) { - // Binding checking, from the spec: - // - // "If the binding point for any uniform or shader storage block instance is less than zero, or greater than or - // equal to the implementation-dependent maximum number of uniform buffer bindings, a compile-time - // error will occur. When the binding identifier is used with a uniform or shader storage block instanced as - // an array of size N, all elements of the array from binding through binding + N - 1 must be within this - // range." - // - if (! type.isOpaque() && type.getBasicType() != EbtBlock) - error(loc, "requires block, or sampler/image, or atomic-counter type", "binding", ""); - if (type.getBasicType() == EbtSampler) { - int lastBinding = qualifier.layoutBinding; - if (type.isArray()) { - if (type.isImplicitlySizedArray()) { - lastBinding += 1; - warn(loc, "assuming array size of one for compile-time checking of binding numbers for implicitly-sized array", "[]", ""); - } else - lastBinding += type.getCumulativeArraySize(); - } - if (spvVersion.vulkan == 0 && lastBinding >= resources.maxCombinedTextureImageUnits) - error(loc, "sampler binding not less than gl_MaxCombinedTextureImageUnits", "binding", type.isArray() ? "(using array)" : ""); - } - if (type.getBasicType() == EbtAtomicUint) { - if (qualifier.layoutBinding >= (unsigned int)resources.maxAtomicCounterBindings) { - error(loc, "atomic_uint binding is too large; see gl_MaxAtomicCounterBindings", "binding", ""); - return; - } - } - } - - // atomic_uint - if (type.getBasicType() == EbtAtomicUint) { - if (! type.getQualifier().hasBinding()) - error(loc, "layout(binding=X) is required", "atomic_uint", ""); - } - - // "The offset qualifier can only be used on block members of blocks..." - if (qualifier.hasOffset()) { - if (type.getBasicType() == EbtBlock) - error(loc, "only applies to block members, not blocks", "offset", ""); - } - - // Image format - if (qualifier.hasFormat()) { - if (! type.isImage()) - error(loc, "only apply to images", TQualifier::getLayoutFormatString(qualifier.layoutFormat), ""); - else { - if (type.getSampler().type == EbtFloat && qualifier.layoutFormat > ElfFloatGuard) - error(loc, "does not apply to floating point images", TQualifier::getLayoutFormatString(qualifier.layoutFormat), ""); - if (type.getSampler().type == EbtInt && (qualifier.layoutFormat < ElfFloatGuard || qualifier.layoutFormat > ElfIntGuard)) - error(loc, "does not apply to signed integer images", TQualifier::getLayoutFormatString(qualifier.layoutFormat), ""); - if (type.getSampler().type == EbtUint && qualifier.layoutFormat < ElfIntGuard) - error(loc, "does not apply to unsigned integer images", TQualifier::getLayoutFormatString(qualifier.layoutFormat), ""); - - if (profile == EEsProfile) { - // "Except for image variables qualified with the format qualifiers r32f, r32i, and r32ui, image variables must - // specify either memory qualifier readonly or the memory qualifier writeonly." - if (! (qualifier.layoutFormat == ElfR32f || qualifier.layoutFormat == ElfR32i || qualifier.layoutFormat == ElfR32ui)) { - if (! qualifier.readonly && ! qualifier.writeonly) - error(loc, "format requires readonly or writeonly memory qualifier", TQualifier::getLayoutFormatString(qualifier.layoutFormat), ""); - } - } - } - } else if (type.isImage() && ! qualifier.writeonly) { - const char *explanation = "image variables not declared 'writeonly' and without a format layout qualifier"; - requireProfile(loc, ECoreProfile | ECompatibilityProfile, explanation); - profileRequires(loc, ECoreProfile | ECompatibilityProfile, 0, E_GL_EXT_shader_image_load_formatted, explanation); - } - - if (qualifier.layoutPushConstant && type.getBasicType() != EbtBlock) - error(loc, "can only be used with a block", "push_constant", ""); - - // input attachment - if (type.isSubpass()) { - if (! qualifier.hasAttachment()) - error(loc, "requires an input_attachment_index layout qualifier", "subpass", ""); - } else { - if (qualifier.hasAttachment()) - error(loc, "can only be used with a subpass", "input_attachment_index", ""); - } - - // specialization-constant id - if (qualifier.hasSpecConstantId()) { - if (type.getQualifier().storage != EvqConst) - error(loc, "can only be applied to 'const'-qualified scalar", "constant_id", ""); - if (! type.isScalar()) - error(loc, "can only be applied to a scalar", "constant_id", ""); - switch (type.getBasicType()) - { - case EbtInt: - case EbtUint: - case EbtInt64: - case EbtUint64: -#ifdef AMD_EXTENSIONS - case EbtInt16: - case EbtUint16: -#endif - case EbtBool: - case EbtFloat: - case EbtDouble: -#ifdef AMD_EXTENSIONS - case EbtFloat16: -#endif - break; - default: - error(loc, "cannot be applied to this type", "constant_id", ""); - break; - } - } -} - -// Do layout error checking that can be done within a layout qualifier proper, not needing to know -// if there are blocks, atomic counters, variables, etc. -void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier& qualifier) -{ - if (qualifier.storage == EvqShared && qualifier.hasLayout()) - error(loc, "cannot apply layout qualifiers to a shared variable", "shared", ""); - - // "It is a compile-time error to use *component* without also specifying the location qualifier (order does not matter)." - if (qualifier.hasComponent() && ! qualifier.hasLocation()) - error(loc, "must specify 'location' to use 'component'", "component", ""); - - if (qualifier.hasAnyLocation()) { - - // "As with input layout qualifiers, all shaders except compute shaders - // allow *location* layout qualifiers on output variable declarations, - // output block declarations, and output block member declarations." - - switch (qualifier.storage) { - case EvqVaryingIn: - { - const char* feature = "location qualifier on input"; - if (profile == EEsProfile && version < 310) - requireStage(loc, EShLangVertex, feature); - else - requireStage(loc, (EShLanguageMask)~EShLangComputeMask, feature); - if (language == EShLangVertex) { - const char* exts[2] = { E_GL_ARB_separate_shader_objects, E_GL_ARB_explicit_attrib_location }; - profileRequires(loc, ~EEsProfile, 330, 2, exts, feature); - profileRequires(loc, EEsProfile, 300, nullptr, feature); - } else { - profileRequires(loc, ~EEsProfile, 410, E_GL_ARB_separate_shader_objects, feature); - profileRequires(loc, EEsProfile, 310, nullptr, feature); - } - break; - } - case EvqVaryingOut: - { - const char* feature = "location qualifier on output"; - if (profile == EEsProfile && version < 310) - requireStage(loc, EShLangFragment, feature); - else - requireStage(loc, (EShLanguageMask)~EShLangComputeMask, feature); - if (language == EShLangFragment) { - const char* exts[2] = { E_GL_ARB_separate_shader_objects, E_GL_ARB_explicit_attrib_location }; - profileRequires(loc, ~EEsProfile, 330, 2, exts, feature); - profileRequires(loc, EEsProfile, 300, nullptr, feature); - } else { - profileRequires(loc, ~EEsProfile, 410, E_GL_ARB_separate_shader_objects, feature); - profileRequires(loc, EEsProfile, 310, nullptr, feature); - } - break; - } - case EvqUniform: - case EvqBuffer: - { - const char* feature = "location qualifier on uniform or buffer"; - requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, feature); - profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, nullptr, feature); - profileRequires(loc, EEsProfile, 310, nullptr, feature); - break; - } - default: - break; - } - if (qualifier.hasIndex()) { - if (qualifier.storage != EvqVaryingOut) - error(loc, "can only be used on an output", "index", ""); - if (! qualifier.hasLocation()) - error(loc, "can only be used with an explicit location", "index", ""); - } - } - - if (qualifier.hasBinding()) { - if (! qualifier.isUniformOrBuffer()) - error(loc, "requires uniform or buffer storage qualifier", "binding", ""); - } - if (qualifier.hasStream()) { - if (qualifier.storage != EvqVaryingOut) - error(loc, "can only be used on an output", "stream", ""); - } - if (qualifier.hasXfb()) { - if (qualifier.storage != EvqVaryingOut) - error(loc, "can only be used on an output", "xfb layout qualifier", ""); - } - if (qualifier.hasUniformLayout()) { - if (! qualifier.isUniformOrBuffer()) { - if (qualifier.hasMatrix() || qualifier.hasPacking()) - error(loc, "matrix or packing qualifiers can only be used on a uniform or buffer", "layout", ""); - if (qualifier.hasOffset() || qualifier.hasAlign()) - error(loc, "offset/align can only be used on a uniform or buffer", "layout", ""); - } - } - if (qualifier.layoutPushConstant) { - if (qualifier.storage != EvqUniform) - error(loc, "can only be used with a uniform", "push_constant", ""); - if (qualifier.hasSet()) - error(loc, "cannot be used with push_constant", "set", ""); - } -} - -// For places that can't have shader-level layout qualifiers -void TParseContext::checkNoShaderLayouts(const TSourceLoc& loc, const TShaderQualifiers& shaderQualifiers) -{ - const char* message = "can only apply to a standalone qualifier"; - - if (shaderQualifiers.geometry != ElgNone) - error(loc, message, TQualifier::getGeometryString(shaderQualifiers.geometry), ""); - if (shaderQualifiers.spacing != EvsNone) - error(loc, message, TQualifier::getVertexSpacingString(shaderQualifiers.spacing), ""); - if (shaderQualifiers.order != EvoNone) - error(loc, message, TQualifier::getVertexOrderString(shaderQualifiers.order), ""); - if (shaderQualifiers.pointMode) - error(loc, message, "point_mode", ""); - if (shaderQualifiers.invocations != TQualifier::layoutNotSet) - error(loc, message, "invocations", ""); - if (shaderQualifiers.earlyFragmentTests) - error(loc, message, "early_fragment_tests", ""); - if (shaderQualifiers.postDepthCoverage) - error(loc, message, "post_depth_coverage", ""); - for (int i = 0; i < 3; ++i) { - if (shaderQualifiers.localSize[i] > 1) - error(loc, message, "local_size", ""); - if (shaderQualifiers.localSizeSpecId[i] != TQualifier::layoutNotSet) - error(loc, message, "local_size id", ""); - } - if (shaderQualifiers.vertices != TQualifier::layoutNotSet) { - if (language == EShLangGeometry) - error(loc, message, "max_vertices", ""); - else if (language == EShLangTessControl) - error(loc, message, "vertices", ""); - else - assert(0); - } - if (shaderQualifiers.blendEquation) - error(loc, message, "blend equation", ""); - if (shaderQualifiers.numViews != TQualifier::layoutNotSet) - error(loc, message, "num_views", ""); -} - -// Correct and/or advance an object's offset layout qualifier. -void TParseContext::fixOffset(const TSourceLoc& loc, TSymbol& symbol) -{ - const TQualifier& qualifier = symbol.getType().getQualifier(); - if (symbol.getType().getBasicType() == EbtAtomicUint) { - if (qualifier.hasBinding() && (int)qualifier.layoutBinding < resources.maxAtomicCounterBindings) { - - // Set the offset - int offset; - if (qualifier.hasOffset()) - offset = qualifier.layoutOffset; - else - offset = atomicUintOffsets[qualifier.layoutBinding]; - symbol.getWritableType().getQualifier().layoutOffset = offset; - - // Check for overlap - int numOffsets = 4; - if (symbol.getType().isArray()) { - if (symbol.getType().isExplicitlySizedArray() && ! symbol.getType().getArraySizes()->isInnerImplicit()) - numOffsets *= symbol.getType().getCumulativeArraySize(); - else { - // "It is a compile-time error to declare an unsized array of atomic_uint." - error(loc, "array must be explicitly sized", "atomic_uint", ""); - } - } - int repeated = intermediate.addUsedOffsets(qualifier.layoutBinding, offset, numOffsets); - if (repeated >= 0) - error(loc, "atomic counters sharing the same offset:", "offset", "%d", repeated); - - // Bump the default offset - atomicUintOffsets[qualifier.layoutBinding] = offset + numOffsets; - } - } -} - -// -// Look up a function name in the symbol table, and make sure it is a function. -// -// Return the function symbol if found, otherwise nullptr. -// -const TFunction* TParseContext::findFunction(const TSourceLoc& loc, const TFunction& call, bool& builtIn) -{ - const TFunction* function = nullptr; - - if (symbolTable.isFunctionNameVariable(call.getName())) { - error(loc, "can't use function syntax on variable", call.getName().c_str(), ""); - return nullptr; - } - - if (profile == EEsProfile || version < 120) - function = findFunctionExact(loc, call, builtIn); - else if (version < 400) - function = findFunction120(loc, call, builtIn); - else - function = findFunction400(loc, call, builtIn); - - return function; -} - -// Function finding algorithm for ES and desktop 110. -const TFunction* TParseContext::findFunctionExact(const TSourceLoc& loc, const TFunction& call, bool& builtIn) -{ - TSymbol* symbol = symbolTable.find(call.getMangledName(), &builtIn); - if (symbol == nullptr) { - error(loc, "no matching overloaded function found", call.getName().c_str(), ""); - - return nullptr; - } - - return symbol->getAsFunction(); -} - -// Function finding algorithm for desktop versions 120 through 330. -const TFunction* TParseContext::findFunction120(const TSourceLoc& loc, const TFunction& call, bool& builtIn) -{ - // first, look for an exact match - TSymbol* symbol = symbolTable.find(call.getMangledName(), &builtIn); - if (symbol) - return symbol->getAsFunction(); - - // exact match not found, look through a list of overloaded functions of the same name - - // "If no exact match is found, then [implicit conversions] will be applied to find a match. Mismatched types - // on input parameters (in or inout or default) must have a conversion from the calling argument type to the - // formal parameter type. Mismatched types on output parameters (out or inout) must have a conversion - // from the formal parameter type to the calling argument type. When argument conversions are used to find - // a match, it is a semantic error if there are multiple ways to apply these conversions to make the call match - // more than one function." - - const TFunction* candidate = nullptr; - TVector candidateList; - symbolTable.findFunctionNameList(call.getMangledName(), candidateList, builtIn); - - for (auto it = candidateList.begin(); it != candidateList.end(); ++it) { - const TFunction& function = *(*it); - - // to even be a potential match, number of arguments has to match - if (call.getParamCount() != function.getParamCount()) - continue; - - bool possibleMatch = true; - for (int i = 0; i < function.getParamCount(); ++i) { - // same types is easy - if (*function[i].type == *call[i].type) - continue; - - // We have a mismatch in type, see if it is implicitly convertible - - if (function[i].type->isArray() || call[i].type->isArray() || - ! function[i].type->sameElementShape(*call[i].type)) - possibleMatch = false; - else { - // do direction-specific checks for conversion of basic type - if (function[i].type->getQualifier().isParamInput()) { - if (! intermediate.canImplicitlyPromote(call[i].type->getBasicType(), function[i].type->getBasicType())) - possibleMatch = false; - } - if (function[i].type->getQualifier().isParamOutput()) { - if (! intermediate.canImplicitlyPromote(function[i].type->getBasicType(), call[i].type->getBasicType())) - possibleMatch = false; - } - } - if (! possibleMatch) - break; - } - if (possibleMatch) { - if (candidate) { - // our second match, meaning ambiguity - error(loc, "ambiguous function signature match: multiple signatures match under implicit type conversion", call.getName().c_str(), ""); - } else - candidate = &function; - } - } - - if (candidate == nullptr) - error(loc, "no matching overloaded function found", call.getName().c_str(), ""); - - return candidate; -} - -// Function finding algorithm for desktop version 400 and above. -// -// "When function calls are resolved, an exact type match for all the arguments -// is sought. If an exact match is found, all other functions are ignored, and -// the exact match is used. If no exact match is found, then the implicit -// conversions in section 4.1.10 Implicit Conversions will be applied to find -// a match. Mismatched types on input parameters (in or inout or default) must -// have a conversion from the calling argument type to the formal parameter type. -// Mismatched types on output parameters (out or inout) must have a conversion -// from the formal parameter type to the calling argument type. -// -// "If implicit conversions can be used to find more than one matching function, -// a single best-matching function is sought. To determine a best match, the -// conversions between calling argument and formal parameter types are compared -// for each function argument and pair of matching functions. After these -// comparisons are performed, each pair of matching functions are compared. -// A function declaration A is considered a better match than function -// declaration B if -// -// * for at least one function argument, the conversion for that argument in A -// is better than the corresponding conversion in B; and -// * there is no function argument for which the conversion in B is better than -// the corresponding conversion in A. -// -// "If a single function declaration is considered a better match than every -// other matching function declaration, it will be used. Otherwise, a -// compile-time semantic error for an ambiguous overloaded function call occurs. -// -// "To determine whether the conversion for a single argument in one match is -// better than that for another match, the following rules are applied, in order: -// -// 1. An exact match is better than a match involving any implicit conversion. -// 2. A match involving an implicit conversion from float to double is better -// than a match involving any other implicit conversion. -// 3. A match involving an implicit conversion from either int or uint to float -// is better than a match involving an implicit conversion from either int -// or uint to double. -// -// "If none of the rules above apply to a particular pair of conversions, neither -// conversion is considered better than the other." -// -const TFunction* TParseContext::findFunction400(const TSourceLoc& loc, const TFunction& call, bool& builtIn) -{ - // first, look for an exact match - TSymbol* symbol = symbolTable.find(call.getMangledName(), &builtIn); - if (symbol) - return symbol->getAsFunction(); - - // no exact match, use the generic selector, parameterized by the GLSL rules - - // create list of candidates to send - TVector candidateList; - symbolTable.findFunctionNameList(call.getMangledName(), candidateList, builtIn); - - // can 'from' convert to 'to'? - const auto convertible = [this](const TType& from, const TType& to, TOperator, int) -> bool { - if (from == to) - return true; - if (from.isArray() || to.isArray() || ! from.sameElementShape(to)) - return false; - return intermediate.canImplicitlyPromote(from.getBasicType(), to.getBasicType()); - }; - - // Is 'to2' a better conversion than 'to1'? - // Ties should not be considered as better. - // Assumes 'convertible' already said true. - const auto better = [](const TType& from, const TType& to1, const TType& to2) -> bool { - // 1. exact match - if (from == to2) - return from != to1; - if (from == to1) - return false; - - // 2. float -> double is better - if (from.getBasicType() == EbtFloat) { - if (to2.getBasicType() == EbtDouble && to1.getBasicType() != EbtDouble) - return true; - } - - // 3. -> float is better than -> double - return to2.getBasicType() == EbtFloat && to1.getBasicType() == EbtDouble; - }; - - // for ambiguity reporting - bool tie = false; - - // send to the generic selector - const TFunction* bestMatch = selectFunction(candidateList, call, convertible, better, tie); - - if (bestMatch == nullptr) - error(loc, "no matching overloaded function found", call.getName().c_str(), ""); - else if (tie) - error(loc, "ambiguous best function under implicit type conversion", call.getName().c_str(), ""); - - return bestMatch; -} - -// When a declaration includes a type, but not a variable name, it can be -// to establish defaults. -void TParseContext::declareTypeDefaults(const TSourceLoc& loc, const TPublicType& publicType) -{ - if (publicType.basicType == EbtAtomicUint && publicType.qualifier.hasBinding() && publicType.qualifier.hasOffset()) { - if (publicType.qualifier.layoutBinding >= (unsigned int)resources.maxAtomicCounterBindings) { - error(loc, "atomic_uint binding is too large", "binding", ""); - return; - } - atomicUintOffsets[publicType.qualifier.layoutBinding] = publicType.qualifier.layoutOffset; - return; - } - - if (publicType.qualifier.hasLayout()) - warn(loc, "useless application of layout qualifier", "layout", ""); -} - -// -// Do everything necessary to handle a variable (non-block) declaration. -// Either redeclaring a variable, or making a new one, updating the symbol -// table, and all error checking. -// -// Returns a subtree node that computes an initializer, if needed. -// Returns nullptr if there is no code to execute for initialization. -// -// 'publicType' is the type part of the declaration (to the left) -// 'arraySizes' is the arrayness tagged on the identifier (to the right) -// -TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& identifier, const TPublicType& publicType, TArraySizes* arraySizes, TIntermTyped* initializer) -{ - TType type(publicType); // shallow copy; 'type' shares the arrayness and structure definition with 'publicType' - if (type.isImplicitlySizedArray()) { - // Because "int[] a = int[2](...), b = int[3](...)" makes two arrays a and b - // of different sizes, for this case sharing the shallow copy of arrayness - // with the publicType oversubscribes it, so get a deep copy of the arrayness. - type.newArraySizes(*publicType.arraySizes); - } - - if (voidErrorCheck(loc, identifier, type.getBasicType())) - return nullptr; - - if (initializer) - rValueErrorCheck(loc, "initializer", initializer); - else - nonInitConstCheck(loc, identifier, type); - - samplerCheck(loc, type, identifier, initializer); - atomicUintCheck(loc, type, identifier); - transparentOpaqueCheck(loc, type, identifier); - - if (identifier != "gl_FragCoord" && (publicType.shaderQualifiers.originUpperLeft || publicType.shaderQualifiers.pixelCenterInteger)) - error(loc, "can only apply origin_upper_left and pixel_center_origin to gl_FragCoord", "layout qualifier", ""); - if (identifier != "gl_FragDepth" && publicType.shaderQualifiers.layoutDepth != EldNone) - error(loc, "can only apply depth layout to gl_FragDepth", "layout qualifier", ""); - - // Check for redeclaration of built-ins and/or attempting to declare a reserved name - TSymbol* symbol = redeclareBuiltinVariable(loc, identifier, type.getQualifier(), publicType.shaderQualifiers); - if (symbol == nullptr) - reservedErrorCheck(loc, identifier); - - inheritGlobalDefaults(type.getQualifier()); - - // Declare the variable - if (arraySizes || type.isArray()) { - // Arrayness is potentially coming both from the type and from the - // variable: "int[] a[];" or just one or the other. - // Merge it all to the type, so all arrayness is part of the type. - arrayDimCheck(loc, &type, arraySizes); - arrayDimMerge(type, arraySizes); - - // Check that implicit sizing is only where allowed. - arraySizesCheck(loc, type.getQualifier(), &type.getArraySizes(), initializer != nullptr, false); - - if (! arrayQualifierError(loc, type.getQualifier()) && ! arrayError(loc, type)) - declareArray(loc, identifier, type, symbol); - - if (initializer) { - profileRequires(loc, ENoProfile, 120, E_GL_3DL_array_objects, "initializer"); - profileRequires(loc, EEsProfile, 300, nullptr, "initializer"); - } - } else { - // non-array case - if (symbol == nullptr) - symbol = declareNonArray(loc, identifier, type); - else if (type != symbol->getType()) - error(loc, "cannot change the type of", "redeclaration", symbol->getName().c_str()); - } - - if (symbol == nullptr) - return nullptr; - - // Deal with initializer - TIntermNode* initNode = nullptr; - if (symbol != nullptr && initializer) { - TVariable* variable = symbol->getAsVariable(); - if (! variable) { - error(loc, "initializer requires a variable, not a member", identifier.c_str(), ""); - return nullptr; - } - initNode = executeInitializer(loc, initializer, variable); - } - - // look for errors in layout qualifier use - layoutObjectCheck(loc, *symbol); - - // fix up - fixOffset(loc, *symbol); - - return initNode; -} - -// Pick up global defaults from the provide global defaults into dst. -void TParseContext::inheritGlobalDefaults(TQualifier& dst) const -{ - if (dst.storage == EvqVaryingOut) { - if (! dst.hasStream() && language == EShLangGeometry) - dst.layoutStream = globalOutputDefaults.layoutStream; - if (! dst.hasXfbBuffer()) - dst.layoutXfbBuffer = globalOutputDefaults.layoutXfbBuffer; - } -} - -// -// Make an internal-only variable whose name is for debug purposes only -// and won't be searched for. Callers will only use the return value to use -// the variable, not the name to look it up. It is okay if the name -// is the same as other names; there won't be any conflict. -// -TVariable* TParseContext::makeInternalVariable(const char* name, const TType& type) const -{ - TString* nameString = NewPoolTString(name); - TVariable* variable = new TVariable(nameString, type); - symbolTable.makeInternalVariable(*variable); - - return variable; -} - -// -// Declare a non-array variable, the main point being there is no redeclaration -// for resizing allowed. -// -// Return the successfully declared variable. -// -TVariable* TParseContext::declareNonArray(const TSourceLoc& loc, const TString& identifier, const TType& type) -{ - // make a new variable - TVariable* variable = new TVariable(&identifier, type); - - ioArrayCheck(loc, type, identifier); - - // add variable to symbol table - if (symbolTable.insert(*variable)) { - if (symbolTable.atGlobalLevel()) - trackLinkage(*variable); - return variable; - } - - error(loc, "redefinition", variable->getName().c_str(), ""); - return nullptr; -} - -// -// Handle all types of initializers from the grammar. -// -// Returning nullptr just means there is no code to execute to handle the -// initializer, which will, for example, be the case for constant initializers. -// -TIntermNode* TParseContext::executeInitializer(const TSourceLoc& loc, TIntermTyped* initializer, TVariable* variable) -{ - // - // Identifier must be of type constant, a global, or a temporary, and - // starting at version 120, desktop allows uniforms to have initializers. - // - TStorageQualifier qualifier = variable->getType().getQualifier().storage; - if (! (qualifier == EvqTemporary || qualifier == EvqGlobal || qualifier == EvqConst || - (qualifier == EvqUniform && profile != EEsProfile && version >= 120))) { - error(loc, " cannot initialize this type of qualifier ", variable->getType().getStorageQualifierString(), ""); - return nullptr; - } - arrayObjectCheck(loc, variable->getType(), "array initializer"); - - // - // If the initializer was from braces { ... }, we convert the whole subtree to a - // constructor-style subtree, allowing the rest of the code to operate - // identically for both kinds of initializers. - // - // Type can't be deduced from the initializer list, so a skeletal type to - // follow has to be passed in. Constness and specialization-constness - // should be deduced bottom up, not dictated by the skeletal type. - // - TType skeletalType; - skeletalType.shallowCopy(variable->getType()); - skeletalType.getQualifier().makeTemporary(); - initializer = convertInitializerList(loc, skeletalType, initializer); - if (! initializer) { - // error recovery; don't leave const without constant values - if (qualifier == EvqConst) - variable->getWritableType().getQualifier().makeTemporary(); - return nullptr; - } - - // Fix outer arrayness if variable is unsized, getting size from the initializer - if (initializer->getType().isExplicitlySizedArray() && - variable->getType().isImplicitlySizedArray()) - variable->getWritableType().changeOuterArraySize(initializer->getType().getOuterArraySize()); - - // Inner arrayness can also get set by an initializer - if (initializer->getType().isArrayOfArrays() && variable->getType().isArrayOfArrays() && - initializer->getType().getArraySizes()->getNumDims() == - variable->getType().getArraySizes()->getNumDims()) { - // adopt unsized sizes from the initializer's sizes - for (int d = 1; d < variable->getType().getArraySizes()->getNumDims(); ++d) { - if (variable->getType().getArraySizes()->getDimSize(d) == UnsizedArraySize) - variable->getWritableType().getArraySizes().setDimSize(d, initializer->getType().getArraySizes()->getDimSize(d)); - } - } - - // Uniforms require a compile-time constant initializer - if (qualifier == EvqUniform && ! initializer->getType().getQualifier().isFrontEndConstant()) { - error(loc, "uniform initializers must be constant", "=", "'%s'", variable->getType().getCompleteString().c_str()); - variable->getWritableType().getQualifier().makeTemporary(); - return nullptr; - } - // Global consts require a constant initializer (specialization constant is okay) - if (qualifier == EvqConst && symbolTable.atGlobalLevel() && ! initializer->getType().getQualifier().isConstant()) { - error(loc, "global const initializers must be constant", "=", "'%s'", variable->getType().getCompleteString().c_str()); - variable->getWritableType().getQualifier().makeTemporary(); - return nullptr; - } - - // Const variables require a constant initializer, depending on version - if (qualifier == EvqConst) { - if (! initializer->getType().getQualifier().isConstant()) { - const char* initFeature = "non-constant initializer"; - requireProfile(loc, ~EEsProfile, initFeature); - profileRequires(loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature); - variable->getWritableType().getQualifier().storage = EvqConstReadOnly; - qualifier = EvqConstReadOnly; - } - } else { - // Non-const global variables in ES need a const initializer. - // - // "In declarations of global variables with no storage qualifier or with a const - // qualifier any initializer must be a constant expression." - if (symbolTable.atGlobalLevel() && ! initializer->getType().getQualifier().isConstant()) { - const char* initFeature = "non-constant global initializer (needs GL_EXT_shader_non_constant_global_initializers)"; - if (profile == EEsProfile) { - if (relaxedErrors() && ! extensionTurnedOn(E_GL_EXT_shader_non_constant_global_initializers)) - warn(loc, "not allowed in this version", initFeature, ""); - else - profileRequires(loc, EEsProfile, 0, E_GL_EXT_shader_non_constant_global_initializers, initFeature); - } - } - } - - if (qualifier == EvqConst || qualifier == EvqUniform) { - // Compile-time tagging of the variable with its constant value... - - initializer = intermediate.addConversion(EOpAssign, variable->getType(), initializer); - if (! initializer || ! initializer->getType().getQualifier().isConstant() || variable->getType() != initializer->getType()) { - error(loc, "non-matching or non-convertible constant type for const initializer", - variable->getType().getStorageQualifierString(), ""); - variable->getWritableType().getQualifier().makeTemporary(); - return nullptr; - } - - // We either have a folded constant in getAsConstantUnion, or we have to use - // the initializer's subtree in the AST to represent the computation of a - // specialization constant. - assert(initializer->getAsConstantUnion() || initializer->getType().getQualifier().isSpecConstant()); - if (initializer->getAsConstantUnion()) - variable->setConstArray(initializer->getAsConstantUnion()->getConstArray()); - else { - // It's a specialization constant. - variable->getWritableType().getQualifier().makeSpecConstant(); - - // Keep the subtree that computes the specialization constant with the variable. - // Later, a symbol node will adopt the subtree from the variable. - variable->setConstSubtree(initializer); - } - } else { - // normal assigning of a value to a variable... - specializationCheck(loc, initializer->getType(), "initializer"); - TIntermSymbol* intermSymbol = intermediate.addSymbol(*variable, loc); - TIntermTyped* initNode = intermediate.addAssign(EOpAssign, intermSymbol, initializer, loc); - if (! initNode) - assignError(loc, "=", intermSymbol->getCompleteString(), initializer->getCompleteString()); - - return initNode; - } - - return nullptr; -} - -// -// Reprocess any initializer-list (the "{ ... }" syntax) parts of the -// initializer. -// -// Need to hierarchically assign correct types and implicit -// conversions. Will do this mimicking the same process used for -// creating a constructor-style initializer, ensuring we get the -// same form. However, it has to in parallel walk the 'type' -// passed in, as type cannot be deduced from an initializer list. -// -TIntermTyped* TParseContext::convertInitializerList(const TSourceLoc& loc, const TType& type, TIntermTyped* initializer) -{ - // Will operate recursively. Once a subtree is found that is constructor style, - // everything below it is already good: Only the "top part" of the initializer - // can be an initializer list, where "top part" can extend for several (or all) levels. - - // see if we have bottomed out in the tree within the initializer-list part - TIntermAggregate* initList = initializer->getAsAggregate(); - if (! initList || initList->getOp() != EOpNull) - return initializer; - - // Of the initializer-list set of nodes, need to process bottom up, - // so recurse deep, then process on the way up. - - // Go down the tree here... - if (type.isArray()) { - // The type's array might be unsized, which could be okay, so base sizes on the size of the aggregate. - // Later on, initializer execution code will deal with array size logic. - TType arrayType; - arrayType.shallowCopy(type); // sharing struct stuff is fine - arrayType.newArraySizes(*type.getArraySizes()); // but get a fresh copy of the array information, to edit below - - // edit array sizes to fill in unsized dimensions - arrayType.changeOuterArraySize((int)initList->getSequence().size()); - TIntermTyped* firstInit = initList->getSequence()[0]->getAsTyped(); - if (arrayType.isArrayOfArrays() && firstInit->getType().isArray() && - arrayType.getArraySizes().getNumDims() == firstInit->getType().getArraySizes()->getNumDims() + 1) { - for (int d = 1; d < arrayType.getArraySizes().getNumDims(); ++d) { - if (arrayType.getArraySizes().getDimSize(d) == UnsizedArraySize) - arrayType.getArraySizes().setDimSize(d, firstInit->getType().getArraySizes()->getDimSize(d - 1)); - } - } - - TType elementType(arrayType, 0); // dereferenced type - for (size_t i = 0; i < initList->getSequence().size(); ++i) { - initList->getSequence()[i] = convertInitializerList(loc, elementType, initList->getSequence()[i]->getAsTyped()); - if (initList->getSequence()[i] == nullptr) - return nullptr; - } - - return addConstructor(loc, initList, arrayType); - } else if (type.isStruct()) { - if (type.getStruct()->size() != initList->getSequence().size()) { - error(loc, "wrong number of structure members", "initializer list", ""); - return nullptr; - } - for (size_t i = 0; i < type.getStruct()->size(); ++i) { - initList->getSequence()[i] = convertInitializerList(loc, *(*type.getStruct())[i].type, initList->getSequence()[i]->getAsTyped()); - if (initList->getSequence()[i] == nullptr) - return nullptr; - } - } else if (type.isMatrix()) { - if (type.getMatrixCols() != (int)initList->getSequence().size()) { - error(loc, "wrong number of matrix columns:", "initializer list", type.getCompleteString().c_str()); - return nullptr; - } - TType vectorType(type, 0); // dereferenced type - for (int i = 0; i < type.getMatrixCols(); ++i) { - initList->getSequence()[i] = convertInitializerList(loc, vectorType, initList->getSequence()[i]->getAsTyped()); - if (initList->getSequence()[i] == nullptr) - return nullptr; - } - } else if (type.isVector()) { - if (type.getVectorSize() != (int)initList->getSequence().size()) { - error(loc, "wrong vector size (or rows in a matrix column):", "initializer list", type.getCompleteString().c_str()); - return nullptr; - } - } else { - error(loc, "unexpected initializer-list type:", "initializer list", type.getCompleteString().c_str()); - return nullptr; - } - - // Now that the subtree is processed, process this node as if the - // initializer list is a set of arguments to a constructor. - TIntermNode* emulatedConstructorArguments; - if (initList->getSequence().size() == 1) - emulatedConstructorArguments = initList->getSequence()[0]; - else - emulatedConstructorArguments = initList; - return addConstructor(loc, emulatedConstructorArguments, type); -} - -// -// Test for the correctness of the parameters passed to various constructor functions -// and also convert them to the right data type, if allowed and required. -// -// 'node' is what to construct from. -// 'type' is what type to construct. -// -// Returns nullptr for an error or the constructed node (aggregate or typed) for no error. -// -TIntermTyped* TParseContext::addConstructor(const TSourceLoc& loc, TIntermNode* node, const TType& type) -{ - if (node == nullptr || node->getAsTyped() == nullptr) - return nullptr; - rValueErrorCheck(loc, "constructor", node->getAsTyped()); - - TIntermAggregate* aggrNode = node->getAsAggregate(); - TOperator op = intermediate.mapTypeToConstructorOp(type); - - // Combined texture-sampler constructors are completely semantic checked - // in constructorTextureSamplerError() - if (op == EOpConstructTextureSampler) - return intermediate.setAggregateOperator(aggrNode, op, type, loc); - - TTypeList::const_iterator memberTypes; - if (op == EOpConstructStruct) - memberTypes = type.getStruct()->begin(); - - TType elementType; - if (type.isArray()) { - TType dereferenced(type, 0); - elementType.shallowCopy(dereferenced); - } else - elementType.shallowCopy(type); - - bool singleArg; - if (aggrNode) { - if (aggrNode->getOp() != EOpNull) - singleArg = true; - else - singleArg = false; - } else - singleArg = true; - - TIntermTyped *newNode; - if (singleArg) { - // If structure constructor or array constructor is being called - // for only one parameter inside the structure, we need to call constructAggregate function once. - if (type.isArray()) - newNode = constructAggregate(node, elementType, 1, node->getLoc()); - else if (op == EOpConstructStruct) - newNode = constructAggregate(node, *(*memberTypes).type, 1, node->getLoc()); - else - newNode = constructBuiltIn(type, op, node->getAsTyped(), node->getLoc(), false); - - if (newNode && (type.isArray() || op == EOpConstructStruct)) - newNode = intermediate.setAggregateOperator(newNode, EOpConstructStruct, type, loc); - - return newNode; - } - - // - // Handle list of arguments. - // - TIntermSequence &sequenceVector = aggrNode->getSequence(); // Stores the information about the parameter to the constructor - // if the structure constructor contains more than one parameter, then construct - // each parameter - - int paramCount = 0; // keeps track of the constructor parameter number being checked - - // for each parameter to the constructor call, check to see if the right type is passed or convert them - // to the right type if possible (and allowed). - // for structure constructors, just check if the right type is passed, no conversion is allowed. - for (TIntermSequence::iterator p = sequenceVector.begin(); - p != sequenceVector.end(); p++, paramCount++) { - if (type.isArray()) - newNode = constructAggregate(*p, elementType, paramCount+1, node->getLoc()); - else if (op == EOpConstructStruct) - newNode = constructAggregate(*p, *(memberTypes[paramCount]).type, paramCount+1, node->getLoc()); - else - newNode = constructBuiltIn(type, op, (*p)->getAsTyped(), node->getLoc(), true); - - if (newNode) - *p = newNode; - else - return nullptr; - } - - return intermediate.setAggregateOperator(aggrNode, op, type, loc); -} - -// Function for constructor implementation. Calls addUnaryMath with appropriate EOp value -// for the parameter to the constructor (passed to this function). Essentially, it converts -// the parameter types correctly. If a constructor expects an int (like ivec2) and is passed a -// float, then float is converted to int. -// -// Returns nullptr for an error or the constructed node. -// -TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, TIntermTyped* node, const TSourceLoc& loc, bool subset) -{ - TIntermTyped* newNode; - TOperator basicOp; - - // - // First, convert types as needed. - // - switch (op) { - case EOpConstructVec2: - case EOpConstructVec3: - case EOpConstructVec4: - case EOpConstructMat2x2: - case EOpConstructMat2x3: - case EOpConstructMat2x4: - case EOpConstructMat3x2: - case EOpConstructMat3x3: - case EOpConstructMat3x4: - case EOpConstructMat4x2: - case EOpConstructMat4x3: - case EOpConstructMat4x4: - case EOpConstructFloat: - basicOp = EOpConstructFloat; - break; - - case EOpConstructDVec2: - case EOpConstructDVec3: - case EOpConstructDVec4: - case EOpConstructDMat2x2: - case EOpConstructDMat2x3: - case EOpConstructDMat2x4: - case EOpConstructDMat3x2: - case EOpConstructDMat3x3: - case EOpConstructDMat3x4: - case EOpConstructDMat4x2: - case EOpConstructDMat4x3: - case EOpConstructDMat4x4: - case EOpConstructDouble: - basicOp = EOpConstructDouble; - break; - -#ifdef AMD_EXTENSIONS - case EOpConstructF16Vec2: - case EOpConstructF16Vec3: - case EOpConstructF16Vec4: - case EOpConstructF16Mat2x2: - case EOpConstructF16Mat2x3: - case EOpConstructF16Mat2x4: - case EOpConstructF16Mat3x2: - case EOpConstructF16Mat3x3: - case EOpConstructF16Mat3x4: - case EOpConstructF16Mat4x2: - case EOpConstructF16Mat4x3: - case EOpConstructF16Mat4x4: - case EOpConstructFloat16: - basicOp = EOpConstructFloat16; - break; -#endif - - case EOpConstructIVec2: - case EOpConstructIVec3: - case EOpConstructIVec4: - case EOpConstructInt: - basicOp = EOpConstructInt; - break; - - case EOpConstructUVec2: - case EOpConstructUVec3: - case EOpConstructUVec4: - case EOpConstructUint: - basicOp = EOpConstructUint; - break; - - case EOpConstructI64Vec2: - case EOpConstructI64Vec3: - case EOpConstructI64Vec4: - case EOpConstructInt64: - basicOp = EOpConstructInt64; - break; - - case EOpConstructU64Vec2: - case EOpConstructU64Vec3: - case EOpConstructU64Vec4: - case EOpConstructUint64: - basicOp = EOpConstructUint64; - break; - -#ifdef AMD_EXTENSIONS - case EOpConstructI16Vec2: - case EOpConstructI16Vec3: - case EOpConstructI16Vec4: - case EOpConstructInt16: - basicOp = EOpConstructInt16; - break; - - case EOpConstructU16Vec2: - case EOpConstructU16Vec3: - case EOpConstructU16Vec4: - case EOpConstructUint16: - basicOp = EOpConstructUint16; - break; -#endif - - case EOpConstructBVec2: - case EOpConstructBVec3: - case EOpConstructBVec4: - case EOpConstructBool: - basicOp = EOpConstructBool; - break; - - default: - error(loc, "unsupported construction", "", ""); - - return nullptr; - } - newNode = intermediate.addUnaryMath(basicOp, node, node->getLoc()); - if (newNode == nullptr) { - error(loc, "can't convert", "constructor", ""); - return nullptr; - } - - // - // Now, if there still isn't an operation to do the construction, and we need one, add one. - // - - // Otherwise, skip out early. - if (subset || (newNode != node && newNode->getType() == type)) - return newNode; - - // setAggregateOperator will insert a new node for the constructor, as needed. - return intermediate.setAggregateOperator(newNode, op, type, loc); -} - -// This function tests for the type of the parameters to the structure or array constructor. Raises -// an error message if the expected type does not match the parameter passed to the constructor. -// -// Returns nullptr for an error or the input node itself if the expected and the given parameter types match. -// -TIntermTyped* TParseContext::constructAggregate(TIntermNode* node, const TType& type, int paramCount, const TSourceLoc& loc) -{ - TIntermTyped* converted = intermediate.addConversion(EOpConstructStruct, type, node->getAsTyped()); - if (! converted || converted->getType() != type) { - error(loc, "", "constructor", "cannot convert parameter %d from '%s' to '%s'", paramCount, - node->getAsTyped()->getType().getCompleteString().c_str(), type.getCompleteString().c_str()); - - return nullptr; - } - - return converted; -} - -// -// Do everything needed to add an interface block. -// -void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, const TString* instanceName, TArraySizes* arraySizes) -{ - blockStageIoCheck(loc, currentBlockQualifier); - blockQualifierCheck(loc, currentBlockQualifier, instanceName != nullptr); - if (arraySizes) { - arraySizesCheck(loc, currentBlockQualifier, arraySizes, false, false); - arrayDimCheck(loc, arraySizes, 0); - if (arraySizes->getNumDims() > 1) - requireProfile(loc, ~EEsProfile, "array-of-array of block"); - } - - // fix and check for member storage qualifiers and types that don't belong within a block - for (unsigned int member = 0; member < typeList.size(); ++member) { - TType& memberType = *typeList[member].type; - TQualifier& memberQualifier = memberType.getQualifier(); - const TSourceLoc& memberLoc = typeList[member].loc; - globalQualifierFixCheck(memberLoc, memberQualifier); - if (memberQualifier.storage != EvqTemporary && memberQualifier.storage != EvqGlobal && memberQualifier.storage != currentBlockQualifier.storage) - error(memberLoc, "member storage qualifier cannot contradict block storage qualifier", memberType.getFieldName().c_str(), ""); - memberQualifier.storage = currentBlockQualifier.storage; - if ((currentBlockQualifier.storage == EvqUniform || currentBlockQualifier.storage == EvqBuffer) && (memberQualifier.isInterpolation() || memberQualifier.isAuxiliary())) - error(memberLoc, "member of uniform or buffer block cannot have an auxiliary or interpolation qualifier", memberType.getFieldName().c_str(), ""); - if (memberType.isArray()) - arraySizesCheck(memberLoc, currentBlockQualifier, &memberType.getArraySizes(), false, member == typeList.size() - 1); - if (memberQualifier.hasOffset()) { - if (spvVersion.spv == 0) { - requireProfile(memberLoc, ~EEsProfile, "offset on block member"); - profileRequires(memberLoc, ~EEsProfile, 440, E_GL_ARB_enhanced_layouts, "offset on block member"); - } - } - - if (memberType.containsOpaque()) - error(memberLoc, "member of block cannot be or contain a sampler, image, or atomic_uint type", typeList[member].type->getFieldName().c_str(), ""); - } - - // This might be a redeclaration of a built-in block. If so, redeclareBuiltinBlock() will - // do all the rest. - if (! symbolTable.atBuiltInLevel() && builtInName(*blockName)) { - redeclareBuiltinBlock(loc, typeList, *blockName, instanceName, arraySizes); - return; - } - - // Not a redeclaration of a built-in; check that all names are user names. - reservedErrorCheck(loc, *blockName); - if (instanceName) - reservedErrorCheck(loc, *instanceName); - for (unsigned int member = 0; member < typeList.size(); ++member) - reservedErrorCheck(typeList[member].loc, typeList[member].type->getFieldName()); - - // Make default block qualification, and adjust the member qualifications - - TQualifier defaultQualification; - switch (currentBlockQualifier.storage) { - case EvqUniform: defaultQualification = globalUniformDefaults; break; - case EvqBuffer: defaultQualification = globalBufferDefaults; break; - case EvqVaryingIn: defaultQualification = globalInputDefaults; break; - case EvqVaryingOut: defaultQualification = globalOutputDefaults; break; - default: defaultQualification.clear(); break; - } - - // Special case for "push_constant uniform", which has a default of std430, - // contrary to normal uniform defaults, and can't have a default tracked for it. - if (currentBlockQualifier.layoutPushConstant && !currentBlockQualifier.hasPacking()) - currentBlockQualifier.layoutPacking = ElpStd430; - - // fix and check for member layout qualifiers - - mergeObjectLayoutQualifiers(defaultQualification, currentBlockQualifier, true); - - // "The align qualifier can only be used on blocks or block members, and only for blocks declared with std140 or std430 layouts." - if (currentBlockQualifier.hasAlign()) { - if (defaultQualification.layoutPacking != ElpStd140 && defaultQualification.layoutPacking != ElpStd430) { - error(loc, "can only be used with std140 or std430 layout packing", "align", ""); - defaultQualification.layoutAlign = -1; - } - } - - bool memberWithLocation = false; - bool memberWithoutLocation = false; - for (unsigned int member = 0; member < typeList.size(); ++member) { - TQualifier& memberQualifier = typeList[member].type->getQualifier(); - const TSourceLoc& memberLoc = typeList[member].loc; - if (memberQualifier.hasStream()) { - if (defaultQualification.layoutStream != memberQualifier.layoutStream) - error(memberLoc, "member cannot contradict block", "stream", ""); - } - - // "This includes a block's inheritance of the - // current global default buffer, a block member's inheritance of the block's - // buffer, and the requirement that any *xfb_buffer* declared on a block - // member must match the buffer inherited from the block." - if (memberQualifier.hasXfbBuffer()) { - if (defaultQualification.layoutXfbBuffer != memberQualifier.layoutXfbBuffer) - error(memberLoc, "member cannot contradict block (or what block inherited from global)", "xfb_buffer", ""); - } - - if (memberQualifier.hasPacking()) - error(memberLoc, "member of block cannot have a packing layout qualifier", typeList[member].type->getFieldName().c_str(), ""); - if (memberQualifier.hasLocation()) { - const char* feature = "location on block member"; - switch (currentBlockQualifier.storage) { - case EvqVaryingIn: - case EvqVaryingOut: - requireProfile(memberLoc, ECoreProfile | ECompatibilityProfile | EEsProfile, feature); - profileRequires(memberLoc, ECoreProfile | ECompatibilityProfile, 440, E_GL_ARB_enhanced_layouts, feature); - profileRequires(memberLoc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, feature); - memberWithLocation = true; - break; - default: - error(memberLoc, "can only use in an in/out block", feature, ""); - break; - } - } else - memberWithoutLocation = true; - - // "The offset qualifier can only be used on block members of blocks declared with std140 or std430 layouts." - // "The align qualifier can only be used on blocks or block members, and only for blocks declared with std140 or std430 layouts." - if (memberQualifier.hasAlign() || memberQualifier.hasOffset()) { - if (defaultQualification.layoutPacking != ElpStd140 && defaultQualification.layoutPacking != ElpStd430) - error(memberLoc, "can only be used with std140 or std430 layout packing", "offset/align", ""); - } - - TQualifier newMemberQualification = defaultQualification; - mergeQualifiers(memberLoc, newMemberQualification, memberQualifier, false); - memberQualifier = newMemberQualification; - } - - layoutMemberLocationArrayCheck(loc, memberWithLocation, arraySizes); - - // Process the members - fixBlockLocations(loc, currentBlockQualifier, typeList, memberWithLocation, memberWithoutLocation); - fixBlockXfbOffsets(currentBlockQualifier, typeList); - fixBlockUniformOffsets(currentBlockQualifier, typeList); - for (unsigned int member = 0; member < typeList.size(); ++member) - layoutTypeCheck(typeList[member].loc, *typeList[member].type); - - // reverse merge, so that currentBlockQualifier now has all layout information - // (can't use defaultQualification directly, it's missing other non-layout-default-class qualifiers) - mergeObjectLayoutQualifiers(currentBlockQualifier, defaultQualification, true); - - // - // Build and add the interface block as a new type named 'blockName' - // - - TType blockType(&typeList, *blockName, currentBlockQualifier); - if (arraySizes) - blockType.newArraySizes(*arraySizes); - else - ioArrayCheck(loc, blockType, instanceName ? *instanceName : *blockName); - - // - // Don't make a user-defined type out of block name; that will cause an error - // if the same block name gets reused in a different interface. - // - // "Block names have no other use within a shader - // beyond interface matching; it is a compile-time error to use a block name at global scope for anything - // other than as a block name (e.g., use of a block name for a global variable name or function name is - // currently reserved)." - // - // Use the symbol table to prevent normal reuse of the block's name, as a variable entry, - // whose type is EbtBlock, but without all the structure; that will come from the type - // the instances point to. - // - TType blockNameType(EbtBlock, blockType.getQualifier().storage); - TVariable* blockNameVar = new TVariable(blockName, blockNameType); - if (! symbolTable.insert(*blockNameVar)) { - TSymbol* existingName = symbolTable.find(*blockName); - if (existingName->getType().getBasicType() == EbtBlock) { - if (existingName->getType().getQualifier().storage == blockType.getQualifier().storage) { - error(loc, "Cannot reuse block name within the same interface:", blockName->c_str(), blockType.getStorageQualifierString()); - return; - } - } else { - error(loc, "block name cannot redefine a non-block name", blockName->c_str(), ""); - return; - } - } - - // Add the variable, as anonymous or named instanceName. - // Make an anonymous variable if no name was provided. - if (! instanceName) - instanceName = NewPoolTString(""); - - TVariable& variable = *new TVariable(instanceName, blockType); - if (! symbolTable.insert(variable)) { - if (*instanceName == "") - error(loc, "nameless block contains a member that already has a name at global scope", blockName->c_str(), ""); - else - error(loc, "block instance name redefinition", variable.getName().c_str(), ""); - - return; - } - - // Check for general layout qualifier errors - layoutObjectCheck(loc, variable); - - // fix up - if (isIoResizeArray(blockType)) { - ioArraySymbolResizeList.push_back(&variable); - checkIoArraysConsistency(loc, true); - } else - fixIoArraySize(loc, variable.getWritableType()); - - // Save it in the AST for linker use. - trackLinkage(variable); -} - -// Do all block-declaration checking regarding the combination of in/out/uniform/buffer -// with a particular stage. -void TParseContext::blockStageIoCheck(const TSourceLoc& loc, const TQualifier& qualifier) -{ - switch (qualifier.storage) { - case EvqUniform: - profileRequires(loc, EEsProfile, 300, nullptr, "uniform block"); - profileRequires(loc, ENoProfile, 140, nullptr, "uniform block"); - if (currentBlockQualifier.layoutPacking == ElpStd430 && ! currentBlockQualifier.layoutPushConstant) - error(loc, "requires the 'buffer' storage qualifier", "std430", ""); - break; - case EvqBuffer: - requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, "buffer block"); - profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, nullptr, "buffer block"); - profileRequires(loc, EEsProfile, 310, nullptr, "buffer block"); - break; - case EvqVaryingIn: - profileRequires(loc, ~EEsProfile, 150, E_GL_ARB_separate_shader_objects, "input block"); - // It is a compile-time error to have an input block in a vertex shader or an output block in a fragment shader - // "Compute shaders do not permit user-defined input variables..." - requireStage(loc, (EShLanguageMask)(EShLangTessControlMask|EShLangTessEvaluationMask|EShLangGeometryMask|EShLangFragmentMask), "input block"); - if (language == EShLangFragment) - profileRequires(loc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, "fragment input block"); - break; - case EvqVaryingOut: - profileRequires(loc, ~EEsProfile, 150, E_GL_ARB_separate_shader_objects, "output block"); - requireStage(loc, (EShLanguageMask)(EShLangVertexMask|EShLangTessControlMask|EShLangTessEvaluationMask|EShLangGeometryMask), "output block"); - // ES 310 can have a block before shader_io is turned on, so skip this test for built-ins - if (language == EShLangVertex && ! parsingBuiltins) - profileRequires(loc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, "vertex output block"); - break; - default: - error(loc, "only uniform, buffer, in, or out blocks are supported", blockName->c_str(), ""); - break; - } -} - -// Do all block-declaration checking regarding its qualifiers. -void TParseContext::blockQualifierCheck(const TSourceLoc& loc, const TQualifier& qualifier, bool /*instanceName*/) -{ - // The 4.5 specification says: - // - // interface-block : - // layout-qualifieropt interface-qualifier block-name { member-list } instance-nameopt ; - // - // interface-qualifier : - // in - // out - // patch in - // patch out - // uniform - // buffer - // - // Note however memory qualifiers aren't included, yet the specification also says - // - // "...memory qualifiers may also be used in the declaration of shader storage blocks..." - - if (qualifier.isInterpolation()) - error(loc, "cannot use interpolation qualifiers on an interface block", "flat/smooth/noperspective", ""); - if (qualifier.centroid) - error(loc, "cannot use centroid qualifier on an interface block", "centroid", ""); - if (qualifier.sample) - error(loc, "cannot use sample qualifier on an interface block", "sample", ""); - if (qualifier.invariant) - error(loc, "cannot use invariant qualifier on an interface block", "invariant", ""); - if (qualifier.layoutPushConstant) - intermediate.addPushConstantCount(); -} - -// -// "For a block, this process applies to the entire block, or until the first member -// is reached that has a location layout qualifier. When a block member is declared with a location -// qualifier, its location comes from that qualifier: The member's location qualifier overrides the block-level -// declaration. Subsequent members are again assigned consecutive locations, based on the newest location, -// until the next member declared with a location qualifier. The values used for locations do not have to be -// declared in increasing order." -void TParseContext::fixBlockLocations(const TSourceLoc& loc, TQualifier& qualifier, TTypeList& typeList, bool memberWithLocation, bool memberWithoutLocation) -{ - // "If a block has no block-level location layout qualifier, it is required that either all or none of its members - // have a location layout qualifier, or a compile-time error results." - if (! qualifier.hasLocation() && memberWithLocation && memberWithoutLocation) - error(loc, "either the block needs a location, or all members need a location, or no members have a location", "location", ""); - else { - if (memberWithLocation) { - // remove any block-level location and make it per *every* member - int nextLocation = 0; // by the rule above, initial value is not relevant - if (qualifier.hasAnyLocation()) { - nextLocation = qualifier.layoutLocation; - qualifier.layoutLocation = TQualifier::layoutLocationEnd; - if (qualifier.hasComponent()) { - // "It is a compile-time error to apply the *component* qualifier to a ... block" - error(loc, "cannot apply to a block", "component", ""); - } - if (qualifier.hasIndex()) { - error(loc, "cannot apply to a block", "index", ""); - } - } - for (unsigned int member = 0; member < typeList.size(); ++member) { - TQualifier& memberQualifier = typeList[member].type->getQualifier(); - const TSourceLoc& memberLoc = typeList[member].loc; - if (! memberQualifier.hasLocation()) { - if (nextLocation >= (int)TQualifier::layoutLocationEnd) - error(memberLoc, "location is too large", "location", ""); - memberQualifier.layoutLocation = nextLocation; - memberQualifier.layoutComponent = TQualifier::layoutComponentEnd; - } - nextLocation = memberQualifier.layoutLocation + intermediate.computeTypeLocationSize(*typeList[member].type); - } - } - } -} - -void TParseContext::fixBlockXfbOffsets(TQualifier& qualifier, TTypeList& typeList) -{ - // "If a block is qualified with xfb_offset, all its - // members are assigned transform feedback buffer offsets. If a block is not qualified with xfb_offset, any - // members of that block not qualified with an xfb_offset will not be assigned transform feedback buffer - // offsets." - - if (! qualifier.hasXfbBuffer() || ! qualifier.hasXfbOffset()) - return; - - int nextOffset = qualifier.layoutXfbOffset; - for (unsigned int member = 0; member < typeList.size(); ++member) { - TQualifier& memberQualifier = typeList[member].type->getQualifier(); - bool containsDouble = false; - int memberSize = intermediate.computeTypeXfbSize(*typeList[member].type, containsDouble); - // see if we need to auto-assign an offset to this member - if (! memberQualifier.hasXfbOffset()) { - // "if applied to an aggregate containing a double, the offset must also be a multiple of 8" - if (containsDouble) - RoundToPow2(nextOffset, 8); - memberQualifier.layoutXfbOffset = nextOffset; - } else - nextOffset = memberQualifier.layoutXfbOffset; - nextOffset += memberSize; - } - - // The above gave all block members an offset, so we can take it off the block now, - // which will avoid double counting the offset usage. - qualifier.layoutXfbOffset = TQualifier::layoutXfbOffsetEnd; -} - -// Calculate and save the offset of each block member, using the recursively -// defined block offset rules and the user-provided offset and align. -// -// Also, compute and save the total size of the block. For the block's size, arrayness -// is not taken into account, as each element is backed by a separate buffer. -// -void TParseContext::fixBlockUniformOffsets(TQualifier& qualifier, TTypeList& typeList) -{ - if (! qualifier.isUniformOrBuffer()) - return; - if (qualifier.layoutPacking != ElpStd140 && qualifier.layoutPacking != ElpStd430) - return; - - int offset = 0; - int memberSize; - for (unsigned int member = 0; member < typeList.size(); ++member) { - TQualifier& memberQualifier = typeList[member].type->getQualifier(); - const TSourceLoc& memberLoc = typeList[member].loc; - - // "When align is applied to an array, it effects only the start of the array, not the array's internal stride." - - // modify just the children's view of matrix layout, if there is one for this member - TLayoutMatrix subMatrixLayout = typeList[member].type->getQualifier().layoutMatrix; - int dummyStride; - int memberAlignment = intermediate.getBaseAlignment(*typeList[member].type, memberSize, dummyStride, qualifier.layoutPacking == ElpStd140, - subMatrixLayout != ElmNone ? subMatrixLayout == ElmRowMajor : qualifier.layoutMatrix == ElmRowMajor); - if (memberQualifier.hasOffset()) { - // "The specified offset must be a multiple - // of the base alignment of the type of the block member it qualifies, or a compile-time error results." - if (! IsMultipleOfPow2(memberQualifier.layoutOffset, memberAlignment)) - error(memberLoc, "must be a multiple of the member's alignment", "offset", ""); - - // GLSL: "It is a compile-time error to specify an offset that is smaller than the offset of the previous - // member in the block or that lies within the previous member of the block" - if (spvVersion.spv == 0) { - if (memberQualifier.layoutOffset < offset) - error(memberLoc, "cannot lie in previous members", "offset", ""); - - // "The offset qualifier forces the qualified member to start at or after the specified - // integral-constant expression, which will be its byte offset from the beginning of the buffer. - // "The actual offset of a member is computed as - // follows: If offset was declared, start with that offset, otherwise start with the next available offset." - offset = std::max(offset, memberQualifier.layoutOffset); - } else { - // TODO: Vulkan: "It is a compile-time error to have any offset, explicit or assigned, - // that lies within another member of the block." - - offset = memberQualifier.layoutOffset; - } - } - - // "The actual alignment of a member will be the greater of the specified align alignment and the standard - // (e.g., std140) base alignment for the member's type." - if (memberQualifier.hasAlign()) - memberAlignment = std::max(memberAlignment, memberQualifier.layoutAlign); - - // "If the resulting offset is not a multiple of the actual alignment, - // increase it to the first offset that is a multiple of - // the actual alignment." - RoundToPow2(offset, memberAlignment); - typeList[member].type->getQualifier().layoutOffset = offset; - offset += memberSize; - } -} - -// For an identifier that is already declared, add more qualification to it. -void TParseContext::addQualifierToExisting(const TSourceLoc& loc, TQualifier qualifier, const TString& identifier) -{ - TSymbol* symbol = symbolTable.find(identifier); - if (! symbol) { - error(loc, "identifier not previously declared", identifier.c_str(), ""); - return; - } - if (symbol->getAsFunction()) { - error(loc, "cannot re-qualify a function name", identifier.c_str(), ""); - return; - } - - if (qualifier.isAuxiliary() || - qualifier.isMemory() || - qualifier.isInterpolation() || - qualifier.hasLayout() || - qualifier.storage != EvqTemporary || - qualifier.precision != EpqNone) { - error(loc, "cannot add storage, auxiliary, memory, interpolation, layout, or precision qualifier to an existing variable", identifier.c_str(), ""); - return; - } - - // For read-only built-ins, add a new symbol for holding the modified qualifier. - // This will bring up an entire block, if a block type has to be modified (e.g., gl_Position inside a block) - if (symbol->isReadOnly()) - symbol = symbolTable.copyUp(symbol); - - if (qualifier.invariant) { - if (intermediate.inIoAccessed(identifier)) - error(loc, "cannot change qualification after use", "invariant", ""); - symbol->getWritableType().getQualifier().invariant = true; - invariantCheck(loc, symbol->getType().getQualifier()); - } else if (qualifier.noContraction) { - if (intermediate.inIoAccessed(identifier)) - error(loc, "cannot change qualification after use", "precise", ""); - symbol->getWritableType().getQualifier().noContraction = true; - } else if (qualifier.specConstant) { - symbol->getWritableType().getQualifier().makeSpecConstant(); - if (qualifier.hasSpecConstantId()) - symbol->getWritableType().getQualifier().layoutSpecConstantId = qualifier.layoutSpecConstantId; - } else - warn(loc, "unknown requalification", "", ""); -} - -void TParseContext::addQualifierToExisting(const TSourceLoc& loc, TQualifier qualifier, TIdentifierList& identifiers) -{ - for (unsigned int i = 0; i < identifiers.size(); ++i) - addQualifierToExisting(loc, qualifier, *identifiers[i]); -} - -// Make sure 'invariant' isn't being applied to a non-allowed object. -void TParseContext::invariantCheck(const TSourceLoc& loc, const TQualifier& qualifier) -{ - if (! qualifier.invariant) - return; - - bool pipeOut = qualifier.isPipeOutput(); - bool pipeIn = qualifier.isPipeInput(); - if (version >= 300 || (profile != EEsProfile && version >= 420)) { - if (! pipeOut) - error(loc, "can only apply to an output", "invariant", ""); - } else { - if ((language == EShLangVertex && pipeIn) || (! pipeOut && ! pipeIn)) - error(loc, "can only apply to an output, or to an input in a non-vertex stage\n", "invariant", ""); - } -} - -// -// Updating default qualifier for the case of a declaration with just a qualifier, -// no type, block, or identifier. -// -void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, const TPublicType& publicType) -{ - if (publicType.shaderQualifiers.vertices != TQualifier::layoutNotSet) { - assert(language == EShLangTessControl || language == EShLangGeometry); - const char* id = (language == EShLangTessControl) ? "vertices" : "max_vertices"; - - if (publicType.qualifier.storage != EvqVaryingOut) - error(loc, "can only apply to 'out'", id, ""); - if (! intermediate.setVertices(publicType.shaderQualifiers.vertices)) - error(loc, "cannot change previously set layout value", id, ""); - - if (language == EShLangTessControl) - checkIoArraysConsistency(loc); - } - if (publicType.shaderQualifiers.invocations != TQualifier::layoutNotSet) { - if (publicType.qualifier.storage != EvqVaryingIn) - error(loc, "can only apply to 'in'", "invocations", ""); - if (! intermediate.setInvocations(publicType.shaderQualifiers.invocations)) - error(loc, "cannot change previously set layout value", "invocations", ""); - } - if (publicType.shaderQualifiers.geometry != ElgNone) { - if (publicType.qualifier.storage == EvqVaryingIn) { - switch (publicType.shaderQualifiers.geometry) { - case ElgPoints: - case ElgLines: - case ElgLinesAdjacency: - case ElgTriangles: - case ElgTrianglesAdjacency: - case ElgQuads: - case ElgIsolines: - if (intermediate.setInputPrimitive(publicType.shaderQualifiers.geometry)) { - if (language == EShLangGeometry) - checkIoArraysConsistency(loc); - } else - error(loc, "cannot change previously set input primitive", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry), ""); - break; - default: - error(loc, "cannot apply to input", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry), ""); - } - } else if (publicType.qualifier.storage == EvqVaryingOut) { - switch (publicType.shaderQualifiers.geometry) { - case ElgPoints: - case ElgLineStrip: - case ElgTriangleStrip: - if (! intermediate.setOutputPrimitive(publicType.shaderQualifiers.geometry)) - error(loc, "cannot change previously set output primitive", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry), ""); - break; - default: - error(loc, "cannot apply to 'out'", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry), ""); - } - } else - error(loc, "cannot apply to:", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry), GetStorageQualifierString(publicType.qualifier.storage)); - } - if (publicType.shaderQualifiers.spacing != EvsNone) { - if (publicType.qualifier.storage == EvqVaryingIn) { - if (! intermediate.setVertexSpacing(publicType.shaderQualifiers.spacing)) - error(loc, "cannot change previously set vertex spacing", TQualifier::getVertexSpacingString(publicType.shaderQualifiers.spacing), ""); - } else - error(loc, "can only apply to 'in'", TQualifier::getVertexSpacingString(publicType.shaderQualifiers.spacing), ""); - } - if (publicType.shaderQualifiers.order != EvoNone) { - if (publicType.qualifier.storage == EvqVaryingIn) { - if (! intermediate.setVertexOrder(publicType.shaderQualifiers.order)) - error(loc, "cannot change previously set vertex order", TQualifier::getVertexOrderString(publicType.shaderQualifiers.order), ""); - } else - error(loc, "can only apply to 'in'", TQualifier::getVertexOrderString(publicType.shaderQualifiers.order), ""); - } - if (publicType.shaderQualifiers.pointMode) { - if (publicType.qualifier.storage == EvqVaryingIn) - intermediate.setPointMode(); - else - error(loc, "can only apply to 'in'", "point_mode", ""); - } - for (int i = 0; i < 3; ++i) { - if (publicType.shaderQualifiers.localSize[i] > 1) { - if (publicType.qualifier.storage == EvqVaryingIn) { - if (! intermediate.setLocalSize(i, publicType.shaderQualifiers.localSize[i])) - error(loc, "cannot change previously set size", "local_size", ""); - else { - int max = 0; - switch (i) { - case 0: max = resources.maxComputeWorkGroupSizeX; break; - case 1: max = resources.maxComputeWorkGroupSizeY; break; - case 2: max = resources.maxComputeWorkGroupSizeZ; break; - default: break; - } - if (intermediate.getLocalSize(i) > (unsigned int)max) - error(loc, "too large; see gl_MaxComputeWorkGroupSize", "local_size", ""); - - // Fix the existing constant gl_WorkGroupSize with this new information. - TVariable* workGroupSize = getEditableVariable("gl_WorkGroupSize"); - if (workGroupSize != nullptr) - workGroupSize->getWritableConstArray()[i].setUConst(intermediate.getLocalSize(i)); - } - } else - error(loc, "can only apply to 'in'", "local_size", ""); - } - if (publicType.shaderQualifiers.localSizeSpecId[i] != TQualifier::layoutNotSet) { - if (publicType.qualifier.storage == EvqVaryingIn) { - if (! intermediate.setLocalSizeSpecId(i, publicType.shaderQualifiers.localSizeSpecId[i])) - error(loc, "cannot change previously set size", "local_size", ""); - } else - error(loc, "can only apply to 'in'", "local_size id", ""); - // Set the workgroup built-in variable as a specialization constant - TVariable* workGroupSize = getEditableVariable("gl_WorkGroupSize"); - if (workGroupSize != nullptr) - workGroupSize->getWritableType().getQualifier().specConstant = true; - } - } - if (publicType.shaderQualifiers.earlyFragmentTests) { - if (publicType.qualifier.storage == EvqVaryingIn) - intermediate.setEarlyFragmentTests(); - else - error(loc, "can only apply to 'in'", "early_fragment_tests", ""); - } - if (publicType.shaderQualifiers.postDepthCoverage) { - if (publicType.qualifier.storage == EvqVaryingIn) - intermediate.setPostDepthCoverage(); - else - error(loc, "can only apply to 'in'", "post_coverage_coverage", ""); - } - if (publicType.shaderQualifiers.blendEquation) { - if (publicType.qualifier.storage != EvqVaryingOut) - error(loc, "can only apply to 'out'", "blend equation", ""); - } - - const TQualifier& qualifier = publicType.qualifier; - - if (qualifier.isAuxiliary() || - qualifier.isMemory() || - qualifier.isInterpolation() || - qualifier.precision != EpqNone) - error(loc, "cannot use auxiliary, memory, interpolation, or precision qualifier in a default qualifier declaration (declaration with no type)", "qualifier", ""); - // "The offset qualifier can only be used on block members of blocks..." - // "The align qualifier can only be used on blocks or block members..." - if (qualifier.hasOffset() || - qualifier.hasAlign()) - error(loc, "cannot use offset or align qualifiers in a default qualifier declaration (declaration with no type)", "layout qualifier", ""); - - layoutQualifierCheck(loc, qualifier); - - switch (qualifier.storage) { - case EvqUniform: - if (qualifier.hasMatrix()) - globalUniformDefaults.layoutMatrix = qualifier.layoutMatrix; - if (qualifier.hasPacking()) - globalUniformDefaults.layoutPacking = qualifier.layoutPacking; - break; - case EvqBuffer: - if (qualifier.hasMatrix()) - globalBufferDefaults.layoutMatrix = qualifier.layoutMatrix; - if (qualifier.hasPacking()) - globalBufferDefaults.layoutPacking = qualifier.layoutPacking; - break; - case EvqVaryingIn: - break; - case EvqVaryingOut: - if (qualifier.hasStream()) - globalOutputDefaults.layoutStream = qualifier.layoutStream; - if (qualifier.hasXfbBuffer()) - globalOutputDefaults.layoutXfbBuffer = qualifier.layoutXfbBuffer; - if (globalOutputDefaults.hasXfbBuffer() && qualifier.hasXfbStride()) { - if (! intermediate.setXfbBufferStride(globalOutputDefaults.layoutXfbBuffer, qualifier.layoutXfbStride)) - error(loc, "all stride settings must match for xfb buffer", "xfb_stride", "%d", qualifier.layoutXfbBuffer); - } - break; - default: - error(loc, "default qualifier requires 'uniform', 'buffer', 'in', or 'out' storage qualification", "", ""); - return; - } - - if (qualifier.hasBinding()) - error(loc, "cannot declare a default, include a type or full declaration", "binding", ""); - if (qualifier.hasAnyLocation()) - error(loc, "cannot declare a default, use a full declaration", "location/component/index", ""); - if (qualifier.hasXfbOffset()) - error(loc, "cannot declare a default, use a full declaration", "xfb_offset", ""); - if (qualifier.layoutPushConstant) - error(loc, "cannot declare a default, can only be used on a block", "push_constant", ""); - if (qualifier.hasSpecConstantId()) - error(loc, "cannot declare a default, can only be used on a scalar", "constant_id", ""); -} - -// -// Take the sequence of statements that has been built up since the last case/default, -// put it on the list of top-level nodes for the current (inner-most) switch statement, -// and follow that by the case/default we are on now. (See switch topology comment on -// TIntermSwitch.) -// -void TParseContext::wrapupSwitchSubsequence(TIntermAggregate* statements, TIntermNode* branchNode) -{ - TIntermSequence* switchSequence = switchSequenceStack.back(); - - if (statements) { - if (switchSequence->size() == 0) - error(statements->getLoc(), "cannot have statements before first case/default label", "switch", ""); - statements->setOperator(EOpSequence); - switchSequence->push_back(statements); - } - if (branchNode) { - // check all previous cases for the same label (or both are 'default') - for (unsigned int s = 0; s < switchSequence->size(); ++s) { - TIntermBranch* prevBranch = (*switchSequence)[s]->getAsBranchNode(); - if (prevBranch) { - TIntermTyped* prevExpression = prevBranch->getExpression(); - TIntermTyped* newExpression = branchNode->getAsBranchNode()->getExpression(); - if (prevExpression == nullptr && newExpression == nullptr) - error(branchNode->getLoc(), "duplicate label", "default", ""); - else if (prevExpression != nullptr && - newExpression != nullptr && - prevExpression->getAsConstantUnion() && - newExpression->getAsConstantUnion() && - prevExpression->getAsConstantUnion()->getConstArray()[0].getIConst() == - newExpression->getAsConstantUnion()->getConstArray()[0].getIConst()) - error(branchNode->getLoc(), "duplicated value", "case", ""); - } - } - switchSequence->push_back(branchNode); - } -} - -// -// Turn the top-level node sequence built up of wrapupSwitchSubsequence9) -// into a switch node. -// -TIntermNode* TParseContext::addSwitch(const TSourceLoc& loc, TIntermTyped* expression, TIntermAggregate* lastStatements) -{ - profileRequires(loc, EEsProfile, 300, nullptr, "switch statements"); - profileRequires(loc, ENoProfile, 130, nullptr, "switch statements"); - - wrapupSwitchSubsequence(lastStatements, nullptr); - - if (expression == nullptr || - (expression->getBasicType() != EbtInt && expression->getBasicType() != EbtUint) || - expression->getType().isArray() || expression->getType().isMatrix() || expression->getType().isVector()) - error(loc, "condition must be a scalar integer expression", "switch", ""); - - // If there is nothing to do, drop the switch but still execute the expression - TIntermSequence* switchSequence = switchSequenceStack.back(); - if (switchSequence->size() == 0) - return expression; - - if (lastStatements == nullptr) { - // This was originally an ERRROR, because early versions of the specification said - // "it is an error to have no statement between a label and the end of the switch statement." - // The specifications were updated to remove this (being ill-defined what a "statement" was), - // so, this became a warning. However, 3.0 tests still check for the error. - if (profile == EEsProfile && version <= 300 && ! relaxedErrors()) - error(loc, "last case/default label not followed by statements", "switch", ""); - else - warn(loc, "last case/default label not followed by statements", "switch", ""); - - // emulate a break for error recovery - lastStatements = intermediate.makeAggregate(intermediate.addBranch(EOpBreak, loc)); - lastStatements->setOperator(EOpSequence); - switchSequence->push_back(lastStatements); - } - - TIntermAggregate* body = new TIntermAggregate(EOpSequence); - body->getSequence() = *switchSequenceStack.back(); - body->setLoc(loc); - - TIntermSwitch* switchNode = new TIntermSwitch(expression, body); - switchNode->setLoc(loc); - - return switchNode; -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/ParseHelper.h b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/ParseHelper.h deleted file mode 100644 index 0d929789..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/ParseHelper.h +++ /dev/null @@ -1,490 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2012-2013 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -// -// This header defines a two-level parse-helper hierarchy, derived from -// TParseVersions: -// - TParseContextBase: sharable across multiple parsers -// - TParseContext: GLSL specific helper -// - -#ifndef _PARSER_HELPER_INCLUDED_ -#define _PARSER_HELPER_INCLUDED_ - -#include "parseVersions.h" -#include "../Include/ShHandle.h" -#include "SymbolTable.h" -#include "localintermediate.h" -#include "Scan.h" -#include -#include - -namespace glslang { - -struct TPragma { - TPragma(bool o, bool d) : optimize(o), debug(d) { } - bool optimize; - bool debug; - TPragmaTable pragmaTable; -}; - -class TScanContext; -class TPpContext; - -typedef std::set TIdSetType; - -// -// Sharable code (as well as what's in TParseVersions) across -// parse helpers. -// -class TParseContextBase : public TParseVersions { -public: - TParseContextBase(TSymbolTable& symbolTable, TIntermediate& interm, bool parsingBuiltins, int version, - EProfile profile, const SpvVersion& spvVersion, EShLanguage language, - TInfoSink& infoSink, bool forwardCompatible, EShMessages messages, - const TString* entryPoint = nullptr) - : TParseVersions(interm, version, profile, spvVersion, language, infoSink, forwardCompatible, messages), - scopeMangler("::"), - symbolTable(symbolTable), - statementNestingLevel(0), loopNestingLevel(0), structNestingLevel(0), controlFlowNestingLevel(0), - postEntryPointReturn(false), - contextPragma(true, false), - parsingBuiltins(parsingBuiltins), scanContext(nullptr), ppContext(nullptr), - limits(resources.limits), - globalUniformBlock(nullptr), - globalUniformBinding(TQualifier::layoutBindingEnd), - globalUniformSet(TQualifier::layoutSetEnd) - { - if (entryPoint != nullptr) - sourceEntryPointName = *entryPoint; - } - virtual ~TParseContextBase() { } - - virtual void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...); - virtual void C_DECL warn(const TSourceLoc&, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...); - virtual void C_DECL ppError(const TSourceLoc&, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...); - virtual void C_DECL ppWarn(const TSourceLoc&, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...); - - virtual void setLimits(const TBuiltInResource&) = 0; - - void checkIndex(const TSourceLoc&, const TType&, int& index); - - EShLanguage getLanguage() const { return language; } - void setScanContext(TScanContext* c) { scanContext = c; } - TScanContext* getScanContext() const { return scanContext; } - void setPpContext(TPpContext* c) { ppContext = c; } - TPpContext* getPpContext() const { return ppContext; } - - virtual void setLineCallback(const std::function& func) { lineCallback = func; } - virtual void setExtensionCallback(const std::function& func) { extensionCallback = func; } - virtual void setVersionCallback(const std::function& func) { versionCallback = func; } - virtual void setPragmaCallback(const std::function&)>& func) { pragmaCallback = func; } - virtual void setErrorCallback(const std::function& func) { errorCallback = func; } - - virtual void reservedPpErrorCheck(const TSourceLoc&, const char* name, const char* op) = 0; - virtual bool lineContinuationCheck(const TSourceLoc&, bool endOfComment) = 0; - virtual bool lineDirectiveShouldSetNextLine() const = 0; - virtual void handlePragma(const TSourceLoc&, const TVector&) = 0; - - virtual bool parseShaderStrings(TPpContext&, TInputScanner& input, bool versionWillBeError = false) = 0; - - virtual void notifyVersion(int line, int version, const char* type_string) - { - if (versionCallback) - versionCallback(line, version, type_string); - } - virtual void notifyErrorDirective(int line, const char* error_message) - { - if (errorCallback) - errorCallback(line, error_message); - } - virtual void notifyLineDirective(int curLineNo, int newLineNo, bool hasSource, int sourceNum, const char* sourceName) - { - if (lineCallback) - lineCallback(curLineNo, newLineNo, hasSource, sourceNum, sourceName); - } - virtual void notifyExtensionDirective(int line, const char* extension, const char* behavior) - { - if (extensionCallback) - extensionCallback(line, extension, behavior); - } - - // Manage the global uniform block (default uniforms in GLSL, $Global in HLSL) - virtual void growGlobalUniformBlock(const TSourceLoc&, TType&, const TString& memberName, TTypeList* typeList = nullptr); - - // Potentially rename shader entry point function - void renameShaderFunction(TString*& name) const - { - // Replace the entry point name given in the shader with the real entry point name, - // if there is a substitution. - if (name != nullptr && *name == sourceEntryPointName && intermediate.getEntryPointName().size() > 0) - name = NewPoolTString(intermediate.getEntryPointName().c_str()); - } - - virtual bool lValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*); - virtual void rValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*); - - const char* const scopeMangler; - - // Basic parsing state, easily accessible to the grammar - - TSymbolTable& symbolTable; // symbol table that goes with the current language, version, and profile - int statementNestingLevel; // 0 if outside all flow control or compound statements - int loopNestingLevel; // 0 if outside all loops - int structNestingLevel; // 0 if outside blocks and structures - int controlFlowNestingLevel; // 0 if outside all flow control - const TType* currentFunctionType; // the return type of the function that's currently being parsed - bool functionReturnsValue; // true if a non-void function has a return - // if inside a function, true if the function is the entry point and this is after a return statement - bool postEntryPointReturn; - // case, node, case, case, node, ...; ensure only one node between cases; stack of them for nesting - TList switchSequenceStack; - // the statementNestingLevel the current switch statement is at, which must match the level of its case statements - TList switchLevel; - struct TPragma contextPragma; - -protected: - TParseContextBase(TParseContextBase&); - TParseContextBase& operator=(TParseContextBase&); - - const bool parsingBuiltins; // true if parsing built-in symbols/functions - TVector linkageSymbols; // these need to be transferred to 'linkage', after all editing is done - TScanContext* scanContext; - TPpContext* ppContext; - TBuiltInResource resources; - TLimits& limits; - TString sourceEntryPointName; - - // These, if set, will be called when a line, pragma ... is preprocessed. - // They will be called with any parameters to the original directive. - std::function lineCallback; - std::function&)> pragmaCallback; - std::function versionCallback; - std::function extensionCallback; - std::function errorCallback; - - // see implementation for detail - const TFunction* selectFunction(const TVector, const TFunction&, - std::function, - std::function, - /* output */ bool& tie); - - virtual void parseSwizzleSelector(const TSourceLoc&, const TString&, int size, - TSwizzleSelectors&); - - // Manage the global uniform block (default uniforms in GLSL, $Global in HLSL) - TVariable* globalUniformBlock; // the actual block, inserted into the symbol table - unsigned int globalUniformBinding; // the block's binding number - unsigned int globalUniformSet; // the block's set number - int firstNewMember; // the index of the first member not yet inserted into the symbol table - // override this to set the language-specific name - virtual const char* getGlobalUniformBlockName() const { return ""; } - virtual void setUniformBlockDefaults(TType&) const { } - virtual void finalizeGlobalUniformBlockLayout(TVariable&) { } - virtual void outputMessage(const TSourceLoc&, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, TPrefixType prefix, - va_list args); - virtual void trackLinkage(TSymbol& symbol); - virtual void makeEditable(TSymbol*&); - virtual TVariable* getEditableVariable(const char* name); - virtual void finish(); -}; - -// -// Manage the state for when to respect precision qualifiers and when to warn about -// the defaults being different than might be expected. -// -class TPrecisionManager { -public: - TPrecisionManager() : obey(false), warn(false), explicitIntDefault(false), explicitFloatDefault(false){ } - virtual ~TPrecisionManager() {} - - void respectPrecisionQualifiers() { obey = true; } - bool respectingPrecisionQualifiers() const { return obey; } - bool shouldWarnAboutDefaults() const { return warn; } - void defaultWarningGiven() { warn = false; } - void warnAboutDefaults() { warn = true; } - void explicitIntDefaultSeen() - { - explicitIntDefault = true; - if (explicitFloatDefault) - warn = false; - } - void explicitFloatDefaultSeen() - { - explicitFloatDefault = true; - if (explicitIntDefault) - warn = false; - } - -protected: - bool obey; // respect precision qualifiers - bool warn; // need to give a warning about the defaults - bool explicitIntDefault; // user set the default for int/uint - bool explicitFloatDefault; // user set the default for float -}; - -// -// GLSL-specific parse helper. Should have GLSL in the name, but that's -// too big of a change for comparing branches at the moment, and perhaps -// impacts downstream consumers as well. -// -class TParseContext : public TParseContextBase { -public: - TParseContext(TSymbolTable&, TIntermediate&, bool parsingBuiltins, int version, EProfile, const SpvVersion& spvVersion, EShLanguage, TInfoSink&, - bool forwardCompatible = false, EShMessages messages = EShMsgDefault, - const TString* entryPoint = nullptr); - virtual ~TParseContext(); - - bool obeyPrecisionQualifiers() const { return precisionManager.respectingPrecisionQualifiers(); }; - void setPrecisionDefaults(); - - void setLimits(const TBuiltInResource&) override; - bool parseShaderStrings(TPpContext&, TInputScanner& input, bool versionWillBeError = false) override; - void parserError(const char* s); // for bison's yyerror - - void reservedErrorCheck(const TSourceLoc&, const TString&); - void reservedPpErrorCheck(const TSourceLoc&, const char* name, const char* op) override; - bool lineContinuationCheck(const TSourceLoc&, bool endOfComment) override; - bool lineDirectiveShouldSetNextLine() const override; - bool builtInName(const TString&); - - void handlePragma(const TSourceLoc&, const TVector&) override; - TIntermTyped* handleVariable(const TSourceLoc&, TSymbol* symbol, const TString* string); - TIntermTyped* handleBracketDereference(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index); - void handleIndexLimits(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index); - - void makeEditable(TSymbol*&) override; - bool isIoResizeArray(const TType&) const; - void fixIoArraySize(const TSourceLoc&, TType&); - void ioArrayCheck(const TSourceLoc&, const TType&, const TString& identifier); - void handleIoResizeArrayAccess(const TSourceLoc&, TIntermTyped* base); - void checkIoArraysConsistency(const TSourceLoc&, bool tailOnly = false); - int getIoArrayImplicitSize() const; - void checkIoArrayConsistency(const TSourceLoc&, int requiredSize, const char* feature, TType&, const TString&); - - TIntermTyped* handleBinaryMath(const TSourceLoc&, const char* str, TOperator op, TIntermTyped* left, TIntermTyped* right); - TIntermTyped* handleUnaryMath(const TSourceLoc&, const char* str, TOperator op, TIntermTyped* childNode); - TIntermTyped* handleDotDereference(const TSourceLoc&, TIntermTyped* base, const TString& field); - void blockMemberExtensionCheck(const TSourceLoc&, const TIntermTyped* base, const TString& field); - TFunction* handleFunctionDeclarator(const TSourceLoc&, TFunction& function, bool prototype); - TIntermAggregate* handleFunctionDefinition(const TSourceLoc&, TFunction&); - TIntermTyped* handleFunctionCall(const TSourceLoc&, TFunction*, TIntermNode*); - TIntermTyped* handleBuiltInFunctionCall(TSourceLoc, TIntermNode& arguments, const TFunction& function); - void computeBuiltinPrecisions(TIntermTyped&, const TFunction&); - TIntermNode* handleReturnValue(const TSourceLoc&, TIntermTyped*); - void checkLocation(const TSourceLoc&, TOperator); - TIntermTyped* handleLengthMethod(const TSourceLoc&, TFunction*, TIntermNode*); - void addInputArgumentConversions(const TFunction&, TIntermNode*&) const; - TIntermTyped* addOutputArgumentConversions(const TFunction&, TIntermAggregate&) const; - void builtInOpCheck(const TSourceLoc&, const TFunction&, TIntermOperator&); - void nonOpBuiltInCheck(const TSourceLoc&, const TFunction&, TIntermAggregate&); - void userFunctionCallCheck(const TSourceLoc&, TIntermAggregate&); - void samplerConstructorLocationCheck(const TSourceLoc&, const char* token, TIntermNode*); - TFunction* handleConstructorCall(const TSourceLoc&, const TPublicType&); - void handlePrecisionQualifier(const TSourceLoc&, TQualifier&, TPrecisionQualifier); - void checkPrecisionQualifier(const TSourceLoc&, TPrecisionQualifier); - - void assignError(const TSourceLoc&, const char* op, TString left, TString right); - void unaryOpError(const TSourceLoc&, const char* op, TString operand); - void binaryOpError(const TSourceLoc&, const char* op, TString left, TString right); - void variableCheck(TIntermTyped*& nodePtr); - bool lValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*) override; - void rValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*) override; - void constantValueCheck(TIntermTyped* node, const char* token); - void integerCheck(const TIntermTyped* node, const char* token); - void globalCheck(const TSourceLoc&, const char* token); - bool constructorError(const TSourceLoc&, TIntermNode*, TFunction&, TOperator, TType&); - bool constructorTextureSamplerError(const TSourceLoc&, const TFunction&); - void arraySizeCheck(const TSourceLoc&, TIntermTyped* expr, TArraySize&); - bool arrayQualifierError(const TSourceLoc&, const TQualifier&); - bool arrayError(const TSourceLoc&, const TType&); - void arraySizeRequiredCheck(const TSourceLoc&, const TArraySizes&); - void structArrayCheck(const TSourceLoc&, const TType& structure); - void arraySizesCheck(const TSourceLoc&, const TQualifier&, TArraySizes*, bool initializer, bool lastMember); - void arrayOfArrayVersionCheck(const TSourceLoc&); - void arrayDimCheck(const TSourceLoc&, const TArraySizes* sizes1, const TArraySizes* sizes2); - void arrayDimCheck(const TSourceLoc&, const TType*, const TArraySizes*); - void arrayDimMerge(TType& type, const TArraySizes* sizes); - bool voidErrorCheck(const TSourceLoc&, const TString&, TBasicType); - void boolCheck(const TSourceLoc&, const TIntermTyped*); - void boolCheck(const TSourceLoc&, const TPublicType&); - void samplerCheck(const TSourceLoc&, const TType&, const TString& identifier, TIntermTyped* initializer); - void atomicUintCheck(const TSourceLoc&, const TType&, const TString& identifier); - void transparentOpaqueCheck(const TSourceLoc&, const TType&, const TString& identifier); - void globalQualifierFixCheck(const TSourceLoc&, TQualifier&); - void globalQualifierTypeCheck(const TSourceLoc&, const TQualifier&, const TPublicType&); - bool structQualifierErrorCheck(const TSourceLoc&, const TPublicType& pType); - void mergeQualifiers(const TSourceLoc&, TQualifier& dst, const TQualifier& src, bool force); - void setDefaultPrecision(const TSourceLoc&, TPublicType&, TPrecisionQualifier); - int computeSamplerTypeIndex(TSampler&); - TPrecisionQualifier getDefaultPrecision(TPublicType&); - void precisionQualifierCheck(const TSourceLoc&, TBasicType, TQualifier&); - void parameterTypeCheck(const TSourceLoc&, TStorageQualifier qualifier, const TType& type); - bool containsFieldWithBasicType(const TType& type ,TBasicType basicType); - TSymbol* redeclareBuiltinVariable(const TSourceLoc&, const TString&, const TQualifier&, const TShaderQualifiers&); - void redeclareBuiltinBlock(const TSourceLoc&, TTypeList& typeList, const TString& blockName, const TString* instanceName, TArraySizes* arraySizes); - void paramCheckFix(const TSourceLoc&, const TStorageQualifier&, TType& type); - void paramCheckFix(const TSourceLoc&, const TQualifier&, TType& type); - void nestedBlockCheck(const TSourceLoc&); - void nestedStructCheck(const TSourceLoc&); - void arrayObjectCheck(const TSourceLoc&, const TType&, const char* op); - void opaqueCheck(const TSourceLoc&, const TType&, const char* op); - void specializationCheck(const TSourceLoc&, const TType&, const char* op); - void structTypeCheck(const TSourceLoc&, TPublicType&); - void inductiveLoopCheck(const TSourceLoc&, TIntermNode* init, TIntermLoop* loop); - void arrayLimitCheck(const TSourceLoc&, const TString&, int size); - void limitCheck(const TSourceLoc&, int value, const char* limit, const char* feature); - - void inductiveLoopBodyCheck(TIntermNode*, int loopIndexId, TSymbolTable&); - void constantIndexExpressionCheck(TIntermNode*); - - void setLayoutQualifier(const TSourceLoc&, TPublicType&, TString&); - void setLayoutQualifier(const TSourceLoc&, TPublicType&, TString&, const TIntermTyped*); - void mergeObjectLayoutQualifiers(TQualifier& dest, const TQualifier& src, bool inheritOnly); - void layoutObjectCheck(const TSourceLoc&, const TSymbol&); - void layoutMemberLocationArrayCheck(const TSourceLoc&, bool memberWithLocation, TArraySizes* arraySizes); - void layoutTypeCheck(const TSourceLoc&, const TType&); - void layoutQualifierCheck(const TSourceLoc&, const TQualifier&); - void checkNoShaderLayouts(const TSourceLoc&, const TShaderQualifiers&); - void fixOffset(const TSourceLoc&, TSymbol&); - - const TFunction* findFunction(const TSourceLoc& loc, const TFunction& call, bool& builtIn); - const TFunction* findFunctionExact(const TSourceLoc& loc, const TFunction& call, bool& builtIn); - const TFunction* findFunction120(const TSourceLoc& loc, const TFunction& call, bool& builtIn); - const TFunction* findFunction400(const TSourceLoc& loc, const TFunction& call, bool& builtIn); - void declareTypeDefaults(const TSourceLoc&, const TPublicType&); - TIntermNode* declareVariable(const TSourceLoc&, TString& identifier, const TPublicType&, TArraySizes* typeArray = 0, TIntermTyped* initializer = 0); - TIntermTyped* addConstructor(const TSourceLoc&, TIntermNode*, const TType&); - TIntermTyped* constructAggregate(TIntermNode*, const TType&, int, const TSourceLoc&); - TIntermTyped* constructBuiltIn(const TType&, TOperator, TIntermTyped*, const TSourceLoc&, bool subset); - void declareBlock(const TSourceLoc&, TTypeList& typeList, const TString* instanceName = 0, TArraySizes* arraySizes = 0); - void blockStageIoCheck(const TSourceLoc&, const TQualifier&); - void blockQualifierCheck(const TSourceLoc&, const TQualifier&, bool instanceName); - void fixBlockLocations(const TSourceLoc&, TQualifier&, TTypeList&, bool memberWithLocation, bool memberWithoutLocation); - void fixBlockXfbOffsets(TQualifier&, TTypeList&); - void fixBlockUniformOffsets(TQualifier&, TTypeList&); - void addQualifierToExisting(const TSourceLoc&, TQualifier, const TString& identifier); - void addQualifierToExisting(const TSourceLoc&, TQualifier, TIdentifierList&); - void invariantCheck(const TSourceLoc&, const TQualifier&); - void updateStandaloneQualifierDefaults(const TSourceLoc&, const TPublicType&); - void wrapupSwitchSubsequence(TIntermAggregate* statements, TIntermNode* branchNode); - TIntermNode* addSwitch(const TSourceLoc&, TIntermTyped* expression, TIntermAggregate* body); - - void updateImplicitArraySize(const TSourceLoc&, TIntermNode*, int index); - -protected: - void nonInitConstCheck(const TSourceLoc&, TString& identifier, TType& type); - void inheritGlobalDefaults(TQualifier& dst) const; - TVariable* makeInternalVariable(const char* name, const TType&) const; - TVariable* declareNonArray(const TSourceLoc&, const TString& identifier, const TType&); - void declareArray(const TSourceLoc&, const TString& identifier, const TType&, TSymbol*&); - TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable); - TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer); - void finish() override; - -public: - // - // Generally, bison productions, the scanner, and the PP need read/write access to these; just give them direct access - // - - // Current state of parsing - bool inMain; // if inside a function, true if the function is main - const TString* blockName; - TQualifier currentBlockQualifier; - TPrecisionQualifier defaultPrecision[EbtNumTypes]; - TBuiltInResource resources; - TLimits& limits; - -protected: - TParseContext(TParseContext&); - TParseContext& operator=(TParseContext&); - - static const int maxSamplerIndex = EsdNumDims * (EbtNumTypes * (2 * 2 * 2 * 2 * 2)); // see computeSamplerTypeIndex() - TPrecisionQualifier defaultSamplerPrecision[maxSamplerIndex]; - TPrecisionManager precisionManager; - TQualifier globalBufferDefaults; - TQualifier globalUniformDefaults; - TQualifier globalInputDefaults; - TQualifier globalOutputDefaults; - int* atomicUintOffsets; // to become an array of the right size to hold an offset per binding point - TString currentCaller; // name of last function body entered (not valid when at global scope) - TIdSetType inductiveLoopIds; - bool anyIndexLimits; - TVector needsIndexLimitationChecking; - - // - // Geometry shader input arrays: - // - array sizing is based on input primitive and/or explicit size - // - // Tessellation control output arrays: - // - array sizing is based on output layout(vertices=...) and/or explicit size - // - // Both: - // - array sizing is retroactive - // - built-in block redeclarations interact with this - // - // Design: - // - use a per-context "resize-list", a list of symbols whose array sizes - // can be fixed - // - // - the resize-list starts empty at beginning of user-shader compilation, it does - // not have built-ins in it - // - // - on built-in array use: copyUp() symbol and add it to the resize-list - // - // - on user array declaration: add it to the resize-list - // - // - on block redeclaration: copyUp() symbol and add it to the resize-list - // * note, that appropriately gives an error if redeclaring a block that - // was already used and hence already copied-up - // - // - on seeing a layout declaration that sizes the array, fix everything in the - // resize-list, giving errors for mismatch - // - // - on seeing an array size declaration, give errors on mismatch between it and previous - // array-sizing declarations - // - TVector ioArraySymbolResizeList; -}; - -} // end namespace glslang - -#endif // _PARSER_HELPER_INCLUDED_ diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/PoolAlloc.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/PoolAlloc.cpp deleted file mode 100644 index 84c40f4e..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/PoolAlloc.cpp +++ /dev/null @@ -1,315 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#include "../Include/Common.h" -#include "../Include/PoolAlloc.h" - -#include "../Include/InitializeGlobals.h" -#include "../OSDependent/osinclude.h" - -namespace glslang { - -// Process-wide TLS index -OS_TLSIndex PoolIndex; - -// Return the thread-specific current pool. -TPoolAllocator& GetThreadPoolAllocator() -{ - return *static_cast(OS_GetTLSValue(PoolIndex)); -} - -// Set the thread-specific current pool. -void SetThreadPoolAllocator(TPoolAllocator* poolAllocator) -{ - OS_SetTLSValue(PoolIndex, poolAllocator); -} - -// Process-wide set up of the TLS pool storage. -bool InitializePoolIndex() -{ - // Allocate a TLS index. - if ((PoolIndex = OS_AllocTLSIndex()) == OS_INVALID_TLS_INDEX) - return false; - - return true; -} - -// -// Implement the functionality of the TPoolAllocator class, which -// is documented in PoolAlloc.h. -// -TPoolAllocator::TPoolAllocator(int growthIncrement, int allocationAlignment) : - pageSize(growthIncrement), - alignment(allocationAlignment), - freeList(nullptr), - inUseList(nullptr), - numCalls(0) -{ - // - // Don't allow page sizes we know are smaller than all common - // OS page sizes. - // - if (pageSize < 4*1024) - pageSize = 4*1024; - - // - // A large currentPageOffset indicates a new page needs to - // be obtained to allocate memory. - // - currentPageOffset = pageSize; - - // - // Adjust alignment to be at least pointer aligned and - // power of 2. - // - size_t minAlign = sizeof(void*); - alignment &= ~(minAlign - 1); - if (alignment < minAlign) - alignment = minAlign; - size_t a = 1; - while (a < alignment) - a <<= 1; - alignment = a; - alignmentMask = a - 1; - - // - // Align header skip - // - headerSkip = minAlign; - if (headerSkip < sizeof(tHeader)) { - headerSkip = (sizeof(tHeader) + alignmentMask) & ~alignmentMask; - } - - push(); -} - -TPoolAllocator::~TPoolAllocator() -{ - while (inUseList) { - tHeader* next = inUseList->nextPage; - inUseList->~tHeader(); - delete [] reinterpret_cast(inUseList); - inUseList = next; - } - - // - // Always delete the free list memory - it can't be being - // (correctly) referenced, whether the pool allocator was - // global or not. We should not check the guard blocks - // here, because we did it already when the block was - // placed into the free list. - // - while (freeList) { - tHeader* next = freeList->nextPage; - delete [] reinterpret_cast(freeList); - freeList = next; - } -} - -const unsigned char TAllocation::guardBlockBeginVal = 0xfb; -const unsigned char TAllocation::guardBlockEndVal = 0xfe; -const unsigned char TAllocation::userDataFill = 0xcd; - -# ifdef GUARD_BLOCKS - const size_t TAllocation::guardBlockSize = 16; -# else - const size_t TAllocation::guardBlockSize = 0; -# endif - -// -// Check a single guard block for damage -// -#ifdef GUARD_BLOCKS -void TAllocation::checkGuardBlock(unsigned char* blockMem, unsigned char val, const char* locText) const -#else -void TAllocation::checkGuardBlock(unsigned char*, unsigned char, const char*) const -#endif -{ -#ifdef GUARD_BLOCKS - for (size_t x = 0; x < guardBlockSize; x++) { - if (blockMem[x] != val) { - const int maxSize = 80; - char assertMsg[maxSize]; - - // We don't print the assert message. It's here just to be helpful. - snprintf(assertMsg, maxSize, "PoolAlloc: Damage %s %zu byte allocation at 0x%p\n", - locText, size, data()); - assert(0 && "PoolAlloc: Damage in guard block"); - } - } -#else - assert(guardBlockSize == 0); -#endif -} - -void TPoolAllocator::push() -{ - tAllocState state = { currentPageOffset, inUseList }; - - stack.push_back(state); - - // - // Indicate there is no current page to allocate from. - // - currentPageOffset = pageSize; -} - -// -// Do a mass-deallocation of all the individual allocations -// that have occurred since the last push(), or since the -// last pop(), or since the object's creation. -// -// The deallocated pages are saved for future allocations. -// -void TPoolAllocator::pop() -{ - if (stack.size() < 1) - return; - - tHeader* page = stack.back().page; - currentPageOffset = stack.back().offset; - - while (inUseList != page) { - tHeader* nextInUse = inUseList->nextPage; - size_t pageCount = inUseList->pageCount; - - // This technically ends the lifetime of the header as C++ object, - // but we will still control the memory and reuse it. - inUseList->~tHeader(); // currently, just a debug allocation checker - - if (pageCount > 1) { - delete [] reinterpret_cast(inUseList); - } else { - inUseList->nextPage = freeList; - freeList = inUseList; - } - inUseList = nextInUse; - } - - stack.pop_back(); -} - -// -// Do a mass-deallocation of all the individual allocations -// that have occurred. -// -void TPoolAllocator::popAll() -{ - while (stack.size() > 0) - pop(); -} - -void* TPoolAllocator::allocate(size_t numBytes) -{ - // If we are using guard blocks, all allocations are bracketed by - // them: [guardblock][allocation][guardblock]. numBytes is how - // much memory the caller asked for. allocationSize is the total - // size including guard blocks. In release build, - // guardBlockSize=0 and this all gets optimized away. - size_t allocationSize = TAllocation::allocationSize(numBytes); - - // - // Just keep some interesting statistics. - // - ++numCalls; - totalBytes += numBytes; - - // - // Do the allocation, most likely case first, for efficiency. - // This step could be moved to be inline sometime. - // - if (currentPageOffset + allocationSize <= pageSize) { - // - // Safe to allocate from currentPageOffset. - // - unsigned char* memory = reinterpret_cast(inUseList) + currentPageOffset; - currentPageOffset += allocationSize; - currentPageOffset = (currentPageOffset + alignmentMask) & ~alignmentMask; - - return initializeAllocation(inUseList, memory, numBytes); - } - - if (allocationSize + headerSkip > pageSize) { - // - // Do a multi-page allocation. Don't mix these with the others. - // The OS is efficient and allocating and free-ing multiple pages. - // - size_t numBytesToAlloc = allocationSize + headerSkip; - tHeader* memory = reinterpret_cast(::new char[numBytesToAlloc]); - if (memory == 0) - return 0; - - // Use placement-new to initialize header - new(memory) tHeader(inUseList, (numBytesToAlloc + pageSize - 1) / pageSize); - inUseList = memory; - - currentPageOffset = pageSize; // make next allocation come from a new page - - // No guard blocks for multi-page allocations (yet) - return reinterpret_cast(reinterpret_cast(memory) + headerSkip); - } - - // - // Need a simple page to allocate from. - // - tHeader* memory; - if (freeList) { - memory = freeList; - freeList = freeList->nextPage; - } else { - memory = reinterpret_cast(::new char[pageSize]); - if (memory == 0) - return 0; - } - - // Use placement-new to initialize header - new(memory) tHeader(inUseList, 1); - inUseList = memory; - - unsigned char* ret = reinterpret_cast(inUseList) + headerSkip; - currentPageOffset = (headerSkip + allocationSize + alignmentMask) & ~alignmentMask; - - return initializeAllocation(inUseList, ret, numBytes); -} - -// -// Check all allocations in a list for damage by calling check on each. -// -void TAllocation::checkAllocList() const -{ - for (const TAllocation* alloc = this; alloc != 0; alloc = alloc->prevAlloc) - alloc->check(); -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/RemoveTree.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/RemoveTree.cpp deleted file mode 100644 index 1d33bfd2..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/RemoveTree.cpp +++ /dev/null @@ -1,118 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2013 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#include "../Include/intermediate.h" -#include "RemoveTree.h" - -namespace glslang { - -// -// Code to recursively delete the intermediate tree. -// -struct TRemoveTraverser : TIntermTraverser { - TRemoveTraverser() : TIntermTraverser(false, false, true, false) {} - - virtual void visitSymbol(TIntermSymbol* node) - { - delete node; - } - - virtual bool visitBinary(TVisit /* visit*/ , TIntermBinary* node) - { - delete node; - - return true; - } - - virtual bool visitUnary(TVisit /* visit */, TIntermUnary* node) - { - delete node; - - return true; - } - - virtual bool visitAggregate(TVisit /* visit*/ , TIntermAggregate* node) - { - delete node; - - return true; - } - - virtual bool visitSelection(TVisit /* visit*/ , TIntermSelection* node) - { - delete node; - - return true; - } - - virtual bool visitSwitch(TVisit /* visit*/ , TIntermSwitch* node) - { - delete node; - - return true; - } - - virtual void visitConstantUnion(TIntermConstantUnion* node) - { - delete node; - } - - virtual bool visitLoop(TVisit /* visit*/ , TIntermLoop* node) - { - delete node; - - return true; - } - - virtual bool visitBranch(TVisit /* visit*/ , TIntermBranch* node) - { - delete node; - - return true; - } -}; - -// -// Entry point. -// -void RemoveAllTreeNodes(TIntermNode* root) -{ - TRemoveTraverser it; - - root->traverse(&it); -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/RemoveTree.h b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/RemoveTree.h deleted file mode 100644 index 1ed01562..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/RemoveTree.h +++ /dev/null @@ -1,41 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#pragma once - -namespace glslang { - -void RemoveAllTreeNodes(TIntermNode*); - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Scan.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Scan.cpp deleted file mode 100644 index df15a166..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Scan.cpp +++ /dev/null @@ -1,1460 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2013 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -// -// GLSL scanning, leveraging the scanning done by the preprocessor. -// - -#include -#include -#include - -#include "../Include/Types.h" -#include "SymbolTable.h" -#include "ParseHelper.h" -#include "glslang_tab.cpp.h" -#include "ScanContext.h" -#include "Scan.h" - -// preprocessor includes -#include "preprocessor/PpContext.h" -#include "preprocessor/PpTokens.h" - -// Required to avoid missing prototype warnings for some compilers -int yylex(YYSTYPE*, glslang::TParseContext&); - -namespace glslang { - -// read past any white space -void TInputScanner::consumeWhiteSpace(bool& foundNonSpaceTab) -{ - int c = peek(); // don't accidentally consume anything other than whitespace - while (c == ' ' || c == '\t' || c == '\r' || c == '\n') { - if (c == '\r' || c == '\n') - foundNonSpaceTab = true; - get(); - c = peek(); - } -} - -// return true if a comment was actually consumed -bool TInputScanner::consumeComment() -{ - if (peek() != '/') - return false; - - get(); // consume the '/' - int c = peek(); - if (c == '/') { - - // a '//' style comment - get(); // consume the second '/' - c = get(); - do { - while (c != EndOfInput && c != '\\' && c != '\r' && c != '\n') - c = get(); - - if (c == EndOfInput || c == '\r' || c == '\n') { - while (c == '\r' || c == '\n') - c = get(); - - // we reached the end of the comment - break; - } else { - // it's a '\', so we need to keep going, after skipping what's escaped - - // read the skipped character - c = get(); - - // if it's a two-character newline, skip both characters - if (c == '\r' && peek() == '\n') - get(); - c = get(); - } - } while (true); - - // put back the last non-comment character - if (c != EndOfInput) - unget(); - - return true; - } else if (c == '*') { - - // a '/*' style comment - get(); // consume the '*' - c = get(); - do { - while (c != EndOfInput && c != '*') - c = get(); - if (c == '*') { - c = get(); - if (c == '/') - break; // end of comment - // not end of comment - } else // end of input - break; - } while (true); - - return true; - } else { - // it's not a comment, put the '/' back - unget(); - - return false; - } -} - -// skip whitespace, then skip a comment, rinse, repeat -void TInputScanner::consumeWhitespaceComment(bool& foundNonSpaceTab) -{ - do { - consumeWhiteSpace(foundNonSpaceTab); - - // if not starting a comment now, then done - int c = peek(); - if (c != '/' || c == EndOfInput) - return; - - // skip potential comment - foundNonSpaceTab = true; - if (! consumeComment()) - return; - - } while (true); -} - -// Returns true if there was non-white space (e.g., a comment, newline) before the #version -// or no #version was found; otherwise, returns false. There is no error case, it always -// succeeds, but will leave version == 0 if no #version was found. -// -// Sets notFirstToken based on whether tokens (beyond white space and comments) -// appeared before the #version. -// -// N.B. does not attempt to leave input in any particular known state. The assumption -// is that scanning will start anew, following the rules for the chosen version/profile, -// and with a corresponding parsing context. -// -bool TInputScanner::scanVersion(int& version, EProfile& profile, bool& notFirstToken) -{ - // This function doesn't have to get all the semantics correct, - // just find the #version if there is a correct one present. - // The preprocessor will have the responsibility of getting all the semantics right. - - bool versionNotFirst = false; // means not first WRT comments and white space, nothing more - notFirstToken = false; // means not first WRT to real tokens - version = 0; // means not found - profile = ENoProfile; - - bool foundNonSpaceTab = false; - bool lookingInMiddle = false; - int c; - do { - if (lookingInMiddle) { - notFirstToken = true; - // make forward progress by finishing off the current line plus extra new lines - if (peek() == '\n' || peek() == '\r') { - while (peek() == '\n' || peek() == '\r') - get(); - } else - do { - c = get(); - } while (c != EndOfInput && c != '\n' && c != '\r'); - while (peek() == '\n' || peek() == '\r') - get(); - if (peek() == EndOfInput) - return true; - } - lookingInMiddle = true; - - // Nominal start, skipping the desktop allowed comments and white space, but tracking if - // something else was found for ES: - consumeWhitespaceComment(foundNonSpaceTab); - if (foundNonSpaceTab) - versionNotFirst = true; - - // "#" - if (get() != '#') { - versionNotFirst = true; - continue; - } - - // whitespace - do { - c = get(); - } while (c == ' ' || c == '\t'); - - // "version" - if ( c != 'v' || - get() != 'e' || - get() != 'r' || - get() != 's' || - get() != 'i' || - get() != 'o' || - get() != 'n') { - versionNotFirst = true; - continue; - } - - // whitespace - do { - c = get(); - } while (c == ' ' || c == '\t'); - - // version number - while (c >= '0' && c <= '9') { - version = 10 * version + (c - '0'); - c = get(); - } - if (version == 0) { - versionNotFirst = true; - continue; - } - - // whitespace - while (c == ' ' || c == '\t') - c = get(); - - // profile - const int maxProfileLength = 13; // not including any 0 - char profileString[maxProfileLength]; - int profileLength; - for (profileLength = 0; profileLength < maxProfileLength; ++profileLength) { - if (c == EndOfInput || c == ' ' || c == '\t' || c == '\n' || c == '\r') - break; - profileString[profileLength] = (char)c; - c = get(); - } - if (c != EndOfInput && c != ' ' && c != '\t' && c != '\n' && c != '\r') { - versionNotFirst = true; - continue; - } - - if (profileLength == 2 && strncmp(profileString, "es", profileLength) == 0) - profile = EEsProfile; - else if (profileLength == 4 && strncmp(profileString, "core", profileLength) == 0) - profile = ECoreProfile; - else if (profileLength == 13 && strncmp(profileString, "compatibility", profileLength) == 0) - profile = ECompatibilityProfile; - - return versionNotFirst; - } while (true); -} - -// Fill this in when doing glslang-level scanning, to hand back to the parser. -class TParserToken { -public: - explicit TParserToken(YYSTYPE& b) : sType(b) { } - - YYSTYPE& sType; -protected: - TParserToken(TParserToken&); - TParserToken& operator=(TParserToken&); -}; - -} // end namespace glslang - -// This is the function the glslang parser (i.e., bison) calls to get its next token -int yylex(YYSTYPE* glslangTokenDesc, glslang::TParseContext& parseContext) -{ - glslang::TParserToken token(*glslangTokenDesc); - - return parseContext.getScanContext()->tokenize(parseContext.getPpContext(), token); -} - -namespace { - -struct str_eq -{ - bool operator()(const char* lhs, const char* rhs) const - { - return strcmp(lhs, rhs) == 0; - } -}; - -struct str_hash -{ - size_t operator()(const char* str) const - { - // djb2 - unsigned long hash = 5381; - int c; - - while ((c = *str++) != 0) - hash = ((hash << 5) + hash) + c; - - return hash; - } -}; - -// A single global usable by all threads, by all versions, by all languages. -// After a single process-level initialization, this is read only and thread safe -std::unordered_map* KeywordMap = nullptr; -std::unordered_set* ReservedSet = nullptr; - -}; - -namespace glslang { - -void TScanContext::fillInKeywordMap() -{ - if (KeywordMap != nullptr) { - // this is really an error, as this should called only once per process - // but, the only risk is if two threads called simultaneously - return; - } - KeywordMap = new std::unordered_map; - - (*KeywordMap)["const"] = CONST; - (*KeywordMap)["uniform"] = UNIFORM; - (*KeywordMap)["in"] = IN; - (*KeywordMap)["out"] = OUT; - (*KeywordMap)["inout"] = INOUT; - (*KeywordMap)["struct"] = STRUCT; - (*KeywordMap)["break"] = BREAK; - (*KeywordMap)["continue"] = CONTINUE; - (*KeywordMap)["do"] = DO; - (*KeywordMap)["for"] = FOR; - (*KeywordMap)["while"] = WHILE; - (*KeywordMap)["switch"] = SWITCH; - (*KeywordMap)["case"] = CASE; - (*KeywordMap)["default"] = DEFAULT; - (*KeywordMap)["if"] = IF; - (*KeywordMap)["else"] = ELSE; - (*KeywordMap)["discard"] = DISCARD; - (*KeywordMap)["return"] = RETURN; - (*KeywordMap)["void"] = VOID; - (*KeywordMap)["bool"] = BOOL; - (*KeywordMap)["float"] = FLOAT; - (*KeywordMap)["int"] = INT; - (*KeywordMap)["bvec2"] = BVEC2; - (*KeywordMap)["bvec3"] = BVEC3; - (*KeywordMap)["bvec4"] = BVEC4; - (*KeywordMap)["vec2"] = VEC2; - (*KeywordMap)["vec3"] = VEC3; - (*KeywordMap)["vec4"] = VEC4; - (*KeywordMap)["ivec2"] = IVEC2; - (*KeywordMap)["ivec3"] = IVEC3; - (*KeywordMap)["ivec4"] = IVEC4; - (*KeywordMap)["mat2"] = MAT2; - (*KeywordMap)["mat3"] = MAT3; - (*KeywordMap)["mat4"] = MAT4; - (*KeywordMap)["true"] = BOOLCONSTANT; - (*KeywordMap)["false"] = BOOLCONSTANT; - (*KeywordMap)["attribute"] = ATTRIBUTE; - (*KeywordMap)["varying"] = VARYING; - (*KeywordMap)["buffer"] = BUFFER; - (*KeywordMap)["coherent"] = COHERENT; - (*KeywordMap)["restrict"] = RESTRICT; - (*KeywordMap)["readonly"] = READONLY; - (*KeywordMap)["writeonly"] = WRITEONLY; - (*KeywordMap)["atomic_uint"] = ATOMIC_UINT; - (*KeywordMap)["volatile"] = VOLATILE; - (*KeywordMap)["layout"] = LAYOUT; - (*KeywordMap)["shared"] = SHARED; - (*KeywordMap)["patch"] = PATCH; - (*KeywordMap)["sample"] = SAMPLE; - (*KeywordMap)["subroutine"] = SUBROUTINE; - (*KeywordMap)["highp"] = HIGH_PRECISION; - (*KeywordMap)["mediump"] = MEDIUM_PRECISION; - (*KeywordMap)["lowp"] = LOW_PRECISION; - (*KeywordMap)["precision"] = PRECISION; - (*KeywordMap)["mat2x2"] = MAT2X2; - (*KeywordMap)["mat2x3"] = MAT2X3; - (*KeywordMap)["mat2x4"] = MAT2X4; - (*KeywordMap)["mat3x2"] = MAT3X2; - (*KeywordMap)["mat3x3"] = MAT3X3; - (*KeywordMap)["mat3x4"] = MAT3X4; - (*KeywordMap)["mat4x2"] = MAT4X2; - (*KeywordMap)["mat4x3"] = MAT4X3; - (*KeywordMap)["mat4x4"] = MAT4X4; - (*KeywordMap)["dmat2"] = DMAT2; - (*KeywordMap)["dmat3"] = DMAT3; - (*KeywordMap)["dmat4"] = DMAT4; - (*KeywordMap)["dmat2x2"] = DMAT2X2; - (*KeywordMap)["dmat2x3"] = DMAT2X3; - (*KeywordMap)["dmat2x4"] = DMAT2X4; - (*KeywordMap)["dmat3x2"] = DMAT3X2; - (*KeywordMap)["dmat3x3"] = DMAT3X3; - (*KeywordMap)["dmat3x4"] = DMAT3X4; - (*KeywordMap)["dmat4x2"] = DMAT4X2; - (*KeywordMap)["dmat4x3"] = DMAT4X3; - (*KeywordMap)["dmat4x4"] = DMAT4X4; - (*KeywordMap)["image1D"] = IMAGE1D; - (*KeywordMap)["iimage1D"] = IIMAGE1D; - (*KeywordMap)["uimage1D"] = UIMAGE1D; - (*KeywordMap)["image2D"] = IMAGE2D; - (*KeywordMap)["iimage2D"] = IIMAGE2D; - (*KeywordMap)["uimage2D"] = UIMAGE2D; - (*KeywordMap)["image3D"] = IMAGE3D; - (*KeywordMap)["iimage3D"] = IIMAGE3D; - (*KeywordMap)["uimage3D"] = UIMAGE3D; - (*KeywordMap)["image2DRect"] = IMAGE2DRECT; - (*KeywordMap)["iimage2DRect"] = IIMAGE2DRECT; - (*KeywordMap)["uimage2DRect"] = UIMAGE2DRECT; - (*KeywordMap)["imageCube"] = IMAGECUBE; - (*KeywordMap)["iimageCube"] = IIMAGECUBE; - (*KeywordMap)["uimageCube"] = UIMAGECUBE; - (*KeywordMap)["imageBuffer"] = IMAGEBUFFER; - (*KeywordMap)["iimageBuffer"] = IIMAGEBUFFER; - (*KeywordMap)["uimageBuffer"] = UIMAGEBUFFER; - (*KeywordMap)["image1DArray"] = IMAGE1DARRAY; - (*KeywordMap)["iimage1DArray"] = IIMAGE1DARRAY; - (*KeywordMap)["uimage1DArray"] = UIMAGE1DARRAY; - (*KeywordMap)["image2DArray"] = IMAGE2DARRAY; - (*KeywordMap)["iimage2DArray"] = IIMAGE2DARRAY; - (*KeywordMap)["uimage2DArray"] = UIMAGE2DARRAY; - (*KeywordMap)["imageCubeArray"] = IMAGECUBEARRAY; - (*KeywordMap)["iimageCubeArray"] = IIMAGECUBEARRAY; - (*KeywordMap)["uimageCubeArray"] = UIMAGECUBEARRAY; - (*KeywordMap)["image2DMS"] = IMAGE2DMS; - (*KeywordMap)["iimage2DMS"] = IIMAGE2DMS; - (*KeywordMap)["uimage2DMS"] = UIMAGE2DMS; - (*KeywordMap)["image2DMSArray"] = IMAGE2DMSARRAY; - (*KeywordMap)["iimage2DMSArray"] = IIMAGE2DMSARRAY; - (*KeywordMap)["uimage2DMSArray"] = UIMAGE2DMSARRAY; - (*KeywordMap)["double"] = DOUBLE; - (*KeywordMap)["dvec2"] = DVEC2; - (*KeywordMap)["dvec3"] = DVEC3; - (*KeywordMap)["dvec4"] = DVEC4; - (*KeywordMap)["uint"] = UINT; - (*KeywordMap)["uvec2"] = UVEC2; - (*KeywordMap)["uvec3"] = UVEC3; - (*KeywordMap)["uvec4"] = UVEC4; - - (*KeywordMap)["int64_t"] = INT64_T; - (*KeywordMap)["uint64_t"] = UINT64_T; - (*KeywordMap)["i64vec2"] = I64VEC2; - (*KeywordMap)["i64vec3"] = I64VEC3; - (*KeywordMap)["i64vec4"] = I64VEC4; - (*KeywordMap)["u64vec2"] = U64VEC2; - (*KeywordMap)["u64vec3"] = U64VEC3; - (*KeywordMap)["u64vec4"] = U64VEC4; - -#ifdef AMD_EXTENSIONS - (*KeywordMap)["int16_t"] = INT16_T; - (*KeywordMap)["uint16_t"] = UINT16_T; - (*KeywordMap)["i16vec2"] = I16VEC2; - (*KeywordMap)["i16vec3"] = I16VEC3; - (*KeywordMap)["i16vec4"] = I16VEC4; - (*KeywordMap)["u16vec2"] = U16VEC2; - (*KeywordMap)["u16vec3"] = U16VEC3; - (*KeywordMap)["u16vec4"] = U16VEC4; - - (*KeywordMap)["float16_t"] = FLOAT16_T; - (*KeywordMap)["f16vec2"] = F16VEC2; - (*KeywordMap)["f16vec3"] = F16VEC3; - (*KeywordMap)["f16vec4"] = F16VEC4; - (*KeywordMap)["f16mat2"] = F16MAT2; - (*KeywordMap)["f16mat3"] = F16MAT3; - (*KeywordMap)["f16mat4"] = F16MAT4; - (*KeywordMap)["f16mat2x2"] = F16MAT2X2; - (*KeywordMap)["f16mat2x3"] = F16MAT2X3; - (*KeywordMap)["f16mat2x4"] = F16MAT2X4; - (*KeywordMap)["f16mat3x2"] = F16MAT3X2; - (*KeywordMap)["f16mat3x3"] = F16MAT3X3; - (*KeywordMap)["f16mat3x4"] = F16MAT3X4; - (*KeywordMap)["f16mat4x2"] = F16MAT4X2; - (*KeywordMap)["f16mat4x3"] = F16MAT4X3; - (*KeywordMap)["f16mat4x4"] = F16MAT4X4; -#endif - - (*KeywordMap)["sampler2D"] = SAMPLER2D; - (*KeywordMap)["samplerCube"] = SAMPLERCUBE; - (*KeywordMap)["samplerCubeArray"] = SAMPLERCUBEARRAY; - (*KeywordMap)["samplerCubeArrayShadow"] = SAMPLERCUBEARRAYSHADOW; - (*KeywordMap)["isamplerCubeArray"] = ISAMPLERCUBEARRAY; - (*KeywordMap)["usamplerCubeArray"] = USAMPLERCUBEARRAY; - (*KeywordMap)["sampler1DArrayShadow"] = SAMPLER1DARRAYSHADOW; - (*KeywordMap)["isampler1DArray"] = ISAMPLER1DARRAY; - (*KeywordMap)["usampler1D"] = USAMPLER1D; - (*KeywordMap)["isampler1D"] = ISAMPLER1D; - (*KeywordMap)["usampler1DArray"] = USAMPLER1DARRAY; - (*KeywordMap)["samplerBuffer"] = SAMPLERBUFFER; - (*KeywordMap)["samplerCubeShadow"] = SAMPLERCUBESHADOW; - (*KeywordMap)["sampler2DArray"] = SAMPLER2DARRAY; - (*KeywordMap)["sampler2DArrayShadow"] = SAMPLER2DARRAYSHADOW; - (*KeywordMap)["isampler2D"] = ISAMPLER2D; - (*KeywordMap)["isampler3D"] = ISAMPLER3D; - (*KeywordMap)["isamplerCube"] = ISAMPLERCUBE; - (*KeywordMap)["isampler2DArray"] = ISAMPLER2DARRAY; - (*KeywordMap)["usampler2D"] = USAMPLER2D; - (*KeywordMap)["usampler3D"] = USAMPLER3D; - (*KeywordMap)["usamplerCube"] = USAMPLERCUBE; - (*KeywordMap)["usampler2DArray"] = USAMPLER2DARRAY; - (*KeywordMap)["isampler2DRect"] = ISAMPLER2DRECT; - (*KeywordMap)["usampler2DRect"] = USAMPLER2DRECT; - (*KeywordMap)["isamplerBuffer"] = ISAMPLERBUFFER; - (*KeywordMap)["usamplerBuffer"] = USAMPLERBUFFER; - (*KeywordMap)["sampler2DMS"] = SAMPLER2DMS; - (*KeywordMap)["isampler2DMS"] = ISAMPLER2DMS; - (*KeywordMap)["usampler2DMS"] = USAMPLER2DMS; - (*KeywordMap)["sampler2DMSArray"] = SAMPLER2DMSARRAY; - (*KeywordMap)["isampler2DMSArray"] = ISAMPLER2DMSARRAY; - (*KeywordMap)["usampler2DMSArray"] = USAMPLER2DMSARRAY; - (*KeywordMap)["sampler1D"] = SAMPLER1D; - (*KeywordMap)["sampler1DShadow"] = SAMPLER1DSHADOW; - (*KeywordMap)["sampler3D"] = SAMPLER3D; - (*KeywordMap)["sampler2DShadow"] = SAMPLER2DSHADOW; - (*KeywordMap)["sampler2DRect"] = SAMPLER2DRECT; - (*KeywordMap)["sampler2DRectShadow"] = SAMPLER2DRECTSHADOW; - (*KeywordMap)["sampler1DArray"] = SAMPLER1DARRAY; - - (*KeywordMap)["samplerExternalOES"] = SAMPLEREXTERNALOES; // GL_OES_EGL_image_external - - (*KeywordMap)["sampler"] = SAMPLER; - (*KeywordMap)["samplerShadow"] = SAMPLERSHADOW; - - (*KeywordMap)["texture2D"] = TEXTURE2D; - (*KeywordMap)["textureCube"] = TEXTURECUBE; - (*KeywordMap)["textureCubeArray"] = TEXTURECUBEARRAY; - (*KeywordMap)["itextureCubeArray"] = ITEXTURECUBEARRAY; - (*KeywordMap)["utextureCubeArray"] = UTEXTURECUBEARRAY; - (*KeywordMap)["itexture1DArray"] = ITEXTURE1DARRAY; - (*KeywordMap)["utexture1D"] = UTEXTURE1D; - (*KeywordMap)["itexture1D"] = ITEXTURE1D; - (*KeywordMap)["utexture1DArray"] = UTEXTURE1DARRAY; - (*KeywordMap)["textureBuffer"] = TEXTUREBUFFER; - (*KeywordMap)["texture2DArray"] = TEXTURE2DARRAY; - (*KeywordMap)["itexture2D"] = ITEXTURE2D; - (*KeywordMap)["itexture3D"] = ITEXTURE3D; - (*KeywordMap)["itextureCube"] = ITEXTURECUBE; - (*KeywordMap)["itexture2DArray"] = ITEXTURE2DARRAY; - (*KeywordMap)["utexture2D"] = UTEXTURE2D; - (*KeywordMap)["utexture3D"] = UTEXTURE3D; - (*KeywordMap)["utextureCube"] = UTEXTURECUBE; - (*KeywordMap)["utexture2DArray"] = UTEXTURE2DARRAY; - (*KeywordMap)["itexture2DRect"] = ITEXTURE2DRECT; - (*KeywordMap)["utexture2DRect"] = UTEXTURE2DRECT; - (*KeywordMap)["itextureBuffer"] = ITEXTUREBUFFER; - (*KeywordMap)["utextureBuffer"] = UTEXTUREBUFFER; - (*KeywordMap)["texture2DMS"] = TEXTURE2DMS; - (*KeywordMap)["itexture2DMS"] = ITEXTURE2DMS; - (*KeywordMap)["utexture2DMS"] = UTEXTURE2DMS; - (*KeywordMap)["texture2DMSArray"] = TEXTURE2DMSARRAY; - (*KeywordMap)["itexture2DMSArray"] = ITEXTURE2DMSARRAY; - (*KeywordMap)["utexture2DMSArray"] = UTEXTURE2DMSARRAY; - (*KeywordMap)["texture1D"] = TEXTURE1D; - (*KeywordMap)["texture3D"] = TEXTURE3D; - (*KeywordMap)["texture2DRect"] = TEXTURE2DRECT; - (*KeywordMap)["texture1DArray"] = TEXTURE1DARRAY; - - (*KeywordMap)["subpassInput"] = SUBPASSINPUT; - (*KeywordMap)["subpassInputMS"] = SUBPASSINPUTMS; - (*KeywordMap)["isubpassInput"] = ISUBPASSINPUT; - (*KeywordMap)["isubpassInputMS"] = ISUBPASSINPUTMS; - (*KeywordMap)["usubpassInput"] = USUBPASSINPUT; - (*KeywordMap)["usubpassInputMS"] = USUBPASSINPUTMS; - - (*KeywordMap)["noperspective"] = NOPERSPECTIVE; - (*KeywordMap)["smooth"] = SMOOTH; - (*KeywordMap)["flat"] = FLAT; -#ifdef AMD_EXTENSIONS - (*KeywordMap)["__explicitInterpAMD"] = __EXPLICITINTERPAMD; -#endif - (*KeywordMap)["centroid"] = CENTROID; - (*KeywordMap)["precise"] = PRECISE; - (*KeywordMap)["invariant"] = INVARIANT; - (*KeywordMap)["packed"] = PACKED; - (*KeywordMap)["resource"] = RESOURCE; - (*KeywordMap)["superp"] = SUPERP; - - ReservedSet = new std::unordered_set; - - ReservedSet->insert("common"); - ReservedSet->insert("partition"); - ReservedSet->insert("active"); - ReservedSet->insert("asm"); - ReservedSet->insert("class"); - ReservedSet->insert("union"); - ReservedSet->insert("enum"); - ReservedSet->insert("typedef"); - ReservedSet->insert("template"); - ReservedSet->insert("this"); - ReservedSet->insert("goto"); - ReservedSet->insert("inline"); - ReservedSet->insert("noinline"); - ReservedSet->insert("public"); - ReservedSet->insert("static"); - ReservedSet->insert("extern"); - ReservedSet->insert("external"); - ReservedSet->insert("interface"); - ReservedSet->insert("long"); - ReservedSet->insert("short"); - ReservedSet->insert("half"); - ReservedSet->insert("fixed"); - ReservedSet->insert("unsigned"); - ReservedSet->insert("input"); - ReservedSet->insert("output"); - ReservedSet->insert("hvec2"); - ReservedSet->insert("hvec3"); - ReservedSet->insert("hvec4"); - ReservedSet->insert("fvec2"); - ReservedSet->insert("fvec3"); - ReservedSet->insert("fvec4"); - ReservedSet->insert("sampler3DRect"); - ReservedSet->insert("filter"); - ReservedSet->insert("sizeof"); - ReservedSet->insert("cast"); - ReservedSet->insert("namespace"); - ReservedSet->insert("using"); -} - -void TScanContext::deleteKeywordMap() -{ - delete KeywordMap; - KeywordMap = nullptr; - delete ReservedSet; - ReservedSet = nullptr; -} - -// Called by yylex to get the next token. -// Returning 0 implies end of input. -int TScanContext::tokenize(TPpContext* pp, TParserToken& token) -{ - do { - parserToken = &token; - TPpToken ppToken; - int token = pp->tokenize(ppToken); - if (token == EndOfInput) - return 0; - - tokenText = ppToken.name; - loc = ppToken.loc; - parserToken->sType.lex.loc = loc; - switch (token) { - case ';': afterType = false; return SEMICOLON; - case ',': afterType = false; return COMMA; - case ':': return COLON; - case '=': afterType = false; return EQUAL; - case '(': afterType = false; return LEFT_PAREN; - case ')': afterType = false; return RIGHT_PAREN; - case '.': field = true; return DOT; - case '!': return BANG; - case '-': return DASH; - case '~': return TILDE; - case '+': return PLUS; - case '*': return STAR; - case '/': return SLASH; - case '%': return PERCENT; - case '<': return LEFT_ANGLE; - case '>': return RIGHT_ANGLE; - case '|': return VERTICAL_BAR; - case '^': return CARET; - case '&': return AMPERSAND; - case '?': return QUESTION; - case '[': return LEFT_BRACKET; - case ']': return RIGHT_BRACKET; - case '{': return LEFT_BRACE; - case '}': return RIGHT_BRACE; - case '\\': - parseContext.error(loc, "illegal use of escape character", "\\", ""); - break; - - case PPAtomAddAssign: return ADD_ASSIGN; - case PPAtomSubAssign: return SUB_ASSIGN; - case PPAtomMulAssign: return MUL_ASSIGN; - case PPAtomDivAssign: return DIV_ASSIGN; - case PPAtomModAssign: return MOD_ASSIGN; - - case PpAtomRight: return RIGHT_OP; - case PpAtomLeft: return LEFT_OP; - - case PpAtomRightAssign: return RIGHT_ASSIGN; - case PpAtomLeftAssign: return LEFT_ASSIGN; - case PpAtomAndAssign: return AND_ASSIGN; - case PpAtomOrAssign: return OR_ASSIGN; - case PpAtomXorAssign: return XOR_ASSIGN; - - case PpAtomAnd: return AND_OP; - case PpAtomOr: return OR_OP; - case PpAtomXor: return XOR_OP; - - case PpAtomEQ: return EQ_OP; - case PpAtomGE: return GE_OP; - case PpAtomNE: return NE_OP; - case PpAtomLE: return LE_OP; - - case PpAtomDecrement: return DEC_OP; - case PpAtomIncrement: return INC_OP; - - case PpAtomColonColon: - parseContext.error(loc, "not supported", "::", ""); - break; - - case PpAtomConstInt: parserToken->sType.lex.i = ppToken.ival; return INTCONSTANT; - case PpAtomConstUint: parserToken->sType.lex.i = ppToken.ival; return UINTCONSTANT; - case PpAtomConstInt64: parserToken->sType.lex.i64 = ppToken.i64val; return INT64CONSTANT; - case PpAtomConstUint64: parserToken->sType.lex.i64 = ppToken.i64val; return UINT64CONSTANT; -#ifdef AMD_EXTENSIONS - case PpAtomConstInt16: parserToken->sType.lex.i = ppToken.ival; return INT16CONSTANT; - case PpAtomConstUint16: parserToken->sType.lex.i = ppToken.ival; return UINT16CONSTANT; -#endif - case PpAtomConstFloat: parserToken->sType.lex.d = ppToken.dval; return FLOATCONSTANT; - case PpAtomConstDouble: parserToken->sType.lex.d = ppToken.dval; return DOUBLECONSTANT; -#ifdef AMD_EXTENSIONS - case PpAtomConstFloat16: parserToken->sType.lex.d = ppToken.dval; return FLOAT16CONSTANT; -#endif - case PpAtomIdentifier: - { - int token = tokenizeIdentifier(); - field = false; - return token; - } - - case EndOfInput: return 0; - - default: - char buf[2]; - buf[0] = (char)token; - buf[1] = 0; - parseContext.error(loc, "unexpected token", buf, ""); - break; - } - } while (true); -} - -int TScanContext::tokenizeIdentifier() -{ - if (ReservedSet->find(tokenText) != ReservedSet->end()) - return reservedWord(); - - auto it = KeywordMap->find(tokenText); - if (it == KeywordMap->end()) { - // Should have an identifier of some sort - return identifierOrType(); - } - keyword = it->second; - - switch (keyword) { - case CONST: - case UNIFORM: - case IN: - case OUT: - case INOUT: - case STRUCT: - case BREAK: - case CONTINUE: - case DO: - case FOR: - case WHILE: - case IF: - case ELSE: - case DISCARD: - case RETURN: - case CASE: - return keyword; - - case SWITCH: - case DEFAULT: - if ((parseContext.profile == EEsProfile && parseContext.version < 300) || - (parseContext.profile != EEsProfile && parseContext.version < 130)) - reservedWord(); - return keyword; - - case VOID: - case BOOL: - case FLOAT: - case INT: - case BVEC2: - case BVEC3: - case BVEC4: - case VEC2: - case VEC3: - case VEC4: - case IVEC2: - case IVEC3: - case IVEC4: - case MAT2: - case MAT3: - case MAT4: - case SAMPLER2D: - case SAMPLERCUBE: - afterType = true; - return keyword; - - case BOOLCONSTANT: - if (strcmp("true", tokenText) == 0) - parserToken->sType.lex.b = true; - else - parserToken->sType.lex.b = false; - return keyword; - - case ATTRIBUTE: - case VARYING: - if (parseContext.profile == EEsProfile && parseContext.version >= 300) - reservedWord(); - return keyword; - - case BUFFER: - if ((parseContext.profile == EEsProfile && parseContext.version < 310) || - (parseContext.profile != EEsProfile && parseContext.version < 430)) - return identifierOrType(); - return keyword; - - case ATOMIC_UINT: - if ((parseContext.profile == EEsProfile && parseContext.version >= 310) || - parseContext.extensionTurnedOn(E_GL_ARB_shader_atomic_counters)) - return keyword; - return es30ReservedFromGLSL(420); - - case COHERENT: - case RESTRICT: - case READONLY: - case WRITEONLY: - if (parseContext.profile == EEsProfile && parseContext.version >= 310) - return keyword; - return es30ReservedFromGLSL(parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store) ? 130 : 420); - - case VOLATILE: - if (parseContext.profile == EEsProfile && parseContext.version >= 310) - return keyword; - if (! parseContext.symbolTable.atBuiltInLevel() && (parseContext.profile == EEsProfile || (parseContext.version < 420 && ! parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store)))) - reservedWord(); - return keyword; - - case LAYOUT: - { - const int numLayoutExts = 2; - const char* layoutExts[numLayoutExts] = { E_GL_ARB_shading_language_420pack, - E_GL_ARB_explicit_attrib_location }; - if ((parseContext.profile == EEsProfile && parseContext.version < 300) || - (parseContext.profile != EEsProfile && parseContext.version < 140 && - ! parseContext.extensionsTurnedOn(numLayoutExts, layoutExts))) - return identifierOrType(); - return keyword; - } - case SHARED: - if ((parseContext.profile == EEsProfile && parseContext.version < 300) || - (parseContext.profile != EEsProfile && parseContext.version < 140)) - return identifierOrType(); - return keyword; - - case PATCH: - if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.profile == EEsProfile && - (parseContext.version >= 320 || - parseContext.extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader))) || - (parseContext.profile != EEsProfile && parseContext.extensionTurnedOn(E_GL_ARB_tessellation_shader))) - return keyword; - - return es30ReservedFromGLSL(400); - - case SAMPLE: - if ((parseContext.profile == EEsProfile && parseContext.version >= 320) || - parseContext.extensionsTurnedOn(1, &E_GL_OES_shader_multisample_interpolation)) - return keyword; - return es30ReservedFromGLSL(400); - - case SUBROUTINE: - return es30ReservedFromGLSL(400); - - case HIGH_PRECISION: - case MEDIUM_PRECISION: - case LOW_PRECISION: - case PRECISION: - return precisionKeyword(); - - case MAT2X2: - case MAT2X3: - case MAT2X4: - case MAT3X2: - case MAT3X3: - case MAT3X4: - case MAT4X2: - case MAT4X3: - case MAT4X4: - return matNxM(); - - case DMAT2: - case DMAT3: - case DMAT4: - case DMAT2X2: - case DMAT2X3: - case DMAT2X4: - case DMAT3X2: - case DMAT3X3: - case DMAT3X4: - case DMAT4X2: - case DMAT4X3: - case DMAT4X4: - return dMat(); - - case IMAGE1D: - case IIMAGE1D: - case UIMAGE1D: - case IMAGE1DARRAY: - case IIMAGE1DARRAY: - case UIMAGE1DARRAY: - case IMAGE2DRECT: - case IIMAGE2DRECT: - case UIMAGE2DRECT: - afterType = true; - return firstGenerationImage(false); - - case IMAGEBUFFER: - case IIMAGEBUFFER: - case UIMAGEBUFFER: - afterType = true; - if ((parseContext.profile == EEsProfile && parseContext.version >= 320) || - parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer)) - return keyword; - return firstGenerationImage(false); - - case IMAGE2D: - case IIMAGE2D: - case UIMAGE2D: - case IMAGE3D: - case IIMAGE3D: - case UIMAGE3D: - case IMAGECUBE: - case IIMAGECUBE: - case UIMAGECUBE: - case IMAGE2DARRAY: - case IIMAGE2DARRAY: - case UIMAGE2DARRAY: - afterType = true; - return firstGenerationImage(true); - - case IMAGECUBEARRAY: - case IIMAGECUBEARRAY: - case UIMAGECUBEARRAY: - afterType = true; - if ((parseContext.profile == EEsProfile && parseContext.version >= 320) || - parseContext.extensionsTurnedOn(Num_AEP_texture_cube_map_array, AEP_texture_cube_map_array)) - return keyword; - return secondGenerationImage(); - - case IMAGE2DMS: - case IIMAGE2DMS: - case UIMAGE2DMS: - case IMAGE2DMSARRAY: - case IIMAGE2DMSARRAY: - case UIMAGE2DMSARRAY: - afterType = true; - return secondGenerationImage(); - - case DOUBLE: - case DVEC2: - case DVEC3: - case DVEC4: - afterType = true; - if (parseContext.profile == EEsProfile || parseContext.version < 400) - reservedWord(); - return keyword; - - case INT64_T: - case UINT64_T: - case I64VEC2: - case I64VEC3: - case I64VEC4: - case U64VEC2: - case U64VEC3: - case U64VEC4: - afterType = true; - if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_int64) && - parseContext.profile != EEsProfile && parseContext.version >= 450)) - return keyword; - return identifierOrType(); - -#ifdef AMD_EXTENSIONS - case INT16_T: - case UINT16_T: - case I16VEC2: - case I16VEC3: - case I16VEC4: - case U16VEC2: - case U16VEC3: - case U16VEC4: - afterType = true; - if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_int16) && - parseContext.profile != EEsProfile && parseContext.version >= 450)) - return keyword; - return identifierOrType(); - - case FLOAT16_T: - case F16VEC2: - case F16VEC3: - case F16VEC4: - case F16MAT2: - case F16MAT3: - case F16MAT4: - case F16MAT2X2: - case F16MAT2X3: - case F16MAT2X4: - case F16MAT3X2: - case F16MAT3X3: - case F16MAT3X4: - case F16MAT4X2: - case F16MAT4X3: - case F16MAT4X4: - afterType = true; - if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) && - parseContext.profile != EEsProfile && parseContext.version >= 450)) - return keyword; - return identifierOrType(); -#endif - - case SAMPLERCUBEARRAY: - case SAMPLERCUBEARRAYSHADOW: - case ISAMPLERCUBEARRAY: - case USAMPLERCUBEARRAY: - afterType = true; - if ((parseContext.profile == EEsProfile && parseContext.version >= 320) || - parseContext.extensionsTurnedOn(Num_AEP_texture_cube_map_array, AEP_texture_cube_map_array)) - return keyword; - if (parseContext.profile == EEsProfile || (parseContext.version < 400 && ! parseContext.extensionTurnedOn(E_GL_ARB_texture_cube_map_array))) - reservedWord(); - return keyword; - - case ISAMPLER1D: - case ISAMPLER1DARRAY: - case USAMPLER1D: - case USAMPLER1DARRAY: - afterType = true; - return es30ReservedFromGLSL(130); - - case UINT: - case UVEC2: - case UVEC3: - case UVEC4: - case SAMPLERCUBESHADOW: - case ISAMPLER2D: - case ISAMPLER3D: - case ISAMPLERCUBE: - case ISAMPLER2DARRAY: - case USAMPLER2D: - case USAMPLER3D: - case USAMPLERCUBE: - case USAMPLER2DARRAY: - afterType = true; - return nonreservedKeyword(300, 130); - - case ISAMPLER2DRECT: - case USAMPLER2DRECT: - afterType = true; - return es30ReservedFromGLSL(140); - - case SAMPLERBUFFER: - afterType = true; - if ((parseContext.profile == EEsProfile && parseContext.version >= 320) || - parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer)) - return keyword; - return es30ReservedFromGLSL(130); - - case ISAMPLERBUFFER: - case USAMPLERBUFFER: - afterType = true; - if ((parseContext.profile == EEsProfile && parseContext.version >= 320) || - parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer)) - return keyword; - return es30ReservedFromGLSL(140); - - case SAMPLER2DMS: - case ISAMPLER2DMS: - case USAMPLER2DMS: - afterType = true; - if (parseContext.profile == EEsProfile && parseContext.version >= 310) - return keyword; - return es30ReservedFromGLSL(150); - - case SAMPLER2DMSARRAY: - case ISAMPLER2DMSARRAY: - case USAMPLER2DMSARRAY: - afterType = true; - if ((parseContext.profile == EEsProfile && parseContext.version >= 320) || - parseContext.extensionsTurnedOn(1, &E_GL_OES_texture_storage_multisample_2d_array)) - return keyword; - return es30ReservedFromGLSL(150); - - case SAMPLER1D: - case SAMPLER1DSHADOW: - afterType = true; - if (parseContext.profile == EEsProfile) - reservedWord(); - return keyword; - - case SAMPLER3D: - afterType = true; - if (parseContext.profile == EEsProfile && parseContext.version < 300) { - if (! parseContext.extensionTurnedOn(E_GL_OES_texture_3D)) - reservedWord(); - } - return keyword; - - case SAMPLER2DSHADOW: - afterType = true; - if (parseContext.profile == EEsProfile && parseContext.version < 300) { - if (!parseContext.extensionTurnedOn(E_GL_EXT_shadow_samplers)) - reservedWord(); - } - return keyword; - - case SAMPLER1DARRAY: - case SAMPLER1DARRAYSHADOW: - afterType = true; - if (parseContext.symbolTable.atBuiltInLevel()) - return keyword; - else if (parseContext.profile == EEsProfile) { - if (parseContext.version >= 300) - reservedWord(); - else - return identifierOrType(); - } else if (parseContext.version < 130 && !parseContext.extensionTurnedOn(E_GL_EXT_texture_array)) { - if (parseContext.forwardCompatible) - parseContext.warn(loc, "using future keyword", tokenText, ""); - - return identifierOrType(); - } - return keyword; - - case SAMPLER2DARRAY: - case SAMPLER2DARRAYSHADOW: - afterType = true; - if (parseContext.symbolTable.atBuiltInLevel()) - return keyword; - else if (parseContext.version < 130 && ((parseContext.profile == EEsProfile && keyword != SAMPLER2DARRAY) || !parseContext.extensionTurnedOn(E_GL_EXT_texture_array))) { - if (parseContext.forwardCompatible) - parseContext.warn(loc, "using future keyword", tokenText, ""); - - return identifierOrType(); - } - return keyword; - - case SAMPLER2DRECT: - case SAMPLER2DRECTSHADOW: - afterType = true; - if (parseContext.profile == EEsProfile) - reservedWord(); - else if (parseContext.version < 140 && ! parseContext.symbolTable.atBuiltInLevel() && ! parseContext.extensionTurnedOn(E_GL_ARB_texture_rectangle)) { - if (parseContext.relaxedErrors()) - parseContext.requireExtensions(loc, 1, &E_GL_ARB_texture_rectangle, "texture-rectangle sampler keyword"); - else - reservedWord(); - } - return keyword; - - case SAMPLEREXTERNALOES: - afterType = true; - if (parseContext.symbolTable.atBuiltInLevel() || - parseContext.extensionTurnedOn(E_GL_OES_EGL_image_external) || - parseContext.extensionTurnedOn(E_GL_OES_EGL_image_external_essl3)) - return keyword; - return identifierOrType(); - - case TEXTURE2D: - case TEXTURECUBE: - case TEXTURECUBEARRAY: - case ITEXTURECUBEARRAY: - case UTEXTURECUBEARRAY: - case ITEXTURE1DARRAY: - case UTEXTURE1D: - case ITEXTURE1D: - case UTEXTURE1DARRAY: - case TEXTUREBUFFER: - case TEXTURE2DARRAY: - case ITEXTURE2D: - case ITEXTURE3D: - case ITEXTURECUBE: - case ITEXTURE2DARRAY: - case UTEXTURE2D: - case UTEXTURE3D: - case UTEXTURECUBE: - case UTEXTURE2DARRAY: - case ITEXTURE2DRECT: - case UTEXTURE2DRECT: - case ITEXTUREBUFFER: - case UTEXTUREBUFFER: - case TEXTURE2DMS: - case ITEXTURE2DMS: - case UTEXTURE2DMS: - case TEXTURE2DMSARRAY: - case ITEXTURE2DMSARRAY: - case UTEXTURE2DMSARRAY: - case TEXTURE1D: - case TEXTURE3D: - case TEXTURE2DRECT: - case TEXTURE1DARRAY: - case SAMPLER: - case SAMPLERSHADOW: - if (parseContext.spvVersion.vulkan >= 100) - return keyword; - else - return identifierOrType(); - - case SUBPASSINPUT: - case SUBPASSINPUTMS: - case ISUBPASSINPUT: - case ISUBPASSINPUTMS: - case USUBPASSINPUT: - case USUBPASSINPUTMS: - if (parseContext.spvVersion.vulkan >= 100) - return keyword; - else - return identifierOrType(); - - case NOPERSPECTIVE: - return es30ReservedFromGLSL(130); - - case SMOOTH: - if ((parseContext.profile == EEsProfile && parseContext.version < 300) || - (parseContext.profile != EEsProfile && parseContext.version < 130)) - return identifierOrType(); - return keyword; - -#ifdef AMD_EXTENSIONS - case __EXPLICITINTERPAMD: - if (parseContext.profile != EEsProfile && parseContext.version >= 450 && - parseContext.extensionTurnedOn(E_GL_AMD_shader_explicit_vertex_parameter)) - return keyword; - return identifierOrType(); -#endif - - case FLAT: - if (parseContext.profile == EEsProfile && parseContext.version < 300) - reservedWord(); - else if (parseContext.profile != EEsProfile && parseContext.version < 130) - return identifierOrType(); - return keyword; - - case CENTROID: - if (parseContext.version < 120) - return identifierOrType(); - return keyword; - - case PRECISE: - if ((parseContext.profile == EEsProfile && - (parseContext.version >= 320 || parseContext.extensionsTurnedOn(Num_AEP_gpu_shader5, AEP_gpu_shader5))) || - (parseContext.profile != EEsProfile && parseContext.version >= 400)) - return keyword; - if (parseContext.profile == EEsProfile && parseContext.version == 310) { - reservedWord(); - return keyword; - } - return identifierOrType(); - - case INVARIANT: - if (parseContext.profile != EEsProfile && parseContext.version < 120) - return identifierOrType(); - return keyword; - - case PACKED: - if ((parseContext.profile == EEsProfile && parseContext.version < 300) || - (parseContext.profile != EEsProfile && parseContext.version < 330)) - return reservedWord(); - return identifierOrType(); - - case RESOURCE: - { - bool reserved = (parseContext.profile == EEsProfile && parseContext.version >= 300) || - (parseContext.profile != EEsProfile && parseContext.version >= 420); - return identifierOrReserved(reserved); - } - case SUPERP: - { - bool reserved = parseContext.profile == EEsProfile || parseContext.version >= 130; - return identifierOrReserved(reserved); - } - - default: - parseContext.infoSink.info.message(EPrefixInternalError, "Unknown glslang keyword", loc); - return 0; - } -} - -int TScanContext::identifierOrType() -{ - parserToken->sType.lex.string = NewPoolTString(tokenText); - if (field) - return IDENTIFIER; - - parserToken->sType.lex.symbol = parseContext.symbolTable.find(*parserToken->sType.lex.string); - if (afterType == false && parserToken->sType.lex.symbol) { - if (const TVariable* variable = parserToken->sType.lex.symbol->getAsVariable()) { - if (variable->isUserType()) { - afterType = true; - - return TYPE_NAME; - } - } - } - - return IDENTIFIER; -} - -// Give an error for use of a reserved symbol. -// However, allow built-in declarations to use reserved words, to allow -// extension support before the extension is enabled. -int TScanContext::reservedWord() -{ - if (! parseContext.symbolTable.atBuiltInLevel()) - parseContext.error(loc, "Reserved word.", tokenText, "", ""); - - return 0; -} - -int TScanContext::identifierOrReserved(bool reserved) -{ - if (reserved) { - reservedWord(); - - return 0; - } - - if (parseContext.forwardCompatible) - parseContext.warn(loc, "using future reserved keyword", tokenText, ""); - - return identifierOrType(); -} - -// For keywords that suddenly showed up on non-ES (not previously reserved) -// but then got reserved by ES 3.0. -int TScanContext::es30ReservedFromGLSL(int version) -{ - if (parseContext.symbolTable.atBuiltInLevel()) - return keyword; - - if ((parseContext.profile == EEsProfile && parseContext.version < 300) || - (parseContext.profile != EEsProfile && parseContext.version < version)) { - if (parseContext.forwardCompatible) - parseContext.warn(loc, "future reserved word in ES 300 and keyword in GLSL", tokenText, ""); - - return identifierOrType(); - } else if (parseContext.profile == EEsProfile && parseContext.version >= 300) - reservedWord(); - - return keyword; -} - -// For a keyword that was never reserved, until it suddenly -// showed up, both in an es version and a non-ES version. -int TScanContext::nonreservedKeyword(int esVersion, int nonEsVersion) -{ - if ((parseContext.profile == EEsProfile && parseContext.version < esVersion) || - (parseContext.profile != EEsProfile && parseContext.version < nonEsVersion)) { - if (parseContext.forwardCompatible) - parseContext.warn(loc, "using future keyword", tokenText, ""); - - return identifierOrType(); - } - - return keyword; -} - -int TScanContext::precisionKeyword() -{ - if (parseContext.profile == EEsProfile || parseContext.version >= 130) - return keyword; - - if (parseContext.forwardCompatible) - parseContext.warn(loc, "using ES precision qualifier keyword", tokenText, ""); - - return identifierOrType(); -} - -int TScanContext::matNxM() -{ - afterType = true; - - if (parseContext.version > 110) - return keyword; - - if (parseContext.forwardCompatible) - parseContext.warn(loc, "using future non-square matrix type keyword", tokenText, ""); - - return identifierOrType(); -} - -int TScanContext::dMat() -{ - afterType = true; - - if (parseContext.profile == EEsProfile && parseContext.version >= 300) { - reservedWord(); - - return keyword; - } - - if (parseContext.profile != EEsProfile && parseContext.version >= 400) - return keyword; - - if (parseContext.forwardCompatible) - parseContext.warn(loc, "using future type keyword", tokenText, ""); - - return identifierOrType(); -} - -int TScanContext::firstGenerationImage(bool inEs310) -{ - if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.profile != EEsProfile && (parseContext.version >= 420 || parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store))) || - (inEs310 && parseContext.profile == EEsProfile && parseContext.version >= 310)) - return keyword; - - if ((parseContext.profile == EEsProfile && parseContext.version >= 300) || - (parseContext.profile != EEsProfile && parseContext.version >= 130)) { - reservedWord(); - - return keyword; - } - - if (parseContext.forwardCompatible) - parseContext.warn(loc, "using future type keyword", tokenText, ""); - - return identifierOrType(); -} - -int TScanContext::secondGenerationImage() -{ - if (parseContext.profile == EEsProfile && parseContext.version >= 310) { - reservedWord(); - return keyword; - } - - if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.profile != EEsProfile && - (parseContext.version >= 420 || parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store)))) - return keyword; - - if (parseContext.forwardCompatible) - parseContext.warn(loc, "using future type keyword", tokenText, ""); - - return identifierOrType(); -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Scan.h b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Scan.h deleted file mode 100644 index 2c26c2ef..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Scan.h +++ /dev/null @@ -1,274 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2013 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// -#ifndef _GLSLANG_SCAN_INCLUDED_ -#define _GLSLANG_SCAN_INCLUDED_ - -#include "Versions.h" - -namespace glslang { - -// Use a global end-of-input character, so no translation is needed across -// layers of encapsulation. Characters are all 8 bit, and positive, so there is -// no aliasing of character 255 onto -1, for example. -const int EndOfInput = -1; - -// -// A character scanner that seamlessly, on read-only strings, reads across an -// array of strings without assuming null termination. -// -class TInputScanner { -public: - TInputScanner(int n, const char* const s[], size_t L[], const char* const* names = nullptr, - int b = 0, int f = 0, bool single = false) : - numSources(n), - // up to this point, common usage is "char*", but now we need positive 8-bit characters - sources(reinterpret_cast(s)), - lengths(L), currentSource(0), currentChar(0), stringBias(b), finale(f), singleLogical(single), - endOfFileReached(false) - { - loc = new TSourceLoc[numSources]; - for (int i = 0; i < numSources; ++i) { - loc[i].init(i - stringBias); - } - if (names != nullptr) { - for (int i = 0; i < numSources; ++i) - loc[i].name = names[i]; - } - loc[currentSource].line = 1; - logicalSourceLoc.init(1); - logicalSourceLoc.name = loc[0].name; - } - - virtual ~TInputScanner() - { - delete [] loc; - } - - // retrieve the next character and advance one character - int get() - { - int ret = peek(); - if (ret == EndOfInput) - return ret; - ++loc[currentSource].column; - ++logicalSourceLoc.column; - if (ret == '\n') { - ++loc[currentSource].line; - ++logicalSourceLoc.line; - logicalSourceLoc.column = 0; - loc[currentSource].column = 0; - } - advance(); - - return ret; - } - - // retrieve the next character, no advance - int peek() - { - if (currentSource >= numSources) { - endOfFileReached = true; - return EndOfInput; - } - // Make sure we do not read off the end of a string. - // N.B. Sources can have a length of 0. - int sourceToRead = currentSource; - size_t charToRead = currentChar; - while(charToRead >= lengths[sourceToRead]) { - charToRead = 0; - sourceToRead += 1; - if (sourceToRead >= numSources) { - return EndOfInput; - } - } - - // Here, we care about making negative valued characters positive - return sources[sourceToRead][charToRead]; - } - - // go back one character - void unget() - { - // Do not roll back once we've reached the end of the file. - if (endOfFileReached) - return; - - if (currentChar > 0) { - --currentChar; - --loc[currentSource].column; - --logicalSourceLoc.column; - if (loc[currentSource].column < 0) { - // We've moved back past a new line. Find the - // previous newline (or start of the file) to compute - // the column count on the now current line. - size_t chIndex = currentChar; - while (chIndex > 0) { - if (sources[currentSource][chIndex] == '\n') { - break; - } - --chIndex; - } - logicalSourceLoc.column = (int)(currentChar - chIndex); - loc[currentSource].column = (int)(currentChar - chIndex); - } - } else { - do { - --currentSource; - } while (currentSource > 0 && lengths[currentSource] == 0); - if (lengths[currentSource] == 0) { - // set to 0 if we've backed up to the start of an empty string - currentChar = 0; - } else - currentChar = lengths[currentSource] - 1; - } - if (peek() == '\n') { - --loc[currentSource].line; - --logicalSourceLoc.line; - } - } - - // for #line override - void setLine(int newLine) - { - logicalSourceLoc.line = newLine; - loc[getLastValidSourceIndex()].line = newLine; - } - - // for #line override in filename based parsing - void setFile(const char* filename) - { - logicalSourceLoc.name = filename; - loc[getLastValidSourceIndex()].name = filename; - } - - void setFile(const char* filename, int i) - { - if (i == getLastValidSourceIndex()) { - logicalSourceLoc.name = filename; - } - loc[i].name = filename; - } - - void setString(int newString) - { - logicalSourceLoc.string = newString; - loc[getLastValidSourceIndex()].string = newString; - logicalSourceLoc.name = nullptr; - loc[getLastValidSourceIndex()].name = nullptr; - } - - // for #include content indentation - void setColumn(int col) - { - logicalSourceLoc.column = col; - loc[getLastValidSourceIndex()].column = col; - } - - void setEndOfInput() - { - endOfFileReached = true; - currentSource = numSources; - } - - bool atEndOfInput() const { return endOfFileReached; } - - const TSourceLoc& getSourceLoc() const - { - if (singleLogical) { - return logicalSourceLoc; - } else { - return loc[std::max(0, std::min(currentSource, numSources - finale - 1))]; - } - } - // Returns the index (starting from 0) of the most recent valid source string we are reading from. - int getLastValidSourceIndex() const { return std::min(currentSource, numSources - 1); } - - void consumeWhiteSpace(bool& foundNonSpaceTab); - bool consumeComment(); - void consumeWhitespaceComment(bool& foundNonSpaceTab); - bool scanVersion(int& version, EProfile& profile, bool& notFirstToken); - -protected: - - // advance one character - void advance() - { - ++currentChar; - if (currentChar >= lengths[currentSource]) { - ++currentSource; - if (currentSource < numSources) { - loc[currentSource].string = loc[currentSource - 1].string + 1; - loc[currentSource].line = 1; - loc[currentSource].column = 0; - } - while (currentSource < numSources && lengths[currentSource] == 0) { - ++currentSource; - if (currentSource < numSources) { - loc[currentSource].string = loc[currentSource - 1].string + 1; - loc[currentSource].line = 1; - loc[currentSource].column = 0; - } - } - currentChar = 0; - } - } - - int numSources; // number of strings in source - const unsigned char* const *sources; // array of strings; must be converted to positive values on use, to avoid aliasing with -1 as EndOfInput - const size_t *lengths; // length of each string - int currentSource; - size_t currentChar; - - // This is for reporting what string/line an error occurred on, and can be overridden by #line. - // It remembers the last state of each source string as it is left for the next one, so unget() - // can restore that state. - TSourceLoc* loc; // an array - - int stringBias; // the first string that is the user's string number 0 - int finale; // number of internal strings after user's last string - - TSourceLoc logicalSourceLoc; - bool singleLogical; // treats the strings as a single logical string. - // locations will be reported from the first string. - - // Set to true once peek() returns EndOfFile, so that we won't roll back - // once we've reached EndOfFile. - bool endOfFileReached; -}; - -} // end namespace glslang - -#endif // _GLSLANG_SCAN_INCLUDED_ diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/ScanContext.h b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/ScanContext.h deleted file mode 100644 index 608ae067..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/ScanContext.h +++ /dev/null @@ -1,88 +0,0 @@ -// -// Copyright (C) 2013 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -// -// This holds context specific to the GLSL scanner, which -// sits between the preprocessor scanner and parser. -// - -#pragma once - -#include "ParseHelper.h" - -namespace glslang { - -class TPpContext; -class TPpToken; -class TParserToken; - -class TScanContext { -public: - explicit TScanContext(TParseContextBase& pc) : parseContext(pc), afterType(false), field(false) { } - virtual ~TScanContext() { } - - static void fillInKeywordMap(); - static void deleteKeywordMap(); - - int tokenize(TPpContext*, TParserToken&); - -protected: - TScanContext(TScanContext&); - TScanContext& operator=(TScanContext&); - - int tokenizeIdentifier(); - int identifierOrType(); - int reservedWord(); - int identifierOrReserved(bool reserved); - int es30ReservedFromGLSL(int version); - int nonreservedKeyword(int esVersion, int nonEsVersion); - int precisionKeyword(); - int matNxM(); - int dMat(); - int firstGenerationImage(bool inEs310); - int secondGenerationImage(); - - TParseContextBase& parseContext; - bool afterType; // true if we've recognized a type, so can only be looking for an identifier - bool field; // true if we're on a field, right after a '.' - TSourceLoc loc; - TParserToken* parserToken; - TPpToken* ppToken; - - const char* tokenText; - int keyword; -}; - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/ShaderLang.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/ShaderLang.cpp deleted file mode 100644 index c92d0239..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/ShaderLang.cpp +++ /dev/null @@ -1,1943 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2013-2016 LunarG, Inc. -// Copyright (C) 2015-2017 Google, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -// -// Implement the top-level of interface to the compiler/linker, -// as defined in ShaderLang.h -// This is the platform independent interface between an OGL driver -// and the shading language compiler/linker. -// -#include -#include -#include -#include -#include "SymbolTable.h" -#include "ParseHelper.h" -#include "Scan.h" -#include "ScanContext.h" - -#ifdef ENABLE_HLSL -#include "../../hlsl/hlslParseHelper.h" -#include "../../hlsl/hlslParseables.h" -#include "../../hlsl/hlslScanContext.h" -#endif - -#include "../Include/ShHandle.h" -#include "../../OGLCompilersDLL/InitializeDll.h" - -#include "preprocessor/PpContext.h" - -#define SH_EXPORTING -#include "../Public/ShaderLang.h" -#include "reflection.h" -#include "iomapper.h" -#include "Initialize.h" - -namespace { // anonymous namespace for file-local functions and symbols - -// Total number of successful initializers of glslang: a refcount -// Shared global; access should be protected by a global mutex/critical section. -int NumberOfClients = 0; - -using namespace glslang; - -// Create a language specific version of parseables. -TBuiltInParseables* CreateBuiltInParseables(TInfoSink& infoSink, EShSource source) -{ - switch (source) { - case EShSourceGlsl: return new TBuiltIns(); // GLSL builtIns -#ifdef ENABLE_HLSL - case EShSourceHlsl: return new TBuiltInParseablesHlsl(); // HLSL intrinsics -#endif - - default: - infoSink.info.message(EPrefixInternalError, "Unable to determine source language"); - return nullptr; - } -} - -// Create a language specific version of a parse context. -TParseContextBase* CreateParseContext(TSymbolTable& symbolTable, TIntermediate& intermediate, - int version, EProfile profile, EShSource source, - EShLanguage language, TInfoSink& infoSink, - SpvVersion spvVersion, bool forwardCompatible, EShMessages messages, - bool parsingBuiltIns, std::string sourceEntryPointName = "") -{ - switch (source) { - case EShSourceGlsl: { - if (sourceEntryPointName.size() == 0) - intermediate.setEntryPointName("main"); - TString entryPoint = sourceEntryPointName.c_str(); - return new TParseContext(symbolTable, intermediate, parsingBuiltIns, version, profile, spvVersion, - language, infoSink, forwardCompatible, messages, &entryPoint); - } -#ifdef ENABLE_HLSL - case EShSourceHlsl: - return new HlslParseContext(symbolTable, intermediate, parsingBuiltIns, version, profile, spvVersion, - language, infoSink, sourceEntryPointName.c_str(), forwardCompatible, messages); -#endif - default: - infoSink.info.message(EPrefixInternalError, "Unable to determine source language"); - return nullptr; - } -} - -// Local mapping functions for making arrays of symbol tables.... - -const int VersionCount = 17; // index range in MapVersionToIndex - -int MapVersionToIndex(int version) -{ - int index = 0; - - switch (version) { - case 100: index = 0; break; - case 110: index = 1; break; - case 120: index = 2; break; - case 130: index = 3; break; - case 140: index = 4; break; - case 150: index = 5; break; - case 300: index = 6; break; - case 330: index = 7; break; - case 400: index = 8; break; - case 410: index = 9; break; - case 420: index = 10; break; - case 430: index = 11; break; - case 440: index = 12; break; - case 310: index = 13; break; - case 450: index = 14; break; - case 500: index = 0; break; // HLSL - case 320: index = 15; break; - case 460: index = 16; break; - default: assert(0); break; - } - - assert(index < VersionCount); - - return index; -} - -const int SpvVersionCount = 3; // index range in MapSpvVersionToIndex - -int MapSpvVersionToIndex(const SpvVersion& spvVersion) -{ - int index = 0; - - if (spvVersion.openGl > 0) - index = 1; - else if (spvVersion.vulkan > 0) - index = 2; - - assert(index < SpvVersionCount); - - return index; -} - -const int ProfileCount = 4; // index range in MapProfileToIndex - -int MapProfileToIndex(EProfile profile) -{ - int index = 0; - - switch (profile) { - case ENoProfile: index = 0; break; - case ECoreProfile: index = 1; break; - case ECompatibilityProfile: index = 2; break; - case EEsProfile: index = 3; break; - default: break; - } - - assert(index < ProfileCount); - - return index; -} - -const int SourceCount = 2; - -int MapSourceToIndex(EShSource source) -{ - int index = 0; - - switch (source) { - case EShSourceGlsl: index = 0; break; - case EShSourceHlsl: index = 1; break; - default: break; - } - - assert(index < SourceCount); - - return index; -} - -// only one of these needed for non-ES; ES needs 2 for different precision defaults of built-ins -enum EPrecisionClass { - EPcGeneral, - EPcFragment, - EPcCount -}; - -// A process-global symbol table per version per profile for built-ins common -// to multiple stages (languages), and a process-global symbol table per version -// per profile per stage for built-ins unique to each stage. They will be sparsely -// populated, so they will only be generated as needed. -// -// Each has a different set of built-ins, and we want to preserve that from -// compile to compile. -// -TSymbolTable* CommonSymbolTable[VersionCount][SpvVersionCount][ProfileCount][SourceCount][EPcCount] = {}; -TSymbolTable* SharedSymbolTables[VersionCount][SpvVersionCount][ProfileCount][SourceCount][EShLangCount] = {}; - -TPoolAllocator* PerProcessGPA = nullptr; - -// -// Parse and add to the given symbol table the content of the given shader string. -// -bool InitializeSymbolTable(const TString& builtIns, int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, - EShSource source, TInfoSink& infoSink, TSymbolTable& symbolTable) -{ - TIntermediate intermediate(language, version, profile); - - intermediate.setSource(source); - - std::unique_ptr parseContext(CreateParseContext(symbolTable, intermediate, version, profile, source, - language, infoSink, spvVersion, true, EShMsgDefault, - true)); - - TShader::ForbidIncluder includer; - TPpContext ppContext(*parseContext, "", includer); - TScanContext scanContext(*parseContext); - parseContext->setScanContext(&scanContext); - parseContext->setPpContext(&ppContext); - - // - // Push the symbol table to give it an initial scope. This - // push should not have a corresponding pop, so that built-ins - // are preserved, and the test for an empty table fails. - // - - symbolTable.push(); - - const char* builtInShaders[2]; - size_t builtInLengths[2]; - builtInShaders[0] = builtIns.c_str(); - builtInLengths[0] = builtIns.size(); - - if (builtInLengths[0] == 0) - return true; - - TInputScanner input(1, builtInShaders, builtInLengths); - if (! parseContext->parseShaderStrings(ppContext, input) != 0) { - infoSink.info.message(EPrefixInternalError, "Unable to parse built-ins"); - printf("Unable to parse built-ins\n%s\n", infoSink.info.c_str()); - printf("%s\n", builtInShaders[0]); - - return false; - } - - return true; -} - -int CommonIndex(EProfile profile, EShLanguage language) -{ - return (profile == EEsProfile && language == EShLangFragment) ? EPcFragment : EPcGeneral; -} - -// -// To initialize per-stage shared tables, with the common table already complete. -// -void InitializeStageSymbolTable(TBuiltInParseables& builtInParseables, int version, EProfile profile, const SpvVersion& spvVersion, - EShLanguage language, EShSource source, TInfoSink& infoSink, TSymbolTable** commonTable, - TSymbolTable** symbolTables) -{ - (*symbolTables[language]).adoptLevels(*commonTable[CommonIndex(profile, language)]); - InitializeSymbolTable(builtInParseables.getStageString(language), version, profile, spvVersion, language, source, - infoSink, *symbolTables[language]); - builtInParseables.identifyBuiltIns(version, profile, spvVersion, language, *symbolTables[language]); - if (profile == EEsProfile && version >= 300) - (*symbolTables[language]).setNoBuiltInRedeclarations(); - if (version == 110) - (*symbolTables[language]).setSeparateNameSpaces(); -} - -// -// Initialize the full set of shareable symbol tables; -// The common (cross-stage) and those shareable per-stage. -// -bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TSymbolTable** symbolTables, int version, EProfile profile, const SpvVersion& spvVersion, EShSource source) -{ - std::unique_ptr builtInParseables(CreateBuiltInParseables(infoSink, source)); - - if (builtInParseables == nullptr) - return false; - - builtInParseables->initialize(version, profile, spvVersion); - - // do the common tables - InitializeSymbolTable(builtInParseables->getCommonString(), version, profile, spvVersion, EShLangVertex, source, - infoSink, *commonTable[EPcGeneral]); - if (profile == EEsProfile) - InitializeSymbolTable(builtInParseables->getCommonString(), version, profile, spvVersion, EShLangFragment, source, - infoSink, *commonTable[EPcFragment]); - - // do the per-stage tables - - // always have vertex and fragment - InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangVertex, source, - infoSink, commonTable, symbolTables); - InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangFragment, source, - infoSink, commonTable, symbolTables); - - // check for tessellation - if ((profile != EEsProfile && version >= 150) || - (profile == EEsProfile && version >= 310)) { - InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangTessControl, source, - infoSink, commonTable, symbolTables); - InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangTessEvaluation, source, - infoSink, commonTable, symbolTables); - } - - // check for geometry - if ((profile != EEsProfile && version >= 150) || - (profile == EEsProfile && version >= 310)) - InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangGeometry, source, - infoSink, commonTable, symbolTables); - - // check for compute - if ((profile != EEsProfile && version >= 420) || - (profile == EEsProfile && version >= 310)) - InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangCompute, source, - infoSink, commonTable, symbolTables); - - return true; -} - -bool AddContextSpecificSymbols(const TBuiltInResource* resources, TInfoSink& infoSink, TSymbolTable& symbolTable, int version, - EProfile profile, const SpvVersion& spvVersion, EShLanguage language, EShSource source) -{ - std::unique_ptr builtInParseables(CreateBuiltInParseables(infoSink, source)); - - if (builtInParseables == nullptr) - return false; - - builtInParseables->initialize(*resources, version, profile, spvVersion, language); - InitializeSymbolTable(builtInParseables->getCommonString(), version, profile, spvVersion, language, source, infoSink, symbolTable); - builtInParseables->identifyBuiltIns(version, profile, spvVersion, language, symbolTable, *resources); - - return true; -} - -// -// To do this on the fly, we want to leave the current state of our thread's -// pool allocator intact, so: -// - Switch to a new pool for parsing the built-ins -// - Do the parsing, which builds the symbol table, using the new pool -// - Switch to the process-global pool to save a copy of the resulting symbol table -// - Free up the new pool used to parse the built-ins -// - Switch back to the original thread's pool -// -// This only gets done the first time any thread needs a particular symbol table -// (lazy evaluation). -// -void SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVersion& spvVersion, EShSource source) -{ - TInfoSink infoSink; - - // Make sure only one thread tries to do this at a time - glslang::GetGlobalLock(); - - // See if it's already been done for this version/profile combination - int versionIndex = MapVersionToIndex(version); - int spvVersionIndex = MapSpvVersionToIndex(spvVersion); - int profileIndex = MapProfileToIndex(profile); - int sourceIndex = MapSourceToIndex(source); - if (CommonSymbolTable[versionIndex][spvVersionIndex][profileIndex][sourceIndex][EPcGeneral]) { - glslang::ReleaseGlobalLock(); - - return; - } - - // Switch to a new pool - TPoolAllocator& previousAllocator = GetThreadPoolAllocator(); - TPoolAllocator* builtInPoolAllocator = new TPoolAllocator; - SetThreadPoolAllocator(builtInPoolAllocator); - - // Dynamically allocate the local symbol tables so we can control when they are deallocated WRT when the pool is popped. - TSymbolTable* commonTable[EPcCount]; - TSymbolTable* stageTables[EShLangCount]; - for (int precClass = 0; precClass < EPcCount; ++precClass) - commonTable[precClass] = new TSymbolTable; - for (int stage = 0; stage < EShLangCount; ++stage) - stageTables[stage] = new TSymbolTable; - - // Generate the local symbol tables using the new pool - InitializeSymbolTables(infoSink, commonTable, stageTables, version, profile, spvVersion, source); - - // Switch to the process-global pool - SetThreadPoolAllocator(PerProcessGPA); - - // Copy the local symbol tables from the new pool to the global tables using the process-global pool - for (int precClass = 0; precClass < EPcCount; ++precClass) { - if (! commonTable[precClass]->isEmpty()) { - CommonSymbolTable[versionIndex][spvVersionIndex][profileIndex][sourceIndex][precClass] = new TSymbolTable; - CommonSymbolTable[versionIndex][spvVersionIndex][profileIndex][sourceIndex][precClass]->copyTable(*commonTable[precClass]); - CommonSymbolTable[versionIndex][spvVersionIndex][profileIndex][sourceIndex][precClass]->readOnly(); - } - } - for (int stage = 0; stage < EShLangCount; ++stage) { - if (! stageTables[stage]->isEmpty()) { - SharedSymbolTables[versionIndex][spvVersionIndex][profileIndex][sourceIndex][stage] = new TSymbolTable; - SharedSymbolTables[versionIndex][spvVersionIndex][profileIndex][sourceIndex][stage]->adoptLevels(*CommonSymbolTable - [versionIndex][spvVersionIndex][profileIndex][sourceIndex][CommonIndex(profile, (EShLanguage)stage)]); - SharedSymbolTables[versionIndex][spvVersionIndex][profileIndex][sourceIndex][stage]->copyTable(*stageTables[stage]); - SharedSymbolTables[versionIndex][spvVersionIndex][profileIndex][sourceIndex][stage]->readOnly(); - } - } - - // Clean up the local tables before deleting the pool they used. - for (int precClass = 0; precClass < EPcCount; ++precClass) - delete commonTable[precClass]; - for (int stage = 0; stage < EShLangCount; ++stage) - delete stageTables[stage]; - - delete builtInPoolAllocator; - SetThreadPoolAllocator(&previousAllocator); - - glslang::ReleaseGlobalLock(); -} - -// Return true if the shader was correctly specified for version/profile/stage. -bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNotFirst, int defaultVersion, - EShSource source, int& version, EProfile& profile, const SpvVersion& spvVersion) -{ - const int FirstProfileVersion = 150; - bool correct = true; - - if (source == EShSourceHlsl) { - version = 500; // shader model; currently a characteristic of glslang, not the input - profile = ECoreProfile; // allow doubles in prototype parsing - return correct; - } - - // Get a version... - if (version == 0) { - version = defaultVersion; - // infoSink.info.message(EPrefixWarning, "#version: statement missing; use #version on first line of shader"); - } - - // Get a good profile... - if (profile == ENoProfile) { - if (version == 300 || version == 310 || version == 320) { - correct = false; - infoSink.info.message(EPrefixError, "#version: versions 300, 310, and 320 require specifying the 'es' profile"); - profile = EEsProfile; - } else if (version == 100) - profile = EEsProfile; - else if (version >= FirstProfileVersion) - profile = ECoreProfile; - else - profile = ENoProfile; - } else { - // a profile was provided... - if (version < 150) { - correct = false; - infoSink.info.message(EPrefixError, "#version: versions before 150 do not allow a profile token"); - if (version == 100) - profile = EEsProfile; - else - profile = ENoProfile; - } else if (version == 300 || version == 310 || version == 320) { - if (profile != EEsProfile) { - correct = false; - infoSink.info.message(EPrefixError, "#version: versions 300, 310, and 320 support only the es profile"); - } - profile = EEsProfile; - } else { - if (profile == EEsProfile) { - correct = false; - infoSink.info.message(EPrefixError, "#version: only version 300, 310, and 320 support the es profile"); - if (version >= FirstProfileVersion) - profile = ECoreProfile; - else - profile = ENoProfile; - } - // else: typical desktop case... e.g., "#version 410 core" - } - } - - // Fix version... - switch (version) { - // ES versions - case 100: break; - case 300: break; - case 310: break; - case 320: break; - - // desktop versions - case 110: break; - case 120: break; - case 130: break; - case 140: break; - case 150: break; - case 330: break; - case 400: break; - case 410: break; - case 420: break; - case 430: break; - case 440: break; - case 450: break; - case 460: break; - - // unknown version - default: - correct = false; - infoSink.info.message(EPrefixError, "version not supported"); - if (profile == EEsProfile) - version = 310; - else { - version = 450; - profile = ECoreProfile; - } - break; - } - - // Correct for stage type... - switch (stage) { - case EShLangGeometry: - if ((profile == EEsProfile && version < 310) || - (profile != EEsProfile && version < 150)) { - correct = false; - infoSink.info.message(EPrefixError, "#version: geometry shaders require es profile with version 310 or non-es profile with version 150 or above"); - version = (profile == EEsProfile) ? 310 : 150; - if (profile == EEsProfile || profile == ENoProfile) - profile = ECoreProfile; - } - break; - case EShLangTessControl: - case EShLangTessEvaluation: - if ((profile == EEsProfile && version < 310) || - (profile != EEsProfile && version < 150)) { - correct = false; - infoSink.info.message(EPrefixError, "#version: tessellation shaders require es profile with version 310 or non-es profile with version 150 or above"); - version = (profile == EEsProfile) ? 310 : 400; // 150 supports the extension, correction is to 400 which does not - if (profile == EEsProfile || profile == ENoProfile) - profile = ECoreProfile; - } - break; - case EShLangCompute: - if ((profile == EEsProfile && version < 310) || - (profile != EEsProfile && version < 420)) { - correct = false; - infoSink.info.message(EPrefixError, "#version: compute shaders require es profile with version 310 or above, or non-es profile with version 420 or above"); - version = profile == EEsProfile ? 310 : 420; - } - break; - default: - break; - } - - if (profile == EEsProfile && version >= 300 && versionNotFirst) { - correct = false; - infoSink.info.message(EPrefixError, "#version: statement must appear first in es-profile shader; before comments or newlines"); - } - - // Check for SPIR-V compatibility - if (spvVersion.spv != 0) { - switch (profile) { - case EEsProfile: - if (spvVersion.vulkan >= 100 && version < 310) { - correct = false; - infoSink.info.message(EPrefixError, "#version: ES shaders for Vulkan SPIR-V require version 310 or higher"); - version = 310; - } - if (spvVersion.openGl >= 100) { - correct = false; - infoSink.info.message(EPrefixError, "#version: ES shaders for OpenGL SPIR-V are not supported"); - version = 310; - } - break; - case ECompatibilityProfile: - infoSink.info.message(EPrefixError, "#version: compilation for SPIR-V does not support the compatibility profile"); - break; - default: - if (spvVersion.vulkan >= 100 && version < 140) { - correct = false; - infoSink.info.message(EPrefixError, "#version: Desktop shaders for Vulkan SPIR-V require version 140 or higher"); - version = 140; - } - if (spvVersion.openGl >= 100 && version < 330) { - correct = false; - infoSink.info.message(EPrefixError, "#version: Desktop shaders for OpenGL SPIR-V require version 330 or higher"); - version = 330; - } - break; - } - } - - return correct; -} - -// There are multiple paths in for setting environment stuff. -// TEnvironment takes precedence, for what it sets, so sort all this out. -// Ideally, the internal code could be made to use TEnvironment, but for -// now, translate it to the historically used parameters. -void TranslateEnvironment(const TEnvironment* environment, EShMessages& messages, EShSource& source, - EShLanguage& stage, SpvVersion& spvVersion) -{ - // Set up environmental defaults, first ignoring 'environment'. - if (messages & EShMsgSpvRules) - spvVersion.spv = 0x00010000; - if (messages & EShMsgVulkanRules) { - spvVersion.vulkan = 100; - spvVersion.vulkanGlsl = 100; - } else if (spvVersion.spv != 0) - spvVersion.openGl = 100; - - // Now, override, based on any content set in 'environment'. - // 'environment' must be cleared to ESh*None settings when items - // are not being set. - if (environment != nullptr) { - // input language - if (environment->input.languageFamily != EShSourceNone) { - stage = environment->input.stage; - switch (environment->input.dialect) { - case EShClientNone: - break; - case EShClientVulkan: - spvVersion.vulkanGlsl = environment->input.dialectVersion; - break; - case EShClientOpenGL: - spvVersion.openGl = environment->input.dialectVersion; - break; - } - switch (environment->input.languageFamily) { - case EShSourceNone: - break; - case EShSourceGlsl: - source = EShSourceGlsl; - messages = static_cast(messages & ~EShMsgReadHlsl); - break; - case EShSourceHlsl: - source = EShSourceHlsl; - messages = static_cast(messages | EShMsgReadHlsl); - break; - } - } - - // client - switch (environment->client.client) { - case EShClientVulkan: - spvVersion.vulkan = environment->client.version; - break; - default: - break; - } - - // generated code - switch (environment->target.language) { - case EshTargetSpv: - spvVersion.spv = environment->target.version; - break; - default: - break; - } - } -} - -// Most processes are recorded when set in the intermediate representation, -// These are the few that are not. -void RecordProcesses(TIntermediate& intermediate, EShMessages messages, const std::string& sourceEntryPointName) -{ - if ((messages & EShMsgRelaxedErrors) != 0) - intermediate.addProcess("relaxed-errors"); - if ((messages & EShMsgSuppressWarnings) != 0) - intermediate.addProcess("suppress-warnings"); - if ((messages & EShMsgKeepUncalled) != 0) - intermediate.addProcess("keep-uncalled"); - if (sourceEntryPointName.size() > 0) { - intermediate.addProcess("source-entrypoint"); - intermediate.addProcessArgument(sourceEntryPointName); - } -} - -// This is the common setup and cleanup code for PreprocessDeferred and -// CompileDeferred. -// It takes any callable with a signature of -// bool (TParseContextBase& parseContext, TPpContext& ppContext, -// TInputScanner& input, bool versionWillBeError, -// TSymbolTable& , TIntermediate& , -// EShOptimizationLevel , EShMessages ); -// Which returns false if a failure was detected and true otherwise. -// -template -bool ProcessDeferred( - TCompiler* compiler, - const char* const shaderStrings[], - const int numStrings, - const int* inputLengths, - const char* const stringNames[], - const char* customPreamble, - const EShOptimizationLevel optLevel, - const TBuiltInResource* resources, - int defaultVersion, // use 100 for ES environment, 110 for desktop; this is the GLSL version, not SPIR-V or Vulkan - EProfile defaultProfile, - // set version/profile to defaultVersion/defaultProfile regardless of the #version - // directive in the source code - bool forceDefaultVersionAndProfile, - bool forwardCompatible, // give errors for use of deprecated features - EShMessages messages, // warnings/errors/AST; things to print out - TIntermediate& intermediate, // returned tree, etc. - ProcessingContext& processingContext, - bool requireNonempty, - TShader::Includer& includer, - const std::string sourceEntryPointName = "", - const TEnvironment* environment = nullptr) // optional way of fully setting all versions, overriding the above -{ - // This must be undone (.pop()) by the caller, after it finishes consuming the created tree. - GetThreadPoolAllocator().push(); - - if (numStrings == 0) - return true; - - // Move to length-based strings, rather than null-terminated strings. - // Also, add strings to include the preamble and to ensure the shader is not null, - // which lets the grammar accept what was a null (post preprocessing) shader. - // - // Shader will look like - // string 0: system preamble - // string 1: custom preamble - // string 2...numStrings+1: user's shader - // string numStrings+2: "int;" - const int numPre = 2; - const int numPost = requireNonempty? 1 : 0; - const int numTotal = numPre + numStrings + numPost; - size_t* lengths = new size_t[numTotal]; - const char** strings = new const char*[numTotal]; - const char** names = new const char*[numTotal]; - for (int s = 0; s < numStrings; ++s) { - strings[s + numPre] = shaderStrings[s]; - if (inputLengths == nullptr || inputLengths[s] < 0) - lengths[s + numPre] = strlen(shaderStrings[s]); - else - lengths[s + numPre] = inputLengths[s]; - } - if (stringNames != nullptr) { - for (int s = 0; s < numStrings; ++s) - names[s + numPre] = stringNames[s]; - } else { - for (int s = 0; s < numStrings; ++s) - names[s + numPre] = nullptr; - } - - // Get all the stages, languages, clients, and other environment - // stuff sorted out. - EShSource source = (messages & EShMsgReadHlsl) != 0 ? EShSourceHlsl : EShSourceGlsl; - SpvVersion spvVersion; - EShLanguage stage = compiler->getLanguage(); - TranslateEnvironment(environment, messages, source, stage, spvVersion); - - // First, without using the preprocessor or parser, find the #version, so we know what - // symbol tables, processing rules, etc. to set up. This does not need the extra strings - // outlined above, just the user shader, after the system and user preambles. - glslang::TInputScanner userInput(numStrings, &strings[numPre], &lengths[numPre]); - int version = 0; - EProfile profile = ENoProfile; - bool versionNotFirstToken = false; - bool versionNotFirst = (source == EShSourceHlsl) - ? true - : userInput.scanVersion(version, profile, versionNotFirstToken); - bool versionNotFound = version == 0; - if (forceDefaultVersionAndProfile && source == EShSourceGlsl) { - if (! (messages & EShMsgSuppressWarnings) && ! versionNotFound && - (version != defaultVersion || profile != defaultProfile)) { - compiler->infoSink.info << "Warning, (version, profile) forced to be (" - << defaultVersion << ", " << ProfileName(defaultProfile) - << "), while in source code it is (" - << version << ", " << ProfileName(profile) << ")\n"; - } - - if (versionNotFound) { - versionNotFirstToken = false; - versionNotFirst = false; - versionNotFound = false; - } - version = defaultVersion; - profile = defaultProfile; - } - - bool goodVersion = DeduceVersionProfile(compiler->infoSink, stage, - versionNotFirst, defaultVersion, source, version, profile, spvVersion); - bool versionWillBeError = (versionNotFound || (profile == EEsProfile && version >= 300 && versionNotFirst)); - bool warnVersionNotFirst = false; - if (! versionWillBeError && versionNotFirstToken) { - if (messages & EShMsgRelaxedErrors) - warnVersionNotFirst = true; - else - versionWillBeError = true; - } - - intermediate.setSource(source); - intermediate.setVersion(version); - intermediate.setProfile(profile); - intermediate.setSpv(spvVersion); - RecordProcesses(intermediate, messages, sourceEntryPointName); - if (spvVersion.vulkan >= 100) - intermediate.setOriginUpperLeft(); - if ((messages & EShMsgHlslOffsets) || source == EShSourceHlsl) - intermediate.setHlslOffsets(); - if (messages & EShMsgDebugInfo) { - intermediate.setSourceFile(names[numPre]); - for (int s = 0; s < numStrings; ++s) - intermediate.addSourceText(strings[numPre + s]); - } - SetupBuiltinSymbolTable(version, profile, spvVersion, source); - - TSymbolTable* cachedTable = SharedSymbolTables[MapVersionToIndex(version)] - [MapSpvVersionToIndex(spvVersion)] - [MapProfileToIndex(profile)] - [MapSourceToIndex(source)] - [stage]; - - // Dynamically allocate the symbol table so we can control when it is deallocated WRT the pool. - TSymbolTable* symbolTableMemory = new TSymbolTable; - TSymbolTable& symbolTable = *symbolTableMemory; - if (cachedTable) - symbolTable.adoptLevels(*cachedTable); - - // Add built-in symbols that are potentially context dependent; - // they get popped again further down. - if (! AddContextSpecificSymbols(resources, compiler->infoSink, symbolTable, version, profile, spvVersion, - stage, source)) - return false; - - // - // Now we can process the full shader under proper symbols and rules. - // - - TParseContextBase* parseContext = CreateParseContext(symbolTable, intermediate, version, profile, source, - stage, compiler->infoSink, - spvVersion, forwardCompatible, messages, false, sourceEntryPointName); - - TPpContext ppContext(*parseContext, names[numPre] ? names[numPre] : "", includer); - - // only GLSL (bison triggered, really) needs an externally set scan context - glslang::TScanContext scanContext(*parseContext); - if (source == EShSourceGlsl) - parseContext->setScanContext(&scanContext); - - parseContext->setPpContext(&ppContext); - parseContext->setLimits(*resources); - if (! goodVersion) - parseContext->addError(); - if (warnVersionNotFirst) { - TSourceLoc loc; - loc.init(); - parseContext->warn(loc, "Illegal to have non-comment, non-whitespace tokens before #version", "#version", ""); - } - - parseContext->initializeExtensionBehavior(); - - // Fill in the strings as outlined above. - std::string preamble; - parseContext->getPreamble(preamble); - strings[0] = preamble.c_str(); - lengths[0] = strlen(strings[0]); - names[0] = nullptr; - strings[1] = customPreamble; - lengths[1] = strlen(strings[1]); - names[1] = nullptr; - assert(2 == numPre); - if (requireNonempty) { - const int postIndex = numStrings + numPre; - strings[postIndex] = "\n int;"; - lengths[postIndex] = strlen(strings[numStrings + numPre]); - names[postIndex] = nullptr; - } - TInputScanner fullInput(numStrings + numPre + numPost, strings, lengths, names, numPre, numPost); - - // Push a new symbol allocation scope that will get used for the shader's globals. - symbolTable.push(); - - bool success = processingContext(*parseContext, ppContext, fullInput, - versionWillBeError, symbolTable, - intermediate, optLevel, messages); - - // Clean up the symbol table. The AST is self-sufficient now. - delete symbolTableMemory; - - delete parseContext; - delete [] lengths; - delete [] strings; - delete [] names; - - return success; -} - -// Responsible for keeping track of the most recent source string and line in -// the preprocessor and outputting newlines appropriately if the source string -// or line changes. -class SourceLineSynchronizer { -public: - SourceLineSynchronizer(const std::function& lastSourceIndex, - std::stringstream* output) - : getLastSourceIndex(lastSourceIndex), output(output), lastSource(-1), lastLine(0) {} -// SourceLineSynchronizer(const SourceLineSynchronizer&) = delete; -// SourceLineSynchronizer& operator=(const SourceLineSynchronizer&) = delete; - - // Sets the internally tracked source string index to that of the most - // recently read token. If we switched to a new source string, returns - // true and inserts a newline. Otherwise, returns false and outputs nothing. - bool syncToMostRecentString() { - if (getLastSourceIndex() != lastSource) { - // After switching to a new source string, we need to reset lastLine - // because line number resets every time a new source string is - // used. We also need to output a newline to separate the output - // from the previous source string (if there is one). - if (lastSource != -1 || lastLine != 0) - *output << std::endl; - lastSource = getLastSourceIndex(); - lastLine = -1; - return true; - } - return false; - } - - // Calls syncToMostRecentString() and then sets the internally tracked line - // number to tokenLine. If we switched to a new line, returns true and inserts - // newlines appropriately. Otherwise, returns false and outputs nothing. - bool syncToLine(int tokenLine) { - syncToMostRecentString(); - const bool newLineStarted = lastLine < tokenLine; - for (; lastLine < tokenLine; ++lastLine) { - if (lastLine > 0) *output << std::endl; - } - return newLineStarted; - } - - // Sets the internally tracked line number to newLineNum. - void setLineNum(int newLineNum) { lastLine = newLineNum; } - -private: - SourceLineSynchronizer& operator=(const SourceLineSynchronizer&); - - // A function for getting the index of the last valid source string we've - // read tokens from. - const std::function getLastSourceIndex; - // output stream for newlines. - std::stringstream* output; - // lastSource is the source string index (starting from 0) of the last token - // processed. It is tracked in order for newlines to be inserted when a new - // source string starts. -1 means we haven't started processing any source - // string. - int lastSource; - // lastLine is the line number (starting from 1) of the last token processed. - // It is tracked in order for newlines to be inserted when a token appears - // on a new line. 0 means we haven't started processing any line in the - // current source string. - int lastLine; -}; - -// DoPreprocessing is a valid ProcessingContext template argument, -// which only performs the preprocessing step of compilation. -// It places the result in the "string" argument to its constructor. -struct DoPreprocessing { - explicit DoPreprocessing(std::string* string): outputString(string) {} - bool operator()(TParseContextBase& parseContext, TPpContext& ppContext, - TInputScanner& input, bool versionWillBeError, - TSymbolTable&, TIntermediate&, - EShOptimizationLevel, EShMessages) - { - // This is a list of tokens that do not require a space before or after. - static const std::string unNeededSpaceTokens = ";()[]"; - static const std::string noSpaceBeforeTokens = ","; - glslang::TPpToken ppToken; - - parseContext.setScanner(&input); - ppContext.setInput(input, versionWillBeError); - - std::stringstream outputStream; - SourceLineSynchronizer lineSync( - std::bind(&TInputScanner::getLastValidSourceIndex, &input), &outputStream); - - parseContext.setExtensionCallback([&lineSync, &outputStream]( - int line, const char* extension, const char* behavior) { - lineSync.syncToLine(line); - outputStream << "#extension " << extension << " : " << behavior; - }); - - parseContext.setLineCallback([&lineSync, &outputStream, &parseContext]( - int curLineNum, int newLineNum, bool hasSource, int sourceNum, const char* sourceName) { - // SourceNum is the number of the source-string that is being parsed. - lineSync.syncToLine(curLineNum); - outputStream << "#line " << newLineNum; - if (hasSource) { - outputStream << " "; - if (sourceName != nullptr) { - outputStream << "\"" << sourceName << "\""; - } else { - outputStream << sourceNum; - } - } - if (parseContext.lineDirectiveShouldSetNextLine()) { - // newLineNum is the new line number for the line following the #line - // directive. So the new line number for the current line is - newLineNum -= 1; - } - outputStream << std::endl; - // And we are at the next line of the #line directive now. - lineSync.setLineNum(newLineNum + 1); - }); - - parseContext.setVersionCallback( - [&lineSync, &outputStream](int line, int version, const char* str) { - lineSync.syncToLine(line); - outputStream << "#version " << version; - if (str) { - outputStream << " " << str; - } - }); - - parseContext.setPragmaCallback([&lineSync, &outputStream]( - int line, const glslang::TVector& ops) { - lineSync.syncToLine(line); - outputStream << "#pragma "; - for(size_t i = 0; i < ops.size(); ++i) { - outputStream << ops[i]; - } - }); - - parseContext.setErrorCallback([&lineSync, &outputStream]( - int line, const char* errorMessage) { - lineSync.syncToLine(line); - outputStream << "#error " << errorMessage; - }); - - int lastToken = EndOfInput; // lastToken records the last token processed. - do { - int token = ppContext.tokenize(ppToken); - if (token == EndOfInput) - break; - - bool isNewString = lineSync.syncToMostRecentString(); - bool isNewLine = lineSync.syncToLine(ppToken.loc.line); - - if (isNewLine) { - // Don't emit whitespace onto empty lines. - // Copy any whitespace characters at the start of a line - // from the input to the output. - outputStream << std::string(ppToken.loc.column - 1, ' '); - } - - // Output a space in between tokens, but not at the start of a line, - // and also not around special tokens. This helps with readability - // and consistency. - if (!isNewString && !isNewLine && lastToken != EndOfInput && - (unNeededSpaceTokens.find((char)token) == std::string::npos) && - (unNeededSpaceTokens.find((char)lastToken) == std::string::npos) && - (noSpaceBeforeTokens.find((char)token) == std::string::npos)) { - outputStream << " "; - } - lastToken = token; - outputStream << ppToken.name; - } while (true); - outputStream << std::endl; - *outputString = outputStream.str(); - - bool success = true; - if (parseContext.getNumErrors() > 0) { - success = false; - parseContext.infoSink.info.prefix(EPrefixError); - parseContext.infoSink.info << parseContext.getNumErrors() << " compilation errors. No code generated.\n\n"; - } - return success; - } - std::string* outputString; -}; - -// DoFullParse is a valid ProcessingConext template argument for fully -// parsing the shader. It populates the "intermediate" with the AST. -struct DoFullParse{ - bool operator()(TParseContextBase& parseContext, TPpContext& ppContext, - TInputScanner& fullInput, bool versionWillBeError, - TSymbolTable&, TIntermediate& intermediate, - EShOptimizationLevel optLevel, EShMessages messages) - { - bool success = true; - // Parse the full shader. - if (! parseContext.parseShaderStrings(ppContext, fullInput, versionWillBeError)) - success = false; - - if (success && intermediate.getTreeRoot()) { - if (optLevel == EShOptNoGeneration) - parseContext.infoSink.info.message(EPrefixNone, "No errors. No code generation or linking was requested."); - else - success = intermediate.postProcess(intermediate.getTreeRoot(), parseContext.getLanguage()); - } else if (! success) { - parseContext.infoSink.info.prefix(EPrefixError); - parseContext.infoSink.info << parseContext.getNumErrors() << " compilation errors. No code generated.\n\n"; - } - - if (messages & EShMsgAST) - intermediate.output(parseContext.infoSink, true); - - return success; - } -}; - -// Take a single compilation unit, and run the preprocessor on it. -// Return: True if there were no issues found in preprocessing, -// False if during preprocessing any unknown version, pragmas or -// extensions were found. -bool PreprocessDeferred( - TCompiler* compiler, - const char* const shaderStrings[], - const int numStrings, - const int* inputLengths, - const char* const stringNames[], - const char* preamble, - const EShOptimizationLevel optLevel, - const TBuiltInResource* resources, - int defaultVersion, // use 100 for ES environment, 110 for desktop - EProfile defaultProfile, - bool forceDefaultVersionAndProfile, - bool forwardCompatible, // give errors for use of deprecated features - EShMessages messages, // warnings/errors/AST; things to print out - TShader::Includer& includer, - TIntermediate& intermediate, // returned tree, etc. - std::string* outputString) -{ - DoPreprocessing parser(outputString); - return ProcessDeferred(compiler, shaderStrings, numStrings, inputLengths, stringNames, - preamble, optLevel, resources, defaultVersion, - defaultProfile, forceDefaultVersionAndProfile, - forwardCompatible, messages, intermediate, parser, - false, includer); -} - -// -// do a partial compile on the given strings for a single compilation unit -// for a potential deferred link into a single stage (and deferred full compile of that -// stage through machine-dependent compilation). -// -// all preprocessing, parsing, semantic checks, etc. for a single compilation unit -// are done here. -// -// return: the tree and other information is filled into the intermediate argument, -// and true is returned by the function for success. -// -bool CompileDeferred( - TCompiler* compiler, - const char* const shaderStrings[], - const int numStrings, - const int* inputLengths, - const char* const stringNames[], - const char* preamble, - const EShOptimizationLevel optLevel, - const TBuiltInResource* resources, - int defaultVersion, // use 100 for ES environment, 110 for desktop - EProfile defaultProfile, - bool forceDefaultVersionAndProfile, - bool forwardCompatible, // give errors for use of deprecated features - EShMessages messages, // warnings/errors/AST; things to print out - TIntermediate& intermediate,// returned tree, etc. - TShader::Includer& includer, - const std::string sourceEntryPointName = "", - TEnvironment* environment = nullptr) -{ - DoFullParse parser; - return ProcessDeferred(compiler, shaderStrings, numStrings, inputLengths, stringNames, - preamble, optLevel, resources, defaultVersion, - defaultProfile, forceDefaultVersionAndProfile, - forwardCompatible, messages, intermediate, parser, - true, includer, sourceEntryPointName, environment); -} - -} // end anonymous namespace for local functions - -// -// ShInitialize() should be called exactly once per process, not per thread. -// -int ShInitialize() -{ - glslang::InitGlobalLock(); - - if (! InitProcess()) - return 0; - - glslang::GetGlobalLock(); - ++NumberOfClients; - glslang::ReleaseGlobalLock(); - - if (PerProcessGPA == nullptr) - PerProcessGPA = new TPoolAllocator(); - - glslang::TScanContext::fillInKeywordMap(); -#ifdef ENABLE_HLSL - glslang::HlslScanContext::fillInKeywordMap(); -#endif - - return 1; -} - -// -// Driver calls these to create and destroy compiler/linker -// objects. -// - -ShHandle ShConstructCompiler(const EShLanguage language, int debugOptions) -{ - if (!InitThread()) - return 0; - - TShHandleBase* base = static_cast(ConstructCompiler(language, debugOptions)); - - return reinterpret_cast(base); -} - -ShHandle ShConstructLinker(const EShExecutable executable, int debugOptions) -{ - if (!InitThread()) - return 0; - - TShHandleBase* base = static_cast(ConstructLinker(executable, debugOptions)); - - return reinterpret_cast(base); -} - -ShHandle ShConstructUniformMap() -{ - if (!InitThread()) - return 0; - - TShHandleBase* base = static_cast(ConstructUniformMap()); - - return reinterpret_cast(base); -} - -void ShDestruct(ShHandle handle) -{ - if (handle == 0) - return; - - TShHandleBase* base = static_cast(handle); - - if (base->getAsCompiler()) - DeleteCompiler(base->getAsCompiler()); - else if (base->getAsLinker()) - DeleteLinker(base->getAsLinker()); - else if (base->getAsUniformMap()) - DeleteUniformMap(base->getAsUniformMap()); -} - -// -// Cleanup symbol tables -// -int __fastcall ShFinalize() -{ - glslang::GetGlobalLock(); - --NumberOfClients; - assert(NumberOfClients >= 0); - bool finalize = NumberOfClients == 0; - glslang::ReleaseGlobalLock(); - if (! finalize) - return 1; - - for (int version = 0; version < VersionCount; ++version) { - for (int spvVersion = 0; spvVersion < SpvVersionCount; ++spvVersion) { - for (int p = 0; p < ProfileCount; ++p) { - for (int source = 0; source < SourceCount; ++source) { - for (int stage = 0; stage < EShLangCount; ++stage) { - delete SharedSymbolTables[version][spvVersion][p][source][stage]; - SharedSymbolTables[version][spvVersion][p][source][stage] = 0; - } - } - } - } - } - - for (int version = 0; version < VersionCount; ++version) { - for (int spvVersion = 0; spvVersion < SpvVersionCount; ++spvVersion) { - for (int p = 0; p < ProfileCount; ++p) { - for (int source = 0; source < SourceCount; ++source) { - for (int pc = 0; pc < EPcCount; ++pc) { - delete CommonSymbolTable[version][spvVersion][p][source][pc]; - CommonSymbolTable[version][spvVersion][p][source][pc] = 0; - } - } - } - } - } - - if (PerProcessGPA != nullptr) { - delete PerProcessGPA; - PerProcessGPA = nullptr; - } - - glslang::TScanContext::deleteKeywordMap(); -#ifdef ENABLE_HLSL - glslang::HlslScanContext::deleteKeywordMap(); -#endif - - return 1; -} - -// -// Do a full compile on the given strings for a single compilation unit -// forming a complete stage. The result of the machine dependent compilation -// is left in the provided compile object. -// -// Return: The return value is really boolean, indicating -// success (1) or failure (0). -// -int ShCompile( - const ShHandle handle, - const char* const shaderStrings[], - const int numStrings, - const int* inputLengths, - const EShOptimizationLevel optLevel, - const TBuiltInResource* resources, - int /*debugOptions*/, - int defaultVersion, // use 100 for ES environment, 110 for desktop - bool forwardCompatible, // give errors for use of deprecated features - EShMessages messages // warnings/errors/AST; things to print out - ) -{ - // Map the generic handle to the C++ object - if (handle == 0) - return 0; - - TShHandleBase* base = reinterpret_cast(handle); - TCompiler* compiler = base->getAsCompiler(); - if (compiler == 0) - return 0; - - SetThreadPoolAllocator(compiler->getPool()); - - compiler->infoSink.info.erase(); - compiler->infoSink.debug.erase(); - - TIntermediate intermediate(compiler->getLanguage()); - TShader::ForbidIncluder includer; - bool success = CompileDeferred(compiler, shaderStrings, numStrings, inputLengths, nullptr, - "", optLevel, resources, defaultVersion, ENoProfile, false, - forwardCompatible, messages, intermediate, includer); - - // - // Call the machine dependent compiler - // - if (success && intermediate.getTreeRoot() && optLevel != EShOptNoGeneration) - success = compiler->compile(intermediate.getTreeRoot(), intermediate.getVersion(), intermediate.getProfile()); - - intermediate.removeTree(); - - // Throw away all the temporary memory used by the compilation process. - // The push was done in the CompileDeferred() call above. - GetThreadPoolAllocator().pop(); - - return success ? 1 : 0; -} - -// -// Link the given compile objects. -// -// Return: The return value of is really boolean, indicating -// success or failure. -// -int ShLinkExt( - const ShHandle linkHandle, - const ShHandle compHandles[], - const int numHandles) -{ - if (linkHandle == 0 || numHandles == 0) - return 0; - - THandleList cObjects; - - for (int i = 0; i < numHandles; ++i) { - if (compHandles[i] == 0) - return 0; - TShHandleBase* base = reinterpret_cast(compHandles[i]); - if (base->getAsLinker()) { - cObjects.push_back(base->getAsLinker()); - } - if (base->getAsCompiler()) - cObjects.push_back(base->getAsCompiler()); - - if (cObjects[i] == 0) - return 0; - } - - TShHandleBase* base = reinterpret_cast(linkHandle); - TLinker* linker = static_cast(base->getAsLinker()); - - SetThreadPoolAllocator(linker->getPool()); - - if (linker == 0) - return 0; - - linker->infoSink.info.erase(); - - for (int i = 0; i < numHandles; ++i) { - if (cObjects[i]->getAsCompiler()) { - if (! cObjects[i]->getAsCompiler()->linkable()) { - linker->infoSink.info.message(EPrefixError, "Not all shaders have valid object code."); - return 0; - } - } - } - - bool ret = linker->link(cObjects); - - return ret ? 1 : 0; -} - -// -// ShSetEncrpytionMethod is a place-holder for specifying -// how source code is encrypted. -// -void ShSetEncryptionMethod(ShHandle handle) -{ - if (handle == 0) - return; -} - -// -// Return any compiler/linker/uniformmap log of messages for the application. -// -const char* ShGetInfoLog(const ShHandle handle) -{ - if (handle == 0) - return 0; - - TShHandleBase* base = static_cast(handle); - TInfoSink* infoSink; - - if (base->getAsCompiler()) - infoSink = &(base->getAsCompiler()->getInfoSink()); - else if (base->getAsLinker()) - infoSink = &(base->getAsLinker()->getInfoSink()); - else - return 0; - - infoSink->info << infoSink->debug.c_str(); - return infoSink->info.c_str(); -} - -// -// Return the resulting binary code from the link process. Structure -// is machine dependent. -// -const void* ShGetExecutable(const ShHandle handle) -{ - if (handle == 0) - return 0; - - TShHandleBase* base = reinterpret_cast(handle); - - TLinker* linker = static_cast(base->getAsLinker()); - if (linker == 0) - return 0; - - return linker->getObjectCode(); -} - -// -// Let the linker know where the application said it's attributes are bound. -// The linker does not use these values, they are remapped by the ICD or -// hardware. It just needs them to know what's aliased. -// -// Return: The return value of is really boolean, indicating -// success or failure. -// -int ShSetVirtualAttributeBindings(const ShHandle handle, const ShBindingTable* table) -{ - if (handle == 0) - return 0; - - TShHandleBase* base = reinterpret_cast(handle); - TLinker* linker = static_cast(base->getAsLinker()); - - if (linker == 0) - return 0; - - linker->setAppAttributeBindings(table); - - return 1; -} - -// -// Let the linker know where the predefined attributes have to live. -// -int ShSetFixedAttributeBindings(const ShHandle handle, const ShBindingTable* table) -{ - if (handle == 0) - return 0; - - TShHandleBase* base = reinterpret_cast(handle); - TLinker* linker = static_cast(base->getAsLinker()); - - if (linker == 0) - return 0; - - linker->setFixedAttributeBindings(table); - return 1; -} - -// -// Some attribute locations are off-limits to the linker... -// -int ShExcludeAttributes(const ShHandle handle, int *attributes, int count) -{ - if (handle == 0) - return 0; - - TShHandleBase* base = reinterpret_cast(handle); - TLinker* linker = static_cast(base->getAsLinker()); - if (linker == 0) - return 0; - - linker->setExcludedAttributes(attributes, count); - - return 1; -} - -// -// Return the index for OpenGL to use for knowing where a uniform lives. -// -// Return: The return value of is really boolean, indicating -// success or failure. -// -int ShGetUniformLocation(const ShHandle handle, const char* name) -{ - if (handle == 0) - return -1; - - TShHandleBase* base = reinterpret_cast(handle); - TUniformMap* uniformMap= base->getAsUniformMap(); - if (uniformMap == 0) - return -1; - - return uniformMap->getLocation(name); -} - -//////////////////////////////////////////////////////////////////////////////////////////// -// -// Deferred-Lowering C++ Interface -// ----------------------------------- -// -// Below is a new alternate C++ interface that might potentially replace the above -// opaque handle-based interface. -// -// See more detailed comment in ShaderLang.h -// - -namespace glslang { - -#include "../Include/revision.h" - -const char* GetEsslVersionString() -{ - return "OpenGL ES GLSL 3.20 glslang Khronos." GLSLANG_REVISION " " GLSLANG_DATE; -} - -const char* GetGlslVersionString() -{ - return "4.60 glslang Khronos." GLSLANG_REVISION " " GLSLANG_DATE; -} - -int GetKhronosToolId() -{ - return 8; -} - -bool InitializeProcess() -{ - return ShInitialize() != 0; -} - -void FinalizeProcess() -{ - ShFinalize(); -} - -class TDeferredCompiler : public TCompiler { -public: - TDeferredCompiler(EShLanguage s, TInfoSink& i) : TCompiler(s, i) { } - virtual bool compile(TIntermNode*, int = 0, EProfile = ENoProfile) { return true; } -}; - -TShader::TShader(EShLanguage s) - : stage(s), lengths(nullptr), stringNames(nullptr), preamble("") -{ - pool = new TPoolAllocator; - infoSink = new TInfoSink; - compiler = new TDeferredCompiler(stage, *infoSink); - intermediate = new TIntermediate(s); - - // clear environment (avoid constructors in them for use in a C interface) - environment.input.languageFamily = EShSourceNone; - environment.input.dialect = EShClientNone; - environment.client.client = EShClientNone; - environment.target.language = EShTargetNone; -} - -TShader::~TShader() -{ - delete infoSink; - delete compiler; - delete intermediate; - delete pool; -} - -void TShader::setStrings(const char* const* s, int n) -{ - strings = s; - numStrings = n; - lengths = nullptr; -} - -void TShader::setStringsWithLengths(const char* const* s, const int* l, int n) -{ - strings = s; - numStrings = n; - lengths = l; -} - -void TShader::setStringsWithLengthsAndNames( - const char* const* s, const int* l, const char* const* names, int n) -{ - strings = s; - numStrings = n; - lengths = l; - stringNames = names; -} - -void TShader::setEntryPoint(const char* entryPoint) -{ - intermediate->setEntryPointName(entryPoint); -} - -void TShader::setSourceEntryPoint(const char* name) -{ - sourceEntryPointName = name; -} - -void TShader::addProcesses(const std::vector& p) -{ - intermediate->addProcesses(p); -} - -// Set binding base for given resource type -void TShader::setShiftBinding(TResourceType res, unsigned int base) { - intermediate->setShiftBinding(res, base); -} - -// Set binding base for given resource type for a given binding set. -void TShader::setShiftBindingForSet(TResourceType res, unsigned int base, unsigned int set) { - intermediate->setShiftBindingForSet(res, base, set); -} - -// Set binding base for sampler types -void TShader::setShiftSamplerBinding(unsigned int base) { setShiftBinding(EResSampler, base); } -// Set binding base for texture types (SRV) -void TShader::setShiftTextureBinding(unsigned int base) { setShiftBinding(EResTexture, base); } -// Set binding base for image types -void TShader::setShiftImageBinding(unsigned int base) { setShiftBinding(EResImage, base); } -// Set binding base for uniform buffer objects (CBV) -void TShader::setShiftUboBinding(unsigned int base) { setShiftBinding(EResUbo, base); } -// Synonym for setShiftUboBinding, to match HLSL language. -void TShader::setShiftCbufferBinding(unsigned int base) { setShiftBinding(EResUbo, base); } -// Set binding base for UAV (unordered access view) -void TShader::setShiftUavBinding(unsigned int base) { setShiftBinding(EResUav, base); } -// Set binding base for SSBOs -void TShader::setShiftSsboBinding(unsigned int base) { setShiftBinding(EResSsbo, base); } -// Enables binding automapping using TIoMapper -void TShader::setAutoMapBindings(bool map) { intermediate->setAutoMapBindings(map); } -// Enables position.Y output negation in vertex shader -void TShader::setInvertY(bool invert) { intermediate->setInvertY(invert); } -// Fragile: currently within one stage: simple auto-assignment of location -void TShader::setAutoMapLocations(bool map) { intermediate->setAutoMapLocations(map); } -// See comment above TDefaultHlslIoMapper in iomapper.cpp: -void TShader::setHlslIoMapping(bool hlslIoMap) { intermediate->setHlslIoMapping(hlslIoMap); } -void TShader::setFlattenUniformArrays(bool flatten) { intermediate->setFlattenUniformArrays(flatten); } -void TShader::setNoStorageFormat(bool useUnknownFormat) { intermediate->setNoStorageFormat(useUnknownFormat); } -void TShader::setResourceSetBinding(const std::vector& base) { intermediate->setResourceSetBinding(base); } -void TShader::setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode) { intermediate->setTextureSamplerTransformMode(mode); } - -// -// Turn the shader strings into a parse tree in the TIntermediate. -// -// Returns true for success. -// -bool TShader::parse(const TBuiltInResource* builtInResources, int defaultVersion, EProfile defaultProfile, bool forceDefaultVersionAndProfile, - bool forwardCompatible, EShMessages messages, Includer& includer) -{ - if (! InitThread()) - return false; - SetThreadPoolAllocator(pool); - - if (! preamble) - preamble = ""; - - return CompileDeferred(compiler, strings, numStrings, lengths, stringNames, - preamble, EShOptNone, builtInResources, defaultVersion, - defaultProfile, forceDefaultVersionAndProfile, - forwardCompatible, messages, *intermediate, includer, sourceEntryPointName, - &environment); -} - -// Fill in a string with the result of preprocessing ShaderStrings -// Returns true if all extensions, pragmas and version strings were valid. -bool TShader::preprocess(const TBuiltInResource* builtInResources, - int defaultVersion, EProfile defaultProfile, - bool forceDefaultVersionAndProfile, - bool forwardCompatible, EShMessages message, - std::string* output_string, - Includer& includer) -{ - if (! InitThread()) - return false; - SetThreadPoolAllocator(pool); - - if (! preamble) - preamble = ""; - - return PreprocessDeferred(compiler, strings, numStrings, lengths, stringNames, preamble, - EShOptNone, builtInResources, defaultVersion, - defaultProfile, forceDefaultVersionAndProfile, - forwardCompatible, message, includer, *intermediate, output_string); -} - -const char* TShader::getInfoLog() -{ - return infoSink->info.c_str(); -} - -const char* TShader::getInfoDebugLog() -{ - return infoSink->debug.c_str(); -} - -TProgram::TProgram() : reflection(0), ioMapper(nullptr), linked(false) -{ - pool = new TPoolAllocator; - infoSink = new TInfoSink; - for (int s = 0; s < EShLangCount; ++s) { - intermediate[s] = 0; - newedIntermediate[s] = false; - } -} - -TProgram::~TProgram() -{ - delete ioMapper; - delete infoSink; - delete reflection; - - for (int s = 0; s < EShLangCount; ++s) - if (newedIntermediate[s]) - delete intermediate[s]; - - delete pool; -} - -// -// Merge the compilation units within each stage into a single TIntermediate. -// All starting compilation units need to be the result of calling TShader::parse(). -// -// Return true for success. -// -bool TProgram::link(EShMessages messages) -{ - if (linked) - return false; - linked = true; - - bool error = false; - - SetThreadPoolAllocator(pool); - - for (int s = 0; s < EShLangCount; ++s) { - if (! linkStage((EShLanguage)s, messages)) - error = true; - } - - // TODO: Link: cross-stage error checking - - return ! error; -} - -// -// Merge the compilation units within the given stage into a single TIntermediate. -// -// Return true for success. -// -bool TProgram::linkStage(EShLanguage stage, EShMessages messages) -{ - if (stages[stage].size() == 0) - return true; - - int numEsShaders = 0, numNonEsShaders = 0; - for (auto it = stages[stage].begin(); it != stages[stage].end(); ++it) { - if ((*it)->intermediate->getProfile() == EEsProfile) { - numEsShaders++; - } else { - numNonEsShaders++; - } - } - - if (numEsShaders > 0 && numNonEsShaders > 0) { - infoSink->info.message(EPrefixError, "Cannot mix ES profile with non-ES profile shaders"); - return false; - } else if (numEsShaders > 1) { - infoSink->info.message(EPrefixError, "Cannot attach multiple ES shaders of the same type to a single program"); - return false; - } - - // - // Be efficient for the common single compilation unit per stage case, - // reusing it's TIntermediate instead of merging into a new one. - // - TIntermediate *firstIntermediate = stages[stage].front()->intermediate; - if (stages[stage].size() == 1) - intermediate[stage] = firstIntermediate; - else { - intermediate[stage] = new TIntermediate(stage, - firstIntermediate->getVersion(), - firstIntermediate->getProfile()); - - - // The new TIntermediate must use the same origin as the original TIntermediates. - // Otherwise linking will fail due to different coordinate systems. - if (firstIntermediate->getOriginUpperLeft()) { - intermediate[stage]->setOriginUpperLeft(); - } - intermediate[stage]->setSpv(firstIntermediate->getSpv()); - - newedIntermediate[stage] = true; - } - - if (messages & EShMsgAST) - infoSink->info << "\nLinked " << StageName(stage) << " stage:\n\n"; - - if (stages[stage].size() > 1) { - std::list::const_iterator it; - for (it = stages[stage].begin(); it != stages[stage].end(); ++it) - intermediate[stage]->merge(*infoSink, *(*it)->intermediate); - } - - intermediate[stage]->finalCheck(*infoSink, (messages & EShMsgKeepUncalled) != 0); - - if (messages & EShMsgAST) - intermediate[stage]->output(*infoSink, true); - - return intermediate[stage]->getNumErrors() == 0; -} - -const char* TProgram::getInfoLog() -{ - return infoSink->info.c_str(); -} - -const char* TProgram::getInfoDebugLog() -{ - return infoSink->debug.c_str(); -} - -// -// Reflection implementation. -// - -bool TProgram::buildReflection() -{ - if (! linked || reflection) - return false; - - reflection = new TReflection; - - for (int s = 0; s < EShLangCount; ++s) { - if (intermediate[s]) { - if (! reflection->addStage((EShLanguage)s, *intermediate[s])) - return false; - } - } - - return true; -} - -int TProgram::getNumLiveUniformVariables() const { return reflection->getNumUniforms(); } -int TProgram::getNumLiveUniformBlocks() const { return reflection->getNumUniformBlocks(); } -const char* TProgram::getUniformName(int index) const { return reflection->getUniform(index).name.c_str(); } -const char* TProgram::getUniformBlockName(int index) const { return reflection->getUniformBlock(index).name.c_str(); } -int TProgram::getUniformBlockSize(int index) const { return reflection->getUniformBlock(index).size; } -int TProgram::getUniformIndex(const char* name) const { return reflection->getIndex(name); } -int TProgram::getUniformBinding(int index) const { return reflection->getUniform(index).getBinding(); } -int TProgram::getUniformBlockIndex(int index) const { return reflection->getUniform(index).index; } -int TProgram::getUniformBlockCounterIndex(int index) const { return reflection->getUniformBlock(index).counterIndex; } -int TProgram::getUniformType(int index) const { return reflection->getUniform(index).glDefineType; } -int TProgram::getUniformBufferOffset(int index) const { return reflection->getUniform(index).offset; } -int TProgram::getUniformArraySize(int index) const { return reflection->getUniform(index).size; } -int TProgram::getNumLiveAttributes() const { return reflection->getNumAttributes(); } -const char* TProgram::getAttributeName(int index) const { return reflection->getAttribute(index).name.c_str(); } -int TProgram::getAttributeType(int index) const { return reflection->getAttribute(index).glDefineType; } -const TType* TProgram::getAttributeTType(int index) const { return reflection->getAttribute(index).getType(); } -const TType* TProgram::getUniformTType(int index) const { return reflection->getUniform(index).getType(); } -const TType* TProgram::getUniformBlockTType(int index) const { return reflection->getUniformBlock(index).getType(); } -unsigned TProgram::getLocalSize(int dim) const { return reflection->getLocalSize(dim); } - -void TProgram::dumpReflection() { reflection->dump(); } - -// -// I/O mapping implementation. -// -bool TProgram::mapIO(TIoMapResolver* resolver) -{ - if (! linked || ioMapper) - return false; - - ioMapper = new TIoMapper; - - for (int s = 0; s < EShLangCount; ++s) { - if (intermediate[s]) { - if (! ioMapper->addStage((EShLanguage)s, *intermediate[s], *infoSink, resolver)) - return false; - } - } - - return true; -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/SymbolTable.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/SymbolTable.cpp deleted file mode 100644 index 233033e7..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/SymbolTable.cpp +++ /dev/null @@ -1,383 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2012-2013 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -// -// Symbol table for parsing. Most functionality and main ideas -// are documented in the header file. -// - -#include "SymbolTable.h" - -namespace glslang { - -// -// TType helper function needs a place to live. -// - -// -// Recursively generate mangled names. -// -void TType::buildMangledName(TString& mangledName) const -{ - if (isMatrix()) - mangledName += 'm'; - else if (isVector()) - mangledName += 'v'; - - switch (basicType) { - case EbtFloat: mangledName += 'f'; break; - case EbtDouble: mangledName += 'd'; break; -#ifdef AMD_EXTENSIONS - case EbtFloat16: mangledName += "f16"; break; -#endif - case EbtInt: mangledName += 'i'; break; - case EbtUint: mangledName += 'u'; break; - case EbtInt64: mangledName += "i64"; break; - case EbtUint64: mangledName += "u64"; break; -#ifdef AMD_EXTENSIONS - case EbtInt16: mangledName += "i16"; break; - case EbtUint16: mangledName += "u16"; break; -#endif - case EbtBool: mangledName += 'b'; break; - case EbtAtomicUint: mangledName += "au"; break; - case EbtSampler: - switch (sampler.type) { - case EbtInt: mangledName += "i"; break; - case EbtUint: mangledName += "u"; break; - default: break; // some compilers want this - } - if (sampler.image) - mangledName += "I"; // a normal image - else if (sampler.sampler) - mangledName += "p"; // a "pure" sampler - else if (!sampler.combined) - mangledName += "t"; // a "pure" texture - else - mangledName += "s"; // traditional combined sampler - if (sampler.arrayed) - mangledName += "A"; - if (sampler.shadow) - mangledName += "S"; - if (sampler.external) - mangledName += "E"; - switch (sampler.dim) { - case Esd1D: mangledName += "1"; break; - case Esd2D: mangledName += "2"; break; - case Esd3D: mangledName += "3"; break; - case EsdCube: mangledName += "C"; break; - case EsdRect: mangledName += "R2"; break; - case EsdBuffer: mangledName += "B"; break; - case EsdSubpass: mangledName += "P"; break; - default: break; // some compilers want this - } - - if (sampler.hasReturnStruct()) { - // Name mangle for sampler return struct uses struct table index. - mangledName += "-tx-struct"; - - char text[16]; // plenty enough space for the small integers. - snprintf(text, sizeof(text), "%d-", sampler.structReturnIndex); - mangledName += text; - } else { - switch (sampler.getVectorSize()) { - case 1: mangledName += "1"; break; - case 2: mangledName += "2"; break; - case 3: mangledName += "3"; break; - case 4: break; // default to prior name mangle behavior - } - } - - if (sampler.ms) - mangledName += "M"; - break; - case EbtStruct: - case EbtBlock: - if (basicType == EbtStruct) - mangledName += "struct-"; - else - mangledName += "block-"; - if (typeName) - mangledName += *typeName; - for (unsigned int i = 0; i < structure->size(); ++i) { - mangledName += '-'; - (*structure)[i].type->buildMangledName(mangledName); - } - default: - break; - } - - if (getVectorSize() > 0) - mangledName += static_cast('0' + getVectorSize()); - else { - mangledName += static_cast('0' + getMatrixCols()); - mangledName += static_cast('0' + getMatrixRows()); - } - - if (arraySizes) { - const int maxSize = 11; - char buf[maxSize]; - for (int i = 0; i < arraySizes->getNumDims(); ++i) { - if (arraySizes->getDimNode(i)) { - if (arraySizes->getDimNode(i)->getAsSymbolNode()) - snprintf(buf, maxSize, "s%d", arraySizes->getDimNode(i)->getAsSymbolNode()->getId()); - else - snprintf(buf, maxSize, "s%p", arraySizes->getDimNode(i)); - } else - snprintf(buf, maxSize, "%d", arraySizes->getDimSize(i)); - mangledName += '['; - mangledName += buf; - mangledName += ']'; - } - } -} - -// -// Dump functions. -// - -void TVariable::dump(TInfoSink& infoSink) const -{ - infoSink.debug << getName().c_str() << ": " << type.getStorageQualifierString() << " " << type.getBasicTypeString(); - if (type.isArray()) { - infoSink.debug << "[0]"; - } - infoSink.debug << "\n"; -} - -void TFunction::dump(TInfoSink& infoSink) const -{ - infoSink.debug << getName().c_str() << ": " << returnType.getBasicTypeString() << " " << getMangledName().c_str() << "\n"; -} - -void TAnonMember::dump(TInfoSink& TInfoSink) const -{ - TInfoSink.debug << "anonymous member " << getMemberNumber() << " of " << getAnonContainer().getName().c_str() << "\n"; -} - -void TSymbolTableLevel::dump(TInfoSink &infoSink) const -{ - tLevel::const_iterator it; - for (it = level.begin(); it != level.end(); ++it) - (*it).second->dump(infoSink); -} - -void TSymbolTable::dump(TInfoSink &infoSink) const -{ - for (int level = currentLevel(); level >= 0; --level) { - infoSink.debug << "LEVEL " << level << "\n"; - table[level]->dump(infoSink); - } -} - -// -// Functions have buried pointers to delete. -// -TFunction::~TFunction() -{ - for (TParamList::iterator i = parameters.begin(); i != parameters.end(); ++i) - delete (*i).type; -} - -// -// Symbol table levels are a map of pointers to symbols that have to be deleted. -// -TSymbolTableLevel::~TSymbolTableLevel() -{ - for (tLevel::iterator it = level.begin(); it != level.end(); ++it) - delete (*it).second; - - delete [] defaultPrecision; -} - -// -// Change all function entries in the table with the non-mangled name -// to be related to the provided built-in operation. -// -void TSymbolTableLevel::relateToOperator(const char* name, TOperator op) -{ - tLevel::const_iterator candidate = level.lower_bound(name); - while (candidate != level.end()) { - const TString& candidateName = (*candidate).first; - TString::size_type parenAt = candidateName.find_first_of('('); - if (parenAt != candidateName.npos && candidateName.compare(0, parenAt, name) == 0) { - TFunction* function = (*candidate).second->getAsFunction(); - function->relateToOperator(op); - } else - break; - ++candidate; - } -} - -// Make all function overloads of the given name require an extension(s). -// Should only be used for a version/profile that actually needs the extension(s). -void TSymbolTableLevel::setFunctionExtensions(const char* name, int num, const char* const extensions[]) -{ - tLevel::const_iterator candidate = level.lower_bound(name); - while (candidate != level.end()) { - const TString& candidateName = (*candidate).first; - TString::size_type parenAt = candidateName.find_first_of('('); - if (parenAt != candidateName.npos && candidateName.compare(0, parenAt, name) == 0) { - TSymbol* symbol = candidate->second; - symbol->setExtensions(num, extensions); - } else - break; - ++candidate; - } -} - -// -// Make all symbols in this table level read only. -// -void TSymbolTableLevel::readOnly() -{ - for (tLevel::iterator it = level.begin(); it != level.end(); ++it) - (*it).second->makeReadOnly(); -} - -// -// Copy a symbol, but the copy is writable; call readOnly() afterward if that's not desired. -// -TSymbol::TSymbol(const TSymbol& copyOf) -{ - name = NewPoolTString(copyOf.name->c_str()); - uniqueId = copyOf.uniqueId; - writable = true; -} - -TVariable::TVariable(const TVariable& copyOf) : TSymbol(copyOf) -{ - type.deepCopy(copyOf.type); - userType = copyOf.userType; - numExtensions = 0; - extensions = 0; - if (copyOf.numExtensions != 0) - setExtensions(copyOf.numExtensions, copyOf.extensions); - - if (! copyOf.constArray.empty()) { - assert(! copyOf.type.isStruct()); - TConstUnionArray newArray(copyOf.constArray, 0, copyOf.constArray.size()); - constArray = newArray; - } - - // don't support specialization-constant subtrees in cloned tables - constSubtree = nullptr; -} - -TVariable* TVariable::clone() const -{ - TVariable *variable = new TVariable(*this); - - return variable; -} - -TFunction::TFunction(const TFunction& copyOf) : TSymbol(copyOf) -{ - for (unsigned int i = 0; i < copyOf.parameters.size(); ++i) { - TParameter param; - parameters.push_back(param); - parameters.back().copyParam(copyOf.parameters[i]); - } - - numExtensions = 0; - extensions = 0; - if (copyOf.extensions != 0) - setExtensions(copyOf.numExtensions, copyOf.extensions); - returnType.deepCopy(copyOf.returnType); - mangledName = copyOf.mangledName; - op = copyOf.op; - defined = copyOf.defined; - prototyped = copyOf.prototyped; - implicitThis = copyOf.implicitThis; - illegalImplicitThis = copyOf.illegalImplicitThis; - defaultParamCount = copyOf.defaultParamCount; -} - -TFunction* TFunction::clone() const -{ - TFunction *function = new TFunction(*this); - - return function; -} - -TAnonMember* TAnonMember::clone() const -{ - // Anonymous members of a given block should be cloned at a higher level, - // where they can all be assured to still end up pointing to a single - // copy of the original container. - assert(0); - - return 0; -} - -TSymbolTableLevel* TSymbolTableLevel::clone() const -{ - TSymbolTableLevel *symTableLevel = new TSymbolTableLevel(); - symTableLevel->anonId = anonId; - symTableLevel->thisLevel = thisLevel; - std::vector containerCopied(anonId, false); - tLevel::const_iterator iter; - for (iter = level.begin(); iter != level.end(); ++iter) { - const TAnonMember* anon = iter->second->getAsAnonMember(); - if (anon) { - // Insert all the anonymous members of this same container at once, - // avoid inserting the other members in the future, once this has been done, - // allowing them to all be part of the same new container. - if (! containerCopied[anon->getAnonId()]) { - TVariable* container = anon->getAnonContainer().clone(); - container->changeName(NewPoolTString("")); - // insert the whole container - symTableLevel->insert(*container, false); - containerCopied[anon->getAnonId()] = true; - } - } else - symTableLevel->insert(*iter->second->clone(), false); - } - - return symTableLevel; -} - -void TSymbolTable::copyTable(const TSymbolTable& copyOf) -{ - assert(adoptedLevels == copyOf.adoptedLevels); - - uniqueId = copyOf.uniqueId; - noBuiltInRedeclarations = copyOf.noBuiltInRedeclarations; - separateNameSpaces = copyOf.separateNameSpaces; - for (unsigned int i = copyOf.adoptedLevels; i < copyOf.table.size(); ++i) - table.push_back(copyOf.table[i]->clone()); -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/SymbolTable.h b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/SymbolTable.h deleted file mode 100644 index f928b7ae..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/SymbolTable.h +++ /dev/null @@ -1,825 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2013 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#ifndef _SYMBOL_TABLE_INCLUDED_ -#define _SYMBOL_TABLE_INCLUDED_ - -// -// Symbol table for parsing. Has these design characteristics: -// -// * Same symbol table can be used to compile many shaders, to preserve -// effort of creating and loading with the large numbers of built-in -// symbols. -// -// --> This requires a copy mechanism, so initial pools used to create -// the shared information can be popped. Done through "clone" -// methods. -// -// * Name mangling will be used to give each function a unique name -// so that symbol table lookups are never ambiguous. This allows -// a simpler symbol table structure. -// -// * Pushing and popping of scope, so symbol table will really be a stack -// of symbol tables. Searched from the top, with new inserts going into -// the top. -// -// * Constants: Compile time constant symbols will keep their values -// in the symbol table. The parser can substitute constants at parse -// time, including doing constant folding and constant propagation. -// -// * No temporaries: Temporaries made from operations (+, --, .xy, etc.) -// are tracked in the intermediate representation, not the symbol table. -// - -#include "../Include/Common.h" -#include "../Include/intermediate.h" -#include "../Include/InfoSink.h" - -namespace glslang { - -// -// Symbol base class. (Can build functions or variables out of these...) -// - -class TVariable; -class TFunction; -class TAnonMember; - -class TSymbol { -public: - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - explicit TSymbol(const TString *n) : name(n), numExtensions(0), extensions(0), writable(true) { } - virtual TSymbol* clone() const = 0; - virtual ~TSymbol() { } // rely on all symbol owned memory coming from the pool - - virtual const TString& getName() const { return *name; } - virtual void changeName(const TString* newName) { name = newName; } - virtual void addPrefix(const char* prefix) - { - TString newName(prefix); - newName.append(*name); - changeName(NewPoolTString(newName.c_str())); - } - virtual const TString& getMangledName() const { return getName(); } - virtual TFunction* getAsFunction() { return 0; } - virtual const TFunction* getAsFunction() const { return 0; } - virtual TVariable* getAsVariable() { return 0; } - virtual const TVariable* getAsVariable() const { return 0; } - virtual const TAnonMember* getAsAnonMember() const { return 0; } - virtual const TType& getType() const = 0; - virtual TType& getWritableType() = 0; - virtual void setUniqueId(int id) { uniqueId = id; } - virtual int getUniqueId() const { return uniqueId; } - virtual void setExtensions(int num, const char* const exts[]) - { - assert(extensions == 0); - assert(num > 0); - numExtensions = num; - extensions = NewPoolObject(exts[0], num); - for (int e = 0; e < num; ++e) - extensions[e] = exts[e]; - } - virtual int getNumExtensions() const { return numExtensions; } - virtual const char** getExtensions() const { return extensions; } - virtual void dump(TInfoSink &infoSink) const = 0; - - virtual bool isReadOnly() const { return ! writable; } - virtual void makeReadOnly() { writable = false; } - -protected: - explicit TSymbol(const TSymbol&); - TSymbol& operator=(const TSymbol&); - - const TString *name; - unsigned int uniqueId; // For cross-scope comparing during code generation - - // For tracking what extensions must be present - // (don't use if correct version/profile is present). - int numExtensions; - const char** extensions; // an array of pointers to existing constant char strings - - // - // N.B.: Non-const functions that will be generally used should assert on this, - // to avoid overwriting shared symbol-table information. - // - bool writable; -}; - -// -// Variable class, meaning a symbol that's not a function. -// -// There could be a separate class hierarchy for Constant variables; -// Only one of int, bool, or float, (or none) is correct for -// any particular use, but it's easy to do this way, and doesn't -// seem worth having separate classes, and "getConst" can't simply return -// different values for different types polymorphically, so this is -// just simple and pragmatic. -// -class TVariable : public TSymbol { -public: - TVariable(const TString *name, const TType& t, bool uT = false ) - : TSymbol(name), - userType(uT), - constSubtree(nullptr), - anonId(-1) { type.shallowCopy(t); } - virtual TVariable* clone() const; - virtual ~TVariable() { } - - virtual TVariable* getAsVariable() { return this; } - virtual const TVariable* getAsVariable() const { return this; } - virtual const TType& getType() const { return type; } - virtual TType& getWritableType() { assert(writable); return type; } - virtual bool isUserType() const { return userType; } - virtual const TConstUnionArray& getConstArray() const { return constArray; } - virtual TConstUnionArray& getWritableConstArray() { assert(writable); return constArray; } - virtual void setConstArray(const TConstUnionArray& array) { constArray = array; } - virtual void setConstSubtree(TIntermTyped* subtree) { constSubtree = subtree; } - virtual TIntermTyped* getConstSubtree() const { return constSubtree; } - virtual void setAnonId(int i) { anonId = i; } - virtual int getAnonId() const { return anonId; } - - virtual void dump(TInfoSink &infoSink) const; - -protected: - explicit TVariable(const TVariable&); - TVariable& operator=(const TVariable&); - - TType type; - bool userType; - // we are assuming that Pool Allocator will free the memory allocated to unionArray - // when this object is destroyed - - // TODO: these two should be a union - // A variable could be a compile-time constant, or a specialization - // constant, or neither, but never both. - TConstUnionArray constArray; // for compile-time constant value - TIntermTyped* constSubtree; // for specialization constant computation - int anonId; // the ID used for anonymous blocks: TODO: see if uniqueId could serve a dual purpose -}; - -// -// The function sub-class of symbols and the parser will need to -// share this definition of a function parameter. -// -struct TParameter { - TString *name; - TType* type; - TIntermTyped* defaultValue; - void copyParam(const TParameter& param) - { - if (param.name) - name = NewPoolTString(param.name->c_str()); - else - name = 0; - type = param.type->clone(); - defaultValue = param.defaultValue; - } - TBuiltInVariable getDeclaredBuiltIn() const { return type->getQualifier().declaredBuiltIn; } -}; - -// -// The function sub-class of a symbol. -// -class TFunction : public TSymbol { -public: - explicit TFunction(TOperator o) : - TSymbol(0), - op(o), - defined(false), prototyped(false), implicitThis(false), illegalImplicitThis(false), defaultParamCount(0) { } - TFunction(const TString *name, const TType& retType, TOperator tOp = EOpNull) : - TSymbol(name), - mangledName(*name + '('), - op(tOp), - defined(false), prototyped(false), implicitThis(false), illegalImplicitThis(false), defaultParamCount(0) - { - returnType.shallowCopy(retType); - declaredBuiltIn = retType.getQualifier().builtIn; - } - virtual TFunction* clone() const override; - virtual ~TFunction(); - - virtual TFunction* getAsFunction() override { return this; } - virtual const TFunction* getAsFunction() const override { return this; } - - // Install 'p' as the (non-'this') last parameter. - // Non-'this' parameters are reflected in both the list of parameters and the - // mangled name. - virtual void addParameter(TParameter& p) - { - assert(writable); - parameters.push_back(p); - p.type->appendMangledName(mangledName); - - if (p.defaultValue != nullptr) - defaultParamCount++; - } - - // Install 'this' as the first parameter. - // 'this' is reflected in the list of parameters, but not the mangled name. - virtual void addThisParameter(TType& type, const char* name) - { - TParameter p = { NewPoolTString(name), new TType, nullptr }; - p.type->shallowCopy(type); - parameters.insert(parameters.begin(), p); - } - - virtual void addPrefix(const char* prefix) override - { - TSymbol::addPrefix(prefix); - mangledName.insert(0, prefix); - } - - virtual void removePrefix(const TString& prefix) - { - assert(mangledName.compare(0, prefix.size(), prefix) == 0); - mangledName.erase(0, prefix.size()); - } - - virtual const TString& getMangledName() const override { return mangledName; } - virtual const TType& getType() const override { return returnType; } - virtual TBuiltInVariable getDeclaredBuiltInType() const { return declaredBuiltIn; } - virtual TType& getWritableType() override { return returnType; } - virtual void relateToOperator(TOperator o) { assert(writable); op = o; } - virtual TOperator getBuiltInOp() const { return op; } - virtual void setDefined() { assert(writable); defined = true; } - virtual bool isDefined() const { return defined; } - virtual void setPrototyped() { assert(writable); prototyped = true; } - virtual bool isPrototyped() const { return prototyped; } - virtual void setImplicitThis() { assert(writable); implicitThis = true; } - virtual bool hasImplicitThis() const { return implicitThis; } - virtual void setIllegalImplicitThis() { assert(writable); illegalImplicitThis = true; } - virtual bool hasIllegalImplicitThis() const { return illegalImplicitThis; } - - // Return total number of parameters - virtual int getParamCount() const { return static_cast(parameters.size()); } - // Return number of parameters with default values. - virtual int getDefaultParamCount() const { return defaultParamCount; } - // Return number of fixed parameters (without default values) - virtual int getFixedParamCount() const { return getParamCount() - getDefaultParamCount(); } - - virtual TParameter& operator[](int i) { assert(writable); return parameters[i]; } - virtual const TParameter& operator[](int i) const { return parameters[i]; } - - virtual void dump(TInfoSink &infoSink) const override; - -protected: - explicit TFunction(const TFunction&); - TFunction& operator=(const TFunction&); - - typedef TVector TParamList; - TParamList parameters; - TType returnType; - TBuiltInVariable declaredBuiltIn; - - TString mangledName; - TOperator op; - bool defined; - bool prototyped; - bool implicitThis; // True if this function is allowed to see all members of 'this' - bool illegalImplicitThis; // True if this function is not supposed to have access to dynamic members of 'this', - // even if it finds member variables in the symbol table. - // This is important for a static member function that has member variables in scope, - // but is not allowed to use them, or see hidden symbols instead. - int defaultParamCount; -}; - -// -// Members of anonymous blocks are a kind of TSymbol. They are not hidden in -// the symbol table behind a container; rather they are visible and point to -// their anonymous container. (The anonymous container is found through the -// member, not the other way around.) -// -class TAnonMember : public TSymbol { -public: - TAnonMember(const TString* n, unsigned int m, const TVariable& a, int an) : TSymbol(n), anonContainer(a), memberNumber(m), anonId(an) { } - virtual TAnonMember* clone() const; - virtual ~TAnonMember() { } - - virtual const TAnonMember* getAsAnonMember() const { return this; } - virtual const TVariable& getAnonContainer() const { return anonContainer; } - virtual unsigned int getMemberNumber() const { return memberNumber; } - - virtual const TType& getType() const - { - const TTypeList& types = *anonContainer.getType().getStruct(); - return *types[memberNumber].type; - } - - virtual TType& getWritableType() - { - assert(writable); - const TTypeList& types = *anonContainer.getType().getStruct(); - return *types[memberNumber].type; - } - - virtual int getAnonId() const { return anonId; } - virtual void dump(TInfoSink &infoSink) const; - -protected: - explicit TAnonMember(const TAnonMember&); - TAnonMember& operator=(const TAnonMember&); - - const TVariable& anonContainer; - unsigned int memberNumber; - int anonId; -}; - -class TSymbolTableLevel { -public: - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - TSymbolTableLevel() : defaultPrecision(0), anonId(0), thisLevel(false) { } - ~TSymbolTableLevel(); - - bool insert(TSymbol& symbol, bool separateNameSpaces) - { - // - // returning true means symbol was added to the table with no semantic errors - // - const TString& name = symbol.getName(); - if (name == "") { - symbol.getAsVariable()->setAnonId(anonId++); - // An empty name means an anonymous container, exposing its members to the external scope. - // Give it a name and insert its members in the symbol table, pointing to the container. - char buf[20]; - snprintf(buf, 20, "%s%d", AnonymousPrefix, symbol.getAsVariable()->getAnonId()); - symbol.changeName(NewPoolTString(buf)); - - return insertAnonymousMembers(symbol, 0); - } else { - // Check for redefinition errors: - // - STL itself will tell us if there is a direct name collision, with name mangling, at this level - // - additionally, check for function-redefining-variable name collisions - const TString& insertName = symbol.getMangledName(); - if (symbol.getAsFunction()) { - // make sure there isn't a variable of this name - if (! separateNameSpaces && level.find(name) != level.end()) - return false; - - // insert, and whatever happens is okay - level.insert(tLevelPair(insertName, &symbol)); - - return true; - } else - return level.insert(tLevelPair(insertName, &symbol)).second; - } - } - - // Add more members to an already inserted aggregate object - bool amend(TSymbol& symbol, int firstNewMember) - { - // See insert() for comments on basic explanation of insert. - // This operates similarly, but more simply. - // Only supporting amend of anonymous blocks so far. - if (IsAnonymous(symbol.getName())) - return insertAnonymousMembers(symbol, firstNewMember); - else - return false; - } - - bool insertAnonymousMembers(TSymbol& symbol, int firstMember) - { - const TTypeList& types = *symbol.getAsVariable()->getType().getStruct(); - for (unsigned int m = firstMember; m < types.size(); ++m) { - TAnonMember* member = new TAnonMember(&types[m].type->getFieldName(), m, *symbol.getAsVariable(), symbol.getAsVariable()->getAnonId()); - if (! level.insert(tLevelPair(member->getMangledName(), member)).second) - return false; - } - - return true; - } - - TSymbol* find(const TString& name) const - { - tLevel::const_iterator it = level.find(name); - if (it == level.end()) - return 0; - else - return (*it).second; - } - - void findFunctionNameList(const TString& name, TVector& list) - { - size_t parenAt = name.find_first_of('('); - TString base(name, 0, parenAt + 1); - - tLevel::const_iterator begin = level.lower_bound(base); - base[parenAt] = ')'; // assume ')' is lexically after '(' - tLevel::const_iterator end = level.upper_bound(base); - for (tLevel::const_iterator it = begin; it != end; ++it) - list.push_back(it->second->getAsFunction()); - } - - // See if there is already a function in the table having the given non-function-style name. - bool hasFunctionName(const TString& name) const - { - tLevel::const_iterator candidate = level.lower_bound(name); - if (candidate != level.end()) { - const TString& candidateName = (*candidate).first; - TString::size_type parenAt = candidateName.find_first_of('('); - if (parenAt != candidateName.npos && candidateName.compare(0, parenAt, name) == 0) - - return true; - } - - return false; - } - - // See if there is a variable at this level having the given non-function-style name. - // Return true if name is found, and set variable to true if the name was a variable. - bool findFunctionVariableName(const TString& name, bool& variable) const - { - tLevel::const_iterator candidate = level.lower_bound(name); - if (candidate != level.end()) { - const TString& candidateName = (*candidate).first; - TString::size_type parenAt = candidateName.find_first_of('('); - if (parenAt == candidateName.npos) { - // not a mangled name - if (candidateName == name) { - // found a variable name match - variable = true; - return true; - } - } else { - // a mangled name - if (candidateName.compare(0, parenAt, name) == 0) { - // found a function name match - variable = false; - return true; - } - } - } - - return false; - } - - // Use this to do a lazy 'push' of precision defaults the first time - // a precision statement is seen in a new scope. Leave it at 0 for - // when no push was needed. Thus, it is not the current defaults, - // it is what to restore the defaults to when popping a level. - void setPreviousDefaultPrecisions(const TPrecisionQualifier *p) - { - // can call multiple times at one scope, will only latch on first call, - // as we're tracking the previous scope's values, not the current values - if (defaultPrecision != 0) - return; - - defaultPrecision = new TPrecisionQualifier[EbtNumTypes]; - for (int t = 0; t < EbtNumTypes; ++t) - defaultPrecision[t] = p[t]; - } - - void getPreviousDefaultPrecisions(TPrecisionQualifier *p) - { - // can be called for table level pops that didn't set the - // defaults - if (defaultPrecision == 0 || p == 0) - return; - - for (int t = 0; t < EbtNumTypes; ++t) - p[t] = defaultPrecision[t]; - } - - void relateToOperator(const char* name, TOperator op); - void setFunctionExtensions(const char* name, int num, const char* const extensions[]); - void dump(TInfoSink &infoSink) const; - TSymbolTableLevel* clone() const; - void readOnly(); - - void setThisLevel() { thisLevel = true; } - bool isThisLevel() const { return thisLevel; } - -protected: - explicit TSymbolTableLevel(TSymbolTableLevel&); - TSymbolTableLevel& operator=(TSymbolTableLevel&); - - typedef std::map, pool_allocator > > tLevel; - typedef const tLevel::value_type tLevelPair; - typedef std::pair tInsertResult; - - tLevel level; // named mappings - TPrecisionQualifier *defaultPrecision; - int anonId; - bool thisLevel; // True if this level of the symbol table is a structure scope containing member function - // that are supposed to see anonymous access to member variables. -}; - -class TSymbolTable { -public: - TSymbolTable() : uniqueId(0), noBuiltInRedeclarations(false), separateNameSpaces(false), adoptedLevels(0) - { - // - // This symbol table cannot be used until push() is called. - // - } - ~TSymbolTable() - { - // this can be called explicitly; safest to code it so it can be called multiple times - - // don't deallocate levels passed in from elsewhere - while (table.size() > adoptedLevels) - pop(0); - } - - void adoptLevels(TSymbolTable& symTable) - { - for (unsigned int level = 0; level < symTable.table.size(); ++level) { - table.push_back(symTable.table[level]); - ++adoptedLevels; - } - uniqueId = symTable.uniqueId; - noBuiltInRedeclarations = symTable.noBuiltInRedeclarations; - separateNameSpaces = symTable.separateNameSpaces; - } - - // - // While level adopting is generic, the methods below enact a the following - // convention for levels: - // 0: common built-ins shared across all stages, all compiles, only one copy for all symbol tables - // 1: per-stage built-ins, shared across all compiles, but a different copy per stage - // 2: built-ins specific to a compile, like resources that are context-dependent, or redeclared built-ins - // 3: user-shader globals - // -protected: - static const int globalLevel = 3; - bool isSharedLevel(int level) { return level <= 1; } // exclude all per-compile levels - bool isBuiltInLevel(int level) { return level <= 2; } // exclude user globals - bool isGlobalLevel(int level) { return level <= globalLevel; } // include user globals -public: - bool isEmpty() { return table.size() == 0; } - bool atBuiltInLevel() { return isBuiltInLevel(currentLevel()); } - bool atGlobalLevel() { return isGlobalLevel(currentLevel()); } - - void setNoBuiltInRedeclarations() { noBuiltInRedeclarations = true; } - void setSeparateNameSpaces() { separateNameSpaces = true; } - - void push() - { - table.push_back(new TSymbolTableLevel); - } - - // Make a new symbol-table level to represent the scope introduced by a structure - // containing member functions, such that the member functions can find anonymous - // references to member variables. - // - // 'thisSymbol' should have a name of "" to trigger anonymous structure-member - // symbol finds. - void pushThis(TSymbol& thisSymbol) - { - assert(thisSymbol.getName().size() == 0); - table.push_back(new TSymbolTableLevel); - table.back()->setThisLevel(); - insert(thisSymbol); - } - - void pop(TPrecisionQualifier *p) - { - table[currentLevel()]->getPreviousDefaultPrecisions(p); - delete table.back(); - table.pop_back(); - } - - // - // Insert a visible symbol into the symbol table so it can - // be found later by name. - // - // Returns false if the was a name collision. - // - bool insert(TSymbol& symbol) - { - symbol.setUniqueId(++uniqueId); - - // make sure there isn't a function of this variable name - if (! separateNameSpaces && ! symbol.getAsFunction() && table[currentLevel()]->hasFunctionName(symbol.getName())) - return false; - - // check for not overloading or redefining a built-in function - if (noBuiltInRedeclarations) { - if (atGlobalLevel() && currentLevel() > 0) { - if (table[0]->hasFunctionName(symbol.getName())) - return false; - if (currentLevel() > 1 && table[1]->hasFunctionName(symbol.getName())) - return false; - } - } - - return table[currentLevel()]->insert(symbol, separateNameSpaces); - } - - // Add more members to an already inserted aggregate object - bool amend(TSymbol& symbol, int firstNewMember) - { - // See insert() for comments on basic explanation of insert. - // This operates similarly, but more simply. - return table[currentLevel()]->amend(symbol, firstNewMember); - } - - // - // To allocate an internal temporary, which will need to be uniquely - // identified by the consumer of the AST, but never need to - // found by doing a symbol table search by name, hence allowed an - // arbitrary name in the symbol with no worry of collision. - // - void makeInternalVariable(TSymbol& symbol) - { - symbol.setUniqueId(++uniqueId); - } - - // - // Copy a variable or anonymous member's structure from a shared level so that - // it can be added (soon after return) to the symbol table where it can be - // modified without impacting other users of the shared table. - // - TSymbol* copyUpDeferredInsert(TSymbol* shared) - { - if (shared->getAsVariable()) { - TSymbol* copy = shared->clone(); - copy->setUniqueId(shared->getUniqueId()); - return copy; - } else { - const TAnonMember* anon = shared->getAsAnonMember(); - assert(anon); - TVariable* container = anon->getAnonContainer().clone(); - container->changeName(NewPoolTString("")); - container->setUniqueId(anon->getAnonContainer().getUniqueId()); - return container; - } - } - - TSymbol* copyUp(TSymbol* shared) - { - TSymbol* copy = copyUpDeferredInsert(shared); - table[globalLevel]->insert(*copy, separateNameSpaces); - if (shared->getAsVariable()) - return copy; - else { - // return the copy of the anonymous member - return table[globalLevel]->find(shared->getName()); - } - } - - // Normal find of a symbol, that can optionally say whether the symbol was found - // at a built-in level or the current top-scope level. - TSymbol* find(const TString& name, bool* builtIn = 0, bool* currentScope = 0, int* thisDepthP = 0) - { - int level = currentLevel(); - TSymbol* symbol; - int thisDepth = 0; - do { - if (table[level]->isThisLevel()) - ++thisDepth; - symbol = table[level]->find(name); - --level; - } while (symbol == nullptr && level >= 0); - level++; - if (builtIn) - *builtIn = isBuiltInLevel(level); - if (currentScope) - *currentScope = isGlobalLevel(currentLevel()) || level == currentLevel(); // consider shared levels as "current scope" WRT user globals - if (thisDepthP != nullptr) { - if (! table[level]->isThisLevel()) - thisDepth = 0; - *thisDepthP = thisDepth; - } - - return symbol; - } - - // Find of a symbol that returns how many layers deep of nested - // structures-with-member-functions ('this' scopes) deep the symbol was - // found in. - TSymbol* find(const TString& name, int& thisDepth) - { - int level = currentLevel(); - TSymbol* symbol; - thisDepth = 0; - do { - if (table[level]->isThisLevel()) - ++thisDepth; - symbol = table[level]->find(name); - --level; - } while (symbol == 0 && level >= 0); - - if (! table[level + 1]->isThisLevel()) - thisDepth = 0; - - return symbol; - } - - bool isFunctionNameVariable(const TString& name) const - { - if (separateNameSpaces) - return false; - - int level = currentLevel(); - do { - bool variable; - bool found = table[level]->findFunctionVariableName(name, variable); - if (found) - return variable; - --level; - } while (level >= 0); - - return false; - } - - void findFunctionNameList(const TString& name, TVector& list, bool& builtIn) - { - // For user levels, return the set found in the first scope with a match - builtIn = false; - int level = currentLevel(); - do { - table[level]->findFunctionNameList(name, list); - --level; - } while (list.empty() && level >= globalLevel); - - if (! list.empty()) - return; - - // Gather across all built-in levels; they don't hide each other - builtIn = true; - do { - table[level]->findFunctionNameList(name, list); - --level; - } while (level >= 0); - } - - void relateToOperator(const char* name, TOperator op) - { - for (unsigned int level = 0; level < table.size(); ++level) - table[level]->relateToOperator(name, op); - } - - void setFunctionExtensions(const char* name, int num, const char* const extensions[]) - { - for (unsigned int level = 0; level < table.size(); ++level) - table[level]->setFunctionExtensions(name, num, extensions); - } - - void setVariableExtensions(const char* name, int num, const char* const extensions[]) - { - TSymbol* symbol = find(TString(name)); - if (symbol) - symbol->setExtensions(num, extensions); - } - - int getMaxSymbolId() { return uniqueId; } - void dump(TInfoSink &infoSink) const; - void copyTable(const TSymbolTable& copyOf); - - void setPreviousDefaultPrecisions(TPrecisionQualifier *p) { table[currentLevel()]->setPreviousDefaultPrecisions(p); } - - void readOnly() - { - for (unsigned int level = 0; level < table.size(); ++level) - table[level]->readOnly(); - } - -protected: - TSymbolTable(TSymbolTable&); - TSymbolTable& operator=(TSymbolTableLevel&); - - int currentLevel() const { return static_cast(table.size()) - 1; } - - std::vector table; - int uniqueId; // for unique identification in code generation - bool noBuiltInRedeclarations; - bool separateNameSpaces; - unsigned int adoptedLevels; -}; - -} // end namespace glslang - -#endif // _SYMBOL_TABLE_INCLUDED_ diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Versions.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Versions.cpp deleted file mode 100644 index a8757ad3..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Versions.cpp +++ /dev/null @@ -1,808 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2012-2013 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -// -// Help manage multiple profiles, versions, extensions etc. -// -// These don't return error codes, as the presumption is parsing will -// always continue as if the tested feature were enabled, and thus there -// is no error recovery needed. -// - -// -// HOW TO add a feature enabled by an extension. -// -// To add a new hypothetical "Feature F" to the front end, where an extension -// "XXX_extension_X" can be used to enable the feature, do the following. -// -// OVERVIEW: Specific features are what are error-checked for, not -// extensions: A specific Feature F might be enabled by an extension, or a -// particular version in a particular profile, or a stage, or combinations, etc. -// -// The basic mechanism is to use the following to "declare" all the things that -// enable/disable Feature F, in a code path that implements Feature F: -// -// requireProfile() -// profileRequires() -// requireStage() -// checkDeprecated() -// requireNotRemoved() -// requireExtensions() -// -// Typically, only the first two calls are needed. They go into a code path that -// implements Feature F, and will log the proper error/warning messages. Parsing -// will then always continue as if the tested feature was enabled. -// -// There is typically no if-testing or conditional parsing, just insertion of the calls above. -// However, if symbols specific to the extension are added (step 5), they will -// only be added under tests that the minimum version and profile are present. -// -// 1) Add a symbol name for the extension string at the bottom of Versions.h: -// -// const char* const XXX_extension_X = "XXX_extension_X"; -// -// 2) Add extension initialization to TParseVersions::initializeExtensionBehavior(), -// the first function below: -// -// extensionBehavior[XXX_extension_X] = EBhDisable; -// -// 3) Add any preprocessor directives etc. in the next function, TParseVersions::getPreamble(): -// -// "#define XXX_extension_X 1\n" -// -// The new-line is important, as that ends preprocess tokens. -// -// 4) Insert a profile check in the feature's path (unless all profiles support the feature, -// for some version level). That is, call requireProfile() to constrain the profiles, e.g.: -// -// // ... in a path specific to Feature F... -// requireProfile(loc, -// ECoreProfile | ECompatibilityProfile, -// "Feature F"); -// -// 5) For each profile that supports the feature, insert version/extension checks: -// -// The mostly likely scenario is that Feature F can only be used with a -// particular profile if XXX_extension_X is present or the version is -// high enough that the core specification already incorporated it. -// -// // following the requireProfile() call... -// profileRequires(loc, -// ECoreProfile | ECompatibilityProfile, -// 420, // 0 if no version incorporated the feature into the core spec. -// XXX_extension_X, // can be a list of extensions that all add the feature -// "Feature F Description"); -// -// This allows the feature if either A) one of the extensions is enabled or -// B) the version is high enough. If no version yet incorporates the feature -// into core, pass in 0. -// -// This can be called multiple times, if different profiles support the -// feature starting at different version numbers or with different -// extensions. -// -// This must be called for each profile allowed by the initial call to requireProfile(). -// -// Profiles are all masks, which can be "or"-ed together. -// -// ENoProfile -// ECoreProfile -// ECompatibilityProfile -// EEsProfile -// -// The ENoProfile profile is only for desktop, before profiles showed up in version 150; -// All other #version with no profile default to either es or core, and so have profiles. -// -// You can select all but a particular profile using ~. The following basically means "desktop": -// -// ~EEsProfile -// -// 6) If built-in symbols are added by the extension, add them in Initialize.cpp: Their use -// will be automatically error checked against the extensions enabled at that moment. -// see the comment at the top of Initialize.cpp for where to put them. Establish them at -// the earliest release that supports the extension. Then, tag them with the -// set of extensions that both enable them and are necessary, given the version of the symbol -// table. (There is a different symbol table for each version.) -// - -#include "parseVersions.h" -#include "localintermediate.h" - -namespace glslang { - -// -// Initialize all extensions, almost always to 'disable', as once their features -// are incorporated into a core version, their features are supported through allowing that -// core version, not through a pseudo-enablement of the extension. -// -void TParseVersions::initializeExtensionBehavior() -{ - extensionBehavior[E_GL_OES_texture_3D] = EBhDisable; - extensionBehavior[E_GL_OES_standard_derivatives] = EBhDisable; - extensionBehavior[E_GL_EXT_frag_depth] = EBhDisable; - extensionBehavior[E_GL_OES_EGL_image_external] = EBhDisable; - extensionBehavior[E_GL_OES_EGL_image_external_essl3] = EBhDisable; - extensionBehavior[E_GL_EXT_shader_texture_lod] = EBhDisable; - extensionBehavior[E_GL_EXT_texture_array] = EBhDisable; - extensionBehavior[E_GL_EXT_shadow_samplers] = EBhDisable; - extensionBehavior[E_GL_ARB_texture_rectangle] = EBhDisable; - extensionBehavior[E_GL_3DL_array_objects] = EBhDisable; - extensionBehavior[E_GL_ARB_shading_language_420pack] = EBhDisable; - extensionBehavior[E_GL_ARB_texture_gather] = EBhDisable; - extensionBehavior[E_GL_ARB_gpu_shader5] = EBhDisablePartial; - extensionBehavior[E_GL_ARB_separate_shader_objects] = EBhDisable; - extensionBehavior[E_GL_ARB_compute_shader] = EBhDisable; - extensionBehavior[E_GL_ARB_tessellation_shader] = EBhDisable; - extensionBehavior[E_GL_ARB_enhanced_layouts] = EBhDisable; - extensionBehavior[E_GL_ARB_texture_cube_map_array] = EBhDisable; - extensionBehavior[E_GL_ARB_shader_texture_lod] = EBhDisable; - extensionBehavior[E_GL_ARB_explicit_attrib_location] = EBhDisable; - extensionBehavior[E_GL_ARB_shader_image_load_store] = EBhDisable; - extensionBehavior[E_GL_ARB_shader_atomic_counters] = EBhDisable; - extensionBehavior[E_GL_ARB_shader_draw_parameters] = EBhDisable; - extensionBehavior[E_GL_ARB_shader_group_vote] = EBhDisable; - extensionBehavior[E_GL_ARB_derivative_control] = EBhDisable; - extensionBehavior[E_GL_ARB_shader_texture_image_samples] = EBhDisable; - extensionBehavior[E_GL_ARB_viewport_array] = EBhDisable; - extensionBehavior[E_GL_ARB_gpu_shader_int64] = EBhDisable; - extensionBehavior[E_GL_ARB_shader_ballot] = EBhDisable; - extensionBehavior[E_GL_ARB_sparse_texture2] = EBhDisable; - extensionBehavior[E_GL_ARB_sparse_texture_clamp] = EBhDisable; - extensionBehavior[E_GL_ARB_shader_stencil_export] = EBhDisable; -// extensionBehavior[E_GL_ARB_cull_distance] = EBhDisable; // present for 4.5, but need extension control over block members - extensionBehavior[E_GL_ARB_post_depth_coverage] = EBhDisable; - extensionBehavior[E_GL_ARB_shader_viewport_layer_array] = EBhDisable; - - extensionBehavior[E_GL_EXT_shader_non_constant_global_initializers] = EBhDisable; - extensionBehavior[E_GL_EXT_shader_image_load_formatted] = EBhDisable; - extensionBehavior[E_GL_EXT_post_depth_coverage] = EBhDisable; - - // #line and #include - extensionBehavior[E_GL_GOOGLE_cpp_style_line_directive] = EBhDisable; - extensionBehavior[E_GL_GOOGLE_include_directive] = EBhDisable; - -#ifdef AMD_EXTENSIONS - extensionBehavior[E_GL_AMD_shader_ballot] = EBhDisable; - extensionBehavior[E_GL_AMD_shader_trinary_minmax] = EBhDisable; - extensionBehavior[E_GL_AMD_shader_explicit_vertex_parameter] = EBhDisable; - extensionBehavior[E_GL_AMD_gcn_shader] = EBhDisable; - extensionBehavior[E_GL_AMD_gpu_shader_half_float] = EBhDisable; - extensionBehavior[E_GL_AMD_texture_gather_bias_lod] = EBhDisable; - extensionBehavior[E_GL_AMD_gpu_shader_int16] = EBhDisable; - extensionBehavior[E_GL_AMD_shader_image_load_store_lod] = EBhDisable; - extensionBehavior[E_GL_AMD_shader_fragment_mask] = EBhDisable; -#endif - -#ifdef NV_EXTENSIONS - extensionBehavior[E_GL_NV_sample_mask_override_coverage] = EBhDisable; - extensionBehavior[E_SPV_NV_geometry_shader_passthrough] = EBhDisable; - extensionBehavior[E_GL_NV_viewport_array2] = EBhDisable; - extensionBehavior[E_GL_NV_stereo_view_rendering] = EBhDisable; - extensionBehavior[E_GL_NVX_multiview_per_view_attributes] = EBhDisable; - extensionBehavior[E_GL_NV_shader_atomic_int64] = EBhDisable; - extensionBehavior[E_GL_NV_conservative_raster_underestimation] = EBhDisable; -#endif - - // AEP - extensionBehavior[E_GL_ANDROID_extension_pack_es31a] = EBhDisable; - extensionBehavior[E_GL_KHR_blend_equation_advanced] = EBhDisable; - extensionBehavior[E_GL_OES_sample_variables] = EBhDisable; - extensionBehavior[E_GL_OES_shader_image_atomic] = EBhDisable; - extensionBehavior[E_GL_OES_shader_multisample_interpolation] = EBhDisable; - extensionBehavior[E_GL_OES_texture_storage_multisample_2d_array] = EBhDisable; - extensionBehavior[E_GL_EXT_geometry_shader] = EBhDisable; - extensionBehavior[E_GL_EXT_geometry_point_size] = EBhDisable; - extensionBehavior[E_GL_EXT_gpu_shader5] = EBhDisable; - extensionBehavior[E_GL_EXT_primitive_bounding_box] = EBhDisable; - extensionBehavior[E_GL_EXT_shader_io_blocks] = EBhDisable; - extensionBehavior[E_GL_EXT_tessellation_shader] = EBhDisable; - extensionBehavior[E_GL_EXT_tessellation_point_size] = EBhDisable; - extensionBehavior[E_GL_EXT_texture_buffer] = EBhDisable; - extensionBehavior[E_GL_EXT_texture_cube_map_array] = EBhDisable; - - // OES matching AEP - extensionBehavior[E_GL_OES_geometry_shader] = EBhDisable; - extensionBehavior[E_GL_OES_geometry_point_size] = EBhDisable; - extensionBehavior[E_GL_OES_gpu_shader5] = EBhDisable; - extensionBehavior[E_GL_OES_primitive_bounding_box] = EBhDisable; - extensionBehavior[E_GL_OES_shader_io_blocks] = EBhDisable; - extensionBehavior[E_GL_OES_tessellation_shader] = EBhDisable; - extensionBehavior[E_GL_OES_tessellation_point_size] = EBhDisable; - extensionBehavior[E_GL_OES_texture_buffer] = EBhDisable; - extensionBehavior[E_GL_OES_texture_cube_map_array] = EBhDisable; - - // EXT extensions - extensionBehavior[E_GL_EXT_device_group] = EBhDisable; - extensionBehavior[E_GL_EXT_multiview] = EBhDisable; - - // OVR extensions - extensionBehavior[E_GL_OVR_multiview] = EBhDisable; - extensionBehavior[E_GL_OVR_multiview2] = EBhDisable; -} - -// Get code that is not part of a shared symbol table, is specific to this shader, -// or needed by the preprocessor (which does not use a shared symbol table). -void TParseVersions::getPreamble(std::string& preamble) -{ - if (profile == EEsProfile) { - preamble = - "#define GL_ES 1\n" - "#define GL_FRAGMENT_PRECISION_HIGH 1\n" - "#define GL_EXT_texture_array 1\n" - "#define GL_OES_texture_3D 1\n" - "#define GL_OES_standard_derivatives 1\n" - "#define GL_EXT_frag_depth 1\n" - "#define GL_OES_EGL_image_external 1\n" - "#define GL_OES_EGL_image_external_essl3 1\n" - "#define GL_EXT_shader_texture_lod 1\n" - "#define GL_EXT_shadow_samplers 1\n" - - // AEP - "#define GL_ANDROID_extension_pack_es31a 1\n" - "#define GL_KHR_blend_equation_advanced 1\n" - "#define GL_OES_sample_variables 1\n" - "#define GL_OES_shader_image_atomic 1\n" - "#define GL_OES_shader_multisample_interpolation 1\n" - "#define GL_OES_texture_storage_multisample_2d_array 1\n" - "#define GL_EXT_geometry_shader 1\n" - "#define GL_EXT_geometry_point_size 1\n" - "#define GL_EXT_gpu_shader5 1\n" - "#define GL_EXT_primitive_bounding_box 1\n" - "#define GL_EXT_shader_io_blocks 1\n" - "#define GL_EXT_tessellation_shader 1\n" - "#define GL_EXT_tessellation_point_size 1\n" - "#define GL_EXT_texture_buffer 1\n" - "#define GL_EXT_texture_cube_map_array 1\n" - - // OES matching AEP - "#define GL_OES_geometry_shader 1\n" - "#define GL_OES_geometry_point_size 1\n" - "#define GL_OES_gpu_shader5 1\n" - "#define GL_OES_primitive_bounding_box 1\n" - "#define GL_OES_shader_io_blocks 1\n" - "#define GL_OES_tessellation_shader 1\n" - "#define GL_OES_tessellation_point_size 1\n" - "#define GL_OES_texture_buffer 1\n" - "#define GL_OES_texture_cube_map_array 1\n" - "#define GL_EXT_shader_non_constant_global_initializers 1\n" - ; - } else { - preamble = - "#define GL_FRAGMENT_PRECISION_HIGH 1\n" - "#define GL_EXT_texture_array 1\n" - "#define GL_ARB_texture_rectangle 1\n" - "#define GL_ARB_shading_language_420pack 1\n" - "#define GL_ARB_texture_gather 1\n" - "#define GL_ARB_gpu_shader5 1\n" - "#define GL_ARB_separate_shader_objects 1\n" - "#define GL_ARB_compute_shader 1\n" - "#define GL_ARB_tessellation_shader 1\n" - "#define GL_ARB_enhanced_layouts 1\n" - "#define GL_ARB_texture_cube_map_array 1\n" - "#define GL_ARB_shader_texture_lod 1\n" - "#define GL_ARB_explicit_attrib_location 1\n" - "#define GL_ARB_shader_image_load_store 1\n" - "#define GL_ARB_shader_atomic_counters 1\n" - "#define GL_ARB_shader_draw_parameters 1\n" - "#define GL_ARB_shader_group_vote 1\n" - "#define GL_ARB_derivative_control 1\n" - "#define GL_ARB_shader_texture_image_samples 1\n" - "#define GL_ARB_viewport_array 1\n" - "#define GL_ARB_gpu_shader_int64 1\n" - "#define GL_ARB_shader_ballot 1\n" - "#define GL_ARB_sparse_texture2 1\n" - "#define GL_ARB_sparse_texture_clamp 1\n" - "#define GL_ARB_shader_stencil_export 1\n" -// "#define GL_ARB_cull_distance 1\n" // present for 4.5, but need extension control over block members - "#define GL_ARB_post_depth_coverage 1\n" - "#define GL_EXT_shader_non_constant_global_initializers 1\n" - "#define GL_EXT_shader_image_load_formatted 1\n" - "#define GL_EXT_post_depth_coverage 1\n" - -#ifdef AMD_EXTENSIONS - "#define GL_AMD_shader_ballot 1\n" - "#define GL_AMD_shader_trinary_minmax 1\n" - "#define GL_AMD_shader_explicit_vertex_parameter 1\n" - "#define GL_AMD_gcn_shader 1\n" - "#define GL_AMD_gpu_shader_half_float 1\n" - "#define GL_AMD_texture_gather_bias_lod 1\n" - "#define GL_AMD_gpu_shader_int16 1\n" - "#define GL_AMD_shader_image_load_store_lod 1\n" - "#define GL_AMD_shader_fragment_mask 1\n" -#endif - -#ifdef NV_EXTENSIONS - "#define GL_NV_sample_mask_override_coverage 1\n" - "#define GL_NV_geometry_shader_passthrough 1\n" - "#define GL_NV_viewport_array2 1\n" - "#define GL_NV_shader_atomic_int64 1\n" - "#define GL_NV_conservative_raster_underestimation 1\n" -#endif - ; - - if (version >= 150) { - // define GL_core_profile and GL_compatibility_profile - preamble += "#define GL_core_profile 1\n"; - - if (profile == ECompatibilityProfile) - preamble += "#define GL_compatibility_profile 1\n"; - } - } - - if ((profile != EEsProfile && version >= 140) || - (profile == EEsProfile && version >= 310)) { - preamble += - "#define GL_EXT_device_group 1\n" - "#define GL_EXT_multiview 1\n" - ; - } - - if (version >= 300 /* both ES and non-ES */) { - preamble += - "#define GL_OVR_multiview 1\n" - "#define GL_OVR_multiview2 1\n" - ; - } - - // #line and #include - preamble += - "#define GL_GOOGLE_cpp_style_line_directive 1\n" - "#define GL_GOOGLE_include_directive 1\n" - ; - - // #define VULKAN XXXX - const int numberBufSize = 12; - char numberBuf[numberBufSize]; - if (spvVersion.vulkanGlsl > 0) { - preamble += "#define VULKAN "; - snprintf(numberBuf, numberBufSize, "%d", spvVersion.vulkanGlsl); - preamble += numberBuf; - preamble += "\n"; - } - // #define GL_SPIRV XXXX - if (spvVersion.openGl > 0) { - preamble += "#define GL_SPIRV "; - snprintf(numberBuf, numberBufSize, "%d", spvVersion.openGl); - preamble += numberBuf; - preamble += "\n"; - } - -} - -// -// When to use requireProfile(): -// -// Use if only some profiles support a feature. However, if within a profile the feature -// is version or extension specific, follow this call with calls to profileRequires(). -// -// Operation: If the current profile is not one of the profileMask, -// give an error message. -// -void TParseVersions::requireProfile(const TSourceLoc& loc, int profileMask, const char* featureDesc) -{ - if (! (profile & profileMask)) - error(loc, "not supported with this profile:", featureDesc, ProfileName(profile)); -} - -// -// Map from stage enum to externally readable text name. -// -const char* StageName(EShLanguage stage) -{ - switch(stage) { - case EShLangVertex: return "vertex"; - case EShLangTessControl: return "tessellation control"; - case EShLangTessEvaluation: return "tessellation evaluation"; - case EShLangGeometry: return "geometry"; - case EShLangFragment: return "fragment"; - case EShLangCompute: return "compute"; - default: return "unknown stage"; - } -} - -// -// When to use profileRequires(): -// -// If a set of profiles have the same requirements for what version or extensions -// are needed to support a feature. -// -// It must be called for each profile that needs protection. Use requireProfile() first -// to reduce that set of profiles. -// -// Operation: Will issue warnings/errors based on the current profile, version, and extension -// behaviors. It only checks extensions when the current profile is one of the profileMask. -// -// A minVersion of 0 means no version of the profileMask support this in core, -// the extension must be present. -// - -// entry point that takes multiple extensions -void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, int numExtensions, const char* const extensions[], const char* featureDesc) -{ - if (profile & profileMask) { - bool okay = false; - if (minVersion > 0 && version >= minVersion) - okay = true; - for (int i = 0; i < numExtensions; ++i) { - switch (getExtensionBehavior(extensions[i])) { - case EBhWarn: - infoSink.info.message(EPrefixWarning, ("extension " + TString(extensions[i]) + " is being used for " + featureDesc).c_str(), loc); - // fall through - case EBhRequire: - case EBhEnable: - okay = true; - break; - default: break; // some compilers want this - } - } - - if (! okay) - error(loc, "not supported for this version or the enabled extensions", featureDesc, ""); - } -} - -// entry point for the above that takes a single extension -void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, const char* extension, const char* featureDesc) -{ - profileRequires(loc, profileMask, minVersion, extension ? 1 : 0, &extension, featureDesc); -} - -// -// When to use requireStage() -// -// If only some stages support a feature. -// -// Operation: If the current stage is not present, give an error message. -// -void TParseVersions::requireStage(const TSourceLoc& loc, EShLanguageMask languageMask, const char* featureDesc) -{ - if (((1 << language) & languageMask) == 0) - error(loc, "not supported in this stage:", featureDesc, StageName(language)); -} - -// If only one stage supports a feature, this can be called. But, all supporting stages -// must be specified with one call. -void TParseVersions::requireStage(const TSourceLoc& loc, EShLanguage stage, const char* featureDesc) -{ - requireStage(loc, static_cast(1 << stage), featureDesc); -} - -// -// Within a set of profiles, see if a feature is deprecated and give an error or warning based on whether -// a future compatibility context is being use. -// -void TParseVersions::checkDeprecated(const TSourceLoc& loc, int profileMask, int depVersion, const char* featureDesc) -{ - if (profile & profileMask) { - if (version >= depVersion) { - if (forwardCompatible) - error(loc, "deprecated, may be removed in future release", featureDesc, ""); - else if (! suppressWarnings()) - infoSink.info.message(EPrefixWarning, (TString(featureDesc) + " deprecated in version " + - String(depVersion) + "; may be removed in future release").c_str(), loc); - } - } -} - -// -// Within a set of profiles, see if a feature has now been removed and if so, give an error. -// The version argument is the first version no longer having the feature. -// -void TParseVersions::requireNotRemoved(const TSourceLoc& loc, int profileMask, int removedVersion, const char* featureDesc) -{ - if (profile & profileMask) { - if (version >= removedVersion) { - const int maxSize = 60; - char buf[maxSize]; - snprintf(buf, maxSize, "%s profile; removed in version %d", ProfileName(profile), removedVersion); - error(loc, "no longer supported in", featureDesc, buf); - } - } -} - -void TParseVersions::unimplemented(const TSourceLoc& loc, const char* featureDesc) -{ - error(loc, "feature not yet implemented", featureDesc, ""); -} - -// Returns true if at least one of the extensions in the extensions parameter is requested. Otherwise, returns false. -// Warns appropriately if the requested behavior of an extension is "warn". -bool TParseVersions::checkExtensionsRequested(const TSourceLoc& loc, int numExtensions, const char* const extensions[], const char* featureDesc) -{ - // First, see if any of the extensions are enabled - for (int i = 0; i < numExtensions; ++i) { - TExtensionBehavior behavior = getExtensionBehavior(extensions[i]); - if (behavior == EBhEnable || behavior == EBhRequire) - return true; - } - - // See if any extensions want to give a warning on use; give warnings for all such extensions - bool warned = false; - for (int i = 0; i < numExtensions; ++i) { - TExtensionBehavior behavior = getExtensionBehavior(extensions[i]); - if (behavior == EBhDisable && relaxedErrors()) { - infoSink.info.message(EPrefixWarning, "The following extension must be enabled to use this feature:", loc); - behavior = EBhWarn; - } - if (behavior == EBhWarn) { - infoSink.info.message(EPrefixWarning, ("extension " + TString(extensions[i]) + " is being used for " + featureDesc).c_str(), loc); - warned = true; - } - } - if (warned) - return true; - return false; -} - -// -// Use when there are no profile/version to check, it's just an error if one of the -// extensions is not present. -// -void TParseVersions::requireExtensions(const TSourceLoc& loc, int numExtensions, const char* const extensions[], const char* featureDesc) -{ - if (checkExtensionsRequested(loc, numExtensions, extensions, featureDesc)) return; - - // If we get this far, give errors explaining what extensions are needed - if (numExtensions == 1) - error(loc, "required extension not requested:", featureDesc, extensions[0]); - else { - error(loc, "required extension not requested:", featureDesc, "Possible extensions include:"); - for (int i = 0; i < numExtensions; ++i) - infoSink.info.message(EPrefixNone, extensions[i]); - } -} - -// -// Use by preprocessor when there are no profile/version to check, it's just an error if one of the -// extensions is not present. -// -void TParseVersions::ppRequireExtensions(const TSourceLoc& loc, int numExtensions, const char* const extensions[], const char* featureDesc) -{ - if (checkExtensionsRequested(loc, numExtensions, extensions, featureDesc)) return; - - // If we get this far, give errors explaining what extensions are needed - if (numExtensions == 1) - ppError(loc, "required extension not requested:", featureDesc, extensions[0]); - else { - ppError(loc, "required extension not requested:", featureDesc, "Possible extensions include:"); - for (int i = 0; i < numExtensions; ++i) - infoSink.info.message(EPrefixNone, extensions[i]); - } -} - -TExtensionBehavior TParseVersions::getExtensionBehavior(const char* extension) -{ - auto iter = extensionBehavior.find(TString(extension)); - if (iter == extensionBehavior.end()) - return EBhMissing; - else - return iter->second; -} - -// Returns true if the given extension is set to enable, require, or warn. -bool TParseVersions::extensionTurnedOn(const char* const extension) -{ - switch (getExtensionBehavior(extension)) { - case EBhEnable: - case EBhRequire: - case EBhWarn: - return true; - default: - break; - } - return false; -} -// See if any of the extensions are set to enable, require, or warn. -bool TParseVersions::extensionsTurnedOn(int numExtensions, const char* const extensions[]) -{ - for (int i = 0; i < numExtensions; ++i) { - if (extensionTurnedOn(extensions[i])) return true; - } - return false; -} - -// -// Change the current state of an extension's behavior. -// -void TParseVersions::updateExtensionBehavior(int line, const char* extension, const char* behaviorString) -{ - // Translate from text string of extension's behavior to an enum. - TExtensionBehavior behavior = EBhDisable; - if (! strcmp("require", behaviorString)) - behavior = EBhRequire; - else if (! strcmp("enable", behaviorString)) - behavior = EBhEnable; - else if (! strcmp("disable", behaviorString)) - behavior = EBhDisable; - else if (! strcmp("warn", behaviorString)) - behavior = EBhWarn; - else { - error(getCurrentLoc(), "behavior not supported:", "#extension", behaviorString); - return; - } - - // update the requested extension - updateExtensionBehavior(extension, behavior); - - // see if need to propagate to implicitly modified things - if (strcmp(extension, "GL_ANDROID_extension_pack_es31a") == 0) { - // to everything in AEP - updateExtensionBehavior(line, "GL_KHR_blend_equation_advanced", behaviorString); - updateExtensionBehavior(line, "GL_OES_sample_variables", behaviorString); - updateExtensionBehavior(line, "GL_OES_shader_image_atomic", behaviorString); - updateExtensionBehavior(line, "GL_OES_shader_multisample_interpolation", behaviorString); - updateExtensionBehavior(line, "GL_OES_texture_storage_multisample_2d_array", behaviorString); - updateExtensionBehavior(line, "GL_EXT_geometry_shader", behaviorString); - updateExtensionBehavior(line, "GL_EXT_gpu_shader5", behaviorString); - updateExtensionBehavior(line, "GL_EXT_primitive_bounding_box", behaviorString); - updateExtensionBehavior(line, "GL_EXT_shader_io_blocks", behaviorString); - updateExtensionBehavior(line, "GL_EXT_tessellation_shader", behaviorString); - updateExtensionBehavior(line, "GL_EXT_texture_buffer", behaviorString); - updateExtensionBehavior(line, "GL_EXT_texture_cube_map_array", behaviorString); - } - // geometry to io_blocks - else if (strcmp(extension, "GL_EXT_geometry_shader") == 0) - updateExtensionBehavior(line, "GL_EXT_shader_io_blocks", behaviorString); - else if (strcmp(extension, "GL_OES_geometry_shader") == 0) - updateExtensionBehavior(line, "GL_OES_shader_io_blocks", behaviorString); - // tessellation to io_blocks - else if (strcmp(extension, "GL_EXT_tessellation_shader") == 0) - updateExtensionBehavior(line, "GL_EXT_shader_io_blocks", behaviorString); - else if (strcmp(extension, "GL_OES_tessellation_shader") == 0) - updateExtensionBehavior(line, "GL_OES_shader_io_blocks", behaviorString); - else if (strcmp(extension, "GL_GOOGLE_include_directive") == 0) - updateExtensionBehavior(line, "GL_GOOGLE_cpp_style_line_directive", behaviorString); -} - -void TParseVersions::updateExtensionBehavior(const char* extension, TExtensionBehavior behavior) -{ - // Update the current behavior - if (strcmp(extension, "all") == 0) { - // special case for the 'all' extension; apply it to every extension present - if (behavior == EBhRequire || behavior == EBhEnable) { - error(getCurrentLoc(), "extension 'all' cannot have 'require' or 'enable' behavior", "#extension", ""); - return; - } else { - for (auto iter = extensionBehavior.begin(); iter != extensionBehavior.end(); ++iter) - iter->second = behavior; - } - } else { - // Do the update for this single extension - auto iter = extensionBehavior.find(TString(extension)); - if (iter == extensionBehavior.end()) { - switch (behavior) { - case EBhRequire: - error(getCurrentLoc(), "extension not supported:", "#extension", extension); - break; - case EBhEnable: - case EBhWarn: - case EBhDisable: - warn(getCurrentLoc(), "extension not supported:", "#extension", extension); - break; - default: - assert(0 && "unexpected behavior"); - } - - return; - } else { - if (iter->second == EBhDisablePartial) - warn(getCurrentLoc(), "extension is only partially supported:", "#extension", extension); - if (behavior == EBhEnable || behavior == EBhRequire) - intermediate.addRequestedExtension(extension); - iter->second = behavior; - } - } -} - -// Call for any operation needing full GLSL integer data-type support. -void TParseVersions::fullIntegerCheck(const TSourceLoc& loc, const char* op) -{ - profileRequires(loc, ENoProfile, 130, nullptr, op); - profileRequires(loc, EEsProfile, 300, nullptr, op); -} - -// Call for any operation needing GLSL double data-type support. -void TParseVersions::doubleCheck(const TSourceLoc& loc, const char* op) -{ - requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); - profileRequires(loc, ECoreProfile, 400, nullptr, op); - profileRequires(loc, ECompatibilityProfile, 400, nullptr, op); -} - -#ifdef AMD_EXTENSIONS -// Call for any operation needing GLSL 16-bit integer data-type support. -void TParseVersions::int16Check(const TSourceLoc& loc, const char* op, bool builtIn) -{ - if (! builtIn) { - requireExtensions(loc, 1, &E_GL_AMD_gpu_shader_int16, "shader int16"); - requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); - profileRequires(loc, ECoreProfile, 450, nullptr, op); - profileRequires(loc, ECompatibilityProfile, 450, nullptr, op); - } -} - -// Call for any operation needing GLSL float16 data-type support. -void TParseVersions::float16Check(const TSourceLoc& loc, const char* op, bool builtIn) -{ - if (! builtIn) { - requireExtensions(loc, 1, &E_GL_AMD_gpu_shader_half_float, "shader half float"); - requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); - profileRequires(loc, ECoreProfile, 450, nullptr, op); - profileRequires(loc, ECompatibilityProfile, 450, nullptr, op); - } -} -#endif - -// Call for any operation needing GLSL 64-bit integer data-type support. -void TParseVersions::int64Check(const TSourceLoc& loc, const char* op, bool builtIn) -{ - if (! builtIn) { - requireExtensions(loc, 1, &E_GL_ARB_gpu_shader_int64, "shader int64"); - requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); - profileRequires(loc, ECoreProfile, 450, nullptr, op); - profileRequires(loc, ECompatibilityProfile, 450, nullptr, op); - } -} - -// Call for any operation removed because SPIR-V is in use. -void TParseVersions::spvRemoved(const TSourceLoc& loc, const char* op) -{ - if (spvVersion.spv != 0) - error(loc, "not allowed when generating SPIR-V", op, ""); -} - -// Call for any operation removed because Vulkan SPIR-V is being generated. -void TParseVersions::vulkanRemoved(const TSourceLoc& loc, const char* op) -{ - if (spvVersion.vulkan >= 100) - error(loc, "not allowed when using GLSL for Vulkan", op, ""); -} - -// Call for any operation that requires Vulkan. -void TParseVersions::requireVulkan(const TSourceLoc& loc, const char* op) -{ - if (spvVersion.vulkan == 0) - error(loc, "only allowed when using GLSL for Vulkan", op, ""); -} - -// Call for any operation that requires SPIR-V. -void TParseVersions::requireSpv(const TSourceLoc& loc, const char* op) -{ - if (spvVersion.spv == 0) - error(loc, "only allowed when generating SPIR-V", op, ""); -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Versions.h b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Versions.h deleted file mode 100644 index 193aabc5..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/Versions.h +++ /dev/null @@ -1,254 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2012-2013 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// -#ifndef _VERSIONS_INCLUDED_ -#define _VERSIONS_INCLUDED_ - -// -// Help manage multiple profiles, versions, extensions etc. -// - -// -// Profiles are set up for masking operations, so queries can be done on multiple -// profiles at the same time. -// -// Don't maintain an ordinal set of enums (0,1,2,3...) to avoid all possible -// defects from mixing the two different forms. -// -typedef enum { - EBadProfile = 0, - ENoProfile = (1 << 0), // only for desktop, before profiles showed up - ECoreProfile = (1 << 1), - ECompatibilityProfile = (1 << 2), - EEsProfile = (1 << 3) -} EProfile; - -namespace glslang { - -// -// Map from profile enum to externally readable text name. -// -inline const char* ProfileName(EProfile profile) -{ - switch (profile) { - case ENoProfile: return "none"; - case ECoreProfile: return "core"; - case ECompatibilityProfile: return "compatibility"; - case EEsProfile: return "es"; - default: return "unknown profile"; - } -} - -// -// What source rules, validation rules, target language, etc. are needed -// desired for SPIR-V? -// -// 0 means a target or rule set is not enabled (ignore rules from that entity). -// Non-0 means to apply semantic rules arising from that version of its rule set. -// The union of all requested rule sets will be applied. -// -struct SpvVersion { - SpvVersion() : spv(0), vulkanGlsl(0), vulkan(0), openGl(0) {} - unsigned int spv; // the version of SPIR-V to target, as defined by "word 1" of the SPIR-V binary header - int vulkanGlsl; // the version of GLSL semantics for Vulkan, from GL_KHR_vulkan_glsl, for "#define VULKAN XXX" - int vulkan; // the version of Vulkan, for which SPIR-V execution environment rules to use (100 means 1.0) - int openGl; // the version of GLSL semantics for OpenGL, from GL_ARB_gl_spirv, for "#define GL_SPIRV XXX" -}; - -// -// The behaviors from the GLSL "#extension extension_name : behavior" -// -typedef enum { - EBhMissing = 0, - EBhRequire, - EBhEnable, - EBhWarn, - EBhDisable, - EBhDisablePartial // use as initial state of an extension that is only partially implemented -} TExtensionBehavior; - -// -// Symbolic names for extensions. Strings may be directly used when calling the -// functions, but better to have the compiler do spelling checks. -// -const char* const E_GL_OES_texture_3D = "GL_OES_texture_3D"; -const char* const E_GL_OES_standard_derivatives = "GL_OES_standard_derivatives"; -const char* const E_GL_EXT_frag_depth = "GL_EXT_frag_depth"; -const char* const E_GL_OES_EGL_image_external = "GL_OES_EGL_image_external"; -const char* const E_GL_OES_EGL_image_external_essl3 = "GL_OES_EGL_image_external_essl3"; -const char* const E_GL_EXT_shader_texture_lod = "GL_EXT_shader_texture_lod"; -const char* const E_GL_EXT_shadow_samplers = "GL_EXT_shadow_samplers"; - -const char* const E_GL_EXT_texture_array = "GL_EXT_texture_array"; -const char* const E_GL_ARB_texture_rectangle = "GL_ARB_texture_rectangle"; -const char* const E_GL_3DL_array_objects = "GL_3DL_array_objects"; -const char* const E_GL_ARB_shading_language_420pack = "GL_ARB_shading_language_420pack"; -const char* const E_GL_ARB_texture_gather = "GL_ARB_texture_gather"; -const char* const E_GL_ARB_gpu_shader5 = "GL_ARB_gpu_shader5"; -const char* const E_GL_ARB_separate_shader_objects = "GL_ARB_separate_shader_objects"; -const char* const E_GL_ARB_compute_shader = "GL_ARB_compute_shader"; -const char* const E_GL_ARB_tessellation_shader = "GL_ARB_tessellation_shader"; -const char* const E_GL_ARB_enhanced_layouts = "GL_ARB_enhanced_layouts"; -const char* const E_GL_ARB_texture_cube_map_array = "GL_ARB_texture_cube_map_array"; -const char* const E_GL_ARB_shader_texture_lod = "GL_ARB_shader_texture_lod"; -const char* const E_GL_ARB_explicit_attrib_location = "GL_ARB_explicit_attrib_location"; -const char* const E_GL_ARB_shader_image_load_store = "GL_ARB_shader_image_load_store"; -const char* const E_GL_ARB_shader_atomic_counters = "GL_ARB_shader_atomic_counters"; -const char* const E_GL_ARB_shader_draw_parameters = "GL_ARB_shader_draw_parameters"; -const char* const E_GL_ARB_shader_group_vote = "GL_ARB_shader_group_vote"; -const char* const E_GL_ARB_derivative_control = "GL_ARB_derivative_control"; -const char* const E_GL_ARB_shader_texture_image_samples = "GL_ARB_shader_texture_image_samples"; -const char* const E_GL_ARB_viewport_array = "GL_ARB_viewport_array"; -const char* const E_GL_ARB_gpu_shader_int64 = "GL_ARB_gpu_shader_int64"; -const char* const E_GL_ARB_shader_ballot = "GL_ARB_shader_ballot"; -const char* const E_GL_ARB_sparse_texture2 = "GL_ARB_sparse_texture2"; -const char* const E_GL_ARB_sparse_texture_clamp = "GL_ARB_sparse_texture_clamp"; -const char* const E_GL_ARB_shader_stencil_export = "GL_ARB_shader_stencil_export"; -// const char* const E_GL_ARB_cull_distance = "GL_ARB_cull_distance"; // present for 4.5, but need extension control over block members -const char* const E_GL_ARB_post_depth_coverage = "GL_ARB_post_depth_coverage"; -const char* const E_GL_ARB_shader_viewport_layer_array = "GL_ARB_shader_viewport_layer_array"; - -const char* const E_GL_EXT_shader_non_constant_global_initializers = "GL_EXT_shader_non_constant_global_initializers"; -const char* const E_GL_EXT_shader_image_load_formatted = "GL_EXT_shader_image_load_formatted"; - -// EXT extensions -const char* const E_GL_EXT_device_group = "GL_EXT_device_group"; -const char* const E_GL_EXT_multiview = "GL_EXT_multiview"; -const char* const E_GL_EXT_post_depth_coverage = "GL_EXT_post_depth_coverage"; - -// Arrays of extensions for the above viewportEXTs duplications - -const char* const post_depth_coverageEXTs[] = { E_GL_ARB_post_depth_coverage, E_GL_EXT_post_depth_coverage }; -const int Num_post_depth_coverageEXTs = sizeof(post_depth_coverageEXTs) / sizeof(post_depth_coverageEXTs[0]); - -// OVR extensions -const char* const E_GL_OVR_multiview = "GL_OVR_multiview"; -const char* const E_GL_OVR_multiview2 = "GL_OVR_multiview2"; - -const char* const OVR_multiview_EXTs[] = { E_GL_OVR_multiview, E_GL_OVR_multiview2 }; -const int Num_OVR_multiview_EXTs = sizeof(OVR_multiview_EXTs) / sizeof(OVR_multiview_EXTs[0]); - -// #line and #include -const char* const E_GL_GOOGLE_cpp_style_line_directive = "GL_GOOGLE_cpp_style_line_directive"; -const char* const E_GL_GOOGLE_include_directive = "GL_GOOGLE_include_directive"; - -#ifdef AMD_EXTENSIONS -const char* const E_GL_AMD_shader_ballot = "GL_AMD_shader_ballot"; -const char* const E_GL_AMD_shader_trinary_minmax = "GL_AMD_shader_trinary_minmax"; -const char* const E_GL_AMD_shader_explicit_vertex_parameter = "GL_AMD_shader_explicit_vertex_parameter"; -const char* const E_GL_AMD_gcn_shader = "GL_AMD_gcn_shader"; -const char* const E_GL_AMD_gpu_shader_half_float = "GL_AMD_gpu_shader_half_float"; -const char* const E_GL_AMD_texture_gather_bias_lod = "GL_AMD_texture_gather_bias_lod"; -const char* const E_GL_AMD_gpu_shader_int16 = "GL_AMD_gpu_shader_int16"; -const char* const E_GL_AMD_shader_image_load_store_lod = "GL_AMD_shader_image_load_store_lod"; -const char* const E_GL_AMD_shader_fragment_mask = "GL_AMD_shader_fragment_mask"; -#endif - -#ifdef NV_EXTENSIONS - -const char* const E_GL_NV_sample_mask_override_coverage = "GL_NV_sample_mask_override_coverage"; -const char* const E_SPV_NV_geometry_shader_passthrough = "GL_NV_geometry_shader_passthrough"; -const char* const E_GL_NV_viewport_array2 = "GL_NV_viewport_array2"; -const char* const E_GL_NV_stereo_view_rendering = "GL_NV_stereo_view_rendering"; -const char* const E_GL_NVX_multiview_per_view_attributes = "GL_NVX_multiview_per_view_attributes"; -const char* const E_GL_NV_shader_atomic_int64 = "GL_NV_shader_atomic_int64"; -const char* const E_GL_NV_conservative_raster_underestimation = "GL_NV_conservative_raster_underestimation"; - -// Arrays of extensions for the above viewportEXTs duplications - -const char* const viewportEXTs[] = { E_GL_ARB_shader_viewport_layer_array, E_GL_NV_viewport_array2 }; -const int Num_viewportEXTs = sizeof(viewportEXTs) / sizeof(viewportEXTs[0]); -#endif - -// AEP -const char* const E_GL_ANDROID_extension_pack_es31a = "GL_ANDROID_extension_pack_es31a"; -const char* const E_GL_KHR_blend_equation_advanced = "GL_KHR_blend_equation_advanced"; -const char* const E_GL_OES_sample_variables = "GL_OES_sample_variables"; -const char* const E_GL_OES_shader_image_atomic = "GL_OES_shader_image_atomic"; -const char* const E_GL_OES_shader_multisample_interpolation = "GL_OES_shader_multisample_interpolation"; -const char* const E_GL_OES_texture_storage_multisample_2d_array = "GL_OES_texture_storage_multisample_2d_array"; -const char* const E_GL_EXT_geometry_shader = "GL_EXT_geometry_shader"; -const char* const E_GL_EXT_geometry_point_size = "GL_EXT_geometry_point_size"; -const char* const E_GL_EXT_gpu_shader5 = "GL_EXT_gpu_shader5"; -const char* const E_GL_EXT_primitive_bounding_box = "GL_EXT_primitive_bounding_box"; -const char* const E_GL_EXT_shader_io_blocks = "GL_EXT_shader_io_blocks"; -const char* const E_GL_EXT_tessellation_shader = "GL_EXT_tessellation_shader"; -const char* const E_GL_EXT_tessellation_point_size = "GL_EXT_tessellation_point_size"; -const char* const E_GL_EXT_texture_buffer = "GL_EXT_texture_buffer"; -const char* const E_GL_EXT_texture_cube_map_array = "GL_EXT_texture_cube_map_array"; - -// OES matching AEP -const char* const E_GL_OES_geometry_shader = "GL_OES_geometry_shader"; -const char* const E_GL_OES_geometry_point_size = "GL_OES_geometry_point_size"; -const char* const E_GL_OES_gpu_shader5 = "GL_OES_gpu_shader5"; -const char* const E_GL_OES_primitive_bounding_box = "GL_OES_primitive_bounding_box"; -const char* const E_GL_OES_shader_io_blocks = "GL_OES_shader_io_blocks"; -const char* const E_GL_OES_tessellation_shader = "GL_OES_tessellation_shader"; -const char* const E_GL_OES_tessellation_point_size = "GL_OES_tessellation_point_size"; -const char* const E_GL_OES_texture_buffer = "GL_OES_texture_buffer"; -const char* const E_GL_OES_texture_cube_map_array = "GL_OES_texture_cube_map_array"; - -// Arrays of extensions for the above AEP duplications - -const char* const AEP_geometry_shader[] = { E_GL_EXT_geometry_shader, E_GL_OES_geometry_shader }; -const int Num_AEP_geometry_shader = sizeof(AEP_geometry_shader)/sizeof(AEP_geometry_shader[0]); - -const char* const AEP_geometry_point_size[] = { E_GL_EXT_geometry_point_size, E_GL_OES_geometry_point_size }; -const int Num_AEP_geometry_point_size = sizeof(AEP_geometry_point_size)/sizeof(AEP_geometry_point_size[0]); - -const char* const AEP_gpu_shader5[] = { E_GL_EXT_gpu_shader5, E_GL_OES_gpu_shader5 }; -const int Num_AEP_gpu_shader5 = sizeof(AEP_gpu_shader5)/sizeof(AEP_gpu_shader5[0]); - -const char* const AEP_primitive_bounding_box[] = { E_GL_EXT_primitive_bounding_box, E_GL_OES_primitive_bounding_box }; -const int Num_AEP_primitive_bounding_box = sizeof(AEP_primitive_bounding_box)/sizeof(AEP_primitive_bounding_box[0]); - -const char* const AEP_shader_io_blocks[] = { E_GL_EXT_shader_io_blocks, E_GL_OES_shader_io_blocks }; -const int Num_AEP_shader_io_blocks = sizeof(AEP_shader_io_blocks)/sizeof(AEP_shader_io_blocks[0]); - -const char* const AEP_tessellation_shader[] = { E_GL_EXT_tessellation_shader, E_GL_OES_tessellation_shader }; -const int Num_AEP_tessellation_shader = sizeof(AEP_tessellation_shader)/sizeof(AEP_tessellation_shader[0]); - -const char* const AEP_tessellation_point_size[] = { E_GL_EXT_tessellation_point_size, E_GL_OES_tessellation_point_size }; -const int Num_AEP_tessellation_point_size = sizeof(AEP_tessellation_point_size)/sizeof(AEP_tessellation_point_size[0]); - -const char* const AEP_texture_buffer[] = { E_GL_EXT_texture_buffer, E_GL_OES_texture_buffer }; -const int Num_AEP_texture_buffer = sizeof(AEP_texture_buffer)/sizeof(AEP_texture_buffer[0]); - -const char* const AEP_texture_cube_map_array[] = { E_GL_EXT_texture_cube_map_array, E_GL_OES_texture_cube_map_array }; -const int Num_AEP_texture_cube_map_array = sizeof(AEP_texture_cube_map_array)/sizeof(AEP_texture_cube_map_array[0]); - -} // end namespace glslang - -#endif // _VERSIONS_INCLUDED_ diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/gl_types.h b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/gl_types.h deleted file mode 100644 index ae00ae57..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/gl_types.h +++ /dev/null @@ -1,180 +0,0 @@ -/* -** Copyright (c) 2013 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are 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 Materials. -** -** THE MATERIALS ARE 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 -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ - -#pragma once - -#define GL_FLOAT 0x1406 -#define GL_FLOAT_VEC2 0x8B50 -#define GL_FLOAT_VEC3 0x8B51 -#define GL_FLOAT_VEC4 0x8B52 - -#define GL_DOUBLE 0x140A -#define GL_DOUBLE_VEC2 0x8FFC -#define GL_DOUBLE_VEC3 0x8FFD -#define GL_DOUBLE_VEC4 0x8FFE - -#define GL_INT 0x1404 -#define GL_INT_VEC2 0x8B53 -#define GL_INT_VEC3 0x8B54 -#define GL_INT_VEC4 0x8B55 - -#define GL_UNSIGNED_INT 0x1405 -#define GL_UNSIGNED_INT_VEC2 0x8DC6 -#define GL_UNSIGNED_INT_VEC3 0x8DC7 -#define GL_UNSIGNED_INT_VEC4 0x8DC8 - -#define GL_INT64_ARB 0x140E -#define GL_INT64_VEC2_ARB 0x8FE9 -#define GL_INT64_VEC3_ARB 0x8FEA -#define GL_INT64_VEC4_ARB 0x8FEB - -#define GL_UNSIGNED_INT64_ARB 0x140F -#define GL_UNSIGNED_INT64_VEC2_ARB 0x8FE5 -#define GL_UNSIGNED_INT64_VEC3_ARB 0x8FE6 -#define GL_UNSIGNED_INT64_VEC4_ARB 0x8FE7 - -#define GL_BOOL 0x8B56 -#define GL_BOOL_VEC2 0x8B57 -#define GL_BOOL_VEC3 0x8B58 -#define GL_BOOL_VEC4 0x8B59 - -#define GL_FLOAT_MAT2 0x8B5A -#define GL_FLOAT_MAT3 0x8B5B -#define GL_FLOAT_MAT4 0x8B5C -#define GL_FLOAT_MAT2x3 0x8B65 -#define GL_FLOAT_MAT2x4 0x8B66 -#define GL_FLOAT_MAT3x2 0x8B67 -#define GL_FLOAT_MAT3x4 0x8B68 -#define GL_FLOAT_MAT4x2 0x8B69 -#define GL_FLOAT_MAT4x3 0x8B6A - -#define GL_DOUBLE_MAT2 0x8F46 -#define GL_DOUBLE_MAT3 0x8F47 -#define GL_DOUBLE_MAT4 0x8F48 -#define GL_DOUBLE_MAT2x3 0x8F49 -#define GL_DOUBLE_MAT2x4 0x8F4A -#define GL_DOUBLE_MAT3x2 0x8F4B -#define GL_DOUBLE_MAT3x4 0x8F4C -#define GL_DOUBLE_MAT4x2 0x8F4D -#define GL_DOUBLE_MAT4x3 0x8F4E - -#ifdef AMD_EXTENSIONS -// Those constants are borrowed from extension NV_gpu_shader5 -#define GL_FLOAT16_NV 0x8FF8 -#define GL_FLOAT16_VEC2_NV 0x8FF9 -#define GL_FLOAT16_VEC3_NV 0x8FFA -#define GL_FLOAT16_VEC4_NV 0x8FFB - -#define GL_FLOAT16_MAT2_AMD 0x91C5 -#define GL_FLOAT16_MAT3_AMD 0x91C6 -#define GL_FLOAT16_MAT4_AMD 0x91C7 -#define GL_FLOAT16_MAT2x3_AMD 0x91C8 -#define GL_FLOAT16_MAT2x4_AMD 0x91C9 -#define GL_FLOAT16_MAT3x2_AMD 0x91CA -#define GL_FLOAT16_MAT3x4_AMD 0x91CB -#define GL_FLOAT16_MAT4x2_AMD 0x91CC -#define GL_FLOAT16_MAT4x3_AMD 0x91CD -#endif - -#define GL_SAMPLER_1D 0x8B5D -#define GL_SAMPLER_2D 0x8B5E -#define GL_SAMPLER_3D 0x8B5F -#define GL_SAMPLER_CUBE 0x8B60 -#define GL_SAMPLER_BUFFER 0x8DC2 -#define GL_SAMPLER_1D_ARRAY 0x8DC0 -#define GL_SAMPLER_2D_ARRAY 0x8DC1 -#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3 -#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 -#define GL_SAMPLER_CUBE_SHADOW 0x8DC5 -#define GL_SAMPLER_1D_SHADOW 0x8B61 -#define GL_SAMPLER_2D_SHADOW 0x8B62 -#define GL_SAMPLER_2D_RECT 0x8B63 -#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 -#define GL_SAMPLER_2D_MULTISAMPLE 0x9108 -#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B -#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C -#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D -#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C -#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D - -#define GL_INT_SAMPLER_1D 0x8DC9 -#define GL_INT_SAMPLER_2D 0x8DCA -#define GL_INT_SAMPLER_3D 0x8DCB -#define GL_INT_SAMPLER_CUBE 0x8DCC -#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE -#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF -#define GL_INT_SAMPLER_2D_RECT 0x8DCD -#define GL_INT_SAMPLER_BUFFER 0x8DD0 -#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 -#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C -#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E -#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E - -#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1 -#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 -#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 -#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 -#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6 -#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 -#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 -#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 -#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D -#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F -#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F -#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A - -#define GL_IMAGE_1D 0x904C -#define GL_IMAGE_2D 0x904D -#define GL_IMAGE_3D 0x904E -#define GL_IMAGE_2D_RECT 0x904F -#define GL_IMAGE_CUBE 0x9050 -#define GL_IMAGE_BUFFER 0x9051 -#define GL_IMAGE_1D_ARRAY 0x9052 -#define GL_IMAGE_2D_ARRAY 0x9053 -#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054 -#define GL_IMAGE_2D_MULTISAMPLE 0x9055 -#define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056 -#define GL_INT_IMAGE_1D 0x9057 -#define GL_INT_IMAGE_2D 0x9058 -#define GL_INT_IMAGE_3D 0x9059 -#define GL_INT_IMAGE_2D_RECT 0x905A -#define GL_INT_IMAGE_CUBE 0x905B -#define GL_INT_IMAGE_BUFFER 0x905C -#define GL_INT_IMAGE_1D_ARRAY 0x905D -#define GL_INT_IMAGE_2D_ARRAY 0x905E -#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F -#define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060 -#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061 -#define GL_UNSIGNED_INT_IMAGE_1D 0x9062 -#define GL_UNSIGNED_INT_IMAGE_2D 0x9063 -#define GL_UNSIGNED_INT_IMAGE_3D 0x9064 -#define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065 -#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066 -#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067 -#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068 -#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069 -#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A -#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B -#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C - -#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/glslang_tab.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/glslang_tab.cpp deleted file mode 100644 index 72415681..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/glslang_tab.cpp +++ /dev/null @@ -1,8213 +0,0 @@ -/* A Bison parser, made by GNU Bison 3.0. */ - -/* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "3.0" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 1 - -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - - - - -/* Copy the first part of user declarations. */ -#line 41 "MachineIndependent/glslang.y" /* yacc.c:339 */ - - -/* Based on: -ANSI C Yacc grammar - -In 1985, Jeff Lee published his Yacc grammar (which is accompanied by a -matching Lex specification) for the April 30, 1985 draft version of the -ANSI C standard. Tom Stockfisch reposted it to net.sources in 1987; that -original, as mentioned in the answer to question 17.25 of the comp.lang.c -FAQ, can be ftp'ed from ftp.uu.net, file usenet/net.sources/ansi.c.grammar.Z. - -I intend to keep this version as close to the current C Standard grammar as -possible; please let me know if you discover discrepancies. - -Jutta Degener, 1995 -*/ - -#include "SymbolTable.h" -#include "ParseHelper.h" -#include "../Public/ShaderLang.h" - -using namespace glslang; - - -#line 91 "MachineIndependent/glslang_tab.cpp" /* yacc.c:339 */ - -# ifndef YY_NULL -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULL nullptr -# else -# define YY_NULL 0 -# endif -# endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 1 -#endif - -/* In a future release of Bison, this section will be replaced - by #include "glslang_tab.cpp.h". */ -#ifndef YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED -# define YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 1 -#endif -#if YYDEBUG -extern int yydebug; -#endif - -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - ATTRIBUTE = 258, - VARYING = 259, - CONST = 260, - BOOL = 261, - FLOAT = 262, - DOUBLE = 263, - INT = 264, - UINT = 265, - INT64_T = 266, - UINT64_T = 267, - INT16_T = 268, - UINT16_T = 269, - FLOAT16_T = 270, - BREAK = 271, - CONTINUE = 272, - DO = 273, - ELSE = 274, - FOR = 275, - IF = 276, - DISCARD = 277, - RETURN = 278, - SWITCH = 279, - CASE = 280, - DEFAULT = 281, - SUBROUTINE = 282, - BVEC2 = 283, - BVEC3 = 284, - BVEC4 = 285, - IVEC2 = 286, - IVEC3 = 287, - IVEC4 = 288, - I64VEC2 = 289, - I64VEC3 = 290, - I64VEC4 = 291, - UVEC2 = 292, - UVEC3 = 293, - UVEC4 = 294, - U64VEC2 = 295, - U64VEC3 = 296, - U64VEC4 = 297, - VEC2 = 298, - VEC3 = 299, - VEC4 = 300, - MAT2 = 301, - MAT3 = 302, - MAT4 = 303, - CENTROID = 304, - IN = 305, - OUT = 306, - INOUT = 307, - UNIFORM = 308, - PATCH = 309, - SAMPLE = 310, - BUFFER = 311, - SHARED = 312, - COHERENT = 313, - VOLATILE = 314, - RESTRICT = 315, - READONLY = 316, - WRITEONLY = 317, - DVEC2 = 318, - DVEC3 = 319, - DVEC4 = 320, - DMAT2 = 321, - DMAT3 = 322, - DMAT4 = 323, - F16VEC2 = 324, - F16VEC3 = 325, - F16VEC4 = 326, - F16MAT2 = 327, - F16MAT3 = 328, - F16MAT4 = 329, - I16VEC2 = 330, - I16VEC3 = 331, - I16VEC4 = 332, - U16VEC2 = 333, - U16VEC3 = 334, - U16VEC4 = 335, - NOPERSPECTIVE = 336, - FLAT = 337, - SMOOTH = 338, - LAYOUT = 339, - __EXPLICITINTERPAMD = 340, - MAT2X2 = 341, - MAT2X3 = 342, - MAT2X4 = 343, - MAT3X2 = 344, - MAT3X3 = 345, - MAT3X4 = 346, - MAT4X2 = 347, - MAT4X3 = 348, - MAT4X4 = 349, - DMAT2X2 = 350, - DMAT2X3 = 351, - DMAT2X4 = 352, - DMAT3X2 = 353, - DMAT3X3 = 354, - DMAT3X4 = 355, - DMAT4X2 = 356, - DMAT4X3 = 357, - DMAT4X4 = 358, - F16MAT2X2 = 359, - F16MAT2X3 = 360, - F16MAT2X4 = 361, - F16MAT3X2 = 362, - F16MAT3X3 = 363, - F16MAT3X4 = 364, - F16MAT4X2 = 365, - F16MAT4X3 = 366, - F16MAT4X4 = 367, - ATOMIC_UINT = 368, - SAMPLER1D = 369, - SAMPLER2D = 370, - SAMPLER3D = 371, - SAMPLERCUBE = 372, - SAMPLER1DSHADOW = 373, - SAMPLER2DSHADOW = 374, - SAMPLERCUBESHADOW = 375, - SAMPLER1DARRAY = 376, - SAMPLER2DARRAY = 377, - SAMPLER1DARRAYSHADOW = 378, - SAMPLER2DARRAYSHADOW = 379, - ISAMPLER1D = 380, - ISAMPLER2D = 381, - ISAMPLER3D = 382, - ISAMPLERCUBE = 383, - ISAMPLER1DARRAY = 384, - ISAMPLER2DARRAY = 385, - USAMPLER1D = 386, - USAMPLER2D = 387, - USAMPLER3D = 388, - USAMPLERCUBE = 389, - USAMPLER1DARRAY = 390, - USAMPLER2DARRAY = 391, - SAMPLER2DRECT = 392, - SAMPLER2DRECTSHADOW = 393, - ISAMPLER2DRECT = 394, - USAMPLER2DRECT = 395, - SAMPLERBUFFER = 396, - ISAMPLERBUFFER = 397, - USAMPLERBUFFER = 398, - SAMPLERCUBEARRAY = 399, - SAMPLERCUBEARRAYSHADOW = 400, - ISAMPLERCUBEARRAY = 401, - USAMPLERCUBEARRAY = 402, - SAMPLER2DMS = 403, - ISAMPLER2DMS = 404, - USAMPLER2DMS = 405, - SAMPLER2DMSARRAY = 406, - ISAMPLER2DMSARRAY = 407, - USAMPLER2DMSARRAY = 408, - SAMPLEREXTERNALOES = 409, - SAMPLER = 410, - SAMPLERSHADOW = 411, - TEXTURE1D = 412, - TEXTURE2D = 413, - TEXTURE3D = 414, - TEXTURECUBE = 415, - TEXTURE1DARRAY = 416, - TEXTURE2DARRAY = 417, - ITEXTURE1D = 418, - ITEXTURE2D = 419, - ITEXTURE3D = 420, - ITEXTURECUBE = 421, - ITEXTURE1DARRAY = 422, - ITEXTURE2DARRAY = 423, - UTEXTURE1D = 424, - UTEXTURE2D = 425, - UTEXTURE3D = 426, - UTEXTURECUBE = 427, - UTEXTURE1DARRAY = 428, - UTEXTURE2DARRAY = 429, - TEXTURE2DRECT = 430, - ITEXTURE2DRECT = 431, - UTEXTURE2DRECT = 432, - TEXTUREBUFFER = 433, - ITEXTUREBUFFER = 434, - UTEXTUREBUFFER = 435, - TEXTURECUBEARRAY = 436, - ITEXTURECUBEARRAY = 437, - UTEXTURECUBEARRAY = 438, - TEXTURE2DMS = 439, - ITEXTURE2DMS = 440, - UTEXTURE2DMS = 441, - TEXTURE2DMSARRAY = 442, - ITEXTURE2DMSARRAY = 443, - UTEXTURE2DMSARRAY = 444, - SUBPASSINPUT = 445, - SUBPASSINPUTMS = 446, - ISUBPASSINPUT = 447, - ISUBPASSINPUTMS = 448, - USUBPASSINPUT = 449, - USUBPASSINPUTMS = 450, - IMAGE1D = 451, - IIMAGE1D = 452, - UIMAGE1D = 453, - IMAGE2D = 454, - IIMAGE2D = 455, - UIMAGE2D = 456, - IMAGE3D = 457, - IIMAGE3D = 458, - UIMAGE3D = 459, - IMAGE2DRECT = 460, - IIMAGE2DRECT = 461, - UIMAGE2DRECT = 462, - IMAGECUBE = 463, - IIMAGECUBE = 464, - UIMAGECUBE = 465, - IMAGEBUFFER = 466, - IIMAGEBUFFER = 467, - UIMAGEBUFFER = 468, - IMAGE1DARRAY = 469, - IIMAGE1DARRAY = 470, - UIMAGE1DARRAY = 471, - IMAGE2DARRAY = 472, - IIMAGE2DARRAY = 473, - UIMAGE2DARRAY = 474, - IMAGECUBEARRAY = 475, - IIMAGECUBEARRAY = 476, - UIMAGECUBEARRAY = 477, - IMAGE2DMS = 478, - IIMAGE2DMS = 479, - UIMAGE2DMS = 480, - IMAGE2DMSARRAY = 481, - IIMAGE2DMSARRAY = 482, - UIMAGE2DMSARRAY = 483, - STRUCT = 484, - VOID = 485, - WHILE = 486, - IDENTIFIER = 487, - TYPE_NAME = 488, - FLOATCONSTANT = 489, - DOUBLECONSTANT = 490, - INTCONSTANT = 491, - UINTCONSTANT = 492, - INT64CONSTANT = 493, - UINT64CONSTANT = 494, - INT16CONSTANT = 495, - UINT16CONSTANT = 496, - BOOLCONSTANT = 497, - FLOAT16CONSTANT = 498, - LEFT_OP = 499, - RIGHT_OP = 500, - INC_OP = 501, - DEC_OP = 502, - LE_OP = 503, - GE_OP = 504, - EQ_OP = 505, - NE_OP = 506, - AND_OP = 507, - OR_OP = 508, - XOR_OP = 509, - MUL_ASSIGN = 510, - DIV_ASSIGN = 511, - ADD_ASSIGN = 512, - MOD_ASSIGN = 513, - LEFT_ASSIGN = 514, - RIGHT_ASSIGN = 515, - AND_ASSIGN = 516, - XOR_ASSIGN = 517, - OR_ASSIGN = 518, - SUB_ASSIGN = 519, - LEFT_PAREN = 520, - RIGHT_PAREN = 521, - LEFT_BRACKET = 522, - RIGHT_BRACKET = 523, - LEFT_BRACE = 524, - RIGHT_BRACE = 525, - DOT = 526, - COMMA = 527, - COLON = 528, - EQUAL = 529, - SEMICOLON = 530, - BANG = 531, - DASH = 532, - TILDE = 533, - PLUS = 534, - STAR = 535, - SLASH = 536, - PERCENT = 537, - LEFT_ANGLE = 538, - RIGHT_ANGLE = 539, - VERTICAL_BAR = 540, - CARET = 541, - AMPERSAND = 542, - QUESTION = 543, - INVARIANT = 544, - PRECISE = 545, - HIGH_PRECISION = 546, - MEDIUM_PRECISION = 547, - LOW_PRECISION = 548, - PRECISION = 549, - PACKED = 550, - RESOURCE = 551, - SUPERP = 552 - }; -#endif - -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; -union YYSTYPE -{ -#line 68 "MachineIndependent/glslang.y" /* yacc.c:355 */ - - struct { - glslang::TSourceLoc loc; - union { - glslang::TString *string; - int i; - unsigned int u; - long long i64; - unsigned long long u64; - bool b; - double d; - }; - glslang::TSymbol* symbol; - } lex; - struct { - glslang::TSourceLoc loc; - glslang::TOperator op; - union { - TIntermNode* intermNode; - glslang::TIntermNodePair nodePair; - glslang::TIntermTyped* intermTypedNode; - }; - union { - glslang::TPublicType type; - glslang::TFunction* function; - glslang::TParameter param; - glslang::TTypeLoc typeLine; - glslang::TTypeList* typeList; - glslang::TArraySizes* arraySizes; - glslang::TIdentifierList* identifierList; - }; - } interm; - -#line 463 "MachineIndependent/glslang_tab.cpp" /* yacc.c:355 */ -}; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif - - - -int yyparse (glslang::TParseContext* pParseContext); - -#endif /* !YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED */ - -/* Copy the second part of user declarations. */ -#line 102 "MachineIndependent/glslang.y" /* yacc.c:358 */ - - -/* windows only pragma */ -#ifdef _MSC_VER - #pragma warning(disable : 4065) - #pragma warning(disable : 4127) - #pragma warning(disable : 4244) -#endif - -#define parseContext (*pParseContext) -#define yyerror(context, msg) context->parserError(msg) - -extern int yylex(YYSTYPE*, TParseContext&); - - -#line 492 "MachineIndependent/glslang_tab.cpp" /* yacc.c:358 */ - -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#else -typedef signed char yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS -# if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_(Msgid) dgettext ("bison-runtime", Msgid) -# endif -# endif -# ifndef YY_ -# define YY_(Msgid) Msgid -# endif -#endif - -#ifndef __attribute__ -/* This feature is available in gcc versions 2.5 and later. */ -# if (! defined __GNUC__ || __GNUC__ < 2 \ - || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) -# define __attribute__(Spec) /* empty */ -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) -#else -# define YYUSE(E) /* empty */ -#endif - -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ -/* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ - _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ - _Pragma ("GCC diagnostic pop") -#else -# define YY_INITIAL_VALUE(Value) Value -#endif -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - - -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS -# include /* INFRINGES ON USER NAME SPACE */ - /* Use EXIT_SUCCESS as a witness for stdlib.h. */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's 'empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined EXIT_SUCCESS \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -# define YYCOPY_NEEDED 1 - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (0) - -#endif - -#if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from SRC to DST. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) -# else -# define YYCOPY(Dst, Src, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (Dst)[yyi] = (Src)[yyi]; \ - } \ - while (0) -# endif -# endif -#endif /* !YYCOPY_NEEDED */ - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 274 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 6614 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 298 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 100 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 450 -/* YYNSTATES -- Number of states. */ -#define YYNSTATES 582 - -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 552 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ -static const yytype_uint16 yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297 -}; - -#if YYDEBUG - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = -{ - 0, 253, 253, 259, 262, 265, 269, 273, 277, 283, - 289, 292, 296, 302, 305, 313, 316, 319, 322, 325, - 330, 338, 345, 352, 358, 362, 369, 372, 378, 385, - 395, 403, 408, 438, 444, 448, 452, 472, 473, 474, - 475, 481, 482, 487, 492, 501, 502, 507, 515, 516, - 522, 531, 532, 537, 542, 547, 555, 556, 564, 575, - 576, 585, 586, 595, 596, 605, 606, 614, 615, 623, - 624, 632, 633, 633, 651, 652, 667, 671, 675, 679, - 684, 688, 692, 696, 700, 704, 708, 715, 718, 729, - 736, 741, 746, 754, 758, 762, 766, 771, 776, 785, - 785, 796, 800, 807, 814, 817, 824, 832, 852, 875, - 890, 913, 924, 934, 944, 954, 963, 966, 970, 974, - 979, 987, 992, 997, 1002, 1007, 1016, 1027, 1054, 1063, - 1070, 1077, 1084, 1096, 1102, 1105, 1112, 1116, 1120, 1128, - 1137, 1140, 1151, 1154, 1157, 1161, 1165, 1169, 1176, 1180, - 1192, 1206, 1211, 1217, 1223, 1230, 1236, 1241, 1246, 1251, - 1259, 1263, 1267, 1271, 1275, 1279, 1285, 1294, 1297, 1305, - 1309, 1318, 1323, 1331, 1335, 1345, 1349, 1353, 1358, 1365, - 1369, 1374, 1379, 1384, 1391, 1398, 1402, 1407, 1412, 1417, - 1423, 1429, 1435, 1443, 1451, 1459, 1464, 1469, 1474, 1479, - 1484, 1489, 1495, 1501, 1507, 1515, 1523, 1531, 1537, 1543, - 1549, 1555, 1561, 1567, 1575, 1583, 1591, 1596, 1601, 1606, - 1611, 1616, 1621, 1626, 1631, 1636, 1641, 1646, 1651, 1657, - 1663, 1669, 1675, 1681, 1687, 1693, 1699, 1705, 1711, 1717, - 1723, 1731, 1739, 1747, 1755, 1763, 1771, 1779, 1787, 1795, - 1803, 1811, 1819, 1824, 1829, 1834, 1839, 1844, 1849, 1854, - 1859, 1864, 1869, 1874, 1879, 1884, 1889, 1894, 1899, 1904, - 1909, 1914, 1919, 1924, 1929, 1934, 1939, 1944, 1949, 1954, - 1959, 1964, 1969, 1974, 1979, 1984, 1989, 1994, 1999, 2004, - 2009, 2014, 2019, 2024, 2029, 2034, 2039, 2044, 2049, 2054, - 2059, 2064, 2069, 2074, 2079, 2084, 2089, 2094, 2099, 2104, - 2109, 2114, 2119, 2124, 2129, 2134, 2139, 2144, 2149, 2154, - 2159, 2164, 2169, 2174, 2179, 2184, 2189, 2194, 2199, 2204, - 2209, 2214, 2219, 2224, 2229, 2234, 2239, 2244, 2249, 2254, - 2259, 2264, 2269, 2274, 2279, 2284, 2289, 2294, 2299, 2304, - 2309, 2314, 2319, 2324, 2329, 2334, 2339, 2344, 2349, 2354, - 2359, 2364, 2370, 2376, 2382, 2388, 2394, 2400, 2406, 2411, - 2427, 2432, 2437, 2445, 2445, 2456, 2456, 2466, 2469, 2482, - 2500, 2524, 2528, 2534, 2539, 2550, 2553, 2559, 2568, 2571, - 2577, 2581, 2582, 2588, 2589, 2590, 2591, 2592, 2593, 2594, - 2598, 2599, 2603, 2599, 2615, 2616, 2620, 2620, 2627, 2627, - 2641, 2644, 2652, 2660, 2671, 2672, 2676, 2683, 2687, 2695, - 2699, 2712, 2712, 2732, 2735, 2741, 2753, 2765, 2765, 2780, - 2780, 2796, 2796, 2817, 2820, 2826, 2829, 2835, 2839, 2846, - 2851, 2856, 2863, 2866, 2875, 2879, 2888, 2891, 2894, 2902, - 2902 -}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE || 1 -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "ATTRIBUTE", "VARYING", "CONST", "BOOL", - "FLOAT", "DOUBLE", "INT", "UINT", "INT64_T", "UINT64_T", "INT16_T", - "UINT16_T", "FLOAT16_T", "BREAK", "CONTINUE", "DO", "ELSE", "FOR", "IF", - "DISCARD", "RETURN", "SWITCH", "CASE", "DEFAULT", "SUBROUTINE", "BVEC2", - "BVEC3", "BVEC4", "IVEC2", "IVEC3", "IVEC4", "I64VEC2", "I64VEC3", - "I64VEC4", "UVEC2", "UVEC3", "UVEC4", "U64VEC2", "U64VEC3", "U64VEC4", - "VEC2", "VEC3", "VEC4", "MAT2", "MAT3", "MAT4", "CENTROID", "IN", "OUT", - "INOUT", "UNIFORM", "PATCH", "SAMPLE", "BUFFER", "SHARED", "COHERENT", - "VOLATILE", "RESTRICT", "READONLY", "WRITEONLY", "DVEC2", "DVEC3", - "DVEC4", "DMAT2", "DMAT3", "DMAT4", "F16VEC2", "F16VEC3", "F16VEC4", - "F16MAT2", "F16MAT3", "F16MAT4", "I16VEC2", "I16VEC3", "I16VEC4", - "U16VEC2", "U16VEC3", "U16VEC4", "NOPERSPECTIVE", "FLAT", "SMOOTH", - "LAYOUT", "__EXPLICITINTERPAMD", "MAT2X2", "MAT2X3", "MAT2X4", "MAT3X2", - "MAT3X3", "MAT3X4", "MAT4X2", "MAT4X3", "MAT4X4", "DMAT2X2", "DMAT2X3", - "DMAT2X4", "DMAT3X2", "DMAT3X3", "DMAT3X4", "DMAT4X2", "DMAT4X3", - "DMAT4X4", "F16MAT2X2", "F16MAT2X3", "F16MAT2X4", "F16MAT3X2", - "F16MAT3X3", "F16MAT3X4", "F16MAT4X2", "F16MAT4X3", "F16MAT4X4", - "ATOMIC_UINT", "SAMPLER1D", "SAMPLER2D", "SAMPLER3D", "SAMPLERCUBE", - "SAMPLER1DSHADOW", "SAMPLER2DSHADOW", "SAMPLERCUBESHADOW", - "SAMPLER1DARRAY", "SAMPLER2DARRAY", "SAMPLER1DARRAYSHADOW", - "SAMPLER2DARRAYSHADOW", "ISAMPLER1D", "ISAMPLER2D", "ISAMPLER3D", - "ISAMPLERCUBE", "ISAMPLER1DARRAY", "ISAMPLER2DARRAY", "USAMPLER1D", - "USAMPLER2D", "USAMPLER3D", "USAMPLERCUBE", "USAMPLER1DARRAY", - "USAMPLER2DARRAY", "SAMPLER2DRECT", "SAMPLER2DRECTSHADOW", - "ISAMPLER2DRECT", "USAMPLER2DRECT", "SAMPLERBUFFER", "ISAMPLERBUFFER", - "USAMPLERBUFFER", "SAMPLERCUBEARRAY", "SAMPLERCUBEARRAYSHADOW", - "ISAMPLERCUBEARRAY", "USAMPLERCUBEARRAY", "SAMPLER2DMS", "ISAMPLER2DMS", - "USAMPLER2DMS", "SAMPLER2DMSARRAY", "ISAMPLER2DMSARRAY", - "USAMPLER2DMSARRAY", "SAMPLEREXTERNALOES", "SAMPLER", "SAMPLERSHADOW", - "TEXTURE1D", "TEXTURE2D", "TEXTURE3D", "TEXTURECUBE", "TEXTURE1DARRAY", - "TEXTURE2DARRAY", "ITEXTURE1D", "ITEXTURE2D", "ITEXTURE3D", - "ITEXTURECUBE", "ITEXTURE1DARRAY", "ITEXTURE2DARRAY", "UTEXTURE1D", - "UTEXTURE2D", "UTEXTURE3D", "UTEXTURECUBE", "UTEXTURE1DARRAY", - "UTEXTURE2DARRAY", "TEXTURE2DRECT", "ITEXTURE2DRECT", "UTEXTURE2DRECT", - "TEXTUREBUFFER", "ITEXTUREBUFFER", "UTEXTUREBUFFER", "TEXTURECUBEARRAY", - "ITEXTURECUBEARRAY", "UTEXTURECUBEARRAY", "TEXTURE2DMS", "ITEXTURE2DMS", - "UTEXTURE2DMS", "TEXTURE2DMSARRAY", "ITEXTURE2DMSARRAY", - "UTEXTURE2DMSARRAY", "SUBPASSINPUT", "SUBPASSINPUTMS", "ISUBPASSINPUT", - "ISUBPASSINPUTMS", "USUBPASSINPUT", "USUBPASSINPUTMS", "IMAGE1D", - "IIMAGE1D", "UIMAGE1D", "IMAGE2D", "IIMAGE2D", "UIMAGE2D", "IMAGE3D", - "IIMAGE3D", "UIMAGE3D", "IMAGE2DRECT", "IIMAGE2DRECT", "UIMAGE2DRECT", - "IMAGECUBE", "IIMAGECUBE", "UIMAGECUBE", "IMAGEBUFFER", "IIMAGEBUFFER", - "UIMAGEBUFFER", "IMAGE1DARRAY", "IIMAGE1DARRAY", "UIMAGE1DARRAY", - "IMAGE2DARRAY", "IIMAGE2DARRAY", "UIMAGE2DARRAY", "IMAGECUBEARRAY", - "IIMAGECUBEARRAY", "UIMAGECUBEARRAY", "IMAGE2DMS", "IIMAGE2DMS", - "UIMAGE2DMS", "IMAGE2DMSARRAY", "IIMAGE2DMSARRAY", "UIMAGE2DMSARRAY", - "STRUCT", "VOID", "WHILE", "IDENTIFIER", "TYPE_NAME", "FLOATCONSTANT", - "DOUBLECONSTANT", "INTCONSTANT", "UINTCONSTANT", "INT64CONSTANT", - "UINT64CONSTANT", "INT16CONSTANT", "UINT16CONSTANT", "BOOLCONSTANT", - "FLOAT16CONSTANT", "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP", - "GE_OP", "EQ_OP", "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN", - "DIV_ASSIGN", "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", - "AND_ASSIGN", "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN", - "RIGHT_PAREN", "LEFT_BRACKET", "RIGHT_BRACKET", "LEFT_BRACE", - "RIGHT_BRACE", "DOT", "COMMA", "COLON", "EQUAL", "SEMICOLON", "BANG", - "DASH", "TILDE", "PLUS", "STAR", "SLASH", "PERCENT", "LEFT_ANGLE", - "RIGHT_ANGLE", "VERTICAL_BAR", "CARET", "AMPERSAND", "QUESTION", - "INVARIANT", "PRECISE", "HIGH_PRECISION", "MEDIUM_PRECISION", - "LOW_PRECISION", "PRECISION", "PACKED", "RESOURCE", "SUPERP", "$accept", - "variable_identifier", "primary_expression", "postfix_expression", - "integer_expression", "function_call", "function_call_or_method", - "function_call_generic", "function_call_header_no_parameters", - "function_call_header_with_parameters", "function_call_header", - "function_identifier", "unary_expression", "unary_operator", - "multiplicative_expression", "additive_expression", "shift_expression", - "relational_expression", "equality_expression", "and_expression", - "exclusive_or_expression", "inclusive_or_expression", - "logical_and_expression", "logical_xor_expression", - "logical_or_expression", "conditional_expression", "$@1", - "assignment_expression", "assignment_operator", "expression", - "constant_expression", "declaration", "block_structure", "$@2", - "identifier_list", "function_prototype", "function_declarator", - "function_header_with_parameters", "function_header", - "parameter_declarator", "parameter_declaration", - "parameter_type_specifier", "init_declarator_list", "single_declaration", - "fully_specified_type", "invariant_qualifier", "interpolation_qualifier", - "layout_qualifier", "layout_qualifier_id_list", "layout_qualifier_id", - "precise_qualifier", "type_qualifier", "single_type_qualifier", - "storage_qualifier", "type_name_list", "type_specifier", - "array_specifier", "type_specifier_nonarray", "precision_qualifier", - "struct_specifier", "$@3", "$@4", "struct_declaration_list", - "struct_declaration", "struct_declarator_list", "struct_declarator", - "initializer", "initializer_list", "declaration_statement", "statement", - "simple_statement", "compound_statement", "$@5", "$@6", - "statement_no_new_scope", "statement_scoped", "$@7", "$@8", - "compound_statement_no_new_scope", "statement_list", - "expression_statement", "selection_statement", - "selection_rest_statement", "condition", "switch_statement", "$@9", - "switch_statement_list", "case_label", "iteration_statement", "$@10", - "$@11", "$@12", "for_init_statement", "conditionopt", - "for_rest_statement", "jump_statement", "translation_unit", - "external_declaration", "function_definition", "$@13", YY_NULL -}; -#endif - -# ifdef YYPRINT -/* YYTOKNUM[NUM] -- (External) token number corresponding to the - (internal) symbol number NUM (which must be that of a token). */ -static const yytype_uint16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, - 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, - 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, - 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, - 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, - 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, - 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, - 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, - 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, - 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, - 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, - 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, - 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, - 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, - 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, - 545, 546, 547, 548, 549, 550, 551, 552 -}; -# endif - -#define YYPACT_NINF -525 - -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-525))) - -#define YYTABLE_NINF -407 - -#define yytable_value_is_error(Yytable_value) \ - 0 - - /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -static const yytype_int16 yypact[] = -{ - 2619, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -243, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -228, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -215, -525, -525, -525, - -525, -525, -525, -525, -525, -157, -525, -216, -218, -205, - -141, 4260, -165, -525, -94, -525, -525, -525, -525, 3183, - -525, -525, -525, -117, -525, -525, 575, -525, -525, -80, - -48, -114, -525, 6381, -242, -525, -525, -113, -525, 4260, - -525, -525, -525, 4260, -75, -74, -525, -235, -190, -525, - -525, -525, 4765, -108, -525, -525, -525, -186, -525, -112, - -178, -525, -525, 4260, -115, -525, -226, 867, -525, -525, - -525, -525, -117, -229, -525, 5039, -224, -525, -71, -525, - -158, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, 5861, 5861, 5861, -525, -525, -525, -525, -525, - -525, -525, -223, -525, -525, -525, -102, -177, 6121, -100, - -525, 5861, -204, -171, -132, -221, -199, -124, -120, -111, - -84, -83, -233, -98, -525, 5313, -525, -60, 5861, -525, - -48, 4260, 4260, -59, 3456, -525, -525, -525, -99, -97, - -525, -90, -88, -96, 5587, -85, 5861, -92, -79, -81, - -525, -525, -191, -525, -525, -153, -525, -218, -78, -525, - -525, -525, -525, 1159, -525, -525, -525, -525, -525, -525, - -108, 5039, -193, 5039, -525, -525, 5039, 4260, -525, -47, - -525, -525, -525, -176, -525, -525, 5861, -42, -525, -525, - 5861, -73, -525, -525, -525, 5861, 5861, 5861, 5861, 5861, - 5861, 5861, 5861, 5861, 5861, 5861, 5861, 5861, 5861, 5861, - 5861, 5861, 5861, 5861, -525, -525, -525, -76, -525, -525, - -525, -525, 3724, -59, -117, -152, -525, -525, -525, -525, - -525, 1451, -525, 5861, -525, -525, -143, 5861, -180, -525, - -525, -525, 1451, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, 5861, 5861, -525, -525, -525, -525, - 5039, -525, -133, -525, 3992, -525, -525, -72, -77, -525, - -525, -525, -525, -525, -204, -204, -171, -171, -132, -132, - -132, -132, -221, -221, -199, -124, -120, -111, -84, -83, - 5861, -525, -525, -142, -108, -59, -525, -37, 2327, -175, - -525, -163, -525, 2892, 1451, -525, -525, -525, -525, 4491, - -525, -525, -129, -525, -525, -68, -525, -525, 2892, -70, - -525, -77, -32, 4260, -63, -66, -525, -525, 5861, 5861, - -525, -69, -61, 188, -58, 2035, -525, -56, -57, 1743, - -525, -525, -161, 5861, 1743, -70, -525, -525, 1451, 5039, - -525, -525, -525, -67, -77, -525, -525, 1451, -54, -525, - -525, -525 -}; - - /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE does not specify something else to do. Zero - means the default is an error. */ -static const yytype_uint16 yydefact[] = -{ - 0, 149, 150, 148, 185, 176, 177, 179, 180, 181, - 182, 183, 184, 178, 165, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 207, 208, 209, 210, 211, 212, - 186, 187, 188, 216, 217, 218, 154, 152, 153, 151, - 157, 155, 156, 158, 159, 160, 161, 162, 163, 164, - 189, 190, 191, 228, 229, 230, 192, 193, 194, 240, - 241, 242, 204, 205, 206, 213, 214, 215, 131, 130, - 129, 0, 132, 219, 220, 221, 222, 223, 224, 225, - 226, 227, 231, 232, 233, 234, 235, 236, 237, 238, - 239, 243, 244, 245, 246, 247, 248, 249, 250, 251, - 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - 262, 263, 266, 267, 268, 269, 270, 271, 273, 274, - 275, 276, 277, 278, 280, 281, 282, 283, 284, 285, - 286, 264, 265, 272, 279, 287, 288, 289, 290, 291, - 292, 361, 293, 294, 295, 296, 297, 298, 299, 300, - 302, 303, 304, 305, 306, 307, 309, 310, 311, 312, - 313, 314, 316, 317, 318, 319, 320, 321, 301, 308, - 315, 322, 323, 324, 325, 326, 327, 362, 363, 364, - 365, 366, 367, 328, 329, 330, 331, 332, 333, 334, - 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 0, 175, 369, 448, - 128, 139, 370, 371, 372, 0, 447, 0, 449, 0, - 105, 104, 0, 116, 121, 146, 145, 143, 147, 0, - 140, 142, 126, 169, 144, 368, 0, 444, 446, 0, - 0, 0, 375, 0, 0, 93, 90, 0, 103, 0, - 112, 106, 114, 0, 115, 0, 91, 122, 0, 96, - 141, 127, 0, 170, 1, 445, 167, 0, 138, 136, - 0, 134, 373, 0, 0, 94, 0, 0, 450, 107, - 111, 113, 109, 117, 108, 0, 123, 99, 0, 97, - 0, 2, 10, 11, 4, 5, 6, 7, 8, 9, - 13, 12, 0, 0, 0, 171, 39, 38, 40, 37, - 3, 15, 33, 17, 22, 23, 0, 0, 27, 0, - 41, 0, 45, 48, 51, 56, 59, 61, 63, 65, - 67, 69, 71, 0, 31, 0, 166, 0, 0, 133, - 0, 0, 0, 0, 0, 377, 92, 95, 0, 0, - 429, 0, 0, 0, 0, 0, 0, 0, 0, 401, - 410, 414, 41, 74, 87, 0, 390, 0, 126, 393, - 412, 392, 391, 0, 394, 395, 396, 397, 398, 399, - 110, 0, 118, 0, 385, 125, 0, 0, 101, 0, - 98, 34, 35, 0, 19, 20, 0, 0, 25, 24, - 0, 175, 28, 30, 36, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 72, 172, 173, 0, 168, 89, - 137, 135, 0, 0, 383, 0, 381, 376, 378, 440, - 439, 0, 431, 0, 443, 441, 0, 0, 0, 426, - 427, 400, 0, 77, 78, 80, 79, 82, 83, 84, - 85, 86, 81, 76, 0, 0, 415, 411, 413, 120, - 0, 388, 0, 124, 0, 102, 14, 0, 21, 18, - 29, 42, 43, 44, 47, 46, 49, 50, 54, 55, - 52, 53, 57, 58, 60, 62, 64, 66, 68, 70, - 0, 174, 374, 0, 384, 0, 379, 0, 0, 0, - 442, 0, 425, 0, 402, 75, 88, 119, 386, 0, - 100, 16, 0, 380, 382, 0, 434, 433, 436, 408, - 421, 419, 0, 0, 0, 0, 387, 389, 0, 0, - 435, 0, 0, 418, 0, 0, 416, 0, 0, 0, - 403, 73, 0, 437, 0, 408, 407, 409, 423, 0, - 405, 428, 404, 0, 438, 432, 417, 424, 0, 420, - 430, 422 -}; - - /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = -{ - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -103, -525, -278, -274, -297, -273, -214, -211, - -210, -212, -209, -208, -525, -261, -525, -292, -525, -308, - -525, 4, -525, -525, -525, 5, -525, -525, -525, -41, - -38, -39, -525, -525, -504, -525, -525, -525, -525, -123, - -525, -230, -237, -525, -525, 0, -246, -525, 1, -525, - -525, -525, -337, -342, -207, -286, -378, -525, -285, -376, - -524, -322, -525, -525, -330, -327, -525, -525, -22, -452, - -275, -525, -525, -298, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -2, -525, -525 -}; - - /* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 320, 321, 322, 487, 323, 324, 325, 326, 327, - 328, 329, 372, 331, 332, 333, 334, 335, 336, 337, - 338, 339, 340, 341, 342, 373, 510, 374, 474, 375, - 440, 376, 227, 397, 300, 377, 229, 230, 231, 260, - 261, 262, 232, 233, 234, 235, 236, 237, 280, 281, - 238, 239, 240, 241, 277, 344, 273, 243, 244, 245, - 351, 283, 354, 355, 445, 446, 395, 482, 379, 380, - 381, 382, 462, 545, 571, 553, 554, 555, 572, 383, - 384, 385, 556, 544, 386, 557, 578, 387, 388, 523, - 451, 518, 538, 551, 552, 389, 246, 247, 248, 257 -}; - - /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule whose - number is the opposite. If YYTABLE_NINF, syntax error. */ -static const yytype_int16 yytable[] = -{ - 242, 263, 270, 394, 226, 228, 403, 478, 286, 278, - 524, 343, 448, 479, 442, 481, 254, 251, 483, 542, - 433, 296, 249, 404, 405, 272, 270, 422, 423, 263, - 294, 567, 272, 285, 542, 570, 412, 250, 272, 295, - 570, 345, -32, 345, 406, 391, 390, 392, 407, 357, - 396, 426, 427, 352, 252, 434, 456, 256, 458, 255, - 484, 258, 424, 425, 463, 464, 465, 466, 467, 468, - 469, 470, 471, 472, 345, 517, 415, 416, 417, 297, - 346, 480, 298, 473, 437, 299, 347, 439, 349, 409, - 486, 539, 475, 522, 350, 410, 475, 475, 488, 394, - 448, 394, 527, 540, 394, 573, 418, 265, 419, 475, - 266, 475, 420, 421, 399, 270, 577, 400, 490, 475, - 515, 352, 476, 516, 352, 498, 499, 500, 501, 475, - 515, 259, 520, 533, 222, 223, 224, 528, 267, 529, - 494, 495, 448, 475, 548, 519, 496, 497, 478, 521, - 272, 547, 276, 502, 503, 282, 287, 292, 293, 345, - 356, 398, 348, 428, 408, 413, 429, 352, 431, 330, - 435, 432, 438, 444, 430, 452, 449, 453, 450, 454, - 457, 459, 525, 526, 279, 485, 460, -31, 394, 461, - 489, 579, 511, -26, 535, 475, 531, 549, 514, -406, - 558, 478, 532, 559, 560, 564, 563, 565, 580, 401, - 402, 369, 352, 568, 504, 541, 581, 569, 505, 507, - 506, 289, 290, 508, 291, 509, 253, 441, 414, 534, - 541, 264, 566, 536, 575, 288, 513, 394, 576, 271, - 550, 562, 330, 537, 275, 330, 242, 0, 0, 0, - 226, 228, 0, 284, 352, 574, 561, 0, 0, 264, - 0, 0, 0, 264, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 394, 0, 0, - 0, 0, 0, 353, 0, 0, 0, 378, 0, 0, - 0, 0, 0, 543, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 270, 0, 543, 0, - 0, 0, 491, 492, 493, 330, 330, 330, 330, 330, - 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, - 330, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 353, 443, 0, 353, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 378, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 353, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 353, 0, 0, 0, 0, 0, 0, 0, - 0, 378, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 378, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 353, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 378, 0, - 0, 0, 0, 378, 378, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 378, 0, - 0, 0, 0, 271, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 378, 0, 0, 0, 378, - 0, 0, 0, 0, 378, 0, 0, 0, 378, 0, - 0, 0, 0, 0, 0, 274, 0, 378, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, - 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, - 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, - 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - 212, 213, 214, 215, 216, 217, 0, 0, 218, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 219, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 220, 221, 222, 223, 224, 225, - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 358, 359, 360, 0, 361, 362, 363, - 364, 365, 366, 367, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 368, 301, - 218, 302, 303, 304, 305, 306, 307, 308, 309, 310, - 311, 0, 0, 312, 313, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 314, 0, 0, 0, 369, 370, 0, 0, - 0, 0, 371, 316, 317, 318, 319, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 220, 221, 222, 223, - 224, 225, 1, 2, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 358, 359, 360, 0, 361, - 362, 363, 364, 365, 366, 367, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 368, 301, 218, 302, 303, 304, 305, 306, 307, 308, - 309, 310, 311, 0, 0, 312, 313, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 314, 0, 0, 0, 369, 477, - 0, 0, 0, 0, 371, 316, 317, 318, 319, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 220, 221, - 222, 223, 224, 225, 1, 2, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 358, 359, 360, - 0, 361, 362, 363, 364, 365, 366, 367, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, - 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 368, 301, 218, 302, 303, 304, 305, 306, - 307, 308, 309, 310, 311, 0, 0, 312, 313, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 314, 0, 0, 0, - 369, 0, 0, 0, 0, 0, 371, 316, 317, 318, - 319, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 220, 221, 222, 223, 224, 225, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 358, - 359, 360, 0, 361, 362, 363, 364, 365, 366, 367, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, - 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, - 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, - 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, - 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, - 214, 215, 216, 217, 368, 301, 218, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 0, 0, 312, - 313, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 314, 0, - 0, 0, 287, 0, 0, 0, 0, 0, 371, 316, - 317, 318, 319, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 220, 221, 222, 223, 224, 225, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 358, 359, 360, 0, 361, 362, 363, 364, 365, - 366, 367, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, - 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, - 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, - 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - 212, 213, 214, 215, 216, 217, 368, 301, 218, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 0, - 0, 312, 313, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 314, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 371, 316, 317, 318, 319, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 220, 221, 222, 223, 224, 225, - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 0, 301, - 218, 302, 303, 304, 305, 306, 307, 308, 309, 310, - 311, 0, 0, 312, 313, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 314, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 371, 316, 317, 318, 319, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 220, 221, 222, 223, - 224, 225, 1, 2, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 0, 0, 218, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 219, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 220, 221, - 222, 223, 224, 225, 0, 0, 0, 0, 0, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 0, 301, 218, 302, 303, 304, 305, - 306, 307, 308, 309, 310, 311, 0, 0, 312, 313, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 314, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 316, 317, - 318, 319, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 220, 221, 222, 223, 224, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, - 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, - 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, - 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, - 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, - 214, 215, 216, 217, 0, 268, 218, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 269, 1, - 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 220, 221, 222, 223, 224, 0, 0, 0, - 0, 0, 0, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, - 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, - 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, - 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, - 211, 212, 213, 214, 215, 216, 217, 0, 0, 218, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 447, 1, 2, 3, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 0, 0, 0, 0, 0, 220, 221, 222, 223, 224, - 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 0, 0, 218, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 512, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 0, 0, - 0, 0, 0, 220, 221, 222, 223, 224, 0, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 0, 0, 218, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 530, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 0, 0, 0, 0, - 0, 220, 221, 222, 223, 224, 0, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, - 217, 0, 0, 218, 0, 0, 0, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 220, - 221, 222, 223, 224, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 0, 0, 0, 0, 0, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, - 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 0, 301, 218, 302, 303, 304, 305, 306, - 307, 308, 309, 310, 311, 0, 0, 312, 313, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 314, 0, 0, 0, - 393, 546, 0, 0, 0, 0, 0, 316, 317, 318, - 319, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 0, 0, 0, 0, - 0, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, - 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, - 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, - 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - 212, 213, 214, 215, 216, 217, 0, 301, 218, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 0, - 0, 312, 313, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 314, 0, 0, 315, 0, 0, 0, 0, 0, 0, - 0, 316, 317, 318, 319, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 0, 0, 0, 0, 0, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 0, 301, 218, 302, 303, 304, 305, 306, 307, 308, - 309, 310, 311, 0, 0, 312, 313, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 314, 0, 0, 0, 393, 0, - 0, 0, 0, 0, 0, 316, 317, 318, 319, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 0, 0, 0, 0, 0, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, - 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, - 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, - 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, - 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, - 214, 215, 216, 217, 0, 301, 218, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 0, 0, 312, - 313, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 314, 0, - 0, 436, 0, 0, 0, 0, 0, 0, 0, 316, - 317, 318, 319, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 0, 0, - 0, 0, 0, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 0, 301, - 218, 302, 303, 304, 305, 306, 307, 308, 309, 310, - 311, 0, 0, 312, 313, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 314, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 455, 316, 317, 318, 319, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 0, 0, 0, 0, 0, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, - 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 0, 301, 218, 302, 303, 304, 305, 306, - 307, 308, 309, 310, 311, 0, 0, 312, 313, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 314, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 316, 317, 318, - 319, 0, 0, 0, 0, 0, 0, 0, 0, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 0, 0, 0, 0, 0, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, - 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 411, 0, 301, 218, 302, 303, 304, 305, 306, - 307, 308, 309, 310, 311, 0, 0, 312, 313, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 314, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 316, 317, 318, - 319, 0, 0, 0, 0, 0, 0, 0, 0, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 0, 0, 0, 0, 0, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, - 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 0, 0, 218 -}; - -static const yytype_int16 yycheck[] = -{ - 0, 231, 239, 295, 0, 0, 314, 383, 254, 57, - 462, 272, 354, 391, 351, 393, 232, 232, 396, 523, - 253, 267, 265, 246, 247, 267, 263, 248, 249, 259, - 265, 555, 267, 275, 538, 559, 328, 265, 267, 274, - 564, 267, 265, 267, 267, 274, 292, 293, 271, 275, - 274, 250, 251, 283, 269, 288, 364, 275, 366, 275, - 397, 266, 283, 284, 255, 256, 257, 258, 259, 260, - 261, 262, 263, 264, 267, 451, 280, 281, 282, 269, - 266, 274, 272, 274, 345, 275, 272, 348, 266, 266, - 266, 266, 272, 273, 272, 272, 272, 272, 406, 391, - 442, 393, 480, 266, 396, 266, 277, 272, 279, 272, - 275, 272, 244, 245, 272, 352, 568, 275, 410, 272, - 272, 351, 275, 275, 354, 422, 423, 424, 425, 272, - 272, 272, 275, 275, 291, 292, 293, 270, 232, 272, - 418, 419, 484, 272, 273, 453, 420, 421, 524, 457, - 267, 529, 232, 426, 427, 269, 269, 232, 232, 267, - 275, 232, 274, 287, 266, 265, 286, 397, 252, 272, - 268, 254, 232, 232, 285, 265, 275, 265, 275, 275, - 265, 273, 474, 475, 232, 232, 265, 265, 480, 270, - 232, 569, 268, 266, 231, 272, 268, 265, 444, 269, - 232, 577, 510, 266, 270, 266, 275, 19, 275, 312, - 313, 269, 442, 269, 428, 523, 270, 274, 429, 431, - 430, 259, 263, 432, 263, 433, 225, 350, 331, 515, - 538, 231, 554, 518, 564, 257, 443, 529, 565, 239, - 538, 549, 345, 518, 246, 348, 246, -1, -1, -1, - 246, 246, -1, 253, 484, 563, 548, -1, -1, 259, - -1, -1, -1, 263, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 569, -1, -1, - -1, -1, -1, 283, -1, -1, -1, 287, -1, -1, - -1, -1, -1, 523, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 543, -1, 538, -1, - -1, -1, 415, 416, 417, 418, 419, 420, 421, 422, - 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, - 433, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 351, 352, -1, 354, -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, 383, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 397, -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, 442, -1, -1, -1, -1, -1, -1, -1, - -1, 451, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 462, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 484, -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, 518, -1, - -1, -1, -1, 523, 524, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 538, -1, - -1, -1, -1, 543, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 555, -1, -1, -1, 559, - -1, -1, -1, -1, 564, -1, -1, -1, 568, -1, - -1, -1, -1, -1, -1, 0, -1, 577, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, -1, -1, 233, -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, - 275, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 289, 290, 291, 292, 293, 294, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, -1, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, -1, -1, 246, 247, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 265, -1, -1, -1, 269, 270, -1, -1, - -1, -1, 275, 276, 277, 278, 279, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 289, 290, 291, 292, - 293, 294, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, -1, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, - 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, - 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, - 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, - 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, - 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, - 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, - 241, 242, 243, -1, -1, 246, 247, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 265, -1, -1, -1, 269, 270, - -1, -1, -1, -1, 275, 276, 277, 278, 279, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 289, 290, - 291, 292, 293, 294, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, - 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, - 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, - 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, - 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, - 239, 240, 241, 242, 243, -1, -1, 246, 247, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 265, -1, -1, -1, - 269, -1, -1, -1, -1, -1, 275, 276, 277, 278, - 279, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 289, 290, 291, 292, 293, 294, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, -1, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, - 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, - 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, - 237, 238, 239, 240, 241, 242, 243, -1, -1, 246, - 247, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 265, -1, - -1, -1, 269, -1, -1, -1, -1, -1, 275, 276, - 277, 278, 279, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 289, 290, 291, 292, 293, 294, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, -1, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, -1, - -1, 246, 247, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 265, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 275, 276, 277, 278, 279, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 289, 290, 291, 292, 293, 294, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, -1, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, -1, -1, 246, 247, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 265, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 275, 276, 277, 278, 279, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 289, 290, 291, 292, - 293, 294, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, - 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, - 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, - 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, - 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, - 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, - -1, -1, 233, -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, 275, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 289, 290, - 291, 292, 293, 294, -1, -1, -1, -1, -1, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, -1, 232, 233, 234, 235, 236, 237, - 238, 239, 240, 241, 242, 243, -1, -1, 246, 247, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 265, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 276, 277, - 278, 279, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 289, 290, 291, 292, 293, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, - 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, - 227, 228, 229, 230, -1, 232, 233, -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, 275, 3, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 289, 290, 291, 292, 293, -1, -1, -1, - -1, -1, -1, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, - 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, - 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, - 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, - 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, - 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 228, 229, 230, -1, -1, 233, - -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, 270, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - -1, -1, -1, -1, -1, 289, 290, 291, 292, 293, - -1, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, - 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, - 226, 227, 228, 229, 230, -1, -1, 233, -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, 270, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, -1, -1, - -1, -1, -1, 289, 290, 291, 292, 293, -1, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, -1, -1, 233, -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, 270, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, - -1, 289, 290, 291, 292, 293, -1, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, - 230, -1, -1, 233, -1, -1, -1, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 289, - 290, 291, 292, 293, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, -1, -1, -1, -1, -1, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, - 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, - 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, - 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, - 229, 230, -1, 232, 233, 234, 235, 236, 237, 238, - 239, 240, 241, 242, 243, -1, -1, 246, 247, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 265, -1, -1, -1, - 269, 270, -1, -1, -1, -1, -1, 276, 277, 278, - 279, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, -1, -1, -1, -1, - -1, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, -1, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, -1, - -1, 246, 247, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 265, -1, -1, 268, -1, -1, -1, -1, -1, -1, - -1, 276, 277, 278, 279, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - -1, -1, -1, -1, -1, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, - 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, - 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, - 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, - 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, - 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, - -1, 232, 233, 234, 235, 236, 237, 238, 239, 240, - 241, 242, 243, -1, -1, 246, 247, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 265, -1, -1, -1, 269, -1, - -1, -1, -1, -1, -1, 276, 277, 278, 279, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, -1, -1, -1, -1, -1, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, - 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, - 227, 228, 229, 230, -1, 232, 233, 234, 235, 236, - 237, 238, 239, 240, 241, 242, 243, -1, -1, 246, - 247, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 265, -1, - -1, 268, -1, -1, -1, -1, -1, -1, -1, 276, - 277, 278, 279, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, -1, -1, - -1, -1, -1, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, -1, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, -1, -1, 246, 247, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 265, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 275, 276, 277, 278, 279, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, -1, -1, -1, -1, -1, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, - 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, - 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, - 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, - 229, 230, -1, 232, 233, 234, 235, 236, 237, 238, - 239, 240, 241, 242, 243, -1, -1, 246, 247, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 265, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 276, 277, 278, - 279, -1, -1, -1, -1, -1, -1, -1, -1, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, -1, -1, -1, -1, -1, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, - 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, - 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, - 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, - 229, 230, -1, 232, 233, 234, 235, 236, 237, 238, - 239, 240, 241, 242, 243, -1, -1, 246, 247, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 265, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 276, 277, 278, - 279, -1, -1, -1, -1, -1, -1, -1, -1, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, -1, -1, -1, -1, -1, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, - 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, - 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, - 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, - 229, 230, -1, -1, 233 -}; - - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint16 yystos[] = -{ - 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 233, 275, - 289, 290, 291, 292, 293, 294, 329, 330, 333, 334, - 335, 336, 340, 341, 342, 343, 344, 345, 348, 349, - 350, 351, 353, 355, 356, 357, 394, 395, 396, 265, - 265, 232, 269, 356, 232, 275, 275, 397, 266, 272, - 337, 338, 339, 349, 353, 272, 275, 232, 232, 275, - 350, 353, 267, 354, 0, 395, 232, 352, 57, 232, - 346, 347, 269, 359, 353, 275, 354, 269, 376, 338, - 337, 339, 232, 232, 265, 274, 354, 269, 272, 275, - 332, 232, 234, 235, 236, 237, 238, 239, 240, 241, - 242, 243, 246, 247, 265, 268, 276, 277, 278, 279, - 299, 300, 301, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, - 320, 321, 322, 323, 353, 267, 266, 272, 274, 266, - 272, 358, 349, 353, 360, 361, 275, 275, 16, 17, - 18, 20, 21, 22, 23, 24, 25, 26, 231, 269, - 270, 275, 310, 323, 325, 327, 329, 333, 353, 366, - 367, 368, 369, 377, 378, 379, 382, 385, 386, 393, - 354, 274, 354, 269, 325, 364, 274, 331, 232, 272, - 275, 310, 310, 327, 246, 247, 267, 271, 266, 266, - 272, 230, 325, 265, 310, 280, 281, 282, 277, 279, - 244, 245, 248, 249, 283, 284, 250, 251, 287, 286, - 285, 252, 254, 253, 288, 268, 268, 323, 232, 323, - 328, 347, 360, 353, 232, 362, 363, 270, 361, 275, - 275, 388, 265, 265, 275, 275, 327, 265, 327, 273, - 265, 270, 370, 255, 256, 257, 258, 259, 260, 261, - 262, 263, 264, 274, 326, 272, 275, 270, 367, 364, - 274, 364, 365, 364, 360, 232, 266, 302, 327, 232, - 325, 310, 310, 310, 312, 312, 313, 313, 314, 314, - 314, 314, 315, 315, 316, 317, 318, 319, 320, 321, - 324, 268, 270, 362, 354, 272, 275, 367, 389, 327, - 275, 327, 273, 387, 377, 325, 325, 364, 270, 272, - 270, 268, 327, 275, 363, 231, 366, 378, 390, 266, - 266, 327, 342, 349, 381, 371, 270, 364, 273, 265, - 381, 391, 392, 373, 374, 375, 380, 383, 232, 266, - 270, 325, 327, 275, 266, 19, 369, 368, 269, 274, - 368, 372, 376, 266, 327, 372, 373, 377, 384, 364, - 275, 270 -}; - - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint16 yyr1[] = -{ - 0, 298, 299, 300, 300, 300, 300, 300, 300, 300, - 300, 300, 300, 300, 300, 301, 301, 301, 301, 301, - 301, 302, 303, 304, 305, 305, 306, 306, 307, 307, - 308, 309, 309, 310, 310, 310, 310, 311, 311, 311, - 311, 312, 312, 312, 312, 313, 313, 313, 314, 314, - 314, 315, 315, 315, 315, 315, 316, 316, 316, 317, - 317, 318, 318, 319, 319, 320, 320, 321, 321, 322, - 322, 323, 324, 323, 325, 325, 326, 326, 326, 326, - 326, 326, 326, 326, 326, 326, 326, 327, 327, 328, - 329, 329, 329, 329, 329, 329, 329, 329, 329, 331, - 330, 332, 332, 333, 334, 334, 335, 335, 336, 337, - 337, 338, 338, 338, 338, 339, 340, 340, 340, 340, - 340, 341, 341, 341, 341, 341, 342, 342, 343, 344, - 344, 344, 344, 345, 346, 346, 347, 347, 347, 348, - 349, 349, 350, 350, 350, 350, 350, 350, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 352, 352, 353, - 353, 354, 354, 354, 354, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 356, 356, 356, 358, 357, 359, 357, 360, 360, 361, - 361, 362, 362, 363, 363, 364, 364, 364, 365, 365, - 366, 367, 367, 368, 368, 368, 368, 368, 368, 368, - 369, 370, 371, 369, 372, 372, 374, 373, 375, 373, - 376, 376, 377, 377, 378, 378, 379, 380, 380, 381, - 381, 383, 382, 384, 384, 385, 385, 387, 386, 388, - 386, 389, 386, 390, 390, 391, 391, 392, 392, 393, - 393, 393, 393, 393, 394, 394, 395, 395, 395, 397, - 396 -}; - - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 3, 1, 4, 1, 3, 2, - 2, 1, 1, 1, 2, 2, 2, 1, 2, 3, - 2, 1, 1, 1, 2, 2, 2, 1, 1, 1, - 1, 1, 3, 3, 3, 1, 3, 3, 1, 3, - 3, 1, 3, 3, 3, 3, 1, 3, 3, 1, - 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, - 3, 1, 0, 6, 1, 3, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, - 2, 2, 4, 2, 3, 4, 2, 3, 4, 0, - 6, 2, 3, 2, 1, 1, 2, 3, 3, 2, - 3, 2, 1, 2, 1, 1, 1, 3, 4, 6, - 5, 1, 2, 3, 5, 4, 1, 2, 1, 1, - 1, 1, 1, 4, 1, 3, 1, 3, 1, 1, - 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 4, 1, 3, 1, - 2, 2, 3, 3, 4, 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, 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, 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, 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, 1, 1, 1, - 1, 1, 1, 0, 6, 0, 5, 1, 2, 3, - 4, 1, 3, 1, 2, 1, 3, 4, 1, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 0, 0, 5, 1, 1, 0, 2, 0, 2, - 2, 3, 1, 2, 1, 2, 5, 3, 1, 1, - 4, 0, 8, 0, 1, 3, 2, 0, 6, 0, - 8, 0, 7, 1, 1, 1, 0, 2, 3, 2, - 2, 2, 3, 2, 1, 2, 1, 1, 1, 0, - 3 -}; - - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (pParseContext, YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (0) - -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 - - - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (0) - -/* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif - - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value, pParseContext); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) - - -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ - -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, glslang::TParseContext* pParseContext) -{ - FILE *yyo = yyoutput; - YYUSE (yyo); - YYUSE (pParseContext); - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - YYUSE (yytype); -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, glslang::TParseContext* pParseContext) -{ - YYFPRINTF (yyoutput, "%s %s (", - yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - - yy_symbol_value_print (yyoutput, yytype, yyvaluep, pParseContext); - YYFPRINTF (yyoutput, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -{ - YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } - YYFPRINTF (stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (0) - - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -static void -yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, glslang::TParseContext* pParseContext) -{ - unsigned long int yylno = yyrline[yyrule]; - int yynrhs = yyr2[yyrule]; - int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, - yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) - , pParseContext); - YYFPRINTF (stderr, "\n"); - } -} - -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyssp, yyvsp, Rule, pParseContext); \ -} while (0) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - - -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -static YYSIZE_T -yystrlen (const char *yystr) -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -static char * -yystpcpy (char *yydest, const char *yysrc) -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) -{ - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); - YYSIZE_T yysize = yysize0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = YY_NULL; - /* Arguments of yyformat. */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ - int yycount = 0; - - /* There are many possibilities here to consider: - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (yytoken != YYEMPTY) - { - int yyn = yypact[*yyssp]; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - } - } - } - - switch (yycount) - { -# define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ - } - - { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - - if (*yymsg_alloc < yysize) - { - *yymsg_alloc = 2 * yysize; - if (! (yysize <= *yymsg_alloc - && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; - } - - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - { - char *yyp = *yymsg; - int yyi = 0; - while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyformat += 2; - } - else - { - yyp++; - yyformat++; - } - } - return 0; -} -#endif /* YYERROR_VERBOSE */ - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, glslang::TParseContext* pParseContext) -{ - YYUSE (yyvaluep); - YYUSE (pParseContext); - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yytype); - YY_IGNORE_MAYBE_UNINITIALIZED_END -} - - - - -/*----------. -| yyparse. | -`----------*/ - -int -yyparse (glslang::TParseContext* pParseContext) -{ -/* The lookahead symbol. */ -int yychar; - - -/* The semantic value of the lookahead symbol. */ -/* Default value used for initialization, for pacifying older GCCs - or non-GCC compilers. */ -YY_INITIAL_VALUE (static YYSTYPE yyval_default;) -YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); - - /* Number of syntax errors so far. */ - int yynerrs; - - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - 'yyss': related to states. - 'yyvs': related to semantic values. - - Refer to the stacks through separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; - - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; - yystacksize = YYINITDEPTH; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; - - yysetstate: - *yyssp = yystate; - - if (yyss + yystacksize - 1 <= yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - - if (yystate == YYFINAL) - YYACCEPT; - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - - /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; - if (yypact_value_is_default (yyn)) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = yylex (&yylval, parseContext); - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yytable_value_is_error (yyn)) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the lookahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - - yystate = yyn; - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - '$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - - - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 2: -#line 253 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.handleVariable((yyvsp[0].lex).loc, (yyvsp[0].lex).symbol, (yyvsp[0].lex).string); - } -#line 3344 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 3: -#line 259 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); - } -#line 3352 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 4: -#line 262 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); - } -#line 3360 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 5: -#line 265 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned literal"); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); - } -#line 3369 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 6: -#line 269 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer literal"); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i64, (yyvsp[0].lex).loc, true); - } -#line 3378 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 7: -#line 273 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer literal"); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u64, (yyvsp[0].lex).loc, true); - } -#line 3387 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 8: -#line 277 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.int16Check((yyvsp[0].lex).loc, "16-bit integer literal"); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((short)(yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); -#endif - } -#line 3398 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 9: -#line 283 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.int16Check((yyvsp[0].lex).loc, "16-bit unsigned integer literal"); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((unsigned short)(yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); -#endif - } -#line 3409 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 10: -#line 289 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtFloat, (yyvsp[0].lex).loc, true); - } -#line 3417 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 11: -#line 292 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double literal"); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtDouble, (yyvsp[0].lex).loc, true); - } -#line 3426 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 12: -#line 296 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.float16Check((yyvsp[0].lex).loc, "half float literal"); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtFloat16, (yyvsp[0].lex).loc, true); -#endif - } -#line 3437 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 13: -#line 302 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).b, (yyvsp[0].lex).loc, true); - } -#line 3445 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 14: -#line 305 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = (yyvsp[-1].interm.intermTypedNode); - if ((yyval.interm.intermTypedNode)->getAsConstantUnion()) - (yyval.interm.intermTypedNode)->getAsConstantUnion()->setExpression(); - } -#line 3455 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 15: -#line 313 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); - } -#line 3463 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 16: -#line 316 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.handleBracketDereference((yyvsp[-2].lex).loc, (yyvsp[-3].interm.intermTypedNode), (yyvsp[-1].interm.intermTypedNode)); - } -#line 3471 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 17: -#line 319 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); - } -#line 3479 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 18: -#line 322 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.handleDotDereference((yyvsp[0].lex).loc, (yyvsp[-2].interm.intermTypedNode), *(yyvsp[0].lex).string); - } -#line 3487 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 19: -#line 325 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.variableCheck((yyvsp[-1].interm.intermTypedNode)); - parseContext.lValueErrorCheck((yyvsp[0].lex).loc, "++", (yyvsp[-1].interm.intermTypedNode)); - (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[0].lex).loc, "++", EOpPostIncrement, (yyvsp[-1].interm.intermTypedNode)); - } -#line 3497 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 20: -#line 330 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.variableCheck((yyvsp[-1].interm.intermTypedNode)); - parseContext.lValueErrorCheck((yyvsp[0].lex).loc, "--", (yyvsp[-1].interm.intermTypedNode)); - (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[0].lex).loc, "--", EOpPostDecrement, (yyvsp[-1].interm.intermTypedNode)); - } -#line 3507 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 21: -#line 338 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.integerCheck((yyvsp[0].interm.intermTypedNode), "[]"); - (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); - } -#line 3516 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 22: -#line 345 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.handleFunctionCall((yyvsp[0].interm).loc, (yyvsp[0].interm).function, (yyvsp[0].interm).intermNode); - delete (yyvsp[0].interm).function; - } -#line 3525 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 23: -#line 352 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm) = (yyvsp[0].interm); - } -#line 3533 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 24: -#line 358 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm) = (yyvsp[-1].interm); - (yyval.interm).loc = (yyvsp[0].lex).loc; - } -#line 3542 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 25: -#line 362 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm) = (yyvsp[-1].interm); - (yyval.interm).loc = (yyvsp[0].lex).loc; - } -#line 3551 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 26: -#line 369 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm) = (yyvsp[-1].interm); - } -#line 3559 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 27: -#line 372 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm) = (yyvsp[0].interm); - } -#line 3567 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 28: -#line 378 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - TParameter param = { 0, new TType }; - param.type->shallowCopy((yyvsp[0].interm.intermTypedNode)->getType()); - (yyvsp[-1].interm).function->addParameter(param); - (yyval.interm).function = (yyvsp[-1].interm).function; - (yyval.interm).intermNode = (yyvsp[0].interm.intermTypedNode); - } -#line 3579 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 29: -#line 385 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - TParameter param = { 0, new TType }; - param.type->shallowCopy((yyvsp[0].interm.intermTypedNode)->getType()); - (yyvsp[-2].interm).function->addParameter(param); - (yyval.interm).function = (yyvsp[-2].interm).function; - (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[-2].interm).intermNode, (yyvsp[0].interm.intermTypedNode), (yyvsp[-1].lex).loc); - } -#line 3591 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 30: -#line 395 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm) = (yyvsp[-1].interm); - } -#line 3599 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 31: -#line 403 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - // Constructor - (yyval.interm).intermNode = 0; - (yyval.interm).function = parseContext.handleConstructorCall((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type)); - } -#line 3609 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 32: -#line 408 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - // - // Should be a method or subroutine call, but we haven't recognized the arguments yet. - // - (yyval.interm).function = 0; - (yyval.interm).intermNode = 0; - - TIntermMethod* method = (yyvsp[0].interm.intermTypedNode)->getAsMethodNode(); - if (method) { - (yyval.interm).function = new TFunction(&method->getMethodName(), TType(EbtInt), EOpArrayLength); - (yyval.interm).intermNode = method->getObject(); - } else { - TIntermSymbol* symbol = (yyvsp[0].interm.intermTypedNode)->getAsSymbolNode(); - if (symbol) { - parseContext.reservedErrorCheck(symbol->getLoc(), symbol->getName()); - TFunction *function = new TFunction(&symbol->getName(), TType(EbtVoid)); - (yyval.interm).function = function; - } else - parseContext.error((yyvsp[0].interm.intermTypedNode)->getLoc(), "function call, method, or subroutine call expected", "", ""); - } - - if ((yyval.interm).function == 0) { - // error recover - TString empty(""); - (yyval.interm).function = new TFunction(&empty, TType(EbtVoid), EOpNull); - } - } -#line 3641 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 33: -#line 438 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.variableCheck((yyvsp[0].interm.intermTypedNode)); - (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); - if (TIntermMethod* method = (yyvsp[0].interm.intermTypedNode)->getAsMethodNode()) - parseContext.error((yyvsp[0].interm.intermTypedNode)->getLoc(), "incomplete method syntax", method->getMethodName().c_str(), ""); - } -#line 3652 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 34: -#line 444 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.lValueErrorCheck((yyvsp[-1].lex).loc, "++", (yyvsp[0].interm.intermTypedNode)); - (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[-1].lex).loc, "++", EOpPreIncrement, (yyvsp[0].interm.intermTypedNode)); - } -#line 3661 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 35: -#line 448 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.lValueErrorCheck((yyvsp[-1].lex).loc, "--", (yyvsp[0].interm.intermTypedNode)); - (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[-1].lex).loc, "--", EOpPreDecrement, (yyvsp[0].interm.intermTypedNode)); - } -#line 3670 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 36: -#line 452 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - if ((yyvsp[-1].interm).op != EOpNull) { - char errorOp[2] = {0, 0}; - switch((yyvsp[-1].interm).op) { - case EOpNegative: errorOp[0] = '-'; break; - case EOpLogicalNot: errorOp[0] = '!'; break; - case EOpBitwiseNot: errorOp[0] = '~'; break; - default: break; // some compilers want this - } - (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[-1].interm).loc, errorOp, (yyvsp[-1].interm).op, (yyvsp[0].interm.intermTypedNode)); - } else { - (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); - if ((yyval.interm.intermTypedNode)->getAsConstantUnion()) - (yyval.interm.intermTypedNode)->getAsConstantUnion()->setExpression(); - } - } -#line 3691 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 37: -#line 472 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpNull; } -#line 3697 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 38: -#line 473 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpNegative; } -#line 3703 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 39: -#line 474 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpLogicalNot; } -#line 3709 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 40: -#line 475 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpBitwiseNot; - parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise not"); } -#line 3716 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 41: -#line 481 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3722 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 42: -#line 482 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "*", EOpMul, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) - (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); - } -#line 3732 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 43: -#line 487 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "/", EOpDiv, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) - (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); - } -#line 3742 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 44: -#line 492 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "%"); - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "%", EOpMod, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) - (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); - } -#line 3753 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 45: -#line 501 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3759 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 46: -#line 502 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "+", EOpAdd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) - (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); - } -#line 3769 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 47: -#line 507 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "-", EOpSub, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) - (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); - } -#line 3779 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 48: -#line 515 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3785 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 49: -#line 516 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bit shift left"); - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "<<", EOpLeftShift, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) - (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); - } -#line 3796 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 50: -#line 522 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bit shift right"); - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, ">>", EOpRightShift, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) - (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); - } -#line 3807 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 51: -#line 531 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3813 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 52: -#line 532 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "<", EOpLessThan, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); - } -#line 3823 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 53: -#line 537 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, ">", EOpGreaterThan, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); - } -#line 3833 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 54: -#line 542 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "<=", EOpLessThanEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); - } -#line 3843 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 55: -#line 547 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, ">=", EOpGreaterThanEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); - } -#line 3853 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 56: -#line 555 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3859 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 57: -#line 556 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.arrayObjectCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "array comparison"); - parseContext.opaqueCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "=="); - parseContext.specializationCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "=="); - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "==", EOpEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); - } -#line 3872 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 58: -#line 564 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.arrayObjectCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "array comparison"); - parseContext.opaqueCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "!="); - parseContext.specializationCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "!="); - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "!=", EOpNotEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); - } -#line 3885 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 59: -#line 575 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3891 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 60: -#line 576 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bitwise and"); - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "&", EOpAnd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) - (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); - } -#line 3902 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 61: -#line 585 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3908 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 62: -#line 586 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bitwise exclusive or"); - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "^", EOpExclusiveOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) - (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); - } -#line 3919 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 63: -#line 595 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3925 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 64: -#line 596 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bitwise inclusive or"); - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "|", EOpInclusiveOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) - (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); - } -#line 3936 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 65: -#line 605 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3942 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 66: -#line 606 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "&&", EOpLogicalAnd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); - } -#line 3952 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 67: -#line 614 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3958 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 68: -#line 615 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "^^", EOpLogicalXor, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); - } -#line 3968 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 69: -#line 623 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3974 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 70: -#line 624 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "||", EOpLogicalOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); - } -#line 3984 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 71: -#line 632 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3990 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 72: -#line 633 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - ++parseContext.controlFlowNestingLevel; - } -#line 3998 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 73: -#line 636 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - --parseContext.controlFlowNestingLevel; - parseContext.boolCheck((yyvsp[-4].lex).loc, (yyvsp[-5].interm.intermTypedNode)); - parseContext.rValueErrorCheck((yyvsp[-4].lex).loc, "?", (yyvsp[-5].interm.intermTypedNode)); - parseContext.rValueErrorCheck((yyvsp[-1].lex).loc, ":", (yyvsp[-2].interm.intermTypedNode)); - parseContext.rValueErrorCheck((yyvsp[-1].lex).loc, ":", (yyvsp[0].interm.intermTypedNode)); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addSelection((yyvsp[-5].interm.intermTypedNode), (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yyvsp[-4].lex).loc); - if ((yyval.interm.intermTypedNode) == 0) { - parseContext.binaryOpError((yyvsp[-4].lex).loc, ":", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(), (yyvsp[0].interm.intermTypedNode)->getCompleteString()); - (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); - } - } -#line 4015 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 74: -#line 651 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 4021 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 75: -#line 652 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.arrayObjectCheck((yyvsp[-1].interm).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "array assignment"); - parseContext.opaqueCheck((yyvsp[-1].interm).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "="); - parseContext.specializationCheck((yyvsp[-1].interm).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "="); - parseContext.lValueErrorCheck((yyvsp[-1].interm).loc, "assign", (yyvsp[-2].interm.intermTypedNode)); - parseContext.rValueErrorCheck((yyvsp[-1].interm).loc, "assign", (yyvsp[0].interm.intermTypedNode)); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addAssign((yyvsp[-1].interm).op, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yyvsp[-1].interm).loc); - if ((yyval.interm.intermTypedNode) == 0) { - parseContext.assignError((yyvsp[-1].interm).loc, "assign", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(), (yyvsp[0].interm.intermTypedNode)->getCompleteString()); - (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); - } - } -#line 4038 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 76: -#line 667 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm).loc = (yyvsp[0].lex).loc; - (yyval.interm).op = EOpAssign; - } -#line 4047 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 77: -#line 671 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm).loc = (yyvsp[0].lex).loc; - (yyval.interm).op = EOpMulAssign; - } -#line 4056 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 78: -#line 675 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm).loc = (yyvsp[0].lex).loc; - (yyval.interm).op = EOpDivAssign; - } -#line 4065 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 79: -#line 679 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "%="); - (yyval.interm).loc = (yyvsp[0].lex).loc; - (yyval.interm).op = EOpModAssign; - } -#line 4075 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 80: -#line 684 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm).loc = (yyvsp[0].lex).loc; - (yyval.interm).op = EOpAddAssign; - } -#line 4084 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 81: -#line 688 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm).loc = (yyvsp[0].lex).loc; - (yyval.interm).op = EOpSubAssign; - } -#line 4093 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 82: -#line 692 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bit-shift left assign"); - (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpLeftShiftAssign; - } -#line 4102 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 83: -#line 696 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bit-shift right assign"); - (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpRightShiftAssign; - } -#line 4111 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 84: -#line 700 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise-and assign"); - (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpAndAssign; - } -#line 4120 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 85: -#line 704 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise-xor assign"); - (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpExclusiveOrAssign; - } -#line 4129 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 86: -#line 708 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise-or assign"); - (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpInclusiveOrAssign; - } -#line 4138 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 87: -#line 715 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); - } -#line 4146 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 88: -#line 718 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.samplerConstructorLocationCheck((yyvsp[-1].lex).loc, ",", (yyvsp[0].interm.intermTypedNode)); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addComma((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yyvsp[-1].lex).loc); - if ((yyval.interm.intermTypedNode) == 0) { - parseContext.binaryOpError((yyvsp[-1].lex).loc, ",", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(), (yyvsp[0].interm.intermTypedNode)->getCompleteString()); - (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); - } - } -#line 4159 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 89: -#line 729 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.constantValueCheck((yyvsp[0].interm.intermTypedNode), ""); - (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); - } -#line 4168 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 90: -#line 736 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.handleFunctionDeclarator((yyvsp[-1].interm).loc, *(yyvsp[-1].interm).function, true /* prototype */); - (yyval.interm.intermNode) = 0; - // TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature - } -#line 4178 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 91: -#line 741 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - if ((yyvsp[-1].interm).intermNode && (yyvsp[-1].interm).intermNode->getAsAggregate()) - (yyvsp[-1].interm).intermNode->getAsAggregate()->setOperator(EOpSequence); - (yyval.interm.intermNode) = (yyvsp[-1].interm).intermNode; - } -#line 4188 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 92: -#line 746 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.profileRequires((yyvsp[-3].lex).loc, ENoProfile, 130, 0, "precision statement"); - - // lazy setting of the previous scope's defaults, has effect only the first time it is called in a particular scope - parseContext.symbolTable.setPreviousDefaultPrecisions(&parseContext.defaultPrecision[0]); - parseContext.setDefaultPrecision((yyvsp[-3].lex).loc, (yyvsp[-1].interm.type), (yyvsp[-2].interm.type).qualifier.precision); - (yyval.interm.intermNode) = 0; - } -#line 4201 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 93: -#line 754 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.declareBlock((yyvsp[-1].interm).loc, *(yyvsp[-1].interm).typeList); - (yyval.interm.intermNode) = 0; - } -#line 4210 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 94: -#line 758 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.declareBlock((yyvsp[-2].interm).loc, *(yyvsp[-2].interm).typeList, (yyvsp[-1].lex).string); - (yyval.interm.intermNode) = 0; - } -#line 4219 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 95: -#line 762 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.declareBlock((yyvsp[-3].interm).loc, *(yyvsp[-3].interm).typeList, (yyvsp[-2].lex).string, (yyvsp[-1].interm).arraySizes); - (yyval.interm.intermNode) = 0; - } -#line 4228 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 96: -#line 766 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.globalQualifierFixCheck((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier); - parseContext.updateStandaloneQualifierDefaults((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type)); - (yyval.interm.intermNode) = 0; - } -#line 4238 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 97: -#line 771 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.checkNoShaderLayouts((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).shaderQualifiers); - parseContext.addQualifierToExisting((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).qualifier, *(yyvsp[-1].lex).string); - (yyval.interm.intermNode) = 0; - } -#line 4248 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 98: -#line 776 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.checkNoShaderLayouts((yyvsp[-3].interm.type).loc, (yyvsp[-3].interm.type).shaderQualifiers); - (yyvsp[-1].interm.identifierList)->push_back((yyvsp[-2].lex).string); - parseContext.addQualifierToExisting((yyvsp[-3].interm.type).loc, (yyvsp[-3].interm.type).qualifier, *(yyvsp[-1].interm.identifierList)); - (yyval.interm.intermNode) = 0; - } -#line 4259 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 99: -#line 785 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { parseContext.nestedBlockCheck((yyvsp[-2].interm.type).loc); } -#line 4265 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 100: -#line 785 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - --parseContext.structNestingLevel; - parseContext.blockName = (yyvsp[-4].lex).string; - parseContext.globalQualifierFixCheck((yyvsp[-5].interm.type).loc, (yyvsp[-5].interm.type).qualifier); - parseContext.checkNoShaderLayouts((yyvsp[-5].interm.type).loc, (yyvsp[-5].interm.type).shaderQualifiers); - parseContext.currentBlockQualifier = (yyvsp[-5].interm.type).qualifier; - (yyval.interm).loc = (yyvsp[-5].interm.type).loc; - (yyval.interm).typeList = (yyvsp[-1].interm.typeList); - } -#line 4279 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 101: -#line 796 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.identifierList) = new TIdentifierList; - (yyval.interm.identifierList)->push_back((yyvsp[0].lex).string); - } -#line 4288 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 102: -#line 800 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.identifierList) = (yyvsp[-2].interm.identifierList); - (yyval.interm.identifierList)->push_back((yyvsp[0].lex).string); - } -#line 4297 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 103: -#line 807 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm).function = (yyvsp[-1].interm.function); - (yyval.interm).loc = (yyvsp[0].lex).loc; - } -#line 4306 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 104: -#line 814 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.function) = (yyvsp[0].interm.function); - } -#line 4314 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 105: -#line 817 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.function) = (yyvsp[0].interm.function); - } -#line 4322 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 106: -#line 824 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - // Add the parameter - (yyval.interm.function) = (yyvsp[-1].interm.function); - if ((yyvsp[0].interm).param.type->getBasicType() != EbtVoid) - (yyvsp[-1].interm.function)->addParameter((yyvsp[0].interm).param); - else - delete (yyvsp[0].interm).param.type; - } -#line 4335 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 107: -#line 832 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - // - // Only first parameter of one-parameter functions can be void - // The check for named parameters not being void is done in parameter_declarator - // - if ((yyvsp[0].interm).param.type->getBasicType() == EbtVoid) { - // - // This parameter > first is void - // - parseContext.error((yyvsp[-1].lex).loc, "cannot be an argument type except for '(void)'", "void", ""); - delete (yyvsp[0].interm).param.type; - } else { - // Add the parameter - (yyval.interm.function) = (yyvsp[-2].interm.function); - (yyvsp[-2].interm.function)->addParameter((yyvsp[0].interm).param); - } - } -#line 4357 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 108: -#line 852 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - if ((yyvsp[-2].interm.type).qualifier.storage != EvqGlobal && (yyvsp[-2].interm.type).qualifier.storage != EvqTemporary) { - parseContext.error((yyvsp[-1].lex).loc, "no qualifiers allowed for function return", - GetStorageQualifierString((yyvsp[-2].interm.type).qualifier.storage), ""); - } - if ((yyvsp[-2].interm.type).arraySizes) - parseContext.arraySizeRequiredCheck((yyvsp[-2].interm.type).loc, *(yyvsp[-2].interm.type).arraySizes); - - // Add the function as a prototype after parsing it (we do not support recursion) - TFunction *function; - TType type((yyvsp[-2].interm.type)); - - // Potentially rename shader entry point function. No-op most of the time. - parseContext.renameShaderFunction((yyvsp[-1].lex).string); - - // Make the function - function = new TFunction((yyvsp[-1].lex).string, type); - (yyval.interm.function) = function; - } -#line 4381 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 109: -#line 875 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - if ((yyvsp[-1].interm.type).arraySizes) { - parseContext.profileRequires((yyvsp[-1].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires((yyvsp[-1].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); - parseContext.arraySizeRequiredCheck((yyvsp[-1].interm.type).loc, *(yyvsp[-1].interm.type).arraySizes); - } - if ((yyvsp[-1].interm.type).basicType == EbtVoid) { - parseContext.error((yyvsp[0].lex).loc, "illegal use of type 'void'", (yyvsp[0].lex).string->c_str(), ""); - } - parseContext.reservedErrorCheck((yyvsp[0].lex).loc, *(yyvsp[0].lex).string); - - TParameter param = {(yyvsp[0].lex).string, new TType((yyvsp[-1].interm.type))}; - (yyval.interm).loc = (yyvsp[0].lex).loc; - (yyval.interm).param = param; - } -#line 4401 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 110: -#line 890 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - if ((yyvsp[-2].interm.type).arraySizes) { - parseContext.profileRequires((yyvsp[-2].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires((yyvsp[-2].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); - parseContext.arraySizeRequiredCheck((yyvsp[-2].interm.type).loc, *(yyvsp[-2].interm.type).arraySizes); - } - parseContext.arrayDimCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.type).arraySizes, (yyvsp[0].interm).arraySizes); - - parseContext.arraySizeRequiredCheck((yyvsp[0].interm).loc, *(yyvsp[0].interm).arraySizes); - parseContext.reservedErrorCheck((yyvsp[-1].lex).loc, *(yyvsp[-1].lex).string); - - (yyvsp[-2].interm.type).arraySizes = (yyvsp[0].interm).arraySizes; - - TParameter param = { (yyvsp[-1].lex).string, new TType((yyvsp[-2].interm.type))}; - (yyval.interm).loc = (yyvsp[-1].lex).loc; - (yyval.interm).param = param; - } -#line 4423 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 111: -#line 913 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm) = (yyvsp[0].interm); - if ((yyvsp[-1].interm.type).qualifier.precision != EpqNone) - (yyval.interm).param.type->getQualifier().precision = (yyvsp[-1].interm.type).qualifier.precision; - parseContext.precisionQualifierCheck((yyval.interm).loc, (yyval.interm).param.type->getBasicType(), (yyval.interm).param.type->getQualifier()); - - parseContext.checkNoShaderLayouts((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).shaderQualifiers); - parseContext.parameterTypeCheck((yyvsp[0].interm).loc, (yyvsp[-1].interm.type).qualifier.storage, *(yyval.interm).param.type); - parseContext.paramCheckFix((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier, *(yyval.interm).param.type); - - } -#line 4439 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 112: -#line 924 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm) = (yyvsp[0].interm); - - parseContext.parameterTypeCheck((yyvsp[0].interm).loc, EvqIn, *(yyvsp[0].interm).param.type); - parseContext.paramCheckFix((yyvsp[0].interm).loc, EvqTemporary, *(yyval.interm).param.type); - parseContext.precisionQualifierCheck((yyval.interm).loc, (yyval.interm).param.type->getBasicType(), (yyval.interm).param.type->getQualifier()); - } -#line 4451 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 113: -#line 934 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm) = (yyvsp[0].interm); - if ((yyvsp[-1].interm.type).qualifier.precision != EpqNone) - (yyval.interm).param.type->getQualifier().precision = (yyvsp[-1].interm.type).qualifier.precision; - parseContext.precisionQualifierCheck((yyvsp[-1].interm.type).loc, (yyval.interm).param.type->getBasicType(), (yyval.interm).param.type->getQualifier()); - - parseContext.checkNoShaderLayouts((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).shaderQualifiers); - parseContext.parameterTypeCheck((yyvsp[0].interm).loc, (yyvsp[-1].interm.type).qualifier.storage, *(yyval.interm).param.type); - parseContext.paramCheckFix((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier, *(yyval.interm).param.type); - } -#line 4466 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 114: -#line 944 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm) = (yyvsp[0].interm); - - parseContext.parameterTypeCheck((yyvsp[0].interm).loc, EvqIn, *(yyvsp[0].interm).param.type); - parseContext.paramCheckFix((yyvsp[0].interm).loc, EvqTemporary, *(yyval.interm).param.type); - parseContext.precisionQualifierCheck((yyval.interm).loc, (yyval.interm).param.type->getBasicType(), (yyval.interm).param.type->getQualifier()); - } -#line 4478 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 115: -#line 954 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - TParameter param = { 0, new TType((yyvsp[0].interm.type)) }; - (yyval.interm).param = param; - if ((yyvsp[0].interm.type).arraySizes) - parseContext.arraySizeRequiredCheck((yyvsp[0].interm.type).loc, *(yyvsp[0].interm.type).arraySizes); - } -#line 4489 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 116: -#line 963 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm) = (yyvsp[0].interm); - } -#line 4497 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 117: -#line 966 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm) = (yyvsp[-2].interm); - parseContext.declareVariable((yyvsp[0].lex).loc, *(yyvsp[0].lex).string, (yyvsp[-2].interm).type); - } -#line 4506 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 118: -#line 970 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm) = (yyvsp[-3].interm); - parseContext.declareVariable((yyvsp[-1].lex).loc, *(yyvsp[-1].lex).string, (yyvsp[-3].interm).type, (yyvsp[0].interm).arraySizes); - } -#line 4515 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 119: -#line 974 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm).type = (yyvsp[-5].interm).type; - TIntermNode* initNode = parseContext.declareVariable((yyvsp[-3].lex).loc, *(yyvsp[-3].lex).string, (yyvsp[-5].interm).type, (yyvsp[-2].interm).arraySizes, (yyvsp[0].interm.intermTypedNode)); - (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[-5].interm).intermNode, initNode, (yyvsp[-1].lex).loc); - } -#line 4525 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 120: -#line 979 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm).type = (yyvsp[-4].interm).type; - TIntermNode* initNode = parseContext.declareVariable((yyvsp[-2].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[-4].interm).type, 0, (yyvsp[0].interm.intermTypedNode)); - (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[-4].interm).intermNode, initNode, (yyvsp[-1].lex).loc); - } -#line 4535 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 121: -#line 987 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm).type = (yyvsp[0].interm.type); - (yyval.interm).intermNode = 0; - parseContext.declareTypeDefaults((yyval.interm).loc, (yyval.interm).type); - } -#line 4545 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 122: -#line 992 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm).type = (yyvsp[-1].interm.type); - (yyval.interm).intermNode = 0; - parseContext.declareVariable((yyvsp[0].lex).loc, *(yyvsp[0].lex).string, (yyvsp[-1].interm.type)); - } -#line 4555 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 123: -#line 997 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm).type = (yyvsp[-2].interm.type); - (yyval.interm).intermNode = 0; - parseContext.declareVariable((yyvsp[-1].lex).loc, *(yyvsp[-1].lex).string, (yyvsp[-2].interm.type), (yyvsp[0].interm).arraySizes); - } -#line 4565 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 124: -#line 1002 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm).type = (yyvsp[-4].interm.type); - TIntermNode* initNode = parseContext.declareVariable((yyvsp[-3].lex).loc, *(yyvsp[-3].lex).string, (yyvsp[-4].interm.type), (yyvsp[-2].interm).arraySizes, (yyvsp[0].interm.intermTypedNode)); - (yyval.interm).intermNode = parseContext.intermediate.growAggregate(0, initNode, (yyvsp[-1].lex).loc); - } -#line 4575 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 125: -#line 1007 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm).type = (yyvsp[-3].interm.type); - TIntermNode* initNode = parseContext.declareVariable((yyvsp[-2].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[-3].interm.type), 0, (yyvsp[0].interm.intermTypedNode)); - (yyval.interm).intermNode = parseContext.intermediate.growAggregate(0, initNode, (yyvsp[-1].lex).loc); - } -#line 4585 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 126: -#line 1016 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type) = (yyvsp[0].interm.type); - - parseContext.globalQualifierTypeCheck((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type).qualifier, (yyval.interm.type)); - if ((yyvsp[0].interm.type).arraySizes) { - parseContext.profileRequires((yyvsp[0].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires((yyvsp[0].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); - } - - parseContext.precisionQualifierCheck((yyval.interm.type).loc, (yyval.interm.type).basicType, (yyval.interm.type).qualifier); - } -#line 4601 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 127: -#line 1027 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.globalQualifierFixCheck((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier); - parseContext.globalQualifierTypeCheck((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier, (yyvsp[0].interm.type)); - - if ((yyvsp[0].interm.type).arraySizes) { - parseContext.profileRequires((yyvsp[0].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires((yyvsp[0].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); - } - - if ((yyvsp[0].interm.type).arraySizes && parseContext.arrayQualifierError((yyvsp[0].interm.type).loc, (yyvsp[-1].interm.type).qualifier)) - (yyvsp[0].interm.type).arraySizes = 0; - - parseContext.checkNoShaderLayouts((yyvsp[0].interm.type).loc, (yyvsp[-1].interm.type).shaderQualifiers); - (yyvsp[0].interm.type).shaderQualifiers.merge((yyvsp[-1].interm.type).shaderQualifiers); - parseContext.mergeQualifiers((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type).qualifier, (yyvsp[-1].interm.type).qualifier, true); - parseContext.precisionQualifierCheck((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type).basicType, (yyvsp[0].interm.type).qualifier); - - (yyval.interm.type) = (yyvsp[0].interm.type); - - if (! (yyval.interm.type).qualifier.isInterpolation() && - ((parseContext.language == EShLangVertex && (yyval.interm.type).qualifier.storage == EvqVaryingOut) || - (parseContext.language == EShLangFragment && (yyval.interm.type).qualifier.storage == EvqVaryingIn))) - (yyval.interm.type).qualifier.smooth = true; - } -#line 4630 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 128: -#line 1054 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.globalCheck((yyvsp[0].lex).loc, "invariant"); - parseContext.profileRequires((yyval.interm.type).loc, ENoProfile, 120, 0, "invariant"); - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.invariant = true; - } -#line 4641 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 129: -#line 1063 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.globalCheck((yyvsp[0].lex).loc, "smooth"); - parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "smooth"); - parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 300, 0, "smooth"); - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.smooth = true; - } -#line 4653 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 130: -#line 1070 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.globalCheck((yyvsp[0].lex).loc, "flat"); - parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "flat"); - parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 300, 0, "flat"); - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.flat = true; - } -#line 4665 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 131: -#line 1077 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.globalCheck((yyvsp[0].lex).loc, "noperspective"); - parseContext.requireProfile((yyvsp[0].lex).loc, ~EEsProfile, "noperspective"); - parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "noperspective"); - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.nopersp = true; - } -#line 4677 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 132: -#line 1084 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.globalCheck((yyvsp[0].lex).loc, "__explicitInterpAMD"); - parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation"); - parseContext.profileRequires((yyvsp[0].lex).loc, ECompatibilityProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation"); - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.explicitInterp = true; -#endif - } -#line 4691 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 133: -#line 1096 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type) = (yyvsp[-1].interm.type); - } -#line 4699 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 134: -#line 1102 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type) = (yyvsp[0].interm.type); - } -#line 4707 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 135: -#line 1105 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type) = (yyvsp[-2].interm.type); - (yyval.interm.type).shaderQualifiers.merge((yyvsp[0].interm.type).shaderQualifiers); - parseContext.mergeObjectLayoutQualifiers((yyval.interm.type).qualifier, (yyvsp[0].interm.type).qualifier, false); - } -#line 4717 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 136: -#line 1112 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc); - parseContext.setLayoutQualifier((yyvsp[0].lex).loc, (yyval.interm.type), *(yyvsp[0].lex).string); - } -#line 4726 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 137: -#line 1116 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[-2].lex).loc); - parseContext.setLayoutQualifier((yyvsp[-2].lex).loc, (yyval.interm.type), *(yyvsp[-2].lex).string, (yyvsp[0].interm.intermTypedNode)); - } -#line 4735 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 138: -#line 1120 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { // because "shared" is both an identifier and a keyword - (yyval.interm.type).init((yyvsp[0].lex).loc); - TString strShared("shared"); - parseContext.setLayoutQualifier((yyvsp[0].lex).loc, (yyval.interm.type), strShared); - } -#line 4745 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 139: -#line 1128 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.profileRequires((yyval.interm.type).loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader5, "precise"); - parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, "precise"); - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.noContraction = true; - } -#line 4756 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 140: -#line 1137 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type) = (yyvsp[0].interm.type); - } -#line 4764 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 141: -#line 1140 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type) = (yyvsp[-1].interm.type); - if ((yyval.interm.type).basicType == EbtVoid) - (yyval.interm.type).basicType = (yyvsp[0].interm.type).basicType; - - (yyval.interm.type).shaderQualifiers.merge((yyvsp[0].interm.type).shaderQualifiers); - parseContext.mergeQualifiers((yyval.interm.type).loc, (yyval.interm.type).qualifier, (yyvsp[0].interm.type).qualifier, false); - } -#line 4777 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 142: -#line 1151 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type) = (yyvsp[0].interm.type); - } -#line 4785 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 143: -#line 1154 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type) = (yyvsp[0].interm.type); - } -#line 4793 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 144: -#line 1157 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.checkPrecisionQualifier((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type).qualifier.precision); - (yyval.interm.type) = (yyvsp[0].interm.type); - } -#line 4802 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 145: -#line 1161 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - // allow inheritance of storage qualifier from block declaration - (yyval.interm.type) = (yyvsp[0].interm.type); - } -#line 4811 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 146: -#line 1165 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - // allow inheritance of storage qualifier from block declaration - (yyval.interm.type) = (yyvsp[0].interm.type); - } -#line 4820 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 147: -#line 1169 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - // allow inheritance of storage qualifier from block declaration - (yyval.interm.type) = (yyvsp[0].interm.type); - } -#line 4829 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 148: -#line 1176 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.storage = EvqConst; // will later turn into EvqConstReadOnly, if the initializer is not constant - } -#line 4838 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 149: -#line 1180 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.requireStage((yyvsp[0].lex).loc, EShLangVertex, "attribute"); - parseContext.checkDeprecated((yyvsp[0].lex).loc, ECoreProfile, 130, "attribute"); - parseContext.checkDeprecated((yyvsp[0].lex).loc, ENoProfile, 130, "attribute"); - parseContext.requireNotRemoved((yyvsp[0].lex).loc, ECoreProfile, 420, "attribute"); - parseContext.requireNotRemoved((yyvsp[0].lex).loc, EEsProfile, 300, "attribute"); - - parseContext.globalCheck((yyvsp[0].lex).loc, "attribute"); - - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.storage = EvqVaryingIn; - } -#line 4855 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 150: -#line 1192 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.checkDeprecated((yyvsp[0].lex).loc, ENoProfile, 130, "varying"); - parseContext.checkDeprecated((yyvsp[0].lex).loc, ECoreProfile, 130, "varying"); - parseContext.requireNotRemoved((yyvsp[0].lex).loc, ECoreProfile, 420, "varying"); - parseContext.requireNotRemoved((yyvsp[0].lex).loc, EEsProfile, 300, "varying"); - - parseContext.globalCheck((yyvsp[0].lex).loc, "varying"); - - (yyval.interm.type).init((yyvsp[0].lex).loc); - if (parseContext.language == EShLangVertex) - (yyval.interm.type).qualifier.storage = EvqVaryingOut; - else - (yyval.interm.type).qualifier.storage = EvqVaryingIn; - } -#line 4874 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 151: -#line 1206 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.globalCheck((yyvsp[0].lex).loc, "inout"); - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.storage = EvqInOut; - } -#line 4884 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 152: -#line 1211 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.globalCheck((yyvsp[0].lex).loc, "in"); - (yyval.interm.type).init((yyvsp[0].lex).loc); - // whether this is a parameter "in" or a pipeline "in" will get sorted out a bit later - (yyval.interm.type).qualifier.storage = EvqIn; - } -#line 4895 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 153: -#line 1217 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.globalCheck((yyvsp[0].lex).loc, "out"); - (yyval.interm.type).init((yyvsp[0].lex).loc); - // whether this is a parameter "out" or a pipeline "out" will get sorted out a bit later - (yyval.interm.type).qualifier.storage = EvqOut; - } -#line 4906 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 154: -#line 1223 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 120, 0, "centroid"); - parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 300, 0, "centroid"); - parseContext.globalCheck((yyvsp[0].lex).loc, "centroid"); - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.centroid = true; - } -#line 4918 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 155: -#line 1230 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.globalCheck((yyvsp[0].lex).loc, "patch"); - parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangTessControlMask | EShLangTessEvaluationMask), "patch"); - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.patch = true; - } -#line 4929 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 156: -#line 1236 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.globalCheck((yyvsp[0].lex).loc, "sample"); - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.sample = true; - } -#line 4939 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 157: -#line 1241 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.globalCheck((yyvsp[0].lex).loc, "uniform"); - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.storage = EvqUniform; - } -#line 4949 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 158: -#line 1246 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.globalCheck((yyvsp[0].lex).loc, "buffer"); - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.storage = EvqBuffer; - } -#line 4959 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 159: -#line 1251 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.globalCheck((yyvsp[0].lex).loc, "shared"); - parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared"); - parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 310, 0, "shared"); - parseContext.requireStage((yyvsp[0].lex).loc, EShLangCompute, "shared"); - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.storage = EvqShared; - } -#line 4972 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 160: -#line 1259 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.coherent = true; - } -#line 4981 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 161: -#line 1263 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.volatil = true; - } -#line 4990 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 162: -#line 1267 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.restrict = true; - } -#line 4999 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 163: -#line 1271 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.readonly = true; - } -#line 5008 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 164: -#line 1275 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.writeonly = true; - } -#line 5017 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 165: -#line 1279 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.spvRemoved((yyvsp[0].lex).loc, "subroutine"); - parseContext.globalCheck((yyvsp[0].lex).loc, "subroutine"); - parseContext.unimplemented((yyvsp[0].lex).loc, "subroutine"); - (yyval.interm.type).init((yyvsp[0].lex).loc); - } -#line 5028 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 166: -#line 1285 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.spvRemoved((yyvsp[-3].lex).loc, "subroutine"); - parseContext.globalCheck((yyvsp[-3].lex).loc, "subroutine"); - parseContext.unimplemented((yyvsp[-3].lex).loc, "subroutine"); - (yyval.interm.type).init((yyvsp[-3].lex).loc); - } -#line 5039 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 167: -#line 1294 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - // TODO - } -#line 5047 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 168: -#line 1297 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - // TODO: 4.0 semantics: subroutines - // 1) make sure each identifier is a type declared earlier with SUBROUTINE - // 2) save all of the identifiers for future comparison with the declared function - } -#line 5057 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 169: -#line 1305 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type) = (yyvsp[0].interm.type); - (yyval.interm.type).qualifier.precision = parseContext.getDefaultPrecision((yyval.interm.type)); - } -#line 5066 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 170: -#line 1309 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.arrayDimCheck((yyvsp[0].interm).loc, (yyvsp[0].interm).arraySizes, 0); - (yyval.interm.type) = (yyvsp[-1].interm.type); - (yyval.interm.type).qualifier.precision = parseContext.getDefaultPrecision((yyval.interm.type)); - (yyval.interm.type).arraySizes = (yyvsp[0].interm).arraySizes; - } -#line 5077 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 171: -#line 1318 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm).loc = (yyvsp[-1].lex).loc; - (yyval.interm).arraySizes = new TArraySizes; - (yyval.interm).arraySizes->addInnerSize(); - } -#line 5087 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 172: -#line 1323 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm).loc = (yyvsp[-2].lex).loc; - (yyval.interm).arraySizes = new TArraySizes; - - TArraySize size; - parseContext.arraySizeCheck((yyvsp[-1].interm.intermTypedNode)->getLoc(), (yyvsp[-1].interm.intermTypedNode), size); - (yyval.interm).arraySizes->addInnerSize(size); - } -#line 5100 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 173: -#line 1331 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm) = (yyvsp[-2].interm); - (yyval.interm).arraySizes->addInnerSize(); - } -#line 5109 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 174: -#line 1335 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm) = (yyvsp[-3].interm); - - TArraySize size; - parseContext.arraySizeCheck((yyvsp[-1].interm.intermTypedNode)->getLoc(), (yyvsp[-1].interm.intermTypedNode), size); - (yyval.interm).arraySizes->addInnerSize(size); - } -#line 5121 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 175: -#line 1345 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtVoid; - } -#line 5130 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 176: -#line 1349 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - } -#line 5139 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 177: -#line 1353 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - } -#line 5149 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 178: -#line 1358 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.float16Check((yyvsp[0].lex).loc, "half float", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; -#endif - } -#line 5161 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 179: -#line 1365 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt; - } -#line 5170 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 180: -#line 1369 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint; - } -#line 5180 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 181: -#line 1374 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt64; - } -#line 5190 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 182: -#line 1379 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint64; - } -#line 5200 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 183: -#line 1384 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.int16Check((yyvsp[0].lex).loc, "16-bit integer", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt16; -#endif - } -#line 5212 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 184: -#line 1391 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.int16Check((yyvsp[0].lex).loc, "16-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint16; -#endif - } -#line 5224 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 185: -#line 1398 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtBool; - } -#line 5233 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 186: -#line 1402 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setVector(2); - } -#line 5243 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 187: -#line 1407 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setVector(3); - } -#line 5253 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 188: -#line 1412 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setVector(4); - } -#line 5263 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 189: -#line 1417 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double vector"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setVector(2); - } -#line 5274 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 190: -#line 1423 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double vector"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setVector(3); - } -#line 5285 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 191: -#line 1429 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double vector"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setVector(4); - } -#line 5296 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 192: -#line 1435 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.float16Check((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setVector(2); -#endif - } -#line 5309 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 193: -#line 1443 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.float16Check((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setVector(3); -#endif - } -#line 5322 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 194: -#line 1451 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.float16Check((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setVector(4); -#endif - } -#line 5335 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 195: -#line 1459 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtBool; - (yyval.interm.type).setVector(2); - } -#line 5345 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 196: -#line 1464 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtBool; - (yyval.interm.type).setVector(3); - } -#line 5355 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 197: -#line 1469 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtBool; - (yyval.interm.type).setVector(4); - } -#line 5365 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 198: -#line 1474 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt; - (yyval.interm.type).setVector(2); - } -#line 5375 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 199: -#line 1479 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt; - (yyval.interm.type).setVector(3); - } -#line 5385 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 200: -#line 1484 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt; - (yyval.interm.type).setVector(4); - } -#line 5395 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 201: -#line 1489 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt64; - (yyval.interm.type).setVector(2); - } -#line 5406 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 202: -#line 1495 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt64; - (yyval.interm.type).setVector(3); - } -#line 5417 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 203: -#line 1501 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt64; - (yyval.interm.type).setVector(4); - } -#line 5428 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 204: -#line 1507 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.int16Check((yyvsp[0].lex).loc, "16-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt16; - (yyval.interm.type).setVector(2); -#endif - } -#line 5441 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 205: -#line 1515 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.int16Check((yyvsp[0].lex).loc, "16-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt16; - (yyval.interm.type).setVector(3); -#endif - } -#line 5454 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 206: -#line 1523 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.int16Check((yyvsp[0].lex).loc, "16-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt16; - (yyval.interm.type).setVector(4); -#endif - } -#line 5467 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 207: -#line 1531 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer vector"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint; - (yyval.interm.type).setVector(2); - } -#line 5478 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 208: -#line 1537 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer vector"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint; - (yyval.interm.type).setVector(3); - } -#line 5489 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 209: -#line 1543 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer vector"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint; - (yyval.interm.type).setVector(4); - } -#line 5500 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 210: -#line 1549 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint64; - (yyval.interm.type).setVector(2); - } -#line 5511 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 211: -#line 1555 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint64; - (yyval.interm.type).setVector(3); - } -#line 5522 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 212: -#line 1561 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint64; - (yyval.interm.type).setVector(4); - } -#line 5533 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 213: -#line 1567 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.int16Check((yyvsp[0].lex).loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint16; - (yyval.interm.type).setVector(2); -#endif - } -#line 5546 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 214: -#line 1575 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.int16Check((yyvsp[0].lex).loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint16; - (yyval.interm.type).setVector(3); -#endif - } -#line 5559 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 215: -#line 1583 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.int16Check((yyvsp[0].lex).loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint16; - (yyval.interm.type).setVector(4); -#endif - } -#line 5572 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 216: -#line 1591 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(2, 2); - } -#line 5582 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 217: -#line 1596 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(3, 3); - } -#line 5592 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 218: -#line 1601 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(4, 4); - } -#line 5602 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 219: -#line 1606 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(2, 2); - } -#line 5612 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 220: -#line 1611 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(2, 3); - } -#line 5622 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 221: -#line 1616 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(2, 4); - } -#line 5632 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 222: -#line 1621 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(3, 2); - } -#line 5642 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 223: -#line 1626 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(3, 3); - } -#line 5652 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 224: -#line 1631 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(3, 4); - } -#line 5662 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 225: -#line 1636 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(4, 2); - } -#line 5672 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 226: -#line 1641 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(4, 3); - } -#line 5682 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 227: -#line 1646 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(4, 4); - } -#line 5692 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 228: -#line 1651 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setMatrix(2, 2); - } -#line 5703 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 229: -#line 1657 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setMatrix(3, 3); - } -#line 5714 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 230: -#line 1663 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setMatrix(4, 4); - } -#line 5725 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 231: -#line 1669 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setMatrix(2, 2); - } -#line 5736 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 232: -#line 1675 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setMatrix(2, 3); - } -#line 5747 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 233: -#line 1681 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setMatrix(2, 4); - } -#line 5758 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 234: -#line 1687 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setMatrix(3, 2); - } -#line 5769 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 235: -#line 1693 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setMatrix(3, 3); - } -#line 5780 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 236: -#line 1699 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setMatrix(3, 4); - } -#line 5791 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 237: -#line 1705 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setMatrix(4, 2); - } -#line 5802 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 238: -#line 1711 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setMatrix(4, 3); - } -#line 5813 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 239: -#line 1717 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setMatrix(4, 4); - } -#line 5824 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 240: -#line 1723 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setMatrix(2, 2); -#endif - } -#line 5837 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 241: -#line 1731 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setMatrix(3, 3); -#endif - } -#line 5850 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 242: -#line 1739 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setMatrix(4, 4); -#endif - } -#line 5863 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 243: -#line 1747 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setMatrix(2, 2); -#endif - } -#line 5876 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 244: -#line 1755 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setMatrix(2, 3); -#endif - } -#line 5889 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 245: -#line 1763 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setMatrix(2, 4); -#endif - } -#line 5902 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 246: -#line 1771 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setMatrix(3, 2); -#endif - } -#line 5915 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 247: -#line 1779 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setMatrix(3, 3); -#endif - } -#line 5928 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 248: -#line 1787 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setMatrix(3, 4); -#endif - } -#line 5941 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 249: -#line 1795 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setMatrix(4, 2); -#endif - } -#line 5954 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 250: -#line 1803 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setMatrix(4, 3); -#endif - } -#line 5967 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 251: -#line 1811 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setMatrix(4, 4); -#endif - } -#line 5980 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 252: -#line 1819 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.vulkanRemoved((yyvsp[0].lex).loc, "atomic counter types"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtAtomicUint; - } -#line 5990 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 253: -#line 1824 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, Esd1D); - } -#line 6000 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 254: -#line 1829 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, Esd2D); - } -#line 6010 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 255: -#line 1834 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, Esd3D); - } -#line 6020 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 256: -#line 1839 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, EsdCube); - } -#line 6030 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 257: -#line 1844 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, Esd1D, false, true); - } -#line 6040 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 258: -#line 1849 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, Esd2D, false, true); - } -#line 6050 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 259: -#line 1854 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, EsdCube, false, true); - } -#line 6060 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 260: -#line 1859 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, Esd1D, true); - } -#line 6070 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 261: -#line 1864 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, Esd2D, true); - } -#line 6080 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 262: -#line 1869 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, Esd1D, true, true); - } -#line 6090 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 263: -#line 1874 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, Esd2D, true, true); - } -#line 6100 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 264: -#line 1879 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, EsdCube, true); - } -#line 6110 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 265: -#line 1884 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, EsdCube, true, true); - } -#line 6120 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 266: -#line 1889 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtInt, Esd1D); - } -#line 6130 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 267: -#line 1894 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtInt, Esd2D); - } -#line 6140 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 268: -#line 1899 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtInt, Esd3D); - } -#line 6150 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 269: -#line 1904 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtInt, EsdCube); - } -#line 6160 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 270: -#line 1909 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtInt, Esd1D, true); - } -#line 6170 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 271: -#line 1914 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtInt, Esd2D, true); - } -#line 6180 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 272: -#line 1919 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtInt, EsdCube, true); - } -#line 6190 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 273: -#line 1924 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtUint, Esd1D); - } -#line 6200 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 274: -#line 1929 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtUint, Esd2D); - } -#line 6210 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 275: -#line 1934 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtUint, Esd3D); - } -#line 6220 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 276: -#line 1939 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtUint, EsdCube); - } -#line 6230 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 277: -#line 1944 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtUint, Esd1D, true); - } -#line 6240 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 278: -#line 1949 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtUint, Esd2D, true); - } -#line 6250 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 279: -#line 1954 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtUint, EsdCube, true); - } -#line 6260 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 280: -#line 1959 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, EsdRect); - } -#line 6270 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 281: -#line 1964 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, EsdRect, false, true); - } -#line 6280 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 282: -#line 1969 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtInt, EsdRect); - } -#line 6290 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 283: -#line 1974 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtUint, EsdRect); - } -#line 6300 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 284: -#line 1979 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, EsdBuffer); - } -#line 6310 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 285: -#line 1984 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtInt, EsdBuffer); - } -#line 6320 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 286: -#line 1989 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtUint, EsdBuffer); - } -#line 6330 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 287: -#line 1994 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, Esd2D, false, false, true); - } -#line 6340 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 288: -#line 1999 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtInt, Esd2D, false, false, true); - } -#line 6350 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 289: -#line 2004 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtUint, Esd2D, false, false, true); - } -#line 6360 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 290: -#line 2009 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, Esd2D, true, false, true); - } -#line 6370 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 291: -#line 2014 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtInt, Esd2D, true, false, true); - } -#line 6380 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 292: -#line 2019 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtUint, Esd2D, true, false, true); - } -#line 6390 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 293: -#line 2024 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setPureSampler(false); - } -#line 6400 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 294: -#line 2029 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setPureSampler(true); - } -#line 6410 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 295: -#line 2034 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat, Esd1D); - } -#line 6420 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 296: -#line 2039 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat, Esd2D); - } -#line 6430 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 297: -#line 2044 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat, Esd3D); - } -#line 6440 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 298: -#line 2049 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat, EsdCube); - } -#line 6450 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 299: -#line 2054 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat, Esd1D, true); - } -#line 6460 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 300: -#line 2059 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat, Esd2D, true); - } -#line 6470 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 301: -#line 2064 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat, EsdCube, true); - } -#line 6480 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 302: -#line 2069 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtInt, Esd1D); - } -#line 6490 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 303: -#line 2074 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtInt, Esd2D); - } -#line 6500 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 304: -#line 2079 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtInt, Esd3D); - } -#line 6510 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 305: -#line 2084 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtInt, EsdCube); - } -#line 6520 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 306: -#line 2089 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtInt, Esd1D, true); - } -#line 6530 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 307: -#line 2094 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtInt, Esd2D, true); - } -#line 6540 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 308: -#line 2099 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtInt, EsdCube, true); - } -#line 6550 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 309: -#line 2104 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtUint, Esd1D); - } -#line 6560 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 310: -#line 2109 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtUint, Esd2D); - } -#line 6570 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 311: -#line 2114 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtUint, Esd3D); - } -#line 6580 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 312: -#line 2119 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtUint, EsdCube); - } -#line 6590 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 313: -#line 2124 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtUint, Esd1D, true); - } -#line 6600 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 314: -#line 2129 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtUint, Esd2D, true); - } -#line 6610 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 315: -#line 2134 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtUint, EsdCube, true); - } -#line 6620 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 316: -#line 2139 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat, EsdRect); - } -#line 6630 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 317: -#line 2144 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtInt, EsdRect); - } -#line 6640 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 318: -#line 2149 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtUint, EsdRect); - } -#line 6650 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 319: -#line 2154 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat, EsdBuffer); - } -#line 6660 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 320: -#line 2159 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtInt, EsdBuffer); - } -#line 6670 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 321: -#line 2164 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtUint, EsdBuffer); - } -#line 6680 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 322: -#line 2169 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat, Esd2D, false, false, true); - } -#line 6690 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 323: -#line 2174 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtInt, Esd2D, false, false, true); - } -#line 6700 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 324: -#line 2179 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtUint, Esd2D, false, false, true); - } -#line 6710 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 325: -#line 2184 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat, Esd2D, true, false, true); - } -#line 6720 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 326: -#line 2189 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtInt, Esd2D, true, false, true); - } -#line 6730 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 327: -#line 2194 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtUint, Esd2D, true, false, true); - } -#line 6740 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 328: -#line 2199 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtFloat, Esd1D); - } -#line 6750 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 329: -#line 2204 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtInt, Esd1D); - } -#line 6760 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 330: -#line 2209 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtUint, Esd1D); - } -#line 6770 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 331: -#line 2214 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtFloat, Esd2D); - } -#line 6780 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 332: -#line 2219 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtInt, Esd2D); - } -#line 6790 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 333: -#line 2224 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtUint, Esd2D); - } -#line 6800 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 334: -#line 2229 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtFloat, Esd3D); - } -#line 6810 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 335: -#line 2234 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtInt, Esd3D); - } -#line 6820 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 336: -#line 2239 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtUint, Esd3D); - } -#line 6830 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 337: -#line 2244 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtFloat, EsdRect); - } -#line 6840 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 338: -#line 2249 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtInt, EsdRect); - } -#line 6850 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 339: -#line 2254 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtUint, EsdRect); - } -#line 6860 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 340: -#line 2259 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtFloat, EsdCube); - } -#line 6870 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 341: -#line 2264 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtInt, EsdCube); - } -#line 6880 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 342: -#line 2269 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtUint, EsdCube); - } -#line 6890 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 343: -#line 2274 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtFloat, EsdBuffer); - } -#line 6900 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 344: -#line 2279 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtInt, EsdBuffer); - } -#line 6910 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 345: -#line 2284 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtUint, EsdBuffer); - } -#line 6920 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 346: -#line 2289 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtFloat, Esd1D, true); - } -#line 6930 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 347: -#line 2294 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtInt, Esd1D, true); - } -#line 6940 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 348: -#line 2299 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtUint, Esd1D, true); - } -#line 6950 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 349: -#line 2304 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtFloat, Esd2D, true); - } -#line 6960 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 350: -#line 2309 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtInt, Esd2D, true); - } -#line 6970 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 351: -#line 2314 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtUint, Esd2D, true); - } -#line 6980 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 352: -#line 2319 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtFloat, EsdCube, true); - } -#line 6990 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 353: -#line 2324 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtInt, EsdCube, true); - } -#line 7000 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 354: -#line 2329 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtUint, EsdCube, true); - } -#line 7010 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 355: -#line 2334 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtFloat, Esd2D, false, false, true); - } -#line 7020 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 356: -#line 2339 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtInt, Esd2D, false, false, true); - } -#line 7030 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 357: -#line 2344 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtUint, Esd2D, false, false, true); - } -#line 7040 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 358: -#line 2349 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtFloat, Esd2D, true, false, true); - } -#line 7050 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 359: -#line 2354 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtInt, Esd2D, true, false, true); - } -#line 7060 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 360: -#line 2359 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setImage(EbtUint, Esd2D, true, false, true); - } -#line 7070 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 361: -#line 2364 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { // GL_OES_EGL_image_external - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, Esd2D); - (yyval.interm.type).sampler.external = true; - } -#line 7081 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 362: -#line 2370 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setSubpass(EbtFloat); - } -#line 7092 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 363: -#line 2376 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setSubpass(EbtFloat, true); - } -#line 7103 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 364: -#line 2382 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setSubpass(EbtInt); - } -#line 7114 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 365: -#line 2388 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setSubpass(EbtInt, true); - } -#line 7125 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 366: -#line 2394 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setSubpass(EbtUint); - } -#line 7136 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 367: -#line 2400 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setSubpass(EbtUint, true); - } -#line 7147 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 368: -#line 2406 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type) = (yyvsp[0].interm.type); - (yyval.interm.type).qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; - parseContext.structTypeCheck((yyval.interm.type).loc, (yyval.interm.type)); - } -#line 7157 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 369: -#line 2411 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - // - // This is for user defined type names. The lexical phase looked up the - // type. - // - if (const TVariable* variable = ((yyvsp[0].lex).symbol)->getAsVariable()) { - const TType& structure = variable->getType(); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtStruct; - (yyval.interm.type).userDef = &structure; - } else - parseContext.error((yyvsp[0].lex).loc, "expected type name", (yyvsp[0].lex).string->c_str(), ""); - } -#line 7175 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 370: -#line 2427 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "highp precision qualifier"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - parseContext.handlePrecisionQualifier((yyvsp[0].lex).loc, (yyval.interm.type).qualifier, EpqHigh); - } -#line 7185 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 371: -#line 2432 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "mediump precision qualifier"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - parseContext.handlePrecisionQualifier((yyvsp[0].lex).loc, (yyval.interm.type).qualifier, EpqMedium); - } -#line 7195 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 372: -#line 2437 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "lowp precision qualifier"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - parseContext.handlePrecisionQualifier((yyvsp[0].lex).loc, (yyval.interm.type).qualifier, EpqLow); - } -#line 7205 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 373: -#line 2445 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { parseContext.nestedStructCheck((yyvsp[-2].lex).loc); } -#line 7211 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 374: -#line 2445 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - TType* structure = new TType((yyvsp[-1].interm.typeList), *(yyvsp[-4].lex).string); - parseContext.structArrayCheck((yyvsp[-4].lex).loc, *structure); - TVariable* userTypeDef = new TVariable((yyvsp[-4].lex).string, *structure, true); - if (! parseContext.symbolTable.insert(*userTypeDef)) - parseContext.error((yyvsp[-4].lex).loc, "redefinition", (yyvsp[-4].lex).string->c_str(), "struct"); - (yyval.interm.type).init((yyvsp[-5].lex).loc); - (yyval.interm.type).basicType = EbtStruct; - (yyval.interm.type).userDef = structure; - --parseContext.structNestingLevel; - } -#line 7227 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 375: -#line 2456 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { parseContext.nestedStructCheck((yyvsp[-1].lex).loc); } -#line 7233 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 376: -#line 2456 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - TType* structure = new TType((yyvsp[-1].interm.typeList), TString("")); - (yyval.interm.type).init((yyvsp[-4].lex).loc); - (yyval.interm.type).basicType = EbtStruct; - (yyval.interm.type).userDef = structure; - --parseContext.structNestingLevel; - } -#line 7245 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 377: -#line 2466 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.typeList) = (yyvsp[0].interm.typeList); - } -#line 7253 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 378: -#line 2469 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.typeList) = (yyvsp[-1].interm.typeList); - for (unsigned int i = 0; i < (yyvsp[0].interm.typeList)->size(); ++i) { - for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) { - if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[0].interm.typeList))[i].type->getFieldName()) - parseContext.error((*(yyvsp[0].interm.typeList))[i].loc, "duplicate member name:", "", (*(yyvsp[0].interm.typeList))[i].type->getFieldName().c_str()); - } - (yyval.interm.typeList)->push_back((*(yyvsp[0].interm.typeList))[i]); - } - } -#line 7268 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 379: -#line 2482 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - if ((yyvsp[-2].interm.type).arraySizes) { - parseContext.profileRequires((yyvsp[-2].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires((yyvsp[-2].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); - if (parseContext.profile == EEsProfile) - parseContext.arraySizeRequiredCheck((yyvsp[-2].interm.type).loc, *(yyvsp[-2].interm.type).arraySizes); - } - - (yyval.interm.typeList) = (yyvsp[-1].interm.typeList); - - parseContext.voidErrorCheck((yyvsp[-2].interm.type).loc, (*(yyvsp[-1].interm.typeList))[0].type->getFieldName(), (yyvsp[-2].interm.type).basicType); - parseContext.precisionQualifierCheck((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).basicType, (yyvsp[-2].interm.type).qualifier); - - for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) { - parseContext.arrayDimCheck((yyvsp[-2].interm.type).loc, (*(yyval.interm.typeList))[i].type, (yyvsp[-2].interm.type).arraySizes); - (*(yyval.interm.typeList))[i].type->mergeType((yyvsp[-2].interm.type)); - } - } -#line 7291 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 380: -#line 2500 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.globalQualifierFixCheck((yyvsp[-3].interm.type).loc, (yyvsp[-3].interm.type).qualifier); - if ((yyvsp[-2].interm.type).arraySizes) { - parseContext.profileRequires((yyvsp[-2].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires((yyvsp[-2].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); - if (parseContext.profile == EEsProfile) - parseContext.arraySizeRequiredCheck((yyvsp[-2].interm.type).loc, *(yyvsp[-2].interm.type).arraySizes); - } - - (yyval.interm.typeList) = (yyvsp[-1].interm.typeList); - - parseContext.checkNoShaderLayouts((yyvsp[-3].interm.type).loc, (yyvsp[-3].interm.type).shaderQualifiers); - parseContext.voidErrorCheck((yyvsp[-2].interm.type).loc, (*(yyvsp[-1].interm.typeList))[0].type->getFieldName(), (yyvsp[-2].interm.type).basicType); - parseContext.mergeQualifiers((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).qualifier, (yyvsp[-3].interm.type).qualifier, true); - parseContext.precisionQualifierCheck((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).basicType, (yyvsp[-2].interm.type).qualifier); - - for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) { - parseContext.arrayDimCheck((yyvsp[-3].interm.type).loc, (*(yyval.interm.typeList))[i].type, (yyvsp[-2].interm.type).arraySizes); - (*(yyval.interm.typeList))[i].type->mergeType((yyvsp[-2].interm.type)); - } - } -#line 7317 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 381: -#line 2524 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.typeList) = new TTypeList; - (yyval.interm.typeList)->push_back((yyvsp[0].interm.typeLine)); - } -#line 7326 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 382: -#line 2528 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.typeList)->push_back((yyvsp[0].interm.typeLine)); - } -#line 7334 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 383: -#line 2534 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.typeLine).type = new TType(EbtVoid); - (yyval.interm.typeLine).loc = (yyvsp[0].lex).loc; - (yyval.interm.typeLine).type->setFieldName(*(yyvsp[0].lex).string); - } -#line 7344 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 384: -#line 2539 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.arrayDimCheck((yyvsp[-1].lex).loc, (yyvsp[0].interm).arraySizes, 0); - - (yyval.interm.typeLine).type = new TType(EbtVoid); - (yyval.interm.typeLine).loc = (yyvsp[-1].lex).loc; - (yyval.interm.typeLine).type->setFieldName(*(yyvsp[-1].lex).string); - (yyval.interm.typeLine).type->newArraySizes(*(yyvsp[0].interm).arraySizes); - } -#line 7357 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 385: -#line 2550 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); - } -#line 7365 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 386: -#line 2553 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - const char* initFeature = "{ } style initializers"; - parseContext.requireProfile((yyvsp[-2].lex).loc, ~EEsProfile, initFeature); - parseContext.profileRequires((yyvsp[-2].lex).loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature); - (yyval.interm.intermTypedNode) = (yyvsp[-1].interm.intermTypedNode); - } -#line 7376 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 387: -#line 2559 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - const char* initFeature = "{ } style initializers"; - parseContext.requireProfile((yyvsp[-3].lex).loc, ~EEsProfile, initFeature); - parseContext.profileRequires((yyvsp[-3].lex).loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature); - (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); - } -#line 7387 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 388: -#line 2568 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate(0, (yyvsp[0].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)->getLoc()); - } -#line 7395 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 389: -#line 2571 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - } -#line 7403 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 390: -#line 2577 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7409 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 391: -#line 2581 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7415 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 392: -#line 2582 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7421 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 393: -#line 2588 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7427 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 394: -#line 2589 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7433 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 395: -#line 2590 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7439 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 396: -#line 2591 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7445 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 397: -#line 2592 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7451 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 398: -#line 2593 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7457 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 399: -#line 2594 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7463 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 400: -#line 2598 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermNode) = 0; } -#line 7469 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 401: -#line 2599 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.symbolTable.push(); - ++parseContext.statementNestingLevel; - } -#line 7478 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 402: -#line 2603 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); - --parseContext.statementNestingLevel; - } -#line 7487 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 403: -#line 2607 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - if ((yyvsp[-2].interm.intermNode) && (yyvsp[-2].interm.intermNode)->getAsAggregate()) - (yyvsp[-2].interm.intermNode)->getAsAggregate()->setOperator(EOpSequence); - (yyval.interm.intermNode) = (yyvsp[-2].interm.intermNode); - } -#line 7497 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 404: -#line 2615 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7503 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 405: -#line 2616 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7509 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 406: -#line 2620 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - ++parseContext.controlFlowNestingLevel; - } -#line 7517 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 407: -#line 2623 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - --parseContext.controlFlowNestingLevel; - (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); - } -#line 7526 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 408: -#line 2627 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.symbolTable.push(); - ++parseContext.statementNestingLevel; - ++parseContext.controlFlowNestingLevel; - } -#line 7536 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 409: -#line 2632 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); - --parseContext.statementNestingLevel; - --parseContext.controlFlowNestingLevel; - (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); - } -#line 7547 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 410: -#line 2641 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermNode) = 0; - } -#line 7555 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 411: -#line 2644 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - if ((yyvsp[-1].interm.intermNode) && (yyvsp[-1].interm.intermNode)->getAsAggregate()) - (yyvsp[-1].interm.intermNode)->getAsAggregate()->setOperator(EOpSequence); - (yyval.interm.intermNode) = (yyvsp[-1].interm.intermNode); - } -#line 7565 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 412: -#line 2652 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[0].interm.intermNode)); - if ((yyvsp[0].interm.intermNode) && (yyvsp[0].interm.intermNode)->getAsBranchNode() && ((yyvsp[0].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpCase || - (yyvsp[0].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpDefault)) { - parseContext.wrapupSwitchSubsequence(0, (yyvsp[0].interm.intermNode)); - (yyval.interm.intermNode) = 0; // start a fresh subsequence for what's after this case - } - } -#line 7578 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 413: -#line 2660 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - if ((yyvsp[0].interm.intermNode) && (yyvsp[0].interm.intermNode)->getAsBranchNode() && ((yyvsp[0].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpCase || - (yyvsp[0].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpDefault)) { - parseContext.wrapupSwitchSubsequence((yyvsp[-1].interm.intermNode) ? (yyvsp[-1].interm.intermNode)->getAsAggregate() : 0, (yyvsp[0].interm.intermNode)); - (yyval.interm.intermNode) = 0; // start a fresh subsequence for what's after this case - } else - (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-1].interm.intermNode), (yyvsp[0].interm.intermNode)); - } -#line 7591 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 414: -#line 2671 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermNode) = 0; } -#line 7597 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 415: -#line 2672 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermNode) = static_cast((yyvsp[-1].interm.intermTypedNode)); } -#line 7603 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 416: -#line 2676 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.boolCheck((yyvsp[-4].lex).loc, (yyvsp[-2].interm.intermTypedNode)); - (yyval.interm.intermNode) = parseContext.intermediate.addSelection((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.nodePair), (yyvsp[-4].lex).loc); - } -#line 7612 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 417: -#line 2683 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermNode); - (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermNode); - } -#line 7621 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 418: -#line 2687 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.nodePair).node1 = (yyvsp[0].interm.intermNode); - (yyval.interm.nodePair).node2 = 0; - } -#line 7630 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 419: -#line 2695 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); - parseContext.boolCheck((yyvsp[0].interm.intermTypedNode)->getLoc(), (yyvsp[0].interm.intermTypedNode)); - } -#line 7639 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 420: -#line 2699 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.boolCheck((yyvsp[-2].lex).loc, (yyvsp[-3].interm.type)); - - TType type((yyvsp[-3].interm.type)); - TIntermNode* initNode = parseContext.declareVariable((yyvsp[-2].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[-3].interm.type), 0, (yyvsp[0].interm.intermTypedNode)); - if (initNode) - (yyval.interm.intermTypedNode) = initNode->getAsTyped(); - else - (yyval.interm.intermTypedNode) = 0; - } -#line 7654 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 421: -#line 2712 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - // start new switch sequence on the switch stack - ++parseContext.controlFlowNestingLevel; - ++parseContext.statementNestingLevel; - parseContext.switchSequenceStack.push_back(new TIntermSequence); - parseContext.switchLevel.push_back(parseContext.statementNestingLevel); - parseContext.symbolTable.push(); - } -#line 7667 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 422: -#line 2720 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermNode) = parseContext.addSwitch((yyvsp[-7].lex).loc, (yyvsp[-5].interm.intermTypedNode), (yyvsp[-1].interm.intermNode) ? (yyvsp[-1].interm.intermNode)->getAsAggregate() : 0); - delete parseContext.switchSequenceStack.back(); - parseContext.switchSequenceStack.pop_back(); - parseContext.switchLevel.pop_back(); - parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); - --parseContext.statementNestingLevel; - --parseContext.controlFlowNestingLevel; - } -#line 7681 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 423: -#line 2732 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermNode) = 0; - } -#line 7689 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 424: -#line 2735 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); - } -#line 7697 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 425: -#line 2741 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermNode) = 0; - if (parseContext.switchLevel.size() == 0) - parseContext.error((yyvsp[-2].lex).loc, "cannot appear outside switch statement", "case", ""); - else if (parseContext.switchLevel.back() != parseContext.statementNestingLevel) - parseContext.error((yyvsp[-2].lex).loc, "cannot be nested inside control flow", "case", ""); - else { - parseContext.constantValueCheck((yyvsp[-1].interm.intermTypedNode), "case"); - parseContext.integerCheck((yyvsp[-1].interm.intermTypedNode), "case"); - (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpCase, (yyvsp[-1].interm.intermTypedNode), (yyvsp[-2].lex).loc); - } - } -#line 7714 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 426: -#line 2753 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermNode) = 0; - if (parseContext.switchLevel.size() == 0) - parseContext.error((yyvsp[-1].lex).loc, "cannot appear outside switch statement", "default", ""); - else if (parseContext.switchLevel.back() != parseContext.statementNestingLevel) - parseContext.error((yyvsp[-1].lex).loc, "cannot be nested inside control flow", "default", ""); - else - (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpDefault, (yyvsp[-1].lex).loc); - } -#line 7728 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 427: -#line 2765 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - if (! parseContext.limits.whileLoops) - parseContext.error((yyvsp[-1].lex).loc, "while loops not available", "limitation", ""); - parseContext.symbolTable.push(); - ++parseContext.loopNestingLevel; - ++parseContext.statementNestingLevel; - ++parseContext.controlFlowNestingLevel; - } -#line 7741 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 428: -#line 2773 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); - (yyval.interm.intermNode) = parseContext.intermediate.addLoop((yyvsp[0].interm.intermNode), (yyvsp[-2].interm.intermTypedNode), 0, true, (yyvsp[-5].lex).loc); - --parseContext.loopNestingLevel; - --parseContext.statementNestingLevel; - --parseContext.controlFlowNestingLevel; - } -#line 7753 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 429: -#line 2780 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - ++parseContext.loopNestingLevel; - ++parseContext.statementNestingLevel; - ++parseContext.controlFlowNestingLevel; - } -#line 7763 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 430: -#line 2785 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - if (! parseContext.limits.whileLoops) - parseContext.error((yyvsp[-7].lex).loc, "do-while loops not available", "limitation", ""); - - parseContext.boolCheck((yyvsp[0].lex).loc, (yyvsp[-2].interm.intermTypedNode)); - - (yyval.interm.intermNode) = parseContext.intermediate.addLoop((yyvsp[-5].interm.intermNode), (yyvsp[-2].interm.intermTypedNode), 0, false, (yyvsp[-4].lex).loc); - --parseContext.loopNestingLevel; - --parseContext.statementNestingLevel; - --parseContext.controlFlowNestingLevel; - } -#line 7779 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 431: -#line 2796 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.symbolTable.push(); - ++parseContext.loopNestingLevel; - ++parseContext.statementNestingLevel; - ++parseContext.controlFlowNestingLevel; - } -#line 7790 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 432: -#line 2802 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); - (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[-3].interm.intermNode), (yyvsp[-5].lex).loc); - TIntermLoop* forLoop = parseContext.intermediate.addLoop((yyvsp[0].interm.intermNode), reinterpret_cast((yyvsp[-2].interm.nodePair).node1), reinterpret_cast((yyvsp[-2].interm.nodePair).node2), true, (yyvsp[-6].lex).loc); - if (! parseContext.limits.nonInductiveForLoops) - parseContext.inductiveLoopCheck((yyvsp[-6].lex).loc, (yyvsp[-3].interm.intermNode), forLoop); - (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyval.interm.intermNode), forLoop, (yyvsp[-6].lex).loc); - (yyval.interm.intermNode)->getAsAggregate()->setOperator(EOpSequence); - --parseContext.loopNestingLevel; - --parseContext.statementNestingLevel; - --parseContext.controlFlowNestingLevel; - } -#line 7807 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 433: -#line 2817 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); - } -#line 7815 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 434: -#line 2820 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); - } -#line 7823 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 435: -#line 2826 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); - } -#line 7831 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 436: -#line 2829 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = 0; - } -#line 7839 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 437: -#line 2835 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.nodePair).node1 = (yyvsp[-1].interm.intermTypedNode); - (yyval.interm.nodePair).node2 = 0; - } -#line 7848 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 438: -#line 2839 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermTypedNode); - (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermTypedNode); - } -#line 7857 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 439: -#line 2846 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - if (parseContext.loopNestingLevel <= 0) - parseContext.error((yyvsp[-1].lex).loc, "continue statement only allowed in loops", "", ""); - (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpContinue, (yyvsp[-1].lex).loc); - } -#line 7867 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 440: -#line 2851 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - if (parseContext.loopNestingLevel + parseContext.switchSequenceStack.size() <= 0) - parseContext.error((yyvsp[-1].lex).loc, "break statement only allowed in switch and loops", "", ""); - (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpBreak, (yyvsp[-1].lex).loc); - } -#line 7877 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 441: -#line 2856 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpReturn, (yyvsp[-1].lex).loc); - if (parseContext.currentFunctionType->getBasicType() != EbtVoid) - parseContext.error((yyvsp[-1].lex).loc, "non-void function must return a value", "return", ""); - if (parseContext.inMain) - parseContext.postEntryPointReturn = true; - } -#line 7889 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 442: -#line 2863 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermNode) = parseContext.handleReturnValue((yyvsp[-2].lex).loc, (yyvsp[-1].interm.intermTypedNode)); - } -#line 7897 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 443: -#line 2866 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.requireStage((yyvsp[-1].lex).loc, EShLangFragment, "discard"); - (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpKill, (yyvsp[-1].lex).loc); - } -#line 7906 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 444: -#line 2875 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); - parseContext.intermediate.setTreeRoot((yyval.interm.intermNode)); - } -#line 7915 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 445: -#line 2879 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - if ((yyvsp[0].interm.intermNode) != nullptr) { - (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-1].interm.intermNode), (yyvsp[0].interm.intermNode)); - parseContext.intermediate.setTreeRoot((yyval.interm.intermNode)); - } - } -#line 7926 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 446: -#line 2888 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); - } -#line 7934 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 447: -#line 2891 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); - } -#line 7942 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 448: -#line 2894 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.requireProfile((yyvsp[0].lex).loc, ~EEsProfile, "extraneous semicolon"); - parseContext.profileRequires((yyvsp[0].lex).loc, ~EEsProfile, 460, nullptr, "extraneous semicolon"); - (yyval.interm.intermNode) = nullptr; - } -#line 7952 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 449: -#line 2902 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyvsp[0].interm).function = parseContext.handleFunctionDeclarator((yyvsp[0].interm).loc, *(yyvsp[0].interm).function, false /* not prototype */); - (yyvsp[0].interm).intermNode = parseContext.handleFunctionDefinition((yyvsp[0].interm).loc, *(yyvsp[0].interm).function); - } -#line 7961 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 450: -#line 2906 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - // May be best done as post process phase on intermediate code - if (parseContext.currentFunctionType->getBasicType() != EbtVoid && ! parseContext.functionReturnsValue) - parseContext.error((yyvsp[-2].interm).loc, "function does not return a value:", "", (yyvsp[-2].interm).function->getName().c_str()); - parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); - (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm).intermNode, (yyvsp[0].interm.intermNode)); - parseContext.intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[-2].interm).function->getType(), (yyvsp[-2].interm).loc); - (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[-2].interm).function->getMangledName().c_str()); - - // store the pragma information for debug and optimize and other vendor specific - // information. This information can be queried from the parse tree - (yyval.interm.intermNode)->getAsAggregate()->setOptimize(parseContext.contextPragma.optimize); - (yyval.interm.intermNode)->getAsAggregate()->setDebug(parseContext.contextPragma.debug); - (yyval.interm.intermNode)->getAsAggregate()->setPragmaTable(parseContext.contextPragma.pragmaTable); - } -#line 7981 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - -#line 7985 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - default: break; - } - /* User semantic actions sometimes alter yychar, and that requires - that yytoken be updated with the new translation. We take the - approach of translating immediately before every use of yytoken. - One alternative is translating here after every semantic action, - but that translation would be missed if the semantic action invokes - YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or - if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an - incorrect destructor might then be invoked immediately. In the - case of YYERROR or YYBACKUP, subsequent parser actions might lead - to an incorrect destructor call or verbose syntax error message - before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - - *++yyvsp = yyval; - - /* Now 'shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - - goto yynewstate; - - -/*--------------------------------------. -| yyerrlab -- here on detecting error. | -`--------------------------------------*/ -yyerrlab: - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (pParseContext, YY_("syntax error")); -#else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ - yyssp, yytoken) - { - char const *yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == 1) - { - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); - if (!yymsg) - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; - } - else - { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; - } - } - yyerror (pParseContext, yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; - } -# undef YYSYNTAX_ERROR -#endif - } - - - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", - yytoken, &yylval, pParseContext); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse lookahead token after shifting the error - token. */ - goto yyerrlab1; - - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - /* Do not reclaim the symbols of the rule whose action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; - - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - - yydestruct ("Error: popping", - yystos[yystate], yyvsp, pParseContext); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - - - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#if !defined yyoverflow || YYERROR_VERBOSE -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (pParseContext, YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEMPTY) - { - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = YYTRANSLATE (yychar); - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval, pParseContext); - } - /* Do not reclaim the symbols of the rule whose action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp, pParseContext); - YYPOPSTACK (1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif - return yyresult; -} -#line 2923 "MachineIndependent/glslang.y" /* yacc.c:1906 */ - diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/glslang_tab.cpp.h b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/glslang_tab.cpp.h deleted file mode 100644 index b2e00632..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/glslang_tab.cpp.h +++ /dev/null @@ -1,395 +0,0 @@ -/* A Bison parser, made by GNU Bison 3.0. */ - -/* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -#ifndef YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED -# define YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 1 -#endif -#if YYDEBUG -extern int yydebug; -#endif - -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - ATTRIBUTE = 258, - VARYING = 259, - CONST = 260, - BOOL = 261, - FLOAT = 262, - DOUBLE = 263, - INT = 264, - UINT = 265, - INT64_T = 266, - UINT64_T = 267, - INT16_T = 268, - UINT16_T = 269, - FLOAT16_T = 270, - BREAK = 271, - CONTINUE = 272, - DO = 273, - ELSE = 274, - FOR = 275, - IF = 276, - DISCARD = 277, - RETURN = 278, - SWITCH = 279, - CASE = 280, - DEFAULT = 281, - SUBROUTINE = 282, - BVEC2 = 283, - BVEC3 = 284, - BVEC4 = 285, - IVEC2 = 286, - IVEC3 = 287, - IVEC4 = 288, - I64VEC2 = 289, - I64VEC3 = 290, - I64VEC4 = 291, - UVEC2 = 292, - UVEC3 = 293, - UVEC4 = 294, - U64VEC2 = 295, - U64VEC3 = 296, - U64VEC4 = 297, - VEC2 = 298, - VEC3 = 299, - VEC4 = 300, - MAT2 = 301, - MAT3 = 302, - MAT4 = 303, - CENTROID = 304, - IN = 305, - OUT = 306, - INOUT = 307, - UNIFORM = 308, - PATCH = 309, - SAMPLE = 310, - BUFFER = 311, - SHARED = 312, - COHERENT = 313, - VOLATILE = 314, - RESTRICT = 315, - READONLY = 316, - WRITEONLY = 317, - DVEC2 = 318, - DVEC3 = 319, - DVEC4 = 320, - DMAT2 = 321, - DMAT3 = 322, - DMAT4 = 323, - F16VEC2 = 324, - F16VEC3 = 325, - F16VEC4 = 326, - F16MAT2 = 327, - F16MAT3 = 328, - F16MAT4 = 329, - I16VEC2 = 330, - I16VEC3 = 331, - I16VEC4 = 332, - U16VEC2 = 333, - U16VEC3 = 334, - U16VEC4 = 335, - NOPERSPECTIVE = 336, - FLAT = 337, - SMOOTH = 338, - LAYOUT = 339, - __EXPLICITINTERPAMD = 340, - MAT2X2 = 341, - MAT2X3 = 342, - MAT2X4 = 343, - MAT3X2 = 344, - MAT3X3 = 345, - MAT3X4 = 346, - MAT4X2 = 347, - MAT4X3 = 348, - MAT4X4 = 349, - DMAT2X2 = 350, - DMAT2X3 = 351, - DMAT2X4 = 352, - DMAT3X2 = 353, - DMAT3X3 = 354, - DMAT3X4 = 355, - DMAT4X2 = 356, - DMAT4X3 = 357, - DMAT4X4 = 358, - F16MAT2X2 = 359, - F16MAT2X3 = 360, - F16MAT2X4 = 361, - F16MAT3X2 = 362, - F16MAT3X3 = 363, - F16MAT3X4 = 364, - F16MAT4X2 = 365, - F16MAT4X3 = 366, - F16MAT4X4 = 367, - ATOMIC_UINT = 368, - SAMPLER1D = 369, - SAMPLER2D = 370, - SAMPLER3D = 371, - SAMPLERCUBE = 372, - SAMPLER1DSHADOW = 373, - SAMPLER2DSHADOW = 374, - SAMPLERCUBESHADOW = 375, - SAMPLER1DARRAY = 376, - SAMPLER2DARRAY = 377, - SAMPLER1DARRAYSHADOW = 378, - SAMPLER2DARRAYSHADOW = 379, - ISAMPLER1D = 380, - ISAMPLER2D = 381, - ISAMPLER3D = 382, - ISAMPLERCUBE = 383, - ISAMPLER1DARRAY = 384, - ISAMPLER2DARRAY = 385, - USAMPLER1D = 386, - USAMPLER2D = 387, - USAMPLER3D = 388, - USAMPLERCUBE = 389, - USAMPLER1DARRAY = 390, - USAMPLER2DARRAY = 391, - SAMPLER2DRECT = 392, - SAMPLER2DRECTSHADOW = 393, - ISAMPLER2DRECT = 394, - USAMPLER2DRECT = 395, - SAMPLERBUFFER = 396, - ISAMPLERBUFFER = 397, - USAMPLERBUFFER = 398, - SAMPLERCUBEARRAY = 399, - SAMPLERCUBEARRAYSHADOW = 400, - ISAMPLERCUBEARRAY = 401, - USAMPLERCUBEARRAY = 402, - SAMPLER2DMS = 403, - ISAMPLER2DMS = 404, - USAMPLER2DMS = 405, - SAMPLER2DMSARRAY = 406, - ISAMPLER2DMSARRAY = 407, - USAMPLER2DMSARRAY = 408, - SAMPLEREXTERNALOES = 409, - SAMPLER = 410, - SAMPLERSHADOW = 411, - TEXTURE1D = 412, - TEXTURE2D = 413, - TEXTURE3D = 414, - TEXTURECUBE = 415, - TEXTURE1DARRAY = 416, - TEXTURE2DARRAY = 417, - ITEXTURE1D = 418, - ITEXTURE2D = 419, - ITEXTURE3D = 420, - ITEXTURECUBE = 421, - ITEXTURE1DARRAY = 422, - ITEXTURE2DARRAY = 423, - UTEXTURE1D = 424, - UTEXTURE2D = 425, - UTEXTURE3D = 426, - UTEXTURECUBE = 427, - UTEXTURE1DARRAY = 428, - UTEXTURE2DARRAY = 429, - TEXTURE2DRECT = 430, - ITEXTURE2DRECT = 431, - UTEXTURE2DRECT = 432, - TEXTUREBUFFER = 433, - ITEXTUREBUFFER = 434, - UTEXTUREBUFFER = 435, - TEXTURECUBEARRAY = 436, - ITEXTURECUBEARRAY = 437, - UTEXTURECUBEARRAY = 438, - TEXTURE2DMS = 439, - ITEXTURE2DMS = 440, - UTEXTURE2DMS = 441, - TEXTURE2DMSARRAY = 442, - ITEXTURE2DMSARRAY = 443, - UTEXTURE2DMSARRAY = 444, - SUBPASSINPUT = 445, - SUBPASSINPUTMS = 446, - ISUBPASSINPUT = 447, - ISUBPASSINPUTMS = 448, - USUBPASSINPUT = 449, - USUBPASSINPUTMS = 450, - IMAGE1D = 451, - IIMAGE1D = 452, - UIMAGE1D = 453, - IMAGE2D = 454, - IIMAGE2D = 455, - UIMAGE2D = 456, - IMAGE3D = 457, - IIMAGE3D = 458, - UIMAGE3D = 459, - IMAGE2DRECT = 460, - IIMAGE2DRECT = 461, - UIMAGE2DRECT = 462, - IMAGECUBE = 463, - IIMAGECUBE = 464, - UIMAGECUBE = 465, - IMAGEBUFFER = 466, - IIMAGEBUFFER = 467, - UIMAGEBUFFER = 468, - IMAGE1DARRAY = 469, - IIMAGE1DARRAY = 470, - UIMAGE1DARRAY = 471, - IMAGE2DARRAY = 472, - IIMAGE2DARRAY = 473, - UIMAGE2DARRAY = 474, - IMAGECUBEARRAY = 475, - IIMAGECUBEARRAY = 476, - UIMAGECUBEARRAY = 477, - IMAGE2DMS = 478, - IIMAGE2DMS = 479, - UIMAGE2DMS = 480, - IMAGE2DMSARRAY = 481, - IIMAGE2DMSARRAY = 482, - UIMAGE2DMSARRAY = 483, - STRUCT = 484, - VOID = 485, - WHILE = 486, - IDENTIFIER = 487, - TYPE_NAME = 488, - FLOATCONSTANT = 489, - DOUBLECONSTANT = 490, - INTCONSTANT = 491, - UINTCONSTANT = 492, - INT64CONSTANT = 493, - UINT64CONSTANT = 494, - INT16CONSTANT = 495, - UINT16CONSTANT = 496, - BOOLCONSTANT = 497, - FLOAT16CONSTANT = 498, - LEFT_OP = 499, - RIGHT_OP = 500, - INC_OP = 501, - DEC_OP = 502, - LE_OP = 503, - GE_OP = 504, - EQ_OP = 505, - NE_OP = 506, - AND_OP = 507, - OR_OP = 508, - XOR_OP = 509, - MUL_ASSIGN = 510, - DIV_ASSIGN = 511, - ADD_ASSIGN = 512, - MOD_ASSIGN = 513, - LEFT_ASSIGN = 514, - RIGHT_ASSIGN = 515, - AND_ASSIGN = 516, - XOR_ASSIGN = 517, - OR_ASSIGN = 518, - SUB_ASSIGN = 519, - LEFT_PAREN = 520, - RIGHT_PAREN = 521, - LEFT_BRACKET = 522, - RIGHT_BRACKET = 523, - LEFT_BRACE = 524, - RIGHT_BRACE = 525, - DOT = 526, - COMMA = 527, - COLON = 528, - EQUAL = 529, - SEMICOLON = 530, - BANG = 531, - DASH = 532, - TILDE = 533, - PLUS = 534, - STAR = 535, - SLASH = 536, - PERCENT = 537, - LEFT_ANGLE = 538, - RIGHT_ANGLE = 539, - VERTICAL_BAR = 540, - CARET = 541, - AMPERSAND = 542, - QUESTION = 543, - INVARIANT = 544, - PRECISE = 545, - HIGH_PRECISION = 546, - MEDIUM_PRECISION = 547, - LOW_PRECISION = 548, - PRECISION = 549, - PACKED = 550, - RESOURCE = 551, - SUPERP = 552 - }; -#endif - -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; -union YYSTYPE -{ -#line 68 "MachineIndependent/glslang.y" /* yacc.c:1909 */ - - struct { - glslang::TSourceLoc loc; - union { - glslang::TString *string; - int i; - unsigned int u; - long long i64; - unsigned long long u64; - bool b; - double d; - }; - glslang::TSymbol* symbol; - } lex; - struct { - glslang::TSourceLoc loc; - glslang::TOperator op; - union { - TIntermNode* intermNode; - glslang::TIntermNodePair nodePair; - glslang::TIntermTyped* intermTypedNode; - }; - union { - glslang::TPublicType type; - glslang::TFunction* function; - glslang::TParameter param; - glslang::TTypeLoc typeLine; - glslang::TTypeList* typeList; - glslang::TArraySizes* arraySizes; - glslang::TIdentifierList* identifierList; - }; - } interm; - -#line 386 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */ -}; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif - - - -int yyparse (glslang::TParseContext* pParseContext); - -#endif /* !YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED */ diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/intermOut.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/intermOut.cpp deleted file mode 100644 index dd2cdc89..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/intermOut.cpp +++ /dev/null @@ -1,1155 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2012-2016 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#include "localintermediate.h" -#include "../Include/InfoSink.h" - -#ifdef _MSC_VER -#include -#else -#include -#endif - -namespace { - -bool IsInfinity(double x) { -#ifdef _MSC_VER - switch (_fpclass(x)) { - case _FPCLASS_NINF: - case _FPCLASS_PINF: - return true; - default: - return false; - } -#else - return std::isinf(x); -#endif -} - -bool IsNan(double x) { -#ifdef _MSC_VER - switch (_fpclass(x)) { - case _FPCLASS_SNAN: - case _FPCLASS_QNAN: - return true; - default: - return false; - } -#else - return std::isnan(x); -#endif -} - -} - -namespace glslang { - -// -// Two purposes: -// 1. Show an example of how to iterate tree. Functions can -// also directly call Traverse() on children themselves to -// have finer grained control over the process than shown here. -// See the last function for how to get started. -// 2. Print out a text based description of the tree. -// - -// -// Use this class to carry along data from node to node in -// the traversal -// -class TOutputTraverser : public TIntermTraverser { -public: - TOutputTraverser(TInfoSink& i) : infoSink(i) { } - - virtual bool visitBinary(TVisit, TIntermBinary* node); - virtual bool visitUnary(TVisit, TIntermUnary* node); - virtual bool visitAggregate(TVisit, TIntermAggregate* node); - virtual bool visitSelection(TVisit, TIntermSelection* node); - virtual void visitConstantUnion(TIntermConstantUnion* node); - virtual void visitSymbol(TIntermSymbol* node); - virtual bool visitLoop(TVisit, TIntermLoop* node); - virtual bool visitBranch(TVisit, TIntermBranch* node); - virtual bool visitSwitch(TVisit, TIntermSwitch* node); - - TInfoSink& infoSink; -protected: - TOutputTraverser(TOutputTraverser&); - TOutputTraverser& operator=(TOutputTraverser&); -}; - -// -// Helper functions for printing, not part of traversing. -// - -static void OutputTreeText(TInfoSink& infoSink, const TIntermNode* node, const int depth) -{ - int i; - - infoSink.debug << node->getLoc().string << ":"; - if (node->getLoc().line) - infoSink.debug << node->getLoc().line; - else - infoSink.debug << "? "; - - for (i = 0; i < depth; ++i) - infoSink.debug << " "; -} - -// -// The rest of the file are the traversal functions. The last one -// is the one that starts the traversal. -// -// Return true from interior nodes to have the external traversal -// continue on to children. If you process children yourself, -// return false. -// - -bool TOutputTraverser::visitBinary(TVisit /* visit */, TIntermBinary* node) -{ - TInfoSink& out = infoSink; - - OutputTreeText(out, node, depth); - - switch (node->getOp()) { - case EOpAssign: out.debug << "move second child to first child"; break; - case EOpAddAssign: out.debug << "add second child into first child"; break; - case EOpSubAssign: out.debug << "subtract second child into first child"; break; - case EOpMulAssign: out.debug << "multiply second child into first child"; break; - case EOpVectorTimesMatrixAssign: out.debug << "matrix mult second child into first child"; break; - case EOpVectorTimesScalarAssign: out.debug << "vector scale second child into first child"; break; - case EOpMatrixTimesScalarAssign: out.debug << "matrix scale second child into first child"; break; - case EOpMatrixTimesMatrixAssign: out.debug << "matrix mult second child into first child"; break; - case EOpDivAssign: out.debug << "divide second child into first child"; break; - case EOpModAssign: out.debug << "mod second child into first child"; break; - case EOpAndAssign: out.debug << "and second child into first child"; break; - case EOpInclusiveOrAssign: out.debug << "or second child into first child"; break; - case EOpExclusiveOrAssign: out.debug << "exclusive or second child into first child"; break; - case EOpLeftShiftAssign: out.debug << "left shift second child into first child"; break; - case EOpRightShiftAssign: out.debug << "right shift second child into first child"; break; - - case EOpIndexDirect: out.debug << "direct index"; break; - case EOpIndexIndirect: out.debug << "indirect index"; break; - case EOpIndexDirectStruct: - out.debug << (*node->getLeft()->getType().getStruct())[node->getRight()->getAsConstantUnion()->getConstArray()[0].getIConst()].type->getFieldName(); - out.debug << ": direct index for structure"; break; - case EOpVectorSwizzle: out.debug << "vector swizzle"; break; - case EOpMatrixSwizzle: out.debug << "matrix swizzle"; break; - - case EOpAdd: out.debug << "add"; break; - case EOpSub: out.debug << "subtract"; break; - case EOpMul: out.debug << "component-wise multiply"; break; - case EOpDiv: out.debug << "divide"; break; - case EOpMod: out.debug << "mod"; break; - case EOpRightShift: out.debug << "right-shift"; break; - case EOpLeftShift: out.debug << "left-shift"; break; - case EOpAnd: out.debug << "bitwise and"; break; - case EOpInclusiveOr: out.debug << "inclusive-or"; break; - case EOpExclusiveOr: out.debug << "exclusive-or"; break; - case EOpEqual: out.debug << "Compare Equal"; break; - case EOpNotEqual: out.debug << "Compare Not Equal"; break; - case EOpLessThan: out.debug << "Compare Less Than"; break; - case EOpGreaterThan: out.debug << "Compare Greater Than"; break; - case EOpLessThanEqual: out.debug << "Compare Less Than or Equal"; break; - case EOpGreaterThanEqual: out.debug << "Compare Greater Than or Equal"; break; - case EOpVectorEqual: out.debug << "Equal"; break; - case EOpVectorNotEqual: out.debug << "NotEqual"; break; - - case EOpVectorTimesScalar: out.debug << "vector-scale"; break; - case EOpVectorTimesMatrix: out.debug << "vector-times-matrix"; break; - case EOpMatrixTimesVector: out.debug << "matrix-times-vector"; break; - case EOpMatrixTimesScalar: out.debug << "matrix-scale"; break; - case EOpMatrixTimesMatrix: out.debug << "matrix-multiply"; break; - - case EOpLogicalOr: out.debug << "logical-or"; break; - case EOpLogicalXor: out.debug << "logical-xor"; break; - case EOpLogicalAnd: out.debug << "logical-and"; break; - - default: out.debug << ""; - } - - out.debug << " (" << node->getCompleteString() << ")"; - - out.debug << "\n"; - - return true; -} - -bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node) -{ - TInfoSink& out = infoSink; - - OutputTreeText(out, node, depth); - - switch (node->getOp()) { - case EOpNegative: out.debug << "Negate value"; break; - case EOpVectorLogicalNot: - case EOpLogicalNot: out.debug << "Negate conditional"; break; - case EOpBitwiseNot: out.debug << "Bitwise not"; break; - - case EOpPostIncrement: out.debug << "Post-Increment"; break; - case EOpPostDecrement: out.debug << "Post-Decrement"; break; - case EOpPreIncrement: out.debug << "Pre-Increment"; break; - case EOpPreDecrement: out.debug << "Pre-Decrement"; break; - - case EOpConvIntToBool: out.debug << "Convert int to bool"; break; - case EOpConvUintToBool: out.debug << "Convert uint to bool"; break; - case EOpConvFloatToBool: out.debug << "Convert float to bool"; break; - case EOpConvDoubleToBool: out.debug << "Convert double to bool"; break; - case EOpConvInt64ToBool: out.debug << "Convert int64 to bool"; break; - case EOpConvUint64ToBool: out.debug << "Convert uint64 to bool"; break; - case EOpConvIntToFloat: out.debug << "Convert int to float"; break; - case EOpConvUintToFloat: out.debug << "Convert uint to float"; break; - case EOpConvDoubleToFloat: out.debug << "Convert double to float"; break; - case EOpConvInt64ToFloat: out.debug << "Convert int64 to float"; break; - case EOpConvUint64ToFloat: out.debug << "Convert uint64 to float"; break; - case EOpConvBoolToFloat: out.debug << "Convert bool to float"; break; - case EOpConvUintToInt: out.debug << "Convert uint to int"; break; - case EOpConvFloatToInt: out.debug << "Convert float to int"; break; - case EOpConvDoubleToInt: out.debug << "Convert double to int"; break; - case EOpConvBoolToInt: out.debug << "Convert bool to int"; break; - case EOpConvInt64ToInt: out.debug << "Convert int64 to int"; break; - case EOpConvUint64ToInt: out.debug << "Convert uint64 to int"; break; - case EOpConvIntToUint: out.debug << "Convert int to uint"; break; - case EOpConvFloatToUint: out.debug << "Convert float to uint"; break; - case EOpConvDoubleToUint: out.debug << "Convert double to uint"; break; - case EOpConvBoolToUint: out.debug << "Convert bool to uint"; break; - case EOpConvInt64ToUint: out.debug << "Convert int64 to uint"; break; - case EOpConvUint64ToUint: out.debug << "Convert uint64 to uint"; break; - case EOpConvIntToDouble: out.debug << "Convert int to double"; break; - case EOpConvUintToDouble: out.debug << "Convert uint to double"; break; - case EOpConvFloatToDouble: out.debug << "Convert float to double"; break; - case EOpConvBoolToDouble: out.debug << "Convert bool to double"; break; - case EOpConvInt64ToDouble: out.debug << "Convert int64 to double"; break; - case EOpConvUint64ToDouble: out.debug << "Convert uint64 to double"; break; - case EOpConvBoolToInt64: out.debug << "Convert bool to int64"; break; - case EOpConvIntToInt64: out.debug << "Convert int to int64"; break; - case EOpConvUintToInt64: out.debug << "Convert uint to int64"; break; - case EOpConvFloatToInt64: out.debug << "Convert float to int64"; break; - case EOpConvDoubleToInt64: out.debug << "Convert double to int64"; break; - case EOpConvUint64ToInt64: out.debug << "Convert uint64 to int64"; break; - case EOpConvBoolToUint64: out.debug << "Convert bool to uint64"; break; - case EOpConvIntToUint64: out.debug << "Convert int to uint64"; break; - case EOpConvUintToUint64: out.debug << "Convert uint to uint64"; break; - case EOpConvFloatToUint64: out.debug << "Convert float to uint64"; break; - case EOpConvDoubleToUint64: out.debug << "Convert double to uint64"; break; - case EOpConvInt64ToUint64: out.debug << "Convert uint64 to uint64"; break; - - case EOpRadians: out.debug << "radians"; break; - case EOpDegrees: out.debug << "degrees"; break; - case EOpSin: out.debug << "sine"; break; - case EOpCos: out.debug << "cosine"; break; - case EOpTan: out.debug << "tangent"; break; - case EOpAsin: out.debug << "arc sine"; break; - case EOpAcos: out.debug << "arc cosine"; break; - case EOpAtan: out.debug << "arc tangent"; break; - case EOpSinh: out.debug << "hyp. sine"; break; - case EOpCosh: out.debug << "hyp. cosine"; break; - case EOpTanh: out.debug << "hyp. tangent"; break; - case EOpAsinh: out.debug << "arc hyp. sine"; break; - case EOpAcosh: out.debug << "arc hyp. cosine"; break; - case EOpAtanh: out.debug << "arc hyp. tangent"; break; - - case EOpExp: out.debug << "exp"; break; - case EOpLog: out.debug << "log"; break; - case EOpExp2: out.debug << "exp2"; break; - case EOpLog2: out.debug << "log2"; break; - case EOpSqrt: out.debug << "sqrt"; break; - case EOpInverseSqrt: out.debug << "inverse sqrt"; break; - - case EOpAbs: out.debug << "Absolute value"; break; - case EOpSign: out.debug << "Sign"; break; - case EOpFloor: out.debug << "Floor"; break; - case EOpTrunc: out.debug << "trunc"; break; - case EOpRound: out.debug << "round"; break; - case EOpRoundEven: out.debug << "roundEven"; break; - case EOpCeil: out.debug << "Ceiling"; break; - case EOpFract: out.debug << "Fraction"; break; - - case EOpIsNan: out.debug << "isnan"; break; - case EOpIsInf: out.debug << "isinf"; break; - - case EOpFloatBitsToInt: out.debug << "floatBitsToInt"; break; - case EOpFloatBitsToUint:out.debug << "floatBitsToUint"; break; - case EOpIntBitsToFloat: out.debug << "intBitsToFloat"; break; - case EOpUintBitsToFloat:out.debug << "uintBitsToFloat"; break; - case EOpDoubleBitsToInt64: out.debug << "doubleBitsToInt64"; break; - case EOpDoubleBitsToUint64: out.debug << "doubleBitsToUint64"; break; - case EOpInt64BitsToDouble: out.debug << "int64BitsToDouble"; break; - case EOpUint64BitsToDouble: out.debug << "uint64BitsToDouble"; break; -#ifdef AMD_EXTENSIONS - case EOpFloat16BitsToInt16: out.debug << "float16BitsToInt16"; break; - case EOpFloat16BitsToUint16: out.debug << "float16BitsToUint16"; break; - case EOpInt16BitsToFloat16: out.debug << "int16BitsToFloat16"; break; - case EOpUint16BitsToFloat16: out.debug << "uint16BitsToFloat16"; break; -#endif - - case EOpPackSnorm2x16: out.debug << "packSnorm2x16"; break; - case EOpUnpackSnorm2x16:out.debug << "unpackSnorm2x16"; break; - case EOpPackUnorm2x16: out.debug << "packUnorm2x16"; break; - case EOpUnpackUnorm2x16:out.debug << "unpackUnorm2x16"; break; - case EOpPackHalf2x16: out.debug << "packHalf2x16"; break; - case EOpUnpackHalf2x16: out.debug << "unpackHalf2x16"; break; - - case EOpPackSnorm4x8: out.debug << "PackSnorm4x8"; break; - case EOpUnpackSnorm4x8: out.debug << "UnpackSnorm4x8"; break; - case EOpPackUnorm4x8: out.debug << "PackUnorm4x8"; break; - case EOpUnpackUnorm4x8: out.debug << "UnpackUnorm4x8"; break; - case EOpPackDouble2x32: out.debug << "PackDouble2x32"; break; - case EOpUnpackDouble2x32: out.debug << "UnpackDouble2x32"; break; - - case EOpPackInt2x32: out.debug << "packInt2x32"; break; - case EOpUnpackInt2x32: out.debug << "unpackInt2x32"; break; - case EOpPackUint2x32: out.debug << "packUint2x32"; break; - case EOpUnpackUint2x32: out.debug << "unpackUint2x32"; break; - -#ifdef AMD_EXTENSIONS - case EOpPackInt2x16: out.debug << "packInt2x16"; break; - case EOpUnpackInt2x16: out.debug << "unpackInt2x16"; break; - case EOpPackUint2x16: out.debug << "packUint2x16"; break; - case EOpUnpackUint2x16: out.debug << "unpackUint2x16"; break; - - case EOpPackInt4x16: out.debug << "packInt4x16"; break; - case EOpUnpackInt4x16: out.debug << "unpackInt4x16"; break; - case EOpPackUint4x16: out.debug << "packUint4x16"; break; - case EOpUnpackUint4x16: out.debug << "unpackUint4x16"; break; - - case EOpPackFloat2x16: out.debug << "packFloat2x16"; break; - case EOpUnpackFloat2x16: out.debug << "unpackFloat2x16"; break; -#endif - - case EOpLength: out.debug << "length"; break; - case EOpNormalize: out.debug << "normalize"; break; - case EOpDPdx: out.debug << "dPdx"; break; - case EOpDPdy: out.debug << "dPdy"; break; - case EOpFwidth: out.debug << "fwidth"; break; - case EOpDPdxFine: out.debug << "dPdxFine"; break; - case EOpDPdyFine: out.debug << "dPdyFine"; break; - case EOpFwidthFine: out.debug << "fwidthFine"; break; - case EOpDPdxCoarse: out.debug << "dPdxCoarse"; break; - case EOpDPdyCoarse: out.debug << "dPdyCoarse"; break; - case EOpFwidthCoarse: out.debug << "fwidthCoarse"; break; - - case EOpInterpolateAtCentroid: out.debug << "interpolateAtCentroid"; break; - - case EOpDeterminant: out.debug << "determinant"; break; - case EOpMatrixInverse: out.debug << "inverse"; break; - case EOpTranspose: out.debug << "transpose"; break; - - case EOpAny: out.debug << "any"; break; - case EOpAll: out.debug << "all"; break; - - case EOpArrayLength: out.debug << "array length"; break; - - case EOpEmitStreamVertex: out.debug << "EmitStreamVertex"; break; - case EOpEndStreamPrimitive: out.debug << "EndStreamPrimitive"; break; - - case EOpAtomicCounterIncrement: out.debug << "AtomicCounterIncrement";break; - case EOpAtomicCounterDecrement: out.debug << "AtomicCounterDecrement";break; - case EOpAtomicCounter: out.debug << "AtomicCounter"; break; - - case EOpTextureQuerySize: out.debug << "textureSize"; break; - case EOpTextureQueryLod: out.debug << "textureQueryLod"; break; - case EOpTextureQueryLevels: out.debug << "textureQueryLevels"; break; - case EOpTextureQuerySamples: out.debug << "textureSamples"; break; - case EOpImageQuerySize: out.debug << "imageQuerySize"; break; - case EOpImageQuerySamples: out.debug << "imageQuerySamples"; break; - case EOpImageLoad: out.debug << "imageLoad"; break; - - case EOpBitFieldReverse: out.debug << "bitFieldReverse"; break; - case EOpBitCount: out.debug << "bitCount"; break; - case EOpFindLSB: out.debug << "findLSB"; break; - case EOpFindMSB: out.debug << "findMSB"; break; - - case EOpNoise: out.debug << "noise"; break; - - case EOpBallot: out.debug << "ballot"; break; - case EOpReadFirstInvocation: out.debug << "readFirstInvocation"; break; - - case EOpAnyInvocation: out.debug << "anyInvocation"; break; - case EOpAllInvocations: out.debug << "allInvocations"; break; - case EOpAllInvocationsEqual: out.debug << "allInvocationsEqual"; break; - - case EOpClip: out.debug << "clip"; break; - case EOpIsFinite: out.debug << "isfinite"; break; - case EOpLog10: out.debug << "log10"; break; - case EOpRcp: out.debug << "rcp"; break; - case EOpSaturate: out.debug << "saturate"; break; - - case EOpSparseTexelsResident: out.debug << "sparseTexelsResident"; break; - -#ifdef AMD_EXTENSIONS - case EOpMinInvocations: out.debug << "minInvocations"; break; - case EOpMaxInvocations: out.debug << "maxInvocations"; break; - case EOpAddInvocations: out.debug << "addInvocations"; break; - case EOpMinInvocationsNonUniform: out.debug << "minInvocationsNonUniform"; break; - case EOpMaxInvocationsNonUniform: out.debug << "maxInvocationsNonUniform"; break; - case EOpAddInvocationsNonUniform: out.debug << "addInvocationsNonUniform"; break; - - case EOpMinInvocationsInclusiveScan: out.debug << "minInvocationsInclusiveScan"; break; - case EOpMaxInvocationsInclusiveScan: out.debug << "maxInvocationsInclusiveScan"; break; - case EOpAddInvocationsInclusiveScan: out.debug << "addInvocationsInclusiveScan"; break; - case EOpMinInvocationsInclusiveScanNonUniform: out.debug << "minInvocationsInclusiveScanNonUniform"; break; - case EOpMaxInvocationsInclusiveScanNonUniform: out.debug << "maxInvocationsInclusiveScanNonUniform"; break; - case EOpAddInvocationsInclusiveScanNonUniform: out.debug << "addInvocationsInclusiveScanNonUniform"; break; - - case EOpMinInvocationsExclusiveScan: out.debug << "minInvocationsExclusiveScan"; break; - case EOpMaxInvocationsExclusiveScan: out.debug << "maxInvocationsExclusiveScan"; break; - case EOpAddInvocationsExclusiveScan: out.debug << "addInvocationsExclusiveScan"; break; - case EOpMinInvocationsExclusiveScanNonUniform: out.debug << "minInvocationsExclusiveScanNonUniform"; break; - case EOpMaxInvocationsExclusiveScanNonUniform: out.debug << "maxInvocationsExclusiveScanNonUniform"; break; - case EOpAddInvocationsExclusiveScanNonUniform: out.debug << "addInvocationsExclusiveScanNonUniform"; break; - - case EOpMbcnt: out.debug << "mbcnt"; break; - - case EOpCubeFaceIndex: out.debug << "cubeFaceIndex"; break; - case EOpCubeFaceCoord: out.debug << "cubeFaceCoord"; break; - - case EOpFragmentMaskFetch: out.debug << "fragmentMaskFetchAMD"; break; - case EOpFragmentFetch: out.debug << "fragmentFetchAMD"; break; - - case EOpConvBoolToFloat16: out.debug << "Convert bool to float16"; break; - case EOpConvIntToFloat16: out.debug << "Convert int to float16"; break; - case EOpConvUintToFloat16: out.debug << "Convert uint to float16"; break; - case EOpConvFloatToFloat16: out.debug << "Convert float to float16"; break; - case EOpConvDoubleToFloat16: out.debug << "Convert double to float16"; break; - case EOpConvInt64ToFloat16: out.debug << "Convert int64 to float16"; break; - case EOpConvUint64ToFloat16: out.debug << "Convert uint64 to float16"; break; - case EOpConvFloat16ToBool: out.debug << "Convert float16 to bool"; break; - case EOpConvFloat16ToInt: out.debug << "Convert float16 to int"; break; - case EOpConvFloat16ToUint: out.debug << "Convert float16 to uint"; break; - case EOpConvFloat16ToFloat: out.debug << "Convert float16 to float"; break; - case EOpConvFloat16ToDouble: out.debug << "Convert float16 to double"; break; - case EOpConvFloat16ToInt64: out.debug << "Convert float16 to int64"; break; - case EOpConvFloat16ToUint64: out.debug << "Convert float16 to uint64"; break; - - case EOpConvBoolToInt16: out.debug << "Convert bool to int16"; break; - case EOpConvIntToInt16: out.debug << "Convert int to int16"; break; - case EOpConvUintToInt16: out.debug << "Convert uint to int16"; break; - case EOpConvFloatToInt16: out.debug << "Convert float to int16"; break; - case EOpConvDoubleToInt16: out.debug << "Convert double to int16"; break; - case EOpConvFloat16ToInt16: out.debug << "Convert float16 to int16"; break; - case EOpConvInt64ToInt16: out.debug << "Convert int64 to int16"; break; - case EOpConvUint64ToInt16: out.debug << "Convert uint64 to int16"; break; - case EOpConvUint16ToInt16: out.debug << "Convert uint16 to int16"; break; - case EOpConvInt16ToBool: out.debug << "Convert int16 to bool"; break; - case EOpConvInt16ToInt: out.debug << "Convert int16 to int"; break; - case EOpConvInt16ToUint: out.debug << "Convert int16 to uint"; break; - case EOpConvInt16ToFloat: out.debug << "Convert int16 to float"; break; - case EOpConvInt16ToDouble: out.debug << "Convert int16 to double"; break; - case EOpConvInt16ToFloat16: out.debug << "Convert int16 to float16"; break; - case EOpConvInt16ToInt64: out.debug << "Convert int16 to int64"; break; - case EOpConvInt16ToUint64: out.debug << "Convert int16 to uint64"; break; - - case EOpConvBoolToUint16: out.debug << "Convert bool to uint16"; break; - case EOpConvIntToUint16: out.debug << "Convert int to uint16"; break; - case EOpConvUintToUint16: out.debug << "Convert uint to uint16"; break; - case EOpConvFloatToUint16: out.debug << "Convert float to uint16"; break; - case EOpConvDoubleToUint16: out.debug << "Convert double to uint16"; break; - case EOpConvFloat16ToUint16: out.debug << "Convert float16 to uint16"; break; - case EOpConvInt64ToUint16: out.debug << "Convert int64 to uint16"; break; - case EOpConvUint64ToUint16: out.debug << "Convert uint64 to uint16"; break; - case EOpConvInt16ToUint16: out.debug << "Convert int16 to uint16"; break; - case EOpConvUint16ToBool: out.debug << "Convert uint16 to bool"; break; - case EOpConvUint16ToInt: out.debug << "Convert uint16 to int"; break; - case EOpConvUint16ToUint: out.debug << "Convert uint16 to uint"; break; - case EOpConvUint16ToFloat: out.debug << "Convert uint16 to float"; break; - case EOpConvUint16ToDouble: out.debug << "Convert uint16 to double"; break; - case EOpConvUint16ToFloat16: out.debug << "Convert uint16 to float16"; break; - case EOpConvUint16ToInt64: out.debug << "Convert uint16 to int64"; break; - case EOpConvUint16ToUint64: out.debug << "Convert uint16 to uint64"; break; -#endif - - case EOpSubpassLoad: out.debug << "subpassLoad"; break; - case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break; - - default: out.debug.message(EPrefixError, "Bad unary op"); - } - - out.debug << " (" << node->getCompleteString() << ")"; - - out.debug << "\n"; - - return true; -} - -bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node) -{ - TInfoSink& out = infoSink; - - if (node->getOp() == EOpNull) { - out.debug.message(EPrefixError, "node is still EOpNull!"); - return true; - } - - OutputTreeText(out, node, depth); - - switch (node->getOp()) { - case EOpSequence: out.debug << "Sequence\n"; return true; - case EOpLinkerObjects: out.debug << "Linker Objects\n"; return true; - case EOpComma: out.debug << "Comma"; break; - case EOpFunction: out.debug << "Function Definition: " << node->getName(); break; - case EOpFunctionCall: out.debug << "Function Call: " << node->getName(); break; - case EOpParameters: out.debug << "Function Parameters: "; break; - - case EOpConstructFloat: out.debug << "Construct float"; break; - case EOpConstructDouble:out.debug << "Construct double"; break; - - case EOpConstructVec2: out.debug << "Construct vec2"; break; - case EOpConstructVec3: out.debug << "Construct vec3"; break; - case EOpConstructVec4: out.debug << "Construct vec4"; break; - case EOpConstructDVec2: out.debug << "Construct dvec2"; break; - case EOpConstructDVec3: out.debug << "Construct dvec3"; break; - case EOpConstructDVec4: out.debug << "Construct dvec4"; break; - case EOpConstructBool: out.debug << "Construct bool"; break; - case EOpConstructBVec2: out.debug << "Construct bvec2"; break; - case EOpConstructBVec3: out.debug << "Construct bvec3"; break; - case EOpConstructBVec4: out.debug << "Construct bvec4"; break; - case EOpConstructInt: out.debug << "Construct int"; break; - case EOpConstructIVec2: out.debug << "Construct ivec2"; break; - case EOpConstructIVec3: out.debug << "Construct ivec3"; break; - case EOpConstructIVec4: out.debug << "Construct ivec4"; break; - case EOpConstructUint: out.debug << "Construct uint"; break; - case EOpConstructUVec2: out.debug << "Construct uvec2"; break; - case EOpConstructUVec3: out.debug << "Construct uvec3"; break; - case EOpConstructUVec4: out.debug << "Construct uvec4"; break; - case EOpConstructInt64: out.debug << "Construct int64_t"; break; - case EOpConstructI64Vec2: out.debug << "Construct i64vec2"; break; - case EOpConstructI64Vec3: out.debug << "Construct i64vec3"; break; - case EOpConstructI64Vec4: out.debug << "Construct i64vec4"; break; - case EOpConstructUint64: out.debug << "Construct uint64_t"; break; - case EOpConstructU64Vec2: out.debug << "Construct u64vec2"; break; - case EOpConstructU64Vec3: out.debug << "Construct u64vec3"; break; - case EOpConstructU64Vec4: out.debug << "Construct u64vec4"; break; -#ifdef AMD_EXTENSIONS - case EOpConstructInt16: out.debug << "Construct int16_t"; break; - case EOpConstructI16Vec2: out.debug << "Construct i16vec2"; break; - case EOpConstructI16Vec3: out.debug << "Construct i16vec3"; break; - case EOpConstructI16Vec4: out.debug << "Construct i16vec4"; break; - case EOpConstructUint16: out.debug << "Construct uint16_t"; break; - case EOpConstructU16Vec2: out.debug << "Construct u16vec2"; break; - case EOpConstructU16Vec3: out.debug << "Construct u16vec3"; break; - case EOpConstructU16Vec4: out.debug << "Construct u16vec4"; break; -#endif - case EOpConstructMat2x2: out.debug << "Construct mat2"; break; - case EOpConstructMat2x3: out.debug << "Construct mat2x3"; break; - case EOpConstructMat2x4: out.debug << "Construct mat2x4"; break; - case EOpConstructMat3x2: out.debug << "Construct mat3x2"; break; - case EOpConstructMat3x3: out.debug << "Construct mat3"; break; - case EOpConstructMat3x4: out.debug << "Construct mat3x4"; break; - case EOpConstructMat4x2: out.debug << "Construct mat4x2"; break; - case EOpConstructMat4x3: out.debug << "Construct mat4x3"; break; - case EOpConstructMat4x4: out.debug << "Construct mat4"; break; - case EOpConstructDMat2x2: out.debug << "Construct dmat2"; break; - case EOpConstructDMat2x3: out.debug << "Construct dmat2x3"; break; - case EOpConstructDMat2x4: out.debug << "Construct dmat2x4"; break; - case EOpConstructDMat3x2: out.debug << "Construct dmat3x2"; break; - case EOpConstructDMat3x3: out.debug << "Construct dmat3"; break; - case EOpConstructDMat3x4: out.debug << "Construct dmat3x4"; break; - case EOpConstructDMat4x2: out.debug << "Construct dmat4x2"; break; - case EOpConstructDMat4x3: out.debug << "Construct dmat4x3"; break; - case EOpConstructDMat4x4: out.debug << "Construct dmat4"; break; - case EOpConstructIMat2x2: out.debug << "Construct imat2"; break; - case EOpConstructIMat2x3: out.debug << "Construct imat2x3"; break; - case EOpConstructIMat2x4: out.debug << "Construct imat2x4"; break; - case EOpConstructIMat3x2: out.debug << "Construct imat3x2"; break; - case EOpConstructIMat3x3: out.debug << "Construct imat3"; break; - case EOpConstructIMat3x4: out.debug << "Construct imat3x4"; break; - case EOpConstructIMat4x2: out.debug << "Construct imat4x2"; break; - case EOpConstructIMat4x3: out.debug << "Construct imat4x3"; break; - case EOpConstructIMat4x4: out.debug << "Construct imat4"; break; - case EOpConstructUMat2x2: out.debug << "Construct umat2"; break; - case EOpConstructUMat2x3: out.debug << "Construct umat2x3"; break; - case EOpConstructUMat2x4: out.debug << "Construct umat2x4"; break; - case EOpConstructUMat3x2: out.debug << "Construct umat3x2"; break; - case EOpConstructUMat3x3: out.debug << "Construct umat3"; break; - case EOpConstructUMat3x4: out.debug << "Construct umat3x4"; break; - case EOpConstructUMat4x2: out.debug << "Construct umat4x2"; break; - case EOpConstructUMat4x3: out.debug << "Construct umat4x3"; break; - case EOpConstructUMat4x4: out.debug << "Construct umat4"; break; - case EOpConstructBMat2x2: out.debug << "Construct bmat2"; break; - case EOpConstructBMat2x3: out.debug << "Construct bmat2x3"; break; - case EOpConstructBMat2x4: out.debug << "Construct bmat2x4"; break; - case EOpConstructBMat3x2: out.debug << "Construct bmat3x2"; break; - case EOpConstructBMat3x3: out.debug << "Construct bmat3"; break; - case EOpConstructBMat3x4: out.debug << "Construct bmat3x4"; break; - case EOpConstructBMat4x2: out.debug << "Construct bmat4x2"; break; - case EOpConstructBMat4x3: out.debug << "Construct bmat4x3"; break; - case EOpConstructBMat4x4: out.debug << "Construct bmat4"; break; -#ifdef AMD_EXTENSIONS - case EOpConstructFloat16: out.debug << "Construct float16_t"; break; - case EOpConstructF16Vec2: out.debug << "Construct f16vec2"; break; - case EOpConstructF16Vec3: out.debug << "Construct f16vec3"; break; - case EOpConstructF16Vec4: out.debug << "Construct f16vec4"; break; - case EOpConstructF16Mat2x2: out.debug << "Construct f16mat2"; break; - case EOpConstructF16Mat2x3: out.debug << "Construct f16mat2x3"; break; - case EOpConstructF16Mat2x4: out.debug << "Construct f16mat2x4"; break; - case EOpConstructF16Mat3x2: out.debug << "Construct f16mat3x2"; break; - case EOpConstructF16Mat3x3: out.debug << "Construct f16mat3"; break; - case EOpConstructF16Mat3x4: out.debug << "Construct f16mat3x4"; break; - case EOpConstructF16Mat4x2: out.debug << "Construct f16mat4x2"; break; - case EOpConstructF16Mat4x3: out.debug << "Construct f16mat4x3"; break; - case EOpConstructF16Mat4x4: out.debug << "Construct f16mat4"; break; -#endif - case EOpConstructStruct: out.debug << "Construct structure"; break; - case EOpConstructTextureSampler: out.debug << "Construct combined texture-sampler"; break; - - case EOpLessThan: out.debug << "Compare Less Than"; break; - case EOpGreaterThan: out.debug << "Compare Greater Than"; break; - case EOpLessThanEqual: out.debug << "Compare Less Than or Equal"; break; - case EOpGreaterThanEqual: out.debug << "Compare Greater Than or Equal"; break; - case EOpVectorEqual: out.debug << "Equal"; break; - case EOpVectorNotEqual: out.debug << "NotEqual"; break; - - case EOpMod: out.debug << "mod"; break; - case EOpModf: out.debug << "modf"; break; - case EOpPow: out.debug << "pow"; break; - - case EOpAtan: out.debug << "arc tangent"; break; - - case EOpMin: out.debug << "min"; break; - case EOpMax: out.debug << "max"; break; - case EOpClamp: out.debug << "clamp"; break; - case EOpMix: out.debug << "mix"; break; - case EOpStep: out.debug << "step"; break; - case EOpSmoothStep: out.debug << "smoothstep"; break; - - case EOpDistance: out.debug << "distance"; break; - case EOpDot: out.debug << "dot-product"; break; - case EOpCross: out.debug << "cross-product"; break; - case EOpFaceForward: out.debug << "face-forward"; break; - case EOpReflect: out.debug << "reflect"; break; - case EOpRefract: out.debug << "refract"; break; - case EOpMul: out.debug << "component-wise multiply"; break; - case EOpOuterProduct: out.debug << "outer product"; break; - - case EOpEmitVertex: out.debug << "EmitVertex"; break; - case EOpEndPrimitive: out.debug << "EndPrimitive"; break; - - case EOpBarrier: out.debug << "Barrier"; break; - case EOpMemoryBarrier: out.debug << "MemoryBarrier"; break; - case EOpMemoryBarrierAtomicCounter: out.debug << "MemoryBarrierAtomicCounter"; break; - case EOpMemoryBarrierBuffer: out.debug << "MemoryBarrierBuffer"; break; - case EOpMemoryBarrierImage: out.debug << "MemoryBarrierImage"; break; - case EOpMemoryBarrierShared: out.debug << "MemoryBarrierShared"; break; - case EOpGroupMemoryBarrier: out.debug << "GroupMemoryBarrier"; break; - - case EOpReadInvocation: out.debug << "readInvocation"; break; - -#ifdef AMD_EXTENSIONS - case EOpSwizzleInvocations: out.debug << "swizzleInvocations"; break; - case EOpSwizzleInvocationsMasked: out.debug << "swizzleInvocationsMasked"; break; - case EOpWriteInvocation: out.debug << "writeInvocation"; break; - - case EOpMin3: out.debug << "min3"; break; - case EOpMax3: out.debug << "max3"; break; - case EOpMid3: out.debug << "mid3"; break; - - case EOpTime: out.debug << "time"; break; -#endif - - case EOpAtomicAdd: out.debug << "AtomicAdd"; break; - case EOpAtomicMin: out.debug << "AtomicMin"; break; - case EOpAtomicMax: out.debug << "AtomicMax"; break; - case EOpAtomicAnd: out.debug << "AtomicAnd"; break; - case EOpAtomicOr: out.debug << "AtomicOr"; break; - case EOpAtomicXor: out.debug << "AtomicXor"; break; - case EOpAtomicExchange: out.debug << "AtomicExchange"; break; - case EOpAtomicCompSwap: out.debug << "AtomicCompSwap"; break; - - case EOpAtomicCounterAdd: out.debug << "AtomicCounterAdd"; break; - case EOpAtomicCounterSubtract: out.debug << "AtomicCounterSubtract"; break; - case EOpAtomicCounterMin: out.debug << "AtomicCounterMin"; break; - case EOpAtomicCounterMax: out.debug << "AtomicCounterMax"; break; - case EOpAtomicCounterAnd: out.debug << "AtomicCounterAnd"; break; - case EOpAtomicCounterOr: out.debug << "AtomicCounterOr"; break; - case EOpAtomicCounterXor: out.debug << "AtomicCounterXor"; break; - case EOpAtomicCounterExchange: out.debug << "AtomicCounterExchange"; break; - case EOpAtomicCounterCompSwap: out.debug << "AtomicCounterCompSwap"; break; - - case EOpImageQuerySize: out.debug << "imageQuerySize"; break; - case EOpImageQuerySamples: out.debug << "imageQuerySamples"; break; - case EOpImageLoad: out.debug << "imageLoad"; break; - case EOpImageStore: out.debug << "imageStore"; break; - case EOpImageAtomicAdd: out.debug << "imageAtomicAdd"; break; - case EOpImageAtomicMin: out.debug << "imageAtomicMin"; break; - case EOpImageAtomicMax: out.debug << "imageAtomicMax"; break; - case EOpImageAtomicAnd: out.debug << "imageAtomicAnd"; break; - case EOpImageAtomicOr: out.debug << "imageAtomicOr"; break; - case EOpImageAtomicXor: out.debug << "imageAtomicXor"; break; - case EOpImageAtomicExchange: out.debug << "imageAtomicExchange"; break; - case EOpImageAtomicCompSwap: out.debug << "imageAtomicCompSwap"; break; -#ifdef AMD_EXTENSIONS - case EOpImageLoadLod: out.debug << "imageLoadLod"; break; - case EOpImageStoreLod: out.debug << "imageStoreLod"; break; -#endif - - case EOpTextureQuerySize: out.debug << "textureSize"; break; - case EOpTextureQueryLod: out.debug << "textureQueryLod"; break; - case EOpTextureQueryLevels: out.debug << "textureQueryLevels"; break; - case EOpTextureQuerySamples: out.debug << "textureSamples"; break; - case EOpTexture: out.debug << "texture"; break; - case EOpTextureProj: out.debug << "textureProj"; break; - case EOpTextureLod: out.debug << "textureLod"; break; - case EOpTextureOffset: out.debug << "textureOffset"; break; - case EOpTextureFetch: out.debug << "textureFetch"; break; - case EOpTextureFetchOffset: out.debug << "textureFetchOffset"; break; - case EOpTextureProjOffset: out.debug << "textureProjOffset"; break; - case EOpTextureLodOffset: out.debug << "textureLodOffset"; break; - case EOpTextureProjLod: out.debug << "textureProjLod"; break; - case EOpTextureProjLodOffset: out.debug << "textureProjLodOffset"; break; - case EOpTextureGrad: out.debug << "textureGrad"; break; - case EOpTextureGradOffset: out.debug << "textureGradOffset"; break; - case EOpTextureProjGrad: out.debug << "textureProjGrad"; break; - case EOpTextureProjGradOffset: out.debug << "textureProjGradOffset"; break; - case EOpTextureGather: out.debug << "textureGather"; break; - case EOpTextureGatherOffset: out.debug << "textureGatherOffset"; break; - case EOpTextureGatherOffsets: out.debug << "textureGatherOffsets"; break; - case EOpTextureClamp: out.debug << "textureClamp"; break; - case EOpTextureOffsetClamp: out.debug << "textureOffsetClamp"; break; - case EOpTextureGradClamp: out.debug << "textureGradClamp"; break; - case EOpTextureGradOffsetClamp: out.debug << "textureGradOffsetClamp"; break; -#ifdef AMD_EXTENSIONS - case EOpTextureGatherLod: out.debug << "textureGatherLod"; break; - case EOpTextureGatherLodOffset: out.debug << "textureGatherLodOffset"; break; - case EOpTextureGatherLodOffsets: out.debug << "textureGatherLodOffsets"; break; -#endif - - case EOpSparseTexture: out.debug << "sparseTexture"; break; - case EOpSparseTextureOffset: out.debug << "sparseTextureOffset"; break; - case EOpSparseTextureLod: out.debug << "sparseTextureLod"; break; - case EOpSparseTextureLodOffset: out.debug << "sparseTextureLodOffset"; break; - case EOpSparseTextureFetch: out.debug << "sparseTexelFetch"; break; - case EOpSparseTextureFetchOffset: out.debug << "sparseTexelFetchOffset"; break; - case EOpSparseTextureGrad: out.debug << "sparseTextureGrad"; break; - case EOpSparseTextureGradOffset: out.debug << "sparseTextureGradOffset"; break; - case EOpSparseTextureGather: out.debug << "sparseTextureGather"; break; - case EOpSparseTextureGatherOffset: out.debug << "sparseTextureGatherOffset"; break; - case EOpSparseTextureGatherOffsets: out.debug << "sparseTextureGatherOffsets"; break; - case EOpSparseImageLoad: out.debug << "sparseImageLoad"; break; - case EOpSparseTextureClamp: out.debug << "sparseTextureClamp"; break; - case EOpSparseTextureOffsetClamp: out.debug << "sparseTextureOffsetClamp"; break; - case EOpSparseTextureGradClamp: out.debug << "sparseTextureGradClamp"; break; - case EOpSparseTextureGradOffsetClamp: out.debug << "sparseTextureGradOffsetClam"; break; -#ifdef AMD_EXTENSIONS - case EOpSparseTextureGatherLod: out.debug << "sparseTextureGatherLod"; break; - case EOpSparseTextureGatherLodOffset: out.debug << "sparseTextureGatherLodOffset"; break; - case EOpSparseTextureGatherLodOffsets: out.debug << "sparseTextureGatherLodOffsets"; break; - case EOpSparseImageLoadLod: out.debug << "sparseImageLoadLod"; break; -#endif - - case EOpAddCarry: out.debug << "addCarry"; break; - case EOpSubBorrow: out.debug << "subBorrow"; break; - case EOpUMulExtended: out.debug << "uMulExtended"; break; - case EOpIMulExtended: out.debug << "iMulExtended"; break; - case EOpBitfieldExtract: out.debug << "bitfieldExtract"; break; - case EOpBitfieldInsert: out.debug << "bitfieldInsert"; break; - - case EOpFma: out.debug << "fma"; break; - case EOpFrexp: out.debug << "frexp"; break; - case EOpLdexp: out.debug << "ldexp"; break; - - case EOpInterpolateAtSample: out.debug << "interpolateAtSample"; break; - case EOpInterpolateAtOffset: out.debug << "interpolateAtOffset"; break; -#ifdef AMD_EXTENSIONS - case EOpInterpolateAtVertex: out.debug << "interpolateAtVertex"; break; -#endif - - case EOpSinCos: out.debug << "sincos"; break; - case EOpGenMul: out.debug << "mul"; break; - - case EOpAllMemoryBarrierWithGroupSync: out.debug << "AllMemoryBarrierWithGroupSync"; break; - case EOpDeviceMemoryBarrier: out.debug << "DeviceMemoryBarrier"; break; - case EOpDeviceMemoryBarrierWithGroupSync: out.debug << "DeviceMemoryBarrierWithGroupSync"; break; - case EOpWorkgroupMemoryBarrier: out.debug << "WorkgroupMemoryBarrier"; break; - case EOpWorkgroupMemoryBarrierWithGroupSync: out.debug << "WorkgroupMemoryBarrierWithGroupSync"; break; - - case EOpSubpassLoad: out.debug << "subpassLoad"; break; - case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break; - - default: out.debug.message(EPrefixError, "Bad aggregation op"); - } - - if (node->getOp() != EOpSequence && node->getOp() != EOpParameters) - out.debug << " (" << node->getCompleteString() << ")"; - - out.debug << "\n"; - - return true; -} - -bool TOutputTraverser::visitSelection(TVisit /* visit */, TIntermSelection* node) -{ - TInfoSink& out = infoSink; - - OutputTreeText(out, node, depth); - - out.debug << "Test condition and select"; - out.debug << " (" << node->getCompleteString() << ")\n"; - - ++depth; - - OutputTreeText(out, node, depth); - out.debug << "Condition\n"; - node->getCondition()->traverse(this); - - OutputTreeText(out, node, depth); - if (node->getTrueBlock()) { - out.debug << "true case\n"; - node->getTrueBlock()->traverse(this); - } else - out.debug << "true case is null\n"; - - if (node->getFalseBlock()) { - OutputTreeText(out, node, depth); - out.debug << "false case\n"; - node->getFalseBlock()->traverse(this); - } - - --depth; - - return false; -} - -static void OutputConstantUnion(TInfoSink& out, const TIntermTyped* node, const TConstUnionArray& constUnion, int depth) -{ - int size = node->getType().computeNumComponents(); - - for (int i = 0; i < size; i++) { - OutputTreeText(out, node, depth); - switch (constUnion[i].getType()) { - case EbtBool: - if (constUnion[i].getBConst()) - out.debug << "true"; - else - out.debug << "false"; - - out.debug << " (" << "const bool" << ")"; - - out.debug << "\n"; - break; - case EbtFloat: - case EbtDouble: -#ifdef AMD_EXTENSIONS - case EbtFloat16: -#endif - { - const double value = constUnion[i].getDConst(); - // Print infinities and NaNs in a portable way. - if (IsInfinity(value)) { - if (value < 0) - out.debug << "-1.#INF\n"; - else - out.debug << "+1.#INF\n"; - } else if (IsNan(value)) - out.debug << "1.#IND\n"; - else { - const int maxSize = 300; - char buf[maxSize]; - snprintf(buf, maxSize, "%f", value); - - out.debug << buf << "\n"; - } - } - break; - case EbtInt: - { - const int maxSize = 300; - char buf[maxSize]; - snprintf(buf, maxSize, "%d (%s)", constUnion[i].getIConst(), "const int"); - - out.debug << buf << "\n"; - } - break; - case EbtUint: - { - const int maxSize = 300; - char buf[maxSize]; - snprintf(buf, maxSize, "%u (%s)", constUnion[i].getUConst(), "const uint"); - - out.debug << buf << "\n"; - } - break; - case EbtInt64: - { - const int maxSize = 300; - char buf[maxSize]; - snprintf(buf, maxSize, "%lld (%s)", constUnion[i].getI64Const(), "const int64_t"); - - out.debug << buf << "\n"; - } - break; - case EbtUint64: - { - const int maxSize = 300; - char buf[maxSize]; - snprintf(buf, maxSize, "%llu (%s)", constUnion[i].getU64Const(), "const uint64_t"); - - out.debug << buf << "\n"; - } - break; -#ifdef AMD_EXTENSIONS - case EbtInt16: - { - const int maxSize = 300; - char buf[maxSize]; - snprintf(buf, maxSize, "%d (%s)", constUnion[i].getIConst(), "const int16_t"); - - out.debug << buf << "\n"; - } - break; - case EbtUint16: - { - const int maxSize = 300; - char buf[maxSize]; - snprintf(buf, maxSize, "%u (%s)", constUnion[i].getUConst(), "const uint16_t"); - - out.debug << buf << "\n"; - } - break; -#endif - default: - out.info.message(EPrefixInternalError, "Unknown constant", node->getLoc()); - break; - } - } -} - -void TOutputTraverser::visitConstantUnion(TIntermConstantUnion* node) -{ - OutputTreeText(infoSink, node, depth); - infoSink.debug << "Constant:\n"; - - OutputConstantUnion(infoSink, node, node->getConstArray(), depth + 1); -} - -void TOutputTraverser::visitSymbol(TIntermSymbol* node) -{ - OutputTreeText(infoSink, node, depth); - - infoSink.debug << "'" << node->getName() << "' (" << node->getCompleteString() << ")\n"; - - if (! node->getConstArray().empty()) - OutputConstantUnion(infoSink, node, node->getConstArray(), depth + 1); - else if (node->getConstSubtree()) { - incrementDepth(node); - node->getConstSubtree()->traverse(this); - decrementDepth(); - } -} - -bool TOutputTraverser::visitLoop(TVisit /* visit */, TIntermLoop* node) -{ - TInfoSink& out = infoSink; - - OutputTreeText(out, node, depth); - - out.debug << "Loop with condition "; - if (! node->testFirst()) - out.debug << "not "; - out.debug << "tested first\n"; - - ++depth; - - OutputTreeText(infoSink, node, depth); - if (node->getTest()) { - out.debug << "Loop Condition\n"; - node->getTest()->traverse(this); - } else - out.debug << "No loop condition\n"; - - OutputTreeText(infoSink, node, depth); - if (node->getBody()) { - out.debug << "Loop Body\n"; - node->getBody()->traverse(this); - } else - out.debug << "No loop body\n"; - - if (node->getTerminal()) { - OutputTreeText(infoSink, node, depth); - out.debug << "Loop Terminal Expression\n"; - node->getTerminal()->traverse(this); - } - - --depth; - - return false; -} - -bool TOutputTraverser::visitBranch(TVisit /* visit*/, TIntermBranch* node) -{ - TInfoSink& out = infoSink; - - OutputTreeText(out, node, depth); - - switch (node->getFlowOp()) { - case EOpKill: out.debug << "Branch: Kill"; break; - case EOpBreak: out.debug << "Branch: Break"; break; - case EOpContinue: out.debug << "Branch: Continue"; break; - case EOpReturn: out.debug << "Branch: Return"; break; - case EOpCase: out.debug << "case: "; break; - case EOpDefault: out.debug << "default: "; break; - default: out.debug << "Branch: Unknown Branch"; break; - } - - if (node->getExpression()) { - out.debug << " with expression\n"; - ++depth; - node->getExpression()->traverse(this); - --depth; - } else - out.debug << "\n"; - - return false; -} - -bool TOutputTraverser::visitSwitch(TVisit /* visit */, TIntermSwitch* node) -{ - TInfoSink& out = infoSink; - - OutputTreeText(out, node, depth); - out.debug << "switch\n"; - - OutputTreeText(out, node, depth); - out.debug << "condition\n"; - ++depth; - node->getCondition()->traverse(this); - - --depth; - OutputTreeText(out, node, depth); - out.debug << "body\n"; - ++depth; - node->getBody()->traverse(this); - - --depth; - - return false; -} - -// -// This function is the one to call externally to start the traversal. -// Individual functions can be initialized to 0 to skip processing of that -// type of node. It's children will still be processed. -// -void TIntermediate::output(TInfoSink& infoSink, bool tree) -{ - infoSink.debug << "Shader version: " << version << "\n"; - if (requestedExtensions.size() > 0) { - for (auto extIt = requestedExtensions.begin(); extIt != requestedExtensions.end(); ++extIt) - infoSink.debug << "Requested " << *extIt << "\n"; - } - - if (xfbMode) - infoSink.debug << "in xfb mode\n"; - - switch (language) { - case EShLangVertex: - break; - - case EShLangTessControl: - infoSink.debug << "vertices = " << vertices << "\n"; - - if (inputPrimitive != ElgNone) - infoSink.debug << "input primitive = " << TQualifier::getGeometryString(inputPrimitive) << "\n"; - if (vertexSpacing != EvsNone) - infoSink.debug << "vertex spacing = " << TQualifier::getVertexSpacingString(vertexSpacing) << "\n"; - if (vertexOrder != EvoNone) - infoSink.debug << "triangle order = " << TQualifier::getVertexOrderString(vertexOrder) << "\n"; - break; - - case EShLangTessEvaluation: - infoSink.debug << "input primitive = " << TQualifier::getGeometryString(inputPrimitive) << "\n"; - infoSink.debug << "vertex spacing = " << TQualifier::getVertexSpacingString(vertexSpacing) << "\n"; - infoSink.debug << "triangle order = " << TQualifier::getVertexOrderString(vertexOrder) << "\n"; - if (pointMode) - infoSink.debug << "using point mode\n"; - break; - - case EShLangGeometry: - infoSink.debug << "invocations = " << invocations << "\n"; - infoSink.debug << "max_vertices = " << vertices << "\n"; - infoSink.debug << "input primitive = " << TQualifier::getGeometryString(inputPrimitive) << "\n"; - infoSink.debug << "output primitive = " << TQualifier::getGeometryString(outputPrimitive) << "\n"; - break; - - case EShLangFragment: - if (pixelCenterInteger) - infoSink.debug << "gl_FragCoord pixel center is integer\n"; - if (originUpperLeft) - infoSink.debug << "gl_FragCoord origin is upper left\n"; - if (earlyFragmentTests) - infoSink.debug << "using early_fragment_tests\n"; - if (postDepthCoverage) - infoSink.debug << "using post_depth_coverage\n"; - if (depthLayout != EldNone) - infoSink.debug << "using " << TQualifier::getLayoutDepthString(depthLayout) << "\n"; - if (blendEquations != 0) { - infoSink.debug << "using"; - // blendEquations is a mask, decode it - for (TBlendEquationShift be = (TBlendEquationShift)0; be < EBlendCount; be = (TBlendEquationShift)(be + 1)) { - if (blendEquations & (1 << be)) - infoSink.debug << " " << TQualifier::getBlendEquationString(be); - } - infoSink.debug << "\n"; - } - break; - - case EShLangCompute: - infoSink.debug << "local_size = (" << localSize[0] << ", " << localSize[1] << ", " << localSize[2] << ")\n"; - { - if (localSizeSpecId[0] != TQualifier::layoutNotSet || - localSizeSpecId[1] != TQualifier::layoutNotSet || - localSizeSpecId[2] != TQualifier::layoutNotSet) { - infoSink.debug << "local_size ids = (" << - localSizeSpecId[0] << ", " << - localSizeSpecId[1] << ", " << - localSizeSpecId[2] << ")\n"; - } - } - break; - - default: - break; - } - - if (treeRoot == 0 || ! tree) - return; - - TOutputTraverser it(infoSink); - - treeRoot->traverse(&it); -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/iomapper.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/iomapper.cpp deleted file mode 100644 index a7d9d91d..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/iomapper.cpp +++ /dev/null @@ -1,778 +0,0 @@ -// -// Copyright (C) 2016-2017 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#include "../Include/Common.h" -#include "../Include/InfoSink.h" -#include "iomapper.h" -#include "LiveTraverser.h" -#include "localintermediate.h" - -#include "gl_types.h" - -#include -#include - -// -// Map IO bindings. -// -// High-level algorithm for one stage: -// -// 1. Traverse all code (live+dead) to find the explicitly provided bindings. -// -// 2. Traverse (just) the live code to determine which non-provided bindings -// require auto-numbering. We do not auto-number dead ones. -// -// 3. Traverse all the code to apply the bindings: -// a. explicitly given bindings are offset according to their type -// b. implicit live bindings are auto-numbered into the holes, using -// any open binding slot. -// c. implicit dead bindings are left un-bound. -// - - -namespace glslang { - -struct TVarEntryInfo -{ - int id; - TIntermSymbol* symbol; - bool live; - int newBinding; - int newSet; - int newLocation; - int newComponent; - int newIndex; - - struct TOrderById - { - inline bool operator()(const TVarEntryInfo& l, const TVarEntryInfo& r) - { - return l.id < r.id; - } - }; - - struct TOrderByPriority - { - // ordering: - // 1) has both binding and set - // 2) has binding but no set - // 3) has no binding but set - // 4) has no binding and no set - inline bool operator()(const TVarEntryInfo& l, const TVarEntryInfo& r) - { - const TQualifier& lq = l.symbol->getQualifier(); - const TQualifier& rq = r.symbol->getQualifier(); - - // simple rules: - // has binding gives 2 points - // has set gives 1 point - // who has the most points is more important. - int lPoints = (lq.hasBinding() ? 2 : 0) + (lq.hasSet() ? 1 : 0); - int rPoints = (rq.hasBinding() ? 2 : 0) + (rq.hasSet() ? 1 : 0); - - if (lPoints == rPoints) - return l.id < r.id; - return lPoints > rPoints; - } - }; -}; - - - -typedef std::vector TVarLiveMap; - -class TVarGatherTraverser : public TLiveTraverser -{ -public: - TVarGatherTraverser(const TIntermediate& i, bool traverseDeadCode, TVarLiveMap& inList, TVarLiveMap& outList, TVarLiveMap& uniformList) - : TLiveTraverser(i, traverseDeadCode, true, true, false) - , inputList(inList) - , outputList(outList) - , uniformList(uniformList) - { - } - - - virtual void visitSymbol(TIntermSymbol* base) - { - TVarLiveMap* target = nullptr; - if (base->getQualifier().storage == EvqVaryingIn) - target = &inputList; - else if (base->getQualifier().storage == EvqVaryingOut) - target = &outputList; - else if (base->getQualifier().isUniformOrBuffer()) - target = &uniformList; - - if (target) { - TVarEntryInfo ent = { base->getId(), base, !traverseAll }; - TVarLiveMap::iterator at = std::lower_bound(target->begin(), target->end(), ent, TVarEntryInfo::TOrderById()); - if (at != target->end() && at->id == ent.id) - at->live = at->live || !traverseAll; // update live state - else - target->insert(at, ent); - } - } - -private: - TVarLiveMap& inputList; - TVarLiveMap& outputList; - TVarLiveMap& uniformList; -}; - -class TVarSetTraverser : public TLiveTraverser -{ -public: - TVarSetTraverser(const TIntermediate& i, const TVarLiveMap& inList, const TVarLiveMap& outList, const TVarLiveMap& uniformList) - : TLiveTraverser(i, true, true, true, false) - , inputList(inList) - , outputList(outList) - , uniformList(uniformList) - { - } - - - virtual void visitSymbol(TIntermSymbol* base) - { - const TVarLiveMap* source; - if (base->getQualifier().storage == EvqVaryingIn) - source = &inputList; - else if (base->getQualifier().storage == EvqVaryingOut) - source = &outputList; - else if (base->getQualifier().isUniformOrBuffer()) - source = &uniformList; - else - return; - - TVarEntryInfo ent = { base->getId() }; - TVarLiveMap::const_iterator at = std::lower_bound(source->begin(), source->end(), ent, TVarEntryInfo::TOrderById()); - if (at == source->end()) - return; - - if (at->id != ent.id) - return; - - if (at->newBinding != -1) - base->getWritableType().getQualifier().layoutBinding = at->newBinding; - if (at->newSet != -1) - base->getWritableType().getQualifier().layoutSet = at->newSet; - if (at->newLocation != -1) - base->getWritableType().getQualifier().layoutLocation = at->newLocation; - if (at->newComponent != -1) - base->getWritableType().getQualifier().layoutComponent = at->newComponent; - if (at->newIndex != -1) - base->getWritableType().getQualifier().layoutIndex = at->newIndex; - } - - private: - const TVarLiveMap& inputList; - const TVarLiveMap& outputList; - const TVarLiveMap& uniformList; -}; - -struct TNotifyUniformAdaptor -{ - EShLanguage stage; - TIoMapResolver& resolver; - inline TNotifyUniformAdaptor(EShLanguage s, TIoMapResolver& r) - : stage(s) - , resolver(r) - { - } - inline void operator()(TVarEntryInfo& ent) - { - resolver.notifyBinding(stage, ent.symbol->getName().c_str(), ent.symbol->getType(), ent.live); - } -private: - TNotifyUniformAdaptor& operator=(TNotifyUniformAdaptor&); -}; - -struct TNotifyInOutAdaptor -{ - EShLanguage stage; - TIoMapResolver& resolver; - inline TNotifyInOutAdaptor(EShLanguage s, TIoMapResolver& r) - : stage(s) - , resolver(r) - { - } - inline void operator()(TVarEntryInfo& ent) - { - resolver.notifyInOut(stage, ent.symbol->getName().c_str(), ent.symbol->getType(), ent.live); - } -private: - TNotifyInOutAdaptor& operator=(TNotifyInOutAdaptor&); -}; - -struct TResolverUniformAdaptor -{ - TResolverUniformAdaptor(EShLanguage s, TIoMapResolver& r, TInfoSink& i, bool& e, TIntermediate& interm) - : stage(s) - , resolver(r) - , infoSink(i) - , error(e) - , intermediate(interm) - { - } - - inline void operator()(TVarEntryInfo& ent) - { - ent.newLocation = -1; - ent.newComponent = -1; - ent.newBinding = -1; - ent.newSet = -1; - ent.newIndex = -1; - const bool isValid = resolver.validateBinding(stage, ent.symbol->getName().c_str(), ent.symbol->getType(), - ent.live); - if (isValid) { - ent.newBinding = resolver.resolveBinding(stage, ent.symbol->getName().c_str(), ent.symbol->getType(), - ent.live); - ent.newSet = resolver.resolveSet(stage, ent.symbol->getName().c_str(), ent.symbol->getType(), ent.live); - ent.newLocation = resolver.resolveUniformLocation(stage, ent.symbol->getName().c_str(), - ent.symbol->getType(), ent.live); - - if (ent.newBinding != -1) { - if (ent.newBinding >= int(TQualifier::layoutBindingEnd)) { - TString err = "mapped binding out of range: " + ent.symbol->getName(); - - infoSink.info.message(EPrefixInternalError, err.c_str()); - error = true; - } - } - if (ent.newSet != -1) { - if (ent.newSet >= int(TQualifier::layoutSetEnd)) { - TString err = "mapped set out of range: " + ent.symbol->getName(); - - infoSink.info.message(EPrefixInternalError, err.c_str()); - error = true; - } - } - } else { - TString errorMsg = "Invalid binding: " + ent.symbol->getName(); - infoSink.info.message(EPrefixInternalError, errorMsg.c_str()); - error = true; - } - } - - EShLanguage stage; - TIoMapResolver& resolver; - TInfoSink& infoSink; - bool& error; - TIntermediate& intermediate; - -private: - TResolverUniformAdaptor& operator=(TResolverUniformAdaptor&); -}; - -struct TResolverInOutAdaptor -{ - TResolverInOutAdaptor(EShLanguage s, TIoMapResolver& r, TInfoSink& i, bool& e, TIntermediate& interm) - : stage(s) - , resolver(r) - , infoSink(i) - , error(e) - , intermediate(interm) - { - } - - inline void operator()(TVarEntryInfo& ent) - { - ent.newLocation = -1; - ent.newComponent = -1; - ent.newBinding = -1; - ent.newSet = -1; - ent.newIndex = -1; - const bool isValid = resolver.validateInOut(stage, - ent.symbol->getName().c_str(), - ent.symbol->getType(), - ent.live); - if (isValid) { - ent.newLocation = resolver.resolveInOutLocation(stage, - ent.symbol->getName().c_str(), - ent.symbol->getType(), - ent.live); - ent.newComponent = resolver.resolveInOutComponent(stage, - ent.symbol->getName().c_str(), - ent.symbol->getType(), - ent.live); - ent.newIndex = resolver.resolveInOutIndex(stage, - ent.symbol->getName().c_str(), - ent.symbol->getType(), - ent.live); - } else { - TString errorMsg = "Invalid shader In/Out variable semantic: "; - errorMsg += ent.symbol->getType().getQualifier().semanticName; - infoSink.info.message(EPrefixInternalError, errorMsg.c_str()); - error = true; - } - } - - EShLanguage stage; - TIoMapResolver& resolver; - TInfoSink& infoSink; - bool& error; - TIntermediate& intermediate; - -private: - TResolverInOutAdaptor& operator=(TResolverInOutAdaptor&); -}; - -// Base class for shared TIoMapResolver services, used by several derivations. -struct TDefaultIoResolverBase : public glslang::TIoMapResolver -{ - TDefaultIoResolverBase(const TIntermediate &intermediate) : - intermediate(intermediate), - nextUniformLocation(0) - { } - - int getBaseBinding(TResourceType res, unsigned int set) const { - return selectBaseBinding(intermediate.getShiftBinding(res), - intermediate.getShiftBindingForSet(res, set)); - } - - const std::vector& getResourceSetBinding() const { return intermediate.getResourceSetBinding(); } - - bool doAutoBindingMapping() const { return intermediate.getAutoMapBindings(); } - bool doAutoLocationMapping() const { return intermediate.getAutoMapLocations(); } - - typedef std::vector TSlotSet; - typedef std::unordered_map TSlotSetMap; - TSlotSetMap slots; - - TSlotSet::iterator findSlot(int set, int slot) - { - return std::lower_bound(slots[set].begin(), slots[set].end(), slot); - } - - bool checkEmpty(int set, int slot) - { - TSlotSet::iterator at = findSlot(set, slot); - return !(at != slots[set].end() && *at == slot); - } - - int reserveSlot(int set, int slot) - { - TSlotSet::iterator at = findSlot(set, slot); - - // tolerate aliasing, by not double-recording aliases - // (policy about appropriateness of the alias is higher up) - if (at == slots[set].end() || *at != slot) - slots[set].insert(at, slot); - - return slot; - } - - int getFreeSlot(int set, int base) - { - TSlotSet::iterator at = findSlot(set, base); - if (at == slots[set].end()) - return reserveSlot(set, base); - - // look in locksteps, if they not match, then there is a free slot - for (; at != slots[set].end(); ++at, ++base) - if (*at != base) - break; - return reserveSlot(set, base); - } - - virtual bool validateBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool /*is_live*/) override = 0; - - virtual int resolveBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool is_live) override = 0; - - int resolveSet(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool /*is_live*/) override - { - if (type.getQualifier().hasSet()) - return type.getQualifier().layoutSet; - - // If a command line or API option requested a single descriptor set, use that (if not overrided by spaceN) - if (getResourceSetBinding().size() == 1) - return atoi(getResourceSetBinding()[0].c_str()); - - return 0; - } - int resolveUniformLocation(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool /*is_live*/) override - { - // kick out of not doing this - if (!doAutoLocationMapping()) - return -1; - - // no locations added if already present, a built-in variable, a block, or an opaque - if (type.getQualifier().hasLocation() || type.isBuiltIn() || - type.getBasicType() == EbtBlock || type.containsOpaque()) - return -1; - - // no locations on blocks of built-in variables - if (type.isStruct()) { - if (type.getStruct()->size() < 1) - return -1; - if ((*type.getStruct())[0].type->isBuiltIn()) - return -1; - } - - return nextUniformLocation++; - } - bool validateInOut(EShLanguage /*stage*/, const char* /*name*/, const TType& /*type*/, bool /*is_live*/) override - { - return true; - } - int resolveInOutLocation(EShLanguage /*stage*/, const char* /*name*/, const TType& type, bool /*is_live*/) override - { - // kick out of not doing this - if (!doAutoLocationMapping()) - return -1; - - // no locations added if already present, or a built-in variable - if (type.getQualifier().hasLocation() || type.isBuiltIn()) - return -1; - - // no locations on blocks of built-in variables - if (type.isStruct()) { - if (type.getStruct()->size() < 1) - return -1; - if ((*type.getStruct())[0].type->isBuiltIn()) - return -1; - } - - // Placeholder. - // TODO: It would be nice to flesh this out using - // intermediate->computeTypeLocationSize(type), or functions that call it like - // intermediate->addUsedLocation() - // These in turn would want the intermediate, which is not available here, but - // is available in many places, and a lot of copying from it could be saved if - // it were just available. - return 0; - } - int resolveInOutComponent(EShLanguage /*stage*/, const char* /*name*/, const TType& /*type*/, bool /*is_live*/) override - { - return -1; - } - int resolveInOutIndex(EShLanguage /*stage*/, const char* /*name*/, const TType& /*type*/, bool /*is_live*/) override - { - return -1; - } - - void notifyBinding(EShLanguage, const char* /*name*/, const TType&, bool /*is_live*/) override {} - void notifyInOut(EShLanguage, const char* /*name*/, const TType&, bool /*is_live*/) override {} - void endNotifications(EShLanguage) override {} - void beginNotifications(EShLanguage) override {} - void beginResolve(EShLanguage) override {} - void endResolve(EShLanguage) override {} - -protected: - const TIntermediate &intermediate; - int nextUniformLocation; - - // Return descriptor set specific base if there is one, and the generic base otherwise. - int selectBaseBinding(int base, int descriptorSetBase) const { - return descriptorSetBase != -1 ? descriptorSetBase : base; - } - - static int getLayoutSet(const glslang::TType& type) { - if (type.getQualifier().hasSet()) - return type.getQualifier().layoutSet; - else - return 0; - } - - static bool isSamplerType(const glslang::TType& type) { - return type.getBasicType() == glslang::EbtSampler && type.getSampler().isPureSampler(); - } - - static bool isTextureType(const glslang::TType& type) { - return (type.getBasicType() == glslang::EbtSampler && - (type.getSampler().isTexture() || type.getSampler().isSubpass())); - } - - static bool isUboType(const glslang::TType& type) { - return type.getQualifier().storage == EvqUniform; - } -}; - -/* - * Basic implementation of glslang::TIoMapResolver that replaces the - * previous offset behavior. - * It does the same, uses the offsets for the corresponding uniform - * types. Also respects the EOptionAutoMapBindings flag and binds - * them if needed. - */ -/* - * Default resolver - */ -struct TDefaultIoResolver : public TDefaultIoResolverBase -{ - TDefaultIoResolver(const TIntermediate &intermediate) : TDefaultIoResolverBase(intermediate) { } - - bool validateBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& /*type*/, bool /*is_live*/) override - { - return true; - } - - int resolveBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool is_live) override - { - const int set = getLayoutSet(type); - - if (type.getQualifier().hasBinding()) { - if (isImageType(type)) - return reserveSlot(set, getBaseBinding(EResImage, set) + type.getQualifier().layoutBinding); - - if (isTextureType(type)) - return reserveSlot(set, getBaseBinding(EResTexture, set) + type.getQualifier().layoutBinding); - - if (isSsboType(type)) - return reserveSlot(set, getBaseBinding(EResSsbo, set) + type.getQualifier().layoutBinding); - - if (isSamplerType(type)) - return reserveSlot(set, getBaseBinding(EResSampler, set) + type.getQualifier().layoutBinding); - - if (isUboType(type)) - return reserveSlot(set, getBaseBinding(EResUbo, set) + type.getQualifier().layoutBinding); - } else if (is_live && doAutoBindingMapping()) { - // find free slot, the caller did make sure it passes all vars with binding - // first and now all are passed that do not have a binding and needs one - - if (isImageType(type)) - return getFreeSlot(set, getBaseBinding(EResImage, set)); - - if (isTextureType(type)) - return getFreeSlot(set, getBaseBinding(EResTexture, set)); - - if (isSsboType(type)) - return getFreeSlot(set, getBaseBinding(EResSsbo, set)); - - if (isSamplerType(type)) - return getFreeSlot(set, getBaseBinding(EResSampler, set)); - - if (isUboType(type)) - return getFreeSlot(set, getBaseBinding(EResUbo, set)); - } - - return -1; - } - -protected: - static bool isImageType(const glslang::TType& type) { - return type.getBasicType() == glslang::EbtSampler && type.getSampler().isImage(); - } - - static bool isSsboType(const glslang::TType& type) { - return type.getQualifier().storage == EvqBuffer; - } -}; - -/******************************************************************************** -The following IO resolver maps types in HLSL register space, as follows: - -t – for shader resource views (SRV) - TEXTURE1D - TEXTURE1DARRAY - TEXTURE2D - TEXTURE2DARRAY - TEXTURE3D - TEXTURECUBE - TEXTURECUBEARRAY - TEXTURE2DMS - TEXTURE2DMSARRAY - STRUCTUREDBUFFER - BYTEADDRESSBUFFER - BUFFER - TBUFFER - -s – for samplers - SAMPLER - SAMPLER1D - SAMPLER2D - SAMPLER3D - SAMPLERCUBE - SAMPLERSTATE - SAMPLERCOMPARISONSTATE - -u – for unordered access views (UAV) - RWBYTEADDRESSBUFFER - RWSTRUCTUREDBUFFER - APPENDSTRUCTUREDBUFFER - CONSUMESTRUCTUREDBUFFER - RWBUFFER - RWTEXTURE1D - RWTEXTURE1DARRAY - RWTEXTURE2D - RWTEXTURE2DARRAY - RWTEXTURE3D - -b – for constant buffer views (CBV) - CBUFFER - CONSTANTBUFFER - ********************************************************************************/ -struct TDefaultHlslIoResolver : public TDefaultIoResolverBase -{ - TDefaultHlslIoResolver(const TIntermediate &intermediate) : TDefaultIoResolverBase(intermediate) { } - - bool validateBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& /*type*/, bool /*is_live*/) override - { - return true; - } - - int resolveBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool is_live) override - { - const int set = getLayoutSet(type); - - if (type.getQualifier().hasBinding()) { - if (isUavType(type)) - return reserveSlot(set, getBaseBinding(EResUav, set) + type.getQualifier().layoutBinding); - - if (isSrvType(type)) - return reserveSlot(set, getBaseBinding(EResTexture, set) + type.getQualifier().layoutBinding); - - if (isSamplerType(type)) - return reserveSlot(set, getBaseBinding(EResSampler, set) + type.getQualifier().layoutBinding); - - if (isUboType(type)) - return reserveSlot(set, getBaseBinding(EResUbo, set) + type.getQualifier().layoutBinding); - } else if (is_live && doAutoBindingMapping()) { - // find free slot, the caller did make sure it passes all vars with binding - // first and now all are passed that do not have a binding and needs one - - if (isUavType(type)) - return getFreeSlot(set, getBaseBinding(EResUav, set)); - - if (isSrvType(type)) - return getFreeSlot(set, getBaseBinding(EResTexture, set)); - - if (isSamplerType(type)) - return getFreeSlot(set, getBaseBinding(EResSampler, set)); - - if (isUboType(type)) - return getFreeSlot(set, getBaseBinding(EResUbo, set)); - } - - return -1; - } - -protected: - // Return true if this is a SRV (shader resource view) type: - static bool isSrvType(const glslang::TType& type) { - return isTextureType(type) || type.getQualifier().storage == EvqBuffer; - } - - // Return true if this is a UAV (unordered access view) type: - static bool isUavType(const glslang::TType& type) { - if (type.getQualifier().readonly) - return false; - - return (type.getBasicType() == glslang::EbtSampler && type.getSampler().isImage()) || - (type.getQualifier().storage == EvqBuffer); - } -}; - - -// Map I/O variables to provided offsets, and make bindings for -// unbound but live variables. -// -// Returns false if the input is too malformed to do this. -bool TIoMapper::addStage(EShLanguage stage, TIntermediate &intermediate, TInfoSink &infoSink, TIoMapResolver *resolver) -{ - bool somethingToDo = !intermediate.getResourceSetBinding().empty() || - intermediate.getAutoMapBindings() || - intermediate.getAutoMapLocations(); - - for (int res = 0; res < EResCount; ++res) { - somethingToDo = somethingToDo || - (intermediate.getShiftBinding(TResourceType(res)) != 0) || - intermediate.hasShiftBindingForSet(TResourceType(res)); - } - - if (!somethingToDo && resolver == nullptr) - return true; - - if (intermediate.getNumEntryPoints() != 1 || intermediate.isRecursive()) - return false; - - TIntermNode* root = intermediate.getTreeRoot(); - if (root == nullptr) - return false; - - // if no resolver is provided, use the default resolver with the given shifts and auto map settings - TDefaultIoResolver defaultResolver(intermediate); - TDefaultHlslIoResolver defaultHlslResolver(intermediate); - - if (resolver == nullptr) { - // TODO: use a passed in IO mapper for this - if (intermediate.usingHlslIoMapping()) - resolver = &defaultHlslResolver; - else - resolver = &defaultResolver; - } - - TVarLiveMap inVarMap, outVarMap, uniformVarMap; - TVarGatherTraverser iter_binding_all(intermediate, true, inVarMap, outVarMap, uniformVarMap); - TVarGatherTraverser iter_binding_live(intermediate, false, inVarMap, outVarMap, uniformVarMap); - - root->traverse(&iter_binding_all); - iter_binding_live.pushFunction(intermediate.getEntryPointMangledName().c_str()); - - while (!iter_binding_live.functions.empty()) { - TIntermNode* function = iter_binding_live.functions.back(); - iter_binding_live.functions.pop_back(); - function->traverse(&iter_binding_live); - } - - // sort entries by priority. see TVarEntryInfo::TOrderByPriority for info. - std::sort(uniformVarMap.begin(), uniformVarMap.end(), TVarEntryInfo::TOrderByPriority()); - - bool hadError = false; - TNotifyInOutAdaptor inOutNotify(stage, *resolver); - TNotifyUniformAdaptor uniformNotify(stage, *resolver); - TResolverUniformAdaptor uniformResolve(stage, *resolver, infoSink, hadError, intermediate); - TResolverInOutAdaptor inOutResolve(stage, *resolver, infoSink, hadError, intermediate); - resolver->beginNotifications(stage); - std::for_each(inVarMap.begin(), inVarMap.end(), inOutNotify); - std::for_each(outVarMap.begin(), outVarMap.end(), inOutNotify); - std::for_each(uniformVarMap.begin(), uniformVarMap.end(), uniformNotify); - resolver->endNotifications(stage); - resolver->beginResolve(stage); - std::for_each(inVarMap.begin(), inVarMap.end(), inOutResolve); - std::for_each(outVarMap.begin(), outVarMap.end(), inOutResolve); - std::for_each(uniformVarMap.begin(), uniformVarMap.end(), uniformResolve); - resolver->endResolve(stage); - - if (!hadError) { - // sort by id again, so we can use lower bound to find entries - std::sort(uniformVarMap.begin(), uniformVarMap.end(), TVarEntryInfo::TOrderById()); - TVarSetTraverser iter_iomap(intermediate, inVarMap, outVarMap, uniformVarMap); - root->traverse(&iter_iomap); - } - - return !hadError; -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/iomapper.h b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/iomapper.h deleted file mode 100644 index 5e0d4391..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/iomapper.h +++ /dev/null @@ -1,63 +0,0 @@ -// -// Copyright (C) 2016 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#ifndef _IOMAPPER_INCLUDED -#define _IOMAPPER_INCLUDED - -#include "../Public/ShaderLang.h" - -// -// A reflection database and its interface, consistent with the OpenGL API reflection queries. -// - -class TInfoSink; - -namespace glslang { - -class TIntermediate; - -// I/O mapper -class TIoMapper { -public: - TIoMapper() {} - virtual ~TIoMapper() {} - - // grow the reflection stage by stage - bool addStage(EShLanguage, TIntermediate&, TInfoSink&, TIoMapResolver*); -}; - -} // end namespace glslang - -#endif // _IOMAPPER_INCLUDED diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/limits.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/limits.cpp deleted file mode 100644 index 64d191b4..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/limits.cpp +++ /dev/null @@ -1,198 +0,0 @@ -// -// Copyright (C) 2013 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -// -// Do sub tree walks for -// 1) inductive loop bodies to see if the inductive variable is modified -// 2) array-index expressions to see if they are "constant-index-expression" -// -// These are per Appendix A of ES 2.0: -// -// "Within the body of the loop, the loop index is not statically assigned to nor is it used as the -// argument to a function out or inout parameter." -// -// "The following are constant-index-expressions: -// - Constant expressions -// - Loop indices as defined in section 4 -// - Expressions composed of both of the above" -// -// N.B.: assuming the last rule excludes function calls -// - -#include "ParseHelper.h" - -namespace glslang { - -// -// The inductive loop-body traverser. -// -// Just look at things that might modify the loop index. -// - -class TInductiveTraverser : public TIntermTraverser { -public: - TInductiveTraverser(int id, TSymbolTable& st) - : loopId(id), symbolTable(st), bad(false) { } - - virtual bool visitBinary(TVisit, TIntermBinary* node); - virtual bool visitUnary(TVisit, TIntermUnary* node); - virtual bool visitAggregate(TVisit, TIntermAggregate* node); - - int loopId; // unique ID of the symbol that's the loop inductive variable - TSymbolTable& symbolTable; - bool bad; - TSourceLoc badLoc; - -protected: - TInductiveTraverser(TInductiveTraverser&); - TInductiveTraverser& operator=(TInductiveTraverser&); -}; - -// check binary operations for those modifying the loop index -bool TInductiveTraverser::visitBinary(TVisit /* visit */, TIntermBinary* node) -{ - if (node->modifiesState() && node->getLeft()->getAsSymbolNode() && - node->getLeft()->getAsSymbolNode()->getId() == loopId) { - bad = true; - badLoc = node->getLoc(); - } - - return true; -} - -// check unary operations for those modifying the loop index -bool TInductiveTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node) -{ - if (node->modifiesState() && node->getOperand()->getAsSymbolNode() && - node->getOperand()->getAsSymbolNode()->getId() == loopId) { - bad = true; - badLoc = node->getLoc(); - } - - return true; -} - -// check function calls for arguments modifying the loop index -bool TInductiveTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node) -{ - if (node->getOp() == EOpFunctionCall) { - // see if an out or inout argument is the loop index - const TIntermSequence& args = node->getSequence(); - for (int i = 0; i < (int)args.size(); ++i) { - if (args[i]->getAsSymbolNode() && args[i]->getAsSymbolNode()->getId() == loopId) { - TSymbol* function = symbolTable.find(node->getName()); - const TType* type = (*function->getAsFunction())[i].type; - if (type->getQualifier().storage == EvqOut || - type->getQualifier().storage == EvqInOut) { - bad = true; - badLoc = node->getLoc(); - } - } - } - } - - return true; -} - -// -// External function to call for loop check. -// -void TParseContext::inductiveLoopBodyCheck(TIntermNode* body, int loopId, TSymbolTable& symbolTable) -{ - TInductiveTraverser it(loopId, symbolTable); - - if (body == nullptr) - return; - - body->traverse(&it); - - if (it.bad) - error(it.badLoc, "inductive loop index modified", "limitations", ""); -} - -// -// The "constant-index-expression" tranverser. -// -// Just look at things that can form an index. -// - -class TIndexTraverser : public TIntermTraverser { -public: - TIndexTraverser(const TIdSetType& ids) : inductiveLoopIds(ids), bad(false) { } - virtual void visitSymbol(TIntermSymbol* symbol); - virtual bool visitAggregate(TVisit, TIntermAggregate* node); - const TIdSetType& inductiveLoopIds; - bool bad; - TSourceLoc badLoc; - -protected: - TIndexTraverser(TIndexTraverser&); - TIndexTraverser& operator=(TIndexTraverser&); -}; - -// make sure symbols are inductive-loop indexes -void TIndexTraverser::visitSymbol(TIntermSymbol* symbol) -{ - if (inductiveLoopIds.find(symbol->getId()) == inductiveLoopIds.end()) { - bad = true; - badLoc = symbol->getLoc(); - } -} - -// check for function calls, assuming they are bad; spec. doesn't really say -bool TIndexTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node) -{ - if (node->getOp() == EOpFunctionCall) { - bad = true; - badLoc = node->getLoc(); - } - - return true; -} - -// -// External function to call for loop check. -// -void TParseContext::constantIndexExpressionCheck(TIntermNode* index) -{ - TIndexTraverser it(inductiveLoopIds); - - index->traverse(&it); - - if (it.bad) - error(it.badLoc, "Non-constant-index-expression", "limitations", ""); -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/linkValidate.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/linkValidate.cpp deleted file mode 100644 index 9ca1557b..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/linkValidate.cpp +++ /dev/null @@ -1,1242 +0,0 @@ -// -// Copyright (C) 2013 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -// -// Do link-time merging and validation of intermediate representations. -// -// Basic model is that during compilation, each compilation unit (shader) is -// compiled into one TIntermediate instance. Then, at link time, multiple -// units for the same stage can be merged together, which can generate errors. -// Then, after all merging, a single instance of TIntermediate represents -// the whole stage. A final error check can be done on the resulting stage, -// even if no merging was done (i.e., the stage was only one compilation unit). -// - -#include "localintermediate.h" -#include "../Include/InfoSink.h" - -namespace glslang { - -// -// Link-time error emitter. -// -void TIntermediate::error(TInfoSink& infoSink, const char* message) -{ - infoSink.info.prefix(EPrefixError); - infoSink.info << "Linking " << StageName(language) << " stage: " << message << "\n"; - - ++numErrors; -} - -// Link-time warning. -void TIntermediate::warn(TInfoSink& infoSink, const char* message) -{ - infoSink.info.prefix(EPrefixWarning); - infoSink.info << "Linking " << StageName(language) << " stage: " << message << "\n"; -} - -// TODO: 4.4 offset/align: "Two blocks linked together in the same program with the same block -// name must have the exact same set of members qualified with offset and their integral-constant -// expression values must be the same, or a link-time error results." - -// -// Merge the information from 'unit' into 'this' -// -void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit) -{ - if (source == EShSourceNone) - source = unit.source; - - if (source != unit.source) - error(infoSink, "can't link compilation units from different source languages"); - - if (unit.getNumEntryPoints() > 0) { - if (getNumEntryPoints() > 0) - error(infoSink, "can't handle multiple entry points per stage"); - else { - entryPointName = unit.getEntryPointName(); - entryPointMangledName = unit.getEntryPointMangledName(); - } - } - numEntryPoints += unit.getNumEntryPoints(); - numErrors += unit.getNumErrors(); - numPushConstants += unit.numPushConstants; - callGraph.insert(callGraph.end(), unit.callGraph.begin(), unit.callGraph.end()); - - if (originUpperLeft != unit.originUpperLeft || pixelCenterInteger != unit.pixelCenterInteger) - error(infoSink, "gl_FragCoord redeclarations must match across shaders"); - - if (! earlyFragmentTests) - earlyFragmentTests = unit.earlyFragmentTests; - - if (!postDepthCoverage) - postDepthCoverage = unit.postDepthCoverage; - - if (depthLayout == EldNone) - depthLayout = unit.depthLayout; - else if (depthLayout != unit.depthLayout) - error(infoSink, "Contradictory depth layouts"); - - blendEquations |= unit.blendEquations; - - if (inputPrimitive == ElgNone) - inputPrimitive = unit.inputPrimitive; - else if (inputPrimitive != unit.inputPrimitive) - error(infoSink, "Contradictory input layout primitives"); - - if (outputPrimitive == ElgNone) - outputPrimitive = unit.outputPrimitive; - else if (outputPrimitive != unit.outputPrimitive) - error(infoSink, "Contradictory output layout primitives"); - - if (vertices == TQualifier::layoutNotSet) - vertices = unit.vertices; - else if (vertices != unit.vertices) { - if (language == EShLangGeometry) - error(infoSink, "Contradictory layout max_vertices values"); - else if (language == EShLangTessControl) - error(infoSink, "Contradictory layout vertices values"); - else - assert(0); - } - - if (vertexSpacing == EvsNone) - vertexSpacing = unit.vertexSpacing; - else if (vertexSpacing != unit.vertexSpacing) - error(infoSink, "Contradictory input vertex spacing"); - - if (vertexOrder == EvoNone) - vertexOrder = unit.vertexOrder; - else if (vertexOrder != unit.vertexOrder) - error(infoSink, "Contradictory triangle ordering"); - - if (unit.pointMode) - pointMode = true; - - for (int i = 0; i < 3; ++i) { - if (localSize[i] > 1) - localSize[i] = unit.localSize[i]; - else if (localSize[i] != unit.localSize[i]) - error(infoSink, "Contradictory local size"); - - if (localSizeSpecId[i] != TQualifier::layoutNotSet) - localSizeSpecId[i] = unit.localSizeSpecId[i]; - else if (localSizeSpecId[i] != unit.localSizeSpecId[i]) - error(infoSink, "Contradictory local size specialization ids"); - } - - if (unit.xfbMode) - xfbMode = true; - for (size_t b = 0; b < xfbBuffers.size(); ++b) { - if (xfbBuffers[b].stride == TQualifier::layoutXfbStrideEnd) - xfbBuffers[b].stride = unit.xfbBuffers[b].stride; - else if (xfbBuffers[b].stride != unit.xfbBuffers[b].stride) - error(infoSink, "Contradictory xfb_stride"); - xfbBuffers[b].implicitStride = std::max(xfbBuffers[b].implicitStride, unit.xfbBuffers[b].implicitStride); - if (unit.xfbBuffers[b].containsDouble) - xfbBuffers[b].containsDouble = true; - // TODO: 4.4 link: enhanced layouts: compare ranges - } - - if (unit.treeRoot == 0) - return; - - if (treeRoot == 0) { - treeRoot = unit.treeRoot; - version = unit.version; - requestedExtensions = unit.requestedExtensions; - return; - } - - // Getting this far means we have two existing trees to merge... - - version = std::max(version, unit.version); - requestedExtensions.insert(unit.requestedExtensions.begin(), unit.requestedExtensions.end()); - - // Get the top-level globals of each unit - TIntermSequence& globals = treeRoot->getAsAggregate()->getSequence(); - TIntermSequence& unitGlobals = unit.treeRoot->getAsAggregate()->getSequence(); - - // Get the linker-object lists - TIntermSequence& linkerObjects = findLinkerObjects(); - TIntermSequence& unitLinkerObjects = unit.findLinkerObjects(); - - mergeBodies(infoSink, globals, unitGlobals); - mergeLinkerObjects(infoSink, linkerObjects, unitLinkerObjects); - - ioAccessed.insert(unit.ioAccessed.begin(), unit.ioAccessed.end()); -} - -// -// Merge the function bodies and global-level initializers from unitGlobals into globals. -// Will error check duplication of function bodies for the same signature. -// -void TIntermediate::mergeBodies(TInfoSink& infoSink, TIntermSequence& globals, const TIntermSequence& unitGlobals) -{ - // TODO: link-time performance: Processing in alphabetical order will be faster - - // Error check the global objects, not including the linker objects - for (unsigned int child = 0; child < globals.size() - 1; ++child) { - for (unsigned int unitChild = 0; unitChild < unitGlobals.size() - 1; ++unitChild) { - TIntermAggregate* body = globals[child]->getAsAggregate(); - TIntermAggregate* unitBody = unitGlobals[unitChild]->getAsAggregate(); - if (body && unitBody && body->getOp() == EOpFunction && unitBody->getOp() == EOpFunction && body->getName() == unitBody->getName()) { - error(infoSink, "Multiple function bodies in multiple compilation units for the same signature in the same stage:"); - infoSink.info << " " << globals[child]->getAsAggregate()->getName() << "\n"; - } - } - } - - // Merge the global objects, just in front of the linker objects - globals.insert(globals.end() - 1, unitGlobals.begin(), unitGlobals.end() - 1); -} - -// -// Merge the linker objects from unitLinkerObjects into linkerObjects. -// Duplication is expected and filtered out, but contradictions are an error. -// -void TIntermediate::mergeLinkerObjects(TInfoSink& infoSink, TIntermSequence& linkerObjects, const TIntermSequence& unitLinkerObjects) -{ - // Error check and merge the linker objects (duplicates should not be created) - std::size_t initialNumLinkerObjects = linkerObjects.size(); - for (unsigned int unitLinkObj = 0; unitLinkObj < unitLinkerObjects.size(); ++unitLinkObj) { - bool merge = true; - for (std::size_t linkObj = 0; linkObj < initialNumLinkerObjects; ++linkObj) { - TIntermSymbol* symbol = linkerObjects[linkObj]->getAsSymbolNode(); - TIntermSymbol* unitSymbol = unitLinkerObjects[unitLinkObj]->getAsSymbolNode(); - assert(symbol && unitSymbol); - if (symbol->getName() == unitSymbol->getName()) { - // filter out copy - merge = false; - - // but if one has an initializer and the other does not, update - // the initializer - if (symbol->getConstArray().empty() && ! unitSymbol->getConstArray().empty()) - symbol->setConstArray(unitSymbol->getConstArray()); - - // Similarly for binding - if (! symbol->getQualifier().hasBinding() && unitSymbol->getQualifier().hasBinding()) - symbol->getQualifier().layoutBinding = unitSymbol->getQualifier().layoutBinding; - - // Update implicit array sizes - mergeImplicitArraySizes(symbol->getWritableType(), unitSymbol->getType()); - - // Check for consistent types/qualification/initializers etc. - mergeErrorCheck(infoSink, *symbol, *unitSymbol, false); - } - } - if (merge) - linkerObjects.push_back(unitLinkerObjects[unitLinkObj]); - } -} - -// TODO 4.5 link functionality: cull distance array size checking - -// Recursively merge the implicit array sizes through the objects' respective type trees. -void TIntermediate::mergeImplicitArraySizes(TType& type, const TType& unitType) -{ - if (type.isImplicitlySizedArray() && unitType.isArray()) { - int newImplicitArraySize = unitType.isImplicitlySizedArray() ? unitType.getImplicitArraySize() : unitType.getOuterArraySize(); - if (newImplicitArraySize > type.getImplicitArraySize ()) - type.setImplicitArraySize(newImplicitArraySize); - } - - // Type mismatches are caught and reported after this, just be careful for now. - if (! type.isStruct() || ! unitType.isStruct() || type.getStruct()->size() != unitType.getStruct()->size()) - return; - - for (int i = 0; i < (int)type.getStruct()->size(); ++i) - mergeImplicitArraySizes(*(*type.getStruct())[i].type, *(*unitType.getStruct())[i].type); -} - -// -// Compare two global objects from two compilation units and see if they match -// well enough. Rules can be different for intra- vs. cross-stage matching. -// -// This function only does one of intra- or cross-stage matching per call. -// -void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& symbol, const TIntermSymbol& unitSymbol, bool crossStage) -{ - bool writeTypeComparison = false; - - // Types have to match - if (symbol.getType() != unitSymbol.getType()) { - error(infoSink, "Types must match:"); - writeTypeComparison = true; - } - - // Qualifiers have to (almost) match - - // Storage... - if (symbol.getQualifier().storage != unitSymbol.getQualifier().storage) { - error(infoSink, "Storage qualifiers must match:"); - writeTypeComparison = true; - } - - // Precision... - if (symbol.getQualifier().precision != unitSymbol.getQualifier().precision) { - error(infoSink, "Precision qualifiers must match:"); - writeTypeComparison = true; - } - - // Invariance... - if (! crossStage && symbol.getQualifier().invariant != unitSymbol.getQualifier().invariant) { - error(infoSink, "Presence of invariant qualifier must match:"); - writeTypeComparison = true; - } - - // Precise... - if (! crossStage && symbol.getQualifier().noContraction != unitSymbol.getQualifier().noContraction) { - error(infoSink, "Presence of precise qualifier must match:"); - writeTypeComparison = true; - } - - // Auxiliary and interpolation... - if (symbol.getQualifier().centroid != unitSymbol.getQualifier().centroid || - symbol.getQualifier().smooth != unitSymbol.getQualifier().smooth || - symbol.getQualifier().flat != unitSymbol.getQualifier().flat || - symbol.getQualifier().sample != unitSymbol.getQualifier().sample || - symbol.getQualifier().patch != unitSymbol.getQualifier().patch || - symbol.getQualifier().nopersp != unitSymbol.getQualifier().nopersp) { - error(infoSink, "Interpolation and auxiliary storage qualifiers must match:"); - writeTypeComparison = true; - } - - // Memory... - if (symbol.getQualifier().coherent != unitSymbol.getQualifier().coherent || - symbol.getQualifier().volatil != unitSymbol.getQualifier().volatil || - symbol.getQualifier().restrict != unitSymbol.getQualifier().restrict || - symbol.getQualifier().readonly != unitSymbol.getQualifier().readonly || - symbol.getQualifier().writeonly != unitSymbol.getQualifier().writeonly) { - error(infoSink, "Memory qualifiers must match:"); - writeTypeComparison = true; - } - - // Layouts... - // TODO: 4.4 enhanced layouts: Generalize to include offset/align: current spec - // requires separate user-supplied offset from actual computed offset, but - // current implementation only has one offset. - if (symbol.getQualifier().layoutMatrix != unitSymbol.getQualifier().layoutMatrix || - symbol.getQualifier().layoutPacking != unitSymbol.getQualifier().layoutPacking || - symbol.getQualifier().layoutLocation != unitSymbol.getQualifier().layoutLocation || - symbol.getQualifier().layoutComponent != unitSymbol.getQualifier().layoutComponent || - symbol.getQualifier().layoutIndex != unitSymbol.getQualifier().layoutIndex || - symbol.getQualifier().layoutBinding != unitSymbol.getQualifier().layoutBinding || - (symbol.getQualifier().hasBinding() && (symbol.getQualifier().layoutOffset != unitSymbol.getQualifier().layoutOffset))) { - error(infoSink, "Layout qualification must match:"); - writeTypeComparison = true; - } - - // Initializers have to match, if both are present, and if we don't already know the types don't match - if (! writeTypeComparison) { - if (! symbol.getConstArray().empty() && ! unitSymbol.getConstArray().empty()) { - if (symbol.getConstArray() != unitSymbol.getConstArray()) { - error(infoSink, "Initializers must match:"); - infoSink.info << " " << symbol.getName() << "\n"; - } - } - } - - if (writeTypeComparison) - infoSink.info << " " << symbol.getName() << ": \"" << symbol.getType().getCompleteString() << "\" versus \"" << - unitSymbol.getType().getCompleteString() << "\"\n"; -} - -// -// Do final link-time error checking of a complete (merged) intermediate representation. -// (Much error checking was done during merging). -// -// Also, lock in defaults of things not set, including array sizes. -// -void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled) -{ - if (getTreeRoot() == nullptr) - return; - - if (numEntryPoints < 1) { - if (source == EShSourceGlsl) - error(infoSink, "Missing entry point: Each stage requires one entry point"); - else - warn(infoSink, "Entry point not found"); - } - - if (numPushConstants > 1) - error(infoSink, "Only one push_constant block is allowed per stage"); - - // recursion and missing body checking - checkCallGraphCycles(infoSink); - checkCallGraphBodies(infoSink, keepUncalled); - - // overlap/alias/missing I/O, etc. - inOutLocationCheck(infoSink); - - // invocations - if (invocations == TQualifier::layoutNotSet) - invocations = 1; - - if (inIoAccessed("gl_ClipDistance") && inIoAccessed("gl_ClipVertex")) - error(infoSink, "Can only use one of gl_ClipDistance or gl_ClipVertex (gl_ClipDistance is preferred)"); - if (inIoAccessed("gl_CullDistance") && inIoAccessed("gl_ClipVertex")) - error(infoSink, "Can only use one of gl_CullDistance or gl_ClipVertex (gl_ClipDistance is preferred)"); - - if (userOutputUsed() && (inIoAccessed("gl_FragColor") || inIoAccessed("gl_FragData"))) - error(infoSink, "Cannot use gl_FragColor or gl_FragData when using user-defined outputs"); - if (inIoAccessed("gl_FragColor") && inIoAccessed("gl_FragData")) - error(infoSink, "Cannot use both gl_FragColor and gl_FragData"); - - for (size_t b = 0; b < xfbBuffers.size(); ++b) { - if (xfbBuffers[b].containsDouble) - RoundToPow2(xfbBuffers[b].implicitStride, 8); - - // "It is a compile-time or link-time error to have - // any xfb_offset that overflows xfb_stride, whether stated on declarations before or after the xfb_stride, or - // in different compilation units. While xfb_stride can be declared multiple times for the same buffer, it is a - // compile-time or link-time error to have different values specified for the stride for the same buffer." - if (xfbBuffers[b].stride != TQualifier::layoutXfbStrideEnd && xfbBuffers[b].implicitStride > xfbBuffers[b].stride) { - error(infoSink, "xfb_stride is too small to hold all buffer entries:"); - infoSink.info.prefix(EPrefixError); - infoSink.info << " xfb_buffer " << (unsigned int)b << ", xfb_stride " << xfbBuffers[b].stride << ", minimum stride needed: " << xfbBuffers[b].implicitStride << "\n"; - } - if (xfbBuffers[b].stride == TQualifier::layoutXfbStrideEnd) - xfbBuffers[b].stride = xfbBuffers[b].implicitStride; - - // "If the buffer is capturing any - // outputs with double-precision components, the stride must be a multiple of 8, otherwise it must be a - // multiple of 4, or a compile-time or link-time error results." - if (xfbBuffers[b].containsDouble && ! IsMultipleOfPow2(xfbBuffers[b].stride, 8)) { - error(infoSink, "xfb_stride must be multiple of 8 for buffer holding a double:"); - infoSink.info.prefix(EPrefixError); - infoSink.info << " xfb_buffer " << (unsigned int)b << ", xfb_stride " << xfbBuffers[b].stride << "\n"; - } else if (! IsMultipleOfPow2(xfbBuffers[b].stride, 4)) { - error(infoSink, "xfb_stride must be multiple of 4:"); - infoSink.info.prefix(EPrefixError); - infoSink.info << " xfb_buffer " << (unsigned int)b << ", xfb_stride " << xfbBuffers[b].stride << "\n"; - } - - // "The resulting stride (implicit or explicit), when divided by 4, must be less than or equal to the - // implementation-dependent constant gl_MaxTransformFeedbackInterleavedComponents." - if (xfbBuffers[b].stride > (unsigned int)(4 * resources.maxTransformFeedbackInterleavedComponents)) { - error(infoSink, "xfb_stride is too large:"); - infoSink.info.prefix(EPrefixError); - infoSink.info << " xfb_buffer " << (unsigned int)b << ", components (1/4 stride) needed are " << xfbBuffers[b].stride/4 << ", gl_MaxTransformFeedbackInterleavedComponents is " << resources.maxTransformFeedbackInterleavedComponents << "\n"; - } - } - - switch (language) { - case EShLangVertex: - break; - case EShLangTessControl: - if (vertices == TQualifier::layoutNotSet) - error(infoSink, "At least one shader must specify an output layout(vertices=...)"); - break; - case EShLangTessEvaluation: - if (source == EShSourceGlsl) { - if (inputPrimitive == ElgNone) - error(infoSink, "At least one shader must specify an input layout primitive"); - if (vertexSpacing == EvsNone) - vertexSpacing = EvsEqual; - if (vertexOrder == EvoNone) - vertexOrder = EvoCcw; - } - break; - case EShLangGeometry: - if (inputPrimitive == ElgNone) - error(infoSink, "At least one shader must specify an input layout primitive"); - if (outputPrimitive == ElgNone -#ifdef NV_EXTENSIONS - && !getGeoPassthroughEXT() -#endif - ) - error(infoSink, "At least one shader must specify an output layout primitive"); - if (vertices == TQualifier::layoutNotSet -#ifdef NV_EXTENSIONS - && !getGeoPassthroughEXT() -#endif - ) - error(infoSink, "At least one shader must specify a layout(max_vertices = value)"); - break; - case EShLangFragment: - // for GL_ARB_post_depth_coverage, EarlyFragmentTest is set automatically in - // ParseHelper.cpp. So if we reach here, this must be GL_EXT_post_depth_coverage - // requiring explicit early_fragment_tests - if (getPostDepthCoverage() && !getEarlyFragmentTests()) - error(infoSink, "post_depth_coverage requires early_fragment_tests"); - break; - case EShLangCompute: - break; - default: - error(infoSink, "Unknown Stage."); - break; - } - - // Process the tree for any node-specific work. - class TFinalLinkTraverser : public TIntermTraverser { - public: - TFinalLinkTraverser() { } - virtual ~TFinalLinkTraverser() { } - - virtual void visitSymbol(TIntermSymbol* symbol) - { - // Implicitly size arrays. - symbol->getWritableType().adoptImplicitArraySizes(); - } - } finalLinkTraverser; - - treeRoot->traverse(&finalLinkTraverser); -} - -// -// See if the call graph contains any static recursion, which is disallowed -// by the specification. -// -void TIntermediate::checkCallGraphCycles(TInfoSink& infoSink) -{ - // Clear fields we'll use for this. - for (TGraph::iterator call = callGraph.begin(); call != callGraph.end(); ++call) { - call->visited = false; - call->currentPath = false; - call->errorGiven = false; - } - - // - // Loop, looking for a new connected subgraph. One subgraph is handled per loop iteration. - // - - TCall* newRoot; - do { - // See if we have unvisited parts of the graph. - newRoot = 0; - for (TGraph::iterator call = callGraph.begin(); call != callGraph.end(); ++call) { - if (! call->visited) { - newRoot = &(*call); - break; - } - } - - // If not, we are done. - if (! newRoot) - break; - - // Otherwise, we found a new subgraph, process it: - // See what all can be reached by this new root, and if any of - // that is recursive. This is done by depth-first traversals, seeing - // if a new call is found that was already in the currentPath (a back edge), - // thereby detecting recursion. - std::list stack; - newRoot->currentPath = true; // currentPath will be true iff it is on the stack - stack.push_back(newRoot); - while (! stack.empty()) { - // get a caller - TCall* call = stack.back(); - - // Add to the stack just one callee. - // This algorithm always terminates, because only !visited and !currentPath causes a push - // and all pushes change currentPath to true, and all pops change visited to true. - TGraph::iterator child = callGraph.begin(); - for (; child != callGraph.end(); ++child) { - - // If we already visited this node, its whole subgraph has already been processed, so skip it. - if (child->visited) - continue; - - if (call->callee == child->caller) { - if (child->currentPath) { - // Then, we found a back edge - if (! child->errorGiven) { - error(infoSink, "Recursion detected:"); - infoSink.info << " " << call->callee << " calling " << child->callee << "\n"; - child->errorGiven = true; - recursive = true; - } - } else { - child->currentPath = true; - stack.push_back(&(*child)); - break; - } - } - } - if (child == callGraph.end()) { - // no more callees, we bottomed out, never look at this node again - stack.back()->currentPath = false; - stack.back()->visited = true; - stack.pop_back(); - } - } // end while, meaning nothing left to process in this subtree - - } while (newRoot); // redundant loop check; should always exit via the 'break' above -} - -// -// See which functions are reachable from the entry point and which have bodies. -// Reachable ones with missing bodies are errors. -// Unreachable bodies are dead code. -// -void TIntermediate::checkCallGraphBodies(TInfoSink& infoSink, bool keepUncalled) -{ - // Clear fields we'll use for this. - for (TGraph::iterator call = callGraph.begin(); call != callGraph.end(); ++call) { - call->visited = false; - call->calleeBodyPosition = -1; - } - - // The top level of the AST includes function definitions (bodies). - // Compare these to function calls in the call graph. - // We'll end up knowing which have bodies, and if so, - // how to map the call-graph node to the location in the AST. - TIntermSequence &functionSequence = getTreeRoot()->getAsAggregate()->getSequence(); - std::vector reachable(functionSequence.size(), true); // so that non-functions are reachable - for (int f = 0; f < (int)functionSequence.size(); ++f) { - glslang::TIntermAggregate* node = functionSequence[f]->getAsAggregate(); - if (node && (node->getOp() == glslang::EOpFunction)) { - if (node->getName().compare(getEntryPointMangledName().c_str()) != 0) - reachable[f] = false; // so that function bodies are unreachable, until proven otherwise - for (TGraph::iterator call = callGraph.begin(); call != callGraph.end(); ++call) { - if (call->callee == node->getName()) - call->calleeBodyPosition = f; - } - } - } - - // Start call-graph traversal by visiting the entry point nodes. - for (TGraph::iterator call = callGraph.begin(); call != callGraph.end(); ++call) { - if (call->caller.compare(getEntryPointMangledName().c_str()) == 0) - call->visited = true; - } - - // Propagate 'visited' through the call-graph to every part of the graph it - // can reach (seeded with the entry-point setting above). - bool changed; - do { - changed = false; - for (auto call1 = callGraph.begin(); call1 != callGraph.end(); ++call1) { - if (call1->visited) { - for (TGraph::iterator call2 = callGraph.begin(); call2 != callGraph.end(); ++call2) { - if (! call2->visited) { - if (call1->callee == call2->caller) { - changed = true; - call2->visited = true; - } - } - } - } - } - } while (changed); - - // Any call-graph node set to visited but without a callee body is an error. - for (TGraph::iterator call = callGraph.begin(); call != callGraph.end(); ++call) { - if (call->visited) { - if (call->calleeBodyPosition == -1) { - error(infoSink, "No function definition (body) found: "); - infoSink.info << " " << call->callee << "\n"; - } else - reachable[call->calleeBodyPosition] = true; - } - } - - // Bodies in the AST not reached by the call graph are dead; - // clear them out, since they can't be reached and also can't - // be translated further due to possibility of being ill defined. - if (! keepUncalled) { - for (int f = 0; f < (int)functionSequence.size(); ++f) { - if (! reachable[f]) - functionSequence[f] = nullptr; - } - functionSequence.erase(std::remove(functionSequence.begin(), functionSequence.end(), nullptr), functionSequence.end()); - } -} - -// -// Satisfy rules for location qualifiers on inputs and outputs -// -void TIntermediate::inOutLocationCheck(TInfoSink& infoSink) -{ - // ES 3.0 requires all outputs to have location qualifiers if there is more than one output - bool fragOutWithNoLocation = false; - int numFragOut = 0; - - // TODO: linker functionality: location collision checking - - TIntermSequence& linkObjects = findLinkerObjects(); - for (size_t i = 0; i < linkObjects.size(); ++i) { - const TType& type = linkObjects[i]->getAsTyped()->getType(); - const TQualifier& qualifier = type.getQualifier(); - if (language == EShLangFragment) { - if (qualifier.storage == EvqVaryingOut && qualifier.builtIn == EbvNone) { - ++numFragOut; - if (!qualifier.hasAnyLocation()) - fragOutWithNoLocation = true; - } - } - } - - if (profile == EEsProfile) { - if (numFragOut > 1 && fragOutWithNoLocation) - error(infoSink, "when more than one fragment shader output, all must have location qualifiers"); - } -} - -TIntermSequence& TIntermediate::findLinkerObjects() const -{ - // Get the top-level globals - TIntermSequence& globals = treeRoot->getAsAggregate()->getSequence(); - - // Get the last member of the sequences, expected to be the linker-object lists - assert(globals.back()->getAsAggregate()->getOp() == EOpLinkerObjects); - - return globals.back()->getAsAggregate()->getSequence(); -} - -// See if a variable was both a user-declared output and used. -// Note: the spec discusses writing to one, but this looks at read or write, which -// is more useful, and perhaps the spec should be changed to reflect that. -bool TIntermediate::userOutputUsed() const -{ - const TIntermSequence& linkerObjects = findLinkerObjects(); - - bool found = false; - for (size_t i = 0; i < linkerObjects.size(); ++i) { - const TIntermSymbol& symbolNode = *linkerObjects[i]->getAsSymbolNode(); - if (symbolNode.getQualifier().storage == EvqVaryingOut && - symbolNode.getName().compare(0, 3, "gl_") != 0 && - inIoAccessed(symbolNode.getName())) { - found = true; - break; - } - } - - return found; -} - -// Accumulate locations used for inputs, outputs, and uniforms, and check for collisions -// as the accumulation is done. -// -// Returns < 0 if no collision, >= 0 if collision and the value returned is a colliding value. -// -// typeCollision is set to true if there is no direct collision, but the types in the same location -// are different. -// -int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& type, bool& typeCollision) -{ - typeCollision = false; - - int set; - if (qualifier.isPipeInput()) - set = 0; - else if (qualifier.isPipeOutput()) - set = 1; - else if (qualifier.storage == EvqUniform) - set = 2; - else if (qualifier.storage == EvqBuffer) - set = 3; - else - return -1; - - int size; - if (qualifier.isUniformOrBuffer()) { - if (type.isExplicitlySizedArray()) - size = type.getCumulativeArraySize(); - else - size = 1; - } else { - // Strip off the outer array dimension for those having an extra one. - if (type.isArray() && qualifier.isArrayedIo(language)) { - TType elementType(type, 0); - size = computeTypeLocationSize(elementType); - } else - size = computeTypeLocationSize(type); - } - - // Locations, and components within locations. - // - // Almost always, dealing with components means a single location is involved. - // The exception is a dvec3. From the spec: - // - // "A dvec3 will consume all four components of the first location and components 0 and 1 of - // the second location. This leaves components 2 and 3 available for other component-qualified - // declarations." - // - // That means, without ever mentioning a component, a component range - // for a different location gets specified, if it's not a vertex shader input. (!) - // (A vertex shader input will show using only one location, even for a dvec3/4.) - // - // So, for the case of dvec3, we need two independent ioRanges. - - int collision = -1; // no collision - if (size == 2 && type.getBasicType() == EbtDouble && type.getVectorSize() == 3 && - (qualifier.isPipeInput() || qualifier.isPipeOutput())) { - // Dealing with dvec3 in/out split across two locations. - // Need two io-ranges. - // The case where the dvec3 doesn't start at component 0 was previously caught as overflow. - - // First range: - TRange locationRange(qualifier.layoutLocation, qualifier.layoutLocation); - TRange componentRange(0, 3); - TIoRange range(locationRange, componentRange, type.getBasicType(), 0); - - // check for collisions - collision = checkLocationRange(set, range, type, typeCollision); - if (collision < 0) { - usedIo[set].push_back(range); - - // Second range: - TRange locationRange2(qualifier.layoutLocation + 1, qualifier.layoutLocation + 1); - TRange componentRange2(0, 1); - TIoRange range2(locationRange2, componentRange2, type.getBasicType(), 0); - - // check for collisions - collision = checkLocationRange(set, range2, type, typeCollision); - if (collision < 0) - usedIo[set].push_back(range2); - } - } else { - // Not a dvec3 in/out split across two locations, generic path. - // Need a single IO-range block. - - TRange locationRange(qualifier.layoutLocation, qualifier.layoutLocation + size - 1); - TRange componentRange(0, 3); - if (qualifier.hasComponent() || type.getVectorSize() > 0) { - int consumedComponents = type.getVectorSize() * (type.getBasicType() == EbtDouble ? 2 : 1); - if (qualifier.hasComponent()) - componentRange.start = qualifier.layoutComponent; - componentRange.last = componentRange.start + consumedComponents - 1; - } - - // combine location and component ranges - TIoRange range(locationRange, componentRange, type.getBasicType(), qualifier.hasIndex() ? qualifier.layoutIndex : 0); - - // check for collisions, except for vertex inputs on desktop - if (! (profile != EEsProfile && language == EShLangVertex && qualifier.isPipeInput())) - collision = checkLocationRange(set, range, type, typeCollision); - - if (collision < 0) - usedIo[set].push_back(range); - } - - return collision; -} - -// Compare a new (the passed in) 'range' against the existing set, and see -// if there are any collisions. -// -// Returns < 0 if no collision, >= 0 if collision and the value returned is a colliding value. -// -int TIntermediate::checkLocationRange(int set, const TIoRange& range, const TType& type, bool& typeCollision) -{ - for (size_t r = 0; r < usedIo[set].size(); ++r) { - if (range.overlap(usedIo[set][r])) { - // there is a collision; pick one - return std::max(range.location.start, usedIo[set][r].location.start); - } else if (range.location.overlap(usedIo[set][r].location) && type.getBasicType() != usedIo[set][r].basicType) { - // aliased-type mismatch - typeCollision = true; - return std::max(range.location.start, usedIo[set][r].location.start); - } - } - - return -1; // no collision -} - -// Accumulate bindings and offsets, and check for collisions -// as the accumulation is done. -// -// Returns < 0 if no collision, >= 0 if collision and the value returned is a colliding value. -// -int TIntermediate::addUsedOffsets(int binding, int offset, int numOffsets) -{ - TRange bindingRange(binding, binding); - TRange offsetRange(offset, offset + numOffsets - 1); - TOffsetRange range(bindingRange, offsetRange); - - // check for collisions, except for vertex inputs on desktop - for (size_t r = 0; r < usedAtomics.size(); ++r) { - if (range.overlap(usedAtomics[r])) { - // there is a collision; pick one - return std::max(offset, usedAtomics[r].offset.start); - } - } - - usedAtomics.push_back(range); - - return -1; // no collision -} - -// Accumulate used constant_id values. -// -// Return false is one was already used. -bool TIntermediate::addUsedConstantId(int id) -{ - if (usedConstantId.find(id) != usedConstantId.end()) - return false; - - usedConstantId.insert(id); - - return true; -} - -// Recursively figure out how many locations are used up by an input or output type. -// Return the size of type, as measured by "locations". -int TIntermediate::computeTypeLocationSize(const TType& type) const -{ - // "If the declared input is an array of size n and each element takes m locations, it will be assigned m * n - // consecutive locations..." - if (type.isArray()) { - // TODO: perf: this can be flattened by using getCumulativeArraySize(), and a deref that discards all arrayness - TType elementType(type, 0); - if (type.isImplicitlySizedArray()) { - // TODO: are there valid cases of having an implicitly-sized array with a location? If so, running this code too early. - return computeTypeLocationSize(elementType); - } else - return type.getOuterArraySize() * computeTypeLocationSize(elementType); - } - - // "The locations consumed by block and structure members are determined by applying the rules above - // recursively..." - if (type.isStruct()) { - int size = 0; - for (int member = 0; member < (int)type.getStruct()->size(); ++member) { - TType memberType(type, member); - size += computeTypeLocationSize(memberType); - } - return size; - } - - // ES: "If a shader input is any scalar or vector type, it will consume a single location." - - // Desktop: "If a vertex shader input is any scalar or vector type, it will consume a single location. If a non-vertex - // shader input is a scalar or vector type other than dvec3 or dvec4, it will consume a single location, while - // types dvec3 or dvec4 will consume two consecutive locations. Inputs of type double and dvec2 will - // consume only a single location, in all stages." - if (type.isScalar()) - return 1; - if (type.isVector()) { - if (language == EShLangVertex && type.getQualifier().isPipeInput()) - return 1; - if (type.getBasicType() == EbtDouble && type.getVectorSize() > 2) - return 2; - else - return 1; - } - - // "If the declared input is an n x m single- or double-precision matrix, ... - // The number of locations assigned for each matrix will be the same as - // for an n-element array of m-component vectors..." - if (type.isMatrix()) { - TType columnType(type, 0); - return type.getMatrixCols() * computeTypeLocationSize(columnType); - } - - assert(0); - return 1; -} - -// Accumulate xfb buffer ranges and check for collisions as the accumulation is done. -// -// Returns < 0 if no collision, >= 0 if collision and the value returned is a colliding value. -// -int TIntermediate::addXfbBufferOffset(const TType& type) -{ - const TQualifier& qualifier = type.getQualifier(); - - assert(qualifier.hasXfbOffset() && qualifier.hasXfbBuffer()); - TXfbBuffer& buffer = xfbBuffers[qualifier.layoutXfbBuffer]; - - // compute the range - unsigned int size = computeTypeXfbSize(type, buffer.containsDouble); - buffer.implicitStride = std::max(buffer.implicitStride, qualifier.layoutXfbOffset + size); - TRange range(qualifier.layoutXfbOffset, qualifier.layoutXfbOffset + size - 1); - - // check for collisions - for (size_t r = 0; r < buffer.ranges.size(); ++r) { - if (range.overlap(buffer.ranges[r])) { - // there is a collision; pick an example to return - return std::max(range.start, buffer.ranges[r].start); - } - } - - buffer.ranges.push_back(range); - - return -1; // no collision -} - -// Recursively figure out how many bytes of xfb buffer are used by the given type. -// Return the size of type, in bytes. -// Sets containsDouble to true if the type contains a double. -// N.B. Caller must set containsDouble to false before calling. -unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& containsDouble) const -{ - // "...if applied to an aggregate containing a double, the offset must also be a multiple of 8, - // and the space taken in the buffer will be a multiple of 8. - // ...within the qualified entity, subsequent components are each - // assigned, in order, to the next available offset aligned to a multiple of - // that component's size. Aggregate types are flattened down to the component - // level to get this sequence of components." - - if (type.isArray()) { - // TODO: perf: this can be flattened by using getCumulativeArraySize(), and a deref that discards all arrayness - assert(type.isExplicitlySizedArray()); - TType elementType(type, 0); - return type.getOuterArraySize() * computeTypeXfbSize(elementType, containsDouble); - } - - if (type.isStruct()) { - unsigned int size = 0; - bool structContainsDouble = false; - for (int member = 0; member < (int)type.getStruct()->size(); ++member) { - TType memberType(type, member); - // "... if applied to - // an aggregate containing a double, the offset must also be a multiple of 8, - // and the space taken in the buffer will be a multiple of 8." - bool memberContainsDouble = false; - int memberSize = computeTypeXfbSize(memberType, memberContainsDouble); - if (memberContainsDouble) { - structContainsDouble = true; - RoundToPow2(size, 8); - } - size += memberSize; - } - - if (structContainsDouble) { - containsDouble = true; - RoundToPow2(size, 8); - } - return size; - } - - int numComponents; - if (type.isScalar()) - numComponents = 1; - else if (type.isVector()) - numComponents = type.getVectorSize(); - else if (type.isMatrix()) - numComponents = type.getMatrixCols() * type.getMatrixRows(); - else { - assert(0); - numComponents = 1; - } - - if (type.getBasicType() == EbtDouble) { - containsDouble = true; - return 8 * numComponents; - } else - return 4 * numComponents; -} - -const int baseAlignmentVec4Std140 = 16; - -// Return the size and alignment of a component of the given type. -// The size is returned in the 'size' parameter -// Return value is the alignment.. -int TIntermediate::getBaseAlignmentScalar(const TType& type, int& size) -{ - switch (type.getBasicType()) { - case EbtInt64: - case EbtUint64: - case EbtDouble: size = 8; return 8; -#ifdef AMD_EXTENSIONS - case EbtInt16: - case EbtUint16: - case EbtFloat16: size = 2; return 2; -#endif - default: size = 4; return 4; - } -} - -// Implement base-alignment and size rules from section 7.6.2.2 Standard Uniform Block Layout -// Operates recursively. -// -// If std140 is true, it does the rounding up to vec4 size required by std140, -// otherwise it does not, yielding std430 rules. -// -// The size is returned in the 'size' parameter -// -// The stride is only non-0 for arrays or matrices, and is the stride of the -// top-level object nested within the type. E.g., for an array of matrices, -// it is the distances needed between matrices, despite the rules saying the -// stride comes from the flattening down to vectors. -// -// Return value is the alignment of the type. -int TIntermediate::getBaseAlignment(const TType& type, int& size, int& stride, bool std140, bool rowMajor) -{ - int alignment; - - // When using the std140 storage layout, structures will be laid out in buffer - // storage with its members stored in monotonically increasing order based on their - // location in the declaration. A structure and each structure member have a base - // offset and a base alignment, from which an aligned offset is computed by rounding - // the base offset up to a multiple of the base alignment. The base offset of the first - // member of a structure is taken from the aligned offset of the structure itself. The - // base offset of all other structure members is derived by taking the offset of the - // last basic machine unit consumed by the previous member and adding one. Each - // structure member is stored in memory at its aligned offset. The members of a top- - // level uniform block are laid out in buffer storage by treating the uniform block as - // a structure with a base offset of zero. - // - // 1. If the member is a scalar consuming N basic machine units, the base alignment is N. - // - // 2. If the member is a two- or four-component vector with components consuming N basic - // machine units, the base alignment is 2N or 4N, respectively. - // - // 3. If the member is a three-component vector with components consuming N - // basic machine units, the base alignment is 4N. - // - // 4. If the member is an array of scalars or vectors, the base alignment and array - // stride are set to match the base alignment of a single array element, according - // to rules (1), (2), and (3), and rounded up to the base alignment of a vec4. The - // array may have padding at the end; the base offset of the member following - // the array is rounded up to the next multiple of the base alignment. - // - // 5. If the member is a column-major matrix with C columns and R rows, the - // matrix is stored identically to an array of C column vectors with R - // components each, according to rule (4). - // - // 6. If the member is an array of S column-major matrices with C columns and - // R rows, the matrix is stored identically to a row of S X C column vectors - // with R components each, according to rule (4). - // - // 7. If the member is a row-major matrix with C columns and R rows, the matrix - // is stored identically to an array of R row vectors with C components each, - // according to rule (4). - // - // 8. If the member is an array of S row-major matrices with C columns and R - // rows, the matrix is stored identically to a row of S X R row vectors with C - // components each, according to rule (4). - // - // 9. If the member is a structure, the base alignment of the structure is N , where - // N is the largest base alignment value of any of its members, and rounded - // up to the base alignment of a vec4. The individual members of this substructure - // are then assigned offsets by applying this set of rules recursively, - // where the base offset of the first member of the sub-structure is equal to the - // aligned offset of the structure. The structure may have padding at the end; - // the base offset of the member following the sub-structure is rounded up to - // the next multiple of the base alignment of the structure. - // - // 10. If the member is an array of S structures, the S elements of the array are laid - // out in order, according to rule (9). - // - // Assuming, for rule 10: The stride is the same as the size of an element. - - stride = 0; - int dummyStride; - - // rules 4, 6, 8, and 10 - if (type.isArray()) { - // TODO: perf: this might be flattened by using getCumulativeArraySize(), and a deref that discards all arrayness - TType derefType(type, 0); - alignment = getBaseAlignment(derefType, size, dummyStride, std140, rowMajor); - if (std140) - alignment = std::max(baseAlignmentVec4Std140, alignment); - RoundToPow2(size, alignment); - stride = size; // uses full matrix size for stride of an array of matrices (not quite what rule 6/8, but what's expected) - // uses the assumption for rule 10 in the comment above - size = stride * type.getOuterArraySize(); - return alignment; - } - - // rule 9 - if (type.getBasicType() == EbtStruct) { - const TTypeList& memberList = *type.getStruct(); - - size = 0; - int maxAlignment = std140 ? baseAlignmentVec4Std140 : 0; - for (size_t m = 0; m < memberList.size(); ++m) { - int memberSize; - // modify just the children's view of matrix layout, if there is one for this member - TLayoutMatrix subMatrixLayout = memberList[m].type->getQualifier().layoutMatrix; - int memberAlignment = getBaseAlignment(*memberList[m].type, memberSize, dummyStride, std140, - (subMatrixLayout != ElmNone) ? (subMatrixLayout == ElmRowMajor) : rowMajor); - maxAlignment = std::max(maxAlignment, memberAlignment); - RoundToPow2(size, memberAlignment); - size += memberSize; - } - - // The structure may have padding at the end; the base offset of - // the member following the sub-structure is rounded up to the next - // multiple of the base alignment of the structure. - RoundToPow2(size, maxAlignment); - - return maxAlignment; - } - - // rule 1 - if (type.isScalar()) - return getBaseAlignmentScalar(type, size); - - // rules 2 and 3 - if (type.isVector()) { - int scalarAlign = getBaseAlignmentScalar(type, size); - switch (type.getVectorSize()) { - case 2: - size *= 2; - return 2 * scalarAlign; - default: - size *= type.getVectorSize(); - return 4 * scalarAlign; - } - } - - // rules 5 and 7 - if (type.isMatrix()) { - // rule 5: deref to row, not to column, meaning the size of vector is num columns instead of num rows - TType derefType(type, 0, rowMajor); - - alignment = getBaseAlignment(derefType, size, dummyStride, std140, rowMajor); - if (std140) - alignment = std::max(baseAlignmentVec4Std140, alignment); - RoundToPow2(size, alignment); - stride = size; // use intra-matrix stride for stride of a just a matrix - if (rowMajor) - size = stride * type.getMatrixRows(); - else - size = stride * type.getMatrixCols(); - - return alignment; - } - - assert(0); // all cases should be covered above - size = baseAlignmentVec4Std140; - return baseAlignmentVec4Std140; -} - -// To aid the basic HLSL rule about crossing vec4 boundaries. -bool TIntermediate::improperStraddle(const TType& type, int size, int offset) -{ - if (! type.isVector() || type.isArray()) - return false; - - return size <= 16 ? offset / 16 != (offset + size - 1) / 16 - : offset % 16 != 0; -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/localintermediate.h b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/localintermediate.h deleted file mode 100644 index 4d48c68d..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/localintermediate.h +++ /dev/null @@ -1,729 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2016 LunarG, Inc. -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#ifndef _LOCAL_INTERMEDIATE_INCLUDED_ -#define _LOCAL_INTERMEDIATE_INCLUDED_ - -#include "../Include/intermediate.h" -#include "../Public/ShaderLang.h" -#include "Versions.h" - -#include -#include -#include - -class TInfoSink; - -namespace glslang { - -struct TMatrixSelector { - int coord1; // stay agnostic about column/row; this is parse order - int coord2; -}; - -typedef int TVectorSelector; - -const int MaxSwizzleSelectors = 4; - -template -class TSwizzleSelectors { -public: - TSwizzleSelectors() : size_(0) { } - - void push_back(selectorType comp) - { - if (size_ < MaxSwizzleSelectors) - components[size_++] = comp; - } - void resize(int s) - { - assert(s <= size_); - size_ = s; - } - int size() const { return size_; } - selectorType operator[](int i) const - { - assert(i < MaxSwizzleSelectors); - return components[i]; - } - -private: - int size_; - selectorType components[MaxSwizzleSelectors]; -}; - -// -// Some helper structures for TIntermediate. Their contents are encapsulated -// by TIntermediate. -// - -// Used for call-graph algorithms for detecting recursion, missing bodies, and dead bodies. -// A "call" is a pair: . -// There can be duplicates. General assumption is the list is small. -struct TCall { - TCall(const TString& pCaller, const TString& pCallee) : caller(pCaller), callee(pCallee) { } - TString caller; - TString callee; - bool visited; - bool currentPath; - bool errorGiven; - int calleeBodyPosition; -}; - -// A generic 1-D range. -struct TRange { - TRange(int start, int last) : start(start), last(last) { } - bool overlap(const TRange& rhs) const - { - return last >= rhs.start && start <= rhs.last; - } - int start; - int last; -}; - -// An IO range is a 3-D rectangle; the set of (location, component, index) triples all lying -// within the same location range, component range, and index value. Locations don't alias unless -// all other dimensions of their range overlap. -struct TIoRange { - TIoRange(TRange location, TRange component, TBasicType basicType, int index) - : location(location), component(component), basicType(basicType), index(index) { } - bool overlap(const TIoRange& rhs) const - { - return location.overlap(rhs.location) && component.overlap(rhs.component) && index == rhs.index; - } - TRange location; - TRange component; - TBasicType basicType; - int index; -}; - -// An offset range is a 2-D rectangle; the set of (binding, offset) pairs all lying -// within the same binding and offset range. -struct TOffsetRange { - TOffsetRange(TRange binding, TRange offset) - : binding(binding), offset(offset) { } - bool overlap(const TOffsetRange& rhs) const - { - return binding.overlap(rhs.binding) && offset.overlap(rhs.offset); - } - TRange binding; - TRange offset; -}; - -// Things that need to be tracked per xfb buffer. -struct TXfbBuffer { - TXfbBuffer() : stride(TQualifier::layoutXfbStrideEnd), implicitStride(0), containsDouble(false) { } - std::vector ranges; // byte offsets that have already been assigned - unsigned int stride; - unsigned int implicitStride; - bool containsDouble; -}; - -// Track a set of strings describing how the module was processed. -// Using the form: -// process arg0 arg1 arg2 ... -// process arg0 arg1 arg2 ... -// where everything is textual, and there can be zero or more arguments -class TProcesses { -public: - TProcesses() {} - ~TProcesses() {} - - void addProcess(const char* process) - { - processes.push_back(process); - } - void addProcess(const std::string& process) - { - processes.push_back(process); - } - void addArgument(int arg) - { - processes.back().append(" "); - std::string argString = std::to_string(arg); - processes.back().append(argString); - } - void addArgument(const char* arg) - { - processes.back().append(" "); - processes.back().append(arg); - } - void addArgument(const std::string& arg) - { - processes.back().append(" "); - processes.back().append(arg); - } - void addIfNonZero(const char* process, int value) - { - if (value != 0) { - addProcess(process); - addArgument(value); - } - } - - const std::vector& getProcesses() const { return processes; } - -private: - std::vector processes; -}; - -class TSymbolTable; -class TSymbol; -class TVariable; - -// -// Set of helper functions to help parse and build the tree. -// -class TIntermediate { -public: - explicit TIntermediate(EShLanguage l, int v = 0, EProfile p = ENoProfile) : - implicitThisName("@this"), - language(l), source(EShSourceNone), profile(p), version(v), treeRoot(0), - numEntryPoints(0), numErrors(0), numPushConstants(0), recursive(false), - invocations(TQualifier::layoutNotSet), vertices(TQualifier::layoutNotSet), - inputPrimitive(ElgNone), outputPrimitive(ElgNone), - pixelCenterInteger(false), originUpperLeft(false), - vertexSpacing(EvsNone), vertexOrder(EvoNone), pointMode(false), earlyFragmentTests(false), - postDepthCoverage(false), depthLayout(EldNone), depthReplacing(false), - blendEquations(0), xfbMode(false), multiStream(false), -#ifdef NV_EXTENSIONS - layoutOverrideCoverage(false), - geoPassthroughEXT(false), -#endif - autoMapBindings(false), - autoMapLocations(false), - invertY(false), - flattenUniformArrays(false), - useUnknownFormat(false), - hlslOffsets(false), - useStorageBuffer(false), - hlslIoMapping(false), - textureSamplerTransformMode(EShTexSampTransKeep), - needToLegalize(false) - { - localSize[0] = 1; - localSize[1] = 1; - localSize[2] = 1; - localSizeSpecId[0] = TQualifier::layoutNotSet; - localSizeSpecId[1] = TQualifier::layoutNotSet; - localSizeSpecId[2] = TQualifier::layoutNotSet; - xfbBuffers.resize(TQualifier::layoutXfbBufferEnd); - - shiftBinding.fill(0); - } - void setLimits(const TBuiltInResource& r) { resources = r; } - - bool postProcess(TIntermNode*, EShLanguage); - void output(TInfoSink&, bool tree); - void removeTree(); - - void setSource(EShSource s) { source = s; } - EShSource getSource() const { return source; } - void setEntryPointName(const char* ep) - { - entryPointName = ep; - processes.addProcess("entry-point"); - processes.addArgument(entryPointName); - } - void setEntryPointMangledName(const char* ep) { entryPointMangledName = ep; } - const std::string& getEntryPointName() const { return entryPointName; } - const std::string& getEntryPointMangledName() const { return entryPointMangledName; } - - void setShiftBinding(TResourceType res, unsigned int shift) - { - shiftBinding[res] = shift; - - const char* name = getResourceName(res); - if (name != nullptr) - processes.addIfNonZero(name, shift); - } - - unsigned int getShiftBinding(TResourceType res) const { return shiftBinding[res]; } - - void setShiftBindingForSet(TResourceType res, unsigned int shift, unsigned int set) - { - if (shift == 0) // ignore if there's no shift: it's a no-op. - return; - - shiftBindingForSet[res][set] = shift; - - const char* name = getResourceName(res); - if (name != nullptr) { - processes.addProcess(name); - processes.addArgument(shift); - processes.addArgument(set); - } - } - - int getShiftBindingForSet(TResourceType res, unsigned int set) const - { - const auto shift = shiftBindingForSet[res].find(set); - return shift == shiftBindingForSet[res].end() ? -1 : shift->second; - } - bool hasShiftBindingForSet(TResourceType res) const { return !shiftBindingForSet[res].empty(); } - - void setResourceSetBinding(const std::vector& shift) - { - resourceSetBinding = shift; - if (shift.size() > 0) { - processes.addProcess("resource-set-binding"); - for (int s = 0; s < (int)shift.size(); ++s) - processes.addArgument(shift[s]); - } - } - const std::vector& getResourceSetBinding() const { return resourceSetBinding; } - void setAutoMapBindings(bool map) - { - autoMapBindings = map; - if (autoMapBindings) - processes.addProcess("auto-map-bindings"); - } - bool getAutoMapBindings() const { return autoMapBindings; } - void setAutoMapLocations(bool map) - { - autoMapLocations = map; - if (autoMapLocations) - processes.addProcess("auto-map-locations"); - } - bool getAutoMapLocations() const { return autoMapLocations; } - void setInvertY(bool invert) - { - invertY = invert; - if (invertY) - processes.addProcess("invert-y"); - } - bool getInvertY() const { return invertY; } - - void setFlattenUniformArrays(bool flatten) - { - flattenUniformArrays = flatten; - if (flattenUniformArrays) - processes.addProcess("flatten-uniform-arrays"); - } - bool getFlattenUniformArrays() const { return flattenUniformArrays; } - void setNoStorageFormat(bool b) - { - useUnknownFormat = b; - if (useUnknownFormat) - processes.addProcess("no-storage-format"); - } - bool getNoStorageFormat() const { return useUnknownFormat; } - void setHlslOffsets() - { - hlslOffsets = true; - if (hlslOffsets) - processes.addProcess("hlsl-offsets"); - } - bool usingHlslOFfsets() const { return hlslOffsets; } - void setUseStorageBuffer() - { - useStorageBuffer = true; - processes.addProcess("use-storage-buffer"); - } - bool usingStorageBuffer() const { return useStorageBuffer; } - void setHlslIoMapping(bool b) - { - hlslIoMapping = b; - if (hlslIoMapping) - processes.addProcess("hlsl-iomap"); - } - bool usingHlslIoMapping() { return hlslIoMapping; } - - void setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode) { textureSamplerTransformMode = mode; } - - void setVersion(int v) { version = v; } - int getVersion() const { return version; } - void setProfile(EProfile p) { profile = p; } - EProfile getProfile() const { return profile; } - void setSpv(const SpvVersion& s) - { - spvVersion = s; - - // client processes - if (spvVersion.vulkan > 0) - processes.addProcess("client vulkan100"); - if (spvVersion.openGl > 0) - processes.addProcess("client opengl100"); - - // target-environment processes - if (spvVersion.vulkan == 100) - processes.addProcess("target-env vulkan1.0"); - else if (spvVersion.vulkan > 0) - processes.addProcess("target-env vulkanUnknown"); - if (spvVersion.openGl > 0) - processes.addProcess("target-env opengl"); - } - const SpvVersion& getSpv() const { return spvVersion; } - EShLanguage getStage() const { return language; } - void addRequestedExtension(const char* extension) { requestedExtensions.insert(extension); } - const std::set& getRequestedExtensions() const { return requestedExtensions; } - - void setTreeRoot(TIntermNode* r) { treeRoot = r; } - TIntermNode* getTreeRoot() const { return treeRoot; } - void incrementEntryPointCount() { ++numEntryPoints; } - int getNumEntryPoints() const { return numEntryPoints; } - int getNumErrors() const { return numErrors; } - void addPushConstantCount() { ++numPushConstants; } - bool isRecursive() const { return recursive; } - - TIntermSymbol* addSymbol(const TVariable&); - TIntermSymbol* addSymbol(const TVariable&, const TSourceLoc&); - TIntermSymbol* addSymbol(const TType&, const TSourceLoc&); - TIntermSymbol* addSymbol(const TIntermSymbol&); - TIntermTyped* addConversion(TOperator, const TType&, TIntermTyped*) const; - TIntermTyped* addUniShapeConversion(TOperator, const TType&, TIntermTyped*); - void addBiShapeConversion(TOperator, TIntermTyped*& lhsNode, TIntermTyped*& rhsNode); - TIntermTyped* addShapeConversion(const TType&, TIntermTyped*); - TIntermTyped* addBinaryMath(TOperator, TIntermTyped* left, TIntermTyped* right, TSourceLoc); - TIntermTyped* addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc); - TIntermTyped* addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, TSourceLoc); - TIntermTyped* addUnaryMath(TOperator, TIntermTyped* child, TSourceLoc); - TIntermTyped* addBuiltInFunctionCall(const TSourceLoc& line, TOperator, bool unary, TIntermNode*, const TType& returnType); - bool canImplicitlyPromote(TBasicType from, TBasicType to, TOperator op = EOpNull) const; - TOperator mapTypeToConstructorOp(const TType&) const; - TIntermAggregate* growAggregate(TIntermNode* left, TIntermNode* right); - TIntermAggregate* growAggregate(TIntermNode* left, TIntermNode* right, const TSourceLoc&); - TIntermAggregate* makeAggregate(TIntermNode* node); - TIntermAggregate* makeAggregate(TIntermNode* node, const TSourceLoc&); - TIntermAggregate* makeAggregate(const TSourceLoc&); - TIntermTyped* setAggregateOperator(TIntermNode*, TOperator, const TType& type, TSourceLoc); - bool areAllChildConst(TIntermAggregate* aggrNode); - TIntermTyped* addSelection(TIntermTyped* cond, TIntermNodePair code, const TSourceLoc&, TSelectionControl = ESelectionControlNone); - TIntermTyped* addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, const TSourceLoc&, TSelectionControl = ESelectionControlNone); - TIntermTyped* addComma(TIntermTyped* left, TIntermTyped* right, const TSourceLoc&); - TIntermTyped* addMethod(TIntermTyped*, const TType&, const TString*, const TSourceLoc&); - TIntermConstantUnion* addConstantUnion(const TConstUnionArray&, const TType&, const TSourceLoc&, bool literal = false) const; - TIntermConstantUnion* addConstantUnion(int, const TSourceLoc&, bool literal = false) const; - TIntermConstantUnion* addConstantUnion(unsigned int, const TSourceLoc&, bool literal = false) const; - TIntermConstantUnion* addConstantUnion(long long, const TSourceLoc&, bool literal = false) const; - TIntermConstantUnion* addConstantUnion(unsigned long long, const TSourceLoc&, bool literal = false) const; -#ifdef AMD_EXTENSIONS - TIntermConstantUnion* addConstantUnion(short, const TSourceLoc&, bool literal = false) const; - TIntermConstantUnion* addConstantUnion(unsigned short, const TSourceLoc&, bool literal = false) const; - -#endif - TIntermConstantUnion* addConstantUnion(bool, const TSourceLoc&, bool literal = false) const; - TIntermConstantUnion* addConstantUnion(double, TBasicType, const TSourceLoc&, bool literal = false) const; - TIntermConstantUnion* addConstantUnion(const TString*, const TSourceLoc&, bool literal = false) const; - TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*) const; - bool parseConstTree(TIntermNode*, TConstUnionArray, TOperator, const TType&, bool singleConstantParam = false); - TIntermLoop* addLoop(TIntermNode*, TIntermTyped*, TIntermTyped*, bool testFirst, const TSourceLoc&, TLoopControl = ELoopControlNone); - TIntermAggregate* addForLoop(TIntermNode*, TIntermNode*, TIntermTyped*, TIntermTyped*, bool testFirst, const TSourceLoc&, TLoopControl = ELoopControlNone); - TIntermBranch* addBranch(TOperator, const TSourceLoc&); - TIntermBranch* addBranch(TOperator, TIntermTyped*, const TSourceLoc&); - template TIntermTyped* addSwizzle(TSwizzleSelectors&, const TSourceLoc&); - - // Low level functions to add nodes (no conversions or other higher level transformations) - // If a type is provided, the node's type will be set to it. - TIntermBinary* addBinaryNode(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc) const; - TIntermBinary* addBinaryNode(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc, const TType&) const; - TIntermUnary* addUnaryNode(TOperator op, TIntermTyped* child, TSourceLoc) const; - TIntermUnary* addUnaryNode(TOperator op, TIntermTyped* child, TSourceLoc, const TType&) const; - - // Add conversion from node's type to given basic type. - TIntermTyped* convertToBasicType(TOperator op, TBasicType basicType, TIntermTyped* node) const; - - // Constant folding (in Constant.cpp) - TIntermTyped* fold(TIntermAggregate* aggrNode); - TIntermTyped* foldConstructor(TIntermAggregate* aggrNode); - TIntermTyped* foldDereference(TIntermTyped* node, int index, const TSourceLoc&); - TIntermTyped* foldSwizzle(TIntermTyped* node, TSwizzleSelectors& fields, const TSourceLoc&); - - // Tree ops - static const TIntermTyped* findLValueBase(const TIntermTyped*, bool swizzleOkay); - - // Linkage related - void addSymbolLinkageNodes(TIntermAggregate*& linkage, EShLanguage, TSymbolTable&); - void addSymbolLinkageNode(TIntermAggregate*& linkage, const TSymbol&); - - bool setInvocations(int i) - { - if (invocations != TQualifier::layoutNotSet) - return invocations == i; - invocations = i; - return true; - } - int getInvocations() const { return invocations; } - bool setVertices(int m) - { - if (vertices != TQualifier::layoutNotSet) - return vertices == m; - vertices = m; - return true; - } - int getVertices() const { return vertices; } - bool setInputPrimitive(TLayoutGeometry p) - { - if (inputPrimitive != ElgNone) - return inputPrimitive == p; - inputPrimitive = p; - return true; - } - TLayoutGeometry getInputPrimitive() const { return inputPrimitive; } - bool setVertexSpacing(TVertexSpacing s) - { - if (vertexSpacing != EvsNone) - return vertexSpacing == s; - vertexSpacing = s; - return true; - } - TVertexSpacing getVertexSpacing() const { return vertexSpacing; } - bool setVertexOrder(TVertexOrder o) - { - if (vertexOrder != EvoNone) - return vertexOrder == o; - vertexOrder = o; - return true; - } - TVertexOrder getVertexOrder() const { return vertexOrder; } - void setPointMode() { pointMode = true; } - bool getPointMode() const { return pointMode; } - - bool setLocalSize(int dim, int size) - { - if (localSize[dim] > 1) - return size == localSize[dim]; - localSize[dim] = size; - return true; - } - unsigned int getLocalSize(int dim) const { return localSize[dim]; } - - bool setLocalSizeSpecId(int dim, int id) - { - if (localSizeSpecId[dim] != TQualifier::layoutNotSet) - return id == localSizeSpecId[dim]; - localSizeSpecId[dim] = id; - return true; - } - int getLocalSizeSpecId(int dim) const { return localSizeSpecId[dim]; } - - void setXfbMode() { xfbMode = true; } - bool getXfbMode() const { return xfbMode; } - void setMultiStream() { multiStream = true; } - bool isMultiStream() const { return multiStream; } - bool setOutputPrimitive(TLayoutGeometry p) - { - if (outputPrimitive != ElgNone) - return outputPrimitive == p; - outputPrimitive = p; - return true; - } - TLayoutGeometry getOutputPrimitive() const { return outputPrimitive; } - void setOriginUpperLeft() { originUpperLeft = true; } - bool getOriginUpperLeft() const { return originUpperLeft; } - void setPixelCenterInteger() { pixelCenterInteger = true; } - bool getPixelCenterInteger() const { return pixelCenterInteger; } - void setEarlyFragmentTests() { earlyFragmentTests = true; } - bool getEarlyFragmentTests() const { return earlyFragmentTests; } - void setPostDepthCoverage() { postDepthCoverage = true; } - bool getPostDepthCoverage() const { return postDepthCoverage; } - bool setDepth(TLayoutDepth d) - { - if (depthLayout != EldNone) - return depthLayout == d; - depthLayout = d; - return true; - } - TLayoutDepth getDepth() const { return depthLayout; } - void setDepthReplacing() { depthReplacing = true; } - bool isDepthReplacing() const { return depthReplacing; } - - void addBlendEquation(TBlendEquationShift b) { blendEquations |= (1 << b); } - unsigned int getBlendEquations() const { return blendEquations; } - - void addToCallGraph(TInfoSink&, const TString& caller, const TString& callee); - void merge(TInfoSink&, TIntermediate&); - void finalCheck(TInfoSink&, bool keepUncalled); - - void addIoAccessed(const TString& name) { ioAccessed.insert(name); } - bool inIoAccessed(const TString& name) const { return ioAccessed.find(name) != ioAccessed.end(); } - - int addUsedLocation(const TQualifier&, const TType&, bool& typeCollision); - int checkLocationRange(int set, const TIoRange& range, const TType&, bool& typeCollision); - int addUsedOffsets(int binding, int offset, int numOffsets); - bool addUsedConstantId(int id); - int computeTypeLocationSize(const TType&) const; - - bool setXfbBufferStride(int buffer, unsigned stride) - { - if (xfbBuffers[buffer].stride != TQualifier::layoutXfbStrideEnd) - return xfbBuffers[buffer].stride == stride; - xfbBuffers[buffer].stride = stride; - return true; - } - unsigned getXfbStride(int buffer) const { return xfbBuffers[buffer].stride; } - int addXfbBufferOffset(const TType&); - unsigned int computeTypeXfbSize(const TType&, bool& containsDouble) const; - static int getBaseAlignmentScalar(const TType&, int& size); - static int getBaseAlignment(const TType&, int& size, int& stride, bool std140, bool rowMajor); - static bool improperStraddle(const TType& type, int size, int offset); - bool promote(TIntermOperator*); - -#ifdef NV_EXTENSIONS - void setLayoutOverrideCoverage() { layoutOverrideCoverage = true; } - bool getLayoutOverrideCoverage() const { return layoutOverrideCoverage; } - void setGeoPassthroughEXT() { geoPassthroughEXT = true; } - bool getGeoPassthroughEXT() const { return geoPassthroughEXT; } -#endif - - const char* addSemanticName(const TString& name) - { - return semanticNameSet.insert(name).first->c_str(); - } - - void setSourceFile(const char* file) { sourceFile = file; } - const std::string& getSourceFile() const { return sourceFile; } - void addSourceText(const char* text) { sourceText = sourceText + text; } - const std::string& getSourceText() const { return sourceText; } - void addProcesses(const std::vector& p) { - for (int i = 0; i < (int)p.size(); ++i) - processes.addProcess(p[i]); - } - void addProcess(const std::string& process) { processes.addProcess(process); } - void addProcessArgument(const std::string& arg) { processes.addArgument(arg); } - const std::vector& getProcesses() const { return processes.getProcesses(); } - - void setNeedsLegalization() { needToLegalize = true; } - bool needsLegalization() const { return needToLegalize; } - - const char* const implicitThisName; - -protected: - TIntermSymbol* addSymbol(int Id, const TString&, const TType&, const TConstUnionArray&, TIntermTyped* subtree, const TSourceLoc&); - void error(TInfoSink& infoSink, const char*); - void warn(TInfoSink& infoSink, const char*); - void mergeBodies(TInfoSink&, TIntermSequence& globals, const TIntermSequence& unitGlobals); - void mergeLinkerObjects(TInfoSink&, TIntermSequence& linkerObjects, const TIntermSequence& unitLinkerObjects); - void mergeImplicitArraySizes(TType&, const TType&); - void mergeErrorCheck(TInfoSink&, const TIntermSymbol&, const TIntermSymbol&, bool crossStage); - void checkCallGraphCycles(TInfoSink&); - void checkCallGraphBodies(TInfoSink&, bool keepUncalled); - void inOutLocationCheck(TInfoSink&); - TIntermSequence& findLinkerObjects() const; - bool userOutputUsed() const; - bool isSpecializationOperation(const TIntermOperator&) const; - bool promoteUnary(TIntermUnary&); - bool promoteBinary(TIntermBinary&); - void addSymbolLinkageNode(TIntermAggregate*& linkage, TSymbolTable&, const TString&); - bool promoteAggregate(TIntermAggregate&); - void pushSelector(TIntermSequence&, const TVectorSelector&, const TSourceLoc&); - void pushSelector(TIntermSequence&, const TMatrixSelector&, const TSourceLoc&); - bool specConstantPropagates(const TIntermTyped&, const TIntermTyped&); - void performTextureUpgradeAndSamplerRemovalTransformation(TIntermNode* root); - static const char* getResourceName(TResourceType); - - const EShLanguage language; // stage, known at construction time - EShSource source; // source language, known a bit later - std::string entryPointName; - std::string entryPointMangledName; - - EProfile profile; - int version; - SpvVersion spvVersion; - TIntermNode* treeRoot; - std::set requestedExtensions; // cumulation of all enabled or required extensions; not connected to what subset of the shader used them - TBuiltInResource resources; - int numEntryPoints; - int numErrors; - int numPushConstants; - bool recursive; - int invocations; - int vertices; - TLayoutGeometry inputPrimitive; - TLayoutGeometry outputPrimitive; - bool pixelCenterInteger; - bool originUpperLeft; - TVertexSpacing vertexSpacing; - TVertexOrder vertexOrder; - bool pointMode; - int localSize[3]; - int localSizeSpecId[3]; - bool earlyFragmentTests; - bool postDepthCoverage; - TLayoutDepth depthLayout; - bool depthReplacing; - int blendEquations; // an 'or'ing of masks of shifts of TBlendEquationShift - bool xfbMode; - bool multiStream; - -#ifdef NV_EXTENSIONS - bool layoutOverrideCoverage; - bool geoPassthroughEXT; -#endif - - // Base shift values - std::array shiftBinding; - - // Per-descriptor-set shift values - std::array, EResCount> shiftBindingForSet; - - std::vector resourceSetBinding; - bool autoMapBindings; - bool autoMapLocations; - bool invertY; - bool flattenUniformArrays; - bool useUnknownFormat; - bool hlslOffsets; - bool useStorageBuffer; - bool hlslIoMapping; - - typedef std::list TGraph; - TGraph callGraph; - - std::set ioAccessed; // set of names of statically read/written I/O that might need extra checking - std::vector usedIo[4]; // sets of used locations, one for each of in, out, uniform, and buffers - std::vector usedAtomics; // sets of bindings used by atomic counters - std::vector xfbBuffers; // all the data we need to track per xfb buffer - std::unordered_set usedConstantId; // specialization constant ids used - std::set semanticNameSet; - - EShTextureSamplerTransformMode textureSamplerTransformMode; - - // source code of shader, useful as part of debug information - std::string sourceFile; - std::string sourceText; - - // for OpModuleProcessed, or equivalent - TProcesses processes; - - bool needToLegalize; - -private: - void operator=(TIntermediate&); // prevent assignments -}; - -} // end namespace glslang - -#endif // _LOCAL_INTERMEDIATE_INCLUDED_ diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/parseConst.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/parseConst.cpp deleted file mode 100644 index 1a8e6d99..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/parseConst.cpp +++ /dev/null @@ -1,204 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -// -// Traverse a tree of constants to create a single folded constant. -// It should only be used when the whole tree is known to be constant. -// - -#include "ParseHelper.h" - -namespace glslang { - -class TConstTraverser : public TIntermTraverser { -public: - TConstTraverser(const TConstUnionArray& cUnion, bool singleConstParam, TOperator constructType, const TType& t) - : unionArray(cUnion), type(t), - constructorType(constructType), singleConstantParam(singleConstParam), error(false), isMatrix(false), - matrixCols(0), matrixRows(0) { index = 0; tOp = EOpNull; } - - virtual void visitConstantUnion(TIntermConstantUnion* node); - virtual bool visitAggregate(TVisit, TIntermAggregate* node); - - int index; - TConstUnionArray unionArray; - TOperator tOp; - const TType& type; - TOperator constructorType; - bool singleConstantParam; - bool error; - int size; // size of the constructor ( 4 for vec4) - bool isMatrix; - int matrixCols; - int matrixRows; - -protected: - TConstTraverser(TConstTraverser&); - TConstTraverser& operator=(TConstTraverser&); -}; - -bool TConstTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node) -{ - if (! node->isConstructor() && node->getOp() != EOpComma) { - error = true; - - return false; - } - - bool flag = node->getSequence().size() == 1 && node->getSequence()[0]->getAsTyped()->getAsConstantUnion(); - if (flag) { - singleConstantParam = true; - constructorType = node->getOp(); - size = node->getType().computeNumComponents(); - - if (node->getType().isMatrix()) { - isMatrix = true; - matrixCols = node->getType().getMatrixCols(); - matrixRows = node->getType().getMatrixRows(); - } - } - - for (TIntermSequence::iterator p = node->getSequence().begin(); - p != node->getSequence().end(); p++) { - - if (node->getOp() == EOpComma) - index = 0; - - (*p)->traverse(this); - } - if (flag) - { - singleConstantParam = false; - constructorType = EOpNull; - size = 0; - isMatrix = false; - matrixCols = 0; - matrixRows = 0; - } - - return false; -} - -void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node) -{ - TConstUnionArray leftUnionArray(unionArray); - int instanceSize = type.computeNumComponents(); - - if (index >= instanceSize) - return; - - if (! singleConstantParam) { - int rightUnionSize = node->getType().computeNumComponents(); - - const TConstUnionArray& rightUnionArray = node->getConstArray(); - for (int i = 0; i < rightUnionSize; i++) { - if (index >= instanceSize) - return; - leftUnionArray[index] = rightUnionArray[i]; - - index++; - } - } else { - int endIndex = index + size; - const TConstUnionArray& rightUnionArray = node->getConstArray(); - if (! isMatrix) { - int count = 0; - int nodeComps = node->getType().computeNumComponents(); - for (int i = index; i < endIndex; i++) { - if (i >= instanceSize) - return; - - leftUnionArray[i] = rightUnionArray[count]; - - (index)++; - - if (nodeComps > 1) - count++; - } - } else { - // constructing a matrix, but from what? - if (node->isMatrix()) { - // Matrix from a matrix; this has the outer matrix, node is the argument matrix. - // Traverse the outer, potentially bigger matrix, fill in missing pieces with the - // identity matrix. - for (int c = 0; c < matrixCols; ++c) { - for (int r = 0; r < matrixRows; ++r) { - int targetOffset = index + c * matrixRows + r; - if (r < node->getType().getMatrixRows() && c < node->getType().getMatrixCols()) { - int srcOffset = c * node->getType().getMatrixRows() + r; - leftUnionArray[targetOffset] = rightUnionArray[srcOffset]; - } else if (r == c) - leftUnionArray[targetOffset].setDConst(1.0); - else - leftUnionArray[targetOffset].setDConst(0.0); - } - } - } else { - // matrix from vector - int count = 0; - const int startIndex = index; - int nodeComps = node->getType().computeNumComponents(); - for (int i = startIndex; i < endIndex; i++) { - if (i >= instanceSize) - return; - if (i == startIndex || (i - startIndex) % (matrixRows + 1) == 0 ) - leftUnionArray[i] = rightUnionArray[count]; - else - leftUnionArray[i].setDConst(0.0); - - index++; - - if (nodeComps > 1) - count++; - } - } - } - } -} - -bool TIntermediate::parseConstTree(TIntermNode* root, TConstUnionArray unionArray, TOperator constructorType, const TType& t, bool singleConstantParam) -{ - if (root == 0) - return false; - - TConstTraverser it(unionArray, singleConstantParam, constructorType, t); - - root->traverse(&it); - if (it.error) - return true; - else - return false; -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/parseVersions.h b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/parseVersions.h deleted file mode 100755 index 5f26b437..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/parseVersions.h +++ /dev/null @@ -1,140 +0,0 @@ -// -// Copyright (C) 2016 Google, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -// This is implemented in Versions.cpp - -#ifndef _PARSE_VERSIONS_INCLUDED_ -#define _PARSE_VERSIONS_INCLUDED_ - -#include "../Public/ShaderLang.h" -#include "../Include/InfoSink.h" -#include "Scan.h" - -#include - -namespace glslang { - -// -// Base class for parse helpers. -// This just has version-related information and checking. -// This class should be sufficient for preprocessing. -// -class TParseVersions { -public: - TParseVersions(TIntermediate& interm, int version, EProfile profile, - const SpvVersion& spvVersion, EShLanguage language, TInfoSink& infoSink, - bool forwardCompatible, EShMessages messages) - : infoSink(infoSink), version(version), profile(profile), language(language), - spvVersion(spvVersion), forwardCompatible(forwardCompatible), - intermediate(interm), messages(messages), numErrors(0), currentScanner(0) { } - virtual ~TParseVersions() { } - virtual void initializeExtensionBehavior(); - virtual void requireProfile(const TSourceLoc&, int queryProfiles, const char* featureDesc); - virtual void profileRequires(const TSourceLoc&, int queryProfiles, int minVersion, int numExtensions, const char* const extensions[], const char* featureDesc); - virtual void profileRequires(const TSourceLoc&, int queryProfiles, int minVersion, const char* const extension, const char* featureDesc); - virtual void requireStage(const TSourceLoc&, EShLanguageMask, const char* featureDesc); - virtual void requireStage(const TSourceLoc&, EShLanguage, const char* featureDesc); - virtual void checkDeprecated(const TSourceLoc&, int queryProfiles, int depVersion, const char* featureDesc); - virtual void requireNotRemoved(const TSourceLoc&, int queryProfiles, int removedVersion, const char* featureDesc); - virtual void unimplemented(const TSourceLoc&, const char* featureDesc); - virtual void requireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[], const char* featureDesc); - virtual void ppRequireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[], const char* featureDesc); - virtual TExtensionBehavior getExtensionBehavior(const char*); - virtual bool extensionTurnedOn(const char* const extension); - virtual bool extensionsTurnedOn(int numExtensions, const char* const extensions[]); - virtual void updateExtensionBehavior(int line, const char* const extension, const char* behavior); - virtual void fullIntegerCheck(const TSourceLoc&, const char* op); - virtual void doubleCheck(const TSourceLoc&, const char* op); -#ifdef AMD_EXTENSIONS - virtual void int16Check(const TSourceLoc& loc, const char* op, bool builtIn = false); - virtual void float16Check(const TSourceLoc&, const char* op, bool builtIn = false); -#endif - virtual void int64Check(const TSourceLoc&, const char* op, bool builtIn = false); - virtual void spvRemoved(const TSourceLoc&, const char* op); - virtual void vulkanRemoved(const TSourceLoc&, const char* op); - virtual void requireVulkan(const TSourceLoc&, const char* op); - virtual void requireSpv(const TSourceLoc&, const char* op); - virtual bool checkExtensionsRequested(const TSourceLoc&, int numExtensions, const char* const extensions[], const char* featureDesc); - virtual void updateExtensionBehavior(const char* const extension, TExtensionBehavior); - - virtual void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...) = 0; - virtual void C_DECL warn(const TSourceLoc&, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...) = 0; - virtual void C_DECL ppError(const TSourceLoc&, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...) = 0; - virtual void C_DECL ppWarn(const TSourceLoc&, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...) = 0; - - void addError() { ++numErrors; } - int getNumErrors() const { return numErrors; } - - void setScanner(TInputScanner* scanner) { currentScanner = scanner; } - TInputScanner* getScanner() const { return currentScanner; } - const TSourceLoc& getCurrentLoc() const { return currentScanner->getSourceLoc(); } - void setCurrentLine(int line) { currentScanner->setLine(line); } - void setCurrentColumn(int col) { currentScanner->setColumn(col); } - void setCurrentSourceName(const char* name) { currentScanner->setFile(name); } - void setCurrentString(int string) { currentScanner->setString(string); } - - void getPreamble(std::string&); - bool relaxedErrors() const { return (messages & EShMsgRelaxedErrors) != 0; } - bool suppressWarnings() const { return (messages & EShMsgSuppressWarnings) != 0; } - bool isReadingHLSL() const { return (messages & EShMsgReadHlsl) == EShMsgReadHlsl; } - - TInfoSink& infoSink; - - // compilation mode - int version; // version, updated by #version in the shader - EProfile profile; // the declared profile in the shader (core by default) - EShLanguage language; // really the stage - SpvVersion spvVersion; - bool forwardCompatible; // true if errors are to be given for use of deprecated features - TIntermediate& intermediate; // helper for making and hooking up pieces of the parse tree - -protected: - TMap extensionBehavior; // for each extension string, what its current behavior is set to - EShMessages messages; // errors/warnings/rule-sets - int numErrors; // number of compile-time errors encountered - TInputScanner* currentScanner; - -private: - explicit TParseVersions(const TParseVersions&); - TParseVersions& operator=(const TParseVersions&); -}; - -} // end namespace glslang - -#endif // _PARSE_VERSIONS_INCLUDED_ diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp deleted file mode 100644 index 3ae711c8..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp +++ /dev/null @@ -1,1274 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2013 LunarG, Inc. -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// -/****************************************************************************\ -Copyright (c) 2002, NVIDIA Corporation. - -NVIDIA Corporation("NVIDIA") supplies this software to you in -consideration of your agreement to the following terms, and your use, -installation, modification or redistribution of this NVIDIA software -constitutes acceptance of these terms. If you do not agree with these -terms, please do not use, install, modify or redistribute this NVIDIA -software. - -In consideration of your agreement to abide by the following terms, and -subject to these terms, NVIDIA grants you a personal, non-exclusive -license, under NVIDIA's copyrights in this original NVIDIA software (the -"NVIDIA Software"), to use, reproduce, modify and redistribute the -NVIDIA Software, with or without modifications, in source and/or binary -forms; provided that if you redistribute the NVIDIA Software, you must -retain the copyright notice of NVIDIA, this notice and the following -text and disclaimers in all such redistributions of the NVIDIA Software. -Neither the name, trademarks, service marks nor logos of NVIDIA -Corporation may be used to endorse or promote products derived from the -NVIDIA Software without specific prior written permission from NVIDIA. -Except as expressly stated in this notice, no other rights or licenses -express or implied, are granted by NVIDIA herein, including but not -limited to any patent rights that may be infringed by your derivative -works or by other works in which the NVIDIA Software may be -incorporated. No hardware is licensed hereunder. - -THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, -INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR -ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER -PRODUCTS. - -IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, -INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY -OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE -NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, -TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF -NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -\****************************************************************************/ - -#ifndef _CRT_SECURE_NO_WARNINGS -#define _CRT_SECURE_NO_WARNINGS -#endif - -#include -#include -#include -#include -#include - -#include "PpContext.h" -#include "PpTokens.h" - -namespace glslang { - -// Handle #define -int TPpContext::CPPdefine(TPpToken* ppToken) -{ - MacroSymbol mac; - - // get the macro name - int token = scanToken(ppToken); - if (token != PpAtomIdentifier) { - parseContext.ppError(ppToken->loc, "must be followed by macro name", "#define", ""); - return token; - } - if (ppToken->loc.string >= 0) { - // We are in user code; check for reserved name use: - parseContext.reservedPpErrorCheck(ppToken->loc, ppToken->name, "#define"); - } - - // save the macro name - const int defAtom = atomStrings.getAddAtom(ppToken->name); - - // gather parameters to the macro, between (...) - token = scanToken(ppToken); - if (token == '(' && ! ppToken->space) { - mac.emptyArgs = 1; - do { - token = scanToken(ppToken); - if (mac.args.size() == 0 && token == ')') - break; - if (token != PpAtomIdentifier) { - parseContext.ppError(ppToken->loc, "bad argument", "#define", ""); - - return token; - } - mac.emptyArgs = 0; - const int argAtom = atomStrings.getAddAtom(ppToken->name); - - // check for duplication of parameter name - bool duplicate = false; - for (size_t a = 0; a < mac.args.size(); ++a) { - if (mac.args[a] == argAtom) { - parseContext.ppError(ppToken->loc, "duplicate macro parameter", "#define", ""); - duplicate = true; - break; - } - } - if (! duplicate) - mac.args.push_back(argAtom); - token = scanToken(ppToken); - } while (token == ','); - if (token != ')') { - parseContext.ppError(ppToken->loc, "missing parenthesis", "#define", ""); - - return token; - } - - token = scanToken(ppToken); - } - - // record the definition of the macro - TSourceLoc defineLoc = ppToken->loc; // because ppToken is going to go to the next line before we report errors - while (token != '\n' && token != EndOfInput) { - mac.body.putToken(token, ppToken); - token = scanToken(ppToken); - if (token != '\n' && ppToken->space) - mac.body.putToken(' ', ppToken); - } - - // check for duplicate definition - MacroSymbol* existing = lookupMacroDef(defAtom); - if (existing != nullptr) { - if (! existing->undef) { - // Already defined -- need to make sure they are identical: - // "Two replacement lists are identical if and only if the preprocessing tokens in both have the same number, - // ordering, spelling, and white-space separation, where all white-space separations are considered identical." - if (existing->args.size() != mac.args.size() || existing->emptyArgs != mac.emptyArgs) - parseContext.ppError(defineLoc, "Macro redefined; different number of arguments:", "#define", atomStrings.getString(defAtom)); - else { - if (existing->args != mac.args) - parseContext.ppError(defineLoc, "Macro redefined; different argument names:", "#define", atomStrings.getString(defAtom)); - existing->body.reset(); - mac.body.reset(); - int newToken; - do { - int oldToken; - TPpToken oldPpToken; - TPpToken newPpToken; - oldToken = existing->body.getToken(parseContext, &oldPpToken); - newToken = mac.body.getToken(parseContext, &newPpToken); - if (oldToken != newToken || oldPpToken != newPpToken) { - parseContext.ppError(defineLoc, "Macro redefined; different substitutions:", "#define", atomStrings.getString(defAtom)); - break; - } - } while (newToken > 0); - } - } - *existing = mac; - } else - addMacroDef(defAtom, mac); - - return '\n'; -} - -// Handle #undef -int TPpContext::CPPundef(TPpToken* ppToken) -{ - int token = scanToken(ppToken); - if (token != PpAtomIdentifier) { - parseContext.ppError(ppToken->loc, "must be followed by macro name", "#undef", ""); - - return token; - } - - parseContext.reservedPpErrorCheck(ppToken->loc, ppToken->name, "#undef"); - - MacroSymbol* macro = lookupMacroDef(atomStrings.getAtom(ppToken->name)); - if (macro != nullptr) - macro->undef = 1; - token = scanToken(ppToken); - if (token != '\n') - parseContext.ppError(ppToken->loc, "can only be followed by a single macro name", "#undef", ""); - - return token; -} - -// Handle #else -/* Skip forward to appropriate spot. This is used both -** to skip to a #endif after seeing an #else, AND to skip to a #else, -** #elif, or #endif after a #if/#ifdef/#ifndef/#elif test was false. -*/ -int TPpContext::CPPelse(int matchelse, TPpToken* ppToken) -{ - int depth = 0; - int token = scanToken(ppToken); - - while (token != EndOfInput) { - if (token != '#') { - while (token != '\n' && token != EndOfInput) - token = scanToken(ppToken); - - if (token == EndOfInput) - return token; - - token = scanToken(ppToken); - continue; - } - - if ((token = scanToken(ppToken)) != PpAtomIdentifier) - continue; - - int nextAtom = atomStrings.getAtom(ppToken->name); - if (nextAtom == PpAtomIf || nextAtom == PpAtomIfdef || nextAtom == PpAtomIfndef) { - depth++; - if (ifdepth >= maxIfNesting || elsetracker >= maxIfNesting) { - parseContext.ppError(ppToken->loc, "maximum nesting depth exceeded", "#if/#ifdef/#ifndef", ""); - return EndOfInput; - } else { - ifdepth++; - elsetracker++; - } - } else if (nextAtom == PpAtomEndif) { - token = extraTokenCheck(nextAtom, ppToken, scanToken(ppToken)); - elseSeen[elsetracker] = false; - --elsetracker; - if (depth == 0) { - // found the #endif we are looking for - if (ifdepth > 0) - --ifdepth; - break; - } - --depth; - --ifdepth; - } else if (matchelse && depth == 0) { - if (nextAtom == PpAtomElse) { - elseSeen[elsetracker] = true; - token = extraTokenCheck(nextAtom, ppToken, scanToken(ppToken)); - // found the #else we are looking for - break; - } else if (nextAtom == PpAtomElif) { - if (elseSeen[elsetracker]) - parseContext.ppError(ppToken->loc, "#elif after #else", "#elif", ""); - /* we decrement ifdepth here, because CPPif will increment - * it and we really want to leave it alone */ - if (ifdepth > 0) { - --ifdepth; - elseSeen[elsetracker] = false; - --elsetracker; - } - - return CPPif(ppToken); - } - } else if (nextAtom == PpAtomElse) { - if (elseSeen[elsetracker]) - parseContext.ppError(ppToken->loc, "#else after #else", "#else", ""); - else - elseSeen[elsetracker] = true; - token = extraTokenCheck(nextAtom, ppToken, scanToken(ppToken)); - } else if (nextAtom == PpAtomElif) { - if (elseSeen[elsetracker]) - parseContext.ppError(ppToken->loc, "#elif after #else", "#elif", ""); - } - } - - return token; -} - -// Call when there should be no more tokens left on a line. -int TPpContext::extraTokenCheck(int contextAtom, TPpToken* ppToken, int token) -{ - if (token != '\n' && token != EndOfInput) { - static const char* message = "unexpected tokens following directive"; - - const char* label; - if (contextAtom == PpAtomElse) - label = "#else"; - else if (contextAtom == PpAtomElif) - label = "#elif"; - else if (contextAtom == PpAtomEndif) - label = "#endif"; - else if (contextAtom == PpAtomIf) - label = "#if"; - else if (contextAtom == PpAtomLine) - label = "#line"; - else - label = ""; - - if (parseContext.relaxedErrors()) - parseContext.ppWarn(ppToken->loc, message, label, ""); - else - parseContext.ppError(ppToken->loc, message, label, ""); - - while (token != '\n' && token != EndOfInput) - token = scanToken(ppToken); - } - - return token; -} - -enum eval_prec { - MIN_PRECEDENCE, - COND, LOGOR, LOGAND, OR, XOR, AND, EQUAL, RELATION, SHIFT, ADD, MUL, UNARY, - MAX_PRECEDENCE -}; - -namespace { - - int op_logor(int a, int b) { return a || b; } - int op_logand(int a, int b) { return a && b; } - int op_or(int a, int b) { return a | b; } - int op_xor(int a, int b) { return a ^ b; } - int op_and(int a, int b) { return a & b; } - int op_eq(int a, int b) { return a == b; } - int op_ne(int a, int b) { return a != b; } - int op_ge(int a, int b) { return a >= b; } - int op_le(int a, int b) { return a <= b; } - int op_gt(int a, int b) { return a > b; } - int op_lt(int a, int b) { return a < b; } - int op_shl(int a, int b) { return a << b; } - int op_shr(int a, int b) { return a >> b; } - int op_add(int a, int b) { return a + b; } - int op_sub(int a, int b) { return a - b; } - int op_mul(int a, int b) { return a * b; } - int op_div(int a, int b) { return a == INT_MIN && b == -1 ? 0 : a / b; } - int op_mod(int a, int b) { return a == INT_MIN && b == -1 ? 0 : a % b; } - int op_pos(int a) { return a; } - int op_neg(int a) { return -a; } - int op_cmpl(int a) { return ~a; } - int op_not(int a) { return !a; } - -}; - -struct TBinop { - int token, precedence, (*op)(int, int); -} binop[] = { - { PpAtomOr, LOGOR, op_logor }, - { PpAtomAnd, LOGAND, op_logand }, - { '|', OR, op_or }, - { '^', XOR, op_xor }, - { '&', AND, op_and }, - { PpAtomEQ, EQUAL, op_eq }, - { PpAtomNE, EQUAL, op_ne }, - { '>', RELATION, op_gt }, - { PpAtomGE, RELATION, op_ge }, - { '<', RELATION, op_lt }, - { PpAtomLE, RELATION, op_le }, - { PpAtomLeft, SHIFT, op_shl }, - { PpAtomRight, SHIFT, op_shr }, - { '+', ADD, op_add }, - { '-', ADD, op_sub }, - { '*', MUL, op_mul }, - { '/', MUL, op_div }, - { '%', MUL, op_mod }, -}; - -struct TUnop { - int token, (*op)(int); -} unop[] = { - { '+', op_pos }, - { '-', op_neg }, - { '~', op_cmpl }, - { '!', op_not }, -}; - -#define NUM_ELEMENTS(A) (sizeof(A) / sizeof(A[0])) - -int TPpContext::eval(int token, int precedence, bool shortCircuit, int& res, bool& err, TPpToken* ppToken) -{ - TSourceLoc loc = ppToken->loc; // because we sometimes read the newline before reporting the error - if (token == PpAtomIdentifier) { - if (strcmp("defined", ppToken->name) == 0) { - if (! parseContext.isReadingHLSL() && isMacroInput()) { - if (parseContext.relaxedErrors()) - parseContext.ppWarn(ppToken->loc, "nonportable when expanded from macros for preprocessor expression", - "defined", ""); - else - parseContext.ppError(ppToken->loc, "cannot use in preprocessor expression when expanded from macros", - "defined", ""); - } - bool needclose = 0; - token = scanToken(ppToken); - if (token == '(') { - needclose = true; - token = scanToken(ppToken); - } - if (token != PpAtomIdentifier) { - parseContext.ppError(loc, "incorrect directive, expected identifier", "preprocessor evaluation", ""); - err = true; - res = 0; - - return token; - } - - MacroSymbol* macro = lookupMacroDef(atomStrings.getAtom(ppToken->name)); - res = macro != nullptr ? !macro->undef : 0; - token = scanToken(ppToken); - if (needclose) { - if (token != ')') { - parseContext.ppError(loc, "expected ')'", "preprocessor evaluation", ""); - err = true; - res = 0; - - return token; - } - token = scanToken(ppToken); - } - } else { - token = evalToToken(token, shortCircuit, res, err, ppToken); - return eval(token, precedence, shortCircuit, res, err, ppToken); - } - } else if (token == PpAtomConstInt) { - res = ppToken->ival; - token = scanToken(ppToken); - } else if (token == '(') { - token = scanToken(ppToken); - token = eval(token, MIN_PRECEDENCE, shortCircuit, res, err, ppToken); - if (! err) { - if (token != ')') { - parseContext.ppError(loc, "expected ')'", "preprocessor evaluation", ""); - err = true; - res = 0; - - return token; - } - token = scanToken(ppToken); - } - } else { - int op = NUM_ELEMENTS(unop) - 1; - for (; op >= 0; op--) { - if (unop[op].token == token) - break; - } - if (op >= 0) { - token = scanToken(ppToken); - token = eval(token, UNARY, shortCircuit, res, err, ppToken); - res = unop[op].op(res); - } else { - parseContext.ppError(loc, "bad expression", "preprocessor evaluation", ""); - err = true; - res = 0; - - return token; - } - } - - token = evalToToken(token, shortCircuit, res, err, ppToken); - - // Perform evaluation of binary operation, if there is one, otherwise we are done. - while (! err) { - if (token == ')' || token == '\n') - break; - int op; - for (op = NUM_ELEMENTS(binop) - 1; op >= 0; op--) { - if (binop[op].token == token) - break; - } - if (op < 0 || binop[op].precedence <= precedence) - break; - int leftSide = res; - - // Setup short-circuiting, needed for ES, unless already in a short circuit. - // (Once in a short-circuit, can't turn off again, until that whole subexpression is done. - if (! shortCircuit) { - if ((token == PpAtomOr && leftSide == 1) || - (token == PpAtomAnd && leftSide == 0)) - shortCircuit = true; - } - - token = scanToken(ppToken); - token = eval(token, binop[op].precedence, shortCircuit, res, err, ppToken); - - if (binop[op].op == op_div || binop[op].op == op_mod) { - if (res == 0) { - parseContext.ppError(loc, "division by 0", "preprocessor evaluation", ""); - res = 1; - } - } - res = binop[op].op(leftSide, res); - } - - return token; -} - -// Expand macros, skipping empty expansions, to get to the first real token in those expansions. -int TPpContext::evalToToken(int token, bool shortCircuit, int& res, bool& err, TPpToken* ppToken) -{ - while (token == PpAtomIdentifier && strcmp("defined", ppToken->name) != 0) { - int macroReturn = MacroExpand(ppToken, true, false); - if (macroReturn == 0) { - parseContext.ppError(ppToken->loc, "can't evaluate expression", "preprocessor evaluation", ""); - err = true; - res = 0; - token = scanToken(ppToken); - break; - } - if (macroReturn == -1) { - if (! shortCircuit && parseContext.profile == EEsProfile) { - const char* message = "undefined macro in expression not allowed in es profile"; - if (parseContext.relaxedErrors()) - parseContext.ppWarn(ppToken->loc, message, "preprocessor evaluation", ppToken->name); - else - parseContext.ppError(ppToken->loc, message, "preprocessor evaluation", ppToken->name); - } - } - token = scanToken(ppToken); - } - - return token; -} - -// Handle #if -int TPpContext::CPPif(TPpToken* ppToken) -{ - int token = scanToken(ppToken); - if (ifdepth >= maxIfNesting || elsetracker >= maxIfNesting) { - parseContext.ppError(ppToken->loc, "maximum nesting depth exceeded", "#if", ""); - return EndOfInput; - } else { - elsetracker++; - ifdepth++; - } - int res = 0; - bool err = false; - token = eval(token, MIN_PRECEDENCE, false, res, err, ppToken); - token = extraTokenCheck(PpAtomIf, ppToken, token); - if (!res && !err) - token = CPPelse(1, ppToken); - - return token; -} - -// Handle #ifdef -int TPpContext::CPPifdef(int defined, TPpToken* ppToken) -{ - int token = scanToken(ppToken); - if (ifdepth > maxIfNesting || elsetracker > maxIfNesting) { - parseContext.ppError(ppToken->loc, "maximum nesting depth exceeded", "#ifdef", ""); - return EndOfInput; - } else { - elsetracker++; - ifdepth++; - } - - if (token != PpAtomIdentifier) { - if (defined) - parseContext.ppError(ppToken->loc, "must be followed by macro name", "#ifdef", ""); - else - parseContext.ppError(ppToken->loc, "must be followed by macro name", "#ifndef", ""); - } else { - MacroSymbol* macro = lookupMacroDef(atomStrings.getAtom(ppToken->name)); - token = scanToken(ppToken); - if (token != '\n') { - parseContext.ppError(ppToken->loc, "unexpected tokens following #ifdef directive - expected a newline", "#ifdef", ""); - while (token != '\n' && token != EndOfInput) - token = scanToken(ppToken); - } - if (((macro != nullptr && !macro->undef) ? 1 : 0) != defined) - token = CPPelse(1, ppToken); - } - - return token; -} - -// Handle #include ... -// TODO: Handle macro expansions for the header name -int TPpContext::CPPinclude(TPpToken* ppToken) -{ - const TSourceLoc directiveLoc = ppToken->loc; - bool startWithLocalSearch = true; // to additionally include the extra "" paths - int token = scanToken(ppToken); - - // handle -style #include - if (token == '<') { - startWithLocalSearch = false; - token = scanHeaderName(ppToken, '>'); - } - // otherwise ppToken already has the header name and it was "header-name" style - - if (token != PpAtomConstString) { - parseContext.ppError(directiveLoc, "must be followed by a header name", "#include", ""); - return token; - } - - // Make a copy of the name because it will be overwritten by the next token scan. - const std::string filename = ppToken->name; - - // See if the directive was well formed - token = scanToken(ppToken); - if (token != '\n') { - if (token == EndOfInput) - parseContext.ppError(ppToken->loc, "expected newline after header name:", "#include", "%s", filename.c_str()); - else - parseContext.ppError(ppToken->loc, "extra content after header name:", "#include", "%s", filename.c_str()); - return token; - } - - // Process well-formed directive - - // Find the inclusion, first look in "Local" ("") paths, if requested, - // otherwise, only search the "System" (<>) paths. - TShader::Includer::IncludeResult* res = nullptr; - if (startWithLocalSearch) - res = includer.includeLocal(filename.c_str(), currentSourceFile.c_str(), includeStack.size() + 1); - if (res == nullptr || res->headerName.empty()) { - includer.releaseInclude(res); - res = includer.includeSystem(filename.c_str(), currentSourceFile.c_str(), includeStack.size() + 1); - } - - // Process the results - if (res != nullptr && !res->headerName.empty()) { - if (res->headerData != nullptr && res->headerLength > 0) { - // path for processing one or more tokens from an included header, hand off 'res' - const bool forNextLine = parseContext.lineDirectiveShouldSetNextLine(); - std::ostringstream prologue; - std::ostringstream epilogue; - prologue << "#line " << forNextLine << " " << "\"" << res->headerName << "\"\n"; - epilogue << (res->headerData[res->headerLength - 1] == '\n'? "" : "\n") << - "#line " << directiveLoc.line + forNextLine << " " << directiveLoc.getStringNameOrNum() << "\n"; - pushInput(new TokenizableIncludeFile(directiveLoc, prologue.str(), res, epilogue.str(), this)); - // There's no "current" location anymore. - parseContext.setCurrentColumn(0); - } else { - // things are okay, but there is nothing to process - includer.releaseInclude(res); - } - } else { - // error path, clean up - std::string message = - res != nullptr ? std::string(res->headerData, res->headerLength) - : std::string("Could not process include directive"); - parseContext.ppError(directiveLoc, message.c_str(), "#include", "for header name: %s", filename.c_str()); - includer.releaseInclude(res); - } - - return token; -} - -// Handle #line -int TPpContext::CPPline(TPpToken* ppToken) -{ - // "#line must have, after macro substitution, one of the following forms: - // "#line line - // "#line line source-string-number" - - int token = scanToken(ppToken); - const TSourceLoc directiveLoc = ppToken->loc; - if (token == '\n') { - parseContext.ppError(ppToken->loc, "must by followed by an integral literal", "#line", ""); - return token; - } - - int lineRes = 0; // Line number after macro expansion. - int lineToken = 0; - bool hasFile = false; - int fileRes = 0; // Source file number after macro expansion. - const char* sourceName = nullptr; // Optional source file name. - bool lineErr = false; - bool fileErr = false; - token = eval(token, MIN_PRECEDENCE, false, lineRes, lineErr, ppToken); - if (! lineErr) { - lineToken = lineRes; - if (token == '\n') - ++lineRes; - - if (parseContext.lineDirectiveShouldSetNextLine()) - --lineRes; - parseContext.setCurrentLine(lineRes); - - if (token != '\n') { - if (token == PpAtomConstString) { - parseContext.ppRequireExtensions(directiveLoc, 1, &E_GL_GOOGLE_cpp_style_line_directive, "filename-based #line"); - // We need to save a copy of the string instead of pointing - // to the name field of the token since the name field - // will likely be overwritten by the next token scan. - sourceName = atomStrings.getString(atomStrings.getAddAtom(ppToken->name)); - parseContext.setCurrentSourceName(sourceName); - hasFile = true; - token = scanToken(ppToken); - } else { - token = eval(token, MIN_PRECEDENCE, false, fileRes, fileErr, ppToken); - if (! fileErr) { - parseContext.setCurrentString(fileRes); - hasFile = true; - } - } - } - } - if (!fileErr && !lineErr) { - parseContext.notifyLineDirective(directiveLoc.line, lineToken, hasFile, fileRes, sourceName); - } - token = extraTokenCheck(PpAtomLine, ppToken, token); - - return token; -} - -// Handle #error -int TPpContext::CPPerror(TPpToken* ppToken) -{ - int token = scanToken(ppToken); - std::string message; - TSourceLoc loc = ppToken->loc; - - while (token != '\n' && token != EndOfInput) { - if (token == PpAtomConstInt || token == PpAtomConstUint || - token == PpAtomConstInt64 || token == PpAtomConstUint64 || -#ifdef AMD_EXTENSIONS - token == PpAtomConstInt16 || token == PpAtomConstUint16 || - token == PpAtomConstFloat16 || -#endif - token == PpAtomConstFloat || token == PpAtomConstDouble) { - message.append(ppToken->name); - } else if (token == PpAtomIdentifier || token == PpAtomConstString) { - message.append(ppToken->name); - } else { - message.append(atomStrings.getString(token)); - } - message.append(" "); - token = scanToken(ppToken); - } - parseContext.notifyErrorDirective(loc.line, message.c_str()); - // store this msg into the shader's information log..set the Compile Error flag!!!! - parseContext.ppError(loc, message.c_str(), "#error", ""); - - return '\n'; -} - -// Handle #pragma -int TPpContext::CPPpragma(TPpToken* ppToken) -{ - char SrcStrName[2]; - TVector tokens; - - TSourceLoc loc = ppToken->loc; // because we go to the next line before processing - int token = scanToken(ppToken); - while (token != '\n' && token != EndOfInput) { - switch (token) { - case PpAtomIdentifier: - case PpAtomConstInt: - case PpAtomConstUint: - case PpAtomConstInt64: - case PpAtomConstUint64: -#ifdef AMD_EXTENSIONS - case PpAtomConstInt16: - case PpAtomConstUint16: -#endif - case PpAtomConstFloat: - case PpAtomConstDouble: -#ifdef AMD_EXTENSIONS - case PpAtomConstFloat16: -#endif - tokens.push_back(ppToken->name); - break; - default: - SrcStrName[0] = (char)token; - SrcStrName[1] = '\0'; - tokens.push_back(SrcStrName); - } - token = scanToken(ppToken); - } - - if (token == EndOfInput) - parseContext.ppError(loc, "directive must end with a newline", "#pragma", ""); - else - parseContext.handlePragma(loc, tokens); - - return token; -} - -// #version: This is just for error checking: the version and profile are decided before preprocessing starts -int TPpContext::CPPversion(TPpToken* ppToken) -{ - int token = scanToken(ppToken); - - if (errorOnVersion || versionSeen) { - if (parseContext.isReadingHLSL()) - parseContext.ppError(ppToken->loc, "invalid preprocessor command", "#version", ""); - else - parseContext.ppError(ppToken->loc, "must occur first in shader", "#version", ""); - } - versionSeen = true; - - if (token == '\n') { - parseContext.ppError(ppToken->loc, "must be followed by version number", "#version", ""); - - return token; - } - - if (token != PpAtomConstInt) - parseContext.ppError(ppToken->loc, "must be followed by version number", "#version", ""); - - ppToken->ival = atoi(ppToken->name); - int versionNumber = ppToken->ival; - int line = ppToken->loc.line; - token = scanToken(ppToken); - - if (token == '\n') { - parseContext.notifyVersion(line, versionNumber, nullptr); - return token; - } else { - int profileAtom = atomStrings.getAtom(ppToken->name); - if (profileAtom != PpAtomCore && - profileAtom != PpAtomCompatibility && - profileAtom != PpAtomEs) - parseContext.ppError(ppToken->loc, "bad profile name; use es, core, or compatibility", "#version", ""); - parseContext.notifyVersion(line, versionNumber, ppToken->name); - token = scanToken(ppToken); - - if (token == '\n') - return token; - else - parseContext.ppError(ppToken->loc, "bad tokens following profile -- expected newline", "#version", ""); - } - - return token; -} - -// Handle #extension -int TPpContext::CPPextension(TPpToken* ppToken) -{ - int line = ppToken->loc.line; - int token = scanToken(ppToken); - char extensionName[MaxTokenLength + 1]; - - if (token=='\n') { - parseContext.ppError(ppToken->loc, "extension name not specified", "#extension", ""); - return token; - } - - if (token != PpAtomIdentifier) - parseContext.ppError(ppToken->loc, "extension name expected", "#extension", ""); - - assert(strlen(ppToken->name) <= MaxTokenLength); - strcpy(extensionName, ppToken->name); - - token = scanToken(ppToken); - if (token != ':') { - parseContext.ppError(ppToken->loc, "':' missing after extension name", "#extension", ""); - return token; - } - - token = scanToken(ppToken); - if (token != PpAtomIdentifier) { - parseContext.ppError(ppToken->loc, "behavior for extension not specified", "#extension", ""); - return token; - } - - parseContext.updateExtensionBehavior(line, extensionName, ppToken->name); - parseContext.notifyExtensionDirective(line, extensionName, ppToken->name); - - token = scanToken(ppToken); - if (token == '\n') - return token; - else - parseContext.ppError(ppToken->loc, "extra tokens -- expected newline", "#extension",""); - - return token; -} - -int TPpContext::readCPPline(TPpToken* ppToken) -{ - int token = scanToken(ppToken); - - if (token == PpAtomIdentifier) { - switch (atomStrings.getAtom(ppToken->name)) { - case PpAtomDefine: - token = CPPdefine(ppToken); - break; - case PpAtomElse: - if (elseSeen[elsetracker]) - parseContext.ppError(ppToken->loc, "#else after #else", "#else", ""); - elseSeen[elsetracker] = true; - if (ifdepth == 0) - parseContext.ppError(ppToken->loc, "mismatched statements", "#else", ""); - token = extraTokenCheck(PpAtomElse, ppToken, scanToken(ppToken)); - token = CPPelse(0, ppToken); - break; - case PpAtomElif: - if (ifdepth == 0) - parseContext.ppError(ppToken->loc, "mismatched statements", "#elif", ""); - if (elseSeen[elsetracker]) - parseContext.ppError(ppToken->loc, "#elif after #else", "#elif", ""); - // this token is really a dont care, but we still need to eat the tokens - token = scanToken(ppToken); - while (token != '\n' && token != EndOfInput) - token = scanToken(ppToken); - token = CPPelse(0, ppToken); - break; - case PpAtomEndif: - if (ifdepth == 0) - parseContext.ppError(ppToken->loc, "mismatched statements", "#endif", ""); - else { - elseSeen[elsetracker] = false; - --elsetracker; - --ifdepth; - } - token = extraTokenCheck(PpAtomEndif, ppToken, scanToken(ppToken)); - break; - case PpAtomIf: - token = CPPif(ppToken); - break; - case PpAtomIfdef: - token = CPPifdef(1, ppToken); - break; - case PpAtomIfndef: - token = CPPifdef(0, ppToken); - break; - case PpAtomInclude: - if(!parseContext.isReadingHLSL()) { - parseContext.ppRequireExtensions(ppToken->loc, 1, &E_GL_GOOGLE_include_directive, "#include"); - } - token = CPPinclude(ppToken); - break; - case PpAtomLine: - token = CPPline(ppToken); - break; - case PpAtomPragma: - token = CPPpragma(ppToken); - break; - case PpAtomUndef: - token = CPPundef(ppToken); - break; - case PpAtomError: - token = CPPerror(ppToken); - break; - case PpAtomVersion: - token = CPPversion(ppToken); - break; - case PpAtomExtension: - token = CPPextension(ppToken); - break; - default: - parseContext.ppError(ppToken->loc, "invalid directive:", "#", ppToken->name); - break; - } - } else if (token != '\n' && token != EndOfInput) - parseContext.ppError(ppToken->loc, "invalid directive", "#", ""); - - while (token != '\n' && token != EndOfInput) - token = scanToken(ppToken); - - return token; -} - -// Context-dependent parsing of a #include . -// Assumes no macro expansions etc. are being done; the name is just on the current input. -// Always creates a name and returns PpAtomicConstString, unless we run out of input. -int TPpContext::scanHeaderName(TPpToken* ppToken, char delimit) -{ - bool tooLong = false; - - if (inputStack.empty()) - return EndOfInput; - - int len = 0; - ppToken->name[0] = '\0'; - do { - int ch = inputStack.back()->getch(); - - // done yet? - if (ch == delimit) { - ppToken->name[len] = '\0'; - if (tooLong) - parseContext.ppError(ppToken->loc, "header name too long", "", ""); - return PpAtomConstString; - } else if (ch == EndOfInput) - return EndOfInput; - - // found a character to expand the name with - if (len < MaxTokenLength) - ppToken->name[len++] = (char)ch; - else - tooLong = true; - } while (true); -} - -// Macro-expand a macro argument 'arg' to create 'expandedArg'. -// Does not replace 'arg'. -// Returns nullptr if no expanded argument is created. -TPpContext::TokenStream* TPpContext::PrescanMacroArg(TokenStream& arg, TPpToken* ppToken, bool newLineOkay) -{ - // expand the argument - TokenStream* expandedArg = new TokenStream; - pushInput(new tMarkerInput(this)); - pushTokenStreamInput(arg); - int token; - while ((token = scanToken(ppToken)) != tMarkerInput::marker && token != EndOfInput) { - token = tokenPaste(token, *ppToken); - if (token == tMarkerInput::marker || token == EndOfInput) - break; - if (token == PpAtomIdentifier && MacroExpand(ppToken, false, newLineOkay) != 0) - continue; - expandedArg->putToken(token, ppToken); - } - - if (token == EndOfInput) { - // MacroExpand ate the marker, so had bad input, recover - delete expandedArg; - expandedArg = nullptr; - } else { - // remove the marker - popInput(); - } - - return expandedArg; -} - -// -// Return the next token for a macro expansion, handling macro arguments, -// whose semantics are dependent on being adjacent to ##. -// -int TPpContext::tMacroInput::scan(TPpToken* ppToken) -{ - int token; - do { - token = mac->body.getToken(pp->parseContext, ppToken); - } while (token == ' '); // handle white space in macro - - // Hash operators basically turn off a round of macro substitution - // (the round done on the argument before the round done on the RHS of the - // macro definition): - // - // "A parameter in the replacement list, unless preceded by a # or ## - // preprocessing token or followed by a ## preprocessing token (see below), - // is replaced by the corresponding argument after all macros contained - // therein have been expanded." - // - // "If, in the replacement list, a parameter is immediately preceded or - // followed by a ## preprocessing token, the parameter is replaced by the - // corresponding argument's preprocessing token sequence." - - bool pasting = false; - if (postpaste) { - // don't expand next token - pasting = true; - postpaste = false; - } - - if (prepaste) { - // already know we should be on a ##, verify - assert(token == PpAtomPaste); - prepaste = false; - postpaste = true; - } - - // see if are preceding a ## - if (mac->body.peekUntokenizedPasting()) { - prepaste = true; - pasting = true; - } - - // HLSL does expand macros before concatenation - if (pasting && pp->parseContext.isReadingHLSL()) - pasting = false; - - // TODO: preprocessor: properly handle whitespace (or lack of it) between tokens when expanding - if (token == PpAtomIdentifier) { - int i; - for (i = (int)mac->args.size() - 1; i >= 0; i--) - if (strcmp(pp->atomStrings.getString(mac->args[i]), ppToken->name) == 0) - break; - if (i >= 0) { - TokenStream* arg = expandedArgs[i]; - if (arg == nullptr || pasting) - arg = args[i]; - pp->pushTokenStreamInput(*arg, prepaste); - - return pp->scanToken(ppToken); - } - } - - if (token == EndOfInput) - mac->busy = 0; - - return token; -} - -// return a textual zero, for scanning a macro that was never defined -int TPpContext::tZeroInput::scan(TPpToken* ppToken) -{ - if (done) - return EndOfInput; - - strcpy(ppToken->name, "0"); - ppToken->ival = 0; - ppToken->space = false; - done = true; - - return PpAtomConstInt; -} - -// -// Check a token to see if it is a macro that should be expanded. -// If it is, and defined, push a tInput that will produce the appropriate expansion -// and return 1. -// If it is, but undefined, and expandUndef is requested, push a tInput that will -// expand to 0 and return -1. -// Otherwise, return 0 to indicate no expansion, which is not necessarily an error. -// -int TPpContext::MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOkay) -{ - ppToken->space = false; - int macroAtom = atomStrings.getAtom(ppToken->name); - switch (macroAtom) { - case PpAtomLineMacro: - ppToken->ival = parseContext.getCurrentLoc().line; - snprintf(ppToken->name, sizeof(ppToken->name), "%d", ppToken->ival); - UngetToken(PpAtomConstInt, ppToken); - return 1; - - case PpAtomFileMacro: { - if (parseContext.getCurrentLoc().name) - parseContext.ppRequireExtensions(ppToken->loc, 1, &E_GL_GOOGLE_cpp_style_line_directive, "filename-based __FILE__"); - ppToken->ival = parseContext.getCurrentLoc().string; - snprintf(ppToken->name, sizeof(ppToken->name), "%s", ppToken->loc.getStringNameOrNum().c_str()); - UngetToken(PpAtomConstInt, ppToken); - return 1; - } - - case PpAtomVersionMacro: - ppToken->ival = parseContext.version; - snprintf(ppToken->name, sizeof(ppToken->name), "%d", ppToken->ival); - UngetToken(PpAtomConstInt, ppToken); - return 1; - - default: - break; - } - - MacroSymbol* macro = macroAtom == 0 ? nullptr : lookupMacroDef(macroAtom); - int depth = 0; - - // no recursive expansions - if (macro != nullptr && macro->busy) - return 0; - - // not expanding undefined macros - if ((macro == nullptr || macro->undef) && ! expandUndef) - return 0; - - // 0 is the value of an undefined macro - if ((macro == nullptr || macro->undef) && expandUndef) { - pushInput(new tZeroInput(this)); - return -1; - } - - tMacroInput *in = new tMacroInput(this); - - TSourceLoc loc = ppToken->loc; // in case we go to the next line before discovering the error - in->mac = macro; - if (macro->args.size() > 0 || macro->emptyArgs) { - int token = scanToken(ppToken); - if (newLineOkay) { - while (token == '\n') - token = scanToken(ppToken); - } - if (token != '(') { - UngetToken(token, ppToken); - delete in; - return 0; - } - in->args.resize(in->mac->args.size()); - for (size_t i = 0; i < in->mac->args.size(); i++) - in->args[i] = new TokenStream; - in->expandedArgs.resize(in->mac->args.size()); - for (size_t i = 0; i < in->mac->args.size(); i++) - in->expandedArgs[i] = nullptr; - size_t arg = 0; - bool tokenRecorded = false; - do { - depth = 0; - while (1) { - token = scanToken(ppToken); - if (token == EndOfInput || token == tMarkerInput::marker) { - parseContext.ppError(loc, "End of input in macro", "macro expansion", atomStrings.getString(macroAtom)); - delete in; - return 0; - } - if (token == '\n') { - if (! newLineOkay) { - parseContext.ppError(loc, "End of line in macro substitution:", "macro expansion", atomStrings.getString(macroAtom)); - delete in; - return 0; - } - continue; - } - if (token == '#') { - parseContext.ppError(ppToken->loc, "unexpected '#'", "macro expansion", atomStrings.getString(macroAtom)); - delete in; - return 0; - } - if (in->mac->args.size() == 0 && token != ')') - break; - if (depth == 0 && (token == ',' || token == ')')) - break; - if (token == '(') - depth++; - if (token == ')') - depth--; - in->args[arg]->putToken(token, ppToken); - tokenRecorded = true; - } - if (token == ')') { - if (in->mac->args.size() == 1 && tokenRecorded == 0) - break; - arg++; - break; - } - arg++; - } while (arg < in->mac->args.size()); - - if (arg < in->mac->args.size()) - parseContext.ppError(loc, "Too few args in Macro", "macro expansion", atomStrings.getString(macroAtom)); - else if (token != ')') { - depth=0; - while (token != EndOfInput && (depth > 0 || token != ')')) { - if (token == ')') - depth--; - token = scanToken(ppToken); - if (token == '(') - depth++; - } - - if (token == EndOfInput) { - parseContext.ppError(loc, "End of input in macro", "macro expansion", atomStrings.getString(macroAtom)); - delete in; - return 0; - } - parseContext.ppError(loc, "Too many args in macro", "macro expansion", atomStrings.getString(macroAtom)); - } - - // We need both expanded and non-expanded forms of the argument, for whether or - // not token pasting will be applied later when the argument is consumed next to ##. - for (size_t i = 0; i < in->mac->args.size(); i++) - in->expandedArgs[i] = PrescanMacroArg(*in->args[i], ppToken, newLineOkay); - } - - pushInput(in); - macro->busy = 1; - macro->body.reset(); - - return 1; -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpAtom.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpAtom.cpp deleted file mode 100644 index 06c2333e..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpAtom.cpp +++ /dev/null @@ -1,181 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2013 LunarG, Inc. -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// -/****************************************************************************\ -Copyright (c) 2002, NVIDIA Corporation. - -NVIDIA Corporation("NVIDIA") supplies this software to you in -consideration of your agreement to the following terms, and your use, -installation, modification or redistribution of this NVIDIA software -constitutes acceptance of these terms. If you do not agree with these -terms, please do not use, install, modify or redistribute this NVIDIA -software. - -In consideration of your agreement to abide by the following terms, and -subject to these terms, NVIDIA grants you a personal, non-exclusive -license, under NVIDIA's copyrights in this original NVIDIA software (the -"NVIDIA Software"), to use, reproduce, modify and redistribute the -NVIDIA Software, with or without modifications, in source and/or binary -forms; provided that if you redistribute the NVIDIA Software, you must -retain the copyright notice of NVIDIA, this notice and the following -text and disclaimers in all such redistributions of the NVIDIA Software. -Neither the name, trademarks, service marks nor logos of NVIDIA -Corporation may be used to endorse or promote products derived from the -NVIDIA Software without specific prior written permission from NVIDIA. -Except as expressly stated in this notice, no other rights or licenses -express or implied, are granted by NVIDIA herein, including but not -limited to any patent rights that may be infringed by your derivative -works or by other works in which the NVIDIA Software may be -incorporated. No hardware is licensed hereunder. - -THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, -INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR -ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER -PRODUCTS. - -IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, -INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY -OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE -NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, -TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF -NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -\****************************************************************************/ - -#ifndef _CRT_SECURE_NO_WARNINGS -#define _CRT_SECURE_NO_WARNINGS -#endif - -#include -#include -#include - -#include "PpContext.h" -#include "PpTokens.h" - -namespace { - -using namespace glslang; - -const struct { - int val; - const char* str; -} tokens[] = { - - { PPAtomAddAssign, "+=" }, - { PPAtomSubAssign, "-=" }, - { PPAtomMulAssign, "*=" }, - { PPAtomDivAssign, "/=" }, - { PPAtomModAssign, "%=" }, - - { PpAtomRight, ">>" }, - { PpAtomLeft, "<<" }, - { PpAtomAnd, "&&" }, - { PpAtomOr, "||" }, - { PpAtomXor, "^^" }, - - { PpAtomRightAssign, ">>=" }, - { PpAtomLeftAssign, "<<=" }, - { PpAtomAndAssign, "&=" }, - { PpAtomOrAssign, "|=" }, - { PpAtomXorAssign, "^=" }, - - { PpAtomEQ, "==" }, - { PpAtomNE, "!=" }, - { PpAtomGE, ">=" }, - { PpAtomLE, "<=" }, - - { PpAtomDecrement, "--" }, - { PpAtomIncrement, "++" }, - - { PpAtomColonColon, "::" }, - - { PpAtomDefine, "define" }, - { PpAtomUndef, "undef" }, - { PpAtomIf, "if" }, - { PpAtomElif, "elif" }, - { PpAtomElse, "else" }, - { PpAtomEndif, "endif" }, - { PpAtomIfdef, "ifdef" }, - { PpAtomIfndef, "ifndef" }, - { PpAtomLine, "line" }, - { PpAtomPragma, "pragma" }, - { PpAtomError, "error" }, - - { PpAtomVersion, "version" }, - { PpAtomCore, "core" }, - { PpAtomCompatibility, "compatibility" }, - { PpAtomEs, "es" }, - { PpAtomExtension, "extension" }, - - { PpAtomLineMacro, "__LINE__" }, - { PpAtomFileMacro, "__FILE__" }, - { PpAtomVersionMacro, "__VERSION__" }, - - { PpAtomInclude, "include" }, -}; - -} // end anonymous namespace - -namespace glslang { - -// -// Initialize the atom table. -// -TStringAtomMap::TStringAtomMap() -{ - badToken.assign(""); - - // Add single character tokens to the atom table: - const char* s = "~!%^&*()-+=|,.<>/?;:[]{}#\\"; - char t[2]; - - t[1] = '\0'; - while (*s) { - t[0] = *s; - addAtomFixed(t, s[0]); - s++; - } - - // Add multiple character scanner tokens : - for (size_t ii = 0; ii < sizeof(tokens)/sizeof(tokens[0]); ii++) - addAtomFixed(tokens[ii].str, tokens[ii].val); - - nextAtom = PpAtomLast; -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp deleted file mode 100644 index 6a2e05fe..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp +++ /dev/null @@ -1,115 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2013 LunarG, Inc. -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// -/****************************************************************************\ -Copyright (c) 2002, NVIDIA Corporation. - -NVIDIA Corporation("NVIDIA") supplies this software to you in -consideration of your agreement to the following terms, and your use, -installation, modification or redistribution of this NVIDIA software -constitutes acceptance of these terms. If you do not agree with these -terms, please do not use, install, modify or redistribute this NVIDIA -software. - -In consideration of your agreement to abide by the following terms, and -subject to these terms, NVIDIA grants you a personal, non-exclusive -license, under NVIDIA's copyrights in this original NVIDIA software (the -"NVIDIA Software"), to use, reproduce, modify and redistribute the -NVIDIA Software, with or without modifications, in source and/or binary -forms; provided that if you redistribute the NVIDIA Software, you must -retain the copyright notice of NVIDIA, this notice and the following -text and disclaimers in all such redistributions of the NVIDIA Software. -Neither the name, trademarks, service marks nor logos of NVIDIA -Corporation may be used to endorse or promote products derived from the -NVIDIA Software without specific prior written permission from NVIDIA. -Except as expressly stated in this notice, no other rights or licenses -express or implied, are granted by NVIDIA herein, including but not -limited to any patent rights that may be infringed by your derivative -works or by other works in which the NVIDIA Software may be -incorporated. No hardware is licensed hereunder. - -THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, -INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR -ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER -PRODUCTS. - -IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, -INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY -OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE -NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, -TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF -NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -\****************************************************************************/ - -#include - -#include "PpContext.h" - -namespace glslang { - -TPpContext::TPpContext(TParseContextBase& pc, const std::string& rootFileName, TShader::Includer& inclr) : - preamble(0), strings(0), previous_token('\n'), parseContext(pc), includer(inclr), inComment(false), - rootFileName(rootFileName), - currentSourceFile(rootFileName) -{ - ifdepth = 0; - for (elsetracker = 0; elsetracker < maxIfNesting; elsetracker++) - elseSeen[elsetracker] = false; - elsetracker = 0; -} - -TPpContext::~TPpContext() -{ - delete [] preamble; - - // free up the inputStack - while (! inputStack.empty()) - popInput(); -} - -void TPpContext::setInput(TInputScanner& input, bool versionWillBeError) -{ - assert(inputStack.size() == 0); - - pushInput(new tStringInput(this, input)); - - errorOnVersion = versionWillBeError; - versionSeen = false; -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpContext.h b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpContext.h deleted file mode 100644 index 854bbbad..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpContext.h +++ /dev/null @@ -1,622 +0,0 @@ -// -// Copyright (C) 2013 LunarG, Inc. -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// -/****************************************************************************\ -Copyright (c) 2002, NVIDIA Corporation. - -NVIDIA Corporation("NVIDIA") supplies this software to you in -consideration of your agreement to the following terms, and your use, -installation, modification or redistribution of this NVIDIA software -constitutes acceptance of these terms. If you do not agree with these -terms, please do not use, install, modify or redistribute this NVIDIA -software. - -In consideration of your agreement to abide by the following terms, and -subject to these terms, NVIDIA grants you a personal, non-exclusive -license, under NVIDIA's copyrights in this original NVIDIA software (the -"NVIDIA Software"), to use, reproduce, modify and redistribute the -NVIDIA Software, with or without modifications, in source and/or binary -forms; provided that if you redistribute the NVIDIA Software, you must -retain the copyright notice of NVIDIA, this notice and the following -text and disclaimers in all such redistributions of the NVIDIA Software. -Neither the name, trademarks, service marks nor logos of NVIDIA -Corporation may be used to endorse or promote products derived from the -NVIDIA Software without specific prior written permission from NVIDIA. -Except as expressly stated in this notice, no other rights or licenses -express or implied, are granted by NVIDIA herein, including but not -limited to any patent rights that may be infringed by your derivative -works or by other works in which the NVIDIA Software may be -incorporated. No hardware is licensed hereunder. - -THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, -INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR -ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER -PRODUCTS. - -IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, -INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY -OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE -NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, -TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF -NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -\****************************************************************************/ - -#ifndef PPCONTEXT_H -#define PPCONTEXT_H - -#include -#include - -#include "../ParseHelper.h" - -/* windows only pragma */ -#ifdef _MSC_VER - #pragma warning(disable : 4127) -#endif - -namespace glslang { - -class TPpToken { -public: - TPpToken() : space(false), i64val(0) - { - loc.init(); - name[0] = 0; - } - - // This is used for comparing macro definitions, so checks what is relevant for that. - bool operator==(const TPpToken& right) - { - return space == right.space && - ival == right.ival && dval == right.dval && i64val == right.i64val && - strncmp(name, right.name, MaxTokenLength) == 0; - } - bool operator!=(const TPpToken& right) { return ! operator==(right); } - - TSourceLoc loc; - bool space; // true if a space (for white space or a removed comment) should also be recognized, in front of the token returned - - union { - int ival; - double dval; - long long i64val; - }; - - char name[MaxTokenLength + 1]; -}; - -class TStringAtomMap { -// -// Implementation is in PpAtom.cpp -// -// Maintain a bi-directional mapping between relevant preprocessor strings and -// "atoms" which a unique integers (small, contiguous, not hash-like) per string. -// -public: - TStringAtomMap(); - - // Map string -> atom. - // Return 0 if no existing string. - int getAtom(const char* s) const - { - auto it = atomMap.find(s); - return it == atomMap.end() ? 0 : it->second; - } - - // Map a new or existing string -> atom, inventing a new atom if necessary. - int getAddAtom(const char* s) - { - int atom = getAtom(s); - if (atom == 0) { - atom = nextAtom++; - addAtomFixed(s, atom); - } - return atom; - } - - // Map atom -> string. - const char* getString(int atom) const { return stringMap[atom]->c_str(); } - -protected: - TStringAtomMap(TStringAtomMap&); - TStringAtomMap& operator=(TStringAtomMap&); - - TUnorderedMap atomMap; - TVector stringMap; // these point into the TString in atomMap - int nextAtom; - - // Bad source characters can lead to bad atoms, so gracefully handle those by - // pre-filling the table with them (to avoid if tests later). - TString badToken; - - // Add bi-directional mappings: - // - string -> atom - // - atom -> string - void addAtomFixed(const char* s, int atom) - { - auto it = atomMap.insert(std::pair(s, atom)).first; - if (stringMap.size() < (size_t)atom + 1) - stringMap.resize(atom + 100, &badToken); - stringMap[atom] = &it->first; - } -}; - -class TInputScanner; - -// This class is the result of turning a huge pile of C code communicating through globals -// into a class. This was done to allowing instancing to attain thread safety. -// Don't expect too much in terms of OO design. -class TPpContext { -public: - TPpContext(TParseContextBase&, const std::string& rootFileName, TShader::Includer&); - virtual ~TPpContext(); - - void setPreamble(const char* preamble, size_t length); - - int tokenize(TPpToken& ppToken); - int tokenPaste(int token, TPpToken&); - - class tInput { - public: - tInput(TPpContext* p) : done(false), pp(p) { } - virtual ~tInput() { } - - virtual int scan(TPpToken*) = 0; - virtual int getch() = 0; - virtual void ungetch() = 0; - virtual bool peekPasting() { return false; } // true when about to see ## - virtual bool endOfReplacementList() { return false; } // true when at the end of a macro replacement list (RHS of #define) - virtual bool isMacroInput() { return false; } - - // Will be called when we start reading tokens from this instance - virtual void notifyActivated() {} - // Will be called when we do not read tokens from this instance anymore - virtual void notifyDeleted() {} - protected: - bool done; - TPpContext* pp; - }; - - void setInput(TInputScanner& input, bool versionWillBeError); - - void pushInput(tInput* in) - { - inputStack.push_back(in); - in->notifyActivated(); - } - void popInput() - { - inputStack.back()->notifyDeleted(); - delete inputStack.back(); - inputStack.pop_back(); - } - - // - // From PpTokens.cpp - // - - class TokenStream { - public: - TokenStream() : current(0) { } - - void putToken(int token, TPpToken* ppToken); - int getToken(TParseContextBase&, TPpToken*); - bool atEnd() { return current >= data.size(); } - bool peekTokenizedPasting(bool lastTokenPastes); - bool peekUntokenizedPasting(); - void reset() { current = 0; } - - protected: - void putSubtoken(char); - int getSubtoken(); - void ungetSubtoken(); - - TVector data; - size_t current; - }; - - // - // From Pp.cpp - // - - struct MacroSymbol { - MacroSymbol() : emptyArgs(0), busy(0), undef(0) { } - TVector args; - TokenStream body; - unsigned emptyArgs : 1; - unsigned busy : 1; - unsigned undef : 1; - }; - - typedef TMap TSymbolMap; - TSymbolMap macroDefs; // map atoms to macro definitions - MacroSymbol* lookupMacroDef(int atom) - { - auto existingMacroIt = macroDefs.find(atom); - return (existingMacroIt == macroDefs.end()) ? nullptr : &(existingMacroIt->second); - } - void addMacroDef(int atom, MacroSymbol& macroDef) { macroDefs[atom] = macroDef; } - -protected: - TPpContext(TPpContext&); - TPpContext& operator=(TPpContext&); - - TStringAtomMap atomStrings; - char* preamble; // string to parse, all before line 1 of string 0, it is 0 if no preamble - int preambleLength; - char** strings; // official strings of shader, starting a string 0 line 1 - size_t* lengths; - int numStrings; // how many official strings there are - int currentString; // which string we're currently parsing (-1 for preamble) - - // Scanner data: - int previous_token; - TParseContextBase& parseContext; - - // Get the next token from *stack* of input sources, popping input sources - // that are out of tokens, down until an input source is found that has a token. - // Return EndOfInput when there are no more tokens to be found by doing this. - int scanToken(TPpToken* ppToken) - { - int token = EndOfInput; - - while (! inputStack.empty()) { - token = inputStack.back()->scan(ppToken); - if (token != EndOfInput || inputStack.empty()) - break; - popInput(); - } - - return token; - } - int getChar() { return inputStack.back()->getch(); } - void ungetChar() { inputStack.back()->ungetch(); } - bool peekPasting() { return !inputStack.empty() && inputStack.back()->peekPasting(); } - bool endOfReplacementList() { return inputStack.empty() || inputStack.back()->endOfReplacementList(); } - bool isMacroInput() { return inputStack.size() > 0 && inputStack.back()->isMacroInput(); } - - static const int maxIfNesting = 65; - - int ifdepth; // current #if-#else-#endif nesting in the cpp.c file (pre-processor) - bool elseSeen[maxIfNesting]; // Keep a track of whether an else has been seen at a particular depth - int elsetracker; // #if-#else and #endif constructs...Counter. - - class tMacroInput : public tInput { - public: - tMacroInput(TPpContext* pp) : tInput(pp), prepaste(false), postpaste(false) { } - virtual ~tMacroInput() - { - for (size_t i = 0; i < args.size(); ++i) - delete args[i]; - for (size_t i = 0; i < expandedArgs.size(); ++i) - delete expandedArgs[i]; - } - - virtual int scan(TPpToken*) override; - virtual int getch() override { assert(0); return EndOfInput; } - virtual void ungetch() override { assert(0); } - bool peekPasting() override { return prepaste; } - bool endOfReplacementList() override { return mac->body.atEnd(); } - bool isMacroInput() override { return true; } - - MacroSymbol *mac; - TVector args; - TVector expandedArgs; - - protected: - bool prepaste; // true if we are just before ## - bool postpaste; // true if we are right after ## - }; - - class tMarkerInput : public tInput { - public: - tMarkerInput(TPpContext* pp) : tInput(pp) { } - virtual int scan(TPpToken*) override - { - if (done) - return EndOfInput; - done = true; - - return marker; - } - virtual int getch() override { assert(0); return EndOfInput; } - virtual void ungetch() override { assert(0); } - static const int marker = -3; - }; - - class tZeroInput : public tInput { - public: - tZeroInput(TPpContext* pp) : tInput(pp) { } - virtual int scan(TPpToken*) override; - virtual int getch() override { assert(0); return EndOfInput; } - virtual void ungetch() override { assert(0); } - }; - - std::vector inputStack; - bool errorOnVersion; - bool versionSeen; - - // - // from Pp.cpp - // - - // Used to obtain #include content. - TShader::Includer& includer; - - int CPPdefine(TPpToken * ppToken); - int CPPundef(TPpToken * ppToken); - int CPPelse(int matchelse, TPpToken * ppToken); - int extraTokenCheck(int atom, TPpToken* ppToken, int token); - int eval(int token, int precedence, bool shortCircuit, int& res, bool& err, TPpToken * ppToken); - int evalToToken(int token, bool shortCircuit, int& res, bool& err, TPpToken * ppToken); - int CPPif (TPpToken * ppToken); - int CPPifdef(int defined, TPpToken * ppToken); - int CPPinclude(TPpToken * ppToken); - int CPPline(TPpToken * ppToken); - int CPPerror(TPpToken * ppToken); - int CPPpragma(TPpToken * ppToken); - int CPPversion(TPpToken * ppToken); - int CPPextension(TPpToken * ppToken); - int readCPPline(TPpToken * ppToken); - int scanHeaderName(TPpToken* ppToken, char delimit); - TokenStream* PrescanMacroArg(TokenStream&, TPpToken*, bool newLineOkay); - int MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOkay); - - // - // From PpTokens.cpp - // - void pushTokenStreamInput(TokenStream&, bool pasting = false); - void UngetToken(int token, TPpToken*); - - class tTokenInput : public tInput { - public: - tTokenInput(TPpContext* pp, TokenStream* t, bool prepasting) : tInput(pp), tokens(t), lastTokenPastes(prepasting) { } - virtual int scan(TPpToken *ppToken) override { return tokens->getToken(pp->parseContext, ppToken); } - virtual int getch() override { assert(0); return EndOfInput; } - virtual void ungetch() override { assert(0); } - virtual bool peekPasting() override { return tokens->peekTokenizedPasting(lastTokenPastes); } - protected: - TokenStream* tokens; - bool lastTokenPastes; // true if the last token in the input is to be pasted, rather than consumed as a token - }; - - class tUngotTokenInput : public tInput { - public: - tUngotTokenInput(TPpContext* pp, int t, TPpToken* p) : tInput(pp), token(t), lval(*p) { } - virtual int scan(TPpToken *) override; - virtual int getch() override { assert(0); return EndOfInput; } - virtual void ungetch() override { assert(0); } - protected: - int token; - TPpToken lval; - }; - - // - // From PpScanner.cpp - // - class tStringInput : public tInput { - public: - tStringInput(TPpContext* pp, TInputScanner& i) : tInput(pp), input(&i) { } - virtual int scan(TPpToken*) override; - - // Scanner used to get source stream characters. - // - Escaped newlines are handled here, invisibly to the caller. - // - All forms of newline are handled, and turned into just a '\n'. - int getch() override - { - int ch = input->get(); - - if (ch == '\\') { - // Move past escaped newlines, as many as sequentially exist - do { - if (input->peek() == '\r' || input->peek() == '\n') { - bool allowed = pp->parseContext.lineContinuationCheck(input->getSourceLoc(), pp->inComment); - if (! allowed && pp->inComment) - return '\\'; - - // escape one newline now - ch = input->get(); - int nextch = input->get(); - if (ch == '\r' && nextch == '\n') - ch = input->get(); - else - ch = nextch; - } else - return '\\'; - } while (ch == '\\'); - } - - // handle any non-escaped newline - if (ch == '\r' || ch == '\n') { - if (ch == '\r' && input->peek() == '\n') - input->get(); - return '\n'; - } - - return ch; - } - - // Scanner used to backup the source stream characters. Newlines are - // handled here, invisibly to the caller, meaning have to undo exactly - // what getch() above does (e.g., don't leave things in the middle of a - // sequence of escaped newlines). - void ungetch() override - { - input->unget(); - - do { - int ch = input->peek(); - if (ch == '\r' || ch == '\n') { - if (ch == '\n') { - // correct for two-character newline - input->unget(); - if (input->peek() != '\r') - input->get(); - } - // now in front of a complete newline, move past an escape character - input->unget(); - if (input->peek() == '\\') - input->unget(); - else { - input->get(); - break; - } - } else - break; - } while (true); - } - - protected: - TInputScanner* input; - }; - - // Holds a reference to included file data, as well as a - // prologue and an epilogue string. This can be scanned using the tInput - // interface and acts as a single source string. - class TokenizableIncludeFile : public tInput { - public: - // Copies prologue and epilogue. The includedFile must remain valid - // until this TokenizableIncludeFile is no longer used. - TokenizableIncludeFile(const TSourceLoc& startLoc, - const std::string& prologue, - TShader::Includer::IncludeResult* includedFile, - const std::string& epilogue, - TPpContext* pp) - : tInput(pp), - prologue_(prologue), - epilogue_(epilogue), - includedFile_(includedFile), - scanner(3, strings, lengths, names, 0, 0, true), - prevScanner(nullptr), - stringInput(pp, scanner) - { - strings[0] = prologue_.data(); - strings[1] = includedFile_->headerData; - strings[2] = epilogue_.data(); - - lengths[0] = prologue_.size(); - lengths[1] = includedFile_->headerLength; - lengths[2] = epilogue_.size(); - - scanner.setLine(startLoc.line); - scanner.setString(startLoc.string); - - scanner.setFile(startLoc.name, 0); - scanner.setFile(startLoc.name, 1); - scanner.setFile(startLoc.name, 2); - } - - // tInput methods: - int scan(TPpToken* t) override { return stringInput.scan(t); } - int getch() override { return stringInput.getch(); } - void ungetch() override { stringInput.ungetch(); } - - void notifyActivated() override - { - prevScanner = pp->parseContext.getScanner(); - pp->parseContext.setScanner(&scanner); - pp->push_include(includedFile_); - } - - void notifyDeleted() override - { - pp->parseContext.setScanner(prevScanner); - pp->pop_include(); - } - - private: - TokenizableIncludeFile& operator=(const TokenizableIncludeFile&); - - // Stores the prologue for this string. - const std::string prologue_; - - // Stores the epilogue for this string. - const std::string epilogue_; - - // Points to the IncludeResult that this TokenizableIncludeFile represents. - TShader::Includer::IncludeResult* includedFile_; - - // Will point to prologue_, includedFile_->headerData and epilogue_ - // This is passed to scanner constructor. - // These do not own the storage and it must remain valid until this - // object has been destroyed. - const char* strings[3]; - // Length of str_, passed to scanner constructor. - size_t lengths[3]; - // String names - const char* names[3]; - // Scans over str_. - TInputScanner scanner; - // The previous effective scanner before the scanner in this instance - // has been activated. - TInputScanner* prevScanner; - // Delegate object implementing the tInput interface. - tStringInput stringInput; - }; - - int ScanFromString(char* s); - void missingEndifCheck(); - int lFloatConst(int len, int ch, TPpToken* ppToken); - int characterLiteral(TPpToken* ppToken); - - void push_include(TShader::Includer::IncludeResult* result) - { - currentSourceFile = result->headerName; - includeStack.push(result); - } - - void pop_include() - { - TShader::Includer::IncludeResult* include = includeStack.top(); - includeStack.pop(); - includer.releaseInclude(include); - if (includeStack.empty()) { - currentSourceFile = rootFileName; - } else { - currentSourceFile = includeStack.top()->headerName; - } - } - - bool inComment; - std::string rootFileName; - std::stack includeStack; - std::string currentSourceFile; -}; - -} // end namespace glslang - -#endif // PPCONTEXT_H diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp deleted file mode 100644 index b58bbeea..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp +++ /dev/null @@ -1,1082 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2013 LunarG, Inc. -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// -/****************************************************************************\ -Copyright (c) 2002, NVIDIA Corporation. - -NVIDIA Corporation("NVIDIA") supplies this software to you in -consideration of your agreement to the following terms, and your use, -installation, modification or redistribution of this NVIDIA software -constitutes acceptance of these terms. If you do not agree with these -terms, please do not use, install, modify or redistribute this NVIDIA -software. - -In consideration of your agreement to abide by the following terms, and -subject to these terms, NVIDIA grants you a personal, non-exclusive -license, under NVIDIA's copyrights in this original NVIDIA software (the -"NVIDIA Software"), to use, reproduce, modify and redistribute the -NVIDIA Software, with or without modifications, in source and/or binary -forms; provided that if you redistribute the NVIDIA Software, you must -retain the copyright notice of NVIDIA, this notice and the following -text and disclaimers in all such redistributions of the NVIDIA Software. -Neither the name, trademarks, service marks nor logos of NVIDIA -Corporation may be used to endorse or promote products derived from the -NVIDIA Software without specific prior written permission from NVIDIA. -Except as expressly stated in this notice, no other rights or licenses -express or implied, are granted by NVIDIA herein, including but not -limited to any patent rights that may be infringed by your derivative -works or by other works in which the NVIDIA Software may be -incorporated. No hardware is licensed hereunder. - -THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, -INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR -ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER -PRODUCTS. - -IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, -INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY -OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE -NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, -TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF -NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -\****************************************************************************/ - -#ifndef _CRT_SECURE_NO_WARNINGS -#define _CRT_SECURE_NO_WARNINGS -#endif - -#include -#include - -#include "PpContext.h" -#include "PpTokens.h" -#include "../Scan.h" - -namespace glslang { - -/////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////// Floating point constants: ///////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////// - -/* -* lFloatConst() - Scan a single- or double-precision floating point constant. Assumes that the scanner -* has seen at least one digit, followed by either a decimal '.' or the -* letter 'e', or a precision ending (e.g., F or LF). -*/ - -int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken) -{ - bool HasDecimalOrExponent = false; - int isDouble = 0; - bool generateFloat16 = false; - bool acceptFloat16 = parseContext.intermediate.getSource() == EShSourceHlsl; - bool isFloat16 = false; - bool requireHF = false; -#ifdef AMD_EXTENSIONS - if (parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float)) { - acceptFloat16 = true; - generateFloat16 = true; - requireHF = true; - } -#endif - - const auto saveName = [&](int ch) { - if (len <= MaxTokenLength) - ppToken->name[len++] = static_cast(ch); - }; - - // Decimal: - - if (ch == '.') { - HasDecimalOrExponent = true; - saveName(ch); - ch = getChar(); - - // 1.#INF or -1.#INF - if (parseContext.intermediate.getSource() == EShSourceHlsl && ch == '#') { - if ((len < 2) || - (len == 2 && ppToken->name[0] != '1') || - (len == 3 && ppToken->name[1] != '1' && !(ppToken->name[0] == '-' || ppToken->name[0] == '+')) || - (len > 3)) - parseContext.ppError(ppToken->loc, "unexpected use of", "#", ""); - else { - // we have 1.# or -1.# or +1.#, check for 'INF' - if ((ch = getChar()) != 'I' || - (ch = getChar()) != 'N' || - (ch = getChar()) != 'F') - parseContext.ppError(ppToken->loc, "expected 'INF'", "#", ""); - else { - // we have [+-].#INF, and we are targeting IEEE 754, so wrap it up: - saveName('I'); - saveName('N'); - saveName('F'); - ppToken->name[len] = '\0'; - if (ppToken->name[0] == '-') - ppToken->i64val = 0xfff0000000000000; // -Infinity - else - ppToken->i64val = 0x7ff0000000000000; // +Infinity - return PpAtomConstFloat; - } - } - } - - while (ch >= '0' && ch <= '9') { - saveName(ch); - ch = getChar(); - } - } - - // Exponent: - - if (ch == 'e' || ch == 'E') { - HasDecimalOrExponent = true; - saveName(ch); - ch = getChar(); - if (ch == '+' || ch == '-') { - saveName(ch); - ch = getChar(); - } - if (ch >= '0' && ch <= '9') { - while (ch >= '0' && ch <= '9') { - saveName(ch); - ch = getChar(); - } - } else { - parseContext.ppError(ppToken->loc, "bad character in float exponent", "", ""); - } - } - - // Suffix: - - if (ch == 'l' || ch == 'L') { - parseContext.doubleCheck(ppToken->loc, "double floating-point suffix"); - if (! HasDecimalOrExponent) - parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", ""); - int ch2 = getChar(); - if (ch2 != 'f' && ch2 != 'F') { - ungetChar(); - ungetChar(); - } else { - saveName(ch); - saveName(ch2); - isDouble = 1; - } - } else if (acceptFloat16 && (ch == 'h' || ch == 'H')) { -#ifdef AMD_EXTENSIONS - if (generateFloat16) - parseContext.float16Check(ppToken->loc, "half floating-point suffix"); -#endif - if (!HasDecimalOrExponent) - parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", ""); - if (requireHF) { - int ch2 = getChar(); - if (ch2 != 'f' && ch2 != 'F') { - ungetChar(); - ungetChar(); - } else { - saveName(ch); - saveName(ch2); - isFloat16 = generateFloat16; - } - } else { - saveName(ch); - isFloat16 = generateFloat16; - } - } else if (ch == 'f' || ch == 'F') { - parseContext.profileRequires(ppToken->loc, EEsProfile, 300, nullptr, "floating-point suffix"); - if (! parseContext.relaxedErrors()) - parseContext.profileRequires(ppToken->loc, ~EEsProfile, 120, nullptr, "floating-point suffix"); - if (! HasDecimalOrExponent) - parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", ""); - saveName(ch); - } else - ungetChar(); - - // Patch up the name, length, etc. - - if (len > MaxTokenLength) { - len = MaxTokenLength; - parseContext.ppError(ppToken->loc, "float literal too long", "", ""); - } - ppToken->name[len] = '\0'; - - // Get the numerical value - ppToken->dval = strtod(ppToken->name, nullptr); - - // Return the right token type - if (isDouble) - return PpAtomConstDouble; - else if (isFloat16) - return PpAtomConstFloat16; - else - return PpAtomConstFloat; -} - -// Recognize a character literal. -// -// The first ' has already been accepted, read the rest, through the closing '. -// -// Always returns PpAtomConstInt. -// -int TPpContext::characterLiteral(TPpToken* ppToken) -{ - ppToken->name[0] = 0; - ppToken->ival = 0; - - if (parseContext.intermediate.getSource() != EShSourceHlsl) { - // illegal, except in macro definition, for which case we report the character - return '\''; - } - - int ch = getChar(); - switch (ch) { - case '\'': - // As empty sequence: '' - parseContext.ppError(ppToken->loc, "unexpected", "\'", ""); - return PpAtomConstInt; - case '\\': - // As escape sequence: '\XXX' - switch (ch = getChar()) { - case 'a': - ppToken->ival = 7; - break; - case 'b': - ppToken->ival = 8; - break; - case 't': - ppToken->ival = 9; - break; - case 'n': - ppToken->ival = 10; - break; - case 'v': - ppToken->ival = 11; - break; - case 'f': - ppToken->ival = 12; - break; - case 'r': - ppToken->ival = 13; - break; - case 'x': - case '0': - parseContext.ppError(ppToken->loc, "octal and hex sequences not supported", "\\", ""); - break; - default: - // This catches '\'', '\"', '\?', etc. - // Also, things like '\C' mean the same thing as 'C' - // (after the above cases are filtered out). - ppToken->ival = ch; - break; - } - break; - default: - ppToken->ival = ch; - break; - } - ppToken->name[0] = (char)ppToken->ival; - ppToken->name[1] = '\0'; - ch = getChar(); - if (ch != '\'') { - parseContext.ppError(ppToken->loc, "expected", "\'", ""); - // Look ahead for a closing ' - do { - ch = getChar(); - } while (ch != '\'' && ch != EndOfInput && ch != '\n'); - } - - return PpAtomConstInt; -} - -// -// Scanner used to tokenize source stream. -// -int TPpContext::tStringInput::scan(TPpToken* ppToken) -{ - int AlreadyComplained = 0; - int len = 0; - int ch = 0; - int ii = 0; - unsigned long long ival = 0; - bool enableInt64 = pp->parseContext.version >= 450 && pp->parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_int64); -#ifdef AMD_EXTENSIONS - bool enableInt16 = pp->parseContext.version >= 450 && pp->parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_int16); -#endif - bool acceptHalf = pp->parseContext.intermediate.getSource() == EShSourceHlsl; -#ifdef AMD_EXTENSIONS - if (pp->parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float)) - acceptHalf = true; -#endif - - const auto floatingPointChar = [&](int ch) { return ch == '.' || ch == 'e' || ch == 'E' || - ch == 'f' || ch == 'F' || - (acceptHalf && (ch == 'h' || ch == 'H')); }; - - ppToken->ival = 0; - ppToken->i64val = 0; - ppToken->space = false; - ch = getch(); - for (;;) { - while (ch == ' ' || ch == '\t') { - ppToken->space = true; - ch = getch(); - } - - ppToken->loc = pp->parseContext.getCurrentLoc(); - len = 0; - switch (ch) { - default: - // Single character token, including EndOfInput, '#' and '\' (escaped newlines are handled at a lower level, so this is just a '\' token) - if (ch > PpAtomMaxSingle) - ch = PpAtomBadToken; - return ch; - - case 'A': case 'B': case 'C': case 'D': case 'E': - case 'F': case 'G': case 'H': case 'I': case 'J': - case 'K': case 'L': case 'M': case 'N': case 'O': - case 'P': case 'Q': case 'R': case 'S': case 'T': - case 'U': case 'V': case 'W': case 'X': case 'Y': - case 'Z': case '_': - case 'a': case 'b': case 'c': case 'd': case 'e': - case 'f': case 'g': case 'h': case 'i': case 'j': - case 'k': case 'l': case 'm': case 'n': case 'o': - case 'p': case 'q': case 'r': case 's': case 't': - case 'u': case 'v': case 'w': case 'x': case 'y': - case 'z': - do { - if (len < MaxTokenLength) { - ppToken->name[len++] = (char)ch; - ch = getch(); - } else { - if (! AlreadyComplained) { - pp->parseContext.ppError(ppToken->loc, "name too long", "", ""); - AlreadyComplained = 1; - } - ch = getch(); - } - } while ((ch >= 'a' && ch <= 'z') || - (ch >= 'A' && ch <= 'Z') || - (ch >= '0' && ch <= '9') || - ch == '_'); - - // line continuation with no token before or after makes len == 0, and need to start over skipping white space, etc. - if (len == 0) - continue; - - ppToken->name[len] = '\0'; - ungetch(); - return PpAtomIdentifier; - case '0': - ppToken->name[len++] = (char)ch; - ch = getch(); - if (ch == 'x' || ch == 'X') { - // must be hexadecimal - - bool isUnsigned = false; - bool isInt64 = false; -#ifdef AMD_EXTENSIONS - bool isInt16 = false; -#endif - ppToken->name[len++] = (char)ch; - ch = getch(); - if ((ch >= '0' && ch <= '9') || - (ch >= 'A' && ch <= 'F') || - (ch >= 'a' && ch <= 'f')) { - - ival = 0; - do { - if (len < MaxTokenLength && (ival <= 0x0fffffffu || (enableInt64 && ival <= 0x0fffffffffffffffull))) { - ppToken->name[len++] = (char)ch; - if (ch >= '0' && ch <= '9') { - ii = ch - '0'; - } else if (ch >= 'A' && ch <= 'F') { - ii = ch - 'A' + 10; - } else if (ch >= 'a' && ch <= 'f') { - ii = ch - 'a' + 10; - } else - pp->parseContext.ppError(ppToken->loc, "bad digit in hexadecimal literal", "", ""); - ival = (ival << 4) | ii; - } else { - if (! AlreadyComplained) { - if(len < MaxTokenLength) - pp->parseContext.ppError(ppToken->loc, "hexadecimal literal too big", "", ""); - else - pp->parseContext.ppError(ppToken->loc, "hexadecimal literal too long", "", ""); - AlreadyComplained = 1; - } - ival = 0xffffffffffffffffull; - } - ch = getch(); - } while ((ch >= '0' && ch <= '9') || - (ch >= 'A' && ch <= 'F') || - (ch >= 'a' && ch <= 'f')); - } else { - pp->parseContext.ppError(ppToken->loc, "bad digit in hexadecimal literal", "", ""); - } - if (ch == 'u' || ch == 'U') { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)ch; - isUnsigned = true; - - if (enableInt64) { - int nextCh = getch(); - if ((ch == 'u' && nextCh == 'l') || (ch == 'U' && nextCh == 'L')) { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)nextCh; - isInt64 = true; - } else - ungetch(); - } - -#ifdef AMD_EXTENSIONS - if (enableInt16) { - int nextCh = getch(); - if ((ch == 'u' && nextCh == 's') || (ch == 'U' && nextCh == 'S')) { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)nextCh; - isInt16 = true; - } else - ungetch(); - } -#endif - } else if (enableInt64 && (ch == 'l' || ch == 'L')) { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)ch; - isInt64 = true; -#ifdef AMD_EXTENSIONS - } else if (enableInt16 && (ch == 's' || ch == 'S')) { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)ch; - isInt16 = true; -#endif - } else - ungetch(); - ppToken->name[len] = '\0'; - - if (isInt64) { - ppToken->i64val = ival; - return isUnsigned ? PpAtomConstUint64 : PpAtomConstInt64; -#ifdef AMD_EXTENSIONS - } else if (isInt16) { - ppToken->ival = (int)ival; - return isUnsigned ? PpAtomConstUint16 : PpAtomConstInt16; -#endif - } else { - ppToken->ival = (int)ival; - return isUnsigned ? PpAtomConstUint : PpAtomConstInt; - } - } else { - // could be octal integer or floating point, speculative pursue octal until it must be floating point - - bool isUnsigned = false; - bool isInt64 = false; -#ifdef AMD_EXTENSIONS - bool isInt16 = false; -#endif - bool octalOverflow = false; - bool nonOctal = false; - ival = 0; - - // see how much octal-like stuff we can read - while (ch >= '0' && ch <= '7') { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)ch; - else if (! AlreadyComplained) { - pp->parseContext.ppError(ppToken->loc, "numeric literal too long", "", ""); - AlreadyComplained = 1; - } - if (ival <= 0x1fffffffu || (enableInt64 && ival <= 0x1fffffffffffffffull)) { - ii = ch - '0'; - ival = (ival << 3) | ii; - } else - octalOverflow = true; - ch = getch(); - } - - // could be part of a float... - if (ch == '8' || ch == '9') { - nonOctal = true; - do { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)ch; - else if (! AlreadyComplained) { - pp->parseContext.ppError(ppToken->loc, "numeric literal too long", "", ""); - AlreadyComplained = 1; - } - ch = getch(); - } while (ch >= '0' && ch <= '9'); - } - if (floatingPointChar(ch)) - return pp->lFloatConst(len, ch, ppToken); - - // wasn't a float, so must be octal... - if (nonOctal) - pp->parseContext.ppError(ppToken->loc, "octal literal digit too large", "", ""); - - if (ch == 'u' || ch == 'U') { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)ch; - isUnsigned = true; - - if (enableInt64) { - int nextCh = getch(); - if ((ch == 'u' && nextCh == 'l') || (ch == 'U' && nextCh == 'L')) { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)nextCh; - isInt64 = true; - } else - ungetch(); - } - -#ifdef AMD_EXTENSIONS - if (enableInt16) { - int nextCh = getch(); - if ((ch == 'u' && nextCh == 's') || (ch == 'U' && nextCh == 'S')) { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)nextCh; - isInt16 = true; - } else - ungetch(); - } -#endif - } else if (enableInt64 && (ch == 'l' || ch == 'L')) { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)ch; - isInt64 = true; -#ifdef AMD_EXTENSIONS - } else if (enableInt16 && (ch == 's' || ch == 'S')) { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)ch; - isInt16 = true; -#endif - } else - ungetch(); - ppToken->name[len] = '\0'; - - if (octalOverflow) - pp->parseContext.ppError(ppToken->loc, "octal literal too big", "", ""); - - if (isInt64) { - ppToken->i64val = ival; - return isUnsigned ? PpAtomConstUint64 : PpAtomConstInt64; -#ifdef AMD_EXTENSIONS - } else if (isInt16) { - ppToken->ival = (int)ival; - return isUnsigned ? PpAtomConstUint16 : PpAtomConstInt16; -#endif - } else { - ppToken->ival = (int)ival; - return isUnsigned ? PpAtomConstUint : PpAtomConstInt; - } - } - break; - case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - // can't be hexadecimal or octal, is either decimal or floating point - - do { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)ch; - else if (! AlreadyComplained) { - pp->parseContext.ppError(ppToken->loc, "numeric literal too long", "", ""); - AlreadyComplained = 1; - } - ch = getch(); - } while (ch >= '0' && ch <= '9'); - if (floatingPointChar(ch)) - return pp->lFloatConst(len, ch, ppToken); - else { - // Finish handling signed and unsigned integers - int numericLen = len; - bool isUnsigned = false; - bool isInt64 = false; -#ifdef AMD_EXTENSIONS - bool isInt16 = false; -#endif - if (ch == 'u' || ch == 'U') { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)ch; - isUnsigned = true; - - if (enableInt64) { - int nextCh = getch(); - if ((ch == 'u' && nextCh == 'l') || (ch == 'U' && nextCh == 'L')) { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)nextCh; - isInt64 = true; - } else - ungetch(); - } - -#ifdef AMD_EXTENSIONS - if (enableInt16) { - int nextCh = getch(); - if ((ch == 'u' && nextCh == 's') || (ch == 'U' && nextCh == 'S')) { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)nextCh; - isInt16 = true; - } else - ungetch(); - } -#endif - } else if (enableInt64 && (ch == 'l' || ch == 'L')) { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)ch; - isInt64 = true; -#ifdef AMD_EXTENSIONS - } else if (enableInt16 && (ch == 's' || ch == 'S')) { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)ch; - isInt16 = true; -#endif - } else - ungetch(); - - ppToken->name[len] = '\0'; - ival = 0; - const unsigned oneTenthMaxInt = 0xFFFFFFFFu / 10; - const unsigned remainderMaxInt = 0xFFFFFFFFu - 10 * oneTenthMaxInt; - const unsigned long long oneTenthMaxInt64 = 0xFFFFFFFFFFFFFFFFull / 10; - const unsigned long long remainderMaxInt64 = 0xFFFFFFFFFFFFFFFFull - 10 * oneTenthMaxInt64; -#ifdef AMD_EXTENSIONS - const unsigned short oneTenthMaxInt16 = 0xFFFFu / 10; - const unsigned short remainderMaxInt16 = 0xFFFFu - 10 * oneTenthMaxInt16; -#endif - for (int i = 0; i < numericLen; i++) { - ch = ppToken->name[i] - '0'; - bool overflow = false; - if (isInt64) - overflow = (ival > oneTenthMaxInt64 || (ival == oneTenthMaxInt64 && (unsigned long long)ch > remainderMaxInt64)); -#ifdef AMD_EXTENSIONS - else if (isInt16) - overflow = (ival > oneTenthMaxInt16 || (ival == oneTenthMaxInt16 && (unsigned short)ch > remainderMaxInt16)); -#endif - else - overflow = (ival > oneTenthMaxInt || (ival == oneTenthMaxInt && (unsigned)ch > remainderMaxInt)); - if (overflow) { - pp->parseContext.ppError(ppToken->loc, "numeric literal too big", "", ""); - ival = 0xFFFFFFFFFFFFFFFFull; - break; - } else - ival = ival * 10 + ch; - } - - if (isInt64) { - ppToken->i64val = ival; - return isUnsigned ? PpAtomConstUint64 : PpAtomConstInt64; -#ifdef AMD_EXTENSIONS - } else if (isInt16) { - ppToken->ival = (int)ival; - return isUnsigned ? PpAtomConstUint16 : PpAtomConstInt16; -#endif - } else { - ppToken->ival = (int)ival; - return isUnsigned ? PpAtomConstUint : PpAtomConstInt; - } - } - break; - case '-': - ch = getch(); - if (ch == '-') { - return PpAtomDecrement; - } else if (ch == '=') { - return PPAtomSubAssign; - } else { - ungetch(); - return '-'; - } - case '+': - ch = getch(); - if (ch == '+') { - return PpAtomIncrement; - } else if (ch == '=') { - return PPAtomAddAssign; - } else { - ungetch(); - return '+'; - } - case '*': - ch = getch(); - if (ch == '=') { - return PPAtomMulAssign; - } else { - ungetch(); - return '*'; - } - case '%': - ch = getch(); - if (ch == '=') { - return PPAtomModAssign; - } else { - ungetch(); - return '%'; - } - case '^': - ch = getch(); - if (ch == '^') { - return PpAtomXor; - } else { - if (ch == '=') - return PpAtomXorAssign; - else{ - ungetch(); - return '^'; - } - } - - case '=': - ch = getch(); - if (ch == '=') { - return PpAtomEQ; - } else { - ungetch(); - return '='; - } - case '!': - ch = getch(); - if (ch == '=') { - return PpAtomNE; - } else { - ungetch(); - return '!'; - } - case '|': - ch = getch(); - if (ch == '|') { - return PpAtomOr; - } else if (ch == '=') { - return PpAtomOrAssign; - } else { - ungetch(); - return '|'; - } - case '&': - ch = getch(); - if (ch == '&') { - return PpAtomAnd; - } else if (ch == '=') { - return PpAtomAndAssign; - } else { - ungetch(); - return '&'; - } - case '<': - ch = getch(); - if (ch == '<') { - ch = getch(); - if (ch == '=') - return PpAtomLeftAssign; - else { - ungetch(); - return PpAtomLeft; - } - } else if (ch == '=') { - return PpAtomLE; - } else { - ungetch(); - return '<'; - } - case '>': - ch = getch(); - if (ch == '>') { - ch = getch(); - if (ch == '=') - return PpAtomRightAssign; - else { - ungetch(); - return PpAtomRight; - } - } else if (ch == '=') { - return PpAtomGE; - } else { - ungetch(); - return '>'; - } - case '.': - ch = getch(); - if (ch >= '0' && ch <= '9') { - ungetch(); - return pp->lFloatConst(0, '.', ppToken); - } else { - ungetch(); - return '.'; - } - case '/': - ch = getch(); - if (ch == '/') { - pp->inComment = true; - do { - ch = getch(); - } while (ch != '\n' && ch != EndOfInput); - ppToken->space = true; - pp->inComment = false; - - return ch; - } else if (ch == '*') { - ch = getch(); - do { - while (ch != '*') { - if (ch == EndOfInput) { - pp->parseContext.ppError(ppToken->loc, "End of input in comment", "comment", ""); - return ch; - } - ch = getch(); - } - ch = getch(); - if (ch == EndOfInput) { - pp->parseContext.ppError(ppToken->loc, "End of input in comment", "comment", ""); - return ch; - } - } while (ch != '/'); - ppToken->space = true; - // loop again to get the next token... - break; - } else if (ch == '=') { - return PPAtomDivAssign; - } else { - ungetch(); - return '/'; - } - break; - case '\'': - return pp->characterLiteral(ppToken); - case '"': - // TODO: If this gets enhanced to handle escape sequences, or - // anything that is different than what #include needs, then - // #include needs to use scanHeaderName() for this. - ch = getch(); - while (ch != '"' && ch != '\n' && ch != EndOfInput) { - if (len < MaxTokenLength) { - ppToken->name[len] = (char)ch; - len++; - ch = getch(); - } else - break; - }; - ppToken->name[len] = '\0'; - if (ch != '"') { - ungetch(); - pp->parseContext.ppError(ppToken->loc, "End of line in string", "string", ""); - } - return PpAtomConstString; - case ':': - ch = getch(); - if (ch == ':') - return PpAtomColonColon; - ungetch(); - return ':'; - } - - ch = getch(); - } -} - -// -// The main functional entry point into the preprocessor, which will -// scan the source strings to figure out and return the next processing token. -// -// Return the token, or EndOfInput when no more tokens. -// -int TPpContext::tokenize(TPpToken& ppToken) -{ - for(;;) { - int token = scanToken(&ppToken); - - // Handle token-pasting logic - token = tokenPaste(token, ppToken); - - if (token == EndOfInput) { - missingEndifCheck(); - return EndOfInput; - } - if (token == '#') { - if (previous_token == '\n') { - token = readCPPline(&ppToken); - if (token == EndOfInput) { - missingEndifCheck(); - return EndOfInput; - } - continue; - } else { - parseContext.ppError(ppToken.loc, "preprocessor directive cannot be preceded by another token", "#", ""); - return EndOfInput; - } - } - previous_token = token; - - if (token == '\n') - continue; - - // expand macros - if (token == PpAtomIdentifier && MacroExpand(&ppToken, false, true) != 0) - continue; - - switch (token) { - case PpAtomIdentifier: - case PpAtomConstInt: - case PpAtomConstUint: - case PpAtomConstFloat: - case PpAtomConstInt64: - case PpAtomConstUint64: -#ifdef AMD_EXTENSIONS - case PpAtomConstInt16: - case PpAtomConstUint16: -#endif - case PpAtomConstDouble: -#ifdef AMD_EXTENSIONS - case PpAtomConstFloat16: -#endif - if (ppToken.name[0] == '\0') - continue; - break; - case PpAtomConstString: - if (parseContext.intermediate.getSource() != EShSourceHlsl) { - // HLSL allows string literals. - parseContext.ppError(ppToken.loc, "string literals not supported", "\"\"", ""); - continue; - } - break; - case '\'': - parseContext.ppError(ppToken.loc, "character literals not supported", "\'", ""); - continue; - default: - strcpy(ppToken.name, atomStrings.getString(token)); - break; - } - - return token; - } -} - -// -// Do all token-pasting related combining of two pasted tokens when getting a -// stream of tokens from a replacement list. Degenerates to no processing if a -// replacement list is not the source of the token stream. -// -int TPpContext::tokenPaste(int token, TPpToken& ppToken) -{ - // starting with ## is illegal, skip to next token - if (token == PpAtomPaste) { - parseContext.ppError(ppToken.loc, "unexpected location", "##", ""); - return scanToken(&ppToken); - } - - int resultToken = token; // "foo" pasted with "35" is an identifier, not a number - - // ## can be chained, process all in the chain at once - while (peekPasting()) { - TPpToken pastedPpToken; - - // next token has to be ## - token = scanToken(&pastedPpToken); - assert(token == PpAtomPaste); - - // This covers end of macro expansion - if (endOfReplacementList()) { - parseContext.ppError(ppToken.loc, "unexpected location; end of replacement list", "##", ""); - break; - } - - // get the token after the ## - token = scanToken(&pastedPpToken); - - // This covers end of argument expansion - if (token == tMarkerInput::marker) { - parseContext.ppError(ppToken.loc, "unexpected location; end of argument", "##", ""); - break; - } - - // get the token text - switch (resultToken) { - case PpAtomIdentifier: - // already have the correct text in token.names - break; - case '=': - case '!': - case '-': - case '~': - case '+': - case '*': - case '/': - case '%': - case '<': - case '>': - case '|': - case '^': - case '&': - case PpAtomRight: - case PpAtomLeft: - case PpAtomAnd: - case PpAtomOr: - case PpAtomXor: - strcpy(ppToken.name, atomStrings.getString(resultToken)); - strcpy(pastedPpToken.name, atomStrings.getString(token)); - break; - default: - parseContext.ppError(ppToken.loc, "not supported for these tokens", "##", ""); - return resultToken; - } - - // combine the tokens - if (strlen(ppToken.name) + strlen(pastedPpToken.name) > MaxTokenLength) { - parseContext.ppError(ppToken.loc, "combined tokens are too long", "##", ""); - return resultToken; - } - strncat(ppToken.name, pastedPpToken.name, MaxTokenLength - strlen(ppToken.name)); - - // correct the kind of token we are making, if needed (identifiers stay identifiers) - if (resultToken != PpAtomIdentifier) { - int newToken = atomStrings.getAtom(ppToken.name); - if (newToken > 0) - resultToken = newToken; - else - parseContext.ppError(ppToken.loc, "combined token is invalid", "##", ""); - } - } - - return resultToken; -} - -// Checks if we've seen balanced #if...#endif -void TPpContext::missingEndifCheck() -{ - if (ifdepth > 0) - parseContext.ppError(parseContext.getCurrentLoc(), "missing #endif", "", ""); -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp deleted file mode 100644 index bc145e25..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp +++ /dev/null @@ -1,365 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2013 LunarG, Inc. -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// -/****************************************************************************\ -Copyright (c) 2002, NVIDIA Corporation. - -NVIDIA Corporation("NVIDIA") supplies this software to you in -consideration of your agreement to the following terms, and your use, -installation, modification or redistribution of this NVIDIA software -constitutes acceptance of these terms. If you do not agree with these -terms, please do not use, install, modify or redistribute this NVIDIA -software. - -In consideration of your agreement to abide by the following terms, and -subject to these terms, NVIDIA grants you a personal, non-exclusive -license, under NVIDIA's copyrights in this original NVIDIA software (the -"NVIDIA Software"), to use, reproduce, modify and redistribute the -NVIDIA Software, with or without modifications, in source and/or binary -forms; provided that if you redistribute the NVIDIA Software, you must -retain the copyright notice of NVIDIA, this notice and the following -text and disclaimers in all such redistributions of the NVIDIA Software. -Neither the name, trademarks, service marks nor logos of NVIDIA -Corporation may be used to endorse or promote products derived from the -NVIDIA Software without specific prior written permission from NVIDIA. -Except as expressly stated in this notice, no other rights or licenses -express or implied, are granted by NVIDIA herein, including but not -limited to any patent rights that may be infringed by your derivative -works or by other works in which the NVIDIA Software may be -incorporated. No hardware is licensed hereunder. - -THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, -INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR -ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER -PRODUCTS. - -IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, -INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY -OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE -NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, -TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF -NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -\****************************************************************************/ - -// -// For recording and playing back the stream of tokens in a macro definition. -// - -#ifndef _CRT_SECURE_NO_WARNINGS -#define _CRT_SECURE_NO_WARNINGS -#endif -#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) -#define snprintf sprintf_s -#endif - -#include -#include -#include -#include - -#include "PpContext.h" -#include "PpTokens.h" - -namespace glslang { - -// push onto back of stream -void TPpContext::TokenStream::putSubtoken(char subtoken) -{ - data.push_back(static_cast(subtoken)); -} - -// get the next token in stream -int TPpContext::TokenStream::getSubtoken() -{ - if (current < data.size()) - return data[current++]; - else - return EndOfInput; -} - -// back up one position in the stream -void TPpContext::TokenStream::ungetSubtoken() -{ - if (current > 0) - --current; -} - -// Add a complete token (including backing string) to the end of a list -// for later playback. -void TPpContext::TokenStream::putToken(int token, TPpToken* ppToken) -{ - const char* s; - char* str = NULL; - - assert((token & ~0xff) == 0); - putSubtoken(static_cast(token)); - - switch (token) { - case PpAtomIdentifier: - case PpAtomConstString: - s = ppToken->name; - while (*s) - putSubtoken(*s++); - putSubtoken(0); - break; - case PpAtomConstInt: - case PpAtomConstUint: - case PpAtomConstInt64: - case PpAtomConstUint64: -#ifdef AMD_EXTENSIONS - case PpAtomConstInt16: - case PpAtomConstUint16: -#endif - case PpAtomConstFloat: - case PpAtomConstDouble: -#ifdef AMD_EXTENSIONS - case PpAtomConstFloat16: -#endif - str = ppToken->name; - while (*str) { - putSubtoken(*str); - str++; - } - putSubtoken(0); - break; - default: - break; - } -} - -// Read the next token from a token stream. -// (Not the source stream, but a stream used to hold a tokenized macro). -int TPpContext::TokenStream::getToken(TParseContextBase& parseContext, TPpToken *ppToken) -{ - int len; - int ch; - - int subtoken = getSubtoken(); - ppToken->loc = parseContext.getCurrentLoc(); - switch (subtoken) { - case '#': - // Check for ##, unless the current # is the last character - if (current < data.size()) { - if (getSubtoken() == '#') { - parseContext.requireProfile(ppToken->loc, ~EEsProfile, "token pasting (##)"); - parseContext.profileRequires(ppToken->loc, ~EEsProfile, 130, 0, "token pasting (##)"); - subtoken = PpAtomPaste; - } else - ungetSubtoken(); - } - break; - case PpAtomConstString: - case PpAtomIdentifier: - case PpAtomConstFloat: - case PpAtomConstDouble: -#ifdef AMD_EXTENSIONS - case PpAtomConstFloat16: -#endif - case PpAtomConstInt: - case PpAtomConstUint: - case PpAtomConstInt64: - case PpAtomConstUint64: -#ifdef AMD_EXTENSIONS - case PpAtomConstInt16: - case PpAtomConstUint16: -#endif - len = 0; - ch = getSubtoken(); - while (ch != 0 && ch != EndOfInput) { - if (len < MaxTokenLength) { - ppToken->name[len] = (char)ch; - len++; - ch = getSubtoken(); - } else { - parseContext.error(ppToken->loc, "token too long", "", ""); - break; - } - } - ppToken->name[len] = 0; - - switch (subtoken) { - case PpAtomIdentifier: - break; - case PpAtomConstString: - break; - case PpAtomConstFloat: - case PpAtomConstDouble: -#ifdef AMD_EXTENSIONS - case PpAtomConstFloat16: -#endif - ppToken->dval = atof(ppToken->name); - break; - case PpAtomConstInt: -#ifdef AMD_EXTENSIONS - case PpAtomConstInt16: -#endif - if (len > 0 && ppToken->name[0] == '0') { - if (len > 1 && (ppToken->name[1] == 'x' || ppToken->name[1] == 'X')) - ppToken->ival = (int)strtol(ppToken->name, 0, 16); - else - ppToken->ival = (int)strtol(ppToken->name, 0, 8); - } else - ppToken->ival = atoi(ppToken->name); - break; - case PpAtomConstUint: -#ifdef AMD_EXTENSIONS - case PpAtomConstUint16: -#endif - if (len > 0 && ppToken->name[0] == '0') { - if (len > 1 && (ppToken->name[1] == 'x' || ppToken->name[1] == 'X')) - ppToken->ival = (int)strtoul(ppToken->name, 0, 16); - else - ppToken->ival = (int)strtoul(ppToken->name, 0, 8); - } else - ppToken->ival = (int)strtoul(ppToken->name, 0, 10); - break; - case PpAtomConstInt64: - if (len > 0 && ppToken->name[0] == '0') { - if (len > 1 && (ppToken->name[1] == 'x' || ppToken->name[1] == 'X')) - ppToken->i64val = strtoll(ppToken->name, nullptr, 16); - else - ppToken->i64val = strtoll(ppToken->name, nullptr, 8); - } else - ppToken->i64val = atoll(ppToken->name); - break; - case PpAtomConstUint64: - if (len > 0 && ppToken->name[0] == '0') { - if (len > 1 && (ppToken->name[1] == 'x' || ppToken->name[1] == 'X')) - ppToken->i64val = (long long)strtoull(ppToken->name, nullptr, 16); - else - ppToken->i64val = (long long)strtoull(ppToken->name, nullptr, 8); - } else - ppToken->i64val = (long long)strtoull(ppToken->name, 0, 10); - break; - } - } - - return subtoken; -} - -// We are pasting if -// 1. we are preceding a pasting operator within this stream -// or -// 2. the entire macro is preceding a pasting operator (lastTokenPastes) -// and we are also on the last token -bool TPpContext::TokenStream::peekTokenizedPasting(bool lastTokenPastes) -{ - // 1. preceding ##? - - size_t savePos = current; - int subtoken; - // skip white space - do { - subtoken = getSubtoken(); - } while (subtoken == ' '); - current = savePos; - if (subtoken == PpAtomPaste) - return true; - - // 2. last token and we've been told after this there will be a ## - - if (! lastTokenPastes) - return false; - // Getting here means the last token will be pasted, after this - - // Are we at the last non-whitespace token? - savePos = current; - bool moreTokens = false; - do { - subtoken = getSubtoken(); - if (subtoken == EndOfInput) - break; - if (subtoken != ' ') { - moreTokens = true; - break; - } - } while (true); - current = savePos; - - return !moreTokens; -} - -// See if the next non-white-space tokens are two consecutive # -bool TPpContext::TokenStream::peekUntokenizedPasting() -{ - // don't return early, have to restore this - size_t savePos = current; - - // skip white-space - int subtoken; - do { - subtoken = getSubtoken(); - } while (subtoken == ' '); - - // check for ## - bool pasting = false; - if (subtoken == '#') { - subtoken = getSubtoken(); - if (subtoken == '#') - pasting = true; - } - - current = savePos; - - return pasting; -} - -void TPpContext::pushTokenStreamInput(TokenStream& ts, bool prepasting) -{ - pushInput(new tTokenInput(this, &ts, prepasting)); - ts.reset(); -} - -int TPpContext::tUngotTokenInput::scan(TPpToken* ppToken) -{ - if (done) - return EndOfInput; - - int ret = token; - *ppToken = lval; - done = true; - - return ret; -} - -void TPpContext::UngetToken(int token, TPpToken* ppToken) -{ - pushInput(new tUngotTokenInput(this, token, ppToken)); -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpTokens.h b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpTokens.h deleted file mode 100644 index d56df576..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/preprocessor/PpTokens.h +++ /dev/null @@ -1,181 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// -/****************************************************************************\ -Copyright (c) 2002, NVIDIA Corporation. - -NVIDIA Corporation("NVIDIA") supplies this software to you in -consideration of your agreement to the following terms, and your use, -installation, modification or redistribution of this NVIDIA software -constitutes acceptance of these terms. If you do not agree with these -terms, please do not use, install, modify or redistribute this NVIDIA -software. - -In consideration of your agreement to abide by the following terms, and -subject to these terms, NVIDIA grants you a personal, non-exclusive -license, under NVIDIA's copyrights in this original NVIDIA software (the -"NVIDIA Software"), to use, reproduce, modify and redistribute the -NVIDIA Software, with or without modifications, in source and/or binary -forms; provided that if you redistribute the NVIDIA Software, you must -retain the copyright notice of NVIDIA, this notice and the following -text and disclaimers in all such redistributions of the NVIDIA Software. -Neither the name, trademarks, service marks nor logos of NVIDIA -Corporation may be used to endorse or promote products derived from the -NVIDIA Software without specific prior written permission from NVIDIA. -Except as expressly stated in this notice, no other rights or licenses -express or implied, are granted by NVIDIA herein, including but not -limited to any patent rights that may be infringed by your derivative -works or by other works in which the NVIDIA Software may be -incorporated. No hardware is licensed hereunder. - -THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, -INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR -ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER -PRODUCTS. - -IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, -INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY -OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE -NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, -TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF -NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -\****************************************************************************/ - -#ifndef PARSER_H -#define PARSER_H - -namespace glslang { - -// Multi-character tokens -enum EFixedAtoms { - // single character tokens get their own char value as their token; start here for multi-character tokens - PpAtomMaxSingle = 127, - - // replace bad character tokens with this, to avoid accidental aliasing with the below - PpAtomBadToken, - - // Operators - - PPAtomAddAssign, - PPAtomSubAssign, - PPAtomMulAssign, - PPAtomDivAssign, - PPAtomModAssign, - - PpAtomRight, - PpAtomLeft, - - PpAtomRightAssign, - PpAtomLeftAssign, - PpAtomAndAssign, - PpAtomOrAssign, - PpAtomXorAssign, - - PpAtomAnd, - PpAtomOr, - PpAtomXor, - - PpAtomEQ, - PpAtomNE, - PpAtomGE, - PpAtomLE, - - PpAtomDecrement, - PpAtomIncrement, - - PpAtomColonColon, - - PpAtomPaste, - - // Constants - - PpAtomConstInt, - PpAtomConstUint, - PpAtomConstInt64, - PpAtomConstUint64, -#ifdef AMD_EXTENSIONS - PpAtomConstInt16, - PpAtomConstUint16, -#endif - PpAtomConstFloat, - PpAtomConstDouble, - PpAtomConstFloat16, - PpAtomConstString, - - // Identifiers - PpAtomIdentifier, - - // preprocessor "keywords" - - PpAtomDefine, - PpAtomUndef, - - PpAtomIf, - PpAtomIfdef, - PpAtomIfndef, - PpAtomElse, - PpAtomElif, - PpAtomEndif, - - PpAtomLine, - PpAtomPragma, - PpAtomError, - - // #version ... - PpAtomVersion, - PpAtomCore, - PpAtomCompatibility, - PpAtomEs, - - // #extension - PpAtomExtension, - - // __LINE__, __FILE__, __VERSION__ - - PpAtomLineMacro, - PpAtomFileMacro, - PpAtomVersionMacro, - - // #include - PpAtomInclude, - - PpAtomLast, -}; - -} // end namespace glslang - -#endif /* not PARSER_H */ diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/propagateNoContraction.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/propagateNoContraction.cpp deleted file mode 100644 index ae95688a..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/propagateNoContraction.cpp +++ /dev/null @@ -1,866 +0,0 @@ -// -// Copyright (C) 2015-2016 Google, Inc. -// -// 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 Google Inc. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. - -// -// Visit the nodes in the glslang intermediate tree representation to -// propagate the 'noContraction' qualifier. -// - -#include "propagateNoContraction.h" - -#include -#include -#include -#include -#include - -#include "localintermediate.h" -namespace { - -// Use a string to hold the access chain information, as in most cases the -// access chain is short and may contain only one element, which is the symbol -// ID. -// Example: struct {float a; float b;} s; -// Object s.a will be represented with: /0 -// Object s.b will be represented with: /1 -// Object s will be represented with: -// For members of vector, matrix and arrays, they will be represented with the -// same symbol ID of their container symbol objects. This is because their -// preciseness is always the same as their container symbol objects. -typedef std::string ObjectAccessChain; - -// The delimiter used in the ObjectAccessChain string to separate symbol ID and -// different level of struct indices. -const char ObjectAccesschainDelimiter = '/'; - -// Mapping from Symbol IDs of symbol nodes, to their defining operation -// nodes. -typedef std::unordered_multimap NodeMapping; -// Mapping from object nodes to their access chain info string. -typedef std::unordered_map AccessChainMapping; - -// Set of object IDs. -typedef std::unordered_set ObjectAccesschainSet; -// Set of return branch nodes. -typedef std::unordered_set ReturnBranchNodeSet; - -// A helper function to tell whether a node is 'noContraction'. Returns true if -// the node has 'noContraction' qualifier, otherwise false. -bool isPreciseObjectNode(glslang::TIntermTyped* node) -{ - return node->getType().getQualifier().noContraction; -} - -// Returns true if the opcode is a dereferencing one. -bool isDereferenceOperation(glslang::TOperator op) -{ - switch (op) { - case glslang::EOpIndexDirect: - case glslang::EOpIndexDirectStruct: - case glslang::EOpIndexIndirect: - case glslang::EOpVectorSwizzle: - case glslang::EOpMatrixSwizzle: - return true; - default: - return false; - } -} - -// Returns true if the opcode leads to an assignment operation. -bool isAssignOperation(glslang::TOperator op) -{ - switch (op) { - case glslang::EOpAssign: - case glslang::EOpAddAssign: - case glslang::EOpSubAssign: - case glslang::EOpMulAssign: - case glslang::EOpVectorTimesMatrixAssign: - case glslang::EOpVectorTimesScalarAssign: - case glslang::EOpMatrixTimesScalarAssign: - case glslang::EOpMatrixTimesMatrixAssign: - case glslang::EOpDivAssign: - case glslang::EOpModAssign: - case glslang::EOpAndAssign: - case glslang::EOpLeftShiftAssign: - case glslang::EOpRightShiftAssign: - case glslang::EOpInclusiveOrAssign: - case glslang::EOpExclusiveOrAssign: - - case glslang::EOpPostIncrement: - case glslang::EOpPostDecrement: - case glslang::EOpPreIncrement: - case glslang::EOpPreDecrement: - return true; - default: - return false; - } -} - -// A helper function to get the unsigned int from a given constant union node. -// Note the node should only hold a uint scalar. -unsigned getStructIndexFromConstantUnion(glslang::TIntermTyped* node) -{ - assert(node->getAsConstantUnion() && node->getAsConstantUnion()->isScalar()); - unsigned struct_dereference_index = node->getAsConstantUnion()->getConstArray()[0].getUConst(); - return struct_dereference_index; -} - -// A helper function to generate symbol_label. -ObjectAccessChain generateSymbolLabel(glslang::TIntermSymbol* node) -{ - ObjectAccessChain symbol_id = - std::to_string(node->getId()) + "(" + node->getName().c_str() + ")"; - return symbol_id; -} - -// Returns true if the operation is an arithmetic operation and valid for -// the 'NoContraction' decoration. -bool isArithmeticOperation(glslang::TOperator op) -{ - switch (op) { - case glslang::EOpAddAssign: - case glslang::EOpSubAssign: - case glslang::EOpMulAssign: - case glslang::EOpVectorTimesMatrixAssign: - case glslang::EOpVectorTimesScalarAssign: - case glslang::EOpMatrixTimesScalarAssign: - case glslang::EOpMatrixTimesMatrixAssign: - case glslang::EOpDivAssign: - case glslang::EOpModAssign: - - case glslang::EOpNegative: - - case glslang::EOpAdd: - case glslang::EOpSub: - case glslang::EOpMul: - case glslang::EOpDiv: - case glslang::EOpMod: - - case glslang::EOpVectorTimesScalar: - case glslang::EOpVectorTimesMatrix: - case glslang::EOpMatrixTimesVector: - case glslang::EOpMatrixTimesScalar: - case glslang::EOpMatrixTimesMatrix: - - case glslang::EOpDot: - - case glslang::EOpPostIncrement: - case glslang::EOpPostDecrement: - case glslang::EOpPreIncrement: - case glslang::EOpPreDecrement: - return true; - default: - return false; - } -} - -// A helper class to help manage the populating_initial_no_contraction_ flag. -template class StateSettingGuard { -public: - StateSettingGuard(T* state_ptr, T new_state_value) - : state_ptr_(state_ptr), previous_state_(*state_ptr) - { - *state_ptr = new_state_value; - } - StateSettingGuard(T* state_ptr) : state_ptr_(state_ptr), previous_state_(*state_ptr) {} - void setState(T new_state_value) { *state_ptr_ = new_state_value; } - ~StateSettingGuard() { *state_ptr_ = previous_state_; } - -private: - T* state_ptr_; - T previous_state_; -}; - -// A helper function to get the front element from a given ObjectAccessChain -ObjectAccessChain getFrontElement(const ObjectAccessChain& chain) -{ - size_t pos_delimiter = chain.find(ObjectAccesschainDelimiter); - return pos_delimiter == std::string::npos ? chain : chain.substr(0, pos_delimiter); -} - -// A helper function to get the access chain starting from the second element. -ObjectAccessChain subAccessChainFromSecondElement(const ObjectAccessChain& chain) -{ - size_t pos_delimiter = chain.find(ObjectAccesschainDelimiter); - return pos_delimiter == std::string::npos ? "" : chain.substr(pos_delimiter + 1); -} - -// A helper function to get the access chain after removing a given prefix. -ObjectAccessChain getSubAccessChainAfterPrefix(const ObjectAccessChain& chain, - const ObjectAccessChain& prefix) -{ - size_t pos = chain.find(prefix); - if (pos != 0) - return chain; - return chain.substr(prefix.length() + sizeof(ObjectAccesschainDelimiter)); -} - -// -// A traverser which traverses the whole AST and populates: -// 1) A mapping from symbol nodes' IDs to their defining operation nodes. -// 2) A set of access chains of the initial precise object nodes. -// -class TSymbolDefinitionCollectingTraverser : public glslang::TIntermTraverser { -public: - TSymbolDefinitionCollectingTraverser(NodeMapping* symbol_definition_mapping, - AccessChainMapping* accesschain_mapping, - ObjectAccesschainSet* precise_objects, - ReturnBranchNodeSet* precise_return_nodes); - - bool visitUnary(glslang::TVisit, glslang::TIntermUnary*) override; - bool visitBinary(glslang::TVisit, glslang::TIntermBinary*) override; - void visitSymbol(glslang::TIntermSymbol*) override; - bool visitAggregate(glslang::TVisit, glslang::TIntermAggregate*) override; - bool visitBranch(glslang::TVisit, glslang::TIntermBranch*) override; - -protected: - TSymbolDefinitionCollectingTraverser& operator=(const TSymbolDefinitionCollectingTraverser&); - - // The mapping from symbol node IDs to their defining nodes. This should be - // populated along traversing the AST. - NodeMapping& symbol_definition_mapping_; - // The set of symbol node IDs for precise symbol nodes, the ones marked as - // 'noContraction'. - ObjectAccesschainSet& precise_objects_; - // The set of precise return nodes. - ReturnBranchNodeSet& precise_return_nodes_; - // A temporary cache of the symbol node whose defining node is to be found - // currently along traversing the AST. - ObjectAccessChain current_object_; - // A map from object node to its access chain. This traverser stores - // the built access chains into this map for each object node it has - // visited. - AccessChainMapping& accesschain_mapping_; - // The pointer to the Function Definition node, so we can get the - // preciseness of the return expression from it when we traverse the - // return branch node. - glslang::TIntermAggregate* current_function_definition_node_; -}; - -TSymbolDefinitionCollectingTraverser::TSymbolDefinitionCollectingTraverser( - NodeMapping* symbol_definition_mapping, AccessChainMapping* accesschain_mapping, - ObjectAccesschainSet* precise_objects, - std::unordered_set* precise_return_nodes) - : TIntermTraverser(true, false, false), symbol_definition_mapping_(*symbol_definition_mapping), - precise_objects_(*precise_objects), precise_return_nodes_(*precise_return_nodes), - current_object_(), accesschain_mapping_(*accesschain_mapping), - current_function_definition_node_(nullptr) {} - -// Visits a symbol node, set the current_object_ to the -// current node symbol ID, and record a mapping from this node to the current -// current_object_, which is the just obtained symbol -// ID. -void TSymbolDefinitionCollectingTraverser::visitSymbol(glslang::TIntermSymbol* node) -{ - current_object_ = generateSymbolLabel(node); - accesschain_mapping_[node] = current_object_; -} - -// Visits an aggregate node, traverses all of its children. -bool TSymbolDefinitionCollectingTraverser::visitAggregate(glslang::TVisit, - glslang::TIntermAggregate* node) -{ - // This aggregate node might be a function definition node, in which case we need to - // cache this node, so we can get the preciseness information of the return value - // of this function later. - StateSettingGuard current_function_definition_node_setting_guard( - ¤t_function_definition_node_); - if (node->getOp() == glslang::EOpFunction) { - // This is function definition node, we need to cache this node so that we can - // get the preciseness of the return value later. - current_function_definition_node_setting_guard.setState(node); - } - // Traverse the items in the sequence. - glslang::TIntermSequence& seq = node->getSequence(); - for (int i = 0; i < (int)seq.size(); ++i) { - current_object_.clear(); - seq[i]->traverse(this); - } - return false; -} - -bool TSymbolDefinitionCollectingTraverser::visitBranch(glslang::TVisit, - glslang::TIntermBranch* node) -{ - if (node->getFlowOp() == glslang::EOpReturn && node->getExpression() && - current_function_definition_node_ && - current_function_definition_node_->getType().getQualifier().noContraction) { - // This node is a return node with an expression, and its function has a - // precise return value. We need to find the involved objects in its - // expression and add them to the set of initial precise objects. - precise_return_nodes_.insert(node); - node->getExpression()->traverse(this); - } - return false; -} - -// Visits a unary node. This might be an implicit assignment like i++, i--. etc. -bool TSymbolDefinitionCollectingTraverser::visitUnary(glslang::TVisit /* visit */, - glslang::TIntermUnary* node) -{ - current_object_.clear(); - node->getOperand()->traverse(this); - if (isAssignOperation(node->getOp())) { - // We should always be able to get an access chain of the operand node. - assert(!current_object_.empty()); - - // If the operand node object is 'precise', we collect its access chain - // for the initial set of 'precise' objects. - if (isPreciseObjectNode(node->getOperand())) { - // The operand node is an 'precise' object node, add its - // access chain to the set of 'precise' objects. This is to collect - // the initial set of 'precise' objects. - precise_objects_.insert(current_object_); - } - // Gets the symbol ID from the object's access chain. - ObjectAccessChain id_symbol = getFrontElement(current_object_); - // Add a mapping from the symbol ID to this assignment operation node. - symbol_definition_mapping_.insert(std::make_pair(id_symbol, node)); - } - // A unary node is not a dereference node, so we clear the access chain which - // is under construction. - current_object_.clear(); - return false; -} - -// Visits a binary node and updates the mapping from symbol IDs to the definition -// nodes. Also collects the access chains for the initial precise objects. -bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit */, - glslang::TIntermBinary* node) -{ - // Traverses the left node to build the access chain info for the object. - current_object_.clear(); - node->getLeft()->traverse(this); - - if (isAssignOperation(node->getOp())) { - // We should always be able to get an access chain for the left node. - assert(!current_object_.empty()); - - // If the left node object is 'precise', it is an initial precise object - // specified in the shader source. Adds it to the initial work list to - // process later. - if (isPreciseObjectNode(node->getLeft())) { - // The left node is an 'precise' object node, add its access chain to - // the set of 'precise' objects. This is to collect the initial set - // of 'precise' objects. - precise_objects_.insert(current_object_); - } - // Gets the symbol ID from the object access chain, which should be the - // first element recorded in the access chain. - ObjectAccessChain id_symbol = getFrontElement(current_object_); - // Adds a mapping from the symbol ID to this assignment operation node. - symbol_definition_mapping_.insert(std::make_pair(id_symbol, node)); - - // Traverses the right node, there may be other 'assignment' - // operations in the right. - current_object_.clear(); - node->getRight()->traverse(this); - - } else if (isDereferenceOperation(node->getOp())) { - // The left node (parent node) is a struct type object. We need to - // record the access chain information of the current node into its - // object id. - if (node->getOp() == glslang::EOpIndexDirectStruct) { - unsigned struct_dereference_index = getStructIndexFromConstantUnion(node->getRight()); - current_object_.push_back(ObjectAccesschainDelimiter); - current_object_.append(std::to_string(struct_dereference_index)); - } - accesschain_mapping_[node] = current_object_; - - // For a dereference node, there is no need to traverse the right child - // node as the right node should always be an integer type object. - - } else { - // For other binary nodes, still traverse the right node. - current_object_.clear(); - node->getRight()->traverse(this); - } - return false; -} - -// Traverses the AST and returns a tuple of four members: -// 1) a mapping from symbol IDs to the definition nodes (aka. assignment nodes) of these symbols. -// 2) a mapping from object nodes in the AST to the access chains of these objects. -// 3) a set of access chains of precise objects. -// 4) a set of return nodes with precise expressions. -std::tuple -getSymbolToDefinitionMappingAndPreciseSymbolIDs(const glslang::TIntermediate& intermediate) -{ - auto result_tuple = std::make_tuple(NodeMapping(), AccessChainMapping(), ObjectAccesschainSet(), - ReturnBranchNodeSet()); - - TIntermNode* root = intermediate.getTreeRoot(); - if (root == 0) - return result_tuple; - - NodeMapping& symbol_definition_mapping = std::get<0>(result_tuple); - AccessChainMapping& accesschain_mapping = std::get<1>(result_tuple); - ObjectAccesschainSet& precise_objects = std::get<2>(result_tuple); - ReturnBranchNodeSet& precise_return_nodes = std::get<3>(result_tuple); - - // Traverses the AST and populate the results. - TSymbolDefinitionCollectingTraverser collector(&symbol_definition_mapping, &accesschain_mapping, - &precise_objects, &precise_return_nodes); - root->traverse(&collector); - - return result_tuple; -} - -// -// A traverser that determine whether the left node (or operand node for unary -// node) of an assignment node is 'precise', containing 'precise' or not, -// according to the access chain a given precise object which share the same -// symbol as the left node. -// -// Post-orderly traverses the left node subtree of an binary assignment node and: -// -// 1) Propagates the 'precise' from the left object nodes to this object node. -// -// 2) Builds object access chain along the traversal, and also compares with -// the access chain of the given 'precise' object along with the traversal to -// tell if the node to be defined is 'precise' or not. -// -class TNoContractionAssigneeCheckingTraverser : public glslang::TIntermTraverser { - - enum DecisionStatus { - // The object node to be assigned to may contain 'precise' objects and also not 'precise' objects. - Mixed = 0, - // The object node to be assigned to is either a 'precise' object or a struct objects whose members are all 'precise'. - Precise = 1, - // The object node to be assigned to is not a 'precise' object. - NotPreicse = 2, - }; - -public: - TNoContractionAssigneeCheckingTraverser(const AccessChainMapping& accesschain_mapping) - : TIntermTraverser(true, false, false), accesschain_mapping_(accesschain_mapping), - precise_object_(nullptr) {} - - // Checks the preciseness of a given assignment node with a precise object - // represented as access chain. The precise object shares the same symbol - // with the assignee of the given assignment node. Return a tuple of two: - // - // 1) The preciseness of the assignee node of this assignment node. True - // if the assignee contains 'precise' objects or is 'precise', false if - // the assignee is not 'precise' according to the access chain of the given - // precise object. - // - // 2) The incremental access chain from the assignee node to its nested - // 'precise' object, according to the access chain of the given precise - // object. This incremental access chain can be empty, which means the - // assignee is 'precise'. Otherwise it shows the path to the nested - // precise object. - std::tuple - getPrecisenessAndRemainedAccessChain(glslang::TIntermOperator* node, - const ObjectAccessChain& precise_object) - { - assert(isAssignOperation(node->getOp())); - precise_object_ = &precise_object; - ObjectAccessChain assignee_object; - if (glslang::TIntermBinary* BN = node->getAsBinaryNode()) { - // This is a binary assignment node, we need to check the - // preciseness of the left node. - assert(accesschain_mapping_.count(BN->getLeft())); - // The left node (assignee node) is an object node, traverse the - // node to let the 'precise' of nesting objects being transfered to - // nested objects. - BN->getLeft()->traverse(this); - // After traversing the left node, if the left node is 'precise', - // we can conclude this assignment should propagate 'precise'. - if (isPreciseObjectNode(BN->getLeft())) { - return make_tuple(true, ObjectAccessChain()); - } - // If the preciseness of the left node (assignee node) can not - // be determined by now, we need to compare the access chain string - // of the assignee object with the given precise object. - assignee_object = accesschain_mapping_.at(BN->getLeft()); - - } else if (glslang::TIntermUnary* UN = node->getAsUnaryNode()) { - // This is a unary assignment node, we need to check the - // preciseness of the operand node. For unary assignment node, the - // operand node should always be an object node. - assert(accesschain_mapping_.count(UN->getOperand())); - // Traverse the operand node to let the 'precise' being propagated - // from lower nodes to upper nodes. - UN->getOperand()->traverse(this); - // After traversing the operand node, if the operand node is - // 'precise', this assignment should propagate 'precise'. - if (isPreciseObjectNode(UN->getOperand())) { - return make_tuple(true, ObjectAccessChain()); - } - // If the preciseness of the operand node (assignee node) can not - // be determined by now, we need to compare the access chain string - // of the assignee object with the given precise object. - assignee_object = accesschain_mapping_.at(UN->getOperand()); - } else { - // Not a binary or unary node, should not happen. - assert(false); - } - - // Compare the access chain string of the assignee node with the given - // precise object to determine if this assignment should propagate - // 'precise'. - if (assignee_object.find(precise_object) == 0) { - // The access chain string of the given precise object is a prefix - // of assignee's access chain string. The assignee should be - // 'precise'. - return make_tuple(true, ObjectAccessChain()); - } else if (precise_object.find(assignee_object) == 0) { - // The assignee's access chain string is a prefix of the given - // precise object, the assignee object contains 'precise' object, - // and we need to pass the remained access chain to the object nodes - // in the right. - return make_tuple(true, getSubAccessChainAfterPrefix(precise_object, assignee_object)); - } else { - // The access chain strings do not match, the assignee object can - // not be labeled as 'precise' according to the given precise - // object. - return make_tuple(false, ObjectAccessChain()); - } - } - -protected: - TNoContractionAssigneeCheckingTraverser& operator=(const TNoContractionAssigneeCheckingTraverser&); - - bool visitBinary(glslang::TVisit, glslang::TIntermBinary* node) override; - void visitSymbol(glslang::TIntermSymbol* node) override; - - // A map from object nodes to their access chain string (used as object ID). - const AccessChainMapping& accesschain_mapping_; - // A given precise object, represented in it access chain string. This - // precise object is used to be compared with the assignee node to tell if - // the assignee node is 'precise', contains 'precise' object or not - // 'precise'. - const ObjectAccessChain* precise_object_; -}; - -// Visits a binary node. If the node is an object node, it must be a dereference -// node. In such cases, if the left node is 'precise', this node should also be -// 'precise'. -bool TNoContractionAssigneeCheckingTraverser::visitBinary(glslang::TVisit, - glslang::TIntermBinary* node) -{ - // Traverses the left so that we transfer the 'precise' from nesting object - // to its nested object. - node->getLeft()->traverse(this); - // If this binary node is an object node, we should have it in the - // accesschain_mapping_. - if (accesschain_mapping_.count(node)) { - // A binary object node must be a dereference node. - assert(isDereferenceOperation(node->getOp())); - // If the left node is 'precise', this node should also be precise, - // otherwise, compare with the given precise_object_. If the - // access chain of this node matches with the given precise_object_, - // this node should be marked as 'precise'. - if (isPreciseObjectNode(node->getLeft())) { - node->getWritableType().getQualifier().noContraction = true; - } else if (accesschain_mapping_.at(node) == *precise_object_) { - node->getWritableType().getQualifier().noContraction = true; - } - } - return false; -} - -// Visits a symbol node, if the symbol node ID (its access chain string) matches -// with the given precise object, this node should be 'precise'. -void TNoContractionAssigneeCheckingTraverser::visitSymbol(glslang::TIntermSymbol* node) -{ - // A symbol node should always be an object node, and should have been added - // to the map from object nodes to their access chain strings. - assert(accesschain_mapping_.count(node)); - if (accesschain_mapping_.at(node) == *precise_object_) { - node->getWritableType().getQualifier().noContraction = true; - } -} - -// -// A traverser that only traverses the right side of binary assignment nodes -// and the operand node of unary assignment nodes. -// -// 1) Marks arithmetic operations as 'NoContraction'. -// -// 2) Find the object which should be marked as 'precise' in the right and -// update the 'precise' object work list. -// -class TNoContractionPropagator : public glslang::TIntermTraverser { -public: - TNoContractionPropagator(ObjectAccesschainSet* precise_objects, - const AccessChainMapping& accesschain_mapping) - : TIntermTraverser(true, false, false), - precise_objects_(*precise_objects), added_precise_object_ids_(), - remained_accesschain_(), accesschain_mapping_(accesschain_mapping) {} - - // Propagates 'precise' in the right nodes of a given assignment node with - // access chain record from the assignee node to a 'precise' object it - // contains. - void - propagateNoContractionInOneExpression(glslang::TIntermTyped* defining_node, - const ObjectAccessChain& assignee_remained_accesschain) - { - remained_accesschain_ = assignee_remained_accesschain; - if (glslang::TIntermBinary* BN = defining_node->getAsBinaryNode()) { - assert(isAssignOperation(BN->getOp())); - BN->getRight()->traverse(this); - if (isArithmeticOperation(BN->getOp())) { - BN->getWritableType().getQualifier().noContraction = true; - } - } else if (glslang::TIntermUnary* UN = defining_node->getAsUnaryNode()) { - assert(isAssignOperation(UN->getOp())); - UN->getOperand()->traverse(this); - if (isArithmeticOperation(UN->getOp())) { - UN->getWritableType().getQualifier().noContraction = true; - } - } - } - - // Propagates 'precise' in a given precise return node. - void propagateNoContractionInReturnNode(glslang::TIntermBranch* return_node) - { - remained_accesschain_ = ""; - assert(return_node->getFlowOp() == glslang::EOpReturn && return_node->getExpression()); - return_node->getExpression()->traverse(this); - } - -protected: - TNoContractionPropagator& operator=(const TNoContractionPropagator&); - - // Visits an aggregate node. The node can be a initializer list, in which - // case we need to find the 'precise' or 'precise' containing object node - // with the access chain record. In other cases, just need to traverse all - // the children nodes. - bool visitAggregate(glslang::TVisit, glslang::TIntermAggregate* node) override - { - if (!remained_accesschain_.empty() && node->getOp() == glslang::EOpConstructStruct) { - // This is a struct initializer node, and the remained - // access chain is not empty, we need to refer to the - // assignee_remained_access_chain_ to find the nested - // 'precise' object. And we don't need to visit other nodes in this - // aggregate node. - - // Gets the struct dereference index that leads to 'precise' object. - ObjectAccessChain precise_accesschain_index_str = - getFrontElement(remained_accesschain_); - unsigned precise_accesschain_index = (unsigned)strtoul(precise_accesschain_index_str.c_str(), nullptr, 10); - // Gets the node pointed by the access chain index extracted before. - glslang::TIntermTyped* potential_precise_node = - node->getSequence()[precise_accesschain_index]->getAsTyped(); - assert(potential_precise_node); - // Pop the front access chain index from the path, and visit the nested node. - { - ObjectAccessChain next_level_accesschain = - subAccessChainFromSecondElement(remained_accesschain_); - StateSettingGuard setup_remained_accesschain_for_next_level( - &remained_accesschain_, next_level_accesschain); - potential_precise_node->traverse(this); - } - return false; - } - return true; - } - - // Visits a binary node. A binary node can be an object node, e.g. a dereference node. - // As only the top object nodes in the right side of an assignment needs to be visited - // and added to 'precise' work list, this traverser won't visit the children nodes of - // an object node. If the binary node does not represent an object node, it should - // go on to traverse its children nodes and if it is an arithmetic operation node, this - // operation should be marked as 'noContraction'. - bool visitBinary(glslang::TVisit, glslang::TIntermBinary* node) override - { - if (isDereferenceOperation(node->getOp())) { - // This binary node is an object node. Need to update the precise - // object set with the access chain of this node + remained - // access chain . - ObjectAccessChain new_precise_accesschain = accesschain_mapping_.at(node); - if (remained_accesschain_.empty()) { - node->getWritableType().getQualifier().noContraction = true; - } else { - new_precise_accesschain += ObjectAccesschainDelimiter + remained_accesschain_; - } - // Cache the access chain as added precise object, so we won't add the - // same object to the work list again. - if (!added_precise_object_ids_.count(new_precise_accesschain)) { - precise_objects_.insert(new_precise_accesschain); - added_precise_object_ids_.insert(new_precise_accesschain); - } - // Only the upper-most object nodes should be visited, so do not - // visit children of this object node. - return false; - } - // If this is an arithmetic operation, marks this node as 'noContraction'. - if (isArithmeticOperation(node->getOp()) && node->getBasicType() != glslang::EbtInt) { - node->getWritableType().getQualifier().noContraction = true; - } - // As this node is not an object node, need to traverse the children nodes. - return true; - } - - // Visits a unary node. A unary node can not be an object node. If the operation - // is an arithmetic operation, need to mark this node as 'noContraction'. - bool visitUnary(glslang::TVisit /* visit */, glslang::TIntermUnary* node) override - { - // If this is an arithmetic operation, marks this with 'noContraction' - if (isArithmeticOperation(node->getOp())) { - node->getWritableType().getQualifier().noContraction = true; - } - return true; - } - - // Visits a symbol node. A symbol node is always an object node. So we - // should always be able to find its in our collected mapping from object - // nodes to access chains. As an object node, a symbol node can be either - // 'precise' or containing 'precise' objects according to unused - // access chain information we have when we visit this node. - void visitSymbol(glslang::TIntermSymbol* node) override - { - // Symbol nodes are object nodes and should always have an - // access chain collected before matches with it. - assert(accesschain_mapping_.count(node)); - ObjectAccessChain new_precise_accesschain = accesschain_mapping_.at(node); - // If the unused access chain is empty, this symbol node should be - // marked as 'precise'. Otherwise, the unused access chain should be - // appended to the symbol ID to build a new access chain which points to - // the nested 'precise' object in this symbol object. - if (remained_accesschain_.empty()) { - node->getWritableType().getQualifier().noContraction = true; - } else { - new_precise_accesschain += ObjectAccesschainDelimiter + remained_accesschain_; - } - // Add the new 'precise' access chain to the work list and make sure we - // don't visit it again. - if (!added_precise_object_ids_.count(new_precise_accesschain)) { - precise_objects_.insert(new_precise_accesschain); - added_precise_object_ids_.insert(new_precise_accesschain); - } - } - - // A set of precise objects, represented as access chains. - ObjectAccesschainSet& precise_objects_; - // Visited symbol nodes, should not revisit these nodes. - ObjectAccesschainSet added_precise_object_ids_; - // The left node of an assignment operation might be an parent of 'precise' objects. - // This means the left node might not be an 'precise' object node, but it may contains - // 'precise' qualifier which should be propagated to the corresponding child node in - // the right. So we need the path from the left node to its nested 'precise' node to - // tell us how to find the corresponding 'precise' node in the right. - ObjectAccessChain remained_accesschain_; - // A map from node pointers to their access chains. - const AccessChainMapping& accesschain_mapping_; -}; -} - -namespace glslang { - -void PropagateNoContraction(const glslang::TIntermediate& intermediate) -{ - // First, traverses the AST, records symbols with their defining operations - // and collects the initial set of precise symbols (symbol nodes that marked - // as 'noContraction') and precise return nodes. - auto mappings_and_precise_objects = - getSymbolToDefinitionMappingAndPreciseSymbolIDs(intermediate); - - // The mapping of symbol node IDs to their defining nodes. This enables us - // to get the defining node directly from a given symbol ID without - // traversing the tree again. - NodeMapping& symbol_definition_mapping = std::get<0>(mappings_and_precise_objects); - - // The mapping of object nodes to their access chains recorded. - AccessChainMapping& accesschain_mapping = std::get<1>(mappings_and_precise_objects); - - // The initial set of 'precise' objects which are represented as the - // access chain toward them. - ObjectAccesschainSet& precise_object_accesschains = std::get<2>(mappings_and_precise_objects); - - // The set of 'precise' return nodes. - ReturnBranchNodeSet& precise_return_nodes = std::get<3>(mappings_and_precise_objects); - - // Second, uses the initial set of precise objects as a work list, pops an - // access chain, extract the symbol ID from it. Then: - // 1) Check the assignee object, see if it is 'precise' object node or - // contains 'precise' object. Obtain the incremental access chain from the - // assignee node to its nested 'precise' node (if any). - // 2) If the assignee object node is 'precise' or it contains 'precise' - // objects, traverses the right side of the assignment operation - // expression to mark arithmetic operations as 'noContration' and update - // 'precise' access chain work list with new found object nodes. - // Repeat above steps until the work list is empty. - TNoContractionAssigneeCheckingTraverser checker(accesschain_mapping); - TNoContractionPropagator propagator(&precise_object_accesschains, accesschain_mapping); - - // We have two initial precise work lists to handle: - // 1) precise return nodes - // 2) precise object access chains - // We should process the precise return nodes first and the involved - // objects in the return expression should be added to the precise object - // access chain set. - while (!precise_return_nodes.empty()) { - glslang::TIntermBranch* precise_return_node = *precise_return_nodes.begin(); - propagator.propagateNoContractionInReturnNode(precise_return_node); - precise_return_nodes.erase(precise_return_node); - } - - while (!precise_object_accesschains.empty()) { - // Get the access chain of a precise object from the work list. - ObjectAccessChain precise_object_accesschain = *precise_object_accesschains.begin(); - // Get the symbol id from the access chain. - ObjectAccessChain symbol_id = getFrontElement(precise_object_accesschain); - // Get all the defining nodes of that symbol ID. - std::pair range = - symbol_definition_mapping.equal_range(symbol_id); - // Visits all the assignment nodes of that symbol ID and - // 1) Check if the assignee node is 'precise' or contains 'precise' - // objects. - // 2) Propagate the 'precise' to the top layer object nodes - // in the right side of the assignment operation, update the 'precise' - // work list with new access chains representing the new 'precise' - // objects, and mark arithmetic operations as 'noContraction'. - for (NodeMapping::iterator defining_node_iter = range.first; - defining_node_iter != range.second; defining_node_iter++) { - TIntermOperator* defining_node = defining_node_iter->second; - // Check the assignee node. - auto checker_result = checker.getPrecisenessAndRemainedAccessChain( - defining_node, precise_object_accesschain); - bool& contain_precise = std::get<0>(checker_result); - ObjectAccessChain& remained_accesschain = std::get<1>(checker_result); - // If the assignee node is 'precise' or contains 'precise', propagate the - // 'precise' to the right. Otherwise just skip this assignment node. - if (contain_precise) { - propagator.propagateNoContractionInOneExpression(defining_node, - remained_accesschain); - } - } - // Remove the last processed 'precise' object from the work list. - precise_object_accesschains.erase(precise_object_accesschain); - } -} -}; diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/propagateNoContraction.h b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/propagateNoContraction.h deleted file mode 100644 index 8521ad7d..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/propagateNoContraction.h +++ /dev/null @@ -1,55 +0,0 @@ -// -// Copyright (C) 2015-2016 Google, Inc. -// -// 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 Google Inc. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. - -// -// Visit the nodes in the glslang intermediate tree representation to -// propagate 'noContraction' qualifier. -// - -#pragma once - -#include "../Include/intermediate.h" - -namespace glslang { - -// Propagates the 'precise' qualifier for objects (objects marked with -// 'noContraction' qualifier) from the shader source specified 'precise' -// variables to all the involved objects, and add 'noContraction' qualifier for -// the involved arithmetic operations. -// Note that the same qualifier: 'noContraction' is used in both object nodes -// and arithmetic operation nodes, but has different meaning. For object nodes, -// 'noContraction' means the object is 'precise'; and for arithmetic operation -// nodes, it means the operation should not be contracted. -void PropagateNoContraction(const glslang::TIntermediate& intermediate); -}; diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/reflection.cpp b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/reflection.cpp deleted file mode 100644 index 50fb6027..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/reflection.cpp +++ /dev/null @@ -1,793 +0,0 @@ -// -// Copyright (C) 2013-2016 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#include "../Include/Common.h" -#include "reflection.h" -#include "LiveTraverser.h" -#include "localintermediate.h" - -#include "gl_types.h" - -// -// Grow the reflection database through a friend traverser class of TReflection and a -// collection of functions to do a liveness traversal that note what uniforms are used -// in semantically non-dead code. -// -// Can be used multiple times, once per stage, to grow a program reflection. -// -// High-level algorithm for one stage: -// -// 1. Put the entry point on the list of live functions. -// -// 2. Traverse any live function, while skipping if-tests with a compile-time constant -// condition of false, and while adding any encountered function calls to the live -// function list. -// -// Repeat until the live function list is empty. -// -// 3. Add any encountered uniform variables and blocks to the reflection database. -// -// Can be attempted with a failed link, but will return false if recursion had been detected, or -// there wasn't exactly one entry point. -// - -namespace glslang { - -// -// The traverser: mostly pass through, except -// - processing binary nodes to see if they are dereferences of an aggregates to track -// - processing symbol nodes to see if they are non-aggregate objects to track -// -// This ignores semantically dead code by using TLiveTraverser. -// -// This is in the glslang namespace directly so it can be a friend of TReflection. -// - -class TReflectionTraverser : public TLiveTraverser { -public: - TReflectionTraverser(const TIntermediate& i, TReflection& r) : - TLiveTraverser(i), reflection(r) { } - - virtual bool visitBinary(TVisit, TIntermBinary* node); - virtual void visitSymbol(TIntermSymbol* base); - - // Add a simple reference to a uniform variable to the uniform database, no dereference involved. - // However, no dereference doesn't mean simple... it could be a complex aggregate. - void addUniform(const TIntermSymbol& base) - { - if (processedDerefs.find(&base) == processedDerefs.end()) { - processedDerefs.insert(&base); - - // Use a degenerate (empty) set of dereferences to immediately put as at the end of - // the dereference change expected by blowUpActiveAggregate. - TList derefs; - blowUpActiveAggregate(base.getType(), base.getName(), derefs, derefs.end(), -1, -1, 0); - } - } - - void addAttribute(const TIntermSymbol& base) - { - if (processedDerefs.find(&base) == processedDerefs.end()) { - processedDerefs.insert(&base); - - const TString &name = base.getName(); - const TType &type = base.getType(); - - TReflection::TNameToIndex::const_iterator it = reflection.nameToIndex.find(name); - if (it == reflection.nameToIndex.end()) { - reflection.nameToIndex[name] = (int)reflection.indexToAttribute.size(); - reflection.indexToAttribute.push_back(TObjectReflection(name, type, 0, mapToGlType(type), 0, 0)); - } - } - } - - // Lookup or calculate the offset of a block member, using the recursively - // defined block offset rules. - int getOffset(const TType& type, int index) - { - const TTypeList& memberList = *type.getStruct(); - - // Don't calculate offset if one is present, it could be user supplied - // and different than what would be calculated. That is, this is faster, - // but not just an optimization. - if (memberList[index].type->getQualifier().hasOffset()) - return memberList[index].type->getQualifier().layoutOffset; - - int memberSize; - int dummyStride; - int offset = 0; - for (int m = 0; m <= index; ++m) { - // modify just the children's view of matrix layout, if there is one for this member - TLayoutMatrix subMatrixLayout = memberList[m].type->getQualifier().layoutMatrix; - int memberAlignment = intermediate.getBaseAlignment(*memberList[m].type, memberSize, dummyStride, - type.getQualifier().layoutPacking == ElpStd140, - subMatrixLayout != ElmNone - ? subMatrixLayout == ElmRowMajor - : type.getQualifier().layoutMatrix == ElmRowMajor); - RoundToPow2(offset, memberAlignment); - if (m < index) - offset += memberSize; - } - - return offset; - } - - // Calculate the block data size. - // Block arrayness is not taken into account, each element is backed by a separate buffer. - int getBlockSize(const TType& blockType) - { - const TTypeList& memberList = *blockType.getStruct(); - int lastIndex = (int)memberList.size() - 1; - int lastOffset = getOffset(blockType, lastIndex); - - int lastMemberSize; - int dummyStride; - intermediate.getBaseAlignment(*memberList[lastIndex].type, lastMemberSize, dummyStride, - blockType.getQualifier().layoutPacking == ElpStd140, - blockType.getQualifier().layoutMatrix == ElmRowMajor); - - return lastOffset + lastMemberSize; - } - - // Traverse the provided deref chain, including the base, and - // - build a full reflection-granularity name, array size, etc. entry out of it, if it goes down to that granularity - // - recursively expand any variable array index in the middle of that traversal - // - recursively expand what's left at the end if the deref chain did not reach down to reflection granularity - // - // arraySize tracks, just for the final dereference in the chain, if there was a specific known size. - // A value of 0 for arraySize will mean to use the full array's size. - void blowUpActiveAggregate(const TType& baseType, const TString& baseName, const TList& derefs, - TList::const_iterator deref, int offset, int blockIndex, int arraySize) - { - // process the part of the dereference chain that was explicit in the shader - TString name = baseName; - const TType* terminalType = &baseType; - for (; deref != derefs.end(); ++deref) { - TIntermBinary* visitNode = *deref; - terminalType = &visitNode->getType(); - int index; - switch (visitNode->getOp()) { - case EOpIndexIndirect: - // Visit all the indices of this array, and for each one add on the remaining dereferencing - for (int i = 0; i < std::max(visitNode->getLeft()->getType().getOuterArraySize(), 1); ++i) { - TString newBaseName = name; - if (baseType.getBasicType() != EbtBlock) - newBaseName.append(TString("[") + String(i) + "]"); - TList::const_iterator nextDeref = deref; - ++nextDeref; - TType derefType(*terminalType, 0); - blowUpActiveAggregate(derefType, newBaseName, derefs, nextDeref, offset, blockIndex, arraySize); - } - - // it was all completed in the recursive calls above - return; - case EOpIndexDirect: - index = visitNode->getRight()->getAsConstantUnion()->getConstArray()[0].getIConst(); - if (baseType.getBasicType() != EbtBlock) - name.append(TString("[") + String(index) + "]"); - break; - case EOpIndexDirectStruct: - index = visitNode->getRight()->getAsConstantUnion()->getConstArray()[0].getIConst(); - if (offset >= 0) - offset += getOffset(visitNode->getLeft()->getType(), index); - if (name.size() > 0) - name.append("."); - name.append((*visitNode->getLeft()->getType().getStruct())[index].type->getFieldName()); - break; - default: - break; - } - } - - // if the terminalType is still too coarse a granularity, this is still an aggregate to expand, expand it... - if (! isReflectionGranularity(*terminalType)) { - if (terminalType->isArray()) { - // Visit all the indices of this array, and for each one, - // fully explode the remaining aggregate to dereference - for (int i = 0; i < std::max(terminalType->getOuterArraySize(), 1); ++i) { - TString newBaseName = name; - newBaseName.append(TString("[") + String(i) + "]"); - TType derefType(*terminalType, 0); - blowUpActiveAggregate(derefType, newBaseName, derefs, derefs.end(), offset, blockIndex, 0); - } - } else { - // Visit all members of this aggregate, and for each one, - // fully explode the remaining aggregate to dereference - const TTypeList& typeList = *terminalType->getStruct(); - for (int i = 0; i < (int)typeList.size(); ++i) { - TString newBaseName = name; - newBaseName.append(TString(".") + typeList[i].type->getFieldName()); - TType derefType(*terminalType, i); - blowUpActiveAggregate(derefType, newBaseName, derefs, derefs.end(), offset, blockIndex, 0); - } - } - - // it was all completed in the recursive calls above - return; - } - - // Finally, add a full string to the reflection database, and update the array size if necessary. - // If the dereferenced entity to record is an array, compute the size and update the maximum size. - - // there might not be a final array dereference, it could have been copied as an array object - if (arraySize == 0) - arraySize = mapToGlArraySize(*terminalType); - - TReflection::TNameToIndex::const_iterator it = reflection.nameToIndex.find(name); - if (it == reflection.nameToIndex.end()) { - reflection.nameToIndex[name] = (int)reflection.indexToUniform.size(); - reflection.indexToUniform.push_back(TObjectReflection(name, *terminalType, offset, - mapToGlType(*terminalType), - arraySize, blockIndex)); - } else if (arraySize > 1) { - int& reflectedArraySize = reflection.indexToUniform[it->second].size; - reflectedArraySize = std::max(arraySize, reflectedArraySize); - } - } - - // Add a uniform dereference where blocks/struct/arrays are involved in the access. - // Handles the situation where the left node is at the correct or too coarse a - // granularity for reflection. (That is, further dereferences up the tree will be - // skipped.) Earlier dereferences, down the tree, will be handled - // at the same time, and logged to prevent reprocessing as the tree is traversed. - // - // Note: Other things like the following must be caught elsewhere: - // - a simple non-array, non-struct variable (no dereference even conceivable) - // - an aggregrate consumed en masse, without a dereference - // - // So, this code is for cases like - // - a struct/block dereferencing a member (whether the member is array or not) - // - an array of struct - // - structs/arrays containing the above - // - void addDereferencedUniform(TIntermBinary* topNode) - { - // See if too fine-grained to process (wait to get further down the tree) - const TType& leftType = topNode->getLeft()->getType(); - if ((leftType.isVector() || leftType.isMatrix()) && ! leftType.isArray()) - return; - - // We have an array or structure or block dereference, see if it's a uniform - // based dereference (if not, skip it). - TIntermSymbol* base = findBase(topNode); - if (! base || ! base->getQualifier().isUniformOrBuffer()) - return; - - // See if we've already processed this (e.g., in the middle of something - // we did earlier), and if so skip it - if (processedDerefs.find(topNode) != processedDerefs.end()) - return; - - // Process this uniform dereference - - int offset = -1; - int blockIndex = -1; - bool anonymous = false; - - // See if we need to record the block itself - bool block = base->getBasicType() == EbtBlock; - if (block) { - offset = 0; - anonymous = IsAnonymous(base->getName()); - - const TString& blockName = base->getType().getTypeName(); - - if (base->getType().isArray()) { - TType derefType(base->getType(), 0); - - assert(! anonymous); - for (int e = 0; e < base->getType().getCumulativeArraySize(); ++e) - blockIndex = addBlockName(blockName + "[" + String(e) + "]", derefType, - getBlockSize(base->getType())); - } else - blockIndex = addBlockName(blockName, base->getType(), getBlockSize(base->getType())); - } - - // Process the dereference chain, backward, accumulating the pieces for later forward traversal. - // If the topNode is a reflection-granularity-array dereference, don't include that last dereference. - TList derefs; - for (TIntermBinary* visitNode = topNode; visitNode; visitNode = visitNode->getLeft()->getAsBinaryNode()) { - if (isReflectionGranularity(visitNode->getLeft()->getType())) - continue; - - derefs.push_front(visitNode); - processedDerefs.insert(visitNode); - } - processedDerefs.insert(base); - - // See if we have a specific array size to stick to while enumerating the explosion of the aggregate - int arraySize = 0; - if (isReflectionGranularity(topNode->getLeft()->getType()) && topNode->getLeft()->isArray()) { - if (topNode->getOp() == EOpIndexDirect) - arraySize = topNode->getRight()->getAsConstantUnion()->getConstArray()[0].getIConst() + 1; - } - - // Put the dereference chain together, forward - TString baseName; - if (! anonymous) { - if (block) - baseName = base->getType().getTypeName(); - else - baseName = base->getName(); - } - blowUpActiveAggregate(base->getType(), baseName, derefs, derefs.begin(), offset, blockIndex, arraySize); - } - - int addBlockName(const TString& name, const TType& type, int size) - { - int blockIndex; - TReflection::TNameToIndex::const_iterator it = reflection.nameToIndex.find(name); - if (reflection.nameToIndex.find(name) == reflection.nameToIndex.end()) { - blockIndex = (int)reflection.indexToUniformBlock.size(); - reflection.nameToIndex[name] = blockIndex; - reflection.indexToUniformBlock.push_back(TObjectReflection(name, type, -1, -1, size, -1)); - } else - blockIndex = it->second; - - return blockIndex; - } - - // Are we at a level in a dereference chain at which individual active uniform queries are made? - bool isReflectionGranularity(const TType& type) - { - return type.getBasicType() != EbtBlock && type.getBasicType() != EbtStruct; - } - - // For a binary operation indexing into an aggregate, chase down the base of the aggregate. - // Return 0 if the topology does not fit this situation. - TIntermSymbol* findBase(const TIntermBinary* node) - { - TIntermSymbol *base = node->getLeft()->getAsSymbolNode(); - if (base) - return base; - TIntermBinary* left = node->getLeft()->getAsBinaryNode(); - if (! left) - return nullptr; - - return findBase(left); - } - - // - // Translate a glslang sampler type into the GL API #define number. - // - int mapSamplerToGlType(TSampler sampler) - { - if (! sampler.image) { - // a sampler... - switch (sampler.type) { - case EbtFloat: - switch ((int)sampler.dim) { - case Esd1D: - switch ((int)sampler.shadow) { - case false: return sampler.arrayed ? GL_SAMPLER_1D_ARRAY : GL_SAMPLER_1D; - case true: return sampler.arrayed ? GL_SAMPLER_1D_ARRAY_SHADOW : GL_SAMPLER_1D_SHADOW; - } - case Esd2D: - switch ((int)sampler.ms) { - case false: - switch ((int)sampler.shadow) { - case false: return sampler.arrayed ? GL_SAMPLER_2D_ARRAY : GL_SAMPLER_2D; - case true: return sampler.arrayed ? GL_SAMPLER_2D_ARRAY_SHADOW : GL_SAMPLER_2D_SHADOW; - } - case true: return sampler.arrayed ? GL_SAMPLER_2D_MULTISAMPLE_ARRAY : GL_SAMPLER_2D_MULTISAMPLE; - } - case Esd3D: - return GL_SAMPLER_3D; - case EsdCube: - switch ((int)sampler.shadow) { - case false: return sampler.arrayed ? GL_SAMPLER_CUBE_MAP_ARRAY : GL_SAMPLER_CUBE; - case true: return sampler.arrayed ? GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW : GL_SAMPLER_CUBE_SHADOW; - } - case EsdRect: - return sampler.shadow ? GL_SAMPLER_2D_RECT_SHADOW : GL_SAMPLER_2D_RECT; - case EsdBuffer: - return GL_SAMPLER_BUFFER; - } - case EbtInt: - switch ((int)sampler.dim) { - case Esd1D: - return sampler.arrayed ? GL_INT_SAMPLER_1D_ARRAY : GL_INT_SAMPLER_1D; - case Esd2D: - switch ((int)sampler.ms) { - case false: return sampler.arrayed ? GL_INT_SAMPLER_2D_ARRAY : GL_INT_SAMPLER_2D; - case true: return sampler.arrayed ? GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY - : GL_INT_SAMPLER_2D_MULTISAMPLE; - } - case Esd3D: - return GL_INT_SAMPLER_3D; - case EsdCube: - return sampler.arrayed ? GL_INT_SAMPLER_CUBE_MAP_ARRAY : GL_INT_SAMPLER_CUBE; - case EsdRect: - return GL_INT_SAMPLER_2D_RECT; - case EsdBuffer: - return GL_INT_SAMPLER_BUFFER; - } - case EbtUint: - switch ((int)sampler.dim) { - case Esd1D: - return sampler.arrayed ? GL_UNSIGNED_INT_SAMPLER_1D_ARRAY : GL_UNSIGNED_INT_SAMPLER_1D; - case Esd2D: - switch ((int)sampler.ms) { - case false: return sampler.arrayed ? GL_UNSIGNED_INT_SAMPLER_2D_ARRAY : GL_UNSIGNED_INT_SAMPLER_2D; - case true: return sampler.arrayed ? GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY - : GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE; - } - case Esd3D: - return GL_UNSIGNED_INT_SAMPLER_3D; - case EsdCube: - return sampler.arrayed ? GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY : GL_UNSIGNED_INT_SAMPLER_CUBE; - case EsdRect: - return GL_UNSIGNED_INT_SAMPLER_2D_RECT; - case EsdBuffer: - return GL_UNSIGNED_INT_SAMPLER_BUFFER; - } - default: - return 0; - } - } else { - // an image... - switch (sampler.type) { - case EbtFloat: - switch ((int)sampler.dim) { - case Esd1D: - return sampler.arrayed ? GL_IMAGE_1D_ARRAY : GL_IMAGE_1D; - case Esd2D: - switch ((int)sampler.ms) { - case false: return sampler.arrayed ? GL_IMAGE_2D_ARRAY : GL_IMAGE_2D; - case true: return sampler.arrayed ? GL_IMAGE_2D_MULTISAMPLE_ARRAY : GL_IMAGE_2D_MULTISAMPLE; - } - case Esd3D: - return GL_IMAGE_3D; - case EsdCube: - return sampler.arrayed ? GL_IMAGE_CUBE_MAP_ARRAY : GL_IMAGE_CUBE; - case EsdRect: - return GL_IMAGE_2D_RECT; - case EsdBuffer: - return GL_IMAGE_BUFFER; - } - case EbtInt: - switch ((int)sampler.dim) { - case Esd1D: - return sampler.arrayed ? GL_INT_IMAGE_1D_ARRAY : GL_INT_IMAGE_1D; - case Esd2D: - switch ((int)sampler.ms) { - case false: return sampler.arrayed ? GL_INT_IMAGE_2D_ARRAY : GL_INT_IMAGE_2D; - case true: return sampler.arrayed ? GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY : GL_INT_IMAGE_2D_MULTISAMPLE; - } - case Esd3D: - return GL_INT_IMAGE_3D; - case EsdCube: - return sampler.arrayed ? GL_INT_IMAGE_CUBE_MAP_ARRAY : GL_INT_IMAGE_CUBE; - case EsdRect: - return GL_INT_IMAGE_2D_RECT; - case EsdBuffer: - return GL_INT_IMAGE_BUFFER; - } - case EbtUint: - switch ((int)sampler.dim) { - case Esd1D: - return sampler.arrayed ? GL_UNSIGNED_INT_IMAGE_1D_ARRAY : GL_UNSIGNED_INT_IMAGE_1D; - case Esd2D: - switch ((int)sampler.ms) { - case false: return sampler.arrayed ? GL_UNSIGNED_INT_IMAGE_2D_ARRAY : GL_UNSIGNED_INT_IMAGE_2D; - case true: return sampler.arrayed ? GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY - : GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE; - } - case Esd3D: - return GL_UNSIGNED_INT_IMAGE_3D; - case EsdCube: - return sampler.arrayed ? GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY : GL_UNSIGNED_INT_IMAGE_CUBE; - case EsdRect: - return GL_UNSIGNED_INT_IMAGE_2D_RECT; - case EsdBuffer: - return GL_UNSIGNED_INT_IMAGE_BUFFER; - } - default: - return 0; - } - } - } - - // - // Translate a glslang type into the GL API #define number. - // Ignores arrayness. - // - int mapToGlType(const TType& type) - { - switch (type.getBasicType()) { - case EbtSampler: - return mapSamplerToGlType(type.getSampler()); - case EbtStruct: - case EbtBlock: - case EbtVoid: - return 0; - default: - break; - } - - if (type.isVector()) { - int offset = type.getVectorSize() - 2; - switch (type.getBasicType()) { - case EbtFloat: return GL_FLOAT_VEC2 + offset; - case EbtDouble: return GL_DOUBLE_VEC2 + offset; -#ifdef AMD_EXTENSIONS - case EbtFloat16: return GL_FLOAT16_VEC2_NV + offset; -#endif - case EbtInt: return GL_INT_VEC2 + offset; - case EbtUint: return GL_UNSIGNED_INT_VEC2 + offset; - case EbtInt64: return GL_INT64_ARB + offset; - case EbtUint64: return GL_UNSIGNED_INT64_ARB + offset; - case EbtBool: return GL_BOOL_VEC2 + offset; - case EbtAtomicUint: return GL_UNSIGNED_INT_ATOMIC_COUNTER + offset; - default: return 0; - } - } - if (type.isMatrix()) { - switch (type.getBasicType()) { - case EbtFloat: - switch (type.getMatrixCols()) { - case 2: - switch (type.getMatrixRows()) { - case 2: return GL_FLOAT_MAT2; - case 3: return GL_FLOAT_MAT2x3; - case 4: return GL_FLOAT_MAT2x4; - default: return 0; - } - case 3: - switch (type.getMatrixRows()) { - case 2: return GL_FLOAT_MAT3x2; - case 3: return GL_FLOAT_MAT3; - case 4: return GL_FLOAT_MAT3x4; - default: return 0; - } - case 4: - switch (type.getMatrixRows()) { - case 2: return GL_FLOAT_MAT4x2; - case 3: return GL_FLOAT_MAT4x3; - case 4: return GL_FLOAT_MAT4; - default: return 0; - } - } - case EbtDouble: - switch (type.getMatrixCols()) { - case 2: - switch (type.getMatrixRows()) { - case 2: return GL_DOUBLE_MAT2; - case 3: return GL_DOUBLE_MAT2x3; - case 4: return GL_DOUBLE_MAT2x4; - default: return 0; - } - case 3: - switch (type.getMatrixRows()) { - case 2: return GL_DOUBLE_MAT3x2; - case 3: return GL_DOUBLE_MAT3; - case 4: return GL_DOUBLE_MAT3x4; - default: return 0; - } - case 4: - switch (type.getMatrixRows()) { - case 2: return GL_DOUBLE_MAT4x2; - case 3: return GL_DOUBLE_MAT4x3; - case 4: return GL_DOUBLE_MAT4; - default: return 0; - } - } -#ifdef AMD_EXTENSIONS - case EbtFloat16: - switch (type.getMatrixCols()) { - case 2: - switch (type.getMatrixRows()) { - case 2: return GL_FLOAT16_MAT2_AMD; - case 3: return GL_FLOAT16_MAT2x3_AMD; - case 4: return GL_FLOAT16_MAT2x4_AMD; - default: return 0; - } - case 3: - switch (type.getMatrixRows()) { - case 2: return GL_FLOAT16_MAT3x2_AMD; - case 3: return GL_FLOAT16_MAT3_AMD; - case 4: return GL_FLOAT16_MAT3x4_AMD; - default: return 0; - } - case 4: - switch (type.getMatrixRows()) { - case 2: return GL_FLOAT16_MAT4x2_AMD; - case 3: return GL_FLOAT16_MAT4x3_AMD; - case 4: return GL_FLOAT16_MAT4_AMD; - default: return 0; - } - } -#endif - default: - return 0; - } - } - if (type.getVectorSize() == 1) { - switch (type.getBasicType()) { - case EbtFloat: return GL_FLOAT; - case EbtDouble: return GL_DOUBLE; -#ifdef AMD_EXTENSIONS - case EbtFloat16: return GL_FLOAT16_NV; -#endif - case EbtInt: return GL_INT; - case EbtUint: return GL_UNSIGNED_INT; - case EbtInt64: return GL_INT64_ARB; - case EbtUint64: return GL_UNSIGNED_INT64_ARB; - case EbtBool: return GL_BOOL; - case EbtAtomicUint: return GL_UNSIGNED_INT_ATOMIC_COUNTER; - default: return 0; - } - } - - return 0; - } - - int mapToGlArraySize(const TType& type) - { - return type.isArray() ? type.getOuterArraySize() : 1; - } - - TReflection& reflection; - std::set processedDerefs; - -protected: - TReflectionTraverser(TReflectionTraverser&); - TReflectionTraverser& operator=(TReflectionTraverser&); -}; - -// -// Implement the traversal functions of interest. -// - -// To catch dereferenced aggregates that must be reflected. -// This catches them at the highest level possible in the tree. -bool TReflectionTraverser::visitBinary(TVisit /* visit */, TIntermBinary* node) -{ - switch (node->getOp()) { - case EOpIndexDirect: - case EOpIndexIndirect: - case EOpIndexDirectStruct: - addDereferencedUniform(node); - break; - default: - break; - } - - // still need to visit everything below, which could contain sub-expressions - // containing different uniforms - return true; -} - -// To reflect non-dereferenced objects. -void TReflectionTraverser::visitSymbol(TIntermSymbol* base) -{ - if (base->getQualifier().storage == EvqUniform) - addUniform(*base); - - if (intermediate.getStage() == EShLangVertex && base->getQualifier().isPipeInput()) - addAttribute(*base); -} - -// -// Implement TReflection methods. -// - -// Track any required attribute reflection, such as compute shader numthreads. -// -void TReflection::buildAttributeReflection(EShLanguage stage, const TIntermediate& intermediate) -{ - if (stage == EShLangCompute) { - // Remember thread dimensions - for (int dim=0; dim<3; ++dim) - localSize[dim] = intermediate.getLocalSize(dim); - } -} - -// build counter block index associations for buffers -void TReflection::buildCounterIndices() -{ - // search for ones that have counters - for (int i = 0; i < int(indexToUniformBlock.size()); ++i) { - const TString counterName(indexToUniformBlock[i].name + "@count"); - const int index = getIndex(counterName); - - if (index >= 0) - indexToUniformBlock[i].counterIndex = index; - } -} - -// Merge live symbols from 'intermediate' into the existing reflection database. -// -// Returns false if the input is too malformed to do this. -bool TReflection::addStage(EShLanguage stage, const TIntermediate& intermediate) -{ - if (intermediate.getTreeRoot() == nullptr || - intermediate.getNumEntryPoints() != 1 || - intermediate.isRecursive()) - return false; - - buildAttributeReflection(stage, intermediate); - - TReflectionTraverser it(intermediate, *this); - - // put the entry point on the list of functions to process - it.pushFunction(intermediate.getEntryPointMangledName().c_str()); - - // process all the functions - while (! it.functions.empty()) { - TIntermNode* function = it.functions.back(); - it.functions.pop_back(); - function->traverse(&it); - } - - buildCounterIndices(); - - return true; -} - -void TReflection::dump() -{ - printf("Uniform reflection:\n"); - for (size_t i = 0; i < indexToUniform.size(); ++i) - indexToUniform[i].dump(); - printf("\n"); - - printf("Uniform block reflection:\n"); - for (size_t i = 0; i < indexToUniformBlock.size(); ++i) - indexToUniformBlock[i].dump(); - printf("\n"); - - printf("Vertex attribute reflection:\n"); - for (size_t i = 0; i < indexToAttribute.size(); ++i) - indexToAttribute[i].dump(); - printf("\n"); - - if (getLocalSize(0) > 1) { - static const char* axis[] = { "X", "Y", "Z" }; - - for (int dim=0; dim<3; ++dim) - if (getLocalSize(dim) > 1) - printf("Local size %s: %d\n", axis[dim], getLocalSize(dim)); - - printf("\n"); - } - - // printf("Live names\n"); - // for (TNameToIndex::const_iterator it = nameToIndex.begin(); it != nameToIndex.end(); ++it) - // printf("%s: %d\n", it->first.c_str(), it->second); - // printf("\n"); -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/reflection.h b/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/reflection.h deleted file mode 100644 index fedfbe8d..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/MachineIndependent/reflection.h +++ /dev/null @@ -1,177 +0,0 @@ -// -// Copyright (C) 2013-2016 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#ifndef _REFLECTION_INCLUDED -#define _REFLECTION_INCLUDED - -#include "../Public/ShaderLang.h" -#include "../Include/Types.h" - -#include -#include - -// -// A reflection database and its interface, consistent with the OpenGL API reflection queries. -// - -namespace glslang { - -class TIntermediate; -class TIntermAggregate; -class TReflectionTraverser; - -// Data needed for just a single object at the granularity exchanged by the reflection API -class TObjectReflection { -public: - TObjectReflection(const TString& pName, const TType& pType, int pOffset, int pGLDefineType, int pSize, int pIndex) : - name(pName), offset(pOffset), - glDefineType(pGLDefineType), size(pSize), index(pIndex), counterIndex(-1), type(pType.clone()) { } - - const TType* const getType() const { return type; } - int getBinding() const - { - if (type == nullptr || !type->getQualifier().hasBinding()) - return -1; - return type->getQualifier().layoutBinding; - } - void dump() const - { - printf("%s: offset %d, type %x, size %d, index %d, binding %d", - name.c_str(), offset, glDefineType, size, index, getBinding() ); - - if (counterIndex != -1) - printf(", counter %d", counterIndex); - - printf("\n"); - } - static TObjectReflection badReflection() { return TObjectReflection(); } - - TString name; - int offset; - int glDefineType; - int size; // data size in bytes for a block, array size for a (non-block) object that's an array - int index; - int counterIndex; - -protected: - TObjectReflection() : offset(-1), glDefineType(-1), size(-1), index(-1), type(nullptr) { } - - const TType* type; -}; - -// The full reflection database -class TReflection { -public: - TReflection() : badReflection(TObjectReflection::badReflection()) - { - for (int dim=0; dim<3; ++dim) - localSize[dim] = 0; - } - - virtual ~TReflection() {} - - // grow the reflection stage by stage - bool addStage(EShLanguage, const TIntermediate&); - - // for mapping a uniform index to a uniform object's description - int getNumUniforms() { return (int)indexToUniform.size(); } - const TObjectReflection& getUniform(int i) const - { - if (i >= 0 && i < (int)indexToUniform.size()) - return indexToUniform[i]; - else - return badReflection; - } - - // for mapping a block index to the block's description - int getNumUniformBlocks() const { return (int)indexToUniformBlock.size(); } - const TObjectReflection& getUniformBlock(int i) const - { - if (i >= 0 && i < (int)indexToUniformBlock.size()) - return indexToUniformBlock[i]; - else - return badReflection; - } - - // for mapping an attribute index to the attribute's description - int getNumAttributes() { return (int)indexToAttribute.size(); } - const TObjectReflection& getAttribute(int i) const - { - if (i >= 0 && i < (int)indexToAttribute.size()) - return indexToAttribute[i]; - else - return badReflection; - } - - // for mapping any name to its index (block names, uniform names and attribute names) - int getIndex(const char* name) const - { - TNameToIndex::const_iterator it = nameToIndex.find(name); - if (it == nameToIndex.end()) - return -1; - else - return it->second; - } - - // see getIndex(const char*) - int getIndex(const TString& name) const { return getIndex(name.c_str()); } - - // Thread local size - unsigned getLocalSize(int dim) const { return dim <= 2 ? localSize[dim] : 0; } - - void dump(); - -protected: - friend class glslang::TReflectionTraverser; - - void buildCounterIndices(); - void buildAttributeReflection(EShLanguage, const TIntermediate&); - - // Need a TString hash: typedef std::unordered_map TNameToIndex; - typedef std::map TNameToIndex; - typedef std::vector TMapIndexToReflection; - - TObjectReflection badReflection; // return for queries of -1 or generally out of range; has expected descriptions with in it for this - TNameToIndex nameToIndex; // maps names to indexes; can hold all types of data: uniform/buffer and which function names have been processed - TMapIndexToReflection indexToUniform; - TMapIndexToReflection indexToUniformBlock; - TMapIndexToReflection indexToAttribute; - - unsigned int localSize[3]; -}; - -} // end namespace glslang - -#endif // _REFLECTION_INCLUDED diff --git a/love/src/jni/love/src/libraries/glslang/glslang/OSDependent/Unix/ossource.cpp b/love/src/jni/love/src/libraries/glslang/glslang/OSDependent/Unix/ossource.cpp deleted file mode 100644 index f59bbceb..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/OSDependent/Unix/ossource.cpp +++ /dev/null @@ -1,204 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -// -// This file contains the Linux-specific functions -// -#include "../osinclude.h" -#include "../../../OGLCompilersDLL/InitializeDll.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace glslang { - -// -// Thread cleanup -// - -// -// Wrapper for Linux call to DetachThread. This is required as pthread_cleanup_push() expects -// the cleanup routine to return void. -// -static void DetachThreadLinux(void *) -{ - DetachThread(); -} - -// -// Registers cleanup handler, sets cancel type and state, and executes the thread specific -// cleanup handler. This function will be called in the Standalone.cpp for regression -// testing. When OpenGL applications are run with the driver code, Linux OS does the -// thread cleanup. -// -void OS_CleanupThreadData(void) -{ -#ifdef __ANDROID__ - DetachThreadLinux(NULL); -#else - int old_cancel_state, old_cancel_type; - void *cleanupArg = NULL; - - // - // Set thread cancel state and push cleanup handler. - // - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &old_cancel_state); - pthread_cleanup_push(DetachThreadLinux, (void *) cleanupArg); - - // - // Put the thread in deferred cancellation mode. - // - pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &old_cancel_type); - - // - // Pop cleanup handler and execute it prior to unregistering the cleanup handler. - // - pthread_cleanup_pop(1); - - // - // Restore the thread's previous cancellation mode. - // - pthread_setcanceltype(old_cancel_state, NULL); -#endif -} - -// -// Thread Local Storage Operations -// -inline OS_TLSIndex PthreadKeyToTLSIndex(pthread_key_t key) -{ - return (OS_TLSIndex)((uintptr_t)key + 1); -} - -inline pthread_key_t TLSIndexToPthreadKey(OS_TLSIndex nIndex) -{ - return (pthread_key_t)((uintptr_t)nIndex - 1); -} - -OS_TLSIndex OS_AllocTLSIndex() -{ - pthread_key_t pPoolIndex; - - // - // Create global pool key. - // - if ((pthread_key_create(&pPoolIndex, NULL)) != 0) { - assert(0 && "OS_AllocTLSIndex(): Unable to allocate Thread Local Storage"); - return OS_INVALID_TLS_INDEX; - } - else - return PthreadKeyToTLSIndex(pPoolIndex); -} - -bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue) -{ - if (nIndex == OS_INVALID_TLS_INDEX) { - assert(0 && "OS_SetTLSValue(): Invalid TLS Index"); - return false; - } - - if (pthread_setspecific(TLSIndexToPthreadKey(nIndex), lpvValue) == 0) - return true; - else - return false; -} - -void* OS_GetTLSValue(OS_TLSIndex nIndex) -{ - // - // This function should return 0 if nIndex is invalid. - // - assert(nIndex != OS_INVALID_TLS_INDEX); - return pthread_getspecific(TLSIndexToPthreadKey(nIndex)); -} - -bool OS_FreeTLSIndex(OS_TLSIndex nIndex) -{ - if (nIndex == OS_INVALID_TLS_INDEX) { - assert(0 && "OS_SetTLSValue(): Invalid TLS Index"); - return false; - } - - // - // Delete the global pool key. - // - if (pthread_key_delete(TLSIndexToPthreadKey(nIndex)) == 0) - return true; - else - return false; -} - -namespace { - pthread_mutex_t gMutex; -} - -void InitGlobalLock() -{ - pthread_mutexattr_t mutexattr; - pthread_mutexattr_init(&mutexattr); - pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_RECURSIVE); - pthread_mutex_init(&gMutex, &mutexattr); -} - -void GetGlobalLock() -{ - pthread_mutex_lock(&gMutex); -} - -void ReleaseGlobalLock() -{ - pthread_mutex_unlock(&gMutex); -} - -// #define DUMP_COUNTERS - -void OS_DumpMemoryCounters() -{ -#ifdef DUMP_COUNTERS - struct rusage usage; - - if (getrusage(RUSAGE_SELF, &usage) == 0) - printf("Working set size: %ld\n", usage.ru_maxrss * 1024); -#else - printf("Recompile with DUMP_COUNTERS defined to see counters.\n"); -#endif -} - -} // end namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/OSDependent/Windows/main.cpp b/love/src/jni/love/src/libraries/glslang/glslang/OSDependent/Windows/main.cpp deleted file mode 100644 index 0217e0a6..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/OSDependent/Windows/main.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#include "glslang/OGLCompilersDLL/InitializeDll.h" - -#define STRICT -#define VC_EXTRALEAN 1 -#include -#include - -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - switch (fdwReason) - { - case DLL_PROCESS_ATTACH: - - if (! glslang::InitProcess()) - return FALSE; - break; - case DLL_THREAD_ATTACH: - - if (! glslang::InitThread()) - return FALSE; - break; - - case DLL_THREAD_DETACH: - - if (! glslang::DetachThread()) - return FALSE; - break; - - case DLL_PROCESS_DETACH: - - glslang::DetachProcess(); - break; - - default: - assert(0 && "DllMain(): Reason for calling DLL Main is unknown"); - return FALSE; - } - - return TRUE; -} diff --git a/love/src/jni/love/src/libraries/glslang/glslang/OSDependent/Windows/ossource.cpp b/love/src/jni/love/src/libraries/glslang/glslang/OSDependent/Windows/ossource.cpp deleted file mode 100644 index 870840c5..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/OSDependent/Windows/ossource.cpp +++ /dev/null @@ -1,147 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#include "../osinclude.h" - -#define STRICT -#define VC_EXTRALEAN 1 -#include -#include -#include -#include -#include -#include - -// -// This file contains the Window-OS-specific functions -// - -#if !(defined(_WIN32) || defined(_WIN64)) -#error Trying to build a windows specific file in a non windows build. -#endif - -namespace glslang { - -inline OS_TLSIndex ToGenericTLSIndex (DWORD handle) -{ - return (OS_TLSIndex)((uintptr_t)handle + 1); -} - -inline DWORD ToNativeTLSIndex (OS_TLSIndex nIndex) -{ - return (DWORD)((uintptr_t)nIndex - 1); -} - -// -// Thread Local Storage Operations -// -OS_TLSIndex OS_AllocTLSIndex() -{ - DWORD dwIndex = TlsAlloc(); - if (dwIndex == TLS_OUT_OF_INDEXES) { - assert(0 && "OS_AllocTLSIndex(): Unable to allocate Thread Local Storage"); - return OS_INVALID_TLS_INDEX; - } - - return ToGenericTLSIndex(dwIndex); -} - -bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue) -{ - if (nIndex == OS_INVALID_TLS_INDEX) { - assert(0 && "OS_SetTLSValue(): Invalid TLS Index"); - return false; - } - - if (TlsSetValue(ToNativeTLSIndex(nIndex), lpvValue)) - return true; - else - return false; -} - -void* OS_GetTLSValue(OS_TLSIndex nIndex) -{ - assert(nIndex != OS_INVALID_TLS_INDEX); - return TlsGetValue(ToNativeTLSIndex(nIndex)); -} - -bool OS_FreeTLSIndex(OS_TLSIndex nIndex) -{ - if (nIndex == OS_INVALID_TLS_INDEX) { - assert(0 && "OS_SetTLSValue(): Invalid TLS Index"); - return false; - } - - if (TlsFree(ToNativeTLSIndex(nIndex))) - return true; - else - return false; -} - -HANDLE GlobalLock; - -void InitGlobalLock() -{ - GlobalLock = CreateMutex(0, false, 0); -} - -void GetGlobalLock() -{ - WaitForSingleObject(GlobalLock, INFINITE); -} - -void ReleaseGlobalLock() -{ - ReleaseMutex(GlobalLock); -} - -unsigned int __stdcall EnterGenericThread (void* entry) -{ - return ((TThreadEntrypoint)entry)(0); -} - -//#define DUMP_COUNTERS - -void OS_DumpMemoryCounters() -{ -#ifdef DUMP_COUNTERS - PROCESS_MEMORY_COUNTERS counters; - GetProcessMemoryInfo(GetCurrentProcess(), &counters, sizeof(counters)); - printf("Working set size: %d\n", counters.WorkingSetSize); -#else - printf("Recompile with DUMP_COUNTERS defined to see counters.\n"); -#endif -} - -} // namespace glslang diff --git a/love/src/jni/love/src/libraries/glslang/glslang/OSDependent/osinclude.h b/love/src/jni/love/src/libraries/glslang/glslang/OSDependent/osinclude.h deleted file mode 100644 index 218abe4f..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/OSDependent/osinclude.h +++ /dev/null @@ -1,63 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// - -#ifndef __OSINCLUDE_H -#define __OSINCLUDE_H - -namespace glslang { - -// -// Thread Local Storage Operations -// -typedef void* OS_TLSIndex; -#define OS_INVALID_TLS_INDEX ((void*)0) - -OS_TLSIndex OS_AllocTLSIndex(); -bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue); -bool OS_FreeTLSIndex(OS_TLSIndex nIndex); -void* OS_GetTLSValue(OS_TLSIndex nIndex); - -void InitGlobalLock(); -void GetGlobalLock(); -void ReleaseGlobalLock(); - -typedef unsigned int (*TThreadEntrypoint)(void*); - -void OS_CleanupThreadData(void); - -void OS_DumpMemoryCounters(); - -} // end namespace glslang - -#endif // __OSINCLUDE_H diff --git a/love/src/jni/love/src/libraries/glslang/glslang/Public/ShaderLang.h b/love/src/jni/love/src/libraries/glslang/glslang/Public/ShaderLang.h deleted file mode 100644 index 35d84636..00000000 --- a/love/src/jni/love/src/libraries/glslang/glslang/Public/ShaderLang.h +++ /dev/null @@ -1,682 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2013-2016 LunarG, Inc. -// -// 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 3Dlabs Inc. Ltd. 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 THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS 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. -// -#ifndef _COMPILER_INTERFACE_INCLUDED_ -#define _COMPILER_INTERFACE_INCLUDED_ - -#include "../Include/ResourceLimits.h" -#include "../MachineIndependent/Versions.h" - -#include -#include - -#ifdef _WIN32 -#define C_DECL __cdecl -//#ifdef SH_EXPORTING -// #define SH_IMPORT_EXPORT __declspec(dllexport) -//#else -// #define SH_IMPORT_EXPORT __declspec(dllimport) -//#endif -#define SH_IMPORT_EXPORT -#else -#define SH_IMPORT_EXPORT -#ifndef __fastcall -#define __fastcall -#endif -#define C_DECL -#endif - -// -// This is the platform independent interface between an OGL driver -// and the shading language compiler/linker. -// - -#ifdef __cplusplus - extern "C" { -#endif - -// -// Call before doing any other compiler/linker operations. -// -// (Call once per process, not once per thread.) -// -SH_IMPORT_EXPORT int ShInitialize(); - -// -// Call this at process shutdown to clean up memory. -// -SH_IMPORT_EXPORT int __fastcall ShFinalize(); - -// -// Types of languages the compiler can consume. -// -typedef enum { - EShLangVertex, - EShLangTessControl, - EShLangTessEvaluation, - EShLangGeometry, - EShLangFragment, - EShLangCompute, - EShLangCount, -} EShLanguage; // would be better as stage, but this is ancient now - -typedef enum { - EShLangVertexMask = (1 << EShLangVertex), - EShLangTessControlMask = (1 << EShLangTessControl), - EShLangTessEvaluationMask = (1 << EShLangTessEvaluation), - EShLangGeometryMask = (1 << EShLangGeometry), - EShLangFragmentMask = (1 << EShLangFragment), - EShLangComputeMask = (1 << EShLangCompute), -} EShLanguageMask; - -namespace glslang { - -class TType; - -typedef enum { - EShSourceNone, - EShSourceGlsl, - EShSourceHlsl, -} EShSource; // if EShLanguage were EShStage, this could be EShLanguage instead - -typedef enum { - EShClientNone, - EShClientVulkan, - EShClientOpenGL, -} EShClient; - -typedef enum { - EShTargetNone, - EshTargetSpv, -} EShTargetLanguage; - -struct TInputLanguage { - EShSource languageFamily; // redundant information with other input, this one overrides when not EShSourceNone - EShLanguage stage; // redundant information with other input, this one overrides when not EShSourceNone - EShClient dialect; - int dialectVersion; // version of client's language definition, not the client (when not EShClientNone) -}; - -struct TClient { - EShClient client; - int version; // version of client itself (not the client's input dialect) -}; - -struct TTarget { - EShTargetLanguage language; - unsigned int version; // the version to target, if SPIR-V, defined by "word 1" of the SPIR-V binary header -}; - -// All source/client/target versions and settings. -// Can override previous methods of setting, when items are set here. -// Expected to grow, as more are added, rather than growing parameter lists. -struct TEnvironment { - TInputLanguage input; // definition of the input language - TClient client; // what client is the overall compilation being done for? - TTarget target; // what to generate -}; - -const char* StageName(EShLanguage); - -} // end namespace glslang - -// -// Types of output the linker will create. -// -typedef enum { - EShExVertexFragment, - EShExFragment -} EShExecutable; - -// -// Optimization level for the compiler. -// -typedef enum { - EShOptNoGeneration, - EShOptNone, - EShOptSimple, // Optimizations that can be done quickly - EShOptFull, // Optimizations that will take more time -} EShOptimizationLevel; - -// -// Texture and Sampler transformation mode. -// -typedef enum { - EShTexSampTransKeep, // keep textures and samplers as is (default) - EShTexSampTransUpgradeTextureRemoveSampler, // change texture w/o embeded sampler into sampled texture and throw away all samplers -} EShTextureSamplerTransformMode; - -// -// Message choices for what errors and warnings are given. -// -enum EShMessages { - EShMsgDefault = 0, // default is to give all required errors and extra warnings - EShMsgRelaxedErrors = (1 << 0), // be liberal in accepting input - EShMsgSuppressWarnings = (1 << 1), // suppress all warnings, except those required by the specification - EShMsgAST = (1 << 2), // print the AST intermediate representation - EShMsgSpvRules = (1 << 3), // issue messages for SPIR-V generation - EShMsgVulkanRules = (1 << 4), // issue messages for Vulkan-requirements of GLSL for SPIR-V - EShMsgOnlyPreprocessor = (1 << 5), // only print out errors produced by the preprocessor - EShMsgReadHlsl = (1 << 6), // use HLSL parsing rules and semantics - EShMsgCascadingErrors = (1 << 7), // get cascading errors; risks error-recovery issues, instead of an early exit - EShMsgKeepUncalled = (1 << 8), // for testing, don't eliminate uncalled functions - EShMsgHlslOffsets = (1 << 9), // allow block offsets to follow HLSL rules instead of GLSL rules - EShMsgDebugInfo = (1 << 10), // save debug information -}; - -// -// Build a table for bindings. This can be used for locating -// attributes, uniforms, globals, etc., as needed. -// -typedef struct { - const char* name; - int binding; -} ShBinding; - -typedef struct { - int numBindings; - ShBinding* bindings; // array of bindings -} ShBindingTable; - -// -// ShHandle held by but opaque to the driver. It is allocated, -// managed, and de-allocated by the compiler/linker. It's contents -// are defined by and used by the compiler and linker. For example, -// symbol table information and object code passed from the compiler -// to the linker can be stored where ShHandle points. -// -// If handle creation fails, 0 will be returned. -// -typedef void* ShHandle; - -// -// Driver calls these to create and destroy compiler/linker -// objects. -// -SH_IMPORT_EXPORT ShHandle ShConstructCompiler(const EShLanguage, int debugOptions); // one per shader -SH_IMPORT_EXPORT ShHandle ShConstructLinker(const EShExecutable, int debugOptions); // one per shader pair -SH_IMPORT_EXPORT ShHandle ShConstructUniformMap(); // one per uniform namespace (currently entire program object) -SH_IMPORT_EXPORT void ShDestruct(ShHandle); - -// -// The return value of ShCompile is boolean, non-zero indicating -// success. -// -// The info-log should be written by ShCompile into -// ShHandle, so it can answer future queries. -// -SH_IMPORT_EXPORT int ShCompile( - const ShHandle, - const char* const shaderStrings[], - const int numStrings, - const int* lengths, - const EShOptimizationLevel, - const TBuiltInResource *resources, - int debugOptions, - int defaultVersion = 110, // use 100 for ES environment, overridden by #version in shader - bool forwardCompatible = false, // give errors for use of deprecated features - EShMessages messages = EShMsgDefault // warnings and errors - ); - -SH_IMPORT_EXPORT int ShLinkExt( - const ShHandle, // linker object - const ShHandle h[], // compiler objects to link together - const int numHandles); - -// -// ShSetEncrpytionMethod is a place-holder for specifying -// how source code is encrypted. -// -SH_IMPORT_EXPORT void ShSetEncryptionMethod(ShHandle); - -// -// All the following return 0 if the information is not -// available in the object passed down, or the object is bad. -// -SH_IMPORT_EXPORT const char* ShGetInfoLog(const ShHandle); -SH_IMPORT_EXPORT const void* ShGetExecutable(const ShHandle); -SH_IMPORT_EXPORT int ShSetVirtualAttributeBindings(const ShHandle, const ShBindingTable*); // to detect user aliasing -SH_IMPORT_EXPORT int ShSetFixedAttributeBindings(const ShHandle, const ShBindingTable*); // to force any physical mappings -// -// Tell the linker to never assign a vertex attribute to this list of physical attributes -// -SH_IMPORT_EXPORT int ShExcludeAttributes(const ShHandle, int *attributes, int count); - -// -// Returns the location ID of the named uniform. -// Returns -1 if error. -// -SH_IMPORT_EXPORT int ShGetUniformLocation(const ShHandle uniformMap, const char* name); - -#ifdef __cplusplus - } // end extern "C" -#endif - -//////////////////////////////////////////////////////////////////////////////////////////// -// -// Deferred-Lowering C++ Interface -// ----------------------------------- -// -// Below is a new alternate C++ interface, which deprecates the above -// opaque handle-based interface. -// -// The below is further designed to handle multiple compilation units per stage, where -// the intermediate results, including the parse tree, are preserved until link time, -// rather than the above interface which is designed to have each compilation unit -// lowered at compile time. In the above model, linking occurs on the lowered results, -// whereas in this model intra-stage linking can occur at the parse tree -// (treeRoot in TIntermediate) level, and then a full stage can be lowered. -// - -#include -#include -#include - -class TCompiler; -class TInfoSink; - -namespace glslang { - -const char* GetEsslVersionString(); -const char* GetGlslVersionString(); -int GetKhronosToolId(); - -class TIntermediate; -class TProgram; -class TPoolAllocator; - -// Call this exactly once per process before using anything else -bool InitializeProcess(); - -// Call once per process to tear down everything -void FinalizeProcess(); - -// Resource type for IO resolver -enum TResourceType { - EResSampler, - EResTexture, - EResImage, - EResUbo, - EResSsbo, - EResUav, - EResCount -}; - -// Make one TShader per shader that you will link into a program. Then provide -// the shader through setStrings() or setStringsWithLengths(), then call parse(), -// then query the info logs. -// Optionally use setPreamble() to set a special shader string that will be -// processed before all others but won't affect the validity of #version. -// -// N.B.: Does not yet support having the same TShader instance being linked into -// multiple programs. -// -// N.B.: Destruct a linked program *before* destructing the shaders linked into it. -// -class TShader { -public: - explicit TShader(EShLanguage); - virtual ~TShader(); - void setStrings(const char* const* s, int n); - void setStringsWithLengths(const char* const* s, const int* l, int n); - void setStringsWithLengthsAndNames( - const char* const* s, const int* l, const char* const* names, int n); - void setPreamble(const char* s) { preamble = s; } - void setEntryPoint(const char* entryPoint); - void setSourceEntryPoint(const char* sourceEntryPointName); - void addProcesses(const std::vector&); - - // IO resolver binding data: see comments in ShaderLang.cpp - void setShiftBinding(TResourceType res, unsigned int base); - void setShiftSamplerBinding(unsigned int base); // DEPRECATED: use setShiftBinding - void setShiftTextureBinding(unsigned int base); // DEPRECATED: use setShiftBinding - void setShiftImageBinding(unsigned int base); // DEPRECATED: use setShiftBinding - void setShiftUboBinding(unsigned int base); // DEPRECATED: use setShiftBinding - void setShiftUavBinding(unsigned int base); // DEPRECATED: use setShiftBinding - void setShiftCbufferBinding(unsigned int base); // synonym for setShiftUboBinding - void setShiftSsboBinding(unsigned int base); // DEPRECATED: use setShiftBinding - void setShiftBindingForSet(TResourceType res, unsigned int base, unsigned int set); - void setResourceSetBinding(const std::vector& base); - void setAutoMapBindings(bool map); - void setAutoMapLocations(bool map); - void setInvertY(bool invert); - void setHlslIoMapping(bool hlslIoMap); - void setFlattenUniformArrays(bool flatten); - void setNoStorageFormat(bool useUnknownFormat); - void setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode); - - // For setting up the environment (initialized in the constructor): - void setEnvInput(EShSource lang, EShLanguage envStage, EShClient client, int version) - { - environment.input.languageFamily = lang; - environment.input.stage = envStage; - environment.input.dialect = client; - environment.input.dialectVersion = version; - } - void setEnvClient(EShClient client, int version) - { - environment.client.client = client; - environment.client.version = version; - } - void setEnvTarget(EShTargetLanguage lang, unsigned int version) - { - environment.target.language = lang; - environment.target.version = version; - } - - // Interface to #include handlers. - // - // To support #include, a client of Glslang does the following: - // 1. Call setStringsWithNames to set the source strings and associated - // names. For example, the names could be the names of the files - // containing the shader sources. - // 2. Call parse with an Includer. - // - // When the Glslang parser encounters an #include directive, it calls - // the Includer's include method with the requested include name - // together with the current string name. The returned IncludeResult - // contains the fully resolved name of the included source, together - // with the source text that should replace the #include directive - // in the source stream. After parsing that source, Glslang will - // release the IncludeResult object. - class Includer { - public: - // An IncludeResult contains the resolved name and content of a source - // inclusion. - struct IncludeResult { - IncludeResult(const std::string& headerName, const char* const headerData, const size_t headerLength, void* userData) : - headerName(headerName), headerData(headerData), headerLength(headerLength), userData(userData) { } - // For a successful inclusion, the fully resolved name of the requested - // include. For example, in a file system-based includer, full resolution - // should convert a relative path name into an absolute path name. - // For a failed inclusion, this is an empty string. - const std::string headerName; - // The content and byte length of the requested inclusion. The - // Includer producing this IncludeResult retains ownership of the - // storage. - // For a failed inclusion, the header - // field points to a string containing error details. - const char* const headerData; - const size_t headerLength; - // Include resolver's context. - void* userData; - protected: - IncludeResult& operator=(const IncludeResult&); - IncludeResult(); - }; - - // For both include methods below: - // - // Resolves an inclusion request by name, current source name, - // and include depth. - // On success, returns an IncludeResult containing the resolved name - // and content of the include. - // On failure, returns a nullptr, or an IncludeResult - // with an empty string for the headerName and error details in the - // header field. - // The Includer retains ownership of the contents - // of the returned IncludeResult value, and those contents must - // remain valid until the releaseInclude method is called on that - // IncludeResult object. - // - // Note "local" vs. "system" is not an "either/or": "local" is an - // extra thing to do over "system". Both might get called, as per - // the C++ specification. - - // For the "system" or <>-style includes; search the "system" paths. - virtual IncludeResult* includeSystem(const char* /*headerName*/, - const char* /*includerName*/, - size_t /*inclusionDepth*/) { return nullptr; } - - // For the "local"-only aspect of a "" include. Should not search in the - // "system" paths, because on returning a failure, the parser will - // call includeSystem() to look in the "system" locations. - virtual IncludeResult* includeLocal(const char* /*headerName*/, - const char* /*includerName*/, - size_t /*inclusionDepth*/) { return nullptr; } - - // Signals that the parser will no longer use the contents of the - // specified IncludeResult. - virtual void releaseInclude(IncludeResult*) = 0; - virtual ~Includer() {} - }; - - // Fail all Includer searches - class ForbidIncluder : public Includer { - public: - virtual void releaseInclude(IncludeResult*) override { } - }; - - bool parse(const TBuiltInResource*, int defaultVersion, EProfile defaultProfile, bool forceDefaultVersionAndProfile, - bool forwardCompatible, EShMessages, Includer&); - - bool parse(const TBuiltInResource* res, int defaultVersion, EProfile defaultProfile, bool forceDefaultVersionAndProfile, - bool forwardCompatible, EShMessages messages) - { - TShader::ForbidIncluder includer; - return parse(res, defaultVersion, defaultProfile, forceDefaultVersionAndProfile, forwardCompatible, messages, includer); - } - - // Equivalent to parse() without a default profile and without forcing defaults. - bool parse(const TBuiltInResource* builtInResources, int defaultVersion, bool forwardCompatible, EShMessages messages) - { - return parse(builtInResources, defaultVersion, ENoProfile, false, forwardCompatible, messages); - } - - bool parse(const TBuiltInResource* builtInResources, int defaultVersion, bool forwardCompatible, EShMessages messages, - Includer& includer) - { - return parse(builtInResources, defaultVersion, ENoProfile, false, forwardCompatible, messages, includer); - } - - bool preprocess(const TBuiltInResource* builtInResources, - int defaultVersion, EProfile defaultProfile, bool forceDefaultVersionAndProfile, - bool forwardCompatible, EShMessages message, std::string* outputString, - Includer& includer); - - const char* getInfoLog(); - const char* getInfoDebugLog(); - EShLanguage getStage() const { return stage; } - TIntermediate* getIntermediate() const { return intermediate; } - -protected: - TPoolAllocator* pool; - EShLanguage stage; - TCompiler* compiler; - TIntermediate* intermediate; - TInfoSink* infoSink; - // strings and lengths follow the standard for glShaderSource: - // strings is an array of numStrings pointers to string data. - // lengths can be null, but if not it is an array of numStrings - // integers containing the length of the associated strings. - // if lengths is null or lengths[n] < 0 the associated strings[n] is - // assumed to be null-terminated. - // stringNames is the optional names for all the strings. If stringNames - // is null, then none of the strings has name. If a certain element in - // stringNames is null, then the corresponding string does not have name. - const char* const* strings; - const int* lengths; - const char* const* stringNames; - const char* preamble; - int numStrings; - - // a function in the source string can be renamed FROM this TO the name given in setEntryPoint. - std::string sourceEntryPointName; - - TEnvironment environment; - - friend class TProgram; - -private: - TShader& operator=(TShader&); -}; - -class TReflection; -class TIoMapper; - -// Allows to customize the binding layout after linking. -// All used uniform variables will invoke at least validateBinding. -// If validateBinding returned true then the other resolveBinding, -// resolveSet, and resolveLocation are invoked to resolve the binding -// and descriptor set index respectively. -// -// Invocations happen in a particular order: -// 1) all shader inputs -// 2) all shader outputs -// 3) all uniforms with binding and set already defined -// 4) all uniforms with binding but no set defined -// 5) all uniforms with set but no binding defined -// 6) all uniforms with no binding and no set defined -// -// mapIO will use this resolver in two phases. The first -// phase is a notification phase, calling the corresponging -// notifiy callbacks, this phase ends with a call to endNotifications. -// Phase two starts directly after the call to endNotifications -// and calls all other callbacks to validate and to get the -// bindings, sets, locations, component and color indices. -// -// NOTE: that still limit checks are applied to bindings and sets -// and may result in an error. -class TIoMapResolver -{ -public: - virtual ~TIoMapResolver() {} - - // Should return true if the resulting/current binding would be okay. - // Basic idea is to do aliasing binding checks with this. - virtual bool validateBinding(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0; - // Should return a value >= 0 if the current binding should be overridden. - // Return -1 if the current binding (including no binding) should be kept. - virtual int resolveBinding(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0; - // Should return a value >= 0 if the current set should be overridden. - // Return -1 if the current set (including no set) should be kept. - virtual int resolveSet(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0; - // Should return a value >= 0 if the current location should be overridden. - // Return -1 if the current location (including no location) should be kept. - virtual int resolveUniformLocation(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0; - // Should return true if the resulting/current setup would be okay. - // Basic idea is to do aliasing checks and reject invalid semantic names. - virtual bool validateInOut(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0; - // Should return a value >= 0 if the current location should be overridden. - // Return -1 if the current location (including no location) should be kept. - virtual int resolveInOutLocation(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0; - // Should return a value >= 0 if the current component index should be overridden. - // Return -1 if the current component index (including no index) should be kept. - virtual int resolveInOutComponent(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0; - // Should return a value >= 0 if the current color index should be overridden. - // Return -1 if the current color index (including no index) should be kept. - virtual int resolveInOutIndex(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0; - // Notification of a uniform variable - virtual void notifyBinding(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0; - // Notification of a in or out variable - virtual void notifyInOut(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0; - // Called by mapIO when it has finished the notify pass - virtual void endNotifications(EShLanguage stage) = 0; - // Called by mapIO when it starts its notify pass for the given stage - virtual void beginNotifications(EShLanguage stage) = 0; - // Called by mipIO when it starts its resolve pass for the given stage - virtual void beginResolve(EShLanguage stage) = 0; - // Called by mapIO when it has finished the resolve pass - virtual void endResolve(EShLanguage stage) = 0; -}; - -// Make one TProgram per set of shaders that will get linked together. Add all -// the shaders that are to be linked together. After calling shader.parse() -// for all shaders, call link(). -// -// N.B.: Destruct a linked program *before* destructing the shaders linked into it. -// -class TProgram { -public: - TProgram(); - virtual ~TProgram(); - void addShader(TShader* shader) { stages[shader->stage].push_back(shader); } - - // Link Validation interface - bool link(EShMessages); - const char* getInfoLog(); - const char* getInfoDebugLog(); - - TIntermediate* getIntermediate(EShLanguage stage) const { return intermediate[stage]; } - - // Reflection Interface - bool buildReflection(); // call first, to do liveness analysis, index mapping, etc.; returns false on failure - int getNumLiveUniformVariables() const; // can be used for glGetProgramiv(GL_ACTIVE_UNIFORMS) - int getNumLiveUniformBlocks() const; // can be used for glGetProgramiv(GL_ACTIVE_UNIFORM_BLOCKS) - const char* getUniformName(int index) const; // can be used for "name" part of glGetActiveUniform() - const char* getUniformBlockName(int blockIndex) const; // can be used for glGetActiveUniformBlockName() - int getUniformBlockSize(int blockIndex) const; // can be used for glGetActiveUniformBlockiv(UNIFORM_BLOCK_DATA_SIZE) - int getUniformIndex(const char* name) const; // can be used for glGetUniformIndices() - int getUniformBinding(int index) const; // returns the binding number - int getUniformBlockIndex(int index) const; // can be used for glGetActiveUniformsiv(GL_UNIFORM_BLOCK_INDEX) - int getUniformBlockCounterIndex(int index) const; // returns block index of associated counter. - int getUniformType(int index) const; // can be used for glGetActiveUniformsiv(GL_UNIFORM_TYPE) - int getUniformBufferOffset(int index) const; // can be used for glGetActiveUniformsiv(GL_UNIFORM_OFFSET) - int getUniformArraySize(int index) const; // can be used for glGetActiveUniformsiv(GL_UNIFORM_SIZE) - int getNumLiveAttributes() const; // can be used for glGetProgramiv(GL_ACTIVE_ATTRIBUTES) - unsigned getLocalSize(int dim) const; // return dim'th local size - const char *getAttributeName(int index) const; // can be used for glGetActiveAttrib() - int getAttributeType(int index) const; // can be used for glGetActiveAttrib() - const TType* getUniformTType(int index) const; // returns a TType* - const TType* getUniformBlockTType(int index) const; // returns a TType* - const TType* getAttributeTType(int index) const; // returns a TType* - - void dumpReflection(); - - // I/O mapping: apply base offsets and map live unbound variables - // If resolver is not provided it uses the previous approach - // and respects auto assignment and offsets. - bool mapIO(TIoMapResolver* resolver = NULL); - -protected: - bool linkStage(EShLanguage, EShMessages); - - TPoolAllocator* pool; - std::list stages[EShLangCount]; - TIntermediate* intermediate[EShLangCount]; - bool newedIntermediate[EShLangCount]; // track which intermediate were "new" versus reusing a singleton unit in a stage - TInfoSink* infoSink; - TReflection* reflection; - TIoMapper* ioMapper; - bool linked; - -private: - TProgram(TProgram&); - TProgram& operator=(TProgram&); -}; - -} // end namespace glslang - -#endif // _COMPILER_INTERFACE_INCLUDED_ diff --git a/love/src/jni/love/src/libraries/lodepng/lodepng.cpp b/love/src/jni/love/src/libraries/lodepng/lodepng.cpp deleted file mode 100755 index 37b0562b..00000000 --- a/love/src/jni/love/src/libraries/lodepng/lodepng.cpp +++ /dev/null @@ -1,6232 +0,0 @@ -/* -LodePNG version 20170917 - -Copyright (c) 2005-2017 Lode Vandevenne - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - - 3. This notice may not be removed or altered from any source - distribution. -*/ - -/* -The manual and changelog are in the header file "lodepng.h" -Rename this file to lodepng.cpp to use it for C++, or to lodepng.c to use it for C. -*/ - -#include "lodepng.h" - -#include -#include -#include - -#if defined(_MSC_VER) && (_MSC_VER >= 1310) /*Visual Studio: A few warning types are not desired here.*/ -#pragma warning( disable : 4244 ) /*implicit conversions: not warned by gcc -Wall -Wextra and requires too much casts*/ -#pragma warning( disable : 4996 ) /*VS does not like fopen, but fopen_s is not standard C so unusable here*/ -#endif /*_MSC_VER */ - -const char* LODEPNG_VERSION_STRING = "20170917"; - -/* -This source file is built up in the following large parts. The code sections -with the "LODEPNG_COMPILE_" #defines divide this up further in an intermixed way. --Tools for C and common code for PNG and Zlib --C Code for Zlib (huffman, deflate, ...) --C Code for PNG (file format chunks, adam7, PNG filters, color conversions, ...) --The C++ wrapper around all of the above -*/ - -/*The malloc, realloc and free functions defined here with "lodepng_" in front -of the name, so that you can easily change them to others related to your -platform if needed. Everything else in the code calls these. Pass --DLODEPNG_NO_COMPILE_ALLOCATORS to the compiler, or comment out -#define LODEPNG_COMPILE_ALLOCATORS in the header, to disable the ones here and -define them in your own project's source files without needing to change -lodepng source code. Don't forget to remove "static" if you copypaste them -from here.*/ - -#ifdef LODEPNG_COMPILE_ALLOCATORS -static void* lodepng_malloc(size_t size) -{ - return malloc(size); -} - -static void* lodepng_realloc(void* ptr, size_t new_size) -{ - return realloc(ptr, new_size); -} - -static void lodepng_free(void* ptr) -{ - free(ptr); -} -#else /*LODEPNG_COMPILE_ALLOCATORS*/ -void* lodepng_malloc(size_t size); -void* lodepng_realloc(void* ptr, size_t new_size); -void lodepng_free(void* ptr); -#endif /*LODEPNG_COMPILE_ALLOCATORS*/ - -/* ////////////////////////////////////////////////////////////////////////// */ -/* ////////////////////////////////////////////////////////////////////////// */ -/* // Tools for C, and common code for PNG and Zlib. // */ -/* ////////////////////////////////////////////////////////////////////////// */ -/* ////////////////////////////////////////////////////////////////////////// */ - -/* -Often in case of an error a value is assigned to a variable and then it breaks -out of a loop (to go to the cleanup phase of a function). This macro does that. -It makes the error handling code shorter and more readable. - -Example: if(!uivector_resizev(&frequencies_ll, 286, 0)) ERROR_BREAK(83); -*/ -#define CERROR_BREAK(errorvar, code)\ -{\ - errorvar = code;\ - break;\ -} - -/*version of CERROR_BREAK that assumes the common case where the error variable is named "error"*/ -#define ERROR_BREAK(code) CERROR_BREAK(error, code) - -/*Set error var to the error code, and return it.*/ -#define CERROR_RETURN_ERROR(errorvar, code)\ -{\ - errorvar = code;\ - return code;\ -} - -/*Try the code, if it returns error, also return the error.*/ -#define CERROR_TRY_RETURN(call)\ -{\ - unsigned error = call;\ - if(error) return error;\ -} - -/*Set error var to the error code, and return from the void function.*/ -#define CERROR_RETURN(errorvar, code)\ -{\ - errorvar = code;\ - return;\ -} - -/* -About uivector, ucvector and string: --All of them wrap dynamic arrays or text strings in a similar way. --LodePNG was originally written in C++. The vectors replace the std::vectors that were used in the C++ version. --The string tools are made to avoid problems with compilers that declare things like strncat as deprecated. --They're not used in the interface, only internally in this file as static functions. --As with many other structs in this file, the init and cleanup functions serve as ctor and dtor. -*/ - -#ifdef LODEPNG_COMPILE_ZLIB -/*dynamic vector of unsigned ints*/ -typedef struct uivector -{ - unsigned* data; - size_t size; /*size in number of unsigned longs*/ - size_t allocsize; /*allocated size in bytes*/ -} uivector; - -static void uivector_cleanup(void* p) -{ - ((uivector*)p)->size = ((uivector*)p)->allocsize = 0; - lodepng_free(((uivector*)p)->data); - ((uivector*)p)->data = NULL; -} - -/*returns 1 if success, 0 if failure ==> nothing done*/ -static unsigned uivector_reserve(uivector* p, size_t allocsize) -{ - if(allocsize > p->allocsize) - { - size_t newsize = (allocsize > p->allocsize * 2) ? allocsize : (allocsize * 3 / 2); - void* data = lodepng_realloc(p->data, newsize); - if(data) - { - p->allocsize = newsize; - p->data = (unsigned*)data; - } - else return 0; /*error: not enough memory*/ - } - return 1; -} - -/*returns 1 if success, 0 if failure ==> nothing done*/ -static unsigned uivector_resize(uivector* p, size_t size) -{ - if(!uivector_reserve(p, size * sizeof(unsigned))) return 0; - p->size = size; - return 1; /*success*/ -} - -/*resize and give all new elements the value*/ -static unsigned uivector_resizev(uivector* p, size_t size, unsigned value) -{ - size_t oldsize = p->size, i; - if(!uivector_resize(p, size)) return 0; - for(i = oldsize; i < size; ++i) p->data[i] = value; - return 1; -} - -static void uivector_init(uivector* p) -{ - p->data = NULL; - p->size = p->allocsize = 0; -} - -#ifdef LODEPNG_COMPILE_ENCODER -/*returns 1 if success, 0 if failure ==> nothing done*/ -static unsigned uivector_push_back(uivector* p, unsigned c) -{ - if(!uivector_resize(p, p->size + 1)) return 0; - p->data[p->size - 1] = c; - return 1; -} -#endif /*LODEPNG_COMPILE_ENCODER*/ -#endif /*LODEPNG_COMPILE_ZLIB*/ - -/* /////////////////////////////////////////////////////////////////////////// */ - -/*dynamic vector of unsigned chars*/ -typedef struct ucvector -{ - unsigned char* data; - size_t size; /*used size*/ - size_t allocsize; /*allocated size*/ -} ucvector; - -/*returns 1 if success, 0 if failure ==> nothing done*/ -static unsigned ucvector_reserve(ucvector* p, size_t allocsize) -{ - if(allocsize > p->allocsize) - { - size_t newsize = (allocsize > p->allocsize * 2) ? allocsize : (allocsize * 3 / 2); - void* data = lodepng_realloc(p->data, newsize); - if(data) - { - p->allocsize = newsize; - p->data = (unsigned char*)data; - } - else return 0; /*error: not enough memory*/ - } - return 1; -} - -/*returns 1 if success, 0 if failure ==> nothing done*/ -static unsigned ucvector_resize(ucvector* p, size_t size) -{ - if(!ucvector_reserve(p, size * sizeof(unsigned char))) return 0; - p->size = size; - return 1; /*success*/ -} - -#ifdef LODEPNG_COMPILE_PNG - -static void ucvector_cleanup(void* p) -{ - ((ucvector*)p)->size = ((ucvector*)p)->allocsize = 0; - lodepng_free(((ucvector*)p)->data); - ((ucvector*)p)->data = NULL; -} - -static void ucvector_init(ucvector* p) -{ - p->data = NULL; - p->size = p->allocsize = 0; -} -#endif /*LODEPNG_COMPILE_PNG*/ - -#ifdef LODEPNG_COMPILE_ZLIB -/*you can both convert from vector to buffer&size and vica versa. If you use -init_buffer to take over a buffer and size, it is not needed to use cleanup*/ -static void ucvector_init_buffer(ucvector* p, unsigned char* buffer, size_t size) -{ - p->data = buffer; - p->allocsize = p->size = size; -} -#endif /*LODEPNG_COMPILE_ZLIB*/ - -#if (defined(LODEPNG_COMPILE_PNG) && defined(LODEPNG_COMPILE_ANCILLARY_CHUNKS)) || defined(LODEPNG_COMPILE_ENCODER) -/*returns 1 if success, 0 if failure ==> nothing done*/ -static unsigned ucvector_push_back(ucvector* p, unsigned char c) -{ - if(!ucvector_resize(p, p->size + 1)) return 0; - p->data[p->size - 1] = c; - return 1; -} -#endif /*defined(LODEPNG_COMPILE_PNG) || defined(LODEPNG_COMPILE_ENCODER)*/ - - -/* ////////////////////////////////////////////////////////////////////////// */ - -#ifdef LODEPNG_COMPILE_PNG -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS -/*returns 1 if success, 0 if failure ==> nothing done*/ -static unsigned string_resize(char** out, size_t size) -{ - char* data = (char*)lodepng_realloc(*out, size + 1); - if(data) - { - data[size] = 0; /*null termination char*/ - *out = data; - } - return data != 0; -} - -/*init a {char*, size_t} pair for use as string*/ -static void string_init(char** out) -{ - *out = NULL; - string_resize(out, 0); -} - -/*free the above pair again*/ -static void string_cleanup(char** out) -{ - lodepng_free(*out); - *out = NULL; -} - -static void string_set(char** out, const char* in) -{ - size_t insize = strlen(in), i; - if(string_resize(out, insize)) - { - for(i = 0; i != insize; ++i) - { - (*out)[i] = in[i]; - } - } -} -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ -#endif /*LODEPNG_COMPILE_PNG*/ - -/* ////////////////////////////////////////////////////////////////////////// */ - -unsigned lodepng_read32bitInt(const unsigned char* buffer) -{ - return (unsigned)((buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3]); -} - -#if defined(LODEPNG_COMPILE_PNG) || defined(LODEPNG_COMPILE_ENCODER) -/*buffer must have at least 4 allocated bytes available*/ -static void lodepng_set32bitInt(unsigned char* buffer, unsigned value) -{ - buffer[0] = (unsigned char)((value >> 24) & 0xff); - buffer[1] = (unsigned char)((value >> 16) & 0xff); - buffer[2] = (unsigned char)((value >> 8) & 0xff); - buffer[3] = (unsigned char)((value ) & 0xff); -} -#endif /*defined(LODEPNG_COMPILE_PNG) || defined(LODEPNG_COMPILE_ENCODER)*/ - -#ifdef LODEPNG_COMPILE_ENCODER -static void lodepng_add32bitInt(ucvector* buffer, unsigned value) -{ - ucvector_resize(buffer, buffer->size + 4); /*todo: give error if resize failed*/ - lodepng_set32bitInt(&buffer->data[buffer->size - 4], value); -} -#endif /*LODEPNG_COMPILE_ENCODER*/ - -/* ////////////////////////////////////////////////////////////////////////// */ -/* / File IO / */ -/* ////////////////////////////////////////////////////////////////////////// */ - -#ifdef LODEPNG_COMPILE_DISK - -/* returns negative value on error. This should be pure C compatible, so no fstat. */ -static long lodepng_filesize(const char* filename) -{ - FILE* file; - long size; - file = fopen(filename, "rb"); - if(!file) return -1; - - if(fseek(file, 0, SEEK_END) != 0) - { - fclose(file); - return -1; - } - - size = ftell(file); - /* It may give LONG_MAX as directory size, this is invalid for us. */ - if(size == LONG_MAX) size = -1; - - fclose(file); - return size; -} - -/* load file into buffer that already has the correct allocated size. Returns error code.*/ -static unsigned lodepng_buffer_file(unsigned char* out, size_t size, const char* filename) -{ - FILE* file; - size_t readsize; - file = fopen(filename, "rb"); - if(!file) return 78; - - readsize = fread(out, 1, size, file); - fclose(file); - - if (readsize != size) return 78; - return 0; -} - -unsigned lodepng_load_file(unsigned char** out, size_t* outsize, const char* filename) -{ - long size = lodepng_filesize(filename); - if (size < 0) return 78; - *outsize = (size_t)size; - - *out = (unsigned char*)lodepng_malloc((size_t)size); - if(!(*out) && size > 0) return 83; /*the above malloc failed*/ - - return lodepng_buffer_file(*out, (size_t)size, filename); -} - -/*write given buffer to the file, overwriting the file, it doesn't append to it.*/ -unsigned lodepng_save_file(const unsigned char* buffer, size_t buffersize, const char* filename) -{ - FILE* file; - file = fopen(filename, "wb" ); - if(!file) return 79; - fwrite((char*)buffer , 1 , buffersize, file); - fclose(file); - return 0; -} - -#endif /*LODEPNG_COMPILE_DISK*/ - -/* ////////////////////////////////////////////////////////////////////////// */ -/* ////////////////////////////////////////////////////////////////////////// */ -/* // End of common code and tools. Begin of Zlib related code. // */ -/* ////////////////////////////////////////////////////////////////////////// */ -/* ////////////////////////////////////////////////////////////////////////// */ - -#ifdef LODEPNG_COMPILE_ZLIB -#ifdef LODEPNG_COMPILE_ENCODER -/*TODO: this ignores potential out of memory errors*/ -#define addBitToStream(/*size_t**/ bitpointer, /*ucvector**/ bitstream, /*unsigned char*/ bit)\ -{\ - /*add a new byte at the end*/\ - if(((*bitpointer) & 7) == 0) ucvector_push_back(bitstream, (unsigned char)0);\ - /*earlier bit of huffman code is in a lesser significant bit of an earlier byte*/\ - (bitstream->data[bitstream->size - 1]) |= (bit << ((*bitpointer) & 0x7));\ - ++(*bitpointer);\ -} - -static void addBitsToStream(size_t* bitpointer, ucvector* bitstream, unsigned value, size_t nbits) -{ - size_t i; - for(i = 0; i != nbits; ++i) addBitToStream(bitpointer, bitstream, (unsigned char)((value >> i) & 1)); -} - -static void addBitsToStreamReversed(size_t* bitpointer, ucvector* bitstream, unsigned value, size_t nbits) -{ - size_t i; - for(i = 0; i != nbits; ++i) addBitToStream(bitpointer, bitstream, (unsigned char)((value >> (nbits - 1 - i)) & 1)); -} -#endif /*LODEPNG_COMPILE_ENCODER*/ - -#ifdef LODEPNG_COMPILE_DECODER - -#define READBIT(bitpointer, bitstream) ((bitstream[bitpointer >> 3] >> (bitpointer & 0x7)) & (unsigned char)1) - -static unsigned char readBitFromStream(size_t* bitpointer, const unsigned char* bitstream) -{ - unsigned char result = (unsigned char)(READBIT(*bitpointer, bitstream)); - ++(*bitpointer); - return result; -} - -static unsigned readBitsFromStream(size_t* bitpointer, const unsigned char* bitstream, size_t nbits) -{ - unsigned result = 0, i; - for(i = 0; i != nbits; ++i) - { - result += ((unsigned)READBIT(*bitpointer, bitstream)) << i; - ++(*bitpointer); - } - return result; -} -#endif /*LODEPNG_COMPILE_DECODER*/ - -/* ////////////////////////////////////////////////////////////////////////// */ -/* / Deflate - Huffman / */ -/* ////////////////////////////////////////////////////////////////////////// */ - -#define FIRST_LENGTH_CODE_INDEX 257 -#define LAST_LENGTH_CODE_INDEX 285 -/*256 literals, the end code, some length codes, and 2 unused codes*/ -#define NUM_DEFLATE_CODE_SYMBOLS 288 -/*the distance codes have their own symbols, 30 used, 2 unused*/ -#define NUM_DISTANCE_SYMBOLS 32 -/*the code length codes. 0-15: code lengths, 16: copy previous 3-6 times, 17: 3-10 zeros, 18: 11-138 zeros*/ -#define NUM_CODE_LENGTH_CODES 19 - -/*the base lengths represented by codes 257-285*/ -static const unsigned LENGTHBASE[29] - = {3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, - 67, 83, 99, 115, 131, 163, 195, 227, 258}; - -/*the extra bits used by codes 257-285 (added to base length)*/ -static const unsigned LENGTHEXTRA[29] - = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, - 4, 4, 4, 4, 5, 5, 5, 5, 0}; - -/*the base backwards distances (the bits of distance codes appear after length codes and use their own huffman tree)*/ -static const unsigned DISTANCEBASE[30] - = {1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, - 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577}; - -/*the extra bits of backwards distances (added to base)*/ -static const unsigned DISTANCEEXTRA[30] - = {0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, - 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13}; - -/*the order in which "code length alphabet code lengths" are stored, out of this -the huffman tree of the dynamic huffman tree lengths is generated*/ -static const unsigned CLCL_ORDER[NUM_CODE_LENGTH_CODES] - = {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - -/* ////////////////////////////////////////////////////////////////////////// */ - -/* -Huffman tree struct, containing multiple representations of the tree -*/ -typedef struct HuffmanTree -{ - unsigned* tree2d; - unsigned* tree1d; - unsigned* lengths; /*the lengths of the codes of the 1d-tree*/ - unsigned maxbitlen; /*maximum number of bits a single code can get*/ - unsigned numcodes; /*number of symbols in the alphabet = number of codes*/ -} HuffmanTree; - -/*function used for debug purposes to draw the tree in ascii art with C++*/ -/* -static void HuffmanTree_draw(HuffmanTree* tree) -{ - std::cout << "tree. length: " << tree->numcodes << " maxbitlen: " << tree->maxbitlen << std::endl; - for(size_t i = 0; i != tree->tree1d.size; ++i) - { - if(tree->lengths.data[i]) - std::cout << i << " " << tree->tree1d.data[i] << " " << tree->lengths.data[i] << std::endl; - } - std::cout << std::endl; -}*/ - -static void HuffmanTree_init(HuffmanTree* tree) -{ - tree->tree2d = 0; - tree->tree1d = 0; - tree->lengths = 0; -} - -static void HuffmanTree_cleanup(HuffmanTree* tree) -{ - lodepng_free(tree->tree2d); - lodepng_free(tree->tree1d); - lodepng_free(tree->lengths); -} - -/*the tree representation used by the decoder. return value is error*/ -static unsigned HuffmanTree_make2DTree(HuffmanTree* tree) -{ - unsigned nodefilled = 0; /*up to which node it is filled*/ - unsigned treepos = 0; /*position in the tree (1 of the numcodes columns)*/ - unsigned n, i; - - tree->tree2d = (unsigned*)lodepng_malloc(tree->numcodes * 2 * sizeof(unsigned)); - if(!tree->tree2d) return 83; /*alloc fail*/ - - /* - convert tree1d[] to tree2d[][]. In the 2D array, a value of 32767 means - uninited, a value >= numcodes is an address to another bit, a value < numcodes - is a code. The 2 rows are the 2 possible bit values (0 or 1), there are as - many columns as codes - 1. - A good huffman tree has N * 2 - 1 nodes, of which N - 1 are internal nodes. - Here, the internal nodes are stored (what their 0 and 1 option point to). - There is only memory for such good tree currently, if there are more nodes - (due to too long length codes), error 55 will happen - */ - for(n = 0; n < tree->numcodes * 2; ++n) - { - tree->tree2d[n] = 32767; /*32767 here means the tree2d isn't filled there yet*/ - } - - for(n = 0; n < tree->numcodes; ++n) /*the codes*/ - { - for(i = 0; i != tree->lengths[n]; ++i) /*the bits for this code*/ - { - unsigned char bit = (unsigned char)((tree->tree1d[n] >> (tree->lengths[n] - i - 1)) & 1); - /*oversubscribed, see comment in lodepng_error_text*/ - if(treepos > 2147483647 || treepos + 2 > tree->numcodes) return 55; - if(tree->tree2d[2 * treepos + bit] == 32767) /*not yet filled in*/ - { - if(i + 1 == tree->lengths[n]) /*last bit*/ - { - tree->tree2d[2 * treepos + bit] = n; /*put the current code in it*/ - treepos = 0; - } - else - { - /*put address of the next step in here, first that address has to be found of course - (it's just nodefilled + 1)...*/ - ++nodefilled; - /*addresses encoded with numcodes added to it*/ - tree->tree2d[2 * treepos + bit] = nodefilled + tree->numcodes; - treepos = nodefilled; - } - } - else treepos = tree->tree2d[2 * treepos + bit] - tree->numcodes; - } - } - - for(n = 0; n < tree->numcodes * 2; ++n) - { - if(tree->tree2d[n] == 32767) tree->tree2d[n] = 0; /*remove possible remaining 32767's*/ - } - - return 0; -} - -/* -Second step for the ...makeFromLengths and ...makeFromFrequencies functions. -numcodes, lengths and maxbitlen must already be filled in correctly. return -value is error. -*/ -static unsigned HuffmanTree_makeFromLengths2(HuffmanTree* tree) -{ - uivector blcount; - uivector nextcode; - unsigned error = 0; - unsigned bits, n; - - uivector_init(&blcount); - uivector_init(&nextcode); - - tree->tree1d = (unsigned*)lodepng_malloc(tree->numcodes * sizeof(unsigned)); - if(!tree->tree1d) error = 83; /*alloc fail*/ - - if(!uivector_resizev(&blcount, tree->maxbitlen + 1, 0) - || !uivector_resizev(&nextcode, tree->maxbitlen + 1, 0)) - error = 83; /*alloc fail*/ - - if(!error) - { - /*step 1: count number of instances of each code length*/ - for(bits = 0; bits != tree->numcodes; ++bits) ++blcount.data[tree->lengths[bits]]; - /*step 2: generate the nextcode values*/ - for(bits = 1; bits <= tree->maxbitlen; ++bits) - { - nextcode.data[bits] = (nextcode.data[bits - 1] + blcount.data[bits - 1]) << 1; - } - /*step 3: generate all the codes*/ - for(n = 0; n != tree->numcodes; ++n) - { - if(tree->lengths[n] != 0) tree->tree1d[n] = nextcode.data[tree->lengths[n]]++; - } - } - - uivector_cleanup(&blcount); - uivector_cleanup(&nextcode); - - if(!error) return HuffmanTree_make2DTree(tree); - else return error; -} - -/* -given the code lengths (as stored in the PNG file), generate the tree as defined -by Deflate. maxbitlen is the maximum bits that a code in the tree can have. -return value is error. -*/ -static unsigned HuffmanTree_makeFromLengths(HuffmanTree* tree, const unsigned* bitlen, - size_t numcodes, unsigned maxbitlen) -{ - unsigned i; - tree->lengths = (unsigned*)lodepng_malloc(numcodes * sizeof(unsigned)); - if(!tree->lengths) return 83; /*alloc fail*/ - for(i = 0; i != numcodes; ++i) tree->lengths[i] = bitlen[i]; - tree->numcodes = (unsigned)numcodes; /*number of symbols*/ - tree->maxbitlen = maxbitlen; - return HuffmanTree_makeFromLengths2(tree); -} - -#ifdef LODEPNG_COMPILE_ENCODER - -/*BPM: Boundary Package Merge, see "A Fast and Space-Economical Algorithm for Length-Limited Coding", -Jyrki Katajainen, Alistair Moffat, Andrew Turpin, 1995.*/ - -/*chain node for boundary package merge*/ -typedef struct BPMNode -{ - int weight; /*the sum of all weights in this chain*/ - unsigned index; /*index of this leaf node (called "count" in the paper)*/ - struct BPMNode* tail; /*the next nodes in this chain (null if last)*/ - int in_use; -} BPMNode; - -/*lists of chains*/ -typedef struct BPMLists -{ - /*memory pool*/ - unsigned memsize; - BPMNode* memory; - unsigned numfree; - unsigned nextfree; - BPMNode** freelist; - /*two heads of lookahead chains per list*/ - unsigned listsize; - BPMNode** chains0; - BPMNode** chains1; -} BPMLists; - -/*creates a new chain node with the given parameters, from the memory in the lists */ -static BPMNode* bpmnode_create(BPMLists* lists, int weight, unsigned index, BPMNode* tail) -{ - unsigned i; - BPMNode* result; - - /*memory full, so garbage collect*/ - if(lists->nextfree >= lists->numfree) - { - /*mark only those that are in use*/ - for(i = 0; i != lists->memsize; ++i) lists->memory[i].in_use = 0; - for(i = 0; i != lists->listsize; ++i) - { - BPMNode* node; - for(node = lists->chains0[i]; node != 0; node = node->tail) node->in_use = 1; - for(node = lists->chains1[i]; node != 0; node = node->tail) node->in_use = 1; - } - /*collect those that are free*/ - lists->numfree = 0; - for(i = 0; i != lists->memsize; ++i) - { - if(!lists->memory[i].in_use) lists->freelist[lists->numfree++] = &lists->memory[i]; - } - lists->nextfree = 0; - } - - result = lists->freelist[lists->nextfree++]; - result->weight = weight; - result->index = index; - result->tail = tail; - return result; -} - -/*sort the leaves with stable mergesort*/ -static void bpmnode_sort(BPMNode* leaves, size_t num) -{ - BPMNode* mem = (BPMNode*)lodepng_malloc(sizeof(*leaves) * num); - size_t width, counter = 0; - for(width = 1; width < num; width *= 2) - { - BPMNode* a = (counter & 1) ? mem : leaves; - BPMNode* b = (counter & 1) ? leaves : mem; - size_t p; - for(p = 0; p < num; p += 2 * width) - { - size_t q = (p + width > num) ? num : (p + width); - size_t r = (p + 2 * width > num) ? num : (p + 2 * width); - size_t i = p, j = q, k; - for(k = p; k < r; k++) - { - if(i < q && (j >= r || a[i].weight <= a[j].weight)) b[k] = a[i++]; - else b[k] = a[j++]; - } - } - counter++; - } - if(counter & 1) memcpy(leaves, mem, sizeof(*leaves) * num); - lodepng_free(mem); -} - -/*Boundary Package Merge step, numpresent is the amount of leaves, and c is the current chain.*/ -static void boundaryPM(BPMLists* lists, BPMNode* leaves, size_t numpresent, int c, int num) -{ - unsigned lastindex = lists->chains1[c]->index; - - if(c == 0) - { - if(lastindex >= numpresent) return; - lists->chains0[c] = lists->chains1[c]; - lists->chains1[c] = bpmnode_create(lists, leaves[lastindex].weight, lastindex + 1, 0); - } - else - { - /*sum of the weights of the head nodes of the previous lookahead chains.*/ - int sum = lists->chains0[c - 1]->weight + lists->chains1[c - 1]->weight; - lists->chains0[c] = lists->chains1[c]; - if(lastindex < numpresent && sum > leaves[lastindex].weight) - { - lists->chains1[c] = bpmnode_create(lists, leaves[lastindex].weight, lastindex + 1, lists->chains1[c]->tail); - return; - } - lists->chains1[c] = bpmnode_create(lists, sum, lastindex, lists->chains1[c - 1]); - /*in the end we are only interested in the chain of the last list, so no - need to recurse if we're at the last one (this gives measurable speedup)*/ - if(num + 1 < (int)(2 * numpresent - 2)) - { - boundaryPM(lists, leaves, numpresent, c - 1, num); - boundaryPM(lists, leaves, numpresent, c - 1, num); - } - } -} - -unsigned lodepng_huffman_code_lengths(unsigned* lengths, const unsigned* frequencies, - size_t numcodes, unsigned maxbitlen) -{ - unsigned error = 0; - unsigned i; - size_t numpresent = 0; /*number of symbols with non-zero frequency*/ - BPMNode* leaves; /*the symbols, only those with > 0 frequency*/ - - if(numcodes == 0) return 80; /*error: a tree of 0 symbols is not supposed to be made*/ - if((1u << maxbitlen) < numcodes) return 80; /*error: represent all symbols*/ - - leaves = (BPMNode*)lodepng_malloc(numcodes * sizeof(*leaves)); - if(!leaves) return 83; /*alloc fail*/ - - for(i = 0; i != numcodes; ++i) - { - if(frequencies[i] > 0) - { - leaves[numpresent].weight = (int)frequencies[i]; - leaves[numpresent].index = i; - ++numpresent; - } - } - - for(i = 0; i != numcodes; ++i) lengths[i] = 0; - - /*ensure at least two present symbols. There should be at least one symbol - according to RFC 1951 section 3.2.7. Some decoders incorrectly require two. To - make these work as well ensure there are at least two symbols. The - Package-Merge code below also doesn't work correctly if there's only one - symbol, it'd give it the theoritical 0 bits but in practice zlib wants 1 bit*/ - if(numpresent == 0) - { - lengths[0] = lengths[1] = 1; /*note that for RFC 1951 section 3.2.7, only lengths[0] = 1 is needed*/ - } - else if(numpresent == 1) - { - lengths[leaves[0].index] = 1; - lengths[leaves[0].index == 0 ? 1 : 0] = 1; - } - else - { - BPMLists lists; - BPMNode* node; - - bpmnode_sort(leaves, numpresent); - - lists.listsize = maxbitlen; - lists.memsize = 2 * maxbitlen * (maxbitlen + 1); - lists.nextfree = 0; - lists.numfree = lists.memsize; - lists.memory = (BPMNode*)lodepng_malloc(lists.memsize * sizeof(*lists.memory)); - lists.freelist = (BPMNode**)lodepng_malloc(lists.memsize * sizeof(BPMNode*)); - lists.chains0 = (BPMNode**)lodepng_malloc(lists.listsize * sizeof(BPMNode*)); - lists.chains1 = (BPMNode**)lodepng_malloc(lists.listsize * sizeof(BPMNode*)); - if(!lists.memory || !lists.freelist || !lists.chains0 || !lists.chains1) error = 83; /*alloc fail*/ - - if(!error) - { - for(i = 0; i != lists.memsize; ++i) lists.freelist[i] = &lists.memory[i]; - - bpmnode_create(&lists, leaves[0].weight, 1, 0); - bpmnode_create(&lists, leaves[1].weight, 2, 0); - - for(i = 0; i != lists.listsize; ++i) - { - lists.chains0[i] = &lists.memory[0]; - lists.chains1[i] = &lists.memory[1]; - } - - /*each boundaryPM call adds one chain to the last list, and we need 2 * numpresent - 2 chains.*/ - for(i = 2; i != 2 * numpresent - 2; ++i) boundaryPM(&lists, leaves, numpresent, (int)maxbitlen - 1, (int)i); - - for(node = lists.chains1[maxbitlen - 1]; node; node = node->tail) - { - for(i = 0; i != node->index; ++i) ++lengths[leaves[i].index]; - } - } - - lodepng_free(lists.memory); - lodepng_free(lists.freelist); - lodepng_free(lists.chains0); - lodepng_free(lists.chains1); - } - - lodepng_free(leaves); - return error; -} - -/*Create the Huffman tree given the symbol frequencies*/ -static unsigned HuffmanTree_makeFromFrequencies(HuffmanTree* tree, const unsigned* frequencies, - size_t mincodes, size_t numcodes, unsigned maxbitlen) -{ - unsigned error = 0; - while(!frequencies[numcodes - 1] && numcodes > mincodes) --numcodes; /*trim zeroes*/ - tree->maxbitlen = maxbitlen; - tree->numcodes = (unsigned)numcodes; /*number of symbols*/ - tree->lengths = (unsigned*)lodepng_realloc(tree->lengths, numcodes * sizeof(unsigned)); - if(!tree->lengths) return 83; /*alloc fail*/ - /*initialize all lengths to 0*/ - memset(tree->lengths, 0, numcodes * sizeof(unsigned)); - - error = lodepng_huffman_code_lengths(tree->lengths, frequencies, numcodes, maxbitlen); - if(!error) error = HuffmanTree_makeFromLengths2(tree); - return error; -} - -static unsigned HuffmanTree_getCode(const HuffmanTree* tree, unsigned index) -{ - return tree->tree1d[index]; -} - -static unsigned HuffmanTree_getLength(const HuffmanTree* tree, unsigned index) -{ - return tree->lengths[index]; -} -#endif /*LODEPNG_COMPILE_ENCODER*/ - -/*get the literal and length code tree of a deflated block with fixed tree, as per the deflate specification*/ -static unsigned generateFixedLitLenTree(HuffmanTree* tree) -{ - unsigned i, error = 0; - unsigned* bitlen = (unsigned*)lodepng_malloc(NUM_DEFLATE_CODE_SYMBOLS * sizeof(unsigned)); - if(!bitlen) return 83; /*alloc fail*/ - - /*288 possible codes: 0-255=literals, 256=endcode, 257-285=lengthcodes, 286-287=unused*/ - for(i = 0; i <= 143; ++i) bitlen[i] = 8; - for(i = 144; i <= 255; ++i) bitlen[i] = 9; - for(i = 256; i <= 279; ++i) bitlen[i] = 7; - for(i = 280; i <= 287; ++i) bitlen[i] = 8; - - error = HuffmanTree_makeFromLengths(tree, bitlen, NUM_DEFLATE_CODE_SYMBOLS, 15); - - lodepng_free(bitlen); - return error; -} - -/*get the distance code tree of a deflated block with fixed tree, as specified in the deflate specification*/ -static unsigned generateFixedDistanceTree(HuffmanTree* tree) -{ - unsigned i, error = 0; - unsigned* bitlen = (unsigned*)lodepng_malloc(NUM_DISTANCE_SYMBOLS * sizeof(unsigned)); - if(!bitlen) return 83; /*alloc fail*/ - - /*there are 32 distance codes, but 30-31 are unused*/ - for(i = 0; i != NUM_DISTANCE_SYMBOLS; ++i) bitlen[i] = 5; - error = HuffmanTree_makeFromLengths(tree, bitlen, NUM_DISTANCE_SYMBOLS, 15); - - lodepng_free(bitlen); - return error; -} - -#ifdef LODEPNG_COMPILE_DECODER - -/* -returns the code, or (unsigned)(-1) if error happened -inbitlength is the length of the complete buffer, in bits (so its byte length times 8) -*/ -static unsigned huffmanDecodeSymbol(const unsigned char* in, size_t* bp, - const HuffmanTree* codetree, size_t inbitlength) -{ - unsigned treepos = 0, ct; - for(;;) - { - if(*bp >= inbitlength) return (unsigned)(-1); /*error: end of input memory reached without endcode*/ - /* - decode the symbol from the tree. The "readBitFromStream" code is inlined in - the expression below because this is the biggest bottleneck while decoding - */ - ct = codetree->tree2d[(treepos << 1) + READBIT(*bp, in)]; - ++(*bp); - if(ct < codetree->numcodes) return ct; /*the symbol is decoded, return it*/ - else treepos = ct - codetree->numcodes; /*symbol not yet decoded, instead move tree position*/ - - if(treepos >= codetree->numcodes) return (unsigned)(-1); /*error: it appeared outside the codetree*/ - } -} -#endif /*LODEPNG_COMPILE_DECODER*/ - -#ifdef LODEPNG_COMPILE_DECODER - -/* ////////////////////////////////////////////////////////////////////////// */ -/* / Inflator (Decompressor) / */ -/* ////////////////////////////////////////////////////////////////////////// */ - -/*get the tree of a deflated block with fixed tree, as specified in the deflate specification*/ -static void getTreeInflateFixed(HuffmanTree* tree_ll, HuffmanTree* tree_d) -{ - /*TODO: check for out of memory errors*/ - generateFixedLitLenTree(tree_ll); - generateFixedDistanceTree(tree_d); -} - -/*get the tree of a deflated block with dynamic tree, the tree itself is also Huffman compressed with a known tree*/ -static unsigned getTreeInflateDynamic(HuffmanTree* tree_ll, HuffmanTree* tree_d, - const unsigned char* in, size_t* bp, size_t inlength) -{ - /*make sure that length values that aren't filled in will be 0, or a wrong tree will be generated*/ - unsigned error = 0; - unsigned n, HLIT, HDIST, HCLEN, i; - size_t inbitlength = inlength * 8; - - /*see comments in deflateDynamic for explanation of the context and these variables, it is analogous*/ - unsigned* bitlen_ll = 0; /*lit,len code lengths*/ - unsigned* bitlen_d = 0; /*dist code lengths*/ - /*code length code lengths ("clcl"), the bit lengths of the huffman tree used to compress bitlen_ll and bitlen_d*/ - unsigned* bitlen_cl = 0; - HuffmanTree tree_cl; /*the code tree for code length codes (the huffman tree for compressed huffman trees)*/ - - if((*bp) + 14 > (inlength << 3)) return 49; /*error: the bit pointer is or will go past the memory*/ - - /*number of literal/length codes + 257. Unlike the spec, the value 257 is added to it here already*/ - HLIT = readBitsFromStream(bp, in, 5) + 257; - /*number of distance codes. Unlike the spec, the value 1 is added to it here already*/ - HDIST = readBitsFromStream(bp, in, 5) + 1; - /*number of code length codes. Unlike the spec, the value 4 is added to it here already*/ - HCLEN = readBitsFromStream(bp, in, 4) + 4; - - if((*bp) + HCLEN * 3 > (inlength << 3)) return 50; /*error: the bit pointer is or will go past the memory*/ - - HuffmanTree_init(&tree_cl); - - while(!error) - { - /*read the code length codes out of 3 * (amount of code length codes) bits*/ - - bitlen_cl = (unsigned*)lodepng_malloc(NUM_CODE_LENGTH_CODES * sizeof(unsigned)); - if(!bitlen_cl) ERROR_BREAK(83 /*alloc fail*/); - - for(i = 0; i != NUM_CODE_LENGTH_CODES; ++i) - { - if(i < HCLEN) bitlen_cl[CLCL_ORDER[i]] = readBitsFromStream(bp, in, 3); - else bitlen_cl[CLCL_ORDER[i]] = 0; /*if not, it must stay 0*/ - } - - error = HuffmanTree_makeFromLengths(&tree_cl, bitlen_cl, NUM_CODE_LENGTH_CODES, 7); - if(error) break; - - /*now we can use this tree to read the lengths for the tree that this function will return*/ - bitlen_ll = (unsigned*)lodepng_malloc(NUM_DEFLATE_CODE_SYMBOLS * sizeof(unsigned)); - bitlen_d = (unsigned*)lodepng_malloc(NUM_DISTANCE_SYMBOLS * sizeof(unsigned)); - if(!bitlen_ll || !bitlen_d) ERROR_BREAK(83 /*alloc fail*/); - for(i = 0; i != NUM_DEFLATE_CODE_SYMBOLS; ++i) bitlen_ll[i] = 0; - for(i = 0; i != NUM_DISTANCE_SYMBOLS; ++i) bitlen_d[i] = 0; - - /*i is the current symbol we're reading in the part that contains the code lengths of lit/len and dist codes*/ - i = 0; - while(i < HLIT + HDIST) - { - unsigned code = huffmanDecodeSymbol(in, bp, &tree_cl, inbitlength); - if(code <= 15) /*a length code*/ - { - if(i < HLIT) bitlen_ll[i] = code; - else bitlen_d[i - HLIT] = code; - ++i; - } - else if(code == 16) /*repeat previous*/ - { - unsigned replength = 3; /*read in the 2 bits that indicate repeat length (3-6)*/ - unsigned value; /*set value to the previous code*/ - - if(i == 0) ERROR_BREAK(54); /*can't repeat previous if i is 0*/ - - if((*bp + 2) > inbitlength) ERROR_BREAK(50); /*error, bit pointer jumps past memory*/ - replength += readBitsFromStream(bp, in, 2); - - if(i < HLIT + 1) value = bitlen_ll[i - 1]; - else value = bitlen_d[i - HLIT - 1]; - /*repeat this value in the next lengths*/ - for(n = 0; n < replength; ++n) - { - if(i >= HLIT + HDIST) ERROR_BREAK(13); /*error: i is larger than the amount of codes*/ - if(i < HLIT) bitlen_ll[i] = value; - else bitlen_d[i - HLIT] = value; - ++i; - } - } - else if(code == 17) /*repeat "0" 3-10 times*/ - { - unsigned replength = 3; /*read in the bits that indicate repeat length*/ - if((*bp + 3) > inbitlength) ERROR_BREAK(50); /*error, bit pointer jumps past memory*/ - replength += readBitsFromStream(bp, in, 3); - - /*repeat this value in the next lengths*/ - for(n = 0; n < replength; ++n) - { - if(i >= HLIT + HDIST) ERROR_BREAK(14); /*error: i is larger than the amount of codes*/ - - if(i < HLIT) bitlen_ll[i] = 0; - else bitlen_d[i - HLIT] = 0; - ++i; - } - } - else if(code == 18) /*repeat "0" 11-138 times*/ - { - unsigned replength = 11; /*read in the bits that indicate repeat length*/ - if((*bp + 7) > inbitlength) ERROR_BREAK(50); /*error, bit pointer jumps past memory*/ - replength += readBitsFromStream(bp, in, 7); - - /*repeat this value in the next lengths*/ - for(n = 0; n < replength; ++n) - { - if(i >= HLIT + HDIST) ERROR_BREAK(15); /*error: i is larger than the amount of codes*/ - - if(i < HLIT) bitlen_ll[i] = 0; - else bitlen_d[i - HLIT] = 0; - ++i; - } - } - else /*if(code == (unsigned)(-1))*/ /*huffmanDecodeSymbol returns (unsigned)(-1) in case of error*/ - { - if(code == (unsigned)(-1)) - { - /*return error code 10 or 11 depending on the situation that happened in huffmanDecodeSymbol - (10=no endcode, 11=wrong jump outside of tree)*/ - error = (*bp) > inbitlength ? 10 : 11; - } - else error = 16; /*unexisting code, this can never happen*/ - break; - } - } - if(error) break; - - if(bitlen_ll[256] == 0) ERROR_BREAK(64); /*the length of the end code 256 must be larger than 0*/ - - /*now we've finally got HLIT and HDIST, so generate the code trees, and the function is done*/ - error = HuffmanTree_makeFromLengths(tree_ll, bitlen_ll, NUM_DEFLATE_CODE_SYMBOLS, 15); - if(error) break; - error = HuffmanTree_makeFromLengths(tree_d, bitlen_d, NUM_DISTANCE_SYMBOLS, 15); - - break; /*end of error-while*/ - } - - lodepng_free(bitlen_cl); - lodepng_free(bitlen_ll); - lodepng_free(bitlen_d); - HuffmanTree_cleanup(&tree_cl); - - return error; -} - -/*inflate a block with dynamic of fixed Huffman tree*/ -static unsigned inflateHuffmanBlock(ucvector* out, const unsigned char* in, size_t* bp, - size_t* pos, size_t inlength, unsigned btype) -{ - unsigned error = 0; - HuffmanTree tree_ll; /*the huffman tree for literal and length codes*/ - HuffmanTree tree_d; /*the huffman tree for distance codes*/ - size_t inbitlength = inlength * 8; - - HuffmanTree_init(&tree_ll); - HuffmanTree_init(&tree_d); - - if(btype == 1) getTreeInflateFixed(&tree_ll, &tree_d); - else if(btype == 2) error = getTreeInflateDynamic(&tree_ll, &tree_d, in, bp, inlength); - - while(!error) /*decode all symbols until end reached, breaks at end code*/ - { - /*code_ll is literal, length or end code*/ - unsigned code_ll = huffmanDecodeSymbol(in, bp, &tree_ll, inbitlength); - if(code_ll <= 255) /*literal symbol*/ - { - /*ucvector_push_back would do the same, but for some reason the two lines below run 10% faster*/ - if(!ucvector_resize(out, (*pos) + 1)) ERROR_BREAK(83 /*alloc fail*/); - out->data[*pos] = (unsigned char)code_ll; - ++(*pos); - } - else if(code_ll >= FIRST_LENGTH_CODE_INDEX && code_ll <= LAST_LENGTH_CODE_INDEX) /*length code*/ - { - unsigned code_d, distance; - unsigned numextrabits_l, numextrabits_d; /*extra bits for length and distance*/ - size_t start, forward, backward, length; - - /*part 1: get length base*/ - length = LENGTHBASE[code_ll - FIRST_LENGTH_CODE_INDEX]; - - /*part 2: get extra bits and add the value of that to length*/ - numextrabits_l = LENGTHEXTRA[code_ll - FIRST_LENGTH_CODE_INDEX]; - if((*bp + numextrabits_l) > inbitlength) ERROR_BREAK(51); /*error, bit pointer will jump past memory*/ - length += readBitsFromStream(bp, in, numextrabits_l); - - /*part 3: get distance code*/ - code_d = huffmanDecodeSymbol(in, bp, &tree_d, inbitlength); - if(code_d > 29) - { - if(code_d == (unsigned)(-1)) /*huffmanDecodeSymbol returns (unsigned)(-1) in case of error*/ - { - /*return error code 10 or 11 depending on the situation that happened in huffmanDecodeSymbol - (10=no endcode, 11=wrong jump outside of tree)*/ - error = (*bp) > inlength * 8 ? 10 : 11; - } - else error = 18; /*error: invalid distance code (30-31 are never used)*/ - break; - } - distance = DISTANCEBASE[code_d]; - - /*part 4: get extra bits from distance*/ - numextrabits_d = DISTANCEEXTRA[code_d]; - if((*bp + numextrabits_d) > inbitlength) ERROR_BREAK(51); /*error, bit pointer will jump past memory*/ - distance += readBitsFromStream(bp, in, numextrabits_d); - - /*part 5: fill in all the out[n] values based on the length and dist*/ - start = (*pos); - if(distance > start) ERROR_BREAK(52); /*too long backward distance*/ - backward = start - distance; - - if(!ucvector_resize(out, (*pos) + length)) ERROR_BREAK(83 /*alloc fail*/); - if (distance < length) { - for(forward = 0; forward < length; ++forward) - { - out->data[(*pos)++] = out->data[backward++]; - } - } else { - memcpy(out->data + *pos, out->data + backward, length); - *pos += length; - } - } - else if(code_ll == 256) - { - break; /*end code, break the loop*/ - } - else /*if(code == (unsigned)(-1))*/ /*huffmanDecodeSymbol returns (unsigned)(-1) in case of error*/ - { - /*return error code 10 or 11 depending on the situation that happened in huffmanDecodeSymbol - (10=no endcode, 11=wrong jump outside of tree)*/ - error = ((*bp) > inlength * 8) ? 10 : 11; - break; - } - } - - HuffmanTree_cleanup(&tree_ll); - HuffmanTree_cleanup(&tree_d); - - return error; -} - -static unsigned inflateNoCompression(ucvector* out, const unsigned char* in, size_t* bp, size_t* pos, size_t inlength) -{ - size_t p; - unsigned LEN, NLEN, n, error = 0; - - /*go to first boundary of byte*/ - while(((*bp) & 0x7) != 0) ++(*bp); - p = (*bp) / 8; /*byte position*/ - - /*read LEN (2 bytes) and NLEN (2 bytes)*/ - if(p + 4 >= inlength) return 52; /*error, bit pointer will jump past memory*/ - LEN = in[p] + 256u * in[p + 1]; p += 2; - NLEN = in[p] + 256u * in[p + 1]; p += 2; - - /*check if 16-bit NLEN is really the one's complement of LEN*/ - if(LEN + NLEN != 65535) return 21; /*error: NLEN is not one's complement of LEN*/ - - if(!ucvector_resize(out, (*pos) + LEN)) return 83; /*alloc fail*/ - - /*read the literal data: LEN bytes are now stored in the out buffer*/ - if(p + LEN > inlength) return 23; /*error: reading outside of in buffer*/ - for(n = 0; n < LEN; ++n) out->data[(*pos)++] = in[p++]; - - (*bp) = p * 8; - - return error; -} - -static unsigned lodepng_inflatev(ucvector* out, - const unsigned char* in, size_t insize, - const LodePNGDecompressSettings* settings) -{ - /*bit pointer in the "in" data, current byte is bp >> 3, current bit is bp & 0x7 (from lsb to msb of the byte)*/ - size_t bp = 0; - unsigned BFINAL = 0; - size_t pos = 0; /*byte position in the out buffer*/ - unsigned error = 0; - - (void)settings; - - while(!BFINAL) - { - unsigned BTYPE; - if(bp + 2 >= insize * 8) return 52; /*error, bit pointer will jump past memory*/ - BFINAL = readBitFromStream(&bp, in); - BTYPE = 1u * readBitFromStream(&bp, in); - BTYPE += 2u * readBitFromStream(&bp, in); - - if(BTYPE == 3) return 20; /*error: invalid BTYPE*/ - else if(BTYPE == 0) error = inflateNoCompression(out, in, &bp, &pos, insize); /*no compression*/ - else error = inflateHuffmanBlock(out, in, &bp, &pos, insize, BTYPE); /*compression, BTYPE 01 or 10*/ - - if(error) return error; - } - - return error; -} - -unsigned lodepng_inflate(unsigned char** out, size_t* outsize, - const unsigned char* in, size_t insize, - const LodePNGDecompressSettings* settings) -{ - unsigned error; - ucvector v; - ucvector_init_buffer(&v, *out, *outsize); - error = lodepng_inflatev(&v, in, insize, settings); - *out = v.data; - *outsize = v.size; - return error; -} - -static unsigned inflate(unsigned char** out, size_t* outsize, - const unsigned char* in, size_t insize, - const LodePNGDecompressSettings* settings) -{ - if(settings->custom_inflate) - { - return settings->custom_inflate(out, outsize, in, insize, settings); - } - else - { - return lodepng_inflate(out, outsize, in, insize, settings); - } -} - -#endif /*LODEPNG_COMPILE_DECODER*/ - -#ifdef LODEPNG_COMPILE_ENCODER - -/* ////////////////////////////////////////////////////////////////////////// */ -/* / Deflator (Compressor) / */ -/* ////////////////////////////////////////////////////////////////////////// */ - -static const size_t MAX_SUPPORTED_DEFLATE_LENGTH = 258; - -/*bitlen is the size in bits of the code*/ -static void addHuffmanSymbol(size_t* bp, ucvector* compressed, unsigned code, unsigned bitlen) -{ - addBitsToStreamReversed(bp, compressed, code, bitlen); -} - -/*search the index in the array, that has the largest value smaller than or equal to the given value, -given array must be sorted (if no value is smaller, it returns the size of the given array)*/ -static size_t searchCodeIndex(const unsigned* array, size_t array_size, size_t value) -{ - /*binary search (only small gain over linear). TODO: use CPU log2 instruction for getting symbols instead*/ - size_t left = 1; - size_t right = array_size - 1; - - while(left <= right) { - size_t mid = (left + right) >> 1; - if (array[mid] >= value) right = mid - 1; - else left = mid + 1; - } - if(left >= array_size || array[left] > value) left--; - return left; -} - -static void addLengthDistance(uivector* values, size_t length, size_t distance) -{ - /*values in encoded vector are those used by deflate: - 0-255: literal bytes - 256: end - 257-285: length/distance pair (length code, followed by extra length bits, distance code, extra distance bits) - 286-287: invalid*/ - - unsigned length_code = (unsigned)searchCodeIndex(LENGTHBASE, 29, length); - unsigned extra_length = (unsigned)(length - LENGTHBASE[length_code]); - unsigned dist_code = (unsigned)searchCodeIndex(DISTANCEBASE, 30, distance); - unsigned extra_distance = (unsigned)(distance - DISTANCEBASE[dist_code]); - - uivector_push_back(values, length_code + FIRST_LENGTH_CODE_INDEX); - uivector_push_back(values, extra_length); - uivector_push_back(values, dist_code); - uivector_push_back(values, extra_distance); -} - -/*3 bytes of data get encoded into two bytes. The hash cannot use more than 3 -bytes as input because 3 is the minimum match length for deflate*/ -static const unsigned HASH_NUM_VALUES = 65536; -static const unsigned HASH_BIT_MASK = 65535; /*HASH_NUM_VALUES - 1, but C90 does not like that as initializer*/ - -typedef struct Hash -{ - int* head; /*hash value to head circular pos - can be outdated if went around window*/ - /*circular pos to prev circular pos*/ - unsigned short* chain; - int* val; /*circular pos to hash value*/ - - /*TODO: do this not only for zeros but for any repeated byte. However for PNG - it's always going to be the zeros that dominate, so not important for PNG*/ - int* headz; /*similar to head, but for chainz*/ - unsigned short* chainz; /*those with same amount of zeros*/ - unsigned short* zeros; /*length of zeros streak, used as a second hash chain*/ -} Hash; - -static unsigned hash_init(Hash* hash, unsigned windowsize) -{ - unsigned i; - hash->head = (int*)lodepng_malloc(sizeof(int) * HASH_NUM_VALUES); - hash->val = (int*)lodepng_malloc(sizeof(int) * windowsize); - hash->chain = (unsigned short*)lodepng_malloc(sizeof(unsigned short) * windowsize); - - hash->zeros = (unsigned short*)lodepng_malloc(sizeof(unsigned short) * windowsize); - hash->headz = (int*)lodepng_malloc(sizeof(int) * (MAX_SUPPORTED_DEFLATE_LENGTH + 1)); - hash->chainz = (unsigned short*)lodepng_malloc(sizeof(unsigned short) * windowsize); - - if(!hash->head || !hash->chain || !hash->val || !hash->headz|| !hash->chainz || !hash->zeros) - { - return 83; /*alloc fail*/ - } - - /*initialize hash table*/ - for(i = 0; i != HASH_NUM_VALUES; ++i) hash->head[i] = -1; - for(i = 0; i != windowsize; ++i) hash->val[i] = -1; - for(i = 0; i != windowsize; ++i) hash->chain[i] = i; /*same value as index indicates uninitialized*/ - - for(i = 0; i <= MAX_SUPPORTED_DEFLATE_LENGTH; ++i) hash->headz[i] = -1; - for(i = 0; i != windowsize; ++i) hash->chainz[i] = i; /*same value as index indicates uninitialized*/ - - return 0; -} - -static void hash_cleanup(Hash* hash) -{ - lodepng_free(hash->head); - lodepng_free(hash->val); - lodepng_free(hash->chain); - - lodepng_free(hash->zeros); - lodepng_free(hash->headz); - lodepng_free(hash->chainz); -} - - - -static unsigned getHash(const unsigned char* data, size_t size, size_t pos) -{ - unsigned result = 0; - if(pos + 2 < size) - { - /*A simple shift and xor hash is used. Since the data of PNGs is dominated - by zeroes due to the filters, a better hash does not have a significant - effect on speed in traversing the chain, and causes more time spend on - calculating the hash.*/ - result ^= (unsigned)(data[pos + 0] << 0u); - result ^= (unsigned)(data[pos + 1] << 4u); - result ^= (unsigned)(data[pos + 2] << 8u); - } else { - size_t amount, i; - if(pos >= size) return 0; - amount = size - pos; - for(i = 0; i != amount; ++i) result ^= (unsigned)(data[pos + i] << (i * 8u)); - } - return result & HASH_BIT_MASK; -} - -static unsigned countZeros(const unsigned char* data, size_t size, size_t pos) -{ - const unsigned char* start = data + pos; - const unsigned char* end = start + MAX_SUPPORTED_DEFLATE_LENGTH; - if(end > data + size) end = data + size; - data = start; - while(data != end && *data == 0) ++data; - /*subtracting two addresses returned as 32-bit number (max value is MAX_SUPPORTED_DEFLATE_LENGTH)*/ - return (unsigned)(data - start); -} - -/*wpos = pos & (windowsize - 1)*/ -static void updateHashChain(Hash* hash, size_t wpos, unsigned hashval, unsigned short numzeros) -{ - hash->val[wpos] = (int)hashval; - if(hash->head[hashval] != -1) hash->chain[wpos] = hash->head[hashval]; - hash->head[hashval] = wpos; - - hash->zeros[wpos] = numzeros; - if(hash->headz[numzeros] != -1) hash->chainz[wpos] = hash->headz[numzeros]; - hash->headz[numzeros] = wpos; -} - -/* -LZ77-encode the data. Return value is error code. The input are raw bytes, the output -is in the form of unsigned integers with codes representing for example literal bytes, or -length/distance pairs. -It uses a hash table technique to let it encode faster. When doing LZ77 encoding, a -sliding window (of windowsize) is used, and all past bytes in that window can be used as -the "dictionary". A brute force search through all possible distances would be slow, and -this hash technique is one out of several ways to speed this up. -*/ -static unsigned encodeLZ77(uivector* out, Hash* hash, - const unsigned char* in, size_t inpos, size_t insize, unsigned windowsize, - unsigned minmatch, unsigned nicematch, unsigned lazymatching) -{ - size_t pos; - unsigned i, error = 0; - /*for large window lengths, assume the user wants no compression loss. Otherwise, max hash chain length speedup.*/ - unsigned maxchainlength = windowsize >= 8192 ? windowsize : windowsize / 8; - unsigned maxlazymatch = windowsize >= 8192 ? MAX_SUPPORTED_DEFLATE_LENGTH : 64; - - unsigned usezeros = 1; /*not sure if setting it to false for windowsize < 8192 is better or worse*/ - unsigned numzeros = 0; - - unsigned offset; /*the offset represents the distance in LZ77 terminology*/ - unsigned length; - unsigned lazy = 0; - unsigned lazylength = 0, lazyoffset = 0; - unsigned hashval; - unsigned current_offset, current_length; - unsigned prev_offset; - const unsigned char *lastptr, *foreptr, *backptr; - unsigned hashpos; - - if(windowsize == 0 || windowsize > 32768) return 60; /*error: windowsize smaller/larger than allowed*/ - if((windowsize & (windowsize - 1)) != 0) return 90; /*error: must be power of two*/ - - if(nicematch > MAX_SUPPORTED_DEFLATE_LENGTH) nicematch = MAX_SUPPORTED_DEFLATE_LENGTH; - - for(pos = inpos; pos < insize; ++pos) - { - size_t wpos = pos & (windowsize - 1); /*position for in 'circular' hash buffers*/ - unsigned chainlength = 0; - - hashval = getHash(in, insize, pos); - - if(usezeros && hashval == 0) - { - if(numzeros == 0) numzeros = countZeros(in, insize, pos); - else if(pos + numzeros > insize || in[pos + numzeros - 1] != 0) --numzeros; - } - else - { - numzeros = 0; - } - - updateHashChain(hash, wpos, hashval, numzeros); - - /*the length and offset found for the current position*/ - length = 0; - offset = 0; - - hashpos = hash->chain[wpos]; - - lastptr = &in[insize < pos + MAX_SUPPORTED_DEFLATE_LENGTH ? insize : pos + MAX_SUPPORTED_DEFLATE_LENGTH]; - - /*search for the longest string*/ - prev_offset = 0; - for(;;) - { - if(chainlength++ >= maxchainlength) break; - current_offset = hashpos <= wpos ? wpos - hashpos : wpos - hashpos + windowsize; - - if(current_offset < prev_offset) break; /*stop when went completely around the circular buffer*/ - prev_offset = current_offset; - if(current_offset > 0) - { - /*test the next characters*/ - foreptr = &in[pos]; - backptr = &in[pos - current_offset]; - - /*common case in PNGs is lots of zeros. Quickly skip over them as a speedup*/ - if(numzeros >= 3) - { - unsigned skip = hash->zeros[hashpos]; - if(skip > numzeros) skip = numzeros; - backptr += skip; - foreptr += skip; - } - - while(foreptr != lastptr && *backptr == *foreptr) /*maximum supported length by deflate is max length*/ - { - ++backptr; - ++foreptr; - } - current_length = (unsigned)(foreptr - &in[pos]); - - if(current_length > length) - { - length = current_length; /*the longest length*/ - offset = current_offset; /*the offset that is related to this longest length*/ - /*jump out once a length of max length is found (speed gain). This also jumps - out if length is MAX_SUPPORTED_DEFLATE_LENGTH*/ - if(current_length >= nicematch) break; - } - } - - if(hashpos == hash->chain[hashpos]) break; - - if(numzeros >= 3 && length > numzeros) - { - hashpos = hash->chainz[hashpos]; - if(hash->zeros[hashpos] != numzeros) break; - } - else - { - hashpos = hash->chain[hashpos]; - /*outdated hash value, happens if particular value was not encountered in whole last window*/ - if(hash->val[hashpos] != (int)hashval) break; - } - } - - if(lazymatching) - { - if(!lazy && length >= 3 && length <= maxlazymatch && length < MAX_SUPPORTED_DEFLATE_LENGTH) - { - lazy = 1; - lazylength = length; - lazyoffset = offset; - continue; /*try the next byte*/ - } - if(lazy) - { - lazy = 0; - if(pos == 0) ERROR_BREAK(81); - if(length > lazylength + 1) - { - /*push the previous character as literal*/ - if(!uivector_push_back(out, in[pos - 1])) ERROR_BREAK(83 /*alloc fail*/); - } - else - { - length = lazylength; - offset = lazyoffset; - hash->head[hashval] = -1; /*the same hashchain update will be done, this ensures no wrong alteration*/ - hash->headz[numzeros] = -1; /*idem*/ - --pos; - } - } - } - if(length >= 3 && offset > windowsize) ERROR_BREAK(86 /*too big (or overflown negative) offset*/); - - /*encode it as length/distance pair or literal value*/ - if(length < 3) /*only lengths of 3 or higher are supported as length/distance pair*/ - { - if(!uivector_push_back(out, in[pos])) ERROR_BREAK(83 /*alloc fail*/); - } - else if(length < minmatch || (length == 3 && offset > 4096)) - { - /*compensate for the fact that longer offsets have more extra bits, a - length of only 3 may be not worth it then*/ - if(!uivector_push_back(out, in[pos])) ERROR_BREAK(83 /*alloc fail*/); - } - else - { - addLengthDistance(out, length, offset); - for(i = 1; i < length; ++i) - { - ++pos; - wpos = pos & (windowsize - 1); - hashval = getHash(in, insize, pos); - if(usezeros && hashval == 0) - { - if(numzeros == 0) numzeros = countZeros(in, insize, pos); - else if(pos + numzeros > insize || in[pos + numzeros - 1] != 0) --numzeros; - } - else - { - numzeros = 0; - } - updateHashChain(hash, wpos, hashval, numzeros); - } - } - } /*end of the loop through each character of input*/ - - return error; -} - -/* /////////////////////////////////////////////////////////////////////////// */ - -static unsigned deflateNoCompression(ucvector* out, const unsigned char* data, size_t datasize) -{ - /*non compressed deflate block data: 1 bit BFINAL,2 bits BTYPE,(5 bits): it jumps to start of next byte, - 2 bytes LEN, 2 bytes NLEN, LEN bytes literal DATA*/ - - size_t i, j, numdeflateblocks = (datasize + 65534) / 65535; - unsigned datapos = 0; - for(i = 0; i != numdeflateblocks; ++i) - { - unsigned BFINAL, BTYPE, LEN, NLEN; - unsigned char firstbyte; - - BFINAL = (i == numdeflateblocks - 1); - BTYPE = 0; - - firstbyte = (unsigned char)(BFINAL + ((BTYPE & 1) << 1) + ((BTYPE & 2) << 1)); - ucvector_push_back(out, firstbyte); - - LEN = 65535; - if(datasize - datapos < 65535) LEN = (unsigned)datasize - datapos; - NLEN = 65535 - LEN; - - ucvector_push_back(out, (unsigned char)(LEN & 255)); - ucvector_push_back(out, (unsigned char)(LEN >> 8)); - ucvector_push_back(out, (unsigned char)(NLEN & 255)); - ucvector_push_back(out, (unsigned char)(NLEN >> 8)); - - /*Decompressed data*/ - for(j = 0; j < 65535 && datapos < datasize; ++j) - { - ucvector_push_back(out, data[datapos++]); - } - } - - return 0; -} - -/* -write the lz77-encoded data, which has lit, len and dist codes, to compressed stream using huffman trees. -tree_ll: the tree for lit and len codes. -tree_d: the tree for distance codes. -*/ -static void writeLZ77data(size_t* bp, ucvector* out, const uivector* lz77_encoded, - const HuffmanTree* tree_ll, const HuffmanTree* tree_d) -{ - size_t i = 0; - for(i = 0; i != lz77_encoded->size; ++i) - { - unsigned val = lz77_encoded->data[i]; - addHuffmanSymbol(bp, out, HuffmanTree_getCode(tree_ll, val), HuffmanTree_getLength(tree_ll, val)); - if(val > 256) /*for a length code, 3 more things have to be added*/ - { - unsigned length_index = val - FIRST_LENGTH_CODE_INDEX; - unsigned n_length_extra_bits = LENGTHEXTRA[length_index]; - unsigned length_extra_bits = lz77_encoded->data[++i]; - - unsigned distance_code = lz77_encoded->data[++i]; - - unsigned distance_index = distance_code; - unsigned n_distance_extra_bits = DISTANCEEXTRA[distance_index]; - unsigned distance_extra_bits = lz77_encoded->data[++i]; - - addBitsToStream(bp, out, length_extra_bits, n_length_extra_bits); - addHuffmanSymbol(bp, out, HuffmanTree_getCode(tree_d, distance_code), - HuffmanTree_getLength(tree_d, distance_code)); - addBitsToStream(bp, out, distance_extra_bits, n_distance_extra_bits); - } - } -} - -/*Deflate for a block of type "dynamic", that is, with freely, optimally, created huffman trees*/ -static unsigned deflateDynamic(ucvector* out, size_t* bp, Hash* hash, - const unsigned char* data, size_t datapos, size_t dataend, - const LodePNGCompressSettings* settings, unsigned final) -{ - unsigned error = 0; - - /* - A block is compressed as follows: The PNG data is lz77 encoded, resulting in - literal bytes and length/distance pairs. This is then huffman compressed with - two huffman trees. One huffman tree is used for the lit and len values ("ll"), - another huffman tree is used for the dist values ("d"). These two trees are - stored using their code lengths, and to compress even more these code lengths - are also run-length encoded and huffman compressed. This gives a huffman tree - of code lengths "cl". The code lenghts used to describe this third tree are - the code length code lengths ("clcl"). - */ - - /*The lz77 encoded data, represented with integers since there will also be length and distance codes in it*/ - uivector lz77_encoded; - HuffmanTree tree_ll; /*tree for lit,len values*/ - HuffmanTree tree_d; /*tree for distance codes*/ - HuffmanTree tree_cl; /*tree for encoding the code lengths representing tree_ll and tree_d*/ - uivector frequencies_ll; /*frequency of lit,len codes*/ - uivector frequencies_d; /*frequency of dist codes*/ - uivector frequencies_cl; /*frequency of code length codes*/ - uivector bitlen_lld; /*lit,len,dist code lenghts (int bits), literally (without repeat codes).*/ - uivector bitlen_lld_e; /*bitlen_lld encoded with repeat codes (this is a rudemtary run length compression)*/ - /*bitlen_cl is the code length code lengths ("clcl"). The bit lengths of codes to represent tree_cl - (these are written as is in the file, it would be crazy to compress these using yet another huffman - tree that needs to be represented by yet another set of code lengths)*/ - uivector bitlen_cl; - size_t datasize = dataend - datapos; - - /* - Due to the huffman compression of huffman tree representations ("two levels"), there are some anologies: - bitlen_lld is to tree_cl what data is to tree_ll and tree_d. - bitlen_lld_e is to bitlen_lld what lz77_encoded is to data. - bitlen_cl is to bitlen_lld_e what bitlen_lld is to lz77_encoded. - */ - - unsigned BFINAL = final; - size_t numcodes_ll, numcodes_d, i; - unsigned HLIT, HDIST, HCLEN; - - uivector_init(&lz77_encoded); - HuffmanTree_init(&tree_ll); - HuffmanTree_init(&tree_d); - HuffmanTree_init(&tree_cl); - uivector_init(&frequencies_ll); - uivector_init(&frequencies_d); - uivector_init(&frequencies_cl); - uivector_init(&bitlen_lld); - uivector_init(&bitlen_lld_e); - uivector_init(&bitlen_cl); - - /*This while loop never loops due to a break at the end, it is here to - allow breaking out of it to the cleanup phase on error conditions.*/ - while(!error) - { - if(settings->use_lz77) - { - error = encodeLZ77(&lz77_encoded, hash, data, datapos, dataend, settings->windowsize, - settings->minmatch, settings->nicematch, settings->lazymatching); - if(error) break; - } - else - { - if(!uivector_resize(&lz77_encoded, datasize)) ERROR_BREAK(83 /*alloc fail*/); - for(i = datapos; i < dataend; ++i) lz77_encoded.data[i - datapos] = data[i]; /*no LZ77, but still will be Huffman compressed*/ - } - - if(!uivector_resizev(&frequencies_ll, 286, 0)) ERROR_BREAK(83 /*alloc fail*/); - if(!uivector_resizev(&frequencies_d, 30, 0)) ERROR_BREAK(83 /*alloc fail*/); - - /*Count the frequencies of lit, len and dist codes*/ - for(i = 0; i != lz77_encoded.size; ++i) - { - unsigned symbol = lz77_encoded.data[i]; - ++frequencies_ll.data[symbol]; - if(symbol > 256) - { - unsigned dist = lz77_encoded.data[i + 2]; - ++frequencies_d.data[dist]; - i += 3; - } - } - frequencies_ll.data[256] = 1; /*there will be exactly 1 end code, at the end of the block*/ - - /*Make both huffman trees, one for the lit and len codes, one for the dist codes*/ - error = HuffmanTree_makeFromFrequencies(&tree_ll, frequencies_ll.data, 257, frequencies_ll.size, 15); - if(error) break; - /*2, not 1, is chosen for mincodes: some buggy PNG decoders require at least 2 symbols in the dist tree*/ - error = HuffmanTree_makeFromFrequencies(&tree_d, frequencies_d.data, 2, frequencies_d.size, 15); - if(error) break; - - numcodes_ll = tree_ll.numcodes; if(numcodes_ll > 286) numcodes_ll = 286; - numcodes_d = tree_d.numcodes; if(numcodes_d > 30) numcodes_d = 30; - /*store the code lengths of both generated trees in bitlen_lld*/ - for(i = 0; i != numcodes_ll; ++i) uivector_push_back(&bitlen_lld, HuffmanTree_getLength(&tree_ll, (unsigned)i)); - for(i = 0; i != numcodes_d; ++i) uivector_push_back(&bitlen_lld, HuffmanTree_getLength(&tree_d, (unsigned)i)); - - /*run-length compress bitlen_ldd into bitlen_lld_e by using repeat codes 16 (copy length 3-6 times), - 17 (3-10 zeroes), 18 (11-138 zeroes)*/ - for(i = 0; i != (unsigned)bitlen_lld.size; ++i) - { - unsigned j = 0; /*amount of repititions*/ - while(i + j + 1 < (unsigned)bitlen_lld.size && bitlen_lld.data[i + j + 1] == bitlen_lld.data[i]) ++j; - - if(bitlen_lld.data[i] == 0 && j >= 2) /*repeat code for zeroes*/ - { - ++j; /*include the first zero*/ - if(j <= 10) /*repeat code 17 supports max 10 zeroes*/ - { - uivector_push_back(&bitlen_lld_e, 17); - uivector_push_back(&bitlen_lld_e, j - 3); - } - else /*repeat code 18 supports max 138 zeroes*/ - { - if(j > 138) j = 138; - uivector_push_back(&bitlen_lld_e, 18); - uivector_push_back(&bitlen_lld_e, j - 11); - } - i += (j - 1); - } - else if(j >= 3) /*repeat code for value other than zero*/ - { - size_t k; - unsigned num = j / 6, rest = j % 6; - uivector_push_back(&bitlen_lld_e, bitlen_lld.data[i]); - for(k = 0; k < num; ++k) - { - uivector_push_back(&bitlen_lld_e, 16); - uivector_push_back(&bitlen_lld_e, 6 - 3); - } - if(rest >= 3) - { - uivector_push_back(&bitlen_lld_e, 16); - uivector_push_back(&bitlen_lld_e, rest - 3); - } - else j -= rest; - i += j; - } - else /*too short to benefit from repeat code*/ - { - uivector_push_back(&bitlen_lld_e, bitlen_lld.data[i]); - } - } - - /*generate tree_cl, the huffmantree of huffmantrees*/ - - if(!uivector_resizev(&frequencies_cl, NUM_CODE_LENGTH_CODES, 0)) ERROR_BREAK(83 /*alloc fail*/); - for(i = 0; i != bitlen_lld_e.size; ++i) - { - ++frequencies_cl.data[bitlen_lld_e.data[i]]; - /*after a repeat code come the bits that specify the number of repetitions, - those don't need to be in the frequencies_cl calculation*/ - if(bitlen_lld_e.data[i] >= 16) ++i; - } - - error = HuffmanTree_makeFromFrequencies(&tree_cl, frequencies_cl.data, - frequencies_cl.size, frequencies_cl.size, 7); - if(error) break; - - if(!uivector_resize(&bitlen_cl, tree_cl.numcodes)) ERROR_BREAK(83 /*alloc fail*/); - for(i = 0; i != tree_cl.numcodes; ++i) - { - /*lenghts of code length tree is in the order as specified by deflate*/ - bitlen_cl.data[i] = HuffmanTree_getLength(&tree_cl, CLCL_ORDER[i]); - } - while(bitlen_cl.data[bitlen_cl.size - 1] == 0 && bitlen_cl.size > 4) - { - /*remove zeros at the end, but minimum size must be 4*/ - if(!uivector_resize(&bitlen_cl, bitlen_cl.size - 1)) ERROR_BREAK(83 /*alloc fail*/); - } - if(error) break; - - /* - Write everything into the output - - After the BFINAL and BTYPE, the dynamic block consists out of the following: - - 5 bits HLIT, 5 bits HDIST, 4 bits HCLEN - - (HCLEN+4)*3 bits code lengths of code length alphabet - - HLIT + 257 code lenghts of lit/length alphabet (encoded using the code length - alphabet, + possible repetition codes 16, 17, 18) - - HDIST + 1 code lengths of distance alphabet (encoded using the code length - alphabet, + possible repetition codes 16, 17, 18) - - compressed data - - 256 (end code) - */ - - /*Write block type*/ - addBitToStream(bp, out, BFINAL); - addBitToStream(bp, out, 0); /*first bit of BTYPE "dynamic"*/ - addBitToStream(bp, out, 1); /*second bit of BTYPE "dynamic"*/ - - /*write the HLIT, HDIST and HCLEN values*/ - HLIT = (unsigned)(numcodes_ll - 257); - HDIST = (unsigned)(numcodes_d - 1); - HCLEN = (unsigned)bitlen_cl.size - 4; - /*trim zeroes for HCLEN. HLIT and HDIST were already trimmed at tree creation*/ - while(!bitlen_cl.data[HCLEN + 4 - 1] && HCLEN > 0) --HCLEN; - addBitsToStream(bp, out, HLIT, 5); - addBitsToStream(bp, out, HDIST, 5); - addBitsToStream(bp, out, HCLEN, 4); - - /*write the code lenghts of the code length alphabet*/ - for(i = 0; i != HCLEN + 4; ++i) addBitsToStream(bp, out, bitlen_cl.data[i], 3); - - /*write the lenghts of the lit/len AND the dist alphabet*/ - for(i = 0; i != bitlen_lld_e.size; ++i) - { - addHuffmanSymbol(bp, out, HuffmanTree_getCode(&tree_cl, bitlen_lld_e.data[i]), - HuffmanTree_getLength(&tree_cl, bitlen_lld_e.data[i])); - /*extra bits of repeat codes*/ - if(bitlen_lld_e.data[i] == 16) addBitsToStream(bp, out, bitlen_lld_e.data[++i], 2); - else if(bitlen_lld_e.data[i] == 17) addBitsToStream(bp, out, bitlen_lld_e.data[++i], 3); - else if(bitlen_lld_e.data[i] == 18) addBitsToStream(bp, out, bitlen_lld_e.data[++i], 7); - } - - /*write the compressed data symbols*/ - writeLZ77data(bp, out, &lz77_encoded, &tree_ll, &tree_d); - /*error: the length of the end code 256 must be larger than 0*/ - if(HuffmanTree_getLength(&tree_ll, 256) == 0) ERROR_BREAK(64); - - /*write the end code*/ - addHuffmanSymbol(bp, out, HuffmanTree_getCode(&tree_ll, 256), HuffmanTree_getLength(&tree_ll, 256)); - - break; /*end of error-while*/ - } - - /*cleanup*/ - uivector_cleanup(&lz77_encoded); - HuffmanTree_cleanup(&tree_ll); - HuffmanTree_cleanup(&tree_d); - HuffmanTree_cleanup(&tree_cl); - uivector_cleanup(&frequencies_ll); - uivector_cleanup(&frequencies_d); - uivector_cleanup(&frequencies_cl); - uivector_cleanup(&bitlen_lld_e); - uivector_cleanup(&bitlen_lld); - uivector_cleanup(&bitlen_cl); - - return error; -} - -static unsigned deflateFixed(ucvector* out, size_t* bp, Hash* hash, - const unsigned char* data, - size_t datapos, size_t dataend, - const LodePNGCompressSettings* settings, unsigned final) -{ - HuffmanTree tree_ll; /*tree for literal values and length codes*/ - HuffmanTree tree_d; /*tree for distance codes*/ - - unsigned BFINAL = final; - unsigned error = 0; - size_t i; - - HuffmanTree_init(&tree_ll); - HuffmanTree_init(&tree_d); - - generateFixedLitLenTree(&tree_ll); - generateFixedDistanceTree(&tree_d); - - addBitToStream(bp, out, BFINAL); - addBitToStream(bp, out, 1); /*first bit of BTYPE*/ - addBitToStream(bp, out, 0); /*second bit of BTYPE*/ - - if(settings->use_lz77) /*LZ77 encoded*/ - { - uivector lz77_encoded; - uivector_init(&lz77_encoded); - error = encodeLZ77(&lz77_encoded, hash, data, datapos, dataend, settings->windowsize, - settings->minmatch, settings->nicematch, settings->lazymatching); - if(!error) writeLZ77data(bp, out, &lz77_encoded, &tree_ll, &tree_d); - uivector_cleanup(&lz77_encoded); - } - else /*no LZ77, but still will be Huffman compressed*/ - { - for(i = datapos; i < dataend; ++i) - { - addHuffmanSymbol(bp, out, HuffmanTree_getCode(&tree_ll, data[i]), HuffmanTree_getLength(&tree_ll, data[i])); - } - } - /*add END code*/ - if(!error) addHuffmanSymbol(bp, out, HuffmanTree_getCode(&tree_ll, 256), HuffmanTree_getLength(&tree_ll, 256)); - - /*cleanup*/ - HuffmanTree_cleanup(&tree_ll); - HuffmanTree_cleanup(&tree_d); - - return error; -} - -static unsigned lodepng_deflatev(ucvector* out, const unsigned char* in, size_t insize, - const LodePNGCompressSettings* settings) -{ - unsigned error = 0; - size_t i, blocksize, numdeflateblocks; - size_t bp = 0; /*the bit pointer*/ - Hash hash; - - if(settings->btype > 2) return 61; - else if(settings->btype == 0) return deflateNoCompression(out, in, insize); - else if(settings->btype == 1) blocksize = insize; - else /*if(settings->btype == 2)*/ - { - /*on PNGs, deflate blocks of 65-262k seem to give most dense encoding*/ - blocksize = insize / 8 + 8; - if(blocksize < 65536) blocksize = 65536; - if(blocksize > 262144) blocksize = 262144; - } - - numdeflateblocks = (insize + blocksize - 1) / blocksize; - if(numdeflateblocks == 0) numdeflateblocks = 1; - - error = hash_init(&hash, settings->windowsize); - if(error) return error; - - for(i = 0; i != numdeflateblocks && !error; ++i) - { - unsigned final = (i == numdeflateblocks - 1); - size_t start = i * blocksize; - size_t end = start + blocksize; - if(end > insize) end = insize; - - if(settings->btype == 1) error = deflateFixed(out, &bp, &hash, in, start, end, settings, final); - else if(settings->btype == 2) error = deflateDynamic(out, &bp, &hash, in, start, end, settings, final); - } - - hash_cleanup(&hash); - - return error; -} - -unsigned lodepng_deflate(unsigned char** out, size_t* outsize, - const unsigned char* in, size_t insize, - const LodePNGCompressSettings* settings) -{ - unsigned error; - ucvector v; - ucvector_init_buffer(&v, *out, *outsize); - error = lodepng_deflatev(&v, in, insize, settings); - *out = v.data; - *outsize = v.size; - return error; -} - -static unsigned deflate(unsigned char** out, size_t* outsize, - const unsigned char* in, size_t insize, - const LodePNGCompressSettings* settings) -{ - if(settings->custom_deflate) - { - return settings->custom_deflate(out, outsize, in, insize, settings); - } - else - { - return lodepng_deflate(out, outsize, in, insize, settings); - } -} - -#endif /*LODEPNG_COMPILE_DECODER*/ - -/* ////////////////////////////////////////////////////////////////////////// */ -/* / Adler32 */ -/* ////////////////////////////////////////////////////////////////////////// */ - -static unsigned update_adler32(unsigned adler, const unsigned char* data, unsigned len) -{ - unsigned s1 = adler & 0xffff; - unsigned s2 = (adler >> 16) & 0xffff; - - while(len > 0) - { - /*at least 5550 sums can be done before the sums overflow, saving a lot of module divisions*/ - unsigned amount = len > 5550 ? 5550 : len; - len -= amount; - while(amount > 0) - { - s1 += (*data++); - s2 += s1; - --amount; - } - s1 %= 65521; - s2 %= 65521; - } - - return (s2 << 16) | s1; -} - -/*Return the adler32 of the bytes data[0..len-1]*/ -static unsigned adler32(const unsigned char* data, unsigned len) -{ - return update_adler32(1L, data, len); -} - -/* ////////////////////////////////////////////////////////////////////////// */ -/* / Zlib / */ -/* ////////////////////////////////////////////////////////////////////////// */ - -#ifdef LODEPNG_COMPILE_DECODER - -unsigned lodepng_zlib_decompress(unsigned char** out, size_t* outsize, const unsigned char* in, - size_t insize, const LodePNGDecompressSettings* settings) -{ - unsigned error = 0; - unsigned CM, CINFO, FDICT; - - if(insize < 2) return 53; /*error, size of zlib data too small*/ - /*read information from zlib header*/ - if((in[0] * 256 + in[1]) % 31 != 0) - { - /*error: 256 * in[0] + in[1] must be a multiple of 31, the FCHECK value is supposed to be made that way*/ - return 24; - } - - CM = in[0] & 15; - CINFO = (in[0] >> 4) & 15; - /*FCHECK = in[1] & 31;*/ /*FCHECK is already tested above*/ - FDICT = (in[1] >> 5) & 1; - /*FLEVEL = (in[1] >> 6) & 3;*/ /*FLEVEL is not used here*/ - - if(CM != 8 || CINFO > 7) - { - /*error: only compression method 8: inflate with sliding window of 32k is supported by the PNG spec*/ - return 25; - } - if(FDICT != 0) - { - /*error: the specification of PNG says about the zlib stream: - "The additional flags shall not specify a preset dictionary."*/ - return 26; - } - - error = inflate(out, outsize, in + 2, insize - 2, settings); - if(error) return error; - - if(!settings->ignore_adler32) - { - unsigned ADLER32 = lodepng_read32bitInt(&in[insize - 4]); - unsigned checksum = adler32(*out, (unsigned)(*outsize)); - if(checksum != ADLER32) return 58; /*error, adler checksum not correct, data must be corrupted*/ - } - - return 0; /*no error*/ -} - -static unsigned zlib_decompress(unsigned char** out, size_t* outsize, const unsigned char* in, - size_t insize, const LodePNGDecompressSettings* settings) -{ - if(settings->custom_zlib) - { - return settings->custom_zlib(out, outsize, in, insize, settings); - } - else - { - return lodepng_zlib_decompress(out, outsize, in, insize, settings); - } -} - -#endif /*LODEPNG_COMPILE_DECODER*/ - -#ifdef LODEPNG_COMPILE_ENCODER - -unsigned lodepng_zlib_compress(unsigned char** out, size_t* outsize, const unsigned char* in, - size_t insize, const LodePNGCompressSettings* settings) -{ - /*initially, *out must be NULL and outsize 0, if you just give some random *out - that's pointing to a non allocated buffer, this'll crash*/ - ucvector outv; - size_t i; - unsigned error; - unsigned char* deflatedata = 0; - size_t deflatesize = 0; - - /*zlib data: 1 byte CMF (CM+CINFO), 1 byte FLG, deflate data, 4 byte ADLER32 checksum of the Decompressed data*/ - unsigned CMF = 120; /*0b01111000: CM 8, CINFO 7. With CINFO 7, any window size up to 32768 can be used.*/ - unsigned FLEVEL = 0; - unsigned FDICT = 0; - unsigned CMFFLG = 256 * CMF + FDICT * 32 + FLEVEL * 64; - unsigned FCHECK = 31 - CMFFLG % 31; - CMFFLG += FCHECK; - - /*ucvector-controlled version of the output buffer, for dynamic array*/ - ucvector_init_buffer(&outv, *out, *outsize); - - ucvector_push_back(&outv, (unsigned char)(CMFFLG >> 8)); - ucvector_push_back(&outv, (unsigned char)(CMFFLG & 255)); - - error = deflate(&deflatedata, &deflatesize, in, insize, settings); - - if(!error) - { - unsigned ADLER32 = adler32(in, (unsigned)insize); - for(i = 0; i != deflatesize; ++i) ucvector_push_back(&outv, deflatedata[i]); - lodepng_free(deflatedata); - lodepng_add32bitInt(&outv, ADLER32); - } - - *out = outv.data; - *outsize = outv.size; - - return error; -} - -/* compress using the default or custom zlib function */ -static unsigned zlib_compress(unsigned char** out, size_t* outsize, const unsigned char* in, - size_t insize, const LodePNGCompressSettings* settings) -{ - if(settings->custom_zlib) - { - return settings->custom_zlib(out, outsize, in, insize, settings); - } - else - { - return lodepng_zlib_compress(out, outsize, in, insize, settings); - } -} - -#endif /*LODEPNG_COMPILE_ENCODER*/ - -#else /*no LODEPNG_COMPILE_ZLIB*/ - -#ifdef LODEPNG_COMPILE_DECODER -static unsigned zlib_decompress(unsigned char** out, size_t* outsize, const unsigned char* in, - size_t insize, const LodePNGDecompressSettings* settings) -{ - if(!settings->custom_zlib) return 87; /*no custom zlib function provided */ - return settings->custom_zlib(out, outsize, in, insize, settings); -} -#endif /*LODEPNG_COMPILE_DECODER*/ -#ifdef LODEPNG_COMPILE_ENCODER -static unsigned zlib_compress(unsigned char** out, size_t* outsize, const unsigned char* in, - size_t insize, const LodePNGCompressSettings* settings) -{ - if(!settings->custom_zlib) return 87; /*no custom zlib function provided */ - return settings->custom_zlib(out, outsize, in, insize, settings); -} -#endif /*LODEPNG_COMPILE_ENCODER*/ - -#endif /*LODEPNG_COMPILE_ZLIB*/ - -/* ////////////////////////////////////////////////////////////////////////// */ - -#ifdef LODEPNG_COMPILE_ENCODER - -/*this is a good tradeoff between speed and compression ratio*/ -#define DEFAULT_WINDOWSIZE 2048 - -void lodepng_compress_settings_init(LodePNGCompressSettings* settings) -{ - /*compress with dynamic huffman tree (not in the mathematical sense, just not the predefined one)*/ - settings->btype = 2; - settings->use_lz77 = 1; - settings->windowsize = DEFAULT_WINDOWSIZE; - settings->minmatch = 3; - settings->nicematch = 128; - settings->lazymatching = 1; - - settings->custom_zlib = 0; - settings->custom_deflate = 0; - settings->custom_context = 0; -} - -const LodePNGCompressSettings lodepng_default_compress_settings = {2, 1, DEFAULT_WINDOWSIZE, 3, 128, 1, 0, 0, 0}; - - -#endif /*LODEPNG_COMPILE_ENCODER*/ - -#ifdef LODEPNG_COMPILE_DECODER - -void lodepng_decompress_settings_init(LodePNGDecompressSettings* settings) -{ - settings->ignore_adler32 = 0; - - settings->custom_zlib = 0; - settings->custom_inflate = 0; - settings->custom_context = 0; -} - -const LodePNGDecompressSettings lodepng_default_decompress_settings = {0, 0, 0, 0}; - -#endif /*LODEPNG_COMPILE_DECODER*/ - -/* ////////////////////////////////////////////////////////////////////////// */ -/* ////////////////////////////////////////////////////////////////////////// */ -/* // End of Zlib related code. Begin of PNG related code. // */ -/* ////////////////////////////////////////////////////////////////////////// */ -/* ////////////////////////////////////////////////////////////////////////// */ - -#ifdef LODEPNG_COMPILE_PNG - -/* ////////////////////////////////////////////////////////////////////////// */ -/* / CRC32 / */ -/* ////////////////////////////////////////////////////////////////////////// */ - - -#ifndef LODEPNG_NO_COMPILE_CRC -/* CRC polynomial: 0xedb88320 */ -static unsigned lodepng_crc32_table[256] = { - 0u, 1996959894u, 3993919788u, 2567524794u, 124634137u, 1886057615u, 3915621685u, 2657392035u, - 249268274u, 2044508324u, 3772115230u, 2547177864u, 162941995u, 2125561021u, 3887607047u, 2428444049u, - 498536548u, 1789927666u, 4089016648u, 2227061214u, 450548861u, 1843258603u, 4107580753u, 2211677639u, - 325883990u, 1684777152u, 4251122042u, 2321926636u, 335633487u, 1661365465u, 4195302755u, 2366115317u, - 997073096u, 1281953886u, 3579855332u, 2724688242u, 1006888145u, 1258607687u, 3524101629u, 2768942443u, - 901097722u, 1119000684u, 3686517206u, 2898065728u, 853044451u, 1172266101u, 3705015759u, 2882616665u, - 651767980u, 1373503546u, 3369554304u, 3218104598u, 565507253u, 1454621731u, 3485111705u, 3099436303u, - 671266974u, 1594198024u, 3322730930u, 2970347812u, 795835527u, 1483230225u, 3244367275u, 3060149565u, - 1994146192u, 31158534u, 2563907772u, 4023717930u, 1907459465u, 112637215u, 2680153253u, 3904427059u, - 2013776290u, 251722036u, 2517215374u, 3775830040u, 2137656763u, 141376813u, 2439277719u, 3865271297u, - 1802195444u, 476864866u, 2238001368u, 4066508878u, 1812370925u, 453092731u, 2181625025u, 4111451223u, - 1706088902u, 314042704u, 2344532202u, 4240017532u, 1658658271u, 366619977u, 2362670323u, 4224994405u, - 1303535960u, 984961486u, 2747007092u, 3569037538u, 1256170817u, 1037604311u, 2765210733u, 3554079995u, - 1131014506u, 879679996u, 2909243462u, 3663771856u, 1141124467u, 855842277u, 2852801631u, 3708648649u, - 1342533948u, 654459306u, 3188396048u, 3373015174u, 1466479909u, 544179635u, 3110523913u, 3462522015u, - 1591671054u, 702138776u, 2966460450u, 3352799412u, 1504918807u, 783551873u, 3082640443u, 3233442989u, - 3988292384u, 2596254646u, 62317068u, 1957810842u, 3939845945u, 2647816111u, 81470997u, 1943803523u, - 3814918930u, 2489596804u, 225274430u, 2053790376u, 3826175755u, 2466906013u, 167816743u, 2097651377u, - 4027552580u, 2265490386u, 503444072u, 1762050814u, 4150417245u, 2154129355u, 426522225u, 1852507879u, - 4275313526u, 2312317920u, 282753626u, 1742555852u, 4189708143u, 2394877945u, 397917763u, 1622183637u, - 3604390888u, 2714866558u, 953729732u, 1340076626u, 3518719985u, 2797360999u, 1068828381u, 1219638859u, - 3624741850u, 2936675148u, 906185462u, 1090812512u, 3747672003u, 2825379669u, 829329135u, 1181335161u, - 3412177804u, 3160834842u, 628085408u, 1382605366u, 3423369109u, 3138078467u, 570562233u, 1426400815u, - 3317316542u, 2998733608u, 733239954u, 1555261956u, 3268935591u, 3050360625u, 752459403u, 1541320221u, - 2607071920u, 3965973030u, 1969922972u, 40735498u, 2617837225u, 3943577151u, 1913087877u, 83908371u, - 2512341634u, 3803740692u, 2075208622u, 213261112u, 2463272603u, 3855990285u, 2094854071u, 198958881u, - 2262029012u, 4057260610u, 1759359992u, 534414190u, 2176718541u, 4139329115u, 1873836001u, 414664567u, - 2282248934u, 4279200368u, 1711684554u, 285281116u, 2405801727u, 4167216745u, 1634467795u, 376229701u, - 2685067896u, 3608007406u, 1308918612u, 956543938u, 2808555105u, 3495958263u, 1231636301u, 1047427035u, - 2932959818u, 3654703836u, 1088359270u, 936918000u, 2847714899u, 3736837829u, 1202900863u, 817233897u, - 3183342108u, 3401237130u, 1404277552u, 615818150u, 3134207493u, 3453421203u, 1423857449u, 601450431u, - 3009837614u, 3294710456u, 1567103746u, 711928724u, 3020668471u, 3272380065u, 1510334235u, 755167117u -}; - -/*Return the CRC of the bytes buf[0..len-1].*/ -unsigned lodepng_crc32(const unsigned char* data, size_t length) -{ - unsigned r = 0xffffffffu; - size_t i; - for(i = 0; i < length; ++i) - { - r = lodepng_crc32_table[(r ^ data[i]) & 0xff] ^ (r >> 8); - } - return r ^ 0xffffffffu; -} -#else /* !LODEPNG_NO_COMPILE_CRC */ -unsigned lodepng_crc32(const unsigned char* data, size_t length); -#endif /* !LODEPNG_NO_COMPILE_CRC */ - -/* ////////////////////////////////////////////////////////////////////////// */ -/* / Reading and writing single bits and bytes from/to stream for LodePNG / */ -/* ////////////////////////////////////////////////////////////////////////// */ - -static unsigned char readBitFromReversedStream(size_t* bitpointer, const unsigned char* bitstream) -{ - unsigned char result = (unsigned char)((bitstream[(*bitpointer) >> 3] >> (7 - ((*bitpointer) & 0x7))) & 1); - ++(*bitpointer); - return result; -} - -static unsigned readBitsFromReversedStream(size_t* bitpointer, const unsigned char* bitstream, size_t nbits) -{ - unsigned result = 0; - size_t i; - for(i = 0 ; i < nbits; ++i) - { - result <<= 1; - result |= (unsigned)readBitFromReversedStream(bitpointer, bitstream); - } - return result; -} - -#ifdef LODEPNG_COMPILE_DECODER -static void setBitOfReversedStream0(size_t* bitpointer, unsigned char* bitstream, unsigned char bit) -{ - /*the current bit in bitstream must be 0 for this to work*/ - if(bit) - { - /*earlier bit of huffman code is in a lesser significant bit of an earlier byte*/ - bitstream[(*bitpointer) >> 3] |= (bit << (7 - ((*bitpointer) & 0x7))); - } - ++(*bitpointer); -} -#endif /*LODEPNG_COMPILE_DECODER*/ - -static void setBitOfReversedStream(size_t* bitpointer, unsigned char* bitstream, unsigned char bit) -{ - /*the current bit in bitstream may be 0 or 1 for this to work*/ - if(bit == 0) bitstream[(*bitpointer) >> 3] &= (unsigned char)(~(1 << (7 - ((*bitpointer) & 0x7)))); - else bitstream[(*bitpointer) >> 3] |= (1 << (7 - ((*bitpointer) & 0x7))); - ++(*bitpointer); -} - -/* ////////////////////////////////////////////////////////////////////////// */ -/* / PNG chunks / */ -/* ////////////////////////////////////////////////////////////////////////// */ - -unsigned lodepng_chunk_length(const unsigned char* chunk) -{ - return lodepng_read32bitInt(&chunk[0]); -} - -void lodepng_chunk_type(char type[5], const unsigned char* chunk) -{ - unsigned i; - for(i = 0; i != 4; ++i) type[i] = (char)chunk[4 + i]; - type[4] = 0; /*null termination char*/ -} - -unsigned char lodepng_chunk_type_equals(const unsigned char* chunk, const char* type) -{ - if(strlen(type) != 4) return 0; - return (chunk[4] == type[0] && chunk[5] == type[1] && chunk[6] == type[2] && chunk[7] == type[3]); -} - -unsigned char lodepng_chunk_ancillary(const unsigned char* chunk) -{ - return((chunk[4] & 32) != 0); -} - -unsigned char lodepng_chunk_private(const unsigned char* chunk) -{ - return((chunk[6] & 32) != 0); -} - -unsigned char lodepng_chunk_safetocopy(const unsigned char* chunk) -{ - return((chunk[7] & 32) != 0); -} - -unsigned char* lodepng_chunk_data(unsigned char* chunk) -{ - return &chunk[8]; -} - -const unsigned char* lodepng_chunk_data_const(const unsigned char* chunk) -{ - return &chunk[8]; -} - -unsigned lodepng_chunk_check_crc(const unsigned char* chunk) -{ - unsigned length = lodepng_chunk_length(chunk); - unsigned CRC = lodepng_read32bitInt(&chunk[length + 8]); - /*the CRC is taken of the data and the 4 chunk type letters, not the length*/ - unsigned checksum = lodepng_crc32(&chunk[4], length + 4); - if(CRC != checksum) return 1; - else return 0; -} - -void lodepng_chunk_generate_crc(unsigned char* chunk) -{ - unsigned length = lodepng_chunk_length(chunk); - unsigned CRC = lodepng_crc32(&chunk[4], length + 4); - lodepng_set32bitInt(chunk + 8 + length, CRC); -} - -unsigned char* lodepng_chunk_next(unsigned char* chunk) -{ - unsigned total_chunk_length = lodepng_chunk_length(chunk) + 12; - return &chunk[total_chunk_length]; -} - -const unsigned char* lodepng_chunk_next_const(const unsigned char* chunk) -{ - unsigned total_chunk_length = lodepng_chunk_length(chunk) + 12; - return &chunk[total_chunk_length]; -} - -unsigned lodepng_chunk_append(unsigned char** out, size_t* outlength, const unsigned char* chunk) -{ - unsigned i; - unsigned total_chunk_length = lodepng_chunk_length(chunk) + 12; - unsigned char *chunk_start, *new_buffer; - size_t new_length = (*outlength) + total_chunk_length; - if(new_length < total_chunk_length || new_length < (*outlength)) return 77; /*integer overflow happened*/ - - new_buffer = (unsigned char*)lodepng_realloc(*out, new_length); - if(!new_buffer) return 83; /*alloc fail*/ - (*out) = new_buffer; - (*outlength) = new_length; - chunk_start = &(*out)[new_length - total_chunk_length]; - - for(i = 0; i != total_chunk_length; ++i) chunk_start[i] = chunk[i]; - - return 0; -} - -unsigned lodepng_chunk_create(unsigned char** out, size_t* outlength, unsigned length, - const char* type, const unsigned char* data) -{ - unsigned i; - unsigned char *chunk, *new_buffer; - size_t new_length = (*outlength) + length + 12; - if(new_length < length + 12 || new_length < (*outlength)) return 77; /*integer overflow happened*/ - new_buffer = (unsigned char*)lodepng_realloc(*out, new_length); - if(!new_buffer) return 83; /*alloc fail*/ - (*out) = new_buffer; - (*outlength) = new_length; - chunk = &(*out)[(*outlength) - length - 12]; - - /*1: length*/ - lodepng_set32bitInt(chunk, (unsigned)length); - - /*2: chunk name (4 letters)*/ - chunk[4] = (unsigned char)type[0]; - chunk[5] = (unsigned char)type[1]; - chunk[6] = (unsigned char)type[2]; - chunk[7] = (unsigned char)type[3]; - - /*3: the data*/ - for(i = 0; i != length; ++i) chunk[8 + i] = data[i]; - - /*4: CRC (of the chunkname characters and the data)*/ - lodepng_chunk_generate_crc(chunk); - - return 0; -} - -/* ////////////////////////////////////////////////////////////////////////// */ -/* / Color types and such / */ -/* ////////////////////////////////////////////////////////////////////////// */ - -/*return type is a LodePNG error code*/ -static unsigned checkColorValidity(LodePNGColorType colortype, unsigned bd) /*bd = bitdepth*/ -{ - switch(colortype) - { - case 0: if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8 || bd == 16)) return 37; break; /*grey*/ - case 2: if(!( bd == 8 || bd == 16)) return 37; break; /*RGB*/ - case 3: if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8 )) return 37; break; /*palette*/ - case 4: if(!( bd == 8 || bd == 16)) return 37; break; /*grey + alpha*/ - case 6: if(!( bd == 8 || bd == 16)) return 37; break; /*RGBA*/ - default: return 31; - } - return 0; /*allowed color type / bits combination*/ -} - -static unsigned getNumColorChannels(LodePNGColorType colortype) -{ - switch(colortype) - { - case 0: return 1; /*grey*/ - case 2: return 3; /*RGB*/ - case 3: return 1; /*palette*/ - case 4: return 2; /*grey + alpha*/ - case 6: return 4; /*RGBA*/ - } - return 0; /*unexisting color type*/ -} - -static unsigned lodepng_get_bpp_lct(LodePNGColorType colortype, unsigned bitdepth) -{ - /*bits per pixel is amount of channels * bits per channel*/ - return getNumColorChannels(colortype) * bitdepth; -} - -/* ////////////////////////////////////////////////////////////////////////// */ - -void lodepng_color_mode_init(LodePNGColorMode* info) -{ - info->key_defined = 0; - info->key_r = info->key_g = info->key_b = 0; - info->colortype = LCT_RGBA; - info->bitdepth = 8; - info->palette = 0; - info->palettesize = 0; -} - -void lodepng_color_mode_cleanup(LodePNGColorMode* info) -{ - lodepng_palette_clear(info); -} - -unsigned lodepng_color_mode_copy(LodePNGColorMode* dest, const LodePNGColorMode* source) -{ - size_t i; - lodepng_color_mode_cleanup(dest); - *dest = *source; - if(source->palette) - { - dest->palette = (unsigned char*)lodepng_malloc(1024); - if(!dest->palette && source->palettesize) return 83; /*alloc fail*/ - for(i = 0; i != source->palettesize * 4; ++i) dest->palette[i] = source->palette[i]; - } - return 0; -} - -static int lodepng_color_mode_equal(const LodePNGColorMode* a, const LodePNGColorMode* b) -{ - size_t i; - if(a->colortype != b->colortype) return 0; - if(a->bitdepth != b->bitdepth) return 0; - if(a->key_defined != b->key_defined) return 0; - if(a->key_defined) - { - if(a->key_r != b->key_r) return 0; - if(a->key_g != b->key_g) return 0; - if(a->key_b != b->key_b) return 0; - } - /*if one of the palette sizes is 0, then we consider it to be the same as the - other: it means that e.g. the palette was not given by the user and should be - considered the same as the palette inside the PNG.*/ - if(1/*a->palettesize != 0 && b->palettesize != 0*/) { - if(a->palettesize != b->palettesize) return 0; - for(i = 0; i != a->palettesize * 4; ++i) - { - if(a->palette[i] != b->palette[i]) return 0; - } - } - return 1; -} - -void lodepng_palette_clear(LodePNGColorMode* info) -{ - if(info->palette) lodepng_free(info->palette); - info->palette = 0; - info->palettesize = 0; -} - -unsigned lodepng_palette_add(LodePNGColorMode* info, - unsigned char r, unsigned char g, unsigned char b, unsigned char a) -{ - unsigned char* data; - /*the same resize technique as C++ std::vectors is used, and here it's made so that for a palette with - the max of 256 colors, it'll have the exact alloc size*/ - if(!info->palette) /*allocate palette if empty*/ - { - /*room for 256 colors with 4 bytes each*/ - data = (unsigned char*)lodepng_realloc(info->palette, 1024); - if(!data) return 83; /*alloc fail*/ - else info->palette = data; - } - info->palette[4 * info->palettesize + 0] = r; - info->palette[4 * info->palettesize + 1] = g; - info->palette[4 * info->palettesize + 2] = b; - info->palette[4 * info->palettesize + 3] = a; - ++info->palettesize; - return 0; -} - -unsigned lodepng_get_bpp(const LodePNGColorMode* info) -{ - /*calculate bits per pixel out of colortype and bitdepth*/ - return lodepng_get_bpp_lct(info->colortype, info->bitdepth); -} - -unsigned lodepng_get_channels(const LodePNGColorMode* info) -{ - return getNumColorChannels(info->colortype); -} - -unsigned lodepng_is_greyscale_type(const LodePNGColorMode* info) -{ - return info->colortype == LCT_GREY || info->colortype == LCT_GREY_ALPHA; -} - -unsigned lodepng_is_alpha_type(const LodePNGColorMode* info) -{ - return (info->colortype & 4) != 0; /*4 or 6*/ -} - -unsigned lodepng_is_palette_type(const LodePNGColorMode* info) -{ - return info->colortype == LCT_PALETTE; -} - -unsigned lodepng_has_palette_alpha(const LodePNGColorMode* info) -{ - size_t i; - for(i = 0; i != info->palettesize; ++i) - { - if(info->palette[i * 4 + 3] < 255) return 1; - } - return 0; -} - -unsigned lodepng_can_have_alpha(const LodePNGColorMode* info) -{ - return info->key_defined - || lodepng_is_alpha_type(info) - || lodepng_has_palette_alpha(info); -} - -size_t lodepng_get_raw_size(unsigned w, unsigned h, const LodePNGColorMode* color) -{ - /*will not overflow for any color type if roughly w * h < 268435455*/ - size_t bpp = lodepng_get_bpp(color); - size_t n = w * h; - return ((n / 8) * bpp) + ((n & 7) * bpp + 7) / 8; -} - -size_t lodepng_get_raw_size_lct(unsigned w, unsigned h, LodePNGColorType colortype, unsigned bitdepth) -{ - /*will not overflow for any color type if roughly w * h < 268435455*/ - size_t bpp = lodepng_get_bpp_lct(colortype, bitdepth); - size_t n = w * h; - return ((n / 8) * bpp) + ((n & 7) * bpp + 7) / 8; -} - - -#ifdef LODEPNG_COMPILE_PNG -#ifdef LODEPNG_COMPILE_DECODER -/*in an idat chunk, each scanline is a multiple of 8 bits, unlike the lodepng output buffer*/ -static size_t lodepng_get_raw_size_idat(unsigned w, unsigned h, const LodePNGColorMode* color) -{ - /*will not overflow for any color type if roughly w * h < 268435455*/ - size_t bpp = lodepng_get_bpp(color); - size_t line = ((w / 8) * bpp) + ((w & 7) * bpp + 7) / 8; - return h * line; -} -#endif /*LODEPNG_COMPILE_DECODER*/ -#endif /*LODEPNG_COMPILE_PNG*/ - -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS - -static void LodePNGUnknownChunks_init(LodePNGInfo* info) -{ - unsigned i; - for(i = 0; i != 3; ++i) info->unknown_chunks_data[i] = 0; - for(i = 0; i != 3; ++i) info->unknown_chunks_size[i] = 0; -} - -static void LodePNGUnknownChunks_cleanup(LodePNGInfo* info) -{ - unsigned i; - for(i = 0; i != 3; ++i) lodepng_free(info->unknown_chunks_data[i]); -} - -static unsigned LodePNGUnknownChunks_copy(LodePNGInfo* dest, const LodePNGInfo* src) -{ - unsigned i; - - LodePNGUnknownChunks_cleanup(dest); - - for(i = 0; i != 3; ++i) - { - size_t j; - dest->unknown_chunks_size[i] = src->unknown_chunks_size[i]; - dest->unknown_chunks_data[i] = (unsigned char*)lodepng_malloc(src->unknown_chunks_size[i]); - if(!dest->unknown_chunks_data[i] && dest->unknown_chunks_size[i]) return 83; /*alloc fail*/ - for(j = 0; j < src->unknown_chunks_size[i]; ++j) - { - dest->unknown_chunks_data[i][j] = src->unknown_chunks_data[i][j]; - } - } - - return 0; -} - -/******************************************************************************/ - -static void LodePNGText_init(LodePNGInfo* info) -{ - info->text_num = 0; - info->text_keys = NULL; - info->text_strings = NULL; -} - -static void LodePNGText_cleanup(LodePNGInfo* info) -{ - size_t i; - for(i = 0; i != info->text_num; ++i) - { - string_cleanup(&info->text_keys[i]); - string_cleanup(&info->text_strings[i]); - } - lodepng_free(info->text_keys); - lodepng_free(info->text_strings); -} - -static unsigned LodePNGText_copy(LodePNGInfo* dest, const LodePNGInfo* source) -{ - size_t i = 0; - dest->text_keys = 0; - dest->text_strings = 0; - dest->text_num = 0; - for(i = 0; i != source->text_num; ++i) - { - CERROR_TRY_RETURN(lodepng_add_text(dest, source->text_keys[i], source->text_strings[i])); - } - return 0; -} - -void lodepng_clear_text(LodePNGInfo* info) -{ - LodePNGText_cleanup(info); -} - -unsigned lodepng_add_text(LodePNGInfo* info, const char* key, const char* str) -{ - char** new_keys = (char**)(lodepng_realloc(info->text_keys, sizeof(char*) * (info->text_num + 1))); - char** new_strings = (char**)(lodepng_realloc(info->text_strings, sizeof(char*) * (info->text_num + 1))); - if(!new_keys || !new_strings) - { - lodepng_free(new_keys); - lodepng_free(new_strings); - return 83; /*alloc fail*/ - } - - ++info->text_num; - info->text_keys = new_keys; - info->text_strings = new_strings; - - string_init(&info->text_keys[info->text_num - 1]); - string_set(&info->text_keys[info->text_num - 1], key); - - string_init(&info->text_strings[info->text_num - 1]); - string_set(&info->text_strings[info->text_num - 1], str); - - return 0; -} - -/******************************************************************************/ - -static void LodePNGIText_init(LodePNGInfo* info) -{ - info->itext_num = 0; - info->itext_keys = NULL; - info->itext_langtags = NULL; - info->itext_transkeys = NULL; - info->itext_strings = NULL; -} - -static void LodePNGIText_cleanup(LodePNGInfo* info) -{ - size_t i; - for(i = 0; i != info->itext_num; ++i) - { - string_cleanup(&info->itext_keys[i]); - string_cleanup(&info->itext_langtags[i]); - string_cleanup(&info->itext_transkeys[i]); - string_cleanup(&info->itext_strings[i]); - } - lodepng_free(info->itext_keys); - lodepng_free(info->itext_langtags); - lodepng_free(info->itext_transkeys); - lodepng_free(info->itext_strings); -} - -static unsigned LodePNGIText_copy(LodePNGInfo* dest, const LodePNGInfo* source) -{ - size_t i = 0; - dest->itext_keys = 0; - dest->itext_langtags = 0; - dest->itext_transkeys = 0; - dest->itext_strings = 0; - dest->itext_num = 0; - for(i = 0; i != source->itext_num; ++i) - { - CERROR_TRY_RETURN(lodepng_add_itext(dest, source->itext_keys[i], source->itext_langtags[i], - source->itext_transkeys[i], source->itext_strings[i])); - } - return 0; -} - -void lodepng_clear_itext(LodePNGInfo* info) -{ - LodePNGIText_cleanup(info); -} - -unsigned lodepng_add_itext(LodePNGInfo* info, const char* key, const char* langtag, - const char* transkey, const char* str) -{ - char** new_keys = (char**)(lodepng_realloc(info->itext_keys, sizeof(char*) * (info->itext_num + 1))); - char** new_langtags = (char**)(lodepng_realloc(info->itext_langtags, sizeof(char*) * (info->itext_num + 1))); - char** new_transkeys = (char**)(lodepng_realloc(info->itext_transkeys, sizeof(char*) * (info->itext_num + 1))); - char** new_strings = (char**)(lodepng_realloc(info->itext_strings, sizeof(char*) * (info->itext_num + 1))); - if(!new_keys || !new_langtags || !new_transkeys || !new_strings) - { - lodepng_free(new_keys); - lodepng_free(new_langtags); - lodepng_free(new_transkeys); - lodepng_free(new_strings); - return 83; /*alloc fail*/ - } - - ++info->itext_num; - info->itext_keys = new_keys; - info->itext_langtags = new_langtags; - info->itext_transkeys = new_transkeys; - info->itext_strings = new_strings; - - string_init(&info->itext_keys[info->itext_num - 1]); - string_set(&info->itext_keys[info->itext_num - 1], key); - - string_init(&info->itext_langtags[info->itext_num - 1]); - string_set(&info->itext_langtags[info->itext_num - 1], langtag); - - string_init(&info->itext_transkeys[info->itext_num - 1]); - string_set(&info->itext_transkeys[info->itext_num - 1], transkey); - - string_init(&info->itext_strings[info->itext_num - 1]); - string_set(&info->itext_strings[info->itext_num - 1], str); - - return 0; -} -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ - -void lodepng_info_init(LodePNGInfo* info) -{ - lodepng_color_mode_init(&info->color); - info->interlace_method = 0; - info->compression_method = 0; - info->filter_method = 0; -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS - info->background_defined = 0; - info->background_r = info->background_g = info->background_b = 0; - - LodePNGText_init(info); - LodePNGIText_init(info); - - info->time_defined = 0; - info->phys_defined = 0; - - LodePNGUnknownChunks_init(info); -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ -} - -void lodepng_info_cleanup(LodePNGInfo* info) -{ - lodepng_color_mode_cleanup(&info->color); -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS - LodePNGText_cleanup(info); - LodePNGIText_cleanup(info); - - LodePNGUnknownChunks_cleanup(info); -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ -} - -unsigned lodepng_info_copy(LodePNGInfo* dest, const LodePNGInfo* source) -{ - lodepng_info_cleanup(dest); - *dest = *source; - lodepng_color_mode_init(&dest->color); - CERROR_TRY_RETURN(lodepng_color_mode_copy(&dest->color, &source->color)); - -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS - CERROR_TRY_RETURN(LodePNGText_copy(dest, source)); - CERROR_TRY_RETURN(LodePNGIText_copy(dest, source)); - - LodePNGUnknownChunks_init(dest); - CERROR_TRY_RETURN(LodePNGUnknownChunks_copy(dest, source)); -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ - return 0; -} - -void lodepng_info_swap(LodePNGInfo* a, LodePNGInfo* b) -{ - LodePNGInfo temp = *a; - *a = *b; - *b = temp; -} - -/* ////////////////////////////////////////////////////////////////////////// */ - -/*index: bitgroup index, bits: bitgroup size(1, 2 or 4), in: bitgroup value, out: octet array to add bits to*/ -static void addColorBits(unsigned char* out, size_t index, unsigned bits, unsigned in) -{ - unsigned m = bits == 1 ? 7 : bits == 2 ? 3 : 1; /*8 / bits - 1*/ - /*p = the partial index in the byte, e.g. with 4 palettebits it is 0 for first half or 1 for second half*/ - unsigned p = index & m; - in &= (1u << bits) - 1u; /*filter out any other bits of the input value*/ - in = in << (bits * (m - p)); - if(p == 0) out[index * bits / 8] = in; - else out[index * bits / 8] |= in; -} - -typedef struct ColorTree ColorTree; - -/* -One node of a color tree -This is the data structure used to count the number of unique colors and to get a palette -index for a color. It's like an octree, but because the alpha channel is used too, each -node has 16 instead of 8 children. -*/ -struct ColorTree -{ - ColorTree* children[16]; /*up to 16 pointers to ColorTree of next level*/ - int index; /*the payload. Only has a meaningful value if this is in the last level*/ -}; - -static void color_tree_init(ColorTree* tree) -{ - int i; - for(i = 0; i != 16; ++i) tree->children[i] = 0; - tree->index = -1; -} - -static void color_tree_cleanup(ColorTree* tree) -{ - int i; - for(i = 0; i != 16; ++i) - { - if(tree->children[i]) - { - color_tree_cleanup(tree->children[i]); - lodepng_free(tree->children[i]); - } - } -} - -/*returns -1 if color not present, its index otherwise*/ -static int color_tree_get(ColorTree* tree, unsigned char r, unsigned char g, unsigned char b, unsigned char a) -{ - int bit = 0; - for(bit = 0; bit < 8; ++bit) - { - int i = 8 * ((r >> bit) & 1) + 4 * ((g >> bit) & 1) + 2 * ((b >> bit) & 1) + 1 * ((a >> bit) & 1); - if(!tree->children[i]) return -1; - else tree = tree->children[i]; - } - return tree ? tree->index : -1; -} - -#ifdef LODEPNG_COMPILE_ENCODER -static int color_tree_has(ColorTree* tree, unsigned char r, unsigned char g, unsigned char b, unsigned char a) -{ - return color_tree_get(tree, r, g, b, a) >= 0; -} -#endif /*LODEPNG_COMPILE_ENCODER*/ - -/*color is not allowed to already exist. -Index should be >= 0 (it's signed to be compatible with using -1 for "doesn't exist")*/ -static void color_tree_add(ColorTree* tree, - unsigned char r, unsigned char g, unsigned char b, unsigned char a, unsigned index) -{ - int bit; - for(bit = 0; bit < 8; ++bit) - { - int i = 8 * ((r >> bit) & 1) + 4 * ((g >> bit) & 1) + 2 * ((b >> bit) & 1) + 1 * ((a >> bit) & 1); - if(!tree->children[i]) - { - tree->children[i] = (ColorTree*)lodepng_malloc(sizeof(ColorTree)); - color_tree_init(tree->children[i]); - } - tree = tree->children[i]; - } - tree->index = (int)index; -} - -/*put a pixel, given its RGBA color, into image of any color type*/ -static unsigned rgba8ToPixel(unsigned char* out, size_t i, - const LodePNGColorMode* mode, ColorTree* tree /*for palette*/, - unsigned char r, unsigned char g, unsigned char b, unsigned char a) -{ - if(mode->colortype == LCT_GREY) - { - unsigned char grey = r; /*((unsigned short)r + g + b) / 3*/; - if(mode->bitdepth == 8) out[i] = grey; - else if(mode->bitdepth == 16) out[i * 2 + 0] = out[i * 2 + 1] = grey; - else - { - /*take the most significant bits of grey*/ - grey = (grey >> (8 - mode->bitdepth)) & ((1 << mode->bitdepth) - 1); - addColorBits(out, i, mode->bitdepth, grey); - } - } - else if(mode->colortype == LCT_RGB) - { - if(mode->bitdepth == 8) - { - out[i * 3 + 0] = r; - out[i * 3 + 1] = g; - out[i * 3 + 2] = b; - } - else - { - out[i * 6 + 0] = out[i * 6 + 1] = r; - out[i * 6 + 2] = out[i * 6 + 3] = g; - out[i * 6 + 4] = out[i * 6 + 5] = b; - } - } - else if(mode->colortype == LCT_PALETTE) - { - int index = color_tree_get(tree, r, g, b, a); - if(index < 0) return 82; /*color not in palette*/ - if(mode->bitdepth == 8) out[i] = index; - else addColorBits(out, i, mode->bitdepth, (unsigned)index); - } - else if(mode->colortype == LCT_GREY_ALPHA) - { - unsigned char grey = r; /*((unsigned short)r + g + b) / 3*/; - if(mode->bitdepth == 8) - { - out[i * 2 + 0] = grey; - out[i * 2 + 1] = a; - } - else if(mode->bitdepth == 16) - { - out[i * 4 + 0] = out[i * 4 + 1] = grey; - out[i * 4 + 2] = out[i * 4 + 3] = a; - } - } - else if(mode->colortype == LCT_RGBA) - { - if(mode->bitdepth == 8) - { - out[i * 4 + 0] = r; - out[i * 4 + 1] = g; - out[i * 4 + 2] = b; - out[i * 4 + 3] = a; - } - else - { - out[i * 8 + 0] = out[i * 8 + 1] = r; - out[i * 8 + 2] = out[i * 8 + 3] = g; - out[i * 8 + 4] = out[i * 8 + 5] = b; - out[i * 8 + 6] = out[i * 8 + 7] = a; - } - } - - return 0; /*no error*/ -} - -/*put a pixel, given its RGBA16 color, into image of any color 16-bitdepth type*/ -static void rgba16ToPixel(unsigned char* out, size_t i, - const LodePNGColorMode* mode, - unsigned short r, unsigned short g, unsigned short b, unsigned short a) -{ - if(mode->colortype == LCT_GREY) - { - unsigned short grey = r; /*((unsigned)r + g + b) / 3*/; - out[i * 2 + 0] = (grey >> 8) & 255; - out[i * 2 + 1] = grey & 255; - } - else if(mode->colortype == LCT_RGB) - { - out[i * 6 + 0] = (r >> 8) & 255; - out[i * 6 + 1] = r & 255; - out[i * 6 + 2] = (g >> 8) & 255; - out[i * 6 + 3] = g & 255; - out[i * 6 + 4] = (b >> 8) & 255; - out[i * 6 + 5] = b & 255; - } - else if(mode->colortype == LCT_GREY_ALPHA) - { - unsigned short grey = r; /*((unsigned)r + g + b) / 3*/; - out[i * 4 + 0] = (grey >> 8) & 255; - out[i * 4 + 1] = grey & 255; - out[i * 4 + 2] = (a >> 8) & 255; - out[i * 4 + 3] = a & 255; - } - else if(mode->colortype == LCT_RGBA) - { - out[i * 8 + 0] = (r >> 8) & 255; - out[i * 8 + 1] = r & 255; - out[i * 8 + 2] = (g >> 8) & 255; - out[i * 8 + 3] = g & 255; - out[i * 8 + 4] = (b >> 8) & 255; - out[i * 8 + 5] = b & 255; - out[i * 8 + 6] = (a >> 8) & 255; - out[i * 8 + 7] = a & 255; - } -} - -/*Get RGBA8 color of pixel with index i (y * width + x) from the raw image with given color type.*/ -static void getPixelColorRGBA8(unsigned char* r, unsigned char* g, - unsigned char* b, unsigned char* a, - const unsigned char* in, size_t i, - const LodePNGColorMode* mode) -{ - if(mode->colortype == LCT_GREY) - { - if(mode->bitdepth == 8) - { - *r = *g = *b = in[i]; - if(mode->key_defined && *r == mode->key_r) *a = 0; - else *a = 255; - } - else if(mode->bitdepth == 16) - { - *r = *g = *b = in[i * 2 + 0]; - if(mode->key_defined && 256U * in[i * 2 + 0] + in[i * 2 + 1] == mode->key_r) *a = 0; - else *a = 255; - } - else - { - unsigned highest = ((1U << mode->bitdepth) - 1U); /*highest possible value for this bit depth*/ - size_t j = i * mode->bitdepth; - unsigned value = readBitsFromReversedStream(&j, in, mode->bitdepth); - *r = *g = *b = (value * 255) / highest; - if(mode->key_defined && value == mode->key_r) *a = 0; - else *a = 255; - } - } - else if(mode->colortype == LCT_RGB) - { - if(mode->bitdepth == 8) - { - *r = in[i * 3 + 0]; *g = in[i * 3 + 1]; *b = in[i * 3 + 2]; - if(mode->key_defined && *r == mode->key_r && *g == mode->key_g && *b == mode->key_b) *a = 0; - else *a = 255; - } - else - { - *r = in[i * 6 + 0]; - *g = in[i * 6 + 2]; - *b = in[i * 6 + 4]; - if(mode->key_defined && 256U * in[i * 6 + 0] + in[i * 6 + 1] == mode->key_r - && 256U * in[i * 6 + 2] + in[i * 6 + 3] == mode->key_g - && 256U * in[i * 6 + 4] + in[i * 6 + 5] == mode->key_b) *a = 0; - else *a = 255; - } - } - else if(mode->colortype == LCT_PALETTE) - { - unsigned index; - if(mode->bitdepth == 8) index = in[i]; - else - { - size_t j = i * mode->bitdepth; - index = readBitsFromReversedStream(&j, in, mode->bitdepth); - } - - if(index >= mode->palettesize) - { - /*This is an error according to the PNG spec, but common PNG decoders make it black instead. - Done here too, slightly faster due to no error handling needed.*/ - *r = *g = *b = 0; - *a = 255; - } - else - { - *r = mode->palette[index * 4 + 0]; - *g = mode->palette[index * 4 + 1]; - *b = mode->palette[index * 4 + 2]; - *a = mode->palette[index * 4 + 3]; - } - } - else if(mode->colortype == LCT_GREY_ALPHA) - { - if(mode->bitdepth == 8) - { - *r = *g = *b = in[i * 2 + 0]; - *a = in[i * 2 + 1]; - } - else - { - *r = *g = *b = in[i * 4 + 0]; - *a = in[i * 4 + 2]; - } - } - else if(mode->colortype == LCT_RGBA) - { - if(mode->bitdepth == 8) - { - *r = in[i * 4 + 0]; - *g = in[i * 4 + 1]; - *b = in[i * 4 + 2]; - *a = in[i * 4 + 3]; - } - else - { - *r = in[i * 8 + 0]; - *g = in[i * 8 + 2]; - *b = in[i * 8 + 4]; - *a = in[i * 8 + 6]; - } - } -} - -/*Similar to getPixelColorRGBA8, but with all the for loops inside of the color -mode test cases, optimized to convert the colors much faster, when converting -to RGBA or RGB with 8 bit per cannel. buffer must be RGBA or RGB output with -enough memory, if has_alpha is true the output is RGBA. mode has the color mode -of the input buffer.*/ -static void getPixelColorsRGBA8(unsigned char* buffer, size_t numpixels, - unsigned has_alpha, const unsigned char* in, - const LodePNGColorMode* mode) -{ - unsigned num_channels = has_alpha ? 4 : 3; - size_t i; - if(mode->colortype == LCT_GREY) - { - if(mode->bitdepth == 8) - { - for(i = 0; i != numpixels; ++i, buffer += num_channels) - { - buffer[0] = buffer[1] = buffer[2] = in[i]; - if(has_alpha) buffer[3] = mode->key_defined && in[i] == mode->key_r ? 0 : 255; - } - } - else if(mode->bitdepth == 16) - { - for(i = 0; i != numpixels; ++i, buffer += num_channels) - { - buffer[0] = buffer[1] = buffer[2] = in[i * 2]; - if(has_alpha) buffer[3] = mode->key_defined && 256U * in[i * 2 + 0] + in[i * 2 + 1] == mode->key_r ? 0 : 255; - } - } - else - { - unsigned highest = ((1U << mode->bitdepth) - 1U); /*highest possible value for this bit depth*/ - size_t j = 0; - for(i = 0; i != numpixels; ++i, buffer += num_channels) - { - unsigned value = readBitsFromReversedStream(&j, in, mode->bitdepth); - buffer[0] = buffer[1] = buffer[2] = (value * 255) / highest; - if(has_alpha) buffer[3] = mode->key_defined && value == mode->key_r ? 0 : 255; - } - } - } - else if(mode->colortype == LCT_RGB) - { - if(mode->bitdepth == 8) - { - for(i = 0; i != numpixels; ++i, buffer += num_channels) - { - buffer[0] = in[i * 3 + 0]; - buffer[1] = in[i * 3 + 1]; - buffer[2] = in[i * 3 + 2]; - if(has_alpha) buffer[3] = mode->key_defined && buffer[0] == mode->key_r - && buffer[1]== mode->key_g && buffer[2] == mode->key_b ? 0 : 255; - } - } - else - { - for(i = 0; i != numpixels; ++i, buffer += num_channels) - { - buffer[0] = in[i * 6 + 0]; - buffer[1] = in[i * 6 + 2]; - buffer[2] = in[i * 6 + 4]; - if(has_alpha) buffer[3] = mode->key_defined - && 256U * in[i * 6 + 0] + in[i * 6 + 1] == mode->key_r - && 256U * in[i * 6 + 2] + in[i * 6 + 3] == mode->key_g - && 256U * in[i * 6 + 4] + in[i * 6 + 5] == mode->key_b ? 0 : 255; - } - } - } - else if(mode->colortype == LCT_PALETTE) - { - unsigned index; - size_t j = 0; - for(i = 0; i != numpixels; ++i, buffer += num_channels) - { - if(mode->bitdepth == 8) index = in[i]; - else index = readBitsFromReversedStream(&j, in, mode->bitdepth); - - if(index >= mode->palettesize) - { - /*This is an error according to the PNG spec, but most PNG decoders make it black instead. - Done here too, slightly faster due to no error handling needed.*/ - buffer[0] = buffer[1] = buffer[2] = 0; - if(has_alpha) buffer[3] = 255; - } - else - { - buffer[0] = mode->palette[index * 4 + 0]; - buffer[1] = mode->palette[index * 4 + 1]; - buffer[2] = mode->palette[index * 4 + 2]; - if(has_alpha) buffer[3] = mode->palette[index * 4 + 3]; - } - } - } - else if(mode->colortype == LCT_GREY_ALPHA) - { - if(mode->bitdepth == 8) - { - for(i = 0; i != numpixels; ++i, buffer += num_channels) - { - buffer[0] = buffer[1] = buffer[2] = in[i * 2 + 0]; - if(has_alpha) buffer[3] = in[i * 2 + 1]; - } - } - else - { - for(i = 0; i != numpixels; ++i, buffer += num_channels) - { - buffer[0] = buffer[1] = buffer[2] = in[i * 4 + 0]; - if(has_alpha) buffer[3] = in[i * 4 + 2]; - } - } - } - else if(mode->colortype == LCT_RGBA) - { - if(mode->bitdepth == 8) - { - for(i = 0; i != numpixels; ++i, buffer += num_channels) - { - buffer[0] = in[i * 4 + 0]; - buffer[1] = in[i * 4 + 1]; - buffer[2] = in[i * 4 + 2]; - if(has_alpha) buffer[3] = in[i * 4 + 3]; - } - } - else - { - for(i = 0; i != numpixels; ++i, buffer += num_channels) - { - buffer[0] = in[i * 8 + 0]; - buffer[1] = in[i * 8 + 2]; - buffer[2] = in[i * 8 + 4]; - if(has_alpha) buffer[3] = in[i * 8 + 6]; - } - } - } -} - -/*Get RGBA16 color of pixel with index i (y * width + x) from the raw image with -given color type, but the given color type must be 16-bit itself.*/ -static void getPixelColorRGBA16(unsigned short* r, unsigned short* g, unsigned short* b, unsigned short* a, - const unsigned char* in, size_t i, const LodePNGColorMode* mode) -{ - if(mode->colortype == LCT_GREY) - { - *r = *g = *b = 256 * in[i * 2 + 0] + in[i * 2 + 1]; - if(mode->key_defined && 256U * in[i * 2 + 0] + in[i * 2 + 1] == mode->key_r) *a = 0; - else *a = 65535; - } - else if(mode->colortype == LCT_RGB) - { - *r = 256u * in[i * 6 + 0] + in[i * 6 + 1]; - *g = 256u * in[i * 6 + 2] + in[i * 6 + 3]; - *b = 256u * in[i * 6 + 4] + in[i * 6 + 5]; - if(mode->key_defined - && 256u * in[i * 6 + 0] + in[i * 6 + 1] == mode->key_r - && 256u * in[i * 6 + 2] + in[i * 6 + 3] == mode->key_g - && 256u * in[i * 6 + 4] + in[i * 6 + 5] == mode->key_b) *a = 0; - else *a = 65535; - } - else if(mode->colortype == LCT_GREY_ALPHA) - { - *r = *g = *b = 256u * in[i * 4 + 0] + in[i * 4 + 1]; - *a = 256u * in[i * 4 + 2] + in[i * 4 + 3]; - } - else if(mode->colortype == LCT_RGBA) - { - *r = 256u * in[i * 8 + 0] + in[i * 8 + 1]; - *g = 256u * in[i * 8 + 2] + in[i * 8 + 3]; - *b = 256u * in[i * 8 + 4] + in[i * 8 + 5]; - *a = 256u * in[i * 8 + 6] + in[i * 8 + 7]; - } -} - -unsigned lodepng_convert(unsigned char* out, const unsigned char* in, - const LodePNGColorMode* mode_out, const LodePNGColorMode* mode_in, - unsigned w, unsigned h) -{ - size_t i; - ColorTree tree; - size_t numpixels = w * h; - unsigned error = 0; - - if(lodepng_color_mode_equal(mode_out, mode_in)) - { - size_t numbytes = lodepng_get_raw_size(w, h, mode_in); - for(i = 0; i != numbytes; ++i) out[i] = in[i]; - return 0; - } - - if(mode_out->colortype == LCT_PALETTE) - { - size_t palettesize = mode_out->palettesize; - const unsigned char* palette = mode_out->palette; - size_t palsize = 1u << mode_out->bitdepth; - /*if the user specified output palette but did not give the values, assume - they want the values of the input color type (assuming that one is palette). - Note that we never create a new palette ourselves.*/ - if(palettesize == 0) - { - palettesize = mode_in->palettesize; - palette = mode_in->palette; - } - if(palettesize < palsize) palsize = palettesize; - color_tree_init(&tree); - for(i = 0; i != palsize; ++i) - { - const unsigned char* p = &palette[i * 4]; - color_tree_add(&tree, p[0], p[1], p[2], p[3], i); - } - } - - if(mode_in->bitdepth == 16 && mode_out->bitdepth == 16) - { - for(i = 0; i != numpixels; ++i) - { - unsigned short r = 0, g = 0, b = 0, a = 0; - getPixelColorRGBA16(&r, &g, &b, &a, in, i, mode_in); - rgba16ToPixel(out, i, mode_out, r, g, b, a); - } - } - else if(mode_out->bitdepth == 8 && mode_out->colortype == LCT_RGBA) - { - getPixelColorsRGBA8(out, numpixels, 1, in, mode_in); - } - else if(mode_out->bitdepth == 8 && mode_out->colortype == LCT_RGB) - { - getPixelColorsRGBA8(out, numpixels, 0, in, mode_in); - } - else - { - unsigned char r = 0, g = 0, b = 0, a = 0; - for(i = 0; i != numpixels; ++i) - { - getPixelColorRGBA8(&r, &g, &b, &a, in, i, mode_in); - error = rgba8ToPixel(out, i, mode_out, &tree, r, g, b, a); - if (error) break; - } - } - - if(mode_out->colortype == LCT_PALETTE) - { - color_tree_cleanup(&tree); - } - - return error; -} - -#ifdef LODEPNG_COMPILE_ENCODER - -void lodepng_color_profile_init(LodePNGColorProfile* profile) -{ - profile->colored = 0; - profile->key = 0; - profile->key_r = profile->key_g = profile->key_b = 0; - profile->alpha = 0; - profile->numcolors = 0; - profile->bits = 1; -} - -/*function used for debug purposes with C++*/ -/*void printColorProfile(LodePNGColorProfile* p) -{ - std::cout << "colored: " << (int)p->colored << ", "; - std::cout << "key: " << (int)p->key << ", "; - std::cout << "key_r: " << (int)p->key_r << ", "; - std::cout << "key_g: " << (int)p->key_g << ", "; - std::cout << "key_b: " << (int)p->key_b << ", "; - std::cout << "alpha: " << (int)p->alpha << ", "; - std::cout << "numcolors: " << (int)p->numcolors << ", "; - std::cout << "bits: " << (int)p->bits << std::endl; -}*/ - -/*Returns how many bits needed to represent given value (max 8 bit)*/ -static unsigned getValueRequiredBits(unsigned char value) -{ - if(value == 0 || value == 255) return 1; - /*The scaling of 2-bit and 4-bit values uses multiples of 85 and 17*/ - if(value % 17 == 0) return value % 85 == 0 ? 2 : 4; - return 8; -} - -/*profile must already have been inited with mode. -It's ok to set some parameters of profile to done already.*/ -unsigned lodepng_get_color_profile(LodePNGColorProfile* profile, - const unsigned char* in, unsigned w, unsigned h, - const LodePNGColorMode* mode) -{ - unsigned error = 0; - size_t i; - ColorTree tree; - size_t numpixels = w * h; - - unsigned colored_done = lodepng_is_greyscale_type(mode) ? 1 : 0; - unsigned alpha_done = lodepng_can_have_alpha(mode) ? 0 : 1; - unsigned numcolors_done = 0; - unsigned bpp = lodepng_get_bpp(mode); - unsigned bits_done = bpp == 1 ? 1 : 0; - unsigned maxnumcolors = 257; - unsigned sixteen = 0; - if(bpp <= 8) maxnumcolors = bpp == 1 ? 2 : (bpp == 2 ? 4 : (bpp == 4 ? 16 : 256)); - - color_tree_init(&tree); - - /*Check if the 16-bit input is truly 16-bit*/ - if(mode->bitdepth == 16) - { - unsigned short r, g, b, a; - for(i = 0; i != numpixels; ++i) - { - getPixelColorRGBA16(&r, &g, &b, &a, in, i, mode); - if((r & 255) != ((r >> 8) & 255) || (g & 255) != ((g >> 8) & 255) || - (b & 255) != ((b >> 8) & 255) || (a & 255) != ((a >> 8) & 255)) /*first and second byte differ*/ - { - sixteen = 1; - break; - } - } - } - - if(sixteen) - { - unsigned short r = 0, g = 0, b = 0, a = 0; - profile->bits = 16; - bits_done = numcolors_done = 1; /*counting colors no longer useful, palette doesn't support 16-bit*/ - - for(i = 0; i != numpixels; ++i) - { - getPixelColorRGBA16(&r, &g, &b, &a, in, i, mode); - - if(!colored_done && (r != g || r != b)) - { - profile->colored = 1; - colored_done = 1; - } - - if(!alpha_done) - { - unsigned matchkey = (r == profile->key_r && g == profile->key_g && b == profile->key_b); - if(a != 65535 && (a != 0 || (profile->key && !matchkey))) - { - profile->alpha = 1; - profile->key = 0; - alpha_done = 1; - } - else if(a == 0 && !profile->alpha && !profile->key) - { - profile->key = 1; - profile->key_r = r; - profile->key_g = g; - profile->key_b = b; - } - else if(a == 65535 && profile->key && matchkey) - { - /* Color key cannot be used if an opaque pixel also has that RGB color. */ - profile->alpha = 1; - profile->key = 0; - alpha_done = 1; - } - } - if(alpha_done && numcolors_done && colored_done && bits_done) break; - } - - if(profile->key && !profile->alpha) - { - for(i = 0; i != numpixels; ++i) - { - getPixelColorRGBA16(&r, &g, &b, &a, in, i, mode); - if(a != 0 && r == profile->key_r && g == profile->key_g && b == profile->key_b) - { - /* Color key cannot be used if an opaque pixel also has that RGB color. */ - profile->alpha = 1; - profile->key = 0; - alpha_done = 1; - } - } - } - } - else /* < 16-bit */ - { - unsigned char r = 0, g = 0, b = 0, a = 0; - for(i = 0; i != numpixels; ++i) - { - getPixelColorRGBA8(&r, &g, &b, &a, in, i, mode); - - if(!bits_done && profile->bits < 8) - { - /*only r is checked, < 8 bits is only relevant for greyscale*/ - unsigned bits = getValueRequiredBits(r); - if(bits > profile->bits) profile->bits = bits; - } - bits_done = (profile->bits >= bpp); - - if(!colored_done && (r != g || r != b)) - { - profile->colored = 1; - colored_done = 1; - if(profile->bits < 8) profile->bits = 8; /*PNG has no colored modes with less than 8-bit per channel*/ - } - - if(!alpha_done) - { - unsigned matchkey = (r == profile->key_r && g == profile->key_g && b == profile->key_b); - if(a != 255 && (a != 0 || (profile->key && !matchkey))) - { - profile->alpha = 1; - profile->key = 0; - alpha_done = 1; - if(profile->bits < 8) profile->bits = 8; /*PNG has no alphachannel modes with less than 8-bit per channel*/ - } - else if(a == 0 && !profile->alpha && !profile->key) - { - profile->key = 1; - profile->key_r = r; - profile->key_g = g; - profile->key_b = b; - } - else if(a == 255 && profile->key && matchkey) - { - /* Color key cannot be used if an opaque pixel also has that RGB color. */ - profile->alpha = 1; - profile->key = 0; - alpha_done = 1; - if(profile->bits < 8) profile->bits = 8; /*PNG has no alphachannel modes with less than 8-bit per channel*/ - } - } - - if(!numcolors_done) - { - if(!color_tree_has(&tree, r, g, b, a)) - { - color_tree_add(&tree, r, g, b, a, profile->numcolors); - if(profile->numcolors < 256) - { - unsigned char* p = profile->palette; - unsigned n = profile->numcolors; - p[n * 4 + 0] = r; - p[n * 4 + 1] = g; - p[n * 4 + 2] = b; - p[n * 4 + 3] = a; - } - ++profile->numcolors; - numcolors_done = profile->numcolors >= maxnumcolors; - } - } - - if(alpha_done && numcolors_done && colored_done && bits_done) break; - } - - if(profile->key && !profile->alpha) - { - for(i = 0; i != numpixels; ++i) - { - getPixelColorRGBA8(&r, &g, &b, &a, in, i, mode); - if(a != 0 && r == profile->key_r && g == profile->key_g && b == profile->key_b) - { - /* Color key cannot be used if an opaque pixel also has that RGB color. */ - profile->alpha = 1; - profile->key = 0; - alpha_done = 1; - if(profile->bits < 8) profile->bits = 8; /*PNG has no alphachannel modes with less than 8-bit per channel*/ - } - } - } - - /*make the profile's key always 16-bit for consistency - repeat each byte twice*/ - profile->key_r += (profile->key_r << 8); - profile->key_g += (profile->key_g << 8); - profile->key_b += (profile->key_b << 8); - } - - color_tree_cleanup(&tree); - return error; -} - -/*Automatically chooses color type that gives smallest amount of bits in the -output image, e.g. grey if there are only greyscale pixels, palette if there -are less than 256 colors, ... -Updates values of mode with a potentially smaller color model. mode_out should -contain the user chosen color model, but will be overwritten with the new chosen one.*/ -unsigned lodepng_auto_choose_color(LodePNGColorMode* mode_out, - const unsigned char* image, unsigned w, unsigned h, - const LodePNGColorMode* mode_in) -{ - LodePNGColorProfile prof; - unsigned error = 0; - unsigned i, n, palettebits, palette_ok; - - lodepng_color_profile_init(&prof); - error = lodepng_get_color_profile(&prof, image, w, h, mode_in); - if(error) return error; - mode_out->key_defined = 0; - - if(prof.key && w * h <= 16) - { - prof.alpha = 1; /*too few pixels to justify tRNS chunk overhead*/ - prof.key = 0; - if(prof.bits < 8) prof.bits = 8; /*PNG has no alphachannel modes with less than 8-bit per channel*/ - } - n = prof.numcolors; - palettebits = n <= 2 ? 1 : (n <= 4 ? 2 : (n <= 16 ? 4 : 8)); - palette_ok = n <= 256 && prof.bits <= 8; - if(w * h < n * 2) palette_ok = 0; /*don't add palette overhead if image has only a few pixels*/ - if(!prof.colored && prof.bits <= palettebits) palette_ok = 0; /*grey is less overhead*/ - - if(palette_ok) - { - unsigned char* p = prof.palette; - lodepng_palette_clear(mode_out); /*remove potential earlier palette*/ - for(i = 0; i != prof.numcolors; ++i) - { - error = lodepng_palette_add(mode_out, p[i * 4 + 0], p[i * 4 + 1], p[i * 4 + 2], p[i * 4 + 3]); - if(error) break; - } - - mode_out->colortype = LCT_PALETTE; - mode_out->bitdepth = palettebits; - - if(mode_in->colortype == LCT_PALETTE && mode_in->palettesize >= mode_out->palettesize - && mode_in->bitdepth == mode_out->bitdepth) - { - /*If input should have same palette colors, keep original to preserve its order and prevent conversion*/ - lodepng_color_mode_cleanup(mode_out); - lodepng_color_mode_copy(mode_out, mode_in); - } - } - else /*8-bit or 16-bit per channel*/ - { - mode_out->bitdepth = prof.bits; - mode_out->colortype = prof.alpha ? (prof.colored ? LCT_RGBA : LCT_GREY_ALPHA) - : (prof.colored ? LCT_RGB : LCT_GREY); - - if(prof.key) - { - unsigned mask = (1u << mode_out->bitdepth) - 1u; /*profile always uses 16-bit, mask converts it*/ - mode_out->key_r = prof.key_r & mask; - mode_out->key_g = prof.key_g & mask; - mode_out->key_b = prof.key_b & mask; - mode_out->key_defined = 1; - } - } - - return error; -} - -#endif /* #ifdef LODEPNG_COMPILE_ENCODER */ - -/* -Paeth predicter, used by PNG filter type 4 -The parameters are of type short, but should come from unsigned chars, the shorts -are only needed to make the paeth calculation correct. -*/ -static unsigned char paethPredictor(short a, short b, short c) -{ - short pa = abs(b - c); - short pb = abs(a - c); - short pc = abs(a + b - c - c); - - if(pc < pa && pc < pb) return (unsigned char)c; - else if(pb < pa) return (unsigned char)b; - else return (unsigned char)a; -} - -/*shared values used by multiple Adam7 related functions*/ - -static const unsigned ADAM7_IX[7] = { 0, 4, 0, 2, 0, 1, 0 }; /*x start values*/ -static const unsigned ADAM7_IY[7] = { 0, 0, 4, 0, 2, 0, 1 }; /*y start values*/ -static const unsigned ADAM7_DX[7] = { 8, 8, 4, 4, 2, 2, 1 }; /*x delta values*/ -static const unsigned ADAM7_DY[7] = { 8, 8, 8, 4, 4, 2, 2 }; /*y delta values*/ - -/* -Outputs various dimensions and positions in the image related to the Adam7 reduced images. -passw: output containing the width of the 7 passes -passh: output containing the height of the 7 passes -filter_passstart: output containing the index of the start and end of each - reduced image with filter bytes -padded_passstart output containing the index of the start and end of each - reduced image when without filter bytes but with padded scanlines -passstart: output containing the index of the start and end of each reduced - image without padding between scanlines, but still padding between the images -w, h: width and height of non-interlaced image -bpp: bits per pixel -"padded" is only relevant if bpp is less than 8 and a scanline or image does not - end at a full byte -*/ -static void Adam7_getpassvalues(unsigned passw[7], unsigned passh[7], size_t filter_passstart[8], - size_t padded_passstart[8], size_t passstart[8], unsigned w, unsigned h, unsigned bpp) -{ - /*the passstart values have 8 values: the 8th one indicates the byte after the end of the 7th (= last) pass*/ - unsigned i; - - /*calculate width and height in pixels of each pass*/ - for(i = 0; i != 7; ++i) - { - passw[i] = (w + ADAM7_DX[i] - ADAM7_IX[i] - 1) / ADAM7_DX[i]; - passh[i] = (h + ADAM7_DY[i] - ADAM7_IY[i] - 1) / ADAM7_DY[i]; - if(passw[i] == 0) passh[i] = 0; - if(passh[i] == 0) passw[i] = 0; - } - - filter_passstart[0] = padded_passstart[0] = passstart[0] = 0; - for(i = 0; i != 7; ++i) - { - /*if passw[i] is 0, it's 0 bytes, not 1 (no filtertype-byte)*/ - filter_passstart[i + 1] = filter_passstart[i] - + ((passw[i] && passh[i]) ? passh[i] * (1 + (passw[i] * bpp + 7) / 8) : 0); - /*bits padded if needed to fill full byte at end of each scanline*/ - padded_passstart[i + 1] = padded_passstart[i] + passh[i] * ((passw[i] * bpp + 7) / 8); - /*only padded at end of reduced image*/ - passstart[i + 1] = passstart[i] + (passh[i] * passw[i] * bpp + 7) / 8; - } -} - -#ifdef LODEPNG_COMPILE_DECODER - -/* ////////////////////////////////////////////////////////////////////////// */ -/* / PNG Decoder / */ -/* ////////////////////////////////////////////////////////////////////////// */ - -/*read the information from the header and store it in the LodePNGInfo. return value is error*/ -unsigned lodepng_inspect(unsigned* w, unsigned* h, LodePNGState* state, - const unsigned char* in, size_t insize) -{ - LodePNGInfo* info = &state->info_png; - if(insize == 0 || in == 0) - { - CERROR_RETURN_ERROR(state->error, 48); /*error: the given data is empty*/ - } - if(insize < 33) - { - CERROR_RETURN_ERROR(state->error, 27); /*error: the data length is smaller than the length of a PNG header*/ - } - - /*when decoding a new PNG image, make sure all parameters created after previous decoding are reset*/ - lodepng_info_cleanup(info); - lodepng_info_init(info); - - if(in[0] != 137 || in[1] != 80 || in[2] != 78 || in[3] != 71 - || in[4] != 13 || in[5] != 10 || in[6] != 26 || in[7] != 10) - { - CERROR_RETURN_ERROR(state->error, 28); /*error: the first 8 bytes are not the correct PNG signature*/ - } - if(lodepng_chunk_length(in + 8) != 13) - { - CERROR_RETURN_ERROR(state->error, 94); /*error: header size must be 13 bytes*/ - } - if(!lodepng_chunk_type_equals(in + 8, "IHDR")) - { - CERROR_RETURN_ERROR(state->error, 29); /*error: it doesn't start with a IHDR chunk!*/ - } - - /*read the values given in the header*/ - *w = lodepng_read32bitInt(&in[16]); - *h = lodepng_read32bitInt(&in[20]); - info->color.bitdepth = in[24]; - info->color.colortype = (LodePNGColorType)in[25]; - info->compression_method = in[26]; - info->filter_method = in[27]; - info->interlace_method = in[28]; - - if(*w == 0 || *h == 0) - { - CERROR_RETURN_ERROR(state->error, 93); - } - - if(!state->decoder.ignore_crc) - { - unsigned CRC = lodepng_read32bitInt(&in[29]); - unsigned checksum = lodepng_crc32(&in[12], 17); - if(CRC != checksum) - { - CERROR_RETURN_ERROR(state->error, 57); /*invalid CRC*/ - } - } - - /*error: only compression method 0 is allowed in the specification*/ - if(info->compression_method != 0) CERROR_RETURN_ERROR(state->error, 32); - /*error: only filter method 0 is allowed in the specification*/ - if(info->filter_method != 0) CERROR_RETURN_ERROR(state->error, 33); - /*error: only interlace methods 0 and 1 exist in the specification*/ - if(info->interlace_method > 1) CERROR_RETURN_ERROR(state->error, 34); - - state->error = checkColorValidity(info->color.colortype, info->color.bitdepth); - return state->error; -} - -static unsigned unfilterScanline(unsigned char* recon, const unsigned char* scanline, const unsigned char* precon, - size_t bytewidth, unsigned char filterType, size_t length) -{ - /* - For PNG filter method 0 - unfilter a PNG image scanline by scanline. when the pixels are smaller than 1 byte, - the filter works byte per byte (bytewidth = 1) - precon is the previous unfiltered scanline, recon the result, scanline the current one - the incoming scanlines do NOT include the filtertype byte, that one is given in the parameter filterType instead - recon and scanline MAY be the same memory address! precon must be disjoint. - */ - - size_t i; - switch(filterType) - { - case 0: - for(i = 0; i != length; ++i) recon[i] = scanline[i]; - break; - case 1: - for(i = 0; i != bytewidth; ++i) recon[i] = scanline[i]; - for(i = bytewidth; i < length; ++i) recon[i] = scanline[i] + recon[i - bytewidth]; - break; - case 2: - if(precon) - { - for(i = 0; i != length; ++i) recon[i] = scanline[i] + precon[i]; - } - else - { - for(i = 0; i != length; ++i) recon[i] = scanline[i]; - } - break; - case 3: - if(precon) - { - for(i = 0; i != bytewidth; ++i) recon[i] = scanline[i] + (precon[i] >> 1); - for(i = bytewidth; i < length; ++i) recon[i] = scanline[i] + ((recon[i - bytewidth] + precon[i]) >> 1); - } - else - { - for(i = 0; i != bytewidth; ++i) recon[i] = scanline[i]; - for(i = bytewidth; i < length; ++i) recon[i] = scanline[i] + (recon[i - bytewidth] >> 1); - } - break; - case 4: - if(precon) - { - for(i = 0; i != bytewidth; ++i) - { - recon[i] = (scanline[i] + precon[i]); /*paethPredictor(0, precon[i], 0) is always precon[i]*/ - } - for(i = bytewidth; i < length; ++i) - { - recon[i] = (scanline[i] + paethPredictor(recon[i - bytewidth], precon[i], precon[i - bytewidth])); - } - } - else - { - for(i = 0; i != bytewidth; ++i) - { - recon[i] = scanline[i]; - } - for(i = bytewidth; i < length; ++i) - { - /*paethPredictor(recon[i - bytewidth], 0, 0) is always recon[i - bytewidth]*/ - recon[i] = (scanline[i] + recon[i - bytewidth]); - } - } - break; - default: return 36; /*error: unexisting filter type given*/ - } - return 0; -} - -static unsigned unfilter(unsigned char* out, const unsigned char* in, unsigned w, unsigned h, unsigned bpp) -{ - /* - For PNG filter method 0 - this function unfilters a single image (e.g. without interlacing this is called once, with Adam7 seven times) - out must have enough bytes allocated already, in must have the scanlines + 1 filtertype byte per scanline - w and h are image dimensions or dimensions of reduced image, bpp is bits per pixel - in and out are allowed to be the same memory address (but aren't the same size since in has the extra filter bytes) - */ - - unsigned y; - unsigned char* prevline = 0; - - /*bytewidth is used for filtering, is 1 when bpp < 8, number of bytes per pixel otherwise*/ - size_t bytewidth = (bpp + 7) / 8; - size_t linebytes = (w * bpp + 7) / 8; - - for(y = 0; y < h; ++y) - { - size_t outindex = linebytes * y; - size_t inindex = (1 + linebytes) * y; /*the extra filterbyte added to each row*/ - unsigned char filterType = in[inindex]; - - CERROR_TRY_RETURN(unfilterScanline(&out[outindex], &in[inindex + 1], prevline, bytewidth, filterType, linebytes)); - - prevline = &out[outindex]; - } - - return 0; -} - -/* -in: Adam7 interlaced image, with no padding bits between scanlines, but between - reduced images so that each reduced image starts at a byte. -out: the same pixels, but re-ordered so that they're now a non-interlaced image with size w*h -bpp: bits per pixel -out has the following size in bits: w * h * bpp. -in is possibly bigger due to padding bits between reduced images. -out must be big enough AND must be 0 everywhere if bpp < 8 in the current implementation -(because that's likely a little bit faster) -NOTE: comments about padding bits are only relevant if bpp < 8 -*/ -static void Adam7_deinterlace(unsigned char* out, const unsigned char* in, unsigned w, unsigned h, unsigned bpp) -{ - unsigned passw[7], passh[7]; - size_t filter_passstart[8], padded_passstart[8], passstart[8]; - unsigned i; - - Adam7_getpassvalues(passw, passh, filter_passstart, padded_passstart, passstart, w, h, bpp); - - if(bpp >= 8) - { - for(i = 0; i != 7; ++i) - { - unsigned x, y, b; - size_t bytewidth = bpp / 8; - for(y = 0; y < passh[i]; ++y) - for(x = 0; x < passw[i]; ++x) - { - size_t pixelinstart = passstart[i] + (y * passw[i] + x) * bytewidth; - size_t pixeloutstart = ((ADAM7_IY[i] + y * ADAM7_DY[i]) * w + ADAM7_IX[i] + x * ADAM7_DX[i]) * bytewidth; - for(b = 0; b < bytewidth; ++b) - { - out[pixeloutstart + b] = in[pixelinstart + b]; - } - } - } - } - else /*bpp < 8: Adam7 with pixels < 8 bit is a bit trickier: with bit pointers*/ - { - for(i = 0; i != 7; ++i) - { - unsigned x, y, b; - unsigned ilinebits = bpp * passw[i]; - unsigned olinebits = bpp * w; - size_t obp, ibp; /*bit pointers (for out and in buffer)*/ - for(y = 0; y < passh[i]; ++y) - for(x = 0; x < passw[i]; ++x) - { - ibp = (8 * passstart[i]) + (y * ilinebits + x * bpp); - obp = (ADAM7_IY[i] + y * ADAM7_DY[i]) * olinebits + (ADAM7_IX[i] + x * ADAM7_DX[i]) * bpp; - for(b = 0; b < bpp; ++b) - { - unsigned char bit = readBitFromReversedStream(&ibp, in); - /*note that this function assumes the out buffer is completely 0, use setBitOfReversedStream otherwise*/ - setBitOfReversedStream0(&obp, out, bit); - } - } - } - } -} - -static void removePaddingBits(unsigned char* out, const unsigned char* in, - size_t olinebits, size_t ilinebits, unsigned h) -{ - /* - After filtering there are still padding bits if scanlines have non multiple of 8 bit amounts. They need - to be removed (except at last scanline of (Adam7-reduced) image) before working with pure image buffers - for the Adam7 code, the color convert code and the output to the user. - in and out are allowed to be the same buffer, in may also be higher but still overlapping; in must - have >= ilinebits*h bits, out must have >= olinebits*h bits, olinebits must be <= ilinebits - also used to move bits after earlier such operations happened, e.g. in a sequence of reduced images from Adam7 - only useful if (ilinebits - olinebits) is a value in the range 1..7 - */ - unsigned y; - size_t diff = ilinebits - olinebits; - size_t ibp = 0, obp = 0; /*input and output bit pointers*/ - for(y = 0; y < h; ++y) - { - size_t x; - for(x = 0; x < olinebits; ++x) - { - unsigned char bit = readBitFromReversedStream(&ibp, in); - setBitOfReversedStream(&obp, out, bit); - } - ibp += diff; - } -} - -/*out must be buffer big enough to contain full image, and in must contain the full decompressed data from -the IDAT chunks (with filter index bytes and possible padding bits) -return value is error*/ -static unsigned postProcessScanlines(unsigned char* out, unsigned char* in, - unsigned w, unsigned h, const LodePNGInfo* info_png) -{ - /* - This function converts the filtered-padded-interlaced data into pure 2D image buffer with the PNG's colortype. - Steps: - *) if no Adam7: 1) unfilter 2) remove padding bits (= posible extra bits per scanline if bpp < 8) - *) if adam7: 1) 7x unfilter 2) 7x remove padding bits 3) Adam7_deinterlace - NOTE: the in buffer will be overwritten with intermediate data! - */ - unsigned bpp = lodepng_get_bpp(&info_png->color); - if(bpp == 0) return 31; /*error: invalid colortype*/ - - if(info_png->interlace_method == 0) - { - if(bpp < 8 && w * bpp != ((w * bpp + 7) / 8) * 8) - { - CERROR_TRY_RETURN(unfilter(in, in, w, h, bpp)); - removePaddingBits(out, in, w * bpp, ((w * bpp + 7) / 8) * 8, h); - } - /*we can immediately filter into the out buffer, no other steps needed*/ - else CERROR_TRY_RETURN(unfilter(out, in, w, h, bpp)); - } - else /*interlace_method is 1 (Adam7)*/ - { - unsigned passw[7], passh[7]; size_t filter_passstart[8], padded_passstart[8], passstart[8]; - unsigned i; - - Adam7_getpassvalues(passw, passh, filter_passstart, padded_passstart, passstart, w, h, bpp); - - for(i = 0; i != 7; ++i) - { - CERROR_TRY_RETURN(unfilter(&in[padded_passstart[i]], &in[filter_passstart[i]], passw[i], passh[i], bpp)); - /*TODO: possible efficiency improvement: if in this reduced image the bits fit nicely in 1 scanline, - move bytes instead of bits or move not at all*/ - if(bpp < 8) - { - /*remove padding bits in scanlines; after this there still may be padding - bits between the different reduced images: each reduced image still starts nicely at a byte*/ - removePaddingBits(&in[passstart[i]], &in[padded_passstart[i]], passw[i] * bpp, - ((passw[i] * bpp + 7) / 8) * 8, passh[i]); - } - } - - Adam7_deinterlace(out, in, w, h, bpp); - } - - return 0; -} - -static unsigned readChunk_PLTE(LodePNGColorMode* color, const unsigned char* data, size_t chunkLength) -{ - unsigned pos = 0, i; - if(color->palette) lodepng_free(color->palette); - color->palettesize = chunkLength / 3; - color->palette = (unsigned char*)lodepng_malloc(4 * color->palettesize); - if(!color->palette && color->palettesize) - { - color->palettesize = 0; - return 83; /*alloc fail*/ - } - if(color->palettesize > 256) return 38; /*error: palette too big*/ - - for(i = 0; i != color->palettesize; ++i) - { - color->palette[4 * i + 0] = data[pos++]; /*R*/ - color->palette[4 * i + 1] = data[pos++]; /*G*/ - color->palette[4 * i + 2] = data[pos++]; /*B*/ - color->palette[4 * i + 3] = 255; /*alpha*/ - } - - return 0; /* OK */ -} - -static unsigned readChunk_tRNS(LodePNGColorMode* color, const unsigned char* data, size_t chunkLength) -{ - unsigned i; - if(color->colortype == LCT_PALETTE) - { - /*error: more alpha values given than there are palette entries*/ - if(chunkLength > color->palettesize) return 38; - - for(i = 0; i != chunkLength; ++i) color->palette[4 * i + 3] = data[i]; - } - else if(color->colortype == LCT_GREY) - { - /*error: this chunk must be 2 bytes for greyscale image*/ - if(chunkLength != 2) return 30; - - color->key_defined = 1; - color->key_r = color->key_g = color->key_b = 256u * data[0] + data[1]; - } - else if(color->colortype == LCT_RGB) - { - /*error: this chunk must be 6 bytes for RGB image*/ - if(chunkLength != 6) return 41; - - color->key_defined = 1; - color->key_r = 256u * data[0] + data[1]; - color->key_g = 256u * data[2] + data[3]; - color->key_b = 256u * data[4] + data[5]; - } - else return 42; /*error: tRNS chunk not allowed for other color models*/ - - return 0; /* OK */ -} - - -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS -/*background color chunk (bKGD)*/ -static unsigned readChunk_bKGD(LodePNGInfo* info, const unsigned char* data, size_t chunkLength) -{ - if(info->color.colortype == LCT_PALETTE) - { - /*error: this chunk must be 1 byte for indexed color image*/ - if(chunkLength != 1) return 43; - - info->background_defined = 1; - info->background_r = info->background_g = info->background_b = data[0]; - } - else if(info->color.colortype == LCT_GREY || info->color.colortype == LCT_GREY_ALPHA) - { - /*error: this chunk must be 2 bytes for greyscale image*/ - if(chunkLength != 2) return 44; - - info->background_defined = 1; - info->background_r = info->background_g = info->background_b = 256u * data[0] + data[1]; - } - else if(info->color.colortype == LCT_RGB || info->color.colortype == LCT_RGBA) - { - /*error: this chunk must be 6 bytes for greyscale image*/ - if(chunkLength != 6) return 45; - - info->background_defined = 1; - info->background_r = 256u * data[0] + data[1]; - info->background_g = 256u * data[2] + data[3]; - info->background_b = 256u * data[4] + data[5]; - } - - return 0; /* OK */ -} - -/*text chunk (tEXt)*/ -static unsigned readChunk_tEXt(LodePNGInfo* info, const unsigned char* data, size_t chunkLength) -{ - unsigned error = 0; - char *key = 0, *str = 0; - unsigned i; - - while(!error) /*not really a while loop, only used to break on error*/ - { - unsigned length, string2_begin; - - length = 0; - while(length < chunkLength && data[length] != 0) ++length; - /*even though it's not allowed by the standard, no error is thrown if - there's no null termination char, if the text is empty*/ - if(length < 1 || length > 79) CERROR_BREAK(error, 89); /*keyword too short or long*/ - - key = (char*)lodepng_malloc(length + 1); - if(!key) CERROR_BREAK(error, 83); /*alloc fail*/ - - key[length] = 0; - for(i = 0; i != length; ++i) key[i] = (char)data[i]; - - string2_begin = length + 1; /*skip keyword null terminator*/ - - length = chunkLength < string2_begin ? 0 : chunkLength - string2_begin; - str = (char*)lodepng_malloc(length + 1); - if(!str) CERROR_BREAK(error, 83); /*alloc fail*/ - - str[length] = 0; - for(i = 0; i != length; ++i) str[i] = (char)data[string2_begin + i]; - - error = lodepng_add_text(info, key, str); - - break; - } - - lodepng_free(key); - lodepng_free(str); - - return error; -} - -/*compressed text chunk (zTXt)*/ -static unsigned readChunk_zTXt(LodePNGInfo* info, const LodePNGDecompressSettings* zlibsettings, - const unsigned char* data, size_t chunkLength) -{ - unsigned error = 0; - unsigned i; - - unsigned length, string2_begin; - char *key = 0; - ucvector decoded; - - ucvector_init(&decoded); - - while(!error) /*not really a while loop, only used to break on error*/ - { - for(length = 0; length < chunkLength && data[length] != 0; ++length) ; - if(length + 2 >= chunkLength) CERROR_BREAK(error, 75); /*no null termination, corrupt?*/ - if(length < 1 || length > 79) CERROR_BREAK(error, 89); /*keyword too short or long*/ - - key = (char*)lodepng_malloc(length + 1); - if(!key) CERROR_BREAK(error, 83); /*alloc fail*/ - - key[length] = 0; - for(i = 0; i != length; ++i) key[i] = (char)data[i]; - - if(data[length + 1] != 0) CERROR_BREAK(error, 72); /*the 0 byte indicating compression must be 0*/ - - string2_begin = length + 2; - if(string2_begin > chunkLength) CERROR_BREAK(error, 75); /*no null termination, corrupt?*/ - - length = chunkLength - string2_begin; - /*will fail if zlib error, e.g. if length is too small*/ - error = zlib_decompress(&decoded.data, &decoded.size, - (unsigned char*)(&data[string2_begin]), - length, zlibsettings); - if(error) break; - ucvector_push_back(&decoded, 0); - - error = lodepng_add_text(info, key, (char*)decoded.data); - - break; - } - - lodepng_free(key); - ucvector_cleanup(&decoded); - - return error; -} - -/*international text chunk (iTXt)*/ -static unsigned readChunk_iTXt(LodePNGInfo* info, const LodePNGDecompressSettings* zlibsettings, - const unsigned char* data, size_t chunkLength) -{ - unsigned error = 0; - unsigned i; - - unsigned length, begin, compressed; - char *key = 0, *langtag = 0, *transkey = 0; - ucvector decoded; - ucvector_init(&decoded); - - while(!error) /*not really a while loop, only used to break on error*/ - { - /*Quick check if the chunk length isn't too small. Even without check - it'd still fail with other error checks below if it's too short. This just gives a different error code.*/ - if(chunkLength < 5) CERROR_BREAK(error, 30); /*iTXt chunk too short*/ - - /*read the key*/ - for(length = 0; length < chunkLength && data[length] != 0; ++length) ; - if(length + 3 >= chunkLength) CERROR_BREAK(error, 75); /*no null termination char, corrupt?*/ - if(length < 1 || length > 79) CERROR_BREAK(error, 89); /*keyword too short or long*/ - - key = (char*)lodepng_malloc(length + 1); - if(!key) CERROR_BREAK(error, 83); /*alloc fail*/ - - key[length] = 0; - for(i = 0; i != length; ++i) key[i] = (char)data[i]; - - /*read the compression method*/ - compressed = data[length + 1]; - if(data[length + 2] != 0) CERROR_BREAK(error, 72); /*the 0 byte indicating compression must be 0*/ - - /*even though it's not allowed by the standard, no error is thrown if - there's no null termination char, if the text is empty for the next 3 texts*/ - - /*read the langtag*/ - begin = length + 3; - length = 0; - for(i = begin; i < chunkLength && data[i] != 0; ++i) ++length; - - langtag = (char*)lodepng_malloc(length + 1); - if(!langtag) CERROR_BREAK(error, 83); /*alloc fail*/ - - langtag[length] = 0; - for(i = 0; i != length; ++i) langtag[i] = (char)data[begin + i]; - - /*read the transkey*/ - begin += length + 1; - length = 0; - for(i = begin; i < chunkLength && data[i] != 0; ++i) ++length; - - transkey = (char*)lodepng_malloc(length + 1); - if(!transkey) CERROR_BREAK(error, 83); /*alloc fail*/ - - transkey[length] = 0; - for(i = 0; i != length; ++i) transkey[i] = (char)data[begin + i]; - - /*read the actual text*/ - begin += length + 1; - - length = chunkLength < begin ? 0 : chunkLength - begin; - - if(compressed) - { - /*will fail if zlib error, e.g. if length is too small*/ - error = zlib_decompress(&decoded.data, &decoded.size, - (unsigned char*)(&data[begin]), - length, zlibsettings); - if(error) break; - if(decoded.allocsize < decoded.size) decoded.allocsize = decoded.size; - ucvector_push_back(&decoded, 0); - } - else - { - if(!ucvector_resize(&decoded, length + 1)) CERROR_BREAK(error, 83 /*alloc fail*/); - - decoded.data[length] = 0; - for(i = 0; i != length; ++i) decoded.data[i] = data[begin + i]; - } - - error = lodepng_add_itext(info, key, langtag, transkey, (char*)decoded.data); - - break; - } - - lodepng_free(key); - lodepng_free(langtag); - lodepng_free(transkey); - ucvector_cleanup(&decoded); - - return error; -} - -static unsigned readChunk_tIME(LodePNGInfo* info, const unsigned char* data, size_t chunkLength) -{ - if(chunkLength != 7) return 73; /*invalid tIME chunk size*/ - - info->time_defined = 1; - info->time.year = 256u * data[0] + data[1]; - info->time.month = data[2]; - info->time.day = data[3]; - info->time.hour = data[4]; - info->time.minute = data[5]; - info->time.second = data[6]; - - return 0; /* OK */ -} - -static unsigned readChunk_pHYs(LodePNGInfo* info, const unsigned char* data, size_t chunkLength) -{ - if(chunkLength != 9) return 74; /*invalid pHYs chunk size*/ - - info->phys_defined = 1; - info->phys_x = 16777216u * data[0] + 65536u * data[1] + 256u * data[2] + data[3]; - info->phys_y = 16777216u * data[4] + 65536u * data[5] + 256u * data[6] + data[7]; - info->phys_unit = data[8]; - - return 0; /* OK */ -} -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ - -/*read a PNG, the result will be in the same color type as the PNG (hence "generic")*/ -static void decodeGeneric(unsigned char** out, unsigned* w, unsigned* h, - LodePNGState* state, - const unsigned char* in, size_t insize) -{ - unsigned char IEND = 0; - const unsigned char* chunk; - size_t i; - ucvector idat; /*the data from idat chunks*/ - ucvector scanlines; - size_t predict; - size_t numpixels; - size_t outsize = 0; - - /*for unknown chunk order*/ - unsigned unknown = 0; -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS - unsigned critical_pos = 1; /*1 = after IHDR, 2 = after PLTE, 3 = after IDAT*/ -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ - - /*provide some proper output values if error will happen*/ - *out = 0; - - state->error = lodepng_inspect(w, h, state, in, insize); /*reads header and resets other parameters in state->info_png*/ - if(state->error) return; - - numpixels = *w * *h; - - /*multiplication overflow*/ - if(*h != 0 && numpixels / *h != *w) CERROR_RETURN(state->error, 92); - /*multiplication overflow possible further below. Allows up to 2^31-1 pixel - bytes with 16-bit RGBA, the rest is room for filter bytes.*/ - if(numpixels > 268435455) CERROR_RETURN(state->error, 92); - - ucvector_init(&idat); - chunk = &in[33]; /*first byte of the first chunk after the header*/ - - /*loop through the chunks, ignoring unknown chunks and stopping at IEND chunk. - IDAT data is put at the start of the in buffer*/ - while(!IEND && !state->error) - { - unsigned chunkLength; - const unsigned char* data; /*the data in the chunk*/ - - /*error: size of the in buffer too small to contain next chunk*/ - if((size_t)((chunk - in) + 12) > insize || chunk < in) CERROR_BREAK(state->error, 30); - - /*length of the data of the chunk, excluding the length bytes, chunk type and CRC bytes*/ - chunkLength = lodepng_chunk_length(chunk); - /*error: chunk length larger than the max PNG chunk size*/ - if(chunkLength > 2147483647) CERROR_BREAK(state->error, 63); - - if((size_t)((chunk - in) + chunkLength + 12) > insize || (chunk + chunkLength + 12) < in) - { - CERROR_BREAK(state->error, 64); /*error: size of the in buffer too small to contain next chunk*/ - } - - data = lodepng_chunk_data_const(chunk); - - /*IDAT chunk, containing compressed image data*/ - if(lodepng_chunk_type_equals(chunk, "IDAT")) - { - size_t oldsize = idat.size; - if(!ucvector_resize(&idat, oldsize + chunkLength)) CERROR_BREAK(state->error, 83 /*alloc fail*/); - for(i = 0; i != chunkLength; ++i) idat.data[oldsize + i] = data[i]; -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS - critical_pos = 3; -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ - } - /*IEND chunk*/ - else if(lodepng_chunk_type_equals(chunk, "IEND")) - { - IEND = 1; - } - /*palette chunk (PLTE)*/ - else if(lodepng_chunk_type_equals(chunk, "PLTE")) - { - state->error = readChunk_PLTE(&state->info_png.color, data, chunkLength); - if(state->error) break; -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS - critical_pos = 2; -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ - } - /*palette transparency chunk (tRNS)*/ - else if(lodepng_chunk_type_equals(chunk, "tRNS")) - { - state->error = readChunk_tRNS(&state->info_png.color, data, chunkLength); - if(state->error) break; - } -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS - /*background color chunk (bKGD)*/ - else if(lodepng_chunk_type_equals(chunk, "bKGD")) - { - state->error = readChunk_bKGD(&state->info_png, data, chunkLength); - if(state->error) break; - } - /*text chunk (tEXt)*/ - else if(lodepng_chunk_type_equals(chunk, "tEXt")) - { - if(state->decoder.read_text_chunks) - { - state->error = readChunk_tEXt(&state->info_png, data, chunkLength); - if(state->error) break; - } - } - /*compressed text chunk (zTXt)*/ - else if(lodepng_chunk_type_equals(chunk, "zTXt")) - { - if(state->decoder.read_text_chunks) - { - state->error = readChunk_zTXt(&state->info_png, &state->decoder.zlibsettings, data, chunkLength); - if(state->error) break; - } - } - /*international text chunk (iTXt)*/ - else if(lodepng_chunk_type_equals(chunk, "iTXt")) - { - if(state->decoder.read_text_chunks) - { - state->error = readChunk_iTXt(&state->info_png, &state->decoder.zlibsettings, data, chunkLength); - if(state->error) break; - } - } - else if(lodepng_chunk_type_equals(chunk, "tIME")) - { - state->error = readChunk_tIME(&state->info_png, data, chunkLength); - if(state->error) break; - } - else if(lodepng_chunk_type_equals(chunk, "pHYs")) - { - state->error = readChunk_pHYs(&state->info_png, data, chunkLength); - if(state->error) break; - } -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ - else /*it's not an implemented chunk type, so ignore it: skip over the data*/ - { - /*error: unknown critical chunk (5th bit of first byte of chunk type is 0)*/ - if(!lodepng_chunk_ancillary(chunk)) CERROR_BREAK(state->error, 69); - - unknown = 1; -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS - if(state->decoder.remember_unknown_chunks) - { - state->error = lodepng_chunk_append(&state->info_png.unknown_chunks_data[critical_pos - 1], - &state->info_png.unknown_chunks_size[critical_pos - 1], chunk); - if(state->error) break; - } -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ - } - - if(!state->decoder.ignore_crc && !unknown) /*check CRC if wanted, only on known chunk types*/ - { - if(lodepng_chunk_check_crc(chunk)) CERROR_BREAK(state->error, 57); /*invalid CRC*/ - } - - if(!IEND) chunk = lodepng_chunk_next_const(chunk); - } - - ucvector_init(&scanlines); - /*predict output size, to allocate exact size for output buffer to avoid more dynamic allocation. - If the decompressed size does not match the prediction, the image must be corrupt.*/ - if(state->info_png.interlace_method == 0) - { - /*The extra *h is added because this are the filter bytes every scanline starts with*/ - predict = lodepng_get_raw_size_idat(*w, *h, &state->info_png.color) + *h; - } - else - { - /*Adam-7 interlaced: predicted size is the sum of the 7 sub-images sizes*/ - const LodePNGColorMode* color = &state->info_png.color; - predict = 0; - predict += lodepng_get_raw_size_idat((*w + 7) >> 3, (*h + 7) >> 3, color) + ((*h + 7) >> 3); - if(*w > 4) predict += lodepng_get_raw_size_idat((*w + 3) >> 3, (*h + 7) >> 3, color) + ((*h + 7) >> 3); - predict += lodepng_get_raw_size_idat((*w + 3) >> 2, (*h + 3) >> 3, color) + ((*h + 3) >> 3); - if(*w > 2) predict += lodepng_get_raw_size_idat((*w + 1) >> 2, (*h + 3) >> 2, color) + ((*h + 3) >> 2); - predict += lodepng_get_raw_size_idat((*w + 1) >> 1, (*h + 1) >> 2, color) + ((*h + 1) >> 2); - if(*w > 1) predict += lodepng_get_raw_size_idat((*w + 0) >> 1, (*h + 1) >> 1, color) + ((*h + 1) >> 1); - predict += lodepng_get_raw_size_idat((*w + 0), (*h + 0) >> 1, color) + ((*h + 0) >> 1); - } - if(!state->error && !ucvector_reserve(&scanlines, predict)) state->error = 83; /*alloc fail*/ - if(!state->error) - { - state->error = zlib_decompress(&scanlines.data, &scanlines.size, idat.data, - idat.size, &state->decoder.zlibsettings); - if(!state->error && scanlines.size != predict) state->error = 91; /*decompressed size doesn't match prediction*/ - } - ucvector_cleanup(&idat); - - if(!state->error) - { - outsize = lodepng_get_raw_size(*w, *h, &state->info_png.color); - *out = (unsigned char*)lodepng_malloc(outsize); - if(!*out) state->error = 83; /*alloc fail*/ - } - if(!state->error) - { - for(i = 0; i < outsize; i++) (*out)[i] = 0; - state->error = postProcessScanlines(*out, scanlines.data, *w, *h, &state->info_png); - } - ucvector_cleanup(&scanlines); -} - -unsigned lodepng_decode(unsigned char** out, unsigned* w, unsigned* h, - LodePNGState* state, - const unsigned char* in, size_t insize) -{ - *out = 0; - decodeGeneric(out, w, h, state, in, insize); - if(state->error) return state->error; - if(!state->decoder.color_convert || lodepng_color_mode_equal(&state->info_raw, &state->info_png.color)) - { - /*same color type, no copying or converting of data needed*/ - /*store the info_png color settings on the info_raw so that the info_raw still reflects what colortype - the raw image has to the end user*/ - if(!state->decoder.color_convert) - { - state->error = lodepng_color_mode_copy(&state->info_raw, &state->info_png.color); - if(state->error) return state->error; - } - } - else - { - /*color conversion needed; sort of copy of the data*/ - unsigned char* data = *out; - size_t outsize; - - /*TODO: check if this works according to the statement in the documentation: "The converter can convert - from greyscale input color type, to 8-bit greyscale or greyscale with alpha"*/ - if(!(state->info_raw.colortype == LCT_RGB || state->info_raw.colortype == LCT_RGBA) - && !(state->info_raw.bitdepth == 8)) - { - return 56; /*unsupported color mode conversion*/ - } - - outsize = lodepng_get_raw_size(*w, *h, &state->info_raw); - *out = (unsigned char*)lodepng_malloc(outsize); - if(!(*out)) - { - state->error = 83; /*alloc fail*/ - } - else state->error = lodepng_convert(*out, data, &state->info_raw, - &state->info_png.color, *w, *h); - lodepng_free(data); - } - return state->error; -} - -unsigned lodepng_decode_memory(unsigned char** out, unsigned* w, unsigned* h, const unsigned char* in, - size_t insize, LodePNGColorType colortype, unsigned bitdepth) -{ - unsigned error; - LodePNGState state; - lodepng_state_init(&state); - state.info_raw.colortype = colortype; - state.info_raw.bitdepth = bitdepth; - error = lodepng_decode(out, w, h, &state, in, insize); - lodepng_state_cleanup(&state); - return error; -} - -unsigned lodepng_decode32(unsigned char** out, unsigned* w, unsigned* h, const unsigned char* in, size_t insize) -{ - return lodepng_decode_memory(out, w, h, in, insize, LCT_RGBA, 8); -} - -unsigned lodepng_decode24(unsigned char** out, unsigned* w, unsigned* h, const unsigned char* in, size_t insize) -{ - return lodepng_decode_memory(out, w, h, in, insize, LCT_RGB, 8); -} - -#ifdef LODEPNG_COMPILE_DISK -unsigned lodepng_decode_file(unsigned char** out, unsigned* w, unsigned* h, const char* filename, - LodePNGColorType colortype, unsigned bitdepth) -{ - unsigned char* buffer = 0; - size_t buffersize; - unsigned error; - error = lodepng_load_file(&buffer, &buffersize, filename); - if(!error) error = lodepng_decode_memory(out, w, h, buffer, buffersize, colortype, bitdepth); - lodepng_free(buffer); - return error; -} - -unsigned lodepng_decode32_file(unsigned char** out, unsigned* w, unsigned* h, const char* filename) -{ - return lodepng_decode_file(out, w, h, filename, LCT_RGBA, 8); -} - -unsigned lodepng_decode24_file(unsigned char** out, unsigned* w, unsigned* h, const char* filename) -{ - return lodepng_decode_file(out, w, h, filename, LCT_RGB, 8); -} -#endif /*LODEPNG_COMPILE_DISK*/ - -void lodepng_decoder_settings_init(LodePNGDecoderSettings* settings) -{ - settings->color_convert = 1; -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS - settings->read_text_chunks = 1; - settings->remember_unknown_chunks = 0; -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ - settings->ignore_crc = 0; - lodepng_decompress_settings_init(&settings->zlibsettings); -} - -#endif /*LODEPNG_COMPILE_DECODER*/ - -#if defined(LODEPNG_COMPILE_DECODER) || defined(LODEPNG_COMPILE_ENCODER) - -void lodepng_state_init(LodePNGState* state) -{ -#ifdef LODEPNG_COMPILE_DECODER - lodepng_decoder_settings_init(&state->decoder); -#endif /*LODEPNG_COMPILE_DECODER*/ -#ifdef LODEPNG_COMPILE_ENCODER - lodepng_encoder_settings_init(&state->encoder); -#endif /*LODEPNG_COMPILE_ENCODER*/ - lodepng_color_mode_init(&state->info_raw); - lodepng_info_init(&state->info_png); - state->error = 1; -} - -void lodepng_state_cleanup(LodePNGState* state) -{ - lodepng_color_mode_cleanup(&state->info_raw); - lodepng_info_cleanup(&state->info_png); -} - -void lodepng_state_copy(LodePNGState* dest, const LodePNGState* source) -{ - lodepng_state_cleanup(dest); - *dest = *source; - lodepng_color_mode_init(&dest->info_raw); - lodepng_info_init(&dest->info_png); - dest->error = lodepng_color_mode_copy(&dest->info_raw, &source->info_raw); if(dest->error) return; - dest->error = lodepng_info_copy(&dest->info_png, &source->info_png); if(dest->error) return; -} - -#endif /* defined(LODEPNG_COMPILE_DECODER) || defined(LODEPNG_COMPILE_ENCODER) */ - -#ifdef LODEPNG_COMPILE_ENCODER - -/* ////////////////////////////////////////////////////////////////////////// */ -/* / PNG Encoder / */ -/* ////////////////////////////////////////////////////////////////////////// */ - -/*chunkName must be string of 4 characters*/ -static unsigned addChunk(ucvector* out, const char* chunkName, const unsigned char* data, size_t length) -{ - CERROR_TRY_RETURN(lodepng_chunk_create(&out->data, &out->size, (unsigned)length, chunkName, data)); - out->allocsize = out->size; /*fix the allocsize again*/ - return 0; -} - -static void writeSignature(ucvector* out) -{ - /*8 bytes PNG signature, aka the magic bytes*/ - ucvector_push_back(out, 137); - ucvector_push_back(out, 80); - ucvector_push_back(out, 78); - ucvector_push_back(out, 71); - ucvector_push_back(out, 13); - ucvector_push_back(out, 10); - ucvector_push_back(out, 26); - ucvector_push_back(out, 10); -} - -static unsigned addChunk_IHDR(ucvector* out, unsigned w, unsigned h, - LodePNGColorType colortype, unsigned bitdepth, unsigned interlace_method) -{ - unsigned error = 0; - ucvector header; - ucvector_init(&header); - - lodepng_add32bitInt(&header, w); /*width*/ - lodepng_add32bitInt(&header, h); /*height*/ - ucvector_push_back(&header, (unsigned char)bitdepth); /*bit depth*/ - ucvector_push_back(&header, (unsigned char)colortype); /*color type*/ - ucvector_push_back(&header, 0); /*compression method*/ - ucvector_push_back(&header, 0); /*filter method*/ - ucvector_push_back(&header, interlace_method); /*interlace method*/ - - error = addChunk(out, "IHDR", header.data, header.size); - ucvector_cleanup(&header); - - return error; -} - -static unsigned addChunk_PLTE(ucvector* out, const LodePNGColorMode* info) -{ - unsigned error = 0; - size_t i; - ucvector PLTE; - ucvector_init(&PLTE); - for(i = 0; i != info->palettesize * 4; ++i) - { - /*add all channels except alpha channel*/ - if(i % 4 != 3) ucvector_push_back(&PLTE, info->palette[i]); - } - error = addChunk(out, "PLTE", PLTE.data, PLTE.size); - ucvector_cleanup(&PLTE); - - return error; -} - -static unsigned addChunk_tRNS(ucvector* out, const LodePNGColorMode* info) -{ - unsigned error = 0; - size_t i; - ucvector tRNS; - ucvector_init(&tRNS); - if(info->colortype == LCT_PALETTE) - { - size_t amount = info->palettesize; - /*the tail of palette values that all have 255 as alpha, does not have to be encoded*/ - for(i = info->palettesize; i != 0; --i) - { - if(info->palette[4 * (i - 1) + 3] == 255) --amount; - else break; - } - /*add only alpha channel*/ - for(i = 0; i != amount; ++i) ucvector_push_back(&tRNS, info->palette[4 * i + 3]); - } - else if(info->colortype == LCT_GREY) - { - if(info->key_defined) - { - ucvector_push_back(&tRNS, (unsigned char)(info->key_r >> 8)); - ucvector_push_back(&tRNS, (unsigned char)(info->key_r & 255)); - } - } - else if(info->colortype == LCT_RGB) - { - if(info->key_defined) - { - ucvector_push_back(&tRNS, (unsigned char)(info->key_r >> 8)); - ucvector_push_back(&tRNS, (unsigned char)(info->key_r & 255)); - ucvector_push_back(&tRNS, (unsigned char)(info->key_g >> 8)); - ucvector_push_back(&tRNS, (unsigned char)(info->key_g & 255)); - ucvector_push_back(&tRNS, (unsigned char)(info->key_b >> 8)); - ucvector_push_back(&tRNS, (unsigned char)(info->key_b & 255)); - } - } - - error = addChunk(out, "tRNS", tRNS.data, tRNS.size); - ucvector_cleanup(&tRNS); - - return error; -} - -static unsigned addChunk_IDAT(ucvector* out, const unsigned char* data, size_t datasize, - LodePNGCompressSettings* zlibsettings) -{ - ucvector zlibdata; - unsigned error = 0; - - /*compress with the Zlib compressor*/ - ucvector_init(&zlibdata); - error = zlib_compress(&zlibdata.data, &zlibdata.size, data, datasize, zlibsettings); - if(!error) error = addChunk(out, "IDAT", zlibdata.data, zlibdata.size); - ucvector_cleanup(&zlibdata); - - return error; -} - -static unsigned addChunk_IEND(ucvector* out) -{ - unsigned error = 0; - error = addChunk(out, "IEND", 0, 0); - return error; -} - -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS - -static unsigned addChunk_tEXt(ucvector* out, const char* keyword, const char* textstring) -{ - unsigned error = 0; - size_t i; - ucvector text; - ucvector_init(&text); - for(i = 0; keyword[i] != 0; ++i) ucvector_push_back(&text, (unsigned char)keyword[i]); - if(i < 1 || i > 79) return 89; /*error: invalid keyword size*/ - ucvector_push_back(&text, 0); /*0 termination char*/ - for(i = 0; textstring[i] != 0; ++i) ucvector_push_back(&text, (unsigned char)textstring[i]); - error = addChunk(out, "tEXt", text.data, text.size); - ucvector_cleanup(&text); - - return error; -} - -static unsigned addChunk_zTXt(ucvector* out, const char* keyword, const char* textstring, - LodePNGCompressSettings* zlibsettings) -{ - unsigned error = 0; - ucvector data, compressed; - size_t i, textsize = strlen(textstring); - - ucvector_init(&data); - ucvector_init(&compressed); - for(i = 0; keyword[i] != 0; ++i) ucvector_push_back(&data, (unsigned char)keyword[i]); - if(i < 1 || i > 79) return 89; /*error: invalid keyword size*/ - ucvector_push_back(&data, 0); /*0 termination char*/ - ucvector_push_back(&data, 0); /*compression method: 0*/ - - error = zlib_compress(&compressed.data, &compressed.size, - (unsigned char*)textstring, textsize, zlibsettings); - if(!error) - { - for(i = 0; i != compressed.size; ++i) ucvector_push_back(&data, compressed.data[i]); - error = addChunk(out, "zTXt", data.data, data.size); - } - - ucvector_cleanup(&compressed); - ucvector_cleanup(&data); - return error; -} - -static unsigned addChunk_iTXt(ucvector* out, unsigned compressed, const char* keyword, const char* langtag, - const char* transkey, const char* textstring, LodePNGCompressSettings* zlibsettings) -{ - unsigned error = 0; - ucvector data; - size_t i, textsize = strlen(textstring); - - ucvector_init(&data); - - for(i = 0; keyword[i] != 0; ++i) ucvector_push_back(&data, (unsigned char)keyword[i]); - if(i < 1 || i > 79) return 89; /*error: invalid keyword size*/ - ucvector_push_back(&data, 0); /*null termination char*/ - ucvector_push_back(&data, compressed ? 1 : 0); /*compression flag*/ - ucvector_push_back(&data, 0); /*compression method*/ - for(i = 0; langtag[i] != 0; ++i) ucvector_push_back(&data, (unsigned char)langtag[i]); - ucvector_push_back(&data, 0); /*null termination char*/ - for(i = 0; transkey[i] != 0; ++i) ucvector_push_back(&data, (unsigned char)transkey[i]); - ucvector_push_back(&data, 0); /*null termination char*/ - - if(compressed) - { - ucvector compressed_data; - ucvector_init(&compressed_data); - error = zlib_compress(&compressed_data.data, &compressed_data.size, - (unsigned char*)textstring, textsize, zlibsettings); - if(!error) - { - for(i = 0; i != compressed_data.size; ++i) ucvector_push_back(&data, compressed_data.data[i]); - } - ucvector_cleanup(&compressed_data); - } - else /*not compressed*/ - { - for(i = 0; textstring[i] != 0; ++i) ucvector_push_back(&data, (unsigned char)textstring[i]); - } - - if(!error) error = addChunk(out, "iTXt", data.data, data.size); - ucvector_cleanup(&data); - return error; -} - -static unsigned addChunk_bKGD(ucvector* out, const LodePNGInfo* info) -{ - unsigned error = 0; - ucvector bKGD; - ucvector_init(&bKGD); - if(info->color.colortype == LCT_GREY || info->color.colortype == LCT_GREY_ALPHA) - { - ucvector_push_back(&bKGD, (unsigned char)(info->background_r >> 8)); - ucvector_push_back(&bKGD, (unsigned char)(info->background_r & 255)); - } - else if(info->color.colortype == LCT_RGB || info->color.colortype == LCT_RGBA) - { - ucvector_push_back(&bKGD, (unsigned char)(info->background_r >> 8)); - ucvector_push_back(&bKGD, (unsigned char)(info->background_r & 255)); - ucvector_push_back(&bKGD, (unsigned char)(info->background_g >> 8)); - ucvector_push_back(&bKGD, (unsigned char)(info->background_g & 255)); - ucvector_push_back(&bKGD, (unsigned char)(info->background_b >> 8)); - ucvector_push_back(&bKGD, (unsigned char)(info->background_b & 255)); - } - else if(info->color.colortype == LCT_PALETTE) - { - ucvector_push_back(&bKGD, (unsigned char)(info->background_r & 255)); /*palette index*/ - } - - error = addChunk(out, "bKGD", bKGD.data, bKGD.size); - ucvector_cleanup(&bKGD); - - return error; -} - -static unsigned addChunk_tIME(ucvector* out, const LodePNGTime* time) -{ - unsigned error = 0; - unsigned char* data = (unsigned char*)lodepng_malloc(7); - if(!data) return 83; /*alloc fail*/ - data[0] = (unsigned char)(time->year >> 8); - data[1] = (unsigned char)(time->year & 255); - data[2] = (unsigned char)time->month; - data[3] = (unsigned char)time->day; - data[4] = (unsigned char)time->hour; - data[5] = (unsigned char)time->minute; - data[6] = (unsigned char)time->second; - error = addChunk(out, "tIME", data, 7); - lodepng_free(data); - return error; -} - -static unsigned addChunk_pHYs(ucvector* out, const LodePNGInfo* info) -{ - unsigned error = 0; - ucvector data; - ucvector_init(&data); - - lodepng_add32bitInt(&data, info->phys_x); - lodepng_add32bitInt(&data, info->phys_y); - ucvector_push_back(&data, info->phys_unit); - - error = addChunk(out, "pHYs", data.data, data.size); - ucvector_cleanup(&data); - - return error; -} - -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ - -static void filterScanline(unsigned char* out, const unsigned char* scanline, const unsigned char* prevline, - size_t length, size_t bytewidth, unsigned char filterType) -{ - size_t i; - switch(filterType) - { - case 0: /*None*/ - for(i = 0; i != length; ++i) out[i] = scanline[i]; - break; - case 1: /*Sub*/ - for(i = 0; i != bytewidth; ++i) out[i] = scanline[i]; - for(i = bytewidth; i < length; ++i) out[i] = scanline[i] - scanline[i - bytewidth]; - break; - case 2: /*Up*/ - if(prevline) - { - for(i = 0; i != length; ++i) out[i] = scanline[i] - prevline[i]; - } - else - { - for(i = 0; i != length; ++i) out[i] = scanline[i]; - } - break; - case 3: /*Average*/ - if(prevline) - { - for(i = 0; i != bytewidth; ++i) out[i] = scanline[i] - (prevline[i] >> 1); - for(i = bytewidth; i < length; ++i) out[i] = scanline[i] - ((scanline[i - bytewidth] + prevline[i]) >> 1); - } - else - { - for(i = 0; i != bytewidth; ++i) out[i] = scanline[i]; - for(i = bytewidth; i < length; ++i) out[i] = scanline[i] - (scanline[i - bytewidth] >> 1); - } - break; - case 4: /*Paeth*/ - if(prevline) - { - /*paethPredictor(0, prevline[i], 0) is always prevline[i]*/ - for(i = 0; i != bytewidth; ++i) out[i] = (scanline[i] - prevline[i]); - for(i = bytewidth; i < length; ++i) - { - out[i] = (scanline[i] - paethPredictor(scanline[i - bytewidth], prevline[i], prevline[i - bytewidth])); - } - } - else - { - for(i = 0; i != bytewidth; ++i) out[i] = scanline[i]; - /*paethPredictor(scanline[i - bytewidth], 0, 0) is always scanline[i - bytewidth]*/ - for(i = bytewidth; i < length; ++i) out[i] = (scanline[i] - scanline[i - bytewidth]); - } - break; - default: return; /*unexisting filter type given*/ - } -} - -/* log2 approximation. A slight bit faster than std::log. */ -static float flog2(float f) -{ - float result = 0; - while(f > 32) { result += 4; f /= 16; } - while(f > 2) { ++result; f /= 2; } - return result + 1.442695f * (f * f * f / 3 - 3 * f * f / 2 + 3 * f - 1.83333f); -} - -static unsigned filter(unsigned char* out, const unsigned char* in, unsigned w, unsigned h, - const LodePNGColorMode* info, const LodePNGEncoderSettings* settings) -{ - /* - For PNG filter method 0 - out must be a buffer with as size: h + (w * h * bpp + 7) / 8, because there are - the scanlines with 1 extra byte per scanline - */ - - unsigned bpp = lodepng_get_bpp(info); - /*the width of a scanline in bytes, not including the filter type*/ - size_t linebytes = (w * bpp + 7) / 8; - /*bytewidth is used for filtering, is 1 when bpp < 8, number of bytes per pixel otherwise*/ - size_t bytewidth = (bpp + 7) / 8; - const unsigned char* prevline = 0; - unsigned x, y; - unsigned error = 0; - LodePNGFilterStrategy strategy = settings->filter_strategy; - - /* - There is a heuristic called the minimum sum of absolute differences heuristic, suggested by the PNG standard: - * If the image type is Palette, or the bit depth is smaller than 8, then do not filter the image (i.e. - use fixed filtering, with the filter None). - * (The other case) If the image type is Grayscale or RGB (with or without Alpha), and the bit depth is - not smaller than 8, then use adaptive filtering heuristic as follows: independently for each row, apply - all five filters and select the filter that produces the smallest sum of absolute values per row. - This heuristic is used if filter strategy is LFS_MINSUM and filter_palette_zero is true. - - If filter_palette_zero is true and filter_strategy is not LFS_MINSUM, the above heuristic is followed, - but for "the other case", whatever strategy filter_strategy is set to instead of the minimum sum - heuristic is used. - */ - if(settings->filter_palette_zero && - (info->colortype == LCT_PALETTE || info->bitdepth < 8)) strategy = LFS_ZERO; - - if(bpp == 0) return 31; /*error: invalid color type*/ - - if(strategy == LFS_ZERO) - { - for(y = 0; y != h; ++y) - { - size_t outindex = (1 + linebytes) * y; /*the extra filterbyte added to each row*/ - size_t inindex = linebytes * y; - out[outindex] = 0; /*filter type byte*/ - filterScanline(&out[outindex + 1], &in[inindex], prevline, linebytes, bytewidth, 0); - prevline = &in[inindex]; - } - } - else if(strategy == LFS_MINSUM) - { - /*adaptive filtering*/ - size_t sum[5]; - unsigned char* attempt[5]; /*five filtering attempts, one for each filter type*/ - size_t smallest = 0; - unsigned char type, bestType = 0; - - for(type = 0; type != 5; ++type) - { - attempt[type] = (unsigned char*)lodepng_malloc(linebytes); - if(!attempt[type]) return 83; /*alloc fail*/ - } - - if(!error) - { - for(y = 0; y != h; ++y) - { - /*try the 5 filter types*/ - for(type = 0; type != 5; ++type) - { - filterScanline(attempt[type], &in[y * linebytes], prevline, linebytes, bytewidth, type); - - /*calculate the sum of the result*/ - sum[type] = 0; - if(type == 0) - { - for(x = 0; x != linebytes; ++x) sum[type] += (unsigned char)(attempt[type][x]); - } - else - { - for(x = 0; x != linebytes; ++x) - { - /*For differences, each byte should be treated as signed, values above 127 are negative - (converted to signed char). Filtertype 0 isn't a difference though, so use unsigned there. - This means filtertype 0 is almost never chosen, but that is justified.*/ - unsigned char s = attempt[type][x]; - sum[type] += s < 128 ? s : (255U - s); - } - } - - /*check if this is smallest sum (or if type == 0 it's the first case so always store the values)*/ - if(type == 0 || sum[type] < smallest) - { - bestType = type; - smallest = sum[type]; - } - } - - prevline = &in[y * linebytes]; - - /*now fill the out values*/ - out[y * (linebytes + 1)] = bestType; /*the first byte of a scanline will be the filter type*/ - for(x = 0; x != linebytes; ++x) out[y * (linebytes + 1) + 1 + x] = attempt[bestType][x]; - } - } - - for(type = 0; type != 5; ++type) lodepng_free(attempt[type]); - } - else if(strategy == LFS_ENTROPY) - { - float sum[5]; - unsigned char* attempt[5]; /*five filtering attempts, one for each filter type*/ - float smallest = 0; - unsigned type, bestType = 0; - unsigned count[256]; - - for(type = 0; type != 5; ++type) - { - attempt[type] = (unsigned char*)lodepng_malloc(linebytes); - if(!attempt[type]) return 83; /*alloc fail*/ - } - - for(y = 0; y != h; ++y) - { - /*try the 5 filter types*/ - for(type = 0; type != 5; ++type) - { - filterScanline(attempt[type], &in[y * linebytes], prevline, linebytes, bytewidth, type); - for(x = 0; x != 256; ++x) count[x] = 0; - for(x = 0; x != linebytes; ++x) ++count[attempt[type][x]]; - ++count[type]; /*the filter type itself is part of the scanline*/ - sum[type] = 0; - for(x = 0; x != 256; ++x) - { - float p = count[x] / (float)(linebytes + 1); - sum[type] += count[x] == 0 ? 0 : flog2(1 / p) * p; - } - /*check if this is smallest sum (or if type == 0 it's the first case so always store the values)*/ - if(type == 0 || sum[type] < smallest) - { - bestType = type; - smallest = sum[type]; - } - } - - prevline = &in[y * linebytes]; - - /*now fill the out values*/ - out[y * (linebytes + 1)] = bestType; /*the first byte of a scanline will be the filter type*/ - for(x = 0; x != linebytes; ++x) out[y * (linebytes + 1) + 1 + x] = attempt[bestType][x]; - } - - for(type = 0; type != 5; ++type) lodepng_free(attempt[type]); - } - else if(strategy == LFS_PREDEFINED) - { - for(y = 0; y != h; ++y) - { - size_t outindex = (1 + linebytes) * y; /*the extra filterbyte added to each row*/ - size_t inindex = linebytes * y; - unsigned char type = settings->predefined_filters[y]; - out[outindex] = type; /*filter type byte*/ - filterScanline(&out[outindex + 1], &in[inindex], prevline, linebytes, bytewidth, type); - prevline = &in[inindex]; - } - } - else if(strategy == LFS_BRUTE_FORCE) - { - /*brute force filter chooser. - deflate the scanline after every filter attempt to see which one deflates best. - This is very slow and gives only slightly smaller, sometimes even larger, result*/ - size_t size[5]; - unsigned char* attempt[5]; /*five filtering attempts, one for each filter type*/ - size_t smallest = 0; - unsigned type = 0, bestType = 0; - unsigned char* dummy; - LodePNGCompressSettings zlibsettings = settings->zlibsettings; - /*use fixed tree on the attempts so that the tree is not adapted to the filtertype on purpose, - to simulate the true case where the tree is the same for the whole image. Sometimes it gives - better result with dynamic tree anyway. Using the fixed tree sometimes gives worse, but in rare - cases better compression. It does make this a bit less slow, so it's worth doing this.*/ - zlibsettings.btype = 1; - /*a custom encoder likely doesn't read the btype setting and is optimized for complete PNG - images only, so disable it*/ - zlibsettings.custom_zlib = 0; - zlibsettings.custom_deflate = 0; - for(type = 0; type != 5; ++type) - { - attempt[type] = (unsigned char*)lodepng_malloc(linebytes); - if(!attempt[type]) return 83; /*alloc fail*/ - } - for(y = 0; y != h; ++y) /*try the 5 filter types*/ - { - for(type = 0; type != 5; ++type) - { - unsigned testsize = linebytes; - /*if(testsize > 8) testsize /= 8;*/ /*it already works good enough by testing a part of the row*/ - - filterScanline(attempt[type], &in[y * linebytes], prevline, linebytes, bytewidth, type); - size[type] = 0; - dummy = 0; - zlib_compress(&dummy, &size[type], attempt[type], testsize, &zlibsettings); - lodepng_free(dummy); - /*check if this is smallest size (or if type == 0 it's the first case so always store the values)*/ - if(type == 0 || size[type] < smallest) - { - bestType = type; - smallest = size[type]; - } - } - prevline = &in[y * linebytes]; - out[y * (linebytes + 1)] = bestType; /*the first byte of a scanline will be the filter type*/ - for(x = 0; x != linebytes; ++x) out[y * (linebytes + 1) + 1 + x] = attempt[bestType][x]; - } - for(type = 0; type != 5; ++type) lodepng_free(attempt[type]); - } - else return 88; /* unknown filter strategy */ - - return error; -} - -static void addPaddingBits(unsigned char* out, const unsigned char* in, - size_t olinebits, size_t ilinebits, unsigned h) -{ - /*The opposite of the removePaddingBits function - olinebits must be >= ilinebits*/ - unsigned y; - size_t diff = olinebits - ilinebits; - size_t obp = 0, ibp = 0; /*bit pointers*/ - for(y = 0; y != h; ++y) - { - size_t x; - for(x = 0; x < ilinebits; ++x) - { - unsigned char bit = readBitFromReversedStream(&ibp, in); - setBitOfReversedStream(&obp, out, bit); - } - /*obp += diff; --> no, fill in some value in the padding bits too, to avoid - "Use of uninitialised value of size ###" warning from valgrind*/ - for(x = 0; x != diff; ++x) setBitOfReversedStream(&obp, out, 0); - } -} - -/* -in: non-interlaced image with size w*h -out: the same pixels, but re-ordered according to PNG's Adam7 interlacing, with - no padding bits between scanlines, but between reduced images so that each - reduced image starts at a byte. -bpp: bits per pixel -there are no padding bits, not between scanlines, not between reduced images -in has the following size in bits: w * h * bpp. -out is possibly bigger due to padding bits between reduced images -NOTE: comments about padding bits are only relevant if bpp < 8 -*/ -static void Adam7_interlace(unsigned char* out, const unsigned char* in, unsigned w, unsigned h, unsigned bpp) -{ - unsigned passw[7], passh[7]; - size_t filter_passstart[8], padded_passstart[8], passstart[8]; - unsigned i; - - Adam7_getpassvalues(passw, passh, filter_passstart, padded_passstart, passstart, w, h, bpp); - - if(bpp >= 8) - { - for(i = 0; i != 7; ++i) - { - unsigned x, y, b; - size_t bytewidth = bpp / 8; - for(y = 0; y < passh[i]; ++y) - for(x = 0; x < passw[i]; ++x) - { - size_t pixelinstart = ((ADAM7_IY[i] + y * ADAM7_DY[i]) * w + ADAM7_IX[i] + x * ADAM7_DX[i]) * bytewidth; - size_t pixeloutstart = passstart[i] + (y * passw[i] + x) * bytewidth; - for(b = 0; b < bytewidth; ++b) - { - out[pixeloutstart + b] = in[pixelinstart + b]; - } - } - } - } - else /*bpp < 8: Adam7 with pixels < 8 bit is a bit trickier: with bit pointers*/ - { - for(i = 0; i != 7; ++i) - { - unsigned x, y, b; - unsigned ilinebits = bpp * passw[i]; - unsigned olinebits = bpp * w; - size_t obp, ibp; /*bit pointers (for out and in buffer)*/ - for(y = 0; y < passh[i]; ++y) - for(x = 0; x < passw[i]; ++x) - { - ibp = (ADAM7_IY[i] + y * ADAM7_DY[i]) * olinebits + (ADAM7_IX[i] + x * ADAM7_DX[i]) * bpp; - obp = (8 * passstart[i]) + (y * ilinebits + x * bpp); - for(b = 0; b < bpp; ++b) - { - unsigned char bit = readBitFromReversedStream(&ibp, in); - setBitOfReversedStream(&obp, out, bit); - } - } - } - } -} - -/*out must be buffer big enough to contain uncompressed IDAT chunk data, and in must contain the full image. -return value is error**/ -static unsigned preProcessScanlines(unsigned char** out, size_t* outsize, const unsigned char* in, - unsigned w, unsigned h, - const LodePNGInfo* info_png, const LodePNGEncoderSettings* settings) -{ - /* - This function converts the pure 2D image with the PNG's colortype, into filtered-padded-interlaced data. Steps: - *) if no Adam7: 1) add padding bits (= posible extra bits per scanline if bpp < 8) 2) filter - *) if adam7: 1) Adam7_interlace 2) 7x add padding bits 3) 7x filter - */ - unsigned bpp = lodepng_get_bpp(&info_png->color); - unsigned error = 0; - - if(info_png->interlace_method == 0) - { - *outsize = h + (h * ((w * bpp + 7) / 8)); /*image size plus an extra byte per scanline + possible padding bits*/ - *out = (unsigned char*)lodepng_malloc(*outsize); - if(!(*out) && (*outsize)) error = 83; /*alloc fail*/ - - if(!error) - { - /*non multiple of 8 bits per scanline, padding bits needed per scanline*/ - if(bpp < 8 && w * bpp != ((w * bpp + 7) / 8) * 8) - { - unsigned char* padded = (unsigned char*)lodepng_malloc(h * ((w * bpp + 7) / 8)); - if(!padded) error = 83; /*alloc fail*/ - if(!error) - { - addPaddingBits(padded, in, ((w * bpp + 7) / 8) * 8, w * bpp, h); - error = filter(*out, padded, w, h, &info_png->color, settings); - } - lodepng_free(padded); - } - else - { - /*we can immediately filter into the out buffer, no other steps needed*/ - error = filter(*out, in, w, h, &info_png->color, settings); - } - } - } - else /*interlace_method is 1 (Adam7)*/ - { - unsigned passw[7], passh[7]; - size_t filter_passstart[8], padded_passstart[8], passstart[8]; - unsigned char* adam7; - - Adam7_getpassvalues(passw, passh, filter_passstart, padded_passstart, passstart, w, h, bpp); - - *outsize = filter_passstart[7]; /*image size plus an extra byte per scanline + possible padding bits*/ - *out = (unsigned char*)lodepng_malloc(*outsize); - if(!(*out)) error = 83; /*alloc fail*/ - - adam7 = (unsigned char*)lodepng_malloc(passstart[7]); - if(!adam7 && passstart[7]) error = 83; /*alloc fail*/ - - if(!error) - { - unsigned i; - - Adam7_interlace(adam7, in, w, h, bpp); - for(i = 0; i != 7; ++i) - { - if(bpp < 8) - { - unsigned char* padded = (unsigned char*)lodepng_malloc(padded_passstart[i + 1] - padded_passstart[i]); - if(!padded) ERROR_BREAK(83); /*alloc fail*/ - addPaddingBits(padded, &adam7[passstart[i]], - ((passw[i] * bpp + 7) / 8) * 8, passw[i] * bpp, passh[i]); - error = filter(&(*out)[filter_passstart[i]], padded, - passw[i], passh[i], &info_png->color, settings); - lodepng_free(padded); - } - else - { - error = filter(&(*out)[filter_passstart[i]], &adam7[padded_passstart[i]], - passw[i], passh[i], &info_png->color, settings); - } - - if(error) break; - } - } - - lodepng_free(adam7); - } - - return error; -} - -/* -palette must have 4 * palettesize bytes allocated, and given in format RGBARGBARGBARGBA... -returns 0 if the palette is opaque, -returns 1 if the palette has a single color with alpha 0 ==> color key -returns 2 if the palette is semi-translucent. -*/ -static unsigned getPaletteTranslucency(const unsigned char* palette, size_t palettesize) -{ - size_t i; - unsigned key = 0; - unsigned r = 0, g = 0, b = 0; /*the value of the color with alpha 0, so long as color keying is possible*/ - for(i = 0; i != palettesize; ++i) - { - if(!key && palette[4 * i + 3] == 0) - { - r = palette[4 * i + 0]; g = palette[4 * i + 1]; b = palette[4 * i + 2]; - key = 1; - i = (size_t)(-1); /*restart from beginning, to detect earlier opaque colors with key's value*/ - } - else if(palette[4 * i + 3] != 255) return 2; - /*when key, no opaque RGB may have key's RGB*/ - else if(key && r == palette[i * 4 + 0] && g == palette[i * 4 + 1] && b == palette[i * 4 + 2]) return 2; - } - return key; -} - -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS -static unsigned addUnknownChunks(ucvector* out, unsigned char* data, size_t datasize) -{ - unsigned char* inchunk = data; - while((size_t)(inchunk - data) < datasize) - { - CERROR_TRY_RETURN(lodepng_chunk_append(&out->data, &out->size, inchunk)); - out->allocsize = out->size; /*fix the allocsize again*/ - inchunk = lodepng_chunk_next(inchunk); - } - return 0; -} -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ - -unsigned lodepng_encode(unsigned char** out, size_t* outsize, - const unsigned char* image, unsigned w, unsigned h, - LodePNGState* state) -{ - LodePNGInfo info; - ucvector outv; - unsigned char* data = 0; /*uncompressed version of the IDAT chunk data*/ - size_t datasize = 0; - - /*provide some proper output values if error will happen*/ - *out = 0; - *outsize = 0; - state->error = 0; - - /*check input values validity*/ - if((state->info_png.color.colortype == LCT_PALETTE || state->encoder.force_palette) - && (state->info_png.color.palettesize == 0 || state->info_png.color.palettesize > 256)) - { - CERROR_RETURN_ERROR(state->error, 68); /*invalid palette size, it is only allowed to be 1-256*/ - } - if(state->encoder.zlibsettings.btype > 2) - { - CERROR_RETURN_ERROR(state->error, 61); /*error: unexisting btype*/ - } - if(state->info_png.interlace_method > 1) - { - CERROR_RETURN_ERROR(state->error, 71); /*error: unexisting interlace mode*/ - } - state->error = checkColorValidity(state->info_png.color.colortype, state->info_png.color.bitdepth); - if(state->error) return state->error; /*error: unexisting color type given*/ - state->error = checkColorValidity(state->info_raw.colortype, state->info_raw.bitdepth); - if(state->error) return state->error; /*error: unexisting color type given*/ - - /* color convert and compute scanline filter types */ - lodepng_info_init(&info); - lodepng_info_copy(&info, &state->info_png); - if(state->encoder.auto_convert) - { - state->error = lodepng_auto_choose_color(&info.color, image, w, h, &state->info_raw); - } - if (!state->error) - { - if(!lodepng_color_mode_equal(&state->info_raw, &info.color)) - { - unsigned char* converted; - size_t size = (w * h * (size_t)lodepng_get_bpp(&info.color) + 7) / 8; - - converted = (unsigned char*)lodepng_malloc(size); - if(!converted && size) state->error = 83; /*alloc fail*/ - if(!state->error) - { - state->error = lodepng_convert(converted, image, &info.color, &state->info_raw, w, h); - } - if(!state->error) preProcessScanlines(&data, &datasize, converted, w, h, &info, &state->encoder); - lodepng_free(converted); - } - else preProcessScanlines(&data, &datasize, image, w, h, &info, &state->encoder); - } - - /* output all PNG chunks */ - ucvector_init(&outv); - while(!state->error) /*while only executed once, to break on error*/ - { -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS - size_t i; -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ - /*write signature and chunks*/ - writeSignature(&outv); - /*IHDR*/ - addChunk_IHDR(&outv, w, h, info.color.colortype, info.color.bitdepth, info.interlace_method); -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS - /*unknown chunks between IHDR and PLTE*/ - if(info.unknown_chunks_data[0]) - { - state->error = addUnknownChunks(&outv, info.unknown_chunks_data[0], info.unknown_chunks_size[0]); - if(state->error) break; - } -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ - /*PLTE*/ - if(info.color.colortype == LCT_PALETTE) - { - addChunk_PLTE(&outv, &info.color); - } - if(state->encoder.force_palette && (info.color.colortype == LCT_RGB || info.color.colortype == LCT_RGBA)) - { - addChunk_PLTE(&outv, &info.color); - } - /*tRNS*/ - if(info.color.colortype == LCT_PALETTE && getPaletteTranslucency(info.color.palette, info.color.palettesize) != 0) - { - addChunk_tRNS(&outv, &info.color); - } - if((info.color.colortype == LCT_GREY || info.color.colortype == LCT_RGB) && info.color.key_defined) - { - addChunk_tRNS(&outv, &info.color); - } -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS - /*bKGD (must come between PLTE and the IDAt chunks*/ - if(info.background_defined) addChunk_bKGD(&outv, &info); - /*pHYs (must come before the IDAT chunks)*/ - if(info.phys_defined) addChunk_pHYs(&outv, &info); - - /*unknown chunks between PLTE and IDAT*/ - if(info.unknown_chunks_data[1]) - { - state->error = addUnknownChunks(&outv, info.unknown_chunks_data[1], info.unknown_chunks_size[1]); - if(state->error) break; - } -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ - /*IDAT (multiple IDAT chunks must be consecutive)*/ - state->error = addChunk_IDAT(&outv, data, datasize, &state->encoder.zlibsettings); - if(state->error) break; -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS - /*tIME*/ - if(info.time_defined) addChunk_tIME(&outv, &info.time); - /*tEXt and/or zTXt*/ - for(i = 0; i != info.text_num; ++i) - { - if(strlen(info.text_keys[i]) > 79) - { - state->error = 66; /*text chunk too large*/ - break; - } - if(strlen(info.text_keys[i]) < 1) - { - state->error = 67; /*text chunk too small*/ - break; - } - if(state->encoder.text_compression) - { - addChunk_zTXt(&outv, info.text_keys[i], info.text_strings[i], &state->encoder.zlibsettings); - } - else - { - addChunk_tEXt(&outv, info.text_keys[i], info.text_strings[i]); - } - } - /*LodePNG version id in text chunk*/ - if(state->encoder.add_id) - { - unsigned alread_added_id_text = 0; - for(i = 0; i != info.text_num; ++i) - { - if(!strcmp(info.text_keys[i], "LodePNG")) - { - alread_added_id_text = 1; - break; - } - } - if(alread_added_id_text == 0) - { - addChunk_tEXt(&outv, "LodePNG", LODEPNG_VERSION_STRING); /*it's shorter as tEXt than as zTXt chunk*/ - } - } - /*iTXt*/ - for(i = 0; i != info.itext_num; ++i) - { - if(strlen(info.itext_keys[i]) > 79) - { - state->error = 66; /*text chunk too large*/ - break; - } - if(strlen(info.itext_keys[i]) < 1) - { - state->error = 67; /*text chunk too small*/ - break; - } - addChunk_iTXt(&outv, state->encoder.text_compression, - info.itext_keys[i], info.itext_langtags[i], info.itext_transkeys[i], info.itext_strings[i], - &state->encoder.zlibsettings); - } - - /*unknown chunks between IDAT and IEND*/ - if(info.unknown_chunks_data[2]) - { - state->error = addUnknownChunks(&outv, info.unknown_chunks_data[2], info.unknown_chunks_size[2]); - if(state->error) break; - } -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ - addChunk_IEND(&outv); - - break; /*this isn't really a while loop; no error happened so break out now!*/ - } - - lodepng_info_cleanup(&info); - lodepng_free(data); - /*instead of cleaning the vector up, give it to the output*/ - *out = outv.data; - *outsize = outv.size; - - return state->error; -} - -unsigned lodepng_encode_memory(unsigned char** out, size_t* outsize, const unsigned char* image, - unsigned w, unsigned h, LodePNGColorType colortype, unsigned bitdepth) -{ - unsigned error; - LodePNGState state; - lodepng_state_init(&state); - state.info_raw.colortype = colortype; - state.info_raw.bitdepth = bitdepth; - state.info_png.color.colortype = colortype; - state.info_png.color.bitdepth = bitdepth; - lodepng_encode(out, outsize, image, w, h, &state); - error = state.error; - lodepng_state_cleanup(&state); - return error; -} - -unsigned lodepng_encode32(unsigned char** out, size_t* outsize, const unsigned char* image, unsigned w, unsigned h) -{ - return lodepng_encode_memory(out, outsize, image, w, h, LCT_RGBA, 8); -} - -unsigned lodepng_encode24(unsigned char** out, size_t* outsize, const unsigned char* image, unsigned w, unsigned h) -{ - return lodepng_encode_memory(out, outsize, image, w, h, LCT_RGB, 8); -} - -#ifdef LODEPNG_COMPILE_DISK -unsigned lodepng_encode_file(const char* filename, const unsigned char* image, unsigned w, unsigned h, - LodePNGColorType colortype, unsigned bitdepth) -{ - unsigned char* buffer; - size_t buffersize; - unsigned error = lodepng_encode_memory(&buffer, &buffersize, image, w, h, colortype, bitdepth); - if(!error) error = lodepng_save_file(buffer, buffersize, filename); - lodepng_free(buffer); - return error; -} - -unsigned lodepng_encode32_file(const char* filename, const unsigned char* image, unsigned w, unsigned h) -{ - return lodepng_encode_file(filename, image, w, h, LCT_RGBA, 8); -} - -unsigned lodepng_encode24_file(const char* filename, const unsigned char* image, unsigned w, unsigned h) -{ - return lodepng_encode_file(filename, image, w, h, LCT_RGB, 8); -} -#endif /*LODEPNG_COMPILE_DISK*/ - -void lodepng_encoder_settings_init(LodePNGEncoderSettings* settings) -{ - lodepng_compress_settings_init(&settings->zlibsettings); - settings->filter_palette_zero = 1; - settings->filter_strategy = LFS_MINSUM; - settings->auto_convert = 1; - settings->force_palette = 0; - settings->predefined_filters = 0; -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS - settings->add_id = 0; - settings->text_compression = 1; -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ -} - -#endif /*LODEPNG_COMPILE_ENCODER*/ -#endif /*LODEPNG_COMPILE_PNG*/ - -#ifdef LODEPNG_COMPILE_ERROR_TEXT -/* -This returns the description of a numerical error code in English. This is also -the documentation of all the error codes. -*/ -const char* lodepng_error_text(unsigned code) -{ - switch(code) - { - case 0: return "no error, everything went ok"; - case 1: return "nothing done yet"; /*the Encoder/Decoder has done nothing yet, error checking makes no sense yet*/ - case 10: return "end of input memory reached without huffman end code"; /*while huffman decoding*/ - case 11: return "error in code tree made it jump outside of huffman tree"; /*while huffman decoding*/ - case 13: return "problem while processing dynamic deflate block"; - case 14: return "problem while processing dynamic deflate block"; - case 15: return "problem while processing dynamic deflate block"; - case 16: return "unexisting code while processing dynamic deflate block"; - case 17: return "end of out buffer memory reached while inflating"; - case 18: return "invalid distance code while inflating"; - case 19: return "end of out buffer memory reached while inflating"; - case 20: return "invalid deflate block BTYPE encountered while decoding"; - case 21: return "NLEN is not ones complement of LEN in a deflate block"; - /*end of out buffer memory reached while inflating: - This can happen if the inflated deflate data is longer than the amount of bytes required to fill up - all the pixels of the image, given the color depth and image dimensions. Something that doesn't - happen in a normal, well encoded, PNG image.*/ - case 22: return "end of out buffer memory reached while inflating"; - case 23: return "end of in buffer memory reached while inflating"; - case 24: return "invalid FCHECK in zlib header"; - case 25: return "invalid compression method in zlib header"; - case 26: return "FDICT encountered in zlib header while it's not used for PNG"; - case 27: return "PNG file is smaller than a PNG header"; - /*Checks the magic file header, the first 8 bytes of the PNG file*/ - case 28: return "incorrect PNG signature, it's no PNG or corrupted"; - case 29: return "first chunk is not the header chunk"; - case 30: return "chunk length too large, chunk broken off at end of file"; - case 31: return "illegal PNG color type or bpp"; - case 32: return "illegal PNG compression method"; - case 33: return "illegal PNG filter method"; - case 34: return "illegal PNG interlace method"; - case 35: return "chunk length of a chunk is too large or the chunk too small"; - case 36: return "illegal PNG filter type encountered"; - case 37: return "illegal bit depth for this color type given"; - case 38: return "the palette is too big"; /*more than 256 colors*/ - case 39: return "more palette alpha values given in tRNS chunk than there are colors in the palette"; - case 40: return "tRNS chunk has wrong size for greyscale image"; - case 41: return "tRNS chunk has wrong size for RGB image"; - case 42: return "tRNS chunk appeared while it was not allowed for this color type"; - case 43: return "bKGD chunk has wrong size for palette image"; - case 44: return "bKGD chunk has wrong size for greyscale image"; - case 45: return "bKGD chunk has wrong size for RGB image"; - case 48: return "empty input buffer given to decoder. Maybe caused by non-existing file?"; - case 49: return "jumped past memory while generating dynamic huffman tree"; - case 50: return "jumped past memory while generating dynamic huffman tree"; - case 51: return "jumped past memory while inflating huffman block"; - case 52: return "jumped past memory while inflating"; - case 53: return "size of zlib data too small"; - case 54: return "repeat symbol in tree while there was no value symbol yet"; - /*jumped past tree while generating huffman tree, this could be when the - tree will have more leaves than symbols after generating it out of the - given lenghts. They call this an oversubscribed dynamic bit lengths tree in zlib.*/ - case 55: return "jumped past tree while generating huffman tree"; - case 56: return "given output image colortype or bitdepth not supported for color conversion"; - case 57: return "invalid CRC encountered (checking CRC can be disabled)"; - case 58: return "invalid ADLER32 encountered (checking ADLER32 can be disabled)"; - case 59: return "requested color conversion not supported"; - case 60: return "invalid window size given in the settings of the encoder (must be 0-32768)"; - case 61: return "invalid BTYPE given in the settings of the encoder (only 0, 1 and 2 are allowed)"; - /*LodePNG leaves the choice of RGB to greyscale conversion formula to the user.*/ - case 62: return "conversion from color to greyscale not supported"; - case 63: return "length of a chunk too long, max allowed for PNG is 2147483647 bytes per chunk"; /*(2^31-1)*/ - /*this would result in the inability of a deflated block to ever contain an end code. It must be at least 1.*/ - case 64: return "the length of the END symbol 256 in the Huffman tree is 0"; - case 66: return "the length of a text chunk keyword given to the encoder is longer than the maximum of 79 bytes"; - case 67: return "the length of a text chunk keyword given to the encoder is smaller than the minimum of 1 byte"; - case 68: return "tried to encode a PLTE chunk with a palette that has less than 1 or more than 256 colors"; - case 69: return "unknown chunk type with 'critical' flag encountered by the decoder"; - case 71: return "unexisting interlace mode given to encoder (must be 0 or 1)"; - case 72: return "while decoding, unexisting compression method encountering in zTXt or iTXt chunk (it must be 0)"; - case 73: return "invalid tIME chunk size"; - case 74: return "invalid pHYs chunk size"; - /*length could be wrong, or data chopped off*/ - case 75: return "no null termination char found while decoding text chunk"; - case 76: return "iTXt chunk too short to contain required bytes"; - case 77: return "integer overflow in buffer size"; - case 78: return "failed to open file for reading"; /*file doesn't exist or couldn't be opened for reading*/ - case 79: return "failed to open file for writing"; - case 80: return "tried creating a tree of 0 symbols"; - case 81: return "lazy matching at pos 0 is impossible"; - case 82: return "color conversion to palette requested while a color isn't in palette"; - case 83: return "memory allocation failed"; - case 84: return "given image too small to contain all pixels to be encoded"; - case 86: return "impossible offset in lz77 encoding (internal bug)"; - case 87: return "must provide custom zlib function pointer if LODEPNG_COMPILE_ZLIB is not defined"; - case 88: return "invalid filter strategy given for LodePNGEncoderSettings.filter_strategy"; - case 89: return "text chunk keyword too short or long: must have size 1-79"; - /*the windowsize in the LodePNGCompressSettings. Requiring POT(==> & instead of %) makes encoding 12% faster.*/ - case 90: return "windowsize must be a power of two"; - case 91: return "invalid decompressed idat size"; - case 92: return "too many pixels, not supported"; - case 93: return "zero width or height is invalid"; - case 94: return "header chunk must have a size of 13 bytes"; - } - return "unknown error code"; -} -#endif /*LODEPNG_COMPILE_ERROR_TEXT*/ - -/* ////////////////////////////////////////////////////////////////////////// */ -/* ////////////////////////////////////////////////////////////////////////// */ -/* // C++ Wrapper // */ -/* ////////////////////////////////////////////////////////////////////////// */ -/* ////////////////////////////////////////////////////////////////////////// */ - -#ifdef LODEPNG_COMPILE_CPP -namespace lodepng -{ - -#ifdef LODEPNG_COMPILE_DISK -unsigned load_file(std::vector& buffer, const std::string& filename) -{ - long size = lodepng_filesize(filename.c_str()); - if(size < 0) return 78; - buffer.resize((size_t)size); - return size == 0 ? 0 : lodepng_buffer_file(&buffer[0], (size_t)size, filename.c_str()); -} - -/*write given buffer to the file, overwriting the file, it doesn't append to it.*/ -unsigned save_file(const std::vector& buffer, const std::string& filename) -{ - return lodepng_save_file(buffer.empty() ? 0 : &buffer[0], buffer.size(), filename.c_str()); -} -#endif /* LODEPNG_COMPILE_DISK */ - -#ifdef LODEPNG_COMPILE_ZLIB -#ifdef LODEPNG_COMPILE_DECODER -unsigned decompress(std::vector& out, const unsigned char* in, size_t insize, - const LodePNGDecompressSettings& settings) -{ - unsigned char* buffer = 0; - size_t buffersize = 0; - unsigned error = zlib_decompress(&buffer, &buffersize, in, insize, &settings); - if(buffer) - { - out.insert(out.end(), &buffer[0], &buffer[buffersize]); - lodepng_free(buffer); - } - return error; -} - -unsigned decompress(std::vector& out, const std::vector& in, - const LodePNGDecompressSettings& settings) -{ - return decompress(out, in.empty() ? 0 : &in[0], in.size(), settings); -} -#endif /* LODEPNG_COMPILE_DECODER */ - -#ifdef LODEPNG_COMPILE_ENCODER -unsigned compress(std::vector& out, const unsigned char* in, size_t insize, - const LodePNGCompressSettings& settings) -{ - unsigned char* buffer = 0; - size_t buffersize = 0; - unsigned error = zlib_compress(&buffer, &buffersize, in, insize, &settings); - if(buffer) - { - out.insert(out.end(), &buffer[0], &buffer[buffersize]); - lodepng_free(buffer); - } - return error; -} - -unsigned compress(std::vector& out, const std::vector& in, - const LodePNGCompressSettings& settings) -{ - return compress(out, in.empty() ? 0 : &in[0], in.size(), settings); -} -#endif /* LODEPNG_COMPILE_ENCODER */ -#endif /* LODEPNG_COMPILE_ZLIB */ - - -#ifdef LODEPNG_COMPILE_PNG - -State::State() -{ - lodepng_state_init(this); -} - -State::State(const State& other) -{ - lodepng_state_init(this); - lodepng_state_copy(this, &other); -} - -State::~State() -{ - lodepng_state_cleanup(this); -} - -State& State::operator=(const State& other) -{ - lodepng_state_copy(this, &other); - return *this; -} - -#ifdef LODEPNG_COMPILE_DECODER - -unsigned decode(std::vector& out, unsigned& w, unsigned& h, const unsigned char* in, - size_t insize, LodePNGColorType colortype, unsigned bitdepth) -{ - unsigned char* buffer; - unsigned error = lodepng_decode_memory(&buffer, &w, &h, in, insize, colortype, bitdepth); - if(buffer && !error) - { - State state; - state.info_raw.colortype = colortype; - state.info_raw.bitdepth = bitdepth; - size_t buffersize = lodepng_get_raw_size(w, h, &state.info_raw); - out.insert(out.end(), &buffer[0], &buffer[buffersize]); - lodepng_free(buffer); - } - return error; -} - -unsigned decode(std::vector& out, unsigned& w, unsigned& h, - const std::vector& in, LodePNGColorType colortype, unsigned bitdepth) -{ - return decode(out, w, h, in.empty() ? 0 : &in[0], (unsigned)in.size(), colortype, bitdepth); -} - -unsigned decode(std::vector& out, unsigned& w, unsigned& h, - State& state, - const unsigned char* in, size_t insize) -{ - unsigned char* buffer = NULL; - unsigned error = lodepng_decode(&buffer, &w, &h, &state, in, insize); - if(buffer && !error) - { - size_t buffersize = lodepng_get_raw_size(w, h, &state.info_raw); - out.insert(out.end(), &buffer[0], &buffer[buffersize]); - } - lodepng_free(buffer); - return error; -} - -unsigned decode(std::vector& out, unsigned& w, unsigned& h, - State& state, - const std::vector& in) -{ - return decode(out, w, h, state, in.empty() ? 0 : &in[0], in.size()); -} - -#ifdef LODEPNG_COMPILE_DISK -unsigned decode(std::vector& out, unsigned& w, unsigned& h, const std::string& filename, - LodePNGColorType colortype, unsigned bitdepth) -{ - std::vector buffer; - unsigned error = load_file(buffer, filename); - if(error) return error; - return decode(out, w, h, buffer, colortype, bitdepth); -} -#endif /* LODEPNG_COMPILE_DECODER */ -#endif /* LODEPNG_COMPILE_DISK */ - -#ifdef LODEPNG_COMPILE_ENCODER -unsigned encode(std::vector& out, const unsigned char* in, unsigned w, unsigned h, - LodePNGColorType colortype, unsigned bitdepth) -{ - unsigned char* buffer; - size_t buffersize; - unsigned error = lodepng_encode_memory(&buffer, &buffersize, in, w, h, colortype, bitdepth); - if(buffer) - { - out.insert(out.end(), &buffer[0], &buffer[buffersize]); - lodepng_free(buffer); - } - return error; -} - -unsigned encode(std::vector& out, - const std::vector& in, unsigned w, unsigned h, - LodePNGColorType colortype, unsigned bitdepth) -{ - if(lodepng_get_raw_size_lct(w, h, colortype, bitdepth) > in.size()) return 84; - return encode(out, in.empty() ? 0 : &in[0], w, h, colortype, bitdepth); -} - -unsigned encode(std::vector& out, - const unsigned char* in, unsigned w, unsigned h, - State& state) -{ - unsigned char* buffer; - size_t buffersize; - unsigned error = lodepng_encode(&buffer, &buffersize, in, w, h, &state); - if(buffer) - { - out.insert(out.end(), &buffer[0], &buffer[buffersize]); - lodepng_free(buffer); - } - return error; -} - -unsigned encode(std::vector& out, - const std::vector& in, unsigned w, unsigned h, - State& state) -{ - if(lodepng_get_raw_size(w, h, &state.info_raw) > in.size()) return 84; - return encode(out, in.empty() ? 0 : &in[0], w, h, state); -} - -#ifdef LODEPNG_COMPILE_DISK -unsigned encode(const std::string& filename, - const unsigned char* in, unsigned w, unsigned h, - LodePNGColorType colortype, unsigned bitdepth) -{ - std::vector buffer; - unsigned error = encode(buffer, in, w, h, colortype, bitdepth); - if(!error) error = save_file(buffer, filename); - return error; -} - -unsigned encode(const std::string& filename, - const std::vector& in, unsigned w, unsigned h, - LodePNGColorType colortype, unsigned bitdepth) -{ - if(lodepng_get_raw_size_lct(w, h, colortype, bitdepth) > in.size()) return 84; - return encode(filename, in.empty() ? 0 : &in[0], w, h, colortype, bitdepth); -} -#endif /* LODEPNG_COMPILE_DISK */ -#endif /* LODEPNG_COMPILE_ENCODER */ -#endif /* LODEPNG_COMPILE_PNG */ -} /* namespace lodepng */ -#endif /*LODEPNG_COMPILE_CPP*/ diff --git a/love/src/jni/love/src/libraries/lodepng/lodepng.h b/love/src/jni/love/src/libraries/lodepng/lodepng.h deleted file mode 100755 index d633bfae..00000000 --- a/love/src/jni/love/src/libraries/lodepng/lodepng.h +++ /dev/null @@ -1,1762 +0,0 @@ -/* -LodePNG version 20170917 - -Copyright (c) 2005-2017 Lode Vandevenne - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - - 3. This notice may not be removed or altered from any source - distribution. -*/ - -#ifndef LODEPNG_H -#define LODEPNG_H - -#include /*for size_t*/ - -extern const char* LODEPNG_VERSION_STRING; - -/* -The following #defines are used to create code sections. They can be disabled -to disable code sections, which can give faster compile time and smaller binary. -The "NO_COMPILE" defines are designed to be used to pass as defines to the -compiler command to disable them without modifying this header, e.g. --DLODEPNG_NO_COMPILE_ZLIB for gcc. -In addition to those below, you can also define LODEPNG_NO_COMPILE_CRC to -allow implementing a custom lodepng_crc32. -*/ -/*deflate & zlib. If disabled, you must specify alternative zlib functions in -the custom_zlib field of the compress and decompress settings*/ -#ifndef LODEPNG_NO_COMPILE_ZLIB -#define LODEPNG_COMPILE_ZLIB -#endif -/*png encoder and png decoder*/ -#ifndef LODEPNG_NO_COMPILE_PNG -#define LODEPNG_COMPILE_PNG -#endif -/*deflate&zlib decoder and png decoder*/ -#ifndef LODEPNG_NO_COMPILE_DECODER -#define LODEPNG_COMPILE_DECODER -#endif -/*deflate&zlib encoder and png encoder*/ -#ifndef LODEPNG_NO_COMPILE_ENCODER -#define LODEPNG_COMPILE_ENCODER -#endif -/*the optional built in harddisk file loading and saving functions*/ -#ifndef LODEPNG_NO_COMPILE_DISK -#define LODEPNG_COMPILE_DISK -#endif -/*support for chunks other than IHDR, IDAT, PLTE, tRNS, IEND: ancillary and unknown chunks*/ -#ifndef LODEPNG_NO_COMPILE_ANCILLARY_CHUNKS -#define LODEPNG_COMPILE_ANCILLARY_CHUNKS -#endif -/*ability to convert error numerical codes to English text string*/ -#ifndef LODEPNG_NO_COMPILE_ERROR_TEXT -#define LODEPNG_COMPILE_ERROR_TEXT -#endif -/*Compile the default allocators (C's free, malloc and realloc). If you disable this, -you can define the functions lodepng_free, lodepng_malloc and lodepng_realloc in your -source files with custom allocators.*/ -#ifndef LODEPNG_NO_COMPILE_ALLOCATORS -#define LODEPNG_COMPILE_ALLOCATORS -#endif -/*compile the C++ version (you can disable the C++ wrapper here even when compiling for C++)*/ -#ifdef __cplusplus -#ifndef LODEPNG_NO_COMPILE_CPP -#define LODEPNG_COMPILE_CPP -#endif -#endif - -#ifdef LODEPNG_COMPILE_CPP -#include -#include -#endif /*LODEPNG_COMPILE_CPP*/ - -#ifdef LODEPNG_COMPILE_PNG -/*The PNG color types (also used for raw).*/ -typedef enum LodePNGColorType -{ - LCT_GREY = 0, /*greyscale: 1,2,4,8,16 bit*/ - LCT_RGB = 2, /*RGB: 8,16 bit*/ - LCT_PALETTE = 3, /*palette: 1,2,4,8 bit*/ - LCT_GREY_ALPHA = 4, /*greyscale with alpha: 8,16 bit*/ - LCT_RGBA = 6 /*RGB with alpha: 8,16 bit*/ -} LodePNGColorType; - -#ifdef LODEPNG_COMPILE_DECODER -/* -Converts PNG data in memory to raw pixel data. -out: Output parameter. Pointer to buffer that will contain the raw pixel data. - After decoding, its size is w * h * (bytes per pixel) bytes larger than - initially. Bytes per pixel depends on colortype and bitdepth. - Must be freed after usage with free(*out). - Note: for 16-bit per channel colors, uses big endian format like PNG does. -w: Output parameter. Pointer to width of pixel data. -h: Output parameter. Pointer to height of pixel data. -in: Memory buffer with the PNG file. -insize: size of the in buffer. -colortype: the desired color type for the raw output image. See explanation on PNG color types. -bitdepth: the desired bit depth for the raw output image. See explanation on PNG color types. -Return value: LodePNG error code (0 means no error). -*/ -unsigned lodepng_decode_memory(unsigned char** out, unsigned* w, unsigned* h, - const unsigned char* in, size_t insize, - LodePNGColorType colortype, unsigned bitdepth); - -/*Same as lodepng_decode_memory, but always decodes to 32-bit RGBA raw image*/ -unsigned lodepng_decode32(unsigned char** out, unsigned* w, unsigned* h, - const unsigned char* in, size_t insize); - -/*Same as lodepng_decode_memory, but always decodes to 24-bit RGB raw image*/ -unsigned lodepng_decode24(unsigned char** out, unsigned* w, unsigned* h, - const unsigned char* in, size_t insize); - -#ifdef LODEPNG_COMPILE_DISK -/* -Load PNG from disk, from file with given name. -Same as the other decode functions, but instead takes a filename as input. -*/ -unsigned lodepng_decode_file(unsigned char** out, unsigned* w, unsigned* h, - const char* filename, - LodePNGColorType colortype, unsigned bitdepth); - -/*Same as lodepng_decode_file, but always decodes to 32-bit RGBA raw image.*/ -unsigned lodepng_decode32_file(unsigned char** out, unsigned* w, unsigned* h, - const char* filename); - -/*Same as lodepng_decode_file, but always decodes to 24-bit RGB raw image.*/ -unsigned lodepng_decode24_file(unsigned char** out, unsigned* w, unsigned* h, - const char* filename); -#endif /*LODEPNG_COMPILE_DISK*/ -#endif /*LODEPNG_COMPILE_DECODER*/ - - -#ifdef LODEPNG_COMPILE_ENCODER -/* -Converts raw pixel data into a PNG image in memory. The colortype and bitdepth - of the output PNG image cannot be chosen, they are automatically determined - by the colortype, bitdepth and content of the input pixel data. - Note: for 16-bit per channel colors, needs big endian format like PNG does. -out: Output parameter. Pointer to buffer that will contain the PNG image data. - Must be freed after usage with free(*out). -outsize: Output parameter. Pointer to the size in bytes of the out buffer. -image: The raw pixel data to encode. The size of this buffer should be - w * h * (bytes per pixel), bytes per pixel depends on colortype and bitdepth. -w: width of the raw pixel data in pixels. -h: height of the raw pixel data in pixels. -colortype: the color type of the raw input image. See explanation on PNG color types. -bitdepth: the bit depth of the raw input image. See explanation on PNG color types. -Return value: LodePNG error code (0 means no error). -*/ -unsigned lodepng_encode_memory(unsigned char** out, size_t* outsize, - const unsigned char* image, unsigned w, unsigned h, - LodePNGColorType colortype, unsigned bitdepth); - -/*Same as lodepng_encode_memory, but always encodes from 32-bit RGBA raw image.*/ -unsigned lodepng_encode32(unsigned char** out, size_t* outsize, - const unsigned char* image, unsigned w, unsigned h); - -/*Same as lodepng_encode_memory, but always encodes from 24-bit RGB raw image.*/ -unsigned lodepng_encode24(unsigned char** out, size_t* outsize, - const unsigned char* image, unsigned w, unsigned h); - -#ifdef LODEPNG_COMPILE_DISK -/* -Converts raw pixel data into a PNG file on disk. -Same as the other encode functions, but instead takes a filename as output. -NOTE: This overwrites existing files without warning! -*/ -unsigned lodepng_encode_file(const char* filename, - const unsigned char* image, unsigned w, unsigned h, - LodePNGColorType colortype, unsigned bitdepth); - -/*Same as lodepng_encode_file, but always encodes from 32-bit RGBA raw image.*/ -unsigned lodepng_encode32_file(const char* filename, - const unsigned char* image, unsigned w, unsigned h); - -/*Same as lodepng_encode_file, but always encodes from 24-bit RGB raw image.*/ -unsigned lodepng_encode24_file(const char* filename, - const unsigned char* image, unsigned w, unsigned h); -#endif /*LODEPNG_COMPILE_DISK*/ -#endif /*LODEPNG_COMPILE_ENCODER*/ - - -#ifdef LODEPNG_COMPILE_CPP -namespace lodepng -{ -#ifdef LODEPNG_COMPILE_DECODER -/*Same as lodepng_decode_memory, but decodes to an std::vector. The colortype -is the format to output the pixels to. Default is RGBA 8-bit per channel.*/ -unsigned decode(std::vector& out, unsigned& w, unsigned& h, - const unsigned char* in, size_t insize, - LodePNGColorType colortype = LCT_RGBA, unsigned bitdepth = 8); -unsigned decode(std::vector& out, unsigned& w, unsigned& h, - const std::vector& in, - LodePNGColorType colortype = LCT_RGBA, unsigned bitdepth = 8); -#ifdef LODEPNG_COMPILE_DISK -/* -Converts PNG file from disk to raw pixel data in memory. -Same as the other decode functions, but instead takes a filename as input. -*/ -unsigned decode(std::vector& out, unsigned& w, unsigned& h, - const std::string& filename, - LodePNGColorType colortype = LCT_RGBA, unsigned bitdepth = 8); -#endif /* LODEPNG_COMPILE_DISK */ -#endif /* LODEPNG_COMPILE_DECODER */ - -#ifdef LODEPNG_COMPILE_ENCODER -/*Same as lodepng_encode_memory, but encodes to an std::vector. colortype -is that of the raw input data. The output PNG color type will be auto chosen.*/ -unsigned encode(std::vector& out, - const unsigned char* in, unsigned w, unsigned h, - LodePNGColorType colortype = LCT_RGBA, unsigned bitdepth = 8); -unsigned encode(std::vector& out, - const std::vector& in, unsigned w, unsigned h, - LodePNGColorType colortype = LCT_RGBA, unsigned bitdepth = 8); -#ifdef LODEPNG_COMPILE_DISK -/* -Converts 32-bit RGBA raw pixel data into a PNG file on disk. -Same as the other encode functions, but instead takes a filename as output. -NOTE: This overwrites existing files without warning! -*/ -unsigned encode(const std::string& filename, - const unsigned char* in, unsigned w, unsigned h, - LodePNGColorType colortype = LCT_RGBA, unsigned bitdepth = 8); -unsigned encode(const std::string& filename, - const std::vector& in, unsigned w, unsigned h, - LodePNGColorType colortype = LCT_RGBA, unsigned bitdepth = 8); -#endif /* LODEPNG_COMPILE_DISK */ -#endif /* LODEPNG_COMPILE_ENCODER */ -} /* namespace lodepng */ -#endif /*LODEPNG_COMPILE_CPP*/ -#endif /*LODEPNG_COMPILE_PNG*/ - -#ifdef LODEPNG_COMPILE_ERROR_TEXT -/*Returns an English description of the numerical error code.*/ -const char* lodepng_error_text(unsigned code); -#endif /*LODEPNG_COMPILE_ERROR_TEXT*/ - -#ifdef LODEPNG_COMPILE_DECODER -/*Settings for zlib decompression*/ -typedef struct LodePNGDecompressSettings LodePNGDecompressSettings; -struct LodePNGDecompressSettings -{ - unsigned ignore_adler32; /*if 1, continue and don't give an error message if the Adler32 checksum is corrupted*/ - - /*use custom zlib decoder instead of built in one (default: null)*/ - unsigned (*custom_zlib)(unsigned char**, size_t*, - const unsigned char*, size_t, - const LodePNGDecompressSettings*); - /*use custom deflate decoder instead of built in one (default: null) - if custom_zlib is used, custom_deflate is ignored since only the built in - zlib function will call custom_deflate*/ - unsigned (*custom_inflate)(unsigned char**, size_t*, - const unsigned char*, size_t, - const LodePNGDecompressSettings*); - - const void* custom_context; /*optional custom settings for custom functions*/ -}; - -extern const LodePNGDecompressSettings lodepng_default_decompress_settings; -void lodepng_decompress_settings_init(LodePNGDecompressSettings* settings); -#endif /*LODEPNG_COMPILE_DECODER*/ - -#ifdef LODEPNG_COMPILE_ENCODER -/* -Settings for zlib compression. Tweaking these settings tweaks the balance -between speed and compression ratio. -*/ -typedef struct LodePNGCompressSettings LodePNGCompressSettings; -struct LodePNGCompressSettings /*deflate = compress*/ -{ - /*LZ77 related settings*/ - unsigned btype; /*the block type for LZ (0, 1, 2 or 3, see zlib standard). Should be 2 for proper compression.*/ - unsigned use_lz77; /*whether or not to use LZ77. Should be 1 for proper compression.*/ - unsigned windowsize; /*must be a power of two <= 32768. higher compresses more but is slower. Default value: 2048.*/ - unsigned minmatch; /*mininum lz77 length. 3 is normally best, 6 can be better for some PNGs. Default: 0*/ - unsigned nicematch; /*stop searching if >= this length found. Set to 258 for best compression. Default: 128*/ - unsigned lazymatching; /*use lazy matching: better compression but a bit slower. Default: true*/ - - /*use custom zlib encoder instead of built in one (default: null)*/ - unsigned (*custom_zlib)(unsigned char**, size_t*, - const unsigned char*, size_t, - const LodePNGCompressSettings*); - /*use custom deflate encoder instead of built in one (default: null) - if custom_zlib is used, custom_deflate is ignored since only the built in - zlib function will call custom_deflate*/ - unsigned (*custom_deflate)(unsigned char**, size_t*, - const unsigned char*, size_t, - const LodePNGCompressSettings*); - - const void* custom_context; /*optional custom settings for custom functions*/ -}; - -extern const LodePNGCompressSettings lodepng_default_compress_settings; -void lodepng_compress_settings_init(LodePNGCompressSettings* settings); -#endif /*LODEPNG_COMPILE_ENCODER*/ - -#ifdef LODEPNG_COMPILE_PNG -/* -Color mode of an image. Contains all information required to decode the pixel -bits to RGBA colors. This information is the same as used in the PNG file -format, and is used both for PNG and raw image data in LodePNG. -*/ -typedef struct LodePNGColorMode -{ - /*header (IHDR)*/ - LodePNGColorType colortype; /*color type, see PNG standard or documentation further in this header file*/ - unsigned bitdepth; /*bits per sample, see PNG standard or documentation further in this header file*/ - - /* - palette (PLTE and tRNS) - - Dynamically allocated with the colors of the palette, including alpha. - When encoding a PNG, to store your colors in the palette of the LodePNGColorMode, first use - lodepng_palette_clear, then for each color use lodepng_palette_add. - If you encode an image without alpha with palette, don't forget to put value 255 in each A byte of the palette. - - When decoding, by default you can ignore this palette, since LodePNG already - fills the palette colors in the pixels of the raw RGBA output. - - The palette is only supported for color type 3. - */ - unsigned char* palette; /*palette in RGBARGBA... order. When allocated, must be either 0, or have size 1024*/ - size_t palettesize; /*palette size in number of colors (amount of bytes is 4 * palettesize)*/ - - /* - transparent color key (tRNS) - - This color uses the same bit depth as the bitdepth value in this struct, which can be 1-bit to 16-bit. - For greyscale PNGs, r, g and b will all 3 be set to the same. - - When decoding, by default you can ignore this information, since LodePNG sets - pixels with this key to transparent already in the raw RGBA output. - - The color key is only supported for color types 0 and 2. - */ - unsigned key_defined; /*is a transparent color key given? 0 = false, 1 = true*/ - unsigned key_r; /*red/greyscale component of color key*/ - unsigned key_g; /*green component of color key*/ - unsigned key_b; /*blue component of color key*/ -} LodePNGColorMode; - -/*init, cleanup and copy functions to use with this struct*/ -void lodepng_color_mode_init(LodePNGColorMode* info); -void lodepng_color_mode_cleanup(LodePNGColorMode* info); -/*return value is error code (0 means no error)*/ -unsigned lodepng_color_mode_copy(LodePNGColorMode* dest, const LodePNGColorMode* source); - -void lodepng_palette_clear(LodePNGColorMode* info); -/*add 1 color to the palette*/ -unsigned lodepng_palette_add(LodePNGColorMode* info, - unsigned char r, unsigned char g, unsigned char b, unsigned char a); - -/*get the total amount of bits per pixel, based on colortype and bitdepth in the struct*/ -unsigned lodepng_get_bpp(const LodePNGColorMode* info); -/*get the amount of color channels used, based on colortype in the struct. -If a palette is used, it counts as 1 channel.*/ -unsigned lodepng_get_channels(const LodePNGColorMode* info); -/*is it a greyscale type? (only colortype 0 or 4)*/ -unsigned lodepng_is_greyscale_type(const LodePNGColorMode* info); -/*has it got an alpha channel? (only colortype 2 or 6)*/ -unsigned lodepng_is_alpha_type(const LodePNGColorMode* info); -/*has it got a palette? (only colortype 3)*/ -unsigned lodepng_is_palette_type(const LodePNGColorMode* info); -/*only returns true if there is a palette and there is a value in the palette with alpha < 255. -Loops through the palette to check this.*/ -unsigned lodepng_has_palette_alpha(const LodePNGColorMode* info); -/* -Check if the given color info indicates the possibility of having non-opaque pixels in the PNG image. -Returns true if the image can have translucent or invisible pixels (it still be opaque if it doesn't use such pixels). -Returns false if the image can only have opaque pixels. -In detail, it returns true only if it's a color type with alpha, or has a palette with non-opaque values, -or if "key_defined" is true. -*/ -unsigned lodepng_can_have_alpha(const LodePNGColorMode* info); -/*Returns the byte size of a raw image buffer with given width, height and color mode*/ -size_t lodepng_get_raw_size(unsigned w, unsigned h, const LodePNGColorMode* color); - -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS -/*The information of a Time chunk in PNG.*/ -typedef struct LodePNGTime -{ - unsigned year; /*2 bytes used (0-65535)*/ - unsigned month; /*1-12*/ - unsigned day; /*1-31*/ - unsigned hour; /*0-23*/ - unsigned minute; /*0-59*/ - unsigned second; /*0-60 (to allow for leap seconds)*/ -} LodePNGTime; -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ - -/*Information about the PNG image, except pixels, width and height.*/ -typedef struct LodePNGInfo -{ - /*header (IHDR), palette (PLTE) and transparency (tRNS) chunks*/ - unsigned compression_method;/*compression method of the original file. Always 0.*/ - unsigned filter_method; /*filter method of the original file*/ - unsigned interlace_method; /*interlace method of the original file*/ - LodePNGColorMode color; /*color type and bits, palette and transparency of the PNG file*/ - -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS - /* - suggested background color chunk (bKGD) - This color uses the same color mode as the PNG (except alpha channel), which can be 1-bit to 16-bit. - - For greyscale PNGs, r, g and b will all 3 be set to the same. When encoding - the encoder writes the red one. For palette PNGs: When decoding, the RGB value - will be stored, not a palette index. But when encoding, specify the index of - the palette in background_r, the other two are then ignored. - - The decoder does not use this background color to edit the color of pixels. - */ - unsigned background_defined; /*is a suggested background color given?*/ - unsigned background_r; /*red component of suggested background color*/ - unsigned background_g; /*green component of suggested background color*/ - unsigned background_b; /*blue component of suggested background color*/ - - /* - non-international text chunks (tEXt and zTXt) - - The char** arrays each contain num strings. The actual messages are in - text_strings, while text_keys are keywords that give a short description what - the actual text represents, e.g. Title, Author, Description, or anything else. - - A keyword is minimum 1 character and maximum 79 characters long. It's - discouraged to use a single line length longer than 79 characters for texts. - - Don't allocate these text buffers yourself. Use the init/cleanup functions - correctly and use lodepng_add_text and lodepng_clear_text. - */ - size_t text_num; /*the amount of texts in these char** buffers (there may be more texts in itext)*/ - char** text_keys; /*the keyword of a text chunk (e.g. "Comment")*/ - char** text_strings; /*the actual text*/ - - /* - international text chunks (iTXt) - Similar to the non-international text chunks, but with additional strings - "langtags" and "transkeys". - */ - size_t itext_num; /*the amount of international texts in this PNG*/ - char** itext_keys; /*the English keyword of the text chunk (e.g. "Comment")*/ - char** itext_langtags; /*language tag for this text's language, ISO/IEC 646 string, e.g. ISO 639 language tag*/ - char** itext_transkeys; /*keyword translated to the international language - UTF-8 string*/ - char** itext_strings; /*the actual international text - UTF-8 string*/ - - /*time chunk (tIME)*/ - unsigned time_defined; /*set to 1 to make the encoder generate a tIME chunk*/ - LodePNGTime time; - - /*phys chunk (pHYs)*/ - unsigned phys_defined; /*if 0, there is no pHYs chunk and the values below are undefined, if 1 else there is one*/ - unsigned phys_x; /*pixels per unit in x direction*/ - unsigned phys_y; /*pixels per unit in y direction*/ - unsigned phys_unit; /*may be 0 (unknown unit) or 1 (metre)*/ - - /* - unknown chunks - There are 3 buffers, one for each position in the PNG where unknown chunks can appear - each buffer contains all unknown chunks for that position consecutively - The 3 buffers are the unknown chunks between certain critical chunks: - 0: IHDR-PLTE, 1: PLTE-IDAT, 2: IDAT-IEND - Do not allocate or traverse this data yourself. Use the chunk traversing functions declared - later, such as lodepng_chunk_next and lodepng_chunk_append, to read/write this struct. - */ - unsigned char* unknown_chunks_data[3]; - size_t unknown_chunks_size[3]; /*size in bytes of the unknown chunks, given for protection*/ -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ -} LodePNGInfo; - -/*init, cleanup and copy functions to use with this struct*/ -void lodepng_info_init(LodePNGInfo* info); -void lodepng_info_cleanup(LodePNGInfo* info); -/*return value is error code (0 means no error)*/ -unsigned lodepng_info_copy(LodePNGInfo* dest, const LodePNGInfo* source); - -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS -void lodepng_clear_text(LodePNGInfo* info); /*use this to clear the texts again after you filled them in*/ -unsigned lodepng_add_text(LodePNGInfo* info, const char* key, const char* str); /*push back both texts at once*/ - -void lodepng_clear_itext(LodePNGInfo* info); /*use this to clear the itexts again after you filled them in*/ -unsigned lodepng_add_itext(LodePNGInfo* info, const char* key, const char* langtag, - const char* transkey, const char* str); /*push back the 4 texts of 1 chunk at once*/ -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ - -/* -Converts raw buffer from one color type to another color type, based on -LodePNGColorMode structs to describe the input and output color type. -See the reference manual at the end of this header file to see which color conversions are supported. -return value = LodePNG error code (0 if all went ok, an error if the conversion isn't supported) -The out buffer must have size (w * h * bpp + 7) / 8, where bpp is the bits per pixel -of the output color type (lodepng_get_bpp). -For < 8 bpp images, there should not be padding bits at the end of scanlines. -For 16-bit per channel colors, uses big endian format like PNG does. -Return value is LodePNG error code -*/ -unsigned lodepng_convert(unsigned char* out, const unsigned char* in, - const LodePNGColorMode* mode_out, const LodePNGColorMode* mode_in, - unsigned w, unsigned h); - -#ifdef LODEPNG_COMPILE_DECODER -/* -Settings for the decoder. This contains settings for the PNG and the Zlib -decoder, but not the Info settings from the Info structs. -*/ -typedef struct LodePNGDecoderSettings -{ - LodePNGDecompressSettings zlibsettings; /*in here is the setting to ignore Adler32 checksums*/ - - unsigned ignore_crc; /*ignore CRC checksums*/ - - unsigned color_convert; /*whether to convert the PNG to the color type you want. Default: yes*/ - -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS - unsigned read_text_chunks; /*if false but remember_unknown_chunks is true, they're stored in the unknown chunks*/ - /*store all bytes from unknown chunks in the LodePNGInfo (off by default, useful for a png editor)*/ - unsigned remember_unknown_chunks; -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ -} LodePNGDecoderSettings; - -void lodepng_decoder_settings_init(LodePNGDecoderSettings* settings); -#endif /*LODEPNG_COMPILE_DECODER*/ - -#ifdef LODEPNG_COMPILE_ENCODER -/*automatically use color type with less bits per pixel if losslessly possible. Default: AUTO*/ -typedef enum LodePNGFilterStrategy -{ - /*every filter at zero*/ - LFS_ZERO, - /*Use filter that gives minimum sum, as described in the official PNG filter heuristic.*/ - LFS_MINSUM, - /*Use the filter type that gives smallest Shannon entropy for this scanline. Depending - on the image, this is better or worse than minsum.*/ - LFS_ENTROPY, - /* - Brute-force-search PNG filters by compressing each filter for each scanline. - Experimental, very slow, and only rarely gives better compression than MINSUM. - */ - LFS_BRUTE_FORCE, - /*use predefined_filters buffer: you specify the filter type for each scanline*/ - LFS_PREDEFINED -} LodePNGFilterStrategy; - -/*Gives characteristics about the colors of the image, which helps decide which color model to use for encoding. -Used internally by default if "auto_convert" is enabled. Public because it's useful for custom algorithms.*/ -typedef struct LodePNGColorProfile -{ - unsigned colored; /*not greyscale*/ - unsigned key; /*image is not opaque and color key is possible instead of full alpha*/ - unsigned short key_r; /*key values, always as 16-bit, in 8-bit case the byte is duplicated, e.g. 65535 means 255*/ - unsigned short key_g; - unsigned short key_b; - unsigned alpha; /*image is not opaque and alpha channel or alpha palette required*/ - unsigned numcolors; /*amount of colors, up to 257. Not valid if bits == 16.*/ - unsigned char palette[1024]; /*Remembers up to the first 256 RGBA colors, in no particular order*/ - unsigned bits; /*bits per channel (not for palette). 1,2 or 4 for greyscale only. 16 if 16-bit per channel required.*/ -} LodePNGColorProfile; - -void lodepng_color_profile_init(LodePNGColorProfile* profile); - -/*Get a LodePNGColorProfile of the image.*/ -unsigned lodepng_get_color_profile(LodePNGColorProfile* profile, - const unsigned char* image, unsigned w, unsigned h, - const LodePNGColorMode* mode_in); -/*The function LodePNG uses internally to decide the PNG color with auto_convert. -Chooses an optimal color model, e.g. grey if only grey pixels, palette if < 256 colors, ...*/ -unsigned lodepng_auto_choose_color(LodePNGColorMode* mode_out, - const unsigned char* image, unsigned w, unsigned h, - const LodePNGColorMode* mode_in); - -/*Settings for the encoder.*/ -typedef struct LodePNGEncoderSettings -{ - LodePNGCompressSettings zlibsettings; /*settings for the zlib encoder, such as window size, ...*/ - - unsigned auto_convert; /*automatically choose output PNG color type. Default: true*/ - - /*If true, follows the official PNG heuristic: if the PNG uses a palette or lower than - 8 bit depth, set all filters to zero. Otherwise use the filter_strategy. Note that to - completely follow the official PNG heuristic, filter_palette_zero must be true and - filter_strategy must be LFS_MINSUM*/ - unsigned filter_palette_zero; - /*Which filter strategy to use when not using zeroes due to filter_palette_zero. - Set filter_palette_zero to 0 to ensure always using your chosen strategy. Default: LFS_MINSUM*/ - LodePNGFilterStrategy filter_strategy; - /*used if filter_strategy is LFS_PREDEFINED. In that case, this must point to a buffer with - the same length as the amount of scanlines in the image, and each value must <= 5. You - have to cleanup this buffer, LodePNG will never free it. Don't forget that filter_palette_zero - must be set to 0 to ensure this is also used on palette or low bitdepth images.*/ - const unsigned char* predefined_filters; - - /*force creating a PLTE chunk if colortype is 2 or 6 (= a suggested palette). - If colortype is 3, PLTE is _always_ created.*/ - unsigned force_palette; -#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS - /*add LodePNG identifier and version as a text chunk, for debugging*/ - unsigned add_id; - /*encode text chunks as zTXt chunks instead of tEXt chunks, and use compression in iTXt chunks*/ - unsigned text_compression; -#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ -} LodePNGEncoderSettings; - -void lodepng_encoder_settings_init(LodePNGEncoderSettings* settings); -#endif /*LODEPNG_COMPILE_ENCODER*/ - - -#if defined(LODEPNG_COMPILE_DECODER) || defined(LODEPNG_COMPILE_ENCODER) -/*The settings, state and information for extended encoding and decoding.*/ -typedef struct LodePNGState -{ -#ifdef LODEPNG_COMPILE_DECODER - LodePNGDecoderSettings decoder; /*the decoding settings*/ -#endif /*LODEPNG_COMPILE_DECODER*/ -#ifdef LODEPNG_COMPILE_ENCODER - LodePNGEncoderSettings encoder; /*the encoding settings*/ -#endif /*LODEPNG_COMPILE_ENCODER*/ - LodePNGColorMode info_raw; /*specifies the format in which you would like to get the raw pixel buffer*/ - LodePNGInfo info_png; /*info of the PNG image obtained after decoding*/ - unsigned error; -#ifdef LODEPNG_COMPILE_CPP - /* For the lodepng::State subclass. */ - virtual ~LodePNGState(){} -#endif -} LodePNGState; - -/*init, cleanup and copy functions to use with this struct*/ -void lodepng_state_init(LodePNGState* state); -void lodepng_state_cleanup(LodePNGState* state); -void lodepng_state_copy(LodePNGState* dest, const LodePNGState* source); -#endif /* defined(LODEPNG_COMPILE_DECODER) || defined(LODEPNG_COMPILE_ENCODER) */ - -#ifdef LODEPNG_COMPILE_DECODER -/* -Same as lodepng_decode_memory, but uses a LodePNGState to allow custom settings and -getting much more information about the PNG image and color mode. -*/ -unsigned lodepng_decode(unsigned char** out, unsigned* w, unsigned* h, - LodePNGState* state, - const unsigned char* in, size_t insize); - -/* -Read the PNG header, but not the actual data. This returns only the information -that is in the header chunk of the PNG, such as width, height and color type. The -information is placed in the info_png field of the LodePNGState. -*/ -unsigned lodepng_inspect(unsigned* w, unsigned* h, - LodePNGState* state, - const unsigned char* in, size_t insize); -#endif /*LODEPNG_COMPILE_DECODER*/ - - -#ifdef LODEPNG_COMPILE_ENCODER -/*This function allocates the out buffer with standard malloc and stores the size in *outsize.*/ -unsigned lodepng_encode(unsigned char** out, size_t* outsize, - const unsigned char* image, unsigned w, unsigned h, - LodePNGState* state); -#endif /*LODEPNG_COMPILE_ENCODER*/ - -/* -The lodepng_chunk functions are normally not needed, except to traverse the -unknown chunks stored in the LodePNGInfo struct, or add new ones to it. -It also allows traversing the chunks of an encoded PNG file yourself. - -PNG standard chunk naming conventions: -First byte: uppercase = critical, lowercase = ancillary -Second byte: uppercase = public, lowercase = private -Third byte: must be uppercase -Fourth byte: uppercase = unsafe to copy, lowercase = safe to copy -*/ - -/* -Gets the length of the data of the chunk. Total chunk length has 12 bytes more. -There must be at least 4 bytes to read from. If the result value is too large, -it may be corrupt data. -*/ -unsigned lodepng_chunk_length(const unsigned char* chunk); - -/*puts the 4-byte type in null terminated string*/ -void lodepng_chunk_type(char type[5], const unsigned char* chunk); - -/*check if the type is the given type*/ -unsigned char lodepng_chunk_type_equals(const unsigned char* chunk, const char* type); - -/*0: it's one of the critical chunk types, 1: it's an ancillary chunk (see PNG standard)*/ -unsigned char lodepng_chunk_ancillary(const unsigned char* chunk); - -/*0: public, 1: private (see PNG standard)*/ -unsigned char lodepng_chunk_private(const unsigned char* chunk); - -/*0: the chunk is unsafe to copy, 1: the chunk is safe to copy (see PNG standard)*/ -unsigned char lodepng_chunk_safetocopy(const unsigned char* chunk); - -/*get pointer to the data of the chunk, where the input points to the header of the chunk*/ -unsigned char* lodepng_chunk_data(unsigned char* chunk); -const unsigned char* lodepng_chunk_data_const(const unsigned char* chunk); - -/*returns 0 if the crc is correct, 1 if it's incorrect (0 for OK as usual!)*/ -unsigned lodepng_chunk_check_crc(const unsigned char* chunk); - -/*generates the correct CRC from the data and puts it in the last 4 bytes of the chunk*/ -void lodepng_chunk_generate_crc(unsigned char* chunk); - -/*iterate to next chunks. don't use on IEND chunk, as there is no next chunk then*/ -unsigned char* lodepng_chunk_next(unsigned char* chunk); -const unsigned char* lodepng_chunk_next_const(const unsigned char* chunk); - -/* -Appends chunk to the data in out. The given chunk should already have its chunk header. -The out variable and outlength are updated to reflect the new reallocated buffer. -Returns error code (0 if it went ok) -*/ -unsigned lodepng_chunk_append(unsigned char** out, size_t* outlength, const unsigned char* chunk); - -/* -Appends new chunk to out. The chunk to append is given by giving its length, type -and data separately. The type is a 4-letter string. -The out variable and outlength are updated to reflect the new reallocated buffer. -Returne error code (0 if it went ok) -*/ -unsigned lodepng_chunk_create(unsigned char** out, size_t* outlength, unsigned length, - const char* type, const unsigned char* data); - - -/*Calculate CRC32 of buffer*/ -unsigned lodepng_crc32(const unsigned char* buf, size_t len); -#endif /*LODEPNG_COMPILE_PNG*/ - - -#ifdef LODEPNG_COMPILE_ZLIB -/* -This zlib part can be used independently to zlib compress and decompress a -buffer. It cannot be used to create gzip files however, and it only supports the -part of zlib that is required for PNG, it does not support dictionaries. -*/ - -#ifdef LODEPNG_COMPILE_DECODER -/*Inflate a buffer. Inflate is the decompression step of deflate. Out buffer must be freed after use.*/ -unsigned lodepng_inflate(unsigned char** out, size_t* outsize, - const unsigned char* in, size_t insize, - const LodePNGDecompressSettings* settings); - -/* -Decompresses Zlib data. Reallocates the out buffer and appends the data. The -data must be according to the zlib specification. -Either, *out must be NULL and *outsize must be 0, or, *out must be a valid -buffer and *outsize its size in bytes. out must be freed by user after usage. -*/ -unsigned lodepng_zlib_decompress(unsigned char** out, size_t* outsize, - const unsigned char* in, size_t insize, - const LodePNGDecompressSettings* settings); -#endif /*LODEPNG_COMPILE_DECODER*/ - -#ifdef LODEPNG_COMPILE_ENCODER -/* -Compresses data with Zlib. Reallocates the out buffer and appends the data. -Zlib adds a small header and trailer around the deflate data. -The data is output in the format of the zlib specification. -Either, *out must be NULL and *outsize must be 0, or, *out must be a valid -buffer and *outsize its size in bytes. out must be freed by user after usage. -*/ -unsigned lodepng_zlib_compress(unsigned char** out, size_t* outsize, - const unsigned char* in, size_t insize, - const LodePNGCompressSettings* settings); - -/* -Find length-limited Huffman code for given frequencies. This function is in the -public interface only for tests, it's used internally by lodepng_deflate. -*/ -unsigned lodepng_huffman_code_lengths(unsigned* lengths, const unsigned* frequencies, - size_t numcodes, unsigned maxbitlen); - -/*Compress a buffer with deflate. See RFC 1951. Out buffer must be freed after use.*/ -unsigned lodepng_deflate(unsigned char** out, size_t* outsize, - const unsigned char* in, size_t insize, - const LodePNGCompressSettings* settings); - -#endif /*LODEPNG_COMPILE_ENCODER*/ -#endif /*LODEPNG_COMPILE_ZLIB*/ - -#ifdef LODEPNG_COMPILE_DISK -/* -Load a file from disk into buffer. The function allocates the out buffer, and -after usage you should free it. -out: output parameter, contains pointer to loaded buffer. -outsize: output parameter, size of the allocated out buffer -filename: the path to the file to load -return value: error code (0 means ok) -*/ -unsigned lodepng_load_file(unsigned char** out, size_t* outsize, const char* filename); - -/* -Save a file from buffer to disk. Warning, if it exists, this function overwrites -the file without warning! -buffer: the buffer to write -buffersize: size of the buffer to write -filename: the path to the file to save to -return value: error code (0 means ok) -*/ -unsigned lodepng_save_file(const unsigned char* buffer, size_t buffersize, const char* filename); -#endif /*LODEPNG_COMPILE_DISK*/ - -#ifdef LODEPNG_COMPILE_CPP -/* The LodePNG C++ wrapper uses std::vectors instead of manually allocated memory buffers. */ -namespace lodepng -{ -#ifdef LODEPNG_COMPILE_PNG -class State : public LodePNGState -{ - public: - State(); - State(const State& other); - virtual ~State(); - State& operator=(const State& other); -}; - -#ifdef LODEPNG_COMPILE_DECODER -/* Same as other lodepng::decode, but using a State for more settings and information. */ -unsigned decode(std::vector& out, unsigned& w, unsigned& h, - State& state, - const unsigned char* in, size_t insize); -unsigned decode(std::vector& out, unsigned& w, unsigned& h, - State& state, - const std::vector& in); -#endif /*LODEPNG_COMPILE_DECODER*/ - -#ifdef LODEPNG_COMPILE_ENCODER -/* Same as other lodepng::encode, but using a State for more settings and information. */ -unsigned encode(std::vector& out, - const unsigned char* in, unsigned w, unsigned h, - State& state); -unsigned encode(std::vector& out, - const std::vector& in, unsigned w, unsigned h, - State& state); -#endif /*LODEPNG_COMPILE_ENCODER*/ - -#ifdef LODEPNG_COMPILE_DISK -/* -Load a file from disk into an std::vector. -return value: error code (0 means ok) -*/ -unsigned load_file(std::vector& buffer, const std::string& filename); - -/* -Save the binary data in an std::vector to a file on disk. The file is overwritten -without warning. -*/ -unsigned save_file(const std::vector& buffer, const std::string& filename); -#endif /* LODEPNG_COMPILE_DISK */ -#endif /* LODEPNG_COMPILE_PNG */ - -#ifdef LODEPNG_COMPILE_ZLIB -#ifdef LODEPNG_COMPILE_DECODER -/* Zlib-decompress an unsigned char buffer */ -unsigned decompress(std::vector& out, const unsigned char* in, size_t insize, - const LodePNGDecompressSettings& settings = lodepng_default_decompress_settings); - -/* Zlib-decompress an std::vector */ -unsigned decompress(std::vector& out, const std::vector& in, - const LodePNGDecompressSettings& settings = lodepng_default_decompress_settings); -#endif /* LODEPNG_COMPILE_DECODER */ - -#ifdef LODEPNG_COMPILE_ENCODER -/* Zlib-compress an unsigned char buffer */ -unsigned compress(std::vector& out, const unsigned char* in, size_t insize, - const LodePNGCompressSettings& settings = lodepng_default_compress_settings); - -/* Zlib-compress an std::vector */ -unsigned compress(std::vector& out, const std::vector& in, - const LodePNGCompressSettings& settings = lodepng_default_compress_settings); -#endif /* LODEPNG_COMPILE_ENCODER */ -#endif /* LODEPNG_COMPILE_ZLIB */ -} /* namespace lodepng */ -#endif /*LODEPNG_COMPILE_CPP*/ - -/* -TODO: -[.] test if there are no memory leaks or security exploits - done a lot but needs to be checked often -[.] check compatibility with various compilers - done but needs to be redone for every newer version -[X] converting color to 16-bit per channel types -[ ] read all public PNG chunk types (but never let the color profile and gamma ones touch RGB values) -[ ] make sure encoder generates no chunks with size > (2^31)-1 -[ ] partial decoding (stream processing) -[X] let the "isFullyOpaque" function check color keys and transparent palettes too -[X] better name for the variables "codes", "codesD", "codelengthcodes", "clcl" and "lldl" -[ ] don't stop decoding on errors like 69, 57, 58 (make warnings) -[ ] make warnings like: oob palette, checksum fail, data after iend, wrong/unknown crit chunk, no null terminator in text, ... -[ ] let the C++ wrapper catch exceptions coming from the standard library and return LodePNG error codes -[ ] allow user to provide custom color conversion functions, e.g. for premultiplied alpha, padding bits or not, ... -[ ] allow user to give data (void*) to custom allocator -*/ - -#endif /*LODEPNG_H inclusion guard*/ - -/* -LodePNG Documentation ---------------------- - -0. table of contents --------------------- - - 1. about - 1.1. supported features - 1.2. features not supported - 2. C and C++ version - 3. security - 4. decoding - 5. encoding - 6. color conversions - 6.1. PNG color types - 6.2. color conversions - 6.3. padding bits - 6.4. A note about 16-bits per channel and endianness - 7. error values - 8. chunks and PNG editing - 9. compiler support - 10. examples - 10.1. decoder C++ example - 10.2. decoder C example - 11. state settings reference - 12. changes - 13. contact information - - -1. about --------- - -PNG is a file format to store raster images losslessly with good compression, -supporting different color types and alpha channel. - -LodePNG is a PNG codec according to the Portable Network Graphics (PNG) -Specification (Second Edition) - W3C Recommendation 10 November 2003. - -The specifications used are: - -*) Portable Network Graphics (PNG) Specification (Second Edition): - http://www.w3.org/TR/2003/REC-PNG-20031110 -*) RFC 1950 ZLIB Compressed Data Format version 3.3: - http://www.gzip.org/zlib/rfc-zlib.html -*) RFC 1951 DEFLATE Compressed Data Format Specification ver 1.3: - http://www.gzip.org/zlib/rfc-deflate.html - -The most recent version of LodePNG can currently be found at -http://lodev.org/lodepng/ - -LodePNG works both in C (ISO C90) and C++, with a C++ wrapper that adds -extra functionality. - -LodePNG exists out of two files: --lodepng.h: the header file for both C and C++ --lodepng.c(pp): give it the name lodepng.c or lodepng.cpp (or .cc) depending on your usage - -If you want to start using LodePNG right away without reading this doc, get the -examples from the LodePNG website to see how to use it in code, or check the -smaller examples in chapter 13 here. - -LodePNG is simple but only supports the basic requirements. To achieve -simplicity, the following design choices were made: There are no dependencies -on any external library. There are functions to decode and encode a PNG with -a single function call, and extended versions of these functions taking a -LodePNGState struct allowing to specify or get more information. By default -the colors of the raw image are always RGB or RGBA, no matter what color type -the PNG file uses. To read and write files, there are simple functions to -convert the files to/from buffers in memory. - -This all makes LodePNG suitable for loading textures in games, demos and small -programs, ... It's less suitable for full fledged image editors, loading PNGs -over network (it requires all the image data to be available before decoding can -begin), life-critical systems, ... - -1.1. supported features ------------------------ - -The following features are supported by the decoder: - -*) decoding of PNGs with any color type, bit depth and interlace mode, to a 24- or 32-bit color raw image, - or the same color type as the PNG -*) encoding of PNGs, from any raw image to 24- or 32-bit color, or the same color type as the raw image -*) Adam7 interlace and deinterlace for any color type -*) loading the image from harddisk or decoding it from a buffer from other sources than harddisk -*) support for alpha channels, including RGBA color model, translucent palettes and color keying -*) zlib decompression (inflate) -*) zlib compression (deflate) -*) CRC32 and ADLER32 checksums -*) handling of unknown chunks, allowing making a PNG editor that stores custom and unknown chunks. -*) the following chunks are supported (generated/interpreted) by both encoder and decoder: - IHDR: header information - PLTE: color palette - IDAT: pixel data - IEND: the final chunk - tRNS: transparency for palettized images - tEXt: textual information - zTXt: compressed textual information - iTXt: international textual information - bKGD: suggested background color - pHYs: physical dimensions - tIME: modification time - -1.2. features not supported ---------------------------- - -The following features are _not_ supported: - -*) some features needed to make a conformant PNG-Editor might be still missing. -*) partial loading/stream processing. All data must be available and is processed in one call. -*) The following public chunks are not supported but treated as unknown chunks by LodePNG - cHRM, gAMA, iCCP, sRGB, sBIT, hIST, sPLT - Some of these are not supported on purpose: LodePNG wants to provide the RGB values - stored in the pixels, not values modified by system dependent gamma or color models. - - -2. C and C++ version --------------------- - -The C version uses buffers allocated with alloc that you need to free() -yourself. You need to use init and cleanup functions for each struct whenever -using a struct from the C version to avoid exploits and memory leaks. - -The C++ version has extra functions with std::vectors in the interface and the -lodepng::State class which is a LodePNGState with constructor and destructor. - -These files work without modification for both C and C++ compilers because all -the additional C++ code is in "#ifdef __cplusplus" blocks that make C-compilers -ignore it, and the C code is made to compile both with strict ISO C90 and C++. - -To use the C++ version, you need to rename the source file to lodepng.cpp -(instead of lodepng.c), and compile it with a C++ compiler. - -To use the C version, you need to rename the source file to lodepng.c (instead -of lodepng.cpp), and compile it with a C compiler. - - -3. Security ------------ - -Even if carefully designed, it's always possible that LodePNG contains possible -exploits. If you discover one, please let me know, and it will be fixed. - -When using LodePNG, care has to be taken with the C version of LodePNG, as well -as the C-style structs when working with C++. The following conventions are used -for all C-style structs: - --if a struct has a corresponding init function, always call the init function when making a new one --if a struct has a corresponding cleanup function, call it before the struct disappears to avoid memory leaks --if a struct has a corresponding copy function, use the copy function instead of "=". - The destination must also be inited already. - - -4. Decoding ------------ - -Decoding converts a PNG compressed image to a raw pixel buffer. - -Most documentation on using the decoder is at its declarations in the header -above. For C, simple decoding can be done with functions such as -lodepng_decode32, and more advanced decoding can be done with the struct -LodePNGState and lodepng_decode. For C++, all decoding can be done with the -various lodepng::decode functions, and lodepng::State can be used for advanced -features. - -When using the LodePNGState, it uses the following fields for decoding: -*) LodePNGInfo info_png: it stores extra information about the PNG (the input) in here -*) LodePNGColorMode info_raw: here you can say what color mode of the raw image (the output) you want to get -*) LodePNGDecoderSettings decoder: you can specify a few extra settings for the decoder to use - -LodePNGInfo info_png --------------------- - -After decoding, this contains extra information of the PNG image, except the actual -pixels, width and height because these are already gotten directly from the decoder -functions. - -It contains for example the original color type of the PNG image, text comments, -suggested background color, etc... More details about the LodePNGInfo struct are -at its declaration documentation. - -LodePNGColorMode info_raw -------------------------- - -When decoding, here you can specify which color type you want -the resulting raw image to be. If this is different from the colortype of the -PNG, then the decoder will automatically convert the result. This conversion -always works, except if you want it to convert a color PNG to greyscale or to -a palette with missing colors. - -By default, 32-bit color is used for the result. - -LodePNGDecoderSettings decoder ------------------------------- - -The settings can be used to ignore the errors created by invalid CRC and Adler32 -chunks, and to disable the decoding of tEXt chunks. - -There's also a setting color_convert, true by default. If false, no conversion -is done, the resulting data will be as it was in the PNG (after decompression) -and you'll have to puzzle the colors of the pixels together yourself using the -color type information in the LodePNGInfo. - - -5. Encoding ------------ - -Encoding converts a raw pixel buffer to a PNG compressed image. - -Most documentation on using the encoder is at its declarations in the header -above. For C, simple encoding can be done with functions such as -lodepng_encode32, and more advanced decoding can be done with the struct -LodePNGState and lodepng_encode. For C++, all encoding can be done with the -various lodepng::encode functions, and lodepng::State can be used for advanced -features. - -Like the decoder, the encoder can also give errors. However it gives less errors -since the encoder input is trusted, the decoder input (a PNG image that could -be forged by anyone) is not trusted. - -When using the LodePNGState, it uses the following fields for encoding: -*) LodePNGInfo info_png: here you specify how you want the PNG (the output) to be. -*) LodePNGColorMode info_raw: here you say what color type of the raw image (the input) has -*) LodePNGEncoderSettings encoder: you can specify a few settings for the encoder to use - -LodePNGInfo info_png --------------------- - -When encoding, you use this the opposite way as when decoding: for encoding, -you fill in the values you want the PNG to have before encoding. By default it's -not needed to specify a color type for the PNG since it's automatically chosen, -but it's possible to choose it yourself given the right settings. - -The encoder will not always exactly match the LodePNGInfo struct you give, -it tries as close as possible. Some things are ignored by the encoder. The -encoder uses, for example, the following settings from it when applicable: -colortype and bitdepth, text chunks, time chunk, the color key, the palette, the -background color, the interlace method, unknown chunks, ... - -When encoding to a PNG with colortype 3, the encoder will generate a PLTE chunk. -If the palette contains any colors for which the alpha channel is not 255 (so -there are translucent colors in the palette), it'll add a tRNS chunk. - -LodePNGColorMode info_raw -------------------------- - -You specify the color type of the raw image that you give to the input here, -including a possible transparent color key and palette you happen to be using in -your raw image data. - -By default, 32-bit color is assumed, meaning your input has to be in RGBA -format with 4 bytes (unsigned chars) per pixel. - -LodePNGEncoderSettings encoder ------------------------------- - -The following settings are supported (some are in sub-structs): -*) auto_convert: when this option is enabled, the encoder will -automatically choose the smallest possible color mode (including color key) that -can encode the colors of all pixels without information loss. -*) btype: the block type for LZ77. 0 = uncompressed, 1 = fixed huffman tree, - 2 = dynamic huffman tree (best compression). Should be 2 for proper - compression. -*) use_lz77: whether or not to use LZ77 for compressed block types. Should be - true for proper compression. -*) windowsize: the window size used by the LZ77 encoder (1 - 32768). Has value - 2048 by default, but can be set to 32768 for better, but slow, compression. -*) force_palette: if colortype is 2 or 6, you can make the encoder write a PLTE - chunk if force_palette is true. This can used as suggested palette to convert - to by viewers that don't support more than 256 colors (if those still exist) -*) add_id: add text chunk "Encoder: LodePNG " to the image. -*) text_compression: default 1. If 1, it'll store texts as zTXt instead of tEXt chunks. - zTXt chunks use zlib compression on the text. This gives a smaller result on - large texts but a larger result on small texts (such as a single program name). - It's all tEXt or all zTXt though, there's no separate setting per text yet. - - -6. color conversions --------------------- - -An important thing to note about LodePNG, is that the color type of the PNG, and -the color type of the raw image, are completely independent. By default, when -you decode a PNG, you get the result as a raw image in the color type you want, -no matter whether the PNG was encoded with a palette, greyscale or RGBA color. -And if you encode an image, by default LodePNG will automatically choose the PNG -color type that gives good compression based on the values of colors and amount -of colors in the image. It can be configured to let you control it instead as -well, though. - -To be able to do this, LodePNG does conversions from one color mode to another. -It can convert from almost any color type to any other color type, except the -following conversions: RGB to greyscale is not supported, and converting to a -palette when the palette doesn't have a required color is not supported. This is -not supported on purpose: this is information loss which requires a color -reduction algorithm that is beyong the scope of a PNG encoder (yes, RGB to grey -is easy, but there are multiple ways if you want to give some channels more -weight). - -By default, when decoding, you get the raw image in 32-bit RGBA or 24-bit RGB -color, no matter what color type the PNG has. And by default when encoding, -LodePNG automatically picks the best color model for the output PNG, and expects -the input image to be 32-bit RGBA or 24-bit RGB. So, unless you want to control -the color format of the images yourself, you can skip this chapter. - -6.1. PNG color types --------------------- - -A PNG image can have many color types, ranging from 1-bit color to 64-bit color, -as well as palettized color modes. After the zlib decompression and unfiltering -in the PNG image is done, the raw pixel data will have that color type and thus -a certain amount of bits per pixel. If you want the output raw image after -decoding to have another color type, a conversion is done by LodePNG. - -The PNG specification gives the following color types: - -0: greyscale, bit depths 1, 2, 4, 8, 16 -2: RGB, bit depths 8 and 16 -3: palette, bit depths 1, 2, 4 and 8 -4: greyscale with alpha, bit depths 8 and 16 -6: RGBA, bit depths 8 and 16 - -Bit depth is the amount of bits per pixel per color channel. So the total amount -of bits per pixel is: amount of channels * bitdepth. - -6.2. color conversions ----------------------- - -As explained in the sections about the encoder and decoder, you can specify -color types and bit depths in info_png and info_raw to change the default -behaviour. - -If, when decoding, you want the raw image to be something else than the default, -you need to set the color type and bit depth you want in the LodePNGColorMode, -or the parameters colortype and bitdepth of the simple decoding function. - -If, when encoding, you use another color type than the default in the raw input -image, you need to specify its color type and bit depth in the LodePNGColorMode -of the raw image, or use the parameters colortype and bitdepth of the simple -encoding function. - -If, when encoding, you don't want LodePNG to choose the output PNG color type -but control it yourself, you need to set auto_convert in the encoder settings -to false, and specify the color type you want in the LodePNGInfo of the -encoder (including palette: it can generate a palette if auto_convert is true, -otherwise not). - -If the input and output color type differ (whether user chosen or auto chosen), -LodePNG will do a color conversion, which follows the rules below, and may -sometimes result in an error. - -To avoid some confusion: --the decoder converts from PNG to raw image --the encoder converts from raw image to PNG --the colortype and bitdepth in LodePNGColorMode info_raw, are those of the raw image --the colortype and bitdepth in the color field of LodePNGInfo info_png, are those of the PNG --when encoding, the color type in LodePNGInfo is ignored if auto_convert - is enabled, it is automatically generated instead --when decoding, the color type in LodePNGInfo is set by the decoder to that of the original - PNG image, but it can be ignored since the raw image has the color type you requested instead --if the color type of the LodePNGColorMode and PNG image aren't the same, a conversion - between the color types is done if the color types are supported. If it is not - supported, an error is returned. If the types are the same, no conversion is done. --even though some conversions aren't supported, LodePNG supports loading PNGs from any - colortype and saving PNGs to any colortype, sometimes it just requires preparing - the raw image correctly before encoding. --both encoder and decoder use the same color converter. - -Non supported color conversions: --color to greyscale: no error is thrown, but the result will look ugly because -only the red channel is taken --anything to palette when that palette does not have that color in it: in this -case an error is thrown - -Supported color conversions: --anything to 8-bit RGB, 8-bit RGBA, 16-bit RGB, 16-bit RGBA --any grey or grey+alpha, to grey or grey+alpha --anything to a palette, as long as the palette has the requested colors in it --removing alpha channel --higher to smaller bitdepth, and vice versa - -If you want no color conversion to be done (e.g. for speed or control): --In the encoder, you can make it save a PNG with any color type by giving the -raw color mode and LodePNGInfo the same color mode, and setting auto_convert to -false. --In the decoder, you can make it store the pixel data in the same color type -as the PNG has, by setting the color_convert setting to false. Settings in -info_raw are then ignored. - -The function lodepng_convert does the color conversion. It is available in the -interface but normally isn't needed since the encoder and decoder already call -it. - -6.3. padding bits ------------------ - -In the PNG file format, if a less than 8-bit per pixel color type is used and the scanlines -have a bit amount that isn't a multiple of 8, then padding bits are used so that each -scanline starts at a fresh byte. But that is NOT true for the LodePNG raw input and output. -The raw input image you give to the encoder, and the raw output image you get from the decoder -will NOT have these padding bits, e.g. in the case of a 1-bit image with a width -of 7 pixels, the first pixel of the second scanline will the the 8th bit of the first byte, -not the first bit of a new byte. - -6.4. A note about 16-bits per channel and endianness ----------------------------------------------------- - -LodePNG uses unsigned char arrays for 16-bit per channel colors too, just like -for any other color format. The 16-bit values are stored in big endian (most -significant byte first) in these arrays. This is the opposite order of the -little endian used by x86 CPU's. - -LodePNG always uses big endian because the PNG file format does so internally. -Conversions to other formats than PNG uses internally are not supported by -LodePNG on purpose, there are myriads of formats, including endianness of 16-bit -colors, the order in which you store R, G, B and A, and so on. Supporting and -converting to/from all that is outside the scope of LodePNG. - -This may mean that, depending on your use case, you may want to convert the big -endian output of LodePNG to little endian with a for loop. This is certainly not -always needed, many applications and libraries support big endian 16-bit colors -anyway, but it means you cannot simply cast the unsigned char* buffer to an -unsigned short* buffer on x86 CPUs. - - -7. error values ---------------- - -All functions in LodePNG that return an error code, return 0 if everything went -OK, or a non-zero code if there was an error. - -The meaning of the LodePNG error values can be retrieved with the function -lodepng_error_text: given the numerical error code, it returns a description -of the error in English as a string. - -Check the implementation of lodepng_error_text to see the meaning of each code. - - -8. chunks and PNG editing -------------------------- - -If you want to add extra chunks to a PNG you encode, or use LodePNG for a PNG -editor that should follow the rules about handling of unknown chunks, or if your -program is able to read other types of chunks than the ones handled by LodePNG, -then that's possible with the chunk functions of LodePNG. - -A PNG chunk has the following layout: - -4 bytes length -4 bytes type name -length bytes data -4 bytes CRC - -8.1. iterating through chunks ------------------------------ - -If you have a buffer containing the PNG image data, then the first chunk (the -IHDR chunk) starts at byte number 8 of that buffer. The first 8 bytes are the -signature of the PNG and are not part of a chunk. But if you start at byte 8 -then you have a chunk, and can check the following things of it. - -NOTE: none of these functions check for memory buffer boundaries. To avoid -exploits, always make sure the buffer contains all the data of the chunks. -When using lodepng_chunk_next, make sure the returned value is within the -allocated memory. - -unsigned lodepng_chunk_length(const unsigned char* chunk): - -Get the length of the chunk's data. The total chunk length is this length + 12. - -void lodepng_chunk_type(char type[5], const unsigned char* chunk): -unsigned char lodepng_chunk_type_equals(const unsigned char* chunk, const char* type): - -Get the type of the chunk or compare if it's a certain type - -unsigned char lodepng_chunk_critical(const unsigned char* chunk): -unsigned char lodepng_chunk_private(const unsigned char* chunk): -unsigned char lodepng_chunk_safetocopy(const unsigned char* chunk): - -Check if the chunk is critical in the PNG standard (only IHDR, PLTE, IDAT and IEND are). -Check if the chunk is private (public chunks are part of the standard, private ones not). -Check if the chunk is safe to copy. If it's not, then, when modifying data in a critical -chunk, unsafe to copy chunks of the old image may NOT be saved in the new one if your -program doesn't handle that type of unknown chunk. - -unsigned char* lodepng_chunk_data(unsigned char* chunk): -const unsigned char* lodepng_chunk_data_const(const unsigned char* chunk): - -Get a pointer to the start of the data of the chunk. - -unsigned lodepng_chunk_check_crc(const unsigned char* chunk): -void lodepng_chunk_generate_crc(unsigned char* chunk): - -Check if the crc is correct or generate a correct one. - -unsigned char* lodepng_chunk_next(unsigned char* chunk): -const unsigned char* lodepng_chunk_next_const(const unsigned char* chunk): - -Iterate to the next chunk. This works if you have a buffer with consecutive chunks. Note that these -functions do no boundary checking of the allocated data whatsoever, so make sure there is enough -data available in the buffer to be able to go to the next chunk. - -unsigned lodepng_chunk_append(unsigned char** out, size_t* outlength, const unsigned char* chunk): -unsigned lodepng_chunk_create(unsigned char** out, size_t* outlength, unsigned length, - const char* type, const unsigned char* data): - -These functions are used to create new chunks that are appended to the data in *out that has -length *outlength. The append function appends an existing chunk to the new data. The create -function creates a new chunk with the given parameters and appends it. Type is the 4-letter -name of the chunk. - -8.2. chunks in info_png ------------------------ - -The LodePNGInfo struct contains fields with the unknown chunk in it. It has 3 -buffers (each with size) to contain 3 types of unknown chunks: -the ones that come before the PLTE chunk, the ones that come between the PLTE -and the IDAT chunks, and the ones that come after the IDAT chunks. -It's necessary to make the distionction between these 3 cases because the PNG -standard forces to keep the ordering of unknown chunks compared to the critical -chunks, but does not force any other ordering rules. - -info_png.unknown_chunks_data[0] is the chunks before PLTE -info_png.unknown_chunks_data[1] is the chunks after PLTE, before IDAT -info_png.unknown_chunks_data[2] is the chunks after IDAT - -The chunks in these 3 buffers can be iterated through and read by using the same -way described in the previous subchapter. - -When using the decoder to decode a PNG, you can make it store all unknown chunks -if you set the option settings.remember_unknown_chunks to 1. By default, this -option is off (0). - -The encoder will always encode unknown chunks that are stored in the info_png. -If you need it to add a particular chunk that isn't known by LodePNG, you can -use lodepng_chunk_append or lodepng_chunk_create to the chunk data in -info_png.unknown_chunks_data[x]. - -Chunks that are known by LodePNG should not be added in that way. E.g. to make -LodePNG add a bKGD chunk, set background_defined to true and add the correct -parameters there instead. - - -9. compiler support -------------------- - -No libraries other than the current standard C library are needed to compile -LodePNG. For the C++ version, only the standard C++ library is needed on top. -Add the files lodepng.c(pp) and lodepng.h to your project, include -lodepng.h where needed, and your program can read/write PNG files. - -It is compatible with C90 and up, and C++03 and up. - -If performance is important, use optimization when compiling! For both the -encoder and decoder, this makes a large difference. - -Make sure that LodePNG is compiled with the same compiler of the same version -and with the same settings as the rest of the program, or the interfaces with -std::vectors and std::strings in C++ can be incompatible. - -CHAR_BITS must be 8 or higher, because LodePNG uses unsigned chars for octets. - -*) gcc and g++ - -LodePNG is developed in gcc so this compiler is natively supported. It gives no -warnings with compiler options "-Wall -Wextra -pedantic -ansi", with gcc and g++ -version 4.7.1 on Linux, 32-bit and 64-bit. - -*) Clang - -Fully supported and warning-free. - -*) Mingw - -The Mingw compiler (a port of gcc for Windows) should be fully supported by -LodePNG. - -*) Visual Studio and Visual C++ Express Edition - -LodePNG should be warning-free with warning level W4. Two warnings were disabled -with pragmas though: warning 4244 about implicit conversions, and warning 4996 -where it wants to use a non-standard function fopen_s instead of the standard C -fopen. - -Visual Studio may want "stdafx.h" files to be included in each source file and -give an error "unexpected end of file while looking for precompiled header". -This is not standard C++ and will not be added to the stock LodePNG. You can -disable it for lodepng.cpp only by right clicking it, Properties, C/C++, -Precompiled Headers, and set it to Not Using Precompiled Headers there. - -NOTE: Modern versions of VS should be fully supported, but old versions, e.g. -VS6, are not guaranteed to work. - -*) Compilers on Macintosh - -LodePNG has been reported to work both with gcc and LLVM for Macintosh, both for -C and C++. - -*) Other Compilers - -If you encounter problems on any compilers, feel free to let me know and I may -try to fix it if the compiler is modern and standards complient. - - -10. examples ------------- - -This decoder example shows the most basic usage of LodePNG. More complex -examples can be found on the LodePNG website. - -10.1. decoder C++ example -------------------------- - -#include "lodepng.h" -#include - -int main(int argc, char *argv[]) -{ - const char* filename = argc > 1 ? argv[1] : "test.png"; - - //load and decode - std::vector image; - unsigned width, height; - unsigned error = lodepng::decode(image, width, height, filename); - - //if there's an error, display it - if(error) std::cout << "decoder error " << error << ": " << lodepng_error_text(error) << std::endl; - - //the pixels are now in the vector "image", 4 bytes per pixel, ordered RGBARGBA..., use it as texture, draw it, ... -} - -10.2. decoder C example ------------------------ - -#include "lodepng.h" - -int main(int argc, char *argv[]) -{ - unsigned error; - unsigned char* image; - size_t width, height; - const char* filename = argc > 1 ? argv[1] : "test.png"; - - error = lodepng_decode32_file(&image, &width, &height, filename); - - if(error) printf("decoder error %u: %s\n", error, lodepng_error_text(error)); - - / * use image here * / - - free(image); - return 0; -} - -11. state settings reference ----------------------------- - -A quick reference of some settings to set on the LodePNGState - -For decoding: - -state.decoder.zlibsettings.ignore_adler32: ignore ADLER32 checksums -state.decoder.zlibsettings.custom_...: use custom inflate function -state.decoder.ignore_crc: ignore CRC checksums -state.decoder.color_convert: convert internal PNG color to chosen one -state.decoder.read_text_chunks: whether to read in text metadata chunks -state.decoder.remember_unknown_chunks: whether to read in unknown chunks -state.info_raw.colortype: desired color type for decoded image -state.info_raw.bitdepth: desired bit depth for decoded image -state.info_raw....: more color settings, see struct LodePNGColorMode -state.info_png....: no settings for decoder but ouput, see struct LodePNGInfo - -For encoding: - -state.encoder.zlibsettings.btype: disable compression by setting it to 0 -state.encoder.zlibsettings.use_lz77: use LZ77 in compression -state.encoder.zlibsettings.windowsize: tweak LZ77 windowsize -state.encoder.zlibsettings.minmatch: tweak min LZ77 length to match -state.encoder.zlibsettings.nicematch: tweak LZ77 match where to stop searching -state.encoder.zlibsettings.lazymatching: try one more LZ77 matching -state.encoder.zlibsettings.custom_...: use custom deflate function -state.encoder.auto_convert: choose optimal PNG color type, if 0 uses info_png -state.encoder.filter_palette_zero: PNG filter strategy for palette -state.encoder.filter_strategy: PNG filter strategy to encode with -state.encoder.force_palette: add palette even if not encoding to one -state.encoder.add_id: add LodePNG identifier and version as a text chunk -state.encoder.text_compression: use compressed text chunks for metadata -state.info_raw.colortype: color type of raw input image you provide -state.info_raw.bitdepth: bit depth of raw input image you provide -state.info_raw: more color settings, see struct LodePNGColorMode -state.info_png.color.colortype: desired color type if auto_convert is false -state.info_png.color.bitdepth: desired bit depth if auto_convert is false -state.info_png.color....: more color settings, see struct LodePNGColorMode -state.info_png....: more PNG related settings, see struct LodePNGInfo - - -12. changes ------------ - -The version number of LodePNG is the date of the change given in the format -yyyymmdd. - -Some changes aren't backwards compatible. Those are indicated with a (!) -symbol. - -*) 17 sep 2017: fix memory leak for some encoder input error cases -*) 27 nov 2016: grey+alpha auto color model detection bugfix -*) 18 apr 2016: Changed qsort to custom stable sort (for platforms w/o qsort). -*) 09 apr 2016: Fixed colorkey usage detection, and better file loading (within - the limits of pure C90). -*) 08 dec 2015: Made load_file function return error if file can't be opened. -*) 24 okt 2015: Bugfix with decoding to palette output. -*) 18 apr 2015: Boundary PM instead of just package-merge for faster encoding. -*) 23 aug 2014: Reduced needless memory usage of decoder. -*) 28 jun 2014: Removed fix_png setting, always support palette OOB for - simplicity. Made ColorProfile public. -*) 09 jun 2014: Faster encoder by fixing hash bug and more zeros optimization. -*) 22 dec 2013: Power of two windowsize required for optimization. -*) 15 apr 2013: Fixed bug with LAC_ALPHA and color key. -*) 25 mar 2013: Added an optional feature to ignore some PNG errors (fix_png). -*) 11 mar 2013 (!): Bugfix with custom free. Changed from "my" to "lodepng_" - prefix for the custom allocators and made it possible with a new #define to - use custom ones in your project without needing to change lodepng's code. -*) 28 jan 2013: Bugfix with color key. -*) 27 okt 2012: Tweaks in text chunk keyword length error handling. -*) 8 okt 2012 (!): Added new filter strategy (entropy) and new auto color mode. - (no palette). Better deflate tree encoding. New compression tweak settings. - Faster color conversions while decoding. Some internal cleanups. -*) 23 sep 2012: Reduced warnings in Visual Studio a little bit. -*) 1 sep 2012 (!): Removed #define's for giving custom (de)compression functions - and made it work with function pointers instead. -*) 23 jun 2012: Added more filter strategies. Made it easier to use custom alloc - and free functions and toggle #defines from compiler flags. Small fixes. -*) 6 may 2012 (!): Made plugging in custom zlib/deflate functions more flexible. -*) 22 apr 2012 (!): Made interface more consistent, renaming a lot. Removed - redundant C++ codec classes. Reduced amount of structs. Everything changed, - but it is cleaner now imho and functionality remains the same. Also fixed - several bugs and shrunk the implementation code. Made new samples. -*) 6 nov 2011 (!): By default, the encoder now automatically chooses the best - PNG color model and bit depth, based on the amount and type of colors of the - raw image. For this, autoLeaveOutAlphaChannel replaced by auto_choose_color. -*) 9 okt 2011: simpler hash chain implementation for the encoder. -*) 8 sep 2011: lz77 encoder lazy matching instead of greedy matching. -*) 23 aug 2011: tweaked the zlib compression parameters after benchmarking. - A bug with the PNG filtertype heuristic was fixed, so that it chooses much - better ones (it's quite significant). A setting to do an experimental, slow, - brute force search for PNG filter types is added. -*) 17 aug 2011 (!): changed some C zlib related function names. -*) 16 aug 2011: made the code less wide (max 120 characters per line). -*) 17 apr 2011: code cleanup. Bugfixes. Convert low to 16-bit per sample colors. -*) 21 feb 2011: fixed compiling for C90. Fixed compiling with sections disabled. -*) 11 dec 2010: encoding is made faster, based on suggestion by Peter Eastman - to optimize long sequences of zeros. -*) 13 nov 2010: added LodePNG_InfoColor_hasPaletteAlpha and - LodePNG_InfoColor_canHaveAlpha functions for convenience. -*) 7 nov 2010: added LodePNG_error_text function to get error code description. -*) 30 okt 2010: made decoding slightly faster -*) 26 okt 2010: (!) changed some C function and struct names (more consistent). - Reorganized the documentation and the declaration order in the header. -*) 08 aug 2010: only changed some comments and external samples. -*) 05 jul 2010: fixed bug thanks to warnings in the new gcc version. -*) 14 mar 2010: fixed bug where too much memory was allocated for char buffers. -*) 02 sep 2008: fixed bug where it could create empty tree that linux apps could - read by ignoring the problem but windows apps couldn't. -*) 06 jun 2008: added more error checks for out of memory cases. -*) 26 apr 2008: added a few more checks here and there to ensure more safety. -*) 06 mar 2008: crash with encoding of strings fixed -*) 02 feb 2008: support for international text chunks added (iTXt) -*) 23 jan 2008: small cleanups, and #defines to divide code in sections -*) 20 jan 2008: support for unknown chunks allowing using LodePNG for an editor. -*) 18 jan 2008: support for tIME and pHYs chunks added to encoder and decoder. -*) 17 jan 2008: ability to encode and decode compressed zTXt chunks added - Also various fixes, such as in the deflate and the padding bits code. -*) 13 jan 2008: Added ability to encode Adam7-interlaced images. Improved - filtering code of encoder. -*) 07 jan 2008: (!) changed LodePNG to use ISO C90 instead of C++. A - C++ wrapper around this provides an interface almost identical to before. - Having LodePNG be pure ISO C90 makes it more portable. The C and C++ code - are together in these files but it works both for C and C++ compilers. -*) 29 dec 2007: (!) changed most integer types to unsigned int + other tweaks -*) 30 aug 2007: bug fixed which makes this Borland C++ compatible -*) 09 aug 2007: some VS2005 warnings removed again -*) 21 jul 2007: deflate code placed in new namespace separate from zlib code -*) 08 jun 2007: fixed bug with 2- and 4-bit color, and small interlaced images -*) 04 jun 2007: improved support for Visual Studio 2005: crash with accessing - invalid std::vector element [0] fixed, and level 3 and 4 warnings removed -*) 02 jun 2007: made the encoder add a tag with version by default -*) 27 may 2007: zlib and png code separated (but still in the same file), - simple encoder/decoder functions added for more simple usage cases -*) 19 may 2007: minor fixes, some code cleaning, new error added (error 69), - moved some examples from here to lodepng_examples.cpp -*) 12 may 2007: palette decoding bug fixed -*) 24 apr 2007: changed the license from BSD to the zlib license -*) 11 mar 2007: very simple addition: ability to encode bKGD chunks. -*) 04 mar 2007: (!) tEXt chunk related fixes, and support for encoding - palettized PNG images. Plus little interface change with palette and texts. -*) 03 mar 2007: Made it encode dynamic Huffman shorter with repeat codes. - Fixed a bug where the end code of a block had length 0 in the Huffman tree. -*) 26 feb 2007: Huffman compression with dynamic trees (BTYPE 2) now implemented - and supported by the encoder, resulting in smaller PNGs at the output. -*) 27 jan 2007: Made the Adler-32 test faster so that a timewaste is gone. -*) 24 jan 2007: gave encoder an error interface. Added color conversion from any - greyscale type to 8-bit greyscale with or without alpha. -*) 21 jan 2007: (!) Totally changed the interface. It allows more color types - to convert to and is more uniform. See the manual for how it works now. -*) 07 jan 2007: Some cleanup & fixes, and a few changes over the last days: - encode/decode custom tEXt chunks, separate classes for zlib & deflate, and - at last made the decoder give errors for incorrect Adler32 or Crc. -*) 01 jan 2007: Fixed bug with encoding PNGs with less than 8 bits per channel. -*) 29 dec 2006: Added support for encoding images without alpha channel, and - cleaned out code as well as making certain parts faster. -*) 28 dec 2006: Added "Settings" to the encoder. -*) 26 dec 2006: The encoder now does LZ77 encoding and produces much smaller files now. - Removed some code duplication in the decoder. Fixed little bug in an example. -*) 09 dec 2006: (!) Placed output parameters of public functions as first parameter. - Fixed a bug of the decoder with 16-bit per color. -*) 15 okt 2006: Changed documentation structure -*) 09 okt 2006: Encoder class added. It encodes a valid PNG image from the - given image buffer, however for now it's not compressed. -*) 08 sep 2006: (!) Changed to interface with a Decoder class -*) 30 jul 2006: (!) LodePNG_InfoPng , width and height are now retrieved in different - way. Renamed decodePNG to decodePNGGeneric. -*) 29 jul 2006: (!) Changed the interface: image info is now returned as a - struct of type LodePNG::LodePNG_Info, instead of a vector, which was a bit clumsy. -*) 28 jul 2006: Cleaned the code and added new error checks. - Corrected terminology "deflate" into "inflate". -*) 23 jun 2006: Added SDL example in the documentation in the header, this - example allows easy debugging by displaying the PNG and its transparency. -*) 22 jun 2006: (!) Changed way to obtain error value. Added - loadFile function for convenience. Made decodePNG32 faster. -*) 21 jun 2006: (!) Changed type of info vector to unsigned. - Changed position of palette in info vector. Fixed an important bug that - happened on PNGs with an uncompressed block. -*) 16 jun 2006: Internally changed unsigned into unsigned where - needed, and performed some optimizations. -*) 07 jun 2006: (!) Renamed functions to decodePNG and placed them - in LodePNG namespace. Changed the order of the parameters. Rewrote the - documentation in the header. Renamed files to lodepng.cpp and lodepng.h -*) 22 apr 2006: Optimized and improved some code -*) 07 sep 2005: (!) Changed to std::vector interface -*) 12 aug 2005: Initial release (C++, decoder only) - - -13. contact information ------------------------ - -Feel free to contact me with suggestions, problems, comments, ... concerning -LodePNG. If you encounter a PNG image that doesn't work properly with this -decoder, feel free to send it and I'll use it to find and fix the problem. - -My email address is (puzzle the account and domain together with an @ symbol): -Domain: gmail dot com. -Account: lode dot vandevenne. - - -Copyright (c) 2005-2017 Lode Vandevenne -*/ diff --git a/love/src/jni/love/src/libraries/lua53/lprefix.h b/love/src/jni/love/src/libraries/lua53/lprefix.h deleted file mode 100644 index de52de7b..00000000 --- a/love/src/jni/love/src/libraries/lua53/lprefix.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -** $Id: lprefix.h,v 1.2 2014/12/29 16:54:13 roberto Exp $ -** Definitions for Lua code that must come before any other header file -** See Copyright Notice in lutf8lib.c -*/ - -#ifndef lprefix_h -#define lprefix_h - - -/* -** Allows POSIX/XSI stuff -*/ -#if !defined(LUA_USE_C89) /* { */ - -#if !defined(_XOPEN_SOURCE) -#define _XOPEN_SOURCE 600 -#elif _XOPEN_SOURCE == 0 -#undef _XOPEN_SOURCE /* use -D_XOPEN_SOURCE=0 to undefine it */ -#endif - -/* -** Allows manipulation of large files in gcc and some other compilers -*/ -#if !defined(LUA_32BITS) && !defined(_FILE_OFFSET_BITS) -#define _LARGEFILE_SOURCE 1 -#define _FILE_OFFSET_BITS 64 -#endif - -#endif /* } */ - - -/* -** Windows stuff -*/ -#if defined(_WIN32) /* { */ - -#if !defined(_CRT_SECURE_NO_WARNINGS) -#define _CRT_SECURE_NO_WARNINGS /* avoid warnings about ISO C functions */ -#endif - -#endif /* } */ - -#endif - diff --git a/love/src/jni/love/src/libraries/lua53/lstrlib.c b/love/src/jni/love/src/libraries/lua53/lstrlib.c deleted file mode 100755 index 03f574f1..00000000 --- a/love/src/jni/love/src/libraries/lua53/lstrlib.c +++ /dev/null @@ -1,600 +0,0 @@ -/* -** $Id: lstrlib.c,v 1.254 2016/12/22 13:08:50 roberto Exp $ -** Standard library for string operations and pattern-matching -** Modified by the Kepler Project and the LOVE Development Team to work with -** Lua 5.1's API -*/ - -/********************************************************************* - * The MIT License (MIT) - * - * Copyright (c) 2015 Kepler Project. - * - * 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. - *********************************************************************/ - -/********************************************************************* - * This file contains parts of Lua 5.2's and Lua 5.3's source code: - * - * Copyright (C) 1994-2014 Lua.org, PUC-Rio. - * - * 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 "lprefix.h" - - -#include -#include -#include -#include -#include -#include - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" -#include "lstrlib.h" - -#if LUA_VERSION_NUM == 501 -typedef size_t lua_Unsigned; -#endif - -#if LUA_VERSION_NUM == 501 -# define LUAL_BUFFER53_BUFFER(B) (B)->b.buffer -#else -# define LUAL_BUFFER53_BUFFER(B) (B)->b.initb -#endif - -static void luaL_buffinit_53 (lua_State *L, luaL_Buffer_53 *B) { -#if LUA_VERSION_NUM == 501 - /* make it crash if used via pointer to a 5.1-style luaL_Buffer */ - B->b.p = NULL; - B->b.L = NULL; - B->b.lvl = 0; - /* reuse the buffer from the 5.1-style luaL_Buffer though! */ - B->ptr = B->b.buffer; - B->capacity = LUAL_BUFFERSIZE; - B->nelems = 0; - B->L2 = L; -#else - return luaL_buffinit(L, (luaL_Buffer*) B); -#endif -} - - -static char *luaL_prepbuffsize_53 (luaL_Buffer_53 *B, size_t s) { -#if LUA_VERSION_NUM == 501 - if (B->capacity - B->nelems < s) { /* needs to grow */ - char* newptr = NULL; - size_t newcap = B->capacity * 2; - if (newcap - B->nelems < s) - newcap = B->nelems + s; - if (newcap < B->capacity) /* overflow */ - luaL_error(B->L2, "buffer too large"); - newptr = (char*)lua_newuserdata(B->L2, newcap); - memcpy(newptr, B->ptr, B->nelems); - if (B->ptr != B->b.buffer) - lua_replace(B->L2, -2); /* remove old buffer */ - B->ptr = newptr; - B->capacity = newcap; - } - return B->ptr+B->nelems; -#else - return luaL_prepbuffsize((luaL_Buffer*) B, s); -#endif -} - - -#define luaL_addsize_53(B, s) \ - ((B)->nelems += (s)) - -#define luaL_addchar_53(B, c) \ - ((void)((B)->nelems < (B)->capacity || luaL_prepbuffsize_53((B), 1)), \ - ((B)->ptr[(B)->nelems++] = (c))) - - -static void luaL_addlstring_53 (luaL_Buffer_53 *B, const char *s, size_t l) { - memcpy(luaL_prepbuffsize_53(B, l), s, l); - luaL_addsize_53(B, l); -} - - -void lua53_pushresult (luaL_Buffer_53 *B) { - lua_pushlstring(B->L2, B->ptr, B->nelems); - if (B->ptr != LUAL_BUFFER53_BUFFER(B)) - lua_replace(B->L2, -2); /* remove userdata buffer */ -} - -void lua53_cleanupbuffer (luaL_Buffer_53 *B) { - if (B->ptr != LUAL_BUFFER53_BUFFER(B)) - lua_replace(B->L2, -1); /* remove userdata buffer */ -} - -/* -** Some sizes are better limited to fit in 'int', but must also fit in -** 'size_t'. (We assume that 'lua_Integer' cannot be smaller than 'int'.) -*/ -#define MAX_SIZET ((size_t)(~(size_t)0)) - -#define MAXSIZE \ - (sizeof(size_t) < sizeof(int) ? MAX_SIZET : (size_t)(INT_MAX)) - - -/* translate a relative string position: negative means back from end */ -static lua_Integer posrelat (lua_Integer pos, size_t len) { - if (pos >= 0) return pos; - else if (0u - (size_t)pos > len) return 0; - else return (lua_Integer)len + pos + 1; -} - - -/* -** {====================================================== -** PACK/UNPACK -** ======================================================= -*/ - - -/* value used for padding */ -#if !defined(LUAL_PACKPADBYTE) -#define LUAL_PACKPADBYTE 0x00 -#endif - -/* maximum size for the binary representation of an integer */ -#define MAXINTSIZE 16 - -/* number of bits in a character */ -#define NB CHAR_BIT - -/* mask for one character (NB 1's) */ -#define MC ((1 << NB) - 1) - -/* size of a lua_Integer */ -#define SZINT ((int)sizeof(lua_Integer)) - - -/* dummy union to get native endianness */ -static const union { - int dummy; - char little; /* true iff machine is little endian */ -} nativeendian = {1}; - - -/* dummy structure to get native alignment requirements */ -struct cD { - char c; - union { double d; void *p; lua_Integer i; lua_Number n; } u; -}; - -#define MAXALIGN (offsetof(struct cD, u)) - - -/* -** Union for serializing floats -*/ -typedef union Ftypes { - float f; - double d; - lua_Number n; - char buff[5 * sizeof(lua_Number)]; /* enough for any float type */ -} Ftypes; - - -/* -** information to pack/unpack stuff -*/ -typedef struct Header { - lua_State *L; - int islittle; - int maxalign; -} Header; - - -/* -** options for pack/unpack -*/ -typedef enum KOption { - Kint, /* signed integers */ - Kuint, /* unsigned integers */ - Kfloat, /* floating-point numbers */ - Kchar, /* fixed-length strings */ - Kstring, /* strings with prefixed length */ - Kzstr, /* zero-terminated strings */ - Kpadding, /* padding */ - Kpaddalign, /* padding for alignment */ - Knop /* no-op (configuration or spaces) */ -} KOption; - - -/* -** Read an integer numeral from string 'fmt' or return 'df' if -** there is no numeral -*/ -static int digit (int c) { return '0' <= c && c <= '9'; } - -static int getnum (const char **fmt, int df) { - if (!digit(**fmt)) /* no number? */ - return df; /* return default value */ - else { - int a = 0; - do { - a = a*10 + (*((*fmt)++) - '0'); - } while (digit(**fmt) && a <= ((int)MAXSIZE - 9)/10); - return a; - } -} - - -/* -** Read an integer numeral and raises an error if it is larger -** than the maximum size for integers. -*/ -static int getnumlimit (Header *h, const char **fmt, int df) { - int sz = getnum(fmt, df); - if (sz > MAXINTSIZE || sz <= 0) - luaL_error(h->L, "integral size (%d) out of limits [1,%d]", - sz, MAXINTSIZE); - return sz; -} - - -/* -** Initialize Header -*/ -static void initheader (lua_State *L, Header *h) { - h->L = L; - h->islittle = nativeendian.little; - h->maxalign = 1; -} - - -/* -** Read and classify next option. 'size' is filled with option's size. -*/ -static KOption getoption (Header *h, const char **fmt, int *size) { - int opt = *((*fmt)++); - *size = 0; /* default */ - switch (opt) { - case 'b': *size = sizeof(char); return Kint; - case 'B': *size = sizeof(char); return Kuint; - case 'h': *size = sizeof(short); return Kint; - case 'H': *size = sizeof(short); return Kuint; - case 'l': *size = sizeof(long); return Kint; - case 'L': *size = sizeof(long); return Kuint; - case 'j': *size = sizeof(lua_Integer); return Kint; - case 'J': *size = sizeof(lua_Integer); return Kuint; - case 'T': *size = sizeof(size_t); return Kuint; - case 'f': *size = sizeof(float); return Kfloat; - case 'd': *size = sizeof(double); return Kfloat; - case 'n': *size = sizeof(lua_Number); return Kfloat; - case 'i': *size = getnumlimit(h, fmt, sizeof(int)); return Kint; - case 'I': *size = getnumlimit(h, fmt, sizeof(int)); return Kuint; - case 's': *size = getnumlimit(h, fmt, sizeof(size_t)); return Kstring; - case 'c': - *size = getnum(fmt, -1); - if (*size == -1) - luaL_error(h->L, "missing size for format option 'c'"); - return Kchar; - case 'z': return Kzstr; - case 'x': *size = 1; return Kpadding; - case 'X': return Kpaddalign; - case ' ': break; - case '<': h->islittle = 1; break; - case '>': h->islittle = 0; break; - case '=': h->islittle = nativeendian.little; break; - case '!': h->maxalign = getnumlimit(h, fmt, MAXALIGN); break; - default: luaL_error(h->L, "invalid format option '%c'", opt); - } - return Knop; -} - - -/* -** Read, classify, and fill other details about the next option. -** 'psize' is filled with option's size, 'notoalign' with its -** alignment requirements. -** Local variable 'size' gets the size to be aligned. (Kpadal option -** always gets its full alignment, other options are limited by -** the maximum alignment ('maxalign'). Kchar option needs no alignment -** despite its size. -*/ -static KOption getdetails (Header *h, size_t totalsize, - const char **fmt, int *psize, int *ntoalign) { - KOption opt = getoption(h, fmt, psize); - int align = *psize; /* usually, alignment follows size */ - if (opt == Kpaddalign) { /* 'X' gets alignment from following option */ - if (**fmt == '\0' || getoption(h, fmt, &align) == Kchar || align == 0) - luaL_argerror(h->L, 1, "invalid next option for option 'X'"); - } - if (align <= 1 || opt == Kchar) /* need no alignment? */ - *ntoalign = 0; - else { - if (align > h->maxalign) /* enforce maximum alignment */ - align = h->maxalign; - if ((align & (align - 1)) != 0) /* is 'align' not a power of 2? */ - luaL_argerror(h->L, 1, "format asks for alignment not power of 2"); - *ntoalign = (align - (int)(totalsize & (align - 1))) & (align - 1); - } - return opt; -} - - -/* -** Pack integer 'n' with 'size' bytes and 'islittle' endianness. -** The final 'if' handles the case when 'size' is larger than -** the size of a Lua integer, correcting the extra sign-extension -** bytes if necessary (by default they would be zeros). -*/ -static void packint (luaL_Buffer_53 *b, lua_Unsigned n, - int islittle, int size, int neg) { - char *buff = luaL_prepbuffsize_53(b, size); - int i; - buff[islittle ? 0 : size - 1] = (char)(n & MC); /* first byte */ - for (i = 1; i < size; i++) { - n >>= NB; - buff[islittle ? i : size - 1 - i] = (char)(n & MC); - } - if (neg && size > SZINT) { /* negative number need sign extension? */ - for (i = SZINT; i < size; i++) /* correct extra bytes */ - buff[islittle ? i : size - 1 - i] = (char)MC; - } - luaL_addsize_53(b, size); /* add result to buffer */ -} - - -/* -** Copy 'size' bytes from 'src' to 'dest', correcting endianness if -** given 'islittle' is different from native endianness. -*/ -static void copywithendian (volatile char *dest, volatile const char *src, - int size, int islittle) { - if (islittle == nativeendian.little) { - while (size-- != 0) - *(dest++) = *(src++); - } - else { - dest += size - 1; - while (size-- != 0) - *(dest--) = *(src++); - } -} - - -void lua53_str_pack (lua_State *L, const char *fmt, int startidx, luaL_Buffer_53 *b) { - Header h; - int arg = startidx - 1; /* current argument to pack */ - size_t totalsize = 0; /* accumulate total size of result */ - initheader(L, &h); - lua_pushnil(L); /* mark to separate arguments from string buffer */ - luaL_buffinit_53(L, b); - while (*fmt != '\0') { - int size, ntoalign; - KOption opt = getdetails(&h, totalsize, &fmt, &size, &ntoalign); - totalsize += ntoalign + size; - while (ntoalign-- > 0) - luaL_addchar_53(b, LUAL_PACKPADBYTE); /* fill alignment */ - arg++; - switch (opt) { - case Kint: { /* signed integers */ - lua_Integer n = luaL_checkinteger(L, arg); - if (size < SZINT) { /* need overflow check? */ - lua_Integer lim = (lua_Integer)1 << ((size * NB) - 1); - luaL_argcheck(L, -lim <= n && n < lim, arg, "integer overflow"); - } - packint(b, (lua_Unsigned)n, h.islittle, size, (n < 0)); - break; - } - case Kuint: { /* unsigned integers */ - lua_Integer n = luaL_checkinteger(L, arg); - if (size < SZINT) /* need overflow check? */ - luaL_argcheck(L, (lua_Unsigned)n < ((lua_Unsigned)1 << (size * NB)), - arg, "unsigned overflow"); - packint(b, (lua_Unsigned)n, h.islittle, size, 0); - break; - } - case Kfloat: { /* floating-point options */ - volatile Ftypes u; - char *buff = luaL_prepbuffsize_53(b, size); - lua_Number n = luaL_checknumber(L, arg); /* get argument */ - if (size == sizeof(u.f)) u.f = (float)n; /* copy it into 'u' */ - else if (size == sizeof(u.d)) u.d = (double)n; - else u.n = n; - /* move 'u' to final result, correcting endianness if needed */ - copywithendian(buff, u.buff, size, h.islittle); - luaL_addsize_53(b, size); - break; - } - case Kchar: { /* fixed-size string */ - size_t len; - const char *s = luaL_checklstring(L, arg, &len); - luaL_argcheck(L, len <= (size_t)size, arg, - "string longer than given size"); - luaL_addlstring_53(b, s, len); /* add string */ - while (len++ < (size_t)size) /* pad extra space */ - luaL_addchar_53(b, LUAL_PACKPADBYTE); - break; - } - case Kstring: { /* strings with length count */ - size_t len; - const char *s = luaL_checklstring(L, arg, &len); - luaL_argcheck(L, size >= (int)sizeof(size_t) || - len < ((size_t)1 << (size * NB)), - arg, "string length does not fit in given size"); - packint(b, (lua_Unsigned)len, h.islittle, size, 0); /* pack length */ - luaL_addlstring_53(b, s, len); - totalsize += len; - break; - } - case Kzstr: { /* zero-terminated string */ - size_t len; - const char *s = luaL_checklstring(L, arg, &len); - luaL_argcheck(L, strlen(s) == len, arg, "string contains zeros"); - luaL_addlstring_53(b, s, len); - luaL_addchar_53(b, '\0'); /* add zero at the end */ - totalsize += len + 1; - break; - } - case Kpadding: luaL_addchar_53(b, LUAL_PACKPADBYTE); /* FALLTHROUGH */ - case Kpaddalign: case Knop: - arg--; /* undo increment */ - break; - } - } -} - - -int lua53_str_packsize (lua_State *L) { - Header h; - const char *fmt = luaL_checkstring(L, 1); /* format string */ - size_t totalsize = 0; /* accumulate total size of result */ - initheader(L, &h); - while (*fmt != '\0') { - int size, ntoalign; - KOption opt = getdetails(&h, totalsize, &fmt, &size, &ntoalign); - size += ntoalign; /* total space used by option */ - luaL_argcheck(L, totalsize <= MAXSIZE - size, 1, - "format result too large"); - totalsize += size; - switch (opt) { - case Kstring: /* strings with length count */ - case Kzstr: /* zero-terminated string */ - luaL_argerror(L, 1, "variable-length format"); - /* call never return, but to avoid warnings: *//* FALLTHROUGH */ - default: break; - } - } - lua_pushinteger(L, (lua_Integer)totalsize); - return 1; -} - - -/* -** Unpack an integer with 'size' bytes and 'islittle' endianness. -** If size is smaller than the size of a Lua integer and integer -** is signed, must do sign extension (propagating the sign to the -** higher bits); if size is larger than the size of a Lua integer, -** it must check the unread bytes to see whether they do not cause an -** overflow. -*/ -static lua_Integer unpackint (lua_State *L, const char *str, - int islittle, int size, int issigned) { - lua_Unsigned res = 0; - int i; - int limit = (size <= SZINT) ? size : SZINT; - for (i = limit - 1; i >= 0; i--) { - res <<= NB; - res |= (lua_Unsigned)(unsigned char)str[islittle ? i : size - 1 - i]; - } - if (size < SZINT) { /* real size smaller than lua_Integer? */ - if (issigned) { /* needs sign extension? */ - lua_Unsigned mask = (lua_Unsigned)1 << (size*NB - 1); - res = ((res ^ mask) - mask); /* do sign extension */ - } - } - else if (size > SZINT) { /* must check unread bytes */ - int mask = (!issigned || (lua_Integer)res >= 0) ? 0 : MC; - for (i = limit; i < size; i++) { - if ((unsigned char)str[islittle ? i : size - 1 - i] != mask) - luaL_error(L, "%d-byte integer does not fit into Lua Integer", size); - } - } - return (lua_Integer)res; -} - - -int lua53_str_unpack (lua_State *L, const char *fmt, const char *data, size_t ld, int dataidx, int posidx) { - Header h; - size_t pos = (size_t)posrelat(luaL_optinteger(L, posidx, 1), ld) - 1; - int n = 0; /* number of results */ - luaL_argcheck(L, pos <= ld, posidx, "initial position out of string"); - initheader(L, &h); - while (*fmt != '\0') { - int size, ntoalign; - KOption opt = getdetails(&h, pos, &fmt, &size, &ntoalign); - if ((size_t)ntoalign + size > ~pos || pos + ntoalign + size > ld) - luaL_argerror(L, dataidx, "data string too short"); - pos += ntoalign; /* skip alignment */ - /* stack space for item + next position */ - luaL_checkstack(L, dataidx, "too many results"); - n++; - switch (opt) { - case Kint: - case Kuint: { - lua_Integer res = unpackint(L, data + pos, h.islittle, size, - (opt == Kint)); - lua_pushinteger(L, res); - break; - } - case Kfloat: { - volatile Ftypes u; - lua_Number num; - copywithendian(u.buff, data + pos, size, h.islittle); - if (size == sizeof(u.f)) num = (lua_Number)u.f; - else if (size == sizeof(u.d)) num = (lua_Number)u.d; - else num = u.n; - lua_pushnumber(L, num); - break; - } - case Kchar: { - lua_pushlstring(L, data + pos, size); - break; - } - case Kstring: { - size_t len = (size_t)unpackint(L, data + pos, h.islittle, size, 0); - luaL_argcheck(L, pos + len + size <= ld, dataidx, "data string too short"); - lua_pushlstring(L, data + pos + size, len); - pos += len; /* skip string */ - break; - } - case Kzstr: { - size_t len = (int)strlen(data + pos); - lua_pushlstring(L, data + pos, len); - pos += len + 1; /* skip string plus final '\0' */ - break; - } - case Kpaddalign: case Kpadding: case Knop: - n--; /* undo increment */ - break; - } - pos += size; - } - lua_pushinteger(L, pos + 1); /* next position */ - return n + 1; -} - -/* }====================================================== */ - diff --git a/love/src/jni/love/src/libraries/lua53/lstrlib.h b/love/src/jni/love/src/libraries/lua53/lstrlib.h deleted file mode 100644 index f341313c..00000000 --- a/love/src/jni/love/src/libraries/lua53/lstrlib.h +++ /dev/null @@ -1,30 +0,0 @@ - -#ifndef LUA53_LSTRLIB_H -#define LUA53_LSTRLIB_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "lua.h" - -typedef struct luaL_Buffer_53 { - luaL_Buffer b; /* make incorrect code crash! */ - char *ptr; - size_t nelems; - size_t capacity; - lua_State *L2; -} luaL_Buffer_53; - -void lua53_pushresult (luaL_Buffer_53 *B); -void lua53_cleanupbuffer (luaL_Buffer_53 *B); - -void lua53_str_pack (lua_State *L, const char *fmt, int startidx, luaL_Buffer_53 *b); -int lua53_str_packsize (lua_State *L); -int lua53_str_unpack (lua_State *L, const char *fmt, const char *data, size_t ld, int dataidx, int posidx); - -#ifdef __cplusplus -} -#endif - -#endif /* LUA53_LSTRLIB_H */ diff --git a/love/src/jni/love/src/libraries/lua53/lutf8lib.c b/love/src/jni/love/src/libraries/lua53/lutf8lib.c deleted file mode 100644 index 48abc338..00000000 --- a/love/src/jni/love/src/libraries/lua53/lutf8lib.c +++ /dev/null @@ -1,316 +0,0 @@ -/* -** $Id: lutf8lib.c,v 1.13 2014/11/02 19:19:04 roberto Exp $ -** Standard library for UTF-8 manipulation -** Modified by the LOVE Development Team to work with Lua 5.1's API -*/ - -/****************************************************************************** - * Copyright (C) 1994-2015 Lua.org, PUC-Rio, 2015 LOVE Development Team. - * - * 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. - ******************************************************************************/ - -#define lutf8lib_c - -#include "lprefix.h" - - -#include -#include -#include - -#include "lutf8lib.h" - -#include "lauxlib.h" -#include "lualib.h" - -#define MAXUNICODE 0x10FFFF - -/* size of buffer for 'utf8esc' function (taken from lobject.h) */ -#define UTF8BUFFSZ 8 - -#define iscont(p) ((*(p) & 0xC0) == 0x80) - - -/* from strlib */ -/* translate a relative string position: negative means back from end */ -static lua_Integer u_posrelat (lua_Integer pos, size_t len) { - if (pos >= 0) return pos; - else if (0u - (size_t)pos > len) return 0; - else return (lua_Integer)len + pos + 1; -} - - -/* -** Decode one UTF-8 sequence, returning NULL if byte sequence is invalid. -*/ -static const char *utf8_decode (const char *o, int *val) { - static unsigned int limits[] = {0xFF, 0x7F, 0x7FF, 0xFFFF}; - const unsigned char *s = (const unsigned char *)o; - unsigned int c = s[0]; - unsigned int res = 0; /* final result */ - if (c < 0x80) /* ascii? */ - res = c; - else { - int count = 0; /* to count number of continuation bytes */ - while (c & 0x40) { /* still have continuation bytes? */ - int cc = s[++count]; /* read next byte */ - if ((cc & 0xC0) != 0x80) /* not a continuation byte? */ - return NULL; /* invalid byte sequence */ - res = (res << 6) | (cc & 0x3F); /* add lower 6 bits from cont. byte */ - c <<= 1; /* to test next bit */ - } - res |= ((c & 0x7F) << (count * 5)); /* add first byte */ - if (count > 3 || res > MAXUNICODE || res <= limits[count]) - return NULL; /* invalid byte sequence */ - s += count; /* skip continuation bytes read */ - } - if (val) *val = res; - return (const char *)s + 1; /* +1 to include first byte */ -} - - -/* -** utf8len(s [, i [, j]]) --> number of characters that start in the -** range [i,j], or nil + current position if 's' is not well formed in -** that interval -*/ -static int utflen (lua_State *L) { - int n = 0; - size_t len; - const char *s = luaL_checklstring(L, 1, &len); - lua_Integer posi = u_posrelat(luaL_optinteger(L, 2, 1), len); - lua_Integer posj = u_posrelat(luaL_optinteger(L, 3, -1), len); - luaL_argcheck(L, 1 <= posi && --posi <= (lua_Integer)len, 2, - "initial position out of string"); - luaL_argcheck(L, --posj < (lua_Integer)len, 3, - "final position out of string"); - while (posi <= posj) { - const char *s1 = utf8_decode(s + posi, NULL); - if (s1 == NULL) { /* conversion error? */ - lua_pushnil(L); /* return nil ... */ - lua_pushinteger(L, posi + 1); /* ... and current position */ - return 2; - } - posi = s1 - s; - n++; - } - lua_pushinteger(L, n); - return 1; -} - - -/* -** codepoint(s, [i, [j]]) -> returns codepoints for all characters -** that start in the range [i,j] -*/ -static int codepoint (lua_State *L) { - size_t len; - const char *s = luaL_checklstring(L, 1, &len); - lua_Integer posi = u_posrelat(luaL_optinteger(L, 2, 1), len); - lua_Integer pose = u_posrelat(luaL_optinteger(L, 3, posi), len); - int n; - const char *se; - luaL_argcheck(L, posi >= 1, 2, "out of range"); - luaL_argcheck(L, pose <= (lua_Integer)len, 3, "out of range"); - if (posi > pose) return 0; /* empty interval; return no values */ - n = (int)(pose - posi + 1); - if (posi + n <= pose) /* (lua_Integer -> int) overflow? */ - return luaL_error(L, "string slice too long"); - luaL_checkstack(L, n, "string slice too long"); - n = 0; - se = s + pose; - for (s += posi - 1; s < se;) { - int code; - s = utf8_decode(s, &code); - if (s == NULL) - return luaL_error(L, "invalid UTF-8 code"); - lua_pushinteger(L, code); - n++; - } - return n; -} - - -/* taken from lobject.c */ -static int utf8esc (char *buff, unsigned long x) { - int n = 1; /* number of bytes put in buffer (backwards) */ - lua_assert(x <= 0x10FFFF); - if (x < 0x80) /* ascii? */ - buff[UTF8BUFFSZ - 1] = (char) x; - else { /* need continuation bytes */ - unsigned int mfb = 0x3f; /* maximum that fits in first byte */ - do { /* add continuation bytes */ - buff[UTF8BUFFSZ - (n++)] = (char) (0x80 | (x & 0x3f)); - x >>= 6; /* remove added bits */ - mfb >>= 1; /* now there is one less bit available in first byte */ - } while (x > mfb); /* still needs continuation byte? */ - buff[UTF8BUFFSZ - n] = (char) ((~mfb << 1) | x); /* add first byte */ - } - return n; -} - -static void pushutfchar (lua_State *L, int arg) { - lua_Integer code = luaL_checkinteger(L, arg); - luaL_argcheck(L, 0 <= code && code <= MAXUNICODE, arg, "value out of range"); - - /* the %U string format does not exist in lua 5.1 or 5.2, so we emulate it */ - /* (code from luaO_pushvfstring in lobject.c) */ - char buff[UTF8BUFFSZ]; - int l = utf8esc(buff, (long) code); - lua_pushlstring(L, buff + UTF8BUFFSZ - l, l); -} - - -/* -** utfchar(n1, n2, ...) -> char(n1)..char(n2)... -*/ -static int utfchar (lua_State *L) { - int n = lua_gettop(L); /* number of arguments */ - if (n == 1) /* optimize common case of single char */ - pushutfchar(L, 1); - else { - int i; - luaL_Buffer b; - luaL_buffinit(L, &b); - for (i = 1; i <= n; i++) { - pushutfchar(L, i); - luaL_addvalue(&b); - } - luaL_pushresult(&b); - } - return 1; -} - - -/* -** offset(s, n, [i]) -> index where n-th character counting from -** position 'i' starts; 0 means character at 'i'. -*/ -static int byteoffset (lua_State *L) { - size_t len; - const char *s = luaL_checklstring(L, 1, &len); - lua_Integer n = luaL_checkinteger(L, 2); - lua_Integer posi = (n >= 0) ? 1 : len + 1; - posi = u_posrelat(luaL_optinteger(L, 3, posi), len); - luaL_argcheck(L, 1 <= posi && --posi <= (lua_Integer)len, 3, - "position out of range"); - if (n == 0) { - /* find beginning of current byte sequence */ - while (posi > 0 && iscont(s + posi)) posi--; - } - else { - if (iscont(s + posi)) - luaL_error(L, "initial position is a continuation byte"); - if (n < 0) { - while (n < 0 && posi > 0) { /* move back */ - do { /* find beginning of previous character */ - posi--; - } while (posi > 0 && iscont(s + posi)); - n++; - } - } - else { - n--; /* do not move for 1st character */ - while (n > 0 && posi < (lua_Integer)len) { - do { /* find beginning of next character */ - posi++; - } while (iscont(s + posi)); /* (cannot pass final '\0') */ - n--; - } - } - } - if (n == 0) /* did it find given character? */ - lua_pushinteger(L, posi + 1); - else /* no such character */ - lua_pushnil(L); - return 1; -} - - -static int iter_aux (lua_State *L) { - size_t len; - const char *s = luaL_checklstring(L, 1, &len); - lua_Integer n = lua_tointeger(L, 2) - 1; - if (n < 0) /* first iteration? */ - n = 0; /* start from here */ - else if (n < (lua_Integer)len) { - n++; /* skip current byte */ - while (iscont(s + n)) n++; /* and its continuations */ - } - if (n >= (lua_Integer)len) - return 0; /* no more codepoints */ - else { - int code; - const char *next = utf8_decode(s + n, &code); - if (next == NULL || iscont(next)) - return luaL_error(L, "invalid UTF-8 code"); - lua_pushinteger(L, n + 1); - lua_pushinteger(L, code); - return 2; - } -} - - -static int iter_codes (lua_State *L) { - luaL_checkstring(L, 1); - lua_pushcfunction(L, iter_aux); - lua_pushvalue(L, 1); - lua_pushinteger(L, 0); - return 3; -} - - -/* pattern to match a single UTF-8 character */ -#if LUA_VERSION_NUM >= 502 -#define UTF8PATT "[\0-\x7F\xC2-\xF4][\x80-\xBF]*" -#else -/* lua 5.1 doesn't support literal null bytes in patterns */ -#define UTF8PATT "[%z\x01-\x7F\xC2-\xF4][\x80-\xBF]*" -#endif - - -static struct luaL_Reg funcs[] = { - {"offset", byteoffset}, - {"codepoint", codepoint}, - {"char", utfchar}, - {"len", utflen}, - {"codes", iter_codes}, - /* placeholders */ - {"charpattern", NULL}, - {NULL, NULL} -}; - - -/* modified version of luaopen_utf8, designed to work with lua 5.1-5.3 */ -int luaopen_luautf8 (lua_State *L) { - luaL_Reg *l; - lua_createtable(L, 0, (int) (sizeof(funcs) / sizeof(luaL_Reg)) - 1); - for (l = funcs; l->name != NULL; l++) { - if (l->func != NULL) { - lua_pushcfunction(L, l->func); - lua_setfield(L, -2, l->name); - } - } - lua_pushliteral(L, UTF8PATT); - lua_setfield(L, -2, "charpattern"); - return 1; -} - diff --git a/love/src/jni/love/src/libraries/lua53/lutf8lib.h b/love/src/jni/love/src/libraries/lua53/lutf8lib.h deleted file mode 100644 index 34999f04..00000000 --- a/love/src/jni/love/src/libraries/lua53/lutf8lib.h +++ /dev/null @@ -1,17 +0,0 @@ - -#ifndef LUA53_LUTF8LIB_H -#define LUA53_LUTF8LIB_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "lua.h" - -LUALIB_API int luaopen_luautf8(lua_State *L); - -#ifdef __cplusplus -} -#endif - -#endif /* LUA53_LUTF8LIB_H */ diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/auxiliar.c b/love/src/jni/love/src/libraries/luasocket/libluasocket/auxiliar.c deleted file mode 100644 index 18fa8e4c..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/auxiliar.c +++ /dev/null @@ -1,158 +0,0 @@ -/*=========================================================================*\ -* Auxiliar routines for class hierarchy manipulation -* LuaSocket toolkit -\*=========================================================================*/ -#include -#include - -#include "auxiliar.h" - -/*=========================================================================*\ -* Exported functions -\*=========================================================================*/ -/*-------------------------------------------------------------------------*\ -* Initializes the module -\*-------------------------------------------------------------------------*/ -int auxiliar_open(lua_State *L) { - (void) L; - return 0; -} - -/*-------------------------------------------------------------------------*\ -* Creates a new class with given methods -* Methods whose names start with __ are passed directly to the metatable. -\*-------------------------------------------------------------------------*/ -void auxiliar_newclass(lua_State *L, const char *classname, luaL_Reg *func) { - luaL_newmetatable(L, classname); /* mt */ - /* create __index table to place methods */ - lua_pushstring(L, "__index"); /* mt,"__index" */ - lua_newtable(L); /* mt,"__index",it */ - /* put class name into class metatable */ - lua_pushstring(L, "class"); /* mt,"__index",it,"class" */ - lua_pushstring(L, classname); /* mt,"__index",it,"class",classname */ - lua_rawset(L, -3); /* mt,"__index",it */ - /* pass all methods that start with _ to the metatable, and all others - * to the index table */ - for (; func->name; func++) { /* mt,"__index",it */ - lua_pushstring(L, func->name); - lua_pushcfunction(L, func->func); - lua_rawset(L, func->name[0] == '_' ? -5: -3); - } - lua_rawset(L, -3); /* mt */ - lua_pop(L, 1); -} - -/*-------------------------------------------------------------------------*\ -* Prints the value of a class in a nice way -\*-------------------------------------------------------------------------*/ -int auxiliar_tostring(lua_State *L) { - char buf[32]; - if (!lua_getmetatable(L, 1)) goto error; - lua_pushstring(L, "__index"); - lua_gettable(L, -2); - if (!lua_istable(L, -1)) goto error; - lua_pushstring(L, "class"); - lua_gettable(L, -2); - if (!lua_isstring(L, -1)) goto error; - sprintf(buf, "%p", lua_touserdata(L, 1)); - lua_pushfstring(L, "%s: %s", lua_tostring(L, -1), buf); - return 1; -error: - lua_pushstring(L, "invalid object passed to 'auxiliar.c:__tostring'"); - lua_error(L); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Insert class into group -\*-------------------------------------------------------------------------*/ -void auxiliar_add2group(lua_State *L, const char *classname, const char *groupname) { - luaL_getmetatable(L, classname); - lua_pushstring(L, groupname); - lua_pushboolean(L, 1); - lua_rawset(L, -3); - lua_pop(L, 1); -} - -/*-------------------------------------------------------------------------*\ -* Make sure argument is a boolean -\*-------------------------------------------------------------------------*/ -int auxiliar_checkboolean(lua_State *L, int objidx) { - if (!lua_isboolean(L, objidx)) - auxiliar_typeerror(L, objidx, lua_typename(L, LUA_TBOOLEAN)); - return lua_toboolean(L, objidx); -} - -/*-------------------------------------------------------------------------*\ -* Return userdata pointer if object belongs to a given class, abort with -* error otherwise -\*-------------------------------------------------------------------------*/ -void *auxiliar_checkclass(lua_State *L, const char *classname, int objidx) { - void *data = auxiliar_getclassudata(L, classname, objidx); - if (!data) { - char msg[45]; - sprintf(msg, "%.35s expected", classname); - luaL_argerror(L, objidx, msg); - } - return data; -} - -/*-------------------------------------------------------------------------*\ -* Return userdata pointer if object belongs to a given group, abort with -* error otherwise -\*-------------------------------------------------------------------------*/ -void *auxiliar_checkgroup(lua_State *L, const char *groupname, int objidx) { - void *data = auxiliar_getgroupudata(L, groupname, objidx); - if (!data) { - char msg[45]; - sprintf(msg, "%.35s expected", groupname); - luaL_argerror(L, objidx, msg); - } - return data; -} - -/*-------------------------------------------------------------------------*\ -* Set object class -\*-------------------------------------------------------------------------*/ -void auxiliar_setclass(lua_State *L, const char *classname, int objidx) { - luaL_getmetatable(L, classname); - if (objidx < 0) objidx--; - lua_setmetatable(L, objidx); -} - -/*-------------------------------------------------------------------------*\ -* Get a userdata pointer if object belongs to a given group. Return NULL -* otherwise -\*-------------------------------------------------------------------------*/ -void *auxiliar_getgroupudata(lua_State *L, const char *groupname, int objidx) { - if (!lua_getmetatable(L, objidx)) - return NULL; - lua_pushstring(L, groupname); - lua_rawget(L, -2); - if (lua_isnil(L, -1)) { - lua_pop(L, 2); - return NULL; - } else { - lua_pop(L, 2); - return lua_touserdata(L, objidx); - } -} - -/*-------------------------------------------------------------------------*\ -* Get a userdata pointer if object belongs to a given class. Return NULL -* otherwise -\*-------------------------------------------------------------------------*/ -void *auxiliar_getclassudata(lua_State *L, const char *classname, int objidx) { - return luaL_checkudata(L, objidx, classname); -} - -/*-------------------------------------------------------------------------*\ -* Throws error when argument does not have correct type. -* Used to be part of lauxlib in Lua 5.1, was dropped from 5.2. -\*-------------------------------------------------------------------------*/ -int auxiliar_typeerror (lua_State *L, int narg, const char *tname) { - const char *msg = lua_pushfstring(L, "%s expected, got %s", tname, - luaL_typename(L, narg)); - return luaL_argerror(L, narg, msg); -} - diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/auxiliar.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/auxiliar.h deleted file mode 100644 index 65511d4d..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/auxiliar.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef AUXILIAR_H -#define AUXILIAR_H -/*=========================================================================*\ -* Auxiliar routines for class hierarchy manipulation -* LuaSocket toolkit (but completely independent of other LuaSocket modules) -* -* A LuaSocket class is a name associated with Lua metatables. A LuaSocket -* group is a name associated with a class. A class can belong to any number -* of groups. This module provides the functionality to: -* -* - create new classes -* - add classes to groups -* - set the class of objects -* - check if an object belongs to a given class or group -* - get the userdata associated to objects -* - print objects in a pretty way -* -* LuaSocket class names follow the convention {}. Modules -* can define any number of classes and groups. The module tcp.c, for -* example, defines the classes tcp{master}, tcp{client} and tcp{server} and -* the groups tcp{client,server} and tcp{any}. Module functions can then -* perform type-checking on their arguments by either class or group. -* -* LuaSocket metatables define the __index metamethod as being a table. This -* table has one field for each method supported by the class, and a field -* "class" with the class name. -* -* The mapping from class name to the corresponding metatable and the -* reverse mapping are done using lauxlib. -\*=========================================================================*/ - -#include "lua.h" -#include "lauxlib.h" -#include "compat.h" - -int auxiliar_open(lua_State *L); -void auxiliar_newclass(lua_State *L, const char *classname, luaL_Reg *func); -void auxiliar_add2group(lua_State *L, const char *classname, const char *group); -void auxiliar_setclass(lua_State *L, const char *classname, int objidx); -void *auxiliar_checkclass(lua_State *L, const char *classname, int objidx); -void *auxiliar_checkgroup(lua_State *L, const char *groupname, int objidx); -void *auxiliar_getclassudata(lua_State *L, const char *groupname, int objidx); -void *auxiliar_getgroupudata(lua_State *L, const char *groupname, int objidx); -int auxiliar_checkboolean(lua_State *L, int objidx); -int auxiliar_tostring(lua_State *L); -int auxiliar_typeerror(lua_State *L, int narg, const char *tname); - -#endif /* AUXILIAR_H */ diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/buffer.c b/love/src/jni/love/src/libraries/luasocket/libluasocket/buffer.c deleted file mode 100644 index fff16346..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/buffer.c +++ /dev/null @@ -1,273 +0,0 @@ -/*=========================================================================*\ -* Input/Output interface for Lua programs -* LuaSocket toolkit -\*=========================================================================*/ -#include "lua.h" -#include "lauxlib.h" -#include "compat.h" - -#include "buffer.h" - -/*=========================================================================*\ -* Internal function prototypes -\*=========================================================================*/ -static int recvraw(p_buffer buf, size_t wanted, luaL_Buffer *b); -static int recvline(p_buffer buf, luaL_Buffer *b); -static int recvall(p_buffer buf, luaL_Buffer *b); -static int buffer_get(p_buffer buf, const char **data, size_t *count); -static void buffer_skip(p_buffer buf, size_t count); -static int sendraw(p_buffer buf, const char *data, size_t count, size_t *sent); - -/* min and max macros */ -#ifndef MIN -#define MIN(x, y) ((x) < (y) ? x : y) -#endif -#ifndef MAX -#define MAX(x, y) ((x) > (y) ? x : y) -#endif - -/*=========================================================================*\ -* Exported functions -\*=========================================================================*/ -/*-------------------------------------------------------------------------*\ -* Initializes module -\*-------------------------------------------------------------------------*/ -int buffer_open(lua_State *L) { - (void) L; - return 0; -} - -/*-------------------------------------------------------------------------*\ -* Initializes C structure -\*-------------------------------------------------------------------------*/ -void buffer_init(p_buffer buf, p_io io, p_timeout tm) { - buf->first = buf->last = 0; - buf->io = io; - buf->tm = tm; - buf->received = buf->sent = 0; - buf->birthday = timeout_gettime(); -} - -/*-------------------------------------------------------------------------*\ -* object:getstats() interface -\*-------------------------------------------------------------------------*/ -int buffer_meth_getstats(lua_State *L, p_buffer buf) { - lua_pushnumber(L, (lua_Number) buf->received); - lua_pushnumber(L, (lua_Number) buf->sent); - lua_pushnumber(L, timeout_gettime() - buf->birthday); - return 3; -} - -/*-------------------------------------------------------------------------*\ -* object:setstats() interface -\*-------------------------------------------------------------------------*/ -int buffer_meth_setstats(lua_State *L, p_buffer buf) { - buf->received = (long) luaL_optnumber(L, 2, (lua_Number) buf->received); - buf->sent = (long) luaL_optnumber(L, 3, (lua_Number) buf->sent); - if (lua_isnumber(L, 4)) buf->birthday = timeout_gettime() - lua_tonumber(L, 4); - lua_pushnumber(L, 1); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* object:send() interface -\*-------------------------------------------------------------------------*/ -int buffer_meth_send(lua_State *L, p_buffer buf) { - int top = lua_gettop(L); - int err = IO_DONE; - size_t size = 0, sent = 0; - const char *data = luaL_checklstring(L, 2, &size); - long start = (long) luaL_optnumber(L, 3, 1); - long end = (long) luaL_optnumber(L, 4, -1); - timeout_markstart(buf->tm); - if (start < 0) start = (long) (size+start+1); - if (end < 0) end = (long) (size+end+1); - if (start < 1) start = (long) 1; - if (end > (long) size) end = (long) size; - if (start <= end) err = sendraw(buf, data+start-1, end-start+1, &sent); - /* check if there was an error */ - if (err != IO_DONE) { - lua_pushnil(L); - lua_pushstring(L, buf->io->error(buf->io->ctx, err)); - lua_pushnumber(L, (lua_Number) (sent+start-1)); - } else { - lua_pushnumber(L, (lua_Number) (sent+start-1)); - lua_pushnil(L); - lua_pushnil(L); - } -#ifdef LUASOCKET_DEBUG - /* push time elapsed during operation as the last return value */ - lua_pushnumber(L, timeout_gettime() - timeout_getstart(buf->tm)); -#endif - return lua_gettop(L) - top; -} - -/*-------------------------------------------------------------------------*\ -* object:receive() interface -\*-------------------------------------------------------------------------*/ -int buffer_meth_receive(lua_State *L, p_buffer buf) { - int err = IO_DONE, top = lua_gettop(L); - luaL_Buffer b; - size_t size; - const char *part = luaL_optlstring(L, 3, "", &size); - timeout_markstart(buf->tm); - /* initialize buffer with optional extra prefix - * (useful for concatenating previous partial results) */ - luaL_buffinit(L, &b); - luaL_addlstring(&b, part, size); - /* receive new patterns */ - if (!lua_isnumber(L, 2)) { - const char *p= luaL_optstring(L, 2, "*l"); - if (p[0] == '*' && p[1] == 'l') err = recvline(buf, &b); - else if (p[0] == '*' && p[1] == 'a') err = recvall(buf, &b); - else luaL_argcheck(L, 0, 2, "invalid receive pattern"); - /* get a fixed number of bytes (minus what was already partially - * received) */ - } else { - double n = lua_tonumber(L, 2); - size_t wanted = (size_t) n; - luaL_argcheck(L, n >= 0, 2, "invalid receive pattern"); - if (size == 0 || wanted > size) - err = recvraw(buf, wanted-size, &b); - } - /* check if there was an error */ - if (err != IO_DONE) { - /* we can't push anyting in the stack before pushing the - * contents of the buffer. this is the reason for the complication */ - luaL_pushresult(&b); - lua_pushstring(L, buf->io->error(buf->io->ctx, err)); - lua_pushvalue(L, -2); - lua_pushnil(L); - lua_replace(L, -4); - } else { - luaL_pushresult(&b); - lua_pushnil(L); - lua_pushnil(L); - } -#ifdef LUASOCKET_DEBUG - /* push time elapsed during operation as the last return value */ - lua_pushnumber(L, timeout_gettime() - timeout_getstart(buf->tm)); -#endif - return lua_gettop(L) - top; -} - -/*-------------------------------------------------------------------------*\ -* Determines if there is any data in the read buffer -\*-------------------------------------------------------------------------*/ -int buffer_isempty(p_buffer buf) { - return buf->first >= buf->last; -} - -/*=========================================================================*\ -* Internal functions -\*=========================================================================*/ -/*-------------------------------------------------------------------------*\ -* Sends a block of data (unbuffered) -\*-------------------------------------------------------------------------*/ -#define STEPSIZE 8192 -static int sendraw(p_buffer buf, const char *data, size_t count, size_t *sent) { - p_io io = buf->io; - p_timeout tm = buf->tm; - size_t total = 0; - int err = IO_DONE; - while (total < count && err == IO_DONE) { - size_t done = 0; - size_t step = (count-total <= STEPSIZE)? count-total: STEPSIZE; - err = io->send(io->ctx, data+total, step, &done, tm); - total += done; - } - *sent = total; - buf->sent += total; - return err; -} - -/*-------------------------------------------------------------------------*\ -* Reads a fixed number of bytes (buffered) -\*-------------------------------------------------------------------------*/ -static int recvraw(p_buffer buf, size_t wanted, luaL_Buffer *b) { - int err = IO_DONE; - size_t total = 0; - while (err == IO_DONE) { - size_t count; const char *data; - err = buffer_get(buf, &data, &count); - count = MIN(count, wanted - total); - luaL_addlstring(b, data, count); - buffer_skip(buf, count); - total += count; - if (total >= wanted) break; - } - return err; -} - -/*-------------------------------------------------------------------------*\ -* Reads everything until the connection is closed (buffered) -\*-------------------------------------------------------------------------*/ -static int recvall(p_buffer buf, luaL_Buffer *b) { - int err = IO_DONE; - size_t total = 0; - while (err == IO_DONE) { - const char *data; size_t count; - err = buffer_get(buf, &data, &count); - total += count; - luaL_addlstring(b, data, count); - buffer_skip(buf, count); - } - if (err == IO_CLOSED) { - if (total > 0) return IO_DONE; - else return IO_CLOSED; - } else return err; -} - -/*-------------------------------------------------------------------------*\ -* Reads a line terminated by a CR LF pair or just by a LF. The CR and LF -* are not returned by the function and are discarded from the buffer -\*-------------------------------------------------------------------------*/ -static int recvline(p_buffer buf, luaL_Buffer *b) { - int err = IO_DONE; - while (err == IO_DONE) { - size_t count, pos; const char *data; - err = buffer_get(buf, &data, &count); - pos = 0; - while (pos < count && data[pos] != '\n') { - /* we ignore all \r's */ - if (data[pos] != '\r') luaL_addchar(b, data[pos]); - pos++; - } - if (pos < count) { /* found '\n' */ - buffer_skip(buf, pos+1); /* skip '\n' too */ - break; /* we are done */ - } else /* reached the end of the buffer */ - buffer_skip(buf, pos); - } - return err; -} - -/*-------------------------------------------------------------------------*\ -* Skips a given number of bytes from read buffer. No data is read from the -* transport layer -\*-------------------------------------------------------------------------*/ -static void buffer_skip(p_buffer buf, size_t count) { - buf->received += count; - buf->first += count; - if (buffer_isempty(buf)) - buf->first = buf->last = 0; -} - -/*-------------------------------------------------------------------------*\ -* Return any data available in buffer, or get more data from transport layer -* if buffer is empty -\*-------------------------------------------------------------------------*/ -static int buffer_get(p_buffer buf, const char **data, size_t *count) { - int err = IO_DONE; - p_io io = buf->io; - p_timeout tm = buf->tm; - if (buffer_isempty(buf)) { - size_t got; - err = io->recv(io->ctx, buf->data, BUF_SIZE, &got, tm); - buf->first = 0; - buf->last = got; - } - *count = buf->last - buf->first; - *data = buf->data + buf->first; - return err; -} diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/buffer.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/buffer.h deleted file mode 100644 index 1281bb39..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/buffer.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef BUF_H -#define BUF_H -/*=========================================================================*\ -* Input/Output interface for Lua programs -* LuaSocket toolkit -* -* Line patterns require buffering. Reading one character at a time involves -* too many system calls and is very slow. This module implements the -* LuaSocket interface for input/output on connected objects, as seen by -* Lua programs. -* -* Input is buffered. Output is *not* buffered because there was no simple -* way of making sure the buffered output data would ever be sent. -* -* The module is built on top of the I/O abstraction defined in io.h and the -* timeout management is done with the timeout.h interface. -\*=========================================================================*/ -#include "lua.h" - -#include "io.h" -#include "timeout.h" - -/* buffer size in bytes */ -#define BUF_SIZE 8192 - -/* buffer control structure */ -typedef struct t_buffer_ { - double birthday; /* throttle support info: creation time, */ - size_t sent, received; /* bytes sent, and bytes received */ - p_io io; /* IO driver used for this buffer */ - p_timeout tm; /* timeout management for this buffer */ - size_t first, last; /* index of first and last bytes of stored data */ - char data[BUF_SIZE]; /* storage space for buffer data */ -} t_buffer; -typedef t_buffer *p_buffer; - -int buffer_open(lua_State *L); -void buffer_init(p_buffer buf, p_io io, p_timeout tm); -int buffer_meth_send(lua_State *L, p_buffer buf); -int buffer_meth_receive(lua_State *L, p_buffer buf); -int buffer_meth_getstats(lua_State *L, p_buffer buf); -int buffer_meth_setstats(lua_State *L, p_buffer buf); -int buffer_isempty(p_buffer buf); - -#endif /* BUF_H */ diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/compat.c b/love/src/jni/love/src/libraries/luasocket/libluasocket/compat.c deleted file mode 100644 index c2d99cb2..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/compat.c +++ /dev/null @@ -1,19 +0,0 @@ -#include "compat.h" - -#if LUA_VERSION_NUM==501 -/* -** Adapted from Lua 5.2 -*/ -void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) { - luaL_checkstack(L, nup+1, "too many upvalues"); - for (; l->name != NULL; l++) { /* fill the table with given functions */ - int i; - lua_pushstring(L, l->name); - for (i = 0; i < nup; i++) /* copy upvalues to the top */ - lua_pushvalue(L, -(nup+1)); - lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */ - lua_settable(L, -(nup + 3)); - } - lua_pop(L, nup); /* remove upvalues */ -} -#endif diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/compat.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/compat.h deleted file mode 100644 index 7bf8010e..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/compat.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef COMPAT_H -#define COMPAT_H - -#include "lua.h" -#include "lauxlib.h" - -#if LUA_VERSION_NUM==501 -void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup); -#endif - -#endif diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/except.c b/love/src/jni/love/src/libraries/luasocket/libluasocket/except.c deleted file mode 100644 index 60b50058..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/except.c +++ /dev/null @@ -1,133 +0,0 @@ -/*=========================================================================*\ -* Simple exception support -* LuaSocket toolkit -\*=========================================================================*/ -#include - -#include "lua.h" -#include "lauxlib.h" -#include "compat.h" - -#include "except.h" - -#if LUA_VERSION_NUM < 502 -#define lua_pcallk(L, na, nr, err, ctx, cont) \ - (((void)ctx),((void)cont),lua_pcall(L, na, nr, err)) -#endif - -#if LUA_VERSION_NUM < 503 -typedef int lua_KContext; -#endif - -/*=========================================================================*\ -* Internal function prototypes. -\*=========================================================================*/ -static int global_protect(lua_State *L); -static int global_newtry(lua_State *L); -static int protected_(lua_State *L); -static int finalize(lua_State *L); -static int do_nothing(lua_State *L); - -/* except functions */ -static luaL_Reg func[] = { - {"newtry", global_newtry}, - {"protect", global_protect}, - {NULL, NULL} -}; - -/*-------------------------------------------------------------------------*\ -* Try factory -\*-------------------------------------------------------------------------*/ -static void wrap(lua_State *L) { - lua_createtable(L, 1, 0); - lua_pushvalue(L, -2); - lua_rawseti(L, -2, 1); - lua_pushvalue(L, lua_upvalueindex(1)); - lua_setmetatable(L, -2); -} - -static int finalize(lua_State *L) { - if (!lua_toboolean(L, 1)) { - lua_pushvalue(L, lua_upvalueindex(2)); - lua_call(L, 0, 0); - lua_settop(L, 2); - wrap(L); - lua_error(L); - return 0; - } else return lua_gettop(L); -} - -static int do_nothing(lua_State *L) { - (void) L; - return 0; -} - -static int global_newtry(lua_State *L) { - lua_settop(L, 1); - if (lua_isnil(L, 1)) lua_pushcfunction(L, do_nothing); - lua_pushvalue(L, lua_upvalueindex(1)); - lua_insert(L, -2); - lua_pushcclosure(L, finalize, 2); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Protect factory -\*-------------------------------------------------------------------------*/ -static int unwrap(lua_State *L) { - if (lua_istable(L, -1) && lua_getmetatable(L, -1)) { - int r = lua_rawequal(L, -1, lua_upvalueindex(1)); - lua_pop(L, 1); - if (r) { - lua_pushnil(L); - lua_rawgeti(L, -2, 1); - return 1; - } - } - return 0; -} - -static int protected_finish(lua_State *L, int status, lua_KContext ctx) { - (void)ctx; - if (status != 0 && status != LUA_YIELD) { - if (unwrap(L)) return 2; - else return lua_error(L); - } else return lua_gettop(L); -} - -#if LUA_VERSION_NUM == 502 -static int protected_cont(lua_State *L) { - int ctx = 0; - int status = lua_getctx(L, &ctx); - return protected_finish(L, status, ctx); -} -#else -#define protected_cont protected_finish -#endif - -static int protected_(lua_State *L) { - int status; - lua_pushvalue(L, lua_upvalueindex(2)); - lua_insert(L, 1); - status = lua_pcallk(L, lua_gettop(L) - 1, LUA_MULTRET, 0, 0, protected_cont); - return protected_finish(L, status, 0); -} - -static int global_protect(lua_State *L) { - lua_settop(L, 1); - lua_pushvalue(L, lua_upvalueindex(1)); - lua_insert(L, 1); - lua_pushcclosure(L, protected_, 2); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Init module -\*-------------------------------------------------------------------------*/ -int except_open(lua_State *L) { - lua_newtable(L); /* metatable for wrapped exceptions */ - lua_pushboolean(L, 0); - lua_setfield(L, -2, "__metatable"); - luaL_setfuncs(L, func, 1); - return 0; -} diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/except.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/except.h deleted file mode 100644 index 2497c056..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/except.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef EXCEPT_H -#define EXCEPT_H -/*=========================================================================*\ -* Exception control -* LuaSocket toolkit (but completely independent from other modules) -* -* This provides support for simple exceptions in Lua. During the -* development of the HTTP/FTP/SMTP support, it became aparent that -* error checking was taking a substantial amount of the coding. These -* function greatly simplify the task of checking errors. -* -* The main idea is that functions should return nil as their first return -* values when they find an error, and return an error message (or value) -* following nil. In case of success, as long as the first value is not nil, -* the other values don't matter. -* -* The idea is to nest function calls with the "try" function. This function -* checks the first value, and, if it's falsy, wraps the second value in a -* table with metatable and calls "error" on it. Otherwise, it returns all -* values it received. Basically, it works like the Lua "assert" function, -* but it creates errors targeted specifically at "protect". -* -* The "newtry" function is a factory for "try" functions that call a -* finalizer in protected mode before calling "error". -* -* The "protect" function returns a new function that behaves exactly like -* the function it receives, but the new function catches exceptions thrown -* by "try" functions and returns nil followed by the error message instead. -* -* With these three functions, it's easy to write functions that throw -* exceptions on error, but that don't interrupt the user script. -\*=========================================================================*/ - -#include "lua.h" - -int except_open(lua_State *L); - -#endif diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/ftp.lua b/love/src/jni/love/src/libraries/luasocket/libluasocket/ftp.lua deleted file mode 100644 index bd528caa..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/ftp.lua +++ /dev/null @@ -1,329 +0,0 @@ ------------------------------------------------------------------------------ --- FTP support for the Lua language --- LuaSocket toolkit. --- Author: Diego Nehab ------------------------------------------------------------------------------ - ------------------------------------------------------------------------------ --- Declare module and import dependencies ------------------------------------------------------------------------------ -local base = _G -local table = require("table") -local string = require("string") -local math = require("math") -local socket = require("socket") -local url = require("socket.url") -local tp = require("socket.tp") -local ltn12 = require("ltn12") -socket.ftp = {} -local _M = socket.ftp ------------------------------------------------------------------------------ --- Program constants ------------------------------------------------------------------------------ --- timeout in seconds before the program gives up on a connection -_M.TIMEOUT = 60 --- default port for ftp service -local PORT = 21 --- this is the default anonymous password. used when no password is --- provided in url. should be changed to your e-mail. -_M.USER = "ftp" -_M.PASSWORD = "anonymous@anonymous.org" - ------------------------------------------------------------------------------ --- Low level FTP API ------------------------------------------------------------------------------ -local metat = { __index = {} } - -function _M.open(server, port, create) - local tp = socket.try(tp.connect(server, port or PORT, _M.TIMEOUT, create)) - local f = base.setmetatable({ tp = tp }, metat) - -- make sure everything gets closed in an exception - f.try = socket.newtry(function() f:close() end) - return f -end - -function metat.__index:portconnect() - self.try(self.server:settimeout(_M.TIMEOUT)) - self.data = self.try(self.server:accept()) - self.try(self.data:settimeout(_M.TIMEOUT)) -end - -function metat.__index:pasvconnect() - self.data = self.try(socket.tcp()) - self.try(self.data:settimeout(_M.TIMEOUT)) - self.try(self.data:connect(self.pasvt.address, self.pasvt.port)) -end - -function metat.__index:login(user, password) - self.try(self.tp:command("user", user or _M.USER)) - local code, reply = self.try(self.tp:check{"2..", 331}) - if code == 331 then - self.try(self.tp:command("pass", password or _M.PASSWORD)) - self.try(self.tp:check("2..")) - end - return 1 -end - -function metat.__index:pasv() - self.try(self.tp:command("pasv")) - local code, reply = self.try(self.tp:check("2..")) - local pattern = "(%d+)%D(%d+)%D(%d+)%D(%d+)%D(%d+)%D(%d+)" - local a, b, c, d, p1, p2 = socket.skip(2, string.find(reply, pattern)) - self.try(a and b and c and d and p1 and p2, reply) - self.pasvt = { - address = string.format("%d.%d.%d.%d", a, b, c, d), - port = p1*256 + p2 - } - if self.server then - self.server:close() - self.server = nil - end - return self.pasvt.address, self.pasvt.port -end - -function metat.__index:epsv() - self.try(self.tp:command("epsv")) - local code, reply = self.try(self.tp:check("229")) - local pattern = "%((.)(.-)%1(.-)%1(.-)%1%)" - local d, prt, address, port = string.match(reply, pattern) - self.try(port, "invalid epsv response") - self.pasvt = { - address = self.tp:getpeername(), - port = port - } - if self.server then - self.server:close() - self.server = nil - end - return self.pasvt.address, self.pasvt.port -end - - -function metat.__index:port(address, port) - self.pasvt = nil - if not address then - address, port = self.try(self.tp:getsockname()) - self.server = self.try(socket.bind(address, 0)) - address, port = self.try(self.server:getsockname()) - self.try(self.server:settimeout(_M.TIMEOUT)) - end - local pl = math.mod(port, 256) - local ph = (port - pl)/256 - local arg = string.gsub(string.format("%s,%d,%d", address, ph, pl), "%.", ",") - self.try(self.tp:command("port", arg)) - self.try(self.tp:check("2..")) - return 1 -end - -function metat.__index:eprt(family, address, port) - self.pasvt = nil - if not address then - address, port = self.try(self.tp:getsockname()) - self.server = self.try(socket.bind(address, 0)) - address, port = self.try(self.server:getsockname()) - self.try(self.server:settimeout(_M.TIMEOUT)) - end - local arg = string.format("|%s|%s|%d|", family, address, port) - self.try(self.tp:command("eprt", arg)) - self.try(self.tp:check("2..")) - return 1 -end - - -function metat.__index:send(sendt) - self.try(self.pasvt or self.server, "need port or pasv first") - -- if there is a pasvt table, we already sent a PASV command - -- we just get the data connection into self.data - if self.pasvt then self:pasvconnect() end - -- get the transfer argument and command - local argument = sendt.argument or - url.unescape(string.gsub(sendt.path or "", "^[/\\]", "")) - if argument == "" then argument = nil end - local command = sendt.command or "stor" - -- send the transfer command and check the reply - self.try(self.tp:command(command, argument)) - local code, reply = self.try(self.tp:check{"2..", "1.."}) - -- if there is not a pasvt table, then there is a server - -- and we already sent a PORT command - if not self.pasvt then self:portconnect() end - -- get the sink, source and step for the transfer - local step = sendt.step or ltn12.pump.step - local readt = { self.tp } - local checkstep = function(src, snk) - -- check status in control connection while downloading - local readyt = socket.select(readt, nil, 0) - if readyt[tp] then code = self.try(self.tp:check("2..")) end - return step(src, snk) - end - local sink = socket.sink("close-when-done", self.data) - -- transfer all data and check error - self.try(ltn12.pump.all(sendt.source, sink, checkstep)) - if string.find(code, "1..") then self.try(self.tp:check("2..")) end - -- done with data connection - self.data:close() - -- find out how many bytes were sent - local sent = socket.skip(1, self.data:getstats()) - self.data = nil - return sent -end - -function metat.__index:receive(recvt) - self.try(self.pasvt or self.server, "need port or pasv first") - if self.pasvt then self:pasvconnect() end - local argument = recvt.argument or - url.unescape(string.gsub(recvt.path or "", "^[/\\]", "")) - if argument == "" then argument = nil end - local command = recvt.command or "retr" - self.try(self.tp:command(command, argument)) - local code,reply = self.try(self.tp:check{"1..", "2.."}) - if (code >= 200) and (code <= 299) then - recvt.sink(reply) - return 1 - end - if not self.pasvt then self:portconnect() end - local source = socket.source("until-closed", self.data) - local step = recvt.step or ltn12.pump.step - self.try(ltn12.pump.all(source, recvt.sink, step)) - if string.find(code, "1..") then self.try(self.tp:check("2..")) end - self.data:close() - self.data = nil - return 1 -end - -function metat.__index:cwd(dir) - self.try(self.tp:command("cwd", dir)) - self.try(self.tp:check(250)) - return 1 -end - -function metat.__index:type(type) - self.try(self.tp:command("type", type)) - self.try(self.tp:check(200)) - return 1 -end - -function metat.__index:greet() - local code = self.try(self.tp:check{"1..", "2.."}) - if string.find(code, "1..") then self.try(self.tp:check("2..")) end - return 1 -end - -function metat.__index:quit() - self.try(self.tp:command("quit")) - self.try(self.tp:check("2..")) - return 1 -end - -function metat.__index:close() - if self.data then self.data:close() end - if self.server then self.server:close() end - return self.tp:close() -end - ------------------------------------------------------------------------------ --- High level FTP API ------------------------------------------------------------------------------ -local function override(t) - if t.url then - local u = url.parse(t.url) - for i,v in base.pairs(t) do - u[i] = v - end - return u - else return t end -end - -local function tput(putt) - putt = override(putt) - socket.try(putt.host, "missing hostname") - local f = _M.open(putt.host, putt.port, putt.create) - f:greet() - f:login(putt.user, putt.password) - if putt.type then f:type(putt.type) end - f:epsv() - local sent = f:send(putt) - f:quit() - f:close() - return sent -end - -local default = { - path = "/", - scheme = "ftp" -} - -local function genericform(u) - local t = socket.try(url.parse(u, default)) - socket.try(t.scheme == "ftp", "wrong scheme '" .. t.scheme .. "'") - socket.try(t.host, "missing hostname") - local pat = "^type=(.)$" - if t.params then - t.type = socket.skip(2, string.find(t.params, pat)) - socket.try(t.type == "a" or t.type == "i", - "invalid type '" .. t.type .. "'") - end - return t -end - -_M.genericform = genericform - -local function sput(u, body) - local putt = genericform(u) - putt.source = ltn12.source.string(body) - return tput(putt) -end - -_M.put = socket.protect(function(putt, body) - if base.type(putt) == "string" then return sput(putt, body) - else return tput(putt) end -end) - -local function tget(gett) - gett = override(gett) - socket.try(gett.host, "missing hostname") - local f = _M.open(gett.host, gett.port, gett.create) - f:greet() - f:login(gett.user, gett.password) - if gett.type then f:type(gett.type) end - f:epsv() - f:receive(gett) - f:quit() - return f:close() -end - -local function sget(u) - local gett = genericform(u) - local t = {} - gett.sink = ltn12.sink.table(t) - tget(gett) - return table.concat(t) -end - -_M.command = socket.protect(function(cmdt) - cmdt = override(cmdt) - socket.try(cmdt.host, "missing hostname") - socket.try(cmdt.command, "missing command") - local f = _M.open(cmdt.host, cmdt.port, cmdt.create) - f:greet() - f:login(cmdt.user, cmdt.password) - if type(cmdt.command) == "table" then - local argument = cmdt.argument or {} - local check = cmdt.check or {} - for i,cmd in ipairs(cmdt.command) do - f.try(f.tp:command(cmd, argument[i])) - if check[i] then f.try(f.tp:check(check[i])) end - end - else - f.try(f.tp:command(cmdt.command, cmdt.argument)) - if cmdt.check then f.try(f.tp:check(cmdt.check)) end - end - f:quit() - return f:close() -end) - -_M.get = socket.protect(function(gett) - if base.type(gett) == "string" then return sget(gett) - else return tget(gett) end -end) - -return _M diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/ftp.lua.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/ftp.lua.h deleted file mode 100644 index fcb0d403..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/ftp.lua.h +++ /dev/null @@ -1,544 +0,0 @@ -/* code automatically generated by bin2c -- DO NOT EDIT */ -{ -/* #include'ing this file in a C program is equivalent to calling - if (luaL_loadfile(L,"ftp.lua")==0) lua_call(L, 0, LUA_MULTRET); -*/ -/* ftp.lua */ -static const unsigned char B1[]={ - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, - 32, 70, 84, 80, 32,115,117,112,112,111,114,116, 32,102,111,114, 32,116,104,101, - 32, 76,117, 97, 32,108, 97,110,103,117, 97,103,101, 10, 45, 45, 32, 76,117, 97, - 83,111, 99,107,101,116, 32,116,111,111,108,107,105,116, 46, 10, 45, 45, 32, 65, -117,116,104,111,114, 58, 32, 68,105,101,103,111, 32, 78,101,104, 97, 98, 10, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 10, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 68, -101, 99,108, 97,114,101, 32,109,111,100,117,108,101, 32, 97,110,100, 32,105,109, -112,111,114,116, 32,100,101,112,101,110,100,101,110, 99,105,101,115, 10, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10,108,111, 99, 97, -108, 32, 98, 97,115,101, 32, 61, 32, 95, 71, 10,108,111, 99, 97,108, 32,116, 97, - 98,108,101, 32, 61, 32,114,101,113,117,105,114,101, 40, 34,116, 97, 98,108,101, - 34, 41, 10,108,111, 99, 97,108, 32,115,116,114,105,110,103, 32, 61, 32,114,101, -113,117,105,114,101, 40, 34,115,116,114,105,110,103, 34, 41, 10,108,111, 99, 97, -108, 32,109, 97,116,104, 32, 61, 32,114,101,113,117,105,114,101, 40, 34,109, 97, -116,104, 34, 41, 10,108,111, 99, 97,108, 32,115,111, 99,107,101,116, 32, 61, 32, -114,101,113,117,105,114,101, 40, 34,115,111, 99,107,101,116, 34, 41, 10,108,111, - 99, 97,108, 32,117,114,108, 32, 61, 32,114,101,113,117,105,114,101, 40, 34,115, -111, 99,107,101,116, 46,117,114,108, 34, 41, 10,108,111, 99, 97,108, 32,116,112, - 32, 61, 32,114,101,113,117,105,114,101, 40, 34,115,111, 99,107,101,116, 46,116, -112, 34, 41, 10,108,111, 99, 97,108, 32,108,116,110, 49, 50, 32, 61, 32,114,101, -113,117,105,114,101, 40, 34,108,116,110, 49, 50, 34, 41, 10,115,111, 99,107,101, -116, 46,102,116,112, 32, 61, 32,123,125, 10,108,111, 99, 97,108, 32, 95, 77, 32, - 61, 32,115,111, 99,107,101,116, 46,102,116,112, 10, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 80,114,111,103,114, 97, -109, 32, 99,111,110,115,116, 97,110,116,115, 10, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32,116,105,109,101,111,117,116, - 32,105,110, 32,115,101, 99,111,110,100,115, 32, 98,101,102,111,114,101, 32,116, -104,101, 32,112,114,111,103,114, 97,109, 32,103,105,118,101,115, 32,117,112, 32, -111,110, 32, 97, 32, 99,111,110,110,101, 99,116,105,111,110, 10, 95, 77, 46, 84, - 73, 77, 69, 79, 85, 84, 32, 61, 32, 54, 48, 10, 45, 45, 32,100,101,102, 97,117, -108,116, 32,112,111,114,116, 32,102,111,114, 32,102,116,112, 32,115,101,114,118, -105, 99,101, 10,108,111, 99, 97,108, 32, 80, 79, 82, 84, 32, 61, 32, 50, 49, 10, - 45, 45, 32,116,104,105,115, 32,105,115, 32,116,104,101, 32,100,101,102, 97,117, -108,116, 32, 97,110,111,110,121,109,111,117,115, 32,112, 97,115,115,119,111,114, -100, 46, 32,117,115,101,100, 32,119,104,101,110, 32,110,111, 32,112, 97,115,115, -119,111,114,100, 32,105,115, 10, 45, 45, 32,112,114,111,118,105,100,101,100, 32, -105,110, 32,117,114,108, 46, 32,115,104,111,117,108,100, 32, 98,101, 32, 99,104, - 97,110,103,101,100, 32,116,111, 32,121,111,117,114, 32,101, 45,109, 97,105,108, - 46, 10, 95, 77, 46, 85, 83, 69, 82, 32, 61, 32, 34,102,116,112, 34, 10, 95, 77, - 46, 80, 65, 83, 83, 87, 79, 82, 68, 32, 61, 32, 34, 97,110,111,110,121,109,111, -117,115, 64, 97,110,111,110,121,109,111,117,115, 46,111,114,103, 34, 10, 10, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, - 76,111,119, 32,108,101,118,101,108, 32, 70, 84, 80, 32, 65, 80, 73, 10, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10,108,111, 99, 97, -108, 32,109,101,116, 97,116, 32, 61, 32,123, 32, 95, 95,105,110,100,101,120, 32, - 61, 32,123,125, 32,125, 10, 10,102,117,110, 99,116,105,111,110, 32, 95, 77, 46, -111,112,101,110, 40,115,101,114,118,101,114, 44, 32,112,111,114,116, 44, 32, 99, -114,101, 97,116,101, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,116,112, 32, - 61, 32,115,111, 99,107,101,116, 46,116,114,121, 40,116,112, 46, 99,111,110,110, -101, 99,116, 40,115,101,114,118,101,114, 44, 32,112,111,114,116, 32,111,114, 32, - 80, 79, 82, 84, 44, 32, 95, 77, 46, 84, 73, 77, 69, 79, 85, 84, 44, 32, 99,114, -101, 97,116,101, 41, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,102, 32, 61, - 32, 98, 97,115,101, 46,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,123, - 32,116,112, 32, 61, 32,116,112, 32,125, 44, 32,109,101,116, 97,116, 41, 10, 32, - 32, 32, 32, 45, 45, 32,109, 97,107,101, 32,115,117,114,101, 32,101,118,101,114, -121,116,104,105,110,103, 32,103,101,116,115, 32, 99,108,111,115,101,100, 32,105, -110, 32, 97,110, 32,101,120, 99,101,112,116,105,111,110, 10, 32, 32, 32, 32,102, - 46,116,114,121, 32, 61, 32,115,111, 99,107,101,116, 46,110,101,119,116,114,121, - 40,102,117,110, 99,116,105,111,110, 40, 41, 32,102, 58, 99,108,111,115,101, 40, - 41, 32,101,110,100, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,102, 10, -101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,109,101,116, 97,116, 46, - 95, 95,105,110,100,101,120, 58,112,111,114,116, 99,111,110,110,101, 99,116, 40, - 41, 10, 32, 32, 32, 32,115,101,108,102, 46,116,114,121, 40,115,101,108,102, 46, -115,101,114,118,101,114, 58,115,101,116,116,105,109,101,111,117,116, 40, 95, 77, - 46, 84, 73, 77, 69, 79, 85, 84, 41, 41, 10, 32, 32, 32, 32,115,101,108,102, 46, -100, 97,116, 97, 32, 61, 32,115,101,108,102, 46,116,114,121, 40,115,101,108,102, - 46,115,101,114,118,101,114, 58, 97, 99, 99,101,112,116, 40, 41, 41, 10, 32, 32, - 32, 32,115,101,108,102, 46,116,114,121, 40,115,101,108,102, 46,100, 97,116, 97, - 58,115,101,116,116,105,109,101,111,117,116, 40, 95, 77, 46, 84, 73, 77, 69, 79, - 85, 84, 41, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,109, -101,116, 97,116, 46, 95, 95,105,110,100,101,120, 58,112, 97,115,118, 99,111,110, -110,101, 99,116, 40, 41, 10, 32, 32, 32, 32,115,101,108,102, 46,100, 97,116, 97, - 32, 61, 32,115,101,108,102, 46,116,114,121, 40,115,111, 99,107,101,116, 46,116, - 99,112, 40, 41, 41, 10, 32, 32, 32, 32,115,101,108,102, 46,116,114,121, 40,115, -101,108,102, 46,100, 97,116, 97, 58,115,101,116,116,105,109,101,111,117,116, 40, - 95, 77, 46, 84, 73, 77, 69, 79, 85, 84, 41, 41, 10, 32, 32, 32, 32,115,101,108, -102, 46,116,114,121, 40,115,101,108,102, 46,100, 97,116, 97, 58, 99,111,110,110, -101, 99,116, 40,115,101,108,102, 46,112, 97,115,118,116, 46, 97,100,100,114,101, -115,115, 44, 32,115,101,108,102, 46,112, 97,115,118,116, 46,112,111,114,116, 41, - 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,109,101,116, 97, -116, 46, 95, 95,105,110,100,101,120, 58,108,111,103,105,110, 40,117,115,101,114, - 44, 32,112, 97,115,115,119,111,114,100, 41, 10, 32, 32, 32, 32,115,101,108,102, - 46,116,114,121, 40,115,101,108,102, 46,116,112, 58, 99,111,109,109, 97,110,100, - 40, 34,117,115,101,114, 34, 44, 32,117,115,101,114, 32,111,114, 32, 95, 77, 46, - 85, 83, 69, 82, 41, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32, 99,111,100, -101, 44, 32,114,101,112,108,121, 32, 61, 32,115,101,108,102, 46,116,114,121, 40, -115,101,108,102, 46,116,112, 58, 99,104,101, 99,107,123, 34, 50, 46, 46, 34, 44, - 32, 51, 51, 49,125, 41, 10, 32, 32, 32, 32,105,102, 32, 99,111,100,101, 32, 61, - 61, 32, 51, 51, 49, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32,115, -101,108,102, 46,116,114,121, 40,115,101,108,102, 46,116,112, 58, 99,111,109,109, - 97,110,100, 40, 34,112, 97,115,115, 34, 44, 32,112, 97,115,115,119,111,114,100, - 32,111,114, 32, 95, 77, 46, 80, 65, 83, 83, 87, 79, 82, 68, 41, 41, 10, 32, 32, - 32, 32, 32, 32, 32, 32,115,101,108,102, 46,116,114,121, 40,115,101,108,102, 46, -116,112, 58, 99,104,101, 99,107, 40, 34, 50, 46, 46, 34, 41, 41, 10, 32, 32, 32, - 32,101,110,100, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32, 49, 10,101,110, -100, 10, 10,102,117,110, 99,116,105,111,110, 32,109,101,116, 97,116, 46, 95, 95, -105,110,100,101,120, 58,112, 97,115,118, 40, 41, 10, 32, 32, 32, 32,115,101,108, -102, 46,116,114,121, 40,115,101,108,102, 46,116,112, 58, 99,111,109,109, 97,110, -100, 40, 34,112, 97,115,118, 34, 41, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, - 32, 99,111,100,101, 44, 32,114,101,112,108,121, 32, 61, 32,115,101,108,102, 46, -116,114,121, 40,115,101,108,102, 46,116,112, 58, 99,104,101, 99,107, 40, 34, 50, - 46, 46, 34, 41, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,112, 97,116,116, -101,114,110, 32, 61, 32, 34, 40, 37,100, 43, 41, 37, 68, 40, 37,100, 43, 41, 37, - 68, 40, 37,100, 43, 41, 37, 68, 40, 37,100, 43, 41, 37, 68, 40, 37,100, 43, 41, - 37, 68, 40, 37,100, 43, 41, 34, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32, 97, - 44, 32, 98, 44, 32, 99, 44, 32,100, 44, 32,112, 49, 44, 32,112, 50, 32, 61, 32, -115,111, 99,107,101,116, 46,115,107,105,112, 40, 50, 44, 32,115,116,114,105,110, -103, 46,102,105,110,100, 40,114,101,112,108,121, 44, 32,112, 97,116,116,101,114, -110, 41, 41, 10, 32, 32, 32, 32,115,101,108,102, 46,116,114,121, 40, 97, 32, 97, -110,100, 32, 98, 32, 97,110,100, 32, 99, 32, 97,110,100, 32,100, 32, 97,110,100, - 32,112, 49, 32, 97,110,100, 32,112, 50, 44, 32,114,101,112,108,121, 41, 10, 32, - 32, 32, 32,115,101,108,102, 46,112, 97,115,118,116, 32, 61, 32,123, 10, 32, 32, - 32, 32, 32, 32, 32, 32, 97,100,100,114,101,115,115, 32, 61, 32,115,116,114,105, -110,103, 46,102,111,114,109, 97,116, 40, 34, 37,100, 46, 37,100, 46, 37,100, 46, - 37,100, 34, 44, 32, 97, 44, 32, 98, 44, 32, 99, 44, 32,100, 41, 44, 10, 32, 32, - 32, 32, 32, 32, 32, 32,112,111,114,116, 32, 61, 32,112, 49, 42, 50, 53, 54, 32, - 43, 32,112, 50, 10, 32, 32, 32, 32,125, 10, 32, 32, 32, 32,105,102, 32,115,101, -108,102, 46,115,101,114,118,101,114, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, - 32, 32, 32,115,101,108,102, 46,115,101,114,118,101,114, 58, 99,108,111,115,101, - 40, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,115,101,108,102, 46,115,101,114,118, -101,114, 32, 61, 32,110,105,108, 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, - 32,114,101,116,117,114,110, 32,115,101,108,102, 46,112, 97,115,118,116, 46, 97, -100,100,114,101,115,115, 44, 32,115,101,108,102, 46,112, 97,115,118,116, 46,112, -111,114,116, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,109,101, -116, 97,116, 46, 95, 95,105,110,100,101,120, 58,101,112,115,118, 40, 41, 10, 32, - 32, 32, 32,115,101,108,102, 46,116,114,121, 40,115,101,108,102, 46,116,112, 58, - 99,111,109,109, 97,110,100, 40, 34,101,112,115,118, 34, 41, 41, 10, 32, 32, 32, - 32,108,111, 99, 97,108, 32, 99,111,100,101, 44, 32,114,101,112,108,121, 32, 61, - 32,115,101,108,102, 46,116,114,121, 40,115,101,108,102, 46,116,112, 58, 99,104, -101, 99,107, 40, 34, 50, 50, 57, 34, 41, 41, 10, 32, 32, 32, 32,108,111, 99, 97, -108, 32,112, 97,116,116,101,114,110, 32, 61, 32, 34, 37, 40, 40, 46, 41, 40, 46, - 45, 41, 37, 49, 40, 46, 45, 41, 37, 49, 40, 46, 45, 41, 37, 49, 37, 41, 34, 10, - 32, 32, 32, 32,108,111, 99, 97,108, 32,100, 44, 32,112,114,116, 44, 32, 97,100, -100,114,101,115,115, 44, 32,112,111,114,116, 32, 61, 32,115,116,114,105,110,103, - 46,109, 97,116, 99,104, 40,114,101,112,108,121, 44, 32,112, 97,116,116,101,114, -110, 41, 10, 32, 32, 32, 32,115,101,108,102, 46,116,114,121, 40,112,111,114,116, - 44, 32, 34,105,110,118, 97,108,105,100, 32,101,112,115,118, 32,114,101,115,112, -111,110,115,101, 34, 41, 10, 32, 32, 32, 32,115,101,108,102, 46,112, 97,115,118, -116, 32, 61, 32,123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 97,100,100,114,101,115, -115, 32, 61, 32,115,101,108,102, 46,116,112, 58,103,101,116,112,101,101,114,110, - 97,109,101, 40, 41, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32,112,111,114,116, 32, - 61, 32,112,111,114,116, 10, 32, 32, 32, 32,125, 10, 32, 32, 32, 32,105,102, 32, -115,101,108,102, 46,115,101,114,118,101,114, 32,116,104,101,110, 10, 32, 32, 32, - 32, 32, 32, 32, 32,115,101,108,102, 46,115,101,114,118,101,114, 58, 99,108,111, -115,101, 40, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,115,101,108,102, 46,115,101, -114,118,101,114, 32, 61, 32,110,105,108, 10, 32, 32, 32, 32,101,110,100, 10, 32, - 32, 32, 32,114,101,116,117,114,110, 32,115,101,108,102, 46,112, 97,115,118,116, - 46, 97,100,100,114,101,115,115, 44, 32,115,101,108,102, 46,112, 97,115,118,116, - 46,112,111,114,116, 10,101,110,100, 10, 10, 10,102,117,110, 99,116,105,111,110, - 32,109,101,116, 97,116, 46, 95, 95,105,110,100,101,120, 58,112,111,114,116, 40, - 97,100,100,114,101,115,115, 44, 32,112,111,114,116, 41, 10, 32, 32, 32, 32,115, -101,108,102, 46,112, 97,115,118,116, 32, 61, 32,110,105,108, 10, 32, 32, 32, 32, -105,102, 32,110,111,116, 32, 97,100,100,114,101,115,115, 32,116,104,101,110, 10, - 32, 32, 32, 32, 32, 32, 32, 32, 97,100,100,114,101,115,115, 44, 32,112,111,114, -116, 32, 61, 32,115,101,108,102, 46,116,114,121, 40,115,101,108,102, 46,116,112, - 58,103,101,116,115,111, 99,107,110, 97,109,101, 40, 41, 41, 10, 32, 32, 32, 32, - 32, 32, 32, 32,115,101,108,102, 46,115,101,114,118,101,114, 32, 61, 32,115,101, -108,102, 46,116,114,121, 40,115,111, 99,107,101,116, 46, 98,105,110,100, 40, 97, -100,100,114,101,115,115, 44, 32, 48, 41, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, - 97,100,100,114,101,115,115, 44, 32,112,111,114,116, 32, 61, 32,115,101,108,102, - 46,116,114,121, 40,115,101,108,102, 46,115,101,114,118,101,114, 58,103,101,116, -115,111, 99,107,110, 97,109,101, 40, 41, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, -115,101,108,102, 46,116,114,121, 40,115,101,108,102, 46,115,101,114,118,101,114, - 58,115,101,116,116,105,109,101,111,117,116, 40, 95, 77, 46, 84, 73, 77, 69, 79, - 85, 84, 41, 41, 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,108,111, 99, - 97,108, 32,112,108, 32, 61, 32,109, 97,116,104, 46,109,111,100, 40,112,111,114, -116, 44, 32, 50, 53, 54, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,112,104, - 32, 61, 32, 40,112,111,114,116, 32, 45, 32,112,108, 41, 47, 50, 53, 54, 10, 32, - 32, 32, 32,108,111, 99, 97,108, 32, 97,114,103, 32, 61, 32,115,116,114,105,110, -103, 46,103,115,117, 98, 40,115,116,114,105,110,103, 46,102,111,114,109, 97,116, - 40, 34, 37,115, 44, 37,100, 44, 37,100, 34, 44, 32, 97,100,100,114,101,115,115, - 44, 32,112,104, 44, 32,112,108, 41, 44, 32, 34, 37, 46, 34, 44, 32, 34, 44, 34, - 41, 10, 32, 32, 32, 32,115,101,108,102, 46,116,114,121, 40,115,101,108,102, 46, -116,112, 58, 99,111,109,109, 97,110,100, 40, 34,112,111,114,116, 34, 44, 32, 97, -114,103, 41, 41, 10, 32, 32, 32, 32,115,101,108,102, 46,116,114,121, 40,115,101, -108,102, 46,116,112, 58, 99,104,101, 99,107, 40, 34, 50, 46, 46, 34, 41, 41, 10, - 32, 32, 32, 32,114,101,116,117,114,110, 32, 49, 10,101,110,100, 10, 10,102,117, -110, 99,116,105,111,110, 32,109,101,116, 97,116, 46, 95, 95,105,110,100,101,120, - 58,101,112,114,116, 40,102, 97,109,105,108,121, 44, 32, 97,100,100,114,101,115, -115, 44, 32,112,111,114,116, 41, 10, 32, 32, 32, 32,115,101,108,102, 46,112, 97, -115,118,116, 32, 61, 32,110,105,108, 10, 32, 32, 32, 32,105,102, 32,110,111,116, - 32, 97,100,100,114,101,115,115, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, - 32, 32, 97,100,100,114,101,115,115, 44, 32,112,111,114,116, 32, 61, 32,115,101, -108,102, 46,116,114,121, 40,115,101,108,102, 46,116,112, 58,103,101,116,115,111, - 99,107,110, 97,109,101, 40, 41, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,115,101, -108,102, 46,115,101,114,118,101,114, 32, 61, 32,115,101,108,102, 46,116,114,121, - 40,115,111, 99,107,101,116, 46, 98,105,110,100, 40, 97,100,100,114,101,115,115, - 44, 32, 48, 41, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 97,100,100,114,101,115, -115, 44, 32,112,111,114,116, 32, 61, 32,115,101,108,102, 46,116,114,121, 40,115, -101,108,102, 46,115,101,114,118,101,114, 58,103,101,116,115,111, 99,107,110, 97, -109,101, 40, 41, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,115,101,108,102, 46,116, -114,121, 40,115,101,108,102, 46,115,101,114,118,101,114, 58,115,101,116,116,105, -109,101,111,117,116, 40, 95, 77, 46, 84, 73, 77, 69, 79, 85, 84, 41, 41, 10, 32, - 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32, 97,114,103, - 32, 61, 32,115,116,114,105,110,103, 46,102,111,114,109, 97,116, 40, 34,124, 37, -115,124, 37,115,124, 37,100,124, 34, 44, 32,102, 97,109,105,108,121, 44, 32, 97, -100,100,114,101,115,115, 44, 32,112,111,114,116, 41, 10, 32, 32, 32, 32,115,101, -108,102, 46,116,114,121, 40,115,101,108,102, 46,116,112, 58, 99,111,109,109, 97, -110,100, 40, 34,101,112,114,116, 34, 44, 32, 97,114,103, 41, 41, 10, 32, 32, 32, - 32,115,101,108,102, 46,116,114,121, 40,115,101,108,102, 46,116,112, 58, 99,104, -101, 99,107, 40, 34, 50, 46, 46, 34, 41, 41, 10, 32, 32, 32, 32,114,101,116,117, -114,110, 32, 49, 10,101,110,100, 10, 10, 10,102,117,110, 99,116,105,111,110, 32, -109,101,116, 97,116, 46, 95, 95,105,110,100,101,120, 58,115,101,110,100, 40,115, -101,110,100,116, 41, 10, 32, 32, 32, 32,115,101,108,102, 46,116,114,121, 40,115, -101,108,102, 46,112, 97,115,118,116, 32,111,114, 32,115,101,108,102, 46,115,101, -114,118,101,114, 44, 32, 34,110,101,101,100, 32,112,111,114,116, 32,111,114, 32, -112, 97,115,118, 32,102,105,114,115,116, 34, 41, 10, 32, 32, 32, 32, 45, 45, 32, -105,102, 32,116,104,101,114,101, 32,105,115, 32, 97, 32,112, 97,115,118,116, 32, -116, 97, 98,108,101, 44, 32,119,101, 32, 97,108,114,101, 97,100,121, 32,115,101, -110,116, 32, 97, 32, 80, 65, 83, 86, 32, 99,111,109,109, 97,110,100, 10, 32, 32, - 32, 32, 45, 45, 32,119,101, 32,106,117,115,116, 32,103,101,116, 32,116,104,101, - 32,100, 97,116, 97, 32, 99,111,110,110,101, 99,116,105,111,110, 32,105,110,116, -111, 32,115,101,108,102, 46,100, 97,116, 97, 10, 32, 32, 32, 32,105,102, 32,115, -101,108,102, 46,112, 97,115,118,116, 32,116,104,101,110, 32,115,101,108,102, 58, -112, 97,115,118, 99,111,110,110,101, 99,116, 40, 41, 32,101,110,100, 10, 32, 32, - 32, 32, 45, 45, 32,103,101,116, 32,116,104,101, 32,116,114, 97,110,115,102,101, -114, 32, 97,114,103,117,109,101,110,116, 32, 97,110,100, 32, 99,111,109,109, 97, -110,100, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32, 97,114,103,117,109,101,110, -116, 32, 61, 32,115,101,110,100,116, 46, 97,114,103,117,109,101,110,116, 32,111, -114, 10, 32, 32, 32, 32, 32, 32, 32, 32,117,114,108, 46,117,110,101,115, 99, 97, -112,101, 40,115,116,114,105,110,103, 46,103,115,117, 98, 40,115,101,110,100,116, - 46,112, 97,116,104, 32,111,114, 32, 34, 34, 44, 32, 34, 94, 91, 47, 92, 92, 93, - 34, 44, 32, 34, 34, 41, 41, 10, 32, 32, 32, 32,105,102, 32, 97,114,103,117,109, -101,110,116, 32, 61, 61, 32, 34, 34, 32,116,104,101,110, 32, 97,114,103,117,109, -101,110,116, 32, 61, 32,110,105,108, 32,101,110,100, 10, 32, 32, 32, 32,108,111, - 99, 97,108, 32, 99,111,109,109, 97,110,100, 32, 61, 32,115,101,110,100,116, 46, - 99,111,109,109, 97,110,100, 32,111,114, 32, 34,115,116,111,114, 34, 10, 32, 32, - 32, 32, 45, 45, 32,115,101,110,100, 32,116,104,101, 32,116,114, 97,110,115,102, -101,114, 32, 99,111,109,109, 97,110,100, 32, 97,110,100, 32, 99,104,101, 99,107, - 32,116,104,101, 32,114,101,112,108,121, 10, 32, 32, 32, 32,115,101,108,102, 46, -116,114,121, 40,115,101,108,102, 46,116,112, 58, 99,111,109,109, 97,110,100, 40, - 99,111,109,109, 97,110,100, 44, 32, 97,114,103,117,109,101,110,116, 41, 41, 10, - 32, 32, 32, 32,108,111, 99, 97,108, 32, 99,111,100,101, 44, 32,114,101,112,108, -121, 32, 61, 32,115,101,108,102, 46,116,114,121, 40,115,101,108,102, 46,116,112, - 58, 99,104,101, 99,107,123, 34, 50, 46, 46, 34, 44, 32, 34, 49, 46, 46, 34,125, - 41, 10, 32, 32, 32, 32, 45, 45, 32,105,102, 32,116,104,101,114,101, 32,105,115, - 32,110,111,116, 32, 97, 32,112, 97,115,118,116, 32,116, 97, 98,108,101, 44, 32, -116,104,101,110, 32,116,104,101,114,101, 32,105,115, 32, 97, 32,115,101,114,118, -101,114, 10, 32, 32, 32, 32, 45, 45, 32, 97,110,100, 32,119,101, 32, 97,108,114, -101, 97,100,121, 32,115,101,110,116, 32, 97, 32, 80, 79, 82, 84, 32, 99,111,109, -109, 97,110,100, 10, 32, 32, 32, 32,105,102, 32,110,111,116, 32,115,101,108,102, - 46,112, 97,115,118,116, 32,116,104,101,110, 32,115,101,108,102, 58,112,111,114, -116, 99,111,110,110,101, 99,116, 40, 41, 32,101,110,100, 10, 32, 32, 32, 32, 45, - 45, 32,103,101,116, 32,116,104,101, 32,115,105,110,107, 44, 32,115,111,117,114, - 99,101, 32, 97,110,100, 32,115,116,101,112, 32,102,111,114, 32,116,104,101, 32, -116,114, 97,110,115,102,101,114, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,115, -116,101,112, 32, 61, 32,115,101,110,100,116, 46,115,116,101,112, 32,111,114, 32, -108,116,110, 49, 50, 46,112,117,109,112, 46,115,116,101,112, 10, 32, 32, 32, 32, -108,111, 99, 97,108, 32,114,101, 97,100,116, 32, 61, 32,123, 32,115,101,108,102, - 46,116,112, 32,125, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32, 99,104,101, 99, -107,115,116,101,112, 32, 61, 32,102,117,110, 99,116,105,111,110, 40,115,114, 99, - 44, 32,115,110,107, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 45, 45, 32, 99,104, -101, 99,107, 32,115,116, 97,116,117,115, 32,105,110, 32, 99,111,110,116,114,111, -108, 32, 99,111,110,110,101, 99,116,105,111,110, 32,119,104,105,108,101, 32,100, -111,119,110,108,111, 97,100,105,110,103, 10, 32, 32, 32, 32, 32, 32, 32, 32,108, -111, 99, 97,108, 32,114,101, 97,100,121,116, 32, 61, 32,115,111, 99,107,101,116, - 46,115,101,108,101, 99,116, 40,114,101, 97,100,116, 44, 32,110,105,108, 44, 32, - 48, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,114,101, 97,100,121,116, - 91,116,112, 93, 32,116,104,101,110, 32, 99,111,100,101, 32, 61, 32,115,101,108, -102, 46,116,114,121, 40,115,101,108,102, 46,116,112, 58, 99,104,101, 99,107, 40, - 34, 50, 46, 46, 34, 41, 41, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, -114,101,116,117,114,110, 32,115,116,101,112, 40,115,114, 99, 44, 32,115,110,107, - 41, 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32, -115,105,110,107, 32, 61, 32,115,111, 99,107,101,116, 46,115,105,110,107, 40, 34, - 99,108,111,115,101, 45,119,104,101,110, 45,100,111,110,101, 34, 44, 32,115,101, -108,102, 46,100, 97,116, 97, 41, 10, 32, 32, 32, 32, 45, 45, 32,116,114, 97,110, -115,102,101,114, 32, 97,108,108, 32,100, 97,116, 97, 32, 97,110,100, 32, 99,104, -101, 99,107, 32,101,114,114,111,114, 10, 32, 32, 32, 32,115,101,108,102, 46,116, -114,121, 40,108,116,110, 49, 50, 46,112,117,109,112, 46, 97,108,108, 40,115,101, -110,100,116, 46,115,111,117,114, 99,101, 44, 32,115,105,110,107, 44, 32, 99,104, -101, 99,107,115,116,101,112, 41, 41, 10, 32, 32, 32, 32,105,102, 32,115,116,114, -105,110,103, 46,102,105,110,100, 40, 99,111,100,101, 44, 32, 34, 49, 46, 46, 34, - 41, 32,116,104,101,110, 32,115,101,108,102, 46,116,114,121, 40,115,101,108,102, - 46,116,112, 58, 99,104,101, 99,107, 40, 34, 50, 46, 46, 34, 41, 41, 32,101,110, -100, 10, 32, 32, 32, 32, 45, 45, 32,100,111,110,101, 32,119,105,116,104, 32,100, - 97,116, 97, 32, 99,111,110,110,101, 99,116,105,111,110, 10, 32, 32, 32, 32,115, -101,108,102, 46,100, 97,116, 97, 58, 99,108,111,115,101, 40, 41, 10, 32, 32, 32, - 32, 45, 45, 32,102,105,110,100, 32,111,117,116, 32,104,111,119, 32,109, 97,110, -121, 32, 98,121,116,101,115, 32,119,101,114,101, 32,115,101,110,116, 10, 32, 32, - 32, 32,108,111, 99, 97,108, 32,115,101,110,116, 32, 61, 32,115,111, 99,107,101, -116, 46,115,107,105,112, 40, 49, 44, 32,115,101,108,102, 46,100, 97,116, 97, 58, -103,101,116,115,116, 97,116,115, 40, 41, 41, 10, 32, 32, 32, 32,115,101,108,102, - 46,100, 97,116, 97, 32, 61, 32,110,105,108, 10, 32, 32, 32, 32,114,101,116,117, -114,110, 32,115,101,110,116, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111, -110, 32,109,101,116, 97,116, 46, 95, 95,105,110,100,101,120, 58,114,101, 99,101, -105,118,101, 40,114,101, 99,118,116, 41, 10, 32, 32, 32, 32,115,101,108,102, 46, -116,114,121, 40,115,101,108,102, 46,112, 97,115,118,116, 32,111,114, 32,115,101, -108,102, 46,115,101,114,118,101,114, 44, 32, 34,110,101,101,100, 32,112,111,114, -116, 32,111,114, 32,112, 97,115,118, 32,102,105,114,115,116, 34, 41, 10, 32, 32, - 32, 32,105,102, 32,115,101,108,102, 46,112, 97,115,118,116, 32,116,104,101,110, - 32,115,101,108,102, 58,112, 97,115,118, 99,111,110,110,101, 99,116, 40, 41, 32, -101,110,100, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32, 97,114,103,117,109,101, -110,116, 32, 61, 32,114,101, 99,118,116, 46, 97,114,103,117,109,101,110,116, 32, -111,114, 10, 32, 32, 32, 32, 32, 32, 32, 32,117,114,108, 46,117,110,101,115, 99, - 97,112,101, 40,115,116,114,105,110,103, 46,103,115,117, 98, 40,114,101, 99,118, -116, 46,112, 97,116,104, 32,111,114, 32, 34, 34, 44, 32, 34, 94, 91, 47, 92, 92, - 93, 34, 44, 32, 34, 34, 41, 41, 10, 32, 32, 32, 32,105,102, 32, 97,114,103,117, -109,101,110,116, 32, 61, 61, 32, 34, 34, 32,116,104,101,110, 32, 97,114,103,117, -109,101,110,116, 32, 61, 32,110,105,108, 32,101,110,100, 10, 32, 32, 32, 32,108, -111, 99, 97,108, 32, 99,111,109,109, 97,110,100, 32, 61, 32,114,101, 99,118,116, - 46, 99,111,109,109, 97,110,100, 32,111,114, 32, 34,114,101,116,114, 34, 10, 32, - 32, 32, 32,115,101,108,102, 46,116,114,121, 40,115,101,108,102, 46,116,112, 58, - 99,111,109,109, 97,110,100, 40, 99,111,109,109, 97,110,100, 44, 32, 97,114,103, -117,109,101,110,116, 41, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32, 99,111, -100,101, 44,114,101,112,108,121, 32, 61, 32,115,101,108,102, 46,116,114,121, 40, -115,101,108,102, 46,116,112, 58, 99,104,101, 99,107,123, 34, 49, 46, 46, 34, 44, - 32, 34, 50, 46, 46, 34,125, 41, 10, 32, 32, 32, 32,105,102, 32, 40, 99,111,100, -101, 32, 62, 61, 32, 50, 48, 48, 41, 32, 97,110,100, 32, 40, 99,111,100,101, 32, - 60, 61, 32, 50, 57, 57, 41, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, - 32,114,101, 99,118,116, 46,115,105,110,107, 40,114,101,112,108,121, 41, 10, 32, - 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114,110, 32, 49, 10, 32, 32, 32, 32, -101,110,100, 10, 32, 32, 32, 32,105,102, 32,110,111,116, 32,115,101,108,102, 46, -112, 97,115,118,116, 32,116,104,101,110, 32,115,101,108,102, 58,112,111,114,116, - 99,111,110,110,101, 99,116, 40, 41, 32,101,110,100, 10, 32, 32, 32, 32,108,111, - 99, 97,108, 32,115,111,117,114, 99,101, 32, 61, 32,115,111, 99,107,101,116, 46, -115,111,117,114, 99,101, 40, 34,117,110,116,105,108, 45, 99,108,111,115,101,100, - 34, 44, 32,115,101,108,102, 46,100, 97,116, 97, 41, 10, 32, 32, 32, 32,108,111, - 99, 97,108, 32,115,116,101,112, 32, 61, 32,114,101, 99,118,116, 46,115,116,101, -112, 32,111,114, 32,108,116,110, 49, 50, 46,112,117,109,112, 46,115,116,101,112, - 10, 32, 32, 32, 32,115,101,108,102, 46,116,114,121, 40,108,116,110, 49, 50, 46, -112,117,109,112, 46, 97,108,108, 40,115,111,117,114, 99,101, 44, 32,114,101, 99, -118,116, 46,115,105,110,107, 44, 32,115,116,101,112, 41, 41, 10, 32, 32, 32, 32, -105,102, 32,115,116,114,105,110,103, 46,102,105,110,100, 40, 99,111,100,101, 44, - 32, 34, 49, 46, 46, 34, 41, 32,116,104,101,110, 32,115,101,108,102, 46,116,114, -121, 40,115,101,108,102, 46,116,112, 58, 99,104,101, 99,107, 40, 34, 50, 46, 46, - 34, 41, 41, 32,101,110,100, 10, 32, 32, 32, 32,115,101,108,102, 46,100, 97,116, - 97, 58, 99,108,111,115,101, 40, 41, 10, 32, 32, 32, 32,115,101,108,102, 46,100, - 97,116, 97, 32, 61, 32,110,105,108, 10, 32, 32, 32, 32,114,101,116,117,114,110, - 32, 49, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,109,101,116, - 97,116, 46, 95, 95,105,110,100,101,120, 58, 99,119,100, 40,100,105,114, 41, 10, - 32, 32, 32, 32,115,101,108,102, 46,116,114,121, 40,115,101,108,102, 46,116,112, - 58, 99,111,109,109, 97,110,100, 40, 34, 99,119,100, 34, 44, 32,100,105,114, 41, - 41, 10, 32, 32, 32, 32,115,101,108,102, 46,116,114,121, 40,115,101,108,102, 46, -116,112, 58, 99,104,101, 99,107, 40, 50, 53, 48, 41, 41, 10, 32, 32, 32, 32,114, -101,116,117,114,110, 32, 49, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111, -110, 32,109,101,116, 97,116, 46, 95, 95,105,110,100,101,120, 58,116,121,112,101, - 40,116,121,112,101, 41, 10, 32, 32, 32, 32,115,101,108,102, 46,116,114,121, 40, -115,101,108,102, 46,116,112, 58, 99,111,109,109, 97,110,100, 40, 34,116,121,112, -101, 34, 44, 32,116,121,112,101, 41, 41, 10, 32, 32, 32, 32,115,101,108,102, 46, -116,114,121, 40,115,101,108,102, 46,116,112, 58, 99,104,101, 99,107, 40, 50, 48, - 48, 41, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32, 49, 10,101,110,100, - 10, 10,102,117,110, 99,116,105,111,110, 32,109,101,116, 97,116, 46, 95, 95,105, -110,100,101,120, 58,103,114,101,101,116, 40, 41, 10, 32, 32, 32, 32,108,111, 99, - 97,108, 32, 99,111,100,101, 32, 61, 32,115,101,108,102, 46,116,114,121, 40,115, -101,108,102, 46,116,112, 58, 99,104,101, 99,107,123, 34, 49, 46, 46, 34, 44, 32, - 34, 50, 46, 46, 34,125, 41, 10, 32, 32, 32, 32,105,102, 32,115,116,114,105,110, -103, 46,102,105,110,100, 40, 99,111,100,101, 44, 32, 34, 49, 46, 46, 34, 41, 32, -116,104,101,110, 32,115,101,108,102, 46,116,114,121, 40,115,101,108,102, 46,116, -112, 58, 99,104,101, 99,107, 40, 34, 50, 46, 46, 34, 41, 41, 32,101,110,100, 10, - 32, 32, 32, 32,114,101,116,117,114,110, 32, 49, 10,101,110,100, 10, 10,102,117, -110, 99,116,105,111,110, 32,109,101,116, 97,116, 46, 95, 95,105,110,100,101,120, - 58,113,117,105,116, 40, 41, 10, 32, 32, 32, 32,115,101,108,102, 46,116,114,121, - 40,115,101,108,102, 46,116,112, 58, 99,111,109,109, 97,110,100, 40, 34,113,117, -105,116, 34, 41, 41, 10, 32, 32, 32, 32,115,101,108,102, 46,116,114,121, 40,115, -101,108,102, 46,116,112, 58, 99,104,101, 99,107, 40, 34, 50, 46, 46, 34, 41, 41, - 10, 32, 32, 32, 32,114,101,116,117,114,110, 32, 49, 10,101,110,100, 10, 10,102, -117,110, 99,116,105,111,110, 32,109,101,116, 97,116, 46, 95, 95,105,110,100,101, -120, 58, 99,108,111,115,101, 40, 41, 10, 32, 32, 32, 32,105,102, 32,115,101,108, -102, 46,100, 97,116, 97, 32,116,104,101,110, 32,115,101,108,102, 46,100, 97,116, - 97, 58, 99,108,111,115,101, 40, 41, 32,101,110,100, 10, 32, 32, 32, 32,105,102, - 32,115,101,108,102, 46,115,101,114,118,101,114, 32,116,104,101,110, 32,115,101, -108,102, 46,115,101,114,118,101,114, 58, 99,108,111,115,101, 40, 41, 32,101,110, -100, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,115,101,108,102, 46,116,112, - 58, 99,108,111,115,101, 40, 41, 10,101,110,100, 10, 10, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 72,105,103,104, 32, -108,101,118,101,108, 32, 70, 84, 80, 32, 65, 80, 73, 10, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10,108,111, 99, 97,108, 32,102,117, -110, 99,116,105,111,110, 32,111,118,101,114,114,105,100,101, 40,116, 41, 10, 32, - 32, 32, 32,105,102, 32,116, 46,117,114,108, 32,116,104,101,110, 10, 32, 32, 32, - 32, 32, 32, 32, 32,108,111, 99, 97,108, 32,117, 32, 61, 32,117,114,108, 46,112, - 97,114,115,101, 40,116, 46,117,114,108, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, -102,111,114, 32,105, 44,118, 32,105,110, 32, 98, 97,115,101, 46,112, 97,105,114, -115, 40,116, 41, 32,100,111, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, -117, 91,105, 93, 32, 61, 32,118, 10, 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, - 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114,110, 32,117, 10, 32, 32, - 32, 32,101,108,115,101, 32,114,101,116,117,114,110, 32,116, 32,101,110,100, 10, -101,110,100, 10, 10,108,111, 99, 97,108, 32,102,117,110, 99,116,105,111,110, 32, -116,112,117,116, 40,112,117,116,116, 41, 10, 32, 32, 32, 32,112,117,116,116, 32, - 61, 32,111,118,101,114,114,105,100,101, 40,112,117,116,116, 41, 10, 32, 32, 32, - 32,115,111, 99,107,101,116, 46,116,114,121, 40,112,117,116,116, 46,104,111,115, -116, 44, 32, 34,109,105,115,115,105,110,103, 32,104,111,115,116,110, 97,109,101, - 34, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,102, 32, 61, 32, 95, 77, 46, -111,112,101,110, 40,112,117,116,116, 46,104,111,115,116, 44, 32,112,117,116,116, - 46,112,111,114,116, 44, 32,112,117,116,116, 46, 99,114,101, 97,116,101, 41, 10, - 32, 32, 32, 32,102, 58,103,114,101,101,116, 40, 41, 10, 32, 32, 32, 32,102, 58, -108,111,103,105,110, 40,112,117,116,116, 46,117,115,101,114, 44, 32,112,117,116, -116, 46,112, 97,115,115,119,111,114,100, 41, 10, 32, 32, 32, 32,105,102, 32,112, -117,116,116, 46,116,121,112,101, 32,116,104,101,110, 32,102, 58,116,121,112,101, - 40,112,117,116,116, 46,116,121,112,101, 41, 32,101,110,100, 10, 32, 32, 32, 32, -102, 58,101,112,115,118, 40, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,115, -101,110,116, 32, 61, 32,102, 58,115,101,110,100, 40,112,117,116,116, 41, 10, 32, - 32, 32, 32,102, 58,113,117,105,116, 40, 41, 10, 32, 32, 32, 32,102, 58, 99,108, -111,115,101, 40, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,115,101,110, -116, 10,101,110,100, 10, 10,108,111, 99, 97,108, 32,100,101,102, 97,117,108,116, - 32, 61, 32,123, 10, 32, 32, 32, 32,112, 97,116,104, 32, 61, 32, 34, 47, 34, 44, - 10, 32, 32, 32, 32,115, 99,104,101,109,101, 32, 61, 32, 34,102,116,112, 34, 10, -125, 10, 10,108,111, 99, 97,108, 32,102,117,110, 99,116,105,111,110, 32,103,101, -110,101,114,105, 99,102,111,114,109, 40,117, 41, 10, 32, 32, 32, 32,108,111, 99, - 97,108, 32,116, 32, 61, 32,115,111, 99,107,101,116, 46,116,114,121, 40,117,114, -108, 46,112, 97,114,115,101, 40,117, 44, 32,100,101,102, 97,117,108,116, 41, 41, - 10, 32, 32, 32, 32,115,111, 99,107,101,116, 46,116,114,121, 40,116, 46,115, 99, -104,101,109,101, 32, 61, 61, 32, 34,102,116,112, 34, 44, 32, 34,119,114,111,110, -103, 32,115, 99,104,101,109,101, 32, 39, 34, 32, 46, 46, 32,116, 46,115, 99,104, -101,109,101, 32, 46, 46, 32, 34, 39, 34, 41, 10, 32, 32, 32, 32,115,111, 99,107, -101,116, 46,116,114,121, 40,116, 46,104,111,115,116, 44, 32, 34,109,105,115,115, -105,110,103, 32,104,111,115,116,110, 97,109,101, 34, 41, 10, 32, 32, 32, 32,108, -111, 99, 97,108, 32,112, 97,116, 32, 61, 32, 34, 94,116,121,112,101, 61, 40, 46, - 41, 36, 34, 10, 32, 32, 32, 32,105,102, 32,116, 46,112, 97,114, 97,109,115, 32, -116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32,116, 46,116,121,112,101, 32, - 61, 32,115,111, 99,107,101,116, 46,115,107,105,112, 40, 50, 44, 32,115,116,114, -105,110,103, 46,102,105,110,100, 40,116, 46,112, 97,114, 97,109,115, 44, 32,112, - 97,116, 41, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,115,111, 99,107,101,116, 46, -116,114,121, 40,116, 46,116,121,112,101, 32, 61, 61, 32, 34, 97, 34, 32,111,114, - 32,116, 46,116,121,112,101, 32, 61, 61, 32, 34,105, 34, 44, 10, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 34,105,110,118, 97,108,105,100, 32,116,121,112, -101, 32, 39, 34, 32, 46, 46, 32,116, 46,116,121,112,101, 32, 46, 46, 32, 34, 39, - 34, 41, 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,114,101,116,117,114, -110, 32,116, 10,101,110,100, 10, 10, 95, 77, 46,103,101,110,101,114,105, 99,102, -111,114,109, 32, 61, 32,103,101,110,101,114,105, 99,102,111,114,109, 10, 10,108, -111, 99, 97,108, 32,102,117,110, 99,116,105,111,110, 32,115,112,117,116, 40,117, - 44, 32, 98,111,100,121, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,112,117, -116,116, 32, 61, 32,103,101,110,101,114,105, 99,102,111,114,109, 40,117, 41, 10, - 32, 32, 32, 32,112,117,116,116, 46,115,111,117,114, 99,101, 32, 61, 32,108,116, -110, 49, 50, 46,115,111,117,114, 99,101, 46,115,116,114,105,110,103, 40, 98,111, -100,121, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,116,112,117,116, 40, -112,117,116,116, 41, 10,101,110,100, 10, 10, 95, 77, 46,112,117,116, 32, 61, 32, -115,111, 99,107,101,116, 46,112,114,111,116,101, 99,116, 40,102,117,110, 99,116, -105,111,110, 40,112,117,116,116, 44, 32, 98,111,100,121, 41, 10, 32, 32, 32, 32, -105,102, 32, 98, 97,115,101, 46,116,121,112,101, 40,112,117,116,116, 41, 32, 61, - 61, 32, 34,115,116,114,105,110,103, 34, 32,116,104,101,110, 32,114,101,116,117, -114,110, 32,115,112,117,116, 40,112,117,116,116, 44, 32, 98,111,100,121, 41, 10, - 32, 32, 32, 32,101,108,115,101, 32,114,101,116,117,114,110, 32,116,112,117,116, - 40,112,117,116,116, 41, 32,101,110,100, 10,101,110,100, 41, 10, 10,108,111, 99, - 97,108, 32,102,117,110, 99,116,105,111,110, 32,116,103,101,116, 40,103,101,116, -116, 41, 10, 32, 32, 32, 32,103,101,116,116, 32, 61, 32,111,118,101,114,114,105, -100,101, 40,103,101,116,116, 41, 10, 32, 32, 32, 32,115,111, 99,107,101,116, 46, -116,114,121, 40,103,101,116,116, 46,104,111,115,116, 44, 32, 34,109,105,115,115, -105,110,103, 32,104,111,115,116,110, 97,109,101, 34, 41, 10, 32, 32, 32, 32,108, -111, 99, 97,108, 32,102, 32, 61, 32, 95, 77, 46,111,112,101,110, 40,103,101,116, -116, 46,104,111,115,116, 44, 32,103,101,116,116, 46,112,111,114,116, 44, 32,103, -101,116,116, 46, 99,114,101, 97,116,101, 41, 10, 32, 32, 32, 32,102, 58,103,114, -101,101,116, 40, 41, 10, 32, 32, 32, 32,102, 58,108,111,103,105,110, 40,103,101, -116,116, 46,117,115,101,114, 44, 32,103,101,116,116, 46,112, 97,115,115,119,111, -114,100, 41, 10, 32, 32, 32, 32,105,102, 32,103,101,116,116, 46,116,121,112,101, - 32,116,104,101,110, 32,102, 58,116,121,112,101, 40,103,101,116,116, 46,116,121, -112,101, 41, 32,101,110,100, 10, 32, 32, 32, 32,102, 58,101,112,115,118, 40, 41, - 10, 32, 32, 32, 32,102, 58,114,101, 99,101,105,118,101, 40,103,101,116,116, 41, - 10, 32, 32, 32, 32,102, 58,113,117,105,116, 40, 41, 10, 32, 32, 32, 32,114,101, -116,117,114,110, 32,102, 58, 99,108,111,115,101, 40, 41, 10,101,110,100, 10, 10, -108,111, 99, 97,108, 32,102,117,110, 99,116,105,111,110, 32,115,103,101,116, 40, -117, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,103,101,116,116, 32, 61, 32, -103,101,110,101,114,105, 99,102,111,114,109, 40,117, 41, 10, 32, 32, 32, 32,108, -111, 99, 97,108, 32,116, 32, 61, 32,123,125, 10, 32, 32, 32, 32,103,101,116,116, - 46,115,105,110,107, 32, 61, 32,108,116,110, 49, 50, 46,115,105,110,107, 46,116, - 97, 98,108,101, 40,116, 41, 10, 32, 32, 32, 32,116,103,101,116, 40,103,101,116, -116, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,116, 97, 98,108,101, 46, - 99,111,110, 99, 97,116, 40,116, 41, 10,101,110,100, 10, 10, 95, 77, 46, 99,111, -109,109, 97,110,100, 32, 61, 32,115,111, 99,107,101,116, 46,112,114,111,116,101, - 99,116, 40,102,117,110, 99,116,105,111,110, 40, 99,109,100,116, 41, 10, 32, 32, - 32, 32, 99,109,100,116, 32, 61, 32,111,118,101,114,114,105,100,101, 40, 99,109, -100,116, 41, 10, 32, 32, 32, 32,115,111, 99,107,101,116, 46,116,114,121, 40, 99, -109,100,116, 46,104,111,115,116, 44, 32, 34,109,105,115,115,105,110,103, 32,104, -111,115,116,110, 97,109,101, 34, 41, 10, 32, 32, 32, 32,115,111, 99,107,101,116, - 46,116,114,121, 40, 99,109,100,116, 46, 99,111,109,109, 97,110,100, 44, 32, 34, -109,105,115,115,105,110,103, 32, 99,111,109,109, 97,110,100, 34, 41, 10, 32, 32, - 32, 32,108,111, 99, 97,108, 32,102, 32, 61, 32, 95, 77, 46,111,112,101,110, 40, - 99,109,100,116, 46,104,111,115,116, 44, 32, 99,109,100,116, 46,112,111,114,116, - 44, 32, 99,109,100,116, 46, 99,114,101, 97,116,101, 41, 10, 32, 32, 32, 32,102, - 58,103,114,101,101,116, 40, 41, 10, 32, 32, 32, 32,102, 58,108,111,103,105,110, - 40, 99,109,100,116, 46,117,115,101,114, 44, 32, 99,109,100,116, 46,112, 97,115, -115,119,111,114,100, 41, 10, 32, 32, 32, 32,105,102, 32,116,121,112,101, 40, 99, -109,100,116, 46, 99,111,109,109, 97,110,100, 41, 32, 61, 61, 32, 34,116, 97, 98, -108,101, 34, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32,108,111, 99, - 97,108, 32, 97,114,103,117,109,101,110,116, 32, 61, 32, 99,109,100,116, 46, 97, -114,103,117,109,101,110,116, 32,111,114, 32,123,125, 10, 32, 32, 32, 32, 32, 32, - 32, 32,108,111, 99, 97,108, 32, 99,104,101, 99,107, 32, 61, 32, 99,109,100,116, - 46, 99,104,101, 99,107, 32,111,114, 32,123,125, 10, 32, 32, 32, 32, 32, 32, 32, - 32,102,111,114, 32,105, 44, 99,109,100, 32,105,110, 32,105,112, 97,105,114,115, - 40, 99,109,100,116, 46, 99,111,109,109, 97,110,100, 41, 32,100,111, 10, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 46,116,114,121, 40,102, 46,116,112, - 58, 99,111,109,109, 97,110,100, 40, 99,109,100, 44, 32, 97,114,103,117,109,101, -110,116, 91,105, 93, 41, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, -105,102, 32, 99,104,101, 99,107, 91,105, 93, 32,116,104,101,110, 32,102, 46,116, -114,121, 40,102, 46,116,112, 58, 99,104,101, 99,107, 40, 99,104,101, 99,107, 91, -105, 93, 41, 41, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, - 10, 32, 32, 32, 32,101,108,115,101, 10, 32, 32, 32, 32, 32, 32, 32, 32,102, 46, -116,114,121, 40,102, 46,116,112, 58, 99,111,109,109, 97,110,100, 40, 99,109,100, -116, 46, 99,111,109,109, 97,110,100, 44, 32, 99,109,100,116, 46, 97,114,103,117, -109,101,110,116, 41, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32, 99,109, -100,116, 46, 99,104,101, 99,107, 32,116,104,101,110, 32,102, 46,116,114,121, 40, -102, 46,116,112, 58, 99,104,101, 99,107, 40, 99,109,100,116, 46, 99,104,101, 99, -107, 41, 41, 32,101,110,100, 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, -102, 58,113,117,105,116, 40, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32, -102, 58, 99,108,111,115,101, 40, 41, 10,101,110,100, 41, 10, 10, 95, 77, 46,103, -101,116, 32, 61, 32,115,111, 99,107,101,116, 46,112,114,111,116,101, 99,116, 40, -102,117,110, 99,116,105,111,110, 40,103,101,116,116, 41, 10, 32, 32, 32, 32,105, -102, 32, 98, 97,115,101, 46,116,121,112,101, 40,103,101,116,116, 41, 32, 61, 61, - 32, 34,115,116,114,105,110,103, 34, 32,116,104,101,110, 32,114,101,116,117,114, -110, 32,115,103,101,116, 40,103,101,116,116, 41, 10, 32, 32, 32, 32,101,108,115, -101, 32,114,101,116,117,114,110, 32,116,103,101,116, 40,103,101,116,116, 41, 32, -101,110,100, 10,101,110,100, 41, 10, 10,114,101,116,117,114,110, 32, 95, 77, 10, - -}; - - if (luaL_loadbuffer(L,(const char*)B1,sizeof(B1),"ftp.lua")==0) lua_call(L, 0, LUA_MULTRET); -} diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/headers.lua b/love/src/jni/love/src/libraries/luasocket/libluasocket/headers.lua deleted file mode 100644 index 1eb8223b..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/headers.lua +++ /dev/null @@ -1,104 +0,0 @@ ------------------------------------------------------------------------------ --- Canonic header field capitalization --- LuaSocket toolkit. --- Author: Diego Nehab ------------------------------------------------------------------------------ -local socket = require("socket") -socket.headers = {} -local _M = socket.headers - -_M.canonic = { - ["accept"] = "Accept", - ["accept-charset"] = "Accept-Charset", - ["accept-encoding"] = "Accept-Encoding", - ["accept-language"] = "Accept-Language", - ["accept-ranges"] = "Accept-Ranges", - ["action"] = "Action", - ["alternate-recipient"] = "Alternate-Recipient", - ["age"] = "Age", - ["allow"] = "Allow", - ["arrival-date"] = "Arrival-Date", - ["authorization"] = "Authorization", - ["bcc"] = "Bcc", - ["cache-control"] = "Cache-Control", - ["cc"] = "Cc", - ["comments"] = "Comments", - ["connection"] = "Connection", - ["content-description"] = "Content-Description", - ["content-disposition"] = "Content-Disposition", - ["content-encoding"] = "Content-Encoding", - ["content-id"] = "Content-ID", - ["content-language"] = "Content-Language", - ["content-length"] = "Content-Length", - ["content-location"] = "Content-Location", - ["content-md5"] = "Content-MD5", - ["content-range"] = "Content-Range", - ["content-transfer-encoding"] = "Content-Transfer-Encoding", - ["content-type"] = "Content-Type", - ["cookie"] = "Cookie", - ["date"] = "Date", - ["diagnostic-code"] = "Diagnostic-Code", - ["dsn-gateway"] = "DSN-Gateway", - ["etag"] = "ETag", - ["expect"] = "Expect", - ["expires"] = "Expires", - ["final-log-id"] = "Final-Log-ID", - ["final-recipient"] = "Final-Recipient", - ["from"] = "From", - ["host"] = "Host", - ["if-match"] = "If-Match", - ["if-modified-since"] = "If-Modified-Since", - ["if-none-match"] = "If-None-Match", - ["if-range"] = "If-Range", - ["if-unmodified-since"] = "If-Unmodified-Since", - ["in-reply-to"] = "In-Reply-To", - ["keywords"] = "Keywords", - ["last-attempt-date"] = "Last-Attempt-Date", - ["last-modified"] = "Last-Modified", - ["location"] = "Location", - ["max-forwards"] = "Max-Forwards", - ["message-id"] = "Message-ID", - ["mime-version"] = "MIME-Version", - ["original-envelope-id"] = "Original-Envelope-ID", - ["original-recipient"] = "Original-Recipient", - ["pragma"] = "Pragma", - ["proxy-authenticate"] = "Proxy-Authenticate", - ["proxy-authorization"] = "Proxy-Authorization", - ["range"] = "Range", - ["received"] = "Received", - ["received-from-mta"] = "Received-From-MTA", - ["references"] = "References", - ["referer"] = "Referer", - ["remote-mta"] = "Remote-MTA", - ["reply-to"] = "Reply-To", - ["reporting-mta"] = "Reporting-MTA", - ["resent-bcc"] = "Resent-Bcc", - ["resent-cc"] = "Resent-Cc", - ["resent-date"] = "Resent-Date", - ["resent-from"] = "Resent-From", - ["resent-message-id"] = "Resent-Message-ID", - ["resent-reply-to"] = "Resent-Reply-To", - ["resent-sender"] = "Resent-Sender", - ["resent-to"] = "Resent-To", - ["retry-after"] = "Retry-After", - ["return-path"] = "Return-Path", - ["sender"] = "Sender", - ["server"] = "Server", - ["smtp-remote-recipient"] = "SMTP-Remote-Recipient", - ["status"] = "Status", - ["subject"] = "Subject", - ["te"] = "TE", - ["to"] = "To", - ["trailer"] = "Trailer", - ["transfer-encoding"] = "Transfer-Encoding", - ["upgrade"] = "Upgrade", - ["user-agent"] = "User-Agent", - ["vary"] = "Vary", - ["via"] = "Via", - ["warning"] = "Warning", - ["will-retry-until"] = "Will-Retry-Until", - ["www-authenticate"] = "WWW-Authenticate", - ["x-mailer"] = "X-Mailer", -} - -return _M \ No newline at end of file diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/headers.lua.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/headers.lua.h deleted file mode 100644 index 0d8d891a..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/headers.lua.h +++ /dev/null @@ -1,196 +0,0 @@ -/* code automatically generated by bin2c -- DO NOT EDIT */ -{ -/* #include'ing this file in a C program is equivalent to calling - if (luaL_loadfile(L,"headers.lua")==0) lua_call(L, 0, LUA_MULTRET); -*/ -/* headers.lua */ -static const unsigned char B1[]={ - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, - 32, 67, 97,110,111,110,105, 99, 32,104,101, 97,100,101,114, 32,102,105,101,108, -100, 32, 99, 97,112,105,116, 97,108,105,122, 97,116,105,111,110, 10, 45, 45, 32, - 76,117, 97, 83,111, 99,107,101,116, 32,116,111,111,108,107,105,116, 46, 10, 45, - 45, 32, 65,117,116,104,111,114, 58, 32, 68,105,101,103,111, 32, 78,101,104, 97, - 98, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, -108,111, 99, 97,108, 32,115,111, 99,107,101,116, 32, 61, 32,114,101,113,117,105, -114,101, 40, 34,115,111, 99,107,101,116, 34, 41, 10,115,111, 99,107,101,116, 46, -104,101, 97,100,101,114,115, 32, 61, 32,123,125, 10,108,111, 99, 97,108, 32, 95, - 77, 32, 61, 32,115,111, 99,107,101,116, 46,104,101, 97,100,101,114,115, 10, 10, - 95, 77, 46, 99, 97,110,111,110,105, 99, 32, 61, 32,123, 10, 32, 32, 32, 32, 91, - 34, 97, 99, 99,101,112,116, 34, 93, 32, 61, 32, 34, 65, 99, 99,101,112,116, 34, - 44, 10, 32, 32, 32, 32, 91, 34, 97, 99, 99,101,112,116, 45, 99,104, 97,114,115, -101,116, 34, 93, 32, 61, 32, 34, 65, 99, 99,101,112,116, 45, 67,104, 97,114,115, -101,116, 34, 44, 10, 32, 32, 32, 32, 91, 34, 97, 99, 99,101,112,116, 45,101,110, - 99,111,100,105,110,103, 34, 93, 32, 61, 32, 34, 65, 99, 99,101,112,116, 45, 69, -110, 99,111,100,105,110,103, 34, 44, 10, 32, 32, 32, 32, 91, 34, 97, 99, 99,101, -112,116, 45,108, 97,110,103,117, 97,103,101, 34, 93, 32, 61, 32, 34, 65, 99, 99, -101,112,116, 45, 76, 97,110,103,117, 97,103,101, 34, 44, 10, 32, 32, 32, 32, 91, - 34, 97, 99, 99,101,112,116, 45,114, 97,110,103,101,115, 34, 93, 32, 61, 32, 34, - 65, 99, 99,101,112,116, 45, 82, 97,110,103,101,115, 34, 44, 10, 32, 32, 32, 32, - 91, 34, 97, 99,116,105,111,110, 34, 93, 32, 61, 32, 34, 65, 99,116,105,111,110, - 34, 44, 10, 32, 32, 32, 32, 91, 34, 97,108,116,101,114,110, 97,116,101, 45,114, -101, 99,105,112,105,101,110,116, 34, 93, 32, 61, 32, 34, 65,108,116,101,114,110, - 97,116,101, 45, 82,101, 99,105,112,105,101,110,116, 34, 44, 10, 32, 32, 32, 32, - 91, 34, 97,103,101, 34, 93, 32, 61, 32, 34, 65,103,101, 34, 44, 10, 32, 32, 32, - 32, 91, 34, 97,108,108,111,119, 34, 93, 32, 61, 32, 34, 65,108,108,111,119, 34, - 44, 10, 32, 32, 32, 32, 91, 34, 97,114,114,105,118, 97,108, 45,100, 97,116,101, - 34, 93, 32, 61, 32, 34, 65,114,114,105,118, 97,108, 45, 68, 97,116,101, 34, 44, - 10, 32, 32, 32, 32, 91, 34, 97,117,116,104,111,114,105,122, 97,116,105,111,110, - 34, 93, 32, 61, 32, 34, 65,117,116,104,111,114,105,122, 97,116,105,111,110, 34, - 44, 10, 32, 32, 32, 32, 91, 34, 98, 99, 99, 34, 93, 32, 61, 32, 34, 66, 99, 99, - 34, 44, 10, 32, 32, 32, 32, 91, 34, 99, 97, 99,104,101, 45, 99,111,110,116,114, -111,108, 34, 93, 32, 61, 32, 34, 67, 97, 99,104,101, 45, 67,111,110,116,114,111, -108, 34, 44, 10, 32, 32, 32, 32, 91, 34, 99, 99, 34, 93, 32, 61, 32, 34, 67, 99, - 34, 44, 10, 32, 32, 32, 32, 91, 34, 99,111,109,109,101,110,116,115, 34, 93, 32, - 61, 32, 34, 67,111,109,109,101,110,116,115, 34, 44, 10, 32, 32, 32, 32, 91, 34, - 99,111,110,110,101, 99,116,105,111,110, 34, 93, 32, 61, 32, 34, 67,111,110,110, -101, 99,116,105,111,110, 34, 44, 10, 32, 32, 32, 32, 91, 34, 99,111,110,116,101, -110,116, 45,100,101,115, 99,114,105,112,116,105,111,110, 34, 93, 32, 61, 32, 34, - 67,111,110,116,101,110,116, 45, 68,101,115, 99,114,105,112,116,105,111,110, 34, - 44, 10, 32, 32, 32, 32, 91, 34, 99,111,110,116,101,110,116, 45,100,105,115,112, -111,115,105,116,105,111,110, 34, 93, 32, 61, 32, 34, 67,111,110,116,101,110,116, - 45, 68,105,115,112,111,115,105,116,105,111,110, 34, 44, 10, 32, 32, 32, 32, 91, - 34, 99,111,110,116,101,110,116, 45,101,110, 99,111,100,105,110,103, 34, 93, 32, - 61, 32, 34, 67,111,110,116,101,110,116, 45, 69,110, 99,111,100,105,110,103, 34, - 44, 10, 32, 32, 32, 32, 91, 34, 99,111,110,116,101,110,116, 45,105,100, 34, 93, - 32, 61, 32, 34, 67,111,110,116,101,110,116, 45, 73, 68, 34, 44, 10, 32, 32, 32, - 32, 91, 34, 99,111,110,116,101,110,116, 45,108, 97,110,103,117, 97,103,101, 34, - 93, 32, 61, 32, 34, 67,111,110,116,101,110,116, 45, 76, 97,110,103,117, 97,103, -101, 34, 44, 10, 32, 32, 32, 32, 91, 34, 99,111,110,116,101,110,116, 45,108,101, -110,103,116,104, 34, 93, 32, 61, 32, 34, 67,111,110,116,101,110,116, 45, 76,101, -110,103,116,104, 34, 44, 10, 32, 32, 32, 32, 91, 34, 99,111,110,116,101,110,116, - 45,108,111, 99, 97,116,105,111,110, 34, 93, 32, 61, 32, 34, 67,111,110,116,101, -110,116, 45, 76,111, 99, 97,116,105,111,110, 34, 44, 10, 32, 32, 32, 32, 91, 34, - 99,111,110,116,101,110,116, 45,109,100, 53, 34, 93, 32, 61, 32, 34, 67,111,110, -116,101,110,116, 45, 77, 68, 53, 34, 44, 10, 32, 32, 32, 32, 91, 34, 99,111,110, -116,101,110,116, 45,114, 97,110,103,101, 34, 93, 32, 61, 32, 34, 67,111,110,116, -101,110,116, 45, 82, 97,110,103,101, 34, 44, 10, 32, 32, 32, 32, 91, 34, 99,111, -110,116,101,110,116, 45,116,114, 97,110,115,102,101,114, 45,101,110, 99,111,100, -105,110,103, 34, 93, 32, 61, 32, 34, 67,111,110,116,101,110,116, 45, 84,114, 97, -110,115,102,101,114, 45, 69,110, 99,111,100,105,110,103, 34, 44, 10, 32, 32, 32, - 32, 91, 34, 99,111,110,116,101,110,116, 45,116,121,112,101, 34, 93, 32, 61, 32, - 34, 67,111,110,116,101,110,116, 45, 84,121,112,101, 34, 44, 10, 32, 32, 32, 32, - 91, 34, 99,111,111,107,105,101, 34, 93, 32, 61, 32, 34, 67,111,111,107,105,101, - 34, 44, 10, 32, 32, 32, 32, 91, 34,100, 97,116,101, 34, 93, 32, 61, 32, 34, 68, - 97,116,101, 34, 44, 10, 32, 32, 32, 32, 91, 34,100,105, 97,103,110,111,115,116, -105, 99, 45, 99,111,100,101, 34, 93, 32, 61, 32, 34, 68,105, 97,103,110,111,115, -116,105, 99, 45, 67,111,100,101, 34, 44, 10, 32, 32, 32, 32, 91, 34,100,115,110, - 45,103, 97,116,101,119, 97,121, 34, 93, 32, 61, 32, 34, 68, 83, 78, 45, 71, 97, -116,101,119, 97,121, 34, 44, 10, 32, 32, 32, 32, 91, 34,101,116, 97,103, 34, 93, - 32, 61, 32, 34, 69, 84, 97,103, 34, 44, 10, 32, 32, 32, 32, 91, 34,101,120,112, -101, 99,116, 34, 93, 32, 61, 32, 34, 69,120,112,101, 99,116, 34, 44, 10, 32, 32, - 32, 32, 91, 34,101,120,112,105,114,101,115, 34, 93, 32, 61, 32, 34, 69,120,112, -105,114,101,115, 34, 44, 10, 32, 32, 32, 32, 91, 34,102,105,110, 97,108, 45,108, -111,103, 45,105,100, 34, 93, 32, 61, 32, 34, 70,105,110, 97,108, 45, 76,111,103, - 45, 73, 68, 34, 44, 10, 32, 32, 32, 32, 91, 34,102,105,110, 97,108, 45,114,101, - 99,105,112,105,101,110,116, 34, 93, 32, 61, 32, 34, 70,105,110, 97,108, 45, 82, -101, 99,105,112,105,101,110,116, 34, 44, 10, 32, 32, 32, 32, 91, 34,102,114,111, -109, 34, 93, 32, 61, 32, 34, 70,114,111,109, 34, 44, 10, 32, 32, 32, 32, 91, 34, -104,111,115,116, 34, 93, 32, 61, 32, 34, 72,111,115,116, 34, 44, 10, 32, 32, 32, - 32, 91, 34,105,102, 45,109, 97,116, 99,104, 34, 93, 32, 61, 32, 34, 73,102, 45, - 77, 97,116, 99,104, 34, 44, 10, 32, 32, 32, 32, 91, 34,105,102, 45,109,111,100, -105,102,105,101,100, 45,115,105,110, 99,101, 34, 93, 32, 61, 32, 34, 73,102, 45, - 77,111,100,105,102,105,101,100, 45, 83,105,110, 99,101, 34, 44, 10, 32, 32, 32, - 32, 91, 34,105,102, 45,110,111,110,101, 45,109, 97,116, 99,104, 34, 93, 32, 61, - 32, 34, 73,102, 45, 78,111,110,101, 45, 77, 97,116, 99,104, 34, 44, 10, 32, 32, - 32, 32, 91, 34,105,102, 45,114, 97,110,103,101, 34, 93, 32, 61, 32, 34, 73,102, - 45, 82, 97,110,103,101, 34, 44, 10, 32, 32, 32, 32, 91, 34,105,102, 45,117,110, -109,111,100,105,102,105,101,100, 45,115,105,110, 99,101, 34, 93, 32, 61, 32, 34, - 73,102, 45, 85,110,109,111,100,105,102,105,101,100, 45, 83,105,110, 99,101, 34, - 44, 10, 32, 32, 32, 32, 91, 34,105,110, 45,114,101,112,108,121, 45,116,111, 34, - 93, 32, 61, 32, 34, 73,110, 45, 82,101,112,108,121, 45, 84,111, 34, 44, 10, 32, - 32, 32, 32, 91, 34,107,101,121,119,111,114,100,115, 34, 93, 32, 61, 32, 34, 75, -101,121,119,111,114,100,115, 34, 44, 10, 32, 32, 32, 32, 91, 34,108, 97,115,116, - 45, 97,116,116,101,109,112,116, 45,100, 97,116,101, 34, 93, 32, 61, 32, 34, 76, - 97,115,116, 45, 65,116,116,101,109,112,116, 45, 68, 97,116,101, 34, 44, 10, 32, - 32, 32, 32, 91, 34,108, 97,115,116, 45,109,111,100,105,102,105,101,100, 34, 93, - 32, 61, 32, 34, 76, 97,115,116, 45, 77,111,100,105,102,105,101,100, 34, 44, 10, - 32, 32, 32, 32, 91, 34,108,111, 99, 97,116,105,111,110, 34, 93, 32, 61, 32, 34, - 76,111, 99, 97,116,105,111,110, 34, 44, 10, 32, 32, 32, 32, 91, 34,109, 97,120, - 45,102,111,114,119, 97,114,100,115, 34, 93, 32, 61, 32, 34, 77, 97,120, 45, 70, -111,114,119, 97,114,100,115, 34, 44, 10, 32, 32, 32, 32, 91, 34,109,101,115,115, - 97,103,101, 45,105,100, 34, 93, 32, 61, 32, 34, 77,101,115,115, 97,103,101, 45, - 73, 68, 34, 44, 10, 32, 32, 32, 32, 91, 34,109,105,109,101, 45,118,101,114,115, -105,111,110, 34, 93, 32, 61, 32, 34, 77, 73, 77, 69, 45, 86,101,114,115,105,111, -110, 34, 44, 10, 32, 32, 32, 32, 91, 34,111,114,105,103,105,110, 97,108, 45,101, -110,118,101,108,111,112,101, 45,105,100, 34, 93, 32, 61, 32, 34, 79,114,105,103, -105,110, 97,108, 45, 69,110,118,101,108,111,112,101, 45, 73, 68, 34, 44, 10, 32, - 32, 32, 32, 91, 34,111,114,105,103,105,110, 97,108, 45,114,101, 99,105,112,105, -101,110,116, 34, 93, 32, 61, 32, 34, 79,114,105,103,105,110, 97,108, 45, 82,101, - 99,105,112,105,101,110,116, 34, 44, 10, 32, 32, 32, 32, 91, 34,112,114, 97,103, -109, 97, 34, 93, 32, 61, 32, 34, 80,114, 97,103,109, 97, 34, 44, 10, 32, 32, 32, - 32, 91, 34,112,114,111,120,121, 45, 97,117,116,104,101,110,116,105, 99, 97,116, -101, 34, 93, 32, 61, 32, 34, 80,114,111,120,121, 45, 65,117,116,104,101,110,116, -105, 99, 97,116,101, 34, 44, 10, 32, 32, 32, 32, 91, 34,112,114,111,120,121, 45, - 97,117,116,104,111,114,105,122, 97,116,105,111,110, 34, 93, 32, 61, 32, 34, 80, -114,111,120,121, 45, 65,117,116,104,111,114,105,122, 97,116,105,111,110, 34, 44, - 10, 32, 32, 32, 32, 91, 34,114, 97,110,103,101, 34, 93, 32, 61, 32, 34, 82, 97, -110,103,101, 34, 44, 10, 32, 32, 32, 32, 91, 34,114,101, 99,101,105,118,101,100, - 34, 93, 32, 61, 32, 34, 82,101, 99,101,105,118,101,100, 34, 44, 10, 32, 32, 32, - 32, 91, 34,114,101, 99,101,105,118,101,100, 45,102,114,111,109, 45,109,116, 97, - 34, 93, 32, 61, 32, 34, 82,101, 99,101,105,118,101,100, 45, 70,114,111,109, 45, - 77, 84, 65, 34, 44, 10, 32, 32, 32, 32, 91, 34,114,101,102,101,114,101,110, 99, -101,115, 34, 93, 32, 61, 32, 34, 82,101,102,101,114,101,110, 99,101,115, 34, 44, - 10, 32, 32, 32, 32, 91, 34,114,101,102,101,114,101,114, 34, 93, 32, 61, 32, 34, - 82,101,102,101,114,101,114, 34, 44, 10, 32, 32, 32, 32, 91, 34,114,101,109,111, -116,101, 45,109,116, 97, 34, 93, 32, 61, 32, 34, 82,101,109,111,116,101, 45, 77, - 84, 65, 34, 44, 10, 32, 32, 32, 32, 91, 34,114,101,112,108,121, 45,116,111, 34, - 93, 32, 61, 32, 34, 82,101,112,108,121, 45, 84,111, 34, 44, 10, 32, 32, 32, 32, - 91, 34,114,101,112,111,114,116,105,110,103, 45,109,116, 97, 34, 93, 32, 61, 32, - 34, 82,101,112,111,114,116,105,110,103, 45, 77, 84, 65, 34, 44, 10, 32, 32, 32, - 32, 91, 34,114,101,115,101,110,116, 45, 98, 99, 99, 34, 93, 32, 61, 32, 34, 82, -101,115,101,110,116, 45, 66, 99, 99, 34, 44, 10, 32, 32, 32, 32, 91, 34,114,101, -115,101,110,116, 45, 99, 99, 34, 93, 32, 61, 32, 34, 82,101,115,101,110,116, 45, - 67, 99, 34, 44, 10, 32, 32, 32, 32, 91, 34,114,101,115,101,110,116, 45,100, 97, -116,101, 34, 93, 32, 61, 32, 34, 82,101,115,101,110,116, 45, 68, 97,116,101, 34, - 44, 10, 32, 32, 32, 32, 91, 34,114,101,115,101,110,116, 45,102,114,111,109, 34, - 93, 32, 61, 32, 34, 82,101,115,101,110,116, 45, 70,114,111,109, 34, 44, 10, 32, - 32, 32, 32, 91, 34,114,101,115,101,110,116, 45,109,101,115,115, 97,103,101, 45, -105,100, 34, 93, 32, 61, 32, 34, 82,101,115,101,110,116, 45, 77,101,115,115, 97, -103,101, 45, 73, 68, 34, 44, 10, 32, 32, 32, 32, 91, 34,114,101,115,101,110,116, - 45,114,101,112,108,121, 45,116,111, 34, 93, 32, 61, 32, 34, 82,101,115,101,110, -116, 45, 82,101,112,108,121, 45, 84,111, 34, 44, 10, 32, 32, 32, 32, 91, 34,114, -101,115,101,110,116, 45,115,101,110,100,101,114, 34, 93, 32, 61, 32, 34, 82,101, -115,101,110,116, 45, 83,101,110,100,101,114, 34, 44, 10, 32, 32, 32, 32, 91, 34, -114,101,115,101,110,116, 45,116,111, 34, 93, 32, 61, 32, 34, 82,101,115,101,110, -116, 45, 84,111, 34, 44, 10, 32, 32, 32, 32, 91, 34,114,101,116,114,121, 45, 97, -102,116,101,114, 34, 93, 32, 61, 32, 34, 82,101,116,114,121, 45, 65,102,116,101, -114, 34, 44, 10, 32, 32, 32, 32, 91, 34,114,101,116,117,114,110, 45,112, 97,116, -104, 34, 93, 32, 61, 32, 34, 82,101,116,117,114,110, 45, 80, 97,116,104, 34, 44, - 10, 32, 32, 32, 32, 91, 34,115,101,110,100,101,114, 34, 93, 32, 61, 32, 34, 83, -101,110,100,101,114, 34, 44, 10, 32, 32, 32, 32, 91, 34,115,101,114,118,101,114, - 34, 93, 32, 61, 32, 34, 83,101,114,118,101,114, 34, 44, 10, 32, 32, 32, 32, 91, - 34,115,109,116,112, 45,114,101,109,111,116,101, 45,114,101, 99,105,112,105,101, -110,116, 34, 93, 32, 61, 32, 34, 83, 77, 84, 80, 45, 82,101,109,111,116,101, 45, - 82,101, 99,105,112,105,101,110,116, 34, 44, 10, 32, 32, 32, 32, 91, 34,115,116, - 97,116,117,115, 34, 93, 32, 61, 32, 34, 83,116, 97,116,117,115, 34, 44, 10, 32, - 32, 32, 32, 91, 34,115,117, 98,106,101, 99,116, 34, 93, 32, 61, 32, 34, 83,117, - 98,106,101, 99,116, 34, 44, 10, 32, 32, 32, 32, 91, 34,116,101, 34, 93, 32, 61, - 32, 34, 84, 69, 34, 44, 10, 32, 32, 32, 32, 91, 34,116,111, 34, 93, 32, 61, 32, - 34, 84,111, 34, 44, 10, 32, 32, 32, 32, 91, 34,116,114, 97,105,108,101,114, 34, - 93, 32, 61, 32, 34, 84,114, 97,105,108,101,114, 34, 44, 10, 32, 32, 32, 32, 91, - 34,116,114, 97,110,115,102,101,114, 45,101,110, 99,111,100,105,110,103, 34, 93, - 32, 61, 32, 34, 84,114, 97,110,115,102,101,114, 45, 69,110, 99,111,100,105,110, -103, 34, 44, 10, 32, 32, 32, 32, 91, 34,117,112,103,114, 97,100,101, 34, 93, 32, - 61, 32, 34, 85,112,103,114, 97,100,101, 34, 44, 10, 32, 32, 32, 32, 91, 34,117, -115,101,114, 45, 97,103,101,110,116, 34, 93, 32, 61, 32, 34, 85,115,101,114, 45, - 65,103,101,110,116, 34, 44, 10, 32, 32, 32, 32, 91, 34,118, 97,114,121, 34, 93, - 32, 61, 32, 34, 86, 97,114,121, 34, 44, 10, 32, 32, 32, 32, 91, 34,118,105, 97, - 34, 93, 32, 61, 32, 34, 86,105, 97, 34, 44, 10, 32, 32, 32, 32, 91, 34,119, 97, -114,110,105,110,103, 34, 93, 32, 61, 32, 34, 87, 97,114,110,105,110,103, 34, 44, - 10, 32, 32, 32, 32, 91, 34,119,105,108,108, 45,114,101,116,114,121, 45,117,110, -116,105,108, 34, 93, 32, 61, 32, 34, 87,105,108,108, 45, 82,101,116,114,121, 45, - 85,110,116,105,108, 34, 44, 10, 32, 32, 32, 32, 91, 34,119,119,119, 45, 97,117, -116,104,101,110,116,105, 99, 97,116,101, 34, 93, 32, 61, 32, 34, 87, 87, 87, 45, - 65,117,116,104,101,110,116,105, 99, 97,116,101, 34, 44, 10, 32, 32, 32, 32, 91, - 34,120, 45,109, 97,105,108,101,114, 34, 93, 32, 61, 32, 34, 88, 45, 77, 97,105, -108,101,114, 34, 44, 10,125, 10, 10,114,101,116,117,114,110, 32, 95, 77, -}; - - if (luaL_loadbuffer(L,(const char*)B1,sizeof(B1),"headers.lua")==0) lua_call(L, 0, LUA_MULTRET); -} diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/http.lua b/love/src/jni/love/src/libraries/luasocket/libluasocket/http.lua deleted file mode 100644 index ab5daf61..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/http.lua +++ /dev/null @@ -1,382 +0,0 @@ ------------------------------------------------------------------------------ --- HTTP/1.1 client support for the Lua language. --- LuaSocket toolkit. --- Author: Diego Nehab ------------------------------------------------------------------------------ - ------------------------------------------------------------------------------ --- Declare module and import dependencies -------------------------------------------------------------------------------- -local socket = require("socket") -local url = require("socket.url") -local ltn12 = require("ltn12") -local mime = require("mime") -local string = require("string") -local headers = require("socket.headers") -local base = _G -local table = require("table") -socket.http = {} -local _M = socket.http - ------------------------------------------------------------------------------ --- Program constants ------------------------------------------------------------------------------ --- connection timeout in seconds -_M.TIMEOUT = 60 --- user agent field sent in request -_M.USERAGENT = socket._VERSION - --- supported schemes -local SCHEMES = { ["http"] = true } --- default port for document retrieval -local PORT = 80 - ------------------------------------------------------------------------------ --- Reads MIME headers from a connection, unfolding where needed ------------------------------------------------------------------------------ -local function receiveheaders(sock, headers) - local line, name, value, err - headers = headers or {} - -- get first line - line, err = sock:receive() - if err then return nil, err end - -- headers go until a blank line is found - while line ~= "" do - -- get field-name and value - name, value = socket.skip(2, string.find(line, "^(.-):%s*(.*)")) - if not (name and value) then return nil, "malformed response headers" end - name = string.lower(name) - -- get next line (value might be folded) - line, err = sock:receive() - if err then return nil, err end - -- unfold any folded values - while string.find(line, "^%s") do - value = value .. line - line = sock:receive() - if err then return nil, err end - end - -- save pair in table - if headers[name] then headers[name] = headers[name] .. ", " .. value - else headers[name] = value end - end - return headers -end - ------------------------------------------------------------------------------ --- Extra sources and sinks ------------------------------------------------------------------------------ -socket.sourcet["http-chunked"] = function(sock, headers) - return base.setmetatable({ - getfd = function() return sock:getfd() end, - dirty = function() return sock:dirty() end - }, { - __call = function() - -- get chunk size, skip extension - local line, err = sock:receive() - if err then return nil, err end - local size = base.tonumber(string.gsub(line, ";.*", ""), 16) - if not size then return nil, "invalid chunk size" end - -- was it the last chunk? - if size > 0 then - -- if not, get chunk and skip terminating CRLF - local chunk, err, part = sock:receive(size) - if chunk then sock:receive() end - return chunk, err - else - -- if it was, read trailers into headers table - headers, err = receiveheaders(sock, headers) - if not headers then return nil, err end - end - end - }) -end - -socket.sinkt["http-chunked"] = function(sock) - return base.setmetatable({ - getfd = function() return sock:getfd() end, - dirty = function() return sock:dirty() end - }, { - __call = function(self, chunk, err) - if not chunk then return sock:send("0\r\n\r\n") end - local size = string.format("%X\r\n", string.len(chunk)) - return sock:send(size .. chunk .. "\r\n") - end - }) -end - ------------------------------------------------------------------------------ --- Low level HTTP API ------------------------------------------------------------------------------ -local metat = { __index = {} } - -function _M.open(host, port, create) - -- create socket with user connect function, or with default - local c = socket.try((create or socket.tcp)()) - local h = base.setmetatable({ c = c }, metat) - -- create finalized try - h.try = socket.newtry(function() h:close() end) - -- set timeout before connecting - h.try(c:settimeout(_M.TIMEOUT)) - h.try(c:connect(host, port or PORT)) - -- here everything worked - return h -end - -function metat.__index:sendrequestline(method, uri) - local reqline = string.format("%s %s HTTP/1.1\r\n", method or "GET", uri) - return self.try(self.c:send(reqline)) -end - -function metat.__index:sendheaders(tosend) - local canonic = headers.canonic - local h = "\r\n" - for f, v in base.pairs(tosend) do - h = (canonic[f] or f) .. ": " .. v .. "\r\n" .. h - end - self.try(self.c:send(h)) - return 1 -end - -function metat.__index:sendbody(headers, source, step) - source = source or ltn12.source.empty() - step = step or ltn12.pump.step - -- if we don't know the size in advance, send chunked and hope for the best - local mode = "http-chunked" - if headers["content-length"] then mode = "keep-open" end - return self.try(ltn12.pump.all(source, socket.sink(mode, self.c), step)) -end - -function metat.__index:receivestatusline() - local status = self.try(self.c:receive(5)) - -- identify HTTP/0.9 responses, which do not contain a status line - -- this is just a heuristic, but is what the RFC recommends - if status ~= "HTTP/" then return nil, status end - -- otherwise proceed reading a status line - status = self.try(self.c:receive("*l", status)) - local code = socket.skip(2, string.find(status, "HTTP/%d*%.%d* (%d%d%d)")) - return self.try(base.tonumber(code), status) -end - -function metat.__index:receiveheaders() - return self.try(receiveheaders(self.c)) -end - -function metat.__index:receivebody(headers, sink, step) - sink = sink or ltn12.sink.null() - step = step or ltn12.pump.step - local length = base.tonumber(headers["content-length"]) - local t = headers["transfer-encoding"] -- shortcut - local mode = "default" -- connection close - if t and t ~= "identity" then mode = "http-chunked" - elseif base.tonumber(headers["content-length"]) then mode = "by-length" end - return self.try(ltn12.pump.all(socket.source(mode, self.c, length), - sink, step)) -end - -function metat.__index:receive09body(status, sink, step) - local source = ltn12.source.rewind(socket.source("until-closed", self.c)) - source(status) - return self.try(ltn12.pump.all(source, sink, step)) -end - -function metat.__index:close() - return self.c:close() -end - ------------------------------------------------------------------------------ --- High level HTTP API ------------------------------------------------------------------------------ -local function adjusturi(reqt) - local u = reqt - -- if there is a proxy, we need the full url. otherwise, just a part. - if not reqt.proxy and not _M.PROXY then - u = { - path = socket.try(reqt.path, "invalid path 'nil'"), - params = reqt.params, - query = reqt.query, - fragment = reqt.fragment - } - end - return url.build(u) -end - -local function adjustproxy(reqt) - local proxy = reqt.proxy or _M.PROXY - if proxy then - proxy = url.parse(proxy) - return proxy.host, proxy.port or 3128 - else - return reqt.host, reqt.port - end -end - -local function adjustheaders(reqt) - -- default headers - local host = string.gsub(reqt.authority, "^.-@", "") - local lower = { - ["user-agent"] = _M.USERAGENT, - ["host"] = host, - ["connection"] = "close, TE", - ["te"] = "trailers" - } - -- if we have authentication information, pass it along - if reqt.user and reqt.password then - lower["authorization"] = - "Basic " .. (mime.b64(reqt.user .. ":" .. - url.unescape(reqt.password))) - end - -- if we have proxy authentication information, pass it along - local proxy = reqt.proxy or _M.PROXY - if proxy then - proxy = url.parse(proxy) - if proxy.user and proxy.password then - lower["proxy-authorization"] = - "Basic " .. (mime.b64(proxy.user .. ":" .. proxy.password)) - end - end - -- override with user headers - for i,v in base.pairs(reqt.headers or lower) do - lower[string.lower(i)] = v - end - return lower -end - --- default url parts -local default = { - host = "", - port = PORT, - path ="/", - scheme = "http" -} - -local function adjustrequest(reqt) - -- parse url if provided - local nreqt = reqt.url and url.parse(reqt.url, default) or {} - -- explicit components override url - for i,v in base.pairs(reqt) do nreqt[i] = v end - if nreqt.port == "" then nreqt.port = PORT end - if not (nreqt.host and nreqt.host ~= "") then - socket.try(nil, "invalid host '" .. base.tostring(nreqt.host) .. "'") - end - -- compute uri if user hasn't overridden - nreqt.uri = reqt.uri or adjusturi(nreqt) - -- adjust headers in request - nreqt.headers = adjustheaders(nreqt) - -- ajust host and port if there is a proxy - nreqt.host, nreqt.port = adjustproxy(nreqt) - return nreqt -end - -local function shouldredirect(reqt, code, headers) - local location = headers.location - if not location then return false end - location = string.gsub(location, "%s", "") - if location == "" then return false end - local scheme = string.match(location, "^([%w][%w%+%-%.]*)%:") - if scheme and not SCHEMES[scheme] then return false end - return (reqt.redirect ~= false) and - (code == 301 or code == 302 or code == 303 or code == 307) and - (not reqt.method or reqt.method == "GET" or reqt.method == "HEAD") - and (not reqt.nredirects or reqt.nredirects < 5) -end - -local function shouldreceivebody(reqt, code) - if reqt.method == "HEAD" then return nil end - if code == 204 or code == 304 then return nil end - if code >= 100 and code < 200 then return nil end - return 1 -end - --- forward declarations -local trequest, tredirect - ---[[local]] function tredirect(reqt, location) - local result, code, headers, status = trequest { - -- the RFC says the redirect URL has to be absolute, but some - -- servers do not respect that - url = url.absolute(reqt.url, location), - source = reqt.source, - sink = reqt.sink, - headers = reqt.headers, - proxy = reqt.proxy, - nredirects = (reqt.nredirects or 0) + 1, - create = reqt.create - } - -- pass location header back as a hint we redirected - headers = headers or {} - headers.location = headers.location or location - return result, code, headers, status -end - ---[[local]] function trequest(reqt) - -- we loop until we get what we want, or - -- until we are sure there is no way to get it - local nreqt = adjustrequest(reqt) - local h = _M.open(nreqt.host, nreqt.port, nreqt.create) - -- send request line and headers - h:sendrequestline(nreqt.method, nreqt.uri) - h:sendheaders(nreqt.headers) - -- if there is a body, send it - if nreqt.source then - h:sendbody(nreqt.headers, nreqt.source, nreqt.step) - end - local code, status = h:receivestatusline() - -- if it is an HTTP/0.9 server, simply get the body and we are done - if not code then - h:receive09body(status, nreqt.sink, nreqt.step) - return 1, 200 - end - local headers - -- ignore any 100-continue messages - while code == 100 do - headers = h:receiveheaders() - code, status = h:receivestatusline() - end - headers = h:receiveheaders() - -- at this point we should have a honest reply from the server - -- we can't redirect if we already used the source, so we report the error - if shouldredirect(nreqt, code, headers) and not nreqt.source then - h:close() - return tredirect(reqt, headers.location) - end - -- here we are finally done - if shouldreceivebody(nreqt, code) then - h:receivebody(headers, nreqt.sink, nreqt.step) - end - h:close() - return 1, code, headers, status -end - --- turns an url and a body into a generic request -local function genericform(u, b) - local t = {} - local reqt = { - url = u, - sink = ltn12.sink.table(t), - target = t - } - if b then - reqt.source = ltn12.source.string(b) - reqt.headers = { - ["content-length"] = string.len(b), - ["content-type"] = "application/x-www-form-urlencoded" - } - reqt.method = "POST" - end - return reqt -end - -_M.genericform = genericform - -local function srequest(u, b) - local reqt = genericform(u, b) - local _, code, headers, status = trequest(reqt) - return table.concat(reqt.target), code, headers, status -end - -_M.request = socket.protect(function(reqt, body) - if base.type(reqt) == "string" then return srequest(reqt, body) - else return trequest(reqt) end -end) - -return _M diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/http.lua.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/http.lua.h deleted file mode 100644 index 840cd85c..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/http.lua.h +++ /dev/null @@ -1,672 +0,0 @@ -/* code automatically generated by bin2c -- DO NOT EDIT */ -{ -/* #include'ing this file in a C program is equivalent to calling - if (luaL_loadfile(L,"http.lua")==0) lua_call(L, 0, LUA_MULTRET); -*/ -/* http.lua */ -static const unsigned char B1[]={ - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, - 32, 72, 84, 84, 80, 47, 49, 46, 49, 32, 99,108,105,101,110,116, 32,115,117,112, -112,111,114,116, 32,102,111,114, 32,116,104,101, 32, 76,117, 97, 32,108, 97,110, -103,117, 97,103,101, 46, 10, 45, 45, 32, 76,117, 97, 83,111, 99,107,101,116, 32, -116,111,111,108,107,105,116, 46, 10, 45, 45, 32, 65,117,116,104,111,114, 58, 32, - 68,105,101,103,111, 32, 78,101,104, 97, 98, 10, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 68,101, 99,108, 97,114,101, 32, -109,111,100,117,108,101, 32, 97,110,100, 32,105,109,112,111,114,116, 32,100,101, -112,101,110,100,101,110, 99,105,101,115, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10,108,111, 99, 97,108, 32,115,111, 99, -107,101,116, 32, 61, 32,114,101,113,117,105,114,101, 40, 34,115,111, 99,107,101, -116, 34, 41, 10,108,111, 99, 97,108, 32,117,114,108, 32, 61, 32,114,101,113,117, -105,114,101, 40, 34,115,111, 99,107,101,116, 46,117,114,108, 34, 41, 10,108,111, - 99, 97,108, 32,108,116,110, 49, 50, 32, 61, 32,114,101,113,117,105,114,101, 40, - 34,108,116,110, 49, 50, 34, 41, 10,108,111, 99, 97,108, 32,109,105,109,101, 32, - 61, 32,114,101,113,117,105,114,101, 40, 34,109,105,109,101, 34, 41, 10,108,111, - 99, 97,108, 32,115,116,114,105,110,103, 32, 61, 32,114,101,113,117,105,114,101, - 40, 34,115,116,114,105,110,103, 34, 41, 10,108,111, 99, 97,108, 32,104,101, 97, -100,101,114,115, 32, 61, 32,114,101,113,117,105,114,101, 40, 34,115,111, 99,107, -101,116, 46,104,101, 97,100,101,114,115, 34, 41, 10,108,111, 99, 97,108, 32, 98, - 97,115,101, 32, 61, 32, 95, 71, 10,108,111, 99, 97,108, 32,116, 97, 98,108,101, - 32, 61, 32,114,101,113,117,105,114,101, 40, 34,116, 97, 98,108,101, 34, 41, 10, -115,111, 99,107,101,116, 46,104,116,116,112, 32, 61, 32,123,125, 10,108,111, 99, - 97,108, 32, 95, 77, 32, 61, 32,115,111, 99,107,101,116, 46,104,116,116,112, 10, - 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, - 45, 32, 80,114,111,103,114, 97,109, 32, 99,111,110,115,116, 97,110,116,115, 10, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, - 32, 99,111,110,110,101, 99,116,105,111,110, 32,116,105,109,101,111,117,116, 32, -105,110, 32,115,101, 99,111,110,100,115, 10, 95, 77, 46, 84, 73, 77, 69, 79, 85, - 84, 32, 61, 32, 54, 48, 10, 45, 45, 32,117,115,101,114, 32, 97,103,101,110,116, - 32,102,105,101,108,100, 32,115,101,110,116, 32,105,110, 32,114,101,113,117,101, -115,116, 10, 95, 77, 46, 85, 83, 69, 82, 65, 71, 69, 78, 84, 32, 61, 32,115,111, - 99,107,101,116, 46, 95, 86, 69, 82, 83, 73, 79, 78, 10, 10, 45, 45, 32,115,117, -112,112,111,114,116,101,100, 32,115, 99,104,101,109,101,115, 10,108,111, 99, 97, -108, 32, 83, 67, 72, 69, 77, 69, 83, 32, 61, 32,123, 32, 91, 34,104,116,116,112, - 34, 93, 32, 61, 32,116,114,117,101, 32,125, 10, 45, 45, 32,100,101,102, 97,117, -108,116, 32,112,111,114,116, 32,102,111,114, 32,100,111, 99,117,109,101,110,116, - 32,114,101,116,114,105,101,118, 97,108, 10,108,111, 99, 97,108, 32, 80, 79, 82, - 84, 32, 61, 32, 56, 48, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 10, 45, 45, 32, 82,101, 97,100,115, 32, 77, 73, 77, 69, 32, -104,101, 97,100,101,114,115, 32,102,114,111,109, 32, 97, 32, 99,111,110,110,101, - 99,116,105,111,110, 44, 32,117,110,102,111,108,100,105,110,103, 32,119,104,101, -114,101, 32,110,101,101,100,101,100, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 10,108,111, 99, 97,108, 32,102,117,110, 99,116,105, -111,110, 32,114,101, 99,101,105,118,101,104,101, 97,100,101,114,115, 40,115,111, - 99,107, 44, 32,104,101, 97,100,101,114,115, 41, 10, 32, 32, 32, 32,108,111, 99, - 97,108, 32,108,105,110,101, 44, 32,110, 97,109,101, 44, 32,118, 97,108,117,101, - 44, 32,101,114,114, 10, 32, 32, 32, 32,104,101, 97,100,101,114,115, 32, 61, 32, -104,101, 97,100,101,114,115, 32,111,114, 32,123,125, 10, 32, 32, 32, 32, 45, 45, - 32,103,101,116, 32,102,105,114,115,116, 32,108,105,110,101, 10, 32, 32, 32, 32, -108,105,110,101, 44, 32,101,114,114, 32, 61, 32,115,111, 99,107, 58,114,101, 99, -101,105,118,101, 40, 41, 10, 32, 32, 32, 32,105,102, 32,101,114,114, 32,116,104, -101,110, 32,114,101,116,117,114,110, 32,110,105,108, 44, 32,101,114,114, 32,101, -110,100, 10, 32, 32, 32, 32, 45, 45, 32,104,101, 97,100,101,114,115, 32,103,111, - 32,117,110,116,105,108, 32, 97, 32, 98,108, 97,110,107, 32,108,105,110,101, 32, -105,115, 32,102,111,117,110,100, 10, 32, 32, 32, 32,119,104,105,108,101, 32,108, -105,110,101, 32,126, 61, 32, 34, 34, 32,100,111, 10, 32, 32, 32, 32, 32, 32, 32, - 32, 45, 45, 32,103,101,116, 32,102,105,101,108,100, 45,110, 97,109,101, 32, 97, -110,100, 32,118, 97,108,117,101, 10, 32, 32, 32, 32, 32, 32, 32, 32,110, 97,109, -101, 44, 32,118, 97,108,117,101, 32, 61, 32,115,111, 99,107,101,116, 46,115,107, -105,112, 40, 50, 44, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,108,105, -110,101, 44, 32, 34, 94, 40, 46, 45, 41, 58, 37,115, 42, 40, 46, 42, 41, 34, 41, - 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,110,111,116, 32, 40,110, 97, -109,101, 32, 97,110,100, 32,118, 97,108,117,101, 41, 32,116,104,101,110, 32,114, -101,116,117,114,110, 32,110,105,108, 44, 32, 34,109, 97,108,102,111,114,109,101, -100, 32,114,101,112,111,110,115,101, 32,104,101, 97,100,101,114,115, 34, 32,101, -110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32,110, 97,109,101, 32, 61, 32,115,116, -114,105,110,103, 46,108,111,119,101,114, 40,110, 97,109,101, 41, 10, 32, 32, 32, - 32, 32, 32, 32, 32, 45, 45, 32,103,101,116, 32,110,101,120,116, 32,108,105,110, -101, 32, 40,118, 97,108,117,101, 32,109,105,103,104,116, 32, 98,101, 32,102,111, -108,100,101,100, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,108,105,110,101, 44, 32, -101,114,114, 32, 32, 61, 32,115,111, 99,107, 58,114,101, 99,101,105,118,101, 40, - 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,101,114,114, 32,116,104,101, -110, 32,114,101,116,117,114,110, 32,110,105,108, 44, 32,101,114,114, 32,101,110, -100, 10, 32, 32, 32, 32, 32, 32, 32, 32, 45, 45, 32,117,110,102,111,108,100, 32, - 97,110,121, 32,102,111,108,100,101,100, 32,118, 97,108,117,101,115, 10, 32, 32, - 32, 32, 32, 32, 32, 32,119,104,105,108,101, 32,115,116,114,105,110,103, 46,102, -105,110,100, 40,108,105,110,101, 44, 32, 34, 94, 37,115, 34, 41, 32,100,111, 10, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,118, 97,108,117,101, 32, 61, 32, -118, 97,108,117,101, 32, 46, 46, 32,108,105,110,101, 10, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32,108,105,110,101, 32, 61, 32,115,111, 99,107, 58,114,101, - 99,101,105,118,101, 40, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, -105,102, 32,101,114,114, 32,116,104,101,110, 32,114,101,116,117,114,110, 32,110, -105,108, 44, 32,101,114,114, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, -101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, 45, 45, 32,115, 97,118,101, 32, -112, 97,105,114, 32,105,110, 32,116, 97, 98,108,101, 10, 32, 32, 32, 32, 32, 32, - 32, 32,105,102, 32,104,101, 97,100,101,114,115, 91,110, 97,109,101, 93, 32,116, -104,101,110, 32,104,101, 97,100,101,114,115, 91,110, 97,109,101, 93, 32, 61, 32, -104,101, 97,100,101,114,115, 91,110, 97,109,101, 93, 32, 46, 46, 32, 34, 44, 32, - 34, 32, 46, 46, 32,118, 97,108,117,101, 10, 32, 32, 32, 32, 32, 32, 32, 32,101, -108,115,101, 32,104,101, 97,100,101,114,115, 91,110, 97,109,101, 93, 32, 61, 32, -118, 97,108,117,101, 32,101,110,100, 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, - 32, 32,114,101,116,117,114,110, 32,104,101, 97,100,101,114,115, 10,101,110,100, - 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, - 45, 45, 32, 69,120,116,114, 97, 32,115,111,117,114, 99,101,115, 32, 97,110,100, - 32,115,105,110,107,115, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 10,115,111, 99,107,101,116, 46,115,111,117,114, 99,101,116, 91, - 34,104,116,116,112, 45, 99,104,117,110,107,101,100, 34, 93, 32, 61, 32,102,117, -110, 99,116,105,111,110, 40,115,111, 99,107, 44, 32,104,101, 97,100,101,114,115, - 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32, 98, 97,115,101, 46,115,101, -116,109,101,116, 97,116, 97, 98,108,101, 40,123, 10, 32, 32, 32, 32, 32, 32, 32, - 32,103,101,116,102,100, 32, 61, 32,102,117,110, 99,116,105,111,110, 40, 41, 32, -114,101,116,117,114,110, 32,115,111, 99,107, 58,103,101,116,102,100, 40, 41, 32, -101,110,100, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32,100,105,114,116,121, 32, 61, - 32,102,117,110, 99,116,105,111,110, 40, 41, 32,114,101,116,117,114,110, 32,115, -111, 99,107, 58,100,105,114,116,121, 40, 41, 32,101,110,100, 10, 32, 32, 32, 32, -125, 44, 32,123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 95, 95, 99, 97,108,108, 32, - 61, 32,102,117,110, 99,116,105,111,110, 40, 41, 10, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 45, 45, 32,103,101,116, 32, 99,104,117,110,107, 32,115,105, -122,101, 44, 32,115,107,105,112, 32,101,120,116,101,110,116,105,111,110, 10, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,108,111, 99, 97,108, 32,108,105,110, -101, 44, 32,101,114,114, 32, 61, 32,115,111, 99,107, 58,114,101, 99,101,105,118, -101, 40, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,101, -114,114, 32,116,104,101,110, 32,114,101,116,117,114,110, 32,110,105,108, 44, 32, -101,114,114, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, -108,111, 99, 97,108, 32,115,105,122,101, 32, 61, 32, 98, 97,115,101, 46,116,111, -110,117,109, 98,101,114, 40,115,116,114,105,110,103, 46,103,115,117, 98, 40,108, -105,110,101, 44, 32, 34, 59, 46, 42, 34, 44, 32, 34, 34, 41, 44, 32, 49, 54, 41, - 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,110,111,116, 32, -115,105,122,101, 32,116,104,101,110, 32,114,101,116,117,114,110, 32,110,105,108, - 44, 32, 34,105,110,118, 97,108,105,100, 32, 99,104,117,110,107, 32,115,105,122, -101, 34, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 45, - 45, 32,119, 97,115, 32,105,116, 32,116,104,101, 32,108, 97,115,116, 32, 99,104, -117,110,107, 63, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32, -115,105,122,101, 32, 62, 32, 48, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 45, 45, 32,105,102, 32,110,111,116, 44, - 32,103,101,116, 32, 99,104,117,110,107, 32, 97,110,100, 32,115,107,105,112, 32, -116,101,114,109,105,110, 97,116,105,110,103, 32, 67, 82, 76, 70, 10, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,108,111, 99, 97,108, 32, 99, -104,117,110,107, 44, 32,101,114,114, 44, 32,112, 97,114,116, 32, 61, 32,115,111, - 99,107, 58,114,101, 99,101,105,118,101, 40,115,105,122,101, 41, 10, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32, 99,104,117,110, -107, 32,116,104,101,110, 32,115,111, 99,107, 58,114,101, 99,101,105,118,101, 40, - 41, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32,114,101,116,117,114,110, 32, 99,104,117,110,107, 44, 32,101,114,114, 10, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,108,115,101, 10, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 45, 45, 32,105,102, 32,105, -116, 32,119, 97,115, 44, 32,114,101, 97,100, 32,116,114, 97,105,108,101,114,115, - 32,105,110,116,111, 32,104,101, 97,100,101,114,115, 32,116, 97, 98,108,101, 10, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,104,101, 97,100, -101,114,115, 44, 32,101,114,114, 32, 61, 32,114,101, 99,101,105,118,101,104,101, - 97,100,101,114,115, 40,115,111, 99,107, 44, 32,104,101, 97,100,101,114,115, 41, - 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32, -110,111,116, 32,104,101, 97,100,101,114,115, 32,116,104,101,110, 32,114,101,116, -117,114,110, 32,110,105,108, 44, 32,101,114,114, 32,101,110,100, 10, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, - 32,101,110,100, 10, 32, 32, 32, 32,125, 41, 10,101,110,100, 10, 10,115,111, 99, -107,101,116, 46,115,105,110,107,116, 91, 34,104,116,116,112, 45, 99,104,117,110, -107,101,100, 34, 93, 32, 61, 32,102,117,110, 99,116,105,111,110, 40,115,111, 99, -107, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32, 98, 97,115,101, 46,115, -101,116,109,101,116, 97,116, 97, 98,108,101, 40,123, 10, 32, 32, 32, 32, 32, 32, - 32, 32,103,101,116,102,100, 32, 61, 32,102,117,110, 99,116,105,111,110, 40, 41, - 32,114,101,116,117,114,110, 32,115,111, 99,107, 58,103,101,116,102,100, 40, 41, - 32,101,110,100, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32,100,105,114,116,121, 32, - 61, 32,102,117,110, 99,116,105,111,110, 40, 41, 32,114,101,116,117,114,110, 32, -115,111, 99,107, 58,100,105,114,116,121, 40, 41, 32,101,110,100, 10, 32, 32, 32, - 32,125, 44, 32,123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 95, 95, 99, 97,108,108, - 32, 61, 32,102,117,110, 99,116,105,111,110, 40,115,101,108,102, 44, 32, 99,104, -117,110,107, 44, 32,101,114,114, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32,105,102, 32,110,111,116, 32, 99,104,117,110,107, 32,116,104,101,110, 32, -114,101,116,117,114,110, 32,115,111, 99,107, 58,115,101,110,100, 40, 34, 48, 92, -114, 92,110, 92,114, 92,110, 34, 41, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32,108,111, 99, 97,108, 32,115,105,122,101, 32, 61, 32,115, -116,114,105,110,103, 46,102,111,114,109, 97,116, 40, 34, 37, 88, 92,114, 92,110, - 34, 44, 32,115,116,114,105,110,103, 46,108,101,110, 40, 99,104,117,110,107, 41, - 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114,110, - 32,115,111, 99,107, 58,115,101,110,100, 40,115,105,122,101, 32, 46, 46, 32, 32, - 99,104,117,110,107, 32, 46, 46, 32, 34, 92,114, 92,110, 34, 41, 10, 32, 32, 32, - 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,125, 41, 10,101,110,100, 10, - 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, - 45, 32, 76,111,119, 32,108,101,118,101,108, 32, 72, 84, 84, 80, 32, 65, 80, 73, - 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10,108, -111, 99, 97,108, 32,109,101,116, 97,116, 32, 61, 32,123, 32, 95, 95,105,110,100, -101,120, 32, 61, 32,123,125, 32,125, 10, 10,102,117,110, 99,116,105,111,110, 32, - 95, 77, 46,111,112,101,110, 40,104,111,115,116, 44, 32,112,111,114,116, 44, 32, - 99,114,101, 97,116,101, 41, 10, 32, 32, 32, 32, 45, 45, 32, 99,114,101, 97,116, -101, 32,115,111, 99,107,101,116, 32,119,105,116,104, 32,117,115,101,114, 32, 99, -111,110,110,101, 99,116, 32,102,117,110, 99,116,105,111,110, 44, 32,111,114, 32, -119,105,116,104, 32,100,101,102, 97,117,108,116, 10, 32, 32, 32, 32,108,111, 99, - 97,108, 32, 99, 32, 61, 32,115,111, 99,107,101,116, 46,116,114,121, 40, 40, 99, -114,101, 97,116,101, 32,111,114, 32,115,111, 99,107,101,116, 46,116, 99,112, 41, - 40, 41, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,104, 32, 61, 32, 98, 97, -115,101, 46,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,123, 32, 99, 32, - 61, 32, 99, 32,125, 44, 32,109,101,116, 97,116, 41, 10, 32, 32, 32, 32, 45, 45, - 32, 99,114,101, 97,116,101, 32,102,105,110, 97,108,105,122,101,100, 32,116,114, -121, 10, 32, 32, 32, 32,104, 46,116,114,121, 32, 61, 32,115,111, 99,107,101,116, - 46,110,101,119,116,114,121, 40,102,117,110, 99,116,105,111,110, 40, 41, 32,104, - 58, 99,108,111,115,101, 40, 41, 32,101,110,100, 41, 10, 32, 32, 32, 32, 45, 45, - 32,115,101,116, 32,116,105,109,101,111,117,116, 32, 98,101,102,111,114,101, 32, - 99,111,110,110,101, 99,116,105,110,103, 10, 32, 32, 32, 32,104, 46,116,114,121, - 40, 99, 58,115,101,116,116,105,109,101,111,117,116, 40, 95, 77, 46, 84, 73, 77, - 69, 79, 85, 84, 41, 41, 10, 32, 32, 32, 32,104, 46,116,114,121, 40, 99, 58, 99, -111,110,110,101, 99,116, 40,104,111,115,116, 44, 32,112,111,114,116, 32,111,114, - 32, 80, 79, 82, 84, 41, 41, 10, 32, 32, 32, 32, 45, 45, 32,104,101,114,101, 32, -101,118,101,114,121,116,104,105,110,103, 32,119,111,114,107,101,100, 10, 32, 32, - 32, 32,114,101,116,117,114,110, 32,104, 10,101,110,100, 10, 10,102,117,110, 99, -116,105,111,110, 32,109,101,116, 97,116, 46, 95, 95,105,110,100,101,120, 58,115, -101,110,100,114,101,113,117,101,115,116,108,105,110,101, 40,109,101,116,104,111, -100, 44, 32,117,114,105, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,114,101, -113,108,105,110,101, 32, 61, 32,115,116,114,105,110,103, 46,102,111,114,109, 97, -116, 40, 34, 37,115, 32, 37,115, 32, 72, 84, 84, 80, 47, 49, 46, 49, 92,114, 92, -110, 34, 44, 32,109,101,116,104,111,100, 32,111,114, 32, 34, 71, 69, 84, 34, 44, - 32,117,114,105, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,115,101,108, -102, 46,116,114,121, 40,115,101,108,102, 46, 99, 58,115,101,110,100, 40,114,101, -113,108,105,110,101, 41, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111, -110, 32,109,101,116, 97,116, 46, 95, 95,105,110,100,101,120, 58,115,101,110,100, -104,101, 97,100,101,114,115, 40,116,111,115,101,110,100, 41, 10, 32, 32, 32, 32, -108,111, 99, 97,108, 32, 99, 97,110,111,110,105, 99, 32, 61, 32,104,101, 97,100, -101,114,115, 46, 99, 97,110,111,110,105, 99, 10, 32, 32, 32, 32,108,111, 99, 97, -108, 32,104, 32, 61, 32, 34, 92,114, 92,110, 34, 10, 32, 32, 32, 32,102,111,114, - 32,102, 44, 32,118, 32,105,110, 32, 98, 97,115,101, 46,112, 97,105,114,115, 40, -116,111,115,101,110,100, 41, 32,100,111, 10, 32, 32, 32, 32, 32, 32, 32, 32,104, - 32, 61, 32, 40, 99, 97,110,111,110,105, 99, 91,102, 93, 32,111,114, 32,102, 41, - 32, 46, 46, 32, 34, 58, 32, 34, 32, 46, 46, 32,118, 32, 46, 46, 32, 34, 92,114, - 92,110, 34, 32, 46, 46, 32,104, 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, - 32,115,101,108,102, 46,116,114,121, 40,115,101,108,102, 46, 99, 58,115,101,110, -100, 40,104, 41, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32, 49, 10,101, -110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,109,101,116, 97,116, 46, 95, - 95,105,110,100,101,120, 58,115,101,110,100, 98,111,100,121, 40,104,101, 97,100, -101,114,115, 44, 32,115,111,117,114, 99,101, 44, 32,115,116,101,112, 41, 10, 32, - 32, 32, 32,115,111,117,114, 99,101, 32, 61, 32,115,111,117,114, 99,101, 32,111, -114, 32,108,116,110, 49, 50, 46,115,111,117,114, 99,101, 46,101,109,112,116,121, - 40, 41, 10, 32, 32, 32, 32,115,116,101,112, 32, 61, 32,115,116,101,112, 32,111, -114, 32,108,116,110, 49, 50, 46,112,117,109,112, 46,115,116,101,112, 10, 32, 32, - 32, 32, 45, 45, 32,105,102, 32,119,101, 32,100,111,110, 39,116, 32,107,110,111, -119, 32,116,104,101, 32,115,105,122,101, 32,105,110, 32, 97,100,118, 97,110, 99, -101, 44, 32,115,101,110,100, 32, 99,104,117,110,107,101,100, 32, 97,110,100, 32, -104,111,112,101, 32,102,111,114, 32,116,104,101, 32, 98,101,115,116, 10, 32, 32, - 32, 32,108,111, 99, 97,108, 32,109,111,100,101, 32, 61, 32, 34,104,116,116,112, - 45, 99,104,117,110,107,101,100, 34, 10, 32, 32, 32, 32,105,102, 32,104,101, 97, -100,101,114,115, 91, 34, 99,111,110,116,101,110,116, 45,108,101,110,103,116,104, - 34, 93, 32,116,104,101,110, 32,109,111,100,101, 32, 61, 32, 34,107,101,101,112, - 45,111,112,101,110, 34, 32,101,110,100, 10, 32, 32, 32, 32,114,101,116,117,114, -110, 32,115,101,108,102, 46,116,114,121, 40,108,116,110, 49, 50, 46,112,117,109, -112, 46, 97,108,108, 40,115,111,117,114, 99,101, 44, 32,115,111, 99,107,101,116, - 46,115,105,110,107, 40,109,111,100,101, 44, 32,115,101,108,102, 46, 99, 41, 44, - 32,115,116,101,112, 41, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111, -110, 32,109,101,116, 97,116, 46, 95, 95,105,110,100,101,120, 58,114,101, 99,101, -105,118,101,115,116, 97,116,117,115,108,105,110,101, 40, 41, 10, 32, 32, 32, 32, -108,111, 99, 97,108, 32,115,116, 97,116,117,115, 32, 61, 32,115,101,108,102, 46, -116,114,121, 40,115,101,108,102, 46, 99, 58,114,101, 99,101,105,118,101, 40, 53, - 41, 41, 10, 32, 32, 32, 32, 45, 45, 32,105,100,101,110,116,105,102,121, 32, 72, - 84, 84, 80, 47, 48, 46, 57, 32,114,101,115,112,111,110,115,101,115, 44, 32,119, -104,105, 99,104, 32,100,111, 32,110,111,116, 32, 99,111,110,116, 97,105,110, 32, - 97, 32,115,116, 97,116,117,115, 32,108,105,110,101, 10, 32, 32, 32, 32, 45, 45, - 32,116,104,105,115, 32,105,115, 32,106,117,115,116, 32, 97, 32,104,101,117,114, -105,115,116,105, 99, 44, 32, 98,117,116, 32,105,115, 32,119,104, 97,116, 32,116, -104,101, 32, 82, 70, 67, 32,114,101, 99,111,109,109,101,110,100,115, 10, 32, 32, - 32, 32,105,102, 32,115,116, 97,116,117,115, 32,126, 61, 32, 34, 72, 84, 84, 80, - 47, 34, 32,116,104,101,110, 32,114,101,116,117,114,110, 32,110,105,108, 44, 32, -115,116, 97,116,117,115, 32,101,110,100, 10, 32, 32, 32, 32, 45, 45, 32,111,116, -104,101,114,119,105,115,101, 32,112,114,111, 99,101,101,100, 32,114,101, 97,100, -105,110,103, 32, 97, 32,115,116, 97,116,117,115, 32,108,105,110,101, 10, 32, 32, - 32, 32,115,116, 97,116,117,115, 32, 61, 32,115,101,108,102, 46,116,114,121, 40, -115,101,108,102, 46, 99, 58,114,101, 99,101,105,118,101, 40, 34, 42,108, 34, 44, - 32,115,116, 97,116,117,115, 41, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32, - 99,111,100,101, 32, 61, 32,115,111, 99,107,101,116, 46,115,107,105,112, 40, 50, - 44, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,115,116, 97,116,117,115, - 44, 32, 34, 72, 84, 84, 80, 47, 37,100, 42, 37, 46, 37,100, 42, 32, 40, 37,100, - 37,100, 37,100, 41, 34, 41, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32, -115,101,108,102, 46,116,114,121, 40, 98, 97,115,101, 46,116,111,110,117,109, 98, -101,114, 40, 99,111,100,101, 41, 44, 32,115,116, 97,116,117,115, 41, 10,101,110, -100, 10, 10,102,117,110, 99,116,105,111,110, 32,109,101,116, 97,116, 46, 95, 95, -105,110,100,101,120, 58,114,101, 99,101,105,118,101,104,101, 97,100,101,114,115, - 40, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,115,101,108,102, 46,116, -114,121, 40,114,101, 99,101,105,118,101,104,101, 97,100,101,114,115, 40,115,101, -108,102, 46, 99, 41, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, - 32,109,101,116, 97,116, 46, 95, 95,105,110,100,101,120, 58,114,101, 99,101,105, -118,101, 98,111,100,121, 40,104,101, 97,100,101,114,115, 44, 32,115,105,110,107, - 44, 32,115,116,101,112, 41, 10, 32, 32, 32, 32,115,105,110,107, 32, 61, 32,115, -105,110,107, 32,111,114, 32,108,116,110, 49, 50, 46,115,105,110,107, 46,110,117, -108,108, 40, 41, 10, 32, 32, 32, 32,115,116,101,112, 32, 61, 32,115,116,101,112, - 32,111,114, 32,108,116,110, 49, 50, 46,112,117,109,112, 46,115,116,101,112, 10, - 32, 32, 32, 32,108,111, 99, 97,108, 32,108,101,110,103,116,104, 32, 61, 32, 98, - 97,115,101, 46,116,111,110,117,109, 98,101,114, 40,104,101, 97,100,101,114,115, - 91, 34, 99,111,110,116,101,110,116, 45,108,101,110,103,116,104, 34, 93, 41, 10, - 32, 32, 32, 32,108,111, 99, 97,108, 32,116, 32, 61, 32,104,101, 97,100,101,114, -115, 91, 34,116,114, 97,110,115,102,101,114, 45,101,110, 99,111,100,105,110,103, - 34, 93, 32, 45, 45, 32,115,104,111,114,116, 99,117,116, 10, 32, 32, 32, 32,108, -111, 99, 97,108, 32,109,111,100,101, 32, 61, 32, 34,100,101,102, 97,117,108,116, - 34, 32, 45, 45, 32, 99,111,110,110,101, 99,116,105,111,110, 32, 99,108,111,115, -101, 10, 32, 32, 32, 32,105,102, 32,116, 32, 97,110,100, 32,116, 32,126, 61, 32, - 34,105,100,101,110,116,105,116,121, 34, 32,116,104,101,110, 32,109,111,100,101, - 32, 61, 32, 34,104,116,116,112, 45, 99,104,117,110,107,101,100, 34, 10, 32, 32, - 32, 32,101,108,115,101,105,102, 32, 98, 97,115,101, 46,116,111,110,117,109, 98, -101,114, 40,104,101, 97,100,101,114,115, 91, 34, 99,111,110,116,101,110,116, 45, -108,101,110,103,116,104, 34, 93, 41, 32,116,104,101,110, 32,109,111,100,101, 32, - 61, 32, 34, 98,121, 45,108,101,110,103,116,104, 34, 32,101,110,100, 10, 32, 32, - 32, 32,114,101,116,117,114,110, 32,115,101,108,102, 46,116,114,121, 40,108,116, -110, 49, 50, 46,112,117,109,112, 46, 97,108,108, 40,115,111, 99,107,101,116, 46, -115,111,117,114, 99,101, 40,109,111,100,101, 44, 32,115,101,108,102, 46, 99, 44, - 32,108,101,110,103,116,104, 41, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32,115,105, -110,107, 44, 32,115,116,101,112, 41, 41, 10,101,110,100, 10, 10,102,117,110, 99, -116,105,111,110, 32,109,101,116, 97,116, 46, 95, 95,105,110,100,101,120, 58,114, -101, 99,101,105,118,101, 48, 57, 98,111,100,121, 40,115,116, 97,116,117,115, 44, - 32,115,105,110,107, 44, 32,115,116,101,112, 41, 10, 32, 32, 32, 32,108,111, 99, - 97,108, 32,115,111,117,114, 99,101, 32, 61, 32,108,116,110, 49, 50, 46,115,111, -117,114, 99,101, 46,114,101,119,105,110,100, 40,115,111, 99,107,101,116, 46,115, -111,117,114, 99,101, 40, 34,117,110,116,105,108, 45, 99,108,111,115,101,100, 34, - 44, 32,115,101,108,102, 46, 99, 41, 41, 10, 32, 32, 32, 32,115,111,117,114, 99, -101, 40,115,116, 97,116,117,115, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, - 32,115,101,108,102, 46,116,114,121, 40,108,116,110, 49, 50, 46,112,117,109,112, - 46, 97,108,108, 40,115,111,117,114, 99,101, 44, 32,115,105,110,107, 44, 32,115, -116,101,112, 41, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32, -109,101,116, 97,116, 46, 95, 95,105,110,100,101,120, 58, 99,108,111,115,101, 40, - 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,115,101,108,102, 46, 99, 58, - 99,108,111,115,101, 40, 41, 10,101,110,100, 10, 10, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 72,105,103,104, 32,108, -101,118,101,108, 32, 72, 84, 84, 80, 32, 65, 80, 73, 10, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10,108,111, 99, 97,108, 32,102,117, -110, 99,116,105,111,110, 32, 97,100,106,117,115,116,117,114,105, 40,114,101,113, -116, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,117, 32, 61, 32,114,101,113, -116, 10, 32, 32, 32, 32, 45, 45, 32,105,102, 32,116,104,101,114,101, 32,105,115, - 32, 97, 32,112,114,111,120,121, 44, 32,119,101, 32,110,101,101,100, 32,116,104, -101, 32,102,117,108,108, 32,117,114,108, 46, 32,111,116,104,101,114,119,105,115, -101, 44, 32,106,117,115,116, 32, 97, 32,112, 97,114,116, 46, 10, 32, 32, 32, 32, -105,102, 32,110,111,116, 32,114,101,113,116, 46,112,114,111,120,121, 32, 97,110, -100, 32,110,111,116, 32, 95, 77, 46, 80, 82, 79, 88, 89, 32,116,104,101,110, 10, - 32, 32, 32, 32, 32, 32, 32, 32,117, 32, 61, 32,123, 10, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32,112, 97,116,104, 32, 61, 32,115,111, 99,107,101,116, 46,116, -114,121, 40,114,101,113,116, 46,112, 97,116,104, 44, 32, 34,105,110,118, 97,108, -105,100, 32,112, 97,116,104, 32, 39,110,105,108, 39, 34, 41, 44, 10, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32,112, 97,114, 97,109,115, 32, 61, 32,114,101,113, -116, 46,112, 97,114, 97,109,115, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32,113,117,101,114,121, 32, 61, 32,114,101,113,116, 46,113,117,101,114,121, 44, - 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102,114, 97,103,109,101,110,116, - 32, 61, 32,114,101,113,116, 46,102,114, 97,103,109,101,110,116, 10, 32, 32, 32, - 32, 32, 32, 32, 32,125, 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,114, -101,116,117,114,110, 32,117,114,108, 46, 98,117,105,108,100, 40,117, 41, 10,101, -110,100, 10, 10,108,111, 99, 97,108, 32,102,117,110, 99,116,105,111,110, 32, 97, -100,106,117,115,116,112,114,111,120,121, 40,114,101,113,116, 41, 10, 32, 32, 32, - 32,108,111, 99, 97,108, 32,112,114,111,120,121, 32, 61, 32,114,101,113,116, 46, -112,114,111,120,121, 32,111,114, 32, 95, 77, 46, 80, 82, 79, 88, 89, 10, 32, 32, - 32, 32,105,102, 32,112,114,111,120,121, 32,116,104,101,110, 10, 32, 32, 32, 32, - 32, 32, 32, 32,112,114,111,120,121, 32, 61, 32,117,114,108, 46,112, 97,114,115, -101, 40,112,114,111,120,121, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116, -117,114,110, 32,112,114,111,120,121, 46,104,111,115,116, 44, 32,112,114,111,120, -121, 46,112,111,114,116, 32,111,114, 32, 51, 49, 50, 56, 10, 32, 32, 32, 32,101, -108,115,101, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114,110, 32,114, -101,113,116, 46,104,111,115,116, 44, 32,114,101,113,116, 46,112,111,114,116, 10, - 32, 32, 32, 32,101,110,100, 10,101,110,100, 10, 10,108,111, 99, 97,108, 32,102, -117,110, 99,116,105,111,110, 32, 97,100,106,117,115,116,104,101, 97,100,101,114, -115, 40,114,101,113,116, 41, 10, 32, 32, 32, 32, 45, 45, 32,100,101,102, 97,117, -108,116, 32,104,101, 97,100,101,114,115, 10, 32, 32, 32, 32,108,111, 99, 97,108, - 32,104,111,115,116, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40, -114,101,113,116, 46, 97,117,116,104,111,114,105,116,121, 44, 32, 34, 94, 46, 45, - 64, 34, 44, 32, 34, 34, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,108,111, -119,101,114, 32, 61, 32,123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 91, 34,117,115, -101,114, 45, 97,103,101,110,116, 34, 93, 32, 61, 32, 95, 77, 46, 85, 83, 69, 82, - 65, 71, 69, 78, 84, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 91, 34,104,111,115, -116, 34, 93, 32, 61, 32,104,111,115,116, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, - 91, 34, 99,111,110,110,101, 99,116,105,111,110, 34, 93, 32, 61, 32, 34, 99,108, -111,115,101, 44, 32, 84, 69, 34, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 91, 34, -116,101, 34, 93, 32, 61, 32, 34,116,114, 97,105,108,101,114,115, 34, 10, 32, 32, - 32, 32,125, 10, 32, 32, 32, 32, 45, 45, 32,105,102, 32,119,101, 32,104, 97,118, -101, 32, 97,117,116,104,101,110,116,105, 99, 97,116,105,111,110, 32,105,110,102, -111,114,109, 97,116,105,111,110, 44, 32,112, 97,115,115, 32,105,116, 32, 97,108, -111,110,103, 10, 32, 32, 32, 32,105,102, 32,114,101,113,116, 46,117,115,101,114, - 32, 97,110,100, 32,114,101,113,116, 46,112, 97,115,115,119,111,114,100, 32,116, -104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32,108,111,119,101,114, 91, 34, 97, -117,116,104,111,114,105,122, 97,116,105,111,110, 34, 93, 32, 61, 10, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 34, 66, 97,115,105, 99, 32, 34, 32, 46, 46, - 32, 32, 40,109,105,109,101, 46, 98, 54, 52, 40,114,101,113,116, 46,117,115,101, -114, 32, 46, 46, 32, 34, 58, 34, 32, 46, 46, 10, 9, 9,117,114,108, 46,117,110, -101,115, 99, 97,112,101, 40,114,101,113,116, 46,112, 97,115,115,119,111,114,100, - 41, 41, 41, 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, 45, 45, 32,105, -102, 32,119,101, 32,104, 97,118,101, 32,112,114,111,120,121, 32, 97,117,116,104, -101,110,116,105, 99, 97,116,105,111,110, 32,105,110,102,111,114,109, 97,116,105, -111,110, 44, 32,112, 97,115,115, 32,105,116, 32, 97,108,111,110,103, 10, 32, 32, - 32, 32,108,111, 99, 97,108, 32,112,114,111,120,121, 32, 61, 32,114,101,113,116, - 46,112,114,111,120,121, 32,111,114, 32, 95, 77, 46, 80, 82, 79, 88, 89, 10, 32, - 32, 32, 32,105,102, 32,112,114,111,120,121, 32,116,104,101,110, 10, 32, 32, 32, - 32, 32, 32, 32, 32,112,114,111,120,121, 32, 61, 32,117,114,108, 46,112, 97,114, -115,101, 40,112,114,111,120,121, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,105,102, - 32,112,114,111,120,121, 46,117,115,101,114, 32, 97,110,100, 32,112,114,111,120, -121, 46,112, 97,115,115,119,111,114,100, 32,116,104,101,110, 10, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32,108,111,119,101,114, 91, 34,112,114,111,120,121, - 45, 97,117,116,104,111,114,105,122, 97,116,105,111,110, 34, 93, 32, 61, 10, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 34, 66, 97,115,105, - 99, 32, 34, 32, 46, 46, 32, 32, 40,109,105,109,101, 46, 98, 54, 52, 40,112,114, -111,120,121, 46,117,115,101,114, 32, 46, 46, 32, 34, 58, 34, 32, 46, 46, 32,112, -114,111,120,121, 46,112, 97,115,115,119,111,114,100, 41, 41, 10, 32, 32, 32, 32, - 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, - 45, 45, 32,111,118,101,114,114,105,100,101, 32,119,105,116,104, 32,117,115,101, -114, 32,104,101, 97,100,101,114,115, 10, 32, 32, 32, 32,102,111,114, 32,105, 44, -118, 32,105,110, 32, 98, 97,115,101, 46,112, 97,105,114,115, 40,114,101,113,116, - 46,104,101, 97,100,101,114,115, 32,111,114, 32,108,111,119,101,114, 41, 32,100, -111, 10, 32, 32, 32, 32, 32, 32, 32, 32,108,111,119,101,114, 91,115,116,114,105, -110,103, 46,108,111,119,101,114, 40,105, 41, 93, 32, 61, 32,118, 10, 32, 32, 32, - 32,101,110,100, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,108,111,119,101, -114, 10,101,110,100, 10, 10, 45, 45, 32,100,101,102, 97,117,108,116, 32,117,114, -108, 32,112, 97,114,116,115, 10,108,111, 99, 97,108, 32,100,101,102, 97,117,108, -116, 32, 61, 32,123, 10, 32, 32, 32, 32,104,111,115,116, 32, 61, 32, 34, 34, 44, - 10, 32, 32, 32, 32,112,111,114,116, 32, 61, 32, 80, 79, 82, 84, 44, 10, 32, 32, - 32, 32,112, 97,116,104, 32, 61, 34, 47, 34, 44, 10, 32, 32, 32, 32,115, 99,104, -101,109,101, 32, 61, 32, 34,104,116,116,112, 34, 10,125, 10, 10,108,111, 99, 97, -108, 32,102,117,110, 99,116,105,111,110, 32, 97,100,106,117,115,116,114,101,113, -117,101,115,116, 40,114,101,113,116, 41, 10, 32, 32, 32, 32, 45, 45, 32,112, 97, -114,115,101, 32,117,114,108, 32,105,102, 32,112,114,111,118,105,100,101,100, 10, - 32, 32, 32, 32,108,111, 99, 97,108, 32,110,114,101,113,116, 32, 61, 32,114,101, -113,116, 46,117,114,108, 32, 97,110,100, 32,117,114,108, 46,112, 97,114,115,101, - 40,114,101,113,116, 46,117,114,108, 44, 32,100,101,102, 97,117,108,116, 41, 32, -111,114, 32,123,125, 10, 32, 32, 32, 32, 45, 45, 32,101,120,112,108,105, 99,105, -116, 32, 99,111,109,112,111,110,101,110,116,115, 32,111,118,101,114,114,105,100, -101, 32,117,114,108, 10, 32, 32, 32, 32,102,111,114, 32,105, 44,118, 32,105,110, - 32, 98, 97,115,101, 46,112, 97,105,114,115, 40,114,101,113,116, 41, 32,100,111, - 32,110,114,101,113,116, 91,105, 93, 32, 61, 32,118, 32,101,110,100, 10, 32, 32, - 32, 32,105,102, 32,110,114,101,113,116, 46,112,111,114,116, 32, 61, 61, 32, 34, - 34, 32,116,104,101,110, 32,110,114,101,113,116, 46,112,111,114,116, 32, 61, 32, - 80, 79, 82, 84, 32,101,110,100, 10, 32, 32, 32, 32,105,102, 32,110,111,116, 32, - 40,110,114,101,113,116, 46,104,111,115,116, 32, 97,110,100, 32,110,114,101,113, -116, 46,104,111,115,116, 32,126, 61, 32, 34, 34, 41, 32,116,104,101,110, 10, 32, - 32, 32, 32, 32, 32, 32, 32,115,111, 99,107,101,116, 46,116,114,121, 40,110,105, -108, 44, 32, 34,105,110,118, 97,108,105,100, 32,104,111,115,116, 32, 39, 34, 32, - 46, 46, 32, 98, 97,115,101, 46,116,111,115,116,114,105,110,103, 40,110,114,101, -113,116, 46,104,111,115,116, 41, 32, 46, 46, 32, 34, 39, 34, 41, 10, 32, 32, 32, - 32,101,110,100, 10, 32, 32, 32, 32, 45, 45, 32, 99,111,109,112,117,116,101, 32, -117,114,105, 32,105,102, 32,117,115,101,114, 32,104, 97,115,110, 39,116, 32,111, -118,101,114,114,105,100,101,110, 10, 32, 32, 32, 32,110,114,101,113,116, 46,117, -114,105, 32, 61, 32,114,101,113,116, 46,117,114,105, 32,111,114, 32, 97,100,106, -117,115,116,117,114,105, 40,110,114,101,113,116, 41, 10, 32, 32, 32, 32, 45, 45, - 32, 97,100,106,117,115,116, 32,104,101, 97,100,101,114,115, 32,105,110, 32,114, -101,113,117,101,115,116, 10, 32, 32, 32, 32,110,114,101,113,116, 46,104,101, 97, -100,101,114,115, 32, 61, 32, 97,100,106,117,115,116,104,101, 97,100,101,114,115, - 40,110,114,101,113,116, 41, 10, 32, 32, 32, 32, 45, 45, 32, 97,106,117,115,116, - 32,104,111,115,116, 32, 97,110,100, 32,112,111,114,116, 32,105,102, 32,116,104, -101,114,101, 32,105,115, 32, 97, 32,112,114,111,120,121, 10, 32, 32, 32, 32,110, -114,101,113,116, 46,104,111,115,116, 44, 32,110,114,101,113,116, 46,112,111,114, -116, 32, 61, 32, 97,100,106,117,115,116,112,114,111,120,121, 40,110,114,101,113, -116, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,110,114,101,113,116, 10, -101,110,100, 10, 10,108,111, 99, 97,108, 32,102,117,110, 99,116,105,111,110, 32, -115,104,111,117,108,100,114,101,100,105,114,101, 99,116, 40,114,101,113,116, 44, - 32, 99,111,100,101, 44, 32,104,101, 97,100,101,114,115, 41, 10, 32, 32, 32, 32, -108,111, 99, 97,108, 32,108,111, 99, 97,116,105,111,110, 32, 61, 32,104,101, 97, -100,101,114,115, 46,108,111, 99, 97,116,105,111,110, 10, 32, 32, 32, 32,105,102, - 32,110,111,116, 32,108,111, 99, 97,116,105,111,110, 32,116,104,101,110, 32,114, -101,116,117,114,110, 32,102, 97,108,115,101, 32,101,110,100, 10, 32, 32, 32, 32, -108,111, 99, 97,116,105,111,110, 32, 61, 32,115,116,114,105,110,103, 46,103,115, -117, 98, 40,108,111, 99, 97,116,105,111,110, 44, 32, 34, 37,115, 34, 44, 32, 34, - 34, 41, 10, 32, 32, 32, 32,105,102, 32,108,111, 99, 97,116,105,111,110, 32, 61, - 61, 32, 34, 34, 32,116,104,101,110, 32,114,101,116,117,114,110, 32,102, 97,108, -115,101, 32,101,110,100, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,115, 99,104, -101,109,101, 32, 61, 32,115,116,114,105,110,103, 46,109, 97,116, 99,104, 40,108, -111, 99, 97,116,105,111,110, 44, 32, 34, 94, 40, 91, 37,119, 93, 91, 37,119, 37, - 43, 37, 45, 37, 46, 93, 42, 41, 37, 58, 34, 41, 10, 32, 32, 32, 32,105,102, 32, -115, 99,104,101,109,101, 32, 97,110,100, 32,110,111,116, 32, 83, 67, 72, 69, 77, - 69, 83, 91,115, 99,104,101,109,101, 93, 32,116,104,101,110, 32,114,101,116,117, -114,110, 32,102, 97,108,115,101, 32,101,110,100, 10, 32, 32, 32, 32,114,101,116, -117,114,110, 32, 40,114,101,113,116, 46,114,101,100,105,114,101, 99,116, 32,126, - 61, 32,102, 97,108,115,101, 41, 32, 97,110,100, 10, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 40, 99,111,100,101, 32, 61, 61, 32, 51, 48, 49, 32,111,114, 32, - 99,111,100,101, 32, 61, 61, 32, 51, 48, 50, 32,111,114, 32, 99,111,100,101, 32, - 61, 61, 32, 51, 48, 51, 32,111,114, 32, 99,111,100,101, 32, 61, 61, 32, 51, 48, - 55, 41, 32, 97,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 40,110, -111,116, 32,114,101,113,116, 46,109,101,116,104,111,100, 32,111,114, 32,114,101, -113,116, 46,109,101,116,104,111,100, 32, 61, 61, 32, 34, 71, 69, 84, 34, 32,111, -114, 32,114,101,113,116, 46,109,101,116,104,111,100, 32, 61, 61, 32, 34, 72, 69, - 65, 68, 34, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97,110,100, 32, - 40,110,111,116, 32,114,101,113,116, 46,110,114,101,100,105,114,101, 99,116,115, - 32,111,114, 32,114,101,113,116, 46,110,114,101,100,105,114,101, 99,116,115, 32, - 60, 32, 53, 41, 10,101,110,100, 10, 10,108,111, 99, 97,108, 32,102,117,110, 99, -116,105,111,110, 32,115,104,111,117,108,100,114,101, 99,101,105,118,101, 98,111, -100,121, 40,114,101,113,116, 44, 32, 99,111,100,101, 41, 10, 32, 32, 32, 32,105, -102, 32,114,101,113,116, 46,109,101,116,104,111,100, 32, 61, 61, 32, 34, 72, 69, - 65, 68, 34, 32,116,104,101,110, 32,114,101,116,117,114,110, 32,110,105,108, 32, -101,110,100, 10, 32, 32, 32, 32,105,102, 32, 99,111,100,101, 32, 61, 61, 32, 50, - 48, 52, 32,111,114, 32, 99,111,100,101, 32, 61, 61, 32, 51, 48, 52, 32,116,104, -101,110, 32,114,101,116,117,114,110, 32,110,105,108, 32,101,110,100, 10, 32, 32, - 32, 32,105,102, 32, 99,111,100,101, 32, 62, 61, 32, 49, 48, 48, 32, 97,110,100, - 32, 99,111,100,101, 32, 60, 32, 50, 48, 48, 32,116,104,101,110, 32,114,101,116, -117,114,110, 32,110,105,108, 32,101,110,100, 10, 32, 32, 32, 32,114,101,116,117, -114,110, 32, 49, 10,101,110,100, 10, 10, 45, 45, 32,102,111,114,119, 97,114,100, - 32,100,101, 99,108, 97,114, 97,116,105,111,110,115, 10,108,111, 99, 97,108, 32, -116,114,101,113,117,101,115,116, 44, 32,116,114,101,100,105,114,101, 99,116, 10, - 10, 45, 45, 91, 91,108,111, 99, 97,108, 93, 93, 32,102,117,110, 99,116,105,111, -110, 32,116,114,101,100,105,114,101, 99,116, 40,114,101,113,116, 44, 32,108,111, - 99, 97,116,105,111,110, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,114,101, -115,117,108,116, 44, 32, 99,111,100,101, 44, 32,104,101, 97,100,101,114,115, 44, - 32,115,116, 97,116,117,115, 32, 61, 32,116,114,101,113,117,101,115,116, 32,123, - 10, 32, 32, 32, 32, 32, 32, 32, 32, 45, 45, 32,116,104,101, 32, 82, 70, 67, 32, -115, 97,121,115, 32,116,104,101, 32,114,101,100,105,114,101, 99,116, 32, 85, 82, - 76, 32,104, 97,115, 32,116,111, 32, 98,101, 32, 97, 98,115,111,108,117,116,101, - 44, 32, 98,117,116, 32,115,111,109,101, 10, 32, 32, 32, 32, 32, 32, 32, 32, 45, - 45, 32,115,101,114,118,101,114,115, 32,100,111, 32,110,111,116, 32,114,101,115, -112,101, 99,116, 32,116,104, 97,116, 10, 32, 32, 32, 32, 32, 32, 32, 32,117,114, -108, 32, 61, 32,117,114,108, 46, 97, 98,115,111,108,117,116,101, 40,114,101,113, -116, 46,117,114,108, 44, 32,108,111, 99, 97,116,105,111,110, 41, 44, 10, 32, 32, - 32, 32, 32, 32, 32, 32,115,111,117,114, 99,101, 32, 61, 32,114,101,113,116, 46, -115,111,117,114, 99,101, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32,115,105,110,107, - 32, 61, 32,114,101,113,116, 46,115,105,110,107, 44, 10, 32, 32, 32, 32, 32, 32, - 32, 32,104,101, 97,100,101,114,115, 32, 61, 32,114,101,113,116, 46,104,101, 97, -100,101,114,115, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32,112,114,111,120,121, 32, - 61, 32,114,101,113,116, 46,112,114,111,120,121, 44, 10, 32, 32, 32, 32, 32, 32, - 32, 32,110,114,101,100,105,114,101, 99,116,115, 32, 61, 32, 40,114,101,113,116, - 46,110,114,101,100,105,114,101, 99,116,115, 32,111,114, 32, 48, 41, 32, 43, 32, - 49, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 99,114,101, 97,116,101, 32, 61, 32, -114,101,113,116, 46, 99,114,101, 97,116,101, 10, 32, 32, 32, 32,125, 10, 32, 32, - 32, 32, 45, 45, 32,112, 97,115,115, 32,108,111, 99, 97,116,105,111,110, 32,104, -101, 97,100,101,114, 32, 98, 97, 99,107, 32, 97,115, 32, 97, 32,104,105,110,116, - 32,119,101, 32,114,101,100,105,114,101, 99,116,101,100, 10, 32, 32, 32, 32,104, -101, 97,100,101,114,115, 32, 61, 32,104,101, 97,100,101,114,115, 32,111,114, 32, -123,125, 10, 32, 32, 32, 32,104,101, 97,100,101,114,115, 46,108,111, 99, 97,116, -105,111,110, 32, 61, 32,104,101, 97,100,101,114,115, 46,108,111, 99, 97,116,105, -111,110, 32,111,114, 32,108,111, 99, 97,116,105,111,110, 10, 32, 32, 32, 32,114, -101,116,117,114,110, 32,114,101,115,117,108,116, 44, 32, 99,111,100,101, 44, 32, -104,101, 97,100,101,114,115, 44, 32,115,116, 97,116,117,115, 10,101,110,100, 10, - 10, 45, 45, 91, 91,108,111, 99, 97,108, 93, 93, 32,102,117,110, 99,116,105,111, -110, 32,116,114,101,113,117,101,115,116, 40,114,101,113,116, 41, 10, 32, 32, 32, - 32, 45, 45, 32,119,101, 32,108,111,111,112, 32,117,110,116,105,108, 32,119,101, - 32,103,101,116, 32,119,104, 97,116, 32,119,101, 32,119, 97,110,116, 44, 32,111, -114, 10, 32, 32, 32, 32, 45, 45, 32,117,110,116,105,108, 32,119,101, 32, 97,114, -101, 32,115,117,114,101, 32,116,104,101,114,101, 32,105,115, 32,110,111, 32,119, - 97,121, 32,116,111, 32,103,101,116, 32,105,116, 10, 32, 32, 32, 32,108,111, 99, - 97,108, 32,110,114,101,113,116, 32, 61, 32, 97,100,106,117,115,116,114,101,113, -117,101,115,116, 40,114,101,113,116, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, - 32,104, 32, 61, 32, 95, 77, 46,111,112,101,110, 40,110,114,101,113,116, 46,104, -111,115,116, 44, 32,110,114,101,113,116, 46,112,111,114,116, 44, 32,110,114,101, -113,116, 46, 99,114,101, 97,116,101, 41, 10, 32, 32, 32, 32, 45, 45, 32,115,101, -110,100, 32,114,101,113,117,101,115,116, 32,108,105,110,101, 32, 97,110,100, 32, -104,101, 97,100,101,114,115, 10, 32, 32, 32, 32,104, 58,115,101,110,100,114,101, -113,117,101,115,116,108,105,110,101, 40,110,114,101,113,116, 46,109,101,116,104, -111,100, 44, 32,110,114,101,113,116, 46,117,114,105, 41, 10, 32, 32, 32, 32,104, - 58,115,101,110,100,104,101, 97,100,101,114,115, 40,110,114,101,113,116, 46,104, -101, 97,100,101,114,115, 41, 10, 32, 32, 32, 32, 45, 45, 32,105,102, 32,116,104, -101,114,101, 32,105,115, 32, 97, 32, 98,111,100,121, 44, 32,115,101,110,100, 32, -105,116, 10, 32, 32, 32, 32,105,102, 32,110,114,101,113,116, 46,115,111,117,114, - 99,101, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32,104, 58,115,101, -110,100, 98,111,100,121, 40,110,114,101,113,116, 46,104,101, 97,100,101,114,115, - 44, 32,110,114,101,113,116, 46,115,111,117,114, 99,101, 44, 32,110,114,101,113, -116, 46,115,116,101,112, 41, 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, -108,111, 99, 97,108, 32, 99,111,100,101, 44, 32,115,116, 97,116,117,115, 32, 61, - 32,104, 58,114,101, 99,101,105,118,101,115,116, 97,116,117,115,108,105,110,101, - 40, 41, 10, 32, 32, 32, 32, 45, 45, 32,105,102, 32,105,116, 32,105,115, 32, 97, -110, 32, 72, 84, 84, 80, 47, 48, 46, 57, 32,115,101,114,118,101,114, 44, 32,115, -105,109,112,108,121, 32,103,101,116, 32,116,104,101, 32, 98,111,100,121, 32, 97, -110,100, 32,119,101, 32, 97,114,101, 32,100,111,110,101, 10, 32, 32, 32, 32,105, -102, 32,110,111,116, 32, 99,111,100,101, 32,116,104,101,110, 10, 32, 32, 32, 32, - 32, 32, 32, 32,104, 58,114,101, 99,101,105,118,101, 48, 57, 98,111,100,121, 40, -115,116, 97,116,117,115, 44, 32,110,114,101,113,116, 46,115,105,110,107, 44, 32, -110,114,101,113,116, 46,115,116,101,112, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, -114,101,116,117,114,110, 32, 49, 44, 32, 50, 48, 48, 10, 32, 32, 32, 32,101,110, -100, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,104,101, 97,100,101,114,115, 10, - 32, 32, 32, 32, 45, 45, 32,105,103,110,111,114,101, 32, 97,110,121, 32, 49, 48, - 48, 45, 99,111,110,116,105,110,117,101, 32,109,101,115,115, 97,103,101,115, 10, - 32, 32, 32, 32,119,104,105,108,101, 32, 99,111,100,101, 32, 61, 61, 32, 49, 48, - 48, 32,100,111, 10, 32, 32, 32, 32, 32, 32, 32, 32,104,101, 97,100,101,114,115, - 32, 61, 32,104, 58,114,101, 99,101,105,118,101,104,101, 97,100,101,114,115, 40, - 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 99,111,100,101, 44, 32,115,116, 97,116, -117,115, 32, 61, 32,104, 58,114,101, 99,101,105,118,101,115,116, 97,116,117,115, -108,105,110,101, 40, 41, 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,104, -101, 97,100,101,114,115, 32, 61, 32,104, 58,114,101, 99,101,105,118,101,104,101, - 97,100,101,114,115, 40, 41, 10, 32, 32, 32, 32, 45, 45, 32, 97,116, 32,116,104, -105,115, 32,112,111,105,110,116, 32,119,101, 32,115,104,111,117,108,100, 32,104, - 97,118,101, 32, 97, 32,104,111,110,101,115,116, 32,114,101,112,108,121, 32,102, -114,111,109, 32,116,104,101, 32,115,101,114,118,101,114, 10, 32, 32, 32, 32, 45, - 45, 32,119,101, 32, 99, 97,110, 39,116, 32,114,101,100,105,114,101, 99,116, 32, -105,102, 32,119,101, 32, 97,108,114,101, 97,100,121, 32,117,115,101,100, 32,116, -104,101, 32,115,111,117,114, 99,101, 44, 32,115,111, 32,119,101, 32,114,101,112, -111,114,116, 32,116,104,101, 32,101,114,114,111,114, 10, 32, 32, 32, 32,105,102, - 32,115,104,111,117,108,100,114,101,100,105,114,101, 99,116, 40,110,114,101,113, -116, 44, 32, 99,111,100,101, 44, 32,104,101, 97,100,101,114,115, 41, 32, 97,110, -100, 32,110,111,116, 32,110,114,101,113,116, 46,115,111,117,114, 99,101, 32,116, -104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32,104, 58, 99,108,111,115,101, 40, - 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114,110, 32,116,114,101, -100,105,114,101, 99,116, 40,114,101,113,116, 44, 32,104,101, 97,100,101,114,115, - 46,108,111, 99, 97,116,105,111,110, 41, 10, 32, 32, 32, 32,101,110,100, 10, 32, - 32, 32, 32, 45, 45, 32,104,101,114,101, 32,119,101, 32, 97,114,101, 32,102,105, -110, 97,108,108,121, 32,100,111,110,101, 10, 32, 32, 32, 32,105,102, 32,115,104, -111,117,108,100,114,101, 99,101,105,118,101, 98,111,100,121, 40,110,114,101,113, -116, 44, 32, 99,111,100,101, 41, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, - 32, 32,104, 58,114,101, 99,101,105,118,101, 98,111,100,121, 40,104,101, 97,100, -101,114,115, 44, 32,110,114,101,113,116, 46,115,105,110,107, 44, 32,110,114,101, -113,116, 46,115,116,101,112, 41, 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, - 32,104, 58, 99,108,111,115,101, 40, 41, 10, 32, 32, 32, 32,114,101,116,117,114, -110, 32, 49, 44, 32, 99,111,100,101, 44, 32,104,101, 97,100,101,114,115, 44, 32, -115,116, 97,116,117,115, 10,101,110,100, 10, 10, 45, 45, 32,116,117,114,110,115, - 32, 97,110, 32,117,114,108, 32, 97,110,100, 32, 97, 32, 98,111,100,121, 32,105, -110,116,111, 32, 97, 32,103,101,110,101,114,105, 99, 32,114,101,113,117,101,115, -116, 10,108,111, 99, 97,108, 32,102,117,110, 99,116,105,111,110, 32,103,101,110, -101,114,105, 99,102,111,114,109, 40,117, 44, 32, 98, 41, 10, 32, 32, 32, 32,108, -111, 99, 97,108, 32,116, 32, 61, 32,123,125, 10, 32, 32, 32, 32,108,111, 99, 97, -108, 32,114,101,113,116, 32, 61, 32,123, 10, 32, 32, 32, 32, 32, 32, 32, 32,117, -114,108, 32, 61, 32,117, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32,115,105,110,107, - 32, 61, 32,108,116,110, 49, 50, 46,115,105,110,107, 46,116, 97, 98,108,101, 40, -116, 41, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32,116, 97,114,103,101,116, 32, 61, - 32,116, 10, 32, 32, 32, 32,125, 10, 32, 32, 32, 32,105,102, 32, 98, 32,116,104, -101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,113,116, 46,115,111,117,114, - 99,101, 32, 61, 32,108,116,110, 49, 50, 46,115,111,117,114, 99,101, 46,115,116, -114,105,110,103, 40, 98, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,113,116, - 46,104,101, 97,100,101,114,115, 32, 61, 32,123, 10, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 91, 34, 99,111,110,116,101,110,116, 45,108,101,110,103,116, -104, 34, 93, 32, 61, 32,115,116,114,105,110,103, 46,108,101,110, 40, 98, 41, 44, - 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 91, 34, 99,111,110,116,101, -110,116, 45,116,121,112,101, 34, 93, 32, 61, 32, 34, 97,112,112,108,105, 99, 97, -116,105,111,110, 47,120, 45,119,119,119, 45,102,111,114,109, 45,117,114,108,101, -110, 99,111,100,101,100, 34, 10, 32, 32, 32, 32, 32, 32, 32, 32,125, 10, 32, 32, - 32, 32, 32, 32, 32, 32,114,101,113,116, 46,109,101,116,104,111,100, 32, 61, 32, - 34, 80, 79, 83, 84, 34, 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,114, -101,116,117,114,110, 32,114,101,113,116, 10,101,110,100, 10, 10, 95, 77, 46,103, -101,110,101,114,105, 99,102,111,114,109, 32, 61, 32,103,101,110,101,114,105, 99, -102,111,114,109, 10, 10,108,111, 99, 97,108, 32,102,117,110, 99,116,105,111,110, - 32,115,114,101,113,117,101,115,116, 40,117, 44, 32, 98, 41, 10, 32, 32, 32, 32, -108,111, 99, 97,108, 32,114,101,113,116, 32, 61, 32,103,101,110,101,114,105, 99, -102,111,114,109, 40,117, 44, 32, 98, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, - 32, 95, 44, 32, 99,111,100,101, 44, 32,104,101, 97,100,101,114,115, 44, 32,115, -116, 97,116,117,115, 32, 61, 32,116,114,101,113,117,101,115,116, 40,114,101,113, -116, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,116, 97, 98,108,101, 46, - 99,111,110, 99, 97,116, 40,114,101,113,116, 46,116, 97,114,103,101,116, 41, 44, - 32, 99,111,100,101, 44, 32,104,101, 97,100,101,114,115, 44, 32,115,116, 97,116, -117,115, 10,101,110,100, 10, 10, 95, 77, 46,114,101,113,117,101,115,116, 32, 61, - 32,115,111, 99,107,101,116, 46,112,114,111,116,101, 99,116, 40,102,117,110, 99, -116,105,111,110, 40,114,101,113,116, 44, 32, 98,111,100,121, 41, 10, 32, 32, 32, - 32,105,102, 32, 98, 97,115,101, 46,116,121,112,101, 40,114,101,113,116, 41, 32, - 61, 61, 32, 34,115,116,114,105,110,103, 34, 32,116,104,101,110, 32,114,101,116, -117,114,110, 32,115,114,101,113,117,101,115,116, 40,114,101,113,116, 44, 32, 98, -111,100,121, 41, 10, 32, 32, 32, 32,101,108,115,101, 32,114,101,116,117,114,110, - 32,116,114,101,113,117,101,115,116, 40,114,101,113,116, 41, 32,101,110,100, 10, -101,110,100, 41, 10, 10,114,101,116,117,114,110, 32, 95, 77, 10, -}; - - if (luaL_loadbuffer(L,(const char*)B1,sizeof(B1),"http.lua")==0) lua_call(L, 0, LUA_MULTRET); -} diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/inet.c b/love/src/jni/love/src/libraries/luasocket/libluasocket/inet.c deleted file mode 100644 index f4c84044..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/inet.c +++ /dev/null @@ -1,543 +0,0 @@ -/*=========================================================================*\ -* Internet domain functions -* LuaSocket toolkit -\*=========================================================================*/ -#include -#include -#include - -#include "lua.h" -#include "lauxlib.h" -#include "compat.h" - -#include "inet.h" - -/*=========================================================================*\ -* Internal function prototypes. -\*=========================================================================*/ -static int inet_global_toip(lua_State *L); -static int inet_global_getaddrinfo(lua_State *L); -static int inet_global_tohostname(lua_State *L); -static int inet_global_getnameinfo(lua_State *L); -static void inet_pushresolved(lua_State *L, struct hostent *hp); -static int inet_global_gethostname(lua_State *L); - -/* DNS functions */ -static luaL_Reg func[] = { - { "toip", inet_global_toip}, - { "getaddrinfo", inet_global_getaddrinfo}, - { "tohostname", inet_global_tohostname}, - { "getnameinfo", inet_global_getnameinfo}, - { "gethostname", inet_global_gethostname}, - { NULL, NULL} -}; - -/*=========================================================================*\ -* Exported functions -\*=========================================================================*/ -/*-------------------------------------------------------------------------*\ -* Initializes module -\*-------------------------------------------------------------------------*/ -int inet_open(lua_State *L) -{ - lua_pushstring(L, "dns"); - lua_newtable(L); - luaL_setfuncs(L, func, 0); - lua_settable(L, -3); - return 0; -} - -/*=========================================================================*\ -* Global Lua functions -\*=========================================================================*/ -/*-------------------------------------------------------------------------*\ -* Returns all information provided by the resolver given a host name -* or ip address -\*-------------------------------------------------------------------------*/ -static int inet_gethost(const char *address, struct hostent **hp) { - struct in_addr addr; - if (inet_aton(address, &addr)) - return socket_gethostbyaddr((char *) &addr, sizeof(addr), hp); - else - return socket_gethostbyname(address, hp); -} - -/*-------------------------------------------------------------------------*\ -* Returns all information provided by the resolver given a host name -* or ip address -\*-------------------------------------------------------------------------*/ -static int inet_global_tohostname(lua_State *L) { - const char *address = luaL_checkstring(L, 1); - struct hostent *hp = NULL; - int err = inet_gethost(address, &hp); - if (err != IO_DONE) { - lua_pushnil(L); - lua_pushstring(L, socket_hoststrerror(err)); - return 2; - } - lua_pushstring(L, hp->h_name); - inet_pushresolved(L, hp); - return 2; -} - -static int inet_global_getnameinfo(lua_State *L) { - char hbuf[NI_MAXHOST]; - char sbuf[NI_MAXSERV]; - int i, ret; - struct addrinfo hints; - struct addrinfo *resolved, *iter; - const char *host = luaL_optstring(L, 1, NULL); - const char *serv = luaL_optstring(L, 2, NULL); - - if (!(host || serv)) - luaL_error(L, "host and serv cannot be both nil"); - - memset(&hints, 0, sizeof(hints)); - hints.ai_socktype = SOCK_STREAM; - hints.ai_family = AF_UNSPEC; - - ret = getaddrinfo(host, serv, &hints, &resolved); - if (ret != 0) { - lua_pushnil(L); - lua_pushstring(L, socket_gaistrerror(ret)); - return 2; - } - - lua_newtable(L); - for (i = 1, iter = resolved; iter; i++, iter = iter->ai_next) { - getnameinfo(iter->ai_addr, (socklen_t) iter->ai_addrlen, - hbuf, host? (socklen_t) sizeof(hbuf): 0, - sbuf, serv? (socklen_t) sizeof(sbuf): 0, 0); - if (host) { - lua_pushnumber(L, i); - lua_pushstring(L, hbuf); - lua_settable(L, -3); - } - } - freeaddrinfo(resolved); - - if (serv) { - lua_pushstring(L, sbuf); - return 2; - } else { - return 1; - } -} - -/*-------------------------------------------------------------------------*\ -* Returns all information provided by the resolver given a host name -* or ip address -\*-------------------------------------------------------------------------*/ -static int inet_global_toip(lua_State *L) -{ - const char *address = luaL_checkstring(L, 1); - struct hostent *hp = NULL; - int err = inet_gethost(address, &hp); - if (err != IO_DONE) { - lua_pushnil(L); - lua_pushstring(L, socket_hoststrerror(err)); - return 2; - } - lua_pushstring(L, inet_ntoa(*((struct in_addr *) hp->h_addr))); - inet_pushresolved(L, hp); - return 2; -} - -int inet_optfamily(lua_State* L, int narg, const char* def) -{ - static const char* optname[] = { "unspec", "inet", "inet6", NULL }; - static int optvalue[] = { AF_UNSPEC, AF_INET, AF_INET6, 0 }; - - return optvalue[luaL_checkoption(L, narg, def, optname)]; -} - -int inet_optsocktype(lua_State* L, int narg, const char* def) -{ - static const char* optname[] = { "stream", "dgram", NULL }; - static int optvalue[] = { SOCK_STREAM, SOCK_DGRAM, 0 }; - - return optvalue[luaL_checkoption(L, narg, def, optname)]; -} - -static int inet_global_getaddrinfo(lua_State *L) -{ - const char *hostname = luaL_checkstring(L, 1); - struct addrinfo *iterator = NULL, *resolved = NULL; - struct addrinfo hints; - int i = 1, ret = 0; - memset(&hints, 0, sizeof(hints)); - hints.ai_socktype = SOCK_STREAM; - hints.ai_family = AF_UNSPEC; - ret = getaddrinfo(hostname, NULL, &hints, &resolved); - if (ret != 0) { - lua_pushnil(L); - lua_pushstring(L, socket_gaistrerror(ret)); - return 2; - } - lua_newtable(L); - for (iterator = resolved; iterator; iterator = iterator->ai_next) { - char hbuf[NI_MAXHOST]; - ret = getnameinfo(iterator->ai_addr, (socklen_t) iterator->ai_addrlen, - hbuf, (socklen_t) sizeof(hbuf), NULL, 0, NI_NUMERICHOST); - if (ret){ - freeaddrinfo(resolved); - lua_pushnil(L); - lua_pushstring(L, socket_gaistrerror(ret)); - return 2; - } - lua_pushnumber(L, i); - lua_newtable(L); - switch (iterator->ai_family) { - case AF_INET: - lua_pushliteral(L, "family"); - lua_pushliteral(L, "inet"); - lua_settable(L, -3); - break; - case AF_INET6: - lua_pushliteral(L, "family"); - lua_pushliteral(L, "inet6"); - lua_settable(L, -3); - break; - case AF_UNSPEC: - lua_pushliteral(L, "family"); - lua_pushliteral(L, "unspec"); - lua_settable(L, -3); - break; - default: - lua_pushliteral(L, "family"); - lua_pushliteral(L, "unknown"); - lua_settable(L, -3); - break; - } - lua_pushliteral(L, "addr"); - lua_pushstring(L, hbuf); - lua_settable(L, -3); - lua_settable(L, -3); - i++; - } - freeaddrinfo(resolved); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Gets the host name -\*-------------------------------------------------------------------------*/ -static int inet_global_gethostname(lua_State *L) -{ - char name[257]; - name[256] = '\0'; - if (gethostname(name, 256) < 0) { - lua_pushnil(L); - lua_pushstring(L, socket_strerror(errno)); - return 2; - } else { - lua_pushstring(L, name); - return 1; - } -} - -/*=========================================================================*\ -* Lua methods -\*=========================================================================*/ -/*-------------------------------------------------------------------------*\ -* Retrieves socket peer name -\*-------------------------------------------------------------------------*/ -int inet_meth_getpeername(lua_State *L, p_socket ps, int family) -{ - int err; - struct sockaddr_storage peer; - socklen_t peer_len = sizeof(peer); - char name[INET6_ADDRSTRLEN]; - char port[6]; /* 65535 = 5 bytes + 0 to terminate it */ - if (getpeername(*ps, (SA *) &peer, &peer_len) < 0) { - lua_pushnil(L); - lua_pushstring(L, socket_strerror(errno)); - return 2; - } - err = getnameinfo((struct sockaddr *) &peer, peer_len, - name, INET6_ADDRSTRLEN, - port, sizeof(port), NI_NUMERICHOST | NI_NUMERICSERV); - if (err) { - lua_pushnil(L); - lua_pushstring(L, gai_strerror(err)); - return 2; - } - lua_pushstring(L, name); - lua_pushinteger(L, (int) strtol(port, (char **) NULL, 10)); - switch (family) { - case AF_INET: lua_pushliteral(L, "inet"); break; - case AF_INET6: lua_pushliteral(L, "inet6"); break; - case AF_UNSPEC: lua_pushliteral(L, "unspec"); break; - default: lua_pushliteral(L, "unknown"); break; - } - return 3; -} - -/*-------------------------------------------------------------------------*\ -* Retrieves socket local name -\*-------------------------------------------------------------------------*/ -int inet_meth_getsockname(lua_State *L, p_socket ps, int family) -{ - int err; - struct sockaddr_storage peer; - socklen_t peer_len = sizeof(peer); - char name[INET6_ADDRSTRLEN]; - char port[6]; /* 65535 = 5 bytes + 0 to terminate it */ - if (getsockname(*ps, (SA *) &peer, &peer_len) < 0) { - lua_pushnil(L); - lua_pushstring(L, socket_strerror(errno)); - return 2; - } - err=getnameinfo((struct sockaddr *)&peer, peer_len, - name, INET6_ADDRSTRLEN, port, 6, NI_NUMERICHOST | NI_NUMERICSERV); - if (err) { - lua_pushnil(L); - lua_pushstring(L, gai_strerror(err)); - return 2; - } - lua_pushstring(L, name); - lua_pushstring(L, port); - switch (family) { - case AF_INET: lua_pushliteral(L, "inet"); break; - case AF_INET6: lua_pushliteral(L, "inet6"); break; - case AF_UNSPEC: lua_pushliteral(L, "unspec"); break; - default: lua_pushliteral(L, "unknown"); break; - } - return 3; -} - -/*=========================================================================*\ -* Internal functions -\*=========================================================================*/ -/*-------------------------------------------------------------------------*\ -* Passes all resolver information to Lua as a table -\*-------------------------------------------------------------------------*/ -static void inet_pushresolved(lua_State *L, struct hostent *hp) -{ - char **alias; - struct in_addr **addr; - int i, resolved; - lua_newtable(L); resolved = lua_gettop(L); - lua_pushstring(L, "name"); - lua_pushstring(L, hp->h_name); - lua_settable(L, resolved); - lua_pushstring(L, "ip"); - lua_pushstring(L, "alias"); - i = 1; - alias = hp->h_aliases; - lua_newtable(L); - if (alias) { - while (*alias) { - lua_pushnumber(L, i); - lua_pushstring(L, *alias); - lua_settable(L, -3); - i++; alias++; - } - } - lua_settable(L, resolved); - i = 1; - lua_newtable(L); - addr = (struct in_addr **) hp->h_addr_list; - if (addr) { - while (*addr) { - lua_pushnumber(L, i); - lua_pushstring(L, inet_ntoa(**addr)); - lua_settable(L, -3); - i++; addr++; - } - } - lua_settable(L, resolved); -} - -/*-------------------------------------------------------------------------*\ -* Tries to create a new inet socket -\*-------------------------------------------------------------------------*/ -const char *inet_trycreate(p_socket ps, int family, int type, int protocol) { - const char *err = socket_strerror(socket_create(ps, family, type, protocol)); - if (err == NULL && family == AF_INET6) { - int yes = 1; - setsockopt(*ps, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&yes, sizeof(yes)); - } - return err; -} - -/*-------------------------------------------------------------------------*\ -* "Disconnects" a DGRAM socket -\*-------------------------------------------------------------------------*/ -const char *inet_trydisconnect(p_socket ps, int family, p_timeout tm) -{ - switch (family) { - case AF_INET: { - struct sockaddr_in sin; - memset((char *) &sin, 0, sizeof(sin)); - sin.sin_family = AF_UNSPEC; - sin.sin_addr.s_addr = INADDR_ANY; - return socket_strerror(socket_connect(ps, (SA *) &sin, - sizeof(sin), tm)); - } - case AF_INET6: { - struct sockaddr_in6 sin6; - struct in6_addr addrany = IN6ADDR_ANY_INIT; - memset((char *) &sin6, 0, sizeof(sin6)); - sin6.sin6_family = AF_UNSPEC; - sin6.sin6_addr = addrany; - return socket_strerror(socket_connect(ps, (SA *) &sin6, - sizeof(sin6), tm)); - } - } - return NULL; -} - -/*-------------------------------------------------------------------------*\ -* Tries to connect to remote address (address, port) -\*-------------------------------------------------------------------------*/ -const char *inet_tryconnect(p_socket ps, int *family, const char *address, - const char *serv, p_timeout tm, struct addrinfo *connecthints) -{ - struct addrinfo *iterator = NULL, *resolved = NULL; - const char *err = NULL; - int current_family = *family; - /* try resolving */ - err = socket_gaistrerror(getaddrinfo(address, serv, - connecthints, &resolved)); - if (err != NULL) { - if (resolved) freeaddrinfo(resolved); - return err; - } - for (iterator = resolved; iterator; iterator = iterator->ai_next) { - timeout_markstart(tm); - /* create new socket if necessary. if there was no - * bind, we need to create one for every new family - * that shows up while iterating. if there was a - * bind, all families will be the same and we will - * not enter this branch. */ - if (current_family != iterator->ai_family || *ps == SOCKET_INVALID) { - socket_destroy(ps); - err = inet_trycreate(ps, iterator->ai_family, - iterator->ai_socktype, iterator->ai_protocol); - if (err) continue; - current_family = iterator->ai_family; - /* set non-blocking before connect */ - socket_setnonblocking(ps); - } - /* try connecting to remote address */ - err = socket_strerror(socket_connect(ps, (SA *) iterator->ai_addr, - (socklen_t) iterator->ai_addrlen, tm)); - /* if success or timeout is zero, break out of loop */ - if (err == NULL || timeout_iszero(tm)) { - *family = current_family; - break; - } - } - freeaddrinfo(resolved); - /* here, if err is set, we failed */ - return err; -} - -/*-------------------------------------------------------------------------*\ -* Tries to accept a socket -\*-------------------------------------------------------------------------*/ -const char *inet_tryaccept(p_socket server, int family, p_socket client, - p_timeout tm) { - socklen_t len; - t_sockaddr_storage addr; - switch (family) { - case AF_INET6: len = sizeof(struct sockaddr_in6); break; - case AF_INET: len = sizeof(struct sockaddr_in); break; - default: len = sizeof(addr); break; - } - return socket_strerror(socket_accept(server, client, (SA *) &addr, - &len, tm)); -} - -/*-------------------------------------------------------------------------*\ -* Tries to bind socket to (address, port) -\*-------------------------------------------------------------------------*/ -const char *inet_trybind(p_socket ps, int *family, const char *address, - const char *serv, struct addrinfo *bindhints) { - struct addrinfo *iterator = NULL, *resolved = NULL; - const char *err = NULL; - int current_family = *family; - /* translate luasocket special values to C */ - if (strcmp(address, "*") == 0) address = NULL; - if (!serv) serv = "0"; - /* try resolving */ - err = socket_gaistrerror(getaddrinfo(address, serv, bindhints, &resolved)); - if (err) { - if (resolved) freeaddrinfo(resolved); - return err; - } - /* iterate over resolved addresses until one is good */ - for (iterator = resolved; iterator; iterator = iterator->ai_next) { - if (current_family != iterator->ai_family || *ps == SOCKET_INVALID) { - socket_destroy(ps); - err = inet_trycreate(ps, iterator->ai_family, - iterator->ai_socktype, iterator->ai_protocol); - if (err) continue; - current_family = iterator->ai_family; - } - /* try binding to local address */ - err = socket_strerror(socket_bind(ps, (SA *) iterator->ai_addr, - (socklen_t) iterator->ai_addrlen)); - /* keep trying unless bind succeeded */ - if (err == NULL) { - *family = current_family; - /* set to non-blocking after bind */ - socket_setnonblocking(ps); - break; - } - } - /* cleanup and return error */ - freeaddrinfo(resolved); - /* here, if err is set, we failed */ - return err; -} - -/*-------------------------------------------------------------------------*\ -* Some systems do not provide these so that we provide our own. -\*-------------------------------------------------------------------------*/ -#ifdef LUASOCKET_INET_ATON -int inet_aton(const char *cp, struct in_addr *inp) -{ - unsigned int a = 0, b = 0, c = 0, d = 0; - int n = 0, r; - unsigned long int addr = 0; - r = sscanf(cp, "%u.%u.%u.%u%n", &a, &b, &c, &d, &n); - if (r == 0 || n == 0) return 0; - cp += n; - if (*cp) return 0; - if (a > 255 || b > 255 || c > 255 || d > 255) return 0; - if (inp) { - addr += a; addr <<= 8; - addr += b; addr <<= 8; - addr += c; addr <<= 8; - addr += d; - inp->s_addr = htonl(addr); - } - return 1; -} -#endif - -#ifdef LUASOCKET_INET_PTON -int inet_pton(int af, const char *src, void *dst) -{ - struct addrinfo hints, *res; - int ret = 1; - memset(&hints, 0, sizeof(struct addrinfo)); - hints.ai_family = af; - hints.ai_flags = AI_NUMERICHOST; - if (getaddrinfo(src, NULL, &hints, &res) != 0) return -1; - if (af == AF_INET) { - struct sockaddr_in *in = (struct sockaddr_in *) res->ai_addr; - memcpy(dst, &in->sin_addr, sizeof(in->sin_addr)); - } else if (af == AF_INET6) { - struct sockaddr_in6 *in = (struct sockaddr_in6 *) res->ai_addr; - memcpy(dst, &in->sin6_addr, sizeof(in->sin6_addr)); - } else { - ret = -1; - } - freeaddrinfo(res); - return ret; -} - -#endif diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/inet.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/inet.h deleted file mode 100644 index feb3541d..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/inet.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef INET_H -#define INET_H -/*=========================================================================*\ -* Internet domain functions -* LuaSocket toolkit -* -* This module implements the creation and connection of internet domain -* sockets, on top of the socket.h interface, and the interface of with the -* resolver. -* -* The function inet_aton is provided for the platforms where it is not -* available. The module also implements the interface of the internet -* getpeername and getsockname functions as seen by Lua programs. -* -* The Lua functions toip and tohostname are also implemented here. -\*=========================================================================*/ -#include "lua.h" -#include "socket.h" -#include "timeout.h" - -#ifdef _WIN32 -#define LUASOCKET_INET_ATON -#endif - -int inet_open(lua_State *L); - -const char *inet_trycreate(p_socket ps, int family, int type, int protocol); -const char *inet_tryconnect(p_socket ps, int *family, const char *address, - const char *serv, p_timeout tm, struct addrinfo *connecthints); -const char *inet_trybind(p_socket ps, int *family, const char *address, - const char *serv, struct addrinfo *bindhints); -const char *inet_trydisconnect(p_socket ps, int family, p_timeout tm); -const char *inet_tryaccept(p_socket server, int family, p_socket client, p_timeout tm); - -int inet_meth_getpeername(lua_State *L, p_socket ps, int family); -int inet_meth_getsockname(lua_State *L, p_socket ps, int family); - -int inet_optfamily(lua_State* L, int narg, const char* def); -int inet_optsocktype(lua_State* L, int narg, const char* def); - -#ifdef LUASOCKET_INET_ATON -int inet_aton(const char *cp, struct in_addr *inp); -#endif - -#ifdef LUASOCKET_INET_PTON -const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt); -int inet_pton(int af, const char *src, void *dst); -#endif - -#endif /* INET_H */ diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/io.c b/love/src/jni/love/src/libraries/luasocket/libluasocket/io.c deleted file mode 100644 index a4230ce8..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/io.c +++ /dev/null @@ -1,30 +0,0 @@ -/*=========================================================================*\ -* Input/Output abstraction -* LuaSocket toolkit -\*=========================================================================*/ -#include "io.h" - -/*=========================================================================*\ -* Exported functions -\*=========================================================================*/ -/*-------------------------------------------------------------------------*\ -* Initializes C structure -\*-------------------------------------------------------------------------*/ -void io_init(p_io io, p_send send, p_recv recv, p_error error, void *ctx) { - io->send = send; - io->recv = recv; - io->error = error; - io->ctx = ctx; -} - -/*-------------------------------------------------------------------------*\ -* I/O error strings -\*-------------------------------------------------------------------------*/ -const char *io_strerror(int err) { - switch (err) { - case IO_DONE: return NULL; - case IO_CLOSED: return "closed"; - case IO_TIMEOUT: return "timeout"; - default: return "unknown error"; - } -} diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/io.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/io.h deleted file mode 100644 index 8cca08a8..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/io.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef IO_H -#define IO_H -/*=========================================================================*\ -* Input/Output abstraction -* LuaSocket toolkit -* -* This module defines the interface that LuaSocket expects from the -* transport layer for streamed input/output. The idea is that if any -* transport implements this interface, then the buffer.c functions -* automatically work on it. -* -* The module socket.h implements this interface, and thus the module tcp.h -* is very simple. -\*=========================================================================*/ -#include -#include "lua.h" - -#include "timeout.h" - -/* IO error codes */ -enum { - IO_DONE = 0, /* operation completed successfully */ - IO_TIMEOUT = -1, /* operation timed out */ - IO_CLOSED = -2, /* the connection has been closed */ - IO_UNKNOWN = -3 -}; - -/* interface to error message function */ -typedef const char *(*p_error) ( - void *ctx, /* context needed by send */ - int err /* error code */ -); - -/* interface to send function */ -typedef int (*p_send) ( - void *ctx, /* context needed by send */ - const char *data, /* pointer to buffer with data to send */ - size_t count, /* number of bytes to send from buffer */ - size_t *sent, /* number of bytes sent uppon return */ - p_timeout tm /* timeout control */ -); - -/* interface to recv function */ -typedef int (*p_recv) ( - void *ctx, /* context needed by recv */ - char *data, /* pointer to buffer where data will be writen */ - size_t count, /* number of bytes to receive into buffer */ - size_t *got, /* number of bytes received uppon return */ - p_timeout tm /* timeout control */ -); - -/* IO driver definition */ -typedef struct t_io_ { - void *ctx; /* context needed by send/recv */ - p_send send; /* send function pointer */ - p_recv recv; /* receive function pointer */ - p_error error; /* strerror function */ -} t_io; -typedef t_io *p_io; - -void io_init(p_io io, p_send send, p_recv recv, p_error error, void *ctx); -const char *io_strerror(int err); - -#endif /* IO_H */ - diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/ltn12.lua b/love/src/jni/love/src/libraries/luasocket/libluasocket/ltn12.lua deleted file mode 100644 index 575c5a7f..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/ltn12.lua +++ /dev/null @@ -1,309 +0,0 @@ ------------------------------------------------------------------------------ --- LTN12 - Filters, sources, sinks and pumps. --- LuaSocket toolkit. --- Author: Diego Nehab ------------------------------------------------------------------------------ - ------------------------------------------------------------------------------ --- Declare module ------------------------------------------------------------------------------ -local string = require("string") -local table = require("table") -local unpack = unpack or table.unpack -local base = _G -local _M = {} -if module then -- heuristic for exporting a global package table - ltn12 = _M -end -local filter,source,sink,pump = {},{},{},{} - -_M.filter = filter -_M.source = source -_M.sink = sink -_M.pump = pump - -local unpack = unpack or table.unpack -local select = base.select - --- 2048 seems to be better in windows... -_M.BLOCKSIZE = 2048 -_M._VERSION = "LTN12 1.0.3" - ------------------------------------------------------------------------------ --- Filter stuff ------------------------------------------------------------------------------ --- returns a high level filter that cycles a low-level filter -function filter.cycle(low, ctx, extra) - base.assert(low) - return function(chunk) - local ret - ret, ctx = low(ctx, chunk, extra) - return ret - end -end - --- chains a bunch of filters together --- (thanks to Wim Couwenberg) -function filter.chain(...) - local arg = {...} - local n = base.select('#',...) - local top, index = 1, 1 - local retry = "" - return function(chunk) - retry = chunk and retry - while true do - if index == top then - chunk = arg[index](chunk) - if chunk == "" or top == n then return chunk - elseif chunk then index = index + 1 - else - top = top+1 - index = top - end - else - chunk = arg[index](chunk or "") - if chunk == "" then - index = index - 1 - chunk = retry - elseif chunk then - if index == n then return chunk - else index = index + 1 end - else base.error("filter returned inappropriate nil") end - end - end - end -end - ------------------------------------------------------------------------------ --- Source stuff ------------------------------------------------------------------------------ --- create an empty source -local function empty() - return nil -end - -function source.empty() - return empty -end - --- returns a source that just outputs an error -function source.error(err) - return function() - return nil, err - end -end - --- creates a file source -function source.file(handle, io_err) - if handle then - return function() - local chunk = handle:read(_M.BLOCKSIZE) - if not chunk then handle:close() end - return chunk - end - else return source.error(io_err or "unable to open file") end -end - --- turns a fancy source into a simple source -function source.simplify(src) - base.assert(src) - return function() - local chunk, err_or_new = src() - src = err_or_new or src - if not chunk then return nil, err_or_new - else return chunk end - end -end - --- creates string source -function source.string(s) - if s then - local i = 1 - return function() - local chunk = string.sub(s, i, i+_M.BLOCKSIZE-1) - i = i + _M.BLOCKSIZE - if chunk ~= "" then return chunk - else return nil end - end - else return source.empty() end -end - --- creates rewindable source -function source.rewind(src) - base.assert(src) - local t = {} - return function(chunk) - if not chunk then - chunk = table.remove(t) - if not chunk then return src() - else return chunk end - else - table.insert(t, chunk) - end - end -end - --- chains a source with one or several filter(s) -function source.chain(src, f, ...) - if ... then f=filter.chain(f, ...) end - base.assert(src and f) - local last_in, last_out = "", "" - local state = "feeding" - local err - return function() - if not last_out then - base.error('source is empty!', 2) - end - while true do - if state == "feeding" then - last_in, err = src() - if err then return nil, err end - last_out = f(last_in) - if not last_out then - if last_in then - base.error('filter returned inappropriate nil') - else - return nil - end - elseif last_out ~= "" then - state = "eating" - if last_in then last_in = "" end - return last_out - end - else - last_out = f(last_in) - if last_out == "" then - if last_in == "" then - state = "feeding" - else - base.error('filter returned ""') - end - elseif not last_out then - if last_in then - base.error('filter returned inappropriate nil') - else - return nil - end - else - return last_out - end - end - end - end -end - --- creates a source that produces contents of several sources, one after the --- other, as if they were concatenated --- (thanks to Wim Couwenberg) -function source.cat(...) - local arg = {...} - local src = table.remove(arg, 1) - return function() - while src do - local chunk, err = src() - if chunk then return chunk end - if err then return nil, err end - src = table.remove(arg, 1) - end - end -end - ------------------------------------------------------------------------------ --- Sink stuff ------------------------------------------------------------------------------ --- creates a sink that stores into a table -function sink.table(t) - t = t or {} - local f = function(chunk, err) - if chunk then table.insert(t, chunk) end - return 1 - end - return f, t -end - --- turns a fancy sink into a simple sink -function sink.simplify(snk) - base.assert(snk) - return function(chunk, err) - local ret, err_or_new = snk(chunk, err) - if not ret then return nil, err_or_new end - snk = err_or_new or snk - return 1 - end -end - --- creates a file sink -function sink.file(handle, io_err) - if handle then - return function(chunk, err) - if not chunk then - handle:close() - return 1 - else return handle:write(chunk) end - end - else return sink.error(io_err or "unable to open file") end -end - --- creates a sink that discards data -local function null() - return 1 -end - -function sink.null() - return null -end - --- creates a sink that just returns an error -function sink.error(err) - return function() - return nil, err - end -end - --- chains a sink with one or several filter(s) -function sink.chain(f, snk, ...) - if ... then - local args = { f, snk, ... } - snk = table.remove(args, #args) - f = filter.chain(unpack(args)) - end - base.assert(f and snk) - return function(chunk, err) - if chunk ~= "" then - local filtered = f(chunk) - local done = chunk and "" - while true do - local ret, snkerr = snk(filtered, err) - if not ret then return nil, snkerr end - if filtered == done then return 1 end - filtered = f(done) - end - else return 1 end - end -end - ------------------------------------------------------------------------------ --- Pump stuff ------------------------------------------------------------------------------ --- pumps one chunk from the source to the sink -function pump.step(src, snk) - local chunk, src_err = src() - local ret, snk_err = snk(chunk, src_err) - if chunk and ret then return 1 - else return nil, src_err or snk_err end -end - --- pumps all data from a source to a sink, using a step function -function pump.all(src, snk, step) - base.assert(src and snk) - step = step or pump.step - while true do - local ret, err = step(src, snk) - if not ret then - if err then return nil, err - else return 1 end - end - end -end - -return _M diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/ltn12.lua.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/ltn12.lua.h deleted file mode 100644 index 6fcfed99..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/ltn12.lua.h +++ /dev/null @@ -1,446 +0,0 @@ -/* code automatically generated by bin2c -- DO NOT EDIT */ -{ -/* #include'ing this file in a C program is equivalent to calling - if (luaL_loadfile(L,"ltn12.lua")==0) lua_call(L, 0, LUA_MULTRET); -*/ -/* ltn12.lua */ -static const unsigned char B1[]={ - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, - 32, 76, 84, 78, 49, 50, 32, 45, 32, 70,105,108,116,101,114,115, 44, 32,115,111, -117,114, 99,101,115, 44, 32,115,105,110,107,115, 32, 97,110,100, 32,112,117,109, -112,115, 46, 10, 45, 45, 32, 76,117, 97, 83,111, 99,107,101,116, 32,116,111,111, -108,107,105,116, 46, 10, 45, 45, 32, 65,117,116,104,111,114, 58, 32, 68,105,101, -103,111, 32, 78,101,104, 97, 98, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 10, 45, 45, 32, 68,101, 99,108, 97,114,101, 32,109,111,100, -117,108,101, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 10,108,111, 99, 97,108, 32,115,116,114,105,110,103, 32, 61, 32,114,101,113, -117,105,114,101, 40, 34,115,116,114,105,110,103, 34, 41, 10,108,111, 99, 97,108, - 32,116, 97, 98,108,101, 32, 61, 32,114,101,113,117,105,114,101, 40, 34,116, 97, - 98,108,101, 34, 41, 10,108,111, 99, 97,108, 32,117,110,112, 97, 99,107, 32, 61, - 32,117,110,112, 97, 99,107, 32,111,114, 32,116, 97, 98,108,101, 46,117,110,112, - 97, 99,107, 10,108,111, 99, 97,108, 32, 98, 97,115,101, 32, 61, 32, 95, 71, 10, -108,111, 99, 97,108, 32, 95, 77, 32, 61, 32,123,125, 10,105,102, 32,109,111,100, -117,108,101, 32,116,104,101,110, 32, 45, 45, 32,104,101,117,114,105,115,116,105, - 99, 32,102,111,114, 32,101,120,112,111,114,116,105,110,103, 32, 97, 32,103,108, -111, 98, 97,108, 32,112, 97, 99,107, 97,103,101, 32,116, 97, 98,108,101, 10, 32, - 32, 32, 32,108,116,110, 49, 50, 32, 61, 32, 95, 77, 10,101,110,100, 10,108,111, - 99, 97,108, 32,102,105,108,116,101,114, 44,115,111,117,114, 99,101, 44,115,105, -110,107, 44,112,117,109,112, 32, 61, 32,123,125, 44,123,125, 44,123,125, 44,123, -125, 10, 10, 95, 77, 46,102,105,108,116,101,114, 32, 61, 32,102,105,108,116,101, -114, 10, 95, 77, 46,115,111,117,114, 99,101, 32, 61, 32,115,111,117,114, 99,101, - 10, 95, 77, 46,115,105,110,107, 32, 61, 32,115,105,110,107, 10, 95, 77, 46,112, -117,109,112, 32, 61, 32,112,117,109,112, 10, 10,108,111, 99, 97,108, 32,117,110, -112, 97, 99,107, 32, 61, 32,117,110,112, 97, 99,107, 32,111,114, 32,116, 97, 98, -108,101, 46,117,110,112, 97, 99,107, 10,108,111, 99, 97,108, 32,115,101,108,101, - 99,116, 32, 61, 32, 98, 97,115,101, 46,115,101,108,101, 99,116, 10, 10, 45, 45, - 32, 50, 48, 52, 56, 32,115,101,101,109,115, 32,116,111, 32, 98,101, 32, 98,101, -116,116,101,114, 32,105,110, 32,119,105,110,100,111,119,115, 46, 46, 46, 10, 95, - 77, 46, 66, 76, 79, 67, 75, 83, 73, 90, 69, 32, 61, 32, 50, 48, 52, 56, 10, 95, - 77, 46, 95, 86, 69, 82, 83, 73, 79, 78, 32, 61, 32, 34, 76, 84, 78, 49, 50, 32, - 49, 46, 48, 46, 51, 34, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 10, 45, 45, 32, 70,105,108,116,101,114, 32,115,116,117,102, -102, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, - 45, 45, 32,114,101,116,117,114,110,115, 32, 97, 32,104,105,103,104, 32,108,101, -118,101,108, 32,102,105,108,116,101,114, 32,116,104, 97,116, 32, 99,121, 99,108, -101,115, 32, 97, 32,108,111,119, 45,108,101,118,101,108, 32,102,105,108,116,101, -114, 10,102,117,110, 99,116,105,111,110, 32,102,105,108,116,101,114, 46, 99,121, - 99,108,101, 40,108,111,119, 44, 32, 99,116,120, 44, 32,101,120,116,114, 97, 41, - 10, 32, 32, 32, 32, 98, 97,115,101, 46, 97,115,115,101,114,116, 40,108,111,119, - 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,102,117,110, 99,116,105,111, -110, 40, 99,104,117,110,107, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,108,111, 99, - 97,108, 32,114,101,116, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116, 44, 32, - 99,116,120, 32, 61, 32,108,111,119, 40, 99,116,120, 44, 32, 99,104,117,110,107, - 44, 32,101,120,116,114, 97, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116, -117,114,110, 32,114,101,116, 10, 32, 32, 32, 32,101,110,100, 10,101,110,100, 10, - 10, 45, 45, 32, 99,104, 97,105,110,115, 32, 97, 32, 98,117,110, 99,104, 32,111, -102, 32,102,105,108,116,101,114,115, 32,116,111,103,101,116,104,101,114, 10, 45, - 45, 32, 40,116,104, 97,110,107,115, 32,116,111, 32, 87,105,109, 32, 67,111,117, -119,101,110, 98,101,114,103, 41, 10,102,117,110, 99,116,105,111,110, 32,102,105, -108,116,101,114, 46, 99,104, 97,105,110, 40, 46, 46, 46, 41, 10, 32, 32, 32, 32, -108,111, 99, 97,108, 32, 97,114,103, 32, 61, 32,123, 46, 46, 46,125, 10, 32, 32, - 32, 32,108,111, 99, 97,108, 32,110, 32, 61, 32, 98, 97,115,101, 46,115,101,108, -101, 99,116, 40, 39, 35, 39, 44, 46, 46, 46, 41, 10, 32, 32, 32, 32,108,111, 99, - 97,108, 32,116,111,112, 44, 32,105,110,100,101,120, 32, 61, 32, 49, 44, 32, 49, - 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,114,101,116,114,121, 32, 61, 32, 34, - 34, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,102,117,110, 99,116,105,111, -110, 40, 99,104,117,110,107, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116, -114,121, 32, 61, 32, 99,104,117,110,107, 32, 97,110,100, 32,114,101,116,114,121, - 10, 32, 32, 32, 32, 32, 32, 32, 32,119,104,105,108,101, 32,116,114,117,101, 32, -100,111, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,105,110, -100,101,120, 32, 61, 61, 32,116,111,112, 32,116,104,101,110, 10, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 99,104,117,110,107, 32, 61, 32, - 97,114,103, 91,105,110,100,101,120, 93, 40, 99,104,117,110,107, 41, 10, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32, 99,104,117, -110,107, 32, 61, 61, 32, 34, 34, 32,111,114, 32,116,111,112, 32, 61, 61, 32,110, - 32,116,104,101,110, 32,114,101,116,117,114,110, 32, 99,104,117,110,107, 10, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,108,115,101,105, -102, 32, 99,104,117,110,107, 32,116,104,101,110, 32,105,110,100,101,120, 32, 61, - 32,105,110,100,101,120, 32, 43, 32, 49, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32,101,108,115,101, 10, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,116,111,112, 32, 61, 32,116,111, -112, 43, 49, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32,105,110,100,101,120, 32, 61, 32,116,111,112, 10, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32,101,108,115,101, 10, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 99,104,117,110,107, 32, 61, 32, 97,114,103, - 91,105,110,100,101,120, 93, 40, 99,104,117,110,107, 32,111,114, 32, 34, 34, 41, - 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32, - 99,104,117,110,107, 32, 61, 61, 32, 34, 34, 32,116,104,101,110, 10, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,110,100, -101,120, 32, 61, 32,105,110,100,101,120, 32, 45, 32, 49, 10, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 99,104,117,110,107, - 32, 61, 32,114,101,116,114,121, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32,101,108,115,101,105,102, 32, 99,104,117,110,107, 32,116,104, -101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32,105,102, 32,105,110,100,101,120, 32, 61, 61, 32,110, 32,116,104,101, -110, 32,114,101,116,117,114,110, 32, 99,104,117,110,107, 10, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,108,115,101, 32, -105,110,100,101,120, 32, 61, 32,105,110,100,101,120, 32, 43, 32, 49, 32,101,110, -100, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,108, -115,101, 32, 98, 97,115,101, 46,101,114,114,111,114, 40, 34,102,105,108,116,101, -114, 32,114,101,116,117,114,110,101,100, 32,105,110, 97,112,112,114,111,112,114, -105, 97,116,101, 32,110,105,108, 34, 41, 32,101,110,100, 10, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32,101, -110,100, 10, 32, 32, 32, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 83,111,117, -114, 99,101, 32,115,116,117,102,102, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 99,114,101, 97,116,101, 32, 97,110, - 32,101,109,112,116,121, 32,115,111,117,114, 99,101, 10,108,111, 99, 97,108, 32, -102,117,110, 99,116,105,111,110, 32,101,109,112,116,121, 40, 41, 10, 32, 32, 32, - 32,114,101,116,117,114,110, 32,110,105,108, 10,101,110,100, 10, 10,102,117,110, - 99,116,105,111,110, 32,115,111,117,114, 99,101, 46,101,109,112,116,121, 40, 41, - 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,101,109,112,116,121, 10,101,110, -100, 10, 10, 45, 45, 32,114,101,116,117,114,110,115, 32, 97, 32,115,111,117,114, - 99,101, 32,116,104, 97,116, 32,106,117,115,116, 32,111,117,116,112,117,116,115, - 32, 97,110, 32,101,114,114,111,114, 10,102,117,110, 99,116,105,111,110, 32,115, -111,117,114, 99,101, 46,101,114,114,111,114, 40,101,114,114, 41, 10, 32, 32, 32, - 32,114,101,116,117,114,110, 32,102,117,110, 99,116,105,111,110, 40, 41, 10, 32, - 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114,110, 32,110,105,108, 44, 32,101, -114,114, 10, 32, 32, 32, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 99, -114,101, 97,116,101,115, 32, 97, 32,102,105,108,101, 32,115,111,117,114, 99,101, - 10,102,117,110, 99,116,105,111,110, 32,115,111,117,114, 99,101, 46,102,105,108, -101, 40,104, 97,110,100,108,101, 44, 32,105,111, 95,101,114,114, 41, 10, 32, 32, - 32, 32,105,102, 32,104, 97,110,100,108,101, 32,116,104,101,110, 10, 32, 32, 32, - 32, 32, 32, 32, 32,114,101,116,117,114,110, 32,102,117,110, 99,116,105,111,110, - 40, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,108,111, 99, 97,108, - 32, 99,104,117,110,107, 32, 61, 32,104, 97,110,100,108,101, 58,114,101, 97,100, - 40, 95, 77, 46, 66, 76, 79, 67, 75, 83, 73, 90, 69, 41, 10, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32,105,102, 32,110,111,116, 32, 99,104,117,110,107, 32, -116,104,101,110, 32,104, 97,110,100,108,101, 58, 99,108,111,115,101, 40, 41, 32, -101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117, -114,110, 32, 99,104,117,110,107, 10, 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, - 10, 32, 32, 32, 32,101,108,115,101, 32,114,101,116,117,114,110, 32,115,111,117, -114, 99,101, 46,101,114,114,111,114, 40,105,111, 95,101,114,114, 32,111,114, 32, - 34,117,110, 97, 98,108,101, 32,116,111, 32,111,112,101,110, 32,102,105,108,101, - 34, 41, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32,116,117,114,110,115, - 32, 97, 32,102, 97,110, 99,121, 32,115,111,117,114, 99,101, 32,105,110,116,111, - 32, 97, 32,115,105,109,112,108,101, 32,115,111,117,114, 99,101, 10,102,117,110, - 99,116,105,111,110, 32,115,111,117,114, 99,101, 46,115,105,109,112,108,105,102, -121, 40,115,114, 99, 41, 10, 32, 32, 32, 32, 98, 97,115,101, 46, 97,115,115,101, -114,116, 40,115,114, 99, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,102, -117,110, 99,116,105,111,110, 40, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,108,111, - 99, 97,108, 32, 99,104,117,110,107, 44, 32,101,114,114, 95,111,114, 95,110,101, -119, 32, 61, 32,115,114, 99, 40, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,115,114, - 99, 32, 61, 32,101,114,114, 95,111,114, 95,110,101,119, 32,111,114, 32,115,114, - 99, 10, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,110,111,116, 32, 99,104,117, -110,107, 32,116,104,101,110, 32,114,101,116,117,114,110, 32,110,105,108, 44, 32, -101,114,114, 95,111,114, 95,110,101,119, 10, 32, 32, 32, 32, 32, 32, 32, 32,101, -108,115,101, 32,114,101,116,117,114,110, 32, 99,104,117,110,107, 32,101,110,100, - 10, 32, 32, 32, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 99,114,101, - 97,116,101,115, 32,115,116,114,105,110,103, 32,115,111,117,114, 99,101, 10,102, -117,110, 99,116,105,111,110, 32,115,111,117,114, 99,101, 46,115,116,114,105,110, -103, 40,115, 41, 10, 32, 32, 32, 32,105,102, 32,115, 32,116,104,101,110, 10, 32, - 32, 32, 32, 32, 32, 32, 32,108,111, 99, 97,108, 32,105, 32, 61, 32, 49, 10, 32, - 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114,110, 32,102,117,110, 99,116,105, -111,110, 40, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,108,111, 99, - 97,108, 32, 99,104,117,110,107, 32, 61, 32,115,116,114,105,110,103, 46,115,117, - 98, 40,115, 44, 32,105, 44, 32,105, 43, 95, 77, 46, 66, 76, 79, 67, 75, 83, 73, - 90, 69, 45, 49, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105, 32, - 61, 32,105, 32, 43, 32, 95, 77, 46, 66, 76, 79, 67, 75, 83, 73, 90, 69, 10, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32, 99,104,117,110,107, 32, -126, 61, 32, 34, 34, 32,116,104,101,110, 32,114,101,116,117,114,110, 32, 99,104, -117,110,107, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,108,115,101, - 32,114,101,116,117,114,110, 32,110,105,108, 32,101,110,100, 10, 32, 32, 32, 32, - 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,101,108,115,101, 32,114,101,116, -117,114,110, 32,115,111,117,114, 99,101, 46,101,109,112,116,121, 40, 41, 32,101, -110,100, 10,101,110,100, 10, 10, 45, 45, 32, 99,114,101, 97,116,101,115, 32,114, -101,119,105,110,100, 97, 98,108,101, 32,115,111,117,114, 99,101, 10,102,117,110, - 99,116,105,111,110, 32,115,111,117,114, 99,101, 46,114,101,119,105,110,100, 40, -115,114, 99, 41, 10, 32, 32, 32, 32, 98, 97,115,101, 46, 97,115,115,101,114,116, - 40,115,114, 99, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,116, 32, 61, 32, -123,125, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,102,117,110, 99,116,105, -111,110, 40, 99,104,117,110,107, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,105,102, - 32,110,111,116, 32, 99,104,117,110,107, 32,116,104,101,110, 10, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 99,104,117,110,107, 32, 61, 32,116, 97, 98,108, -101, 46,114,101,109,111,118,101, 40,116, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32,105,102, 32,110,111,116, 32, 99,104,117,110,107, 32,116,104,101, -110, 32,114,101,116,117,114,110, 32,115,114, 99, 40, 41, 10, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32,101,108,115,101, 32,114,101,116,117,114,110, 32, 99, -104,117,110,107, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32,101,108,115, -101, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,116, 97, 98,108,101, 46, -105,110,115,101,114,116, 40,116, 44, 32, 99,104,117,110,107, 41, 10, 32, 32, 32, - 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,101,110,100, 10,101,110,100, - 10, 10, 45, 45, 32, 99,104, 97,105,110,115, 32, 97, 32,115,111,117,114, 99,101, - 32,119,105,116,104, 32,111,110,101, 32,111,114, 32,115,101,118,101,114, 97,108, - 32,102,105,108,116,101,114, 40,115, 41, 10,102,117,110, 99,116,105,111,110, 32, -115,111,117,114, 99,101, 46, 99,104, 97,105,110, 40,115,114, 99, 44, 32,102, 44, - 32, 46, 46, 46, 41, 10, 32, 32, 32, 32,105,102, 32, 46, 46, 46, 32,116,104,101, -110, 32,102, 61,102,105,108,116,101,114, 46, 99,104, 97,105,110, 40,102, 44, 32, - 46, 46, 46, 41, 32,101,110,100, 10, 32, 32, 32, 32, 98, 97,115,101, 46, 97,115, -115,101,114,116, 40,115,114, 99, 32, 97,110,100, 32,102, 41, 10, 32, 32, 32, 32, -108,111, 99, 97,108, 32,108, 97,115,116, 95,105,110, 44, 32,108, 97,115,116, 95, -111,117,116, 32, 61, 32, 34, 34, 44, 32, 34, 34, 10, 32, 32, 32, 32,108,111, 99, - 97,108, 32,115,116, 97,116,101, 32, 61, 32, 34,102,101,101,100,105,110,103, 34, - 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,101,114,114, 10, 32, 32, 32, 32,114, -101,116,117,114,110, 32,102,117,110, 99,116,105,111,110, 40, 41, 10, 32, 32, 32, - 32, 32, 32, 32, 32,105,102, 32,110,111,116, 32,108, 97,115,116, 95,111,117,116, - 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 98, 97, -115,101, 46,101,114,114,111,114, 40, 39,115,111,117,114, 99,101, 32,105,115, 32, -101,109,112,116,121, 33, 39, 44, 32, 50, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, -101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32,119,104,105,108,101, 32,116,114, -117,101, 32,100,111, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, - 32,115,116, 97,116,101, 32, 61, 61, 32, 34,102,101,101,100,105,110,103, 34, 32, -116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32,108, 97,115,116, 95,105,110, 44, 32,101,114,114, 32, 61, 32,115,114, 99, 40, - 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, - 32,101,114,114, 32,116,104,101,110, 32,114,101,116,117,114,110, 32,110,105,108, - 44, 32,101,114,114, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32,108, 97,115,116, 95,111,117,116, 32, 61, 32,102, 40,108, - 97,115,116, 95,105,110, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32,105,102, 32,110,111,116, 32,108, 97,115,116, 95,111,117,116, 32, -116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32,105,102, 32,108, 97,115,116, 95,105,110, 32,116,104,101,110, - 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 98, 97,115,101, 46,101,114,114,111,114, 40, 39,102,105,108, -116,101,114, 32,114,101,116,117,114,110,101,100, 32,105,110, 97,112,112,114,111, -112,114,105, 97,116,101, 32,110,105,108, 39, 41, 10, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,108,115,101, 10, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32,114,101,116,117,114,110, 32,110,105,108, 10, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,108,115,101,105,102, 32, -108, 97,115,116, 95,111,117,116, 32,126, 61, 32, 34, 34, 32,116,104,101,110, 10, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, -115,116, 97,116,101, 32, 61, 32, 34,101, 97,116,105,110,103, 34, 10, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32, -108, 97,115,116, 95,105,110, 32,116,104,101,110, 32,108, 97,115,116, 95,105,110, - 32, 61, 32, 34, 34, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114,110, 32,108, 97,115, -116, 95,111,117,116, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,108, -115,101, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,108, - 97,115,116, 95,111,117,116, 32, 61, 32,102, 40,108, 97,115,116, 95,105,110, 41, - 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32, -108, 97,115,116, 95,111,117,116, 32, 61, 61, 32, 34, 34, 32,116,104,101,110, 10, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, -105,102, 32,108, 97,115,116, 95,105,110, 32, 61, 61, 32, 34, 34, 32,116,104,101, -110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32,115,116, 97,116,101, 32, 61, 32, 34,102,101,101,100,105, -110,103, 34, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32,101,108,115,101, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 98, 97,115,101, 46,101,114, -114,111,114, 40, 39,102,105,108,116,101,114, 32,114,101,116,117,114,110,101,100, - 32, 34, 34, 39, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32,101,108,115,101,105,102, 32,110,111,116, 32,108, 97,115, -116, 95,111,117,116, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,108, 97,115,116, 95,105, -110, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 98, 97,115,101, 46,101,114,114,111, -114, 40, 39,102,105,108,116,101,114, 32,114,101,116,117,114,110,101,100, 32,105, -110, 97,112,112,114,111,112,114,105, 97,116,101, 32,110,105,108, 39, 41, 10, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101, -108,115,101, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114,110, 32,110,105,108, 10, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101, -110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101, -108,115,101, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32,114,101,116,117,114,110, 32,108, 97,115,116, 95,111,117,116, 10, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, - 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,101,110,100, 10,101,110,100, 10, - 10, 45, 45, 32, 99,114,101, 97,116,101,115, 32, 97, 32,115,111,117,114, 99,101, - 32,116,104, 97,116, 32,112,114,111,100,117, 99,101,115, 32, 99,111,110,116,101, -110,116,115, 32,111,102, 32,115,101,118,101,114, 97,108, 32,115,111,117,114, 99, -101,115, 44, 32,111,110,101, 32, 97,102,116,101,114, 32,116,104,101, 10, 45, 45, - 32,111,116,104,101,114, 44, 32, 97,115, 32,105,102, 32,116,104,101,121, 32,119, -101,114,101, 32, 99,111,110, 99, 97,116,101,110, 97,116,101,100, 10, 45, 45, 32, - 40,116,104, 97,110,107,115, 32,116,111, 32, 87,105,109, 32, 67,111,117,119,101, -110, 98,101,114,103, 41, 10,102,117,110, 99,116,105,111,110, 32,115,111,117,114, - 99,101, 46, 99, 97,116, 40, 46, 46, 46, 41, 10, 32, 32, 32, 32,108,111, 99, 97, -108, 32, 97,114,103, 32, 61, 32,123, 46, 46, 46,125, 10, 32, 32, 32, 32,108,111, - 99, 97,108, 32,115,114, 99, 32, 61, 32,116, 97, 98,108,101, 46,114,101,109,111, -118,101, 40, 97,114,103, 44, 32, 49, 41, 10, 32, 32, 32, 32,114,101,116,117,114, -110, 32,102,117,110, 99,116,105,111,110, 40, 41, 10, 32, 32, 32, 32, 32, 32, 32, - 32,119,104,105,108,101, 32,115,114, 99, 32,100,111, 10, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32,108,111, 99, 97,108, 32, 99,104,117,110,107, 44, 32,101, -114,114, 32, 61, 32,115,114, 99, 40, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32,105,102, 32, 99,104,117,110,107, 32,116,104,101,110, 32,114,101,116, -117,114,110, 32, 99,104,117,110,107, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32,105,102, 32,101,114,114, 32,116,104,101,110, 32,114,101, -116,117,114,110, 32,110,105,108, 44, 32,101,114,114, 32,101,110,100, 10, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,115,114, 99, 32, 61, 32,116, 97, 98,108, -101, 46,114,101,109,111,118,101, 40, 97,114,103, 44, 32, 49, 41, 10, 32, 32, 32, - 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,101,110,100, 10,101,110,100, - 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, - 45, 45, 32, 83,105,110,107, 32,115,116,117,102,102, 10, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 99,114,101, 97,116, -101,115, 32, 97, 32,115,105,110,107, 32,116,104, 97,116, 32,115,116,111,114,101, -115, 32,105,110,116,111, 32, 97, 32,116, 97, 98,108,101, 10,102,117,110, 99,116, -105,111,110, 32,115,105,110,107, 46,116, 97, 98,108,101, 40,116, 41, 10, 32, 32, - 32, 32,116, 32, 61, 32,116, 32,111,114, 32,123,125, 10, 32, 32, 32, 32,108,111, - 99, 97,108, 32,102, 32, 61, 32,102,117,110, 99,116,105,111,110, 40, 99,104,117, -110,107, 44, 32,101,114,114, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32, - 99,104,117,110,107, 32,116,104,101,110, 32,116, 97, 98,108,101, 46,105,110,115, -101,114,116, 40,116, 44, 32, 99,104,117,110,107, 41, 32,101,110,100, 10, 32, 32, - 32, 32, 32, 32, 32, 32,114,101,116,117,114,110, 32, 49, 10, 32, 32, 32, 32,101, -110,100, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,102, 44, 32,116, 10,101, -110,100, 10, 10, 45, 45, 32,116,117,114,110,115, 32, 97, 32,102, 97,110, 99,121, - 32,115,105,110,107, 32,105,110,116,111, 32, 97, 32,115,105,109,112,108,101, 32, -115,105,110,107, 10,102,117,110, 99,116,105,111,110, 32,115,105,110,107, 46,115, -105,109,112,108,105,102,121, 40,115,110,107, 41, 10, 32, 32, 32, 32, 98, 97,115, -101, 46, 97,115,115,101,114,116, 40,115,110,107, 41, 10, 32, 32, 32, 32,114,101, -116,117,114,110, 32,102,117,110, 99,116,105,111,110, 40, 99,104,117,110,107, 44, - 32,101,114,114, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,108,111, 99, 97,108, 32, -114,101,116, 44, 32,101,114,114, 95,111,114, 95,110,101,119, 32, 61, 32,115,110, -107, 40, 99,104,117,110,107, 44, 32,101,114,114, 41, 10, 32, 32, 32, 32, 32, 32, - 32, 32,105,102, 32,110,111,116, 32,114,101,116, 32,116,104,101,110, 32,114,101, -116,117,114,110, 32,110,105,108, 44, 32,101,114,114, 95,111,114, 95,110,101,119, - 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32,115,110,107, 32, 61, 32,101, -114,114, 95,111,114, 95,110,101,119, 32,111,114, 32,115,110,107, 10, 32, 32, 32, - 32, 32, 32, 32, 32,114,101,116,117,114,110, 32, 49, 10, 32, 32, 32, 32,101,110, -100, 10,101,110,100, 10, 10, 45, 45, 32, 99,114,101, 97,116,101,115, 32, 97, 32, -102,105,108,101, 32,115,105,110,107, 10,102,117,110, 99,116,105,111,110, 32,115, -105,110,107, 46,102,105,108,101, 40,104, 97,110,100,108,101, 44, 32,105,111, 95, -101,114,114, 41, 10, 32, 32, 32, 32,105,102, 32,104, 97,110,100,108,101, 32,116, -104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114,110, 32,102, -117,110, 99,116,105,111,110, 40, 99,104,117,110,107, 44, 32,101,114,114, 41, 10, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,110,111,116, 32, 99, -104,117,110,107, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32,104, 97,110,100,108,101, 58, 99,108,111,115,101, 40, 41, - 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116, -117,114,110, 32, 49, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,108, -115,101, 32,114,101,116,117,114,110, 32,104, 97,110,100,108,101, 58,119,114,105, -116,101, 40, 99,104,117,110,107, 41, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, - 32, 32,101,110,100, 10, 32, 32, 32, 32,101,108,115,101, 32,114,101,116,117,114, -110, 32,115,105,110,107, 46,101,114,114,111,114, 40,105,111, 95,101,114,114, 32, -111,114, 32, 34,117,110, 97, 98,108,101, 32,116,111, 32,111,112,101,110, 32,102, -105,108,101, 34, 41, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 99,114, -101, 97,116,101,115, 32, 97, 32,115,105,110,107, 32,116,104, 97,116, 32,100,105, -115, 99, 97,114,100,115, 32,100, 97,116, 97, 10,108,111, 99, 97,108, 32,102,117, -110, 99,116,105,111,110, 32,110,117,108,108, 40, 41, 10, 32, 32, 32, 32,114,101, -116,117,114,110, 32, 49, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, - 32,115,105,110,107, 46,110,117,108,108, 40, 41, 10, 32, 32, 32, 32,114,101,116, -117,114,110, 32,110,117,108,108, 10,101,110,100, 10, 10, 45, 45, 32, 99,114,101, - 97,116,101,115, 32, 97, 32,115,105,110,107, 32,116,104, 97,116, 32,106,117,115, -116, 32,114,101,116,117,114,110,115, 32, 97,110, 32,101,114,114,111,114, 10,102, -117,110, 99,116,105,111,110, 32,115,105,110,107, 46,101,114,114,111,114, 40,101, -114,114, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,102,117,110, 99,116, -105,111,110, 40, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114,110, - 32,110,105,108, 44, 32,101,114,114, 10, 32, 32, 32, 32,101,110,100, 10,101,110, -100, 10, 10, 45, 45, 32, 99,104, 97,105,110,115, 32, 97, 32,115,105,110,107, 32, -119,105,116,104, 32,111,110,101, 32,111,114, 32,115,101,118,101,114, 97,108, 32, -102,105,108,116,101,114, 40,115, 41, 10,102,117,110, 99,116,105,111,110, 32,115, -105,110,107, 46, 99,104, 97,105,110, 40,102, 44, 32,115,110,107, 44, 32, 46, 46, - 46, 41, 10, 32, 32, 32, 32,105,102, 32, 46, 46, 46, 32,116,104,101,110, 10, 32, - 32, 32, 32, 32, 32, 32, 32,108,111, 99, 97,108, 32, 97,114,103,115, 32, 61, 32, -123, 32,102, 44, 32,115,110,107, 44, 32, 46, 46, 46, 32,125, 10, 32, 32, 32, 32, - 32, 32, 32, 32,115,110,107, 32, 61, 32,116, 97, 98,108,101, 46,114,101,109,111, -118,101, 40, 97,114,103,115, 44, 32, 35, 97,114,103,115, 41, 10, 32, 32, 32, 32, - 32, 32, 32, 32,102, 32, 61, 32,102,105,108,116,101,114, 46, 99,104, 97,105,110, - 40,117,110,112, 97, 99,107, 40, 97,114,103,115, 41, 41, 10, 32, 32, 32, 32,101, -110,100, 10, 32, 32, 32, 32, 98, 97,115,101, 46, 97,115,115,101,114,116, 40,102, - 32, 97,110,100, 32,115,110,107, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, - 32,102,117,110, 99,116,105,111,110, 40, 99,104,117,110,107, 44, 32,101,114,114, - 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32, 99,104,117,110,107, 32,126, - 61, 32, 34, 34, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32,108,111, 99, 97,108, 32,102,105,108,116,101,114,101,100, 32, 61, 32,102, - 40, 99,104,117,110,107, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, -108,111, 99, 97,108, 32,100,111,110,101, 32, 61, 32, 99,104,117,110,107, 32, 97, -110,100, 32, 34, 34, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,119,104, -105,108,101, 32,116,114,117,101, 32,100,111, 10, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32,108,111, 99, 97,108, 32,114,101,116, 44, 32,115, -110,107,101,114,114, 32, 61, 32,115,110,107, 40,102,105,108,116,101,114,101,100, - 44, 32,101,114,114, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32,105,102, 32,110,111,116, 32,114,101,116, 32,116,104,101,110, 32,114, -101,116,117,114,110, 32,110,105,108, 44, 32,115,110,107,101,114,114, 32,101,110, -100, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, - 32,102,105,108,116,101,114,101,100, 32, 61, 61, 32,100,111,110,101, 32,116,104, -101,110, 32,114,101,116,117,114,110, 32, 49, 32,101,110,100, 10, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102,105,108,116,101,114,101,100, - 32, 61, 32,102, 40,100,111,110,101, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32,101,108,115,101, 32, -114,101,116,117,114,110, 32, 49, 32,101,110,100, 10, 32, 32, 32, 32,101,110,100, - 10,101,110,100, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 10, 45, 45, 32, 80,117,109,112, 32,115,116,117,102,102, 10, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32,112, -117,109,112,115, 32,111,110,101, 32, 99,104,117,110,107, 32,102,114,111,109, 32, -116,104,101, 32,115,111,117,114, 99,101, 32,116,111, 32,116,104,101, 32,115,105, -110,107, 10,102,117,110, 99,116,105,111,110, 32,112,117,109,112, 46,115,116,101, -112, 40,115,114, 99, 44, 32,115,110,107, 41, 10, 32, 32, 32, 32,108,111, 99, 97, -108, 32, 99,104,117,110,107, 44, 32,115,114, 99, 95,101,114,114, 32, 61, 32,115, -114, 99, 40, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,114,101,116, 44, 32, -115,110,107, 95,101,114,114, 32, 61, 32,115,110,107, 40, 99,104,117,110,107, 44, - 32,115,114, 99, 95,101,114,114, 41, 10, 32, 32, 32, 32,105,102, 32, 99,104,117, -110,107, 32, 97,110,100, 32,114,101,116, 32,116,104,101,110, 32,114,101,116,117, -114,110, 32, 49, 10, 32, 32, 32, 32,101,108,115,101, 32,114,101,116,117,114,110, - 32,110,105,108, 44, 32,115,114, 99, 95,101,114,114, 32,111,114, 32,115,110,107, - 95,101,114,114, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32,112,117,109, -112,115, 32, 97,108,108, 32,100, 97,116, 97, 32,102,114,111,109, 32, 97, 32,115, -111,117,114, 99,101, 32,116,111, 32, 97, 32,115,105,110,107, 44, 32,117,115,105, -110,103, 32, 97, 32,115,116,101,112, 32,102,117,110, 99,116,105,111,110, 10,102, -117,110, 99,116,105,111,110, 32,112,117,109,112, 46, 97,108,108, 40,115,114, 99, - 44, 32,115,110,107, 44, 32,115,116,101,112, 41, 10, 32, 32, 32, 32, 98, 97,115, -101, 46, 97,115,115,101,114,116, 40,115,114, 99, 32, 97,110,100, 32,115,110,107, - 41, 10, 32, 32, 32, 32,115,116,101,112, 32, 61, 32,115,116,101,112, 32,111,114, - 32,112,117,109,112, 46,115,116,101,112, 10, 32, 32, 32, 32,119,104,105,108,101, - 32,116,114,117,101, 32,100,111, 10, 32, 32, 32, 32, 32, 32, 32, 32,108,111, 99, - 97,108, 32,114,101,116, 44, 32,101,114,114, 32, 61, 32,115,116,101,112, 40,115, -114, 99, 44, 32,115,110,107, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32, -110,111,116, 32,114,101,116, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32,105,102, 32,101,114,114, 32,116,104,101,110, 32,114,101,116, -117,114,110, 32,110,105,108, 44, 32,101,114,114, 10, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32,101,108,115,101, 32,114,101,116,117,114,110, 32, 49, 32,101, -110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,101, -110,100, 10,101,110,100, 10, 10,114,101,116,117,114,110, 32, 95, 77, 10, -}; - - if (luaL_loadbuffer(L,(const char*)B1,sizeof(B1),"ltn12.lua")==0) lua_call(L, 0, LUA_MULTRET); -} diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/luasocket.c b/love/src/jni/love/src/libraries/luasocket/libluasocket/luasocket.c deleted file mode 100644 index 7d9c8023..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/luasocket.c +++ /dev/null @@ -1,114 +0,0 @@ -/*=========================================================================*\ -* LuaSocket toolkit -* Networking support for the Lua language -* Diego Nehab -* 26/11/1999 -* -* This library is part of an effort to progressively increase the network -* connectivity of the Lua language. The Lua interface to networking -* functions follows the Sockets API closely, trying to simplify all tasks -* involved in setting up both client and server connections. The provided -* IO routines, however, follow the Lua style, being very similar to the -* standard Lua read and write functions. -\*=========================================================================*/ - -/*=========================================================================*\ -* Standard include files -\*=========================================================================*/ -#include "lua.h" -#include "lauxlib.h" -#include "compat.h" - -/*=========================================================================*\ -* LuaSocket includes -\*=========================================================================*/ -#include "luasocket.h" -#include "auxiliar.h" -#include "except.h" -#include "timeout.h" -#include "buffer.h" -#include "inet.h" -#include "tcp.h" -#include "udp.h" -#include "select.h" - -/*-------------------------------------------------------------------------*\ -* Internal function prototypes -\*-------------------------------------------------------------------------*/ -static int global_skip(lua_State *L); -static int global_unload(lua_State *L); -static int base_open(lua_State *L); - -/*-------------------------------------------------------------------------*\ -* Modules and functions -\*-------------------------------------------------------------------------*/ -static const luaL_Reg mod[] = { - {"auxiliar", auxiliar_open}, - {"except", except_open}, - {"timeout", timeout_open}, - {"buffer", buffer_open}, - {"inet", inet_open}, - {"tcp", tcp_open}, - {"udp", udp_open}, - {"select", select_open}, - {NULL, NULL} -}; - -static luaL_Reg func[] = { - {"skip", global_skip}, - {"__unload", global_unload}, - {NULL, NULL} -}; - -/*-------------------------------------------------------------------------*\ -* Skip a few arguments -\*-------------------------------------------------------------------------*/ -static int global_skip(lua_State *L) { - int amount = luaL_checkinteger(L, 1); - int ret = lua_gettop(L) - amount - 1; - return ret >= 0 ? ret : 0; -} - -/*-------------------------------------------------------------------------*\ -* Unloads the library -\*-------------------------------------------------------------------------*/ -static int global_unload(lua_State *L) { - (void) L; - socket_close(); - return 0; -} - -/*-------------------------------------------------------------------------*\ -* Setup basic stuff. -\*-------------------------------------------------------------------------*/ -static int base_open(lua_State *L) { - if (socket_open()) { - /* export functions (and leave namespace table on top of stack) */ - lua_newtable(L); - luaL_setfuncs(L, func, 0); -#ifdef LUASOCKET_DEBUG - lua_pushstring(L, "_DEBUG"); - lua_pushboolean(L, 1); - lua_rawset(L, -3); -#endif - /* make version string available to scripts */ - lua_pushstring(L, "_VERSION"); - lua_pushstring(L, LUASOCKET_VERSION); - lua_rawset(L, -3); - return 1; - } else { - lua_pushstring(L, "unable to initialize library"); - lua_error(L); - return 0; - } -} - -/*-------------------------------------------------------------------------*\ -* Initializes all library modules. -\*-------------------------------------------------------------------------*/ -LUASOCKET_API int luaopen_socket_core(lua_State *L) { - int i; - base_open(L); - for (i = 0; mod[i].name; i++) mod[i].func(L); - return 1; -} diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/luasocket.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/luasocket.h deleted file mode 100644 index 3957c59f..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/luasocket.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef LUASOCKET_H -#define LUASOCKET_H -/*=========================================================================*\ -* LuaSocket toolkit -* Networking support for the Lua language -* Diego Nehab -* 9/11/1999 -\*=========================================================================*/ -#include "lua.h" - -/*-------------------------------------------------------------------------*\ -* Current socket library version -\*-------------------------------------------------------------------------*/ -#define LUASOCKET_VERSION "LuaSocket 3.0-rc1" -#define LUASOCKET_COPYRIGHT "Copyright (C) 1999-2013 Diego Nehab" - -/*-------------------------------------------------------------------------*\ -* This macro prefixes all exported API functions -\*-------------------------------------------------------------------------*/ -#ifndef LUASOCKET_API -#if defined(WIN32) || defined(_WIN32) -# define LUASOCKET_API __declspec(dllexport) -#else -# define LUASOCKET_API __attribute__((visibility("default"))) -#endif -#endif - -/*-------------------------------------------------------------------------*\ -* Initializes the library. -\*-------------------------------------------------------------------------*/ -LUASOCKET_API int luaopen_socket_core(lua_State *L); - -#endif /* LUASOCKET_H */ diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/makefile b/love/src/jni/love/src/libraries/luasocket/libluasocket/makefile deleted file mode 100644 index 2ffd7d9d..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/makefile +++ /dev/null @@ -1,438 +0,0 @@ -# luasocket src/makefile -# -# Definitions in this section can be overriden on the command line or in the -# environment. -# -# These are equivalent: -# -# export PLAT=linux DEBUG=DEBUG LUAV=5.2 prefix=/sw -# make -# -# and -# -# make PLAT=linux DEBUG=DEBUG LUAV=5.2 prefix=/sw - -# PLAT: linux macosx win32 mingw -# platform to build for -PLAT?=linux - -# LUAV: 5.1 5.2 -# lua version to build against -LUAV?=5.1 - -# MYCFLAGS: to be set by user if needed -MYCFLAGS?= - -# MYLDFLAGS: to be set by user if needed -MYLDFLAGS?= - -# DEBUG: NODEBUG DEBUG -# debug mode causes luasocket to collect and returns timing information useful -# for testing and debugging luasocket itself -DEBUG?=NODEBUG - -# where lua headers are found for macosx builds -# LUAINC_macosx: -# /opt/local/include -LUAINC_macosx_base?=/opt/local/include -LUAINC_macosx?=$(LUAINC_macosx_base)/lua/$(LUAV) -# FIXME default should this default to fink or to macports? -# What happens when more than one Lua version is installed? -LUAPREFIX_macosx?=/opt/local -CDIR_macosx?=lib/lua/$(LUAV) -LDIR_macosx?=share/lua/$(LUAV) - -# LUAINC_linux: -# /usr/include/lua$(LUAV) -# /usr/local/include -# /usr/local/include/lua$(LUAV) -# where lua headers are found for linux builds -LUAINC_linux_base?=/usr/include -LUAINC_linux?=$(LUAINC_linux_base)/lua/$(LUAV) -LUAPREFIX_linux?=/usr/local -CDIR_linux?=lib/lua/$(LUAV) -LDIR_linux?=share/lua/$(LUAV) - -# LUAINC_freebsd: -# /usr/local/include/lua$(LUAV) -# where lua headers are found for freebsd builds -LUAINC_freebsd_base?=/usr/local/include/ -LUAINC_freebsd?=$(LUAINC_freebsd_base)/lua$(LUAV) -LUAPREFIX_freebsd?=/usr/local/ -CDIR_freebsd?=lib/lua/$(LUAV) -LDIR_freebsd?=share/lua/$(LUAV) - -# where lua headers are found for mingw builds -# LUAINC_mingw: -# /opt/local/include -LUAINC_mingw_base?=/usr/include -LUAINC_mingw?=$(LUAINC_mingw_base)/lua/$(LUAV) -LUALIB_mingw_base?=/usr/bin -LUALIB_mingw?=$(LUALIB_mingw_base)/lua/$(LUAV)/lua$(subst .,,$(LUAV)).dll -LUAPREFIX_mingw?=/usr -CDIR_mingw?=lua/$(LUAV) -LDIR_mingw?=lua/$(LUAV)/lua - - -# LUAINC_win32: -# LUALIB_win32: -# where lua headers and libraries are found for win32 builds -LUAPREFIX_win32?= -LUAINC_win32?=$(LUAPREFIX_win32)/include/lua/$(LUAV) -PLATFORM_win32?=Release -CDIR_win32?=bin/lua/$(LUAV)/$(PLATFORM_win32) -LDIR_win32?=bin/lua/$(LUAV)/$(PLATFORM_win32)/lua -LUALIB_win32?=$(LUAPREFIX_win32)/lib/lua/$(LUAV)/$(PLATFORM_win32) -LUALIBNAME_win32?=lua$(subst .,,$(LUAV)).lib - - -# LUAINC_solaris: -LUAINC_solaris_base?=/usr/include -LUAINC_solaris?=$(LUAINC_solaris_base)/lua/$(LUAV) -LUAPREFIX_solaris?=/usr/local -CDIR_solaris?=lib/lua/$(LUAV) -LDIR_solaris?=share/lua/$(LUAV) - -# prefix: /usr/local /usr /opt/local /sw -# the top of the default install tree -prefix?=$(LUAPREFIX_$(PLAT)) - -CDIR?=$(CDIR_$(PLAT)) -LDIR?=$(LDIR_$(PLAT)) - -# DESTDIR: (no default) -# used by package managers to install into a temporary destination -DESTDIR= - -#------ -# Definitions below can be overridden on the make command line, but -# shouldn't have to be. - - -#------ -# Install directories -# - -INSTALL_DIR=install -d -INSTALL_DATA=install -m644 -INSTALL_EXEC=install -INSTALL_TOP=$(DESTDIR)$(prefix) - -INSTALL_TOP_LDIR=$(INSTALL_TOP)/$(LDIR) -INSTALL_TOP_CDIR=$(INSTALL_TOP)/$(CDIR) - -INSTALL_SOCKET_LDIR=$(INSTALL_TOP_LDIR)/socket -INSTALL_SOCKET_CDIR=$(INSTALL_TOP_CDIR)/socket -INSTALL_MIME_LDIR=$(INSTALL_TOP_LDIR)/mime -INSTALL_MIME_CDIR=$(INSTALL_TOP_CDIR)/mime - -print: - @echo PLAT=$(PLAT) - @echo LUAV=$(LUAV) - @echo DEBUG=$(DEBUG) - @echo prefix=$(prefix) - @echo LUAINC_$(PLAT)=$(LUAINC_$(PLAT)) - @echo LUALIB_$(PLAT)=$(LUALIB_$(PLAT)) - @echo INSTALL_TOP_CDIR=$(INSTALL_TOP_CDIR) - @echo INSTALL_TOP_LDIR=$(INSTALL_TOP_LDIR) - @echo CFLAGS=$(CFLAGS) - @echo LDFLAGS=$(LDFLAGS) - -#------ -# Supported platforms -# -PLATS= macosx linux win32 mingw solaris - -#------ -# Compiler and linker settings -# for Mac OS X -SO_macosx=so -O_macosx=o -CC_macosx=gcc -DEF_macosx= -DLUASOCKET_$(DEBUG) -DUNIX_HAS_SUN_LEN \ - -DLUASOCKET_API='__attribute__((visibility("default")))' \ - -DUNIX_API='__attribute__((visibility("default")))' \ - -DMIME_API='__attribute__((visibility("default")))' -CFLAGS_macosx= -I$(LUAINC) $(DEF) -Wall -O2 -fno-common \ - -fvisibility=hidden -LDFLAGS_macosx= -bundle -undefined dynamic_lookup -o -LD_macosx= export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc -SOCKET_macosx=usocket.o - -#------ -# Compiler and linker settings -# for Linux -SO_linux=so -O_linux=o -CC_linux=gcc -DEF_linux=-DLUASOCKET_$(DEBUG) \ - -DLUASOCKET_API='__attribute__((visibility("default")))' \ - -DUNIX_API='__attribute__((visibility("default")))' \ - -DMIME_API='__attribute__((visibility("default")))' -CFLAGS_linux= -I$(LUAINC) $(DEF) -Wall -Wshadow -Wextra \ - -Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden -LDFLAGS_linux=-O -shared -fpic -o -LD_linux=gcc -SOCKET_linux=usocket.o - -#------ -# Compiler and linker settings -# for FreeBSD -SO_freebsd=so -O_freebsd=o -CC_freebsd=gcc -DEF_freebsd=-DLUASOCKET_$(DEBUG) \ - -DLUASOCKET_API='__attribute__((visibility("default")))' \ - -DUNIX_API='__attribute__((visibility("default")))' \ - -DMIME_API='__attribute__((visibility("default")))' -CFLAGS_freebsd= -I$(LUAINC) $(DEF) -Wall -Wshadow -Wextra \ - -Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden -LDFLAGS_freebsd=-O -shared -fpic -o -LD_freebsd=gcc -SOCKET_freebsd=usocket.o - -#------ -# Compiler and linker settings -# for Solaris -SO_solaris=so -O_solaris=o -CC_solaris=gcc -DEF_solaris=-DLUASOCKET_$(DEBUG) \ - -DLUASOCKET_API='__attribute__((visibility("default")))' \ - -DUNIX_API='__attribute__((visibility("default")))' \ - -DMIME_API='__attribute__((visibility("default")))' -CFLAGS_solaris=-I$(LUAINC) $(DEF) -Wall -Wshadow -Wextra \ - -Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden -LDFLAGS_solaris=-lnsl -lsocket -lresolv -O -shared -fpic -o -LD_solaris=gcc -SOCKET_solaris=usocket.o - -#------ -# Compiler and linker settings -# for MingW -SO_mingw=dll -O_mingw=o -CC_mingw=gcc -DEF_mingw= -DLUASOCKET_INET_PTON -DLUASOCKET_$(DEBUG) \ - -DWINVER=0x0501 -DLUASOCKET_API='__declspec(dllexport)' \ - -DMIME_API='__declspec(dllexport)' -CFLAGS_mingw= -I$(LUAINC) $(DEF) -Wall -O2 -fno-common \ - -fvisibility=hidden -LDFLAGS_mingw= $(LUALIB) -shared -Wl,-s -lws2_32 -o -LD_mingw=gcc -SOCKET_mingw=wsocket.o - - -#------ -# Compiler and linker settings -# for Win32 -SO_win32=dll -O_win32=obj -CC_win32=cl -DEF_win32= //D "WIN32" //D "NDEBUG" //D "_WINDOWS" //D "_USRDLL" \ - //D "LUASOCKET_API=__declspec(dllexport)" //D "_CRT_SECURE_NO_WARNINGS" \ - //D "_WINDLL" //D "MIME_API=__declspec(dllexport)" \ - //D "LUASOCKET_$(DEBUG)" -CFLAGS_win32=//I "$(LUAINC)" $(DEF) //O2 //Ot //MD //W3 //nologo -LDFLAGS_win32= //nologo //link //NOLOGO //DLL //INCREMENTAL:NO \ - //MANIFEST //MANIFESTFILE:"intermediate.manifest" \ - //MANIFESTUAC:"level='asInvoker' uiAccess='false'" \ - //SUBSYSTEM:WINDOWS //OPT:REF //OPT:ICF //DYNAMICBASE:NO \ - //MACHINE:X86 /LIBPATH:"$(shell cmd //c echo $(LUALIB))" \ - $(LUALIBNAME_win32) ws2_32.lib //OUT: -LD_win32=cl -SOCKET_win32=wsocket.obj - -.SUFFIXES: .obj - -.c.obj: - $(CC) $(CFLAGS) //Fo"$@" //c $< - -#------ -# Output file names -# -SO=$(SO_$(PLAT)) -O=$(O_$(PLAT)) -SOCKET_V=3.0-rc1 -MIME_V=1.0.3 -SOCKET_SO=socket-$(SOCKET_V).$(SO) -MIME_SO=mime-$(MIME_V).$(SO) -UNIX_SO=unix.$(SO) -SERIAL_SO=serial.$(SO) -SOCKET=$(SOCKET_$(PLAT)) - -#------ -# Settings selected for platform -# -CC=$(CC_$(PLAT)) -DEF=$(DEF_$(PLAT)) -CFLAGS=$(MYCFLAGS) $(CFLAGS_$(PLAT)) -LDFLAGS=$(MYLDFLAGS) $(LDFLAGS_$(PLAT)) -LD=$(LD_$(PLAT)) -LUAINC= $(LUAINC_$(PLAT)) -LUALIB= $(LUALIB_$(PLAT)) - -#------ -# Modules belonging to socket-core -# -SOCKET_OBJS= \ - luasocket.$(O) \ - timeout.$(O) \ - buffer.$(O) \ - io.$(O) \ - auxiliar.$(O) \ - compat.$(O) \ - options.$(O) \ - inet.$(O) \ - $(SOCKET) \ - except.$(O) \ - select.$(O) \ - tcp.$(O) \ - udp.$(O) - -#------ -# Modules belonging mime-core -# -MIME_OBJS= \ - mime.$(O) \ - compat.$(O) - -#------ -# Modules belonging unix (local domain sockets) -# -UNIX_OBJS=\ - buffer.$(O) \ - auxiliar.$(O) \ - options.$(O) \ - timeout.$(O) \ - io.$(O) \ - usocket.$(O) \ - unixtcp.$(O) \ - unixudp.$(O) \ - compat.$(O) \ - unix.$(O) - -#------ -# Modules belonging to serial (device streams) -# -SERIAL_OBJS=\ - buffer.$(O) \ - auxiliar.$(O) \ - options.$(O) \ - timeout.$(O) \ - io.$(O) \ - usocket.$(O) \ - serial.$(O) - -#------ -# Files to install -# -TO_SOCKET_LDIR= \ - http.lua \ - url.lua \ - tp.lua \ - ftp.lua \ - headers.lua \ - smtp.lua - -TO_TOP_LDIR= \ - ltn12.lua \ - socket.lua \ - mime.lua - -#------ -# Targets -# -default: $(PLAT) - - -freebsd: - $(MAKE) all-unix PLAT=freebsd - -macosx: - $(MAKE) all-unix PLAT=macosx - -win32: - $(MAKE) all PLAT=win32 - -linux: - $(MAKE) all-unix PLAT=linux - -mingw: - $(MAKE) all PLAT=mingw - -solaris: - $(MAKE) all-unix PLAT=solaris - -none: - @echo "Please run" - @echo " make PLATFORM" - @echo "where PLATFORM is one of these:" - @echo " $(PLATS)" - -all: $(SOCKET_SO) $(MIME_SO) - -$(SOCKET_SO): $(SOCKET_OBJS) - $(LD) $(SOCKET_OBJS) $(LDFLAGS)$@ - -$(MIME_SO): $(MIME_OBJS) - $(LD) $(MIME_OBJS) $(LDFLAGS)$@ - -all-unix: all $(UNIX_SO) $(SERIAL_SO) - -$(UNIX_SO): $(UNIX_OBJS) - $(LD) $(UNIX_OBJS) $(LDFLAGS)$@ - -$(SERIAL_SO): $(SERIAL_OBJS) - $(LD) $(SERIAL_OBJS) $(LDFLAGS)$@ - -install: - $(INSTALL_DIR) $(INSTALL_TOP_LDIR) - $(INSTALL_DATA) $(TO_TOP_LDIR) $(INSTALL_TOP_LDIR) - $(INSTALL_DIR) $(INSTALL_SOCKET_LDIR) - $(INSTALL_DATA) $(TO_SOCKET_LDIR) $(INSTALL_SOCKET_LDIR) - $(INSTALL_DIR) $(INSTALL_SOCKET_CDIR) - $(INSTALL_EXEC) $(SOCKET_SO) $(INSTALL_SOCKET_CDIR)/core.$(SO) - $(INSTALL_DIR) $(INSTALL_MIME_CDIR) - $(INSTALL_EXEC) $(MIME_SO) $(INSTALL_MIME_CDIR)/core.$(SO) - -install-unix: install - $(INSTALL_EXEC) $(UNIX_SO) $(INSTALL_SOCKET_CDIR)/$(UNIX_SO) - $(INSTALL_EXEC) $(SERIAL_SO) $(INSTALL_SOCKET_CDIR)/$(SERIAL_SO) - -local: - $(MAKE) install INSTALL_TOP_CDIR=.. INSTALL_TOP_LDIR=.. - -clean: - rm -f $(SOCKET_SO) $(SOCKET_OBJS) $(SERIAL_OBJS) - rm -f $(MIME_SO) $(UNIX_SO) $(SERIAL_SO) $(MIME_OBJS) $(UNIX_OBJS) - -.PHONY: all $(PLATS) default clean echo none - -#------ -# List of dependencies -# -compat.$(O): compat.c compat.h -auxiliar.$(O): auxiliar.c auxiliar.h -buffer.$(O): buffer.c buffer.h io.h timeout.h -except.$(O): except.c except.h -inet.$(O): inet.c inet.h socket.h io.h timeout.h usocket.h -io.$(O): io.c io.h timeout.h -luasocket.$(O): luasocket.c luasocket.h auxiliar.h except.h \ - timeout.h buffer.h io.h inet.h socket.h usocket.h tcp.h \ - udp.h select.h -mime.$(O): mime.c mime.h -options.$(O): options.c auxiliar.h options.h socket.h io.h \ - timeout.h usocket.h inet.h -select.$(O): select.c socket.h io.h timeout.h usocket.h select.h -serial.$(O): serial.c auxiliar.h socket.h io.h timeout.h usocket.h \ - options.h unix.h buffer.h -tcp.$(O): tcp.c auxiliar.h socket.h io.h timeout.h usocket.h \ - inet.h options.h tcp.h buffer.h -timeout.$(O): timeout.c auxiliar.h timeout.h -udp.$(O): udp.c auxiliar.h socket.h io.h timeout.h usocket.h \ - inet.h options.h udp.h -unix.$(O): unix.c auxiliar.h socket.h io.h timeout.h usocket.h \ - options.h unix.h buffer.h -usocket.$(O): usocket.c socket.h io.h timeout.h usocket.h -wsocket.$(O): wsocket.c socket.h io.h timeout.h usocket.h diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/mbox.lua b/love/src/jni/love/src/libraries/luasocket/libluasocket/mbox.lua deleted file mode 100644 index ed9e7814..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/mbox.lua +++ /dev/null @@ -1,92 +0,0 @@ -local _M = {} - -if module then - mbox = _M -end - -function _M.split_message(message_s) - local message = {} - message_s = string.gsub(message_s, "\r\n", "\n") - string.gsub(message_s, "^(.-\n)\n", function (h) message.headers = h end) - string.gsub(message_s, "^.-\n\n(.*)", function (b) message.body = b end) - if not message.body then - string.gsub(message_s, "^\n(.*)", function (b) message.body = b end) - end - if not message.headers and not message.body then - message.headers = message_s - end - return message.headers or "", message.body or "" -end - -function _M.split_headers(headers_s) - local headers = {} - headers_s = string.gsub(headers_s, "\r\n", "\n") - headers_s = string.gsub(headers_s, "\n[ ]+", " ") - string.gsub("\n" .. headers_s, "\n([^\n]+)", function (h) table.insert(headers, h) end) - return headers -end - -function _M.parse_header(header_s) - header_s = string.gsub(header_s, "\n[ ]+", " ") - header_s = string.gsub(header_s, "\n+", "") - local _, __, name, value = string.find(header_s, "([^%s:]-):%s*(.*)") - return name, value -end - -function _M.parse_headers(headers_s) - local headers_t = _M.split_headers(headers_s) - local headers = {} - for i = 1, #headers_t do - local name, value = _M.parse_header(headers_t[i]) - if name then - name = string.lower(name) - if headers[name] then - headers[name] = headers[name] .. ", " .. value - else headers[name] = value end - end - end - return headers -end - -function _M.parse_from(from) - local _, __, name, address = string.find(from, "^%s*(.-)%s*%<(.-)%>") - if not address then - _, __, address = string.find(from, "%s*(.+)%s*") - end - name = name or "" - address = address or "" - if name == "" then name = address end - name = string.gsub(name, '"', "") - return name, address -end - -function _M.split_mbox(mbox_s) - local mbox = {} - mbox_s = string.gsub(mbox_s, "\r\n", "\n") .."\n\nFrom \n" - local nj, i, j = 1, 1, 1 - while 1 do - i, nj = string.find(mbox_s, "\n\nFrom .-\n", j) - if not i then break end - local message = string.sub(mbox_s, j, i-1) - table.insert(mbox, message) - j = nj+1 - end - return mbox -end - -function _M.parse(mbox_s) - local mbox = _M.split_mbox(mbox_s) - for i = 1, #mbox do - mbox[i] = _M.parse_message(mbox[i]) - end - return mbox -end - -function _M.parse_message(message_s) - local message = {} - message.headers, message.body = _M.split_message(message_s) - message.headers = _M.parse_headers(message.headers) - return message -end - -return _M diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/mbox.lua.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/mbox.lua.h deleted file mode 100644 index f3edca97..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/mbox.lua.h +++ /dev/null @@ -1,144 +0,0 @@ -/* code automatically generated by bin2c -- DO NOT EDIT */ -{ -/* #include'ing this file in a C program is equivalent to calling - if (luaL_loadfile(L,"mbox.lua")==0) lua_call(L, 0, LUA_MULTRET); -*/ -/* mbox.lua */ -static const unsigned char B1[]={ -108,111, 99, 97,108, 32, 95, 77, 32, 61, 32,123,125, 10, 10,105,102, 32,109,111, -100,117,108,101, 32,116,104,101,110, 10, 32, 32, 32, 32,109, 98,111,120, 32, 61, - 32, 95, 77, 10,101,110,100, 32, 10, 10,102,117,110, 99,116,105,111,110, 32, 95, - 77, 46,115,112,108,105,116, 95,109,101,115,115, 97,103,101, 40,109,101,115,115, - 97,103,101, 95,115, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,109,101,115, -115, 97,103,101, 32, 61, 32,123,125, 10, 32, 32, 32, 32,109,101,115,115, 97,103, -101, 95,115, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,109,101, -115,115, 97,103,101, 95,115, 44, 32, 34, 92,114, 92,110, 34, 44, 32, 34, 92,110, - 34, 41, 10, 32, 32, 32, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,109, -101,115,115, 97,103,101, 95,115, 44, 32, 34, 94, 40, 46, 45, 92,110, 41, 92,110, - 34, 44, 32,102,117,110, 99,116,105,111,110, 32, 40,104, 41, 32,109,101,115,115, - 97,103,101, 46,104,101, 97,100,101,114,115, 32, 61, 32,104, 32,101,110,100, 41, - 10, 32, 32, 32, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,109,101,115, -115, 97,103,101, 95,115, 44, 32, 34, 94, 46, 45, 92,110, 92,110, 40, 46, 42, 41, - 34, 44, 32,102,117,110, 99,116,105,111,110, 32, 40, 98, 41, 32,109,101,115,115, - 97,103,101, 46, 98,111,100,121, 32, 61, 32, 98, 32,101,110,100, 41, 10, 32, 32, - 32, 32,105,102, 32,110,111,116, 32,109,101,115,115, 97,103,101, 46, 98,111,100, -121, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32,115,116,114,105,110, -103, 46,103,115,117, 98, 40,109,101,115,115, 97,103,101, 95,115, 44, 32, 34, 94, - 92,110, 40, 46, 42, 41, 34, 44, 32,102,117,110, 99,116,105,111,110, 32, 40, 98, - 41, 32,109,101,115,115, 97,103,101, 46, 98,111,100,121, 32, 61, 32, 98, 32,101, -110,100, 41, 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,105,102, 32,110, -111,116, 32,109,101,115,115, 97,103,101, 46,104,101, 97,100,101,114,115, 32, 97, -110,100, 32,110,111,116, 32,109,101,115,115, 97,103,101, 46, 98,111,100,121, 32, -116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32,109,101,115,115, 97,103,101, - 46,104,101, 97,100,101,114,115, 32, 61, 32,109,101,115,115, 97,103,101, 95,115, - 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32, -109,101,115,115, 97,103,101, 46,104,101, 97,100,101,114,115, 32,111,114, 32, 34, - 34, 44, 32,109,101,115,115, 97,103,101, 46, 98,111,100,121, 32,111,114, 32, 34, - 34, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32, 95, 77, 46,115, -112,108,105,116, 95,104,101, 97,100,101,114,115, 40,104,101, 97,100,101,114,115, - 95,115, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,104,101, 97,100,101,114, -115, 32, 61, 32,123,125, 10, 32, 32, 32, 32,104,101, 97,100,101,114,115, 95,115, - 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,104,101, 97,100,101, -114,115, 95,115, 44, 32, 34, 92,114, 92,110, 34, 44, 32, 34, 92,110, 34, 41, 10, - 32, 32, 32, 32,104,101, 97,100,101,114,115, 95,115, 32, 61, 32,115,116,114,105, -110,103, 46,103,115,117, 98, 40,104,101, 97,100,101,114,115, 95,115, 44, 32, 34, - 92,110, 91, 32, 93, 43, 34, 44, 32, 34, 32, 34, 41, 10, 32, 32, 32, 32,115,116, -114,105,110,103, 46,103,115,117, 98, 40, 34, 92,110, 34, 32, 46, 46, 32,104,101, - 97,100,101,114,115, 95,115, 44, 32, 34, 92,110, 40, 91, 94, 92,110, 93, 43, 41, - 34, 44, 32,102,117,110, 99,116,105,111,110, 32, 40,104, 41, 32,116, 97, 98,108, -101, 46,105,110,115,101,114,116, 40,104,101, 97,100,101,114,115, 44, 32,104, 41, - 32,101,110,100, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,104,101, 97, -100,101,114,115, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32, 95, - 77, 46,112, 97,114,115,101, 95,104,101, 97,100,101,114, 40,104,101, 97,100,101, -114, 95,115, 41, 10, 32, 32, 32, 32,104,101, 97,100,101,114, 95,115, 32, 61, 32, -115,116,114,105,110,103, 46,103,115,117, 98, 40,104,101, 97,100,101,114, 95,115, - 44, 32, 34, 92,110, 91, 32, 93, 43, 34, 44, 32, 34, 32, 34, 41, 10, 32, 32, 32, - 32,104,101, 97,100,101,114, 95,115, 32, 61, 32,115,116,114,105,110,103, 46,103, -115,117, 98, 40,104,101, 97,100,101,114, 95,115, 44, 32, 34, 92,110, 43, 34, 44, - 32, 34, 34, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32, 95, 44, 32, 95, 95, - 44, 32,110, 97,109,101, 44, 32,118, 97,108,117,101, 32, 61, 32,115,116,114,105, -110,103, 46,102,105,110,100, 40,104,101, 97,100,101,114, 95,115, 44, 32, 34, 40, - 91, 94, 37,115, 58, 93, 45, 41, 58, 37,115, 42, 40, 46, 42, 41, 34, 41, 10, 32, - 32, 32, 32,114,101,116,117,114,110, 32,110, 97,109,101, 44, 32,118, 97,108,117, -101, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32, 95, 77, 46,112, - 97,114,115,101, 95,104,101, 97,100,101,114,115, 40,104,101, 97,100,101,114,115, - 95,115, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,104,101, 97,100,101,114, -115, 95,116, 32, 61, 32, 95, 77, 46,115,112,108,105,116, 95,104,101, 97,100,101, -114,115, 40,104,101, 97,100,101,114,115, 95,115, 41, 10, 32, 32, 32, 32,108,111, - 99, 97,108, 32,104,101, 97,100,101,114,115, 32, 61, 32,123,125, 10, 32, 32, 32, - 32,102,111,114, 32,105, 32, 61, 32, 49, 44, 32, 35,104,101, 97,100,101,114,115, - 95,116, 32,100,111, 10, 32, 32, 32, 32, 32, 32, 32, 32,108,111, 99, 97,108, 32, -110, 97,109,101, 44, 32,118, 97,108,117,101, 32, 61, 32, 95, 77, 46,112, 97,114, -115,101, 95,104,101, 97,100,101,114, 40,104,101, 97,100,101,114,115, 95,116, 91, -105, 93, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,110, 97,109,101, 32, -116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,110, 97,109, -101, 32, 61, 32,115,116,114,105,110,103, 46,108,111,119,101,114, 40,110, 97,109, -101, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,104,101, - 97,100,101,114,115, 91,110, 97,109,101, 93, 32,116,104,101,110, 10, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,104,101, 97,100,101,114,115, - 91,110, 97,109,101, 93, 32, 61, 32,104,101, 97,100,101,114,115, 91,110, 97,109, -101, 93, 32, 46, 46, 32, 34, 44, 32, 34, 32, 46, 46, 32,118, 97,108,117,101, 10, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,108,115,101, 32,104,101, 97, -100,101,114,115, 91,110, 97,109,101, 93, 32, 61, 32,118, 97,108,117,101, 32,101, -110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,101, -110,100, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,104,101, 97,100,101,114, -115, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32, 95, 77, 46,112, - 97,114,115,101, 95,102,114,111,109, 40,102,114,111,109, 41, 10, 32, 32, 32, 32, -108,111, 99, 97,108, 32, 95, 44, 32, 95, 95, 44, 32,110, 97,109,101, 44, 32, 97, -100,100,114,101,115,115, 32, 61, 32,115,116,114,105,110,103, 46,102,105,110,100, - 40,102,114,111,109, 44, 32, 34, 94, 37,115, 42, 40, 46, 45, 41, 37,115, 42, 37, - 60, 40, 46, 45, 41, 37, 62, 34, 41, 10, 32, 32, 32, 32,105,102, 32,110,111,116, - 32, 97,100,100,114,101,115,115, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, - 32, 32, 95, 44, 32, 95, 95, 44, 32, 97,100,100,114,101,115,115, 32, 61, 32,115, -116,114,105,110,103, 46,102,105,110,100, 40,102,114,111,109, 44, 32, 34, 37,115, - 42, 40, 46, 43, 41, 37,115, 42, 34, 41, 10, 32, 32, 32, 32,101,110,100, 10, 32, - 32, 32, 32,110, 97,109,101, 32, 61, 32,110, 97,109,101, 32,111,114, 32, 34, 34, - 10, 32, 32, 32, 32, 97,100,100,114,101,115,115, 32, 61, 32, 97,100,100,114,101, -115,115, 32,111,114, 32, 34, 34, 10, 32, 32, 32, 32,105,102, 32,110, 97,109,101, - 32, 61, 61, 32, 34, 34, 32,116,104,101,110, 32,110, 97,109,101, 32, 61, 32, 97, -100,100,114,101,115,115, 32,101,110,100, 10, 32, 32, 32, 32,110, 97,109,101, 32, - 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,110, 97,109,101, 44, 32, - 39, 34, 39, 44, 32, 34, 34, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32, -110, 97,109,101, 44, 32, 97,100,100,114,101,115,115, 10,101,110,100, 10, 10,102, -117,110, 99,116,105,111,110, 32, 95, 77, 46,115,112,108,105,116, 95,109, 98,111, -120, 40,109, 98,111,120, 95,115, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32, -109, 98,111,120, 32, 61, 32,123,125, 10, 32, 32, 32, 32,109, 98,111,120, 95,115, - 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,109, 98,111,120, 95, -115, 44, 32, 34, 92,114, 92,110, 34, 44, 32, 34, 92,110, 34, 41, 32, 46, 46, 34, - 92,110, 92,110, 70,114,111,109, 32, 92,110, 34, 10, 32, 32, 32, 32,108,111, 99, - 97,108, 32,110,106, 44, 32,105, 44, 32,106, 32, 61, 32, 49, 44, 32, 49, 44, 32, - 49, 10, 32, 32, 32, 32,119,104,105,108,101, 32, 49, 32,100,111, 10, 32, 32, 32, - 32, 32, 32, 32, 32,105, 44, 32,110,106, 32, 61, 32,115,116,114,105,110,103, 46, -102,105,110,100, 40,109, 98,111,120, 95,115, 44, 32, 34, 92,110, 92,110, 70,114, -111,109, 32, 46, 45, 92,110, 34, 44, 32,106, 41, 10, 32, 32, 32, 32, 32, 32, 32, - 32,105,102, 32,110,111,116, 32,105, 32,116,104,101,110, 32, 98,114,101, 97,107, - 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32,108,111, 99, 97,108, 32,109, -101,115,115, 97,103,101, 32, 61, 32,115,116,114,105,110,103, 46,115,117, 98, 40, -109, 98,111,120, 95,115, 44, 32,106, 44, 32,105, 45, 49, 41, 10, 32, 32, 32, 32, - 32, 32, 32, 32,116, 97, 98,108,101, 46,105,110,115,101,114,116, 40,109, 98,111, -120, 44, 32,109,101,115,115, 97,103,101, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, -106, 32, 61, 32,110,106, 43, 49, 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, - 32,114,101,116,117,114,110, 32,109, 98,111,120, 10,101,110,100, 10, 10,102,117, -110, 99,116,105,111,110, 32, 95, 77, 46,112, 97,114,115,101, 40,109, 98,111,120, - 95,115, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,109, 98,111,120, 32, 61, - 32, 95, 77, 46,115,112,108,105,116, 95,109, 98,111,120, 40,109, 98,111,120, 95, -115, 41, 10, 32, 32, 32, 32,102,111,114, 32,105, 32, 61, 32, 49, 44, 32, 35,109, - 98,111,120, 32,100,111, 10, 32, 32, 32, 32, 32, 32, 32, 32,109, 98,111,120, 91, -105, 93, 32, 61, 32, 95, 77, 46,112, 97,114,115,101, 95,109,101,115,115, 97,103, -101, 40,109, 98,111,120, 91,105, 93, 41, 10, 32, 32, 32, 32,101,110,100, 10, 32, - 32, 32, 32,114,101,116,117,114,110, 32,109, 98,111,120, 10,101,110,100, 10, 10, -102,117,110, 99,116,105,111,110, 32, 95, 77, 46,112, 97,114,115,101, 95,109,101, -115,115, 97,103,101, 40,109,101,115,115, 97,103,101, 95,115, 41, 10, 32, 32, 32, - 32,108,111, 99, 97,108, 32,109,101,115,115, 97,103,101, 32, 61, 32,123,125, 10, - 32, 32, 32, 32,109,101,115,115, 97,103,101, 46,104,101, 97,100,101,114,115, 44, - 32,109,101,115,115, 97,103,101, 46, 98,111,100,121, 32, 61, 32, 95, 77, 46,115, -112,108,105,116, 95,109,101,115,115, 97,103,101, 40,109,101,115,115, 97,103,101, - 95,115, 41, 10, 32, 32, 32, 32,109,101,115,115, 97,103,101, 46,104,101, 97,100, -101,114,115, 32, 61, 32, 95, 77, 46,112, 97,114,115,101, 95,104,101, 97,100,101, -114,115, 40,109,101,115,115, 97,103,101, 46,104,101, 97,100,101,114,115, 41, 10, - 32, 32, 32, 32,114,101,116,117,114,110, 32,109,101,115,115, 97,103,101, 10,101, -110,100, 10, 10,114,101,116,117,114,110, 32, 95, 77, 10, -}; - - if (luaL_loadbuffer(L,(const char*)B1,sizeof(B1),"mbox.lua")==0) lua_call(L, 0, LUA_MULTRET); -} diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/mime.c b/love/src/jni/love/src/libraries/luasocket/libluasocket/mime.c deleted file mode 100644 index ed441046..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/mime.c +++ /dev/null @@ -1,721 +0,0 @@ -/*=========================================================================*\ -* MIME support functions -* LuaSocket toolkit -\*=========================================================================*/ -#include - -#include "lua.h" -#include "lauxlib.h" -#include "compat.h" - -#include "mime.h" - -/*=========================================================================*\ -* Don't want to trust escape character constants -\*=========================================================================*/ -typedef unsigned char UC; -static const char CRLF[] = "\r\n"; -static const char EQCRLF[] = "=\r\n"; - -/*=========================================================================*\ -* Internal function prototypes. -\*=========================================================================*/ -static int mime_global_wrp(lua_State *L); -static int mime_global_b64(lua_State *L); -static int mime_global_unb64(lua_State *L); -static int mime_global_qp(lua_State *L); -static int mime_global_unqp(lua_State *L); -static int mime_global_qpwrp(lua_State *L); -static int mime_global_eol(lua_State *L); -static int mime_global_dot(lua_State *L); - -static size_t dot(int c, size_t state, luaL_Buffer *buffer); -static void b64setup(UC *base); -static size_t b64encode(UC c, UC *input, size_t size, luaL_Buffer *buffer); -static size_t b64pad(const UC *input, size_t size, luaL_Buffer *buffer); -static size_t b64decode(UC c, UC *input, size_t size, luaL_Buffer *buffer); - -static void qpsetup(UC *class, UC *unbase); -static void qpquote(UC c, luaL_Buffer *buffer); -static size_t qpdecode(UC c, UC *input, size_t size, luaL_Buffer *buffer); -static size_t qpencode(UC c, UC *input, size_t size, - const char *marker, luaL_Buffer *buffer); -static size_t qppad(UC *input, size_t size, luaL_Buffer *buffer); - -/* code support functions */ -static luaL_Reg func[] = { - { "dot", mime_global_dot }, - { "b64", mime_global_b64 }, - { "eol", mime_global_eol }, - { "qp", mime_global_qp }, - { "qpwrp", mime_global_qpwrp }, - { "unb64", mime_global_unb64 }, - { "unqp", mime_global_unqp }, - { "wrp", mime_global_wrp }, - { NULL, NULL } -}; - -/*-------------------------------------------------------------------------*\ -* Quoted-printable globals -\*-------------------------------------------------------------------------*/ -static UC qpclass[256]; -static UC qpbase[] = "0123456789ABCDEF"; -static UC qpunbase[256]; -enum {QP_PLAIN, QP_QUOTED, QP_CR, QP_IF_LAST}; - -/*-------------------------------------------------------------------------*\ -* Base64 globals -\*-------------------------------------------------------------------------*/ -static const UC b64base[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -static UC b64unbase[256]; - -/*=========================================================================*\ -* Exported functions -\*=========================================================================*/ -/*-------------------------------------------------------------------------*\ -* Initializes module -\*-------------------------------------------------------------------------*/ -MIME_API int luaopen_mime_core(lua_State *L) -{ - lua_newtable(L); - luaL_setfuncs(L, func, 0); - /* make version string available to scripts */ - lua_pushstring(L, "_VERSION"); - lua_pushstring(L, MIME_VERSION); - lua_rawset(L, -3); - /* initialize lookup tables */ - qpsetup(qpclass, qpunbase); - b64setup(b64unbase); - return 1; -} - -/*=========================================================================*\ -* Global Lua functions -\*=========================================================================*/ -/*-------------------------------------------------------------------------*\ -* Incrementaly breaks a string into lines. The string can have CRLF breaks. -* A, n = wrp(l, B, length) -* A is a copy of B, broken into lines of at most 'length' bytes. -* 'l' is how many bytes are left for the first line of B. -* 'n' is the number of bytes left in the last line of A. -\*-------------------------------------------------------------------------*/ -static int mime_global_wrp(lua_State *L) -{ - size_t size = 0; - int left = (int) luaL_checknumber(L, 1); - const UC *input = (const UC *) luaL_optlstring(L, 2, NULL, &size); - const UC *last = input + size; - int length = (int) luaL_optnumber(L, 3, 76); - luaL_Buffer buffer; - /* end of input black-hole */ - if (!input) { - /* if last line has not been terminated, add a line break */ - if (left < length) lua_pushstring(L, CRLF); - /* otherwise, we are done */ - else lua_pushnil(L); - lua_pushnumber(L, length); - return 2; - } - luaL_buffinit(L, &buffer); - while (input < last) { - switch (*input) { - case '\r': - break; - case '\n': - luaL_addstring(&buffer, CRLF); - left = length; - break; - default: - if (left <= 0) { - left = length; - luaL_addstring(&buffer, CRLF); - } - luaL_addchar(&buffer, *input); - left--; - break; - } - input++; - } - luaL_pushresult(&buffer); - lua_pushnumber(L, left); - return 2; -} - -/*-------------------------------------------------------------------------*\ -* Fill base64 decode map. -\*-------------------------------------------------------------------------*/ -static void b64setup(UC *unbase) -{ - int i; - for (i = 0; i <= 255; i++) unbase[i] = (UC) 255; - for (i = 0; i < 64; i++) unbase[b64base[i]] = (UC) i; - unbase['='] = 0; -} - -/*-------------------------------------------------------------------------*\ -* Acumulates bytes in input buffer until 3 bytes are available. -* Translate the 3 bytes into Base64 form and append to buffer. -* Returns new number of bytes in buffer. -\*-------------------------------------------------------------------------*/ -static size_t b64encode(UC c, UC *input, size_t size, - luaL_Buffer *buffer) -{ - input[size++] = c; - if (size == 3) { - UC code[4]; - unsigned long value = 0; - value += input[0]; value <<= 8; - value += input[1]; value <<= 8; - value += input[2]; - code[3] = b64base[value & 0x3f]; value >>= 6; - code[2] = b64base[value & 0x3f]; value >>= 6; - code[1] = b64base[value & 0x3f]; value >>= 6; - code[0] = b64base[value]; - luaL_addlstring(buffer, (char *) code, 4); - size = 0; - } - return size; -} - -/*-------------------------------------------------------------------------*\ -* Encodes the Base64 last 1 or 2 bytes and adds padding '=' -* Result, if any, is appended to buffer. -* Returns 0. -\*-------------------------------------------------------------------------*/ -static size_t b64pad(const UC *input, size_t size, - luaL_Buffer *buffer) -{ - unsigned long value = 0; - UC code[4] = {'=', '=', '=', '='}; - switch (size) { - case 1: - value = input[0] << 4; - code[1] = b64base[value & 0x3f]; value >>= 6; - code[0] = b64base[value]; - luaL_addlstring(buffer, (char *) code, 4); - break; - case 2: - value = input[0]; value <<= 8; - value |= input[1]; value <<= 2; - code[2] = b64base[value & 0x3f]; value >>= 6; - code[1] = b64base[value & 0x3f]; value >>= 6; - code[0] = b64base[value]; - luaL_addlstring(buffer, (char *) code, 4); - break; - default: - break; - } - return 0; -} - -/*-------------------------------------------------------------------------*\ -* Acumulates bytes in input buffer until 4 bytes are available. -* Translate the 4 bytes from Base64 form and append to buffer. -* Returns new number of bytes in buffer. -\*-------------------------------------------------------------------------*/ -static size_t b64decode(UC c, UC *input, size_t size, - luaL_Buffer *buffer) -{ - /* ignore invalid characters */ - if (b64unbase[c] > 64) return size; - input[size++] = c; - /* decode atom */ - if (size == 4) { - UC decoded[3]; - int valid, value = 0; - value = b64unbase[input[0]]; value <<= 6; - value |= b64unbase[input[1]]; value <<= 6; - value |= b64unbase[input[2]]; value <<= 6; - value |= b64unbase[input[3]]; - decoded[2] = (UC) (value & 0xff); value >>= 8; - decoded[1] = (UC) (value & 0xff); value >>= 8; - decoded[0] = (UC) value; - /* take care of paddding */ - valid = (input[2] == '=') ? 1 : (input[3] == '=') ? 2 : 3; - luaL_addlstring(buffer, (char *) decoded, valid); - return 0; - /* need more data */ - } else return size; -} - -/*-------------------------------------------------------------------------*\ -* Incrementally applies the Base64 transfer content encoding to a string -* A, B = b64(C, D) -* A is the encoded version of the largest prefix of C .. D that is -* divisible by 3. B has the remaining bytes of C .. D, *without* encoding. -* The easiest thing would be to concatenate the two strings and -* encode the result, but we can't afford that or Lua would dupplicate -* every chunk we received. -\*-------------------------------------------------------------------------*/ -static int mime_global_b64(lua_State *L) -{ - UC atom[3]; - size_t isize = 0, asize = 0; - const UC *input = (const UC *) luaL_optlstring(L, 1, NULL, &isize); - const UC *last = input + isize; - luaL_Buffer buffer; - /* end-of-input blackhole */ - if (!input) { - lua_pushnil(L); - lua_pushnil(L); - return 2; - } - /* make sure we don't confuse buffer stuff with arguments */ - lua_settop(L, 2); - /* process first part of the input */ - luaL_buffinit(L, &buffer); - while (input < last) - asize = b64encode(*input++, atom, asize, &buffer); - input = (const UC *) luaL_optlstring(L, 2, NULL, &isize); - /* if second part is nil, we are done */ - if (!input) { - size_t osize = 0; - asize = b64pad(atom, asize, &buffer); - luaL_pushresult(&buffer); - /* if the output is empty and the input is nil, return nil */ - lua_tolstring(L, -1, &osize); - if (osize == 0) lua_pushnil(L); - lua_pushnil(L); - return 2; - } - /* otherwise process the second part */ - last = input + isize; - while (input < last) - asize = b64encode(*input++, atom, asize, &buffer); - luaL_pushresult(&buffer); - lua_pushlstring(L, (char *) atom, asize); - return 2; -} - -/*-------------------------------------------------------------------------*\ -* Incrementally removes the Base64 transfer content encoding from a string -* A, B = b64(C, D) -* A is the encoded version of the largest prefix of C .. D that is -* divisible by 4. B has the remaining bytes of C .. D, *without* encoding. -\*-------------------------------------------------------------------------*/ -static int mime_global_unb64(lua_State *L) -{ - UC atom[4]; - size_t isize = 0, asize = 0; - const UC *input = (const UC *) luaL_optlstring(L, 1, NULL, &isize); - const UC *last = input + isize; - luaL_Buffer buffer; - /* end-of-input blackhole */ - if (!input) { - lua_pushnil(L); - lua_pushnil(L); - return 2; - } - /* make sure we don't confuse buffer stuff with arguments */ - lua_settop(L, 2); - /* process first part of the input */ - luaL_buffinit(L, &buffer); - while (input < last) - asize = b64decode(*input++, atom, asize, &buffer); - input = (const UC *) luaL_optlstring(L, 2, NULL, &isize); - /* if second is nil, we are done */ - if (!input) { - size_t osize = 0; - luaL_pushresult(&buffer); - /* if the output is empty and the input is nil, return nil */ - lua_tolstring(L, -1, &osize); - if (osize == 0) lua_pushnil(L); - lua_pushnil(L); - return 2; - } - /* otherwise, process the rest of the input */ - last = input + isize; - while (input < last) - asize = b64decode(*input++, atom, asize, &buffer); - luaL_pushresult(&buffer); - lua_pushlstring(L, (char *) atom, asize); - return 2; -} - -/*-------------------------------------------------------------------------*\ -* Quoted-printable encoding scheme -* all (except CRLF in text) can be =XX -* CLRL in not text must be =XX=XX -* 33 through 60 inclusive can be plain -* 62 through 126 inclusive can be plain -* 9 and 32 can be plain, unless in the end of a line, where must be =XX -* encoded lines must be no longer than 76 not counting CRLF -* soft line-break are =CRLF -* To encode one byte, we need to see the next two. -* Worst case is when we see a space, and wonder if a CRLF is comming -\*-------------------------------------------------------------------------*/ -/*-------------------------------------------------------------------------*\ -* Split quoted-printable characters into classes -* Precompute reverse map for encoding -\*-------------------------------------------------------------------------*/ -static void qpsetup(UC *cl, UC *unbase) -{ - int i; - for (i = 0; i < 256; i++) cl[i] = QP_QUOTED; - for (i = 33; i <= 60; i++) cl[i] = QP_PLAIN; - for (i = 62; i <= 126; i++) cl[i] = QP_PLAIN; - cl['\t'] = QP_IF_LAST; - cl[' '] = QP_IF_LAST; - cl['\r'] = QP_CR; - for (i = 0; i < 256; i++) unbase[i] = 255; - unbase['0'] = 0; unbase['1'] = 1; unbase['2'] = 2; - unbase['3'] = 3; unbase['4'] = 4; unbase['5'] = 5; - unbase['6'] = 6; unbase['7'] = 7; unbase['8'] = 8; - unbase['9'] = 9; unbase['A'] = 10; unbase['a'] = 10; - unbase['B'] = 11; unbase['b'] = 11; unbase['C'] = 12; - unbase['c'] = 12; unbase['D'] = 13; unbase['d'] = 13; - unbase['E'] = 14; unbase['e'] = 14; unbase['F'] = 15; - unbase['f'] = 15; -} - -/*-------------------------------------------------------------------------*\ -* Output one character in form =XX -\*-------------------------------------------------------------------------*/ -static void qpquote(UC c, luaL_Buffer *buffer) -{ - luaL_addchar(buffer, '='); - luaL_addchar(buffer, qpbase[c >> 4]); - luaL_addchar(buffer, qpbase[c & 0x0F]); -} - -/*-------------------------------------------------------------------------*\ -* Accumulate characters until we are sure about how to deal with them. -* Once we are sure, output to the buffer, in the correct form. -\*-------------------------------------------------------------------------*/ -static size_t qpencode(UC c, UC *input, size_t size, - const char *marker, luaL_Buffer *buffer) -{ - input[size++] = c; - /* deal with all characters we can have */ - while (size > 0) { - switch (qpclass[input[0]]) { - /* might be the CR of a CRLF sequence */ - case QP_CR: - if (size < 2) return size; - if (input[1] == '\n') { - luaL_addstring(buffer, marker); - return 0; - } else qpquote(input[0], buffer); - break; - /* might be a space and that has to be quoted if last in line */ - case QP_IF_LAST: - if (size < 3) return size; - /* if it is the last, quote it and we are done */ - if (input[1] == '\r' && input[2] == '\n') { - qpquote(input[0], buffer); - luaL_addstring(buffer, marker); - return 0; - } else luaL_addchar(buffer, input[0]); - break; - /* might have to be quoted always */ - case QP_QUOTED: - qpquote(input[0], buffer); - break; - /* might never have to be quoted */ - default: - luaL_addchar(buffer, input[0]); - break; - } - input[0] = input[1]; input[1] = input[2]; - size--; - } - return 0; -} - -/*-------------------------------------------------------------------------*\ -* Deal with the final characters -\*-------------------------------------------------------------------------*/ -static size_t qppad(UC *input, size_t size, luaL_Buffer *buffer) -{ - size_t i; - for (i = 0; i < size; i++) { - if (qpclass[input[i]] == QP_PLAIN) luaL_addchar(buffer, input[i]); - else qpquote(input[i], buffer); - } - if (size > 0) luaL_addstring(buffer, EQCRLF); - return 0; -} - -/*-------------------------------------------------------------------------*\ -* Incrementally converts a string to quoted-printable -* A, B = qp(C, D, marker) -* Marker is the text to be used to replace CRLF sequences found in A. -* A is the encoded version of the largest prefix of C .. D that -* can be encoded without doubts. -* B has the remaining bytes of C .. D, *without* encoding. -\*-------------------------------------------------------------------------*/ -static int mime_global_qp(lua_State *L) -{ - - size_t asize = 0, isize = 0; - UC atom[3]; - const UC *input = (const UC *) luaL_optlstring(L, 1, NULL, &isize); - const UC *last = input + isize; - const char *marker = luaL_optstring(L, 3, CRLF); - luaL_Buffer buffer; - /* end-of-input blackhole */ - if (!input) { - lua_pushnil(L); - lua_pushnil(L); - return 2; - } - /* make sure we don't confuse buffer stuff with arguments */ - lua_settop(L, 3); - /* process first part of input */ - luaL_buffinit(L, &buffer); - while (input < last) - asize = qpencode(*input++, atom, asize, marker, &buffer); - input = (const UC *) luaL_optlstring(L, 2, NULL, &isize); - /* if second part is nil, we are done */ - if (!input) { - asize = qppad(atom, asize, &buffer); - luaL_pushresult(&buffer); - if (!(*lua_tostring(L, -1))) lua_pushnil(L); - lua_pushnil(L); - return 2; - } - /* otherwise process rest of input */ - last = input + isize; - while (input < last) - asize = qpencode(*input++, atom, asize, marker, &buffer); - luaL_pushresult(&buffer); - lua_pushlstring(L, (char *) atom, asize); - return 2; -} - -/*-------------------------------------------------------------------------*\ -* Accumulate characters until we are sure about how to deal with them. -* Once we are sure, output the to the buffer, in the correct form. -\*-------------------------------------------------------------------------*/ -static size_t qpdecode(UC c, UC *input, size_t size, luaL_Buffer *buffer) { - int d; - input[size++] = c; - /* deal with all characters we can deal */ - switch (input[0]) { - /* if we have an escape character */ - case '=': - if (size < 3) return size; - /* eliminate soft line break */ - if (input[1] == '\r' && input[2] == '\n') return 0; - /* decode quoted representation */ - c = qpunbase[input[1]]; d = qpunbase[input[2]]; - /* if it is an invalid, do not decode */ - if (c > 15 || d > 15) luaL_addlstring(buffer, (char *)input, 3); - else luaL_addchar(buffer, (char) ((c << 4) + d)); - return 0; - case '\r': - if (size < 2) return size; - if (input[1] == '\n') luaL_addlstring(buffer, (char *)input, 2); - return 0; - default: - if (input[0] == '\t' || (input[0] > 31 && input[0] < 127)) - luaL_addchar(buffer, input[0]); - return 0; - } -} - -/*-------------------------------------------------------------------------*\ -* Incrementally decodes a string in quoted-printable -* A, B = qp(C, D) -* A is the decoded version of the largest prefix of C .. D that -* can be decoded without doubts. -* B has the remaining bytes of C .. D, *without* decoding. -\*-------------------------------------------------------------------------*/ -static int mime_global_unqp(lua_State *L) -{ - size_t asize = 0, isize = 0; - UC atom[3]; - const UC *input = (const UC *) luaL_optlstring(L, 1, NULL, &isize); - const UC *last = input + isize; - luaL_Buffer buffer; - /* end-of-input blackhole */ - if (!input) { - lua_pushnil(L); - lua_pushnil(L); - return 2; - } - /* make sure we don't confuse buffer stuff with arguments */ - lua_settop(L, 2); - /* process first part of input */ - luaL_buffinit(L, &buffer); - while (input < last) - asize = qpdecode(*input++, atom, asize, &buffer); - input = (const UC *) luaL_optlstring(L, 2, NULL, &isize); - /* if second part is nil, we are done */ - if (!input) { - luaL_pushresult(&buffer); - if (!(*lua_tostring(L, -1))) lua_pushnil(L); - lua_pushnil(L); - return 2; - } - /* otherwise process rest of input */ - last = input + isize; - while (input < last) - asize = qpdecode(*input++, atom, asize, &buffer); - luaL_pushresult(&buffer); - lua_pushlstring(L, (char *) atom, asize); - return 2; -} - -/*-------------------------------------------------------------------------*\ -* Incrementally breaks a quoted-printed string into lines -* A, n = qpwrp(l, B, length) -* A is a copy of B, broken into lines of at most 'length' bytes. -* 'l' is how many bytes are left for the first line of B. -* 'n' is the number of bytes left in the last line of A. -* There are two complications: lines can't be broken in the middle -* of an encoded =XX, and there might be line breaks already -\*-------------------------------------------------------------------------*/ -static int mime_global_qpwrp(lua_State *L) -{ - size_t size = 0; - int left = (int) luaL_checknumber(L, 1); - const UC *input = (const UC *) luaL_optlstring(L, 2, NULL, &size); - const UC *last = input + size; - int length = (int) luaL_optnumber(L, 3, 76); - luaL_Buffer buffer; - /* end-of-input blackhole */ - if (!input) { - if (left < length) lua_pushstring(L, EQCRLF); - else lua_pushnil(L); - lua_pushnumber(L, length); - return 2; - } - /* process all input */ - luaL_buffinit(L, &buffer); - while (input < last) { - switch (*input) { - case '\r': - break; - case '\n': - left = length; - luaL_addstring(&buffer, CRLF); - break; - case '=': - if (left <= 3) { - left = length; - luaL_addstring(&buffer, EQCRLF); - } - luaL_addchar(&buffer, *input); - left--; - break; - default: - if (left <= 1) { - left = length; - luaL_addstring(&buffer, EQCRLF); - } - luaL_addchar(&buffer, *input); - left--; - break; - } - input++; - } - luaL_pushresult(&buffer); - lua_pushnumber(L, left); - return 2; -} - -/*-------------------------------------------------------------------------*\ -* Here is what we do: \n, and \r are considered candidates for line -* break. We issue *one* new line marker if any of them is seen alone, or -* followed by a different one. That is, \n\n and \r\r will issue two -* end of line markers each, but \r\n, \n\r etc will only issue *one* -* marker. This covers Mac OS, Mac OS X, VMS, Unix and DOS, as well as -* probably other more obscure conventions. -* -* c is the current character being processed -* last is the previous character -\*-------------------------------------------------------------------------*/ -#define eolcandidate(c) (c == '\r' || c == '\n') -static int eolprocess(int c, int last, const char *marker, - luaL_Buffer *buffer) -{ - if (eolcandidate(c)) { - if (eolcandidate(last)) { - if (c == last) luaL_addstring(buffer, marker); - return 0; - } else { - luaL_addstring(buffer, marker); - return c; - } - } else { - luaL_addchar(buffer, (char) c); - return 0; - } -} - -/*-------------------------------------------------------------------------*\ -* Converts a string to uniform EOL convention. -* A, n = eol(o, B, marker) -* A is the converted version of the largest prefix of B that can be -* converted unambiguously. 'o' is the context returned by the previous -* call. 'n' is the new context. -\*-------------------------------------------------------------------------*/ -static int mime_global_eol(lua_State *L) -{ - int ctx = luaL_checkinteger(L, 1); - size_t isize = 0; - const char *input = luaL_optlstring(L, 2, NULL, &isize); - const char *last = input + isize; - const char *marker = luaL_optstring(L, 3, CRLF); - luaL_Buffer buffer; - luaL_buffinit(L, &buffer); - /* end of input blackhole */ - if (!input) { - lua_pushnil(L); - lua_pushnumber(L, 0); - return 2; - } - /* process all input */ - while (input < last) - ctx = eolprocess(*input++, ctx, marker, &buffer); - luaL_pushresult(&buffer); - lua_pushnumber(L, ctx); - return 2; -} - -/*-------------------------------------------------------------------------*\ -* Takes one byte and stuff it if needed. -\*-------------------------------------------------------------------------*/ -static size_t dot(int c, size_t state, luaL_Buffer *buffer) -{ - luaL_addchar(buffer, (char) c); - switch (c) { - case '\r': - return 1; - case '\n': - return (state == 1)? 2: 0; - case '.': - if (state == 2) - luaL_addchar(buffer, '.'); - default: - return 0; - } -} - -/*-------------------------------------------------------------------------*\ -* Incrementally applies smtp stuffing to a string -* A, n = dot(l, D) -\*-------------------------------------------------------------------------*/ -static int mime_global_dot(lua_State *L) -{ - size_t isize = 0, state = (size_t) luaL_checknumber(L, 1); - const char *input = luaL_optlstring(L, 2, NULL, &isize); - const char *last = input + isize; - luaL_Buffer buffer; - /* end-of-input blackhole */ - if (!input) { - lua_pushnil(L); - lua_pushnumber(L, 2); - return 2; - } - /* process all input */ - luaL_buffinit(L, &buffer); - while (input < last) - state = dot(*input++, state, &buffer); - luaL_pushresult(&buffer); - lua_pushnumber(L, (lua_Number) state); - return 2; -} - diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/mime.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/mime.h deleted file mode 100644 index 99968a55..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/mime.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef MIME_H -#define MIME_H -/*=========================================================================*\ -* Core MIME support -* LuaSocket toolkit -* -* This module provides functions to implement transfer content encodings -* and formatting conforming to RFC 2045. It is used by mime.lua, which -* provide a higher level interface to this functionality. -\*=========================================================================*/ -#include "lua.h" - -/*-------------------------------------------------------------------------*\ -* Current MIME library version -\*-------------------------------------------------------------------------*/ -#define MIME_VERSION "MIME 1.0.3" -#define MIME_COPYRIGHT "Copyright (C) 2004-2013 Diego Nehab" -#define MIME_AUTHORS "Diego Nehab" - -/*-------------------------------------------------------------------------*\ -* This macro prefixes all exported API functions -\*-------------------------------------------------------------------------*/ -#ifndef MIME_API -#define MIME_API extern -#endif - -MIME_API int luaopen_mime_core(lua_State *L); - -#endif /* MIME_H */ diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/mime.lua b/love/src/jni/love/src/libraries/luasocket/libluasocket/mime.lua deleted file mode 100644 index 642cd9ca..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/mime.lua +++ /dev/null @@ -1,90 +0,0 @@ ------------------------------------------------------------------------------ --- MIME support for the Lua language. --- Author: Diego Nehab --- Conforming to RFCs 2045-2049 ------------------------------------------------------------------------------ - ------------------------------------------------------------------------------ --- Declare module and import dependencies ------------------------------------------------------------------------------ -local base = _G -local ltn12 = require("ltn12") -local mime = require("mime.core") -local io = require("io") -local string = require("string") -local _M = mime - --- encode, decode and wrap algorithm tables -local encodet, decodet, wrapt = {},{},{} - -_M.encodet = encodet -_M.decodet = decodet -_M.wrapt = wrapt - --- creates a function that chooses a filter by name from a given table -local function choose(table) - return function(name, opt1, opt2) - if base.type(name) ~= "string" then - name, opt1, opt2 = "default", name, opt1 - end - local f = table[name or "nil"] - if not f then - base.error("unknown key (" .. base.tostring(name) .. ")", 3) - else return f(opt1, opt2) end - end -end - --- define the encoding filters -encodet['base64'] = function() - return ltn12.filter.cycle(_M.b64, "") -end - -encodet['quoted-printable'] = function(mode) - return ltn12.filter.cycle(_M.qp, "", - (mode == "binary") and "=0D=0A" or "\r\n") -end - --- define the decoding filters -decodet['base64'] = function() - return ltn12.filter.cycle(_M.unb64, "") -end - -decodet['quoted-printable'] = function() - return ltn12.filter.cycle(_M.unqp, "") -end - -local function format(chunk) - if chunk then - if chunk == "" then return "''" - else return string.len(chunk) end - else return "nil" end -end - --- define the line-wrap filters -wrapt['text'] = function(length) - length = length or 76 - return ltn12.filter.cycle(_M.wrp, length, length) -end -wrapt['base64'] = wrapt['text'] -wrapt['default'] = wrapt['text'] - -wrapt['quoted-printable'] = function() - return ltn12.filter.cycle(_M.qpwrp, 76, 76) -end - --- function that choose the encoding, decoding or wrap algorithm -_M.encode = choose(encodet) -_M.decode = choose(decodet) -_M.wrap = choose(wrapt) - --- define the end-of-line normalization filter -function _M.normalize(marker) - return ltn12.filter.cycle(_M.eol, 0, marker) -end - --- high level stuffing filter -function _M.stuff() - return ltn12.filter.cycle(_M.dot, 2) -end - -return _M \ No newline at end of file diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/mime.lua.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/mime.lua.h deleted file mode 100644 index 78a14cb2..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/mime.lua.h +++ /dev/null @@ -1,136 +0,0 @@ -/* code automatically generated by bin2c -- DO NOT EDIT */ -{ -/* #include'ing this file in a C program is equivalent to calling - if (luaL_loadfile(L,"mime.lua")==0) lua_call(L, 0, LUA_MULTRET); -*/ -/* mime.lua */ -static const unsigned char B1[]={ - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, - 32, 77, 73, 77, 69, 32,115,117,112,112,111,114,116, 32,102,111,114, 32,116,104, -101, 32, 76,117, 97, 32,108, 97,110,103,117, 97,103,101, 46, 10, 45, 45, 32, 65, -117,116,104,111,114, 58, 32, 68,105,101,103,111, 32, 78,101,104, 97, 98, 10, 45, - 45, 32, 67,111,110,102,111,114,109,105,110,103, 32,116,111, 32, 82, 70, 67,115, - 32, 50, 48, 52, 53, 45, 50, 48, 52, 57, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 68,101, 99,108, 97,114,101, 32,109, -111,100,117,108,101, 32, 97,110,100, 32,105,109,112,111,114,116, 32,100,101,112, -101,110,100,101,110, 99,105,101,115, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 10,108,111, 99, 97,108, 32, 98, 97,115,101, 32, 61, - 32, 95, 71, 10,108,111, 99, 97,108, 32,108,116,110, 49, 50, 32, 61, 32,114,101, -113,117,105,114,101, 40, 34,108,116,110, 49, 50, 34, 41, 10,108,111, 99, 97,108, - 32,109,105,109,101, 32, 61, 32,114,101,113,117,105,114,101, 40, 34,109,105,109, -101, 46, 99,111,114,101, 34, 41, 10,108,111, 99, 97,108, 32,105,111, 32, 61, 32, -114,101,113,117,105,114,101, 40, 34,105,111, 34, 41, 10,108,111, 99, 97,108, 32, -115,116,114,105,110,103, 32, 61, 32,114,101,113,117,105,114,101, 40, 34,115,116, -114,105,110,103, 34, 41, 10,108,111, 99, 97,108, 32, 95, 77, 32, 61, 32,109,105, -109,101, 10, 10, 45, 45, 32,101,110, 99,111,100,101, 44, 32,100,101, 99,111,100, -101, 32, 97,110,100, 32,119,114, 97,112, 32, 97,108,103,111,114,105,116,104,109, - 32,116, 97, 98,108,101,115, 10,108,111, 99, 97,108, 32,101,110, 99,111,100,101, -116, 44, 32,100,101, 99,111,100,101,116, 44, 32,119,114, 97,112,116, 32, 61, 32, -123,125, 44,123,125, 44,123,125, 10, 10, 95, 77, 46,101,110, 99,111,100,101,116, - 32, 61, 32,101,110, 99,111,100,101,116, 10, 95, 77, 46,100,101, 99,111,100,101, -116, 32, 61, 32,100,101, 99,111,100,101,116, 10, 95, 77, 46,119,114, 97,112,116, - 32, 32, 32, 61, 32,119,114, 97,112,116, 32, 32, 10, 10, 45, 45, 32, 99,114,101, - 97,116,101,115, 32, 97, 32,102,117,110, 99,116,105,111,110, 32,116,104, 97,116, - 32, 99,104,111,111,115,101,115, 32, 97, 32,102,105,108,116,101,114, 32, 98,121, - 32,110, 97,109,101, 32,102,114,111,109, 32, 97, 32,103,105,118,101,110, 32,116, - 97, 98,108,101, 10,108,111, 99, 97,108, 32,102,117,110, 99,116,105,111,110, 32, - 99,104,111,111,115,101, 40,116, 97, 98,108,101, 41, 10, 32, 32, 32, 32,114,101, -116,117,114,110, 32,102,117,110, 99,116,105,111,110, 40,110, 97,109,101, 44, 32, -111,112,116, 49, 44, 32,111,112,116, 50, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, -105,102, 32, 98, 97,115,101, 46,116,121,112,101, 40,110, 97,109,101, 41, 32,126, - 61, 32, 34,115,116,114,105,110,103, 34, 32,116,104,101,110, 10, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32,110, 97,109,101, 44, 32,111,112,116, 49, 44, 32, -111,112,116, 50, 32, 61, 32, 34,100,101,102, 97,117,108,116, 34, 44, 32,110, 97, -109,101, 44, 32,111,112,116, 49, 10, 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, - 10, 32, 32, 32, 32, 32, 32, 32, 32,108,111, 99, 97,108, 32,102, 32, 61, 32,116, - 97, 98,108,101, 91,110, 97,109,101, 32,111,114, 32, 34,110,105,108, 34, 93, 10, - 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,110,111,116, 32,102, 32,116,104,101, -110, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 98, 97,115,101, 46, -101,114,114,111,114, 40, 34,117,110,107,110,111,119,110, 32,107,101,121, 32, 40, - 34, 32, 46, 46, 32, 98, 97,115,101, 46,116,111,115,116,114,105,110,103, 40,110, - 97,109,101, 41, 32, 46, 46, 32, 34, 41, 34, 44, 32, 51, 41, 10, 32, 32, 32, 32, - 32, 32, 32, 32,101,108,115,101, 32,114,101,116,117,114,110, 32,102, 40,111,112, -116, 49, 44, 32,111,112,116, 50, 41, 32,101,110,100, 10, 32, 32, 32, 32,101,110, -100, 10,101,110,100, 10, 10, 45, 45, 32,100,101,102,105,110,101, 32,116,104,101, - 32,101,110, 99,111,100,105,110,103, 32,102,105,108,116,101,114,115, 10,101,110, - 99,111,100,101,116, 91, 39, 98, 97,115,101, 54, 52, 39, 93, 32, 61, 32,102,117, -110, 99,116,105,111,110, 40, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32, -108,116,110, 49, 50, 46,102,105,108,116,101,114, 46, 99,121, 99,108,101, 40, 95, - 77, 46, 98, 54, 52, 44, 32, 34, 34, 41, 10,101,110,100, 10, 10,101,110, 99,111, -100,101,116, 91, 39,113,117,111,116,101,100, 45,112,114,105,110,116, 97, 98,108, -101, 39, 93, 32, 61, 32,102,117,110, 99,116,105,111,110, 40,109,111,100,101, 41, - 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,108,116,110, 49, 50, 46,102,105, -108,116,101,114, 46, 99,121, 99,108,101, 40, 95, 77, 46,113,112, 44, 32, 34, 34, - 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 40,109,111,100,101, 32, 61, 61, 32, 34, - 98,105,110, 97,114,121, 34, 41, 32, 97,110,100, 32, 34, 61, 48, 68, 61, 48, 65, - 34, 32,111,114, 32, 34, 92,114, 92,110, 34, 41, 10,101,110,100, 10, 10, 45, 45, - 32,100,101,102,105,110,101, 32,116,104,101, 32,100,101, 99,111,100,105,110,103, - 32,102,105,108,116,101,114,115, 10,100,101, 99,111,100,101,116, 91, 39, 98, 97, -115,101, 54, 52, 39, 93, 32, 61, 32,102,117,110, 99,116,105,111,110, 40, 41, 10, - 32, 32, 32, 32,114,101,116,117,114,110, 32,108,116,110, 49, 50, 46,102,105,108, -116,101,114, 46, 99,121, 99,108,101, 40, 95, 77, 46,117,110, 98, 54, 52, 44, 32, - 34, 34, 41, 10,101,110,100, 10, 10,100,101, 99,111,100,101,116, 91, 39,113,117, -111,116,101,100, 45,112,114,105,110,116, 97, 98,108,101, 39, 93, 32, 61, 32,102, -117,110, 99,116,105,111,110, 40, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, - 32,108,116,110, 49, 50, 46,102,105,108,116,101,114, 46, 99,121, 99,108,101, 40, - 95, 77, 46,117,110,113,112, 44, 32, 34, 34, 41, 10,101,110,100, 10, 10,108,111, - 99, 97,108, 32,102,117,110, 99,116,105,111,110, 32,102,111,114,109, 97,116, 40, - 99,104,117,110,107, 41, 10, 32, 32, 32, 32,105,102, 32, 99,104,117,110,107, 32, -116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32, 99,104,117,110, -107, 32, 61, 61, 32, 34, 34, 32,116,104,101,110, 32,114,101,116,117,114,110, 32, - 34, 39, 39, 34, 10, 32, 32, 32, 32, 32, 32, 32, 32,101,108,115,101, 32,114,101, -116,117,114,110, 32,115,116,114,105,110,103, 46,108,101,110, 40, 99,104,117,110, -107, 41, 32,101,110,100, 10, 32, 32, 32, 32,101,108,115,101, 32,114,101,116,117, -114,110, 32, 34,110,105,108, 34, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, - 32,100,101,102,105,110,101, 32,116,104,101, 32,108,105,110,101, 45,119,114, 97, -112, 32,102,105,108,116,101,114,115, 10,119,114, 97,112,116, 91, 39,116,101,120, -116, 39, 93, 32, 61, 32,102,117,110, 99,116,105,111,110, 40,108,101,110,103,116, -104, 41, 10, 32, 32, 32, 32,108,101,110,103,116,104, 32, 61, 32,108,101,110,103, -116,104, 32,111,114, 32, 55, 54, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32, -108,116,110, 49, 50, 46,102,105,108,116,101,114, 46, 99,121, 99,108,101, 40, 95, - 77, 46,119,114,112, 44, 32,108,101,110,103,116,104, 44, 32,108,101,110,103,116, -104, 41, 10,101,110,100, 10,119,114, 97,112,116, 91, 39, 98, 97,115,101, 54, 52, - 39, 93, 32, 61, 32,119,114, 97,112,116, 91, 39,116,101,120,116, 39, 93, 10,119, -114, 97,112,116, 91, 39,100,101,102, 97,117,108,116, 39, 93, 32, 61, 32,119,114, - 97,112,116, 91, 39,116,101,120,116, 39, 93, 10, 10,119,114, 97,112,116, 91, 39, -113,117,111,116,101,100, 45,112,114,105,110,116, 97, 98,108,101, 39, 93, 32, 61, - 32,102,117,110, 99,116,105,111,110, 40, 41, 10, 32, 32, 32, 32,114,101,116,117, -114,110, 32,108,116,110, 49, 50, 46,102,105,108,116,101,114, 46, 99,121, 99,108, -101, 40, 95, 77, 46,113,112,119,114,112, 44, 32, 55, 54, 44, 32, 55, 54, 41, 10, -101,110,100, 10, 10, 45, 45, 32,102,117,110, 99,116,105,111,110, 32,116,104, 97, -116, 32, 99,104,111,111,115,101, 32,116,104,101, 32,101,110, 99,111,100,105,110, -103, 44, 32,100,101, 99,111,100,105,110,103, 32,111,114, 32,119,114, 97,112, 32, - 97,108,103,111,114,105,116,104,109, 10, 95, 77, 46,101,110, 99,111,100,101, 32, - 61, 32, 99,104,111,111,115,101, 40,101,110, 99,111,100,101,116, 41, 10, 95, 77, - 46,100,101, 99,111,100,101, 32, 61, 32, 99,104,111,111,115,101, 40,100,101, 99, -111,100,101,116, 41, 10, 95, 77, 46,119,114, 97,112, 32, 61, 32, 99,104,111,111, -115,101, 40,119,114, 97,112,116, 41, 10, 10, 45, 45, 32,100,101,102,105,110,101, - 32,116,104,101, 32,101,110,100, 45,111,102, 45,108,105,110,101, 32,110,111,114, -109, 97,108,105,122, 97,116,105,111,110, 32,102,105,108,116,101,114, 10,102,117, -110, 99,116,105,111,110, 32, 95, 77, 46,110,111,114,109, 97,108,105,122,101, 40, -109, 97,114,107,101,114, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,108, -116,110, 49, 50, 46,102,105,108,116,101,114, 46, 99,121, 99,108,101, 40, 95, 77, - 46,101,111,108, 44, 32, 48, 44, 32,109, 97,114,107,101,114, 41, 10,101,110,100, - 10, 10, 45, 45, 32,104,105,103,104, 32,108,101,118,101,108, 32,115,116,117,102, -102,105,110,103, 32,102,105,108,116,101,114, 10,102,117,110, 99,116,105,111,110, - 32, 95, 77, 46,115,116,117,102,102, 40, 41, 10, 32, 32, 32, 32,114,101,116,117, -114,110, 32,108,116,110, 49, 50, 46,102,105,108,116,101,114, 46, 99,121, 99,108, -101, 40, 95, 77, 46,100,111,116, 44, 32, 50, 41, 10,101,110,100, 10, 10,114,101, -116,117,114,110, 32, 95, 77, -}; - - if (luaL_loadbuffer(L,(const char*)B1,sizeof(B1),"mime.lua")==0) lua_call(L, 0, LUA_MULTRET); -} diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/options.c b/love/src/jni/love/src/libraries/luasocket/libluasocket/options.c deleted file mode 100644 index 20f4c280..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/options.c +++ /dev/null @@ -1,374 +0,0 @@ -/*=========================================================================*\ -* Common option interface -* LuaSocket toolkit -\*=========================================================================*/ -#include - -#include "lauxlib.h" - -#include "auxiliar.h" -#include "options.h" -#include "inet.h" - - -/*=========================================================================*\ -* Internal functions prototypes -\*=========================================================================*/ -static int opt_setmembership(lua_State *L, p_socket ps, int level, int name); -static int opt_ip6_setmembership(lua_State *L, p_socket ps, int level, int name); -static int opt_setboolean(lua_State *L, p_socket ps, int level, int name); -static int opt_getboolean(lua_State *L, p_socket ps, int level, int name); -static int opt_setint(lua_State *L, p_socket ps, int level, int name); -static int opt_getint(lua_State *L, p_socket ps, int level, int name); -static int opt_set(lua_State *L, p_socket ps, int level, int name, - void *val, int len); -static int opt_get(lua_State *L, p_socket ps, int level, int name, - void *val, int* len); - -/*=========================================================================*\ -* Exported functions -\*=========================================================================*/ -/*-------------------------------------------------------------------------*\ -* Calls appropriate option handler -\*-------------------------------------------------------------------------*/ -int opt_meth_setoption(lua_State *L, p_opt opt, p_socket ps) -{ - const char *name = luaL_checkstring(L, 2); /* obj, name, ... */ - while (opt->name && strcmp(name, opt->name)) - opt++; - if (!opt->func) { - char msg[45]; - sprintf(msg, "unsupported option `%.35s'", name); - luaL_argerror(L, 2, msg); - } - return opt->func(L, ps); -} - -int opt_meth_getoption(lua_State *L, p_opt opt, p_socket ps) -{ - const char *name = luaL_checkstring(L, 2); /* obj, name, ... */ - while (opt->name && strcmp(name, opt->name)) - opt++; - if (!opt->func) { - char msg[45]; - sprintf(msg, "unsupported option `%.35s'", name); - luaL_argerror(L, 2, msg); - } - return opt->func(L, ps); -} - -/* enables reuse of local address */ -int opt_set_reuseaddr(lua_State *L, p_socket ps) -{ - return opt_setboolean(L, ps, SOL_SOCKET, SO_REUSEADDR); -} - -int opt_get_reuseaddr(lua_State *L, p_socket ps) -{ - return opt_getboolean(L, ps, SOL_SOCKET, SO_REUSEADDR); -} - -/* enables reuse of local port */ -int opt_set_reuseport(lua_State *L, p_socket ps) -{ - return opt_setboolean(L, ps, SOL_SOCKET, SO_REUSEPORT); -} - -int opt_get_reuseport(lua_State *L, p_socket ps) -{ - return opt_getboolean(L, ps, SOL_SOCKET, SO_REUSEPORT); -} - -/* disables the Naggle algorithm */ -int opt_set_tcp_nodelay(lua_State *L, p_socket ps) -{ - return opt_setboolean(L, ps, IPPROTO_TCP, TCP_NODELAY); -} - -int opt_get_tcp_nodelay(lua_State *L, p_socket ps) -{ - return opt_getboolean(L, ps, IPPROTO_TCP, TCP_NODELAY); -} - -int opt_set_keepalive(lua_State *L, p_socket ps) -{ - return opt_setboolean(L, ps, SOL_SOCKET, SO_KEEPALIVE); -} - -int opt_get_keepalive(lua_State *L, p_socket ps) -{ - return opt_getboolean(L, ps, SOL_SOCKET, SO_KEEPALIVE); -} - -int opt_set_dontroute(lua_State *L, p_socket ps) -{ - return opt_setboolean(L, ps, SOL_SOCKET, SO_DONTROUTE); -} - -int opt_get_dontroute(lua_State *L, p_socket ps) -{ - return opt_getboolean(L, ps, SOL_SOCKET, SO_DONTROUTE); -} - -int opt_set_broadcast(lua_State *L, p_socket ps) -{ - return opt_setboolean(L, ps, SOL_SOCKET, SO_BROADCAST); -} - -int opt_get_broadcast(lua_State *L, p_socket ps) -{ - return opt_getboolean(L, ps, SOL_SOCKET, SO_BROADCAST); -} - -int opt_set_ip6_unicast_hops(lua_State *L, p_socket ps) -{ - return opt_setint(L, ps, IPPROTO_IPV6, IPV6_UNICAST_HOPS); -} - -int opt_get_ip6_unicast_hops(lua_State *L, p_socket ps) -{ - return opt_getint(L, ps, IPPROTO_IPV6, IPV6_UNICAST_HOPS); -} - -int opt_set_ip6_multicast_hops(lua_State *L, p_socket ps) -{ - return opt_setint(L, ps, IPPROTO_IPV6, IPV6_MULTICAST_HOPS); -} - -int opt_get_ip6_multicast_hops(lua_State *L, p_socket ps) -{ - return opt_getint(L, ps, IPPROTO_IPV6, IPV6_MULTICAST_HOPS); -} - -int opt_set_ip_multicast_loop(lua_State *L, p_socket ps) -{ - return opt_setboolean(L, ps, IPPROTO_IP, IP_MULTICAST_LOOP); -} - -int opt_get_ip_multicast_loop(lua_State *L, p_socket ps) -{ - return opt_getboolean(L, ps, IPPROTO_IP, IP_MULTICAST_LOOP); -} - -int opt_set_ip6_multicast_loop(lua_State *L, p_socket ps) -{ - return opt_setboolean(L, ps, IPPROTO_IPV6, IPV6_MULTICAST_LOOP); -} - -int opt_get_ip6_multicast_loop(lua_State *L, p_socket ps) -{ - return opt_getboolean(L, ps, IPPROTO_IPV6, IPV6_MULTICAST_LOOP); -} - -int opt_set_linger(lua_State *L, p_socket ps) -{ - struct linger li; /* obj, name, table */ - if (!lua_istable(L, 3)) auxiliar_typeerror(L,3,lua_typename(L, LUA_TTABLE)); - lua_pushstring(L, "on"); - lua_gettable(L, 3); - if (!lua_isboolean(L, -1)) - luaL_argerror(L, 3, "boolean 'on' field expected"); - li.l_onoff = (u_short) lua_toboolean(L, -1); - lua_pushstring(L, "timeout"); - lua_gettable(L, 3); - if (!lua_isnumber(L, -1)) - luaL_argerror(L, 3, "number 'timeout' field expected"); - li.l_linger = (u_short) lua_tonumber(L, -1); - return opt_set(L, ps, SOL_SOCKET, SO_LINGER, (char *) &li, sizeof(li)); -} - -int opt_get_linger(lua_State *L, p_socket ps) -{ - struct linger li; /* obj, name */ - int len = sizeof(li); - int err = opt_get(L, ps, SOL_SOCKET, SO_LINGER, (char *) &li, &len); - if (err) - return err; - lua_newtable(L); - lua_pushboolean(L, li.l_onoff); - lua_setfield(L, -2, "on"); - lua_pushinteger(L, li.l_linger); - lua_setfield(L, -2, "timeout"); - return 1; -} - -int opt_set_ip_multicast_ttl(lua_State *L, p_socket ps) -{ - return opt_setint(L, ps, IPPROTO_IP, IP_MULTICAST_TTL); -} - -int opt_set_ip_multicast_if(lua_State *L, p_socket ps) -{ - const char *address = luaL_checkstring(L, 3); /* obj, name, ip */ - struct in_addr val; - val.s_addr = htonl(INADDR_ANY); - if (strcmp(address, "*") && !inet_aton(address, &val)) - luaL_argerror(L, 3, "ip expected"); - return opt_set(L, ps, IPPROTO_IP, IP_MULTICAST_IF, - (char *) &val, sizeof(val)); -} - -int opt_get_ip_multicast_if(lua_State *L, p_socket ps) -{ - struct in_addr val; - socklen_t len = sizeof(val); - if (getsockopt(*ps, IPPROTO_IP, IP_MULTICAST_IF, (char *) &val, &len) < 0) { - lua_pushnil(L); - lua_pushstring(L, "getsockopt failed"); - return 2; - } - lua_pushstring(L, inet_ntoa(val)); - return 1; -} - -int opt_set_ip_add_membership(lua_State *L, p_socket ps) -{ - return opt_setmembership(L, ps, IPPROTO_IP, IP_ADD_MEMBERSHIP); -} - -int opt_set_ip_drop_membersip(lua_State *L, p_socket ps) -{ - return opt_setmembership(L, ps, IPPROTO_IP, IP_DROP_MEMBERSHIP); -} - -int opt_set_ip6_add_membership(lua_State *L, p_socket ps) -{ - return opt_ip6_setmembership(L, ps, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP); -} - -int opt_set_ip6_drop_membersip(lua_State *L, p_socket ps) -{ - return opt_ip6_setmembership(L, ps, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP); -} - -int opt_get_ip6_v6only(lua_State *L, p_socket ps) -{ - return opt_getboolean(L, ps, IPPROTO_IPV6, IPV6_V6ONLY); -} - -int opt_set_ip6_v6only(lua_State *L, p_socket ps) -{ - return opt_setboolean(L, ps, IPPROTO_IPV6, IPV6_V6ONLY); -} - -/*=========================================================================*\ -* Auxiliar functions -\*=========================================================================*/ -static int opt_setmembership(lua_State *L, p_socket ps, int level, int name) -{ - struct ip_mreq val; /* obj, name, table */ - if (!lua_istable(L, 3)) auxiliar_typeerror(L,3,lua_typename(L, LUA_TTABLE)); - lua_pushstring(L, "multiaddr"); - lua_gettable(L, 3); - if (!lua_isstring(L, -1)) - luaL_argerror(L, 3, "string 'multiaddr' field expected"); - if (!inet_aton(lua_tostring(L, -1), &val.imr_multiaddr)) - luaL_argerror(L, 3, "invalid 'multiaddr' ip address"); - lua_pushstring(L, "interface"); - lua_gettable(L, 3); - if (!lua_isstring(L, -1)) - luaL_argerror(L, 3, "string 'interface' field expected"); - val.imr_interface.s_addr = htonl(INADDR_ANY); - if (strcmp(lua_tostring(L, -1), "*") && - !inet_aton(lua_tostring(L, -1), &val.imr_interface)) - luaL_argerror(L, 3, "invalid 'interface' ip address"); - return opt_set(L, ps, level, name, (char *) &val, sizeof(val)); -} - -static int opt_ip6_setmembership(lua_State *L, p_socket ps, int level, int name) -{ - struct ipv6_mreq val; /* obj, opt-name, table */ - memset(&val, 0, sizeof(val)); - if (!lua_istable(L, 3)) auxiliar_typeerror(L,3,lua_typename(L, LUA_TTABLE)); - lua_pushstring(L, "multiaddr"); - lua_gettable(L, 3); - if (!lua_isstring(L, -1)) - luaL_argerror(L, 3, "string 'multiaddr' field expected"); - if (!inet_pton(AF_INET6, lua_tostring(L, -1), &val.ipv6mr_multiaddr)) - luaL_argerror(L, 3, "invalid 'multiaddr' ip address"); - lua_pushstring(L, "interface"); - lua_gettable(L, 3); - /* By default we listen to interface on default route - * (sigh). However, interface= can override it. We should - * support either number, or name for it. Waiting for - * windows port of if_nametoindex */ - if (!lua_isnil(L, -1)) { - if (lua_isnumber(L, -1)) { - val.ipv6mr_interface = (unsigned int) lua_tonumber(L, -1); - } else - luaL_argerror(L, -1, "number 'interface' field expected"); - } - return opt_set(L, ps, level, name, (char *) &val, sizeof(val)); -} - -static -int opt_get(lua_State *L, p_socket ps, int level, int name, void *val, int* len) -{ - socklen_t socklen = *len; - if (getsockopt(*ps, level, name, (char *) val, &socklen) < 0) { - lua_pushnil(L); - lua_pushstring(L, "getsockopt failed"); - return 2; - } - *len = socklen; - return 0; -} - -static -int opt_set(lua_State *L, p_socket ps, int level, int name, void *val, int len) -{ - if (setsockopt(*ps, level, name, (char *) val, len) < 0) { - lua_pushnil(L); - lua_pushstring(L, "setsockopt failed"); - return 2; - } - lua_pushnumber(L, 1); - return 1; -} - -static int opt_getboolean(lua_State *L, p_socket ps, int level, int name) -{ - int val = 0; - int len = sizeof(val); - int err = opt_get(L, ps, level, name, (char *) &val, &len); - if (err) - return err; - lua_pushboolean(L, val); - return 1; -} - -int opt_get_error(lua_State *L, p_socket ps) -{ - int val = 0; - socklen_t len = sizeof(val); - if (getsockopt(*ps, SOL_SOCKET, SO_ERROR, (char *) &val, &len) < 0) { - lua_pushnil(L); - lua_pushstring(L, "getsockopt failed"); - return 2; - } - lua_pushstring(L, socket_strerror(val)); - return 1; -} - -static int opt_setboolean(lua_State *L, p_socket ps, int level, int name) -{ - int val = auxiliar_checkboolean(L, 3); /* obj, name, bool */ - return opt_set(L, ps, level, name, (char *) &val, sizeof(val)); -} - -static int opt_getint(lua_State *L, p_socket ps, int level, int name) -{ - int val = 0; - int len = sizeof(val); - int err = opt_get(L, ps, level, name, (char *) &val, &len); - if (err) - return err; - lua_pushnumber(L, val); - return 1; -} - -static int opt_setint(lua_State *L, p_socket ps, int level, int name) -{ - int val = (int) lua_tonumber(L, 3); /* obj, name, int */ - return opt_set(L, ps, level, name, (char *) &val, sizeof(val)); -} diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/options.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/options.h deleted file mode 100644 index 19ba0dfc..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/options.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef OPTIONS_H -#define OPTIONS_H -/*=========================================================================*\ -* Common option interface -* LuaSocket toolkit -* -* This module provides a common interface to socket options, used mainly by -* modules UDP and TCP. -\*=========================================================================*/ - -#include "lua.h" -#include "socket.h" - -/* option registry */ -typedef struct t_opt { - const char *name; - int (*func)(lua_State *L, p_socket ps); -} t_opt; -typedef t_opt *p_opt; - -/* supported options for setoption */ -int opt_set_dontroute(lua_State *L, p_socket ps); -int opt_set_broadcast(lua_State *L, p_socket ps); -int opt_set_tcp_nodelay(lua_State *L, p_socket ps); -int opt_set_keepalive(lua_State *L, p_socket ps); -int opt_set_linger(lua_State *L, p_socket ps); -int opt_set_reuseaddr(lua_State *L, p_socket ps); -int opt_set_reuseport(lua_State *L, p_socket ps); -int opt_set_ip_multicast_if(lua_State *L, p_socket ps); -int opt_set_ip_multicast_ttl(lua_State *L, p_socket ps); -int opt_set_ip_multicast_loop(lua_State *L, p_socket ps); -int opt_set_ip_add_membership(lua_State *L, p_socket ps); -int opt_set_ip_drop_membersip(lua_State *L, p_socket ps); -int opt_set_ip6_unicast_hops(lua_State *L, p_socket ps); -int opt_set_ip6_multicast_hops(lua_State *L, p_socket ps); -int opt_set_ip6_multicast_loop(lua_State *L, p_socket ps); -int opt_set_ip6_add_membership(lua_State *L, p_socket ps); -int opt_set_ip6_drop_membersip(lua_State *L, p_socket ps); -int opt_set_ip6_v6only(lua_State *L, p_socket ps); - -/* supported options for getoption */ -int opt_get_dontroute(lua_State *L, p_socket ps); -int opt_get_broadcast(lua_State *L, p_socket ps); -int opt_get_reuseaddr(lua_State *L, p_socket ps); -int opt_get_reuseport(lua_State *L, p_socket ps); -int opt_get_tcp_nodelay(lua_State *L, p_socket ps); -int opt_get_keepalive(lua_State *L, p_socket ps); -int opt_get_linger(lua_State *L, p_socket ps); -int opt_get_ip_multicast_loop(lua_State *L, p_socket ps); -int opt_get_ip_multicast_if(lua_State *L, p_socket ps); -int opt_get_error(lua_State *L, p_socket ps); -int opt_get_ip6_multicast_loop(lua_State *L, p_socket ps); -int opt_get_ip6_multicast_hops(lua_State *L, p_socket ps); -int opt_get_ip6_unicast_hops(lua_State *L, p_socket ps); -int opt_get_ip6_v6only(lua_State *L, p_socket ps); -int opt_get_reuseport(lua_State *L, p_socket ps); - -/* invokes the appropriate option handler */ -int opt_meth_setoption(lua_State *L, p_opt opt, p_socket ps); -int opt_meth_getoption(lua_State *L, p_opt opt, p_socket ps); - -#endif diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/pierror.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/pierror.h deleted file mode 100644 index cb773ab7..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/pierror.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef PIERROR_H -#define PIERROR_H -/*=========================================================================*\ -* Error messages -* Defines platform independent error messages -\*=========================================================================*/ - -#define PIE_HOST_NOT_FOUND "host not found" -#define PIE_ADDRINUSE "address already in use" -#define PIE_ISCONN "already connected" -#define PIE_ACCESS "permission denied" -#define PIE_CONNREFUSED "connection refused" -#define PIE_CONNABORTED "closed" -#define PIE_CONNRESET "closed" -#define PIE_TIMEDOUT "timeout" -#define PIE_AGAIN "temporary failure in name resolution" -#define PIE_BADFLAGS "invalid value for ai_flags" -#define PIE_BADHINTS "invalid value for hints" -#define PIE_FAIL "non-recoverable failure in name resolution" -#define PIE_FAMILY "ai_family not supported" -#define PIE_MEMORY "memory allocation failure" -#define PIE_NONAME "host or service not provided, or not known" -#define PIE_OVERFLOW "argument buffer overflow" -#define PIE_PROTOCOL "resolved protocol is unknown" -#define PIE_SERVICE "service not supported for socket type" -#define PIE_SOCKTYPE "ai_socktype not supported" - -#endif diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/select.c b/love/src/jni/love/src/libraries/luasocket/libluasocket/select.c deleted file mode 100644 index 9d133b7a..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/select.c +++ /dev/null @@ -1,220 +0,0 @@ -/*=========================================================================*\ -* Select implementation -* LuaSocket toolkit -\*=========================================================================*/ -#include - -#include "lua.h" -#include "lauxlib.h" -#include "compat.h" - -#include "socket.h" -#include "timeout.h" -#include "select.h" - -/*=========================================================================*\ -* Internal function prototypes. -\*=========================================================================*/ -static t_socket getfd(lua_State *L); -static int dirty(lua_State *L); -static void collect_fd(lua_State *L, int tab, int itab, - fd_set *set, t_socket *max_fd); -static int check_dirty(lua_State *L, int tab, int dtab, fd_set *set); -static void return_fd(lua_State *L, fd_set *set, t_socket max_fd, - int itab, int tab, int start); -static void make_assoc(lua_State *L, int tab); -static int global_select(lua_State *L); - -/* functions in library namespace */ -static luaL_Reg func[] = { - {"select", global_select}, - {NULL, NULL} -}; - -/*=========================================================================*\ -* Exported functions -\*=========================================================================*/ -/*-------------------------------------------------------------------------*\ -* Initializes module -\*-------------------------------------------------------------------------*/ -int select_open(lua_State *L) { - lua_pushstring(L, "_SETSIZE"); - lua_pushinteger(L, FD_SETSIZE); - lua_rawset(L, -3); - lua_pushstring(L, "_SOCKETINVALID"); - lua_pushinteger(L, SOCKET_INVALID); - lua_rawset(L, -3); - luaL_setfuncs(L, func, 0); - return 0; -} - -/*=========================================================================*\ -* Global Lua functions -\*=========================================================================*/ -/*-------------------------------------------------------------------------*\ -* Waits for a set of sockets until a condition is met or timeout. -\*-------------------------------------------------------------------------*/ -static int global_select(lua_State *L) { - int rtab, wtab, itab, ret, ndirty; - t_socket max_fd = SOCKET_INVALID; - fd_set rset, wset; - t_timeout tm; - double t = luaL_optnumber(L, 3, -1); - FD_ZERO(&rset); FD_ZERO(&wset); - lua_settop(L, 3); - lua_newtable(L); itab = lua_gettop(L); - lua_newtable(L); rtab = lua_gettop(L); - lua_newtable(L); wtab = lua_gettop(L); - collect_fd(L, 1, itab, &rset, &max_fd); - collect_fd(L, 2, itab, &wset, &max_fd); - ndirty = check_dirty(L, 1, rtab, &rset); - t = ndirty > 0? 0.0: t; - timeout_init(&tm, t, -1); - timeout_markstart(&tm); - ret = socket_select(max_fd+1, &rset, &wset, NULL, &tm); - if (ret > 0 || ndirty > 0) { - return_fd(L, &rset, max_fd+1, itab, rtab, ndirty); - return_fd(L, &wset, max_fd+1, itab, wtab, 0); - make_assoc(L, rtab); - make_assoc(L, wtab); - return 2; - } else if (ret == 0) { - lua_pushstring(L, "timeout"); - return 3; - } else { - luaL_error(L, "select failed"); - return 3; - } -} - -/*=========================================================================*\ -* Internal functions -\*=========================================================================*/ -static t_socket getfd(lua_State *L) { - t_socket fd = SOCKET_INVALID; - lua_pushstring(L, "getfd"); - lua_gettable(L, -2); - if (!lua_isnil(L, -1)) { - lua_pushvalue(L, -2); - lua_call(L, 1, 1); - if (lua_isnumber(L, -1)) { - double numfd = lua_tonumber(L, -1); - fd = (numfd >= 0.0)? (t_socket) numfd: SOCKET_INVALID; - } - } - lua_pop(L, 1); - return fd; -} - -static int dirty(lua_State *L) { - int is = 0; - lua_pushstring(L, "dirty"); - lua_gettable(L, -2); - if (!lua_isnil(L, -1)) { - lua_pushvalue(L, -2); - lua_call(L, 1, 1); - is = lua_toboolean(L, -1); - } - lua_pop(L, 1); - return is; -} - -static void collect_fd(lua_State *L, int tab, int itab, - fd_set *set, t_socket *max_fd) { - int i = 1, n = 0; - /* nil is the same as an empty table */ - if (lua_isnil(L, tab)) return; - /* otherwise we need it to be a table */ - luaL_checktype(L, tab, LUA_TTABLE); - for ( ;; ) { - t_socket fd; - lua_pushnumber(L, i); - lua_gettable(L, tab); - if (lua_isnil(L, -1)) { - lua_pop(L, 1); - break; - } - /* getfd figures out if this is a socket */ - fd = getfd(L); - if (fd != SOCKET_INVALID) { - /* make sure we don't overflow the fd_set */ -#ifdef _WIN32 - if (n >= FD_SETSIZE) - luaL_argerror(L, tab, "too many sockets"); -#else - if (fd >= FD_SETSIZE) - luaL_argerror(L, tab, "descriptor too large for set size"); -#endif - FD_SET(fd, set); - n++; - /* keep track of the largest descriptor so far */ - if (*max_fd == SOCKET_INVALID || *max_fd < fd) - *max_fd = fd; - /* make sure we can map back from descriptor to the object */ - lua_pushnumber(L, (lua_Number) fd); - lua_pushvalue(L, -2); - lua_settable(L, itab); - } - lua_pop(L, 1); - i = i + 1; - } -} - -static int check_dirty(lua_State *L, int tab, int dtab, fd_set *set) { - int ndirty = 0, i = 1; - if (lua_isnil(L, tab)) - return 0; - for ( ;; ) { - t_socket fd; - lua_pushnumber(L, i); - lua_gettable(L, tab); - if (lua_isnil(L, -1)) { - lua_pop(L, 1); - break; - } - fd = getfd(L); - if (fd != SOCKET_INVALID && dirty(L)) { - lua_pushnumber(L, ++ndirty); - lua_pushvalue(L, -2); - lua_settable(L, dtab); - FD_CLR(fd, set); - } - lua_pop(L, 1); - i = i + 1; - } - return ndirty; -} - -static void return_fd(lua_State *L, fd_set *set, t_socket max_fd, - int itab, int tab, int start) { - t_socket fd; - for (fd = 0; fd < max_fd; fd++) { - if (FD_ISSET(fd, set)) { - lua_pushnumber(L, ++start); - lua_pushnumber(L, (lua_Number) fd); - lua_gettable(L, itab); - lua_settable(L, tab); - } - } -} - -static void make_assoc(lua_State *L, int tab) { - int i = 1, atab; - lua_newtable(L); atab = lua_gettop(L); - for ( ;; ) { - lua_pushnumber(L, i); - lua_gettable(L, tab); - if (!lua_isnil(L, -1)) { - lua_pushnumber(L, i); - lua_pushvalue(L, -2); - lua_settable(L, atab); - lua_pushnumber(L, i); - lua_settable(L, atab); - } else { - lua_pop(L, 1); - break; - } - i = i+1; - } -} - diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/select.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/select.h deleted file mode 100644 index 87502003..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/select.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef SELECT_H -#define SELECT_H -/*=========================================================================*\ -* Select implementation -* LuaSocket toolkit -* -* Each object that can be passed to the select function has to export -* method getfd() which returns the descriptor to be passed to the -* underlying select function. Another method, dirty(), should return -* true if there is data ready for reading (required for buffered input). -\*=========================================================================*/ - -int select_open(lua_State *L); - -#endif /* SELECT_H */ diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/serial.c b/love/src/jni/love/src/libraries/luasocket/libluasocket/serial.c deleted file mode 100644 index 4088de53..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/serial.c +++ /dev/null @@ -1,173 +0,0 @@ -/*=========================================================================*\ -* Serial stream -* LuaSocket toolkit -\*=========================================================================*/ -#include - -#include "lua.h" -#include "lauxlib.h" -#include "luasocket.h" - -#include "auxiliar.h" -#include "socket.h" -#include "options.h" -#include "unix.h" -#include - -/* -Reuses userdata definition from unix.h, since it is useful for all -stream-like objects. - -If we stored the serial path for use in error messages or userdata -printing, we might need our own userdata definition. - -Group usage is semi-inherited from unix.c, but unnecessary since we -have only one object type. -*/ - -/*=========================================================================*\ -* Internal function prototypes -\*=========================================================================*/ -static int global_create(lua_State *L); -static int meth_send(lua_State *L); -static int meth_receive(lua_State *L); -static int meth_close(lua_State *L); -static int meth_settimeout(lua_State *L); -static int meth_getfd(lua_State *L); -static int meth_setfd(lua_State *L); -static int meth_dirty(lua_State *L); -static int meth_getstats(lua_State *L); -static int meth_setstats(lua_State *L); - -/* serial object methods */ -static luaL_Reg serial_methods[] = { - {"__gc", meth_close}, - {"__tostring", auxiliar_tostring}, - {"close", meth_close}, - {"dirty", meth_dirty}, - {"getfd", meth_getfd}, - {"getstats", meth_getstats}, - {"setstats", meth_setstats}, - {"receive", meth_receive}, - {"send", meth_send}, - {"setfd", meth_setfd}, - {"settimeout", meth_settimeout}, - {NULL, NULL} -}; - -/*-------------------------------------------------------------------------*\ -* Initializes module -\*-------------------------------------------------------------------------*/ -LUASOCKET_API int luaopen_socket_serial(lua_State *L) { - /* create classes */ - auxiliar_newclass(L, "serial{client}", serial_methods); - /* create class groups */ - auxiliar_add2group(L, "serial{client}", "serial{any}"); - lua_pushcfunction(L, global_create); - return 1; -} - -/*=========================================================================*\ -* Lua methods -\*=========================================================================*/ -/*-------------------------------------------------------------------------*\ -* Just call buffered IO methods -\*-------------------------------------------------------------------------*/ -static int meth_send(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkclass(L, "serial{client}", 1); - return buffer_meth_send(L, &un->buf); -} - -static int meth_receive(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkclass(L, "serial{client}", 1); - return buffer_meth_receive(L, &un->buf); -} - -static int meth_getstats(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkclass(L, "serial{client}", 1); - return buffer_meth_getstats(L, &un->buf); -} - -static int meth_setstats(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkclass(L, "serial{client}", 1); - return buffer_meth_setstats(L, &un->buf); -} - -/*-------------------------------------------------------------------------*\ -* Select support methods -\*-------------------------------------------------------------------------*/ -static int meth_getfd(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkgroup(L, "serial{any}", 1); - lua_pushnumber(L, (int) un->sock); - return 1; -} - -/* this is very dangerous, but can be handy for those that are brave enough */ -static int meth_setfd(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkgroup(L, "serial{any}", 1); - un->sock = (t_socket) luaL_checknumber(L, 2); - return 0; -} - -static int meth_dirty(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkgroup(L, "serial{any}", 1); - lua_pushboolean(L, !buffer_isempty(&un->buf)); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Closes socket used by object -\*-------------------------------------------------------------------------*/ -static int meth_close(lua_State *L) -{ - p_unix un = (p_unix) auxiliar_checkgroup(L, "serial{any}", 1); - socket_destroy(&un->sock); - lua_pushnumber(L, 1); - return 1; -} - - -/*-------------------------------------------------------------------------*\ -* Just call tm methods -\*-------------------------------------------------------------------------*/ -static int meth_settimeout(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkgroup(L, "serial{any}", 1); - return timeout_meth_settimeout(L, &un->tm); -} - -/*=========================================================================*\ -* Library functions -\*=========================================================================*/ - - -/*-------------------------------------------------------------------------*\ -* Creates a serial object -\*-------------------------------------------------------------------------*/ -static int global_create(lua_State *L) { - const char* path = luaL_checkstring(L, 1); - - /* allocate unix object */ - p_unix un = (p_unix) lua_newuserdata(L, sizeof(t_unix)); - - /* open serial device */ - t_socket sock = open(path, O_NOCTTY|O_RDWR); - - /*printf("open %s on %d\n", path, sock);*/ - - if (sock < 0) { - lua_pushnil(L); - lua_pushstring(L, socket_strerror(errno)); - lua_pushnumber(L, errno); - return 3; - } - /* set its type as client object */ - auxiliar_setclass(L, "serial{client}", -1); - /* initialize remaining structure fields */ - socket_setnonblocking(&sock); - un->sock = sock; - io_init(&un->io, (p_send) socket_write, (p_recv) socket_read, - (p_error) socket_ioerror, &un->sock); - timeout_init(&un->tm, -1, -1); - buffer_init(&un->buf, &un->io, &un->tm); - return 1; -} diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/smtp.lua b/love/src/jni/love/src/libraries/luasocket/libluasocket/smtp.lua deleted file mode 100644 index 018be7f6..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/smtp.lua +++ /dev/null @@ -1,256 +0,0 @@ ------------------------------------------------------------------------------ --- SMTP client support for the Lua language. --- LuaSocket toolkit. --- Author: Diego Nehab ------------------------------------------------------------------------------ - ------------------------------------------------------------------------------ --- Declare module and import dependencies ------------------------------------------------------------------------------ -local base = _G -local coroutine = require("coroutine") -local string = require("string") -local math = require("math") -local os = require("os") -local socket = require("socket") -local tp = require("socket.tp") -local ltn12 = require("ltn12") -local headers = require("socket.headers") -local mime = require("mime") - -socket.smtp = {} -local _M = socket.smtp - ------------------------------------------------------------------------------ --- Program constants ------------------------------------------------------------------------------ --- timeout for connection -_M.TIMEOUT = 60 --- default server used to send e-mails -_M.SERVER = "localhost" --- default port -_M.PORT = 25 --- domain used in HELO command and default sendmail --- If we are under a CGI, try to get from environment -_M.DOMAIN = os.getenv("SERVER_NAME") or "localhost" --- default time zone (means we don't know) -_M.ZONE = "-0000" - ---------------------------------------------------------------------------- --- Low level SMTP API ------------------------------------------------------------------------------ -local metat = { __index = {} } - -function metat.__index:greet(domain) - self.try(self.tp:check("2..")) - self.try(self.tp:command("EHLO", domain or _M.DOMAIN)) - return socket.skip(1, self.try(self.tp:check("2.."))) -end - -function metat.__index:mail(from) - self.try(self.tp:command("MAIL", "FROM:" .. from)) - return self.try(self.tp:check("2..")) -end - -function metat.__index:rcpt(to) - self.try(self.tp:command("RCPT", "TO:" .. to)) - return self.try(self.tp:check("2..")) -end - -function metat.__index:data(src, step) - self.try(self.tp:command("DATA")) - self.try(self.tp:check("3..")) - self.try(self.tp:source(src, step)) - self.try(self.tp:send("\r\n.\r\n")) - return self.try(self.tp:check("2..")) -end - -function metat.__index:quit() - self.try(self.tp:command("QUIT")) - return self.try(self.tp:check("2..")) -end - -function metat.__index:close() - return self.tp:close() -end - -function metat.__index:login(user, password) - self.try(self.tp:command("AUTH", "LOGIN")) - self.try(self.tp:check("3..")) - self.try(self.tp:send(mime.b64(user) .. "\r\n")) - self.try(self.tp:check("3..")) - self.try(self.tp:send(mime.b64(password) .. "\r\n")) - return self.try(self.tp:check("2..")) -end - -function metat.__index:plain(user, password) - local auth = "PLAIN " .. mime.b64("\0" .. user .. "\0" .. password) - self.try(self.tp:command("AUTH", auth)) - return self.try(self.tp:check("2..")) -end - -function metat.__index:auth(user, password, ext) - if not user or not password then return 1 end - if string.find(ext, "AUTH[^\n]+LOGIN") then - return self:login(user, password) - elseif string.find(ext, "AUTH[^\n]+PLAIN") then - return self:plain(user, password) - else - self.try(nil, "authentication not supported") - end -end - --- send message or throw an exception -function metat.__index:send(mailt) - self:mail(mailt.from) - if base.type(mailt.rcpt) == "table" then - for i,v in base.ipairs(mailt.rcpt) do - self:rcpt(v) - end - else - self:rcpt(mailt.rcpt) - end - self:data(ltn12.source.chain(mailt.source, mime.stuff()), mailt.step) -end - -function _M.open(server, port, create) - local tp = socket.try(tp.connect(server or _M.SERVER, port or _M.PORT, - _M.TIMEOUT, create)) - local s = base.setmetatable({tp = tp}, metat) - -- make sure tp is closed if we get an exception - s.try = socket.newtry(function() - s:close() - end) - return s -end - --- convert headers to lowercase -local function lower_headers(headers) - local lower = {} - for i,v in base.pairs(headers or lower) do - lower[string.lower(i)] = v - end - return lower -end - ---------------------------------------------------------------------------- --- Multipart message source ------------------------------------------------------------------------------ --- returns a hopefully unique mime boundary -local seqno = 0 -local function newboundary() - seqno = seqno + 1 - return string.format('%s%05d==%05u', os.date('%d%m%Y%H%M%S'), - math.random(0, 99999), seqno) -end - --- send_message forward declaration -local send_message - --- yield the headers all at once, it's faster -local function send_headers(tosend) - local canonic = headers.canonic - local h = "\r\n" - for f,v in base.pairs(tosend) do - h = (canonic[f] or f) .. ': ' .. v .. "\r\n" .. h - end - coroutine.yield(h) -end - --- yield multipart message body from a multipart message table -local function send_multipart(mesgt) - -- make sure we have our boundary and send headers - local bd = newboundary() - local headers = lower_headers(mesgt.headers or {}) - headers['content-type'] = headers['content-type'] or 'multipart/mixed' - headers['content-type'] = headers['content-type'] .. - '; boundary="' .. bd .. '"' - send_headers(headers) - -- send preamble - if mesgt.body.preamble then - coroutine.yield(mesgt.body.preamble) - coroutine.yield("\r\n") - end - -- send each part separated by a boundary - for i, m in base.ipairs(mesgt.body) do - coroutine.yield("\r\n--" .. bd .. "\r\n") - send_message(m) - end - -- send last boundary - coroutine.yield("\r\n--" .. bd .. "--\r\n\r\n") - -- send epilogue - if mesgt.body.epilogue then - coroutine.yield(mesgt.body.epilogue) - coroutine.yield("\r\n") - end -end - --- yield message body from a source -local function send_source(mesgt) - -- make sure we have a content-type - local headers = lower_headers(mesgt.headers or {}) - headers['content-type'] = headers['content-type'] or - 'text/plain; charset="iso-8859-1"' - send_headers(headers) - -- send body from source - while true do - local chunk, err = mesgt.body() - if err then coroutine.yield(nil, err) - elseif chunk then coroutine.yield(chunk) - else break end - end -end - --- yield message body from a string -local function send_string(mesgt) - -- make sure we have a content-type - local headers = lower_headers(mesgt.headers or {}) - headers['content-type'] = headers['content-type'] or - 'text/plain; charset="iso-8859-1"' - send_headers(headers) - -- send body from string - coroutine.yield(mesgt.body) -end - --- message source -function send_message(mesgt) - if base.type(mesgt.body) == "table" then send_multipart(mesgt) - elseif base.type(mesgt.body) == "function" then send_source(mesgt) - else send_string(mesgt) end -end - --- set defaul headers -local function adjust_headers(mesgt) - local lower = lower_headers(mesgt.headers) - lower["date"] = lower["date"] or - os.date("!%a, %d %b %Y %H:%M:%S ") .. (mesgt.zone or _M.ZONE) - lower["x-mailer"] = lower["x-mailer"] or socket._VERSION - -- this can't be overridden - lower["mime-version"] = "1.0" - return lower -end - -function _M.message(mesgt) - mesgt.headers = adjust_headers(mesgt) - -- create and return message source - local co = coroutine.create(function() send_message(mesgt) end) - return function() - local ret, a, b = coroutine.resume(co) - if ret then return a, b - else return nil, a end - end -end - ---------------------------------------------------------------------------- --- High level SMTP API ------------------------------------------------------------------------------ -_M.send = socket.protect(function(mailt) - local s = _M.open(mailt.server, mailt.port, mailt.create) - local ext = s:greet(mailt.domain) - s:auth(mailt.user, mailt.password, ext) - s:send(mailt) - s:quit() - return s:close() -end) - -return _M \ No newline at end of file diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/smtp.lua.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/smtp.lua.h deleted file mode 100644 index 2faf479c..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/smtp.lua.h +++ /dev/null @@ -1,415 +0,0 @@ -/* code automatically generated by bin2c -- DO NOT EDIT */ -{ -/* #include'ing this file in a C program is equivalent to calling - if (luaL_loadfile(L,"smtp.lua")==0) lua_call(L, 0, LUA_MULTRET); -*/ -/* smtp.lua */ -static const unsigned char B1[]={ - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, - 32, 83, 77, 84, 80, 32, 99,108,105,101,110,116, 32,115,117,112,112,111,114,116, - 32,102,111,114, 32,116,104,101, 32, 76,117, 97, 32,108, 97,110,103,117, 97,103, -101, 46, 10, 45, 45, 32, 76,117, 97, 83,111, 99,107,101,116, 32,116,111,111,108, -107,105,116, 46, 10, 45, 45, 32, 65,117,116,104,111,114, 58, 32, 68,105,101,103, -111, 32, 78,101,104, 97, 98, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 10, 45, 45, 32, 68,101, 99,108, 97,114,101, 32,109,111,100,117, -108,101, 32, 97,110,100, 32,105,109,112,111,114,116, 32,100,101,112,101,110,100, -101,110, 99,105,101,115, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 10,108,111, 99, 97,108, 32, 98, 97,115,101, 32, 61, 32, 95, 71, - 10,108,111, 99, 97,108, 32, 99,111,114,111,117,116,105,110,101, 32, 61, 32,114, -101,113,117,105,114,101, 40, 34, 99,111,114,111,117,116,105,110,101, 34, 41, 10, -108,111, 99, 97,108, 32,115,116,114,105,110,103, 32, 61, 32,114,101,113,117,105, -114,101, 40, 34,115,116,114,105,110,103, 34, 41, 10,108,111, 99, 97,108, 32,109, - 97,116,104, 32, 61, 32,114,101,113,117,105,114,101, 40, 34,109, 97,116,104, 34, - 41, 10,108,111, 99, 97,108, 32,111,115, 32, 61, 32,114,101,113,117,105,114,101, - 40, 34,111,115, 34, 41, 10,108,111, 99, 97,108, 32,115,111, 99,107,101,116, 32, - 61, 32,114,101,113,117,105,114,101, 40, 34,115,111, 99,107,101,116, 34, 41, 10, -108,111, 99, 97,108, 32,116,112, 32, 61, 32,114,101,113,117,105,114,101, 40, 34, -115,111, 99,107,101,116, 46,116,112, 34, 41, 10,108,111, 99, 97,108, 32,108,116, -110, 49, 50, 32, 61, 32,114,101,113,117,105,114,101, 40, 34,108,116,110, 49, 50, - 34, 41, 10,108,111, 99, 97,108, 32,104,101, 97,100,101,114,115, 32, 61, 32,114, -101,113,117,105,114,101, 40, 34,115,111, 99,107,101,116, 46,104,101, 97,100,101, -114,115, 34, 41, 10,108,111, 99, 97,108, 32,109,105,109,101, 32, 61, 32,114,101, -113,117,105,114,101, 40, 34,109,105,109,101, 34, 41, 10, 10,115,111, 99,107,101, -116, 46,115,109,116,112, 32, 61, 32,123,125, 10,108,111, 99, 97,108, 32, 95, 77, - 32, 61, 32,115,111, 99,107,101,116, 46,115,109,116,112, 10, 10, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 80,114,111, -103,114, 97,109, 32, 99,111,110,115,116, 97,110,116,115, 10, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32,116,105,109,101, -111,117,116, 32,102,111,114, 32, 99,111,110,110,101, 99,116,105,111,110, 10, 95, - 77, 46, 84, 73, 77, 69, 79, 85, 84, 32, 61, 32, 54, 48, 10, 45, 45, 32,100,101, -102, 97,117,108,116, 32,115,101,114,118,101,114, 32,117,115,101,100, 32,116,111, - 32,115,101,110,100, 32,101, 45,109, 97,105,108,115, 10, 95, 77, 46, 83, 69, 82, - 86, 69, 82, 32, 61, 32, 34,108,111, 99, 97,108,104,111,115,116, 34, 10, 45, 45, - 32,100,101,102, 97,117,108,116, 32,112,111,114,116, 10, 95, 77, 46, 80, 79, 82, - 84, 32, 61, 32, 50, 53, 10, 45, 45, 32,100,111,109, 97,105,110, 32,117,115,101, -100, 32,105,110, 32, 72, 69, 76, 79, 32, 99,111,109,109, 97,110,100, 32, 97,110, -100, 32,100,101,102, 97,117,108,116, 32,115,101,110,100,109, 97,105,108, 10, 45, - 45, 32, 73,102, 32,119,101, 32, 97,114,101, 32,117,110,100,101,114, 32, 97, 32, - 67, 71, 73, 44, 32,116,114,121, 32,116,111, 32,103,101,116, 32,102,114,111,109, - 32,101,110,118,105,114,111,110,109,101,110,116, 10, 95, 77, 46, 68, 79, 77, 65, - 73, 78, 32, 61, 32,111,115, 46,103,101,116,101,110,118, 40, 34, 83, 69, 82, 86, - 69, 82, 95, 78, 65, 77, 69, 34, 41, 32,111,114, 32, 34,108,111, 99, 97,108,104, -111,115,116, 34, 10, 45, 45, 32,100,101,102, 97,117,108,116, 32,116,105,109,101, - 32,122,111,110,101, 32, 40,109,101, 97,110,115, 32,119,101, 32,100,111,110, 39, -116, 32,107,110,111,119, 41, 10, 95, 77, 46, 90, 79, 78, 69, 32, 61, 32, 34, 45, - 48, 48, 48, 48, 34, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 10, 45, 45, 32, 76,111,119, 32,108,101,118,101,108, 32, 83, 77, 84, 80, - 32, 65, 80, 73, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 10,108,111, 99, 97,108, 32,109,101,116, 97,116, 32, 61, 32,123, 32, 95, - 95,105,110,100,101,120, 32, 61, 32,123,125, 32,125, 10, 10,102,117,110, 99,116, -105,111,110, 32,109,101,116, 97,116, 46, 95, 95,105,110,100,101,120, 58,103,114, -101,101,116, 40,100,111,109, 97,105,110, 41, 10, 32, 32, 32, 32,115,101,108,102, - 46,116,114,121, 40,115,101,108,102, 46,116,112, 58, 99,104,101, 99,107, 40, 34, - 50, 46, 46, 34, 41, 41, 10, 32, 32, 32, 32,115,101,108,102, 46,116,114,121, 40, -115,101,108,102, 46,116,112, 58, 99,111,109,109, 97,110,100, 40, 34, 69, 72, 76, - 79, 34, 44, 32,100,111,109, 97,105,110, 32,111,114, 32, 95, 77, 46, 68, 79, 77, - 65, 73, 78, 41, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,115,111, 99, -107,101,116, 46,115,107,105,112, 40, 49, 44, 32,115,101,108,102, 46,116,114,121, - 40,115,101,108,102, 46,116,112, 58, 99,104,101, 99,107, 40, 34, 50, 46, 46, 34, - 41, 41, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,109,101, -116, 97,116, 46, 95, 95,105,110,100,101,120, 58,109, 97,105,108, 40,102,114,111, -109, 41, 10, 32, 32, 32, 32,115,101,108,102, 46,116,114,121, 40,115,101,108,102, - 46,116,112, 58, 99,111,109,109, 97,110,100, 40, 34, 77, 65, 73, 76, 34, 44, 32, - 34, 70, 82, 79, 77, 58, 34, 32, 46, 46, 32,102,114,111,109, 41, 41, 10, 32, 32, - 32, 32,114,101,116,117,114,110, 32,115,101,108,102, 46,116,114,121, 40,115,101, -108,102, 46,116,112, 58, 99,104,101, 99,107, 40, 34, 50, 46, 46, 34, 41, 41, 10, -101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,109,101,116, 97,116, 46, - 95, 95,105,110,100,101,120, 58,114, 99,112,116, 40,116,111, 41, 10, 32, 32, 32, - 32,115,101,108,102, 46,116,114,121, 40,115,101,108,102, 46,116,112, 58, 99,111, -109,109, 97,110,100, 40, 34, 82, 67, 80, 84, 34, 44, 32, 34, 84, 79, 58, 34, 32, - 46, 46, 32,116,111, 41, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,115, -101,108,102, 46,116,114,121, 40,115,101,108,102, 46,116,112, 58, 99,104,101, 99, -107, 40, 34, 50, 46, 46, 34, 41, 41, 10,101,110,100, 10, 10,102,117,110, 99,116, -105,111,110, 32,109,101,116, 97,116, 46, 95, 95,105,110,100,101,120, 58,100, 97, -116, 97, 40,115,114, 99, 44, 32,115,116,101,112, 41, 10, 32, 32, 32, 32,115,101, -108,102, 46,116,114,121, 40,115,101,108,102, 46,116,112, 58, 99,111,109,109, 97, -110,100, 40, 34, 68, 65, 84, 65, 34, 41, 41, 10, 32, 32, 32, 32,115,101,108,102, - 46,116,114,121, 40,115,101,108,102, 46,116,112, 58, 99,104,101, 99,107, 40, 34, - 51, 46, 46, 34, 41, 41, 10, 32, 32, 32, 32,115,101,108,102, 46,116,114,121, 40, -115,101,108,102, 46,116,112, 58,115,111,117,114, 99,101, 40,115,114, 99, 44, 32, -115,116,101,112, 41, 41, 10, 32, 32, 32, 32,115,101,108,102, 46,116,114,121, 40, -115,101,108,102, 46,116,112, 58,115,101,110,100, 40, 34, 92,114, 92,110, 46, 92, -114, 92,110, 34, 41, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,115,101, -108,102, 46,116,114,121, 40,115,101,108,102, 46,116,112, 58, 99,104,101, 99,107, - 40, 34, 50, 46, 46, 34, 41, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105, -111,110, 32,109,101,116, 97,116, 46, 95, 95,105,110,100,101,120, 58,113,117,105, -116, 40, 41, 10, 32, 32, 32, 32,115,101,108,102, 46,116,114,121, 40,115,101,108, -102, 46,116,112, 58, 99,111,109,109, 97,110,100, 40, 34, 81, 85, 73, 84, 34, 41, - 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,115,101,108,102, 46,116,114, -121, 40,115,101,108,102, 46,116,112, 58, 99,104,101, 99,107, 40, 34, 50, 46, 46, - 34, 41, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,109,101, -116, 97,116, 46, 95, 95,105,110,100,101,120, 58, 99,108,111,115,101, 40, 41, 10, - 32, 32, 32, 32,114,101,116,117,114,110, 32,115,101,108,102, 46,116,112, 58, 99, -108,111,115,101, 40, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, - 32,109,101,116, 97,116, 46, 95, 95,105,110,100,101,120, 58,108,111,103,105,110, - 40,117,115,101,114, 44, 32,112, 97,115,115,119,111,114,100, 41, 10, 32, 32, 32, - 32,115,101,108,102, 46,116,114,121, 40,115,101,108,102, 46,116,112, 58, 99,111, -109,109, 97,110,100, 40, 34, 65, 85, 84, 72, 34, 44, 32, 34, 76, 79, 71, 73, 78, - 34, 41, 41, 10, 32, 32, 32, 32,115,101,108,102, 46,116,114,121, 40,115,101,108, -102, 46,116,112, 58, 99,104,101, 99,107, 40, 34, 51, 46, 46, 34, 41, 41, 10, 32, - 32, 32, 32,115,101,108,102, 46,116,114,121, 40,115,101,108,102, 46,116,112, 58, -115,101,110,100, 40,109,105,109,101, 46, 98, 54, 52, 40,117,115,101,114, 41, 32, - 46, 46, 32, 34, 92,114, 92,110, 34, 41, 41, 10, 32, 32, 32, 32,115,101,108,102, - 46,116,114,121, 40,115,101,108,102, 46,116,112, 58, 99,104,101, 99,107, 40, 34, - 51, 46, 46, 34, 41, 41, 10, 32, 32, 32, 32,115,101,108,102, 46,116,114,121, 40, -115,101,108,102, 46,116,112, 58,115,101,110,100, 40,109,105,109,101, 46, 98, 54, - 52, 40,112, 97,115,115,119,111,114,100, 41, 32, 46, 46, 32, 34, 92,114, 92,110, - 34, 41, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,115,101,108,102, 46, -116,114,121, 40,115,101,108,102, 46,116,112, 58, 99,104,101, 99,107, 40, 34, 50, - 46, 46, 34, 41, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32, -109,101,116, 97,116, 46, 95, 95,105,110,100,101,120, 58,112,108, 97,105,110, 40, -117,115,101,114, 44, 32,112, 97,115,115,119,111,114,100, 41, 10, 32, 32, 32, 32, -108,111, 99, 97,108, 32, 97,117,116,104, 32, 61, 32, 34, 80, 76, 65, 73, 78, 32, - 34, 32, 46, 46, 32,109,105,109,101, 46, 98, 54, 52, 40, 34, 92, 48, 34, 32, 46, - 46, 32,117,115,101,114, 32, 46, 46, 32, 34, 92, 48, 34, 32, 46, 46, 32,112, 97, -115,115,119,111,114,100, 41, 10, 32, 32, 32, 32,115,101,108,102, 46,116,114,121, - 40,115,101,108,102, 46,116,112, 58, 99,111,109,109, 97,110,100, 40, 34, 65, 85, - 84, 72, 34, 44, 32, 97,117,116,104, 41, 41, 10, 32, 32, 32, 32,114,101,116,117, -114,110, 32,115,101,108,102, 46,116,114,121, 40,115,101,108,102, 46,116,112, 58, - 99,104,101, 99,107, 40, 34, 50, 46, 46, 34, 41, 41, 10,101,110,100, 10, 10,102, -117,110, 99,116,105,111,110, 32,109,101,116, 97,116, 46, 95, 95,105,110,100,101, -120, 58, 97,117,116,104, 40,117,115,101,114, 44, 32,112, 97,115,115,119,111,114, -100, 44, 32,101,120,116, 41, 10, 32, 32, 32, 32,105,102, 32,110,111,116, 32,117, -115,101,114, 32,111,114, 32,110,111,116, 32,112, 97,115,115,119,111,114,100, 32, -116,104,101,110, 32,114,101,116,117,114,110, 32, 49, 32,101,110,100, 10, 32, 32, - 32, 32,105,102, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,101,120,116, - 44, 32, 34, 65, 85, 84, 72, 91, 94, 92,110, 93, 43, 76, 79, 71, 73, 78, 34, 41, - 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114,110, - 32,115,101,108,102, 58,108,111,103,105,110, 40,117,115,101,114, 44, 32,112, 97, -115,115,119,111,114,100, 41, 10, 32, 32, 32, 32,101,108,115,101,105,102, 32,115, -116,114,105,110,103, 46,102,105,110,100, 40,101,120,116, 44, 32, 34, 65, 85, 84, - 72, 91, 94, 92,110, 93, 43, 80, 76, 65, 73, 78, 34, 41, 32,116,104,101,110, 10, - 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114,110, 32,115,101,108,102, 58, -112,108, 97,105,110, 40,117,115,101,114, 44, 32,112, 97,115,115,119,111,114,100, - 41, 10, 32, 32, 32, 32,101,108,115,101, 10, 32, 32, 32, 32, 32, 32, 32, 32,115, -101,108,102, 46,116,114,121, 40,110,105,108, 44, 32, 34, 97,117,116,104,101,110, -116,105, 99, 97,116,105,111,110, 32,110,111,116, 32,115,117,112,112,111,114,116, -101,100, 34, 41, 10, 32, 32, 32, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, - 32,115,101,110,100, 32,109,101,115,115, 97,103,101, 32,111,114, 32,116,104,114, -111,119, 32, 97,110, 32,101,120, 99,101,112,116,105,111,110, 10,102,117,110, 99, -116,105,111,110, 32,109,101,116, 97,116, 46, 95, 95,105,110,100,101,120, 58,115, -101,110,100, 40,109, 97,105,108,116, 41, 10, 32, 32, 32, 32,115,101,108,102, 58, -109, 97,105,108, 40,109, 97,105,108,116, 46,102,114,111,109, 41, 10, 32, 32, 32, - 32,105,102, 32, 98, 97,115,101, 46,116,121,112,101, 40,109, 97,105,108,116, 46, -114, 99,112,116, 41, 32, 61, 61, 32, 34,116, 97, 98,108,101, 34, 32,116,104,101, -110, 10, 32, 32, 32, 32, 32, 32, 32, 32,102,111,114, 32,105, 44,118, 32,105,110, - 32, 98, 97,115,101, 46,105,112, 97,105,114,115, 40,109, 97,105,108,116, 46,114, - 99,112,116, 41, 32,100,111, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, -115,101,108,102, 58,114, 99,112,116, 40,118, 41, 10, 32, 32, 32, 32, 32, 32, 32, - 32,101,110,100, 10, 32, 32, 32, 32,101,108,115,101, 10, 32, 32, 32, 32, 32, 32, - 32, 32,115,101,108,102, 58,114, 99,112,116, 40,109, 97,105,108,116, 46,114, 99, -112,116, 41, 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,115,101,108,102, - 58,100, 97,116, 97, 40,108,116,110, 49, 50, 46,115,111,117,114, 99,101, 46, 99, -104, 97,105,110, 40,109, 97,105,108,116, 46,115,111,117,114, 99,101, 44, 32,109, -105,109,101, 46,115,116,117,102,102, 40, 41, 41, 44, 32,109, 97,105,108,116, 46, -115,116,101,112, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32, - 95, 77, 46,111,112,101,110, 40,115,101,114,118,101,114, 44, 32,112,111,114,116, - 44, 32, 99,114,101, 97,116,101, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32, -116,112, 32, 61, 32,115,111, 99,107,101,116, 46,116,114,121, 40,116,112, 46, 99, -111,110,110,101, 99,116, 40,115,101,114,118,101,114, 32,111,114, 32, 95, 77, 46, - 83, 69, 82, 86, 69, 82, 44, 32,112,111,114,116, 32,111,114, 32, 95, 77, 46, 80, - 79, 82, 84, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 95, 77, 46, 84, 73, 77, 69, - 79, 85, 84, 44, 32, 99,114,101, 97,116,101, 41, 41, 10, 32, 32, 32, 32,108,111, - 99, 97,108, 32,115, 32, 61, 32, 98, 97,115,101, 46,115,101,116,109,101,116, 97, -116, 97, 98,108,101, 40,123,116,112, 32, 61, 32,116,112,125, 44, 32,109,101,116, - 97,116, 41, 10, 32, 32, 32, 32, 45, 45, 32,109, 97,107,101, 32,115,117,114,101, - 32,116,112, 32,105,115, 32, 99,108,111,115,101,100, 32,105,102, 32,119,101, 32, -103,101,116, 32, 97,110, 32,101,120, 99,101,112,116,105,111,110, 10, 32, 32, 32, - 32,115, 46,116,114,121, 32, 61, 32,115,111, 99,107,101,116, 46,110,101,119,116, -114,121, 40,102,117,110, 99,116,105,111,110, 40, 41, 10, 32, 32, 32, 32, 32, 32, - 32, 32,115, 58, 99,108,111,115,101, 40, 41, 10, 32, 32, 32, 32,101,110,100, 41, - 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,115, 10,101,110,100, 10, 10, 45, - 45, 32, 99,111,110,118,101,114,116, 32,104,101, 97,100,101,114,115, 32,116,111, - 32,108,111,119,101,114, 99, 97,115,101, 10,108,111, 99, 97,108, 32,102,117,110, - 99,116,105,111,110, 32,108,111,119,101,114, 95,104,101, 97,100,101,114,115, 40, -104,101, 97,100,101,114,115, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,108, -111,119,101,114, 32, 61, 32,123,125, 10, 32, 32, 32, 32,102,111,114, 32,105, 44, -118, 32,105,110, 32, 98, 97,115,101, 46,112, 97,105,114,115, 40,104,101, 97,100, -101,114,115, 32,111,114, 32,108,111,119,101,114, 41, 32,100,111, 10, 32, 32, 32, - 32, 32, 32, 32, 32,108,111,119,101,114, 91,115,116,114,105,110,103, 46,108,111, -119,101,114, 40,105, 41, 93, 32, 61, 32,118, 10, 32, 32, 32, 32,101,110,100, 10, - 32, 32, 32, 32,114,101,116,117,114,110, 32,108,111,119,101,114, 10,101,110,100, - 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, - 32, 77,117,108,116,105,112, 97,114,116, 32,109,101,115,115, 97,103,101, 32,115, -111,117,114, 99,101, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 10, 45, 45, 32,114,101,116,117,114,110,115, 32, 97, 32,104,111,112, -101,102,117,108,108,121, 32,117,110,105,113,117,101, 32,109,105,109,101, 32, 98, -111,117,110,100, 97,114,121, 10,108,111, 99, 97,108, 32,115,101,113,110,111, 32, - 61, 32, 48, 10,108,111, 99, 97,108, 32,102,117,110, 99,116,105,111,110, 32,110, -101,119, 98,111,117,110,100, 97,114,121, 40, 41, 10, 32, 32, 32, 32,115,101,113, -110,111, 32, 61, 32,115,101,113,110,111, 32, 43, 32, 49, 10, 32, 32, 32, 32,114, -101,116,117,114,110, 32,115,116,114,105,110,103, 46,102,111,114,109, 97,116, 40, - 39, 37,115, 37, 48, 53,100, 61, 61, 37, 48, 53,117, 39, 44, 32,111,115, 46,100, - 97,116,101, 40, 39, 37,100, 37,109, 37, 89, 37, 72, 37, 77, 37, 83, 39, 41, 44, - 10, 32, 32, 32, 32, 32, 32, 32, 32,109, 97,116,104, 46,114, 97,110,100,111,109, - 40, 48, 44, 32, 57, 57, 57, 57, 57, 41, 44, 32,115,101,113,110,111, 41, 10,101, -110,100, 10, 10, 45, 45, 32,115,101,110,100, 95,109,101,115,115, 97,103,101, 32, -102,111,114,119, 97,114,100, 32,100,101, 99,108, 97,114, 97,116,105,111,110, 10, -108,111, 99, 97,108, 32,115,101,110,100, 95,109,101,115,115, 97,103,101, 10, 10, - 45, 45, 32,121,105,101,108,100, 32,116,104,101, 32,104,101, 97,100,101,114,115, - 32, 97,108,108, 32, 97,116, 32,111,110, 99,101, 44, 32,105,116, 39,115, 32,102, - 97,115,116,101,114, 10,108,111, 99, 97,108, 32,102,117,110, 99,116,105,111,110, - 32,115,101,110,100, 95,104,101, 97,100,101,114,115, 40,116,111,115,101,110,100, - 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32, 99, 97,110,111,110,105, 99, 32, - 61, 32,104,101, 97,100,101,114,115, 46, 99, 97,110,111,110,105, 99, 10, 32, 32, - 32, 32,108,111, 99, 97,108, 32,104, 32, 61, 32, 34, 92,114, 92,110, 34, 10, 32, - 32, 32, 32,102,111,114, 32,102, 44,118, 32,105,110, 32, 98, 97,115,101, 46,112, - 97,105,114,115, 40,116,111,115,101,110,100, 41, 32,100,111, 10, 32, 32, 32, 32, - 32, 32, 32, 32,104, 32, 61, 32, 40, 99, 97,110,111,110,105, 99, 91,102, 93, 32, -111,114, 32,102, 41, 32, 46, 46, 32, 39, 58, 32, 39, 32, 46, 46, 32,118, 32, 46, - 46, 32, 34, 92,114, 92,110, 34, 32, 46, 46, 32,104, 10, 32, 32, 32, 32,101,110, -100, 10, 32, 32, 32, 32, 99,111,114,111,117,116,105,110,101, 46,121,105,101,108, -100, 40,104, 41, 10,101,110,100, 10, 10, 45, 45, 32,121,105,101,108,100, 32,109, -117,108,116,105,112, 97,114,116, 32,109,101,115,115, 97,103,101, 32, 98,111,100, -121, 32,102,114,111,109, 32, 97, 32,109,117,108,116,105,112, 97,114,116, 32,109, -101,115,115, 97,103,101, 32,116, 97, 98,108,101, 10,108,111, 99, 97,108, 32,102, -117,110, 99,116,105,111,110, 32,115,101,110,100, 95,109,117,108,116,105,112, 97, -114,116, 40,109,101,115,103,116, 41, 10, 32, 32, 32, 32, 45, 45, 32,109, 97,107, -101, 32,115,117,114,101, 32,119,101, 32,104, 97,118,101, 32,111,117,114, 32, 98, -111,117,110,100, 97,114,121, 32, 97,110,100, 32,115,101,110,100, 32,104,101, 97, -100,101,114,115, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32, 98,100, 32, 61, 32, -110,101,119, 98,111,117,110,100, 97,114,121, 40, 41, 10, 32, 32, 32, 32,108,111, - 99, 97,108, 32,104,101, 97,100,101,114,115, 32, 61, 32,108,111,119,101,114, 95, -104,101, 97,100,101,114,115, 40,109,101,115,103,116, 46,104,101, 97,100,101,114, -115, 32,111,114, 32,123,125, 41, 10, 32, 32, 32, 32,104,101, 97,100,101,114,115, - 91, 39, 99,111,110,116,101,110,116, 45,116,121,112,101, 39, 93, 32, 61, 32,104, -101, 97,100,101,114,115, 91, 39, 99,111,110,116,101,110,116, 45,116,121,112,101, - 39, 93, 32,111,114, 32, 39,109,117,108,116,105,112, 97,114,116, 47,109,105,120, -101,100, 39, 10, 32, 32, 32, 32,104,101, 97,100,101,114,115, 91, 39, 99,111,110, -116,101,110,116, 45,116,121,112,101, 39, 93, 32, 61, 32,104,101, 97,100,101,114, -115, 91, 39, 99,111,110,116,101,110,116, 45,116,121,112,101, 39, 93, 32, 46, 46, - 10, 32, 32, 32, 32, 32, 32, 32, 32, 39, 59, 32, 98,111,117,110,100, 97,114,121, - 61, 34, 39, 32, 46, 46, 32, 32, 98,100, 32, 46, 46, 32, 39, 34, 39, 10, 32, 32, - 32, 32,115,101,110,100, 95,104,101, 97,100,101,114,115, 40,104,101, 97,100,101, -114,115, 41, 10, 32, 32, 32, 32, 45, 45, 32,115,101,110,100, 32,112,114,101, 97, -109, 98,108,101, 10, 32, 32, 32, 32,105,102, 32,109,101,115,103,116, 46, 98,111, -100,121, 46,112,114,101, 97,109, 98,108,101, 32,116,104,101,110, 10, 32, 32, 32, - 32, 32, 32, 32, 32, 99,111,114,111,117,116,105,110,101, 46,121,105,101,108,100, - 40,109,101,115,103,116, 46, 98,111,100,121, 46,112,114,101, 97,109, 98,108,101, - 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 99,111,114,111,117,116,105,110,101, 46, -121,105,101,108,100, 40, 34, 92,114, 92,110, 34, 41, 10, 32, 32, 32, 32,101,110, -100, 10, 32, 32, 32, 32, 45, 45, 32,115,101,110,100, 32,101, 97, 99,104, 32,112, - 97,114,116, 32,115,101,112, 97,114, 97,116,101,100, 32, 98,121, 32, 97, 32, 98, -111,117,110,100, 97,114,121, 10, 32, 32, 32, 32,102,111,114, 32,105, 44, 32,109, - 32,105,110, 32, 98, 97,115,101, 46,105,112, 97,105,114,115, 40,109,101,115,103, -116, 46, 98,111,100,121, 41, 32,100,111, 10, 32, 32, 32, 32, 32, 32, 32, 32, 99, -111,114,111,117,116,105,110,101, 46,121,105,101,108,100, 40, 34, 92,114, 92,110, - 45, 45, 34, 32, 46, 46, 32, 98,100, 32, 46, 46, 32, 34, 92,114, 92,110, 34, 41, - 10, 32, 32, 32, 32, 32, 32, 32, 32,115,101,110,100, 95,109,101,115,115, 97,103, -101, 40,109, 41, 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, 45, 45, 32, -115,101,110,100, 32,108, 97,115,116, 32, 98,111,117,110,100, 97,114,121, 10, 32, - 32, 32, 32, 99,111,114,111,117,116,105,110,101, 46,121,105,101,108,100, 40, 34, - 92,114, 92,110, 45, 45, 34, 32, 46, 46, 32, 98,100, 32, 46, 46, 32, 34, 45, 45, - 92,114, 92,110, 92,114, 92,110, 34, 41, 10, 32, 32, 32, 32, 45, 45, 32,115,101, -110,100, 32,101,112,105,108,111,103,117,101, 10, 32, 32, 32, 32,105,102, 32,109, -101,115,103,116, 46, 98,111,100,121, 46,101,112,105,108,111,103,117,101, 32,116, -104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 99,111,114,111,117,116,105,110, -101, 46,121,105,101,108,100, 40,109,101,115,103,116, 46, 98,111,100,121, 46,101, -112,105,108,111,103,117,101, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 99,111,114, -111,117,116,105,110,101, 46,121,105,101,108,100, 40, 34, 92,114, 92,110, 34, 41, - 10, 32, 32, 32, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32,121,105,101, -108,100, 32,109,101,115,115, 97,103,101, 32, 98,111,100,121, 32,102,114,111,109, - 32, 97, 32,115,111,117,114, 99,101, 10,108,111, 99, 97,108, 32,102,117,110, 99, -116,105,111,110, 32,115,101,110,100, 95,115,111,117,114, 99,101, 40,109,101,115, -103,116, 41, 10, 32, 32, 32, 32, 45, 45, 32,109, 97,107,101, 32,115,117,114,101, - 32,119,101, 32,104, 97,118,101, 32, 97, 32, 99,111,110,116,101,110,116, 45,116, -121,112,101, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,104,101, 97,100,101,114, -115, 32, 61, 32,108,111,119,101,114, 95,104,101, 97,100,101,114,115, 40,109,101, -115,103,116, 46,104,101, 97,100,101,114,115, 32,111,114, 32,123,125, 41, 10, 32, - 32, 32, 32,104,101, 97,100,101,114,115, 91, 39, 99,111,110,116,101,110,116, 45, -116,121,112,101, 39, 93, 32, 61, 32,104,101, 97,100,101,114,115, 91, 39, 99,111, -110,116,101,110,116, 45,116,121,112,101, 39, 93, 32,111,114, 10, 32, 32, 32, 32, - 32, 32, 32, 32, 39,116,101,120,116, 47,112,108, 97,105,110, 59, 32, 99,104, 97, -114,115,101,116, 61, 34,105,115,111, 45, 56, 56, 53, 57, 45, 49, 34, 39, 10, 32, - 32, 32, 32,115,101,110,100, 95,104,101, 97,100,101,114,115, 40,104,101, 97,100, -101,114,115, 41, 10, 32, 32, 32, 32, 45, 45, 32,115,101,110,100, 32, 98,111,100, -121, 32,102,114,111,109, 32,115,111,117,114, 99,101, 10, 32, 32, 32, 32,119,104, -105,108,101, 32,116,114,117,101, 32,100,111, 10, 32, 32, 32, 32, 32, 32, 32, 32, -108,111, 99, 97,108, 32, 99,104,117,110,107, 44, 32,101,114,114, 32, 61, 32,109, -101,115,103,116, 46, 98,111,100,121, 40, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, -105,102, 32,101,114,114, 32,116,104,101,110, 32, 99,111,114,111,117,116,105,110, -101, 46,121,105,101,108,100, 40,110,105,108, 44, 32,101,114,114, 41, 10, 32, 32, - 32, 32, 32, 32, 32, 32,101,108,115,101,105,102, 32, 99,104,117,110,107, 32,116, -104,101,110, 32, 99,111,114,111,117,116,105,110,101, 46,121,105,101,108,100, 40, - 99,104,117,110,107, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,101,108,115,101, 32, - 98,114,101, 97,107, 32,101,110,100, 10, 32, 32, 32, 32,101,110,100, 10,101,110, -100, 10, 10, 45, 45, 32,121,105,101,108,100, 32,109,101,115,115, 97,103,101, 32, - 98,111,100,121, 32,102,114,111,109, 32, 97, 32,115,116,114,105,110,103, 10,108, -111, 99, 97,108, 32,102,117,110, 99,116,105,111,110, 32,115,101,110,100, 95,115, -116,114,105,110,103, 40,109,101,115,103,116, 41, 10, 32, 32, 32, 32, 45, 45, 32, -109, 97,107,101, 32,115,117,114,101, 32,119,101, 32,104, 97,118,101, 32, 97, 32, - 99,111,110,116,101,110,116, 45,116,121,112,101, 10, 32, 32, 32, 32,108,111, 99, - 97,108, 32,104,101, 97,100,101,114,115, 32, 61, 32,108,111,119,101,114, 95,104, -101, 97,100,101,114,115, 40,109,101,115,103,116, 46,104,101, 97,100,101,114,115, - 32,111,114, 32,123,125, 41, 10, 32, 32, 32, 32,104,101, 97,100,101,114,115, 91, - 39, 99,111,110,116,101,110,116, 45,116,121,112,101, 39, 93, 32, 61, 32,104,101, - 97,100,101,114,115, 91, 39, 99,111,110,116,101,110,116, 45,116,121,112,101, 39, - 93, 32,111,114, 10, 32, 32, 32, 32, 32, 32, 32, 32, 39,116,101,120,116, 47,112, -108, 97,105,110, 59, 32, 99,104, 97,114,115,101,116, 61, 34,105,115,111, 45, 56, - 56, 53, 57, 45, 49, 34, 39, 10, 32, 32, 32, 32,115,101,110,100, 95,104,101, 97, -100,101,114,115, 40,104,101, 97,100,101,114,115, 41, 10, 32, 32, 32, 32, 45, 45, - 32,115,101,110,100, 32, 98,111,100,121, 32,102,114,111,109, 32,115,116,114,105, -110,103, 10, 32, 32, 32, 32, 99,111,114,111,117,116,105,110,101, 46,121,105,101, -108,100, 40,109,101,115,103,116, 46, 98,111,100,121, 41, 10,101,110,100, 10, 10, - 45, 45, 32,109,101,115,115, 97,103,101, 32,115,111,117,114, 99,101, 10,102,117, -110, 99,116,105,111,110, 32,115,101,110,100, 95,109,101,115,115, 97,103,101, 40, -109,101,115,103,116, 41, 10, 32, 32, 32, 32,105,102, 32, 98, 97,115,101, 46,116, -121,112,101, 40,109,101,115,103,116, 46, 98,111,100,121, 41, 32, 61, 61, 32, 34, -116, 97, 98,108,101, 34, 32,116,104,101,110, 32,115,101,110,100, 95,109,117,108, -116,105,112, 97,114,116, 40,109,101,115,103,116, 41, 10, 32, 32, 32, 32,101,108, -115,101,105,102, 32, 98, 97,115,101, 46,116,121,112,101, 40,109,101,115,103,116, - 46, 98,111,100,121, 41, 32, 61, 61, 32, 34,102,117,110, 99,116,105,111,110, 34, - 32,116,104,101,110, 32,115,101,110,100, 95,115,111,117,114, 99,101, 40,109,101, -115,103,116, 41, 10, 32, 32, 32, 32,101,108,115,101, 32,115,101,110,100, 95,115, -116,114,105,110,103, 40,109,101,115,103,116, 41, 32,101,110,100, 10,101,110,100, - 10, 10, 45, 45, 32,115,101,116, 32,100,101,102, 97,117,108, 32,104,101, 97,100, -101,114,115, 10,108,111, 99, 97,108, 32,102,117,110, 99,116,105,111,110, 32, 97, -100,106,117,115,116, 95,104,101, 97,100,101,114,115, 40,109,101,115,103,116, 41, - 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,108,111,119,101,114, 32, 61, 32,108, -111,119,101,114, 95,104,101, 97,100,101,114,115, 40,109,101,115,103,116, 46,104, -101, 97,100,101,114,115, 41, 10, 32, 32, 32, 32,108,111,119,101,114, 91, 34,100, - 97,116,101, 34, 93, 32, 61, 32,108,111,119,101,114, 91, 34,100, 97,116,101, 34, - 93, 32,111,114, 10, 32, 32, 32, 32, 32, 32, 32, 32,111,115, 46,100, 97,116,101, - 40, 34, 33, 37, 97, 44, 32, 37,100, 32, 37, 98, 32, 37, 89, 32, 37, 72, 58, 37, - 77, 58, 37, 83, 32, 34, 41, 32, 46, 46, 32, 40,109,101,115,103,116, 46,122,111, -110,101, 32,111,114, 32, 95, 77, 46, 90, 79, 78, 69, 41, 10, 32, 32, 32, 32,108, -111,119,101,114, 91, 34,120, 45,109, 97,105,108,101,114, 34, 93, 32, 61, 32,108, -111,119,101,114, 91, 34,120, 45,109, 97,105,108,101,114, 34, 93, 32,111,114, 32, -115,111, 99,107,101,116, 46, 95, 86, 69, 82, 83, 73, 79, 78, 10, 32, 32, 32, 32, - 45, 45, 32,116,104,105,115, 32, 99, 97,110, 39,116, 32, 98,101, 32,111,118,101, -114,114,105,100,101,110, 10, 32, 32, 32, 32,108,111,119,101,114, 91, 34,109,105, -109,101, 45,118,101,114,115,105,111,110, 34, 93, 32, 61, 32, 34, 49, 46, 48, 34, - 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,108,111,119,101,114, 10,101,110, -100, 10, 10,102,117,110, 99,116,105,111,110, 32, 95, 77, 46,109,101,115,115, 97, -103,101, 40,109,101,115,103,116, 41, 10, 32, 32, 32, 32,109,101,115,103,116, 46, -104,101, 97,100,101,114,115, 32, 61, 32, 97,100,106,117,115,116, 95,104,101, 97, -100,101,114,115, 40,109,101,115,103,116, 41, 10, 32, 32, 32, 32, 45, 45, 32, 99, -114,101, 97,116,101, 32, 97,110,100, 32,114,101,116,117,114,110, 32,109,101,115, -115, 97,103,101, 32,115,111,117,114, 99,101, 10, 32, 32, 32, 32,108,111, 99, 97, -108, 32, 99,111, 32, 61, 32, 99,111,114,111,117,116,105,110,101, 46, 99,114,101, - 97,116,101, 40,102,117,110, 99,116,105,111,110, 40, 41, 32,115,101,110,100, 95, -109,101,115,115, 97,103,101, 40,109,101,115,103,116, 41, 32,101,110,100, 41, 10, - 32, 32, 32, 32,114,101,116,117,114,110, 32,102,117,110, 99,116,105,111,110, 40, - 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,108,111, 99, 97,108, 32,114,101,116, 44, - 32, 97, 44, 32, 98, 32, 61, 32, 99,111,114,111,117,116,105,110,101, 46,114,101, -115,117,109,101, 40, 99,111, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32, -114,101,116, 32,116,104,101,110, 32,114,101,116,117,114,110, 32, 97, 44, 32, 98, - 10, 32, 32, 32, 32, 32, 32, 32, 32,101,108,115,101, 32,114,101,116,117,114,110, - 32,110,105,108, 44, 32, 97, 32,101,110,100, 10, 32, 32, 32, 32,101,110,100, 10, -101,110,100, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 10, 45, 45, 32, 72,105,103,104, 32,108,101,118,101,108, 32, 83, 77, 84, 80, 32, - 65, 80, 73, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 10, 95, 77, 46,115,101,110,100, 32, 61, 32,115,111, 99,107,101,116, 46,112, -114,111,116,101, 99,116, 40,102,117,110, 99,116,105,111,110, 40,109, 97,105,108, -116, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,115, 32, 61, 32, 95, 77, 46, -111,112,101,110, 40,109, 97,105,108,116, 46,115,101,114,118,101,114, 44, 32,109, - 97,105,108,116, 46,112,111,114,116, 44, 32,109, 97,105,108,116, 46, 99,114,101, - 97,116,101, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,101,120,116, 32, 61, - 32,115, 58,103,114,101,101,116, 40,109, 97,105,108,116, 46,100,111,109, 97,105, -110, 41, 10, 32, 32, 32, 32,115, 58, 97,117,116,104, 40,109, 97,105,108,116, 46, -117,115,101,114, 44, 32,109, 97,105,108,116, 46,112, 97,115,115,119,111,114,100, - 44, 32,101,120,116, 41, 10, 32, 32, 32, 32,115, 58,115,101,110,100, 40,109, 97, -105,108,116, 41, 10, 32, 32, 32, 32,115, 58,113,117,105,116, 40, 41, 10, 32, 32, - 32, 32,114,101,116,117,114,110, 32,115, 58, 99,108,111,115,101, 40, 41, 10,101, -110,100, 41, 10, 10,114,101,116,117,114,110, 32, 95, 77, -}; - - if (luaL_loadbuffer(L,(const char*)B1,sizeof(B1),"smtp.lua")==0) lua_call(L, 0, LUA_MULTRET); -} diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/socket.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/socket.h deleted file mode 100644 index 63573de5..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/socket.h +++ /dev/null @@ -1,78 +0,0 @@ -#ifndef SOCKET_H -#define SOCKET_H -/*=========================================================================*\ -* Socket compatibilization module -* LuaSocket toolkit -* -* BSD Sockets and WinSock are similar, but there are a few irritating -* differences. Also, not all *nix platforms behave the same. This module -* (and the associated usocket.h and wsocket.h) factor these differences and -* creates a interface compatible with the io.h module. -\*=========================================================================*/ -#include "io.h" - -/*=========================================================================*\ -* Platform specific compatibilization -\*=========================================================================*/ -#ifdef _WIN32 -#include "wsocket.h" -#else -#include "usocket.h" -#endif - -/*=========================================================================*\ -* The connect and accept functions accept a timeout and their -* implementations are somewhat complicated. We chose to move -* the timeout control into this module for these functions in -* order to simplify the modules that use them. -\*=========================================================================*/ -#include "timeout.h" - -/* we are lazy... */ -typedef struct sockaddr SA; - -/*=========================================================================*\ -* Functions bellow implement a comfortable platform independent -* interface to sockets -\*=========================================================================*/ -int socket_open(void); -int socket_close(void); -void socket_destroy(p_socket ps); -void socket_shutdown(p_socket ps, int how); -int socket_sendto(p_socket ps, const char *data, size_t count, - size_t *sent, SA *addr, socklen_t addr_len, p_timeout tm); -int socket_recvfrom(p_socket ps, char *data, size_t count, - size_t *got, SA *addr, socklen_t *addr_len, p_timeout tm); - -void socket_setnonblocking(p_socket ps); -void socket_setblocking(p_socket ps); - -int socket_waitfd(p_socket ps, int sw, p_timeout tm); -int socket_select(t_socket n, fd_set *rfds, fd_set *wfds, fd_set *efds, - p_timeout tm); - -int socket_connect(p_socket ps, SA *addr, socklen_t addr_len, p_timeout tm); -int socket_create(p_socket ps, int domain, int type, int protocol); -int socket_bind(p_socket ps, SA *addr, socklen_t addr_len); -int socket_listen(p_socket ps, int backlog); -int socket_accept(p_socket ps, p_socket pa, SA *addr, - socklen_t *addr_len, p_timeout tm); - -const char *socket_hoststrerror(int err); -const char *socket_gaistrerror(int err); -const char *socket_strerror(int err); - -/* these are perfect to use with the io abstraction module - and the buffered input module */ -int socket_send(p_socket ps, const char *data, size_t count, - size_t *sent, p_timeout tm); -int socket_recv(p_socket ps, char *data, size_t count, size_t *got, p_timeout tm); -int socket_write(p_socket ps, const char *data, size_t count, - size_t *sent, p_timeout tm); -int socket_read(p_socket ps, char *data, size_t count, size_t *got, p_timeout tm); -const char *socket_ioerror(p_socket ps, int err); - -int socket_gethostbyaddr(const char *addr, socklen_t len, struct hostent **hp); -int socket_gethostbyname(const char *addr, struct hostent **hp); - -#endif /* SOCKET_H */ diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/socket.lua b/love/src/jni/love/src/libraries/luasocket/libluasocket/socket.lua deleted file mode 100644 index d1c0b164..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/socket.lua +++ /dev/null @@ -1,149 +0,0 @@ ------------------------------------------------------------------------------ --- LuaSocket helper module --- Author: Diego Nehab ------------------------------------------------------------------------------ - ------------------------------------------------------------------------------ --- Declare module and import dependencies ------------------------------------------------------------------------------ -local base = _G -local string = require("string") -local math = require("math") -local socket = require("socket.core") - -local _M = socket - ------------------------------------------------------------------------------ --- Exported auxiliar functions ------------------------------------------------------------------------------ -function _M.connect4(address, port, laddress, lport) - return socket.connect(address, port, laddress, lport, "inet") -end - -function _M.connect6(address, port, laddress, lport) - return socket.connect(address, port, laddress, lport, "inet6") -end - -function _M.bind(host, port, backlog) - if host == "*" then host = "0.0.0.0" end - local addrinfo, err = socket.dns.getaddrinfo(host); - if not addrinfo then return nil, err end - local sock, res - err = "no info on address" - for i, alt in base.ipairs(addrinfo) do - if alt.family == "inet" then - sock, err = socket.tcp4() - else - sock, err = socket.tcp6() - end - if not sock then return nil, err end - sock:setoption("reuseaddr", true) - res, err = sock:bind(alt.addr, port) - if not res then - sock:close() - else - res, err = sock:listen(backlog) - if not res then - sock:close() - else - return sock - end - end - end - return nil, err -end - -_M.try = _M.newtry() - -function _M.choose(table) - return function(name, opt1, opt2) - if base.type(name) ~= "string" then - name, opt1, opt2 = "default", name, opt1 - end - local f = table[name or "nil"] - if not f then base.error("unknown key (".. base.tostring(name) ..")", 3) - else return f(opt1, opt2) end - end -end - ------------------------------------------------------------------------------ --- Socket sources and sinks, conforming to LTN12 ------------------------------------------------------------------------------ --- create namespaces inside LuaSocket namespace -local sourcet, sinkt = {}, {} -_M.sourcet = sourcet -_M.sinkt = sinkt - -_M.BLOCKSIZE = 2048 - -sinkt["close-when-done"] = function(sock) - return base.setmetatable({ - getfd = function() return sock:getfd() end, - dirty = function() return sock:dirty() end - }, { - __call = function(self, chunk, err) - if not chunk then - sock:close() - return 1 - else return sock:send(chunk) end - end - }) -end - -sinkt["keep-open"] = function(sock) - return base.setmetatable({ - getfd = function() return sock:getfd() end, - dirty = function() return sock:dirty() end - }, { - __call = function(self, chunk, err) - if chunk then return sock:send(chunk) - else return 1 end - end - }) -end - -sinkt["default"] = sinkt["keep-open"] - -_M.sink = _M.choose(sinkt) - -sourcet["by-length"] = function(sock, length) - return base.setmetatable({ - getfd = function() return sock:getfd() end, - dirty = function() return sock:dirty() end - }, { - __call = function() - if length <= 0 then return nil end - local size = math.min(socket.BLOCKSIZE, length) - local chunk, err = sock:receive(size) - if err then return nil, err end - length = length - string.len(chunk) - return chunk - end - }) -end - -sourcet["until-closed"] = function(sock) - local done - return base.setmetatable({ - getfd = function() return sock:getfd() end, - dirty = function() return sock:dirty() end - }, { - __call = function() - if done then return nil end - local chunk, err, partial = sock:receive(socket.BLOCKSIZE) - if not err then return chunk - elseif err == "closed" then - sock:close() - done = 1 - return partial - else return nil, err end - end - }) -end - - -sourcet["default"] = sourcet["until-closed"] - -_M.source = _M.choose(sourcet) - -return _M diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/socket.lua.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/socket.lua.h deleted file mode 100644 index f99e58ec..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/socket.lua.h +++ /dev/null @@ -1,234 +0,0 @@ -/* code automatically generated by bin2c -- DO NOT EDIT */ -{ -/* #include'ing this file in a C program is equivalent to calling - if (luaL_loadfile(L,"socket.lua")==0) lua_call(L, 0, LUA_MULTRET); -*/ -/* socket.lua */ -static const unsigned char B1[]={ - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, - 32, 76,117, 97, 83,111, 99,107,101,116, 32,104,101,108,112,101,114, 32,109,111, -100,117,108,101, 10, 45, 45, 32, 65,117,116,104,111,114, 58, 32, 68,105,101,103, -111, 32, 78,101,104, 97, 98, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 10, 45, 45, 32, 68,101, 99,108, 97,114,101, 32,109,111,100,117, -108,101, 32, 97,110,100, 32,105,109,112,111,114,116, 32,100,101,112,101,110,100, -101,110, 99,105,101,115, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 10,108,111, 99, 97,108, 32, 98, 97,115,101, 32, 61, 32, 95, 71, - 10,108,111, 99, 97,108, 32,115,116,114,105,110,103, 32, 61, 32,114,101,113,117, -105,114,101, 40, 34,115,116,114,105,110,103, 34, 41, 10,108,111, 99, 97,108, 32, -109, 97,116,104, 32, 61, 32,114,101,113,117,105,114,101, 40, 34,109, 97,116,104, - 34, 41, 10,108,111, 99, 97,108, 32,115,111, 99,107,101,116, 32, 61, 32,114,101, -113,117,105,114,101, 40, 34,115,111, 99,107,101,116, 46, 99,111,114,101, 34, 41, - 10, 10,108,111, 99, 97,108, 32, 95, 77, 32, 61, 32,115,111, 99,107,101,116, 10, - 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, - 45, 32, 69,120,112,111,114,116,101,100, 32, 97,117,120,105,108,105, 97,114, 32, -102,117,110, 99,116,105,111,110,115, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 10,102,117,110, 99,116,105,111,110, 32, 95, 77, 46, - 99,111,110,110,101, 99,116, 52, 40, 97,100,100,114,101,115,115, 44, 32,112,111, -114,116, 44, 32,108, 97,100,100,114,101,115,115, 44, 32,108,112,111,114,116, 41, - 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,115,111, 99,107,101,116, 46, 99, -111,110,110,101, 99,116, 40, 97,100,100,114,101,115,115, 44, 32,112,111,114,116, - 44, 32,108, 97,100,100,114,101,115,115, 44, 32,108,112,111,114,116, 44, 32, 34, -105,110,101,116, 34, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, - 32, 95, 77, 46, 99,111,110,110,101, 99,116, 54, 40, 97,100,100,114,101,115,115, - 44, 32,112,111,114,116, 44, 32,108, 97,100,100,114,101,115,115, 44, 32,108,112, -111,114,116, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,115,111, 99,107, -101,116, 46, 99,111,110,110,101, 99,116, 40, 97,100,100,114,101,115,115, 44, 32, -112,111,114,116, 44, 32,108, 97,100,100,114,101,115,115, 44, 32,108,112,111,114, -116, 44, 32, 34,105,110,101,116, 54, 34, 41, 10,101,110,100, 10, 10,102,117,110, - 99,116,105,111,110, 32, 95, 77, 46, 98,105,110,100, 40,104,111,115,116, 44, 32, -112,111,114,116, 44, 32, 98, 97, 99,107,108,111,103, 41, 10, 32, 32, 32, 32,105, -102, 32,104,111,115,116, 32, 61, 61, 32, 34, 42, 34, 32,116,104,101,110, 32,104, -111,115,116, 32, 61, 32, 34, 48, 46, 48, 46, 48, 46, 48, 34, 32,101,110,100, 10, - 32, 32, 32, 32,108,111, 99, 97,108, 32, 97,100,100,114,105,110,102,111, 44, 32, -101,114,114, 32, 61, 32,115,111, 99,107,101,116, 46,100,110,115, 46,103,101,116, - 97,100,100,114,105,110,102,111, 40,104,111,115,116, 41, 59, 10, 32, 32, 32, 32, -105,102, 32,110,111,116, 32, 97,100,100,114,105,110,102,111, 32,116,104,101,110, - 32,114,101,116,117,114,110, 32,110,105,108, 44, 32,101,114,114, 32,101,110,100, - 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,115,111, 99,107, 44, 32,114,101,115, - 10, 32, 32, 32, 32,101,114,114, 32, 61, 32, 34,110,111, 32,105,110,102,111, 32, -111,110, 32, 97,100,100,114,101,115,115, 34, 10, 32, 32, 32, 32,102,111,114, 32, -105, 44, 32, 97,108,116, 32,105,110, 32, 98, 97,115,101, 46,105,112, 97,105,114, -115, 40, 97,100,100,114,105,110,102,111, 41, 32,100,111, 10, 32, 32, 32, 32, 32, - 32, 32, 32,105,102, 32, 97,108,116, 46,102, 97,109,105,108,121, 32, 61, 61, 32, - 34,105,110,101,116, 34, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32,115,111, 99,107, 44, 32,101,114,114, 32, 61, 32,115,111, 99,107, -101,116, 46,116, 99,112, 52, 40, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,101,108, -115,101, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,115,111, 99,107, 44, - 32,101,114,114, 32, 61, 32,115,111, 99,107,101,116, 46,116, 99,112, 54, 40, 41, - 10, 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, - 32,105,102, 32,110,111,116, 32,115,111, 99,107, 32,116,104,101,110, 32,114,101, -116,117,114,110, 32,110,105,108, 44, 32,101,114,114, 32,101,110,100, 10, 32, 32, - 32, 32, 32, 32, 32, 32,115,111, 99,107, 58,115,101,116,111,112,116,105,111,110, - 40, 34,114,101,117,115,101, 97,100,100,114, 34, 44, 32,116,114,117,101, 41, 10, - 32, 32, 32, 32, 32, 32, 32, 32,114,101,115, 44, 32,101,114,114, 32, 61, 32,115, -111, 99,107, 58, 98,105,110,100, 40, 97,108,116, 46, 97,100,100,114, 44, 32,112, -111,114,116, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,110,111,116, 32, -114,101,115, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32,115,111, 99,107, 58, 99,108,111,115,101, 40, 41, 10, 32, 32, 32, 32, 32, 32, - 32, 32,101,108,115,101, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114, -101,115, 44, 32,101,114,114, 32, 61, 32,115,111, 99,107, 58,108,105,115,116,101, -110, 40, 98, 97, 99,107,108,111,103, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32,105,102, 32,110,111,116, 32,114,101,115, 32,116,104,101,110, 10, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,115,111, 99,107, 58, - 99,108,111,115,101, 40, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, -101,108,115,101, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32,114,101,116,117,114,110, 32,115,111, 99,107, 10, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, - 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32, -110,105,108, 44, 32,101,114,114, 10,101,110,100, 10, 10, 95, 77, 46,116,114,121, - 32, 61, 32, 95, 77, 46,110,101,119,116,114,121, 40, 41, 10, 10,102,117,110, 99, -116,105,111,110, 32, 95, 77, 46, 99,104,111,111,115,101, 40,116, 97, 98,108,101, - 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,102,117,110, 99,116,105,111, -110, 40,110, 97,109,101, 44, 32,111,112,116, 49, 44, 32,111,112,116, 50, 41, 10, - 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32, 98, 97,115,101, 46,116,121,112,101, - 40,110, 97,109,101, 41, 32,126, 61, 32, 34,115,116,114,105,110,103, 34, 32,116, -104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,110, 97,109,101, - 44, 32,111,112,116, 49, 44, 32,111,112,116, 50, 32, 61, 32, 34,100,101,102, 97, -117,108,116, 34, 44, 32,110, 97,109,101, 44, 32,111,112,116, 49, 10, 32, 32, 32, - 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32,108,111, 99, - 97,108, 32,102, 32, 61, 32,116, 97, 98,108,101, 91,110, 97,109,101, 32,111,114, - 32, 34,110,105,108, 34, 93, 10, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,110, -111,116, 32,102, 32,116,104,101,110, 32, 98, 97,115,101, 46,101,114,114,111,114, - 40, 34,117,110,107,110,111,119,110, 32,107,101,121, 32, 40, 34, 46, 46, 32, 98, - 97,115,101, 46,116,111,115,116,114,105,110,103, 40,110, 97,109,101, 41, 32, 46, - 46, 34, 41, 34, 44, 32, 51, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,101,108,115, -101, 32,114,101,116,117,114,110, 32,102, 40,111,112,116, 49, 44, 32,111,112,116, - 50, 41, 32,101,110,100, 10, 32, 32, 32, 32,101,110,100, 10,101,110,100, 10, 10, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, - 32, 83,111, 99,107,101,116, 32,115,111,117,114, 99,101,115, 32, 97,110,100, 32, -115,105,110,107,115, 44, 32, 99,111,110,102,111,114,109,105,110,103, 32,116,111, - 32, 76, 84, 78, 49, 50, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 10, 45, 45, 32, 99,114,101, 97,116,101, 32,110, 97,109,101,115, -112, 97, 99,101,115, 32,105,110,115,105,100,101, 32, 76,117, 97, 83,111, 99,107, -101,116, 32,110, 97,109,101,115,112, 97, 99,101, 10,108,111, 99, 97,108, 32,115, -111,117,114, 99,101,116, 44, 32,115,105,110,107,116, 32, 61, 32,123,125, 44, 32, -123,125, 10, 95, 77, 46,115,111,117,114, 99,101,116, 32, 61, 32,115,111,117,114, - 99,101,116, 10, 95, 77, 46,115,105,110,107,116, 32, 61, 32,115,105,110,107,116, - 10, 10, 95, 77, 46, 66, 76, 79, 67, 75, 83, 73, 90, 69, 32, 61, 32, 50, 48, 52, - 56, 10, 10,115,105,110,107,116, 91, 34, 99,108,111,115,101, 45,119,104,101,110, - 45,100,111,110,101, 34, 93, 32, 61, 32,102,117,110, 99,116,105,111,110, 40,115, -111, 99,107, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32, 98, 97,115,101, - 46,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,123, 10, 32, 32, 32, 32, - 32, 32, 32, 32,103,101,116,102,100, 32, 61, 32,102,117,110, 99,116,105,111,110, - 40, 41, 32,114,101,116,117,114,110, 32,115,111, 99,107, 58,103,101,116,102,100, - 40, 41, 32,101,110,100, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32,100,105,114,116, -121, 32, 61, 32,102,117,110, 99,116,105,111,110, 40, 41, 32,114,101,116,117,114, -110, 32,115,111, 99,107, 58,100,105,114,116,121, 40, 41, 32,101,110,100, 10, 32, - 32, 32, 32,125, 44, 32,123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 95, 95, 99, 97, -108,108, 32, 61, 32,102,117,110, 99,116,105,111,110, 40,115,101,108,102, 44, 32, - 99,104,117,110,107, 44, 32,101,114,114, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32,105,102, 32,110,111,116, 32, 99,104,117,110,107, 32,116,104,101, -110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,115,111, - 99,107, 58, 99,108,111,115,101, 40, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114,110, 32, 49, 10, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32,101,108,115,101, 32,114,101,116,117,114,110, 32, -115,111, 99,107, 58,115,101,110,100, 40, 99,104,117,110,107, 41, 32,101,110,100, - 10, 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,125, 41, 10, -101,110,100, 10, 10,115,105,110,107,116, 91, 34,107,101,101,112, 45,111,112,101, -110, 34, 93, 32, 61, 32,102,117,110, 99,116,105,111,110, 40,115,111, 99,107, 41, - 10, 32, 32, 32, 32,114,101,116,117,114,110, 32, 98, 97,115,101, 46,115,101,116, -109,101,116, 97,116, 97, 98,108,101, 40,123, 10, 32, 32, 32, 32, 32, 32, 32, 32, -103,101,116,102,100, 32, 61, 32,102,117,110, 99,116,105,111,110, 40, 41, 32,114, -101,116,117,114,110, 32,115,111, 99,107, 58,103,101,116,102,100, 40, 41, 32,101, -110,100, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32,100,105,114,116,121, 32, 61, 32, -102,117,110, 99,116,105,111,110, 40, 41, 32,114,101,116,117,114,110, 32,115,111, - 99,107, 58,100,105,114,116,121, 40, 41, 32,101,110,100, 10, 32, 32, 32, 32,125, - 44, 32,123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 95, 95, 99, 97,108,108, 32, 61, - 32,102,117,110, 99,116,105,111,110, 40,115,101,108,102, 44, 32, 99,104,117,110, -107, 44, 32,101,114,114, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, -105,102, 32, 99,104,117,110,107, 32,116,104,101,110, 32,114,101,116,117,114,110, - 32,115,111, 99,107, 58,115,101,110,100, 40, 99,104,117,110,107, 41, 10, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,108,115,101, 32,114,101,116,117,114, -110, 32, 49, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, - 32, 32, 32, 32,125, 41, 10,101,110,100, 10, 10,115,105,110,107,116, 91, 34,100, -101,102, 97,117,108,116, 34, 93, 32, 61, 32,115,105,110,107,116, 91, 34,107,101, -101,112, 45,111,112,101,110, 34, 93, 10, 10, 95, 77, 46,115,105,110,107, 32, 61, - 32, 95, 77, 46, 99,104,111,111,115,101, 40,115,105,110,107,116, 41, 10, 10,115, -111,117,114, 99,101,116, 91, 34, 98,121, 45,108,101,110,103,116,104, 34, 93, 32, - 61, 32,102,117,110, 99,116,105,111,110, 40,115,111, 99,107, 44, 32,108,101,110, -103,116,104, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32, 98, 97,115,101, - 46,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,123, 10, 32, 32, 32, 32, - 32, 32, 32, 32,103,101,116,102,100, 32, 61, 32,102,117,110, 99,116,105,111,110, - 40, 41, 32,114,101,116,117,114,110, 32,115,111, 99,107, 58,103,101,116,102,100, - 40, 41, 32,101,110,100, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32,100,105,114,116, -121, 32, 61, 32,102,117,110, 99,116,105,111,110, 40, 41, 32,114,101,116,117,114, -110, 32,115,111, 99,107, 58,100,105,114,116,121, 40, 41, 32,101,110,100, 10, 32, - 32, 32, 32,125, 44, 32,123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 95, 95, 99, 97, -108,108, 32, 61, 32,102,117,110, 99,116,105,111,110, 40, 41, 10, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,108,101,110,103,116,104, 32, 60, 61, - 32, 48, 32,116,104,101,110, 32,114,101,116,117,114,110, 32,110,105,108, 32,101, -110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,108,111, 99, 97,108, - 32,115,105,122,101, 32, 61, 32,109, 97,116,104, 46,109,105,110, 40,115,111, 99, -107,101,116, 46, 66, 76, 79, 67, 75, 83, 73, 90, 69, 44, 32,108,101,110,103,116, -104, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,108,111, 99, 97,108, - 32, 99,104,117,110,107, 44, 32,101,114,114, 32, 61, 32,115,111, 99,107, 58,114, -101, 99,101,105,118,101, 40,115,105,122,101, 41, 10, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32,105,102, 32,101,114,114, 32,116,104,101,110, 32,114,101,116, -117,114,110, 32,110,105,108, 44, 32,101,114,114, 32,101,110,100, 10, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32,108,101,110,103,116,104, 32, 61, 32,108,101, -110,103,116,104, 32, 45, 32,115,116,114,105,110,103, 46,108,101,110, 40, 99,104, -117,110,107, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116, -117,114,110, 32, 99,104,117,110,107, 10, 32, 32, 32, 32, 32, 32, 32, 32,101,110, -100, 10, 32, 32, 32, 32,125, 41, 10,101,110,100, 10, 10,115,111,117,114, 99,101, -116, 91, 34,117,110,116,105,108, 45, 99,108,111,115,101,100, 34, 93, 32, 61, 32, -102,117,110, 99,116,105,111,110, 40,115,111, 99,107, 41, 10, 32, 32, 32, 32,108, -111, 99, 97,108, 32,100,111,110,101, 10, 32, 32, 32, 32,114,101,116,117,114,110, - 32, 98, 97,115,101, 46,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,123, - 10, 32, 32, 32, 32, 32, 32, 32, 32,103,101,116,102,100, 32, 61, 32,102,117,110, - 99,116,105,111,110, 40, 41, 32,114,101,116,117,114,110, 32,115,111, 99,107, 58, -103,101,116,102,100, 40, 41, 32,101,110,100, 44, 10, 32, 32, 32, 32, 32, 32, 32, - 32,100,105,114,116,121, 32, 61, 32,102,117,110, 99,116,105,111,110, 40, 41, 32, -114,101,116,117,114,110, 32,115,111, 99,107, 58,100,105,114,116,121, 40, 41, 32, -101,110,100, 10, 32, 32, 32, 32,125, 44, 32,123, 10, 32, 32, 32, 32, 32, 32, 32, - 32, 95, 95, 99, 97,108,108, 32, 61, 32,102,117,110, 99,116,105,111,110, 40, 41, - 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,100,111,110,101, - 32,116,104,101,110, 32,114,101,116,117,114,110, 32,110,105,108, 32,101,110,100, - 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,108,111, 99, 97,108, 32, 99, -104,117,110,107, 44, 32,101,114,114, 44, 32,112, 97,114,116,105, 97,108, 32, 61, - 32,115,111, 99,107, 58,114,101, 99,101,105,118,101, 40,115,111, 99,107,101,116, - 46, 66, 76, 79, 67, 75, 83, 73, 90, 69, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32,105,102, 32,110,111,116, 32,101,114,114, 32,116,104,101,110, 32, -114,101,116,117,114,110, 32, 99,104,117,110,107, 10, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32,101,108,115,101,105,102, 32,101,114,114, 32, 61, 61, 32, 34, - 99,108,111,115,101,100, 34, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32,115,111, 99,107, 58, 99,108,111,115,101, 40, - 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,100,111, -110,101, 32, 61, 32, 49, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32,114,101,116,117,114,110, 32,112, 97,114,116,105, 97,108, 10, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,108,115,101, 32,114,101,116,117,114, -110, 32,110,105,108, 44, 32,101,114,114, 32,101,110,100, 10, 32, 32, 32, 32, 32, - 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,125, 41, 10,101,110,100, 10, 10, 10, -115,111,117,114, 99,101,116, 91, 34,100,101,102, 97,117,108,116, 34, 93, 32, 61, - 32,115,111,117,114, 99,101,116, 91, 34,117,110,116,105,108, 45, 99,108,111,115, -101,100, 34, 93, 10, 10, 95, 77, 46,115,111,117,114, 99,101, 32, 61, 32, 95, 77, - 46, 99,104,111,111,115,101, 40,115,111,117,114, 99,101,116, 41, 10, 10,114,101, -116,117,114,110, 32, 95, 77, 10, -}; - - if (luaL_loadbuffer(L,(const char*)B1,sizeof(B1),"socket.lua")==0) lua_call(L, 0, LUA_MULTRET); -} diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/tcp.c b/love/src/jni/love/src/libraries/luasocket/libluasocket/tcp.c deleted file mode 100644 index ef9ee6f9..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/tcp.c +++ /dev/null @@ -1,451 +0,0 @@ -/*=========================================================================*\ -* TCP object -* LuaSocket toolkit -\*=========================================================================*/ -#include - -#include "lua.h" -#include "lauxlib.h" -#include "compat.h" - -#include "auxiliar.h" -#include "socket.h" -#include "inet.h" -#include "options.h" -#include "tcp.h" - -/*=========================================================================*\ -* Internal function prototypes -\*=========================================================================*/ -static int global_create(lua_State *L); -static int global_create4(lua_State *L); -static int global_create6(lua_State *L); -static int global_connect(lua_State *L); -static int meth_connect(lua_State *L); -static int meth_listen(lua_State *L); -static int meth_getfamily(lua_State *L); -static int meth_bind(lua_State *L); -static int meth_send(lua_State *L); -static int meth_getstats(lua_State *L); -static int meth_setstats(lua_State *L); -static int meth_getsockname(lua_State *L); -static int meth_getpeername(lua_State *L); -static int meth_shutdown(lua_State *L); -static int meth_receive(lua_State *L); -static int meth_accept(lua_State *L); -static int meth_close(lua_State *L); -static int meth_getoption(lua_State *L); -static int meth_setoption(lua_State *L); -static int meth_gettimeout(lua_State *L); -static int meth_settimeout(lua_State *L); -static int meth_getfd(lua_State *L); -static int meth_setfd(lua_State *L); -static int meth_dirty(lua_State *L); - -/* tcp object methods */ -static luaL_Reg tcp_methods[] = { - {"__gc", meth_close}, - {"__tostring", auxiliar_tostring}, - {"accept", meth_accept}, - {"bind", meth_bind}, - {"close", meth_close}, - {"connect", meth_connect}, - {"dirty", meth_dirty}, - {"getfamily", meth_getfamily}, - {"getfd", meth_getfd}, - {"getoption", meth_getoption}, - {"getpeername", meth_getpeername}, - {"getsockname", meth_getsockname}, - {"getstats", meth_getstats}, - {"setstats", meth_setstats}, - {"listen", meth_listen}, - {"receive", meth_receive}, - {"send", meth_send}, - {"setfd", meth_setfd}, - {"setoption", meth_setoption}, - {"setpeername", meth_connect}, - {"setsockname", meth_bind}, - {"settimeout", meth_settimeout}, - {"gettimeout", meth_gettimeout}, - {"shutdown", meth_shutdown}, - {NULL, NULL} -}; - -/* socket option handlers */ -static t_opt optget[] = { - {"keepalive", opt_get_keepalive}, - {"reuseaddr", opt_get_reuseaddr}, - {"reuseport", opt_get_reuseport}, - {"tcp-nodelay", opt_get_tcp_nodelay}, - {"linger", opt_get_linger}, - {"error", opt_get_error}, - {NULL, NULL} -}; - -static t_opt optset[] = { - {"keepalive", opt_set_keepalive}, - {"reuseaddr", opt_set_reuseaddr}, - {"reuseport", opt_set_reuseport}, - {"tcp-nodelay", opt_set_tcp_nodelay}, - {"ipv6-v6only", opt_set_ip6_v6only}, - {"linger", opt_set_linger}, - {NULL, NULL} -}; - -/* functions in library namespace */ -static luaL_Reg func[] = { - {"tcp", global_create}, - {"tcp4", global_create4}, - {"tcp6", global_create6}, - {"connect", global_connect}, - {NULL, NULL} -}; - -/*-------------------------------------------------------------------------*\ -* Initializes module -\*-------------------------------------------------------------------------*/ -int tcp_open(lua_State *L) -{ - /* create classes */ - auxiliar_newclass(L, "tcp{master}", tcp_methods); - auxiliar_newclass(L, "tcp{client}", tcp_methods); - auxiliar_newclass(L, "tcp{server}", tcp_methods); - /* create class groups */ - auxiliar_add2group(L, "tcp{master}", "tcp{any}"); - auxiliar_add2group(L, "tcp{client}", "tcp{any}"); - auxiliar_add2group(L, "tcp{server}", "tcp{any}"); - /* define library functions */ - luaL_setfuncs(L, func, 0); - return 0; -} - -/*=========================================================================*\ -* Lua methods -\*=========================================================================*/ -/*-------------------------------------------------------------------------*\ -* Just call buffered IO methods -\*-------------------------------------------------------------------------*/ -static int meth_send(lua_State *L) { - p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{client}", 1); - return buffer_meth_send(L, &tcp->buf); -} - -static int meth_receive(lua_State *L) { - p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{client}", 1); - return buffer_meth_receive(L, &tcp->buf); -} - -static int meth_getstats(lua_State *L) { - p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{client}", 1); - return buffer_meth_getstats(L, &tcp->buf); -} - -static int meth_setstats(lua_State *L) { - p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{client}", 1); - return buffer_meth_setstats(L, &tcp->buf); -} - -/*-------------------------------------------------------------------------*\ -* Just call option handler -\*-------------------------------------------------------------------------*/ -static int meth_getoption(lua_State *L) -{ - p_tcp tcp = (p_tcp) auxiliar_checkgroup(L, "tcp{any}", 1); - return opt_meth_getoption(L, optget, &tcp->sock); -} - -static int meth_setoption(lua_State *L) -{ - p_tcp tcp = (p_tcp) auxiliar_checkgroup(L, "tcp{any}", 1); - return opt_meth_setoption(L, optset, &tcp->sock); -} - -/*-------------------------------------------------------------------------*\ -* Select support methods -\*-------------------------------------------------------------------------*/ -static int meth_getfd(lua_State *L) -{ - p_tcp tcp = (p_tcp) auxiliar_checkgroup(L, "tcp{any}", 1); - lua_pushnumber(L, (int) tcp->sock); - return 1; -} - -/* this is very dangerous, but can be handy for those that are brave enough */ -static int meth_setfd(lua_State *L) -{ - p_tcp tcp = (p_tcp) auxiliar_checkgroup(L, "tcp{any}", 1); - tcp->sock = (t_socket) luaL_checknumber(L, 2); - return 0; -} - -static int meth_dirty(lua_State *L) -{ - p_tcp tcp = (p_tcp) auxiliar_checkgroup(L, "tcp{any}", 1); - lua_pushboolean(L, !buffer_isempty(&tcp->buf)); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Waits for and returns a client object attempting connection to the -* server object -\*-------------------------------------------------------------------------*/ -static int meth_accept(lua_State *L) -{ - p_tcp server = (p_tcp) auxiliar_checkclass(L, "tcp{server}", 1); - p_timeout tm = timeout_markstart(&server->tm); - t_socket sock; - const char *err = inet_tryaccept(&server->sock, server->family, &sock, tm); - /* if successful, push client socket */ - if (err == NULL) { - p_tcp clnt = (p_tcp) lua_newuserdata(L, sizeof(t_tcp)); - auxiliar_setclass(L, "tcp{client}", -1); - /* initialize structure fields */ - memset(clnt, 0, sizeof(t_tcp)); - socket_setnonblocking(&sock); - clnt->sock = sock; - io_init(&clnt->io, (p_send) socket_send, (p_recv) socket_recv, - (p_error) socket_ioerror, &clnt->sock); - timeout_init(&clnt->tm, -1, -1); - buffer_init(&clnt->buf, &clnt->io, &clnt->tm); - clnt->family = server->family; - return 1; - } else { - lua_pushnil(L); - lua_pushstring(L, err); - return 2; - } -} - -/*-------------------------------------------------------------------------*\ -* Binds an object to an address -\*-------------------------------------------------------------------------*/ -static int meth_bind(lua_State *L) { - p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{master}", 1); - const char *address = luaL_checkstring(L, 2); - const char *port = luaL_checkstring(L, 3); - const char *err; - struct addrinfo bindhints; - memset(&bindhints, 0, sizeof(bindhints)); - bindhints.ai_socktype = SOCK_STREAM; - bindhints.ai_family = tcp->family; - bindhints.ai_flags = AI_PASSIVE; - err = inet_trybind(&tcp->sock, &tcp->family, address, port, &bindhints); - if (err) { - lua_pushnil(L); - lua_pushstring(L, err); - return 2; - } - lua_pushnumber(L, 1); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Turns a master tcp object into a client object. -\*-------------------------------------------------------------------------*/ -static int meth_connect(lua_State *L) { - p_tcp tcp = (p_tcp) auxiliar_checkgroup(L, "tcp{any}", 1); - const char *address = luaL_checkstring(L, 2); - const char *port = luaL_checkstring(L, 3); - struct addrinfo connecthints; - const char *err; - memset(&connecthints, 0, sizeof(connecthints)); - connecthints.ai_socktype = SOCK_STREAM; - /* make sure we try to connect only to the same family */ - connecthints.ai_family = tcp->family; - timeout_markstart(&tcp->tm); - err = inet_tryconnect(&tcp->sock, &tcp->family, address, port, - &tcp->tm, &connecthints); - /* have to set the class even if it failed due to non-blocking connects */ - auxiliar_setclass(L, "tcp{client}", 1); - if (err) { - lua_pushnil(L); - lua_pushstring(L, err); - return 2; - } - lua_pushnumber(L, 1); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Closes socket used by object -\*-------------------------------------------------------------------------*/ -static int meth_close(lua_State *L) -{ - p_tcp tcp = (p_tcp) auxiliar_checkgroup(L, "tcp{any}", 1); - socket_destroy(&tcp->sock); - lua_pushnumber(L, 1); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Returns family as string -\*-------------------------------------------------------------------------*/ -static int meth_getfamily(lua_State *L) -{ - p_tcp tcp = (p_tcp) auxiliar_checkgroup(L, "tcp{any}", 1); - if (tcp->family == AF_INET6) { - lua_pushliteral(L, "inet6"); - return 1; - } else if (tcp->family == AF_INET) { - lua_pushliteral(L, "inet4"); - return 1; - } else { - lua_pushliteral(L, "inet4"); - return 1; - } -} - -/*-------------------------------------------------------------------------*\ -* Puts the sockt in listen mode -\*-------------------------------------------------------------------------*/ -static int meth_listen(lua_State *L) -{ - p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{master}", 1); - int backlog = (int) luaL_optnumber(L, 2, 32); - int err = socket_listen(&tcp->sock, backlog); - if (err != IO_DONE) { - lua_pushnil(L); - lua_pushstring(L, socket_strerror(err)); - return 2; - } - /* turn master object into a server object */ - auxiliar_setclass(L, "tcp{server}", 1); - lua_pushnumber(L, 1); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Shuts the connection down partially -\*-------------------------------------------------------------------------*/ -static int meth_shutdown(lua_State *L) -{ - /* SHUT_RD, SHUT_WR, SHUT_RDWR have the value 0, 1, 2, so we can use method index directly */ - static const char* methods[] = { "receive", "send", "both", NULL }; - p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{client}", 1); - int how = luaL_checkoption(L, 2, "both", methods); - socket_shutdown(&tcp->sock, how); - lua_pushnumber(L, 1); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Just call inet methods -\*-------------------------------------------------------------------------*/ -static int meth_getpeername(lua_State *L) -{ - p_tcp tcp = (p_tcp) auxiliar_checkgroup(L, "tcp{any}", 1); - return inet_meth_getpeername(L, &tcp->sock, tcp->family); -} - -static int meth_getsockname(lua_State *L) -{ - p_tcp tcp = (p_tcp) auxiliar_checkgroup(L, "tcp{any}", 1); - return inet_meth_getsockname(L, &tcp->sock, tcp->family); -} - -/*-------------------------------------------------------------------------*\ -* Just call tm methods -\*-------------------------------------------------------------------------*/ -static int meth_settimeout(lua_State *L) -{ - p_tcp tcp = (p_tcp) auxiliar_checkgroup(L, "tcp{any}", 1); - return timeout_meth_settimeout(L, &tcp->tm); -} - -static int meth_gettimeout(lua_State *L) -{ - p_tcp tcp = (p_tcp) auxiliar_checkgroup(L, "tcp{any}", 1); - return timeout_meth_gettimeout(L, &tcp->tm); -} - -/*=========================================================================*\ -* Library functions -\*=========================================================================*/ -/*-------------------------------------------------------------------------*\ -* Creates a master tcp object -\*-------------------------------------------------------------------------*/ -static int tcp_create(lua_State *L, int family) { - p_tcp tcp = (p_tcp) lua_newuserdata(L, sizeof(t_tcp)); - memset(tcp, 0, sizeof(t_tcp)); - /* set its type as master object */ - auxiliar_setclass(L, "tcp{master}", -1); - /* if family is AF_UNSPEC, we leave the socket invalid and - * store AF_UNSPEC into family. This will allow it to later be - * replaced with an AF_INET6 or AF_INET socket upon first use. */ - tcp->sock = SOCKET_INVALID; - tcp->family = family; - io_init(&tcp->io, (p_send) socket_send, (p_recv) socket_recv, - (p_error) socket_ioerror, &tcp->sock); - timeout_init(&tcp->tm, -1, -1); - buffer_init(&tcp->buf, &tcp->io, &tcp->tm); - if (family != AF_UNSPEC) { - const char *err = inet_trycreate(&tcp->sock, family, SOCK_STREAM, 0); - if (err != NULL) { - lua_pushnil(L); - lua_pushstring(L, err); - return 2; - } - socket_setnonblocking(&tcp->sock); - } - return 1; -} - -static int global_create(lua_State *L) { - return tcp_create(L, AF_UNSPEC); -} - -static int global_create4(lua_State *L) { - return tcp_create(L, AF_INET); -} - -static int global_create6(lua_State *L) { - return tcp_create(L, AF_INET6); -} - -static int global_connect(lua_State *L) { - const char *remoteaddr = luaL_checkstring(L, 1); - const char *remoteserv = luaL_checkstring(L, 2); - const char *localaddr = luaL_optstring(L, 3, NULL); - const char *localserv = luaL_optstring(L, 4, "0"); - int family = inet_optfamily(L, 5, "unspec"); - p_tcp tcp = (p_tcp) lua_newuserdata(L, sizeof(t_tcp)); - struct addrinfo bindhints, connecthints; - const char *err = NULL; - /* initialize tcp structure */ - memset(tcp, 0, sizeof(t_tcp)); - io_init(&tcp->io, (p_send) socket_send, (p_recv) socket_recv, - (p_error) socket_ioerror, &tcp->sock); - timeout_init(&tcp->tm, -1, -1); - buffer_init(&tcp->buf, &tcp->io, &tcp->tm); - tcp->sock = SOCKET_INVALID; - tcp->family = AF_UNSPEC; - /* allow user to pick local address and port */ - memset(&bindhints, 0, sizeof(bindhints)); - bindhints.ai_socktype = SOCK_STREAM; - bindhints.ai_family = family; - bindhints.ai_flags = AI_PASSIVE; - if (localaddr) { - err = inet_trybind(&tcp->sock, &tcp->family, localaddr, - localserv, &bindhints); - if (err) { - lua_pushnil(L); - lua_pushstring(L, err); - return 2; - } - } - /* try to connect to remote address and port */ - memset(&connecthints, 0, sizeof(connecthints)); - connecthints.ai_socktype = SOCK_STREAM; - /* make sure we try to connect only to the same family */ - connecthints.ai_family = tcp->family; - err = inet_tryconnect(&tcp->sock, &tcp->family, remoteaddr, remoteserv, - &tcp->tm, &connecthints); - if (err) { - socket_destroy(&tcp->sock); - lua_pushnil(L); - lua_pushstring(L, err); - return 2; - } - auxiliar_setclass(L, "tcp{client}", -1); - return 1; -} diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/tcp.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/tcp.h deleted file mode 100644 index eded6203..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/tcp.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef TCP_H -#define TCP_H -/*=========================================================================*\ -* TCP object -* LuaSocket toolkit -* -* The tcp.h module is basicly a glue that puts together modules buffer.h, -* timeout.h socket.h and inet.h to provide the LuaSocket TCP (AF_INET, -* SOCK_STREAM) support. -* -* Three classes are defined: master, client and server. The master class is -* a newly created tcp object, that has not been bound or connected. Server -* objects are tcp objects bound to some local address. Client objects are -* tcp objects either connected to some address or returned by the accept -* method of a server object. -\*=========================================================================*/ -#include "lua.h" - -#include "buffer.h" -#include "timeout.h" -#include "socket.h" - -typedef struct t_tcp_ { - t_socket sock; - t_io io; - t_buffer buf; - t_timeout tm; - int family; -} t_tcp; - -typedef t_tcp *p_tcp; - -int tcp_open(lua_State *L); - -#endif /* TCP_H */ diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/timeout.c b/love/src/jni/love/src/libraries/luasocket/libluasocket/timeout.c deleted file mode 100644 index 5a601d54..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/timeout.c +++ /dev/null @@ -1,228 +0,0 @@ -/*=========================================================================*\ -* Timeout management functions -* LuaSocket toolkit -\*=========================================================================*/ -#include -#include -#include - -#include "lua.h" -#include "lauxlib.h" -#include "compat.h" - -#include "auxiliar.h" -#include "timeout.h" - -#ifdef _WIN32 -#include -#else -#include -#include -#endif - -/* min and max macros */ -#ifndef MIN -#define MIN(x, y) ((x) < (y) ? x : y) -#endif -#ifndef MAX -#define MAX(x, y) ((x) > (y) ? x : y) -#endif - -/*=========================================================================*\ -* Internal function prototypes -\*=========================================================================*/ -static int timeout_lua_gettime(lua_State *L); -static int timeout_lua_sleep(lua_State *L); - -static luaL_Reg func[] = { - { "gettime", timeout_lua_gettime }, - { "sleep", timeout_lua_sleep }, - { NULL, NULL } -}; - -/*=========================================================================*\ -* Exported functions. -\*=========================================================================*/ -/*-------------------------------------------------------------------------*\ -* Initialize structure -\*-------------------------------------------------------------------------*/ -void timeout_init(p_timeout tm, double block, double total) { - tm->block = block; - tm->total = total; -} - -/*-------------------------------------------------------------------------*\ -* Determines how much time we have left for the next system call, -* if the previous call was successful -* Input -* tm: timeout control structure -* Returns -* the number of ms left or -1 if there is no time limit -\*-------------------------------------------------------------------------*/ -double timeout_get(p_timeout tm) { - if (tm->block < 0.0 && tm->total < 0.0) { - return -1; - } else if (tm->block < 0.0) { - double t = tm->total - timeout_gettime() + tm->start; - return MAX(t, 0.0); - } else if (tm->total < 0.0) { - return tm->block; - } else { - double t = tm->total - timeout_gettime() + tm->start; - return MIN(tm->block, MAX(t, 0.0)); - } -} - -/*-------------------------------------------------------------------------*\ -* Returns time since start of operation -* Input -* tm: timeout control structure -* Returns -* start field of structure -\*-------------------------------------------------------------------------*/ -double timeout_getstart(p_timeout tm) { - return tm->start; -} - -/*-------------------------------------------------------------------------*\ -* Determines how much time we have left for the next system call, -* if the previous call was a failure -* Input -* tm: timeout control structure -* Returns -* the number of ms left or -1 if there is no time limit -\*-------------------------------------------------------------------------*/ -double timeout_getretry(p_timeout tm) { - if (tm->block < 0.0 && tm->total < 0.0) { - return -1; - } else if (tm->block < 0.0) { - double t = tm->total - timeout_gettime() + tm->start; - return MAX(t, 0.0); - } else if (tm->total < 0.0) { - double t = tm->block - timeout_gettime() + tm->start; - return MAX(t, 0.0); - } else { - double t = tm->total - timeout_gettime() + tm->start; - return MIN(tm->block, MAX(t, 0.0)); - } -} - -/*-------------------------------------------------------------------------*\ -* Marks the operation start time in structure -* Input -* tm: timeout control structure -\*-------------------------------------------------------------------------*/ -p_timeout timeout_markstart(p_timeout tm) { - tm->start = timeout_gettime(); - return tm; -} - -/*-------------------------------------------------------------------------*\ -* Gets time in s, relative to January 1, 1970 (UTC) -* Returns -* time in s. -\*-------------------------------------------------------------------------*/ -#ifdef _WIN32 -double timeout_gettime(void) { - FILETIME ft; - double t; - GetSystemTimeAsFileTime(&ft); - /* Windows file time (time since January 1, 1601 (UTC)) */ - t = ft.dwLowDateTime/1.0e7 + ft.dwHighDateTime*(4294967296.0/1.0e7); - /* convert to Unix Epoch time (time since January 1, 1970 (UTC)) */ - return (t - 11644473600.0); -} -#else -double timeout_gettime(void) { - struct timeval v; - gettimeofday(&v, (struct timezone *) NULL); - /* Unix Epoch time (time since January 1, 1970 (UTC)) */ - return v.tv_sec + v.tv_usec/1.0e6; -} -#endif - -/*-------------------------------------------------------------------------*\ -* Initializes module -\*-------------------------------------------------------------------------*/ -int timeout_open(lua_State *L) { - luaL_setfuncs(L, func, 0); - return 0; -} - -/*-------------------------------------------------------------------------*\ -* Sets timeout values for IO operations -* Lua Input: base, time [, mode] -* time: time out value in seconds -* mode: "b" for block timeout, "t" for total timeout. (default: b) -\*-------------------------------------------------------------------------*/ -int timeout_meth_settimeout(lua_State *L, p_timeout tm) { - double t = luaL_optnumber(L, 2, -1); - const char *mode = luaL_optstring(L, 3, "b"); - switch (*mode) { - case 'b': - tm->block = t; - break; - case 'r': case 't': - tm->total = t; - break; - default: - luaL_argcheck(L, 0, 3, "invalid timeout mode"); - break; - } - lua_pushnumber(L, 1); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Gets timeout values for IO operations -* Lua Output: block, total -\*-------------------------------------------------------------------------*/ -int timeout_meth_gettimeout(lua_State *L, p_timeout tm) { - lua_pushnumber(L, tm->block); - lua_pushnumber(L, tm->total); - return 2; -} - -/*=========================================================================*\ -* Test support functions -\*=========================================================================*/ -/*-------------------------------------------------------------------------*\ -* Returns the time the system has been up, in secconds. -\*-------------------------------------------------------------------------*/ -static int timeout_lua_gettime(lua_State *L) -{ - lua_pushnumber(L, timeout_gettime()); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Sleep for n seconds. -\*-------------------------------------------------------------------------*/ -#ifdef _WIN32 -int timeout_lua_sleep(lua_State *L) -{ - double n = luaL_checknumber(L, 1); - if (n < 0.0) n = 0.0; - if (n < DBL_MAX/1000.0) n *= 1000.0; - if (n > INT_MAX) n = INT_MAX; - Sleep((int)n); - return 0; -} -#else -int timeout_lua_sleep(lua_State *L) -{ - double n = luaL_checknumber(L, 1); - struct timespec t, r; - if (n < 0.0) n = 0.0; - if (n > INT_MAX) n = INT_MAX; - t.tv_sec = (int) n; - n -= t.tv_sec; - t.tv_nsec = (int) (n * 1000000000); - if (t.tv_nsec >= 1000000000) t.tv_nsec = 999999999; - while (nanosleep(&t, &r) != 0) { - t.tv_sec = r.tv_sec; - t.tv_nsec = r.tv_nsec; - } - return 0; -} -#endif diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/timeout.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/timeout.h deleted file mode 100644 index af902318..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/timeout.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef TIMEOUT_H -#define TIMEOUT_H -/*=========================================================================*\ -* Timeout management functions -* LuaSocket toolkit -\*=========================================================================*/ -#include "lua.h" - -/* timeout control structure */ -typedef struct t_timeout_ { - double block; /* maximum time for blocking calls */ - double total; /* total number of miliseconds for operation */ - double start; /* time of start of operation */ -} t_timeout; -typedef t_timeout *p_timeout; - -int timeout_open(lua_State *L); -void timeout_init(p_timeout tm, double block, double total); -double timeout_get(p_timeout tm); -double timeout_getretry(p_timeout tm); -p_timeout timeout_markstart(p_timeout tm); -double timeout_getstart(p_timeout tm); -double timeout_gettime(void); -int timeout_meth_settimeout(lua_State *L, p_timeout tm); -int timeout_meth_gettimeout(lua_State *L, p_timeout tm); - -#define timeout_iszero(tm) ((tm)->block == 0.0) - -#endif /* TIMEOUT_H */ diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/tp.lua b/love/src/jni/love/src/libraries/luasocket/libluasocket/tp.lua deleted file mode 100644 index b8ebc56d..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/tp.lua +++ /dev/null @@ -1,134 +0,0 @@ ------------------------------------------------------------------------------ --- Unified SMTP/FTP subsystem --- LuaSocket toolkit. --- Author: Diego Nehab ------------------------------------------------------------------------------ - ------------------------------------------------------------------------------ --- Declare module and import dependencies ------------------------------------------------------------------------------ -local base = _G -local string = require("string") -local socket = require("socket") -local ltn12 = require("ltn12") - -socket.tp = {} -local _M = socket.tp - ------------------------------------------------------------------------------ --- Program constants ------------------------------------------------------------------------------ -_M.TIMEOUT = 60 - ------------------------------------------------------------------------------ --- Implementation ------------------------------------------------------------------------------ --- gets server reply (works for SMTP and FTP) -local function get_reply(c) - local code, current, sep - local line, err = c:receive() - local reply = line - if err then return nil, err end - code, sep = socket.skip(2, string.find(line, "^(%d%d%d)(.?)")) - if not code then return nil, "invalid server reply" end - if sep == "-" then -- reply is multiline - repeat - line, err = c:receive() - if err then return nil, err end - current, sep = socket.skip(2, string.find(line, "^(%d%d%d)(.?)")) - reply = reply .. "\n" .. line - -- reply ends with same code - until code == current and sep == " " - end - return code, reply -end - --- metatable for sock object -local metat = { __index = {} } - -function metat.__index:getpeername() - return self.c:getpeername() -end - -function metat.__index:getsockname() - return self.c:getpeername() -end - -function metat.__index:check(ok) - local code, reply = get_reply(self.c) - if not code then return nil, reply end - if base.type(ok) ~= "function" then - if base.type(ok) == "table" then - for i, v in base.ipairs(ok) do - if string.find(code, v) then - return base.tonumber(code), reply - end - end - return nil, reply - else - if string.find(code, ok) then return base.tonumber(code), reply - else return nil, reply end - end - else return ok(base.tonumber(code), reply) end -end - -function metat.__index:command(cmd, arg) - cmd = string.upper(cmd) - if arg then - return self.c:send(cmd .. " " .. arg.. "\r\n") - else - return self.c:send(cmd .. "\r\n") - end -end - -function metat.__index:sink(snk, pat) - local chunk, err = self.c:receive(pat) - return snk(chunk, err) -end - -function metat.__index:send(data) - return self.c:send(data) -end - -function metat.__index:receive(pat) - return self.c:receive(pat) -end - -function metat.__index:getfd() - return self.c:getfd() -end - -function metat.__index:dirty() - return self.c:dirty() -end - -function metat.__index:getcontrol() - return self.c -end - -function metat.__index:source(source, step) - local sink = socket.sink("keep-open", self.c) - local ret, err = ltn12.pump.all(source, sink, step or ltn12.pump.step) - return ret, err -end - --- closes the underlying c -function metat.__index:close() - self.c:close() - return 1 -end - --- connect with server and return c object -function _M.connect(host, port, timeout, create) - local c, e = (create or socket.tcp)() - if not c then return nil, e end - c:settimeout(timeout or _M.TIMEOUT) - local r, e = c:connect(host, port) - if not r then - c:close() - return nil, e - end - return base.setmetatable({c = c}, metat) -end - -return _M diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/tp.lua.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/tp.lua.h deleted file mode 100644 index cde8b648..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/tp.lua.h +++ /dev/null @@ -1,200 +0,0 @@ -/* code automatically generated by bin2c -- DO NOT EDIT */ -{ -/* #include'ing this file in a C program is equivalent to calling - if (luaL_loadfile(L,"tp.lua")==0) lua_call(L, 0, LUA_MULTRET); -*/ -/* tp.lua */ -static const unsigned char B1[]={ - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, - 32, 85,110,105,102,105,101,100, 32, 83, 77, 84, 80, 47, 70, 84, 80, 32,115,117, - 98,115,121,115,116,101,109, 10, 45, 45, 32, 76,117, 97, 83,111, 99,107,101,116, - 32,116,111,111,108,107,105,116, 46, 10, 45, 45, 32, 65,117,116,104,111,114, 58, - 32, 68,105,101,103,111, 32, 78,101,104, 97, 98, 10, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 68,101, 99,108, 97,114,101, - 32,109,111,100,117,108,101, 32, 97,110,100, 32,105,109,112,111,114,116, 32,100, -101,112,101,110,100,101,110, 99,105,101,115, 10, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 10,108,111, 99, 97,108, 32, 98, 97,115,101, - 32, 61, 32, 95, 71, 10,108,111, 99, 97,108, 32,115,116,114,105,110,103, 32, 61, - 32,114,101,113,117,105,114,101, 40, 34,115,116,114,105,110,103, 34, 41, 10,108, -111, 99, 97,108, 32,115,111, 99,107,101,116, 32, 61, 32,114,101,113,117,105,114, -101, 40, 34,115,111, 99,107,101,116, 34, 41, 10,108,111, 99, 97,108, 32,108,116, -110, 49, 50, 32, 61, 32,114,101,113,117,105,114,101, 40, 34,108,116,110, 49, 50, - 34, 41, 10, 10,115,111, 99,107,101,116, 46,116,112, 32, 61, 32,123,125, 10,108, -111, 99, 97,108, 32, 95, 77, 32, 61, 32,115,111, 99,107,101,116, 46,116,112, 10, - 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, - 45, 32, 80,114,111,103,114, 97,109, 32, 99,111,110,115,116, 97,110,116,115, 10, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 95, 77, - 46, 84, 73, 77, 69, 79, 85, 84, 32, 61, 32, 54, 48, 10, 10, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 73,109,112,108, -101,109,101,110,116, 97,116,105,111,110, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32,103,101,116,115, 32,115,101,114, -118,101,114, 32,114,101,112,108,121, 32, 40,119,111,114,107,115, 32,102,111,114, - 32, 83, 77, 84, 80, 32, 97,110,100, 32, 70, 84, 80, 41, 10,108,111, 99, 97,108, - 32,102,117,110, 99,116,105,111,110, 32,103,101,116, 95,114,101,112,108,121, 40, - 99, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32, 99,111,100,101, 44, 32, 99, -117,114,114,101,110,116, 44, 32,115,101,112, 10, 32, 32, 32, 32,108,111, 99, 97, -108, 32,108,105,110,101, 44, 32,101,114,114, 32, 61, 32, 99, 58,114,101, 99,101, -105,118,101, 40, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,114,101,112,108, -121, 32, 61, 32,108,105,110,101, 10, 32, 32, 32, 32,105,102, 32,101,114,114, 32, -116,104,101,110, 32,114,101,116,117,114,110, 32,110,105,108, 44, 32,101,114,114, - 32,101,110,100, 10, 32, 32, 32, 32, 99,111,100,101, 44, 32,115,101,112, 32, 61, - 32,115,111, 99,107,101,116, 46,115,107,105,112, 40, 50, 44, 32,115,116,114,105, -110,103, 46,102,105,110,100, 40,108,105,110,101, 44, 32, 34, 94, 40, 37,100, 37, -100, 37,100, 41, 40, 46, 63, 41, 34, 41, 41, 10, 32, 32, 32, 32,105,102, 32,110, -111,116, 32, 99,111,100,101, 32,116,104,101,110, 32,114,101,116,117,114,110, 32, -110,105,108, 44, 32, 34,105,110,118, 97,108,105,100, 32,115,101,114,118,101,114, - 32,114,101,112,108,121, 34, 32,101,110,100, 10, 32, 32, 32, 32,105,102, 32,115, -101,112, 32, 61, 61, 32, 34, 45, 34, 32,116,104,101,110, 32, 45, 45, 32,114,101, -112,108,121, 32,105,115, 32,109,117,108,116,105,108,105,110,101, 10, 32, 32, 32, - 32, 32, 32, 32, 32,114,101,112,101, 97,116, 10, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32,108,105,110,101, 44, 32,101,114,114, 32, 61, 32, 99, 58,114,101, - 99,101,105,118,101, 40, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, -105,102, 32,101,114,114, 32,116,104,101,110, 32,114,101,116,117,114,110, 32,110, -105,108, 44, 32,101,114,114, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 99,117,114,114,101,110,116, 44, 32,115,101,112, 32, 61, 32,115, -111, 99,107,101,116, 46,115,107,105,112, 40, 50, 44, 32,115,116,114,105,110,103, - 46,102,105,110,100, 40,108,105,110,101, 44, 32, 34, 94, 40, 37,100, 37,100, 37, -100, 41, 40, 46, 63, 41, 34, 41, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32,114,101,112,108,121, 32, 61, 32,114,101,112,108,121, 32, 46, 46, 32, 34, - 92,110, 34, 32, 46, 46, 32,108,105,110,101, 10, 32, 32, 32, 32, 32, 32, 32, 32, - 45, 45, 32,114,101,112,108,121, 32,101,110,100,115, 32,119,105,116,104, 32,115, - 97,109,101, 32, 99,111,100,101, 10, 32, 32, 32, 32, 32, 32, 32, 32,117,110,116, -105,108, 32, 99,111,100,101, 32, 61, 61, 32, 99,117,114,114,101,110,116, 32, 97, -110,100, 32,115,101,112, 32, 61, 61, 32, 34, 32, 34, 10, 32, 32, 32, 32,101,110, -100, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32, 99,111,100,101, 44, 32,114, -101,112,108,121, 10,101,110,100, 10, 10, 45, 45, 32,109,101,116, 97,116, 97, 98, -108,101, 32,102,111,114, 32,115,111, 99,107, 32,111, 98,106,101, 99,116, 10,108, -111, 99, 97,108, 32,109,101,116, 97,116, 32, 61, 32,123, 32, 95, 95,105,110,100, -101,120, 32, 61, 32,123,125, 32,125, 10, 10,102,117,110, 99,116,105,111,110, 32, -109,101,116, 97,116, 46, 95, 95,105,110,100,101,120, 58,103,101,116,112,101,101, -114,110, 97,109,101, 40, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,115, -101,108,102, 46, 99, 58,103,101,116,112,101,101,114,110, 97,109,101, 40, 41, 10, -101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,109,101,116, 97,116, 46, - 95, 95,105,110,100,101,120, 58,103,101,116,115,111, 99,107,110, 97,109,101, 40, - 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,115,101,108,102, 46, 99, 58, -103,101,116,112,101,101,114,110, 97,109,101, 40, 41, 10,101,110,100, 10, 10,102, -117,110, 99,116,105,111,110, 32,109,101,116, 97,116, 46, 95, 95,105,110,100,101, -120, 58, 99,104,101, 99,107, 40,111,107, 41, 10, 32, 32, 32, 32,108,111, 99, 97, -108, 32, 99,111,100,101, 44, 32,114,101,112,108,121, 32, 61, 32,103,101,116, 95, -114,101,112,108,121, 40,115,101,108,102, 46, 99, 41, 10, 32, 32, 32, 32,105,102, - 32,110,111,116, 32, 99,111,100,101, 32,116,104,101,110, 32,114,101,116,117,114, -110, 32,110,105,108, 44, 32,114,101,112,108,121, 32,101,110,100, 10, 32, 32, 32, - 32,105,102, 32, 98, 97,115,101, 46,116,121,112,101, 40,111,107, 41, 32,126, 61, - 32, 34,102,117,110, 99,116,105,111,110, 34, 32,116,104,101,110, 10, 32, 32, 32, - 32, 32, 32, 32, 32,105,102, 32, 98, 97,115,101, 46,116,121,112,101, 40,111,107, - 41, 32, 61, 61, 32, 34,116, 97, 98,108,101, 34, 32,116,104,101,110, 10, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102,111,114, 32,105, 44, 32,118, 32,105, -110, 32, 98, 97,115,101, 46,105,112, 97,105,114,115, 40,111,107, 41, 32,100,111, - 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32, -115,116,114,105,110,103, 46,102,105,110,100, 40, 99,111,100,101, 44, 32,118, 41, - 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32,114,101,116,117,114,110, 32, 98, 97,115,101, 46,116,111, -110,117,109, 98,101,114, 40, 99,111,100,101, 41, 44, 32,114,101,112,108,121, 10, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114,110, 32,110,105,108, 44, 32, -114,101,112,108,121, 10, 32, 32, 32, 32, 32, 32, 32, 32,101,108,115,101, 10, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,115,116,114,105,110,103, - 46,102,105,110,100, 40, 99,111,100,101, 44, 32,111,107, 41, 32,116,104,101,110, - 32,114,101,116,117,114,110, 32, 98, 97,115,101, 46,116,111,110,117,109, 98,101, -114, 40, 99,111,100,101, 41, 44, 32,114,101,112,108,121, 10, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32,101,108,115,101, 32,114,101,116,117,114,110, 32,110, -105,108, 44, 32,114,101,112,108,121, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, - 32, 32,101,110,100, 10, 32, 32, 32, 32,101,108,115,101, 32,114,101,116,117,114, -110, 32,111,107, 40, 98, 97,115,101, 46,116,111,110,117,109, 98,101,114, 40, 99, -111,100,101, 41, 44, 32,114,101,112,108,121, 41, 32,101,110,100, 10,101,110,100, - 10, 10,102,117,110, 99,116,105,111,110, 32,109,101,116, 97,116, 46, 95, 95,105, -110,100,101,120, 58, 99,111,109,109, 97,110,100, 40, 99,109,100, 44, 32, 97,114, -103, 41, 10, 32, 32, 32, 32, 99,109,100, 32, 61, 32,115,116,114,105,110,103, 46, -117,112,112,101,114, 40, 99,109,100, 41, 10, 32, 32, 32, 32,105,102, 32, 97,114, -103, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114, -110, 32,115,101,108,102, 46, 99, 58,115,101,110,100, 40, 99,109,100, 32, 46, 46, - 32, 34, 32, 34, 32, 46, 46, 32, 97,114,103, 46, 46, 32, 34, 92,114, 92,110, 34, - 41, 10, 32, 32, 32, 32,101,108,115,101, 10, 32, 32, 32, 32, 32, 32, 32, 32,114, -101,116,117,114,110, 32,115,101,108,102, 46, 99, 58,115,101,110,100, 40, 99,109, -100, 32, 46, 46, 32, 34, 92,114, 92,110, 34, 41, 10, 32, 32, 32, 32,101,110,100, - 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,109,101,116, 97,116, - 46, 95, 95,105,110,100,101,120, 58,115,105,110,107, 40,115,110,107, 44, 32,112, - 97,116, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32, 99,104,117,110,107, 44, - 32,101,114,114, 32, 61, 32,115,101,108,102, 46, 99, 58,114,101, 99,101,105,118, -101, 40,112, 97,116, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,115,110, -107, 40, 99,104,117,110,107, 44, 32,101,114,114, 41, 10,101,110,100, 10, 10,102, -117,110, 99,116,105,111,110, 32,109,101,116, 97,116, 46, 95, 95,105,110,100,101, -120, 58,115,101,110,100, 40,100, 97,116, 97, 41, 10, 32, 32, 32, 32,114,101,116, -117,114,110, 32,115,101,108,102, 46, 99, 58,115,101,110,100, 40,100, 97,116, 97, - 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,109,101,116, 97, -116, 46, 95, 95,105,110,100,101,120, 58,114,101, 99,101,105,118,101, 40,112, 97, -116, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,115,101,108,102, 46, 99, - 58,114,101, 99,101,105,118,101, 40,112, 97,116, 41, 10,101,110,100, 10, 10,102, -117,110, 99,116,105,111,110, 32,109,101,116, 97,116, 46, 95, 95,105,110,100,101, -120, 58,103,101,116,102,100, 40, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, - 32,115,101,108,102, 46, 99, 58,103,101,116,102,100, 40, 41, 10,101,110,100, 10, - 10,102,117,110, 99,116,105,111,110, 32,109,101,116, 97,116, 46, 95, 95,105,110, -100,101,120, 58,100,105,114,116,121, 40, 41, 10, 32, 32, 32, 32,114,101,116,117, -114,110, 32,115,101,108,102, 46, 99, 58,100,105,114,116,121, 40, 41, 10,101,110, -100, 10, 10,102,117,110, 99,116,105,111,110, 32,109,101,116, 97,116, 46, 95, 95, -105,110,100,101,120, 58,103,101,116, 99,111,110,116,114,111,108, 40, 41, 10, 32, - 32, 32, 32,114,101,116,117,114,110, 32,115,101,108,102, 46, 99, 10,101,110,100, - 10, 10,102,117,110, 99,116,105,111,110, 32,109,101,116, 97,116, 46, 95, 95,105, -110,100,101,120, 58,115,111,117,114, 99,101, 40,115,111,117,114, 99,101, 44, 32, -115,116,101,112, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,115,105,110,107, - 32, 61, 32,115,111, 99,107,101,116, 46,115,105,110,107, 40, 34,107,101,101,112, - 45,111,112,101,110, 34, 44, 32,115,101,108,102, 46, 99, 41, 10, 32, 32, 32, 32, -108,111, 99, 97,108, 32,114,101,116, 44, 32,101,114,114, 32, 61, 32,108,116,110, - 49, 50, 46,112,117,109,112, 46, 97,108,108, 40,115,111,117,114, 99,101, 44, 32, -115,105,110,107, 44, 32,115,116,101,112, 32,111,114, 32,108,116,110, 49, 50, 46, -112,117,109,112, 46,115,116,101,112, 41, 10, 32, 32, 32, 32,114,101,116,117,114, -110, 32,114,101,116, 44, 32,101,114,114, 10,101,110,100, 10, 10, 45, 45, 32, 99, -108,111,115,101,115, 32,116,104,101, 32,117,110,100,101,114,108,121,105,110,103, - 32, 99, 10,102,117,110, 99,116,105,111,110, 32,109,101,116, 97,116, 46, 95, 95, -105,110,100,101,120, 58, 99,108,111,115,101, 40, 41, 10, 32, 32, 32, 32,115,101, -108,102, 46, 99, 58, 99,108,111,115,101, 40, 41, 10, 32, 32, 32, 32,114,101,116, -117,114,110, 32, 49, 10,101,110,100, 10, 10, 45, 45, 32, 99,111,110,110,101, 99, -116, 32,119,105,116,104, 32,115,101,114,118,101,114, 32, 97,110,100, 32,114,101, -116,117,114,110, 32, 99, 32,111, 98,106,101, 99,116, 10,102,117,110, 99,116,105, -111,110, 32, 95, 77, 46, 99,111,110,110,101, 99,116, 40,104,111,115,116, 44, 32, -112,111,114,116, 44, 32,116,105,109,101,111,117,116, 44, 32, 99,114,101, 97,116, -101, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32, 99, 44, 32,101, 32, 61, 32, - 40, 99,114,101, 97,116,101, 32,111,114, 32,115,111, 99,107,101,116, 46,116, 99, -112, 41, 40, 41, 10, 32, 32, 32, 32,105,102, 32,110,111,116, 32, 99, 32,116,104, -101,110, 32,114,101,116,117,114,110, 32,110,105,108, 44, 32,101, 32,101,110,100, - 10, 32, 32, 32, 32, 99, 58,115,101,116,116,105,109,101,111,117,116, 40,116,105, -109,101,111,117,116, 32,111,114, 32, 95, 77, 46, 84, 73, 77, 69, 79, 85, 84, 41, - 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,114, 44, 32,101, 32, 61, 32, 99, 58, - 99,111,110,110,101, 99,116, 40,104,111,115,116, 44, 32,112,111,114,116, 41, 10, - 32, 32, 32, 32,105,102, 32,110,111,116, 32,114, 32,116,104,101,110, 10, 32, 32, - 32, 32, 32, 32, 32, 32, 99, 58, 99,108,111,115,101, 40, 41, 10, 32, 32, 32, 32, - 32, 32, 32, 32,114,101,116,117,114,110, 32,110,105,108, 44, 32,101, 10, 32, 32, - 32, 32,101,110,100, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32, 98, 97,115, -101, 46,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,123, 99, 32, 61, 32, - 99,125, 44, 32,109,101,116, 97,116, 41, 10,101,110,100, 10, 10,114,101,116,117, -114,110, 32, 95, 77, 10, -}; - - if (luaL_loadbuffer(L,(const char*)B1,sizeof(B1),"tp.lua")==0) lua_call(L, 0, LUA_MULTRET); -} diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/udp.c b/love/src/jni/love/src/libraries/luasocket/libluasocket/udp.c deleted file mode 100644 index ec972526..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/udp.c +++ /dev/null @@ -1,462 +0,0 @@ -/*=========================================================================*\ -* UDP object -* LuaSocket toolkit -\*=========================================================================*/ -#include -#include - -#include "lua.h" -#include "lauxlib.h" -#include "compat.h" - -#include "auxiliar.h" -#include "socket.h" -#include "inet.h" -#include "options.h" -#include "udp.h" - -/* min and max macros */ -#ifndef MIN -#define MIN(x, y) ((x) < (y) ? x : y) -#endif -#ifndef MAX -#define MAX(x, y) ((x) > (y) ? x : y) -#endif - -/*=========================================================================*\ -* Internal function prototypes -\*=========================================================================*/ -static int global_create(lua_State *L); -static int global_create4(lua_State *L); -static int global_create6(lua_State *L); -static int meth_send(lua_State *L); -static int meth_sendto(lua_State *L); -static int meth_receive(lua_State *L); -static int meth_receivefrom(lua_State *L); -static int meth_getfamily(lua_State *L); -static int meth_getsockname(lua_State *L); -static int meth_getpeername(lua_State *L); -static int meth_gettimeout(lua_State *L); -static int meth_setsockname(lua_State *L); -static int meth_setpeername(lua_State *L); -static int meth_close(lua_State *L); -static int meth_setoption(lua_State *L); -static int meth_getoption(lua_State *L); -static int meth_settimeout(lua_State *L); -static int meth_getfd(lua_State *L); -static int meth_setfd(lua_State *L); -static int meth_dirty(lua_State *L); - -/* udp object methods */ -static luaL_Reg udp_methods[] = { - {"__gc", meth_close}, - {"__tostring", auxiliar_tostring}, - {"close", meth_close}, - {"dirty", meth_dirty}, - {"getfamily", meth_getfamily}, - {"getfd", meth_getfd}, - {"getpeername", meth_getpeername}, - {"getsockname", meth_getsockname}, - {"receive", meth_receive}, - {"receivefrom", meth_receivefrom}, - {"send", meth_send}, - {"sendto", meth_sendto}, - {"setfd", meth_setfd}, - {"setoption", meth_setoption}, - {"getoption", meth_getoption}, - {"setpeername", meth_setpeername}, - {"setsockname", meth_setsockname}, - {"settimeout", meth_settimeout}, - {"gettimeout", meth_gettimeout}, - {NULL, NULL} -}; - -/* socket options for setoption */ -static t_opt optset[] = { - {"dontroute", opt_set_dontroute}, - {"broadcast", opt_set_broadcast}, - {"reuseaddr", opt_set_reuseaddr}, - {"reuseport", opt_set_reuseport}, - {"ip-multicast-if", opt_set_ip_multicast_if}, - {"ip-multicast-ttl", opt_set_ip_multicast_ttl}, - {"ip-multicast-loop", opt_set_ip_multicast_loop}, - {"ip-add-membership", opt_set_ip_add_membership}, - {"ip-drop-membership", opt_set_ip_drop_membersip}, - {"ipv6-unicast-hops", opt_set_ip6_unicast_hops}, - {"ipv6-multicast-hops", opt_set_ip6_unicast_hops}, - {"ipv6-multicast-loop", opt_set_ip6_multicast_loop}, - {"ipv6-add-membership", opt_set_ip6_add_membership}, - {"ipv6-drop-membership", opt_set_ip6_drop_membersip}, - {"ipv6-v6only", opt_set_ip6_v6only}, - {NULL, NULL} -}; - -/* socket options for getoption */ -static t_opt optget[] = { - {"dontroute", opt_get_dontroute}, - {"broadcast", opt_get_broadcast}, - {"reuseaddr", opt_get_reuseaddr}, - {"reuseport", opt_get_reuseport}, - {"ip-multicast-if", opt_get_ip_multicast_if}, - {"ip-multicast-loop", opt_get_ip_multicast_loop}, - {"error", opt_get_error}, - {"ipv6-unicast-hops", opt_get_ip6_unicast_hops}, - {"ipv6-multicast-hops", opt_get_ip6_unicast_hops}, - {"ipv6-multicast-loop", opt_get_ip6_multicast_loop}, - {"ipv6-v6only", opt_get_ip6_v6only}, - {NULL, NULL} -}; - -/* functions in library namespace */ -static luaL_Reg func[] = { - {"udp", global_create}, - {"udp4", global_create4}, - {"udp6", global_create6}, - {NULL, NULL} -}; - -/*-------------------------------------------------------------------------*\ -* Initializes module -\*-------------------------------------------------------------------------*/ -int udp_open(lua_State *L) { - /* create classes */ - auxiliar_newclass(L, "udp{connected}", udp_methods); - auxiliar_newclass(L, "udp{unconnected}", udp_methods); - /* create class groups */ - auxiliar_add2group(L, "udp{connected}", "udp{any}"); - auxiliar_add2group(L, "udp{unconnected}", "udp{any}"); - auxiliar_add2group(L, "udp{connected}", "select{able}"); - auxiliar_add2group(L, "udp{unconnected}", "select{able}"); - /* define library functions */ - luaL_setfuncs(L, func, 0); - /* export default UDP size */ - lua_pushliteral(L, "_DATAGRAMSIZE"); - lua_pushinteger(L, UDP_DATAGRAMSIZE); - lua_rawset(L, -3); - return 0; -} - -/*=========================================================================*\ -* Lua methods -\*=========================================================================*/ -static const char *udp_strerror(int err) { - /* a 'closed' error on an unconnected means the target address was not - * accepted by the transport layer */ - if (err == IO_CLOSED) return "refused"; - else return socket_strerror(err); -} - -/*-------------------------------------------------------------------------*\ -* Send data through connected udp socket -\*-------------------------------------------------------------------------*/ -static int meth_send(lua_State *L) { - p_udp udp = (p_udp) auxiliar_checkclass(L, "udp{connected}", 1); - p_timeout tm = &udp->tm; - size_t count, sent = 0; - int err; - const char *data = luaL_checklstring(L, 2, &count); - timeout_markstart(tm); - err = socket_send(&udp->sock, data, count, &sent, tm); - if (err != IO_DONE) { - lua_pushnil(L); - lua_pushstring(L, udp_strerror(err)); - return 2; - } - lua_pushnumber(L, (lua_Number) sent); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Send data through unconnected udp socket -\*-------------------------------------------------------------------------*/ -static int meth_sendto(lua_State *L) { - p_udp udp = (p_udp) auxiliar_checkclass(L, "udp{unconnected}", 1); - size_t count, sent = 0; - const char *data = luaL_checklstring(L, 2, &count); - const char *ip = luaL_checkstring(L, 3); - const char *port = luaL_checkstring(L, 4); - p_timeout tm = &udp->tm; - int err; - struct addrinfo aihint; - struct addrinfo *ai; - memset(&aihint, 0, sizeof(aihint)); - aihint.ai_family = udp->family; - aihint.ai_socktype = SOCK_DGRAM; - aihint.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV; - err = getaddrinfo(ip, port, &aihint, &ai); - if (err) { - lua_pushnil(L); - lua_pushstring(L, gai_strerror(err)); - return 2; - } - timeout_markstart(tm); - err = socket_sendto(&udp->sock, data, count, &sent, ai->ai_addr, - (socklen_t) ai->ai_addrlen, tm); - freeaddrinfo(ai); - if (err != IO_DONE) { - lua_pushnil(L); - lua_pushstring(L, udp_strerror(err)); - return 2; - } - lua_pushnumber(L, (lua_Number) sent); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Receives data from a UDP socket -\*-------------------------------------------------------------------------*/ -static int meth_receive(lua_State *L) { - p_udp udp = (p_udp) auxiliar_checkgroup(L, "udp{any}", 1); - char buf[UDP_DATAGRAMSIZE]; - size_t got, wanted = (size_t) luaL_optnumber(L, 2, sizeof(buf)); - char *dgram = wanted > sizeof(buf)? (char *) malloc(wanted): buf; - int err; - p_timeout tm = &udp->tm; - timeout_markstart(tm); - if (!dgram) { - lua_pushnil(L); - lua_pushliteral(L, "out of memory"); - return 2; - } - err = socket_recv(&udp->sock, dgram, wanted, &got, tm); - /* Unlike TCP, recv() of zero is not closed, but a zero-length packet. */ - if (err != IO_DONE && err != IO_CLOSED) { - lua_pushnil(L); - lua_pushstring(L, udp_strerror(err)); - if (wanted > sizeof(buf)) free(dgram); - return 2; - } - lua_pushlstring(L, dgram, got); - if (wanted > sizeof(buf)) free(dgram); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Receives data and sender from a UDP socket -\*-------------------------------------------------------------------------*/ -static int meth_receivefrom(lua_State *L) { - p_udp udp = (p_udp) auxiliar_checkclass(L, "udp{unconnected}", 1); - char buf[UDP_DATAGRAMSIZE]; - size_t got, wanted = (size_t) luaL_optnumber(L, 2, sizeof(buf)); - char *dgram = wanted > sizeof(buf)? (char *) malloc(wanted): buf; - struct sockaddr_storage addr; - socklen_t addr_len = sizeof(addr); - char addrstr[INET6_ADDRSTRLEN]; - char portstr[6]; - int err; - p_timeout tm = &udp->tm; - timeout_markstart(tm); - if (!dgram) { - lua_pushnil(L); - lua_pushliteral(L, "out of memory"); - return 2; - } - err = socket_recvfrom(&udp->sock, dgram, wanted, &got, (SA *) &addr, - &addr_len, tm); - /* Unlike TCP, recv() of zero is not closed, but a zero-length packet. */ - if (err != IO_DONE && err != IO_CLOSED) { - lua_pushnil(L); - lua_pushstring(L, udp_strerror(err)); - if (wanted > sizeof(buf)) free(dgram); - return 2; - } - err = getnameinfo((struct sockaddr *)&addr, addr_len, addrstr, - INET6_ADDRSTRLEN, portstr, 6, NI_NUMERICHOST | NI_NUMERICSERV); - if (err) { - lua_pushnil(L); - lua_pushstring(L, gai_strerror(err)); - if (wanted > sizeof(buf)) free(dgram); - return 2; - } - lua_pushlstring(L, dgram, got); - lua_pushstring(L, addrstr); - lua_pushinteger(L, (int) strtol(portstr, (char **) NULL, 10)); - if (wanted > sizeof(buf)) free(dgram); - return 3; -} - -/*-------------------------------------------------------------------------*\ -* Returns family as string -\*-------------------------------------------------------------------------*/ -static int meth_getfamily(lua_State *L) { - p_udp udp = (p_udp) auxiliar_checkgroup(L, "udp{any}", 1); - if (udp->family == AF_INET6) { - lua_pushliteral(L, "inet6"); - return 1; - } else { - lua_pushliteral(L, "inet4"); - return 1; - } -} - -/*-------------------------------------------------------------------------*\ -* Select support methods -\*-------------------------------------------------------------------------*/ -static int meth_getfd(lua_State *L) { - p_udp udp = (p_udp) auxiliar_checkgroup(L, "udp{any}", 1); - lua_pushnumber(L, (int) udp->sock); - return 1; -} - -/* this is very dangerous, but can be handy for those that are brave enough */ -static int meth_setfd(lua_State *L) { - p_udp udp = (p_udp) auxiliar_checkgroup(L, "udp{any}", 1); - udp->sock = (t_socket) luaL_checknumber(L, 2); - return 0; -} - -static int meth_dirty(lua_State *L) { - p_udp udp = (p_udp) auxiliar_checkgroup(L, "udp{any}", 1); - (void) udp; - lua_pushboolean(L, 0); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Just call inet methods -\*-------------------------------------------------------------------------*/ -static int meth_getpeername(lua_State *L) { - p_udp udp = (p_udp) auxiliar_checkclass(L, "udp{connected}", 1); - return inet_meth_getpeername(L, &udp->sock, udp->family); -} - -static int meth_getsockname(lua_State *L) { - p_udp udp = (p_udp) auxiliar_checkgroup(L, "udp{any}", 1); - return inet_meth_getsockname(L, &udp->sock, udp->family); -} - -/*-------------------------------------------------------------------------*\ -* Just call option handler -\*-------------------------------------------------------------------------*/ -static int meth_setoption(lua_State *L) { - p_udp udp = (p_udp) auxiliar_checkgroup(L, "udp{any}", 1); - return opt_meth_setoption(L, optset, &udp->sock); -} - -/*-------------------------------------------------------------------------*\ -* Just call option handler -\*-------------------------------------------------------------------------*/ -static int meth_getoption(lua_State *L) { - p_udp udp = (p_udp) auxiliar_checkgroup(L, "udp{any}", 1); - return opt_meth_getoption(L, optget, &udp->sock); -} - -/*-------------------------------------------------------------------------*\ -* Just call tm methods -\*-------------------------------------------------------------------------*/ -static int meth_settimeout(lua_State *L) { - p_udp udp = (p_udp) auxiliar_checkgroup(L, "udp{any}", 1); - return timeout_meth_settimeout(L, &udp->tm); -} - -static int meth_gettimeout(lua_State *L) { - p_udp udp = (p_udp) auxiliar_checkgroup(L, "udp{any}", 1); - return timeout_meth_gettimeout(L, &udp->tm); -} - -/*-------------------------------------------------------------------------*\ -* Turns a master udp object into a client object. -\*-------------------------------------------------------------------------*/ -static int meth_setpeername(lua_State *L) { - p_udp udp = (p_udp) auxiliar_checkgroup(L, "udp{any}", 1); - p_timeout tm = &udp->tm; - const char *address = luaL_checkstring(L, 2); - int connecting = strcmp(address, "*"); - const char *port = connecting? luaL_checkstring(L, 3): "0"; - struct addrinfo connecthints; - const char *err; - memset(&connecthints, 0, sizeof(connecthints)); - connecthints.ai_socktype = SOCK_DGRAM; - /* make sure we try to connect only to the same family */ - connecthints.ai_family = udp->family; - if (connecting) { - err = inet_tryconnect(&udp->sock, &udp->family, address, - port, tm, &connecthints); - if (err) { - lua_pushnil(L); - lua_pushstring(L, err); - return 2; - } - auxiliar_setclass(L, "udp{connected}", 1); - } else { - /* we ignore possible errors because Mac OS X always - * returns EAFNOSUPPORT */ - inet_trydisconnect(&udp->sock, udp->family, tm); - auxiliar_setclass(L, "udp{unconnected}", 1); - } - lua_pushnumber(L, 1); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Closes socket used by object -\*-------------------------------------------------------------------------*/ -static int meth_close(lua_State *L) { - p_udp udp = (p_udp) auxiliar_checkgroup(L, "udp{any}", 1); - socket_destroy(&udp->sock); - lua_pushnumber(L, 1); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Turns a master object into a server object -\*-------------------------------------------------------------------------*/ -static int meth_setsockname(lua_State *L) { - p_udp udp = (p_udp) auxiliar_checkclass(L, "udp{unconnected}", 1); - const char *address = luaL_checkstring(L, 2); - const char *port = luaL_checkstring(L, 3); - const char *err; - struct addrinfo bindhints; - memset(&bindhints, 0, sizeof(bindhints)); - bindhints.ai_socktype = SOCK_DGRAM; - bindhints.ai_family = udp->family; - bindhints.ai_flags = AI_PASSIVE; - err = inet_trybind(&udp->sock, &udp->family, address, port, &bindhints); - if (err) { - lua_pushnil(L); - lua_pushstring(L, err); - return 2; - } - lua_pushnumber(L, 1); - return 1; -} - -/*=========================================================================*\ -* Library functions -\*=========================================================================*/ -/*-------------------------------------------------------------------------*\ -* Creates a master udp object -\*-------------------------------------------------------------------------*/ -static int udp_create(lua_State *L, int family) { - /* allocate udp object */ - p_udp udp = (p_udp) lua_newuserdata(L, sizeof(t_udp)); - auxiliar_setclass(L, "udp{unconnected}", -1); - /* if family is AF_UNSPEC, we leave the socket invalid and - * store AF_UNSPEC into family. This will allow it to later be - * replaced with an AF_INET6 or AF_INET socket upon first use. */ - udp->sock = SOCKET_INVALID; - timeout_init(&udp->tm, -1, -1); - udp->family = family; - if (family != AF_UNSPEC) { - const char *err = inet_trycreate(&udp->sock, family, SOCK_DGRAM, 0); - if (err != NULL) { - lua_pushnil(L); - lua_pushstring(L, err); - return 2; - } - socket_setnonblocking(&udp->sock); - } - return 1; -} - -static int global_create(lua_State *L) { - return udp_create(L, AF_UNSPEC); -} - -static int global_create4(lua_State *L) { - return udp_create(L, AF_INET); -} - -static int global_create6(lua_State *L) { - return udp_create(L, AF_INET6); -} diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/udp.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/udp.h deleted file mode 100644 index be9b6a55..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/udp.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef UDP_H -#define UDP_H -/*=========================================================================*\ -* UDP object -* LuaSocket toolkit -* -* The udp.h module provides LuaSocket with support for UDP protocol -* (AF_INET, SOCK_DGRAM). -* -* Two classes are defined: connected and unconnected. UDP objects are -* originally unconnected. They can be "connected" to a given address -* with a call to the setpeername function. The same function can be used to -* break the connection. -\*=========================================================================*/ -#include "lua.h" - -#include "timeout.h" -#include "socket.h" - -#define UDP_DATAGRAMSIZE 8192 - -typedef struct t_udp_ { - t_socket sock; - t_timeout tm; - int family; -} t_udp; -typedef t_udp *p_udp; - -int udp_open(lua_State *L); - -#endif /* UDP_H */ diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/unix.c b/love/src/jni/love/src/libraries/luasocket/libluasocket/unix.c deleted file mode 100644 index 2009c193..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/unix.c +++ /dev/null @@ -1,30 +0,0 @@ -/*=========================================================================*\ -* Unix domain socket -* LuaSocket toolkit -\*=========================================================================*/ -#include "lua.h" -#include "lauxlib.h" - -#include "unixtcp.h" -#include "unixudp.h" - -/*-------------------------------------------------------------------------*\ -* Modules and functions -\*-------------------------------------------------------------------------*/ -static const luaL_Reg mod[] = { - {"tcp", unixtcp_open}, - {"udp", unixudp_open}, - {NULL, NULL} -}; - -/*-------------------------------------------------------------------------*\ -* Initializes module -\*-------------------------------------------------------------------------*/ -int luaopen_socket_unix(lua_State *L) -{ - int i; - lua_newtable(L); - for (i = 0; mod[i].name; i++) mod[i].func(L); - return 1; -} - diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/unix.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/unix.h deleted file mode 100644 index 8cc7a793..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/unix.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef UNIX_H -#define UNIX_H -/*=========================================================================*\ -* Unix domain object -* LuaSocket toolkit -* -* This module is just an example of how to extend LuaSocket with a new -* domain. -\*=========================================================================*/ -#include "lua.h" - -#include "buffer.h" -#include "timeout.h" -#include "socket.h" - -#ifndef UNIX_API -#define UNIX_API extern -#endif - -typedef struct t_unix_ { - t_socket sock; - t_io io; - t_buffer buf; - t_timeout tm; -} t_unix; -typedef t_unix *p_unix; - -UNIX_API int luaopen_socket_unix(lua_State *L); - -#endif /* UNIX_H */ diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/unixtcp.c b/love/src/jni/love/src/libraries/luasocket/libluasocket/unixtcp.c deleted file mode 100644 index 747ef5f9..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/unixtcp.c +++ /dev/null @@ -1,357 +0,0 @@ -/*=========================================================================*\ -* Unix domain socket tcp sub module -* LuaSocket toolkit -\*=========================================================================*/ -#include - -#include "lua.h" -#include "lauxlib.h" -#include "compat.h" - -#include "auxiliar.h" -#include "socket.h" -#include "options.h" -#include "unixtcp.h" -#include - -/*=========================================================================*\ -* Internal function prototypes -\*=========================================================================*/ -static int global_create(lua_State *L); -static int meth_connect(lua_State *L); -static int meth_listen(lua_State *L); -static int meth_bind(lua_State *L); -static int meth_send(lua_State *L); -static int meth_shutdown(lua_State *L); -static int meth_receive(lua_State *L); -static int meth_accept(lua_State *L); -static int meth_close(lua_State *L); -static int meth_setoption(lua_State *L); -static int meth_settimeout(lua_State *L); -static int meth_getfd(lua_State *L); -static int meth_setfd(lua_State *L); -static int meth_dirty(lua_State *L); -static int meth_getstats(lua_State *L); -static int meth_setstats(lua_State *L); -static int meth_getsockname(lua_State *L); - -static const char *unixtcp_tryconnect(p_unix un, const char *path); -static const char *unixtcp_trybind(p_unix un, const char *path); - -/* unixtcp object methods */ -static luaL_Reg unixtcp_methods[] = { - {"__gc", meth_close}, - {"__tostring", auxiliar_tostring}, - {"accept", meth_accept}, - {"bind", meth_bind}, - {"close", meth_close}, - {"connect", meth_connect}, - {"dirty", meth_dirty}, - {"getfd", meth_getfd}, - {"getstats", meth_getstats}, - {"setstats", meth_setstats}, - {"listen", meth_listen}, - {"receive", meth_receive}, - {"send", meth_send}, - {"setfd", meth_setfd}, - {"setoption", meth_setoption}, - {"setpeername", meth_connect}, - {"setsockname", meth_bind}, - {"getsockname", meth_getsockname}, - {"settimeout", meth_settimeout}, - {"shutdown", meth_shutdown}, - {NULL, NULL} -}; - -/* socket option handlers */ -static t_opt optset[] = { - {"keepalive", opt_set_keepalive}, - {"reuseaddr", opt_set_reuseaddr}, - {"linger", opt_set_linger}, - {NULL, NULL} -}; - -/* functions in library namespace */ -static luaL_Reg func[] = { - {"tcp", global_create}, - {NULL, NULL} -}; - -/*-------------------------------------------------------------------------*\ -* Initializes module -\*-------------------------------------------------------------------------*/ -int unixtcp_open(lua_State *L) -{ - /* create classes */ - auxiliar_newclass(L, "unixtcp{master}", unixtcp_methods); - auxiliar_newclass(L, "unixtcp{client}", unixtcp_methods); - auxiliar_newclass(L, "unixtcp{server}", unixtcp_methods); - - /* create class groups */ - auxiliar_add2group(L, "unixtcp{master}", "unixtcp{any}"); - auxiliar_add2group(L, "unixtcp{client}", "unixtcp{any}"); - auxiliar_add2group(L, "unixtcp{server}", "unixtcp{any}"); - - luaL_setfuncs(L, func, 0); - return 0; -} - -/*=========================================================================*\ -* Lua methods -\*=========================================================================*/ -/*-------------------------------------------------------------------------*\ -* Just call buffered IO methods -\*-------------------------------------------------------------------------*/ -static int meth_send(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkclass(L, "unixtcp{client}", 1); - return buffer_meth_send(L, &un->buf); -} - -static int meth_receive(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkclass(L, "unixtcp{client}", 1); - return buffer_meth_receive(L, &un->buf); -} - -static int meth_getstats(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkclass(L, "unixtcp{client}", 1); - return buffer_meth_getstats(L, &un->buf); -} - -static int meth_setstats(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkclass(L, "unixtcp{client}", 1); - return buffer_meth_setstats(L, &un->buf); -} - -/*-------------------------------------------------------------------------*\ -* Just call option handler -\*-------------------------------------------------------------------------*/ -static int meth_setoption(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkgroup(L, "unixtcp{any}", 1); - return opt_meth_setoption(L, optset, &un->sock); -} - -/*-------------------------------------------------------------------------*\ -* Select support methods -\*-------------------------------------------------------------------------*/ -static int meth_getfd(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkgroup(L, "unixtcp{any}", 1); - lua_pushnumber(L, (int) un->sock); - return 1; -} - -/* this is very dangerous, but can be handy for those that are brave enough */ -static int meth_setfd(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkgroup(L, "unixtcp{any}", 1); - un->sock = (t_socket) luaL_checknumber(L, 2); - return 0; -} - -static int meth_dirty(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkgroup(L, "unixtcp{any}", 1); - lua_pushboolean(L, !buffer_isempty(&un->buf)); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Waits for and returns a client object attempting connection to the -* server object -\*-------------------------------------------------------------------------*/ -static int meth_accept(lua_State *L) { - p_unix server = (p_unix) auxiliar_checkclass(L, "unixtcp{server}", 1); - p_timeout tm = timeout_markstart(&server->tm); - t_socket sock; - int err = socket_accept(&server->sock, &sock, NULL, NULL, tm); - /* if successful, push client socket */ - if (err == IO_DONE) { - p_unix clnt = (p_unix) lua_newuserdata(L, sizeof(t_unix)); - auxiliar_setclass(L, "unixtcp{client}", -1); - /* initialize structure fields */ - socket_setnonblocking(&sock); - clnt->sock = sock; - io_init(&clnt->io, (p_send)socket_send, (p_recv)socket_recv, - (p_error) socket_ioerror, &clnt->sock); - timeout_init(&clnt->tm, -1, -1); - buffer_init(&clnt->buf, &clnt->io, &clnt->tm); - return 1; - } else { - lua_pushnil(L); - lua_pushstring(L, socket_strerror(err)); - return 2; - } -} - -/*-------------------------------------------------------------------------*\ -* Binds an object to an address -\*-------------------------------------------------------------------------*/ -static const char *unixtcp_trybind(p_unix un, const char *path) { - struct sockaddr_un local; - size_t len = strlen(path); - int err; - if (len >= sizeof(local.sun_path)) return "path too long"; - memset(&local, 0, sizeof(local)); - strcpy(local.sun_path, path); - local.sun_family = AF_UNIX; -#ifdef UNIX_HAS_SUN_LEN - local.sun_len = sizeof(local.sun_family) + sizeof(local.sun_len) - + len + 1; - err = socket_bind(&un->sock, (SA *) &local, local.sun_len); - -#else - err = socket_bind(&un->sock, (SA *) &local, - sizeof(local.sun_family) + len); -#endif - if (err != IO_DONE) socket_destroy(&un->sock); - return socket_strerror(err); -} - -static int meth_bind(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkclass(L, "unixtcp{master}", 1); - const char *path = luaL_checkstring(L, 2); - const char *err = unixtcp_trybind(un, path); - if (err) { - lua_pushnil(L); - lua_pushstring(L, err); - return 2; - } - lua_pushnumber(L, 1); - return 1; -} - -static int meth_getsockname(lua_State *L) -{ - p_unix un = (p_unix) auxiliar_checkgroup(L, "unixtcp{any}", 1); - struct sockaddr_un peer = {0}; - socklen_t peer_len = sizeof(peer); - - if (getsockname(un->sock, (SA *) &peer, &peer_len) < 0) { - lua_pushnil(L); - lua_pushstring(L, socket_strerror(errno)); - return 2; - } - - lua_pushstring(L, peer.sun_path); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Turns a master unixtcp object into a client object. -\*-------------------------------------------------------------------------*/ -static const char *unixtcp_tryconnect(p_unix un, const char *path) -{ - struct sockaddr_un remote; - int err; - size_t len = strlen(path); - if (len >= sizeof(remote.sun_path)) return "path too long"; - memset(&remote, 0, sizeof(remote)); - strcpy(remote.sun_path, path); - remote.sun_family = AF_UNIX; - timeout_markstart(&un->tm); -#ifdef UNIX_HAS_SUN_LEN - remote.sun_len = sizeof(remote.sun_family) + sizeof(remote.sun_len) - + len + 1; - err = socket_connect(&un->sock, (SA *) &remote, remote.sun_len, &un->tm); -#else - err = socket_connect(&un->sock, (SA *) &remote, - sizeof(remote.sun_family) + len, &un->tm); -#endif - if (err != IO_DONE) socket_destroy(&un->sock); - return socket_strerror(err); -} - -static int meth_connect(lua_State *L) -{ - p_unix un = (p_unix) auxiliar_checkclass(L, "unixtcp{master}", 1); - const char *path = luaL_checkstring(L, 2); - const char *err = unixtcp_tryconnect(un, path); - if (err) { - lua_pushnil(L); - lua_pushstring(L, err); - return 2; - } - /* turn master object into a client object */ - auxiliar_setclass(L, "unixtcp{client}", 1); - lua_pushnumber(L, 1); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Closes socket used by object -\*-------------------------------------------------------------------------*/ -static int meth_close(lua_State *L) -{ - p_unix un = (p_unix) auxiliar_checkgroup(L, "unixtcp{any}", 1); - socket_destroy(&un->sock); - lua_pushnumber(L, 1); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Puts the sockt in listen mode -\*-------------------------------------------------------------------------*/ -static int meth_listen(lua_State *L) -{ - p_unix un = (p_unix) auxiliar_checkclass(L, "unixtcp{master}", 1); - int backlog = (int) luaL_optnumber(L, 2, 32); - int err = socket_listen(&un->sock, backlog); - if (err != IO_DONE) { - lua_pushnil(L); - lua_pushstring(L, socket_strerror(err)); - return 2; - } - /* turn master object into a server object */ - auxiliar_setclass(L, "unixtcp{server}", 1); - lua_pushnumber(L, 1); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Shuts the connection down partially -\*-------------------------------------------------------------------------*/ -static int meth_shutdown(lua_State *L) -{ - /* SHUT_RD, SHUT_WR, SHUT_RDWR have the value 0, 1, 2, so we can use method index directly */ - static const char* methods[] = { "receive", "send", "both", NULL }; - p_unix tcp = (p_unix) auxiliar_checkclass(L, "unixtcp{client}", 1); - int how = luaL_checkoption(L, 2, "both", methods); - socket_shutdown(&tcp->sock, how); - lua_pushnumber(L, 1); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Just call tm methods -\*-------------------------------------------------------------------------*/ -static int meth_settimeout(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkgroup(L, "unixtcp{any}", 1); - return timeout_meth_settimeout(L, &un->tm); -} - -/*=========================================================================*\ -* Library functions -\*=========================================================================*/ -/*-------------------------------------------------------------------------*\ -* Creates a master unixtcp object -\*-------------------------------------------------------------------------*/ -static int global_create(lua_State *L) { - t_socket sock; - int err = socket_create(&sock, AF_UNIX, SOCK_STREAM, 0); - /* try to allocate a system socket */ - if (err == IO_DONE) { - /* allocate unixtcp object */ - p_unix un = (p_unix) lua_newuserdata(L, sizeof(t_unix)); - /* set its type as master object */ - auxiliar_setclass(L, "unixtcp{master}", -1); - /* initialize remaining structure fields */ - socket_setnonblocking(&sock); - un->sock = sock; - io_init(&un->io, (p_send) socket_send, (p_recv) socket_recv, - (p_error) socket_ioerror, &un->sock); - timeout_init(&un->tm, -1, -1); - buffer_init(&un->buf, &un->io, &un->tm); - return 1; - } else { - lua_pushnil(L); - lua_pushstring(L, socket_strerror(err)); - return 2; - } -} diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/unixtcp.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/unixtcp.h deleted file mode 100644 index 0eababce..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/unixtcp.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef UNIXTCP_H -#define UNIXTCP_H -/*=========================================================================*\ -* UNIX TCP object -* LuaSocket toolkit -* -* The unixtcp.h module is basicly a glue that puts together modules buffer.h, -* timeout.h socket.h and inet.h to provide the LuaSocket UNIX TCP (AF_UNIX, -* SOCK_STREAM) support. -* -* Three classes are defined: master, client and server. The master class is -* a newly created unixtcp object, that has not been bound or connected. Server -* objects are unixtcp objects bound to some local address. Client objects are -* unixtcp objects either connected to some address or returned by the accept -* method of a server object. -\*=========================================================================*/ -#include "unix.h" - -int unixtcp_open(lua_State *L); - -#endif /* UNIXTCP_H */ diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/unixudp.c b/love/src/jni/love/src/libraries/luasocket/libluasocket/unixudp.c deleted file mode 100644 index 0e0a19ab..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/unixudp.c +++ /dev/null @@ -1,407 +0,0 @@ -/*=========================================================================*\ -* Unix domain socket udp submodule -* LuaSocket toolkit -\*=========================================================================*/ -#include -#include - -#include "lua.h" -#include "lauxlib.h" -#include "compat.h" - -#include "auxiliar.h" -#include "socket.h" -#include "options.h" -#include "unix.h" -#include - -#define UNIXUDP_DATAGRAMSIZE 8192 - -/*=========================================================================*\ -* Internal function prototypes -\*=========================================================================*/ -static int global_create(lua_State *L); -static int meth_connect(lua_State *L); -static int meth_bind(lua_State *L); -static int meth_send(lua_State *L); -static int meth_receive(lua_State *L); -static int meth_close(lua_State *L); -static int meth_setoption(lua_State *L); -static int meth_settimeout(lua_State *L); -static int meth_gettimeout(lua_State *L); -static int meth_getfd(lua_State *L); -static int meth_setfd(lua_State *L); -static int meth_dirty(lua_State *L); -static int meth_receivefrom(lua_State *L); -static int meth_sendto(lua_State *L); -static int meth_getsockname(lua_State *L); - -static const char *unixudp_tryconnect(p_unix un, const char *path); -static const char *unixudp_trybind(p_unix un, const char *path); - -/* unixudp object methods */ -static luaL_Reg unixudp_methods[] = { - {"__gc", meth_close}, - {"__tostring", auxiliar_tostring}, - {"bind", meth_bind}, - {"close", meth_close}, - {"connect", meth_connect}, - {"dirty", meth_dirty}, - {"getfd", meth_getfd}, - {"send", meth_send}, - {"sendto", meth_sendto}, - {"receive", meth_receive}, - {"receivefrom", meth_receivefrom}, - {"setfd", meth_setfd}, - {"setoption", meth_setoption}, - {"setpeername", meth_connect}, - {"setsockname", meth_bind}, - {"getsockname", meth_getsockname}, - {"settimeout", meth_settimeout}, - {"gettimeout", meth_gettimeout}, - {NULL, NULL} -}; - -/* socket option handlers */ -static t_opt optset[] = { - {"reuseaddr", opt_set_reuseaddr}, - {NULL, NULL} -}; - -/* functions in library namespace */ -static luaL_Reg func[] = { - {"udp", global_create}, - {NULL, NULL} -}; - -/*-------------------------------------------------------------------------*\ -* Initializes module -\*-------------------------------------------------------------------------*/ -int unixudp_open(lua_State *L) -{ - /* create classes */ - auxiliar_newclass(L, "unixudp{connected}", unixudp_methods); - auxiliar_newclass(L, "unixudp{unconnected}", unixudp_methods); - /* create class groups */ - auxiliar_add2group(L, "unixudp{connected}", "unixudp{any}"); - auxiliar_add2group(L, "unixudp{unconnected}", "unixudp{any}"); - auxiliar_add2group(L, "unixudp{connected}", "select{able}"); - auxiliar_add2group(L, "unixudp{unconnected}", "select{able}"); - - luaL_setfuncs(L, func, 0); - return 0; -} - -/*=========================================================================*\ -* Lua methods -\*=========================================================================*/ -static const char *unixudp_strerror(int err) -{ - /* a 'closed' error on an unconnected means the target address was not - * accepted by the transport layer */ - if (err == IO_CLOSED) return "refused"; - else return socket_strerror(err); -} - -static int meth_send(lua_State *L) -{ - p_unix un = (p_unix) auxiliar_checkclass(L, "unixudp{connected}", 1); - p_timeout tm = &un->tm; - size_t count, sent = 0; - int err; - const char *data = luaL_checklstring(L, 2, &count); - timeout_markstart(tm); - err = socket_send(&un->sock, data, count, &sent, tm); - if (err != IO_DONE) { - lua_pushnil(L); - lua_pushstring(L, unixudp_strerror(err)); - return 2; - } - lua_pushnumber(L, (lua_Number) sent); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Send data through unconnected unixudp socket -\*-------------------------------------------------------------------------*/ -static int meth_sendto(lua_State *L) -{ - p_unix un = (p_unix) auxiliar_checkclass(L, "unixudp{unconnected}", 1); - size_t count, sent = 0; - const char *data = luaL_checklstring(L, 2, &count); - const char *path = luaL_checkstring(L, 3); - p_timeout tm = &un->tm; - int err; - struct sockaddr_un remote; - size_t len = strlen(path); - - if (len >= sizeof(remote.sun_path)) { - lua_pushnil(L); - lua_pushstring(L, "path too long"); - return 2; - } - - memset(&remote, 0, sizeof(remote)); - strcpy(remote.sun_path, path); - remote.sun_family = AF_UNIX; - timeout_markstart(tm); -#ifdef UNIX_HAS_SUN_LEN - remote.sun_len = sizeof(remote.sun_family) + sizeof(remote.sun_len) - + len + 1; - err = socket_sendto(&un->sock, data, count, &sent, (SA *) &remote, remote.sun_len, tm); -#else - err = socket_sendto(&un->sock, data, count, &sent, (SA *) &remote, - sizeof(remote.sun_family) + len, tm); -#endif - if (err != IO_DONE) { - lua_pushnil(L); - lua_pushstring(L, unixudp_strerror(err)); - return 2; - } - lua_pushnumber(L, (lua_Number) sent); - return 1; -} - -static int meth_receive(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkgroup(L, "unixudp{any}", 1); - char buf[UNIXUDP_DATAGRAMSIZE]; - size_t got, wanted = (size_t) luaL_optnumber(L, 2, sizeof(buf)); - char *dgram = wanted > sizeof(buf)? (char *) malloc(wanted): buf; - int err; - p_timeout tm = &un->tm; - timeout_markstart(tm); - if (!dgram) { - lua_pushnil(L); - lua_pushliteral(L, "out of memory"); - return 2; - } - err = socket_recv(&un->sock, dgram, wanted, &got, tm); - /* Unlike TCP, recv() of zero is not closed, but a zero-length packet. */ - if (err != IO_DONE && err != IO_CLOSED) { - lua_pushnil(L); - lua_pushstring(L, unixudp_strerror(err)); - if (wanted > sizeof(buf)) free(dgram); - return 2; - } - lua_pushlstring(L, dgram, got); - if (wanted > sizeof(buf)) free(dgram); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Receives data and sender from a UDP socket -\*-------------------------------------------------------------------------*/ -static int meth_receivefrom(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkclass(L, "unixudp{unconnected}", 1); - char buf[UNIXUDP_DATAGRAMSIZE]; - size_t got, wanted = (size_t) luaL_optnumber(L, 2, sizeof(buf)); - char *dgram = wanted > sizeof(buf)? (char *) malloc(wanted): buf; - struct sockaddr_un addr; - socklen_t addr_len = sizeof(addr); - int err; - p_timeout tm = &un->tm; - timeout_markstart(tm); - if (!dgram) { - lua_pushnil(L); - lua_pushliteral(L, "out of memory"); - return 2; - } - err = socket_recvfrom(&un->sock, dgram, wanted, &got, (SA *) &addr, - &addr_len, tm); - /* Unlike TCP, recv() of zero is not closed, but a zero-length packet. */ - if (err != IO_DONE && err != IO_CLOSED) { - lua_pushnil(L); - lua_pushstring(L, unixudp_strerror(err)); - if (wanted > sizeof(buf)) free(dgram); - return 2; - } - - lua_pushlstring(L, dgram, got); - /* the path may be empty, when client send without bind */ - lua_pushstring(L, addr.sun_path); - if (wanted > sizeof(buf)) free(dgram); - return 2; -} - -/*-------------------------------------------------------------------------*\ -* Just call option handler -\*-------------------------------------------------------------------------*/ -static int meth_setoption(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkgroup(L, "unixudp{any}", 1); - return opt_meth_setoption(L, optset, &un->sock); -} - -/*-------------------------------------------------------------------------*\ -* Select support methods -\*-------------------------------------------------------------------------*/ -static int meth_getfd(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkgroup(L, "unixudp{any}", 1); - lua_pushnumber(L, (int) un->sock); - return 1; -} - -/* this is very dangerous, but can be handy for those that are brave enough */ -static int meth_setfd(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkgroup(L, "unixudp{any}", 1); - un->sock = (t_socket) luaL_checknumber(L, 2); - return 0; -} - -static int meth_dirty(lua_State *L) { - p_unix un = (p_unix) auxiliar_checkgroup(L, "unixudp{any}", 1); - (void) un; - lua_pushboolean(L, 0); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Binds an object to an address -\*-------------------------------------------------------------------------*/ -static const char *unixudp_trybind(p_unix un, const char *path) { - struct sockaddr_un local; - size_t len = strlen(path); - int err; - if (len >= sizeof(local.sun_path)) return "path too long"; - memset(&local, 0, sizeof(local)); - strcpy(local.sun_path, path); - local.sun_family = AF_UNIX; -#ifdef UNIX_HAS_SUN_LEN - local.sun_len = sizeof(local.sun_family) + sizeof(local.sun_len) - + len + 1; - err = socket_bind(&un->sock, (SA *) &local, local.sun_len); - -#else - err = socket_bind(&un->sock, (SA *) &local, - sizeof(local.sun_family) + len); -#endif - if (err != IO_DONE) socket_destroy(&un->sock); - return socket_strerror(err); -} - -static int meth_bind(lua_State *L) -{ - p_unix un = (p_unix) auxiliar_checkclass(L, "unixudp{unconnected}", 1); - const char *path = luaL_checkstring(L, 2); - const char *err = unixudp_trybind(un, path); - if (err) { - lua_pushnil(L); - lua_pushstring(L, err); - return 2; - } - lua_pushnumber(L, 1); - return 1; -} - -static int meth_getsockname(lua_State *L) -{ - p_unix un = (p_unix) auxiliar_checkgroup(L, "unixudp{any}", 1); - struct sockaddr_un peer = {0}; - socklen_t peer_len = sizeof(peer); - - if (getsockname(un->sock, (SA *) &peer, &peer_len) < 0) { - lua_pushnil(L); - lua_pushstring(L, socket_strerror(errno)); - return 2; - } - - lua_pushstring(L, peer.sun_path); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Turns a master unixudp object into a client object. -\*-------------------------------------------------------------------------*/ -static const char *unixudp_tryconnect(p_unix un, const char *path) -{ - struct sockaddr_un remote; - int err; - size_t len = strlen(path); - if (len >= sizeof(remote.sun_path)) return "path too long"; - memset(&remote, 0, sizeof(remote)); - strcpy(remote.sun_path, path); - remote.sun_family = AF_UNIX; - timeout_markstart(&un->tm); -#ifdef UNIX_HAS_SUN_LEN - remote.sun_len = sizeof(remote.sun_family) + sizeof(remote.sun_len) - + len + 1; - err = socket_connect(&un->sock, (SA *) &remote, remote.sun_len, &un->tm); -#else - err = socket_connect(&un->sock, (SA *) &remote, - sizeof(remote.sun_family) + len, &un->tm); -#endif - if (err != IO_DONE) socket_destroy(&un->sock); - return socket_strerror(err); -} - -static int meth_connect(lua_State *L) -{ - p_unix un = (p_unix) auxiliar_checkgroup(L, "unixudp{any}", 1); - const char *path = luaL_checkstring(L, 2); - const char *err = unixudp_tryconnect(un, path); - if (err) { - lua_pushnil(L); - lua_pushstring(L, err); - return 2; - } - /* turn unconnected object into a connected object */ - auxiliar_setclass(L, "unixudp{connected}", 1); - lua_pushnumber(L, 1); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Closes socket used by object -\*-------------------------------------------------------------------------*/ -static int meth_close(lua_State *L) -{ - p_unix un = (p_unix) auxiliar_checkgroup(L, "unixudp{any}", 1); - socket_destroy(&un->sock); - lua_pushnumber(L, 1); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Just call tm methods -\*-------------------------------------------------------------------------*/ -static int meth_settimeout(lua_State *L) -{ - p_unix un = (p_unix) auxiliar_checkgroup(L, "unixudp{any}", 1); - return timeout_meth_settimeout(L, &un->tm); -} - -static int meth_gettimeout(lua_State *L) -{ - p_unix un = (p_unix) auxiliar_checkgroup(L, "unixudp{any}", 1); - return timeout_meth_gettimeout(L, &un->tm); -} - -/*=========================================================================*\ -* Library functions -\*=========================================================================*/ -/*-------------------------------------------------------------------------*\ -* Creates a master unixudp object -\*-------------------------------------------------------------------------*/ -static int global_create(lua_State *L) -{ - t_socket sock; - int err = socket_create(&sock, AF_UNIX, SOCK_DGRAM, 0); - /* try to allocate a system socket */ - if (err == IO_DONE) { - /* allocate unixudp object */ - p_unix un = (p_unix) lua_newuserdata(L, sizeof(t_unix)); - /* set its type as master object */ - auxiliar_setclass(L, "unixudp{unconnected}", -1); - /* initialize remaining structure fields */ - socket_setnonblocking(&sock); - un->sock = sock; - io_init(&un->io, (p_send) socket_send, (p_recv) socket_recv, - (p_error) socket_ioerror, &un->sock); - timeout_init(&un->tm, -1, -1); - buffer_init(&un->buf, &un->io, &un->tm); - return 1; - } else { - lua_pushnil(L); - lua_pushstring(L, socket_strerror(err)); - return 2; - } -} diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/unixudp.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/unixudp.h deleted file mode 100644 index ccfdc075..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/unixudp.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef UNIXUDP_H -#define UNIXUDP_H -/*=========================================================================*\ -* UDP object -* LuaSocket toolkit -* -* The udp.h module provides LuaSocket with support for UDP protocol -* (AF_INET, SOCK_DGRAM). -* -* Two classes are defined: connected and unconnected. UDP objects are -* originally unconnected. They can be "connected" to a given address -* with a call to the setpeername function. The same function can be used to -* break the connection. -\*=========================================================================*/ - -#include "unix.h" - -int unixudp_open(lua_State *L); - -#endif /* UNIXUDP_H */ diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/url.lua b/love/src/jni/love/src/libraries/luasocket/libluasocket/url.lua deleted file mode 100644 index 3f1359c8..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/url.lua +++ /dev/null @@ -1,308 +0,0 @@ ------------------------------------------------------------------------------ --- URI parsing, composition and relative URL resolution --- LuaSocket toolkit. --- Author: Diego Nehab ------------------------------------------------------------------------------ - ------------------------------------------------------------------------------ --- Declare module ------------------------------------------------------------------------------ -local string = require("string") -local base = _G -local table = require("table") -local socket = require("socket") - -socket.url = {} -local _M = socket.url - ------------------------------------------------------------------------------ --- Module version ------------------------------------------------------------------------------ -_M._VERSION = "URL 1.0.3" - ------------------------------------------------------------------------------ --- Encodes a string into its escaped hexadecimal representation --- Input --- s: binary string to be encoded --- Returns --- escaped representation of string binary ------------------------------------------------------------------------------ -function _M.escape(s) - return (string.gsub(s, "([^A-Za-z0-9_])", function(c) - return string.format("%%%02x", string.byte(c)) - end)) -end - ------------------------------------------------------------------------------ --- Protects a path segment, to prevent it from interfering with the --- url parsing. --- Input --- s: binary string to be encoded --- Returns --- escaped representation of string binary ------------------------------------------------------------------------------ -local function make_set(t) - local s = {} - for i,v in base.ipairs(t) do - s[t[i]] = 1 - end - return s -end - --- these are allowed within a path segment, along with alphanum --- other characters must be escaped -local segment_set = make_set { - "-", "_", ".", "!", "~", "*", "'", "(", - ")", ":", "@", "&", "=", "+", "$", ",", -} - -local function protect_segment(s) - return string.gsub(s, "([^A-Za-z0-9_])", function (c) - if segment_set[c] then return c - else return string.format("%%%02x", string.byte(c)) end - end) -end - ------------------------------------------------------------------------------ --- Unencodes a escaped hexadecimal string into its binary representation --- Input --- s: escaped hexadecimal string to be unencoded --- Returns --- unescaped binary representation of escaped hexadecimal binary ------------------------------------------------------------------------------ -function _M.unescape(s) - return (string.gsub(s, "%%(%x%x)", function(hex) - return string.char(base.tonumber(hex, 16)) - end)) -end - ------------------------------------------------------------------------------ --- Builds a path from a base path and a relative path --- Input --- base_path --- relative_path --- Returns --- corresponding absolute path ------------------------------------------------------------------------------ -local function absolute_path(base_path, relative_path) - if string.sub(relative_path, 1, 1) == "/" then return relative_path end - local path = string.gsub(base_path, "[^/]*$", "") - path = path .. relative_path - path = string.gsub(path, "([^/]*%./)", function (s) - if s ~= "./" then return s else return "" end - end) - path = string.gsub(path, "/%.$", "/") - local reduced - while reduced ~= path do - reduced = path - path = string.gsub(reduced, "([^/]*/%.%./)", function (s) - if s ~= "../../" then return "" else return s end - end) - end - path = string.gsub(reduced, "([^/]*/%.%.)$", function (s) - if s ~= "../.." then return "" else return s end - end) - return path -end - ------------------------------------------------------------------------------ --- Parses a url and returns a table with all its parts according to RFC 2396 --- The following grammar describes the names given to the URL parts --- ::= :///;?# --- ::= @: --- ::= [:] --- :: = {/} --- Input --- url: uniform resource locator of request --- default: table with default values for each field --- Returns --- table with the following fields, where RFC naming conventions have --- been preserved: --- scheme, authority, userinfo, user, password, host, port, --- path, params, query, fragment --- Obs: --- the leading '/' in {/} is considered part of ------------------------------------------------------------------------------ -function _M.parse(url, default) - -- initialize default parameters - local parsed = {} - for i,v in base.pairs(default or parsed) do parsed[i] = v end - -- empty url is parsed to nil - if not url or url == "" then return nil, "invalid url" end - -- remove whitespace - -- url = string.gsub(url, "%s", "") - -- get fragment - url = string.gsub(url, "#(.*)$", function(f) - parsed.fragment = f - return "" - end) - -- get scheme - url = string.gsub(url, "^([%w][%w%+%-%.]*)%:", - function(s) parsed.scheme = s; return "" end) - -- get authority - url = string.gsub(url, "^//([^/]*)", function(n) - parsed.authority = n - return "" - end) - -- get query string - url = string.gsub(url, "%?(.*)", function(q) - parsed.query = q - return "" - end) - -- get params - url = string.gsub(url, "%;(.*)", function(p) - parsed.params = p - return "" - end) - -- path is whatever was left - if url ~= "" then parsed.path = url end - local authority = parsed.authority - if not authority then return parsed end - authority = string.gsub(authority,"^([^@]*)@", - function(u) parsed.userinfo = u; return "" end) - authority = string.gsub(authority, ":([^:%]]*)$", - function(p) parsed.port = p; return "" end) - if authority ~= "" then - -- IPv6? - parsed.host = string.match(authority, "^%[(.+)%]$") or authority - end - local userinfo = parsed.userinfo - if not userinfo then return parsed end - userinfo = string.gsub(userinfo, ":([^:]*)$", - function(p) parsed.password = p; return "" end) - parsed.user = userinfo - return parsed -end - ------------------------------------------------------------------------------ --- Rebuilds a parsed URL from its components. --- Components are protected if any reserved or unallowed characters are found --- Input --- parsed: parsed URL, as returned by parse --- Returns --- a stringing with the corresponding URL ------------------------------------------------------------------------------ -function _M.build(parsed) - local ppath = _M.parse_path(parsed.path or "") - local url = _M.build_path(ppath) - if parsed.params then url = url .. ";" .. parsed.params end - if parsed.query then url = url .. "?" .. parsed.query end - local authority = parsed.authority - if parsed.host then - authority = parsed.host - if string.find(authority, ":") then -- IPv6? - authority = "[" .. authority .. "]" - end - if parsed.port then authority = authority .. ":" .. parsed.port end - local userinfo = parsed.userinfo - if parsed.user then - userinfo = parsed.user - if parsed.password then - userinfo = userinfo .. ":" .. parsed.password - end - end - if userinfo then authority = userinfo .. "@" .. authority end - end - if authority then url = "//" .. authority .. url end - if parsed.scheme then url = parsed.scheme .. ":" .. url end - if parsed.fragment then url = url .. "#" .. parsed.fragment end - -- url = string.gsub(url, "%s", "") - return url -end - ------------------------------------------------------------------------------ --- Builds a absolute URL from a base and a relative URL according to RFC 2396 --- Input --- base_url --- relative_url --- Returns --- corresponding absolute url ------------------------------------------------------------------------------ -function _M.absolute(base_url, relative_url) - local base_parsed - if base.type(base_url) == "table" then - base_parsed = base_url - base_url = _M.build(base_parsed) - else - base_parsed = _M.parse(base_url) - end - local relative_parsed = _M.parse(relative_url) - if not base_parsed then return relative_url - elseif not relative_parsed then return base_url - elseif relative_parsed.scheme then return relative_url - else - relative_parsed.scheme = base_parsed.scheme - if not relative_parsed.authority then - relative_parsed.authority = base_parsed.authority - if not relative_parsed.path then - relative_parsed.path = base_parsed.path - if not relative_parsed.params then - relative_parsed.params = base_parsed.params - if not relative_parsed.query then - relative_parsed.query = base_parsed.query - end - end - else - relative_parsed.path = absolute_path(base_parsed.path or "", - relative_parsed.path) - end - end - return _M.build(relative_parsed) - end -end - ------------------------------------------------------------------------------ --- Breaks a path into its segments, unescaping the segments --- Input --- path --- Returns --- segment: a table with one entry per segment ------------------------------------------------------------------------------ -function _M.parse_path(path) - local parsed = {} - path = path or "" - --path = string.gsub(path, "%s", "") - string.gsub(path, "([^/]+)", function (s) table.insert(parsed, s) end) - for i = 1, #parsed do - parsed[i] = _M.unescape(parsed[i]) - end - if string.sub(path, 1, 1) == "/" then parsed.is_absolute = 1 end - if string.sub(path, -1, -1) == "/" then parsed.is_directory = 1 end - return parsed -end - ------------------------------------------------------------------------------ --- Builds a path component from its segments, escaping protected characters. --- Input --- parsed: path segments --- unsafe: if true, segments are not protected before path is built --- Returns --- path: corresponding path stringing ------------------------------------------------------------------------------ -function _M.build_path(parsed, unsafe) - local path = "" - local n = #parsed - if unsafe then - for i = 1, n-1 do - path = path .. parsed[i] - path = path .. "/" - end - if n > 0 then - path = path .. parsed[n] - if parsed.is_directory then path = path .. "/" end - end - else - for i = 1, n-1 do - path = path .. protect_segment(parsed[i]) - path = path .. "/" - end - if n > 0 then - path = path .. protect_segment(parsed[n]) - if parsed.is_directory then path = path .. "/" end - end - end - if parsed.is_absolute then path = "/" .. path end - return path -end - -return _M diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/url.lua.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/url.lua.h deleted file mode 100644 index 25147214..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/url.lua.h +++ /dev/null @@ -1,567 +0,0 @@ -/* code automatically generated by bin2c -- DO NOT EDIT */ -{ -/* #include'ing this file in a C program is equivalent to calling - if (luaL_loadfile(L,"url.lua")==0) lua_call(L, 0, LUA_MULTRET); -*/ -/* url.lua */ -static const unsigned char B1[]={ - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, - 32, 85, 82, 73, 32,112, 97,114,115,105,110,103, 44, 32, 99,111,109,112,111,115, -105,116,105,111,110, 32, 97,110,100, 32,114,101,108, 97,116,105,118,101, 32, 85, - 82, 76, 32,114,101,115,111,108,117,116,105,111,110, 10, 45, 45, 32, 76,117, 97, - 83,111, 99,107,101,116, 32,116,111,111,108,107,105,116, 46, 10, 45, 45, 32, 65, -117,116,104,111,114, 58, 32, 68,105,101,103,111, 32, 78,101,104, 97, 98, 10, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 10, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 68, -101, 99,108, 97,114,101, 32,109,111,100,117,108,101, 10, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10,108,111, 99, 97,108, 32,115,116, -114,105,110,103, 32, 61, 32,114,101,113,117,105,114,101, 40, 34,115,116,114,105, -110,103, 34, 41, 10,108,111, 99, 97,108, 32, 98, 97,115,101, 32, 61, 32, 95, 71, - 10,108,111, 99, 97,108, 32,116, 97, 98,108,101, 32, 61, 32,114,101,113,117,105, -114,101, 40, 34,116, 97, 98,108,101, 34, 41, 10,108,111, 99, 97,108, 32,115,111, - 99,107,101,116, 32, 61, 32,114,101,113,117,105,114,101, 40, 34,115,111, 99,107, -101,116, 34, 41, 10, 10,115,111, 99,107,101,116, 46,117,114,108, 32, 61, 32,123, -125, 10,108,111, 99, 97,108, 32, 95, 77, 32, 61, 32,115,111, 99,107,101,116, 46, -117,114,108, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 10, 45, 45, 32, 77,111,100,117,108,101, 32,118,101,114,115,105,111,110, - 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 95, - 77, 46, 95, 86, 69, 82, 83, 73, 79, 78, 32, 61, 32, 34, 85, 82, 76, 32, 49, 46, - 48, 46, 51, 34, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 10, 45, 45, 32, 69,110, 99,111,100,101,115, 32, 97, 32,115,116,114, -105,110,103, 32,105,110,116,111, 32,105,116,115, 32,101,115, 99, 97,112,101,100, - 32,104,101,120, 97,100,101, 99,105,109, 97,108, 32,114,101,112,114,101,115,101, -110,116, 97,116,105,111,110, 10, 45, 45, 32, 73,110,112,117,116, 10, 45, 45, 32, - 32, 32,115, 58, 32, 98,105,110, 97,114,121, 32,115,116,114,105,110,103, 32,116, -111, 32, 98,101, 32,101,110, 99,111,100,101,100, 10, 45, 45, 32, 82,101,116,117, -114,110,115, 10, 45, 45, 32, 32, 32,101,115, 99, 97,112,101,100, 32,114,101,112, -114,101,115,101,110,116, 97,116,105,111,110, 32,111,102, 32,115,116,114,105,110, -103, 32, 98,105,110, 97,114,121, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 10,102,117,110, 99,116,105,111,110, 32, 95, 77, 46,101, -115, 99, 97,112,101, 40,115, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32, - 40,115,116,114,105,110,103, 46,103,115,117, 98, 40,115, 44, 32, 34, 40, 91, 94, - 65, 45, 90, 97, 45,122, 48, 45, 57, 95, 93, 41, 34, 44, 32,102,117,110, 99,116, -105,111,110, 40, 99, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114, -110, 32,115,116,114,105,110,103, 46,102,111,114,109, 97,116, 40, 34, 37, 37, 37, - 48, 50,120, 34, 44, 32,115,116,114,105,110,103, 46, 98,121,116,101, 40, 99, 41, - 41, 10, 32, 32, 32, 32,101,110,100, 41, 41, 10,101,110,100, 10, 10, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 80,114, -111,116,101, 99,116,115, 32, 97, 32,112, 97,116,104, 32,115,101,103,109,101,110, -116, 44, 32,116,111, 32,112,114,101,118,101,110,116, 32,105,116, 32,102,114,111, -109, 32,105,110,116,101,114,102,101,114,105,110,103, 32,119,105,116,104, 32,116, -104,101, 10, 45, 45, 32,117,114,108, 32,112, 97,114,115,105,110,103, 46, 10, 45, - 45, 32, 73,110,112,117,116, 10, 45, 45, 32, 32, 32,115, 58, 32, 98,105,110, 97, -114,121, 32,115,116,114,105,110,103, 32,116,111, 32, 98,101, 32,101,110, 99,111, -100,101,100, 10, 45, 45, 32, 82,101,116,117,114,110,115, 10, 45, 45, 32, 32, 32, -101,115, 99, 97,112,101,100, 32,114,101,112,114,101,115,101,110,116, 97,116,105, -111,110, 32,111,102, 32,115,116,114,105,110,103, 32, 98,105,110, 97,114,121, 10, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10,108,111, - 99, 97,108, 32,102,117,110, 99,116,105,111,110, 32,109, 97,107,101, 95,115,101, -116, 40,116, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,115, 32, 61, 32,123, -125, 10, 32, 32, 32, 32,102,111,114, 32,105, 44,118, 32,105,110, 32, 98, 97,115, -101, 46,105,112, 97,105,114,115, 40,116, 41, 32,100,111, 10, 32, 32, 32, 32, 32, - 32, 32, 32,115, 91,116, 91,105, 93, 93, 32, 61, 32, 49, 10, 32, 32, 32, 32,101, -110,100, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,115, 10,101,110,100, 10, - 10, 45, 45, 32,116,104,101,115,101, 32, 97,114,101, 32, 97,108,108,111,119,101, -100, 32,119,105,116,104,105,110,103, 32, 97, 32,112, 97,116,104, 32,115,101,103, -109,101,110,116, 44, 32, 97,108,111,110,103, 32,119,105,116,104, 32, 97,108,112, -104, 97,110,117,109, 10, 45, 45, 32,111,116,104,101,114, 32, 99,104, 97,114, 97, - 99,116,101,114,115, 32,109,117,115,116, 32, 98,101, 32,101,115, 99, 97,112,101, -100, 10,108,111, 99, 97,108, 32,115,101,103,109,101,110,116, 95,115,101,116, 32, - 61, 32,109, 97,107,101, 95,115,101,116, 32,123, 10, 32, 32, 32, 32, 34, 45, 34, - 44, 32, 34, 95, 34, 44, 32, 34, 46, 34, 44, 32, 34, 33, 34, 44, 32, 34,126, 34, - 44, 32, 34, 42, 34, 44, 32, 34, 39, 34, 44, 32, 34, 40, 34, 44, 10, 32, 32, 32, - 32, 34, 41, 34, 44, 32, 34, 58, 34, 44, 32, 34, 64, 34, 44, 32, 34, 38, 34, 44, - 32, 34, 61, 34, 44, 32, 34, 43, 34, 44, 32, 34, 36, 34, 44, 32, 34, 44, 34, 44, - 10,125, 10, 10,108,111, 99, 97,108, 32,102,117,110, 99,116,105,111,110, 32,112, -114,111,116,101, 99,116, 95,115,101,103,109,101,110,116, 40,115, 41, 10, 32, 32, - 32, 32,114,101,116,117,114,110, 32,115,116,114,105,110,103, 46,103,115,117, 98, - 40,115, 44, 32, 34, 40, 91, 94, 65, 45, 90, 97, 45,122, 48, 45, 57, 95, 93, 41, - 34, 44, 32,102,117,110, 99,116,105,111,110, 32, 40, 99, 41, 10, 32, 32, 32, 32, - 32, 32, 32, 32,105,102, 32,115,101,103,109,101,110,116, 95,115,101,116, 91, 99, - 93, 32,116,104,101,110, 32,114,101,116,117,114,110, 32, 99, 10, 32, 32, 32, 32, - 32, 32, 32, 32,101,108,115,101, 32,114,101,116,117,114,110, 32,115,116,114,105, -110,103, 46,102,111,114,109, 97,116, 40, 34, 37, 37, 37, 48, 50,120, 34, 44, 32, -115,116,114,105,110,103, 46, 98,121,116,101, 40, 99, 41, 41, 32,101,110,100, 10, - 32, 32, 32, 32,101,110,100, 41, 10,101,110,100, 10, 10, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 85,110,101,110, 99, -111,100,101,115, 32, 97, 32,101,115, 99, 97,112,101,100, 32,104,101,120, 97,100, -101, 99,105,109, 97,108, 32,115,116,114,105,110,103, 32,105,110,116,111, 32,105, -116,115, 32, 98,105,110, 97,114,121, 32,114,101,112,114,101,115,101,110,116, 97, -116,105,111,110, 10, 45, 45, 32, 73,110,112,117,116, 10, 45, 45, 32, 32, 32,115, - 58, 32,101,115, 99, 97,112,101,100, 32,104,101,120, 97,100,101, 99,105,109, 97, -108, 32,115,116,114,105,110,103, 32,116,111, 32, 98,101, 32,117,110,101,110, 99, -111,100,101,100, 10, 45, 45, 32, 82,101,116,117,114,110,115, 10, 45, 45, 32, 32, - 32,117,110,101,115, 99, 97,112,101,100, 32, 98,105,110, 97,114,121, 32,114,101, -112,114,101,115,101,110,116, 97,116,105,111,110, 32,111,102, 32,101,115, 99, 97, -112,101,100, 32,104,101,120, 97,100,101, 99,105,109, 97,108, 32, 32, 98,105,110, - 97,114,121, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 10,102,117,110, 99,116,105,111,110, 32, 95, 77, 46,117,110,101,115, 99, 97, -112,101, 40,115, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32, 40,115,116, -114,105,110,103, 46,103,115,117, 98, 40,115, 44, 32, 34, 37, 37, 40, 37,120, 37, -120, 41, 34, 44, 32,102,117,110, 99,116,105,111,110, 40,104,101,120, 41, 10, 32, - 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114,110, 32,115,116,114,105,110,103, - 46, 99,104, 97,114, 40, 98, 97,115,101, 46,116,111,110,117,109, 98,101,114, 40, -104,101,120, 44, 32, 49, 54, 41, 41, 10, 32, 32, 32, 32,101,110,100, 41, 41, 10, -101,110,100, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 10, 45, 45, 32, 66,117,105,108,100,115, 32, 97, 32,112, 97,116,104, 32, -102,114,111,109, 32, 97, 32, 98, 97,115,101, 32,112, 97,116,104, 32, 97,110,100, - 32, 97, 32,114,101,108, 97,116,105,118,101, 32,112, 97,116,104, 10, 45, 45, 32, - 73,110,112,117,116, 10, 45, 45, 32, 32, 32, 98, 97,115,101, 95,112, 97,116,104, - 10, 45, 45, 32, 32, 32,114,101,108, 97,116,105,118,101, 95,112, 97,116,104, 10, - 45, 45, 32, 82,101,116,117,114,110,115, 10, 45, 45, 32, 32, 32, 99,111,114,114, -101,115,112,111,110,100,105,110,103, 32, 97, 98,115,111,108,117,116,101, 32,112, - 97,116,104, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 10,108,111, 99, 97,108, 32,102,117,110, 99,116,105,111,110, 32, 97, 98,115, -111,108,117,116,101, 95,112, 97,116,104, 40, 98, 97,115,101, 95,112, 97,116,104, - 44, 32,114,101,108, 97,116,105,118,101, 95,112, 97,116,104, 41, 10, 32, 32, 32, - 32,105,102, 32,115,116,114,105,110,103, 46,115,117, 98, 40,114,101,108, 97,116, -105,118,101, 95,112, 97,116,104, 44, 32, 49, 44, 32, 49, 41, 32, 61, 61, 32, 34, - 47, 34, 32,116,104,101,110, 32,114,101,116,117,114,110, 32,114,101,108, 97,116, -105,118,101, 95,112, 97,116,104, 32,101,110,100, 10, 32, 32, 32, 32,108,111, 99, - 97,108, 32,112, 97,116,104, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, - 98, 40, 98, 97,115,101, 95,112, 97,116,104, 44, 32, 34, 91, 94, 47, 93, 42, 36, - 34, 44, 32, 34, 34, 41, 10, 32, 32, 32, 32,112, 97,116,104, 32, 61, 32,112, 97, -116,104, 32, 46, 46, 32,114,101,108, 97,116,105,118,101, 95,112, 97,116,104, 10, - 32, 32, 32, 32,112, 97,116,104, 32, 61, 32,115,116,114,105,110,103, 46,103,115, -117, 98, 40,112, 97,116,104, 44, 32, 34, 40, 91, 94, 47, 93, 42, 37, 46, 47, 41, - 34, 44, 32,102,117,110, 99,116,105,111,110, 32, 40,115, 41, 10, 32, 32, 32, 32, - 32, 32, 32, 32,105,102, 32,115, 32,126, 61, 32, 34, 46, 47, 34, 32,116,104,101, -110, 32,114,101,116,117,114,110, 32,115, 32,101,108,115,101, 32,114,101,116,117, -114,110, 32, 34, 34, 32,101,110,100, 10, 32, 32, 32, 32,101,110,100, 41, 10, 32, - 32, 32, 32,112, 97,116,104, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, - 98, 40,112, 97,116,104, 44, 32, 34, 47, 37, 46, 36, 34, 44, 32, 34, 47, 34, 41, - 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,114,101,100,117, 99,101,100, 10, 32, - 32, 32, 32,119,104,105,108,101, 32,114,101,100,117, 99,101,100, 32,126, 61, 32, -112, 97,116,104, 32,100,111, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,100,117, - 99,101,100, 32, 61, 32,112, 97,116,104, 10, 32, 32, 32, 32, 32, 32, 32, 32,112, - 97,116,104, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,114,101, -100,117, 99,101,100, 44, 32, 34, 40, 91, 94, 47, 93, 42, 47, 37, 46, 37, 46, 47, - 41, 34, 44, 32,102,117,110, 99,116,105,111,110, 32, 40,115, 41, 10, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,115, 32,126, 61, 32, 34, 46, 46, - 47, 46, 46, 47, 34, 32,116,104,101,110, 32,114,101,116,117,114,110, 32, 34, 34, - 32,101,108,115,101, 32,114,101,116,117,114,110, 32,115, 32,101,110,100, 10, 32, - 32, 32, 32, 32, 32, 32, 32,101,110,100, 41, 10, 32, 32, 32, 32,101,110,100, 10, - 32, 32, 32, 32,112, 97,116,104, 32, 61, 32,115,116,114,105,110,103, 46,103,115, -117, 98, 40,114,101,100,117, 99,101,100, 44, 32, 34, 40, 91, 94, 47, 93, 42, 47, - 37, 46, 37, 46, 41, 36, 34, 44, 32,102,117,110, 99,116,105,111,110, 32, 40,115, - 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,115, 32,126, 61, 32, 34, 46, - 46, 47, 46, 46, 34, 32,116,104,101,110, 32,114,101,116,117,114,110, 32, 34, 34, - 32,101,108,115,101, 32,114,101,116,117,114,110, 32,115, 32,101,110,100, 10, 32, - 32, 32, 32,101,110,100, 41, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,112, - 97,116,104, 10,101,110,100, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 80, 97,114,115,101,115, 32, 97, 32,117, -114,108, 32, 97,110,100, 32,114,101,116,117,114,110,115, 32, 97, 32,116, 97, 98, -108,101, 32,119,105,116,104, 32, 97,108,108, 32,105,116,115, 32,112, 97,114,116, -115, 32, 97, 99, 99,111,114,100,105,110,103, 32,116,111, 32, 82, 70, 67, 32, 50, - 51, 57, 54, 10, 45, 45, 32, 84,104,101, 32,102,111,108,108,111,119,105,110,103, - 32,103,114, 97,109,109, 97,114, 32,100,101,115, 99,114,105, 98,101,115, 32,116, -104,101, 32,110, 97,109,101,115, 32,103,105,118,101,110, 32,116,111, 32,116,104, -101, 32, 85, 82, 76, 32,112, 97,114,116,115, 10, 45, 45, 32, 60,117,114,108, 62, - 32, 58, 58, 61, 32, 60,115, 99,104,101,109,101, 62, 58, 47, 47, 60, 97,117,116, -104,111,114,105,116,121, 62, 47, 60,112, 97,116,104, 62, 59, 60,112, 97,114, 97, -109,115, 62, 63, 60,113,117,101,114,121, 62, 35, 60,102,114, 97,103,109,101,110, -116, 62, 10, 45, 45, 32, 60, 97,117,116,104,111,114,105,116,121, 62, 32, 58, 58, - 61, 32, 60,117,115,101,114,105,110,102,111, 62, 64, 60,104,111,115,116, 62, 58, - 60,112,111,114,116, 62, 10, 45, 45, 32, 60,117,115,101,114,105,110,102,111, 62, - 32, 58, 58, 61, 32, 60,117,115,101,114, 62, 91, 58, 60,112, 97,115,115,119,111, -114,100, 62, 93, 10, 45, 45, 32, 60,112, 97,116,104, 62, 32, 58, 58, 32, 61, 32, -123, 60,115,101,103,109,101,110,116, 62, 47,125, 60,115,101,103,109,101,110,116, - 62, 10, 45, 45, 32, 73,110,112,117,116, 10, 45, 45, 32, 32, 32,117,114,108, 58, - 32,117,110,105,102,111,114,109, 32,114,101,115,111,117,114, 99,101, 32,108,111, - 99, 97,116,111,114, 32,111,102, 32,114,101,113,117,101,115,116, 10, 45, 45, 32, - 32, 32,100,101,102, 97,117,108,116, 58, 32,116, 97, 98,108,101, 32,119,105,116, -104, 32,100,101,102, 97,117,108,116, 32,118, 97,108,117,101,115, 32,102,111,114, - 32,101, 97, 99,104, 32,102,105,101,108,100, 10, 45, 45, 32, 82,101,116,117,114, -110,115, 10, 45, 45, 32, 32, 32,116, 97, 98,108,101, 32,119,105,116,104, 32,116, -104,101, 32,102,111,108,108,111,119,105,110,103, 32,102,105,101,108,100,115, 44, - 32,119,104,101,114,101, 32, 82, 70, 67, 32,110, 97,109,105,110,103, 32, 99,111, -110,118,101,110,116,105,111,110,115, 32,104, 97,118,101, 10, 45, 45, 32, 32, 32, - 98,101,101,110, 32,112,114,101,115,101,114,118,101,100, 58, 10, 45, 45, 32, 32, - 32, 32, 32,115, 99,104,101,109,101, 44, 32, 97,117,116,104,111,114,105,116,121, - 44, 32,117,115,101,114,105,110,102,111, 44, 32,117,115,101,114, 44, 32,112, 97, -115,115,119,111,114,100, 44, 32,104,111,115,116, 44, 32,112,111,114,116, 44, 10, - 45, 45, 32, 32, 32, 32, 32,112, 97,116,104, 44, 32,112, 97,114, 97,109,115, 44, - 32,113,117,101,114,121, 44, 32,102,114, 97,103,109,101,110,116, 10, 45, 45, 32, - 79, 98,115, 58, 10, 45, 45, 32, 32, 32,116,104,101, 32,108,101, 97,100,105,110, -103, 32, 39, 47, 39, 32,105,110, 32,123, 47, 60,112, 97,116,104, 62,125, 32,105, -115, 32, 99,111,110,115,105,100,101,114,101,100, 32,112, 97,114,116, 32,111,102, - 32, 60,112, 97,116,104, 62, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 10,102,117,110, 99,116,105,111,110, 32, 95, 77, 46,112, 97, -114,115,101, 40,117,114,108, 44, 32,100,101,102, 97,117,108,116, 41, 10, 32, 32, - 32, 32, 45, 45, 32,105,110,105,116,105, 97,108,105,122,101, 32,100,101,102, 97, -117,108,116, 32,112, 97,114, 97,109,101,116,101,114,115, 10, 32, 32, 32, 32,108, -111, 99, 97,108, 32,112, 97,114,115,101,100, 32, 61, 32,123,125, 10, 32, 32, 32, - 32,102,111,114, 32,105, 44,118, 32,105,110, 32, 98, 97,115,101, 46,112, 97,105, -114,115, 40,100,101,102, 97,117,108,116, 32,111,114, 32,112, 97,114,115,101,100, - 41, 32,100,111, 32,112, 97,114,115,101,100, 91,105, 93, 32, 61, 32,118, 32,101, -110,100, 10, 32, 32, 32, 32, 45, 45, 32,101,109,112,116,121, 32,117,114,108, 32, -105,115, 32,112, 97,114,115,101,100, 32,116,111, 32,110,105,108, 10, 32, 32, 32, - 32,105,102, 32,110,111,116, 32,117,114,108, 32,111,114, 32,117,114,108, 32, 61, - 61, 32, 34, 34, 32,116,104,101,110, 32,114,101,116,117,114,110, 32,110,105,108, - 44, 32, 34,105,110,118, 97,108,105,100, 32,117,114,108, 34, 32,101,110,100, 10, - 32, 32, 32, 32, 45, 45, 32,114,101,109,111,118,101, 32,119,104,105,116,101,115, -112, 97, 99,101, 10, 32, 32, 32, 32, 45, 45, 32,117,114,108, 32, 61, 32,115,116, -114,105,110,103, 46,103,115,117, 98, 40,117,114,108, 44, 32, 34, 37,115, 34, 44, - 32, 34, 34, 41, 10, 32, 32, 32, 32, 45, 45, 32,103,101,116, 32,102,114, 97,103, -109,101,110,116, 10, 32, 32, 32, 32,117,114,108, 32, 61, 32,115,116,114,105,110, -103, 46,103,115,117, 98, 40,117,114,108, 44, 32, 34, 35, 40, 46, 42, 41, 36, 34, - 44, 32,102,117,110, 99,116,105,111,110, 40,102, 41, 10, 32, 32, 32, 32, 32, 32, - 32, 32,112, 97,114,115,101,100, 46,102,114, 97,103,109,101,110,116, 32, 61, 32, -102, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114,110, 32, 34, 34, 10, - 32, 32, 32, 32,101,110,100, 41, 10, 32, 32, 32, 32, 45, 45, 32,103,101,116, 32, -115, 99,104,101,109,101, 10, 32, 32, 32, 32,117,114,108, 32, 61, 32,115,116,114, -105,110,103, 46,103,115,117, 98, 40,117,114,108, 44, 32, 34, 94, 40, 91, 37,119, - 93, 91, 37,119, 37, 43, 37, 45, 37, 46, 93, 42, 41, 37, 58, 34, 44, 10, 32, 32, - 32, 32, 32, 32, 32, 32,102,117,110, 99,116,105,111,110, 40,115, 41, 32,112, 97, -114,115,101,100, 46,115, 99,104,101,109,101, 32, 61, 32,115, 59, 32,114,101,116, -117,114,110, 32, 34, 34, 32,101,110,100, 41, 10, 32, 32, 32, 32, 45, 45, 32,103, -101,116, 32, 97,117,116,104,111,114,105,116,121, 10, 32, 32, 32, 32,117,114,108, - 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,117,114,108, 44, 32, - 34, 94, 47, 47, 40, 91, 94, 47, 93, 42, 41, 34, 44, 32,102,117,110, 99,116,105, -111,110, 40,110, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32,112, 97,114,115,101,100, - 46, 97,117,116,104,111,114,105,116,121, 32, 61, 32,110, 10, 32, 32, 32, 32, 32, - 32, 32, 32,114,101,116,117,114,110, 32, 34, 34, 10, 32, 32, 32, 32,101,110,100, - 41, 10, 32, 32, 32, 32, 45, 45, 32,103,101,116, 32,113,117,101,114,121, 32,115, -116,114,105,110,103, 10, 32, 32, 32, 32,117,114,108, 32, 61, 32,115,116,114,105, -110,103, 46,103,115,117, 98, 40,117,114,108, 44, 32, 34, 37, 63, 40, 46, 42, 41, - 34, 44, 32,102,117,110, 99,116,105,111,110, 40,113, 41, 10, 32, 32, 32, 32, 32, - 32, 32, 32,112, 97,114,115,101,100, 46,113,117,101,114,121, 32, 61, 32,113, 10, - 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114,110, 32, 34, 34, 10, 32, 32, - 32, 32,101,110,100, 41, 10, 32, 32, 32, 32, 45, 45, 32,103,101,116, 32,112, 97, -114, 97,109,115, 10, 32, 32, 32, 32,117,114,108, 32, 61, 32,115,116,114,105,110, -103, 46,103,115,117, 98, 40,117,114,108, 44, 32, 34, 37, 59, 40, 46, 42, 41, 34, - 44, 32,102,117,110, 99,116,105,111,110, 40,112, 41, 10, 32, 32, 32, 32, 32, 32, - 32, 32,112, 97,114,115,101,100, 46,112, 97,114, 97,109,115, 32, 61, 32,112, 10, - 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114,110, 32, 34, 34, 10, 32, 32, - 32, 32,101,110,100, 41, 10, 32, 32, 32, 32, 45, 45, 32,112, 97,116,104, 32,105, -115, 32,119,104, 97,116,101,118,101,114, 32,119, 97,115, 32,108,101,102,116, 10, - 32, 32, 32, 32,105,102, 32,117,114,108, 32,126, 61, 32, 34, 34, 32,116,104,101, -110, 32,112, 97,114,115,101,100, 46,112, 97,116,104, 32, 61, 32,117,114,108, 32, -101,110,100, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32, 97,117,116,104,111,114, -105,116,121, 32, 61, 32,112, 97,114,115,101,100, 46, 97,117,116,104,111,114,105, -116,121, 10, 32, 32, 32, 32,105,102, 32,110,111,116, 32, 97,117,116,104,111,114, -105,116,121, 32,116,104,101,110, 32,114,101,116,117,114,110, 32,112, 97,114,115, -101,100, 32,101,110,100, 10, 32, 32, 32, 32, 97,117,116,104,111,114,105,116,121, - 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40, 97,117,116,104,111, -114,105,116,121, 44, 34, 94, 40, 91, 94, 64, 93, 42, 41, 64, 34, 44, 10, 32, 32, - 32, 32, 32, 32, 32, 32,102,117,110, 99,116,105,111,110, 40,117, 41, 32,112, 97, -114,115,101,100, 46,117,115,101,114,105,110,102,111, 32, 61, 32,117, 59, 32,114, -101,116,117,114,110, 32, 34, 34, 32,101,110,100, 41, 10, 32, 32, 32, 32, 97,117, -116,104,111,114,105,116,121, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, - 98, 40, 97,117,116,104,111,114,105,116,121, 44, 32, 34, 58, 40, 91, 94, 58, 37, - 93, 93, 42, 41, 36, 34, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32,102,117,110, 99, -116,105,111,110, 40,112, 41, 32,112, 97,114,115,101,100, 46,112,111,114,116, 32, - 61, 32,112, 59, 32,114,101,116,117,114,110, 32, 34, 34, 32,101,110,100, 41, 10, - 32, 32, 32, 32,105,102, 32, 97,117,116,104,111,114,105,116,121, 32,126, 61, 32, - 34, 34, 32,116,104,101,110, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 45, 45, 32, - 73, 80,118, 54, 63, 10, 32, 32, 32, 32, 32, 32, 32, 32,112, 97,114,115,101,100, - 46,104,111,115,116, 32, 61, 32,115,116,114,105,110,103, 46,109, 97,116, 99,104, - 40, 97,117,116,104,111,114,105,116,121, 44, 32, 34, 94, 37, 91, 40, 46, 43, 41, - 37, 93, 36, 34, 41, 32,111,114, 32, 97,117,116,104,111,114,105,116,121, 32, 10, - 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,117,115, -101,114,105,110,102,111, 32, 61, 32,112, 97,114,115,101,100, 46,117,115,101,114, -105,110,102,111, 10, 32, 32, 32, 32,105,102, 32,110,111,116, 32,117,115,101,114, -105,110,102,111, 32,116,104,101,110, 32,114,101,116,117,114,110, 32,112, 97,114, -115,101,100, 32,101,110,100, 10, 32, 32, 32, 32,117,115,101,114,105,110,102,111, - 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,117,115,101,114,105, -110,102,111, 44, 32, 34, 58, 40, 91, 94, 58, 93, 42, 41, 36, 34, 44, 10, 32, 32, - 32, 32, 32, 32, 32, 32,102,117,110, 99,116,105,111,110, 40,112, 41, 32,112, 97, -114,115,101,100, 46,112, 97,115,115,119,111,114,100, 32, 61, 32,112, 59, 32,114, -101,116,117,114,110, 32, 34, 34, 32,101,110,100, 41, 10, 32, 32, 32, 32,112, 97, -114,115,101,100, 46,117,115,101,114, 32, 61, 32,117,115,101,114,105,110,102,111, - 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,112, 97,114,115,101,100, 10,101, -110,100, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 10, 45, 45, 32, 82,101, 98,117,105,108,100,115, 32, 97, 32,112, 97,114,115, -101,100, 32, 85, 82, 76, 32,102,114,111,109, 32,105,116,115, 32, 99,111,109,112, -111,110,101,110,116,115, 46, 10, 45, 45, 32, 67,111,109,112,111,110,101,110,116, -115, 32, 97,114,101, 32,112,114,111,116,101, 99,116,101,100, 32,105,102, 32, 97, -110,121, 32,114,101,115,101,114,118,101,100, 32,111,114, 32,117,110, 97,108,108, -111,119,101,100, 32, 99,104, 97,114, 97, 99,116,101,114,115, 32, 97,114,101, 32, -102,111,117,110,100, 10, 45, 45, 32, 73,110,112,117,116, 10, 45, 45, 32, 32, 32, -112, 97,114,115,101,100, 58, 32,112, 97,114,115,101,100, 32, 85, 82, 76, 44, 32, - 97,115, 32,114,101,116,117,114,110,101,100, 32, 98,121, 32,112, 97,114,115,101, - 10, 45, 45, 32, 82,101,116,117,114,110,115, 10, 45, 45, 32, 32, 32, 97, 32,115, -116,114,105,110,103,105,110,103, 32,119,105,116,104, 32,116,104,101, 32, 99,111, -114,114,101,115,112,111,110,100,105,110,103, 32, 85, 82, 76, 10, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10,102,117,110, 99,116,105, -111,110, 32, 95, 77, 46, 98,117,105,108,100, 40,112, 97,114,115,101,100, 41, 10, - 32, 32, 32, 32,108,111, 99, 97,108, 32,112,112, 97,116,104, 32, 61, 32, 95, 77, - 46,112, 97,114,115,101, 95,112, 97,116,104, 40,112, 97,114,115,101,100, 46,112, - 97,116,104, 32,111,114, 32, 34, 34, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, - 32,117,114,108, 32, 61, 32, 95, 77, 46, 98,117,105,108,100, 95,112, 97,116,104, - 40,112,112, 97,116,104, 41, 10, 32, 32, 32, 32,105,102, 32,112, 97,114,115,101, -100, 46,112, 97,114, 97,109,115, 32,116,104,101,110, 32,117,114,108, 32, 61, 32, -117,114,108, 32, 46, 46, 32, 34, 59, 34, 32, 46, 46, 32,112, 97,114,115,101,100, - 46,112, 97,114, 97,109,115, 32,101,110,100, 10, 32, 32, 32, 32,105,102, 32,112, - 97,114,115,101,100, 46,113,117,101,114,121, 32,116,104,101,110, 32,117,114,108, - 32, 61, 32,117,114,108, 32, 46, 46, 32, 34, 63, 34, 32, 46, 46, 32,112, 97,114, -115,101,100, 46,113,117,101,114,121, 32,101,110,100, 10, 32, 32, 32, 32,108,111, - 99, 97,108, 32, 97,117,116,104,111,114,105,116,121, 32, 61, 32,112, 97,114,115, -101,100, 46, 97,117,116,104,111,114,105,116,121, 10, 32, 32, 32, 32,105,102, 32, -112, 97,114,115,101,100, 46,104,111,115,116, 32,116,104,101,110, 10, 32, 32, 32, - 32, 32, 32, 32, 32, 97,117,116,104,111,114,105,116,121, 32, 61, 32,112, 97,114, -115,101,100, 46,104,111,115,116, 10, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32, -115,116,114,105,110,103, 46,102,105,110,100, 40, 97,117,116,104,111,114,105,116, -121, 44, 32, 34, 58, 34, 41, 32,116,104,101,110, 32, 45, 45, 32, 73, 80,118, 54, - 63, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97,117,116,104,111,114, -105,116,121, 32, 61, 32, 34, 91, 34, 32, 46, 46, 32, 97,117,116,104,111,114,105, -116,121, 32, 46, 46, 32, 34, 93, 34, 10, 32, 32, 32, 32, 32, 32, 32, 32,101,110, -100, 10, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,112, 97,114,115,101,100, 46, -112,111,114,116, 32,116,104,101,110, 32, 97,117,116,104,111,114,105,116,121, 32, - 61, 32, 97,117,116,104,111,114,105,116,121, 32, 46, 46, 32, 34, 58, 34, 32, 46, - 46, 32,112, 97,114,115,101,100, 46,112,111,114,116, 32,101,110,100, 10, 32, 32, - 32, 32, 32, 32, 32, 32,108,111, 99, 97,108, 32,117,115,101,114,105,110,102,111, - 32, 61, 32,112, 97,114,115,101,100, 46,117,115,101,114,105,110,102,111, 10, 32, - 32, 32, 32, 32, 32, 32, 32,105,102, 32,112, 97,114,115,101,100, 46,117,115,101, -114, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,117, -115,101,114,105,110,102,111, 32, 61, 32,112, 97,114,115,101,100, 46,117,115,101, -114, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,112, 97,114, -115,101,100, 46,112, 97,115,115,119,111,114,100, 32,116,104,101,110, 10, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,117,115,101,114,105,110, -102,111, 32, 61, 32,117,115,101,114,105,110,102,111, 32, 46, 46, 32, 34, 58, 34, - 32, 46, 46, 32,112, 97,114,115,101,100, 46,112, 97,115,115,119,111,114,100, 10, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, - 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,117, -115,101,114,105,110,102,111, 32,116,104,101,110, 32, 97,117,116,104,111,114,105, -116,121, 32, 61, 32,117,115,101,114,105,110,102,111, 32, 46, 46, 32, 34, 64, 34, - 32, 46, 46, 32, 97,117,116,104,111,114,105,116,121, 32,101,110,100, 10, 32, 32, - 32, 32,101,110,100, 10, 32, 32, 32, 32,105,102, 32, 97,117,116,104,111,114,105, -116,121, 32,116,104,101,110, 32,117,114,108, 32, 61, 32, 34, 47, 47, 34, 32, 46, - 46, 32, 97,117,116,104,111,114,105,116,121, 32, 46, 46, 32,117,114,108, 32,101, -110,100, 10, 32, 32, 32, 32,105,102, 32,112, 97,114,115,101,100, 46,115, 99,104, -101,109,101, 32,116,104,101,110, 32,117,114,108, 32, 61, 32,112, 97,114,115,101, -100, 46,115, 99,104,101,109,101, 32, 46, 46, 32, 34, 58, 34, 32, 46, 46, 32,117, -114,108, 32,101,110,100, 10, 32, 32, 32, 32,105,102, 32,112, 97,114,115,101,100, - 46,102,114, 97,103,109,101,110,116, 32,116,104,101,110, 32,117,114,108, 32, 61, - 32,117,114,108, 32, 46, 46, 32, 34, 35, 34, 32, 46, 46, 32,112, 97,114,115,101, -100, 46,102,114, 97,103,109,101,110,116, 32,101,110,100, 10, 32, 32, 32, 32, 45, - 45, 32,117,114,108, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40, -117,114,108, 44, 32, 34, 37,115, 34, 44, 32, 34, 34, 41, 10, 32, 32, 32, 32,114, -101,116,117,114,110, 32,117,114,108, 10,101,110,100, 10, 10, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 66,117,105,108, -100,115, 32, 97, 32, 97, 98,115,111,108,117,116,101, 32, 85, 82, 76, 32,102,114, -111,109, 32, 97, 32, 98, 97,115,101, 32, 97,110,100, 32, 97, 32,114,101,108, 97, -116,105,118,101, 32, 85, 82, 76, 32, 97, 99, 99,111,114,100,105,110,103, 32,116, -111, 32, 82, 70, 67, 32, 50, 51, 57, 54, 10, 45, 45, 32, 73,110,112,117,116, 10, - 45, 45, 32, 32, 32, 98, 97,115,101, 95,117,114,108, 10, 45, 45, 32, 32, 32,114, -101,108, 97,116,105,118,101, 95,117,114,108, 10, 45, 45, 32, 82,101,116,117,114, -110,115, 10, 45, 45, 32, 32, 32, 99,111,114,114,101,115,112,111,110,100,105,110, -103, 32, 97, 98,115,111,108,117,116,101, 32,117,114,108, 10, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10,102,117,110, 99,116,105,111, -110, 32, 95, 77, 46, 97, 98,115,111,108,117,116,101, 40, 98, 97,115,101, 95,117, -114,108, 44, 32,114,101,108, 97,116,105,118,101, 95,117,114,108, 41, 10, 32, 32, - 32, 32,108,111, 99, 97,108, 32, 98, 97,115,101, 95,112, 97,114,115,101,100, 10, - 32, 32, 32, 32,105,102, 32, 98, 97,115,101, 46,116,121,112,101, 40, 98, 97,115, -101, 95,117,114,108, 41, 32, 61, 61, 32, 34,116, 97, 98,108,101, 34, 32,116,104, -101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 98, 97,115,101, 95,112, 97,114,115, -101,100, 32, 61, 32, 98, 97,115,101, 95,117,114,108, 10, 32, 32, 32, 32, 32, 32, - 32, 32, 98, 97,115,101, 95,117,114,108, 32, 61, 32, 95, 77, 46, 98,117,105,108, -100, 40, 98, 97,115,101, 95,112, 97,114,115,101,100, 41, 10, 32, 32, 32, 32,101, -108,115,101, 10, 32, 32, 32, 32, 32, 32, 32, 32, 98, 97,115,101, 95,112, 97,114, -115,101,100, 32, 61, 32, 95, 77, 46,112, 97,114,115,101, 40, 98, 97,115,101, 95, -117,114,108, 41, 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,108,111, 99, - 97,108, 32,114,101,108, 97,116,105,118,101, 95,112, 97,114,115,101,100, 32, 61, - 32, 95, 77, 46,112, 97,114,115,101, 40,114,101,108, 97,116,105,118,101, 95,117, -114,108, 41, 10, 32, 32, 32, 32,105,102, 32,110,111,116, 32, 98, 97,115,101, 95, -112, 97,114,115,101,100, 32,116,104,101,110, 32,114,101,116,117,114,110, 32,114, -101,108, 97,116,105,118,101, 95,117,114,108, 10, 32, 32, 32, 32,101,108,115,101, -105,102, 32,110,111,116, 32,114,101,108, 97,116,105,118,101, 95,112, 97,114,115, -101,100, 32,116,104,101,110, 32,114,101,116,117,114,110, 32, 98, 97,115,101, 95, -117,114,108, 10, 32, 32, 32, 32,101,108,115,101,105,102, 32,114,101,108, 97,116, -105,118,101, 95,112, 97,114,115,101,100, 46,115, 99,104,101,109,101, 32,116,104, -101,110, 32,114,101,116,117,114,110, 32,114,101,108, 97,116,105,118,101, 95,117, -114,108, 10, 32, 32, 32, 32,101,108,115,101, 10, 32, 32, 32, 32, 32, 32, 32, 32, -114,101,108, 97,116,105,118,101, 95,112, 97,114,115,101,100, 46,115, 99,104,101, -109,101, 32, 61, 32, 98, 97,115,101, 95,112, 97,114,115,101,100, 46,115, 99,104, -101,109,101, 10, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,110,111,116, 32,114, -101,108, 97,116,105,118,101, 95,112, 97,114,115,101,100, 46, 97,117,116,104,111, -114,105,116,121, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32,114,101,108, 97,116,105,118,101, 95,112, 97,114,115,101,100, 46, 97,117, -116,104,111,114,105,116,121, 32, 61, 32, 98, 97,115,101, 95,112, 97,114,115,101, -100, 46, 97,117,116,104,111,114,105,116,121, 10, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32,105,102, 32,110,111,116, 32,114,101,108, 97,116,105,118,101, 95, -112, 97,114,115,101,100, 46,112, 97,116,104, 32,116,104,101,110, 10, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,101,108, 97,116,105,118, -101, 95,112, 97,114,115,101,100, 46,112, 97,116,104, 32, 61, 32, 98, 97,115,101, - 95,112, 97,114,115,101,100, 46,112, 97,116,104, 10, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,110,111,116, 32,114,101,108, 97, -116,105,118,101, 95,112, 97,114,115,101,100, 46,112, 97,114, 97,109,115, 32,116, -104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32,114,101,108, 97,116,105,118,101, 95,112, 97,114,115,101,100, 46, -112, 97,114, 97,109,115, 32, 61, 32, 98, 97,115,101, 95,112, 97,114,115,101,100, - 46,112, 97,114, 97,109,115, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,110,111,116, 32,114,101,108, 97,116, -105,118,101, 95,112, 97,114,115,101,100, 46,113,117,101,114,121, 32,116,104,101, -110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32,114,101,108, 97,116,105,118,101, 95,112, 97,114,115,101, -100, 46,113,117,101,114,121, 32, 61, 32, 98, 97,115,101, 95,112, 97,114,115,101, -100, 46,113,117,101,114,121, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32,101,108,115,101, 32, 32, 32, 32, 10, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32,114,101,108, 97,116,105,118,101, 95,112, 97, -114,115,101,100, 46,112, 97,116,104, 32, 61, 32, 97, 98,115,111,108,117,116,101, - 95,112, 97,116,104, 40, 98, 97,115,101, 95,112, 97,114,115,101,100, 46,112, 97, -116,104, 32,111,114, 32, 34, 34, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,101,108, 97,116,105,118,101, 95,112, - 97,114,115,101,100, 46,112, 97,116,104, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, - 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114,110, 32, 95, 77, 46, 98,117, -105,108,100, 40,114,101,108, 97,116,105,118,101, 95,112, 97,114,115,101,100, 41, - 10, 32, 32, 32, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 66,114,101, 97,107, -115, 32, 97, 32,112, 97,116,104, 32,105,110,116,111, 32,105,116,115, 32,115,101, -103,109,101,110,116,115, 44, 32,117,110,101,115, 99, 97,112,105,110,103, 32,116, -104,101, 32,115,101,103,109,101,110,116,115, 10, 45, 45, 32, 73,110,112,117,116, - 10, 45, 45, 32, 32, 32,112, 97,116,104, 10, 45, 45, 32, 82,101,116,117,114,110, -115, 10, 45, 45, 32, 32, 32,115,101,103,109,101,110,116, 58, 32, 97, 32,116, 97, - 98,108,101, 32,119,105,116,104, 32,111,110,101, 32,101,110,116,114,121, 32,112, -101,114, 32,115,101,103,109,101,110,116, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 10,102,117,110, 99,116,105,111,110, 32, 95, 77, - 46,112, 97,114,115,101, 95,112, 97,116,104, 40,112, 97,116,104, 41, 10, 32, 32, - 32, 32,108,111, 99, 97,108, 32,112, 97,114,115,101,100, 32, 61, 32,123,125, 10, - 32, 32, 32, 32,112, 97,116,104, 32, 61, 32,112, 97,116,104, 32,111,114, 32, 34, - 34, 10, 32, 32, 32, 32, 45, 45,112, 97,116,104, 32, 61, 32,115,116,114,105,110, -103, 46,103,115,117, 98, 40,112, 97,116,104, 44, 32, 34, 37,115, 34, 44, 32, 34, - 34, 41, 10, 32, 32, 32, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,112, - 97,116,104, 44, 32, 34, 40, 91, 94, 47, 93, 43, 41, 34, 44, 32,102,117,110, 99, -116,105,111,110, 32, 40,115, 41, 32,116, 97, 98,108,101, 46,105,110,115,101,114, -116, 40,112, 97,114,115,101,100, 44, 32,115, 41, 32,101,110,100, 41, 10, 32, 32, - 32, 32,102,111,114, 32,105, 32, 61, 32, 49, 44, 32, 35,112, 97,114,115,101,100, - 32,100,111, 10, 32, 32, 32, 32, 32, 32, 32, 32,112, 97,114,115,101,100, 91,105, - 93, 32, 61, 32, 95, 77, 46,117,110,101,115, 99, 97,112,101, 40,112, 97,114,115, -101,100, 91,105, 93, 41, 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,105, -102, 32,115,116,114,105,110,103, 46,115,117, 98, 40,112, 97,116,104, 44, 32, 49, - 44, 32, 49, 41, 32, 61, 61, 32, 34, 47, 34, 32,116,104,101,110, 32,112, 97,114, -115,101,100, 46,105,115, 95, 97, 98,115,111,108,117,116,101, 32, 61, 32, 49, 32, -101,110,100, 10, 32, 32, 32, 32,105,102, 32,115,116,114,105,110,103, 46,115,117, - 98, 40,112, 97,116,104, 44, 32, 45, 49, 44, 32, 45, 49, 41, 32, 61, 61, 32, 34, - 47, 34, 32,116,104,101,110, 32,112, 97,114,115,101,100, 46,105,115, 95,100,105, -114,101, 99,116,111,114,121, 32, 61, 32, 49, 32,101,110,100, 10, 32, 32, 32, 32, -114,101,116,117,114,110, 32,112, 97,114,115,101,100, 10,101,110,100, 10, 10, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, - 66,117,105,108,100,115, 32, 97, 32,112, 97,116,104, 32, 99,111,109,112,111,110, -101,110,116, 32,102,114,111,109, 32,105,116,115, 32,115,101,103,109,101,110,116, -115, 44, 32,101,115, 99, 97,112,105,110,103, 32,112,114,111,116,101, 99,116,101, -100, 32, 99,104, 97,114, 97, 99,116,101,114,115, 46, 10, 45, 45, 32, 73,110,112, -117,116, 10, 45, 45, 32, 32, 32,112, 97,114,115,101,100, 58, 32,112, 97,116,104, - 32,115,101,103,109,101,110,116,115, 10, 45, 45, 32, 32, 32,117,110,115, 97,102, -101, 58, 32,105,102, 32,116,114,117,101, 44, 32,115,101,103,109,101,110,116,115, - 32, 97,114,101, 32,110,111,116, 32,112,114,111,116,101, 99,116,101,100, 32, 98, -101,102,111,114,101, 32,112, 97,116,104, 32,105,115, 32, 98,117,105,108,116, 10, - 45, 45, 32, 82,101,116,117,114,110,115, 10, 45, 45, 32, 32, 32,112, 97,116,104, - 58, 32, 99,111,114,114,101,115,112,111,110,100,105,110,103, 32,112, 97,116,104, - 32,115,116,114,105,110,103,105,110,103, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 10,102,117,110, 99,116,105,111,110, 32, 95, 77, - 46, 98,117,105,108,100, 95,112, 97,116,104, 40,112, 97,114,115,101,100, 44, 32, -117,110,115, 97,102,101, 41, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,112, 97, -116,104, 32, 61, 32, 34, 34, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,110, 32, - 61, 32, 35,112, 97,114,115,101,100, 10, 32, 32, 32, 32,105,102, 32,117,110,115, - 97,102,101, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32,102,111,114, - 32,105, 32, 61, 32, 49, 44, 32,110, 45, 49, 32,100,111, 10, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32,112, 97,116,104, 32, 61, 32,112, 97,116,104, 32, 46, - 46, 32,112, 97,114,115,101,100, 91,105, 93, 10, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32,112, 97,116,104, 32, 61, 32,112, 97,116,104, 32, 46, 46, 32, 34, - 47, 34, 10, 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, 32, - 32, 32, 32,105,102, 32,110, 32, 62, 32, 48, 32,116,104,101,110, 10, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32,112, 97,116,104, 32, 61, 32,112, 97,116,104, - 32, 46, 46, 32,112, 97,114,115,101,100, 91,110, 93, 10, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32,105,102, 32,112, 97,114,115,101,100, 46,105,115, 95,100, -105,114,101, 99,116,111,114,121, 32,116,104,101,110, 32,112, 97,116,104, 32, 61, - 32,112, 97,116,104, 32, 46, 46, 32, 34, 47, 34, 32,101,110,100, 10, 32, 32, 32, - 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,101,108,115,101, 10, 32, 32, - 32, 32, 32, 32, 32, 32,102,111,114, 32,105, 32, 61, 32, 49, 44, 32,110, 45, 49, - 32,100,111, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,112, 97,116,104, - 32, 61, 32,112, 97,116,104, 32, 46, 46, 32,112,114,111,116,101, 99,116, 95,115, -101,103,109,101,110,116, 40,112, 97,114,115,101,100, 91,105, 93, 41, 10, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,112, 97,116,104, 32, 61, 32,112, 97,116, -104, 32, 46, 46, 32, 34, 47, 34, 10, 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, - 10, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,110, 32, 62, 32, 48, 32,116,104, -101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,112, 97,116,104, 32, - 61, 32,112, 97,116,104, 32, 46, 46, 32,112,114,111,116,101, 99,116, 95,115,101, -103,109,101,110,116, 40,112, 97,114,115,101,100, 91,110, 93, 41, 10, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,112, 97,114,115,101,100, 46,105, -115, 95,100,105,114,101, 99,116,111,114,121, 32,116,104,101,110, 32,112, 97,116, -104, 32, 61, 32,112, 97,116,104, 32, 46, 46, 32, 34, 47, 34, 32,101,110,100, 10, - 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,101,110,100, 10, - 32, 32, 32, 32,105,102, 32,112, 97,114,115,101,100, 46,105,115, 95, 97, 98,115, -111,108,117,116,101, 32,116,104,101,110, 32,112, 97,116,104, 32, 61, 32, 34, 47, - 34, 32, 46, 46, 32,112, 97,116,104, 32,101,110,100, 10, 32, 32, 32, 32,114,101, -116,117,114,110, 32,112, 97,116,104, 10,101,110,100, 10, 10,114,101,116,117,114, -110, 32, 95, 77, 10, -}; - - if (luaL_loadbuffer(L,(const char*)B1,sizeof(B1),"url.lua")==0) lua_call(L, 0, LUA_MULTRET); -} diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/usocket.c b/love/src/jni/love/src/libraries/luasocket/libluasocket/usocket.c deleted file mode 100644 index 8adc5738..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/usocket.c +++ /dev/null @@ -1,451 +0,0 @@ -/*=========================================================================*\ -* Socket compatibilization module for Unix -* LuaSocket toolkit -* -* The code is now interrupt-safe. -* The penalty of calling select to avoid busy-wait is only paid when -* the I/O call fail in the first place. -\*=========================================================================*/ -#include -#include - -#include "socket.h" -#include "pierror.h" - -/*-------------------------------------------------------------------------*\ -* Wait for readable/writable/connected socket with timeout -\*-------------------------------------------------------------------------*/ -#ifndef SOCKET_SELECT -#include - -#define WAITFD_R POLLIN -#define WAITFD_W POLLOUT -#define WAITFD_C (POLLIN|POLLOUT) -int socket_waitfd(p_socket ps, int sw, p_timeout tm) { - int ret; - struct pollfd pfd; - pfd.fd = *ps; - pfd.events = sw; - pfd.revents = 0; - if (timeout_iszero(tm)) return IO_TIMEOUT; /* optimize timeout == 0 case */ - do { - int t = (int)(timeout_getretry(tm)*1e3); - ret = poll(&pfd, 1, t >= 0? t: -1); - } while (ret == -1 && errno == EINTR); - if (ret == -1) return errno; - if (ret == 0) return IO_TIMEOUT; - if (sw == WAITFD_C && (pfd.revents & (POLLIN|POLLERR))) return IO_CLOSED; - return IO_DONE; -} -#else - -#define WAITFD_R 1 -#define WAITFD_W 2 -#define WAITFD_C (WAITFD_R|WAITFD_W) - -int socket_waitfd(p_socket ps, int sw, p_timeout tm) { - int ret; - fd_set rfds, wfds, *rp, *wp; - struct timeval tv, *tp; - double t; - if (*ps >= FD_SETSIZE) return EINVAL; - if (timeout_iszero(tm)) return IO_TIMEOUT; /* optimize timeout == 0 case */ - do { - /* must set bits within loop, because select may have modifed them */ - rp = wp = NULL; - if (sw & WAITFD_R) { FD_ZERO(&rfds); FD_SET(*ps, &rfds); rp = &rfds; } - if (sw & WAITFD_W) { FD_ZERO(&wfds); FD_SET(*ps, &wfds); wp = &wfds; } - t = timeout_getretry(tm); - tp = NULL; - if (t >= 0.0) { - tv.tv_sec = (int)t; - tv.tv_usec = (int)((t-tv.tv_sec)*1.0e6); - tp = &tv; - } - ret = select(*ps+1, rp, wp, NULL, tp); - } while (ret == -1 && errno == EINTR); - if (ret == -1) return errno; - if (ret == 0) return IO_TIMEOUT; - if (sw == WAITFD_C && FD_ISSET(*ps, &rfds)) return IO_CLOSED; - return IO_DONE; -} -#endif - - -/*-------------------------------------------------------------------------*\ -* Initializes module -\*-------------------------------------------------------------------------*/ -int socket_open(void) { - /* instals a handler to ignore sigpipe or it will crash us */ - signal(SIGPIPE, SIG_IGN); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Close module -\*-------------------------------------------------------------------------*/ -int socket_close(void) { - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Close and inutilize socket -\*-------------------------------------------------------------------------*/ -void socket_destroy(p_socket ps) { - if (*ps != SOCKET_INVALID) { - close(*ps); - *ps = SOCKET_INVALID; - } -} - -/*-------------------------------------------------------------------------*\ -* Select with timeout control -\*-------------------------------------------------------------------------*/ -int socket_select(t_socket n, fd_set *rfds, fd_set *wfds, fd_set *efds, - p_timeout tm) { - int ret; - do { - struct timeval tv; - double t = timeout_getretry(tm); - tv.tv_sec = (int) t; - tv.tv_usec = (int) ((t - tv.tv_sec) * 1.0e6); - /* timeout = 0 means no wait */ - ret = select(n, rfds, wfds, efds, t >= 0.0 ? &tv: NULL); - } while (ret < 0 && errno == EINTR); - return ret; -} - -/*-------------------------------------------------------------------------*\ -* Creates and sets up a socket -\*-------------------------------------------------------------------------*/ -int socket_create(p_socket ps, int domain, int type, int protocol) { - *ps = socket(domain, type, protocol); - if (*ps != SOCKET_INVALID) return IO_DONE; - else return errno; -} - -/*-------------------------------------------------------------------------*\ -* Binds or returns error message -\*-------------------------------------------------------------------------*/ -int socket_bind(p_socket ps, SA *addr, socklen_t len) { - int err = IO_DONE; - socket_setblocking(ps); - if (bind(*ps, addr, len) < 0) err = errno; - socket_setnonblocking(ps); - return err; -} - -/*-------------------------------------------------------------------------*\ -* -\*-------------------------------------------------------------------------*/ -int socket_listen(p_socket ps, int backlog) { - int err = IO_DONE; - if (listen(*ps, backlog)) err = errno; - return err; -} - -/*-------------------------------------------------------------------------*\ -* -\*-------------------------------------------------------------------------*/ -void socket_shutdown(p_socket ps, int how) { - shutdown(*ps, how); -} - -/*-------------------------------------------------------------------------*\ -* Connects or returns error message -\*-------------------------------------------------------------------------*/ -int socket_connect(p_socket ps, SA *addr, socklen_t len, p_timeout tm) { - int err; - /* avoid calling on closed sockets */ - if (*ps == SOCKET_INVALID) return IO_CLOSED; - /* call connect until done or failed without being interrupted */ - do if (connect(*ps, addr, len) == 0) return IO_DONE; - while ((err = errno) == EINTR); - /* if connection failed immediately, return error code */ - if (err != EINPROGRESS && err != EAGAIN) return err; - /* zero timeout case optimization */ - if (timeout_iszero(tm)) return IO_TIMEOUT; - /* wait until we have the result of the connection attempt or timeout */ - err = socket_waitfd(ps, WAITFD_C, tm); - if (err == IO_CLOSED) { - if (recv(*ps, (char *) &err, 0, 0) == 0) return IO_DONE; - else return errno; - } else return err; -} - -/*-------------------------------------------------------------------------*\ -* Accept with timeout -\*-------------------------------------------------------------------------*/ -int socket_accept(p_socket ps, p_socket pa, SA *addr, socklen_t *len, p_timeout tm) { - if (*ps == SOCKET_INVALID) return IO_CLOSED; - for ( ;; ) { - int err; - if ((*pa = accept(*ps, addr, len)) != SOCKET_INVALID) return IO_DONE; - err = errno; - if (err == EINTR) continue; - if (err != EAGAIN && err != ECONNABORTED) return err; - if ((err = socket_waitfd(ps, WAITFD_R, tm)) != IO_DONE) return err; - } - /* can't reach here */ - return IO_UNKNOWN; -} - -/*-------------------------------------------------------------------------*\ -* Send with timeout -\*-------------------------------------------------------------------------*/ -int socket_send(p_socket ps, const char *data, size_t count, - size_t *sent, p_timeout tm) -{ - int err; - *sent = 0; - /* avoid making system calls on closed sockets */ - if (*ps == SOCKET_INVALID) return IO_CLOSED; - /* loop until we send something or we give up on error */ - for ( ;; ) { - long put = (long) send(*ps, data, count, 0); - /* if we sent anything, we are done */ - if (put >= 0) { - *sent = put; - return IO_DONE; - } - err = errno; - /* EPIPE means the connection was closed */ - if (err == EPIPE) return IO_CLOSED; - /* EPROTOTYPE means the connection is being closed (on Yosemite!)*/ - if (err == EPROTOTYPE) continue; - /* we call was interrupted, just try again */ - if (err == EINTR) continue; - /* if failed fatal reason, report error */ - if (err != EAGAIN) return err; - /* wait until we can send something or we timeout */ - if ((err = socket_waitfd(ps, WAITFD_W, tm)) != IO_DONE) return err; - } - /* can't reach here */ - return IO_UNKNOWN; -} - -/*-------------------------------------------------------------------------*\ -* Sendto with timeout -\*-------------------------------------------------------------------------*/ -int socket_sendto(p_socket ps, const char *data, size_t count, size_t *sent, - SA *addr, socklen_t len, p_timeout tm) -{ - int err; - *sent = 0; - if (*ps == SOCKET_INVALID) return IO_CLOSED; - for ( ;; ) { - long put = (long) sendto(*ps, data, count, 0, addr, len); - if (put >= 0) { - *sent = put; - return IO_DONE; - } - err = errno; - if (err == EPIPE) return IO_CLOSED; - if (err == EPROTOTYPE) continue; - if (err == EINTR) continue; - if (err != EAGAIN) return err; - if ((err = socket_waitfd(ps, WAITFD_W, tm)) != IO_DONE) return err; - } - return IO_UNKNOWN; -} - -/*-------------------------------------------------------------------------*\ -* Receive with timeout -\*-------------------------------------------------------------------------*/ -int socket_recv(p_socket ps, char *data, size_t count, size_t *got, p_timeout tm) { - int err; - *got = 0; - if (*ps == SOCKET_INVALID) return IO_CLOSED; - for ( ;; ) { - long taken = (long) recv(*ps, data, count, 0); - if (taken > 0) { - *got = taken; - return IO_DONE; - } - err = errno; - if (taken == 0) return IO_CLOSED; - if (err == EINTR) continue; - if (err != EAGAIN) return err; - if ((err = socket_waitfd(ps, WAITFD_R, tm)) != IO_DONE) return err; - } - return IO_UNKNOWN; -} - -/*-------------------------------------------------------------------------*\ -* Recvfrom with timeout -\*-------------------------------------------------------------------------*/ -int socket_recvfrom(p_socket ps, char *data, size_t count, size_t *got, - SA *addr, socklen_t *len, p_timeout tm) { - int err; - *got = 0; - if (*ps == SOCKET_INVALID) return IO_CLOSED; - for ( ;; ) { - long taken = (long) recvfrom(*ps, data, count, 0, addr, len); - if (taken > 0) { - *got = taken; - return IO_DONE; - } - err = errno; - if (taken == 0) return IO_CLOSED; - if (err == EINTR) continue; - if (err != EAGAIN) return err; - if ((err = socket_waitfd(ps, WAITFD_R, tm)) != IO_DONE) return err; - } - return IO_UNKNOWN; -} - - -/*-------------------------------------------------------------------------*\ -* Write with timeout -* -* socket_read and socket_write are cut-n-paste of socket_send and socket_recv, -* with send/recv replaced with write/read. We can't just use write/read -* in the socket version, because behaviour when size is zero is different. -\*-------------------------------------------------------------------------*/ -int socket_write(p_socket ps, const char *data, size_t count, - size_t *sent, p_timeout tm) -{ - int err; - *sent = 0; - /* avoid making system calls on closed sockets */ - if (*ps == SOCKET_INVALID) return IO_CLOSED; - /* loop until we send something or we give up on error */ - for ( ;; ) { - long put = (long) write(*ps, data, count); - /* if we sent anything, we are done */ - if (put >= 0) { - *sent = put; - return IO_DONE; - } - err = errno; - /* EPIPE means the connection was closed */ - if (err == EPIPE) return IO_CLOSED; - /* EPROTOTYPE means the connection is being closed (on Yosemite!)*/ - if (err == EPROTOTYPE) continue; - /* we call was interrupted, just try again */ - if (err == EINTR) continue; - /* if failed fatal reason, report error */ - if (err != EAGAIN) return err; - /* wait until we can send something or we timeout */ - if ((err = socket_waitfd(ps, WAITFD_W, tm)) != IO_DONE) return err; - } - /* can't reach here */ - return IO_UNKNOWN; -} - -/*-------------------------------------------------------------------------*\ -* Read with timeout -* See note for socket_write -\*-------------------------------------------------------------------------*/ -int socket_read(p_socket ps, char *data, size_t count, size_t *got, p_timeout tm) { - int err; - *got = 0; - if (*ps == SOCKET_INVALID) return IO_CLOSED; - for ( ;; ) { - long taken = (long) read(*ps, data, count); - if (taken > 0) { - *got = taken; - return IO_DONE; - } - err = errno; - if (taken == 0) return IO_CLOSED; - if (err == EINTR) continue; - if (err != EAGAIN) return err; - if ((err = socket_waitfd(ps, WAITFD_R, tm)) != IO_DONE) return err; - } - return IO_UNKNOWN; -} - -/*-------------------------------------------------------------------------*\ -* Put socket into blocking mode -\*-------------------------------------------------------------------------*/ -void socket_setblocking(p_socket ps) { - int flags = fcntl(*ps, F_GETFL, 0); - flags &= (~(O_NONBLOCK)); - fcntl(*ps, F_SETFL, flags); -} - -/*-------------------------------------------------------------------------*\ -* Put socket into non-blocking mode -\*-------------------------------------------------------------------------*/ -void socket_setnonblocking(p_socket ps) { - int flags = fcntl(*ps, F_GETFL, 0); - flags |= O_NONBLOCK; - fcntl(*ps, F_SETFL, flags); -} - -/*-------------------------------------------------------------------------*\ -* DNS helpers -\*-------------------------------------------------------------------------*/ -int socket_gethostbyaddr(const char *addr, socklen_t len, struct hostent **hp) { - *hp = gethostbyaddr(addr, len, AF_INET); - if (*hp) return IO_DONE; - else if (h_errno) return h_errno; - else if (errno) return errno; - else return IO_UNKNOWN; -} - -int socket_gethostbyname(const char *addr, struct hostent **hp) { - *hp = gethostbyname(addr); - if (*hp) return IO_DONE; - else if (h_errno) return h_errno; - else if (errno) return errno; - else return IO_UNKNOWN; -} - -/*-------------------------------------------------------------------------*\ -* Error translation functions -* Make sure important error messages are standard -\*-------------------------------------------------------------------------*/ -const char *socket_hoststrerror(int err) { - if (err <= 0) return io_strerror(err); - switch (err) { - case HOST_NOT_FOUND: return PIE_HOST_NOT_FOUND; - default: return hstrerror(err); - } -} - -const char *socket_strerror(int err) { - if (err <= 0) return io_strerror(err); - switch (err) { - case EADDRINUSE: return PIE_ADDRINUSE; - case EISCONN: return PIE_ISCONN; - case EACCES: return PIE_ACCESS; - case ECONNREFUSED: return PIE_CONNREFUSED; - case ECONNABORTED: return PIE_CONNABORTED; - case ECONNRESET: return PIE_CONNRESET; - case ETIMEDOUT: return PIE_TIMEDOUT; - default: { - return strerror(err); - } - } -} - -const char *socket_ioerror(p_socket ps, int err) { - (void) ps; - return socket_strerror(err); -} - -const char *socket_gaistrerror(int err) { - if (err == 0) return NULL; - switch (err) { - case EAI_AGAIN: return PIE_AGAIN; - case EAI_BADFLAGS: return PIE_BADFLAGS; -#ifdef EAI_BADHINTS - case EAI_BADHINTS: return PIE_BADHINTS; -#endif - case EAI_FAIL: return PIE_FAIL; - case EAI_FAMILY: return PIE_FAMILY; - case EAI_MEMORY: return PIE_MEMORY; - case EAI_NONAME: return PIE_NONAME; - case EAI_OVERFLOW: return PIE_OVERFLOW; -#ifdef EAI_PROTOCOL - case EAI_PROTOCOL: return PIE_PROTOCOL; -#endif - case EAI_SERVICE: return PIE_SERVICE; - case EAI_SOCKTYPE: return PIE_SOCKTYPE; - case EAI_SYSTEM: return strerror(errno); - default: return gai_strerror(err); - } -} - diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/usocket.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/usocket.h deleted file mode 100644 index 45f2f99f..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/usocket.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef USOCKET_H -#define USOCKET_H -/*=========================================================================*\ -* Socket compatibilization module for Unix -* LuaSocket toolkit -\*=========================================================================*/ - -/*=========================================================================*\ -* BSD include files -\*=========================================================================*/ -/* error codes */ -#include -/* close function */ -#include -/* fnctnl function and associated constants */ -#include -/* struct sockaddr */ -#include -/* socket function */ -#include -/* struct timeval */ -#include -/* gethostbyname and gethostbyaddr functions */ -#include -/* sigpipe handling */ -#include -/* IP stuff*/ -#include -#include -/* TCP options (nagle algorithm disable) */ -#include -#include - -#ifndef SO_REUSEPORT -#define SO_REUSEPORT SO_REUSEADDR -#endif - -/* Some platforms use IPV6_JOIN_GROUP instead if - * IPV6_ADD_MEMBERSHIP. The semantics are same, though. */ -#ifndef IPV6_ADD_MEMBERSHIP -#ifdef IPV6_JOIN_GROUP -#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP -#endif /* IPV6_JOIN_GROUP */ -#endif /* !IPV6_ADD_MEMBERSHIP */ - -/* Same with IPV6_DROP_MEMBERSHIP / IPV6_LEAVE_GROUP. */ -#ifndef IPV6_DROP_MEMBERSHIP -#ifdef IPV6_LEAVE_GROUP -#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP -#endif /* IPV6_LEAVE_GROUP */ -#endif /* !IPV6_DROP_MEMBERSHIP */ - -typedef int t_socket; -typedef t_socket *p_socket; -typedef struct sockaddr_storage t_sockaddr_storage; - -#define SOCKET_INVALID (-1) - -#endif /* USOCKET_H */ diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/wsocket.c b/love/src/jni/love/src/libraries/luasocket/libluasocket/wsocket.c deleted file mode 100644 index 8ecb0fc7..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/wsocket.c +++ /dev/null @@ -1,433 +0,0 @@ -/*=========================================================================*\ -* Socket compatibilization module for Win32 -* LuaSocket toolkit -* -* The penalty of calling select to avoid busy-wait is only paid when -* the I/O call fail in the first place. -\*=========================================================================*/ -#include - -#include "socket.h" -#include "pierror.h" - -/* WinSock doesn't have a strerror... */ -static const char *wstrerror(int err); - -/*-------------------------------------------------------------------------*\ -* Initializes module -\*-------------------------------------------------------------------------*/ -int socket_open(void) { - WSADATA wsaData; - WORD wVersionRequested = MAKEWORD(2, 0); - int err = WSAStartup(wVersionRequested, &wsaData ); - if (err != 0) return 0; - if ((LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 0) && - (LOBYTE(wsaData.wVersion) != 1 || HIBYTE(wsaData.wVersion) != 1)) { - WSACleanup(); - return 0; - } - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Close module -\*-------------------------------------------------------------------------*/ -int socket_close(void) { - WSACleanup(); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Wait for readable/writable/connected socket with timeout -\*-------------------------------------------------------------------------*/ -#define WAITFD_R 1 -#define WAITFD_W 2 -#define WAITFD_E 4 -#define WAITFD_C (WAITFD_E|WAITFD_W) - -int socket_waitfd(p_socket ps, int sw, p_timeout tm) { - int ret; - fd_set rfds, wfds, efds, *rp = NULL, *wp = NULL, *ep = NULL; - struct timeval tv, *tp = NULL; - double t; - if (timeout_iszero(tm)) return IO_TIMEOUT; /* optimize timeout == 0 case */ - if (sw & WAITFD_R) { - FD_ZERO(&rfds); - FD_SET(*ps, &rfds); - rp = &rfds; - } - if (sw & WAITFD_W) { FD_ZERO(&wfds); FD_SET(*ps, &wfds); wp = &wfds; } - if (sw & WAITFD_C) { FD_ZERO(&efds); FD_SET(*ps, &efds); ep = &efds; } - if ((t = timeout_get(tm)) >= 0.0) { - tv.tv_sec = (int) t; - tv.tv_usec = (int) ((t-tv.tv_sec)*1.0e6); - tp = &tv; - } - ret = select(0, rp, wp, ep, tp); - if (ret == -1) return WSAGetLastError(); - if (ret == 0) return IO_TIMEOUT; - if (sw == WAITFD_C && FD_ISSET(*ps, &efds)) return IO_CLOSED; - return IO_DONE; -} - -/*-------------------------------------------------------------------------*\ -* Select with int timeout in ms -\*-------------------------------------------------------------------------*/ -int socket_select(t_socket n, fd_set *rfds, fd_set *wfds, fd_set *efds, - p_timeout tm) { - struct timeval tv; - double t = timeout_get(tm); - tv.tv_sec = (int) t; - tv.tv_usec = (int) ((t - tv.tv_sec) * 1.0e6); - if (n <= 0) { - Sleep((DWORD) (1000*t)); - return 0; - } else return select(0, rfds, wfds, efds, t >= 0.0? &tv: NULL); -} - -/*-------------------------------------------------------------------------*\ -* Close and inutilize socket -\*-------------------------------------------------------------------------*/ -void socket_destroy(p_socket ps) { - if (*ps != SOCKET_INVALID) { - socket_setblocking(ps); /* close can take a long time on WIN32 */ - closesocket(*ps); - *ps = SOCKET_INVALID; - } -} - -/*-------------------------------------------------------------------------*\ -* -\*-------------------------------------------------------------------------*/ -void socket_shutdown(p_socket ps, int how) { - socket_setblocking(ps); - shutdown(*ps, how); - socket_setnonblocking(ps); -} - -/*-------------------------------------------------------------------------*\ -* Creates and sets up a socket -\*-------------------------------------------------------------------------*/ -int socket_create(p_socket ps, int domain, int type, int protocol) { - *ps = socket(domain, type, protocol); - if (*ps != SOCKET_INVALID) return IO_DONE; - else return WSAGetLastError(); -} - -/*-------------------------------------------------------------------------*\ -* Connects or returns error message -\*-------------------------------------------------------------------------*/ -int socket_connect(p_socket ps, SA *addr, socklen_t len, p_timeout tm) { - int err; - /* don't call on closed socket */ - if (*ps == SOCKET_INVALID) return IO_CLOSED; - /* ask system to connect */ - if (connect(*ps, addr, len) == 0) return IO_DONE; - /* make sure the system is trying to connect */ - err = WSAGetLastError(); - if (err != WSAEWOULDBLOCK && err != WSAEINPROGRESS) return err; - /* zero timeout case optimization */ - if (timeout_iszero(tm)) return IO_TIMEOUT; - /* we wait until something happens */ - err = socket_waitfd(ps, WAITFD_C, tm); - if (err == IO_CLOSED) { - int len = sizeof(err); - /* give windows time to set the error (yes, disgusting) */ - Sleep(10); - /* find out why we failed */ - getsockopt(*ps, SOL_SOCKET, SO_ERROR, (char *)&err, &len); - /* we KNOW there was an error. if 'why' is 0, we will return - * "unknown error", but it's not really our fault */ - return err > 0? err: IO_UNKNOWN; - } else return err; - -} - -/*-------------------------------------------------------------------------*\ -* Binds or returns error message -\*-------------------------------------------------------------------------*/ -int socket_bind(p_socket ps, SA *addr, socklen_t len) { - int err = IO_DONE; - socket_setblocking(ps); - if (bind(*ps, addr, len) < 0) err = WSAGetLastError(); - socket_setnonblocking(ps); - return err; -} - -/*-------------------------------------------------------------------------*\ -* -\*-------------------------------------------------------------------------*/ -int socket_listen(p_socket ps, int backlog) { - int err = IO_DONE; - socket_setblocking(ps); - if (listen(*ps, backlog) < 0) err = WSAGetLastError(); - socket_setnonblocking(ps); - return err; -} - -/*-------------------------------------------------------------------------*\ -* Accept with timeout -\*-------------------------------------------------------------------------*/ -int socket_accept(p_socket ps, p_socket pa, SA *addr, socklen_t *len, - p_timeout tm) { - if (*ps == SOCKET_INVALID) return IO_CLOSED; - for ( ;; ) { - int err; - /* try to get client socket */ - if ((*pa = accept(*ps, addr, len)) != SOCKET_INVALID) return IO_DONE; - /* find out why we failed */ - err = WSAGetLastError(); - /* if we failed because there was no connectoin, keep trying */ - if (err != WSAEWOULDBLOCK && err != WSAECONNABORTED) return err; - /* call select to avoid busy wait */ - if ((err = socket_waitfd(ps, WAITFD_R, tm)) != IO_DONE) return err; - } -} - -/*-------------------------------------------------------------------------*\ -* Send with timeout -* On windows, if you try to send 10MB, the OS will buffer EVERYTHING -* this can take an awful lot of time and we will end up blocked. -* Therefore, whoever calls this function should not pass a huge buffer. -\*-------------------------------------------------------------------------*/ -int socket_send(p_socket ps, const char *data, size_t count, - size_t *sent, p_timeout tm) -{ - int err; - *sent = 0; - /* avoid making system calls on closed sockets */ - if (*ps == SOCKET_INVALID) return IO_CLOSED; - /* loop until we send something or we give up on error */ - for ( ;; ) { - /* try to send something */ - int put = send(*ps, data, (int) count, 0); - /* if we sent something, we are done */ - if (put > 0) { - *sent = put; - return IO_DONE; - } - /* deal with failure */ - err = WSAGetLastError(); - /* we can only proceed if there was no serious error */ - if (err != WSAEWOULDBLOCK) return err; - /* avoid busy wait */ - if ((err = socket_waitfd(ps, WAITFD_W, tm)) != IO_DONE) return err; - } -} - -/*-------------------------------------------------------------------------*\ -* Sendto with timeout -\*-------------------------------------------------------------------------*/ -int socket_sendto(p_socket ps, const char *data, size_t count, size_t *sent, - SA *addr, socklen_t len, p_timeout tm) -{ - int err; - *sent = 0; - if (*ps == SOCKET_INVALID) return IO_CLOSED; - for ( ;; ) { - int put = sendto(*ps, data, (int) count, 0, addr, len); - if (put > 0) { - *sent = put; - return IO_DONE; - } - err = WSAGetLastError(); - if (err != WSAEWOULDBLOCK) return err; - if ((err = socket_waitfd(ps, WAITFD_W, tm)) != IO_DONE) return err; - } -} - -/*-------------------------------------------------------------------------*\ -* Receive with timeout -\*-------------------------------------------------------------------------*/ -int socket_recv(p_socket ps, char *data, size_t count, size_t *got, - p_timeout tm) -{ - int err, prev = IO_DONE; - *got = 0; - if (*ps == SOCKET_INVALID) return IO_CLOSED; - for ( ;; ) { - int taken = recv(*ps, data, (int) count, 0); - if (taken > 0) { - *got = taken; - return IO_DONE; - } - if (taken == 0) return IO_CLOSED; - err = WSAGetLastError(); - /* On UDP, a connreset simply means the previous send failed. - * So we try again. - * On TCP, it means our socket is now useless, so the error passes. - * (We will loop again, exiting because the same error will happen) */ - if (err != WSAEWOULDBLOCK) { - if (err != WSAECONNRESET || prev == WSAECONNRESET) return err; - prev = err; - } - if ((err = socket_waitfd(ps, WAITFD_R, tm)) != IO_DONE) return err; - } -} - -/*-------------------------------------------------------------------------*\ -* Recvfrom with timeout -\*-------------------------------------------------------------------------*/ -int socket_recvfrom(p_socket ps, char *data, size_t count, size_t *got, - SA *addr, socklen_t *len, p_timeout tm) -{ - int err, prev = IO_DONE; - *got = 0; - if (*ps == SOCKET_INVALID) return IO_CLOSED; - for ( ;; ) { - int taken = recvfrom(*ps, data, (int) count, 0, addr, len); - if (taken > 0) { - *got = taken; - return IO_DONE; - } - if (taken == 0) return IO_CLOSED; - err = WSAGetLastError(); - /* On UDP, a connreset simply means the previous send failed. - * So we try again. - * On TCP, it means our socket is now useless, so the error passes. - * (We will loop again, exiting because the same error will happen) */ - if (err != WSAEWOULDBLOCK) { - if (err != WSAECONNRESET || prev == WSAECONNRESET) return err; - prev = err; - } - if ((err = socket_waitfd(ps, WAITFD_R, tm)) != IO_DONE) return err; - } -} - -/*-------------------------------------------------------------------------*\ -* Put socket into blocking mode -\*-------------------------------------------------------------------------*/ -void socket_setblocking(p_socket ps) { - u_long argp = 0; - ioctlsocket(*ps, FIONBIO, &argp); -} - -/*-------------------------------------------------------------------------*\ -* Put socket into non-blocking mode -\*-------------------------------------------------------------------------*/ -void socket_setnonblocking(p_socket ps) { - u_long argp = 1; - ioctlsocket(*ps, FIONBIO, &argp); -} - -/*-------------------------------------------------------------------------*\ -* DNS helpers -\*-------------------------------------------------------------------------*/ -int socket_gethostbyaddr(const char *addr, socklen_t len, struct hostent **hp) { - *hp = gethostbyaddr(addr, len, AF_INET); - if (*hp) return IO_DONE; - else return WSAGetLastError(); -} - -int socket_gethostbyname(const char *addr, struct hostent **hp) { - *hp = gethostbyname(addr); - if (*hp) return IO_DONE; - else return WSAGetLastError(); -} - -/*-------------------------------------------------------------------------*\ -* Error translation functions -\*-------------------------------------------------------------------------*/ -const char *socket_hoststrerror(int err) { - if (err <= 0) return io_strerror(err); - switch (err) { - case WSAHOST_NOT_FOUND: return PIE_HOST_NOT_FOUND; - default: return wstrerror(err); - } -} - -const char *socket_strerror(int err) { - if (err <= 0) return io_strerror(err); - switch (err) { - case WSAEADDRINUSE: return PIE_ADDRINUSE; - case WSAECONNREFUSED : return PIE_CONNREFUSED; - case WSAEISCONN: return PIE_ISCONN; - case WSAEACCES: return PIE_ACCESS; - case WSAECONNABORTED: return PIE_CONNABORTED; - case WSAECONNRESET: return PIE_CONNRESET; - case WSAETIMEDOUT: return PIE_TIMEDOUT; - default: return wstrerror(err); - } -} - -const char *socket_ioerror(p_socket ps, int err) { - (void) ps; - return socket_strerror(err); -} - -static const char *wstrerror(int err) { - switch (err) { - case WSAEINTR: return "Interrupted function call"; - case WSAEACCES: return PIE_ACCESS; // "Permission denied"; - case WSAEFAULT: return "Bad address"; - case WSAEINVAL: return "Invalid argument"; - case WSAEMFILE: return "Too many open files"; - case WSAEWOULDBLOCK: return "Resource temporarily unavailable"; - case WSAEINPROGRESS: return "Operation now in progress"; - case WSAEALREADY: return "Operation already in progress"; - case WSAENOTSOCK: return "Socket operation on nonsocket"; - case WSAEDESTADDRREQ: return "Destination address required"; - case WSAEMSGSIZE: return "Message too long"; - case WSAEPROTOTYPE: return "Protocol wrong type for socket"; - case WSAENOPROTOOPT: return "Bad protocol option"; - case WSAEPROTONOSUPPORT: return "Protocol not supported"; - case WSAESOCKTNOSUPPORT: return PIE_SOCKTYPE; // "Socket type not supported"; - case WSAEOPNOTSUPP: return "Operation not supported"; - case WSAEPFNOSUPPORT: return "Protocol family not supported"; - case WSAEAFNOSUPPORT: return PIE_FAMILY; // "Address family not supported by protocol family"; - case WSAEADDRINUSE: return PIE_ADDRINUSE; // "Address already in use"; - case WSAEADDRNOTAVAIL: return "Cannot assign requested address"; - case WSAENETDOWN: return "Network is down"; - case WSAENETUNREACH: return "Network is unreachable"; - case WSAENETRESET: return "Network dropped connection on reset"; - case WSAECONNABORTED: return "Software caused connection abort"; - case WSAECONNRESET: return PIE_CONNRESET; // "Connection reset by peer"; - case WSAENOBUFS: return "No buffer space available"; - case WSAEISCONN: return PIE_ISCONN; // "Socket is already connected"; - case WSAENOTCONN: return "Socket is not connected"; - case WSAESHUTDOWN: return "Cannot send after socket shutdown"; - case WSAETIMEDOUT: return PIE_TIMEDOUT; // "Connection timed out"; - case WSAECONNREFUSED: return PIE_CONNREFUSED; // "Connection refused"; - case WSAEHOSTDOWN: return "Host is down"; - case WSAEHOSTUNREACH: return "No route to host"; - case WSAEPROCLIM: return "Too many processes"; - case WSASYSNOTREADY: return "Network subsystem is unavailable"; - case WSAVERNOTSUPPORTED: return "Winsock.dll version out of range"; - case WSANOTINITIALISED: - return "Successful WSAStartup not yet performed"; - case WSAEDISCON: return "Graceful shutdown in progress"; - case WSAHOST_NOT_FOUND: return PIE_HOST_NOT_FOUND; // "Host not found"; - case WSATRY_AGAIN: return "Nonauthoritative host not found"; - case WSANO_RECOVERY: return PIE_FAIL; // "Nonrecoverable name lookup error"; - case WSANO_DATA: return "Valid name, no data record of requested type"; - default: return "Unknown error"; - } -} - -const char *socket_gaistrerror(int err) { - if (err == 0) return NULL; - switch (err) { - case EAI_AGAIN: return PIE_AGAIN; - case EAI_BADFLAGS: return PIE_BADFLAGS; -#ifdef EAI_BADHINTS - case EAI_BADHINTS: return PIE_BADHINTS; -#endif - case EAI_FAIL: return PIE_FAIL; - case EAI_FAMILY: return PIE_FAMILY; - case EAI_MEMORY: return PIE_MEMORY; - case EAI_NONAME: return PIE_NONAME; -#ifdef EAI_OVERFLOW - case EAI_OVERFLOW: return PIE_OVERFLOW; -#endif -#ifdef EAI_PROTOCOL - case EAI_PROTOCOL: return PIE_PROTOCOL; -#endif - case EAI_SERVICE: return PIE_SERVICE; - case EAI_SOCKTYPE: return PIE_SOCKTYPE; -#ifdef EAI_SYSTEM - case EAI_SYSTEM: return strerror(errno); -#endif - default: return gai_strerror(err); - } -} - diff --git a/love/src/jni/love/src/libraries/luasocket/libluasocket/wsocket.h b/love/src/jni/love/src/libraries/luasocket/libluasocket/wsocket.h deleted file mode 100644 index 39866402..00000000 --- a/love/src/jni/love/src/libraries/luasocket/libluasocket/wsocket.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef WSOCKET_H -#define WSOCKET_H -/*=========================================================================*\ -* Socket compatibilization module for Win32 -* LuaSocket toolkit -\*=========================================================================*/ - -/*=========================================================================*\ -* WinSock include files -\*=========================================================================*/ -#include -#include - -typedef int socklen_t; -typedef SOCKADDR_STORAGE t_sockaddr_storage; -typedef SOCKET t_socket; -typedef t_socket *p_socket; - -#ifndef IPV6_V6ONLY -#define IPV6_V6ONLY 27 -#endif - -#define SOCKET_INVALID (INVALID_SOCKET) - -#ifndef SO_REUSEPORT -#define SO_REUSEPORT SO_REUSEADDR -#endif - -#ifndef AI_NUMERICSERV -#define AI_NUMERICSERV (0) -#endif - -#endif /* WSOCKET_H */ diff --git a/love/src/jni/love/src/libraries/luasocket/luasocket.cpp b/love/src/jni/love/src/libraries/luasocket/luasocket.cpp deleted file mode 100644 index 88a99e63..00000000 --- a/love/src/jni/love/src/libraries/luasocket/luasocket.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "luasocket.h" - -// LuaSocket -extern "C" { -#include "libluasocket/luasocket.h" -#include "libluasocket/mime.h" -} - -// Quick macro for adding functions to -// the preloder. -#define PRELOAD(name, function) \ - lua_getglobal(L, "package"); \ - lua_getfield(L, -1, "preload"); \ - lua_pushcfunction(L, function); \ - lua_setfield(L, -2, name); \ - lua_pop(L, 2); - -namespace love -{ -namespace luasocket -{ - -int __open(lua_State * L) -{ - - // Preload code from LuaSocket. - PRELOAD("socket.core", luaopen_socket_core); - PRELOAD("mime.core", luaopen_mime_core); - - PRELOAD("socket", __open_luasocket_socket); - PRELOAD("socket.ftp", __open_luasocket_ftp) - PRELOAD("socket.http", __open_luasocket_http); - PRELOAD("ltn12", __open_luasocket_ltn12); - PRELOAD("mime", __open_luasocket_mime) - PRELOAD("socket.smtp", __open_luasocket_smtp); - PRELOAD("socket.tp", __open_luasocket_tp) - PRELOAD("socket.url", __open_luasocket_url) - PRELOAD("socket.headers", __open_luasocket_headers) - PRELOAD("mbox", __open_luasocket_mbox) - - // No need to register garbage collector function. - - return 0; -} - -int __open_luasocket_socket(lua_State * L) -{ - #include "libluasocket/socket.lua.h" - return 1; -} - -int __open_luasocket_ftp(lua_State * L) -{ - #include "libluasocket/ftp.lua.h" - return 1; -} - -int __open_luasocket_http(lua_State * L) -{ - #include "libluasocket/http.lua.h" - return 1; -} - -int __open_luasocket_ltn12(lua_State * L) -{ - #include "libluasocket/ltn12.lua.h" - return 1; -} - -int __open_luasocket_mime(lua_State * L) -{ - #include "libluasocket/mime.lua.h" - return 1; -} - -int __open_luasocket_smtp(lua_State * L) -{ - #include "libluasocket/smtp.lua.h" - return 1; -} - -int __open_luasocket_tp(lua_State * L) -{ - #include "libluasocket/tp.lua.h" - return 1; -} - -int __open_luasocket_url(lua_State * L) -{ - #include "libluasocket/url.lua.h" - return 1; -} - -int __open_luasocket_headers(lua_State * L) -{ - #include "libluasocket/headers.lua.h" - return 1; -} - -int __open_luasocket_mbox(lua_State * L) -{ - #include "libluasocket/mbox.lua.h" - return 1; -} - -} // luasocket -} // love diff --git a/love/src/jni/love/src/libraries/luasocket/luasocket.h b/love/src/jni/love/src/libraries/luasocket/luasocket.h deleted file mode 100644 index e322f8ac..00000000 --- a/love/src/jni/love/src/libraries/luasocket/luasocket.h +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_LUASOCKET_LUASOCKET_H -#define LOVE_LUASOCKET_LUASOCKET_H - -// LOVE -#include - -namespace love -{ -namespace luasocket -{ - -int __open(lua_State * L); - -// Loaders for all lua files. We want to be able -// to load these dynamically. (Identical in the LuaSocket -// documentation. These functions wrap the parsing of code, etc). -int __open_luasocket_socket(lua_State * L); -int __open_luasocket_ftp(lua_State * L); -int __open_luasocket_http(lua_State * L); -int __open_luasocket_ltn12(lua_State * L); -int __open_luasocket_mime(lua_State * L); -int __open_luasocket_smtp(lua_State * L); -int __open_luasocket_tp(lua_State * L); -int __open_luasocket_url(lua_State * L); -int __open_luasocket_headers(lua_State * L); -int __open_luasocket_mbox(lua_State * L); - -} // luasocket -} // love - -#endif // LOVE_LUASOCKET_LUASOCKET_H diff --git a/love/src/jni/love/src/libraries/lz4/lz4.c b/love/src/jni/love/src/libraries/lz4/lz4.c deleted file mode 100755 index 213b0851..00000000 --- a/love/src/jni/love/src/libraries/lz4/lz4.c +++ /dev/null @@ -1,1564 +0,0 @@ -/* - LZ4 - Fast LZ compression algorithm - Copyright (C) 2011-2017, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - 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. - - 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 THE COPYRIGHT - OWNER OR CONTRIBUTORS 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. - - You can contact the author at : - - LZ4 homepage : http://www.lz4.org - - LZ4 source repository : https://github.com/lz4/lz4 -*/ - - -/*-************************************ -* Tuning parameters -**************************************/ -/* - * LZ4_HEAPMODE : - * Select how default compression functions will allocate memory for their hash table, - * in memory stack (0:default, fastest), or in memory heap (1:requires malloc()). - */ -#ifndef LZ4_HEAPMODE -# define LZ4_HEAPMODE 0 -#endif - -/* - * ACCELERATION_DEFAULT : - * Select "acceleration" for LZ4_compress_fast() when parameter value <= 0 - */ -#define ACCELERATION_DEFAULT 1 - - -/*-************************************ -* CPU Feature Detection -**************************************/ -/* LZ4_FORCE_MEMORY_ACCESS - * By default, access to unaligned memory is controlled by `memcpy()`, which is safe and portable. - * Unfortunately, on some target/compiler combinations, the generated assembly is sub-optimal. - * The below switch allow to select different access method for improved performance. - * Method 0 (default) : use `memcpy()`. Safe and portable. - * Method 1 : `__packed` statement. It depends on compiler extension (ie, not portable). - * This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`. - * Method 2 : direct access. This method is portable but violate C standard. - * It can generate buggy code on targets which assembly generation depends on alignment. - * But in some circumstances, it's the only known way to get the most performance (ie GCC + ARMv6) - * See https://fastcompression.blogspot.fr/2015/08/accessing-unaligned-memory.html for details. - * Prefer these methods in priority order (0 > 1 > 2) - */ -#ifndef LZ4_FORCE_MEMORY_ACCESS /* can be defined externally */ -# if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) ) -# define LZ4_FORCE_MEMORY_ACCESS 2 -# elif defined(__INTEL_COMPILER) || defined(__GNUC__) -# define LZ4_FORCE_MEMORY_ACCESS 1 -# endif -#endif - -/* - * LZ4_FORCE_SW_BITCOUNT - * Define this parameter if your target system or compiler does not support hardware bit count - */ -#if defined(_MSC_VER) && defined(_WIN32_WCE) /* Visual Studio for Windows CE does not support Hardware bit count */ -# define LZ4_FORCE_SW_BITCOUNT -#endif - - - -/*-************************************ -* Dependency -**************************************/ -#include "lz4.h" -/* see also "memory routines" below */ - - -/*-************************************ -* Compiler Options -**************************************/ -#ifdef _MSC_VER /* Visual Studio */ -# include -# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ -# pragma warning(disable : 4293) /* disable: C4293: too large shift (32-bits) */ -#endif /* _MSC_VER */ - -#ifndef LZ4_FORCE_INLINE -# ifdef _MSC_VER /* Visual Studio */ -# define LZ4_FORCE_INLINE static __forceinline -# else -# if defined (__cplusplus) || defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ -# ifdef __GNUC__ -# define LZ4_FORCE_INLINE static inline __attribute__((always_inline)) -# else -# define LZ4_FORCE_INLINE static inline -# endif -# else -# define LZ4_FORCE_INLINE static -# endif /* __STDC_VERSION__ */ -# endif /* _MSC_VER */ -#endif /* LZ4_FORCE_INLINE */ - -/* LZ4_FORCE_O2_GCC_PPC64LE and LZ4_FORCE_O2_INLINE_GCC_PPC64LE - * Gcc on ppc64le generates an unrolled SIMDized loop for LZ4_wildCopy, - * together with a simple 8-byte copy loop as a fall-back path. - * However, this optimization hurts the decompression speed by >30%, - * because the execution does not go to the optimized loop - * for typical compressible data, and all of the preamble checks - * before going to the fall-back path become useless overhead. - * This optimization happens only with the -O3 flag, and -O2 generates - * a simple 8-byte copy loop. - * With gcc on ppc64le, all of the LZ4_decompress_* and LZ4_wildCopy - * functions are annotated with __attribute__((optimize("O2"))), - * and also LZ4_wildCopy is forcibly inlined, so that the O2 attribute - * of LZ4_wildCopy does not affect the compression speed. - */ -#if defined(__PPC64__) && defined(__LITTLE_ENDIAN__) && defined(__GNUC__) -# define LZ4_FORCE_O2_GCC_PPC64LE __attribute__((optimize("O2"))) -# define LZ4_FORCE_O2_INLINE_GCC_PPC64LE __attribute__((optimize("O2"))) LZ4_FORCE_INLINE -#else -# define LZ4_FORCE_O2_GCC_PPC64LE -# define LZ4_FORCE_O2_INLINE_GCC_PPC64LE static -#endif - -#if (defined(__GNUC__) && (__GNUC__ >= 3)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) || defined(__clang__) -# define expect(expr,value) (__builtin_expect ((expr),(value)) ) -#else -# define expect(expr,value) (expr) -#endif - -#define likely(expr) expect((expr) != 0, 1) -#define unlikely(expr) expect((expr) != 0, 0) - - -/*-************************************ -* Memory routines -**************************************/ -#include /* malloc, calloc, free */ -#define ALLOCATOR(n,s) calloc(n,s) -#define FREEMEM free -#include /* memset, memcpy */ -#define MEM_INIT memset - - -/*-************************************ -* Basic Types -**************************************/ -#if defined(__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) -# include - typedef uint8_t BYTE; - typedef uint16_t U16; - typedef uint32_t U32; - typedef int32_t S32; - typedef uint64_t U64; - typedef uintptr_t uptrval; -#else - typedef unsigned char BYTE; - typedef unsigned short U16; - typedef unsigned int U32; - typedef signed int S32; - typedef unsigned long long U64; - typedef size_t uptrval; /* generally true, except OpenVMS-64 */ -#endif - -#if defined(__x86_64__) - typedef U64 reg_t; /* 64-bits in x32 mode */ -#else - typedef size_t reg_t; /* 32-bits in x32 mode */ -#endif - -/*-************************************ -* Reading and writing into memory -**************************************/ -static unsigned LZ4_isLittleEndian(void) -{ - const union { U32 u; BYTE c[4]; } one = { 1 }; /* don't use static : performance detrimental */ - return one.c[0]; -} - - -#if defined(LZ4_FORCE_MEMORY_ACCESS) && (LZ4_FORCE_MEMORY_ACCESS==2) -/* lie to the compiler about data alignment; use with caution */ - -static U16 LZ4_read16(const void* memPtr) { return *(const U16*) memPtr; } -static U32 LZ4_read32(const void* memPtr) { return *(const U32*) memPtr; } -static reg_t LZ4_read_ARCH(const void* memPtr) { return *(const reg_t*) memPtr; } - -static void LZ4_write16(void* memPtr, U16 value) { *(U16*)memPtr = value; } -static void LZ4_write32(void* memPtr, U32 value) { *(U32*)memPtr = value; } - -#elif defined(LZ4_FORCE_MEMORY_ACCESS) && (LZ4_FORCE_MEMORY_ACCESS==1) - -/* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */ -/* currently only defined for gcc and icc */ -typedef union { U16 u16; U32 u32; reg_t uArch; } __attribute__((packed)) unalign; - -static U16 LZ4_read16(const void* ptr) { return ((const unalign*)ptr)->u16; } -static U32 LZ4_read32(const void* ptr) { return ((const unalign*)ptr)->u32; } -static reg_t LZ4_read_ARCH(const void* ptr) { return ((const unalign*)ptr)->uArch; } - -static void LZ4_write16(void* memPtr, U16 value) { ((unalign*)memPtr)->u16 = value; } -static void LZ4_write32(void* memPtr, U32 value) { ((unalign*)memPtr)->u32 = value; } - -#else /* safe and portable access through memcpy() */ - -static U16 LZ4_read16(const void* memPtr) -{ - U16 val; memcpy(&val, memPtr, sizeof(val)); return val; -} - -static U32 LZ4_read32(const void* memPtr) -{ - U32 val; memcpy(&val, memPtr, sizeof(val)); return val; -} - -static reg_t LZ4_read_ARCH(const void* memPtr) -{ - reg_t val; memcpy(&val, memPtr, sizeof(val)); return val; -} - -static void LZ4_write16(void* memPtr, U16 value) -{ - memcpy(memPtr, &value, sizeof(value)); -} - -static void LZ4_write32(void* memPtr, U32 value) -{ - memcpy(memPtr, &value, sizeof(value)); -} - -#endif /* LZ4_FORCE_MEMORY_ACCESS */ - - -static U16 LZ4_readLE16(const void* memPtr) -{ - if (LZ4_isLittleEndian()) { - return LZ4_read16(memPtr); - } else { - const BYTE* p = (const BYTE*)memPtr; - return (U16)((U16)p[0] + (p[1]<<8)); - } -} - -static void LZ4_writeLE16(void* memPtr, U16 value) -{ - if (LZ4_isLittleEndian()) { - LZ4_write16(memPtr, value); - } else { - BYTE* p = (BYTE*)memPtr; - p[0] = (BYTE) value; - p[1] = (BYTE)(value>>8); - } -} - -static void LZ4_copy8(void* dst, const void* src) -{ - memcpy(dst,src,8); -} - -/* customized variant of memcpy, which can overwrite up to 8 bytes beyond dstEnd */ -LZ4_FORCE_O2_INLINE_GCC_PPC64LE -void LZ4_wildCopy(void* dstPtr, const void* srcPtr, void* dstEnd) -{ - BYTE* d = (BYTE*)dstPtr; - const BYTE* s = (const BYTE*)srcPtr; - BYTE* const e = (BYTE*)dstEnd; - - do { LZ4_copy8(d,s); d+=8; s+=8; } while (d=1) -# include -#else -# ifndef assert -# define assert(condition) ((void)0) -# endif -#endif - -#define LZ4_STATIC_ASSERT(c) { enum { LZ4_static_assert = 1/(int)(!!(c)) }; } /* use only *after* variable declarations */ - -#if defined(LZ4_DEBUG) && (LZ4_DEBUG>=2) -# include -static int g_debuglog_enable = 1; -# define DEBUGLOG(l, ...) { \ - if ((g_debuglog_enable) && (l<=LZ4_DEBUG)) { \ - fprintf(stderr, __FILE__ ": "); \ - fprintf(stderr, __VA_ARGS__); \ - fprintf(stderr, " \n"); \ - } } -#else -# define DEBUGLOG(l, ...) {} /* disabled */ -#endif - - -/*-************************************ -* Common functions -**************************************/ -static unsigned LZ4_NbCommonBytes (reg_t val) -{ - if (LZ4_isLittleEndian()) { - if (sizeof(val)==8) { -# if defined(_MSC_VER) && defined(_WIN64) && !defined(LZ4_FORCE_SW_BITCOUNT) - unsigned long r = 0; - _BitScanForward64( &r, (U64)val ); - return (int)(r>>3); -# elif (defined(__clang__) || (defined(__GNUC__) && (__GNUC__>=3))) && !defined(LZ4_FORCE_SW_BITCOUNT) - return (__builtin_ctzll((U64)val) >> 3); -# else - static const int DeBruijnBytePos[64] = { 0, 0, 0, 0, 0, 1, 1, 2, - 0, 3, 1, 3, 1, 4, 2, 7, - 0, 2, 3, 6, 1, 5, 3, 5, - 1, 3, 4, 4, 2, 5, 6, 7, - 7, 0, 1, 2, 3, 3, 4, 6, - 2, 6, 5, 5, 3, 4, 5, 6, - 7, 1, 2, 4, 6, 4, 4, 5, - 7, 2, 6, 5, 7, 6, 7, 7 }; - return DeBruijnBytePos[((U64)((val & -(long long)val) * 0x0218A392CDABBD3FULL)) >> 58]; -# endif - } else /* 32 bits */ { -# if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) - unsigned long r; - _BitScanForward( &r, (U32)val ); - return (int)(r>>3); -# elif (defined(__clang__) || (defined(__GNUC__) && (__GNUC__>=3))) && !defined(LZ4_FORCE_SW_BITCOUNT) - return (__builtin_ctz((U32)val) >> 3); -# else - static const int DeBruijnBytePos[32] = { 0, 0, 3, 0, 3, 1, 3, 0, - 3, 2, 2, 1, 3, 2, 0, 1, - 3, 3, 1, 2, 2, 2, 2, 0, - 3, 1, 2, 0, 1, 0, 1, 1 }; - return DeBruijnBytePos[((U32)((val & -(S32)val) * 0x077CB531U)) >> 27]; -# endif - } - } else /* Big Endian CPU */ { - if (sizeof(val)==8) { /* 64-bits */ -# if defined(_MSC_VER) && defined(_WIN64) && !defined(LZ4_FORCE_SW_BITCOUNT) - unsigned long r = 0; - _BitScanReverse64( &r, val ); - return (unsigned)(r>>3); -# elif (defined(__clang__) || (defined(__GNUC__) && (__GNUC__>=3))) && !defined(LZ4_FORCE_SW_BITCOUNT) - return (__builtin_clzll((U64)val) >> 3); -# else - static const U32 by32 = sizeof(val)*4; /* 32 on 64 bits (goal), 16 on 32 bits. - Just to avoid some static analyzer complaining about shift by 32 on 32-bits target. - Note that this code path is never triggered in 32-bits mode. */ - unsigned r; - if (!(val>>by32)) { r=4; } else { r=0; val>>=by32; } - if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; } - r += (!val); - return r; -# endif - } else /* 32 bits */ { -# if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) - unsigned long r = 0; - _BitScanReverse( &r, (unsigned long)val ); - return (unsigned)(r>>3); -# elif (defined(__clang__) || (defined(__GNUC__) && (__GNUC__>=3))) && !defined(LZ4_FORCE_SW_BITCOUNT) - return (__builtin_clz((U32)val) >> 3); -# else - unsigned r; - if (!(val>>16)) { r=2; val>>=8; } else { r=0; val>>=24; } - r += (!val); - return r; -# endif - } - } -} - -#define STEPSIZE sizeof(reg_t) -LZ4_FORCE_INLINE -unsigned LZ4_count(const BYTE* pIn, const BYTE* pMatch, const BYTE* pInLimit) -{ - const BYTE* const pStart = pIn; - - if (likely(pIn < pInLimit-(STEPSIZE-1))) { - reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn); - if (!diff) { - pIn+=STEPSIZE; pMatch+=STEPSIZE; - } else { - return LZ4_NbCommonBytes(diff); - } } - - while (likely(pIn < pInLimit-(STEPSIZE-1))) { - reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn); - if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; } - pIn += LZ4_NbCommonBytes(diff); - return (unsigned)(pIn - pStart); - } - - if ((STEPSIZE==8) && (pIn<(pInLimit-3)) && (LZ4_read32(pMatch) == LZ4_read32(pIn))) { pIn+=4; pMatch+=4; } - if ((pIn<(pInLimit-1)) && (LZ4_read16(pMatch) == LZ4_read16(pIn))) { pIn+=2; pMatch+=2; } - if ((pIn compression run slower on incompressible data */ - - -/*-************************************ -* Local Structures and types -**************************************/ -typedef enum { notLimited = 0, limitedOutput = 1 } limitedOutput_directive; -typedef enum { byPtr, byU32, byU16 } tableType_t; - -typedef enum { noDict = 0, withPrefix64k, usingExtDict } dict_directive; -typedef enum { noDictIssue = 0, dictSmall } dictIssue_directive; - -typedef enum { endOnOutputSize = 0, endOnInputSize = 1 } endCondition_directive; -typedef enum { full = 0, partial = 1 } earlyEnd_directive; - - -/*-************************************ -* Local Utils -**************************************/ -int LZ4_versionNumber (void) { return LZ4_VERSION_NUMBER; } -const char* LZ4_versionString(void) { return LZ4_VERSION_STRING; } -int LZ4_compressBound(int isize) { return LZ4_COMPRESSBOUND(isize); } -int LZ4_sizeofState() { return LZ4_STREAMSIZE; } - - -/*-****************************** -* Compression functions -********************************/ -static U32 LZ4_hash4(U32 sequence, tableType_t const tableType) -{ - if (tableType == byU16) - return ((sequence * 2654435761U) >> ((MINMATCH*8)-(LZ4_HASHLOG+1))); - else - return ((sequence * 2654435761U) >> ((MINMATCH*8)-LZ4_HASHLOG)); -} - -static U32 LZ4_hash5(U64 sequence, tableType_t const tableType) -{ - static const U64 prime5bytes = 889523592379ULL; - static const U64 prime8bytes = 11400714785074694791ULL; - const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG; - if (LZ4_isLittleEndian()) - return (U32)(((sequence << 24) * prime5bytes) >> (64 - hashLog)); - else - return (U32)(((sequence >> 24) * prime8bytes) >> (64 - hashLog)); -} - -LZ4_FORCE_INLINE U32 LZ4_hashPosition(const void* const p, tableType_t const tableType) -{ - if ((sizeof(reg_t)==8) && (tableType != byU16)) return LZ4_hash5(LZ4_read_ARCH(p), tableType); - return LZ4_hash4(LZ4_read32(p), tableType); -} - -static void LZ4_putPositionOnHash(const BYTE* p, U32 h, void* tableBase, tableType_t const tableType, const BYTE* srcBase) -{ - switch (tableType) - { - case byPtr: { const BYTE** hashTable = (const BYTE**)tableBase; hashTable[h] = p; return; } - case byU32: { U32* hashTable = (U32*) tableBase; hashTable[h] = (U32)(p-srcBase); return; } - case byU16: { U16* hashTable = (U16*) tableBase; hashTable[h] = (U16)(p-srcBase); return; } - } -} - -LZ4_FORCE_INLINE void LZ4_putPosition(const BYTE* p, void* tableBase, tableType_t tableType, const BYTE* srcBase) -{ - U32 const h = LZ4_hashPosition(p, tableType); - LZ4_putPositionOnHash(p, h, tableBase, tableType, srcBase); -} - -static const BYTE* LZ4_getPositionOnHash(U32 h, void* tableBase, tableType_t tableType, const BYTE* srcBase) -{ - if (tableType == byPtr) { const BYTE** hashTable = (const BYTE**) tableBase; return hashTable[h]; } - if (tableType == byU32) { const U32* const hashTable = (U32*) tableBase; return hashTable[h] + srcBase; } - { const U16* const hashTable = (U16*) tableBase; return hashTable[h] + srcBase; } /* default, to ensure a return */ -} - -LZ4_FORCE_INLINE const BYTE* LZ4_getPosition(const BYTE* p, void* tableBase, tableType_t tableType, const BYTE* srcBase) -{ - U32 const h = LZ4_hashPosition(p, tableType); - return LZ4_getPositionOnHash(h, tableBase, tableType, srcBase); -} - - -/** LZ4_compress_generic() : - inlined, to ensure branches are decided at compilation time */ -LZ4_FORCE_INLINE int LZ4_compress_generic( - LZ4_stream_t_internal* const cctx, - const char* const source, - char* const dest, - const int inputSize, - const int maxOutputSize, - const limitedOutput_directive outputLimited, - const tableType_t tableType, - const dict_directive dict, - const dictIssue_directive dictIssue, - const U32 acceleration) -{ - const BYTE* ip = (const BYTE*) source; - const BYTE* base; - const BYTE* lowLimit; - const BYTE* const lowRefLimit = ip - cctx->dictSize; - const BYTE* const dictionary = cctx->dictionary; - const BYTE* const dictEnd = dictionary + cctx->dictSize; - const ptrdiff_t dictDelta = dictEnd - (const BYTE*)source; - const BYTE* anchor = (const BYTE*) source; - const BYTE* const iend = ip + inputSize; - const BYTE* const mflimit = iend - MFLIMIT; - const BYTE* const matchlimit = iend - LASTLITERALS; - - BYTE* op = (BYTE*) dest; - BYTE* const olimit = op + maxOutputSize; - - U32 forwardH; - - /* Init conditions */ - if ((U32)inputSize > (U32)LZ4_MAX_INPUT_SIZE) return 0; /* Unsupported inputSize, too large (or negative) */ - switch(dict) - { - case noDict: - default: - base = (const BYTE*)source; - lowLimit = (const BYTE*)source; - break; - case withPrefix64k: - base = (const BYTE*)source - cctx->currentOffset; - lowLimit = (const BYTE*)source - cctx->dictSize; - break; - case usingExtDict: - base = (const BYTE*)source - cctx->currentOffset; - lowLimit = (const BYTE*)source; - break; - } - if ((tableType == byU16) && (inputSize>=LZ4_64Klimit)) return 0; /* Size too large (not within 64K limit) */ - if (inputSizehashTable, tableType, base); - ip++; forwardH = LZ4_hashPosition(ip, tableType); - - /* Main Loop */ - for ( ; ; ) { - ptrdiff_t refDelta = 0; - const BYTE* match; - BYTE* token; - - /* Find a match */ - { const BYTE* forwardIp = ip; - unsigned step = 1; - unsigned searchMatchNb = acceleration << LZ4_skipTrigger; - do { - U32 const h = forwardH; - ip = forwardIp; - forwardIp += step; - step = (searchMatchNb++ >> LZ4_skipTrigger); - - if (unlikely(forwardIp > mflimit)) goto _last_literals; - - match = LZ4_getPositionOnHash(h, cctx->hashTable, tableType, base); - if (dict==usingExtDict) { - if (match < (const BYTE*)source) { - refDelta = dictDelta; - lowLimit = dictionary; - } else { - refDelta = 0; - lowLimit = (const BYTE*)source; - } } - forwardH = LZ4_hashPosition(forwardIp, tableType); - LZ4_putPositionOnHash(ip, h, cctx->hashTable, tableType, base); - - } while ( ((dictIssue==dictSmall) ? (match < lowRefLimit) : 0) - || ((tableType==byU16) ? 0 : (match + MAX_DISTANCE < ip)) - || (LZ4_read32(match+refDelta) != LZ4_read32(ip)) ); - } - - /* Catch up */ - while (((ip>anchor) & (match+refDelta > lowLimit)) && (unlikely(ip[-1]==match[refDelta-1]))) { ip--; match--; } - - /* Encode Literals */ - { unsigned const litLength = (unsigned)(ip - anchor); - token = op++; - if ((outputLimited) && /* Check output buffer overflow */ - (unlikely(op + litLength + (2 + 1 + LASTLITERALS) + (litLength/255) > olimit))) - return 0; - if (litLength >= RUN_MASK) { - int len = (int)litLength-RUN_MASK; - *token = (RUN_MASK<= 255 ; len-=255) *op++ = 255; - *op++ = (BYTE)len; - } - else *token = (BYTE)(litLength< matchlimit) limit = matchlimit; - matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, limit); - ip += MINMATCH + matchCode; - if (ip==limit) { - unsigned const more = LZ4_count(ip, (const BYTE*)source, matchlimit); - matchCode += more; - ip += more; - } - } else { - matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit); - ip += MINMATCH + matchCode; - } - - if ( outputLimited && /* Check output buffer overflow */ - (unlikely(op + (1 + LASTLITERALS) + (matchCode>>8) > olimit)) ) - return 0; - if (matchCode >= ML_MASK) { - *token += ML_MASK; - matchCode -= ML_MASK; - LZ4_write32(op, 0xFFFFFFFF); - while (matchCode >= 4*255) { - op+=4; - LZ4_write32(op, 0xFFFFFFFF); - matchCode -= 4*255; - } - op += matchCode / 255; - *op++ = (BYTE)(matchCode % 255); - } else - *token += (BYTE)(matchCode); - } - - anchor = ip; - - /* Test end of chunk */ - if (ip > mflimit) break; - - /* Fill table */ - LZ4_putPosition(ip-2, cctx->hashTable, tableType, base); - - /* Test next position */ - match = LZ4_getPosition(ip, cctx->hashTable, tableType, base); - if (dict==usingExtDict) { - if (match < (const BYTE*)source) { - refDelta = dictDelta; - lowLimit = dictionary; - } else { - refDelta = 0; - lowLimit = (const BYTE*)source; - } } - LZ4_putPosition(ip, cctx->hashTable, tableType, base); - if ( ((dictIssue==dictSmall) ? (match>=lowRefLimit) : 1) - && (match+MAX_DISTANCE>=ip) - && (LZ4_read32(match+refDelta)==LZ4_read32(ip)) ) - { token=op++; *token=0; goto _next_match; } - - /* Prepare next loop */ - forwardH = LZ4_hashPosition(++ip, tableType); - } - -_last_literals: - /* Encode Last Literals */ - { size_t const lastRun = (size_t)(iend - anchor); - if ( (outputLimited) && /* Check output buffer overflow */ - ((op - (BYTE*)dest) + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > (U32)maxOutputSize) ) - return 0; - if (lastRun >= RUN_MASK) { - size_t accumulator = lastRun - RUN_MASK; - *op++ = RUN_MASK << ML_BITS; - for(; accumulator >= 255 ; accumulator-=255) *op++ = 255; - *op++ = (BYTE) accumulator; - } else { - *op++ = (BYTE)(lastRun<internal_donotuse; - LZ4_resetStream((LZ4_stream_t*)state); - if (acceleration < 1) acceleration = ACCELERATION_DEFAULT; - - if (maxOutputSize >= LZ4_compressBound(inputSize)) { - if (inputSize < LZ4_64Klimit) - return LZ4_compress_generic(ctx, source, dest, inputSize, 0, notLimited, byU16, noDict, noDictIssue, acceleration); - else - return LZ4_compress_generic(ctx, source, dest, inputSize, 0, notLimited, (sizeof(void*)==8) ? byU32 : byPtr, noDict, noDictIssue, acceleration); - } else { - if (inputSize < LZ4_64Klimit) - return LZ4_compress_generic(ctx, source, dest, inputSize, maxOutputSize, limitedOutput, byU16, noDict, noDictIssue, acceleration); - else - return LZ4_compress_generic(ctx, source, dest, inputSize, maxOutputSize, limitedOutput, (sizeof(void*)==8) ? byU32 : byPtr, noDict, noDictIssue, acceleration); - } -} - - -int LZ4_compress_fast(const char* source, char* dest, int inputSize, int maxOutputSize, int acceleration) -{ -#if (LZ4_HEAPMODE) - void* ctxPtr = ALLOCATOR(1, sizeof(LZ4_stream_t)); /* malloc-calloc always properly aligned */ -#else - LZ4_stream_t ctx; - void* const ctxPtr = &ctx; -#endif - - int const result = LZ4_compress_fast_extState(ctxPtr, source, dest, inputSize, maxOutputSize, acceleration); - -#if (LZ4_HEAPMODE) - FREEMEM(ctxPtr); -#endif - return result; -} - - -int LZ4_compress_default(const char* source, char* dest, int inputSize, int maxOutputSize) -{ - return LZ4_compress_fast(source, dest, inputSize, maxOutputSize, 1); -} - - -/* hidden debug function */ -/* strangely enough, gcc generates faster code when this function is uncommented, even if unused */ -int LZ4_compress_fast_force(const char* source, char* dest, int inputSize, int maxOutputSize, int acceleration) -{ - LZ4_stream_t ctx; - LZ4_resetStream(&ctx); - - if (inputSize < LZ4_64Klimit) - return LZ4_compress_generic(&ctx.internal_donotuse, source, dest, inputSize, maxOutputSize, limitedOutput, byU16, noDict, noDictIssue, acceleration); - else - return LZ4_compress_generic(&ctx.internal_donotuse, source, dest, inputSize, maxOutputSize, limitedOutput, sizeof(void*)==8 ? byU32 : byPtr, noDict, noDictIssue, acceleration); -} - - -/*-****************************** -* *_destSize() variant -********************************/ - -static int LZ4_compress_destSize_generic( - LZ4_stream_t_internal* const ctx, - const char* const src, - char* const dst, - int* const srcSizePtr, - const int targetDstSize, - const tableType_t tableType) -{ - const BYTE* ip = (const BYTE*) src; - const BYTE* base = (const BYTE*) src; - const BYTE* lowLimit = (const BYTE*) src; - const BYTE* anchor = ip; - const BYTE* const iend = ip + *srcSizePtr; - const BYTE* const mflimit = iend - MFLIMIT; - const BYTE* const matchlimit = iend - LASTLITERALS; - - BYTE* op = (BYTE*) dst; - BYTE* const oend = op + targetDstSize; - BYTE* const oMaxLit = op + targetDstSize - 2 /* offset */ - 8 /* because 8+MINMATCH==MFLIMIT */ - 1 /* token */; - BYTE* const oMaxMatch = op + targetDstSize - (LASTLITERALS + 1 /* token */); - BYTE* const oMaxSeq = oMaxLit - 1 /* token */; - - U32 forwardH; - - - /* Init conditions */ - if (targetDstSize < 1) return 0; /* Impossible to store anything */ - if ((U32)*srcSizePtr > (U32)LZ4_MAX_INPUT_SIZE) return 0; /* Unsupported input size, too large (or negative) */ - if ((tableType == byU16) && (*srcSizePtr>=LZ4_64Klimit)) return 0; /* Size too large (not within 64K limit) */ - if (*srcSizePtrhashTable, tableType, base); - ip++; forwardH = LZ4_hashPosition(ip, tableType); - - /* Main Loop */ - for ( ; ; ) { - const BYTE* match; - BYTE* token; - - /* Find a match */ - { const BYTE* forwardIp = ip; - unsigned step = 1; - unsigned searchMatchNb = 1 << LZ4_skipTrigger; - - do { - U32 h = forwardH; - ip = forwardIp; - forwardIp += step; - step = (searchMatchNb++ >> LZ4_skipTrigger); - - if (unlikely(forwardIp > mflimit)) goto _last_literals; - - match = LZ4_getPositionOnHash(h, ctx->hashTable, tableType, base); - forwardH = LZ4_hashPosition(forwardIp, tableType); - LZ4_putPositionOnHash(ip, h, ctx->hashTable, tableType, base); - - } while ( ((tableType==byU16) ? 0 : (match + MAX_DISTANCE < ip)) - || (LZ4_read32(match) != LZ4_read32(ip)) ); - } - - /* Catch up */ - while ((ip>anchor) && (match > lowLimit) && (unlikely(ip[-1]==match[-1]))) { ip--; match--; } - - /* Encode Literal length */ - { unsigned litLength = (unsigned)(ip - anchor); - token = op++; - if (op + ((litLength+240)/255) + litLength > oMaxLit) { - /* Not enough space for a last match */ - op--; - goto _last_literals; - } - if (litLength>=RUN_MASK) { - unsigned len = litLength - RUN_MASK; - *token=(RUN_MASK<= 255 ; len-=255) *op++ = 255; - *op++ = (BYTE)len; - } - else *token = (BYTE)(litLength< oMaxMatch) { - /* Match description too long : reduce it */ - matchLength = (15-1) + (oMaxMatch-op) * 255; - } - ip += MINMATCH + matchLength; - - if (matchLength>=ML_MASK) { - *token += ML_MASK; - matchLength -= ML_MASK; - while (matchLength >= 255) { matchLength-=255; *op++ = 255; } - *op++ = (BYTE)matchLength; - } - else *token += (BYTE)(matchLength); - } - - anchor = ip; - - /* Test end of block */ - if (ip > mflimit) break; - if (op > oMaxSeq) break; - - /* Fill table */ - LZ4_putPosition(ip-2, ctx->hashTable, tableType, base); - - /* Test next position */ - match = LZ4_getPosition(ip, ctx->hashTable, tableType, base); - LZ4_putPosition(ip, ctx->hashTable, tableType, base); - if ( (match+MAX_DISTANCE>=ip) - && (LZ4_read32(match)==LZ4_read32(ip)) ) - { token=op++; *token=0; goto _next_match; } - - /* Prepare next loop */ - forwardH = LZ4_hashPosition(++ip, tableType); - } - -_last_literals: - /* Encode Last Literals */ - { size_t lastRunSize = (size_t)(iend - anchor); - if (op + 1 /* token */ + ((lastRunSize+240)/255) /* litLength */ + lastRunSize /* literals */ > oend) { - /* adapt lastRunSize to fill 'dst' */ - lastRunSize = (oend-op) - 1; - lastRunSize -= (lastRunSize+240)/255; - } - ip = anchor + lastRunSize; - - if (lastRunSize >= RUN_MASK) { - size_t accumulator = lastRunSize - RUN_MASK; - *op++ = RUN_MASK << ML_BITS; - for(; accumulator >= 255 ; accumulator-=255) *op++ = 255; - *op++ = (BYTE) accumulator; - } else { - *op++ = (BYTE)(lastRunSize<= LZ4_compressBound(*srcSizePtr)) { /* compression success is guaranteed */ - return LZ4_compress_fast_extState(state, src, dst, *srcSizePtr, targetDstSize, 1); - } else { - if (*srcSizePtr < LZ4_64Klimit) - return LZ4_compress_destSize_generic(&state->internal_donotuse, src, dst, srcSizePtr, targetDstSize, byU16); - else - return LZ4_compress_destSize_generic(&state->internal_donotuse, src, dst, srcSizePtr, targetDstSize, sizeof(void*)==8 ? byU32 : byPtr); - } -} - - -int LZ4_compress_destSize(const char* src, char* dst, int* srcSizePtr, int targetDstSize) -{ -#if (LZ4_HEAPMODE) - LZ4_stream_t* ctx = (LZ4_stream_t*)ALLOCATOR(1, sizeof(LZ4_stream_t)); /* malloc-calloc always properly aligned */ -#else - LZ4_stream_t ctxBody; - LZ4_stream_t* ctx = &ctxBody; -#endif - - int result = LZ4_compress_destSize_extState(ctx, src, dst, srcSizePtr, targetDstSize); - -#if (LZ4_HEAPMODE) - FREEMEM(ctx); -#endif - return result; -} - - - -/*-****************************** -* Streaming functions -********************************/ - -LZ4_stream_t* LZ4_createStream(void) -{ - LZ4_stream_t* lz4s = (LZ4_stream_t*)ALLOCATOR(8, LZ4_STREAMSIZE_U64); - LZ4_STATIC_ASSERT(LZ4_STREAMSIZE >= sizeof(LZ4_stream_t_internal)); /* A compilation error here means LZ4_STREAMSIZE is not large enough */ - LZ4_resetStream(lz4s); - return lz4s; -} - -void LZ4_resetStream (LZ4_stream_t* LZ4_stream) -{ - DEBUGLOG(4, "LZ4_resetStream"); - MEM_INIT(LZ4_stream, 0, sizeof(LZ4_stream_t)); -} - -int LZ4_freeStream (LZ4_stream_t* LZ4_stream) -{ - if (!LZ4_stream) return 0; /* support free on NULL */ - FREEMEM(LZ4_stream); - return (0); -} - - -#define HASH_UNIT sizeof(reg_t) -int LZ4_loadDict (LZ4_stream_t* LZ4_dict, const char* dictionary, int dictSize) -{ - LZ4_stream_t_internal* dict = &LZ4_dict->internal_donotuse; - const BYTE* p = (const BYTE*)dictionary; - const BYTE* const dictEnd = p + dictSize; - const BYTE* base; - - if ((dict->initCheck) || (dict->currentOffset > 1 GB)) /* Uninitialized structure, or reuse overflow */ - LZ4_resetStream(LZ4_dict); - - if (dictSize < (int)HASH_UNIT) { - dict->dictionary = NULL; - dict->dictSize = 0; - return 0; - } - - if ((dictEnd - p) > 64 KB) p = dictEnd - 64 KB; - dict->currentOffset += 64 KB; - base = p - dict->currentOffset; - dict->dictionary = p; - dict->dictSize = (U32)(dictEnd - p); - dict->currentOffset += dict->dictSize; - - while (p <= dictEnd-HASH_UNIT) { - LZ4_putPosition(p, dict->hashTable, byU32, base); - p+=3; - } - - return dict->dictSize; -} - - -static void LZ4_renormDictT(LZ4_stream_t_internal* LZ4_dict, const BYTE* src) -{ - if ((LZ4_dict->currentOffset > 0x80000000) || - ((uptrval)LZ4_dict->currentOffset > (uptrval)src)) { /* address space overflow */ - /* rescale hash table */ - U32 const delta = LZ4_dict->currentOffset - 64 KB; - const BYTE* dictEnd = LZ4_dict->dictionary + LZ4_dict->dictSize; - int i; - for (i=0; ihashTable[i] < delta) LZ4_dict->hashTable[i]=0; - else LZ4_dict->hashTable[i] -= delta; - } - LZ4_dict->currentOffset = 64 KB; - if (LZ4_dict->dictSize > 64 KB) LZ4_dict->dictSize = 64 KB; - LZ4_dict->dictionary = dictEnd - LZ4_dict->dictSize; - } -} - - -int LZ4_compress_fast_continue (LZ4_stream_t* LZ4_stream, const char* source, char* dest, int inputSize, int maxOutputSize, int acceleration) -{ - LZ4_stream_t_internal* streamPtr = &LZ4_stream->internal_donotuse; - const BYTE* const dictEnd = streamPtr->dictionary + streamPtr->dictSize; - - const BYTE* smallest = (const BYTE*) source; - if (streamPtr->initCheck) return 0; /* Uninitialized structure detected */ - if ((streamPtr->dictSize>0) && (smallest>dictEnd)) smallest = dictEnd; - LZ4_renormDictT(streamPtr, smallest); - if (acceleration < 1) acceleration = ACCELERATION_DEFAULT; - - /* Check overlapping input/dictionary space */ - { const BYTE* sourceEnd = (const BYTE*) source + inputSize; - if ((sourceEnd > streamPtr->dictionary) && (sourceEnd < dictEnd)) { - streamPtr->dictSize = (U32)(dictEnd - sourceEnd); - if (streamPtr->dictSize > 64 KB) streamPtr->dictSize = 64 KB; - if (streamPtr->dictSize < 4) streamPtr->dictSize = 0; - streamPtr->dictionary = dictEnd - streamPtr->dictSize; - } - } - - /* prefix mode : source data follows dictionary */ - if (dictEnd == (const BYTE*)source) { - int result; - if ((streamPtr->dictSize < 64 KB) && (streamPtr->dictSize < streamPtr->currentOffset)) - result = LZ4_compress_generic(streamPtr, source, dest, inputSize, maxOutputSize, limitedOutput, byU32, withPrefix64k, dictSmall, acceleration); - else - result = LZ4_compress_generic(streamPtr, source, dest, inputSize, maxOutputSize, limitedOutput, byU32, withPrefix64k, noDictIssue, acceleration); - streamPtr->dictSize += (U32)inputSize; - streamPtr->currentOffset += (U32)inputSize; - return result; - } - - /* external dictionary mode */ - { int result; - if ((streamPtr->dictSize < 64 KB) && (streamPtr->dictSize < streamPtr->currentOffset)) - result = LZ4_compress_generic(streamPtr, source, dest, inputSize, maxOutputSize, limitedOutput, byU32, usingExtDict, dictSmall, acceleration); - else - result = LZ4_compress_generic(streamPtr, source, dest, inputSize, maxOutputSize, limitedOutput, byU32, usingExtDict, noDictIssue, acceleration); - streamPtr->dictionary = (const BYTE*)source; - streamPtr->dictSize = (U32)inputSize; - streamPtr->currentOffset += (U32)inputSize; - return result; - } -} - - -/* Hidden debug function, to force external dictionary mode */ -int LZ4_compress_forceExtDict (LZ4_stream_t* LZ4_dict, const char* source, char* dest, int inputSize) -{ - LZ4_stream_t_internal* streamPtr = &LZ4_dict->internal_donotuse; - int result; - const BYTE* const dictEnd = streamPtr->dictionary + streamPtr->dictSize; - - const BYTE* smallest = dictEnd; - if (smallest > (const BYTE*) source) smallest = (const BYTE*) source; - LZ4_renormDictT(streamPtr, smallest); - - result = LZ4_compress_generic(streamPtr, source, dest, inputSize, 0, notLimited, byU32, usingExtDict, noDictIssue, 1); - - streamPtr->dictionary = (const BYTE*)source; - streamPtr->dictSize = (U32)inputSize; - streamPtr->currentOffset += (U32)inputSize; - - return result; -} - - -/*! LZ4_saveDict() : - * If previously compressed data block is not guaranteed to remain available at its memory location, - * save it into a safer place (char* safeBuffer). - * Note : you don't need to call LZ4_loadDict() afterwards, - * dictionary is immediately usable, you can therefore call LZ4_compress_fast_continue(). - * Return : saved dictionary size in bytes (necessarily <= dictSize), or 0 if error. - */ -int LZ4_saveDict (LZ4_stream_t* LZ4_dict, char* safeBuffer, int dictSize) -{ - LZ4_stream_t_internal* const dict = &LZ4_dict->internal_donotuse; - const BYTE* const previousDictEnd = dict->dictionary + dict->dictSize; - - if ((U32)dictSize > 64 KB) dictSize = 64 KB; /* useless to define a dictionary > 64 KB */ - if ((U32)dictSize > dict->dictSize) dictSize = dict->dictSize; - - memmove(safeBuffer, previousDictEnd - dictSize, dictSize); - - dict->dictionary = (const BYTE*)safeBuffer; - dict->dictSize = (U32)dictSize; - - return dictSize; -} - - - -/*-***************************** -* Decompression functions -*******************************/ -/*! LZ4_decompress_generic() : - * This generic decompression function covers all use cases. - * It shall be instantiated several times, using different sets of directives. - * Note that it is important for performance that this function really get inlined, - * in order to remove useless branches during compilation optimization. - */ -LZ4_FORCE_O2_GCC_PPC64LE -LZ4_FORCE_INLINE int LZ4_decompress_generic( - const char* const src, - char* const dst, - int srcSize, - int outputSize, /* If endOnInput==endOnInputSize, this value is `dstCapacity` */ - - int endOnInput, /* endOnOutputSize, endOnInputSize */ - int partialDecoding, /* full, partial */ - int targetOutputSize, /* only used if partialDecoding==partial */ - int dict, /* noDict, withPrefix64k, usingExtDict */ - const BYTE* const lowPrefix, /* always <= dst, == dst when no prefix */ - const BYTE* const dictStart, /* only if dict==usingExtDict */ - const size_t dictSize /* note : = 0 if noDict */ - ) -{ - const BYTE* ip = (const BYTE*) src; - const BYTE* const iend = ip + srcSize; - - BYTE* op = (BYTE*) dst; - BYTE* const oend = op + outputSize; - BYTE* cpy; - BYTE* oexit = op + targetOutputSize; - - const BYTE* const dictEnd = (const BYTE*)dictStart + dictSize; - const unsigned inc32table[8] = {0, 1, 2, 1, 0, 4, 4, 4}; - const int dec64table[8] = {0, 0, 0, -1, -4, 1, 2, 3}; - - const int safeDecode = (endOnInput==endOnInputSize); - const int checkOffset = ((safeDecode) && (dictSize < (int)(64 KB))); - - - /* Special cases */ - if ((partialDecoding) && (oexit > oend-MFLIMIT)) oexit = oend-MFLIMIT; /* targetOutputSize too high => just decode everything */ - if ((endOnInput) && (unlikely(outputSize==0))) return ((srcSize==1) && (*ip==0)) ? 0 : -1; /* Empty output buffer */ - if ((!endOnInput) && (unlikely(outputSize==0))) return (*ip==0?1:-1); - - /* Main Loop : decode sequences */ - while (1) { - size_t length; - const BYTE* match; - size_t offset; - - unsigned const token = *ip++; - - /* shortcut for common case : - * in most circumstances, we expect to decode small matches (<= 18 bytes) separated by few literals (<= 14 bytes). - * this shortcut was tested on x86 and x64, where it improves decoding speed. - * it has not yet been benchmarked on ARM, Power, mips, etc. */ - if (((ip + 14 /*maxLL*/ + 2 /*offset*/ <= iend) - & (op + 14 /*maxLL*/ + 18 /*maxML*/ <= oend)) - & ((token < (15<> ML_BITS; - size_t const off = LZ4_readLE16(ip+ll); - const BYTE* const matchPtr = op + ll - off; /* pointer underflow risk ? */ - if ((off >= 18) /* do not deal with overlapping matches */ & (matchPtr >= lowPrefix)) { - size_t const ml = (token & ML_MASK) + MINMATCH; - memcpy(op, ip, 16); op += ll; ip += ll + 2 /*offset*/; - memcpy(op, matchPtr, 18); op += ml; - continue; - } - } - - /* decode literal length */ - if ((length=(token>>ML_BITS)) == RUN_MASK) { - unsigned s; - do { - s = *ip++; - length += s; - } while ( likely(endOnInput ? ip(partialDecoding?oexit:oend-MFLIMIT)) || (ip+length>iend-(2+1+LASTLITERALS))) ) - || ((!endOnInput) && (cpy>oend-WILDCOPYLENGTH)) ) - { - if (partialDecoding) { - if (cpy > oend) goto _output_error; /* Error : write attempt beyond end of output buffer */ - if ((endOnInput) && (ip+length > iend)) goto _output_error; /* Error : read attempt beyond end of input buffer */ - } else { - if ((!endOnInput) && (cpy != oend)) goto _output_error; /* Error : block decoding must stop exactly there */ - if ((endOnInput) && ((ip+length != iend) || (cpy > oend))) goto _output_error; /* Error : input must be consumed */ - } - memcpy(op, ip, length); - ip += length; - op += length; - break; /* Necessarily EOF, due to parsing restrictions */ - } - LZ4_wildCopy(op, ip, cpy); - ip += length; op = cpy; - - /* get offset */ - offset = LZ4_readLE16(ip); ip+=2; - match = op - offset; - if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _output_error; /* Error : offset outside buffers */ - LZ4_write32(op, (U32)offset); /* costs ~1%; silence an msan warning when offset==0 */ - - /* get matchlength */ - length = token & ML_MASK; - if (length == ML_MASK) { - unsigned s; - do { - s = *ip++; - if ((endOnInput) && (ip > iend-LASTLITERALS)) goto _output_error; - length += s; - } while (s==255); - if ((safeDecode) && unlikely((uptrval)(op)+length<(uptrval)op)) goto _output_error; /* overflow detection */ - } - length += MINMATCH; - - /* check external dictionary */ - if ((dict==usingExtDict) && (match < lowPrefix)) { - if (unlikely(op+length > oend-LASTLITERALS)) goto _output_error; /* doesn't respect parsing restriction */ - - if (length <= (size_t)(lowPrefix-match)) { - /* match can be copied as a single segment from external dictionary */ - memmove(op, dictEnd - (lowPrefix-match), length); - op += length; - } else { - /* match encompass external dictionary and current block */ - size_t const copySize = (size_t)(lowPrefix-match); - size_t const restSize = length - copySize; - memcpy(op, dictEnd - copySize, copySize); - op += copySize; - if (restSize > (size_t)(op-lowPrefix)) { /* overlap copy */ - BYTE* const endOfMatch = op + restSize; - const BYTE* copyFrom = lowPrefix; - while (op < endOfMatch) *op++ = *copyFrom++; - } else { - memcpy(op, lowPrefix, restSize); - op += restSize; - } } - continue; - } - - /* copy match within block */ - cpy = op + length; - if (unlikely(offset<8)) { - op[0] = match[0]; - op[1] = match[1]; - op[2] = match[2]; - op[3] = match[3]; - match += inc32table[offset]; - memcpy(op+4, match, 4); - match -= dec64table[offset]; - } else { LZ4_copy8(op, match); match+=8; } - op += 8; - - if (unlikely(cpy>oend-12)) { - BYTE* const oCopyLimit = oend-(WILDCOPYLENGTH-1); - if (cpy > oend-LASTLITERALS) goto _output_error; /* Error : last LASTLITERALS bytes must be literals (uncompressed) */ - if (op < oCopyLimit) { - LZ4_wildCopy(op, match, oCopyLimit); - match += oCopyLimit - op; - op = oCopyLimit; - } - while (op16) LZ4_wildCopy(op+8, match+8, cpy); - } - op = cpy; /* correction */ - } - - /* end of decoding */ - if (endOnInput) - return (int) (((char*)op)-dst); /* Nb of output bytes decoded */ - else - return (int) (((const char*)ip)-src); /* Nb of input bytes read */ - - /* Overflow error detected */ -_output_error: - return (int) (-(((const char*)ip)-src))-1; -} - - -LZ4_FORCE_O2_GCC_PPC64LE -int LZ4_decompress_safe(const char* source, char* dest, int compressedSize, int maxDecompressedSize) -{ - return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize, endOnInputSize, full, 0, noDict, (BYTE*)dest, NULL, 0); -} - -LZ4_FORCE_O2_GCC_PPC64LE -int LZ4_decompress_safe_partial(const char* source, char* dest, int compressedSize, int targetOutputSize, int maxDecompressedSize) -{ - return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize, endOnInputSize, partial, targetOutputSize, noDict, (BYTE*)dest, NULL, 0); -} - -LZ4_FORCE_O2_GCC_PPC64LE -int LZ4_decompress_fast(const char* source, char* dest, int originalSize) -{ - return LZ4_decompress_generic(source, dest, 0, originalSize, endOnOutputSize, full, 0, withPrefix64k, (BYTE*)(dest - 64 KB), NULL, 64 KB); -} - - -/*===== streaming decompression functions =====*/ - -LZ4_streamDecode_t* LZ4_createStreamDecode(void) -{ - LZ4_streamDecode_t* lz4s = (LZ4_streamDecode_t*) ALLOCATOR(1, sizeof(LZ4_streamDecode_t)); - return lz4s; -} - -int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream) -{ - if (!LZ4_stream) return 0; /* support free on NULL */ - FREEMEM(LZ4_stream); - return 0; -} - -/*! - * LZ4_setStreamDecode() : - * Use this function to instruct where to find the dictionary. - * This function is not necessary if previous data is still available where it was decoded. - * Loading a size of 0 is allowed (same effect as no dictionary). - * Return : 1 if OK, 0 if error - */ -int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize) -{ - LZ4_streamDecode_t_internal* lz4sd = &LZ4_streamDecode->internal_donotuse; - lz4sd->prefixSize = (size_t) dictSize; - lz4sd->prefixEnd = (const BYTE*) dictionary + dictSize; - lz4sd->externalDict = NULL; - lz4sd->extDictSize = 0; - return 1; -} - -/* -*_continue() : - These decoding functions allow decompression of multiple blocks in "streaming" mode. - Previously decoded blocks must still be available at the memory position where they were decoded. - If it's not possible, save the relevant part of decoded data into a safe buffer, - and indicate where it stands using LZ4_setStreamDecode() -*/ -LZ4_FORCE_O2_GCC_PPC64LE -int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int compressedSize, int maxOutputSize) -{ - LZ4_streamDecode_t_internal* lz4sd = &LZ4_streamDecode->internal_donotuse; - int result; - - if (lz4sd->prefixEnd == (BYTE*)dest) { - result = LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, - endOnInputSize, full, 0, - usingExtDict, lz4sd->prefixEnd - lz4sd->prefixSize, lz4sd->externalDict, lz4sd->extDictSize); - if (result <= 0) return result; - lz4sd->prefixSize += result; - lz4sd->prefixEnd += result; - } else { - lz4sd->extDictSize = lz4sd->prefixSize; - lz4sd->externalDict = lz4sd->prefixEnd - lz4sd->extDictSize; - result = LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, - endOnInputSize, full, 0, - usingExtDict, (BYTE*)dest, lz4sd->externalDict, lz4sd->extDictSize); - if (result <= 0) return result; - lz4sd->prefixSize = result; - lz4sd->prefixEnd = (BYTE*)dest + result; - } - - return result; -} - -LZ4_FORCE_O2_GCC_PPC64LE -int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int originalSize) -{ - LZ4_streamDecode_t_internal* lz4sd = &LZ4_streamDecode->internal_donotuse; - int result; - - if (lz4sd->prefixEnd == (BYTE*)dest) { - result = LZ4_decompress_generic(source, dest, 0, originalSize, - endOnOutputSize, full, 0, - usingExtDict, lz4sd->prefixEnd - lz4sd->prefixSize, lz4sd->externalDict, lz4sd->extDictSize); - if (result <= 0) return result; - lz4sd->prefixSize += originalSize; - lz4sd->prefixEnd += originalSize; - } else { - lz4sd->extDictSize = lz4sd->prefixSize; - lz4sd->externalDict = lz4sd->prefixEnd - lz4sd->extDictSize; - result = LZ4_decompress_generic(source, dest, 0, originalSize, - endOnOutputSize, full, 0, - usingExtDict, (BYTE*)dest, lz4sd->externalDict, lz4sd->extDictSize); - if (result <= 0) return result; - lz4sd->prefixSize = originalSize; - lz4sd->prefixEnd = (BYTE*)dest + originalSize; - } - - return result; -} - - -/* -Advanced decoding functions : -*_usingDict() : - These decoding functions work the same as "_continue" ones, - the dictionary must be explicitly provided within parameters -*/ - -LZ4_FORCE_O2_GCC_PPC64LE -LZ4_FORCE_INLINE int LZ4_decompress_usingDict_generic(const char* source, char* dest, int compressedSize, int maxOutputSize, int safe, const char* dictStart, int dictSize) -{ - if (dictSize==0) - return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, safe, full, 0, noDict, (BYTE*)dest, NULL, 0); - if (dictStart+dictSize == dest) { - if (dictSize >= (int)(64 KB - 1)) - return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, safe, full, 0, withPrefix64k, (BYTE*)dest-64 KB, NULL, 0); - return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, safe, full, 0, noDict, (BYTE*)dest-dictSize, NULL, 0); - } - return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, safe, full, 0, usingExtDict, (BYTE*)dest, (const BYTE*)dictStart, dictSize); -} - -LZ4_FORCE_O2_GCC_PPC64LE -int LZ4_decompress_safe_usingDict(const char* source, char* dest, int compressedSize, int maxOutputSize, const char* dictStart, int dictSize) -{ - return LZ4_decompress_usingDict_generic(source, dest, compressedSize, maxOutputSize, 1, dictStart, dictSize); -} - -LZ4_FORCE_O2_GCC_PPC64LE -int LZ4_decompress_fast_usingDict(const char* source, char* dest, int originalSize, const char* dictStart, int dictSize) -{ - return LZ4_decompress_usingDict_generic(source, dest, 0, originalSize, 0, dictStart, dictSize); -} - -/* debug function */ -LZ4_FORCE_O2_GCC_PPC64LE -int LZ4_decompress_safe_forceExtDict(const char* source, char* dest, int compressedSize, int maxOutputSize, const char* dictStart, int dictSize) -{ - return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, endOnInputSize, full, 0, usingExtDict, (BYTE*)dest, (const BYTE*)dictStart, dictSize); -} - - -/*=************************************************* -* Obsolete Functions -***************************************************/ -/* obsolete compression functions */ -int LZ4_compress_limitedOutput(const char* source, char* dest, int inputSize, int maxOutputSize) { return LZ4_compress_default(source, dest, inputSize, maxOutputSize); } -int LZ4_compress(const char* source, char* dest, int inputSize) { return LZ4_compress_default(source, dest, inputSize, LZ4_compressBound(inputSize)); } -int LZ4_compress_limitedOutput_withState (void* state, const char* src, char* dst, int srcSize, int dstSize) { return LZ4_compress_fast_extState(state, src, dst, srcSize, dstSize, 1); } -int LZ4_compress_withState (void* state, const char* src, char* dst, int srcSize) { return LZ4_compress_fast_extState(state, src, dst, srcSize, LZ4_compressBound(srcSize), 1); } -int LZ4_compress_limitedOutput_continue (LZ4_stream_t* LZ4_stream, const char* src, char* dst, int srcSize, int maxDstSize) { return LZ4_compress_fast_continue(LZ4_stream, src, dst, srcSize, maxDstSize, 1); } -int LZ4_compress_continue (LZ4_stream_t* LZ4_stream, const char* source, char* dest, int inputSize) { return LZ4_compress_fast_continue(LZ4_stream, source, dest, inputSize, LZ4_compressBound(inputSize), 1); } - -/* -These function names are deprecated and should no longer be used. -They are only provided here for compatibility with older user programs. -- LZ4_uncompress is totally equivalent to LZ4_decompress_fast -- LZ4_uncompress_unknownOutputSize is totally equivalent to LZ4_decompress_safe -*/ -int LZ4_uncompress (const char* source, char* dest, int outputSize) { return LZ4_decompress_fast(source, dest, outputSize); } -int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int maxOutputSize) { return LZ4_decompress_safe(source, dest, isize, maxOutputSize); } - - -/* Obsolete Streaming functions */ - -int LZ4_sizeofStreamState() { return LZ4_STREAMSIZE; } - -static void LZ4_init(LZ4_stream_t* lz4ds, BYTE* base) -{ - MEM_INIT(lz4ds, 0, sizeof(LZ4_stream_t)); - lz4ds->internal_donotuse.bufferStart = base; -} - -int LZ4_resetStreamState(void* state, char* inputBuffer) -{ - if ((((uptrval)state) & 3) != 0) return 1; /* Error : pointer is not aligned on 4-bytes boundary */ - LZ4_init((LZ4_stream_t*)state, (BYTE*)inputBuffer); - return 0; -} - -void* LZ4_create (char* inputBuffer) -{ - LZ4_stream_t* lz4ds = (LZ4_stream_t*)ALLOCATOR(8, sizeof(LZ4_stream_t)); - LZ4_init (lz4ds, (BYTE*)inputBuffer); - return lz4ds; -} - -char* LZ4_slideInputBuffer (void* LZ4_Data) -{ - LZ4_stream_t_internal* ctx = &((LZ4_stream_t*)LZ4_Data)->internal_donotuse; - int dictSize = LZ4_saveDict((LZ4_stream_t*)LZ4_Data, (char*)ctx->bufferStart, 64 KB); - return (char*)(ctx->bufferStart + dictSize); -} - -/* Obsolete streaming decompression functions */ - -int LZ4_decompress_safe_withPrefix64k(const char* source, char* dest, int compressedSize, int maxOutputSize) -{ - return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, endOnInputSize, full, 0, withPrefix64k, (BYTE*)dest - 64 KB, NULL, 64 KB); -} - -int LZ4_decompress_fast_withPrefix64k(const char* source, char* dest, int originalSize) -{ - return LZ4_decompress_generic(source, dest, 0, originalSize, endOnOutputSize, full, 0, withPrefix64k, (BYTE*)dest - 64 KB, NULL, 64 KB); -} - -#endif /* LZ4_COMMONDEFS_ONLY */ diff --git a/love/src/jni/love/src/libraries/lz4/lz4.h b/love/src/jni/love/src/libraries/lz4/lz4.h deleted file mode 100755 index 3cf6c8dc..00000000 --- a/love/src/jni/love/src/libraries/lz4/lz4.h +++ /dev/null @@ -1,479 +0,0 @@ -/* - * LZ4 - Fast LZ compression algorithm - * Header File - * Copyright (C) 2011-2017, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - 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. - - 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 THE COPYRIGHT - OWNER OR CONTRIBUTORS 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. - - You can contact the author at : - - LZ4 homepage : http://www.lz4.org - - LZ4 source repository : https://github.com/lz4/lz4 -*/ -#if defined (__cplusplus) -extern "C" { -#endif - -#ifndef LZ4_H_2983827168210 -#define LZ4_H_2983827168210 - -/* --- Dependency --- */ -#include /* size_t */ - - -/** - Introduction - - LZ4 is lossless compression algorithm, providing compression speed at 400 MB/s per core, - scalable with multi-cores CPU. It features an extremely fast decoder, with speed in - multiple GB/s per core, typically reaching RAM speed limits on multi-core systems. - - The LZ4 compression library provides in-memory compression and decompression functions. - Compression can be done in: - - a single step (described as Simple Functions) - - a single step, reusing a context (described in Advanced Functions) - - unbounded multiple steps (described as Streaming compression) - - lz4.h provides block compression functions. It gives full buffer control to user. - Decompressing an lz4-compressed block also requires metadata (such as compressed size). - Each application is free to encode such metadata in whichever way it wants. - - An additional format, called LZ4 frame specification (doc/lz4_Frame_format.md), - take care of encoding standard metadata alongside LZ4-compressed blocks. - If your application requires interoperability, it's recommended to use it. - A library is provided to take care of it, see lz4frame.h. -*/ - -/*^*************************************************************** -* Export parameters -*****************************************************************/ -/* -* LZ4_DLL_EXPORT : -* Enable exporting of functions when building a Windows DLL -* LZ4LIB_VISIBILITY : -* Control library symbols visibility. -*/ -#ifndef LZ4LIB_VISIBILITY -# if defined(__GNUC__) && (__GNUC__ >= 4) -# define LZ4LIB_VISIBILITY __attribute__ ((visibility ("default"))) -# else -# define LZ4LIB_VISIBILITY -# endif -#endif -#if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1) -# define LZ4LIB_API __declspec(dllexport) LZ4LIB_VISIBILITY -#elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1) -# define LZ4LIB_API __declspec(dllimport) LZ4LIB_VISIBILITY /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/ -#else -# define LZ4LIB_API LZ4LIB_VISIBILITY -#endif - -/*------ Version ------*/ -#define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */ -#define LZ4_VERSION_MINOR 8 /* for new (non-breaking) interface capabilities */ -#define LZ4_VERSION_RELEASE 0 /* for tweaks, bug-fixes, or development */ - -#define LZ4_VERSION_NUMBER (LZ4_VERSION_MAJOR *100*100 + LZ4_VERSION_MINOR *100 + LZ4_VERSION_RELEASE) - -#define LZ4_LIB_VERSION LZ4_VERSION_MAJOR.LZ4_VERSION_MINOR.LZ4_VERSION_RELEASE -#define LZ4_QUOTE(str) #str -#define LZ4_EXPAND_AND_QUOTE(str) LZ4_QUOTE(str) -#define LZ4_VERSION_STRING LZ4_EXPAND_AND_QUOTE(LZ4_LIB_VERSION) - -LZ4LIB_API int LZ4_versionNumber (void); /**< library version number; to be used when checking dll version */ -LZ4LIB_API const char* LZ4_versionString (void); /**< library version string; to be used when checking dll version */ - - -/*-************************************ -* Tuning parameter -**************************************/ -/*! - * LZ4_MEMORY_USAGE : - * Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; etc.) - * Increasing memory usage improves compression ratio - * Reduced memory usage can improve speed, due to cache effect - * Default value is 14, for 16KB, which nicely fits into Intel x86 L1 cache - */ -#ifndef LZ4_MEMORY_USAGE -# define LZ4_MEMORY_USAGE 14 -#endif - -/*-************************************ -* Simple Functions -**************************************/ -/*! LZ4_compress_default() : - Compresses 'srcSize' bytes from buffer 'src' - into already allocated 'dst' buffer of size 'dstCapacity'. - Compression is guaranteed to succeed if 'dstCapacity' >= LZ4_compressBound(srcSize). - It also runs faster, so it's a recommended setting. - If the function cannot compress 'src' into a limited 'dst' budget, - compression stops *immediately*, and the function result is zero. - As a consequence, 'dst' content is not valid. - This function never writes outside 'dst' buffer, nor read outside 'source' buffer. - srcSize : supported max value is LZ4_MAX_INPUT_VALUE - dstCapacity : full or partial size of buffer 'dst' (which must be already allocated) - return : the number of bytes written into buffer 'dst' (necessarily <= dstCapacity) - or 0 if compression fails */ -LZ4LIB_API int LZ4_compress_default(const char* src, char* dst, int srcSize, int dstCapacity); - -/*! LZ4_decompress_safe() : - compressedSize : is the exact complete size of the compressed block. - dstCapacity : is the size of destination buffer, which must be already allocated. - return : the number of bytes decompressed into destination buffer (necessarily <= dstCapacity) - If destination buffer is not large enough, decoding will stop and output an error code (negative value). - If the source stream is detected malformed, the function will stop decoding and return a negative result. - This function is protected against buffer overflow exploits, including malicious data packets. - It never writes outside output buffer, nor reads outside input buffer. -*/ -LZ4LIB_API int LZ4_decompress_safe (const char* src, char* dst, int compressedSize, int dstCapacity); - - -/*-************************************ -* Advanced Functions -**************************************/ -#define LZ4_MAX_INPUT_SIZE 0x7E000000 /* 2 113 929 216 bytes */ -#define LZ4_COMPRESSBOUND(isize) ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16) - -/*! -LZ4_compressBound() : - Provides the maximum size that LZ4 compression may output in a "worst case" scenario (input data not compressible) - This function is primarily useful for memory allocation purposes (destination buffer size). - Macro LZ4_COMPRESSBOUND() is also provided for compilation-time evaluation (stack memory allocation for example). - Note that LZ4_compress_default() compress faster when dest buffer size is >= LZ4_compressBound(srcSize) - inputSize : max supported value is LZ4_MAX_INPUT_SIZE - return : maximum output size in a "worst case" scenario - or 0, if input size is too large ( > LZ4_MAX_INPUT_SIZE) -*/ -LZ4LIB_API int LZ4_compressBound(int inputSize); - -/*! -LZ4_compress_fast() : - Same as LZ4_compress_default(), but allows to select an "acceleration" factor. - The larger the acceleration value, the faster the algorithm, but also the lesser the compression. - It's a trade-off. It can be fine tuned, with each successive value providing roughly +~3% to speed. - An acceleration value of "1" is the same as regular LZ4_compress_default() - Values <= 0 will be replaced by ACCELERATION_DEFAULT (see lz4.c), which is 1. -*/ -LZ4LIB_API int LZ4_compress_fast (const char* src, char* dst, int srcSize, int dstCapacity, int acceleration); - - -/*! -LZ4_compress_fast_extState() : - Same compression function, just using an externally allocated memory space to store compression state. - Use LZ4_sizeofState() to know how much memory must be allocated, - and allocate it on 8-bytes boundaries (using malloc() typically). - Then, provide it as 'void* state' to compression function. -*/ -LZ4LIB_API int LZ4_sizeofState(void); -LZ4LIB_API int LZ4_compress_fast_extState (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration); - - -/*! -LZ4_compress_destSize() : - Reverse the logic : compresses as much data as possible from 'src' buffer - into already allocated buffer 'dst' of size 'targetDestSize'. - This function either compresses the entire 'src' content into 'dst' if it's large enough, - or fill 'dst' buffer completely with as much data as possible from 'src'. - *srcSizePtr : will be modified to indicate how many bytes where read from 'src' to fill 'dst'. - New value is necessarily <= old value. - return : Nb bytes written into 'dst' (necessarily <= targetDestSize) - or 0 if compression fails -*/ -LZ4LIB_API int LZ4_compress_destSize (const char* src, char* dst, int* srcSizePtr, int targetDstSize); - - -/*! -LZ4_decompress_fast() : (unsafe!!) - originalSize : is the original uncompressed size - return : the number of bytes read from the source buffer (in other words, the compressed size) - If the source stream is detected malformed, the function will stop decoding and return a negative result. - Destination buffer must be already allocated. Its size must be >= 'originalSize' bytes. - note : This function respects memory boundaries for *properly formed* compressed data. - It is a bit faster than LZ4_decompress_safe(). - However, it does not provide any protection against intentionally modified data stream (malicious input). - Use this function in trusted environment only (data to decode comes from a trusted source). -*/ -LZ4LIB_API int LZ4_decompress_fast (const char* src, char* dst, int originalSize); - -/*! -LZ4_decompress_safe_partial() : - This function decompress a compressed block of size 'srcSize' at position 'src' - into destination buffer 'dst' of size 'dstCapacity'. - The function will decompress a minimum of 'targetOutputSize' bytes, and stop after that. - However, it's not accurate, and may write more than 'targetOutputSize' (but <= dstCapacity). - @return : the number of bytes decoded in the destination buffer (necessarily <= dstCapacity) - Note : this number can be < 'targetOutputSize' should the compressed block contain less data. - Always control how many bytes were decoded. - If the source stream is detected malformed, the function will stop decoding and return a negative result. - This function never writes outside of output buffer, and never reads outside of input buffer. It is therefore protected against malicious data packets. -*/ -LZ4LIB_API int LZ4_decompress_safe_partial (const char* src, char* dst, int srcSize, int targetOutputSize, int dstCapacity); - - -/*-********************************************* -* Streaming Compression Functions -***********************************************/ -typedef union LZ4_stream_u LZ4_stream_t; /* incomplete type (defined later) */ - -/*! LZ4_createStream() and LZ4_freeStream() : - * LZ4_createStream() will allocate and initialize an `LZ4_stream_t` structure. - * LZ4_freeStream() releases its memory. - */ -LZ4LIB_API LZ4_stream_t* LZ4_createStream(void); -LZ4LIB_API int LZ4_freeStream (LZ4_stream_t* streamPtr); - -/*! LZ4_resetStream() : - * An LZ4_stream_t structure can be allocated once and re-used multiple times. - * Use this function to start compressing a new stream. - */ -LZ4LIB_API void LZ4_resetStream (LZ4_stream_t* streamPtr); - -/*! LZ4_loadDict() : - * Use this function to load a static dictionary into LZ4_stream_t. - * Any previous data will be forgotten, only 'dictionary' will remain in memory. - * Loading a size of 0 is allowed, and is the same as reset. - * @return : dictionary size, in bytes (necessarily <= 64 KB) - */ -LZ4LIB_API int LZ4_loadDict (LZ4_stream_t* streamPtr, const char* dictionary, int dictSize); - -/*! LZ4_compress_fast_continue() : - * Compress content into 'src' using data from previously compressed blocks, improving compression ratio. - * 'dst' buffer must be already allocated. - * If dstCapacity >= LZ4_compressBound(srcSize), compression is guaranteed to succeed, and runs faster. - * - * Important : Up to 64KB of previously compressed data is assumed to remain present and unmodified in memory ! - * Special 1 : If input buffer is a double-buffer, it can have any size, including < 64 KB. - * Special 2 : If input buffer is a ring-buffer, it can have any size, including < 64 KB. - * - * @return : size of compressed block - * or 0 if there is an error (typically, compressed data cannot fit into 'dst') - * After an error, the stream status is invalid, it can only be reset or freed. - */ -LZ4LIB_API int LZ4_compress_fast_continue (LZ4_stream_t* streamPtr, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration); - -/*! LZ4_saveDict() : - * If previously compressed data block is not guaranteed to remain available at its current memory location, - * save it into a safer place (char* safeBuffer). - * Note : it's not necessary to call LZ4_loadDict() after LZ4_saveDict(), dictionary is immediately usable. - * @return : saved dictionary size in bytes (necessarily <= dictSize), or 0 if error. - */ -LZ4LIB_API int LZ4_saveDict (LZ4_stream_t* streamPtr, char* safeBuffer, int dictSize); - - -/*-********************************************** -* Streaming Decompression Functions -* Bufferless synchronous API -************************************************/ -typedef union LZ4_streamDecode_u LZ4_streamDecode_t; /* incomplete type (defined later) */ - -/*! LZ4_createStreamDecode() and LZ4_freeStreamDecode() : - * creation / destruction of streaming decompression tracking structure. - * A tracking structure can be re-used multiple times sequentially. */ -LZ4LIB_API LZ4_streamDecode_t* LZ4_createStreamDecode(void); -LZ4LIB_API int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream); - -/*! LZ4_setStreamDecode() : - * An LZ4_streamDecode_t structure can be allocated once and re-used multiple times. - * Use this function to start decompression of a new stream of blocks. - * A dictionary can optionnally be set. Use NULL or size 0 for a simple reset order. - * @return : 1 if OK, 0 if error - */ -LZ4LIB_API int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize); - -/*! LZ4_decompress_*_continue() : - * These decoding functions allow decompression of consecutive blocks in "streaming" mode. - * A block is an unsplittable entity, it must be presented entirely to a decompression function. - * Decompression functions only accept one block at a time. - * Previously decoded blocks *must* remain available at the memory position where they were decoded (up to 64 KB). - * - * Special : if application sets a ring buffer for decompression, it must respect one of the following conditions : - * - Exactly same size as encoding buffer, with same update rule (block boundaries at same positions) - * In which case, the decoding & encoding ring buffer can have any size, including very small ones ( < 64 KB). - * - Larger than encoding buffer, by a minimum of maxBlockSize more bytes. - * maxBlockSize is implementation dependent. It's the maximum size of any single block. - * In which case, encoding and decoding buffers do not need to be synchronized, - * and encoding ring buffer can have any size, including small ones ( < 64 KB). - * - _At least_ 64 KB + 8 bytes + maxBlockSize. - * In which case, encoding and decoding buffers do not need to be synchronized, - * and encoding ring buffer can have any size, including larger than decoding buffer. - * Whenever these conditions are not possible, save the last 64KB of decoded data into a safe buffer, - * and indicate where it is saved using LZ4_setStreamDecode() before decompressing next block. -*/ -LZ4LIB_API int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* src, char* dst, int srcSize, int dstCapacity); -LZ4LIB_API int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* src, char* dst, int originalSize); - - -/*! LZ4_decompress_*_usingDict() : - * These decoding functions work the same as - * a combination of LZ4_setStreamDecode() followed by LZ4_decompress_*_continue() - * They are stand-alone, and don't need an LZ4_streamDecode_t structure. - */ -LZ4LIB_API int LZ4_decompress_safe_usingDict (const char* src, char* dst, int srcSize, int dstCapcity, const char* dictStart, int dictSize); -LZ4LIB_API int LZ4_decompress_fast_usingDict (const char* src, char* dst, int originalSize, const char* dictStart, int dictSize); - - -/*^********************************************** - * !!!!!! STATIC LINKING ONLY !!!!!! - ***********************************************/ -/*-************************************ - * Private definitions - ************************************** - * Do not use these definitions. - * They are exposed to allow static allocation of `LZ4_stream_t` and `LZ4_streamDecode_t`. - * Using these definitions will expose code to API and/or ABI break in future versions of the library. - **************************************/ -#define LZ4_HASHLOG (LZ4_MEMORY_USAGE-2) -#define LZ4_HASHTABLESIZE (1 << LZ4_MEMORY_USAGE) -#define LZ4_HASH_SIZE_U32 (1 << LZ4_HASHLOG) /* required as macro for static allocation */ - -#if defined(__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) -#include - -typedef struct { - uint32_t hashTable[LZ4_HASH_SIZE_U32]; - uint32_t currentOffset; - uint32_t initCheck; - const uint8_t* dictionary; - uint8_t* bufferStart; /* obsolete, used for slideInputBuffer */ - uint32_t dictSize; -} LZ4_stream_t_internal; - -typedef struct { - const uint8_t* externalDict; - size_t extDictSize; - const uint8_t* prefixEnd; - size_t prefixSize; -} LZ4_streamDecode_t_internal; - -#else - -typedef struct { - unsigned int hashTable[LZ4_HASH_SIZE_U32]; - unsigned int currentOffset; - unsigned int initCheck; - const unsigned char* dictionary; - unsigned char* bufferStart; /* obsolete, used for slideInputBuffer */ - unsigned int dictSize; -} LZ4_stream_t_internal; - -typedef struct { - const unsigned char* externalDict; - size_t extDictSize; - const unsigned char* prefixEnd; - size_t prefixSize; -} LZ4_streamDecode_t_internal; - -#endif - -/*! - * LZ4_stream_t : - * information structure to track an LZ4 stream. - * init this structure before first use. - * note : only use in association with static linking ! - * this definition is not API/ABI safe, - * it may change in a future version ! - */ -#define LZ4_STREAMSIZE_U64 ((1 << (LZ4_MEMORY_USAGE-3)) + 4) -#define LZ4_STREAMSIZE (LZ4_STREAMSIZE_U64 * sizeof(unsigned long long)) -union LZ4_stream_u { - unsigned long long table[LZ4_STREAMSIZE_U64]; - LZ4_stream_t_internal internal_donotuse; -} ; /* previously typedef'd to LZ4_stream_t */ - - -/*! - * LZ4_streamDecode_t : - * information structure to track an LZ4 stream during decompression. - * init this structure using LZ4_setStreamDecode (or memset()) before first use - * note : only use in association with static linking ! - * this definition is not API/ABI safe, - * and may change in a future version ! - */ -#define LZ4_STREAMDECODESIZE_U64 4 -#define LZ4_STREAMDECODESIZE (LZ4_STREAMDECODESIZE_U64 * sizeof(unsigned long long)) -union LZ4_streamDecode_u { - unsigned long long table[LZ4_STREAMDECODESIZE_U64]; - LZ4_streamDecode_t_internal internal_donotuse; -} ; /* previously typedef'd to LZ4_streamDecode_t */ - - -/*-************************************ -* Obsolete Functions -**************************************/ - -/*! Deprecation warnings - Should deprecation warnings be a problem, - it is generally possible to disable them, - typically with -Wno-deprecated-declarations for gcc - or _CRT_SECURE_NO_WARNINGS in Visual. - Otherwise, it's also possible to define LZ4_DISABLE_DEPRECATE_WARNINGS */ -#ifdef LZ4_DISABLE_DEPRECATE_WARNINGS -# define LZ4_DEPRECATED(message) /* disable deprecation warnings */ -#else -# define LZ4_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) -# if defined(__clang__) /* clang doesn't handle mixed C++11 and CNU attributes */ -# define LZ4_DEPRECATED(message) __attribute__((deprecated(message))) -# elif defined (__cplusplus) && (__cplusplus >= 201402) /* C++14 or greater */ -# define LZ4_DEPRECATED(message) [[deprecated(message)]] -# elif (LZ4_GCC_VERSION >= 405) -# define LZ4_DEPRECATED(message) __attribute__((deprecated(message))) -# elif (LZ4_GCC_VERSION >= 301) -# define LZ4_DEPRECATED(message) __attribute__((deprecated)) -# elif defined(_MSC_VER) -# define LZ4_DEPRECATED(message) __declspec(deprecated(message)) -# else -# pragma message("WARNING: You need to implement LZ4_DEPRECATED for this compiler") -# define LZ4_DEPRECATED(message) -# endif -#endif /* LZ4_DISABLE_DEPRECATE_WARNINGS */ - -/* Obsolete compression functions */ -LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_default() instead") int LZ4_compress (const char* source, char* dest, int sourceSize); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_default() instead") int LZ4_compress_limitedOutput (const char* source, char* dest, int sourceSize, int maxOutputSize); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") int LZ4_compress_withState (void* state, const char* source, char* dest, int inputSize); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") int LZ4_compress_limitedOutput_withState (void* state, const char* source, char* dest, int inputSize, int maxOutputSize); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") int LZ4_compress_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") int LZ4_compress_limitedOutput_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize, int maxOutputSize); - -/* Obsolete decompression functions */ -LZ4LIB_API LZ4_DEPRECATED("use LZ4_decompress_fast() instead") int LZ4_uncompress (const char* source, char* dest, int outputSize); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_decompress_safe() instead") int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int maxOutputSize); - -/* Obsolete streaming functions; use new streaming interface whenever possible */ -LZ4LIB_API LZ4_DEPRECATED("use LZ4_createStream() instead") void* LZ4_create (char* inputBuffer); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_createStream() instead") int LZ4_sizeofStreamState(void); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_resetStream() instead") int LZ4_resetStreamState(void* state, char* inputBuffer); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_saveDict() instead") char* LZ4_slideInputBuffer (void* state); - -/* Obsolete streaming decoding functions */ -LZ4LIB_API LZ4_DEPRECATED("use LZ4_decompress_safe_usingDict() instead") int LZ4_decompress_safe_withPrefix64k (const char* src, char* dst, int compressedSize, int maxDstSize); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_decompress_fast_usingDict() instead") int LZ4_decompress_fast_withPrefix64k (const char* src, char* dst, int originalSize); - -#endif /* LZ4_H_2983827168210 */ - - -#if defined (__cplusplus) -} -#endif diff --git a/love/src/jni/love/src/libraries/lz4/lz4hc.c b/love/src/jni/love/src/libraries/lz4/lz4hc.c deleted file mode 100755 index 60690a03..00000000 --- a/love/src/jni/love/src/libraries/lz4/lz4hc.c +++ /dev/null @@ -1,864 +0,0 @@ -/* - LZ4 HC - High Compression Mode of LZ4 - Copyright (C) 2011-2017, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - 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. - - 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 THE COPYRIGHT - OWNER OR CONTRIBUTORS 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. - - You can contact the author at : - - LZ4 source repository : https://github.com/lz4/lz4 - - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c -*/ -/* note : lz4hc is not an independent module, it requires lz4.h/lz4.c for proper compilation */ - - -/* ************************************* -* Tuning Parameter -***************************************/ - -/*! HEAPMODE : - * Select how default compression function will allocate workplace memory, - * in stack (0:fastest), or in heap (1:requires malloc()). - * Since workplace is rather large, heap mode is recommended. - */ -#ifndef LZ4HC_HEAPMODE -# define LZ4HC_HEAPMODE 1 -#endif - - -/*=== Dependency ===*/ -#define LZ4_HC_STATIC_LINKING_ONLY -#include "lz4hc.h" - - -/*=== Common LZ4 definitions ===*/ -#if defined(__GNUC__) -# pragma GCC diagnostic ignored "-Wunused-function" -#endif -#if defined (__clang__) -# pragma clang diagnostic ignored "-Wunused-function" -#endif - -#define LZ4_COMMONDEFS_ONLY -#include "lz4.c" /* LZ4_count, constants, mem */ - - -/*=== Constants ===*/ -#define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH) - - -/*=== Macros ===*/ -#define MIN(a,b) ( (a) < (b) ? (a) : (b) ) -#define MAX(a,b) ( (a) > (b) ? (a) : (b) ) -#define HASH_FUNCTION(i) (((i) * 2654435761U) >> ((MINMATCH*8)-LZ4HC_HASH_LOG)) -#define DELTANEXTMAXD(p) chainTable[(p) & LZ4HC_MAXD_MASK] /* flexible, LZ4HC_MAXD dependent */ -#define DELTANEXTU16(table, pos) table[(U16)(pos)] /* faster */ - -static U32 LZ4HC_hashPtr(const void* ptr) { return HASH_FUNCTION(LZ4_read32(ptr)); } - - - -/************************************** -* HC Compression -**************************************/ -static void LZ4HC_init (LZ4HC_CCtx_internal* hc4, const BYTE* start) -{ - MEM_INIT((void*)hc4->hashTable, 0, sizeof(hc4->hashTable)); - MEM_INIT(hc4->chainTable, 0xFF, sizeof(hc4->chainTable)); - hc4->nextToUpdate = 64 KB; - hc4->base = start - 64 KB; - hc4->end = start; - hc4->dictBase = start - 64 KB; - hc4->dictLimit = 64 KB; - hc4->lowLimit = 64 KB; -} - - -/* Update chains up to ip (excluded) */ -LZ4_FORCE_INLINE void LZ4HC_Insert (LZ4HC_CCtx_internal* hc4, const BYTE* ip) -{ - U16* const chainTable = hc4->chainTable; - U32* const hashTable = hc4->hashTable; - const BYTE* const base = hc4->base; - U32 const target = (U32)(ip - base); - U32 idx = hc4->nextToUpdate; - - while (idx < target) { - U32 const h = LZ4HC_hashPtr(base+idx); - size_t delta = idx - hashTable[h]; - if (delta>MAX_DISTANCE) delta = MAX_DISTANCE; - DELTANEXTU16(chainTable, idx) = (U16)delta; - hashTable[h] = idx; - idx++; - } - - hc4->nextToUpdate = target; -} - -/** LZ4HC_countBack() : - * @return : negative value, nb of common bytes before ip/match */ -LZ4_FORCE_INLINE -int LZ4HC_countBack(const BYTE* const ip, const BYTE* const match, - const BYTE* const iMin, const BYTE* const mMin) -{ - int back=0; - while ( (ip+back > iMin) - && (match+back > mMin) - && (ip[back-1] == match[back-1])) - back--; - return back; -} - -/* LZ4HC_countPattern() : - * pattern32 must be a sample of repetitive pattern of length 1, 2 or 4 (but not 3!) */ -static unsigned LZ4HC_countPattern(const BYTE* ip, const BYTE* const iEnd, U32 const pattern32) -{ - const BYTE* const iStart = ip; - reg_t const pattern = (sizeof(pattern)==8) ? (reg_t)pattern32 + (((reg_t)pattern32) << 32) : pattern32; - - while (likely(ip < iEnd-(sizeof(pattern)-1))) { - reg_t const diff = LZ4_read_ARCH(ip) ^ pattern; - if (!diff) { ip+=sizeof(pattern); continue; } - ip += LZ4_NbCommonBytes(diff); - return (unsigned)(ip - iStart); - } - - if (LZ4_isLittleEndian()) { - reg_t patternByte = pattern; - while ((ip>= 8; - } - } else { /* big endian */ - U32 bitOffset = (sizeof(pattern)*8) - 8; - while (ip < iEnd) { - BYTE const byte = (BYTE)(pattern >> bitOffset); - if (*ip != byte) break; - ip ++; bitOffset -= 8; - } - } - - return (unsigned)(ip - iStart); -} - -/* LZ4HC_reverseCountPattern() : - * pattern must be a sample of repetitive pattern of length 1, 2 or 4 (but not 3!) - * read using natural platform endianess */ -static unsigned LZ4HC_reverseCountPattern(const BYTE* ip, const BYTE* const iLow, U32 pattern) -{ - const BYTE* const iStart = ip; - - while (likely(ip >= iLow+4)) { - if (LZ4_read32(ip-4) != pattern) break; - ip -= 4; - } - { const BYTE* bytePtr = (const BYTE*)(&pattern) + 3; /* works for any endianess */ - while (likely(ip>iLow)) { - if (ip[-1] != *bytePtr) break; - ip--; bytePtr--; - } } - return (unsigned)(iStart - ip); -} - -typedef enum { rep_untested, rep_not, rep_confirmed } repeat_state_e; - -LZ4_FORCE_INLINE int LZ4HC_InsertAndGetWiderMatch ( - LZ4HC_CCtx_internal* hc4, - const BYTE* const ip, - const BYTE* const iLowLimit, - const BYTE* const iHighLimit, - int longest, - const BYTE** matchpos, - const BYTE** startpos, - const int maxNbAttempts) -{ - U16* const chainTable = hc4->chainTable; - U32* const HashTable = hc4->hashTable; - const BYTE* const base = hc4->base; - const U32 dictLimit = hc4->dictLimit; - const BYTE* const lowPrefixPtr = base + dictLimit; - const U32 lowLimit = (hc4->lowLimit + 64 KB > (U32)(ip-base)) ? hc4->lowLimit : (U32)(ip - base) - MAX_DISTANCE; - const BYTE* const dictBase = hc4->dictBase; - int const delta = (int)(ip-iLowLimit); - int nbAttempts = maxNbAttempts; - U32 const pattern = LZ4_read32(ip); - U32 matchIndex; - repeat_state_e repeat = rep_untested; - size_t srcPatternLength = 0; - - DEBUGLOG(7, "LZ4HC_InsertAndGetWiderMatch"); - /* First Match */ - LZ4HC_Insert(hc4, ip); - matchIndex = HashTable[LZ4HC_hashPtr(ip)]; - DEBUGLOG(7, "First match at index %u / %u (lowLimit)", - matchIndex, lowLimit); - - while ((matchIndex>=lowLimit) && (nbAttempts)) { - DEBUGLOG(7, "remaining attempts : %i", nbAttempts); - nbAttempts--; - if (matchIndex >= dictLimit) { - const BYTE* const matchPtr = base + matchIndex; - if (*(iLowLimit + longest) == *(matchPtr - delta + longest)) { - if (LZ4_read32(matchPtr) == pattern) { - int mlt = MINMATCH + LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, iHighLimit); - #if 0 - /* more generic but unfortunately slower on clang */ - int const back = LZ4HC_countBack(ip, matchPtr, iLowLimit, lowPrefixPtr); - #else - int back = 0; - while ( (ip+back > iLowLimit) - && (matchPtr+back > lowPrefixPtr) - && (ip[back-1] == matchPtr[back-1])) { - back--; - } - #endif - mlt -= back; - - if (mlt > longest) { - longest = mlt; - *matchpos = matchPtr+back; - *startpos = ip+back; - } } - } - } else { /* matchIndex < dictLimit */ - const BYTE* const matchPtr = dictBase + matchIndex; - if (LZ4_read32(matchPtr) == pattern) { - int mlt; - int back = 0; - const BYTE* vLimit = ip + (dictLimit - matchIndex); - if (vLimit > iHighLimit) vLimit = iHighLimit; - mlt = LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH; - if ((ip+mlt == vLimit) && (vLimit < iHighLimit)) - mlt += LZ4_count(ip+mlt, base+dictLimit, iHighLimit); - while ( (ip+back > iLowLimit) - && (matchIndex+back > lowLimit) - && (ip[back-1] == matchPtr[back-1])) - back--; - mlt -= back; - if (mlt > longest) { - longest = mlt; - *matchpos = base + matchIndex + back; - *startpos = ip + back; - } } } - - { U32 const nextOffset = DELTANEXTU16(chainTable, matchIndex); - matchIndex -= nextOffset; - if (nextOffset==1) { - /* may be a repeated pattern */ - if (repeat == rep_untested) { - if ( ((pattern & 0xFFFF) == (pattern >> 16)) - & ((pattern & 0xFF) == (pattern >> 24)) ) { - repeat = rep_confirmed; - srcPatternLength = LZ4HC_countPattern(ip+4, iHighLimit, pattern) + 4; - } else { - repeat = rep_not; - } } - if ( (repeat == rep_confirmed) - && (matchIndex >= dictLimit) ) { /* same segment only */ - const BYTE* const matchPtr = base + matchIndex; - if (LZ4_read32(matchPtr) == pattern) { /* good candidate */ - size_t const forwardPatternLength = LZ4HC_countPattern(matchPtr+sizeof(pattern), iHighLimit, pattern) + sizeof(pattern); - const BYTE* const maxLowPtr = (lowPrefixPtr + MAX_DISTANCE >= ip) ? lowPrefixPtr : ip - MAX_DISTANCE; - size_t const backLength = LZ4HC_reverseCountPattern(matchPtr, maxLowPtr, pattern); - size_t const currentSegmentLength = backLength + forwardPatternLength; - - if ( (currentSegmentLength >= srcPatternLength) /* current pattern segment large enough to contain full srcPatternLength */ - && (forwardPatternLength <= srcPatternLength) ) { /* haven't reached this position yet */ - matchIndex += (U32)forwardPatternLength - (U32)srcPatternLength; /* best position, full pattern, might be followed by more match */ - } else { - matchIndex -= (U32)backLength; /* let's go to farthest segment position, will find a match of length currentSegmentLength + maybe some back */ - } - } } } } - } /* while ((matchIndex>=lowLimit) && (nbAttempts)) */ - - return longest; -} - -LZ4_FORCE_INLINE -int LZ4HC_InsertAndFindBestMatch(LZ4HC_CCtx_internal* const hc4, /* Index table will be updated */ - const BYTE* const ip, const BYTE* const iLimit, - const BYTE** matchpos, - const int maxNbAttempts) -{ - const BYTE* uselessPtr = ip; - /* note : LZ4HC_InsertAndGetWiderMatch() is able to modify the starting position of a match (*startpos), - * but this won't be the case here, as we define iLowLimit==ip, - * so LZ4HC_InsertAndGetWiderMatch() won't be allowed to search past ip */ - return LZ4HC_InsertAndGetWiderMatch(hc4, ip, ip, iLimit, MINMATCH-1, matchpos, &uselessPtr, maxNbAttempts); -} - - - -typedef enum { - noLimit = 0, - limitedOutput = 1, - limitedDestSize = 2, -} limitedOutput_directive; - -/* LZ4HC_encodeSequence() : - * @return : 0 if ok, - * 1 if buffer issue detected */ -LZ4_FORCE_INLINE int LZ4HC_encodeSequence ( - const BYTE** ip, - BYTE** op, - const BYTE** anchor, - int matchLength, - const BYTE* const match, - limitedOutput_directive limit, - BYTE* oend) -{ - size_t length; - BYTE* const token = (*op)++; - -#if defined(LZ4_DEBUG) && (LZ4_DEBUG >= 2) - static const BYTE* start = NULL; - static U32 totalCost = 0; - U32 const pos = (start==NULL) ? 0 : (U32)(*anchor - start); - U32 const ll = (U32)(*ip - *anchor); - U32 const llAdd = (ll>=15) ? ((ll-15) / 255) + 1 : 0; - U32 const mlAdd = (matchLength>=19) ? ((matchLength-19) / 255) + 1 : 0; - U32 const cost = 1 + llAdd + ll + 2 + mlAdd; - if (start==NULL) start = *anchor; /* only works for single segment */ - //g_debuglog_enable = (pos >= 2228) & (pos <= 2262); - DEBUGLOG(2, "pos:%7u -- literals:%3u, match:%4i, offset:%5u, cost:%3u + %u", - pos, - (U32)(*ip - *anchor), matchLength, (U32)(*ip-match), - cost, totalCost); - totalCost += cost; -#endif - - /* Encode Literal length */ - length = (size_t)(*ip - *anchor); - if ((limit) && ((*op + (length >> 8) + length + (2 + 1 + LASTLITERALS)) > oend)) return 1; /* Check output limit */ - if (length >= RUN_MASK) { - size_t len = length - RUN_MASK; - *token = (RUN_MASK << ML_BITS); - for(; len >= 255 ; len -= 255) *(*op)++ = 255; - *(*op)++ = (BYTE)len; - } else { - *token = (BYTE)(length << ML_BITS); - } - - /* Copy Literals */ - LZ4_wildCopy(*op, *anchor, (*op) + length); - *op += length; - - /* Encode Offset */ - LZ4_writeLE16(*op, (U16)(*ip-match)); *op += 2; - - /* Encode MatchLength */ - assert(matchLength >= MINMATCH); - length = (size_t)(matchLength - MINMATCH); - if ((limit) && (*op + (length >> 8) + (1 + LASTLITERALS) > oend)) return 1; /* Check output limit */ - if (length >= ML_MASK) { - *token += ML_MASK; - length -= ML_MASK; - for(; length >= 510 ; length -= 510) { *(*op)++ = 255; *(*op)++ = 255; } - if (length >= 255) { length -= 255; *(*op)++ = 255; } - *(*op)++ = (BYTE)length; - } else { - *token += (BYTE)(length); - } - - /* Prepare next loop */ - *ip += matchLength; - *anchor = *ip; - - return 0; -} - -/* btopt */ -#include "lz4opt.h" - - -static int LZ4HC_compress_hashChain ( - LZ4HC_CCtx_internal* const ctx, - const char* const source, - char* const dest, - int* srcSizePtr, - int const maxOutputSize, - unsigned maxNbAttempts, - limitedOutput_directive limit - ) -{ - const int inputSize = *srcSizePtr; - - const BYTE* ip = (const BYTE*) source; - const BYTE* anchor = ip; - const BYTE* const iend = ip + inputSize; - const BYTE* const mflimit = iend - MFLIMIT; - const BYTE* const matchlimit = (iend - LASTLITERALS); - - BYTE* optr = (BYTE*) dest; - BYTE* op = (BYTE*) dest; - BYTE* oend = op + maxOutputSize; - - int ml, ml2, ml3, ml0; - const BYTE* ref = NULL; - const BYTE* start2 = NULL; - const BYTE* ref2 = NULL; - const BYTE* start3 = NULL; - const BYTE* ref3 = NULL; - const BYTE* start0; - const BYTE* ref0; - - /* init */ - *srcSizePtr = 0; - if (limit == limitedDestSize && maxOutputSize < 1) return 0; /* Impossible to store anything */ - if ((U32)inputSize > (U32)LZ4_MAX_INPUT_SIZE) return 0; /* Unsupported input size, too large (or negative) */ - - if (limit == limitedDestSize) oend -= LASTLITERALS; /* Hack for support limitations LZ4 decompressor */ - if (inputSize < LZ4_minLength) goto _last_literals; /* Input too small, no compression (all literals) */ - - /* Main Loop */ - while (ip < mflimit) { - ml = LZ4HC_InsertAndFindBestMatch (ctx, ip, matchlimit, &ref, maxNbAttempts); - if (ml ml1, and - * ip1+3 <= ip2 (usually < ip1+ml1) */ - if ((start2 - ip) < OPTIMAL_ML) { - int correction; - int new_ml = ml; - if (new_ml > OPTIMAL_ML) new_ml = OPTIMAL_ML; - if (ip+new_ml > start2 + ml2 - MINMATCH) new_ml = (int)(start2 - ip) + ml2 - MINMATCH; - correction = new_ml - (int)(start2 - ip); - if (correction > 0) { - start2 += correction; - ref2 += correction; - ml2 -= correction; - } - } - /* Now, we have start2 = ip+new_ml, with new_ml = min(ml, OPTIMAL_ML=18) */ - - if (start2 + ml2 < mflimit) - ml3 = LZ4HC_InsertAndGetWiderMatch(ctx, start2 + ml2 - 3, start2, matchlimit, ml2, &ref3, &start3, maxNbAttempts); - else - ml3 = ml2; - - if (ml3 == ml2) { /* No better match : 2 sequences to encode */ - /* ip & ref are known; Now for ml */ - if (start2 < ip+ml) ml = (int)(start2 - ip); - /* Now, encode 2 sequences */ - optr = op; - if (LZ4HC_encodeSequence(&ip, &op, &anchor, ml, ref, limit, oend)) goto _dest_overflow; - ip = start2; - optr = op; - if (LZ4HC_encodeSequence(&ip, &op, &anchor, ml2, ref2, limit, oend)) goto _dest_overflow; - continue; - } - - if (start3 < ip+ml+3) { /* Not enough space for match 2 : remove it */ - if (start3 >= (ip+ml)) { /* can write Seq1 immediately ==> Seq2 is removed, so Seq3 becomes Seq1 */ - if (start2 < ip+ml) { - int correction = (int)(ip+ml - start2); - start2 += correction; - ref2 += correction; - ml2 -= correction; - if (ml2 < MINMATCH) { - start2 = start3; - ref2 = ref3; - ml2 = ml3; - } - } - - optr = op; - if (LZ4HC_encodeSequence(&ip, &op, &anchor, ml, ref, limit, oend)) goto _dest_overflow; - ip = start3; - ref = ref3; - ml = ml3; - - start0 = start2; - ref0 = ref2; - ml0 = ml2; - goto _Search2; - } - - start2 = start3; - ref2 = ref3; - ml2 = ml3; - goto _Search3; - } - - /* - * OK, now we have 3 ascending matches; let's write at least the first one - * ip & ref are known; Now for ml - */ - if (start2 < ip+ml) { - if ((start2 - ip) < (int)ML_MASK) { - int correction; - if (ml > OPTIMAL_ML) ml = OPTIMAL_ML; - if (ip + ml > start2 + ml2 - MINMATCH) ml = (int)(start2 - ip) + ml2 - MINMATCH; - correction = ml - (int)(start2 - ip); - if (correction > 0) { - start2 += correction; - ref2 += correction; - ml2 -= correction; - } - } else { - ml = (int)(start2 - ip); - } - } - optr = op; - if (LZ4HC_encodeSequence(&ip, &op, &anchor, ml, ref, limit, oend)) goto _dest_overflow; - - ip = start2; - ref = ref2; - ml = ml2; - - start2 = start3; - ref2 = ref3; - ml2 = ml3; - - goto _Search3; - } - -_last_literals: - /* Encode Last Literals */ - { size_t lastRunSize = (size_t)(iend - anchor); /* literals */ - size_t litLength = (lastRunSize + 255 - RUN_MASK) / 255; - size_t const totalSize = 1 + litLength + lastRunSize; - if (limit == limitedDestSize) oend += LASTLITERALS; /* restore correct value */ - if (limit && (op + totalSize > oend)) { - if (limit == limitedOutput) return 0; /* Check output limit */ - /* adapt lastRunSize to fill 'dest' */ - lastRunSize = (size_t)(oend - op) - 1; - litLength = (lastRunSize + 255 - RUN_MASK) / 255; - lastRunSize -= litLength; - } - ip = anchor + lastRunSize; - - if (lastRunSize >= RUN_MASK) { - size_t accumulator = lastRunSize - RUN_MASK; - *op++ = (RUN_MASK << ML_BITS); - for(; accumulator >= 255 ; accumulator -= 255) *op++ = 255; - *op++ = (BYTE) accumulator; - } else { - *op++ = (BYTE)(lastRunSize << ML_BITS); - } - memcpy(op, anchor, lastRunSize); - op += lastRunSize; - } - - /* End */ - *srcSizePtr = (int) (((const char*)ip) - source); - return (int) (((char*)op)-dest); - -_dest_overflow: - if (limit == limitedDestSize) { - op = optr; /* restore correct out pointer */ - goto _last_literals; - } - return 0; -} - - -static int LZ4HC_compress_generic ( - LZ4HC_CCtx_internal* const ctx, - const char* const src, - char* const dst, - int* const srcSizePtr, - int const dstCapacity, - int cLevel, - limitedOutput_directive limit - ) -{ - ctx->end += *srcSizePtr; - if (cLevel < 1) cLevel = LZ4HC_CLEVEL_DEFAULT; /* note : convention is different from lz4frame, maybe something to review */ - if (cLevel > 9) { - if (limit == limitedDestSize) cLevel = 10; - switch (cLevel) { - case 10: - return LZ4HC_compress_hashChain(ctx, src, dst, srcSizePtr, dstCapacity, 1<<12, limit); - case 11: - return LZ4HC_compress_optimal(ctx, src, dst, *srcSizePtr, dstCapacity, limit, 512, 128, 0); - default: - /* fall-through */ - case 12: - return LZ4HC_compress_optimal(ctx, src, dst, *srcSizePtr, dstCapacity, limit, 1<<13, LZ4_OPT_NUM, 1); - } - } - return LZ4HC_compress_hashChain(ctx, src, dst, srcSizePtr, dstCapacity, 1 << (cLevel-1), limit); /* levels 1-9 */ -} - - -int LZ4_sizeofStateHC(void) { return sizeof(LZ4_streamHC_t); } - -int LZ4_compress_HC_extStateHC (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int compressionLevel) -{ - LZ4HC_CCtx_internal* const ctx = &((LZ4_streamHC_t*)state)->internal_donotuse; - if (((size_t)(state)&(sizeof(void*)-1)) != 0) return 0; /* Error : state is not aligned for pointers (32 or 64 bits) */ - LZ4HC_init (ctx, (const BYTE*)src); - if (dstCapacity < LZ4_compressBound(srcSize)) - return LZ4HC_compress_generic (ctx, src, dst, &srcSize, dstCapacity, compressionLevel, limitedOutput); - else - return LZ4HC_compress_generic (ctx, src, dst, &srcSize, dstCapacity, compressionLevel, noLimit); -} - -int LZ4_compress_HC(const char* src, char* dst, int srcSize, int dstCapacity, int compressionLevel) -{ -#if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1 - LZ4_streamHC_t* const statePtr = (LZ4_streamHC_t*)malloc(sizeof(LZ4_streamHC_t)); -#else - LZ4_streamHC_t state; - LZ4_streamHC_t* const statePtr = &state; -#endif - int const cSize = LZ4_compress_HC_extStateHC(statePtr, src, dst, srcSize, dstCapacity, compressionLevel); -#if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1 - free(statePtr); -#endif - return cSize; -} - -/* LZ4_compress_HC_destSize() : - * only compatible with Hash Chain match finder */ -int LZ4_compress_HC_destSize(void* LZ4HC_Data, const char* source, char* dest, int* sourceSizePtr, int targetDestSize, int cLevel) -{ - LZ4HC_CCtx_internal* const ctx = &((LZ4_streamHC_t*)LZ4HC_Data)->internal_donotuse; - LZ4HC_init(ctx, (const BYTE*) source); - return LZ4HC_compress_generic(ctx, source, dest, sourceSizePtr, targetDestSize, cLevel, limitedDestSize); -} - - - -/************************************** -* Streaming Functions -**************************************/ -/* allocation */ -LZ4_streamHC_t* LZ4_createStreamHC(void) { return (LZ4_streamHC_t*)malloc(sizeof(LZ4_streamHC_t)); } -int LZ4_freeStreamHC (LZ4_streamHC_t* LZ4_streamHCPtr) { - if (!LZ4_streamHCPtr) return 0; /* support free on NULL */ - free(LZ4_streamHCPtr); - return 0; -} - - -/* initialization */ -void LZ4_resetStreamHC (LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLevel) -{ - LZ4_STATIC_ASSERT(sizeof(LZ4HC_CCtx_internal) <= sizeof(size_t) * LZ4_STREAMHCSIZE_SIZET); /* if compilation fails here, LZ4_STREAMHCSIZE must be increased */ - LZ4_streamHCPtr->internal_donotuse.base = NULL; - LZ4_setCompressionLevel(LZ4_streamHCPtr, compressionLevel); -} - -void LZ4_setCompressionLevel(LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLevel) -{ - if (compressionLevel < 1) compressionLevel = 1; - if (compressionLevel > LZ4HC_CLEVEL_MAX) compressionLevel = LZ4HC_CLEVEL_MAX; - LZ4_streamHCPtr->internal_donotuse.compressionLevel = compressionLevel; -} - -int LZ4_loadDictHC (LZ4_streamHC_t* LZ4_streamHCPtr, const char* dictionary, int dictSize) -{ - LZ4HC_CCtx_internal* const ctxPtr = &LZ4_streamHCPtr->internal_donotuse; - if (dictSize > 64 KB) { - dictionary += dictSize - 64 KB; - dictSize = 64 KB; - } - LZ4HC_init (ctxPtr, (const BYTE*)dictionary); - ctxPtr->end = (const BYTE*)dictionary + dictSize; - if (dictSize >= 4) LZ4HC_Insert (ctxPtr, ctxPtr->end-3); - return dictSize; -} - - -/* compression */ - -static void LZ4HC_setExternalDict(LZ4HC_CCtx_internal* ctxPtr, const BYTE* newBlock) -{ - if (ctxPtr->end >= ctxPtr->base + 4) LZ4HC_Insert (ctxPtr, ctxPtr->end-3); /* Referencing remaining dictionary content */ - - /* Only one memory segment for extDict, so any previous extDict is lost at this stage */ - ctxPtr->lowLimit = ctxPtr->dictLimit; - ctxPtr->dictLimit = (U32)(ctxPtr->end - ctxPtr->base); - ctxPtr->dictBase = ctxPtr->base; - ctxPtr->base = newBlock - ctxPtr->dictLimit; - ctxPtr->end = newBlock; - ctxPtr->nextToUpdate = ctxPtr->dictLimit; /* match referencing will resume from there */ -} - -static int LZ4_compressHC_continue_generic (LZ4_streamHC_t* LZ4_streamHCPtr, - const char* src, char* dst, - int* srcSizePtr, int dstCapacity, - limitedOutput_directive limit) -{ - LZ4HC_CCtx_internal* const ctxPtr = &LZ4_streamHCPtr->internal_donotuse; - /* auto-init if forgotten */ - if (ctxPtr->base == NULL) LZ4HC_init (ctxPtr, (const BYTE*) src); - - /* Check overflow */ - if ((size_t)(ctxPtr->end - ctxPtr->base) > 2 GB) { - size_t dictSize = (size_t)(ctxPtr->end - ctxPtr->base) - ctxPtr->dictLimit; - if (dictSize > 64 KB) dictSize = 64 KB; - LZ4_loadDictHC(LZ4_streamHCPtr, (const char*)(ctxPtr->end) - dictSize, (int)dictSize); - } - - /* Check if blocks follow each other */ - if ((const BYTE*)src != ctxPtr->end) LZ4HC_setExternalDict(ctxPtr, (const BYTE*)src); - - /* Check overlapping input/dictionary space */ - { const BYTE* sourceEnd = (const BYTE*) src + *srcSizePtr; - const BYTE* const dictBegin = ctxPtr->dictBase + ctxPtr->lowLimit; - const BYTE* const dictEnd = ctxPtr->dictBase + ctxPtr->dictLimit; - if ((sourceEnd > dictBegin) && ((const BYTE*)src < dictEnd)) { - if (sourceEnd > dictEnd) sourceEnd = dictEnd; - ctxPtr->lowLimit = (U32)(sourceEnd - ctxPtr->dictBase); - if (ctxPtr->dictLimit - ctxPtr->lowLimit < 4) ctxPtr->lowLimit = ctxPtr->dictLimit; - } - } - - return LZ4HC_compress_generic (ctxPtr, src, dst, srcSizePtr, dstCapacity, ctxPtr->compressionLevel, limit); -} - -int LZ4_compress_HC_continue (LZ4_streamHC_t* LZ4_streamHCPtr, const char* src, char* dst, int srcSize, int dstCapacity) -{ - if (dstCapacity < LZ4_compressBound(srcSize)) - return LZ4_compressHC_continue_generic (LZ4_streamHCPtr, src, dst, &srcSize, dstCapacity, limitedOutput); - else - return LZ4_compressHC_continue_generic (LZ4_streamHCPtr, src, dst, &srcSize, dstCapacity, noLimit); -} - -int LZ4_compress_HC_continue_destSize (LZ4_streamHC_t* LZ4_streamHCPtr, const char* src, char* dst, int* srcSizePtr, int targetDestSize) -{ - return LZ4_compressHC_continue_generic(LZ4_streamHCPtr, src, dst, srcSizePtr, targetDestSize, limitedDestSize); -} - - - -/* dictionary saving */ - -int LZ4_saveDictHC (LZ4_streamHC_t* LZ4_streamHCPtr, char* safeBuffer, int dictSize) -{ - LZ4HC_CCtx_internal* const streamPtr = &LZ4_streamHCPtr->internal_donotuse; - int const prefixSize = (int)(streamPtr->end - (streamPtr->base + streamPtr->dictLimit)); - if (dictSize > 64 KB) dictSize = 64 KB; - if (dictSize < 4) dictSize = 0; - if (dictSize > prefixSize) dictSize = prefixSize; - memmove(safeBuffer, streamPtr->end - dictSize, dictSize); - { U32 const endIndex = (U32)(streamPtr->end - streamPtr->base); - streamPtr->end = (const BYTE*)safeBuffer + dictSize; - streamPtr->base = streamPtr->end - endIndex; - streamPtr->dictLimit = endIndex - dictSize; - streamPtr->lowLimit = endIndex - dictSize; - if (streamPtr->nextToUpdate < streamPtr->dictLimit) streamPtr->nextToUpdate = streamPtr->dictLimit; - } - return dictSize; -} - - -/*********************************** -* Deprecated Functions -***********************************/ -/* These functions currently generate deprecation warnings */ -/* Deprecated compression functions */ -int LZ4_compressHC(const char* src, char* dst, int srcSize) { return LZ4_compress_HC (src, dst, srcSize, LZ4_compressBound(srcSize), 0); } -int LZ4_compressHC_limitedOutput(const char* src, char* dst, int srcSize, int maxDstSize) { return LZ4_compress_HC(src, dst, srcSize, maxDstSize, 0); } -int LZ4_compressHC2(const char* src, char* dst, int srcSize, int cLevel) { return LZ4_compress_HC (src, dst, srcSize, LZ4_compressBound(srcSize), cLevel); } -int LZ4_compressHC2_limitedOutput(const char* src, char* dst, int srcSize, int maxDstSize, int cLevel) { return LZ4_compress_HC(src, dst, srcSize, maxDstSize, cLevel); } -int LZ4_compressHC_withStateHC (void* state, const char* src, char* dst, int srcSize) { return LZ4_compress_HC_extStateHC (state, src, dst, srcSize, LZ4_compressBound(srcSize), 0); } -int LZ4_compressHC_limitedOutput_withStateHC (void* state, const char* src, char* dst, int srcSize, int maxDstSize) { return LZ4_compress_HC_extStateHC (state, src, dst, srcSize, maxDstSize, 0); } -int LZ4_compressHC2_withStateHC (void* state, const char* src, char* dst, int srcSize, int cLevel) { return LZ4_compress_HC_extStateHC(state, src, dst, srcSize, LZ4_compressBound(srcSize), cLevel); } -int LZ4_compressHC2_limitedOutput_withStateHC (void* state, const char* src, char* dst, int srcSize, int maxDstSize, int cLevel) { return LZ4_compress_HC_extStateHC(state, src, dst, srcSize, maxDstSize, cLevel); } -int LZ4_compressHC_continue (LZ4_streamHC_t* ctx, const char* src, char* dst, int srcSize) { return LZ4_compress_HC_continue (ctx, src, dst, srcSize, LZ4_compressBound(srcSize)); } -int LZ4_compressHC_limitedOutput_continue (LZ4_streamHC_t* ctx, const char* src, char* dst, int srcSize, int maxDstSize) { return LZ4_compress_HC_continue (ctx, src, dst, srcSize, maxDstSize); } - - -/* Deprecated streaming functions */ -int LZ4_sizeofStreamStateHC(void) { return LZ4_STREAMHCSIZE; } - -int LZ4_resetStreamStateHC(void* state, char* inputBuffer) -{ - LZ4HC_CCtx_internal *ctx = &((LZ4_streamHC_t*)state)->internal_donotuse; - if ((((size_t)state) & (sizeof(void*)-1)) != 0) return 1; /* Error : pointer is not aligned for pointer (32 or 64 bits) */ - LZ4HC_init(ctx, (const BYTE*)inputBuffer); - ctx->inputBuffer = (BYTE*)inputBuffer; - return 0; -} - -void* LZ4_createHC (char* inputBuffer) -{ - LZ4_streamHC_t* hc4 = (LZ4_streamHC_t*)ALLOCATOR(1, sizeof(LZ4_streamHC_t)); - if (hc4 == NULL) return NULL; /* not enough memory */ - LZ4HC_init (&hc4->internal_donotuse, (const BYTE*)inputBuffer); - hc4->internal_donotuse.inputBuffer = (BYTE*)inputBuffer; - return hc4; -} - -int LZ4_freeHC (void* LZ4HC_Data) { - if (!LZ4HC_Data) return 0; /* support free on NULL */ - FREEMEM(LZ4HC_Data); - return 0; -} - -int LZ4_compressHC2_continue (void* LZ4HC_Data, const char* src, char* dst, int srcSize, int cLevel) -{ - return LZ4HC_compress_generic (&((LZ4_streamHC_t*)LZ4HC_Data)->internal_donotuse, src, dst, &srcSize, 0, cLevel, noLimit); -} - -int LZ4_compressHC2_limitedOutput_continue (void* LZ4HC_Data, const char* src, char* dst, int srcSize, int dstCapacity, int cLevel) -{ - return LZ4HC_compress_generic (&((LZ4_streamHC_t*)LZ4HC_Data)->internal_donotuse, src, dst, &srcSize, dstCapacity, cLevel, limitedOutput); -} - -char* LZ4_slideInputBufferHC(void* LZ4HC_Data) -{ - LZ4HC_CCtx_internal* const hc4 = &((LZ4_streamHC_t*)LZ4HC_Data)->internal_donotuse; - int const dictSize = LZ4_saveDictHC((LZ4_streamHC_t*)LZ4HC_Data, (char*)(hc4->inputBuffer), 64 KB); - return (char*)(hc4->inputBuffer + dictSize); -} diff --git a/love/src/jni/love/src/libraries/lz4/lz4hc.h b/love/src/jni/love/src/libraries/lz4/lz4hc.h deleted file mode 100755 index d7910623..00000000 --- a/love/src/jni/love/src/libraries/lz4/lz4hc.h +++ /dev/null @@ -1,272 +0,0 @@ -/* - LZ4 HC - High Compression Mode of LZ4 - Header File - Copyright (C) 2011-2017, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - 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. - - 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 THE COPYRIGHT - OWNER OR CONTRIBUTORS 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. - - You can contact the author at : - - LZ4 source repository : https://github.com/lz4/lz4 - - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c -*/ -#ifndef LZ4_HC_H_19834876238432 -#define LZ4_HC_H_19834876238432 - -#if defined (__cplusplus) -extern "C" { -#endif - -/* --- Dependency --- */ -/* note : lz4hc requires lz4.h/lz4.c for compilation */ -#include "lz4.h" /* stddef, LZ4LIB_API, LZ4_DEPRECATED */ - - -/* --- Useful constants --- */ -#define LZ4HC_CLEVEL_MIN 3 -#define LZ4HC_CLEVEL_DEFAULT 9 -#define LZ4HC_CLEVEL_OPT_MIN 11 -#define LZ4HC_CLEVEL_MAX 12 - - -/*-************************************ - * Block Compression - **************************************/ -/*! LZ4_compress_HC() : - * Compress data from `src` into `dst`, using the more powerful but slower "HC" algorithm. - * `dst` must be already allocated. - * Compression is guaranteed to succeed if `dstCapacity >= LZ4_compressBound(srcSize)` (see "lz4.h") - * Max supported `srcSize` value is LZ4_MAX_INPUT_SIZE (see "lz4.h") - * `compressionLevel` : any value between 1 and LZ4HC_CLEVEL_MAX will work. - * Values > LZ4HC_CLEVEL_MAX behave the same as LZ4HC_CLEVEL_MAX. - * @return : the number of bytes written into 'dst' - * or 0 if compression fails. - */ -LZ4LIB_API int LZ4_compress_HC (const char* src, char* dst, int srcSize, int dstCapacity, int compressionLevel); - - -/* Note : - * Decompression functions are provided within "lz4.h" (BSD license) - */ - - -/*! LZ4_compress_HC_extStateHC() : - * Same as LZ4_compress_HC(), but using an externally allocated memory segment for `state`. - * `state` size is provided by LZ4_sizeofStateHC(). - * Memory segment must be aligned on 8-bytes boundaries (which a normal malloc() should do properly). - */ -LZ4LIB_API int LZ4_sizeofStateHC(void); -LZ4LIB_API int LZ4_compress_HC_extStateHC(void* state, const char* src, char* dst, int srcSize, int maxDstSize, int compressionLevel); - - -/*-************************************ - * Streaming Compression - * Bufferless synchronous API - **************************************/ - typedef union LZ4_streamHC_u LZ4_streamHC_t; /* incomplete type (defined later) */ - -/*! LZ4_createStreamHC() and LZ4_freeStreamHC() : - * These functions create and release memory for LZ4 HC streaming state. - * Newly created states are automatically initialized. - * Existing states can be re-used several times, using LZ4_resetStreamHC(). - * These methods are API and ABI stable, they can be used in combination with a DLL. - */ -LZ4LIB_API LZ4_streamHC_t* LZ4_createStreamHC(void); -LZ4LIB_API int LZ4_freeStreamHC (LZ4_streamHC_t* streamHCPtr); - -LZ4LIB_API void LZ4_resetStreamHC (LZ4_streamHC_t* streamHCPtr, int compressionLevel); -LZ4LIB_API int LZ4_loadDictHC (LZ4_streamHC_t* streamHCPtr, const char* dictionary, int dictSize); - -LZ4LIB_API int LZ4_compress_HC_continue (LZ4_streamHC_t* streamHCPtr, const char* src, char* dst, int srcSize, int maxDstSize); - -LZ4LIB_API int LZ4_saveDictHC (LZ4_streamHC_t* streamHCPtr, char* safeBuffer, int maxDictSize); - -/* - These functions compress data in successive blocks of any size, using previous blocks as dictionary. - One key assumption is that previous blocks (up to 64 KB) remain read-accessible while compressing next blocks. - There is an exception for ring buffers, which can be smaller than 64 KB. - Ring buffers scenario is automatically detected and handled by LZ4_compress_HC_continue(). - - Before starting compression, state must be properly initialized, using LZ4_resetStreamHC(). - A first "fictional block" can then be designated as initial dictionary, using LZ4_loadDictHC() (Optional). - - Then, use LZ4_compress_HC_continue() to compress each successive block. - Previous memory blocks (including initial dictionary when present) must remain accessible and unmodified during compression. - 'dst' buffer should be sized to handle worst case scenarios (see LZ4_compressBound()), to ensure operation success. - Because in case of failure, the API does not guarantee context recovery, and context will have to be reset. - If `dst` buffer budget cannot be >= LZ4_compressBound(), consider using LZ4_compress_HC_continue_destSize() instead. - - If, for any reason, previous data block can't be preserved unmodified in memory for next compression block, - you can save it to a more stable memory space, using LZ4_saveDictHC(). - Return value of LZ4_saveDictHC() is the size of dictionary effectively saved into 'safeBuffer'. -*/ - - -/*-************************************************************** - * PRIVATE DEFINITIONS : - * Do not use these definitions. - * They are exposed to allow static allocation of `LZ4_streamHC_t`. - * Using these definitions makes the code vulnerable to potential API break when upgrading LZ4 - ****************************************************************/ -#define LZ4HC_DICTIONARY_LOGSIZE 16 -#define LZ4HC_MAXD (1<= 199901L) /* C99 */) -#include - -typedef struct -{ - uint32_t hashTable[LZ4HC_HASHTABLESIZE]; - uint16_t chainTable[LZ4HC_MAXD]; - const uint8_t* end; /* next block here to continue on current prefix */ - const uint8_t* base; /* All index relative to this position */ - const uint8_t* dictBase; /* alternate base for extDict */ - uint8_t* inputBuffer; /* deprecated */ - uint32_t dictLimit; /* below that point, need extDict */ - uint32_t lowLimit; /* below that point, no more dict */ - uint32_t nextToUpdate; /* index from which to continue dictionary update */ - int compressionLevel; -} LZ4HC_CCtx_internal; - -#else - -typedef struct -{ - unsigned int hashTable[LZ4HC_HASHTABLESIZE]; - unsigned short chainTable[LZ4HC_MAXD]; - const unsigned char* end; /* next block here to continue on current prefix */ - const unsigned char* base; /* All index relative to this position */ - const unsigned char* dictBase; /* alternate base for extDict */ - unsigned char* inputBuffer; /* deprecated */ - unsigned int dictLimit; /* below that point, need extDict */ - unsigned int lowLimit; /* below that point, no more dict */ - unsigned int nextToUpdate; /* index from which to continue dictionary update */ - int compressionLevel; -} LZ4HC_CCtx_internal; - -#endif - -#define LZ4_STREAMHCSIZE (4*LZ4HC_HASHTABLESIZE + 2*LZ4HC_MAXD + 56) /* 262200 */ -#define LZ4_STREAMHCSIZE_SIZET (LZ4_STREAMHCSIZE / sizeof(size_t)) -union LZ4_streamHC_u { - size_t table[LZ4_STREAMHCSIZE_SIZET]; - LZ4HC_CCtx_internal internal_donotuse; -}; /* previously typedef'd to LZ4_streamHC_t */ -/* - LZ4_streamHC_t : - This structure allows static allocation of LZ4 HC streaming state. - State must be initialized using LZ4_resetStreamHC() before first use. - - Static allocation shall only be used in combination with static linking. - When invoking LZ4 from a DLL, use create/free functions instead, which are API and ABI stable. -*/ - - -/*-************************************ -* Deprecated Functions -**************************************/ -/* see lz4.h LZ4_DISABLE_DEPRECATE_WARNINGS to turn off deprecation warnings */ - -/* deprecated compression functions */ -LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_HC() instead") int LZ4_compressHC (const char* source, char* dest, int inputSize); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_HC() instead") int LZ4_compressHC_limitedOutput (const char* source, char* dest, int inputSize, int maxOutputSize); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_HC() instead") int LZ4_compressHC2 (const char* source, char* dest, int inputSize, int compressionLevel); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_HC() instead") int LZ4_compressHC2_limitedOutput (const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") int LZ4_compressHC_withStateHC (void* state, const char* source, char* dest, int inputSize); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") int LZ4_compressHC_limitedOutput_withStateHC (void* state, const char* source, char* dest, int inputSize, int maxOutputSize); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") int LZ4_compressHC2_withStateHC (void* state, const char* source, char* dest, int inputSize, int compressionLevel); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") int LZ4_compressHC2_limitedOutput_withStateHC(void* state, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") int LZ4_compressHC_continue (LZ4_streamHC_t* LZ4_streamHCPtr, const char* source, char* dest, int inputSize); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") int LZ4_compressHC_limitedOutput_continue (LZ4_streamHC_t* LZ4_streamHCPtr, const char* source, char* dest, int inputSize, int maxOutputSize); - -/* Deprecated Streaming functions using older model; should no longer be used */ -LZ4LIB_API LZ4_DEPRECATED("use LZ4_createStreamHC() instead") void* LZ4_createHC (char* inputBuffer); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_saveDictHC() instead") char* LZ4_slideInputBufferHC (void* LZ4HC_Data); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_freeStreamHC() instead") int LZ4_freeHC (void* LZ4HC_Data); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") int LZ4_compressHC2_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int compressionLevel); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") int LZ4_compressHC2_limitedOutput_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_createStreamHC() instead") int LZ4_sizeofStreamStateHC(void); -LZ4LIB_API LZ4_DEPRECATED("use LZ4_resetStreamHC() instead") int LZ4_resetStreamStateHC(void* state, char* inputBuffer); - - -#if defined (__cplusplus) -} -#endif - -#endif /* LZ4_HC_H_19834876238432 */ - - -/*-************************************************** - * !!!!! STATIC LINKING ONLY !!!!! - * Following definitions are considered experimental. - * They should not be linked from DLL, - * as there is no guarantee of API stability yet. - * Prototypes will be promoted to "stable" status - * after successfull usage in real-life scenarios. - ***************************************************/ -#ifdef LZ4_HC_STATIC_LINKING_ONLY /* protection macro */ -#ifndef LZ4_HC_SLO_098092834 -#define LZ4_HC_SLO_098092834 - -/*! LZ4_compress_HC_destSize() : v1.8.0 (experimental) - * Will try to compress as much data from `src` as possible - * that can fit into `targetDstSize` budget. - * Result is provided in 2 parts : - * @return : the number of bytes written into 'dst' - * or 0 if compression fails. - * `srcSizePtr` : value will be updated to indicate how much bytes were read from `src` - */ -int LZ4_compress_HC_destSize(void* LZ4HC_Data, - const char* src, char* dst, - int* srcSizePtr, int targetDstSize, - int compressionLevel); - -/*! LZ4_compress_HC_continue_destSize() : v1.8.0 (experimental) - * Similar as LZ4_compress_HC_continue(), - * but will read a variable nb of bytes from `src` - * to fit into `targetDstSize` budget. - * Result is provided in 2 parts : - * @return : the number of bytes written into 'dst' - * or 0 if compression fails. - * `srcSizePtr` : value will be updated to indicate how much bytes were read from `src`. - */ -int LZ4_compress_HC_continue_destSize(LZ4_streamHC_t* LZ4_streamHCPtr, - const char* src, char* dst, - int* srcSizePtr, int targetDstSize); - -/*! LZ4_setCompressionLevel() : v1.8.0 (experimental) - * It's possible to change compression level between 2 invocations of LZ4_compress_HC_continue*() - */ -void LZ4_setCompressionLevel(LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLevel); - - - -#endif /* LZ4_HC_SLO_098092834 */ -#endif /* LZ4_HC_STATIC_LINKING_ONLY */ diff --git a/love/src/jni/love/src/libraries/lz4/lz4opt.h b/love/src/jni/love/src/libraries/lz4/lz4opt.h deleted file mode 100755 index 9917851e..00000000 --- a/love/src/jni/love/src/libraries/lz4/lz4opt.h +++ /dev/null @@ -1,329 +0,0 @@ -/* - lz4opt.h - Optimal Mode of LZ4 - Copyright (C) 2015-2017, Przemyslaw Skibinski - Note : this file is intended to be included within lz4hc.c - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - 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. - - 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 THE COPYRIGHT - OWNER OR CONTRIBUTORS 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. - - You can contact the author at : - - LZ4 source repository : https://github.com/lz4/lz4 - - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c -*/ - -#define LZ4_OPT_NUM (1<<12) - -typedef struct { - int price; - int off; - int mlen; - int litlen; -} LZ4HC_optimal_t; - - -/* price in bytes */ -LZ4_FORCE_INLINE int LZ4HC_literalsPrice(int const litlen) -{ - int price = litlen; - if (litlen >= (int)RUN_MASK) - price += 1 + (litlen-RUN_MASK)/255; - return price; -} - - -/* requires mlen >= MINMATCH */ -LZ4_FORCE_INLINE int LZ4HC_sequencePrice(int litlen, int mlen) -{ - int price = 1 + 2 ; /* token + 16-bit offset */ - - price += LZ4HC_literalsPrice(litlen); - - if (mlen >= (int)(ML_MASK+MINMATCH)) - price += 1 + (mlen-(ML_MASK+MINMATCH))/255; - - return price; -} - - -/*-************************************* -* Match finder -***************************************/ -typedef struct { - int off; - int len; -} LZ4HC_match_t; - -LZ4_FORCE_INLINE -LZ4HC_match_t LZ4HC_FindLongerMatch(LZ4HC_CCtx_internal* const ctx, - const BYTE* ip, const BYTE* const iHighLimit, - int minLen, int nbSearches) -{ - LZ4HC_match_t match = { 0 , 0 }; - const BYTE* matchPtr = NULL; - /* note : LZ4HC_InsertAndGetWiderMatch() is able to modify the starting position of a match (*startpos), - * but this won't be the case here, as we define iLowLimit==ip, - * so LZ4HC_InsertAndGetWiderMatch() won't be allowed to search past ip */ - int const matchLength = LZ4HC_InsertAndGetWiderMatch(ctx, ip, ip, iHighLimit, minLen, &matchPtr, &ip, nbSearches); - if (matchLength <= minLen) return match; - match.len = matchLength; - match.off = (int)(ip-matchPtr); - return match; -} - - -static int LZ4HC_compress_optimal ( - LZ4HC_CCtx_internal* ctx, - const char* const source, - char* dst, - int inputSize, - int dstCapacity, - limitedOutput_directive limit, - int const nbSearches, - size_t sufficient_len, - int const fullUpdate - ) -{ -#define TRAILING_LITERALS 3 - LZ4HC_optimal_t opt[LZ4_OPT_NUM + TRAILING_LITERALS]; /* this uses a bit too much stack memory to my taste ... */ - - const BYTE* ip = (const BYTE*) source; - const BYTE* anchor = ip; - const BYTE* const iend = ip + inputSize; - const BYTE* const mflimit = iend - MFLIMIT; - const BYTE* const matchlimit = iend - LASTLITERALS; - BYTE* op = (BYTE*) dst; - BYTE* const oend = op + dstCapacity; - - /* init */ - DEBUGLOG(5, "LZ4HC_compress_optimal"); - if (sufficient_len >= LZ4_OPT_NUM) sufficient_len = LZ4_OPT_NUM-1; - - /* Main Loop */ - assert(ip - anchor < LZ4_MAX_INPUT_SIZE); - while (ip < mflimit) { - int const llen = (int)(ip - anchor); - int best_mlen, best_off; - int cur, last_match_pos = 0; - - LZ4HC_match_t const firstMatch = LZ4HC_FindLongerMatch(ctx, ip, matchlimit, MINMATCH-1, nbSearches); - if (firstMatch.len==0) { ip++; continue; } - - if ((size_t)firstMatch.len > sufficient_len) { - /* good enough solution : immediate encoding */ - int const firstML = firstMatch.len; - const BYTE* const matchPos = ip - firstMatch.off; - if ( LZ4HC_encodeSequence(&ip, &op, &anchor, firstML, matchPos, limit, oend) ) /* updates ip, op and anchor */ - return 0; /* error */ - continue; - } - - /* set prices for first positions (literals) */ - { int rPos; - for (rPos = 0 ; rPos < MINMATCH ; rPos++) { - int const cost = LZ4HC_literalsPrice(llen + rPos); - opt[rPos].mlen = 1; - opt[rPos].off = 0; - opt[rPos].litlen = llen + rPos; - opt[rPos].price = cost; - DEBUGLOG(7, "rPos:%3i => price:%3i (litlen=%i) -- initial setup", - rPos, cost, opt[rPos].litlen); - } } - /* set prices using initial match */ - { int mlen = MINMATCH; - int const matchML = firstMatch.len; /* necessarily < sufficient_len < LZ4_OPT_NUM */ - int const offset = firstMatch.off; - assert(matchML < LZ4_OPT_NUM); - for ( ; mlen <= matchML ; mlen++) { - int const cost = LZ4HC_sequencePrice(llen, mlen); - opt[mlen].mlen = mlen; - opt[mlen].off = offset; - opt[mlen].litlen = llen; - opt[mlen].price = cost; - DEBUGLOG(7, "rPos:%3i => price:%3i (matchlen=%i) -- initial setup", - mlen, cost, mlen); - } } - last_match_pos = firstMatch.len; - { int addLit; - for (addLit = 1; addLit <= TRAILING_LITERALS; addLit ++) { - opt[last_match_pos+addLit].mlen = 1; /* literal */ - opt[last_match_pos+addLit].off = 0; - opt[last_match_pos+addLit].litlen = addLit; - opt[last_match_pos+addLit].price = opt[last_match_pos].price + LZ4HC_literalsPrice(addLit); - DEBUGLOG(7, "rPos:%3i => price:%3i (litlen=%i) -- initial setup", - last_match_pos+addLit, opt[last_match_pos+addLit].price, addLit); - } } - - /* check further positions */ - for (cur = 1; cur < last_match_pos; cur++) { - const BYTE* const curPtr = ip + cur; - LZ4HC_match_t newMatch; - - if (curPtr >= mflimit) break; - DEBUGLOG(7, "rPos:%u[%u] vs [%u]%u", - cur, opt[cur].price, opt[cur+1].price, cur+1); - if (fullUpdate) { - /* not useful to search here if next position has same (or lower) cost */ - if ( (opt[cur+1].price <= opt[cur].price) - /* in some cases, next position has same cost, but cost rises sharply after, so a small match would still be beneficial */ - && (opt[cur+MINMATCH].price < opt[cur].price + 3/*min seq price*/) ) - continue; - } else { - /* not useful to search here if next position has same (or lower) cost */ - if (opt[cur+1].price <= opt[cur].price) continue; - } - - DEBUGLOG(7, "search at rPos:%u", cur); - if (fullUpdate) - newMatch = LZ4HC_FindLongerMatch(ctx, curPtr, matchlimit, MINMATCH-1, nbSearches); - else - /* only test matches of minimum length; slightly faster, but misses a few bytes */ - newMatch = LZ4HC_FindLongerMatch(ctx, curPtr, matchlimit, last_match_pos - cur, nbSearches); - if (!newMatch.len) continue; - - if ( ((size_t)newMatch.len > sufficient_len) - || (newMatch.len + cur >= LZ4_OPT_NUM) ) { - /* immediate encoding */ - best_mlen = newMatch.len; - best_off = newMatch.off; - last_match_pos = cur + 1; - goto encode; - } - - /* before match : set price with literals at beginning */ - { int const baseLitlen = opt[cur].litlen; - int litlen; - for (litlen = 1; litlen < MINMATCH; litlen++) { - int const price = opt[cur].price - LZ4HC_literalsPrice(baseLitlen) + LZ4HC_literalsPrice(baseLitlen+litlen); - int const pos = cur + litlen; - if (price < opt[pos].price) { - opt[pos].mlen = 1; /* literal */ - opt[pos].off = 0; - opt[pos].litlen = baseLitlen+litlen; - opt[pos].price = price; - DEBUGLOG(7, "rPos:%3i => price:%3i (litlen=%i)", - pos, price, opt[pos].litlen); - } } } - - /* set prices using match at position = cur */ - { int const matchML = newMatch.len; - int ml = MINMATCH; - - assert(cur + newMatch.len < LZ4_OPT_NUM); - for ( ; ml <= matchML ; ml++) { - int const pos = cur + ml; - int const offset = newMatch.off; - int price; - int ll; - DEBUGLOG(7, "testing price rPos %i (last_match_pos=%i)", - pos, last_match_pos); - if (opt[cur].mlen == 1) { - ll = opt[cur].litlen; - price = ((cur > ll) ? opt[cur - ll].price : 0) - + LZ4HC_sequencePrice(ll, ml); - } else { - ll = 0; - price = opt[cur].price + LZ4HC_sequencePrice(0, ml); - } - - if (pos > last_match_pos+TRAILING_LITERALS || price <= opt[pos].price) { - DEBUGLOG(7, "rPos:%3i => price:%3i (matchlen=%i)", - pos, price, ml); - assert(pos < LZ4_OPT_NUM); - if ( (ml == matchML) /* last pos of last match */ - && (last_match_pos < pos) ) - last_match_pos = pos; - opt[pos].mlen = ml; - opt[pos].off = offset; - opt[pos].litlen = ll; - opt[pos].price = price; - } } } - /* complete following positions with literals */ - { int addLit; - for (addLit = 1; addLit <= TRAILING_LITERALS; addLit ++) { - opt[last_match_pos+addLit].mlen = 1; /* literal */ - opt[last_match_pos+addLit].off = 0; - opt[last_match_pos+addLit].litlen = addLit; - opt[last_match_pos+addLit].price = opt[last_match_pos].price + LZ4HC_literalsPrice(addLit); - DEBUGLOG(7, "rPos:%3i => price:%3i (litlen=%i)", last_match_pos+addLit, opt[last_match_pos+addLit].price, addLit); - } } - } /* for (cur = 1; cur <= last_match_pos; cur++) */ - - best_mlen = opt[last_match_pos].mlen; - best_off = opt[last_match_pos].off; - cur = last_match_pos - best_mlen; - -encode: /* cur, last_match_pos, best_mlen, best_off must be set */ - assert(cur < LZ4_OPT_NUM); - assert(last_match_pos >= 1); /* == 1 when only one candidate */ - DEBUGLOG(6, "reverse traversal, looking for shortest path") - DEBUGLOG(6, "last_match_pos = %i", last_match_pos); - { int candidate_pos = cur; - int selected_matchLength = best_mlen; - int selected_offset = best_off; - while (1) { /* from end to beginning */ - int const next_matchLength = opt[candidate_pos].mlen; /* can be 1, means literal */ - int const next_offset = opt[candidate_pos].off; - DEBUGLOG(6, "pos %i: sequence length %i", candidate_pos, selected_matchLength); - opt[candidate_pos].mlen = selected_matchLength; - opt[candidate_pos].off = selected_offset; - selected_matchLength = next_matchLength; - selected_offset = next_offset; - if (next_matchLength > candidate_pos) break; /* last match elected, first match to encode */ - assert(next_matchLength > 0); /* can be 1, means literal */ - candidate_pos -= next_matchLength; - } } - - /* encode all recorded sequences in order */ - { int rPos = 0; /* relative position (to ip) */ - while (rPos < last_match_pos) { - int const ml = opt[rPos].mlen; - int const offset = opt[rPos].off; - if (ml == 1) { ip++; rPos++; continue; } /* literal; note: can end up with several literals, in which case, skip them */ - rPos += ml; - assert(ml >= MINMATCH); - assert((offset >= 1) && (offset <= MAX_DISTANCE)); - if ( LZ4HC_encodeSequence(&ip, &op, &anchor, ml, ip - offset, limit, oend) ) /* updates ip, op and anchor */ - return 0; /* error */ - } } - } /* while (ip < mflimit) */ - - /* Encode Last Literals */ - { int lastRun = (int)(iend - anchor); - if ( (limit) - && (((char*)op - dst) + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > (U32)dstCapacity)) - return 0; /* Check output limit */ - if (lastRun >= (int)RUN_MASK) { - *op++=(RUN_MASK< 254 ; lastRun-=255) *op++ = 255; - *op++ = (BYTE) lastRun; - } else *op++ = (BYTE)(lastRun<0) ? ((int)x) : ((int)x-1 ) ) -#define LERP(t, a, b) ((a) + (t)*((b)-(a))) - - -//--------------------------------------------------------------------- -// Static data - -/* - * Permutation table. This is just a random jumble of all numbers 0-255, - * repeated twice to avoid wrapping the index at 255 for each lookup. - * This needs to be exactly the same for all instances on all platforms, - * so it's easiest to just keep it as static explicit data. - * This also removes the need for any initialisation of this class. - * - * Note that making this an int[] instead of a char[] might make the - * code run faster on platforms with a high penalty for unaligned single - * byte addressing. Intel x86 is generally single-byte-friendly, but - * some other CPUs are faster with 4-aligned reads. - * However, a char[] is smaller, which avoids cache trashing, and that - * is probably the most important aspect on most architectures. - * This array is accessed a *lot* by the noise functions. - * A vector-valued noise over 3D accesses it 96 times, and a - * float-valued 4D noise 64 times. We want this to fit in the cache! - */ -unsigned char Noise1234::perm[] = {151,160,137,91,90,15, - 131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23, - 190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33, - 88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166, - 77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244, - 102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196, - 135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123, - 5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42, - 223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9, - 129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228, - 251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107, - 49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254, - 138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180, - 151,160,137,91,90,15, - 131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23, - 190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33, - 88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166, - 77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244, - 102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196, - 135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123, - 5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42, - 223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9, - 129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228, - 251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107, - 49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254, - 138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180 -}; - -//--------------------------------------------------------------------- - -/* - * Helper functions to compute gradients-dot-residualvectors (1D to 4D) - * Note that these generate gradients of more than unit length. To make - * a close match with the value range of classic Perlin noise, the final - * noise values need to be rescaled. To match the RenderMan noise in a - * statistical sense, the approximate scaling values (empirically - * determined from test renderings) are: - * 1D noise needs rescaling with 0.188 - * 2D noise needs rescaling with 0.507 - * 3D noise needs rescaling with 0.936 - * 4D noise needs rescaling with 0.87 - * Note that these noise functions are the most practical and useful - * signed version of Perlin noise. To return values according to the - * RenderMan specification from the SL noise() and pnoise() functions, - * the noise values need to be scaled and offset to [0,1], like this: - * float SLnoise = (Noise1234::noise(x,y,z) + 1.0) * 0.5; - */ - -float Noise1234::grad( int hash, float x ) { - int h = hash & 15; - float grad = 1.0 + (h & 7); // Gradient value 1.0, 2.0, ..., 8.0 - if (h&8) grad = -grad; // and a random sign for the gradient - return ( grad * x ); // Multiply the gradient with the distance -} - -float Noise1234::grad( int hash, float x, float y ) { - int h = hash & 7; // Convert low 3 bits of hash code - float u = h<4 ? x : y; // into 8 simple gradient directions, - float v = h<4 ? y : x; // and compute the dot product with (x,y). - return ((h&1)? -u : u) + ((h&2)? -2.0*v : 2.0*v); -} - -float Noise1234::grad( int hash, float x, float y , float z ) { - int h = hash & 15; // Convert low 4 bits of hash code into 12 simple - float u = h<8 ? x : y; // gradient directions, and compute dot product. - float v = h<4 ? y : h==12||h==14 ? x : z; // Fix repeats at h = 12 to 15 - return ((h&1)? -u : u) + ((h&2)? -v : v); -} - -float Noise1234::grad( int hash, float x, float y, float z, float t ) { - int h = hash & 31; // Convert low 5 bits of hash code into 32 simple - float u = h<24 ? x : y; // gradient directions, and compute dot product. - float v = h<16 ? y : z; - float w = h<8 ? z : t; - return ((h&1)? -u : u) + ((h&2)? -v : v) + ((h&4)? -w : w); -} - -//--------------------------------------------------------------------- -/** 1D float Perlin noise, SL "noise()" - */ -float Noise1234::noise( float x ) -{ - int ix0, ix1; - float fx0, fx1; - float s, n0, n1; - - ix0 = FASTFLOOR( x ); // Integer part of x - fx0 = x - ix0; // Fractional part of x - fx1 = fx0 - 1.0f; - ix1 = ( ix0+1 ) & 0xff; - ix0 = ix0 & 0xff; // Wrap to 0..255 - - s = FADE( fx0 ); - - n0 = grad( perm[ ix0 ], fx0 ); - n1 = grad( perm[ ix1 ], fx1 ); - return 0.188f * ( LERP( s, n0, n1 ) ); -} - -//--------------------------------------------------------------------- -/** 1D float Perlin periodic noise, SL "pnoise()" - */ -float Noise1234::pnoise( float x, int px ) -{ - int ix0, ix1; - float fx0, fx1; - float s, n0, n1; - - ix0 = FASTFLOOR( x ); // Integer part of x - fx0 = x - ix0; // Fractional part of x - fx1 = fx0 - 1.0f; - ix1 = (( ix0 + 1 ) % px) & 0xff; // Wrap to 0..px-1 *and* wrap to 0..255 - ix0 = ( ix0 % px ) & 0xff; // (because px might be greater than 256) - - s = FADE( fx0 ); - - n0 = grad( perm[ ix0 ], fx0 ); - n1 = grad( perm[ ix1 ], fx1 ); - return 0.188f * ( LERP( s, n0, n1 ) ); -} - - -//--------------------------------------------------------------------- -/** 2D float Perlin noise. - */ -float Noise1234::noise( float x, float y ) -{ - int ix0, iy0, ix1, iy1; - float fx0, fy0, fx1, fy1; - float s, t, nx0, nx1, n0, n1; - - ix0 = FASTFLOOR( x ); // Integer part of x - iy0 = FASTFLOOR( y ); // Integer part of y - fx0 = x - ix0; // Fractional part of x - fy0 = y - iy0; // Fractional part of y - fx1 = fx0 - 1.0f; - fy1 = fy0 - 1.0f; - ix1 = (ix0 + 1) & 0xff; // Wrap to 0..255 - iy1 = (iy0 + 1) & 0xff; - ix0 = ix0 & 0xff; - iy0 = iy0 & 0xff; - - t = FADE( fy0 ); - s = FADE( fx0 ); - - nx0 = grad(perm[ix0 + perm[iy0]], fx0, fy0); - nx1 = grad(perm[ix0 + perm[iy1]], fx0, fy1); - n0 = LERP( t, nx0, nx1 ); - - nx0 = grad(perm[ix1 + perm[iy0]], fx1, fy0); - nx1 = grad(perm[ix1 + perm[iy1]], fx1, fy1); - n1 = LERP(t, nx0, nx1); - - return 0.507f * ( LERP( s, n0, n1 ) ); -} - -//--------------------------------------------------------------------- -/** 2D float Perlin periodic noise. - */ -float Noise1234::pnoise( float x, float y, int px, int py ) -{ - int ix0, iy0, ix1, iy1; - float fx0, fy0, fx1, fy1; - float s, t, nx0, nx1, n0, n1; - - ix0 = FASTFLOOR( x ); // Integer part of x - iy0 = FASTFLOOR( y ); // Integer part of y - fx0 = x - ix0; // Fractional part of x - fy0 = y - iy0; // Fractional part of y - fx1 = fx0 - 1.0f; - fy1 = fy0 - 1.0f; - ix1 = (( ix0 + 1 ) % px) & 0xff; // Wrap to 0..px-1 and wrap to 0..255 - iy1 = (( iy0 + 1 ) % py) & 0xff; // Wrap to 0..py-1 and wrap to 0..255 - ix0 = ( ix0 % px ) & 0xff; - iy0 = ( iy0 % py ) & 0xff; - - t = FADE( fy0 ); - s = FADE( fx0 ); - - nx0 = grad(perm[ix0 + perm[iy0]], fx0, fy0); - nx1 = grad(perm[ix0 + perm[iy1]], fx0, fy1); - n0 = LERP( t, nx0, nx1 ); - - nx0 = grad(perm[ix1 + perm[iy0]], fx1, fy0); - nx1 = grad(perm[ix1 + perm[iy1]], fx1, fy1); - n1 = LERP(t, nx0, nx1); - - return 0.507f * ( LERP( s, n0, n1 ) ); -} - - -//--------------------------------------------------------------------- -/** 3D float Perlin noise. - */ -float Noise1234::noise( float x, float y, float z ) -{ - int ix0, iy0, ix1, iy1, iz0, iz1; - float fx0, fy0, fz0, fx1, fy1, fz1; - float s, t, r; - float nxy0, nxy1, nx0, nx1, n0, n1; - - ix0 = FASTFLOOR( x ); // Integer part of x - iy0 = FASTFLOOR( y ); // Integer part of y - iz0 = FASTFLOOR( z ); // Integer part of z - fx0 = x - ix0; // Fractional part of x - fy0 = y - iy0; // Fractional part of y - fz0 = z - iz0; // Fractional part of z - fx1 = fx0 - 1.0f; - fy1 = fy0 - 1.0f; - fz1 = fz0 - 1.0f; - ix1 = ( ix0 + 1 ) & 0xff; // Wrap to 0..255 - iy1 = ( iy0 + 1 ) & 0xff; - iz1 = ( iz0 + 1 ) & 0xff; - ix0 = ix0 & 0xff; - iy0 = iy0 & 0xff; - iz0 = iz0 & 0xff; - - r = FADE( fz0 ); - t = FADE( fy0 ); - s = FADE( fx0 ); - - nxy0 = grad(perm[ix0 + perm[iy0 + perm[iz0]]], fx0, fy0, fz0); - nxy1 = grad(perm[ix0 + perm[iy0 + perm[iz1]]], fx0, fy0, fz1); - nx0 = LERP( r, nxy0, nxy1 ); - - nxy0 = grad(perm[ix0 + perm[iy1 + perm[iz0]]], fx0, fy1, fz0); - nxy1 = grad(perm[ix0 + perm[iy1 + perm[iz1]]], fx0, fy1, fz1); - nx1 = LERP( r, nxy0, nxy1 ); - - n0 = LERP( t, nx0, nx1 ); - - nxy0 = grad(perm[ix1 + perm[iy0 + perm[iz0]]], fx1, fy0, fz0); - nxy1 = grad(perm[ix1 + perm[iy0 + perm[iz1]]], fx1, fy0, fz1); - nx0 = LERP( r, nxy0, nxy1 ); - - nxy0 = grad(perm[ix1 + perm[iy1 + perm[iz0]]], fx1, fy1, fz0); - nxy1 = grad(perm[ix1 + perm[iy1 + perm[iz1]]], fx1, fy1, fz1); - nx1 = LERP( r, nxy0, nxy1 ); - - n1 = LERP( t, nx0, nx1 ); - - return 0.936f * ( LERP( s, n0, n1 ) ); -} - -//--------------------------------------------------------------------- -/** 3D float Perlin periodic noise. - */ -float Noise1234::pnoise( float x, float y, float z, int px, int py, int pz ) -{ - int ix0, iy0, ix1, iy1, iz0, iz1; - float fx0, fy0, fz0, fx1, fy1, fz1; - float s, t, r; - float nxy0, nxy1, nx0, nx1, n0, n1; - - ix0 = FASTFLOOR( x ); // Integer part of x - iy0 = FASTFLOOR( y ); // Integer part of y - iz0 = FASTFLOOR( z ); // Integer part of z - fx0 = x - ix0; // Fractional part of x - fy0 = y - iy0; // Fractional part of y - fz0 = z - iz0; // Fractional part of z - fx1 = fx0 - 1.0f; - fy1 = fy0 - 1.0f; - fz1 = fz0 - 1.0f; - ix1 = (( ix0 + 1 ) % px ) & 0xff; // Wrap to 0..px-1 and wrap to 0..255 - iy1 = (( iy0 + 1 ) % py ) & 0xff; // Wrap to 0..py-1 and wrap to 0..255 - iz1 = (( iz0 + 1 ) % pz ) & 0xff; // Wrap to 0..pz-1 and wrap to 0..255 - ix0 = ( ix0 % px ) & 0xff; - iy0 = ( iy0 % py ) & 0xff; - iz0 = ( iz0 % pz ) & 0xff; - - r = FADE( fz0 ); - t = FADE( fy0 ); - s = FADE( fx0 ); - - nxy0 = grad(perm[ix0 + perm[iy0 + perm[iz0]]], fx0, fy0, fz0); - nxy1 = grad(perm[ix0 + perm[iy0 + perm[iz1]]], fx0, fy0, fz1); - nx0 = LERP( r, nxy0, nxy1 ); - - nxy0 = grad(perm[ix0 + perm[iy1 + perm[iz0]]], fx0, fy1, fz0); - nxy1 = grad(perm[ix0 + perm[iy1 + perm[iz1]]], fx0, fy1, fz1); - nx1 = LERP( r, nxy0, nxy1 ); - - n0 = LERP( t, nx0, nx1 ); - - nxy0 = grad(perm[ix1 + perm[iy0 + perm[iz0]]], fx1, fy0, fz0); - nxy1 = grad(perm[ix1 + perm[iy0 + perm[iz1]]], fx1, fy0, fz1); - nx0 = LERP( r, nxy0, nxy1 ); - - nxy0 = grad(perm[ix1 + perm[iy1 + perm[iz0]]], fx1, fy1, fz0); - nxy1 = grad(perm[ix1 + perm[iy1 + perm[iz1]]], fx1, fy1, fz1); - nx1 = LERP( r, nxy0, nxy1 ); - - n1 = LERP( t, nx0, nx1 ); - - return 0.936f * ( LERP( s, n0, n1 ) ); -} - - -//--------------------------------------------------------------------- -/** 4D float Perlin noise. - */ - -float Noise1234::noise( float x, float y, float z, float w ) -{ - int ix0, iy0, iz0, iw0, ix1, iy1, iz1, iw1; - float fx0, fy0, fz0, fw0, fx1, fy1, fz1, fw1; - float s, t, r, q; - float nxyz0, nxyz1, nxy0, nxy1, nx0, nx1, n0, n1; - - ix0 = FASTFLOOR( x ); // Integer part of x - iy0 = FASTFLOOR( y ); // Integer part of y - iz0 = FASTFLOOR( z ); // Integer part of y - iw0 = FASTFLOOR( w ); // Integer part of w - fx0 = x - ix0; // Fractional part of x - fy0 = y - iy0; // Fractional part of y - fz0 = z - iz0; // Fractional part of z - fw0 = w - iw0; // Fractional part of w - fx1 = fx0 - 1.0f; - fy1 = fy0 - 1.0f; - fz1 = fz0 - 1.0f; - fw1 = fw0 - 1.0f; - ix1 = ( ix0 + 1 ) & 0xff; // Wrap to 0..255 - iy1 = ( iy0 + 1 ) & 0xff; - iz1 = ( iz0 + 1 ) & 0xff; - iw1 = ( iw0 + 1 ) & 0xff; - ix0 = ix0 & 0xff; - iy0 = iy0 & 0xff; - iz0 = iz0 & 0xff; - iw0 = iw0 & 0xff; - - q = FADE( fw0 ); - r = FADE( fz0 ); - t = FADE( fy0 ); - s = FADE( fx0 ); - - nxyz0 = grad(perm[ix0 + perm[iy0 + perm[iz0 + perm[iw0]]]], fx0, fy0, fz0, fw0); - nxyz1 = grad(perm[ix0 + perm[iy0 + perm[iz0 + perm[iw1]]]], fx0, fy0, fz0, fw1); - nxy0 = LERP( q, nxyz0, nxyz1 ); - - nxyz0 = grad(perm[ix0 + perm[iy0 + perm[iz1 + perm[iw0]]]], fx0, fy0, fz1, fw0); - nxyz1 = grad(perm[ix0 + perm[iy0 + perm[iz1 + perm[iw1]]]], fx0, fy0, fz1, fw1); - nxy1 = LERP( q, nxyz0, nxyz1 ); - - nx0 = LERP ( r, nxy0, nxy1 ); - - nxyz0 = grad(perm[ix0 + perm[iy1 + perm[iz0 + perm[iw0]]]], fx0, fy1, fz0, fw0); - nxyz1 = grad(perm[ix0 + perm[iy1 + perm[iz0 + perm[iw1]]]], fx0, fy1, fz0, fw1); - nxy0 = LERP( q, nxyz0, nxyz1 ); - - nxyz0 = grad(perm[ix0 + perm[iy1 + perm[iz1 + perm[iw0]]]], fx0, fy1, fz1, fw0); - nxyz1 = grad(perm[ix0 + perm[iy1 + perm[iz1 + perm[iw1]]]], fx0, fy1, fz1, fw1); - nxy1 = LERP( q, nxyz0, nxyz1 ); - - nx1 = LERP ( r, nxy0, nxy1 ); - - n0 = LERP( t, nx0, nx1 ); - - nxyz0 = grad(perm[ix1 + perm[iy0 + perm[iz0 + perm[iw0]]]], fx1, fy0, fz0, fw0); - nxyz1 = grad(perm[ix1 + perm[iy0 + perm[iz0 + perm[iw1]]]], fx1, fy0, fz0, fw1); - nxy0 = LERP( q, nxyz0, nxyz1 ); - - nxyz0 = grad(perm[ix1 + perm[iy0 + perm[iz1 + perm[iw0]]]], fx1, fy0, fz1, fw0); - nxyz1 = grad(perm[ix1 + perm[iy0 + perm[iz1 + perm[iw1]]]], fx1, fy0, fz1, fw1); - nxy1 = LERP( q, nxyz0, nxyz1 ); - - nx0 = LERP ( r, nxy0, nxy1 ); - - nxyz0 = grad(perm[ix1 + perm[iy1 + perm[iz0 + perm[iw0]]]], fx1, fy1, fz0, fw0); - nxyz1 = grad(perm[ix1 + perm[iy1 + perm[iz0 + perm[iw1]]]], fx1, fy1, fz0, fw1); - nxy0 = LERP( q, nxyz0, nxyz1 ); - - nxyz0 = grad(perm[ix1 + perm[iy1 + perm[iz1 + perm[iw0]]]], fx1, fy1, fz1, fw0); - nxyz1 = grad(perm[ix1 + perm[iy1 + perm[iz1 + perm[iw1]]]], fx1, fy1, fz1, fw1); - nxy1 = LERP( q, nxyz0, nxyz1 ); - - nx1 = LERP ( r, nxy0, nxy1 ); - - n1 = LERP( t, nx0, nx1 ); - - return 0.87f * ( LERP( s, n0, n1 ) ); -} - -//--------------------------------------------------------------------- -/** 4D float Perlin periodic noise. - */ - -float Noise1234::pnoise( float x, float y, float z, float w, - int px, int py, int pz, int pw ) -{ - int ix0, iy0, iz0, iw0, ix1, iy1, iz1, iw1; - float fx0, fy0, fz0, fw0, fx1, fy1, fz1, fw1; - float s, t, r, q; - float nxyz0, nxyz1, nxy0, nxy1, nx0, nx1, n0, n1; - - ix0 = FASTFLOOR( x ); // Integer part of x - iy0 = FASTFLOOR( y ); // Integer part of y - iz0 = FASTFLOOR( z ); // Integer part of y - iw0 = FASTFLOOR( w ); // Integer part of w - fx0 = x - ix0; // Fractional part of x - fy0 = y - iy0; // Fractional part of y - fz0 = z - iz0; // Fractional part of z - fw0 = w - iw0; // Fractional part of w - fx1 = fx0 - 1.0f; - fy1 = fy0 - 1.0f; - fz1 = fz0 - 1.0f; - fw1 = fw0 - 1.0f; - ix1 = (( ix0 + 1 ) % px ) & 0xff; // Wrap to 0..px-1 and wrap to 0..255 - iy1 = (( iy0 + 1 ) % py ) & 0xff; // Wrap to 0..py-1 and wrap to 0..255 - iz1 = (( iz0 + 1 ) % pz ) & 0xff; // Wrap to 0..pz-1 and wrap to 0..255 - iw1 = (( iw0 + 1 ) % pw ) & 0xff; // Wrap to 0..pw-1 and wrap to 0..255 - ix0 = ( ix0 % px ) & 0xff; - iy0 = ( iy0 % py ) & 0xff; - iz0 = ( iz0 % pz ) & 0xff; - iw0 = ( iw0 % pw ) & 0xff; - - q = FADE( fw0 ); - r = FADE( fz0 ); - t = FADE( fy0 ); - s = FADE( fx0 ); - - nxyz0 = grad(perm[ix0 + perm[iy0 + perm[iz0 + perm[iw0]]]], fx0, fy0, fz0, fw0); - nxyz1 = grad(perm[ix0 + perm[iy0 + perm[iz0 + perm[iw1]]]], fx0, fy0, fz0, fw1); - nxy0 = LERP( q, nxyz0, nxyz1 ); - - nxyz0 = grad(perm[ix0 + perm[iy0 + perm[iz1 + perm[iw0]]]], fx0, fy0, fz1, fw0); - nxyz1 = grad(perm[ix0 + perm[iy0 + perm[iz1 + perm[iw1]]]], fx0, fy0, fz1, fw1); - nxy1 = LERP( q, nxyz0, nxyz1 ); - - nx0 = LERP ( r, nxy0, nxy1 ); - - nxyz0 = grad(perm[ix0 + perm[iy1 + perm[iz0 + perm[iw0]]]], fx0, fy1, fz0, fw0); - nxyz1 = grad(perm[ix0 + perm[iy1 + perm[iz0 + perm[iw1]]]], fx0, fy1, fz0, fw1); - nxy0 = LERP( q, nxyz0, nxyz1 ); - - nxyz0 = grad(perm[ix0 + perm[iy1 + perm[iz1 + perm[iw0]]]], fx0, fy1, fz1, fw0); - nxyz1 = grad(perm[ix0 + perm[iy1 + perm[iz1 + perm[iw1]]]], fx0, fy1, fz1, fw1); - nxy1 = LERP( q, nxyz0, nxyz1 ); - - nx1 = LERP ( r, nxy0, nxy1 ); - - n0 = LERP( t, nx0, nx1 ); - - nxyz0 = grad(perm[ix1 + perm[iy0 + perm[iz0 + perm[iw0]]]], fx1, fy0, fz0, fw0); - nxyz1 = grad(perm[ix1 + perm[iy0 + perm[iz0 + perm[iw1]]]], fx1, fy0, fz0, fw1); - nxy0 = LERP( q, nxyz0, nxyz1 ); - - nxyz0 = grad(perm[ix1 + perm[iy0 + perm[iz1 + perm[iw0]]]], fx1, fy0, fz1, fw0); - nxyz1 = grad(perm[ix1 + perm[iy0 + perm[iz1 + perm[iw1]]]], fx1, fy0, fz1, fw1); - nxy1 = LERP( q, nxyz0, nxyz1 ); - - nx0 = LERP ( r, nxy0, nxy1 ); - - nxyz0 = grad(perm[ix1 + perm[iy1 + perm[iz0 + perm[iw0]]]], fx1, fy1, fz0, fw0); - nxyz1 = grad(perm[ix1 + perm[iy1 + perm[iz0 + perm[iw1]]]], fx1, fy1, fz0, fw1); - nxy0 = LERP( q, nxyz0, nxyz1 ); - - nxyz0 = grad(perm[ix1 + perm[iy1 + perm[iz1 + perm[iw0]]]], fx1, fy1, fz1, fw0); - nxyz1 = grad(perm[ix1 + perm[iy1 + perm[iz1 + perm[iw1]]]], fx1, fy1, fz1, fw1); - nxy1 = LERP( q, nxyz0, nxyz1 ); - - nx1 = LERP ( r, nxy0, nxy1 ); - - n1 = LERP( t, nx0, nx1 ); - - return 0.87f * ( LERP( s, n0, n1 ) ); -} - -//--------------------------------------------------------------------- diff --git a/love/src/jni/love/src/libraries/noise1234/noise1234.h b/love/src/jni/love/src/libraries/noise1234/noise1234.h deleted file mode 100644 index 928572a5..00000000 --- a/love/src/jni/love/src/libraries/noise1234/noise1234.h +++ /dev/null @@ -1,57 +0,0 @@ -// Noise1234 -// Author: Stefan Gustavson (stegu@itn.liu.se) -// -// This library is public domain software, released by the author -// into the public domain in February 2011. You may do anything -// you like with it. You may even remove all attributions, -// but of course I'd appreciate it if you kept my name somewhere. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. - -/** \file - \brief Declares the Noise1234 class for producing Perlin noise. - \author Stefan Gustavson (stegu@itn.liu.se) -*/ - -/* - * This is a clean, fast, modern and free Perlin noise class in C++. - * Being a stand-alone class with no external dependencies, it is - * highly reusable without source code modifications. - * - * Note: - * Replacing the "float" type with "double" can actually make this run faster - * on some platforms. A templatized version of Noise1234 could be useful. - */ - -class Noise1234 { - - public: - Noise1234() {} - ~Noise1234() {} - -/** 1D, 2D, 3D and 4D float Perlin noise, SL "noise()" - */ - static float noise( float x ); - static float noise( float x, float y ); - static float noise( float x, float y, float z ); - static float noise( float x, float y, float z, float w ); - -/** 1D, 2D, 3D and 4D float Perlin periodic noise, SL "pnoise()" - */ - static float pnoise( float x, int px ); - static float pnoise( float x, float y, int px, int py ); - static float pnoise( float x, float y, float z, int px, int py, int pz ); - static float pnoise( float x, float y, float z, float w, - int px, int py, int pz, int pw ); - - private: - static unsigned char perm[]; - static float grad( int hash, float x ); - static float grad( int hash, float x, float y ); - static float grad( int hash, float x, float y , float z ); - static float grad( int hash, float x, float y, float z, float t ); - -}; diff --git a/love/src/jni/love/src/libraries/noise1234/simplexnoise1234.cpp b/love/src/jni/love/src/libraries/noise1234/simplexnoise1234.cpp deleted file mode 100644 index 2765f38e..00000000 --- a/love/src/jni/love/src/libraries/noise1234/simplexnoise1234.cpp +++ /dev/null @@ -1,210 +0,0 @@ -// SimplexNoise1234 -// Copyright © 2003-2011, Stefan Gustavson -// -// Contact: stegu@itn.liu.se -// -// This library is public domain software, released by the author -// into the public domain in February 2011. You may do anything -// you like with it. You may even remove all attributions, -// but of course I'd appreciate it if you kept my name somewhere. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. - -// Modified by the LOVE Development Team to remove 3D and 4D implementations due -// to patent issues. - -/** \file - \brief Implements the SimplexNoise1234 class for producing Perlin simplex noise. - \author Stefan Gustavson (stegu@itn.liu.se) -*/ - -/* - * This implementation is "Simplex Noise" as presented by - * Ken Perlin at a relatively obscure and not often cited course - * session "Real-Time Shading" at Siggraph 2001 (before real - * time shading actually took on), under the title "hardware noise". - * The 3D function is numerically equivalent to his Java reference - * code available in the PDF course notes, although I re-implemented - * it from scratch to get more readable code. The 1D, 2D and 4D cases - * were implemented from scratch by me from Ken Perlin's text. - * - * This is a highly reusable class. It has no dependencies - * on any other file, apart from its own header file. - */ - - -#include "simplexnoise1234.h" - -#define FASTFLOOR(x) ( ((x)>0) ? ((int)x) : (((int)x)-1) ) - -//--------------------------------------------------------------------- -// Static data - -/* - * Permutation table. This is just a random jumble of all numbers 0-255, - * repeated twice to avoid wrapping the index at 255 for each lookup. - * This needs to be exactly the same for all instances on all platforms, - * so it's easiest to just keep it as static explicit data. - * This also removes the need for any initialisation of this class. - * - * Note that making this an int[] instead of a char[] might make the - * code run faster on platforms with a high penalty for unaligned single - * byte addressing. Intel x86 is generally single-byte-friendly, but - * some other CPUs are faster with 4-aligned reads. - * However, a char[] is smaller, which avoids cache trashing, and that - * is probably the most important aspect on most architectures. - * This array is accessed a *lot* by the noise functions. - * A vector-valued noise over 3D accesses it 96 times, and a - * float-valued 4D noise 64 times. We want this to fit in the cache! - */ -unsigned char SimplexNoise1234::perm[512] = {151,160,137,91,90,15, - 131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23, - 190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33, - 88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166, - 77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244, - 102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196, - 135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123, - 5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42, - 223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9, - 129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228, - 251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107, - 49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254, - 138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180, - 151,160,137,91,90,15, - 131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23, - 190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33, - 88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166, - 77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244, - 102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196, - 135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123, - 5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42, - 223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9, - 129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228, - 251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107, - 49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254, - 138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180 -}; - -//--------------------------------------------------------------------- - -/* - * Helper functions to compute gradients-dot-residualvectors (1D to 4D) - * Note that these generate gradients of more than unit length. To make - * a close match with the value range of classic Perlin noise, the final - * noise values need to be rescaled to fit nicely within [-1,1]. - * (The simplex noise functions as such also have different scaling.) - * Note also that these noise functions are the most practical and useful - * signed version of Perlin noise. To return values according to the - * RenderMan specification from the SL noise() and pnoise() functions, - * the noise values need to be scaled and offset to [0,1], like this: - * float SLnoise = (SimplexNoise1234::noise(x,y,z) + 1.0) * 0.5; - */ - -float SimplexNoise1234::grad( int hash, float x ) { - int h = hash & 15; - float grad = 1.0f + (h & 7); // Gradient value 1.0, 2.0, ..., 8.0 - if (h&8) grad = -grad; // Set a random sign for the gradient - return ( grad * x ); // Multiply the gradient with the distance -} - -float SimplexNoise1234::grad( int hash, float x, float y ) { - int h = hash & 7; // Convert low 3 bits of hash code - float u = h<4 ? x : y; // into 8 simple gradient directions, - float v = h<4 ? y : x; // and compute the dot product with (x,y). - return ((h&1)? -u : u) + ((h&2)? -2.0f*v : 2.0f*v); -} - -// 1D simplex noise -float SimplexNoise1234::noise(float x) { - - int i0 = FASTFLOOR(x); - int i1 = i0 + 1; - float x0 = x - i0; - float x1 = x0 - 1.0f; - - float n0, n1; - - float t0 = 1.0f - x0*x0; -// if(t0 < 0.0f) t0 = 0.0f; - t0 *= t0; - n0 = t0 * t0 * grad(perm[i0 & 0xff], x0); - - float t1 = 1.0f - x1*x1; -// if(t1 < 0.0f) t1 = 0.0f; - t1 *= t1; - n1 = t1 * t1 * grad(perm[i1 & 0xff], x1); - // The maximum value of this noise is 8*(3/4)^4 = 2.53125 - // A factor of 0.395 will scale to fit exactly within [-1,1] - return 0.395f * (n0 + n1); - -} - -// 2D simplex noise -float SimplexNoise1234::noise(float x, float y) { - -#define F2 0.366025403 // F2 = 0.5*(sqrt(3.0)-1.0) -#define G2 0.211324865 // G2 = (3.0-Math.sqrt(3.0))/6.0 - - float n0, n1, n2; // Noise contributions from the three corners - - // Skew the input space to determine which simplex cell we're in - float s = (x+y)*F2; // Hairy factor for 2D - float xs = x + s; - float ys = y + s; - int i = FASTFLOOR(xs); - int j = FASTFLOOR(ys); - - float t = (float)(i+j)*G2; - float X0 = i-t; // Unskew the cell origin back to (x,y) space - float Y0 = j-t; - float x0 = x-X0; // The x,y distances from the cell origin - float y0 = y-Y0; - - // For the 2D case, the simplex shape is an equilateral triangle. - // Determine which simplex we are in. - int i1, j1; // Offsets for second (middle) corner of simplex in (i,j) coords - if(x0>y0) {i1=1; j1=0;} // lower triangle, XY order: (0,0)->(1,0)->(1,1) - else {i1=0; j1=1;} // upper triangle, YX order: (0,0)->(0,1)->(1,1) - - // A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and - // a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where - // c = (3-sqrt(3))/6 - - float x1 = x0 - i1 + G2; // Offsets for middle corner in (x,y) unskewed coords - float y1 = y0 - j1 + G2; - float x2 = x0 - 1.0f + 2.0f * G2; // Offsets for last corner in (x,y) unskewed coords - float y2 = y0 - 1.0f + 2.0f * G2; - - // Wrap the integer indices at 256, to avoid indexing perm[] out of bounds - int ii = i & 0xff; - int jj = j & 0xff; - - // Calculate the contribution from the three corners - float t0 = 0.5f - x0*x0-y0*y0; - if(t0 < 0.0f) n0 = 0.0f; - else { - t0 *= t0; - n0 = t0 * t0 * grad(perm[ii+perm[jj]], x0, y0); - } - - float t1 = 0.5f - x1*x1-y1*y1; - if(t1 < 0.0f) n1 = 0.0f; - else { - t1 *= t1; - n1 = t1 * t1 * grad(perm[ii+i1+perm[jj+j1]], x1, y1); - } - - float t2 = 0.5f - x2*x2-y2*y2; - if(t2 < 0.0f) n2 = 0.0f; - else { - t2 *= t2; - n2 = t2 * t2 * grad(perm[ii+1+perm[jj+1]], x2, y2); - } - - // Add contributions from each corner to get the final noise value. - // The result is scaled to return values in the interval [-1,1]. - return 45.23f * (n0 + n1 + n2); // TODO: The scale factor is preliminary! - } diff --git a/love/src/jni/love/src/libraries/noise1234/simplexnoise1234.h b/love/src/jni/love/src/libraries/noise1234/simplexnoise1234.h deleted file mode 100644 index 6aceb6b6..00000000 --- a/love/src/jni/love/src/libraries/noise1234/simplexnoise1234.h +++ /dev/null @@ -1,51 +0,0 @@ -// SimplexNoise1234 -// Copyright � 2003-2011, Stefan Gustavson -// -// Contact: stegu@itn.liu.se -// -// This library is public domain software, released by the author -// into the public domain in February 2011. You may do anything -// you like with it. You may even remove all attributions, -// but of course I'd appreciate it if you kept my name somewhere. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. - -// Modified by the LOVE Development Team to remove 3D and 4D implementations due -// to patent issues. - -/** \file - \brief Declares the SimplexNoise1234 class for producing Perlin simplex noise. - \author Stefan Gustavson (stegu@itn.liu.se) -*/ - -/* - * This is a clean, fast, modern and free Perlin Simplex noise class in C++. - * Being a stand-alone class with no external dependencies, it is - * highly reusable without source code modifications. - * - * - * Note: - * Replacing the "float" type with "double" can actually make this run faster - * on some platforms. A templatized version of SimplexNoise1234 could be useful. - */ - -class SimplexNoise1234 { - - public: - SimplexNoise1234() {} - ~SimplexNoise1234() {} - -/** 1D and 2D float Perlin noise - */ - static float noise( float x ); - static float noise( float x, float y ); - - private: - static unsigned char perm[]; - static float grad( int hash, float x ); - static float grad( int hash, float x, float y ); - -}; diff --git a/love/src/jni/love/src/libraries/physfs/physfs.c b/love/src/jni/love/src/libraries/physfs/physfs.c deleted file mode 100644 index 19148ad5..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs.c +++ /dev/null @@ -1,3302 +0,0 @@ -/** - * PhysicsFS; a portable, flexible file i/o abstraction. - * - * Documentation is in physfs.h. It's verbose, honest. :) - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file written by Ryan C. Gordon. - */ - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_internal.h" - -#if defined(_MSC_VER) -#include - -/* this code came from https://stackoverflow.com/a/8712996 */ -int __PHYSFS_msvc_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap) -{ - int count = -1; - - if (size != 0) - count = _vsnprintf_s(outBuf, size, _TRUNCATE, format, ap); - if (count == -1) - count = _vscprintf(format, ap); - - return count; -} - -int __PHYSFS_msvc_snprintf(char *outBuf, size_t size, const char *format, ...) -{ - int count; - va_list ap; - - va_start(ap, format); - count = __PHYSFS_msvc_vsnprintf(outBuf, size, format, ap); - va_end(ap); - - return count; -} -#endif - - -typedef struct __PHYSFS_DIRHANDLE__ -{ - void *opaque; /* Instance data unique to the archiver. */ - char *dirName; /* Path to archive in platform-dependent notation. */ - char *mountPoint; /* Mountpoint in virtual file tree. */ - const PHYSFS_Archiver *funcs; /* Ptr to archiver info for this handle. */ - struct __PHYSFS_DIRHANDLE__ *next; /* linked list stuff. */ -} DirHandle; - - -typedef struct __PHYSFS_FILEHANDLE__ -{ - PHYSFS_Io *io; /* Instance data unique to the archiver for this file. */ - PHYSFS_uint8 forReading; /* Non-zero if reading, zero if write/append */ - const DirHandle *dirHandle; /* Archiver instance that created this */ - PHYSFS_uint8 *buffer; /* Buffer, if set (NULL otherwise). Don't touch! */ - size_t bufsize; /* Bufsize, if set (0 otherwise). Don't touch! */ - size_t buffill; /* Buffer fill size. Don't touch! */ - size_t bufpos; /* Buffer position. Don't touch! */ - struct __PHYSFS_FILEHANDLE__ *next; /* linked list stuff. */ -} FileHandle; - - -typedef struct __PHYSFS_ERRSTATETYPE__ -{ - void *tid; - PHYSFS_ErrorCode code; - struct __PHYSFS_ERRSTATETYPE__ *next; -} ErrState; - - -/* General PhysicsFS state ... */ -static int initialized = 0; -static ErrState *errorStates = NULL; -static DirHandle *searchPath = NULL; -static DirHandle *writeDir = NULL; -static FileHandle *openWriteList = NULL; -static FileHandle *openReadList = NULL; -static char *baseDir = NULL; -static char *userDir = NULL; -static char *prefDir = NULL; -static int allowSymLinks = 0; -static PHYSFS_Archiver **archivers = NULL; -static PHYSFS_ArchiveInfo **archiveInfo = NULL; -static volatile size_t numArchivers = 0; - -/* mutexes ... */ -static void *errorLock = NULL; /* protects error message list. */ -static void *stateLock = NULL; /* protects other PhysFS static state. */ - -/* allocator ... */ -static int externalAllocator = 0; -PHYSFS_Allocator allocator; - - -#ifdef PHYSFS_NEED_ATOMIC_OP_FALLBACK -static inline int __PHYSFS_atomicAdd(int *ptrval, const int val) -{ - int retval; - __PHYSFS_platformGrabMutex(stateLock); - retval = *ptrval; - *ptrval = retval + val; - __PHYSFS_platformReleaseMutex(stateLock); - return retval; -} /* __PHYSFS_atomicAdd */ - -int __PHYSFS_ATOMIC_INCR(int *ptrval) -{ - return __PHYSFS_atomicAdd(ptrval, 1); -} /* __PHYSFS_ATOMIC_INCR */ - -int __PHYSFS_ATOMIC_DECR(int *ptrval) -{ - return __PHYSFS_atomicAdd(ptrval, -1); -} /* __PHYSFS_ATOMIC_DECR */ -#endif - - - -/* PHYSFS_Io implementation for i/o to physical filesystem... */ - -/* !!! FIXME: maybe refcount the paths in a string pool? */ -typedef struct __PHYSFS_NativeIoInfo -{ - void *handle; - const char *path; - int mode; /* 'r', 'w', or 'a' */ -} NativeIoInfo; - -static PHYSFS_sint64 nativeIo_read(PHYSFS_Io *io, void *buf, PHYSFS_uint64 len) -{ - NativeIoInfo *info = (NativeIoInfo *) io->opaque; - return __PHYSFS_platformRead(info->handle, buf, len); -} /* nativeIo_read */ - -static PHYSFS_sint64 nativeIo_write(PHYSFS_Io *io, const void *buffer, - PHYSFS_uint64 len) -{ - NativeIoInfo *info = (NativeIoInfo *) io->opaque; - return __PHYSFS_platformWrite(info->handle, buffer, len); -} /* nativeIo_write */ - -static int nativeIo_seek(PHYSFS_Io *io, PHYSFS_uint64 offset) -{ - NativeIoInfo *info = (NativeIoInfo *) io->opaque; - return __PHYSFS_platformSeek(info->handle, offset); -} /* nativeIo_seek */ - -static PHYSFS_sint64 nativeIo_tell(PHYSFS_Io *io) -{ - NativeIoInfo *info = (NativeIoInfo *) io->opaque; - return __PHYSFS_platformTell(info->handle); -} /* nativeIo_tell */ - -static PHYSFS_sint64 nativeIo_length(PHYSFS_Io *io) -{ - NativeIoInfo *info = (NativeIoInfo *) io->opaque; - return __PHYSFS_platformFileLength(info->handle); -} /* nativeIo_length */ - -static PHYSFS_Io *nativeIo_duplicate(PHYSFS_Io *io) -{ - NativeIoInfo *info = (NativeIoInfo *) io->opaque; - return __PHYSFS_createNativeIo(info->path, info->mode); -} /* nativeIo_duplicate */ - -static int nativeIo_flush(PHYSFS_Io *io) -{ - NativeIoInfo *info = (NativeIoInfo *) io->opaque; - return __PHYSFS_platformFlush(info->handle); -} /* nativeIo_flush */ - -static void nativeIo_destroy(PHYSFS_Io *io) -{ - NativeIoInfo *info = (NativeIoInfo *) io->opaque; - __PHYSFS_platformClose(info->handle); - allocator.Free((void *) info->path); - allocator.Free(info); - allocator.Free(io); -} /* nativeIo_destroy */ - -static const PHYSFS_Io __PHYSFS_nativeIoInterface = -{ - CURRENT_PHYSFS_IO_API_VERSION, NULL, - nativeIo_read, - nativeIo_write, - nativeIo_seek, - nativeIo_tell, - nativeIo_length, - nativeIo_duplicate, - nativeIo_flush, - nativeIo_destroy -}; - -PHYSFS_Io *__PHYSFS_createNativeIo(const char *path, const int mode) -{ - PHYSFS_Io *io = NULL; - NativeIoInfo *info = NULL; - void *handle = NULL; - char *pathdup = NULL; - - assert((mode == 'r') || (mode == 'w') || (mode == 'a')); - - io = (PHYSFS_Io *) allocator.Malloc(sizeof (PHYSFS_Io)); - GOTO_IF(!io, PHYSFS_ERR_OUT_OF_MEMORY, createNativeIo_failed); - info = (NativeIoInfo *) allocator.Malloc(sizeof (NativeIoInfo)); - GOTO_IF(!info, PHYSFS_ERR_OUT_OF_MEMORY, createNativeIo_failed); - pathdup = (char *) allocator.Malloc(strlen(path) + 1); - GOTO_IF(!pathdup, PHYSFS_ERR_OUT_OF_MEMORY, createNativeIo_failed); - - if (mode == 'r') - handle = __PHYSFS_platformOpenRead(path); - else if (mode == 'w') - handle = __PHYSFS_platformOpenWrite(path); - else if (mode == 'a') - handle = __PHYSFS_platformOpenAppend(path); - - GOTO_IF_ERRPASS(!handle, createNativeIo_failed); - - strcpy(pathdup, path); - info->handle = handle; - info->path = pathdup; - info->mode = mode; - memcpy(io, &__PHYSFS_nativeIoInterface, sizeof (*io)); - io->opaque = info; - return io; - -createNativeIo_failed: - if (handle != NULL) __PHYSFS_platformClose(handle); - if (pathdup != NULL) allocator.Free(pathdup); - if (info != NULL) allocator.Free(info); - if (io != NULL) allocator.Free(io); - return NULL; -} /* __PHYSFS_createNativeIo */ - - -/* PHYSFS_Io implementation for i/o to a memory buffer... */ - -typedef struct __PHYSFS_MemoryIoInfo -{ - const PHYSFS_uint8 *buf; - PHYSFS_uint64 len; - PHYSFS_uint64 pos; - PHYSFS_Io *parent; - int refcount; - void (*destruct)(void *); -} MemoryIoInfo; - -static PHYSFS_sint64 memoryIo_read(PHYSFS_Io *io, void *buf, PHYSFS_uint64 len) -{ - MemoryIoInfo *info = (MemoryIoInfo *) io->opaque; - const PHYSFS_uint64 avail = info->len - info->pos; - assert(avail <= info->len); - - if (avail == 0) - return 0; /* we're at EOF; nothing to do. */ - - if (len > avail) - len = avail; - - memcpy(buf, info->buf + info->pos, (size_t) len); - info->pos += len; - return len; -} /* memoryIo_read */ - -static PHYSFS_sint64 memoryIo_write(PHYSFS_Io *io, const void *buffer, - PHYSFS_uint64 len) -{ - BAIL(PHYSFS_ERR_OPEN_FOR_READING, -1); -} /* memoryIo_write */ - -static int memoryIo_seek(PHYSFS_Io *io, PHYSFS_uint64 offset) -{ - MemoryIoInfo *info = (MemoryIoInfo *) io->opaque; - BAIL_IF(offset > info->len, PHYSFS_ERR_PAST_EOF, 0); - info->pos = offset; - return 1; -} /* memoryIo_seek */ - -static PHYSFS_sint64 memoryIo_tell(PHYSFS_Io *io) -{ - const MemoryIoInfo *info = (MemoryIoInfo *) io->opaque; - return (PHYSFS_sint64) info->pos; -} /* memoryIo_tell */ - -static PHYSFS_sint64 memoryIo_length(PHYSFS_Io *io) -{ - const MemoryIoInfo *info = (MemoryIoInfo *) io->opaque; - return (PHYSFS_sint64) info->len; -} /* memoryIo_length */ - -static PHYSFS_Io *memoryIo_duplicate(PHYSFS_Io *io) -{ - MemoryIoInfo *info = (MemoryIoInfo *) io->opaque; - MemoryIoInfo *newinfo = NULL; - PHYSFS_Io *parent = info->parent; - PHYSFS_Io *retval = NULL; - - /* avoid deep copies. */ - assert((!parent) || (!((MemoryIoInfo *) parent->opaque)->parent) ); - - /* share the buffer between duplicates. */ - if (parent != NULL) /* dup the parent, increment its refcount. */ - return parent->duplicate(parent); - - /* we're the parent. */ - - retval = (PHYSFS_Io *) allocator.Malloc(sizeof (PHYSFS_Io)); - BAIL_IF(!retval, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - newinfo = (MemoryIoInfo *) allocator.Malloc(sizeof (MemoryIoInfo)); - if (!newinfo) - { - allocator.Free(retval); - BAIL(PHYSFS_ERR_OUT_OF_MEMORY, NULL); - } /* if */ - - __PHYSFS_ATOMIC_INCR(&info->refcount); - - memset(newinfo, '\0', sizeof (*info)); - newinfo->buf = info->buf; - newinfo->len = info->len; - newinfo->pos = 0; - newinfo->parent = io; - newinfo->refcount = 0; - newinfo->destruct = NULL; - - memcpy(retval, io, sizeof (*retval)); - retval->opaque = newinfo; - return retval; -} /* memoryIo_duplicate */ - -static int memoryIo_flush(PHYSFS_Io *io) { return 1; /* it's read-only. */ } - -static void memoryIo_destroy(PHYSFS_Io *io) -{ - MemoryIoInfo *info = (MemoryIoInfo *) io->opaque; - PHYSFS_Io *parent = info->parent; - - if (parent != NULL) - { - assert(info->buf == ((MemoryIoInfo *) info->parent->opaque)->buf); - assert(info->len == ((MemoryIoInfo *) info->parent->opaque)->len); - assert(info->refcount == 0); - assert(info->destruct == NULL); - allocator.Free(info); - allocator.Free(io); - parent->destroy(parent); /* decrements refcount. */ - return; - } /* if */ - - /* we _are_ the parent. */ - assert(info->refcount > 0); /* even in a race, we hold a reference. */ - - if (__PHYSFS_ATOMIC_DECR(&info->refcount) == 0) - { - void (*destruct)(void *) = info->destruct; - void *buf = (void *) info->buf; - io->opaque = NULL; /* kill this here in case of race. */ - allocator.Free(info); - allocator.Free(io); - if (destruct != NULL) - destruct(buf); - } /* if */ -} /* memoryIo_destroy */ - - -static const PHYSFS_Io __PHYSFS_memoryIoInterface = -{ - CURRENT_PHYSFS_IO_API_VERSION, NULL, - memoryIo_read, - memoryIo_write, - memoryIo_seek, - memoryIo_tell, - memoryIo_length, - memoryIo_duplicate, - memoryIo_flush, - memoryIo_destroy -}; - -PHYSFS_Io *__PHYSFS_createMemoryIo(const void *buf, PHYSFS_uint64 len, - void (*destruct)(void *)) -{ - PHYSFS_Io *io = NULL; - MemoryIoInfo *info = NULL; - - io = (PHYSFS_Io *) allocator.Malloc(sizeof (PHYSFS_Io)); - GOTO_IF(!io, PHYSFS_ERR_OUT_OF_MEMORY, createMemoryIo_failed); - info = (MemoryIoInfo *) allocator.Malloc(sizeof (MemoryIoInfo)); - GOTO_IF(!info, PHYSFS_ERR_OUT_OF_MEMORY, createMemoryIo_failed); - - memset(info, '\0', sizeof (*info)); - info->buf = (const PHYSFS_uint8 *) buf; - info->len = len; - info->pos = 0; - info->parent = NULL; - info->refcount = 1; - info->destruct = destruct; - - memcpy(io, &__PHYSFS_memoryIoInterface, sizeof (*io)); - io->opaque = info; - return io; - -createMemoryIo_failed: - if (info != NULL) allocator.Free(info); - if (io != NULL) allocator.Free(io); - return NULL; -} /* __PHYSFS_createMemoryIo */ - - -/* PHYSFS_Io implementation for i/o to a PHYSFS_File... */ - -static PHYSFS_sint64 handleIo_read(PHYSFS_Io *io, void *buf, PHYSFS_uint64 len) -{ - return PHYSFS_readBytes((PHYSFS_File *) io->opaque, buf, len); -} /* handleIo_read */ - -static PHYSFS_sint64 handleIo_write(PHYSFS_Io *io, const void *buffer, - PHYSFS_uint64 len) -{ - return PHYSFS_writeBytes((PHYSFS_File *) io->opaque, buffer, len); -} /* handleIo_write */ - -static int handleIo_seek(PHYSFS_Io *io, PHYSFS_uint64 offset) -{ - return PHYSFS_seek((PHYSFS_File *) io->opaque, offset); -} /* handleIo_seek */ - -static PHYSFS_sint64 handleIo_tell(PHYSFS_Io *io) -{ - return PHYSFS_tell((PHYSFS_File *) io->opaque); -} /* handleIo_tell */ - -static PHYSFS_sint64 handleIo_length(PHYSFS_Io *io) -{ - return PHYSFS_fileLength((PHYSFS_File *) io->opaque); -} /* handleIo_length */ - -static PHYSFS_Io *handleIo_duplicate(PHYSFS_Io *io) -{ - /* - * There's no duplicate at the PHYSFS_File level, so we break the - * abstraction. We're allowed to: we're physfs.c! - */ - FileHandle *origfh = (FileHandle *) io->opaque; - FileHandle *newfh = (FileHandle *) allocator.Malloc(sizeof (FileHandle)); - PHYSFS_Io *retval = NULL; - - GOTO_IF(!newfh, PHYSFS_ERR_OUT_OF_MEMORY, handleIo_dupe_failed); - memset(newfh, '\0', sizeof (*newfh)); - - retval = (PHYSFS_Io *) allocator.Malloc(sizeof (PHYSFS_Io)); - GOTO_IF(!retval, PHYSFS_ERR_OUT_OF_MEMORY, handleIo_dupe_failed); - -#if 0 /* we don't buffer the duplicate, at least not at the moment. */ - if (origfh->buffer != NULL) - { - newfh->buffer = (PHYSFS_uint8 *) allocator.Malloc(origfh->bufsize); - if (!newfh->buffer) - GOTO(PHYSFS_ERR_OUT_OF_MEMORY, handleIo_dupe_failed); - newfh->bufsize = origfh->bufsize; - } /* if */ -#endif - - newfh->io = origfh->io->duplicate(origfh->io); - GOTO_IF_ERRPASS(!newfh->io, handleIo_dupe_failed); - - newfh->forReading = origfh->forReading; - newfh->dirHandle = origfh->dirHandle; - - __PHYSFS_platformGrabMutex(stateLock); - if (newfh->forReading) - { - newfh->next = openReadList; - openReadList = newfh; - } /* if */ - else - { - newfh->next = openWriteList; - openWriteList = newfh; - } /* else */ - __PHYSFS_platformReleaseMutex(stateLock); - - memcpy(retval, io, sizeof (PHYSFS_Io)); - retval->opaque = newfh; - return retval; - -handleIo_dupe_failed: - if (newfh) - { - if (newfh->io != NULL) newfh->io->destroy(newfh->io); - if (newfh->buffer != NULL) allocator.Free(newfh->buffer); - allocator.Free(newfh); - } /* if */ - - return NULL; -} /* handleIo_duplicate */ - -static int handleIo_flush(PHYSFS_Io *io) -{ - return PHYSFS_flush((PHYSFS_File *) io->opaque); -} /* handleIo_flush */ - -static void handleIo_destroy(PHYSFS_Io *io) -{ - if (io->opaque != NULL) - PHYSFS_close((PHYSFS_File *) io->opaque); - allocator.Free(io); -} /* handleIo_destroy */ - -static const PHYSFS_Io __PHYSFS_handleIoInterface = -{ - CURRENT_PHYSFS_IO_API_VERSION, NULL, - handleIo_read, - handleIo_write, - handleIo_seek, - handleIo_tell, - handleIo_length, - handleIo_duplicate, - handleIo_flush, - handleIo_destroy -}; - -static PHYSFS_Io *__PHYSFS_createHandleIo(PHYSFS_File *f) -{ - PHYSFS_Io *io = (PHYSFS_Io *) allocator.Malloc(sizeof (PHYSFS_Io)); - BAIL_IF(!io, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - memcpy(io, &__PHYSFS_handleIoInterface, sizeof (*io)); - io->opaque = f; - return io; -} /* __PHYSFS_createHandleIo */ - - -/* functions ... */ - -typedef struct -{ - char **list; - PHYSFS_uint32 size; - PHYSFS_ErrorCode errcode; -} EnumStringListCallbackData; - -static void enumStringListCallback(void *data, const char *str) -{ - void *ptr; - char *newstr; - EnumStringListCallbackData *pecd = (EnumStringListCallbackData *) data; - - if (pecd->errcode) - return; - - ptr = allocator.Realloc(pecd->list, (pecd->size + 2) * sizeof (char *)); - newstr = (char *) allocator.Malloc(strlen(str) + 1); - if (ptr != NULL) - pecd->list = (char **) ptr; - - if ((ptr == NULL) || (newstr == NULL)) - { - pecd->errcode = PHYSFS_ERR_OUT_OF_MEMORY; - pecd->list[pecd->size] = NULL; - PHYSFS_freeList(pecd->list); - return; - } /* if */ - - strcpy(newstr, str); - pecd->list[pecd->size] = newstr; - pecd->size++; -} /* enumStringListCallback */ - - -static char **doEnumStringList(void (*func)(PHYSFS_StringCallback, void *)) -{ - EnumStringListCallbackData ecd; - memset(&ecd, '\0', sizeof (ecd)); - ecd.list = (char **) allocator.Malloc(sizeof (char *)); - BAIL_IF(!ecd.list, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - func(enumStringListCallback, &ecd); - - if (ecd.errcode) - { - PHYSFS_setErrorCode(ecd.errcode); - return NULL; - } /* if */ - - ecd.list[ecd.size] = NULL; - return ecd.list; -} /* doEnumStringList */ - - -static void __PHYSFS_bubble_sort(void *a, size_t lo, size_t hi, - int (*cmpfn)(void *, size_t, size_t), - void (*swapfn)(void *, size_t, size_t)) -{ - size_t i; - int sorted; - - do - { - sorted = 1; - for (i = lo; i < hi; i++) - { - if (cmpfn(a, i, i + 1) > 0) - { - swapfn(a, i, i + 1); - sorted = 0; - } /* if */ - } /* for */ - } while (!sorted); -} /* __PHYSFS_bubble_sort */ - - -static void __PHYSFS_quick_sort(void *a, size_t lo, size_t hi, - int (*cmpfn)(void *, size_t, size_t), - void (*swapfn)(void *, size_t, size_t)) -{ - size_t i; - size_t j; - size_t v; - - if ((hi - lo) <= PHYSFS_QUICKSORT_THRESHOLD) - __PHYSFS_bubble_sort(a, lo, hi, cmpfn, swapfn); - else - { - i = (hi + lo) / 2; - - if (cmpfn(a, lo, i) > 0) swapfn(a, lo, i); - if (cmpfn(a, lo, hi) > 0) swapfn(a, lo, hi); - if (cmpfn(a, i, hi) > 0) swapfn(a, i, hi); - - j = hi - 1; - swapfn(a, i, j); - i = lo; - v = j; - while (1) - { - while(cmpfn(a, ++i, v) < 0) { /* do nothing */ } - while(cmpfn(a, --j, v) > 0) { /* do nothing */ } - if (j < i) - break; - swapfn(a, i, j); - } /* while */ - if (i != (hi-1)) - swapfn(a, i, hi-1); - __PHYSFS_quick_sort(a, lo, j, cmpfn, swapfn); - __PHYSFS_quick_sort(a, i+1, hi, cmpfn, swapfn); - } /* else */ -} /* __PHYSFS_quick_sort */ - - -void __PHYSFS_sort(void *entries, size_t max, - int (*cmpfn)(void *, size_t, size_t), - void (*swapfn)(void *, size_t, size_t)) -{ - /* - * Quicksort w/ Bubblesort fallback algorithm inspired by code from here: - * https://www.cs.ubc.ca/spider/harrison/Java/sorting-demo.html - */ - if (max > 0) - __PHYSFS_quick_sort(entries, 0, max - 1, cmpfn, swapfn); -} /* __PHYSFS_sort */ - - -static ErrState *findErrorForCurrentThread(void) -{ - ErrState *i; - void *tid; - - if (errorLock != NULL) - __PHYSFS_platformGrabMutex(errorLock); - - if (errorStates != NULL) - { - tid = __PHYSFS_platformGetThreadID(); - - for (i = errorStates; i != NULL; i = i->next) - { - if (i->tid == tid) - { - if (errorLock != NULL) - __PHYSFS_platformReleaseMutex(errorLock); - return i; - } /* if */ - } /* for */ - } /* if */ - - if (errorLock != NULL) - __PHYSFS_platformReleaseMutex(errorLock); - - return NULL; /* no error available. */ -} /* findErrorForCurrentThread */ - - -/* this doesn't reset the error state. */ -static inline PHYSFS_ErrorCode currentErrorCode(void) -{ - const ErrState *err = findErrorForCurrentThread(); - return err ? err->code : PHYSFS_ERR_OK; -} /* currentErrorCode */ - - -PHYSFS_ErrorCode PHYSFS_getLastErrorCode(void) -{ - ErrState *err = findErrorForCurrentThread(); - const PHYSFS_ErrorCode retval = (err) ? err->code : PHYSFS_ERR_OK; - if (err) - err->code = PHYSFS_ERR_OK; - return retval; -} /* PHYSFS_getLastErrorCode */ - - -PHYSFS_DECL const char *PHYSFS_getErrorByCode(PHYSFS_ErrorCode code) -{ - switch (code) - { - case PHYSFS_ERR_OK: return "no error"; - case PHYSFS_ERR_OTHER_ERROR: return "unknown error"; - case PHYSFS_ERR_OUT_OF_MEMORY: return "out of memory"; - case PHYSFS_ERR_NOT_INITIALIZED: return "not initialized"; - case PHYSFS_ERR_IS_INITIALIZED: return "already initialized"; - case PHYSFS_ERR_ARGV0_IS_NULL: return "argv[0] is NULL"; - case PHYSFS_ERR_UNSUPPORTED: return "unsupported"; - case PHYSFS_ERR_PAST_EOF: return "past end of file"; - case PHYSFS_ERR_FILES_STILL_OPEN: return "files still open"; - case PHYSFS_ERR_INVALID_ARGUMENT: return "invalid argument"; - case PHYSFS_ERR_NOT_MOUNTED: return "not mounted"; - case PHYSFS_ERR_NOT_FOUND: return "not found"; - case PHYSFS_ERR_SYMLINK_FORBIDDEN: return "symlinks are forbidden"; - case PHYSFS_ERR_NO_WRITE_DIR: return "write directory is not set"; - case PHYSFS_ERR_OPEN_FOR_READING: return "file open for reading"; - case PHYSFS_ERR_OPEN_FOR_WRITING: return "file open for writing"; - case PHYSFS_ERR_NOT_A_FILE: return "not a file"; - case PHYSFS_ERR_READ_ONLY: return "read-only filesystem"; - case PHYSFS_ERR_CORRUPT: return "corrupted"; - case PHYSFS_ERR_SYMLINK_LOOP: return "infinite symbolic link loop"; - case PHYSFS_ERR_IO: return "i/o error"; - case PHYSFS_ERR_PERMISSION: return "permission denied"; - case PHYSFS_ERR_NO_SPACE: return "no space available for writing"; - case PHYSFS_ERR_BAD_FILENAME: return "filename is illegal or insecure"; - case PHYSFS_ERR_BUSY: return "tried to modify a file the OS needs"; - case PHYSFS_ERR_DIR_NOT_EMPTY: return "directory isn't empty"; - case PHYSFS_ERR_OS_ERROR: return "OS reported an error"; - case PHYSFS_ERR_DUPLICATE: return "duplicate resource"; - case PHYSFS_ERR_BAD_PASSWORD: return "bad password"; - case PHYSFS_ERR_APP_CALLBACK: return "app callback reported error"; - } /* switch */ - - return NULL; /* don't know this error code. */ -} /* PHYSFS_getErrorByCode */ - - -void PHYSFS_setErrorCode(PHYSFS_ErrorCode errcode) -{ - ErrState *err; - - if (!errcode) - return; - - err = findErrorForCurrentThread(); - if (err == NULL) - { - err = (ErrState *) allocator.Malloc(sizeof (ErrState)); - if (err == NULL) - return; /* uhh...? */ - - memset(err, '\0', sizeof (ErrState)); - err->tid = __PHYSFS_platformGetThreadID(); - - if (errorLock != NULL) - __PHYSFS_platformGrabMutex(errorLock); - - err->next = errorStates; - errorStates = err; - - if (errorLock != NULL) - __PHYSFS_platformReleaseMutex(errorLock); - } /* if */ - - err->code = errcode; -} /* PHYSFS_setErrorCode */ - - -const char *PHYSFS_getLastError(void) -{ - const PHYSFS_ErrorCode err = PHYSFS_getLastErrorCode(); - return (err) ? PHYSFS_getErrorByCode(err) : NULL; -} /* PHYSFS_getLastError */ - - -/* MAKE SURE that errorLock is held before calling this! */ -static void freeErrorStates(void) -{ - ErrState *i; - ErrState *next; - - for (i = errorStates; i != NULL; i = next) - { - next = i->next; - allocator.Free(i); - } /* for */ - - errorStates = NULL; -} /* freeErrorStates */ - - -void PHYSFS_getLinkedVersion(PHYSFS_Version *ver) -{ - if (ver != NULL) - { - ver->major = PHYSFS_VER_MAJOR; - ver->minor = PHYSFS_VER_MINOR; - ver->patch = PHYSFS_VER_PATCH; - } /* if */ -} /* PHYSFS_getLinkedVersion */ - - -static const char *find_filename_extension(const char *fname) -{ - const char *retval = NULL; - if (fname != NULL) - { - const char *p = strchr(fname, '.'); - retval = p; - - while (p != NULL) - { - p = strchr(p + 1, '.'); - if (p != NULL) - retval = p; - } /* while */ - - if (retval != NULL) - retval++; /* skip '.' */ - } /* if */ - - return retval; -} /* find_filename_extension */ - - -static DirHandle *tryOpenDir(PHYSFS_Io *io, const PHYSFS_Archiver *funcs, - const char *d, int forWriting, int *_claimed) -{ - DirHandle *retval = NULL; - void *opaque = NULL; - - if (io != NULL) - BAIL_IF_ERRPASS(!io->seek(io, 0), NULL); - - opaque = funcs->openArchive(io, d, forWriting, _claimed); - if (opaque != NULL) - { - retval = (DirHandle *) allocator.Malloc(sizeof (DirHandle)); - if (retval == NULL) - funcs->closeArchive(opaque); - else - { - memset(retval, '\0', sizeof (DirHandle)); - retval->mountPoint = NULL; - retval->funcs = funcs; - retval->opaque = opaque; - } /* else */ - } /* if */ - - return retval; -} /* tryOpenDir */ - - -static DirHandle *openDirectory(PHYSFS_Io *io, const char *d, int forWriting) -{ - DirHandle *retval = NULL; - PHYSFS_Archiver **i; - const char *ext; - int created_io = 0; - int claimed = 0; - PHYSFS_ErrorCode errcode; - - assert((io != NULL) || (d != NULL)); - - if (io == NULL) - { - /* DIR gets first shot (unlike the rest, it doesn't deal with files). */ - retval = tryOpenDir(io, &__PHYSFS_Archiver_DIR, d, forWriting, &claimed); - if (retval || claimed) - return retval; - - io = __PHYSFS_createNativeIo(d, forWriting ? 'w' : 'r'); - BAIL_IF_ERRPASS(!io, 0); - created_io = 1; - } /* if */ - - ext = find_filename_extension(d); - if (ext != NULL) - { - /* Look for archivers with matching file extensions first... */ - for (i = archivers; (*i != NULL) && (retval == NULL) && !claimed; i++) - { - if (PHYSFS_utf8stricmp(ext, (*i)->info.extension) == 0) - retval = tryOpenDir(io, *i, d, forWriting, &claimed); - } /* for */ - - /* failing an exact file extension match, try all the others... */ - for (i = archivers; (*i != NULL) && (retval == NULL) && !claimed; i++) - { - if (PHYSFS_utf8stricmp(ext, (*i)->info.extension) != 0) - retval = tryOpenDir(io, *i, d, forWriting, &claimed); - } /* for */ - } /* if */ - - else /* no extension? Try them all. */ - { - for (i = archivers; (*i != NULL) && (retval == NULL) && !claimed; i++) - retval = tryOpenDir(io, *i, d, forWriting, &claimed); - } /* else */ - - errcode = currentErrorCode(); - - if ((!retval) && (created_io)) - io->destroy(io); - - BAIL_IF(!retval, claimed ? errcode : PHYSFS_ERR_UNSUPPORTED, NULL); - return retval; -} /* openDirectory */ - - -/* - * Make a platform-independent path string sane. Doesn't actually check the - * file hierarchy, it just cleans up the string. - * (dst) must be a buffer at least as big as (src), as this is where the - * cleaned up string is deposited. - * If there are illegal bits in the path (".." entries, etc) then we - * return zero and (dst) is undefined. Non-zero if the path was sanitized. - */ -static int sanitizePlatformIndependentPath(const char *src, char *dst) -{ - char *prev; - char ch; - - while (*src == '/') /* skip initial '/' chars... */ - src++; - - /* Make sure the entire string isn't "." or ".." */ - if ((strcmp(src, ".") == 0) || (strcmp(src, "..") == 0)) - BAIL(PHYSFS_ERR_BAD_FILENAME, 0); - - prev = dst; - do - { - ch = *(src++); - - if ((ch == ':') || (ch == '\\')) /* illegal chars in a physfs path. */ - BAIL(PHYSFS_ERR_BAD_FILENAME, 0); - - if (ch == '/') /* path separator. */ - { - *dst = '\0'; /* "." and ".." are illegal pathnames. */ - if ((strcmp(prev, ".") == 0) || (strcmp(prev, "..") == 0)) - BAIL(PHYSFS_ERR_BAD_FILENAME, 0); - - while (*src == '/') /* chop out doubles... */ - src++; - - if (*src == '\0') /* ends with a pathsep? */ - break; /* we're done, don't add final pathsep to dst. */ - - prev = dst + 1; - } /* if */ - - *(dst++) = ch; - } while (ch != '\0'); - - return 1; -} /* sanitizePlatformIndependentPath */ - - -/* - * Figure out if (fname) is part of (h)'s mountpoint. (fname) must be an - * output from sanitizePlatformIndependentPath(), so that it is in a known - * state. - * - * This only finds legitimate segments of a mountpoint. If the mountpoint is - * "/a/b/c" and (fname) is "/a/b/c", "/", or "/a/b/c/d", then the results are - * all zero. "/a/b" will succeed, though. - */ -static int partOfMountPoint(DirHandle *h, char *fname) -{ - int rc; - size_t len, mntpntlen; - - if (h->mountPoint == NULL) - return 0; - else if (*fname == '\0') - return 1; - - len = strlen(fname); - mntpntlen = strlen(h->mountPoint); - if (len > mntpntlen) /* can't be a subset of mountpoint. */ - return 0; - - /* if true, must be not a match or a complete match, but not a subset. */ - if ((len + 1) == mntpntlen) - return 0; - - rc = strncmp(fname, h->mountPoint, len); /* !!! FIXME: case insensitive? */ - if (rc != 0) - return 0; /* not a match. */ - - /* make sure /a/b matches /a/b/ and not /a/bc ... */ - return h->mountPoint[len] == '/'; -} /* partOfMountPoint */ - - -static DirHandle *createDirHandle(PHYSFS_Io *io, const char *newDir, - const char *mountPoint, int forWriting) -{ - DirHandle *dirHandle = NULL; - char *tmpmntpnt = NULL; - - assert(newDir != NULL); /* should have caught this higher up. */ - - if (mountPoint != NULL) - { - const size_t len = strlen(mountPoint) + 1; - tmpmntpnt = (char *) __PHYSFS_smallAlloc(len); - GOTO_IF(!tmpmntpnt, PHYSFS_ERR_OUT_OF_MEMORY, badDirHandle); - if (!sanitizePlatformIndependentPath(mountPoint, tmpmntpnt)) - goto badDirHandle; - mountPoint = tmpmntpnt; /* sanitized version. */ - } /* if */ - - dirHandle = openDirectory(io, newDir, forWriting); - GOTO_IF_ERRPASS(!dirHandle, badDirHandle); - - dirHandle->dirName = (char *) allocator.Malloc(strlen(newDir) + 1); - GOTO_IF(!dirHandle->dirName, PHYSFS_ERR_OUT_OF_MEMORY, badDirHandle); - strcpy(dirHandle->dirName, newDir); - - if ((mountPoint != NULL) && (*mountPoint != '\0')) - { - dirHandle->mountPoint = (char *)allocator.Malloc(strlen(mountPoint)+2); - if (!dirHandle->mountPoint) - GOTO(PHYSFS_ERR_OUT_OF_MEMORY, badDirHandle); - strcpy(dirHandle->mountPoint, mountPoint); - strcat(dirHandle->mountPoint, "/"); - } /* if */ - - __PHYSFS_smallFree(tmpmntpnt); - return dirHandle; - -badDirHandle: - if (dirHandle != NULL) - { - dirHandle->funcs->closeArchive(dirHandle->opaque); - allocator.Free(dirHandle->dirName); - allocator.Free(dirHandle->mountPoint); - allocator.Free(dirHandle); - } /* if */ - - __PHYSFS_smallFree(tmpmntpnt); - return NULL; -} /* createDirHandle */ - - -/* MAKE SURE you've got the stateLock held before calling this! */ -static int freeDirHandle(DirHandle *dh, FileHandle *openList) -{ - FileHandle *i; - - if (dh == NULL) - return 1; - - for (i = openList; i != NULL; i = i->next) - BAIL_IF(i->dirHandle == dh, PHYSFS_ERR_FILES_STILL_OPEN, 0); - - dh->funcs->closeArchive(dh->opaque); - allocator.Free(dh->dirName); - allocator.Free(dh->mountPoint); - allocator.Free(dh); - return 1; -} /* freeDirHandle */ - - -static char *calculateBaseDir(const char *argv0) -{ - const char dirsep = __PHYSFS_platformDirSeparator; - char *retval = NULL; - char *ptr = NULL; - - /* Give the platform layer first shot at this. */ - retval = __PHYSFS_platformCalcBaseDir(argv0); - if (retval != NULL) - return retval; - - /* We need argv0 to go on. */ - BAIL_IF(argv0 == NULL, PHYSFS_ERR_ARGV0_IS_NULL, NULL); - - ptr = strrchr(argv0, dirsep); - if (ptr != NULL) - { - const size_t size = ((size_t) (ptr - argv0)) + 1; - retval = (char *) allocator.Malloc(size + 1); - BAIL_IF(!retval, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - memcpy(retval, argv0, size); - retval[size] = '\0'; - return retval; - } /* if */ - - /* argv0 wasn't helpful. */ - BAIL(PHYSFS_ERR_INVALID_ARGUMENT, NULL); -} /* calculateBaseDir */ - - -static int initializeMutexes(void) -{ - errorLock = __PHYSFS_platformCreateMutex(); - if (errorLock == NULL) - goto initializeMutexes_failed; - - stateLock = __PHYSFS_platformCreateMutex(); - if (stateLock == NULL) - goto initializeMutexes_failed; - - return 1; /* success. */ - -initializeMutexes_failed: - if (errorLock != NULL) - __PHYSFS_platformDestroyMutex(errorLock); - - if (stateLock != NULL) - __PHYSFS_platformDestroyMutex(stateLock); - - errorLock = stateLock = NULL; - return 0; /* failed. */ -} /* initializeMutexes */ - - -static int doRegisterArchiver(const PHYSFS_Archiver *_archiver); - -static int initStaticArchivers(void) -{ - #define REGISTER_STATIC_ARCHIVER(arc) { \ - if (!doRegisterArchiver(&__PHYSFS_Archiver_##arc)) { \ - return 0; \ - } \ - } - - #if PHYSFS_SUPPORTS_ZIP - REGISTER_STATIC_ARCHIVER(ZIP); - #endif - #if PHYSFS_SUPPORTS_7Z - SZIP_global_init(); - REGISTER_STATIC_ARCHIVER(7Z); - #endif - #if PHYSFS_SUPPORTS_GRP - REGISTER_STATIC_ARCHIVER(GRP); - #endif - #if PHYSFS_SUPPORTS_QPAK - REGISTER_STATIC_ARCHIVER(QPAK); - #endif - #if PHYSFS_SUPPORTS_HOG - REGISTER_STATIC_ARCHIVER(HOG); - #endif - #if PHYSFS_SUPPORTS_MVL - REGISTER_STATIC_ARCHIVER(MVL); - #endif - #if PHYSFS_SUPPORTS_WAD - REGISTER_STATIC_ARCHIVER(WAD); - #endif - #if PHYSFS_SUPPORTS_SLB - REGISTER_STATIC_ARCHIVER(SLB); - #endif - #if PHYSFS_SUPPORTS_ISO9660 - REGISTER_STATIC_ARCHIVER(ISO9660); - #endif - #if PHYSFS_SUPPORTS_VDF - REGISTER_STATIC_ARCHIVER(VDF) - #endif - - #undef REGISTER_STATIC_ARCHIVER - - return 1; -} /* initStaticArchivers */ - - -static void setDefaultAllocator(void); -static int doDeinit(void); - -int PHYSFS_init(const char *argv0) -{ - BAIL_IF(initialized, PHYSFS_ERR_IS_INITIALIZED, 0); - - if (!externalAllocator) - setDefaultAllocator(); - - if ((allocator.Init != NULL) && (!allocator.Init())) return 0; - - if (!__PHYSFS_platformInit()) - { - if (allocator.Deinit != NULL) allocator.Deinit(); - return 0; - } /* if */ - - /* everything below here can be cleaned up safely by doDeinit(). */ - - if (!initializeMutexes()) goto initFailed; - - baseDir = calculateBaseDir(argv0); - if (!baseDir) goto initFailed; - - userDir = __PHYSFS_platformCalcUserDir(); - if (!userDir) goto initFailed; - - /* Platform layer is required to append a dirsep. */ - assert(baseDir[strlen(baseDir) - 1] == __PHYSFS_platformDirSeparator); - assert(userDir[strlen(userDir) - 1] == __PHYSFS_platformDirSeparator); - - if (!initStaticArchivers()) goto initFailed; - - initialized = 1; - - /* This makes sure that the error subsystem is initialized. */ - PHYSFS_setErrorCode(PHYSFS_getLastErrorCode()); - - return 1; - -initFailed: - doDeinit(); - return 0; -} /* PHYSFS_init */ - - -/* MAKE SURE you hold stateLock before calling this! */ -static int closeFileHandleList(FileHandle **list) -{ - FileHandle *i; - FileHandle *next = NULL; - - for (i = *list; i != NULL; i = next) - { - PHYSFS_Io *io = i->io; - next = i->next; - - if (io->flush && !io->flush(io)) - { - *list = i; - return 0; - } /* if */ - - io->destroy(io); - allocator.Free(i); - } /* for */ - - *list = NULL; - return 1; -} /* closeFileHandleList */ - - -/* MAKE SURE you hold the stateLock before calling this! */ -static void freeSearchPath(void) -{ - DirHandle *i; - DirHandle *next = NULL; - - closeFileHandleList(&openReadList); - - if (searchPath != NULL) - { - for (i = searchPath; i != NULL; i = next) - { - next = i->next; - freeDirHandle(i, openReadList); - } /* for */ - searchPath = NULL; - } /* if */ -} /* freeSearchPath */ - - -/* MAKE SURE you hold stateLock before calling this! */ -static int archiverInUse(const PHYSFS_Archiver *arc, const DirHandle *list) -{ - const DirHandle *i; - for (i = list; i != NULL; i = i->next) - { - if (i->funcs == arc) - return 1; - } /* for */ - - return 0; /* not in use */ -} /* archiverInUse */ - - -/* MAKE SURE you hold stateLock before calling this! */ -static int doDeregisterArchiver(const size_t idx) -{ - const size_t len = (numArchivers - idx) * sizeof (void *); - PHYSFS_ArchiveInfo *info = archiveInfo[idx]; - PHYSFS_Archiver *arc = archivers[idx]; - - /* make sure nothing is still using this archiver */ - if (archiverInUse(arc, searchPath) || archiverInUse(arc, writeDir)) - BAIL(PHYSFS_ERR_FILES_STILL_OPEN, 0); - - allocator.Free((void *) info->extension); - allocator.Free((void *) info->description); - allocator.Free((void *) info->author); - allocator.Free((void *) info->url); - allocator.Free((void *) arc); - - memmove(&archiveInfo[idx], &archiveInfo[idx+1], len); - memmove(&archivers[idx], &archivers[idx+1], len); - - assert(numArchivers > 0); - numArchivers--; - - return 1; -} /* doDeregisterArchiver */ - - -/* Does NOT hold the state lock; we're shutting down. */ -static void freeArchivers(void) -{ - while (numArchivers > 0) - { - if (!doDeregisterArchiver(numArchivers - 1)) - assert(!"nothing should be mounted during shutdown."); - } /* while */ - - allocator.Free(archivers); - allocator.Free(archiveInfo); - archivers = NULL; - archiveInfo = NULL; -} /* freeArchivers */ - - -static int doDeinit(void) -{ - closeFileHandleList(&openWriteList); - BAIL_IF(!PHYSFS_setWriteDir(NULL), PHYSFS_ERR_FILES_STILL_OPEN, 0); - - freeSearchPath(); - freeArchivers(); - freeErrorStates(); - - if (baseDir != NULL) - { - allocator.Free(baseDir); - baseDir = NULL; - } /* if */ - - if (userDir != NULL) - { - allocator.Free(userDir); - userDir = NULL; - } /* if */ - - if (prefDir != NULL) - { - allocator.Free(prefDir); - prefDir = NULL; - } /* if */ - - if (archiveInfo != NULL) - { - allocator.Free(archiveInfo); - archiveInfo = NULL; - } /* if */ - - if (archivers != NULL) - { - allocator.Free(archivers); - archivers = NULL; - } /* if */ - - allowSymLinks = 0; - initialized = 0; - - if (errorLock) __PHYSFS_platformDestroyMutex(errorLock); - if (stateLock) __PHYSFS_platformDestroyMutex(stateLock); - - if (allocator.Deinit != NULL) - allocator.Deinit(); - - errorLock = stateLock = NULL; - - __PHYSFS_platformDeinit(); - - return 1; -} /* doDeinit */ - - -int PHYSFS_deinit(void) -{ - BAIL_IF(!initialized, PHYSFS_ERR_NOT_INITIALIZED, 0); - return doDeinit(); -} /* PHYSFS_deinit */ - - -int PHYSFS_isInit(void) -{ - return initialized; -} /* PHYSFS_isInit */ - - -char *__PHYSFS_strdup(const char *str) -{ - char *retval = (char *) allocator.Malloc(strlen(str) + 1); - if (retval) - strcpy(retval, str); - return retval; -} /* __PHYSFS_strdup */ - - -PHYSFS_uint32 __PHYSFS_hashString(const char *str, size_t len) -{ - PHYSFS_uint32 hash = 5381; - while (len--) - hash = ((hash << 5) + hash) ^ *(str++); - return hash; -} /* __PHYSFS_hashString */ - - -/* MAKE SURE you hold stateLock before calling this! */ -static int doRegisterArchiver(const PHYSFS_Archiver *_archiver) -{ - const PHYSFS_uint32 maxver = CURRENT_PHYSFS_ARCHIVER_API_VERSION; - const size_t len = (numArchivers + 2) * sizeof (void *); - PHYSFS_Archiver *archiver = NULL; - PHYSFS_ArchiveInfo *info = NULL; - const char *ext = NULL; - void *ptr = NULL; - size_t i; - - BAIL_IF(!_archiver, PHYSFS_ERR_INVALID_ARGUMENT, 0); - BAIL_IF(_archiver->version > maxver, PHYSFS_ERR_UNSUPPORTED, 0); - BAIL_IF(!_archiver->info.extension, PHYSFS_ERR_INVALID_ARGUMENT, 0); - BAIL_IF(!_archiver->info.description, PHYSFS_ERR_INVALID_ARGUMENT, 0); - BAIL_IF(!_archiver->info.author, PHYSFS_ERR_INVALID_ARGUMENT, 0); - BAIL_IF(!_archiver->info.url, PHYSFS_ERR_INVALID_ARGUMENT, 0); - BAIL_IF(!_archiver->openArchive, PHYSFS_ERR_INVALID_ARGUMENT, 0); - BAIL_IF(!_archiver->enumerate, PHYSFS_ERR_INVALID_ARGUMENT, 0); - BAIL_IF(!_archiver->openRead, PHYSFS_ERR_INVALID_ARGUMENT, 0); - BAIL_IF(!_archiver->openWrite, PHYSFS_ERR_INVALID_ARGUMENT, 0); - BAIL_IF(!_archiver->openAppend, PHYSFS_ERR_INVALID_ARGUMENT, 0); - BAIL_IF(!_archiver->remove, PHYSFS_ERR_INVALID_ARGUMENT, 0); - BAIL_IF(!_archiver->mkdir, PHYSFS_ERR_INVALID_ARGUMENT, 0); - BAIL_IF(!_archiver->closeArchive, PHYSFS_ERR_INVALID_ARGUMENT, 0); - BAIL_IF(!_archiver->stat, PHYSFS_ERR_INVALID_ARGUMENT, 0); - - ext = _archiver->info.extension; - for (i = 0; i < numArchivers; i++) - { - if (PHYSFS_utf8stricmp(archiveInfo[i]->extension, ext) == 0) - BAIL(PHYSFS_ERR_DUPLICATE, 0); - } /* for */ - - /* make a copy of the data. */ - archiver = (PHYSFS_Archiver *) allocator.Malloc(sizeof (*archiver)); - GOTO_IF(!archiver, PHYSFS_ERR_OUT_OF_MEMORY, regfailed); - - /* Must copy sizeof (OLD_VERSION_OF_STRUCT) when version changes! */ - memcpy(archiver, _archiver, sizeof (*archiver)); - - info = (PHYSFS_ArchiveInfo *) &archiver->info; - memset(info, '\0', sizeof (*info)); /* NULL in case an alloc fails. */ - #define CPYSTR(item) \ - info->item = __PHYSFS_strdup(_archiver->info.item); \ - GOTO_IF(!info->item, PHYSFS_ERR_OUT_OF_MEMORY, regfailed); - CPYSTR(extension); - CPYSTR(description); - CPYSTR(author); - CPYSTR(url); - info->supportsSymlinks = _archiver->info.supportsSymlinks; - #undef CPYSTR - - ptr = allocator.Realloc(archiveInfo, len); - GOTO_IF(!ptr, PHYSFS_ERR_OUT_OF_MEMORY, regfailed); - archiveInfo = (PHYSFS_ArchiveInfo **) ptr; - - ptr = allocator.Realloc(archivers, len); - GOTO_IF(!ptr, PHYSFS_ERR_OUT_OF_MEMORY, regfailed); - archivers = (PHYSFS_Archiver **) ptr; - - archiveInfo[numArchivers] = info; - archiveInfo[numArchivers + 1] = NULL; - - archivers[numArchivers] = archiver; - archivers[numArchivers + 1] = NULL; - - numArchivers++; - - return 1; - -regfailed: - if (info != NULL) - { - allocator.Free((void *) info->extension); - allocator.Free((void *) info->description); - allocator.Free((void *) info->author); - allocator.Free((void *) info->url); - } /* if */ - allocator.Free(archiver); - - return 0; -} /* doRegisterArchiver */ - - -int PHYSFS_registerArchiver(const PHYSFS_Archiver *archiver) -{ - int retval; - BAIL_IF(!initialized, PHYSFS_ERR_NOT_INITIALIZED, 0); - __PHYSFS_platformGrabMutex(stateLock); - retval = doRegisterArchiver(archiver); - __PHYSFS_platformReleaseMutex(stateLock); - return retval; -} /* PHYSFS_registerArchiver */ - - -int PHYSFS_deregisterArchiver(const char *ext) -{ - size_t i; - - BAIL_IF(!initialized, PHYSFS_ERR_NOT_INITIALIZED, 0); - BAIL_IF(!ext, PHYSFS_ERR_INVALID_ARGUMENT, 0); - - __PHYSFS_platformGrabMutex(stateLock); - for (i = 0; i < numArchivers; i++) - { - if (PHYSFS_utf8stricmp(archiveInfo[i]->extension, ext) == 0) - { - const int retval = doDeregisterArchiver(i); - __PHYSFS_platformReleaseMutex(stateLock); - return retval; - } /* if */ - } /* for */ - __PHYSFS_platformReleaseMutex(stateLock); - - BAIL(PHYSFS_ERR_NOT_FOUND, 0); -} /* PHYSFS_deregisterArchiver */ - - -const PHYSFS_ArchiveInfo **PHYSFS_supportedArchiveTypes(void) -{ - BAIL_IF(!initialized, PHYSFS_ERR_NOT_INITIALIZED, NULL); - return (const PHYSFS_ArchiveInfo **) archiveInfo; -} /* PHYSFS_supportedArchiveTypes */ - - -void PHYSFS_freeList(void *list) -{ - void **i; - if (list != NULL) - { - for (i = (void **) list; *i != NULL; i++) - allocator.Free(*i); - - allocator.Free(list); - } /* if */ -} /* PHYSFS_freeList */ - - -const char *PHYSFS_getDirSeparator(void) -{ - static char retval[2] = { __PHYSFS_platformDirSeparator, '\0' }; - return retval; -} /* PHYSFS_getDirSeparator */ - - -char **PHYSFS_getCdRomDirs(void) -{ - return doEnumStringList(__PHYSFS_platformDetectAvailableCDs); -} /* PHYSFS_getCdRomDirs */ - - -void PHYSFS_getCdRomDirsCallback(PHYSFS_StringCallback callback, void *data) -{ - __PHYSFS_platformDetectAvailableCDs(callback, data); -} /* PHYSFS_getCdRomDirsCallback */ - - -const char *PHYSFS_getPrefDir(const char *org, const char *app) -{ - const char dirsep = __PHYSFS_platformDirSeparator; - PHYSFS_Stat statbuf; - char *ptr = NULL; - char *endstr = NULL; - - BAIL_IF(!initialized, PHYSFS_ERR_NOT_INITIALIZED, 0); - BAIL_IF(!org, PHYSFS_ERR_INVALID_ARGUMENT, NULL); - BAIL_IF(*org == '\0', PHYSFS_ERR_INVALID_ARGUMENT, NULL); - BAIL_IF(!app, PHYSFS_ERR_INVALID_ARGUMENT, NULL); - BAIL_IF(*app == '\0', PHYSFS_ERR_INVALID_ARGUMENT, NULL); - - allocator.Free(prefDir); - prefDir = __PHYSFS_platformCalcPrefDir(org, app); - BAIL_IF_ERRPASS(!prefDir, NULL); - - assert(strlen(prefDir) > 0); - endstr = prefDir + (strlen(prefDir) - 1); - assert(*endstr == dirsep); - *endstr = '\0'; /* mask out the final dirsep for now. */ - - if (!__PHYSFS_platformStat(prefDir, &statbuf, 1)) - { - for (ptr = strchr(prefDir, dirsep); ptr; ptr = strchr(ptr+1, dirsep)) - { - *ptr = '\0'; - __PHYSFS_platformMkDir(prefDir); - *ptr = dirsep; - } /* for */ - - if (!__PHYSFS_platformMkDir(prefDir)) - { - allocator.Free(prefDir); - prefDir = NULL; - } /* if */ - } /* if */ - - *endstr = dirsep; /* readd the final dirsep. */ - - return prefDir; -} /* PHYSFS_getPrefDir */ - - -const char *PHYSFS_getBaseDir(void) -{ - return baseDir; /* this is calculated in PHYSFS_init()... */ -} /* PHYSFS_getBaseDir */ - - -const char *__PHYSFS_getUserDir(void) /* not deprecated internal version. */ -{ - return userDir; /* this is calculated in PHYSFS_init()... */ -} /* __PHYSFS_getUserDir */ - - -const char *PHYSFS_getUserDir(void) -{ - return __PHYSFS_getUserDir(); -} /* PHYSFS_getUserDir */ - - -const char *PHYSFS_getWriteDir(void) -{ - const char *retval = NULL; - - __PHYSFS_platformGrabMutex(stateLock); - if (writeDir != NULL) - retval = writeDir->dirName; - __PHYSFS_platformReleaseMutex(stateLock); - - return retval; -} /* PHYSFS_getWriteDir */ - - -int PHYSFS_setWriteDir(const char *newDir) -{ - int retval = 1; - - __PHYSFS_platformGrabMutex(stateLock); - - if (writeDir != NULL) - { - BAIL_IF_MUTEX_ERRPASS(!freeDirHandle(writeDir, openWriteList), - stateLock, 0); - writeDir = NULL; - } /* if */ - - if (newDir != NULL) - { - writeDir = createDirHandle(NULL, newDir, NULL, 1); - retval = (writeDir != NULL); - } /* if */ - - __PHYSFS_platformReleaseMutex(stateLock); - - return retval; -} /* PHYSFS_setWriteDir */ - - -static int doMount(PHYSFS_Io *io, const char *fname, - const char *mountPoint, int appendToPath) -{ - DirHandle *dh; - DirHandle *prev = NULL; - DirHandle *i; - - BAIL_IF(!fname, PHYSFS_ERR_INVALID_ARGUMENT, 0); - - if (mountPoint == NULL) - mountPoint = "/"; - - __PHYSFS_platformGrabMutex(stateLock); - - for (i = searchPath; i != NULL; i = i->next) - { - /* already in search path? */ - if ((i->dirName != NULL) && (strcmp(fname, i->dirName) == 0)) - BAIL_MUTEX_ERRPASS(stateLock, 1); - prev = i; - } /* for */ - - dh = createDirHandle(io, fname, mountPoint, 0); - BAIL_IF_MUTEX_ERRPASS(!dh, stateLock, 0); - - if (appendToPath) - { - if (prev == NULL) - searchPath = dh; - else - prev->next = dh; - } /* if */ - else - { - dh->next = searchPath; - searchPath = dh; - } /* else */ - - __PHYSFS_platformReleaseMutex(stateLock); - return 1; -} /* doMount */ - - -int PHYSFS_mountIo(PHYSFS_Io *io, const char *fname, - const char *mountPoint, int appendToPath) -{ - BAIL_IF(!io, PHYSFS_ERR_INVALID_ARGUMENT, 0); - BAIL_IF(!fname, PHYSFS_ERR_INVALID_ARGUMENT, 0); - BAIL_IF(io->version != 0, PHYSFS_ERR_UNSUPPORTED, 0); - return doMount(io, fname, mountPoint, appendToPath); -} /* PHYSFS_mountIo */ - - -int PHYSFS_mountMemory(const void *buf, PHYSFS_uint64 len, void (*del)(void *), - const char *fname, const char *mountPoint, - int appendToPath) -{ - int retval = 0; - PHYSFS_Io *io = NULL; - - BAIL_IF(!buf, PHYSFS_ERR_INVALID_ARGUMENT, 0); - BAIL_IF(!fname, PHYSFS_ERR_INVALID_ARGUMENT, 0); - - io = __PHYSFS_createMemoryIo(buf, len, del); - BAIL_IF_ERRPASS(!io, 0); - retval = doMount(io, fname, mountPoint, appendToPath); - if (!retval) - { - /* docs say not to call (del) in case of failure, so cheat. */ - MemoryIoInfo *info = (MemoryIoInfo *) io->opaque; - info->destruct = NULL; - io->destroy(io); - } /* if */ - - return retval; -} /* PHYSFS_mountMemory */ - - -int PHYSFS_mountHandle(PHYSFS_File *file, const char *fname, - const char *mountPoint, int appendToPath) -{ - int retval = 0; - PHYSFS_Io *io = NULL; - - BAIL_IF(!file, PHYSFS_ERR_INVALID_ARGUMENT, 0); - BAIL_IF(!fname, PHYSFS_ERR_INVALID_ARGUMENT, 0); - - io = __PHYSFS_createHandleIo(file); - BAIL_IF_ERRPASS(!io, 0); - retval = doMount(io, fname, mountPoint, appendToPath); - if (!retval) - { - /* docs say not to destruct in case of failure, so cheat. */ - io->opaque = NULL; - io->destroy(io); - } /* if */ - - return retval; -} /* PHYSFS_mountHandle */ - - -int PHYSFS_mount(const char *newDir, const char *mountPoint, int appendToPath) -{ - BAIL_IF(!newDir, PHYSFS_ERR_INVALID_ARGUMENT, 0); - return doMount(NULL, newDir, mountPoint, appendToPath); -} /* PHYSFS_mount */ - - -int PHYSFS_addToSearchPath(const char *newDir, int appendToPath) -{ - return PHYSFS_mount(newDir, NULL, appendToPath); -} /* PHYSFS_addToSearchPath */ - - -int PHYSFS_removeFromSearchPath(const char *oldDir) -{ - return PHYSFS_unmount(oldDir); -} /* PHYSFS_removeFromSearchPath */ - - -int PHYSFS_unmount(const char *oldDir) -{ - DirHandle *i; - DirHandle *prev = NULL; - DirHandle *next = NULL; - - BAIL_IF(oldDir == NULL, PHYSFS_ERR_INVALID_ARGUMENT, 0); - - __PHYSFS_platformGrabMutex(stateLock); - for (i = searchPath; i != NULL; i = i->next) - { - if (strcmp(i->dirName, oldDir) == 0) - { - next = i->next; - BAIL_IF_MUTEX_ERRPASS(!freeDirHandle(i, openReadList), - stateLock, 0); - - if (prev == NULL) - searchPath = next; - else - prev->next = next; - - BAIL_MUTEX_ERRPASS(stateLock, 1); - } /* if */ - prev = i; - } /* for */ - - BAIL_MUTEX(PHYSFS_ERR_NOT_MOUNTED, stateLock, 0); -} /* PHYSFS_unmount */ - - -char **PHYSFS_getSearchPath(void) -{ - return doEnumStringList(PHYSFS_getSearchPathCallback); -} /* PHYSFS_getSearchPath */ - - -const char *PHYSFS_getMountPoint(const char *dir) -{ - DirHandle *i; - __PHYSFS_platformGrabMutex(stateLock); - for (i = searchPath; i != NULL; i = i->next) - { - if (strcmp(i->dirName, dir) == 0) - { - const char *retval = ((i->mountPoint) ? i->mountPoint : "/"); - __PHYSFS_platformReleaseMutex(stateLock); - return retval; - } /* if */ - } /* for */ - __PHYSFS_platformReleaseMutex(stateLock); - - BAIL(PHYSFS_ERR_NOT_MOUNTED, NULL); -} /* PHYSFS_getMountPoint */ - - -void PHYSFS_getSearchPathCallback(PHYSFS_StringCallback callback, void *data) -{ - DirHandle *i; - - __PHYSFS_platformGrabMutex(stateLock); - - for (i = searchPath; i != NULL; i = i->next) - callback(data, i->dirName); - - __PHYSFS_platformReleaseMutex(stateLock); -} /* PHYSFS_getSearchPathCallback */ - - -typedef struct setSaneCfgEnumData -{ - const char *archiveExt; - size_t archiveExtLen; - int archivesFirst; - PHYSFS_ErrorCode errcode; -} setSaneCfgEnumData; - -static PHYSFS_EnumerateCallbackResult setSaneCfgEnumCallback(void *_data, - const char *dir, const char *f) -{ - setSaneCfgEnumData *data = (setSaneCfgEnumData *) _data; - const size_t extlen = data->archiveExtLen; - const size_t l = strlen(f); - const char *ext; - - if ((l > extlen) && (f[l - extlen - 1] == '.')) - { - ext = f + (l - extlen); - if (PHYSFS_utf8stricmp(ext, data->archiveExt) == 0) - { - const char dirsep = __PHYSFS_platformDirSeparator; - const char *d = PHYSFS_getRealDir(f); - const size_t allocsize = strlen(d) + l + 2; - char *str = (char *) __PHYSFS_smallAlloc(allocsize); - if (str == NULL) - data->errcode = PHYSFS_ERR_OUT_OF_MEMORY; - else - { - snprintf(str, allocsize, "%s%c%s", d, dirsep, f); - if (!PHYSFS_mount(str, NULL, data->archivesFirst == 0)) - data->errcode = currentErrorCode(); - __PHYSFS_smallFree(str); - } /* else */ - } /* if */ - } /* if */ - - /* !!! FIXME: if we want to abort on errors... */ - /*return (data->errcode != PHYSFS_ERR_OK) ? PHYSFS_ENUM_ERROR : PHYSFS_ENUM_OK;*/ - - return PHYSFS_ENUM_OK; /* keep going */ -} /* setSaneCfgEnumCallback */ - - -int PHYSFS_setSaneConfig(const char *organization, const char *appName, - const char *archiveExt, int includeCdRoms, - int archivesFirst) -{ - const char *basedir; - const char *prefdir; - - BAIL_IF(!initialized, PHYSFS_ERR_NOT_INITIALIZED, 0); - - prefdir = PHYSFS_getPrefDir(organization, appName); - BAIL_IF_ERRPASS(!prefdir, 0); - - basedir = PHYSFS_getBaseDir(); - BAIL_IF_ERRPASS(!basedir, 0); - - BAIL_IF(!PHYSFS_setWriteDir(prefdir), PHYSFS_ERR_NO_WRITE_DIR, 0); - - /* !!! FIXME: these can fail and we should report that... */ - - /* Put write dir first in search path... */ - PHYSFS_mount(prefdir, NULL, 0); - - /* Put base path on search path... */ - PHYSFS_mount(basedir, NULL, 1); - - /* handle CD-ROMs... */ - if (includeCdRoms) - { - char **cds = PHYSFS_getCdRomDirs(); - char **i; - for (i = cds; *i != NULL; i++) - PHYSFS_mount(*i, NULL, 1); - PHYSFS_freeList(cds); - } /* if */ - - /* Root out archives, and add them to search path... */ - if (archiveExt != NULL) - { - setSaneCfgEnumData data; - memset(&data, '\0', sizeof (data)); - data.archiveExt = archiveExt; - data.archiveExtLen = strlen(archiveExt); - data.archivesFirst = archivesFirst; - data.errcode = PHYSFS_ERR_OK; - if (!PHYSFS_enumerate("/", setSaneCfgEnumCallback, &data)) - { - /* !!! FIXME: use this if we're reporting errors. - PHYSFS_ErrorCode errcode = currentErrorCode(); - if (errcode == PHYSFS_ERR_APP_CALLBACK) - errcode = data->errcode; */ - } /* if */ - } /* if */ - - return 1; -} /* PHYSFS_setSaneConfig */ - - -void PHYSFS_permitSymbolicLinks(int allow) -{ - allowSymLinks = allow; -} /* PHYSFS_permitSymbolicLinks */ - - -int PHYSFS_symbolicLinksPermitted(void) -{ - return allowSymLinks; -} /* PHYSFS_symbolicLinksPermitted */ - - -/* - * Verify that (fname) (in platform-independent notation), in relation - * to (h) is secure. That means that each element of fname is checked - * for symlinks (if they aren't permitted). This also allows for quick - * rejection of files that exist outside an archive's mountpoint. - * - * With some exceptions (like PHYSFS_mkdir(), which builds multiple subdirs - * at a time), you should always pass zero for "allowMissing" for efficiency. - * - * (fname) must point to an output from sanitizePlatformIndependentPath(), - * since it will make sure that path names are in the right format for - * passing certain checks. It will also do checks for "insecure" pathnames - * like ".." which should be done once instead of once per archive. This also - * gives us license to treat (fname) as scratch space in this function. - * - * Returns non-zero if string is safe, zero if there's a security issue. - * PHYSFS_getLastError() will specify what was wrong. (*fname) will be - * updated to point past any mount point elements so it is prepared to - * be used with the archiver directly. - */ -static int verifyPath(DirHandle *h, char **_fname, int allowMissing) -{ - char *fname = *_fname; - int retval = 1; - char *start; - char *end; - - if (*fname == '\0') /* quick rejection. */ - return 1; - - /* !!! FIXME: This codeblock sucks. */ - if (h->mountPoint != NULL) /* NULL mountpoint means "/". */ - { - size_t mntpntlen = strlen(h->mountPoint); - size_t len = strlen(fname); - assert(mntpntlen > 1); /* root mount points should be NULL. */ - /* not under the mountpoint, so skip this archive. */ - BAIL_IF(len < mntpntlen-1, PHYSFS_ERR_NOT_FOUND, 0); - /* !!! FIXME: Case insensitive? */ - retval = strncmp(h->mountPoint, fname, mntpntlen-1); - BAIL_IF(retval != 0, PHYSFS_ERR_NOT_FOUND, 0); - if (len > mntpntlen-1) /* corner case... */ - BAIL_IF(fname[mntpntlen-1]!='/', PHYSFS_ERR_NOT_FOUND, 0); - fname += mntpntlen-1; /* move to start of actual archive path. */ - if (*fname == '/') - fname++; - *_fname = fname; /* skip mountpoint for later use. */ - retval = 1; /* may be reset, below. */ - } /* if */ - - start = fname; - if (!allowSymLinks) - { - while (1) - { - PHYSFS_Stat statbuf; - int rc = 0; - end = strchr(start, '/'); - - if (end != NULL) *end = '\0'; - rc = h->funcs->stat(h->opaque, fname, &statbuf); - if (rc) - rc = (statbuf.filetype == PHYSFS_FILETYPE_SYMLINK); - else if (currentErrorCode() == PHYSFS_ERR_NOT_FOUND) - retval = 0; - - if (end != NULL) *end = '/'; - - /* insecure path (has a disallowed symlink in it)? */ - BAIL_IF(rc, PHYSFS_ERR_SYMLINK_FORBIDDEN, 0); - - /* break out early if path element is missing. */ - if (!retval) - { - /* - * We need to clear it if it's the last element of the path, - * since this might be a non-existant file we're opening - * for writing... - */ - if ((end == NULL) || (allowMissing)) - retval = 1; - break; - } /* if */ - - if (end == NULL) - break; - - start = end + 1; - } /* while */ - } /* if */ - - return retval; -} /* verifyPath */ - - -static int doMkdir(const char *_dname, char *dname) -{ - DirHandle *h; - char *start; - char *end; - int retval = 0; - int exists = 1; /* force existance check on first path element. */ - - BAIL_IF_ERRPASS(!sanitizePlatformIndependentPath(_dname, dname), 0); - - __PHYSFS_platformGrabMutex(stateLock); - BAIL_IF_MUTEX(!writeDir, PHYSFS_ERR_NO_WRITE_DIR, stateLock, 0); - h = writeDir; - BAIL_IF_MUTEX_ERRPASS(!verifyPath(h, &dname, 1), stateLock, 0); - - start = dname; - while (1) - { - end = strchr(start, '/'); - if (end != NULL) - *end = '\0'; - - /* only check for existance if all parent dirs existed, too... */ - if (exists) - { - PHYSFS_Stat statbuf; - const int rc = h->funcs->stat(h->opaque, dname, &statbuf); - if ((!rc) && (currentErrorCode() == PHYSFS_ERR_NOT_FOUND)) - exists = 0; - retval = ((rc) && (statbuf.filetype == PHYSFS_FILETYPE_DIRECTORY)); - } /* if */ - - if (!exists) - retval = h->funcs->mkdir(h->opaque, dname); - - if (!retval) - break; - - if (end == NULL) - break; - - *end = '/'; - start = end + 1; - } /* while */ - - __PHYSFS_platformReleaseMutex(stateLock); - return retval; -} /* doMkdir */ - - -int PHYSFS_mkdir(const char *_dname) -{ - int retval = 0; - char *dname; - size_t len; - - BAIL_IF(!_dname, PHYSFS_ERR_INVALID_ARGUMENT, 0); - len = strlen(_dname) + 1; - dname = (char *) __PHYSFS_smallAlloc(len); - BAIL_IF(!dname, PHYSFS_ERR_OUT_OF_MEMORY, 0); - retval = doMkdir(_dname, dname); - __PHYSFS_smallFree(dname); - return retval; -} /* PHYSFS_mkdir */ - - -static int doDelete(const char *_fname, char *fname) -{ - int retval; - DirHandle *h; - BAIL_IF_ERRPASS(!sanitizePlatformIndependentPath(_fname, fname), 0); - - __PHYSFS_platformGrabMutex(stateLock); - - BAIL_IF_MUTEX(!writeDir, PHYSFS_ERR_NO_WRITE_DIR, stateLock, 0); - h = writeDir; - BAIL_IF_MUTEX_ERRPASS(!verifyPath(h, &fname, 0), stateLock, 0); - retval = h->funcs->remove(h->opaque, fname); - - __PHYSFS_platformReleaseMutex(stateLock); - return retval; -} /* doDelete */ - - -int PHYSFS_delete(const char *_fname) -{ - int retval; - char *fname; - size_t len; - - BAIL_IF(!_fname, PHYSFS_ERR_INVALID_ARGUMENT, 0); - len = strlen(_fname) + 1; - fname = (char *) __PHYSFS_smallAlloc(len); - BAIL_IF(!fname, PHYSFS_ERR_OUT_OF_MEMORY, 0); - retval = doDelete(_fname, fname); - __PHYSFS_smallFree(fname); - return retval; -} /* PHYSFS_delete */ - - -static DirHandle *getRealDirHandle(const char *_fname) -{ - DirHandle *retval = NULL; - char *fname = NULL; - size_t len; - - BAIL_IF(!_fname, PHYSFS_ERR_INVALID_ARGUMENT, NULL); - len = strlen(_fname) + 1; - fname = __PHYSFS_smallAlloc(len); - BAIL_IF(!fname, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - if (sanitizePlatformIndependentPath(_fname, fname)) - { - DirHandle *i; - __PHYSFS_platformGrabMutex(stateLock); - for (i = searchPath; i != NULL; i = i->next) - { - char *arcfname = fname; - if (partOfMountPoint(i, arcfname)) - { - retval = i; - break; - } /* if */ - else if (verifyPath(i, &arcfname, 0)) - { - PHYSFS_Stat statbuf; - if (i->funcs->stat(i->opaque, arcfname, &statbuf)) - { - retval = i; - break; - } /* if */ - } /* if */ - } /* for */ - __PHYSFS_platformReleaseMutex(stateLock); - } /* if */ - - __PHYSFS_smallFree(fname); - return retval; -} /* getRealDirHandle */ - -const char *PHYSFS_getRealDir(const char *fname) -{ - DirHandle *dh = getRealDirHandle(fname); - return dh ? dh->dirName : NULL; -} /* PHYSFS_getRealDir */ - - -static int locateInStringList(const char *str, - char **list, - PHYSFS_uint32 *pos) -{ - PHYSFS_uint32 len = *pos; - PHYSFS_uint32 half_len; - PHYSFS_uint32 lo = 0; - PHYSFS_uint32 middle; - int cmp; - - while (len > 0) - { - half_len = len >> 1; - middle = lo + half_len; - cmp = strcmp(list[middle], str); - - if (cmp == 0) /* it's in the list already. */ - return 1; - else if (cmp > 0) - len = half_len; - else - { - lo = middle + 1; - len -= half_len + 1; - } /* else */ - } /* while */ - - *pos = lo; - return 0; -} /* locateInStringList */ - - -static PHYSFS_EnumerateCallbackResult enumFilesCallback(void *data, - const char *origdir, const char *str) -{ - PHYSFS_uint32 pos; - void *ptr; - char *newstr; - EnumStringListCallbackData *pecd = (EnumStringListCallbackData *) data; - - /* - * See if file is in the list already, and if not, insert it in there - * alphabetically... - */ - pos = pecd->size; - if (locateInStringList(str, pecd->list, &pos)) - return PHYSFS_ENUM_OK; /* already in the list, but keep going. */ - - ptr = allocator.Realloc(pecd->list, (pecd->size + 2) * sizeof (char *)); - newstr = (char *) allocator.Malloc(strlen(str) + 1); - if (ptr != NULL) - pecd->list = (char **) ptr; - - if ((ptr == NULL) || (newstr == NULL)) - { - if (newstr) - allocator.Free(newstr); - - pecd->errcode = PHYSFS_ERR_OUT_OF_MEMORY; - return PHYSFS_ENUM_ERROR; /* better luck next time. */ - } /* if */ - - strcpy(newstr, str); - - if (pos != pecd->size) - { - memmove(&pecd->list[pos+1], &pecd->list[pos], - sizeof (char *) * ((pecd->size) - pos)); - } /* if */ - - pecd->list[pos] = newstr; - pecd->size++; - - return PHYSFS_ENUM_OK; -} /* enumFilesCallback */ - - -char **PHYSFS_enumerateFiles(const char *path) -{ - EnumStringListCallbackData ecd; - memset(&ecd, '\0', sizeof (ecd)); - ecd.list = (char **) allocator.Malloc(sizeof (char *)); - BAIL_IF(!ecd.list, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - if (!PHYSFS_enumerate(path, enumFilesCallback, &ecd)) - { - const PHYSFS_ErrorCode errcode = currentErrorCode(); - PHYSFS_uint32 i; - for (i = 0; i < ecd.size; i++) - allocator.Free(ecd.list[i]); - allocator.Free(ecd.list); - BAIL_IF(errcode == PHYSFS_ERR_APP_CALLBACK, ecd.errcode, NULL); - return NULL; - } /* if */ - - ecd.list[ecd.size] = NULL; - return ecd.list; -} /* PHYSFS_enumerateFiles */ - - -/* - * Broke out to seperate function so we can use stack allocation gratuitously. - */ -static PHYSFS_EnumerateCallbackResult enumerateFromMountPoint(DirHandle *i, - const char *arcfname, - PHYSFS_EnumerateCallback callback, - const char *_fname, void *data) -{ - PHYSFS_EnumerateCallbackResult retval; - const size_t len = strlen(arcfname); - char *ptr = NULL; - char *end = NULL; - const size_t slen = strlen(i->mountPoint) + 1; - char *mountPoint = (char *) __PHYSFS_smallAlloc(slen); - - BAIL_IF(!mountPoint, PHYSFS_ERR_OUT_OF_MEMORY, PHYSFS_ENUM_ERROR); - - strcpy(mountPoint, i->mountPoint); - ptr = mountPoint + ((len) ? len + 1 : 0); - end = strchr(ptr, '/'); - assert(end); /* should always find a terminating '/'. */ - *end = '\0'; - retval = callback(data, _fname, ptr); - __PHYSFS_smallFree(mountPoint); - - BAIL_IF(retval == PHYSFS_ENUM_ERROR, PHYSFS_ERR_APP_CALLBACK, retval); - return retval; -} /* enumerateFromMountPoint */ - - -typedef struct SymlinkFilterData -{ - PHYSFS_EnumerateCallback callback; - void *callbackData; - DirHandle *dirhandle; - const char *arcfname; - PHYSFS_ErrorCode errcode; -} SymlinkFilterData; - -static PHYSFS_EnumerateCallbackResult enumCallbackFilterSymLinks(void *_data, - const char *origdir, const char *fname) -{ - SymlinkFilterData *data = (SymlinkFilterData *) _data; - const DirHandle *dh = data->dirhandle; - const char *arcfname = data->arcfname; - PHYSFS_Stat statbuf; - const char *trimmedDir = (*arcfname == '/') ? (arcfname + 1) : arcfname; - const size_t slen = strlen(trimmedDir) + strlen(fname) + 2; - char *path = (char *) __PHYSFS_smallAlloc(slen); - PHYSFS_EnumerateCallbackResult retval = PHYSFS_ENUM_OK; - - if (path == NULL) - { - data->errcode = PHYSFS_ERR_OUT_OF_MEMORY; - return PHYSFS_ENUM_ERROR; - } /* if */ - - snprintf(path, slen, "%s%s%s", trimmedDir, *trimmedDir ? "/" : "", fname); - - if (!dh->funcs->stat(dh->opaque, path, &statbuf)) - { - data->errcode = currentErrorCode(); - retval = PHYSFS_ENUM_ERROR; - } /* if */ - else - { - /* Pass it on to the application if it's not a symlink. */ - if (statbuf.filetype != PHYSFS_FILETYPE_SYMLINK) - { - retval = data->callback(data->callbackData, origdir, fname); - if (retval == PHYSFS_ENUM_ERROR) - data->errcode = PHYSFS_ERR_APP_CALLBACK; - } /* if */ - } /* else */ - - __PHYSFS_smallFree(path); - - return retval; -} /* enumCallbackFilterSymLinks */ - - -int PHYSFS_enumerate(const char *_fn, PHYSFS_EnumerateCallback cb, void *data) -{ - PHYSFS_EnumerateCallbackResult retval = PHYSFS_ENUM_OK; - size_t len; - char *fname; - - BAIL_IF(!_fn, PHYSFS_ERR_INVALID_ARGUMENT, 0); - BAIL_IF(!cb, PHYSFS_ERR_INVALID_ARGUMENT, 0); - - len = strlen(_fn) + 1; - fname = (char *) __PHYSFS_smallAlloc(len); - BAIL_IF(!fname, PHYSFS_ERR_OUT_OF_MEMORY, 0); - - if (!sanitizePlatformIndependentPath(_fn, fname)) - retval = PHYSFS_ENUM_STOP; - else - { - DirHandle *i; - SymlinkFilterData filterdata; - - __PHYSFS_platformGrabMutex(stateLock); - - if (!allowSymLinks) - { - memset(&filterdata, '\0', sizeof (filterdata)); - filterdata.callback = cb; - filterdata.callbackData = data; - } /* if */ - - for (i = searchPath; (retval == PHYSFS_ENUM_OK) && i; i = i->next) - { - char *arcfname = fname; - - if (partOfMountPoint(i, arcfname)) - retval = enumerateFromMountPoint(i, arcfname, cb, _fn, data); - - else if (verifyPath(i, &arcfname, 0)) - { - PHYSFS_Stat statbuf; - if (!i->funcs->stat(i->opaque, arcfname, &statbuf)) - { - if (currentErrorCode() == PHYSFS_ERR_NOT_FOUND) - continue; /* no such dir in this archive, skip it. */ - } /* if */ - - if (statbuf.filetype != PHYSFS_FILETYPE_DIRECTORY) - continue; /* not a directory in this archive, skip it. */ - - else if ((!allowSymLinks) && (i->funcs->info.supportsSymlinks)) - { - filterdata.dirhandle = i; - filterdata.arcfname = arcfname; - filterdata.errcode = PHYSFS_ERR_OK; - retval = i->funcs->enumerate(i->opaque, arcfname, - enumCallbackFilterSymLinks, - _fn, &filterdata); - if (retval == PHYSFS_ENUM_ERROR) - { - if (currentErrorCode() == PHYSFS_ERR_APP_CALLBACK) - PHYSFS_setErrorCode(filterdata.errcode); - } /* if */ - } /* else if */ - else - { - retval = i->funcs->enumerate(i->opaque, arcfname, - cb, _fn, data); - } /* else */ - } /* else if */ - } /* for */ - - __PHYSFS_platformReleaseMutex(stateLock); - } /* if */ - - __PHYSFS_smallFree(fname); - - return (retval == PHYSFS_ENUM_ERROR) ? 0 : 1; -} /* PHYSFS_enumerate */ - - -typedef struct -{ - PHYSFS_EnumFilesCallback callback; - void *data; -} LegacyEnumFilesCallbackData; - -static PHYSFS_EnumerateCallbackResult enumFilesCallbackAlwaysSucceed(void *d, - const char *origdir, const char *fname) -{ - LegacyEnumFilesCallbackData *cbdata = (LegacyEnumFilesCallbackData *) d; - cbdata->callback(cbdata->data, origdir, fname); - return PHYSFS_ENUM_OK; -} /* enumFilesCallbackAlwaysSucceed */ - -void PHYSFS_enumerateFilesCallback(const char *fname, - PHYSFS_EnumFilesCallback callback, - void *data) -{ - LegacyEnumFilesCallbackData cbdata; - cbdata.callback = callback; - cbdata.data = data; - (void) PHYSFS_enumerate(fname, enumFilesCallbackAlwaysSucceed, &cbdata); -} /* PHYSFS_enumerateFilesCallback */ - - -int PHYSFS_exists(const char *fname) -{ - return (getRealDirHandle(fname) != NULL); -} /* PHYSFS_exists */ - - -PHYSFS_sint64 PHYSFS_getLastModTime(const char *fname) -{ - PHYSFS_Stat statbuf; - BAIL_IF_ERRPASS(!PHYSFS_stat(fname, &statbuf), -1); - return statbuf.modtime; -} /* PHYSFS_getLastModTime */ - - -int PHYSFS_isDirectory(const char *fname) -{ - PHYSFS_Stat statbuf; - BAIL_IF_ERRPASS(!PHYSFS_stat(fname, &statbuf), 0); - return (statbuf.filetype == PHYSFS_FILETYPE_DIRECTORY); -} /* PHYSFS_isDirectory */ - - -int PHYSFS_isSymbolicLink(const char *fname) -{ - PHYSFS_Stat statbuf; - BAIL_IF_ERRPASS(!PHYSFS_stat(fname, &statbuf), 0); - return (statbuf.filetype == PHYSFS_FILETYPE_SYMLINK); -} /* PHYSFS_isSymbolicLink */ - - -static PHYSFS_File *doOpenWrite(const char *_fname, int appending) -{ - FileHandle *fh = NULL; - size_t len; - char *fname; - - BAIL_IF(!_fname, PHYSFS_ERR_INVALID_ARGUMENT, 0); - len = strlen(_fname) + 1; - fname = (char *) __PHYSFS_smallAlloc(len); - BAIL_IF(!fname, PHYSFS_ERR_OUT_OF_MEMORY, 0); - - if (sanitizePlatformIndependentPath(_fname, fname)) - { - PHYSFS_Io *io = NULL; - DirHandle *h = NULL; - const PHYSFS_Archiver *f; - - __PHYSFS_platformGrabMutex(stateLock); - - GOTO_IF(!writeDir, PHYSFS_ERR_NO_WRITE_DIR, doOpenWriteEnd); - - h = writeDir; - GOTO_IF_ERRPASS(!verifyPath(h, &fname, 0), doOpenWriteEnd); - - f = h->funcs; - if (appending) - io = f->openAppend(h->opaque, fname); - else - io = f->openWrite(h->opaque, fname); - - GOTO_IF_ERRPASS(!io, doOpenWriteEnd); - - fh = (FileHandle *) allocator.Malloc(sizeof (FileHandle)); - if (fh == NULL) - { - io->destroy(io); - GOTO(PHYSFS_ERR_OUT_OF_MEMORY, doOpenWriteEnd); - } /* if */ - else - { - memset(fh, '\0', sizeof (FileHandle)); - fh->io = io; - fh->dirHandle = h; - fh->next = openWriteList; - openWriteList = fh; - } /* else */ - - doOpenWriteEnd: - __PHYSFS_platformReleaseMutex(stateLock); - } /* if */ - - __PHYSFS_smallFree(fname); - return ((PHYSFS_File *) fh); -} /* doOpenWrite */ - - -PHYSFS_File *PHYSFS_openWrite(const char *filename) -{ - return doOpenWrite(filename, 0); -} /* PHYSFS_openWrite */ - - -PHYSFS_File *PHYSFS_openAppend(const char *filename) -{ - return doOpenWrite(filename, 1); -} /* PHYSFS_openAppend */ - - -PHYSFS_File *PHYSFS_openRead(const char *_fname) -{ - FileHandle *fh = NULL; - char *fname; - size_t len; - - BAIL_IF(!_fname, PHYSFS_ERR_INVALID_ARGUMENT, 0); - len = strlen(_fname) + 1; - fname = (char *) __PHYSFS_smallAlloc(len); - BAIL_IF(!fname, PHYSFS_ERR_OUT_OF_MEMORY, 0); - - if (sanitizePlatformIndependentPath(_fname, fname)) - { - DirHandle *i = NULL; - PHYSFS_Io *io = NULL; - - __PHYSFS_platformGrabMutex(stateLock); - - GOTO_IF(!searchPath, PHYSFS_ERR_NOT_FOUND, openReadEnd); - - for (i = searchPath; i != NULL; i = i->next) - { - char *arcfname = fname; - if (verifyPath(i, &arcfname, 0)) - { - io = i->funcs->openRead(i->opaque, arcfname); - if (io) - break; - } /* if */ - } /* for */ - - GOTO_IF_ERRPASS(!io, openReadEnd); - - fh = (FileHandle *) allocator.Malloc(sizeof (FileHandle)); - if (fh == NULL) - { - io->destroy(io); - GOTO(PHYSFS_ERR_OUT_OF_MEMORY, openReadEnd); - } /* if */ - - memset(fh, '\0', sizeof (FileHandle)); - fh->io = io; - fh->forReading = 1; - fh->dirHandle = i; - fh->next = openReadList; - openReadList = fh; - - openReadEnd: - __PHYSFS_platformReleaseMutex(stateLock); - } /* if */ - - __PHYSFS_smallFree(fname); - return ((PHYSFS_File *) fh); -} /* PHYSFS_openRead */ - - -static int closeHandleInOpenList(FileHandle **list, FileHandle *handle) -{ - FileHandle *prev = NULL; - FileHandle *i; - int rc = 1; - - for (i = *list; i != NULL; i = i->next) - { - if (i == handle) /* handle is in this list? */ - { - PHYSFS_Io *io = handle->io; - PHYSFS_uint8 *tmp = handle->buffer; - rc = PHYSFS_flush((PHYSFS_File *) handle); - if (!rc) - return -1; - io->destroy(io); - - if (tmp != NULL) /* free any associated buffer. */ - allocator.Free(tmp); - - if (prev == NULL) - *list = handle->next; - else - prev->next = handle->next; - - allocator.Free(handle); - return 1; - } /* if */ - prev = i; - } /* for */ - - return 0; -} /* closeHandleInOpenList */ - - -int PHYSFS_close(PHYSFS_File *_handle) -{ - FileHandle *handle = (FileHandle *) _handle; - int rc; - - __PHYSFS_platformGrabMutex(stateLock); - - /* -1 == close failure. 0 == not found. 1 == success. */ - rc = closeHandleInOpenList(&openReadList, handle); - BAIL_IF_MUTEX_ERRPASS(rc == -1, stateLock, 0); - if (!rc) - { - rc = closeHandleInOpenList(&openWriteList, handle); - BAIL_IF_MUTEX_ERRPASS(rc == -1, stateLock, 0); - } /* if */ - - __PHYSFS_platformReleaseMutex(stateLock); - BAIL_IF(!rc, PHYSFS_ERR_INVALID_ARGUMENT, 0); - return 1; -} /* PHYSFS_close */ - - -static PHYSFS_sint64 doBufferedRead(FileHandle *fh, void *_buffer, size_t len) -{ - PHYSFS_uint8 *buffer = (PHYSFS_uint8 *) _buffer; - PHYSFS_sint64 retval = 0; - - while (len > 0) - { - const size_t avail = fh->buffill - fh->bufpos; - if (avail > 0) /* data available in the buffer. */ - { - const size_t cpy = (len < avail) ? len : avail; - memcpy(buffer, fh->buffer + fh->bufpos, cpy); - assert(len >= cpy); - buffer += cpy; - len -= cpy; - fh->bufpos += cpy; - retval += cpy; - } /* if */ - - else /* buffer is empty, refill it. */ - { - PHYSFS_Io *io = fh->io; - const PHYSFS_sint64 rc = io->read(io, fh->buffer, fh->bufsize); - fh->bufpos = 0; - if (rc > 0) - fh->buffill = (size_t) rc; - else - { - fh->buffill = 0; - if (retval == 0) /* report already-read data, or failure. */ - retval = rc; - break; - } /* else */ - } /* else */ - } /* while */ - - return retval; -} /* doBufferedRead */ - - -PHYSFS_sint64 PHYSFS_read(PHYSFS_File *handle, void *buffer, - PHYSFS_uint32 size, PHYSFS_uint32 count) -{ - const PHYSFS_uint64 len = ((PHYSFS_uint64) size) * ((PHYSFS_uint64) count); - const PHYSFS_sint64 retval = PHYSFS_readBytes(handle, buffer, len); - return ( (retval <= 0) ? retval : (retval / ((PHYSFS_sint64) size)) ); -} /* PHYSFS_read */ - - -PHYSFS_sint64 PHYSFS_readBytes(PHYSFS_File *handle, void *buffer, - PHYSFS_uint64 _len) -{ - const size_t len = (size_t) _len; - FileHandle *fh = (FileHandle *) handle; - -#ifdef PHYSFS_NO_64BIT_SUPPORT - const PHYSFS_uint64 maxlen = __PHYSFS_UI64(0x7FFFFFFF); -#else - const PHYSFS_uint64 maxlen = __PHYSFS_UI64(0x7FFFFFFFFFFFFFFF); -#endif - - if (!__PHYSFS_ui64FitsAddressSpace(_len)) - BAIL(PHYSFS_ERR_INVALID_ARGUMENT, -1); - - BAIL_IF(_len > maxlen, PHYSFS_ERR_INVALID_ARGUMENT, -1); - BAIL_IF(!fh->forReading, PHYSFS_ERR_OPEN_FOR_WRITING, -1); - BAIL_IF_ERRPASS(len == 0, 0); - if (fh->buffer) - return doBufferedRead(fh, buffer, len); - - return fh->io->read(fh->io, buffer, len); -} /* PHYSFS_readBytes */ - - -static PHYSFS_sint64 doBufferedWrite(PHYSFS_File *handle, const void *buffer, - const size_t len) -{ - FileHandle *fh = (FileHandle *) handle; - - /* whole thing fits in the buffer? */ - if ((fh->buffill + len) < fh->bufsize) - { - memcpy(fh->buffer + fh->buffill, buffer, len); - fh->buffill += len; - return (PHYSFS_sint64) len; - } /* if */ - - /* would overflow buffer. Flush and then write the new objects, too. */ - BAIL_IF_ERRPASS(!PHYSFS_flush(handle), -1); - return fh->io->write(fh->io, buffer, len); -} /* doBufferedWrite */ - - -PHYSFS_sint64 PHYSFS_write(PHYSFS_File *handle, const void *buffer, - PHYSFS_uint32 size, PHYSFS_uint32 count) -{ - const PHYSFS_uint64 len = ((PHYSFS_uint64) size) * ((PHYSFS_uint64) count); - const PHYSFS_sint64 retval = PHYSFS_writeBytes(handle, buffer, len); - return ( (retval <= 0) ? retval : (retval / ((PHYSFS_sint64) size)) ); -} /* PHYSFS_write */ - - -PHYSFS_sint64 PHYSFS_writeBytes(PHYSFS_File *handle, const void *buffer, - PHYSFS_uint64 _len) -{ - const size_t len = (size_t) _len; - FileHandle *fh = (FileHandle *) handle; - -#ifdef PHYSFS_NO_64BIT_SUPPORT - const PHYSFS_uint64 maxlen = __PHYSFS_UI64(0x7FFFFFFF); -#else - const PHYSFS_uint64 maxlen = __PHYSFS_UI64(0x7FFFFFFFFFFFFFFF); -#endif - - if (!__PHYSFS_ui64FitsAddressSpace(_len)) - BAIL(PHYSFS_ERR_INVALID_ARGUMENT, -1); - - BAIL_IF(_len > maxlen, PHYSFS_ERR_INVALID_ARGUMENT, -1); - BAIL_IF(fh->forReading, PHYSFS_ERR_OPEN_FOR_READING, -1); - BAIL_IF_ERRPASS(len == 0, 0); - if (fh->buffer) - return doBufferedWrite(handle, buffer, len); - - return fh->io->write(fh->io, buffer, len); -} /* PHYSFS_write */ - - -int PHYSFS_eof(PHYSFS_File *handle) -{ - FileHandle *fh = (FileHandle *) handle; - - if (!fh->forReading) /* never EOF on files opened for write/append. */ - return 0; - - /* can't be eof if buffer isn't empty */ - if (fh->bufpos == fh->buffill) - { - /* check the Io. */ - PHYSFS_Io *io = fh->io; - const PHYSFS_sint64 pos = io->tell(io); - const PHYSFS_sint64 len = io->length(io); - if ((pos < 0) || (len < 0)) - return 0; /* beats me. */ - return (pos >= len); - } /* if */ - - return 0; -} /* PHYSFS_eof */ - - -PHYSFS_sint64 PHYSFS_tell(PHYSFS_File *handle) -{ - FileHandle *fh = (FileHandle *) handle; - const PHYSFS_sint64 pos = fh->io->tell(fh->io); - const PHYSFS_sint64 retval = fh->forReading ? - (pos - fh->buffill) + fh->bufpos : - (pos + fh->buffill); - return retval; -} /* PHYSFS_tell */ - - -int PHYSFS_seek(PHYSFS_File *handle, PHYSFS_uint64 pos) -{ - FileHandle *fh = (FileHandle *) handle; - BAIL_IF_ERRPASS(!PHYSFS_flush(handle), 0); - - if (fh->buffer && fh->forReading) - { - /* avoid throwing away our precious buffer if seeking within it. */ - PHYSFS_sint64 offset = pos - PHYSFS_tell(handle); - if ( /* seeking within the already-buffered range? */ - /* forward? */ - ((offset >= 0) && (((size_t)offset) <= fh->buffill-fh->bufpos)) || - /* backward? */ - ((offset < 0) && (((size_t) -offset) <= fh->bufpos)) ) - { - fh->bufpos = (size_t) (((PHYSFS_sint64) fh->bufpos) + offset); - return 1; /* successful seek */ - } /* if */ - } /* if */ - - /* we have to fall back to a 'raw' seek. */ - fh->buffill = fh->bufpos = 0; - return fh->io->seek(fh->io, pos); -} /* PHYSFS_seek */ - - -PHYSFS_sint64 PHYSFS_fileLength(PHYSFS_File *handle) -{ - PHYSFS_Io *io = ((FileHandle *) handle)->io; - return io->length(io); -} /* PHYSFS_filelength */ - - -int PHYSFS_setBuffer(PHYSFS_File *handle, PHYSFS_uint64 _bufsize) -{ - FileHandle *fh = (FileHandle *) handle; - const size_t bufsize = (size_t) _bufsize; - - if (!__PHYSFS_ui64FitsAddressSpace(_bufsize)) - BAIL(PHYSFS_ERR_INVALID_ARGUMENT, 0); - - BAIL_IF_ERRPASS(!PHYSFS_flush(handle), 0); - - /* - * For reads, we need to move the file pointer to where it would be - * if we weren't buffering, so that the next read will get the - * right chunk of stuff from the file. PHYSFS_flush() handles writes. - */ - if ((fh->forReading) && (fh->buffill != fh->bufpos)) - { - PHYSFS_uint64 pos; - const PHYSFS_sint64 curpos = fh->io->tell(fh->io); - BAIL_IF_ERRPASS(curpos == -1, 0); - pos = ((curpos - fh->buffill) + fh->bufpos); - BAIL_IF_ERRPASS(!fh->io->seek(fh->io, pos), 0); - } /* if */ - - if (bufsize == 0) /* delete existing buffer. */ - { - if (fh->buffer) - { - allocator.Free(fh->buffer); - fh->buffer = NULL; - } /* if */ - } /* if */ - - else - { - PHYSFS_uint8 *newbuf; - newbuf = (PHYSFS_uint8 *) allocator.Realloc(fh->buffer, bufsize); - BAIL_IF(!newbuf, PHYSFS_ERR_OUT_OF_MEMORY, 0); - fh->buffer = newbuf; - } /* else */ - - fh->bufsize = bufsize; - fh->buffill = fh->bufpos = 0; - return 1; -} /* PHYSFS_setBuffer */ - - -int PHYSFS_flush(PHYSFS_File *handle) -{ - FileHandle *fh = (FileHandle *) handle; - PHYSFS_Io *io; - PHYSFS_sint64 rc; - - if ((fh->forReading) || (fh->bufpos == fh->buffill)) - return 1; /* open for read or buffer empty are successful no-ops. */ - - /* dump buffer to disk. */ - io = fh->io; - rc = io->write(io, fh->buffer + fh->bufpos, fh->buffill - fh->bufpos); - BAIL_IF_ERRPASS(rc <= 0, 0); - fh->bufpos = fh->buffill = 0; - return io->flush ? io->flush(io) : 1; -} /* PHYSFS_flush */ - - -int PHYSFS_stat(const char *_fname, PHYSFS_Stat *stat) -{ - int retval = 0; - char *fname; - size_t len; - - BAIL_IF(!_fname, PHYSFS_ERR_INVALID_ARGUMENT, 0); - BAIL_IF(!stat, PHYSFS_ERR_INVALID_ARGUMENT, 0); - len = strlen(_fname) + 1; - fname = (char *) __PHYSFS_smallAlloc(len); - BAIL_IF(!fname, PHYSFS_ERR_OUT_OF_MEMORY, 0); - - /* set some sane defaults... */ - stat->filesize = -1; - stat->modtime = -1; - stat->createtime = -1; - stat->accesstime = -1; - stat->filetype = PHYSFS_FILETYPE_OTHER; - stat->readonly = 1; - - if (sanitizePlatformIndependentPath(_fname, fname)) - { - if (*fname == '\0') - { - stat->filetype = PHYSFS_FILETYPE_DIRECTORY; - stat->readonly = !writeDir; /* Writeable if we have a writeDir */ - retval = 1; - } /* if */ - else - { - DirHandle *i; - int exists = 0; - __PHYSFS_platformGrabMutex(stateLock); - for (i = searchPath; ((i != NULL) && (!exists)); i = i->next) - { - char *arcfname = fname; - exists = partOfMountPoint(i, arcfname); - if (exists) - { - stat->filetype = PHYSFS_FILETYPE_DIRECTORY; - stat->readonly = 1; - retval = 1; - } /* if */ - else if (verifyPath(i, &arcfname, 0)) - { - retval = i->funcs->stat(i->opaque, arcfname, stat); - if ((retval) || (currentErrorCode() != PHYSFS_ERR_NOT_FOUND)) - exists = 1; - } /* else if */ - } /* for */ - __PHYSFS_platformReleaseMutex(stateLock); - } /* else */ - } /* if */ - - __PHYSFS_smallFree(fname); - return retval; -} /* PHYSFS_stat */ - - -int __PHYSFS_readAll(PHYSFS_Io *io, void *buf, const size_t _len) -{ - const PHYSFS_uint64 len = (PHYSFS_uint64) _len; - return (io->read(io, buf, len) == len); -} /* __PHYSFS_readAll */ - - -void *__PHYSFS_initSmallAlloc(void *ptr, const size_t len) -{ - void *useHeap = ((ptr == NULL) ? ((void *) 1) : ((void *) 0)); - if (useHeap) /* too large for stack allocation or alloca() failed. */ - ptr = allocator.Malloc(len+sizeof (void *)); - - if (ptr != NULL) - { - void **retval = (void **) ptr; - /*printf("%s alloc'd (%lld) bytes at (%p).\n", - useHeap ? "heap" : "stack", (long long) len, ptr);*/ - *retval = useHeap; - return retval + 1; - } /* if */ - - return NULL; /* allocation failed. */ -} /* __PHYSFS_initSmallAlloc */ - - -void __PHYSFS_smallFree(void *ptr) -{ - if (ptr != NULL) - { - void **block = ((void **) ptr) - 1; - const int useHeap = (*block != NULL); - if (useHeap) - allocator.Free(block); - /*printf("%s free'd (%p).\n", useHeap ? "heap" : "stack", block);*/ - } /* if */ -} /* __PHYSFS_smallFree */ - - -int PHYSFS_setAllocator(const PHYSFS_Allocator *a) -{ - BAIL_IF(initialized, PHYSFS_ERR_IS_INITIALIZED, 0); - externalAllocator = (a != NULL); - if (externalAllocator) - memcpy(&allocator, a, sizeof (PHYSFS_Allocator)); - - return 1; -} /* PHYSFS_setAllocator */ - - -const PHYSFS_Allocator *PHYSFS_getAllocator(void) -{ - BAIL_IF(!initialized, PHYSFS_ERR_NOT_INITIALIZED, NULL); - return &allocator; -} /* PHYSFS_getAllocator */ - - -static void *mallocAllocatorMalloc(PHYSFS_uint64 s) -{ - if (!__PHYSFS_ui64FitsAddressSpace(s)) - BAIL(PHYSFS_ERR_OUT_OF_MEMORY, NULL); - #undef malloc - return malloc((size_t) s); -} /* mallocAllocatorMalloc */ - - -static void *mallocAllocatorRealloc(void *ptr, PHYSFS_uint64 s) -{ - if (!__PHYSFS_ui64FitsAddressSpace(s)) - BAIL(PHYSFS_ERR_OUT_OF_MEMORY, NULL); - #undef realloc - return realloc(ptr, (size_t) s); -} /* mallocAllocatorRealloc */ - - -static void mallocAllocatorFree(void *ptr) -{ - #undef free - free(ptr); -} /* mallocAllocatorFree */ - - -static void setDefaultAllocator(void) -{ - assert(!externalAllocator); - allocator.Init = NULL; - allocator.Deinit = NULL; - allocator.Malloc = mallocAllocatorMalloc; - allocator.Realloc = mallocAllocatorRealloc; - allocator.Free = mallocAllocatorFree; -} /* setDefaultAllocator */ - - -int __PHYSFS_DirTreeInit(__PHYSFS_DirTree *dt, const size_t entrylen) -{ - static char rootpath[2] = { '/', '\0' }; - size_t alloclen; - - assert(entrylen >= sizeof (__PHYSFS_DirTreeEntry)); - - memset(dt, '\0', sizeof (*dt)); - - dt->root = (__PHYSFS_DirTreeEntry *) allocator.Malloc(entrylen); - BAIL_IF(!dt->root, PHYSFS_ERR_OUT_OF_MEMORY, 0); - memset(dt->root, '\0', entrylen); - dt->root->name = rootpath; - dt->root->isdir = 1; - dt->hashBuckets = 64; - if (!dt->hashBuckets) - dt->hashBuckets = 1; - dt->entrylen = entrylen; - - alloclen = dt->hashBuckets * sizeof (__PHYSFS_DirTreeEntry *); - dt->hash = (__PHYSFS_DirTreeEntry **) allocator.Malloc(alloclen); - BAIL_IF(!dt->hash, PHYSFS_ERR_OUT_OF_MEMORY, 0); - memset(dt->hash, '\0', alloclen); - - return 1; -} /* __PHYSFS_DirTreeInit */ - - -static inline PHYSFS_uint32 hashPathName(__PHYSFS_DirTree *dt, const char *name) -{ - return __PHYSFS_hashString(name, strlen(name)) % dt->hashBuckets; -} /* hashPathName */ - - -/* Fill in missing parent directories. */ -static __PHYSFS_DirTreeEntry *addAncestors(__PHYSFS_DirTree *dt, char *name) -{ - __PHYSFS_DirTreeEntry *retval = dt->root; - char *sep = strrchr(name, '/'); - - if (sep) - { - *sep = '\0'; /* chop off last piece. */ - retval = (__PHYSFS_DirTreeEntry *) __PHYSFS_DirTreeFind(dt, name); - - if (retval != NULL) - { - *sep = '/'; - BAIL_IF(!retval->isdir, PHYSFS_ERR_CORRUPT, NULL); - return retval; /* already hashed. */ - } /* if */ - - /* okay, this is a new dir. Build and hash us. */ - retval = (__PHYSFS_DirTreeEntry*)__PHYSFS_DirTreeAdd(dt, name, 1); - *sep = '/'; - } /* if */ - - return retval; -} /* addAncestors */ - - -void *__PHYSFS_DirTreeAdd(__PHYSFS_DirTree *dt, char *name, const int isdir) -{ - __PHYSFS_DirTreeEntry *retval = __PHYSFS_DirTreeFind(dt, name); - if (!retval) - { - const size_t alloclen = strlen(name) + 1 + dt->entrylen; - PHYSFS_uint32 hashval; - __PHYSFS_DirTreeEntry *parent = addAncestors(dt, name); - BAIL_IF_ERRPASS(!parent, NULL); - assert(dt->entrylen >= sizeof (__PHYSFS_DirTreeEntry)); - retval = (__PHYSFS_DirTreeEntry *) allocator.Malloc(alloclen); - BAIL_IF(!retval, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - memset(retval, '\0', dt->entrylen); - retval->name = ((char *) retval) + dt->entrylen; - strcpy(retval->name, name); - hashval = hashPathName(dt, name); - retval->hashnext = dt->hash[hashval]; - dt->hash[hashval] = retval; - retval->sibling = parent->children; - retval->isdir = isdir; - parent->children = retval; - } /* if */ - - return retval; -} /* __PHYSFS_DirTreeAdd */ - - -/* Find the __PHYSFS_DirTreeEntry for a path in platform-independent notation. */ -void *__PHYSFS_DirTreeFind(__PHYSFS_DirTree *dt, const char *path) -{ - PHYSFS_uint32 hashval; - __PHYSFS_DirTreeEntry *prev = NULL; - __PHYSFS_DirTreeEntry *retval; - - if (*path == '\0') - return dt->root; - - hashval = hashPathName(dt, path); - for (retval = dt->hash[hashval]; retval; retval = retval->hashnext) - { - if (strcmp(retval->name, path) == 0) - { - if (prev != NULL) /* move this to the front of the list */ - { - prev->hashnext = retval->hashnext; - retval->hashnext = dt->hash[hashval]; - dt->hash[hashval] = retval; - } /* if */ - - return retval; - } /* if */ - - prev = retval; - } /* for */ - - BAIL(PHYSFS_ERR_NOT_FOUND, NULL); -} /* __PHYSFS_DirTreeFind */ - -PHYSFS_EnumerateCallbackResult __PHYSFS_DirTreeEnumerate(void *opaque, - const char *dname, PHYSFS_EnumerateCallback cb, - const char *origdir, void *callbackdata) -{ - PHYSFS_EnumerateCallbackResult retval = PHYSFS_ENUM_OK; - __PHYSFS_DirTree *tree = (__PHYSFS_DirTree *) opaque; - const __PHYSFS_DirTreeEntry *entry = __PHYSFS_DirTreeFind(tree, dname); - BAIL_IF(!entry, PHYSFS_ERR_NOT_FOUND, PHYSFS_ENUM_ERROR); - - entry = entry->children; - - while (entry && (retval == PHYSFS_ENUM_OK)) - { - const char *name = entry->name; - const char *ptr = strrchr(name, '/'); - retval = cb(callbackdata, origdir, ptr ? ptr + 1 : name); - BAIL_IF(retval == PHYSFS_ENUM_ERROR, PHYSFS_ERR_APP_CALLBACK, retval); - entry = entry->sibling; - } /* while */ - - return retval; -} /* __PHYSFS_DirTreeEnumerate */ - - -void __PHYSFS_DirTreeDeinit(__PHYSFS_DirTree *dt) -{ - if (!dt) - return; - - if (dt->root) - { - assert(dt->root->sibling == NULL); - assert(dt->hash || (dt->root->children == NULL)); - allocator.Free(dt->root); - } /* if */ - - if (dt->hash) - { - size_t i; - for (i = 0; i < dt->hashBuckets; i++) - { - __PHYSFS_DirTreeEntry *entry; - __PHYSFS_DirTreeEntry *next; - for (entry = dt->hash[i]; entry; entry = next) - { - next = entry->hashnext; - allocator.Free(entry); - } /* for */ - } /* for */ - allocator.Free(dt->hash); - } /* if */ -} /* __PHYSFS_DirTreeDeinit */ - -/* end of physfs.c ... */ - diff --git a/love/src/jni/love/src/libraries/physfs/physfs.h b/love/src/jni/love/src/libraries/physfs/physfs.h deleted file mode 100644 index 91696075..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs.h +++ /dev/null @@ -1,3854 +0,0 @@ -/** - * \file physfs.h - * - * Main header file for PhysicsFS. - */ - -/** - * \mainpage PhysicsFS - * - * The latest version of PhysicsFS can be found at: - * https://icculus.org/physfs/ - * - * PhysicsFS; a portable, flexible file i/o abstraction. - * - * This API gives you access to a system file system in ways superior to the - * stdio or system i/o calls. The brief benefits: - * - * - It's portable. - * - It's safe. No file access is permitted outside the specified dirs. - * - It's flexible. Archives (.ZIP files) can be used transparently as - * directory structures. - * - * With PhysicsFS, you have a single writing directory and multiple - * directories (the "search path") for reading. You can think of this as a - * filesystem within a filesystem. If (on Windows) you were to set the - * writing directory to "C:\MyGame\MyWritingDirectory", then no PHYSFS calls - * could touch anything above this directory, including the "C:\MyGame" and - * "C:\" directories. This prevents an application's internal scripting - * language from piddling over c:\\config.sys, for example. If you'd rather - * give PHYSFS full access to the system's REAL file system, set the writing - * dir to "C:\", but that's generally A Bad Thing for several reasons. - * - * Drive letters are hidden in PhysicsFS once you set up your initial paths. - * The search path creates a single, hierarchical directory structure. - * Not only does this lend itself well to general abstraction with archives, - * it also gives better support to operating systems like MacOS and Unix. - * Generally speaking, you shouldn't ever hardcode a drive letter; not only - * does this hurt portability to non-Microsoft OSes, but it limits your win32 - * users to a single drive, too. Use the PhysicsFS abstraction functions and - * allow user-defined configuration options, too. When opening a file, you - * specify it like it was on a Unix filesystem: if you want to write to - * "C:\MyGame\MyConfigFiles\game.cfg", then you might set the write dir to - * "C:\MyGame" and then open "MyConfigFiles/game.cfg". This gives an - * abstraction across all platforms. Specifying a file in this way is termed - * "platform-independent notation" in this documentation. Specifying a - * a filename in a form such as "C:\mydir\myfile" or - * "MacOS hard drive:My Directory:My File" is termed "platform-dependent - * notation". The only time you use platform-dependent notation is when - * setting up your write directory and search path; after that, all file - * access into those directories are done with platform-independent notation. - * - * All files opened for writing are opened in relation to the write directory, - * which is the root of the writable filesystem. When opening a file for - * reading, PhysicsFS goes through the search path. This is NOT the - * same thing as the PATH environment variable. An application using - * PhysicsFS specifies directories to be searched which may be actual - * directories, or archive files that contain files and subdirectories of - * their own. See the end of these docs for currently supported archive - * formats. - * - * Once the search path is defined, you may open files for reading. If you've - * got the following search path defined (to use a win32 example again): - * - * - C:\\mygame - * - C:\\mygame\\myuserfiles - * - D:\\mygamescdromdatafiles - * - C:\\mygame\\installeddatafiles.zip - * - * Then a call to PHYSFS_openRead("textfiles/myfile.txt") (note the directory - * separator, lack of drive letter, and lack of dir separator at the start of - * the string; this is platform-independent notation) will check for - * C:\\mygame\\textfiles\\myfile.txt, then - * C:\\mygame\\myuserfiles\\textfiles\\myfile.txt, then - * D:\\mygamescdromdatafiles\\textfiles\\myfile.txt, then, finally, for - * textfiles\\myfile.txt inside of C:\\mygame\\installeddatafiles.zip. - * Remember that most archive types and platform filesystems store their - * filenames in a case-sensitive manner, so you should be careful to specify - * it correctly. - * - * Files opened through PhysicsFS may NOT contain "." or ".." or ":" as dir - * elements. Not only are these meaningless on MacOS Classic and/or Unix, - * they are a security hole. Also, symbolic links (which can be found in - * some archive types and directly in the filesystem on Unix platforms) are - * NOT followed until you call PHYSFS_permitSymbolicLinks(). That's left to - * your own discretion, as following a symlink can allow for access outside - * the write dir and search paths. For portability, there is no mechanism for - * creating new symlinks in PhysicsFS. - * - * The write dir is not included in the search path unless you specifically - * add it. While you CAN change the write dir as many times as you like, - * you should probably set it once and stick to it. Remember that your - * program will not have permission to write in every directory on Unix and - * NT systems. - * - * All files are opened in binary mode; there is no endline conversion for - * textfiles. Other than that, PhysicsFS has some convenience functions for - * platform-independence. There is a function to tell you the current - * platform's dir separator ("\\" on windows, "/" on Unix, ":" on MacOS), - * which is needed only to set up your search/write paths. There is a - * function to tell you what CD-ROM drives contain accessible discs, and a - * function to recommend a good search path, etc. - * - * A recommended order for the search path is the write dir, then the base dir, - * then the cdrom dir, then any archives discovered. Quake 3 does something - * like this, but moves the archives to the start of the search path. Build - * Engine games, like Duke Nukem 3D and Blood, place the archives last, and - * use the base dir for both searching and writing. There is a helper - * function (PHYSFS_setSaneConfig()) that puts together a basic configuration - * for you, based on a few parameters. Also see the comments on - * PHYSFS_getBaseDir(), and PHYSFS_getPrefDir() for info on what those - * are and how they can help you determine an optimal search path. - * - * PhysicsFS 2.0 adds the concept of "mounting" archives to arbitrary points - * in the search path. If a zipfile contains "maps/level.map" and you mount - * that archive at "mods/mymod", then you would have to open - * "mods/mymod/maps/level.map" to access the file, even though "mods/mymod" - * isn't actually specified in the .zip file. Unlike the Unix mentality of - * mounting a filesystem, "mods/mymod" doesn't actually have to exist when - * mounting the zipfile. It's a "virtual" directory. The mounting mechanism - * allows the developer to seperate archives in the tree and avoid trampling - * over files when added new archives, such as including mod support in a - * game...keeping external content on a tight leash in this manner can be of - * utmost importance to some applications. - * - * PhysicsFS is mostly thread safe. The errors returned by - * PHYSFS_getLastErrorCode() are unique by thread, and library-state-setting - * functions are mutex'd. For efficiency, individual file accesses are - * not locked, so you can not safely read/write/seek/close/etc the same - * file from two threads at the same time. Other race conditions are bugs - * that should be reported/patched. - * - * While you CAN use stdio/syscall file access in a program that has PHYSFS_* - * calls, doing so is not recommended, and you can not directly use system - * filehandles with PhysicsFS and vice versa (but as of PhysicsFS 2.1, you - * can wrap them in a PHYSFS_Io interface yourself if you wanted to). - * - * Note that archives need not be named as such: if you have a ZIP file and - * rename it with a .PKG extension, the file will still be recognized as a - * ZIP archive by PhysicsFS; the file's contents are used to determine its - * type where possible. - * - * Currently supported archive types: - * - .ZIP (pkZip/WinZip/Info-ZIP compatible) - * - .7Z (7zip archives) - * - .ISO (ISO9660 files, CD-ROM images) - * - .GRP (Build Engine groupfile archives) - * - .PAK (Quake I/II archive format) - * - .HOG (Descent I/II HOG file archives) - * - .MVL (Descent II movielib archives) - * - .WAD (DOOM engine archives) - * - .VDF (Gothic I/II engine archives) - * - .SLB (Independence War archives) - * - * String policy for PhysicsFS 2.0 and later: - * - * PhysicsFS 1.0 could only deal with null-terminated ASCII strings. All high - * ASCII chars resulted in undefined behaviour, and there was no Unicode - * support at all. PhysicsFS 2.0 supports Unicode without breaking binary - * compatibility with the 1.0 API by using UTF-8 encoding of all strings - * passed in and out of the library. - * - * All strings passed through PhysicsFS are in null-terminated UTF-8 format. - * This means that if all you care about is English (ASCII characters <= 127) - * then you just use regular C strings. If you care about Unicode (and you - * should!) then you need to figure out what your platform wants, needs, and - * offers. If you are on Windows before Win2000 and build with Unicode - * support, your TCHAR strings are two bytes per character (this is called - * "UCS-2 encoding"). Any modern Windows uses UTF-16, which is two bytes - * per character for most characters, but some characters are four. You - * should convert them to UTF-8 before handing them to PhysicsFS with - * PHYSFS_utf8FromUtf16(), which handles both UTF-16 and UCS-2. If you're - * using Unix or Mac OS X, your wchar_t strings are four bytes per character - * ("UCS-4 encoding", sometimes called "UTF-32"). Use PHYSFS_utf8FromUcs4(). - * Mac OS X can give you UTF-8 directly from a CFString or NSString, and many - * Unixes generally give you C strings in UTF-8 format everywhere. If you - * have a single-byte high ASCII charset, like so-many European "codepages" - * you may be out of luck. We'll convert from "Latin1" to UTF-8 only, and - * never back to Latin1. If you're above ASCII 127, all bets are off: move - * to Unicode or use your platform's facilities. Passing a C string with - * high-ASCII data that isn't UTF-8 encoded will NOT do what you expect! - * - * Naturally, there's also PHYSFS_utf8ToUcs2(), PHYSFS_utf8ToUtf16(), and - * PHYSFS_utf8ToUcs4() to get data back into a format you like. Behind the - * scenes, PhysicsFS will use Unicode where possible: the UTF-8 strings on - * Windows will be converted and used with the multibyte Windows APIs, for - * example. - * - * PhysicsFS offers basic encoding conversion support, but not a whole string - * library. Get your stuff into whatever format you can work with. - * - * Most platforms supported by PhysicsFS 2.1 and later fully support Unicode. - * Some older platforms have been dropped (Windows 95, Mac OS 9). Some, like - * OS/2, might be able to convert to a local codepage or will just fail to - * open/create the file. Modern OSes (macOS, Linux, Windows, etc) should all - * be fine. - * - * Many game-specific archivers are seriously unprepared for Unicode (the - * Descent HOG/MVL and Build Engine GRP archivers, for example, only offer a - * DOS 8.3 filename, for example). Nothing can be done for these, but they - * tend to be legacy formats for existing content that was all ASCII (and - * thus, valid UTF-8) anyhow. Other formats, like .ZIP, don't explicitly - * offer Unicode support, but unofficially expect filenames to be UTF-8 - * encoded, and thus Just Work. Most everything does the right thing without - * bothering you, but it's good to be aware of these nuances in case they - * don't. - * - * - * Other stuff: - * - * Please see the file LICENSE.txt in the source's root directory for - * licensing and redistribution rights. - * - * Please see the file CREDITS.txt in the source's "docs" directory for - * a more or less complete list of who's responsible for this. - * - * \author Ryan C. Gordon. - */ - -#ifndef _INCLUDE_PHYSFS_H_ -#define _INCLUDE_PHYSFS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(PHYSFS_DECL) -/* do nothing. */ -#elif (defined _MSC_VER) -#define PHYSFS_DECL __declspec(dllexport) -#elif (defined __SUNPRO_C) -#define PHYSFS_DECL __global -#elif ((__GNUC__ >= 3) && (!__EMX__) && (!sun)) -#define PHYSFS_DECL __attribute__((visibility("default"))) -#else -#define PHYSFS_DECL -#endif - -#if defined(PHYSFS_DEPRECATED) -/* do nothing. */ -#elif (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ -#define PHYSFS_DEPRECATED __attribute__((deprecated)) -#else -#define PHYSFS_DEPRECATED -#endif - -#if 0 /* !!! FIXME: look into this later. */ -#if defined(PHYSFS_CALL) -/* do nothing. */ -#elif defined(__WIN32__) && !defined(__GNUC__) -#define PHYSFS_CALL __cdecl -#elif defined(__OS2__) || defined(OS2) /* should work across all compilers. */ -#define PHYSFS_CALL _System -#else -#define PHYSFS_CALL -#endif -#endif - -/** - * \typedef PHYSFS_uint8 - * \brief An unsigned, 8-bit integer type. - */ -typedef unsigned char PHYSFS_uint8; - -/** - * \typedef PHYSFS_sint8 - * \brief A signed, 8-bit integer type. - */ -typedef signed char PHYSFS_sint8; - -/** - * \typedef PHYSFS_uint16 - * \brief An unsigned, 16-bit integer type. - */ -typedef unsigned short PHYSFS_uint16; - -/** - * \typedef PHYSFS_sint16 - * \brief A signed, 16-bit integer type. - */ -typedef signed short PHYSFS_sint16; - -/** - * \typedef PHYSFS_uint32 - * \brief An unsigned, 32-bit integer type. - */ -typedef unsigned int PHYSFS_uint32; - -/** - * \typedef PHYSFS_sint32 - * \brief A signed, 32-bit integer type. - */ -typedef signed int PHYSFS_sint32; - -/** - * \typedef PHYSFS_uint64 - * \brief An unsigned, 64-bit integer type. - * \warning on platforms without any sort of 64-bit datatype, this is - * equivalent to PHYSFS_uint32! - */ - -/** - * \typedef PHYSFS_sint64 - * \brief A signed, 64-bit integer type. - * \warning on platforms without any sort of 64-bit datatype, this is - * equivalent to PHYSFS_sint32! - */ - - -#if (defined PHYSFS_NO_64BIT_SUPPORT) /* oh well. */ -typedef PHYSFS_uint32 PHYSFS_uint64; -typedef PHYSFS_sint32 PHYSFS_sint64; -#elif (defined _MSC_VER) -typedef signed __int64 PHYSFS_sint64; -typedef unsigned __int64 PHYSFS_uint64; -#else -typedef unsigned long long PHYSFS_uint64; -typedef signed long long PHYSFS_sint64; -#endif - - -#ifndef DOXYGEN_SHOULD_IGNORE_THIS -/* Make sure the types really have the right sizes */ -#define PHYSFS_COMPILE_TIME_ASSERT(name, x) \ - typedef int PHYSFS_compile_time_assert_##name[(x) * 2 - 1] - -PHYSFS_COMPILE_TIME_ASSERT(uint8IsOneByte, sizeof(PHYSFS_uint8) == 1); -PHYSFS_COMPILE_TIME_ASSERT(sint8IsOneByte, sizeof(PHYSFS_sint8) == 1); -PHYSFS_COMPILE_TIME_ASSERT(uint16IsTwoBytes, sizeof(PHYSFS_uint16) == 2); -PHYSFS_COMPILE_TIME_ASSERT(sint16IsTwoBytes, sizeof(PHYSFS_sint16) == 2); -PHYSFS_COMPILE_TIME_ASSERT(uint32IsFourBytes, sizeof(PHYSFS_uint32) == 4); -PHYSFS_COMPILE_TIME_ASSERT(sint32IsFourBytes, sizeof(PHYSFS_sint32) == 4); - -#ifndef PHYSFS_NO_64BIT_SUPPORT -PHYSFS_COMPILE_TIME_ASSERT(uint64IsEightBytes, sizeof(PHYSFS_uint64) == 8); -PHYSFS_COMPILE_TIME_ASSERT(sint64IsEightBytes, sizeof(PHYSFS_sint64) == 8); -#endif - -#undef PHYSFS_COMPILE_TIME_ASSERT - -#endif /* DOXYGEN_SHOULD_IGNORE_THIS */ - - -/** - * \struct PHYSFS_File - * \brief A PhysicsFS file handle. - * - * You get a pointer to one of these when you open a file for reading, - * writing, or appending via PhysicsFS. - * - * As you can see from the lack of meaningful fields, you should treat this - * as opaque data. Don't try to manipulate the file handle, just pass the - * pointer you got, unmolested, to various PhysicsFS APIs. - * - * \sa PHYSFS_openRead - * \sa PHYSFS_openWrite - * \sa PHYSFS_openAppend - * \sa PHYSFS_close - * \sa PHYSFS_read - * \sa PHYSFS_write - * \sa PHYSFS_seek - * \sa PHYSFS_tell - * \sa PHYSFS_eof - * \sa PHYSFS_setBuffer - * \sa PHYSFS_flush - */ -typedef struct PHYSFS_File -{ - void *opaque; /**< That's all you get. Don't touch. */ -} PHYSFS_File; - - -/** - * \def PHYSFS_file - * \brief 1.0 API compatibility define. - * - * PHYSFS_file is identical to PHYSFS_File. This #define is here for backwards - * compatibility with the 1.0 API, which had an inconsistent capitalization - * convention in this case. New code should use PHYSFS_File, as this #define - * may go away someday. - * - * \sa PHYSFS_File - */ -#define PHYSFS_file PHYSFS_File - - -/** - * \struct PHYSFS_ArchiveInfo - * \brief Information on various PhysicsFS-supported archives. - * - * This structure gives you details on what sort of archives are supported - * by this implementation of PhysicsFS. Archives tend to be things like - * ZIP files and such. - * - * \warning Not all binaries are created equal! PhysicsFS can be built with - * or without support for various archives. You can check with - * PHYSFS_supportedArchiveTypes() to see if your archive type is - * supported. - * - * \sa PHYSFS_supportedArchiveTypes - * \sa PHYSFS_registerArchiver - * \sa PHYSFS_deregisterArchiver - */ -typedef struct PHYSFS_ArchiveInfo -{ - const char *extension; /**< Archive file extension: "ZIP", for example. */ - const char *description; /**< Human-readable archive description. */ - const char *author; /**< Person who did support for this archive. */ - const char *url; /**< URL related to this archive */ - int supportsSymlinks; /**< non-zero if archive offers symbolic links. */ -} PHYSFS_ArchiveInfo; - - -/** - * \struct PHYSFS_Version - * \brief Information the version of PhysicsFS in use. - * - * Represents the library's version as three levels: major revision - * (increments with massive changes, additions, and enhancements), - * minor revision (increments with backwards-compatible changes to the - * major revision), and patchlevel (increments with fixes to the minor - * revision). - * - * \sa PHYSFS_VERSION - * \sa PHYSFS_getLinkedVersion - */ -typedef struct PHYSFS_Version -{ - PHYSFS_uint8 major; /**< major revision */ - PHYSFS_uint8 minor; /**< minor revision */ - PHYSFS_uint8 patch; /**< patchlevel */ -} PHYSFS_Version; - - -#ifndef DOXYGEN_SHOULD_IGNORE_THIS -#define PHYSFS_VER_MAJOR 3 -#define PHYSFS_VER_MINOR 0 -#define PHYSFS_VER_PATCH 1 -#endif /* DOXYGEN_SHOULD_IGNORE_THIS */ - - -/* PhysicsFS state stuff ... */ - -/** - * \def PHYSFS_VERSION(x) - * \brief Macro to determine PhysicsFS version program was compiled against. - * - * This macro fills in a PHYSFS_Version structure with the version of the - * library you compiled against. This is determined by what header the - * compiler uses. Note that if you dynamically linked the library, you might - * have a slightly newer or older version at runtime. That version can be - * determined with PHYSFS_getLinkedVersion(), which, unlike PHYSFS_VERSION, - * is not a macro. - * - * \param x A pointer to a PHYSFS_Version struct to initialize. - * - * \sa PHYSFS_Version - * \sa PHYSFS_getLinkedVersion - */ -#define PHYSFS_VERSION(x) \ -{ \ - (x)->major = PHYSFS_VER_MAJOR; \ - (x)->minor = PHYSFS_VER_MINOR; \ - (x)->patch = PHYSFS_VER_PATCH; \ -} - - -/** - * \fn void PHYSFS_getLinkedVersion(PHYSFS_Version *ver) - * \brief Get the version of PhysicsFS that is linked against your program. - * - * If you are using a shared library (DLL) version of PhysFS, then it is - * possible that it will be different than the version you compiled against. - * - * This is a real function; the macro PHYSFS_VERSION tells you what version - * of PhysFS you compiled against: - * - * \code - * PHYSFS_Version compiled; - * PHYSFS_Version linked; - * - * PHYSFS_VERSION(&compiled); - * PHYSFS_getLinkedVersion(&linked); - * printf("We compiled against PhysFS version %d.%d.%d ...\n", - * compiled.major, compiled.minor, compiled.patch); - * printf("But we linked against PhysFS version %d.%d.%d.\n", - * linked.major, linked.minor, linked.patch); - * \endcode - * - * This function may be called safely at any time, even before PHYSFS_init(). - * - * \sa PHYSFS_VERSION - */ -PHYSFS_DECL void PHYSFS_getLinkedVersion(PHYSFS_Version *ver); - - -/** - * \fn int PHYSFS_init(const char *argv0) - * \brief Initialize the PhysicsFS library. - * - * This must be called before any other PhysicsFS function. - * - * This should be called prior to any attempts to change your process's - * current working directory. - * - * \param argv0 the argv[0] string passed to your program's mainline. - * This may be NULL on most platforms (such as ones without a - * standard main() function), but you should always try to pass - * something in here. Unix-like systems such as Linux _need_ to - * pass argv[0] from main() in here. - * \return nonzero on success, zero on error. Specifics of the error can be - * gleaned from PHYSFS_getLastError(). - * - * \sa PHYSFS_deinit - * \sa PHYSFS_isInit - */ -PHYSFS_DECL int PHYSFS_init(const char *argv0); - - -/** - * \fn int PHYSFS_deinit(void) - * \brief Deinitialize the PhysicsFS library. - * - * This closes any files opened via PhysicsFS, blanks the search/write paths, - * frees memory, and invalidates all of your file handles. - * - * Note that this call can FAIL if there's a file open for writing that - * refuses to close (for example, the underlying operating system was - * buffering writes to network filesystem, and the fileserver has crashed, - * or a hard drive has failed, etc). It is usually best to close all write - * handles yourself before calling this function, so that you can gracefully - * handle a specific failure. - * - * Once successfully deinitialized, PHYSFS_init() can be called again to - * restart the subsystem. All default API states are restored at this - * point, with the exception of any custom allocator you might have - * specified, which survives between initializations. - * - * \return nonzero on success, zero on error. Specifics of the error can be - * gleaned from PHYSFS_getLastError(). If failure, state of PhysFS is - * undefined, and probably badly screwed up. - * - * \sa PHYSFS_init - * \sa PHYSFS_isInit - */ -PHYSFS_DECL int PHYSFS_deinit(void); - - -/** - * \fn const PHYSFS_ArchiveInfo **PHYSFS_supportedArchiveTypes(void) - * \brief Get a list of supported archive types. - * - * Get a list of archive types supported by this implementation of PhysicFS. - * These are the file formats usable for search path entries. This is for - * informational purposes only. Note that the extension listed is merely - * convention: if we list "ZIP", you can open a PkZip-compatible archive - * with an extension of "XYZ", if you like. - * - * The returned value is an array of pointers to PHYSFS_ArchiveInfo structures, - * with a NULL entry to signify the end of the list: - * - * \code - * PHYSFS_ArchiveInfo **i; - * - * for (i = PHYSFS_supportedArchiveTypes(); *i != NULL; i++) - * { - * printf("Supported archive: [%s], which is [%s].\n", - * (*i)->extension, (*i)->description); - * } - * \endcode - * - * The return values are pointers to internal memory, and should - * be considered READ ONLY, and never freed. The returned values are - * valid until the next call to PHYSFS_deinit(), PHYSFS_registerArchiver(), - * or PHYSFS_deregisterArchiver(). - * - * \return READ ONLY Null-terminated array of READ ONLY structures. - * - * \sa PHYSFS_registerArchiver - * \sa PHYSFS_deregisterArchiver - */ -PHYSFS_DECL const PHYSFS_ArchiveInfo **PHYSFS_supportedArchiveTypes(void); - - -/** - * \fn void PHYSFS_freeList(void *listVar) - * \brief Deallocate resources of lists returned by PhysicsFS. - * - * Certain PhysicsFS functions return lists of information that are - * dynamically allocated. Use this function to free those resources. - * - * It is safe to pass a NULL here, but doing so will cause a crash in versions - * before PhysicsFS 2.1.0. - * - * \param listVar List of information specified as freeable by this function. - * Passing NULL is safe; it is a valid no-op. - * - * \sa PHYSFS_getCdRomDirs - * \sa PHYSFS_enumerateFiles - * \sa PHYSFS_getSearchPath - */ -PHYSFS_DECL void PHYSFS_freeList(void *listVar); - - -/** - * \fn const char *PHYSFS_getLastError(void) - * \brief Get human-readable error information. - * - * \deprecated Use PHYSFS_getLastErrorCode() and PHYSFS_getErrorByCode() instead. - * - * \warning As of PhysicsFS 2.1, this function has been nerfed. - * Before PhysicsFS 2.1, this function was the only way to get - * error details beyond a given function's basic return value. - * This was meant to be a human-readable string in one of several - * languages, and was not useful for application parsing. This was - * a problem, because the developer and not the user chose the - * language at compile time, and the PhysicsFS maintainers had - * to (poorly) maintain a significant amount of localization work. - * The app couldn't parse the strings, even if they counted on a - * specific language, since some were dynamically generated. - * In 2.1 and later, this always returns a static string in - * English; you may use it as a key string for your own - * localizations if you like, as we'll promise not to change - * existing error strings. Also, if your application wants to - * look at specific errors, we now offer a better option: - * use PHYSFS_getLastErrorCode() instead. - * - * Get the last PhysicsFS error message as a human-readable, null-terminated - * string. This will return NULL if there's been no error since the last call - * to this function. The pointer returned by this call points to an internal - * buffer. Each thread has a unique error state associated with it, but each - * time a new error message is set, it will overwrite the previous one - * associated with that thread. It is safe to call this function at anytime, - * even before PHYSFS_init(). - * - * PHYSFS_getLastError() and PHYSFS_getLastErrorCode() both reset the same - * thread-specific error state. Calling one will wipe out the other's - * data. If you need both, call PHYSFS_getLastErrorCode(), then pass that - * value to PHYSFS_getErrorByCode(). - * - * As of PhysicsFS 2.1, this function only presents text in the English - * language, but the strings are static, so you can use them as keys into - * your own localization dictionary. These strings are meant to be passed on - * directly to the user. - * - * Generally, applications should only concern themselves with whether a - * given function failed; however, if your code require more specifics, you - * should use PHYSFS_getLastErrorCode() instead of this function. - * - * \return READ ONLY string of last error message. - * - * \sa PHYSFS_getLastErrorCode - * \sa PHYSFS_getErrorByCode - */ -PHYSFS_DECL const char *PHYSFS_getLastError(void) PHYSFS_DEPRECATED; - - -/** - * \fn const char *PHYSFS_getDirSeparator(void) - * \brief Get platform-dependent dir separator string. - * - * This returns "\\" on win32, "/" on Unix, and ":" on MacOS. It may be more - * than one character, depending on the platform, and your code should take - * that into account. Note that this is only useful for setting up the - * search/write paths, since access into those dirs always use '/' - * (platform-independent notation) to separate directories. This is also - * handy for getting platform-independent access when using stdio calls. - * - * \return READ ONLY null-terminated string of platform's dir separator. - */ -PHYSFS_DECL const char *PHYSFS_getDirSeparator(void); - - -/** - * \fn void PHYSFS_permitSymbolicLinks(int allow) - * \brief Enable or disable following of symbolic links. - * - * Some physical filesystems and archives contain files that are just pointers - * to other files. On the physical filesystem, opening such a link will - * (transparently) open the file that is pointed to. - * - * By default, PhysicsFS will check if a file is really a symlink during open - * calls and fail if it is. Otherwise, the link could take you outside the - * write and search paths, and compromise security. - * - * If you want to take that risk, call this function with a non-zero parameter. - * Note that this is more for sandboxing a program's scripting language, in - * case untrusted scripts try to compromise the system. Generally speaking, - * a user could very well have a legitimate reason to set up a symlink, so - * unless you feel there's a specific danger in allowing them, you should - * permit them. - * - * Symlinks are only explicitly checked when dealing with filenames - * in platform-independent notation. That is, when setting up your - * search and write paths, etc, symlinks are never checked for. - * - * Please note that PHYSFS_stat() will always check the path specified; if - * that path is a symlink, it will not be followed in any case. If symlinks - * aren't permitted through this function, PHYSFS_stat() ignores them, and - * would treat the query as if the path didn't exist at all. - * - * Symbolic link permission can be enabled or disabled at any time after - * you've called PHYSFS_init(), and is disabled by default. - * - * \param allow nonzero to permit symlinks, zero to deny linking. - * - * \sa PHYSFS_symbolicLinksPermitted - */ -PHYSFS_DECL void PHYSFS_permitSymbolicLinks(int allow); - - -/** - * \fn char **PHYSFS_getCdRomDirs(void) - * \brief Get an array of paths to available CD-ROM drives. - * - * The dirs returned are platform-dependent ("D:\" on Win32, "/cdrom" or - * whatnot on Unix). Dirs are only returned if there is a disc ready and - * accessible in the drive. So if you've got two drives (D: and E:), and only - * E: has a disc in it, then that's all you get. If the user inserts a disc - * in D: and you call this function again, you get both drives. If, on a - * Unix box, the user unmounts a disc and remounts it elsewhere, the next - * call to this function will reflect that change. - * - * This function refers to "CD-ROM" media, but it really means "inserted disc - * media," such as DVD-ROM, HD-DVD, CDRW, and Blu-Ray discs. It looks for - * filesystems, and as such won't report an audio CD, unless there's a - * mounted filesystem track on it. - * - * The returned value is an array of strings, with a NULL entry to signify the - * end of the list: - * - * \code - * char **cds = PHYSFS_getCdRomDirs(); - * char **i; - * - * for (i = cds; *i != NULL; i++) - * printf("cdrom dir [%s] is available.\n", *i); - * - * PHYSFS_freeList(cds); - * \endcode - * - * This call may block while drives spin up. Be forewarned. - * - * When you are done with the returned information, you may dispose of the - * resources by calling PHYSFS_freeList() with the returned pointer. - * - * \return Null-terminated array of null-terminated strings. - * - * \sa PHYSFS_getCdRomDirsCallback - */ -PHYSFS_DECL char **PHYSFS_getCdRomDirs(void); - - -/** - * \fn const char *PHYSFS_getBaseDir(void) - * \brief Get the path where the application resides. - * - * Helper function. - * - * Get the "base dir". This is the directory where the application was run - * from, which is probably the installation directory, and may or may not - * be the process's current working directory. - * - * You should probably use the base dir in your search path. - * - * \return READ ONLY string of base dir in platform-dependent notation. - * - * \sa PHYSFS_getPrefDir - */ -PHYSFS_DECL const char *PHYSFS_getBaseDir(void); - - -/** - * \fn const char *PHYSFS_getUserDir(void) - * \brief Get the path where user's home directory resides. - * - * \deprecated As of PhysicsFS 2.1, you probably want PHYSFS_getPrefDir(). - * - * Helper function. - * - * Get the "user dir". This is meant to be a suggestion of where a specific - * user of the system can store files. On Unix, this is her home directory. - * On systems with no concept of multiple home directories (MacOS, win95), - * this will default to something like "C:\mybasedir\users\username" - * where "username" will either be the login name, or "default" if the - * platform doesn't support multiple users, either. - * - * \return READ ONLY string of user dir in platform-dependent notation. - * - * \sa PHYSFS_getBaseDir - * \sa PHYSFS_getPrefDir - */ -PHYSFS_DECL const char *PHYSFS_getUserDir(void) PHYSFS_DEPRECATED; - - -/** - * \fn const char *PHYSFS_getWriteDir(void) - * \brief Get path where PhysicsFS will allow file writing. - * - * Get the current write dir. The default write dir is NULL. - * - * \return READ ONLY string of write dir in platform-dependent notation, - * OR NULL IF NO WRITE PATH IS CURRENTLY SET. - * - * \sa PHYSFS_setWriteDir - */ -PHYSFS_DECL const char *PHYSFS_getWriteDir(void); - - -/** - * \fn int PHYSFS_setWriteDir(const char *newDir) - * \brief Tell PhysicsFS where it may write files. - * - * Set a new write dir. This will override the previous setting. - * - * This call will fail (and fail to change the write dir) if the current - * write dir still has files open in it. - * - * \param newDir The new directory to be the root of the write dir, - * specified in platform-dependent notation. Setting to NULL - * disables the write dir, so no files can be opened for - * writing via PhysicsFS. - * \return non-zero on success, zero on failure. All attempts to open a file - * for writing via PhysicsFS will fail until this call succeeds. - * Use PHYSFS_getLastErrorCode() to obtain the specific error. - * - * \sa PHYSFS_getWriteDir - */ -PHYSFS_DECL int PHYSFS_setWriteDir(const char *newDir); - - -/** - * \fn int PHYSFS_addToSearchPath(const char *newDir, int appendToPath) - * \brief Add an archive or directory to the search path. - * - * \deprecated As of PhysicsFS 2.0, use PHYSFS_mount() instead. This - * function just wraps it anyhow. - * - * This function is equivalent to: - * - * \code - * PHYSFS_mount(newDir, NULL, appendToPath); - * \endcode - * - * You must use this and not PHYSFS_mount if binary compatibility with - * PhysicsFS 1.0 is important (which it may not be for many people). - * - * \sa PHYSFS_mount - * \sa PHYSFS_removeFromSearchPath - * \sa PHYSFS_getSearchPath - */ -PHYSFS_DECL int PHYSFS_addToSearchPath(const char *newDir, int appendToPath) - PHYSFS_DEPRECATED; - -/** - * \fn int PHYSFS_removeFromSearchPath(const char *oldDir) - * \brief Remove a directory or archive from the search path. - * - * \deprecated As of PhysicsFS 2.1, use PHYSFS_unmount() instead. This - * function just wraps it anyhow. There's no functional difference - * except the vocabulary changed from "adding to the search path" - * to "mounting" when that functionality was extended, and thus - * the preferred way to accomplish this function's work is now - * called "unmounting." - * - * This function is equivalent to: - * - * \code - * PHYSFS_unmount(oldDir); - * \endcode - * - * You must use this and not PHYSFS_unmount if binary compatibility with - * PhysicsFS 1.0 is important (which it may not be for many people). - * - * \sa PHYSFS_addToSearchPath - * \sa PHYSFS_getSearchPath - * \sa PHYSFS_unmount - */ -PHYSFS_DECL int PHYSFS_removeFromSearchPath(const char *oldDir) - PHYSFS_DEPRECATED; - - -/** - * \fn char **PHYSFS_getSearchPath(void) - * \brief Get the current search path. - * - * The default search path is an empty list. - * - * The returned value is an array of strings, with a NULL entry to signify the - * end of the list: - * - * \code - * char **i; - * - * for (i = PHYSFS_getSearchPath(); *i != NULL; i++) - * printf("[%s] is in the search path.\n", *i); - * \endcode - * - * When you are done with the returned information, you may dispose of the - * resources by calling PHYSFS_freeList() with the returned pointer. - * - * \return Null-terminated array of null-terminated strings. NULL if there - * was a problem (read: OUT OF MEMORY). - * - * \sa PHYSFS_getSearchPathCallback - * \sa PHYSFS_addToSearchPath - * \sa PHYSFS_removeFromSearchPath - */ -PHYSFS_DECL char **PHYSFS_getSearchPath(void); - - -/** - * \fn int PHYSFS_setSaneConfig(const char *organization, const char *appName, const char *archiveExt, int includeCdRoms, int archivesFirst) - * \brief Set up sane, default paths. - * - * Helper function. - * - * The write dir will be set to the pref dir returned by - * \code PHYSFS_getPrefDir(organization, appName) \endcode, which is - * created if it doesn't exist. - * - * The above is sufficient to make sure your program's configuration directory - * is separated from other clutter, and platform-independent. - * - * The search path will be: - * - * - The Write Dir (created if it doesn't exist) - * - The Base Dir (PHYSFS_getBaseDir()) - * - All found CD-ROM dirs (optionally) - * - * These directories are then searched for files ending with the extension - * (archiveExt), which, if they are valid and supported archives, will also - * be added to the search path. If you specified "PKG" for (archiveExt), and - * there's a file named data.PKG in the base dir, it'll be checked. Archives - * can either be appended or prepended to the search path in alphabetical - * order, regardless of which directories they were found in. All archives - * are mounted in the root of the virtual file system ("/"). - * - * All of this can be accomplished from the application, but this just does it - * all for you. Feel free to add more to the search path manually, too. - * - * \param organization Name of your company/group/etc to be used as a - * dirname, so keep it small, and no-frills. - * - * \param appName Program-specific name of your program, to separate it - * from other programs using PhysicsFS. - * - * \param archiveExt File extension used by your program to specify an - * archive. For example, Quake 3 uses "pk3", even though - * they are just zipfiles. Specify NULL to not dig out - * archives automatically. Do not specify the '.' char; - * If you want to look for ZIP files, specify "ZIP" and - * not ".ZIP" ... the archive search is case-insensitive. - * - * \param includeCdRoms Non-zero to include CD-ROMs in the search path, and - * (if (archiveExt) != NULL) search them for archives. - * This may cause a significant amount of blocking - * while discs are accessed, and if there are no discs - * in the drive (or even not mounted on Unix systems), - * then they may not be made available anyhow. You may - * want to specify zero and handle the disc setup - * yourself. - * - * \param archivesFirst Non-zero to prepend the archives to the search path. - * Zero to append them. Ignored if !(archiveExt). - * - * \return nonzero on success, zero on error. Use PHYSFS_getLastErrorCode() - * to obtain the specific error. - */ -PHYSFS_DECL int PHYSFS_setSaneConfig(const char *organization, - const char *appName, - const char *archiveExt, - int includeCdRoms, - int archivesFirst); - - -/* Directory management stuff ... */ - -/** - * \fn int PHYSFS_mkdir(const char *dirName) - * \brief Create a directory. - * - * This is specified in platform-independent notation in relation to the - * write dir. All missing parent directories are also created if they - * don't exist. - * - * So if you've got the write dir set to "C:\mygame\writedir" and call - * PHYSFS_mkdir("downloads/maps") then the directories - * "C:\mygame\writedir\downloads" and "C:\mygame\writedir\downloads\maps" - * will be created if possible. If the creation of "maps" fails after we - * have successfully created "downloads", then the function leaves the - * created directory behind and reports failure. - * - * \param dirName New dir to create. - * \return nonzero on success, zero on error. Use - * PHYSFS_getLastErrorCode() to obtain the specific error. - * - * \sa PHYSFS_delete - */ -PHYSFS_DECL int PHYSFS_mkdir(const char *dirName); - - -/** - * \fn int PHYSFS_delete(const char *filename) - * \brief Delete a file or directory. - * - * (filename) is specified in platform-independent notation in relation to the - * write dir. - * - * A directory must be empty before this call can delete it. - * - * Deleting a symlink will remove the link, not what it points to, regardless - * of whether you "permitSymLinks" or not. - * - * So if you've got the write dir set to "C:\mygame\writedir" and call - * PHYSFS_delete("downloads/maps/level1.map") then the file - * "C:\mygame\writedir\downloads\maps\level1.map" is removed from the - * physical filesystem, if it exists and the operating system permits the - * deletion. - * - * Note that on Unix systems, deleting a file may be successful, but the - * actual file won't be removed until all processes that have an open - * filehandle to it (including your program) close their handles. - * - * Chances are, the bits that make up the file still exist, they are just - * made available to be written over at a later point. Don't consider this - * a security method or anything. :) - * - * \param filename Filename to delete. - * \return nonzero on success, zero on error. Use PHYSFS_getLastErrorCode() - * to obtain the specific error. - */ -PHYSFS_DECL int PHYSFS_delete(const char *filename); - - -/** - * \fn const char *PHYSFS_getRealDir(const char *filename) - * \brief Figure out where in the search path a file resides. - * - * The file is specified in platform-independent notation. The returned - * filename will be the element of the search path where the file was found, - * which may be a directory, or an archive. Even if there are multiple - * matches in different parts of the search path, only the first one found - * is used, just like when opening a file. - * - * So, if you look for "maps/level1.map", and C:\\mygame is in your search - * path and C:\\mygame\\maps\\level1.map exists, then "C:\mygame" is returned. - * - * If a any part of a match is a symbolic link, and you've not explicitly - * permitted symlinks, then it will be ignored, and the search for a match - * will continue. - * - * If you specify a fake directory that only exists as a mount point, it'll - * be associated with the first archive mounted there, even though that - * directory isn't necessarily contained in a real archive. - * - * \warning This will return NULL if there is no real directory associated - * with (filename). Specifically, PHYSFS_mountIo(), - * PHYSFS_mountMemory(), and PHYSFS_mountHandle() will return NULL - * even if the filename is found in the search path. Plan accordingly. - * - * \param filename file to look for. - * \return READ ONLY string of element of search path containing the - * the file in question. NULL if not found. - */ -PHYSFS_DECL const char *PHYSFS_getRealDir(const char *filename); - - -/** - * \fn char **PHYSFS_enumerateFiles(const char *dir) - * \brief Get a file listing of a search path's directory. - * - * \warning In PhysicsFS versions prior to 2.1, this function would return - * as many items as it could in the face of a failure condition - * (out of memory, disk i/o error, etc). Since this meant apps - * couldn't distinguish between complete success and partial failure, - * and since the function could always return NULL to report - * catastrophic failures anyway, in PhysicsFS 2.1 this function's - * policy changed: it will either return a list of complete results - * or it will return NULL for any failure of any kind, so we can - * guarantee that the enumeration ran to completion and has no gaps - * in its results. - * - * Matching directories are interpolated. That is, if "C:\mydir" is in the - * search path and contains a directory "savegames" that contains "x.sav", - * "y.sav", and "z.sav", and there is also a "C:\userdir" in the search path - * that has a "savegames" subdirectory with "w.sav", then the following code: - * - * \code - * char **rc = PHYSFS_enumerateFiles("savegames"); - * char **i; - * - * for (i = rc; *i != NULL; i++) - * printf(" * We've got [%s].\n", *i); - * - * PHYSFS_freeList(rc); - * \endcode - * - * \...will print: - * - * \verbatim - * We've got [x.sav]. - * We've got [y.sav]. - * We've got [z.sav]. - * We've got [w.sav].\endverbatim - * - * Feel free to sort the list however you like. However, the returned data - * will always contain no duplicates, and will be always sorted in alphabetic - * (rather: case-sensitive Unicode) order for you. - * - * Don't forget to call PHYSFS_freeList() with the return value from this - * function when you are done with it. - * - * \param dir directory in platform-independent notation to enumerate. - * \return Null-terminated array of null-terminated strings, or NULL for - * failure cases. - * - * \sa PHYSFS_enumerate - */ -PHYSFS_DECL char **PHYSFS_enumerateFiles(const char *dir); - - -/** - * \fn int PHYSFS_exists(const char *fname) - * \brief Determine if a file exists in the search path. - * - * Reports true if there is an entry anywhere in the search path by the - * name of (fname). - * - * Note that entries that are symlinks are ignored if - * PHYSFS_permitSymbolicLinks(1) hasn't been called, so you - * might end up further down in the search path than expected. - * - * \param fname filename in platform-independent notation. - * \return non-zero if filename exists. zero otherwise. - */ -PHYSFS_DECL int PHYSFS_exists(const char *fname); - - -/** - * \fn int PHYSFS_isDirectory(const char *fname) - * \brief Determine if a file in the search path is really a directory. - * - * \deprecated As of PhysicsFS 2.1, use PHYSFS_stat() instead. This - * function just wraps it anyhow. - * - * Determine if the first occurence of (fname) in the search path is - * really a directory entry. - * - * Note that entries that are symlinks are ignored if - * PHYSFS_permitSymbolicLinks(1) hasn't been called, so you - * might end up further down in the search path than expected. - * - * \param fname filename in platform-independent notation. - * \return non-zero if filename exists and is a directory. zero otherwise. - * - * \sa PHYSFS_stat - * \sa PHYSFS_exists - */ -PHYSFS_DECL int PHYSFS_isDirectory(const char *fname) PHYSFS_DEPRECATED; - - -/** - * \fn int PHYSFS_isSymbolicLink(const char *fname) - * \brief Determine if a file in the search path is really a symbolic link. - * - * \deprecated As of PhysicsFS 2.1, use PHYSFS_stat() instead. This - * function just wraps it anyhow. - * - * Determine if the first occurence of (fname) in the search path is - * really a symbolic link. - * - * Note that entries that are symlinks are ignored if - * PHYSFS_permitSymbolicLinks(1) hasn't been called, and as such, - * this function will always return 0 in that case. - * - * \param fname filename in platform-independent notation. - * \return non-zero if filename exists and is a symlink. zero otherwise. - * - * \sa PHYSFS_stat - * \sa PHYSFS_exists - */ -PHYSFS_DECL int PHYSFS_isSymbolicLink(const char *fname) PHYSFS_DEPRECATED; - - -/** - * \fn PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename) - * \brief Get the last modification time of a file. - * - * \deprecated As of PhysicsFS 2.1, use PHYSFS_stat() instead. This - * function just wraps it anyhow. - * - * The modtime is returned as a number of seconds since the Unix epoch - * (midnight, Jan 1, 1970). The exact derivation and accuracy of this time - * depends on the particular archiver. If there is no reasonable way to - * obtain this information for a particular archiver, or there was some sort - * of error, this function returns (-1). - * - * You must use this and not PHYSFS_stat() if binary compatibility with - * PhysicsFS 2.0 is important (which it may not be for many people). - * - * \param filename filename to check, in platform-independent notation. - * \return last modified time of the file. -1 if it can't be determined. - * - * \sa PHYSFS_stat - */ -PHYSFS_DECL PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename) - PHYSFS_DEPRECATED; - - -/* i/o stuff... */ - -/** - * \fn PHYSFS_File *PHYSFS_openWrite(const char *filename) - * \brief Open a file for writing. - * - * Open a file for writing, in platform-independent notation and in relation - * to the write dir as the root of the writable filesystem. The specified - * file is created if it doesn't exist. If it does exist, it is truncated to - * zero bytes, and the writing offset is set to the start. - * - * Note that entries that are symlinks are ignored if - * PHYSFS_permitSymbolicLinks(1) hasn't been called, and opening a - * symlink with this function will fail in such a case. - * - * \param filename File to open. - * \return A valid PhysicsFS filehandle on success, NULL on error. Use - * PHYSFS_getLastErrorCode() to obtain the specific error. - * - * \sa PHYSFS_openRead - * \sa PHYSFS_openAppend - * \sa PHYSFS_write - * \sa PHYSFS_close - */ -PHYSFS_DECL PHYSFS_File *PHYSFS_openWrite(const char *filename); - - -/** - * \fn PHYSFS_File *PHYSFS_openAppend(const char *filename) - * \brief Open a file for appending. - * - * Open a file for writing, in platform-independent notation and in relation - * to the write dir as the root of the writable filesystem. The specified - * file is created if it doesn't exist. If it does exist, the writing offset - * is set to the end of the file, so the first write will be the byte after - * the end. - * - * Note that entries that are symlinks are ignored if - * PHYSFS_permitSymbolicLinks(1) hasn't been called, and opening a - * symlink with this function will fail in such a case. - * - * \param filename File to open. - * \return A valid PhysicsFS filehandle on success, NULL on error. Use - * PHYSFS_getLastErrorCode() to obtain the specific error. - * - * \sa PHYSFS_openRead - * \sa PHYSFS_openWrite - * \sa PHYSFS_write - * \sa PHYSFS_close - */ -PHYSFS_DECL PHYSFS_File *PHYSFS_openAppend(const char *filename); - - -/** - * \fn PHYSFS_File *PHYSFS_openRead(const char *filename) - * \brief Open a file for reading. - * - * Open a file for reading, in platform-independent notation. The search path - * is checked one at a time until a matching file is found, in which case an - * abstract filehandle is associated with it, and reading may be done. - * The reading offset is set to the first byte of the file. - * - * Note that entries that are symlinks are ignored if - * PHYSFS_permitSymbolicLinks(1) hasn't been called, and opening a - * symlink with this function will fail in such a case. - * - * \param filename File to open. - * \return A valid PhysicsFS filehandle on success, NULL on error. - * Use PHYSFS_getLastErrorCode() to obtain the specific error. - * - * \sa PHYSFS_openWrite - * \sa PHYSFS_openAppend - * \sa PHYSFS_read - * \sa PHYSFS_close - */ -PHYSFS_DECL PHYSFS_File *PHYSFS_openRead(const char *filename); - - -/** - * \fn int PHYSFS_close(PHYSFS_File *handle) - * \brief Close a PhysicsFS filehandle. - * - * This call is capable of failing if the operating system was buffering - * writes to the physical media, and, now forced to write those changes to - * physical media, can not store the data for some reason. In such a case, - * the filehandle stays open. A well-written program should ALWAYS check the - * return value from the close call in addition to every writing call! - * - * \param handle handle returned from PHYSFS_open*(). - * \return nonzero on success, zero on error. Use PHYSFS_getLastErrorCode() - * to obtain the specific error. - * - * \sa PHYSFS_openRead - * \sa PHYSFS_openWrite - * \sa PHYSFS_openAppend - */ -PHYSFS_DECL int PHYSFS_close(PHYSFS_File *handle); - - -/** - * \fn PHYSFS_sint64 PHYSFS_read(PHYSFS_File *handle, void *buffer, PHYSFS_uint32 objSize, PHYSFS_uint32 objCount) - * \brief Read data from a PhysicsFS filehandle - * - * The file must be opened for reading. - * - * \deprecated As of PhysicsFS 2.1, use PHYSFS_readBytes() instead. This - * function just wraps it anyhow. This function never clarified - * what would happen if you managed to read a partial object, so - * working at the byte level makes this cleaner for everyone, - * especially now that PHYSFS_Io interfaces can be supplied by the - * application. - * - * \param handle handle returned from PHYSFS_openRead(). - * \param buffer buffer to store read data into. - * \param objSize size in bytes of objects being read from (handle). - * \param objCount number of (objSize) objects to read from (handle). - * \return number of objects read. PHYSFS_getLastErrorCode() can shed light - * on the reason this might be < (objCount), as can PHYSFS_eof(). - * -1 if complete failure. - * - * \sa PHYSFS_readBytes - * \sa PHYSFS_eof - */ -PHYSFS_DECL PHYSFS_sint64 PHYSFS_read(PHYSFS_File *handle, - void *buffer, - PHYSFS_uint32 objSize, - PHYSFS_uint32 objCount) - PHYSFS_DEPRECATED; - -/** - * \fn PHYSFS_sint64 PHYSFS_write(PHYSFS_File *handle, const void *buffer, PHYSFS_uint32 objSize, PHYSFS_uint32 objCount) - * \brief Write data to a PhysicsFS filehandle - * - * The file must be opened for writing. - * - * \deprecated As of PhysicsFS 2.1, use PHYSFS_writeBytes() instead. This - * function just wraps it anyhow. This function never clarified - * what would happen if you managed to write a partial object, so - * working at the byte level makes this cleaner for everyone, - * especially now that PHYSFS_Io interfaces can be supplied by the - * application. - * - * \param handle retval from PHYSFS_openWrite() or PHYSFS_openAppend(). - * \param buffer buffer of bytes to write to (handle). - * \param objSize size in bytes of objects being written to (handle). - * \param objCount number of (objSize) objects to write to (handle). - * \return number of objects written. PHYSFS_getLastErrorCode() can shed - * light on the reason this might be < (objCount). -1 if complete - * failure. - * - * \sa PHYSFS_writeBytes - */ -PHYSFS_DECL PHYSFS_sint64 PHYSFS_write(PHYSFS_File *handle, - const void *buffer, - PHYSFS_uint32 objSize, - PHYSFS_uint32 objCount) - PHYSFS_DEPRECATED; - - -/* File position stuff... */ - -/** - * \fn int PHYSFS_eof(PHYSFS_File *handle) - * \brief Check for end-of-file state on a PhysicsFS filehandle. - * - * Determine if the end of file has been reached in a PhysicsFS filehandle. - * - * \param handle handle returned from PHYSFS_openRead(). - * \return nonzero if EOF, zero if not. - * - * \sa PHYSFS_read - * \sa PHYSFS_tell - */ -PHYSFS_DECL int PHYSFS_eof(PHYSFS_File *handle); - - -/** - * \fn PHYSFS_sint64 PHYSFS_tell(PHYSFS_File *handle) - * \brief Determine current position within a PhysicsFS filehandle. - * - * \param handle handle returned from PHYSFS_open*(). - * \return offset in bytes from start of file. -1 if error occurred. - * Use PHYSFS_getLastErrorCode() to obtain the specific error. - * - * \sa PHYSFS_seek - */ -PHYSFS_DECL PHYSFS_sint64 PHYSFS_tell(PHYSFS_File *handle); - - -/** - * \fn int PHYSFS_seek(PHYSFS_File *handle, PHYSFS_uint64 pos) - * \brief Seek to a new position within a PhysicsFS filehandle. - * - * The next read or write will occur at that place. Seeking past the - * beginning or end of the file is not allowed, and causes an error. - * - * \param handle handle returned from PHYSFS_open*(). - * \param pos number of bytes from start of file to seek to. - * \return nonzero on success, zero on error. Use PHYSFS_getLastErrorCode() - * to obtain the specific error. - * - * \sa PHYSFS_tell - */ -PHYSFS_DECL int PHYSFS_seek(PHYSFS_File *handle, PHYSFS_uint64 pos); - - -/** - * \fn PHYSFS_sint64 PHYSFS_fileLength(PHYSFS_File *handle) - * \brief Get total length of a file in bytes. - * - * Note that if another process/thread is writing to this file at the same - * time, then the information this function supplies could be incorrect - * before you get it. Use with caution, or better yet, don't use at all. - * - * \param handle handle returned from PHYSFS_open*(). - * \return size in bytes of the file. -1 if can't be determined. - * - * \sa PHYSFS_tell - * \sa PHYSFS_seek - */ -PHYSFS_DECL PHYSFS_sint64 PHYSFS_fileLength(PHYSFS_File *handle); - - -/* Buffering stuff... */ - -/** - * \fn int PHYSFS_setBuffer(PHYSFS_File *handle, PHYSFS_uint64 bufsize) - * \brief Set up buffering for a PhysicsFS file handle. - * - * Define an i/o buffer for a file handle. A memory block of (bufsize) bytes - * will be allocated and associated with (handle). - * - * For files opened for reading, up to (bufsize) bytes are read from (handle) - * and stored in the internal buffer. Calls to PHYSFS_read() will pull - * from this buffer until it is empty, and then refill it for more reading. - * Note that compressed files, like ZIP archives, will decompress while - * buffering, so this can be handy for offsetting CPU-intensive operations. - * The buffer isn't filled until you do your next read. - * - * For files opened for writing, data will be buffered to memory until the - * buffer is full or the buffer is flushed. Closing a handle implicitly - * causes a flush...check your return values! - * - * Seeking, etc transparently accounts for buffering. - * - * You can resize an existing buffer by calling this function more than once - * on the same file. Setting the buffer size to zero will free an existing - * buffer. - * - * PhysicsFS file handles are unbuffered by default. - * - * Please check the return value of this function! Failures can include - * not being able to seek backwards in a read-only file when removing the - * buffer, not being able to allocate the buffer, and not being able to - * flush the buffer to disk, among other unexpected problems. - * - * \param handle handle returned from PHYSFS_open*(). - * \param bufsize size, in bytes, of buffer to allocate. - * \return nonzero if successful, zero on error. - * - * \sa PHYSFS_flush - * \sa PHYSFS_read - * \sa PHYSFS_write - * \sa PHYSFS_close - */ -PHYSFS_DECL int PHYSFS_setBuffer(PHYSFS_File *handle, PHYSFS_uint64 bufsize); - - -/** - * \fn int PHYSFS_flush(PHYSFS_File *handle) - * \brief Flush a buffered PhysicsFS file handle. - * - * For buffered files opened for writing, this will put the current contents - * of the buffer to disk and flag the buffer as empty if possible. - * - * For buffered files opened for reading or unbuffered files, this is a safe - * no-op, and will report success. - * - * \param handle handle returned from PHYSFS_open*(). - * \return nonzero if successful, zero on error. - * - * \sa PHYSFS_setBuffer - * \sa PHYSFS_close - */ -PHYSFS_DECL int PHYSFS_flush(PHYSFS_File *handle); - - -/* Byteorder stuff... */ - -/** - * \fn PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 val) - * \brief Swap littleendian signed 16 to platform's native byte order. - * - * Take a 16-bit signed value in littleendian format and convert it to - * the platform's native byte order. - * - * \param val value to convert - * \return converted value. - */ -PHYSFS_DECL PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 val); - - -/** - * \fn PHYSFS_uint16 PHYSFS_swapULE16(PHYSFS_uint16 val) - * \brief Swap littleendian unsigned 16 to platform's native byte order. - * - * Take a 16-bit unsigned value in littleendian format and convert it to - * the platform's native byte order. - * - * \param val value to convert - * \return converted value. - */ -PHYSFS_DECL PHYSFS_uint16 PHYSFS_swapULE16(PHYSFS_uint16 val); - -/** - * \fn PHYSFS_sint32 PHYSFS_swapSLE32(PHYSFS_sint32 val) - * \brief Swap littleendian signed 32 to platform's native byte order. - * - * Take a 32-bit signed value in littleendian format and convert it to - * the platform's native byte order. - * - * \param val value to convert - * \return converted value. - */ -PHYSFS_DECL PHYSFS_sint32 PHYSFS_swapSLE32(PHYSFS_sint32 val); - - -/** - * \fn PHYSFS_uint32 PHYSFS_swapULE32(PHYSFS_uint32 val) - * \brief Swap littleendian unsigned 32 to platform's native byte order. - * - * Take a 32-bit unsigned value in littleendian format and convert it to - * the platform's native byte order. - * - * \param val value to convert - * \return converted value. - */ -PHYSFS_DECL PHYSFS_uint32 PHYSFS_swapULE32(PHYSFS_uint32 val); - -/** - * \fn PHYSFS_sint64 PHYSFS_swapSLE64(PHYSFS_sint64 val) - * \brief Swap littleendian signed 64 to platform's native byte order. - * - * Take a 64-bit signed value in littleendian format and convert it to - * the platform's native byte order. - * - * \param val value to convert - * \return converted value. - * - * \warning Remember, PHYSFS_sint64 is only 32 bits on platforms without - * any sort of 64-bit support. - */ -PHYSFS_DECL PHYSFS_sint64 PHYSFS_swapSLE64(PHYSFS_sint64 val); - - -/** - * \fn PHYSFS_uint64 PHYSFS_swapULE64(PHYSFS_uint64 val) - * \brief Swap littleendian unsigned 64 to platform's native byte order. - * - * Take a 64-bit unsigned value in littleendian format and convert it to - * the platform's native byte order. - * - * \param val value to convert - * \return converted value. - * - * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without - * any sort of 64-bit support. - */ -PHYSFS_DECL PHYSFS_uint64 PHYSFS_swapULE64(PHYSFS_uint64 val); - - -/** - * \fn PHYSFS_sint16 PHYSFS_swapSBE16(PHYSFS_sint16 val) - * \brief Swap bigendian signed 16 to platform's native byte order. - * - * Take a 16-bit signed value in bigendian format and convert it to - * the platform's native byte order. - * - * \param val value to convert - * \return converted value. - */ -PHYSFS_DECL PHYSFS_sint16 PHYSFS_swapSBE16(PHYSFS_sint16 val); - - -/** - * \fn PHYSFS_uint16 PHYSFS_swapUBE16(PHYSFS_uint16 val) - * \brief Swap bigendian unsigned 16 to platform's native byte order. - * - * Take a 16-bit unsigned value in bigendian format and convert it to - * the platform's native byte order. - * - * \param val value to convert - * \return converted value. - */ -PHYSFS_DECL PHYSFS_uint16 PHYSFS_swapUBE16(PHYSFS_uint16 val); - -/** - * \fn PHYSFS_sint32 PHYSFS_swapSBE32(PHYSFS_sint32 val) - * \brief Swap bigendian signed 32 to platform's native byte order. - * - * Take a 32-bit signed value in bigendian format and convert it to - * the platform's native byte order. - * - * \param val value to convert - * \return converted value. - */ -PHYSFS_DECL PHYSFS_sint32 PHYSFS_swapSBE32(PHYSFS_sint32 val); - - -/** - * \fn PHYSFS_uint32 PHYSFS_swapUBE32(PHYSFS_uint32 val) - * \brief Swap bigendian unsigned 32 to platform's native byte order. - * - * Take a 32-bit unsigned value in bigendian format and convert it to - * the platform's native byte order. - * - * \param val value to convert - * \return converted value. - */ -PHYSFS_DECL PHYSFS_uint32 PHYSFS_swapUBE32(PHYSFS_uint32 val); - - -/** - * \fn PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 val) - * \brief Swap bigendian signed 64 to platform's native byte order. - * - * Take a 64-bit signed value in bigendian format and convert it to - * the platform's native byte order. - * - * \param val value to convert - * \return converted value. - * - * \warning Remember, PHYSFS_sint64 is only 32 bits on platforms without - * any sort of 64-bit support. - */ -PHYSFS_DECL PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 val); - - -/** - * \fn PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 val) - * \brief Swap bigendian unsigned 64 to platform's native byte order. - * - * Take a 64-bit unsigned value in bigendian format and convert it to - * the platform's native byte order. - * - * \param val value to convert - * \return converted value. - * - * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without - * any sort of 64-bit support. - */ -PHYSFS_DECL PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 val); - - -/** - * \fn int PHYSFS_readSLE16(PHYSFS_File *file, PHYSFS_sint16 *val) - * \brief Read and convert a signed 16-bit littleendian value. - * - * Convenience function. Read a signed 16-bit littleendian value from a - * file and convert it to the platform's native byte order. - * - * \param file PhysicsFS file handle from which to read. - * \param val pointer to where value should be stored. - * \return zero on failure, non-zero on success. If successful, (*val) will - * store the result. On failure, you can find out what went wrong - * from PHYSFS_getLastErrorCode(). - */ -PHYSFS_DECL int PHYSFS_readSLE16(PHYSFS_File *file, PHYSFS_sint16 *val); - - -/** - * \fn int PHYSFS_readULE16(PHYSFS_File *file, PHYSFS_uint16 *val) - * \brief Read and convert an unsigned 16-bit littleendian value. - * - * Convenience function. Read an unsigned 16-bit littleendian value from a - * file and convert it to the platform's native byte order. - * - * \param file PhysicsFS file handle from which to read. - * \param val pointer to where value should be stored. - * \return zero on failure, non-zero on success. If successful, (*val) will - * store the result. On failure, you can find out what went wrong - * from PHYSFS_getLastErrorCode(). - * - */ -PHYSFS_DECL int PHYSFS_readULE16(PHYSFS_File *file, PHYSFS_uint16 *val); - - -/** - * \fn int PHYSFS_readSBE16(PHYSFS_File *file, PHYSFS_sint16 *val) - * \brief Read and convert a signed 16-bit bigendian value. - * - * Convenience function. Read a signed 16-bit bigendian value from a - * file and convert it to the platform's native byte order. - * - * \param file PhysicsFS file handle from which to read. - * \param val pointer to where value should be stored. - * \return zero on failure, non-zero on success. If successful, (*val) will - * store the result. On failure, you can find out what went wrong - * from PHYSFS_getLastErrorCode(). - */ -PHYSFS_DECL int PHYSFS_readSBE16(PHYSFS_File *file, PHYSFS_sint16 *val); - - -/** - * \fn int PHYSFS_readUBE16(PHYSFS_File *file, PHYSFS_uint16 *val) - * \brief Read and convert an unsigned 16-bit bigendian value. - * - * Convenience function. Read an unsigned 16-bit bigendian value from a - * file and convert it to the platform's native byte order. - * - * \param file PhysicsFS file handle from which to read. - * \param val pointer to where value should be stored. - * \return zero on failure, non-zero on success. If successful, (*val) will - * store the result. On failure, you can find out what went wrong - * from PHYSFS_getLastErrorCode(). - * - */ -PHYSFS_DECL int PHYSFS_readUBE16(PHYSFS_File *file, PHYSFS_uint16 *val); - - -/** - * \fn int PHYSFS_readSLE32(PHYSFS_File *file, PHYSFS_sint32 *val) - * \brief Read and convert a signed 32-bit littleendian value. - * - * Convenience function. Read a signed 32-bit littleendian value from a - * file and convert it to the platform's native byte order. - * - * \param file PhysicsFS file handle from which to read. - * \param val pointer to where value should be stored. - * \return zero on failure, non-zero on success. If successful, (*val) will - * store the result. On failure, you can find out what went wrong - * from PHYSFS_getLastErrorCode(). - */ -PHYSFS_DECL int PHYSFS_readSLE32(PHYSFS_File *file, PHYSFS_sint32 *val); - - -/** - * \fn int PHYSFS_readULE32(PHYSFS_File *file, PHYSFS_uint32 *val) - * \brief Read and convert an unsigned 32-bit littleendian value. - * - * Convenience function. Read an unsigned 32-bit littleendian value from a - * file and convert it to the platform's native byte order. - * - * \param file PhysicsFS file handle from which to read. - * \param val pointer to where value should be stored. - * \return zero on failure, non-zero on success. If successful, (*val) will - * store the result. On failure, you can find out what went wrong - * from PHYSFS_getLastErrorCode(). - * - */ -PHYSFS_DECL int PHYSFS_readULE32(PHYSFS_File *file, PHYSFS_uint32 *val); - - -/** - * \fn int PHYSFS_readSBE32(PHYSFS_File *file, PHYSFS_sint32 *val) - * \brief Read and convert a signed 32-bit bigendian value. - * - * Convenience function. Read a signed 32-bit bigendian value from a - * file and convert it to the platform's native byte order. - * - * \param file PhysicsFS file handle from which to read. - * \param val pointer to where value should be stored. - * \return zero on failure, non-zero on success. If successful, (*val) will - * store the result. On failure, you can find out what went wrong - * from PHYSFS_getLastErrorCode(). - */ -PHYSFS_DECL int PHYSFS_readSBE32(PHYSFS_File *file, PHYSFS_sint32 *val); - - -/** - * \fn int PHYSFS_readUBE32(PHYSFS_File *file, PHYSFS_uint32 *val) - * \brief Read and convert an unsigned 32-bit bigendian value. - * - * Convenience function. Read an unsigned 32-bit bigendian value from a - * file and convert it to the platform's native byte order. - * - * \param file PhysicsFS file handle from which to read. - * \param val pointer to where value should be stored. - * \return zero on failure, non-zero on success. If successful, (*val) will - * store the result. On failure, you can find out what went wrong - * from PHYSFS_getLastErrorCode(). - * - */ -PHYSFS_DECL int PHYSFS_readUBE32(PHYSFS_File *file, PHYSFS_uint32 *val); - - -/** - * \fn int PHYSFS_readSLE64(PHYSFS_File *file, PHYSFS_sint64 *val) - * \brief Read and convert a signed 64-bit littleendian value. - * - * Convenience function. Read a signed 64-bit littleendian value from a - * file and convert it to the platform's native byte order. - * - * \param file PhysicsFS file handle from which to read. - * \param val pointer to where value should be stored. - * \return zero on failure, non-zero on success. If successful, (*val) will - * store the result. On failure, you can find out what went wrong - * from PHYSFS_getLastErrorCode(). - * - * \warning Remember, PHYSFS_sint64 is only 32 bits on platforms without - * any sort of 64-bit support. - */ -PHYSFS_DECL int PHYSFS_readSLE64(PHYSFS_File *file, PHYSFS_sint64 *val); - - -/** - * \fn int PHYSFS_readULE64(PHYSFS_File *file, PHYSFS_uint64 *val) - * \brief Read and convert an unsigned 64-bit littleendian value. - * - * Convenience function. Read an unsigned 64-bit littleendian value from a - * file and convert it to the platform's native byte order. - * - * \param file PhysicsFS file handle from which to read. - * \param val pointer to where value should be stored. - * \return zero on failure, non-zero on success. If successful, (*val) will - * store the result. On failure, you can find out what went wrong - * from PHYSFS_getLastErrorCode(). - * - * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without - * any sort of 64-bit support. - */ -PHYSFS_DECL int PHYSFS_readULE64(PHYSFS_File *file, PHYSFS_uint64 *val); - - -/** - * \fn int PHYSFS_readSBE64(PHYSFS_File *file, PHYSFS_sint64 *val) - * \brief Read and convert a signed 64-bit bigendian value. - * - * Convenience function. Read a signed 64-bit bigendian value from a - * file and convert it to the platform's native byte order. - * - * \param file PhysicsFS file handle from which to read. - * \param val pointer to where value should be stored. - * \return zero on failure, non-zero on success. If successful, (*val) will - * store the result. On failure, you can find out what went wrong - * from PHYSFS_getLastErrorCode(). - * - * \warning Remember, PHYSFS_sint64 is only 32 bits on platforms without - * any sort of 64-bit support. - */ -PHYSFS_DECL int PHYSFS_readSBE64(PHYSFS_File *file, PHYSFS_sint64 *val); - - -/** - * \fn int PHYSFS_readUBE64(PHYSFS_File *file, PHYSFS_uint64 *val) - * \brief Read and convert an unsigned 64-bit bigendian value. - * - * Convenience function. Read an unsigned 64-bit bigendian value from a - * file and convert it to the platform's native byte order. - * - * \param file PhysicsFS file handle from which to read. - * \param val pointer to where value should be stored. - * \return zero on failure, non-zero on success. If successful, (*val) will - * store the result. On failure, you can find out what went wrong - * from PHYSFS_getLastErrorCode(). - * - * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without - * any sort of 64-bit support. - */ -PHYSFS_DECL int PHYSFS_readUBE64(PHYSFS_File *file, PHYSFS_uint64 *val); - - -/** - * \fn int PHYSFS_writeSLE16(PHYSFS_File *file, PHYSFS_sint16 val) - * \brief Convert and write a signed 16-bit littleendian value. - * - * Convenience function. Convert a signed 16-bit value from the platform's - * native byte order to littleendian and write it to a file. - * - * \param file PhysicsFS file handle to which to write. - * \param val Value to convert and write. - * \return zero on failure, non-zero on success. On failure, you can - * find out what went wrong from PHYSFS_getLastErrorCode(). - */ -PHYSFS_DECL int PHYSFS_writeSLE16(PHYSFS_File *file, PHYSFS_sint16 val); - - -/** - * \fn int PHYSFS_writeULE16(PHYSFS_File *file, PHYSFS_uint16 val) - * \brief Convert and write an unsigned 16-bit littleendian value. - * - * Convenience function. Convert an unsigned 16-bit value from the platform's - * native byte order to littleendian and write it to a file. - * - * \param file PhysicsFS file handle to which to write. - * \param val Value to convert and write. - * \return zero on failure, non-zero on success. On failure, you can - * find out what went wrong from PHYSFS_getLastErrorCode(). - */ -PHYSFS_DECL int PHYSFS_writeULE16(PHYSFS_File *file, PHYSFS_uint16 val); - - -/** - * \fn int PHYSFS_writeSBE16(PHYSFS_File *file, PHYSFS_sint16 val) - * \brief Convert and write a signed 16-bit bigendian value. - * - * Convenience function. Convert a signed 16-bit value from the platform's - * native byte order to bigendian and write it to a file. - * - * \param file PhysicsFS file handle to which to write. - * \param val Value to convert and write. - * \return zero on failure, non-zero on success. On failure, you can - * find out what went wrong from PHYSFS_getLastErrorCode(). - */ -PHYSFS_DECL int PHYSFS_writeSBE16(PHYSFS_File *file, PHYSFS_sint16 val); - - -/** - * \fn int PHYSFS_writeUBE16(PHYSFS_File *file, PHYSFS_uint16 val) - * \brief Convert and write an unsigned 16-bit bigendian value. - * - * Convenience function. Convert an unsigned 16-bit value from the platform's - * native byte order to bigendian and write it to a file. - * - * \param file PhysicsFS file handle to which to write. - * \param val Value to convert and write. - * \return zero on failure, non-zero on success. On failure, you can - * find out what went wrong from PHYSFS_getLastErrorCode(). - */ -PHYSFS_DECL int PHYSFS_writeUBE16(PHYSFS_File *file, PHYSFS_uint16 val); - - -/** - * \fn int PHYSFS_writeSLE32(PHYSFS_File *file, PHYSFS_sint32 val) - * \brief Convert and write a signed 32-bit littleendian value. - * - * Convenience function. Convert a signed 32-bit value from the platform's - * native byte order to littleendian and write it to a file. - * - * \param file PhysicsFS file handle to which to write. - * \param val Value to convert and write. - * \return zero on failure, non-zero on success. On failure, you can - * find out what went wrong from PHYSFS_getLastErrorCode(). - */ -PHYSFS_DECL int PHYSFS_writeSLE32(PHYSFS_File *file, PHYSFS_sint32 val); - - -/** - * \fn int PHYSFS_writeULE32(PHYSFS_File *file, PHYSFS_uint32 val) - * \brief Convert and write an unsigned 32-bit littleendian value. - * - * Convenience function. Convert an unsigned 32-bit value from the platform's - * native byte order to littleendian and write it to a file. - * - * \param file PhysicsFS file handle to which to write. - * \param val Value to convert and write. - * \return zero on failure, non-zero on success. On failure, you can - * find out what went wrong from PHYSFS_getLastErrorCode(). - */ -PHYSFS_DECL int PHYSFS_writeULE32(PHYSFS_File *file, PHYSFS_uint32 val); - - -/** - * \fn int PHYSFS_writeSBE32(PHYSFS_File *file, PHYSFS_sint32 val) - * \brief Convert and write a signed 32-bit bigendian value. - * - * Convenience function. Convert a signed 32-bit value from the platform's - * native byte order to bigendian and write it to a file. - * - * \param file PhysicsFS file handle to which to write. - * \param val Value to convert and write. - * \return zero on failure, non-zero on success. On failure, you can - * find out what went wrong from PHYSFS_getLastErrorCode(). - */ -PHYSFS_DECL int PHYSFS_writeSBE32(PHYSFS_File *file, PHYSFS_sint32 val); - - -/** - * \fn int PHYSFS_writeUBE32(PHYSFS_File *file, PHYSFS_uint32 val) - * \brief Convert and write an unsigned 32-bit bigendian value. - * - * Convenience function. Convert an unsigned 32-bit value from the platform's - * native byte order to bigendian and write it to a file. - * - * \param file PhysicsFS file handle to which to write. - * \param val Value to convert and write. - * \return zero on failure, non-zero on success. On failure, you can - * find out what went wrong from PHYSFS_getLastErrorCode(). - */ -PHYSFS_DECL int PHYSFS_writeUBE32(PHYSFS_File *file, PHYSFS_uint32 val); - - -/** - * \fn int PHYSFS_writeSLE64(PHYSFS_File *file, PHYSFS_sint64 val) - * \brief Convert and write a signed 64-bit littleendian value. - * - * Convenience function. Convert a signed 64-bit value from the platform's - * native byte order to littleendian and write it to a file. - * - * \param file PhysicsFS file handle to which to write. - * \param val Value to convert and write. - * \return zero on failure, non-zero on success. On failure, you can - * find out what went wrong from PHYSFS_getLastErrorCode(). - * - * \warning Remember, PHYSFS_sint64 is only 32 bits on platforms without - * any sort of 64-bit support. - */ -PHYSFS_DECL int PHYSFS_writeSLE64(PHYSFS_File *file, PHYSFS_sint64 val); - - -/** - * \fn int PHYSFS_writeULE64(PHYSFS_File *file, PHYSFS_uint64 val) - * \brief Convert and write an unsigned 64-bit littleendian value. - * - * Convenience function. Convert an unsigned 64-bit value from the platform's - * native byte order to littleendian and write it to a file. - * - * \param file PhysicsFS file handle to which to write. - * \param val Value to convert and write. - * \return zero on failure, non-zero on success. On failure, you can - * find out what went wrong from PHYSFS_getLastErrorCode(). - * - * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without - * any sort of 64-bit support. - */ -PHYSFS_DECL int PHYSFS_writeULE64(PHYSFS_File *file, PHYSFS_uint64 val); - - -/** - * \fn int PHYSFS_writeSBE64(PHYSFS_File *file, PHYSFS_sint64 val) - * \brief Convert and write a signed 64-bit bigending value. - * - * Convenience function. Convert a signed 64-bit value from the platform's - * native byte order to bigendian and write it to a file. - * - * \param file PhysicsFS file handle to which to write. - * \param val Value to convert and write. - * \return zero on failure, non-zero on success. On failure, you can - * find out what went wrong from PHYSFS_getLastErrorCode(). - * - * \warning Remember, PHYSFS_sint64 is only 32 bits on platforms without - * any sort of 64-bit support. - */ -PHYSFS_DECL int PHYSFS_writeSBE64(PHYSFS_File *file, PHYSFS_sint64 val); - - -/** - * \fn int PHYSFS_writeUBE64(PHYSFS_File *file, PHYSFS_uint64 val) - * \brief Convert and write an unsigned 64-bit bigendian value. - * - * Convenience function. Convert an unsigned 64-bit value from the platform's - * native byte order to bigendian and write it to a file. - * - * \param file PhysicsFS file handle to which to write. - * \param val Value to convert and write. - * \return zero on failure, non-zero on success. On failure, you can - * find out what went wrong from PHYSFS_getLastErrorCode(). - * - * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without - * any sort of 64-bit support. - */ -PHYSFS_DECL int PHYSFS_writeUBE64(PHYSFS_File *file, PHYSFS_uint64 val); - - -/* Everything above this line is part of the PhysicsFS 1.0 API. */ - -/** - * \fn int PHYSFS_isInit(void) - * \brief Determine if the PhysicsFS library is initialized. - * - * Once PHYSFS_init() returns successfully, this will return non-zero. - * Before a successful PHYSFS_init() and after PHYSFS_deinit() returns - * successfully, this will return zero. This function is safe to call at - * any time. - * - * \return non-zero if library is initialized, zero if library is not. - * - * \sa PHYSFS_init - * \sa PHYSFS_deinit - */ -PHYSFS_DECL int PHYSFS_isInit(void); - - -/** - * \fn int PHYSFS_symbolicLinksPermitted(void) - * \brief Determine if the symbolic links are permitted. - * - * This reports the setting from the last call to PHYSFS_permitSymbolicLinks(). - * If PHYSFS_permitSymbolicLinks() hasn't been called since the library was - * last initialized, symbolic links are implicitly disabled. - * - * \return non-zero if symlinks are permitted, zero if not. - * - * \sa PHYSFS_permitSymbolicLinks - */ -PHYSFS_DECL int PHYSFS_symbolicLinksPermitted(void); - - -/** - * \struct PHYSFS_Allocator - * \brief PhysicsFS allocation function pointers. - * - * (This is for limited, hardcore use. If you don't immediately see a need - * for it, you can probably ignore this forever.) - * - * You create one of these structures for use with PHYSFS_setAllocator. - * Allocators are assumed to be reentrant by the caller; please mutex - * accordingly. - * - * Allocations are always discussed in 64-bits, for future expansion...we're - * on the cusp of a 64-bit transition, and we'll probably be allocating 6 - * gigabytes like it's nothing sooner or later, and I don't want to change - * this again at that point. If you're on a 32-bit platform and have to - * downcast, it's okay to return NULL if the allocation is greater than - * 4 gigabytes, since you'd have to do so anyhow. - * - * \sa PHYSFS_setAllocator - */ -typedef struct PHYSFS_Allocator -{ - int (*Init)(void); /**< Initialize. Can be NULL. Zero on failure. */ - void (*Deinit)(void); /**< Deinitialize your allocator. Can be NULL. */ - void *(*Malloc)(PHYSFS_uint64); /**< Allocate like malloc(). */ - void *(*Realloc)(void *, PHYSFS_uint64); /**< Reallocate like realloc(). */ - void (*Free)(void *); /**< Free memory from Malloc or Realloc. */ -} PHYSFS_Allocator; - - -/** - * \fn int PHYSFS_setAllocator(const PHYSFS_Allocator *allocator) - * \brief Hook your own allocation routines into PhysicsFS. - * - * (This is for limited, hardcore use. If you don't immediately see a need - * for it, you can probably ignore this forever.) - * - * By default, PhysicsFS will use whatever is reasonable for a platform - * to manage dynamic memory (usually ANSI C malloc/realloc/free, but - * some platforms might use something else), but in some uncommon cases, the - * app might want more control over the library's memory management. This - * lets you redirect PhysicsFS to use your own allocation routines instead. - * You can only call this function before PHYSFS_init(); if the library is - * initialized, it'll reject your efforts to change the allocator mid-stream. - * You may call this function after PHYSFS_deinit() if you are willing to - * shut down the library and restart it with a new allocator; this is a safe - * and supported operation. The allocator remains intact between deinit/init - * calls. If you want to return to the platform's default allocator, pass a - * NULL in here. - * - * If you aren't immediately sure what to do with this function, you can - * safely ignore it altogether. - * - * \param allocator Structure containing your allocator's entry points. - * \return zero on failure, non-zero on success. This call only fails - * when used between PHYSFS_init() and PHYSFS_deinit() calls. - */ -PHYSFS_DECL int PHYSFS_setAllocator(const PHYSFS_Allocator *allocator); - - -/** - * \fn int PHYSFS_mount(const char *newDir, const char *mountPoint, int appendToPath) - * \brief Add an archive or directory to the search path. - * - * If this is a duplicate, the entry is not added again, even though the - * function succeeds. You may not add the same archive to two different - * mountpoints: duplicate checking is done against the archive and not the - * mountpoint. - * - * When you mount an archive, it is added to a virtual file system...all files - * in all of the archives are interpolated into a single hierachical file - * tree. Two archives mounted at the same place (or an archive with files - * overlapping another mountpoint) may have overlapping files: in such a case, - * the file earliest in the search path is selected, and the other files are - * inaccessible to the application. This allows archives to be used to - * override previous revisions; you can use the mounting mechanism to place - * archives at a specific point in the file tree and prevent overlap; this - * is useful for downloadable mods that might trample over application data - * or each other, for example. - * - * The mountpoint does not need to exist prior to mounting, which is different - * than those familiar with the Unix concept of "mounting" may expect. - * As well, more than one archive can be mounted to the same mountpoint, or - * mountpoints and archive contents can overlap...the interpolation mechanism - * still functions as usual. - * - * Specifying a symbolic link to an archive or directory is allowed here, - * regardless of the state of PHYSFS_permitSymbolicLinks(). That function - * only deals with symlinks inside the mounted directory or archive. - * - * \param newDir directory or archive to add to the path, in - * platform-dependent notation. - * \param mountPoint Location in the interpolated tree that this archive - * will be "mounted", in platform-independent notation. - * NULL or "" is equivalent to "/". - * \param appendToPath nonzero to append to search path, zero to prepend. - * \return nonzero if added to path, zero on failure (bogus archive, dir - * missing, etc). Use PHYSFS_getLastErrorCode() to obtain - * the specific error. - * - * \sa PHYSFS_removeFromSearchPath - * \sa PHYSFS_getSearchPath - * \sa PHYSFS_getMountPoint - * \sa PHYSFS_mountIo - */ -PHYSFS_DECL int PHYSFS_mount(const char *newDir, - const char *mountPoint, - int appendToPath); - -/** - * \fn int PHYSFS_getMountPoint(const char *dir) - * \brief Determine a mounted archive's mountpoint. - * - * You give this function the name of an archive or dir you successfully - * added to the search path, and it reports the location in the interpolated - * tree where it is mounted. Files mounted with a NULL mountpoint or through - * PHYSFS_addToSearchPath() will report "/". The return value is READ ONLY - * and valid until the archive is removed from the search path. - * - * \param dir directory or archive previously added to the path, in - * platform-dependent notation. This must match the string - * used when adding, even if your string would also reference - * the same file with a different string of characters. - * \return READ-ONLY string of mount point if added to path, NULL on failure - * (bogus archive, etc). Use PHYSFS_getLastErrorCode() to obtain the - * specific error. - * - * \sa PHYSFS_removeFromSearchPath - * \sa PHYSFS_getSearchPath - * \sa PHYSFS_getMountPoint - */ -PHYSFS_DECL const char *PHYSFS_getMountPoint(const char *dir); - - -/** - * \typedef PHYSFS_StringCallback - * \brief Function signature for callbacks that report strings. - * - * These are used to report a list of strings to an original caller, one - * string per callback. All strings are UTF-8 encoded. Functions should not - * try to modify or free the string's memory. - * - * These callbacks are used, starting in PhysicsFS 1.1, as an alternative to - * functions that would return lists that need to be cleaned up with - * PHYSFS_freeList(). The callback means that the library doesn't need to - * allocate an entire list and all the strings up front. - * - * Be aware that promises data ordering in the list versions are not - * necessarily so in the callback versions. Check the documentation on - * specific APIs, but strings may not be sorted as you expect. - * - * \param data User-defined data pointer, passed through from the API - * that eventually called the callback. - * \param str The string data about which the callback is meant to inform. - * - * \sa PHYSFS_getCdRomDirsCallback - * \sa PHYSFS_getSearchPathCallback - */ -typedef void (*PHYSFS_StringCallback)(void *data, const char *str); - - -/** - * \typedef PHYSFS_EnumFilesCallback - * \brief Function signature for callbacks that enumerate files. - * - * \warning As of PhysicsFS 2.1, Use PHYSFS_EnumerateCallback with - * PHYSFS_enumerate() instead; it gives you more control over the process. - * - * These are used to report a list of directory entries to an original caller, - * one file/dir/symlink per callback. All strings are UTF-8 encoded. - * Functions should not try to modify or free any string's memory. - * - * These callbacks are used, starting in PhysicsFS 1.1, as an alternative to - * functions that would return lists that need to be cleaned up with - * PHYSFS_freeList(). The callback means that the library doesn't need to - * allocate an entire list and all the strings up front. - * - * Be aware that promised data ordering in the list versions are not - * necessarily so in the callback versions. Check the documentation on - * specific APIs, but strings may not be sorted as you expect and you might - * get duplicate strings. - * - * \param data User-defined data pointer, passed through from the API - * that eventually called the callback. - * \param origdir A string containing the full path, in platform-independent - * notation, of the directory containing this file. In most - * cases, this is the directory on which you requested - * enumeration, passed in the callback for your convenience. - * \param fname The filename that is being enumerated. It may not be in - * alphabetical order compared to other callbacks that have - * fired, and it will not contain the full path. You can - * recreate the fullpath with $origdir/$fname ... The file - * can be a subdirectory, a file, a symlink, etc. - * - * \sa PHYSFS_enumerateFilesCallback - */ -typedef void (*PHYSFS_EnumFilesCallback)(void *data, const char *origdir, - const char *fname); - - -/** - * \fn void PHYSFS_getCdRomDirsCallback(PHYSFS_StringCallback c, void *d) - * \brief Enumerate CD-ROM directories, using an application-defined callback. - * - * Internally, PHYSFS_getCdRomDirs() just calls this function and then builds - * a list before returning to the application, so functionality is identical - * except for how the information is represented to the application. - * - * Unlike PHYSFS_getCdRomDirs(), this function does not return an array. - * Rather, it calls a function specified by the application once per - * detected disc: - * - * \code - * - * static void foundDisc(void *data, const char *cddir) - * { - * printf("cdrom dir [%s] is available.\n", cddir); - * } - * - * // ... - * PHYSFS_getCdRomDirsCallback(foundDisc, NULL); - * \endcode - * - * This call may block while drives spin up. Be forewarned. - * - * \param c Callback function to notify about detected drives. - * \param d Application-defined data passed to callback. Can be NULL. - * - * \sa PHYSFS_StringCallback - * \sa PHYSFS_getCdRomDirs - */ -PHYSFS_DECL void PHYSFS_getCdRomDirsCallback(PHYSFS_StringCallback c, void *d); - - -/** - * \fn void PHYSFS_getSearchPathCallback(PHYSFS_StringCallback c, void *d) - * \brief Enumerate the search path, using an application-defined callback. - * - * Internally, PHYSFS_getSearchPath() just calls this function and then builds - * a list before returning to the application, so functionality is identical - * except for how the information is represented to the application. - * - * Unlike PHYSFS_getSearchPath(), this function does not return an array. - * Rather, it calls a function specified by the application once per - * element of the search path: - * - * \code - * - * static void printSearchPath(void *data, const char *pathItem) - * { - * printf("[%s] is in the search path.\n", pathItem); - * } - * - * // ... - * PHYSFS_getSearchPathCallback(printSearchPath, NULL); - * \endcode - * - * Elements of the search path are reported in order search priority, so the - * first archive/dir that would be examined when looking for a file is the - * first element passed through the callback. - * - * \param c Callback function to notify about search path elements. - * \param d Application-defined data passed to callback. Can be NULL. - * - * \sa PHYSFS_StringCallback - * \sa PHYSFS_getSearchPath - */ -PHYSFS_DECL void PHYSFS_getSearchPathCallback(PHYSFS_StringCallback c, void *d); - - -/** - * \fn void PHYSFS_enumerateFilesCallback(const char *dir, PHYSFS_EnumFilesCallback c, void *d) - * \brief Get a file listing of a search path's directory, using an application-defined callback. - * - * \deprecated As of PhysicsFS 2.1, use PHYSFS_enumerate() instead. This - * function has no way to report errors (or to have the callback signal an - * error or request a stop), so if data will be lost, your callback has no - * way to direct the process, and your calling app has no way to know. - * - * As of PhysicsFS 2.1, this function just wraps PHYSFS_enumerate() and - * ignores errors. Consider using PHYSFS_enumerate() or - * PHYSFS_enumerateFiles() instead. - * - * \sa PHYSFS_enumerate - * \sa PHYSFS_enumerateFiles - * \sa PHYSFS_EnumFilesCallback - */ -PHYSFS_DECL void PHYSFS_enumerateFilesCallback(const char *dir, - PHYSFS_EnumFilesCallback c, - void *d) PHYSFS_DEPRECATED; - -/** - * \fn void PHYSFS_utf8FromUcs4(const PHYSFS_uint32 *src, char *dst, PHYSFS_uint64 len) - * \brief Convert a UCS-4 string to a UTF-8 string. - * - * \warning This function will not report an error if there are invalid UCS-4 - * values in the source string. It will replace them with a '?' - * character and continue on. - * - * UCS-4 (aka UTF-32) strings are 32-bits per character: \c wchar_t on Unix. - * - * To ensure that the destination buffer is large enough for the conversion, - * please allocate a buffer that is the same size as the source buffer. UTF-8 - * never uses more than 32-bits per character, so while it may shrink a UCS-4 - * string, it will never expand it. - * - * Strings that don't fit in the destination buffer will be truncated, but - * will always be null-terminated and never have an incomplete UTF-8 - * sequence at the end. If the buffer length is 0, this function does nothing. - * - * \param src Null-terminated source string in UCS-4 format. - * \param dst Buffer to store converted UTF-8 string. - * \param len Size, in bytes, of destination buffer. - */ -PHYSFS_DECL void PHYSFS_utf8FromUcs4(const PHYSFS_uint32 *src, char *dst, - PHYSFS_uint64 len); - -/** - * \fn void PHYSFS_utf8ToUcs4(const char *src, PHYSFS_uint32 *dst, PHYSFS_uint64 len) - * \brief Convert a UTF-8 string to a UCS-4 string. - * - * \warning This function will not report an error if there are invalid UTF-8 - * sequences in the source string. It will replace them with a '?' - * character and continue on. - * - * UCS-4 (aka UTF-32) strings are 32-bits per character: \c wchar_t on Unix. - * - * To ensure that the destination buffer is large enough for the conversion, - * please allocate a buffer that is four times the size of the source buffer. - * UTF-8 uses from one to four bytes per character, but UCS-4 always uses - * four, so an entirely low-ASCII string will quadruple in size! - * - * Strings that don't fit in the destination buffer will be truncated, but - * will always be null-terminated and never have an incomplete UCS-4 - * sequence at the end. If the buffer length is 0, this function does nothing. - * - * \param src Null-terminated source string in UTF-8 format. - * \param dst Buffer to store converted UCS-4 string. - * \param len Size, in bytes, of destination buffer. - */ -PHYSFS_DECL void PHYSFS_utf8ToUcs4(const char *src, PHYSFS_uint32 *dst, - PHYSFS_uint64 len); - -/** - * \fn void PHYSFS_utf8FromUcs2(const PHYSFS_uint16 *src, char *dst, PHYSFS_uint64 len) - * \brief Convert a UCS-2 string to a UTF-8 string. - * - * \warning you almost certainly should use PHYSFS_utf8FromUtf16(), which - * became available in PhysicsFS 2.1, unless you know what you're doing. - * - * \warning This function will not report an error if there are invalid UCS-2 - * values in the source string. It will replace them with a '?' - * character and continue on. - * - * UCS-2 strings are 16-bits per character: \c TCHAR on Windows, when building - * with Unicode support. Please note that modern versions of Windows use - * UTF-16, which is an extended form of UCS-2, and not UCS-2 itself. You - * almost certainly want PHYSFS_utf8FromUtf16() instead. - * - * To ensure that the destination buffer is large enough for the conversion, - * please allocate a buffer that is double the size of the source buffer. - * UTF-8 never uses more than 32-bits per character, so while it may shrink - * a UCS-2 string, it may also expand it. - * - * Strings that don't fit in the destination buffer will be truncated, but - * will always be null-terminated and never have an incomplete UTF-8 - * sequence at the end. If the buffer length is 0, this function does nothing. - * - * \param src Null-terminated source string in UCS-2 format. - * \param dst Buffer to store converted UTF-8 string. - * \param len Size, in bytes, of destination buffer. - * - * \sa PHYSFS_utf8FromUtf16 - */ -PHYSFS_DECL void PHYSFS_utf8FromUcs2(const PHYSFS_uint16 *src, char *dst, - PHYSFS_uint64 len); - -/** - * \fn PHYSFS_utf8ToUcs2(const char *src, PHYSFS_uint16 *dst, PHYSFS_uint64 len) - * \brief Convert a UTF-8 string to a UCS-2 string. - * - * \warning you almost certainly should use PHYSFS_utf8ToUtf16(), which - * became available in PhysicsFS 2.1, unless you know what you're doing. - * - * \warning This function will not report an error if there are invalid UTF-8 - * sequences in the source string. It will replace them with a '?' - * character and continue on. - * - * UCS-2 strings are 16-bits per character: \c TCHAR on Windows, when building - * with Unicode support. Please note that modern versions of Windows use - * UTF-16, which is an extended form of UCS-2, and not UCS-2 itself. You - * almost certainly want PHYSFS_utf8ToUtf16() instead, but you need to - * understand how that changes things, too. - * - * To ensure that the destination buffer is large enough for the conversion, - * please allocate a buffer that is double the size of the source buffer. - * UTF-8 uses from one to four bytes per character, but UCS-2 always uses - * two, so an entirely low-ASCII string will double in size! - * - * Strings that don't fit in the destination buffer will be truncated, but - * will always be null-terminated and never have an incomplete UCS-2 - * sequence at the end. If the buffer length is 0, this function does nothing. - * - * \param src Null-terminated source string in UTF-8 format. - * \param dst Buffer to store converted UCS-2 string. - * \param len Size, in bytes, of destination buffer. - * - * \sa PHYSFS_utf8ToUtf16 - */ -PHYSFS_DECL void PHYSFS_utf8ToUcs2(const char *src, PHYSFS_uint16 *dst, - PHYSFS_uint64 len); - -/** - * \fn void PHYSFS_utf8FromLatin1(const char *src, char *dst, PHYSFS_uint64 len) - * \brief Convert a UTF-8 string to a Latin1 string. - * - * Latin1 strings are 8-bits per character: a popular "high ASCII" encoding. - * - * To ensure that the destination buffer is large enough for the conversion, - * please allocate a buffer that is double the size of the source buffer. - * UTF-8 expands latin1 codepoints over 127 from 1 to 2 bytes, so the string - * may grow in some cases. - * - * Strings that don't fit in the destination buffer will be truncated, but - * will always be null-terminated and never have an incomplete UTF-8 - * sequence at the end. If the buffer length is 0, this function does nothing. - * - * Please note that we do not supply a UTF-8 to Latin1 converter, since Latin1 - * can't express most Unicode codepoints. It's a legacy encoding; you should - * be converting away from it at all times. - * - * \param src Null-terminated source string in Latin1 format. - * \param dst Buffer to store converted UTF-8 string. - * \param len Size, in bytes, of destination buffer. - */ -PHYSFS_DECL void PHYSFS_utf8FromLatin1(const char *src, char *dst, - PHYSFS_uint64 len); - -/* Everything above this line is part of the PhysicsFS 2.0 API. */ - -/** - * \fn int PHYSFS_caseFold(const PHYSFS_uint32 from, PHYSFS_uint32 *to) - * \brief "Fold" a Unicode codepoint to a lowercase equivalent. - * - * (This is for limited, hardcore use. If you don't immediately see a need - * for it, you can probably ignore this forever.) - * - * This will convert a Unicode codepoint into its lowercase equivalent. - * Bogus codepoints and codepoints without a lowercase equivalent will - * be returned unconverted. - * - * Note that you might get multiple codepoints in return! The German Eszett, - * for example, will fold down to two lowercase latin 's' codepoints. The - * theory is that if you fold two strings, one with an Eszett and one with - * "SS" down, they will match. - * - * \warning Anyone that is a student of Unicode knows about the "Turkish I" - * problem. This API does not handle it. Assume this one letter - * in all of Unicode will definitely fold sort of incorrectly. If - * you don't know what this is about, you can probably ignore this - * problem for most of the planet, but perfection is impossible. - * - * \param from The codepoint to fold. - * \param to Buffer to store the folded codepoint values into. This should - * point to space for at least 3 PHYSFS_uint32 slots. - * \return The number of codepoints the folding produced. Between 1 and 3. - */ -PHYSFS_DECL int PHYSFS_caseFold(const PHYSFS_uint32 from, PHYSFS_uint32 *to); - - -/** - * \fn int PHYSFS_utf8stricmp(const char *str1, const char *str2) - * \brief Case-insensitive compare of two UTF-8 strings. - * - * This is a strcasecmp/stricmp replacement that expects both strings - * to be in UTF-8 encoding. It will do "case folding" to decide if the - * Unicode codepoints in the strings match. - * - * If both strings are exclusively low-ASCII characters, this will do the - * right thing, as that is also valid UTF-8. If there are any high-ASCII - * chars, this will not do what you expect! - * - * It will report which string is "greater than" the other, but be aware that - * this doesn't necessarily mean anything: 'a' may be "less than" 'b', but - * a Japanese kuten has no meaningful alphabetically relationship to - * a Greek lambda, but being able to assign a reliable "value" makes sorting - * algorithms possible, if not entirely sane. Most cases should treat the - * return value as "equal" or "not equal". - * - * Like stricmp, this expects both strings to be NULL-terminated. - * - * \param str1 First string to compare. - * \param str2 Second string to compare. - * \return -1 if str1 is "less than" str2, 1 if "greater than", 0 if equal. - */ -PHYSFS_DECL int PHYSFS_utf8stricmp(const char *str1, const char *str2); - -/** - * \fn int PHYSFS_utf16stricmp(const PHYSFS_uint16 *str1, const PHYSFS_uint16 *str2) - * \brief Case-insensitive compare of two UTF-16 strings. - * - * This is a strcasecmp/stricmp replacement that expects both strings - * to be in UTF-16 encoding. It will do "case folding" to decide if the - * Unicode codepoints in the strings match. - * - * It will report which string is "greater than" the other, but be aware that - * this doesn't necessarily mean anything: 'a' may be "less than" 'b', but - * a Japanese kuten has no meaningful alphabetically relationship to - * a Greek lambda, but being able to assign a reliable "value" makes sorting - * algorithms possible, if not entirely sane. Most cases should treat the - * return value as "equal" or "not equal". - * - * Like stricmp, this expects both strings to be NULL-terminated. - * - * \param str1 First string to compare. - * \param str2 Second string to compare. - * \return -1 if str1 is "less than" str2, 1 if "greater than", 0 if equal. - */ -PHYSFS_DECL int PHYSFS_utf16stricmp(const PHYSFS_uint16 *str1, - const PHYSFS_uint16 *str2); - -/** - * \fn int PHYSFS_ucs4stricmp(const PHYSFS_uint32 *str1, const PHYSFS_uint32 *str2) - * \brief Case-insensitive compare of two UCS-4 strings. - * - * This is a strcasecmp/stricmp replacement that expects both strings - * to be in UCS-4 (aka UTF-32) encoding. It will do "case folding" to decide - * if the Unicode codepoints in the strings match. - * - * It will report which string is "greater than" the other, but be aware that - * this doesn't necessarily mean anything: 'a' may be "less than" 'b', but - * a Japanese kuten has no meaningful alphabetically relationship to - * a Greek lambda, but being able to assign a reliable "value" makes sorting - * algorithms possible, if not entirely sane. Most cases should treat the - * return value as "equal" or "not equal". - * - * Like stricmp, this expects both strings to be NULL-terminated. - * - * \param str1 First string to compare. - * \param str2 Second string to compare. - * \return -1 if str1 is "less than" str2, 1 if "greater than", 0 if equal. - */ -PHYSFS_DECL int PHYSFS_ucs4stricmp(const PHYSFS_uint32 *str1, - const PHYSFS_uint32 *str2); - - -/** - * \typedef PHYSFS_EnumerateCallback - * \brief Possible return values from PHYSFS_EnumerateCallback. - * - * These values dictate if an enumeration callback should continue to fire, - * or stop (and why it is stopping). - * - * \sa PHYSFS_EnumerateCallback - * \sa PHYSFS_enumerate - */ -typedef enum PHYSFS_EnumerateCallbackResult -{ - PHYSFS_ENUM_ERROR = -1, /**< Stop enumerating, report error to app. */ - PHYSFS_ENUM_STOP = 0, /**< Stop enumerating, report success to app. */ - PHYSFS_ENUM_OK = 1 /**< Keep enumerating, no problems */ -} PHYSFS_EnumerateCallbackResult; - -/** - * \typedef PHYSFS_EnumerateCallback - * \brief Function signature for callbacks that enumerate and return results. - * - * This is the same thing as PHYSFS_EnumFilesCallback from PhysicsFS 2.0, - * except it can return a result from the callback: namely: if you're looking - * for something specific, once you find it, you can tell PhysicsFS to stop - * enumerating further. This is used with PHYSFS_enumerate(), which we - * hopefully got right this time. :) - * - * \param data User-defined data pointer, passed through from the API - * that eventually called the callback. - * \param origdir A string containing the full path, in platform-independent - * notation, of the directory containing this file. In most - * cases, this is the directory on which you requested - * enumeration, passed in the callback for your convenience. - * \param fname The filename that is being enumerated. It may not be in - * alphabetical order compared to other callbacks that have - * fired, and it will not contain the full path. You can - * recreate the fullpath with $origdir/$fname ... The file - * can be a subdirectory, a file, a symlink, etc. - * \return A value from PHYSFS_EnumerateCallbackResult. - * All other values are (currently) undefined; don't use them. - * - * \sa PHYSFS_enumerate - * \sa PHYSFS_EnumerateCallbackResult - */ -typedef PHYSFS_EnumerateCallbackResult (*PHYSFS_EnumerateCallback)(void *data, - const char *origdir, const char *fname); - -/** - * \fn int PHYSFS_enumerate(const char *dir, PHYSFS_EnumerateCallback c, void *d) - * \brief Get a file listing of a search path's directory, using an application-defined callback, with errors reported. - * - * Internally, PHYSFS_enumerateFiles() just calls this function and then builds - * a list before returning to the application, so functionality is identical - * except for how the information is represented to the application. - * - * Unlike PHYSFS_enumerateFiles(), this function does not return an array. - * Rather, it calls a function specified by the application once per - * element of the search path: - * - * \code - * - * static int printDir(void *data, const char *origdir, const char *fname) - * { - * printf(" * We've got [%s] in [%s].\n", fname, origdir); - * return 1; // give me more data, please. - * } - * - * // ... - * PHYSFS_enumerate("/some/path", printDir, NULL); - * \endcode - * - * Items sent to the callback are not guaranteed to be in any order whatsoever. - * There is no sorting done at this level, and if you need that, you should - * probably use PHYSFS_enumerateFiles() instead, which guarantees - * alphabetical sorting. This form reports whatever is discovered in each - * archive before moving on to the next. Even within one archive, we can't - * guarantee what order it will discover data. Any sorting you find in - * these callbacks is just pure luck. Do not rely on it. As this walks - * the entire list of archives, you may receive duplicate filenames. - * - * This API and the callbacks themselves are capable of reporting errors. - * Prior to this API, callbacks had to accept every enumerated item, even if - * they were only looking for a specific thing and wanted to stop after that, - * or had a serious error and couldn't alert anyone. Furthermore, if - * PhysicsFS itself had a problem (disk error or whatnot), it couldn't report - * it to the calling app, it would just have to skip items or stop - * enumerating outright, and the caller wouldn't know it had lost some data - * along the way. - * - * Now the caller can be sure it got a complete data set, and its callback has - * control if it wants enumeration to stop early. See the documentation for - * PHYSFS_EnumerateCallback for details on how your callback should behave. - * - * \param dir Directory, in platform-independent notation, to enumerate. - * \param c Callback function to notify about search path elements. - * \param d Application-defined data passed to callback. Can be NULL. - * \return non-zero on success, zero on failure. Use - * PHYSFS_getLastErrorCode() to obtain the specific error. If the - * callback returns PHYSFS_ENUM_STOP to stop early, this will be - * considered success. Callbacks returning PHYSFS_ENUM_ERROR will - * make this function return zero and set the error code to - * PHYSFS_ERR_APP_CALLBACK. - * - * \sa PHYSFS_EnumerateCallback - * \sa PHYSFS_enumerateFiles - */ -PHYSFS_DECL int PHYSFS_enumerate(const char *dir, PHYSFS_EnumerateCallback c, - void *d); - - -/** - * \fn int PHYSFS_unmount(const char *oldDir) - * \brief Remove a directory or archive from the search path. - * - * This is functionally equivalent to PHYSFS_removeFromSearchPath(), but that - * function is deprecated to keep the vocabulary paired with PHYSFS_mount(). - * - * This must be a (case-sensitive) match to a dir or archive already in the - * search path, specified in platform-dependent notation. - * - * This call will fail (and fail to remove from the path) if the element still - * has files open in it. - * - * \warning This function wants the path to the archive or directory that was - * mounted (the same string used for the "newDir" argument of - * PHYSFS_addToSearchPath or any of the mount functions), not the - * path where it is mounted in the tree (the "mountPoint" argument - * to any of the mount functions). - * - * \param oldDir dir/archive to remove. - * \return nonzero on success, zero on failure. Use - * PHYSFS_getLastErrorCode() to obtain the specific error. - * - * \sa PHYSFS_getSearchPath - * \sa PHYSFS_mount - */ -PHYSFS_DECL int PHYSFS_unmount(const char *oldDir); - - -/** - * \fn const PHYSFS_Allocator *PHYSFS_getAllocator(void) - * \brief Discover the current allocator. - * - * (This is for limited, hardcore use. If you don't immediately see a need - * for it, you can probably ignore this forever.) - * - * This function exposes the function pointers that make up the currently used - * allocator. This can be useful for apps that want to access PhysicsFS's - * internal, default allocation routines, as well as for external code that - * wants to share the same allocator, even if the application specified their - * own. - * - * This call is only valid between PHYSFS_init() and PHYSFS_deinit() calls; - * it will return NULL if the library isn't initialized. As we can't - * guarantee the state of the internal allocators unless the library is - * initialized, you shouldn't use any allocator returned here after a call - * to PHYSFS_deinit(). - * - * Do not call the returned allocator's Init() or Deinit() methods under any - * circumstances. - * - * If you aren't immediately sure what to do with this function, you can - * safely ignore it altogether. - * - * \return Current allocator, as set by PHYSFS_setAllocator(), or PhysicsFS's - * internal, default allocator if no application defined allocator - * is currently set. Will return NULL if the library is not - * initialized. - * - * \sa PHYSFS_Allocator - * \sa PHYSFS_setAllocator - */ -PHYSFS_DECL const PHYSFS_Allocator *PHYSFS_getAllocator(void); - - -/** - * \enum PHYSFS_FileType - * \brief Type of a File - * - * Possible types of a file. - * - * \sa PHYSFS_stat - */ -typedef enum PHYSFS_FileType -{ - PHYSFS_FILETYPE_REGULAR, /**< a normal file */ - PHYSFS_FILETYPE_DIRECTORY, /**< a directory */ - PHYSFS_FILETYPE_SYMLINK, /**< a symlink */ - PHYSFS_FILETYPE_OTHER /**< something completely different like a device */ -} PHYSFS_FileType; - -/** - * \struct PHYSFS_Stat - * \brief Meta data for a file or directory - * - * Container for various meta data about a file in the virtual file system. - * PHYSFS_stat() uses this structure for returning the information. The time - * data will be either the number of seconds since the Unix epoch (midnight, - * Jan 1, 1970), or -1 if the information isn't available or applicable. - * The (filesize) field is measured in bytes. - * The (readonly) field tells you whether the archive thinks a file is - * not writable, but tends to be only an estimate (for example, your write - * dir might overlap with a .zip file, meaning you _can_ successfully open - * that path for writing, as it gets created elsewhere. - * - * \sa PHYSFS_stat - * \sa PHYSFS_FileType - */ -typedef struct PHYSFS_Stat -{ - PHYSFS_sint64 filesize; /**< size in bytes, -1 for non-files and unknown */ - PHYSFS_sint64 modtime; /**< last modification time */ - PHYSFS_sint64 createtime; /**< like modtime, but for file creation time */ - PHYSFS_sint64 accesstime; /**< like modtime, but for file access time */ - PHYSFS_FileType filetype; /**< File? Directory? Symlink? */ - int readonly; /**< non-zero if read only, zero if writable. */ -} PHYSFS_Stat; - -/** - * \fn int PHYSFS_stat(const char *fname, PHYSFS_Stat *stat) - * \brief Get various information about a directory or a file. - * - * Obtain various information about a file or directory from the meta data. - * - * This function will never follow symbolic links. If you haven't enabled - * symlinks with PHYSFS_permitSymbolicLinks(), stat'ing a symlink will be - * treated like stat'ing a non-existant file. If symlinks are enabled, - * stat'ing a symlink will give you information on the link itself and not - * what it points to. - * - * \param fname filename to check, in platform-indepedent notation. - * \param stat pointer to structure to fill in with data about (fname). - * \return non-zero on success, zero on failure. On failure, (stat)'s - * contents are undefined. - * - * \sa PHYSFS_Stat - */ -PHYSFS_DECL int PHYSFS_stat(const char *fname, PHYSFS_Stat *stat); - - -/** - * \fn void PHYSFS_utf8FromUtf16(const PHYSFS_uint16 *src, char *dst, PHYSFS_uint64 len) - * \brief Convert a UTF-16 string to a UTF-8 string. - * - * \warning This function will not report an error if there are invalid UTF-16 - * sequences in the source string. It will replace them with a '?' - * character and continue on. - * - * UTF-16 strings are 16-bits per character (except some chars, which are - * 32-bits): \c TCHAR on Windows, when building with Unicode support. Modern - * Windows releases use UTF-16. Windows releases before 2000 used TCHAR, but - * only handled UCS-2. UTF-16 _is_ UCS-2, except for the characters that - * are 4 bytes, which aren't representable in UCS-2 at all anyhow. If you - * aren't sure, you should be using UTF-16 at this point on Windows. - * - * To ensure that the destination buffer is large enough for the conversion, - * please allocate a buffer that is double the size of the source buffer. - * UTF-8 never uses more than 32-bits per character, so while it may shrink - * a UTF-16 string, it may also expand it. - * - * Strings that don't fit in the destination buffer will be truncated, but - * will always be null-terminated and never have an incomplete UTF-8 - * sequence at the end. If the buffer length is 0, this function does nothing. - * - * \param src Null-terminated source string in UTF-16 format. - * \param dst Buffer to store converted UTF-8 string. - * \param len Size, in bytes, of destination buffer. - */ -PHYSFS_DECL void PHYSFS_utf8FromUtf16(const PHYSFS_uint16 *src, char *dst, - PHYSFS_uint64 len); - -/** - * \fn PHYSFS_utf8ToUtf16(const char *src, PHYSFS_uint16 *dst, PHYSFS_uint64 len) - * \brief Convert a UTF-8 string to a UTF-16 string. - * - * \warning This function will not report an error if there are invalid UTF-8 - * sequences in the source string. It will replace them with a '?' - * character and continue on. - * - * UTF-16 strings are 16-bits per character (except some chars, which are - * 32-bits): \c TCHAR on Windows, when building with Unicode support. Modern - * Windows releases use UTF-16. Windows releases before 2000 used TCHAR, but - * only handled UCS-2. UTF-16 _is_ UCS-2, except for the characters that - * are 4 bytes, which aren't representable in UCS-2 at all anyhow. If you - * aren't sure, you should be using UTF-16 at this point on Windows. - * - * To ensure that the destination buffer is large enough for the conversion, - * please allocate a buffer that is double the size of the source buffer. - * UTF-8 uses from one to four bytes per character, but UTF-16 always uses - * two to four, so an entirely low-ASCII string will double in size! The - * UTF-16 characters that would take four bytes also take four bytes in UTF-8, - * so you don't need to allocate 4x the space just in case: double will do. - * - * Strings that don't fit in the destination buffer will be truncated, but - * will always be null-terminated and never have an incomplete UTF-16 - * surrogate pair at the end. If the buffer length is 0, this function does - * nothing. - * - * \param src Null-terminated source string in UTF-8 format. - * \param dst Buffer to store converted UTF-16 string. - * \param len Size, in bytes, of destination buffer. - * - * \sa PHYSFS_utf8ToUtf16 - */ -PHYSFS_DECL void PHYSFS_utf8ToUtf16(const char *src, PHYSFS_uint16 *dst, - PHYSFS_uint64 len); - - -/** - * \fn PHYSFS_sint64 PHYSFS_readBytes(PHYSFS_File *handle, void *buffer, PHYSFS_uint64 len) - * \brief Read bytes from a PhysicsFS filehandle - * - * The file must be opened for reading. - * - * \param handle handle returned from PHYSFS_openRead(). - * \param buffer buffer of at least (len) bytes to store read data into. - * \param len number of bytes being read from (handle). - * \return number of bytes read. This may be less than (len); this does not - * signify an error, necessarily (a short read may mean EOF). - * PHYSFS_getLastErrorCode() can shed light on the reason this might - * be < (len), as can PHYSFS_eof(). -1 if complete failure. - * - * \sa PHYSFS_eof - */ -PHYSFS_DECL PHYSFS_sint64 PHYSFS_readBytes(PHYSFS_File *handle, void *buffer, - PHYSFS_uint64 len); - -/** - * \fn PHYSFS_sint64 PHYSFS_writeBytes(PHYSFS_File *handle, const void *buffer, PHYSFS_uint64 len) - * \brief Write data to a PhysicsFS filehandle - * - * The file must be opened for writing. - * - * Please note that while (len) is an unsigned 64-bit integer, you are limited - * to 63 bits (9223372036854775807 bytes), so we can return a negative value - * on error. If length is greater than 0x7FFFFFFFFFFFFFFF, this function will - * immediately fail. For systems without a 64-bit datatype, you are limited - * to 31 bits (0x7FFFFFFF, or 2147483647 bytes). We trust most things won't - * need to do multiple gigabytes of i/o in one call anyhow, but why limit - * things? - * - * \param handle retval from PHYSFS_openWrite() or PHYSFS_openAppend(). - * \param buffer buffer of (len) bytes to write to (handle). - * \param len number of bytes being written to (handle). - * \return number of bytes written. This may be less than (len); in the case - * of an error, the system may try to write as many bytes as possible, - * so an incomplete write might occur. PHYSFS_getLastErrorCode() can - * shed light on the reason this might be < (len). -1 if complete - * failure. - */ -PHYSFS_DECL PHYSFS_sint64 PHYSFS_writeBytes(PHYSFS_File *handle, - const void *buffer, - PHYSFS_uint64 len); - - -/** - * \struct PHYSFS_Io - * \brief An abstract i/o interface. - * - * \warning This is advanced, hardcore stuff. You don't need this unless you - * really know what you're doing. Most apps will not need this. - * - * Historically, PhysicsFS provided access to the physical filesystem and - * archives within that filesystem. However, sometimes you need more power - * than this. Perhaps you need to provide an archive that is entirely - * contained in RAM, or you need to bridge some other file i/o API to - * PhysicsFS, or you need to translate the bits (perhaps you have a - * a standard .zip file that's encrypted, and you need to decrypt on the fly - * for the unsuspecting zip archiver). - * - * A PHYSFS_Io is the interface that Archivers use to get archive data. - * Historically, this has mapped to file i/o to the physical filesystem, but - * as of PhysicsFS 2.1, applications can provide their own i/o implementations - * at runtime. - * - * This interface isn't necessarily a good universal fit for i/o. There are a - * few requirements of note: - * - * - They only do blocking i/o (at least, for now). - * - They need to be able to duplicate. If you have a file handle from - * fopen(), you need to be able to create a unique clone of it (so we - * have two handles to the same file that can both seek/read/etc without - * stepping on each other). - * - They need to know the size of their entire data set. - * - They need to be able to seek and rewind on demand. - * - * ...in short, you're probably not going to write an HTTP implementation. - * - * Thread safety: PHYSFS_Io implementations are not guaranteed to be thread - * safe in themselves. Under the hood where PhysicsFS uses them, the library - * provides its own locks. If you plan to use them directly from separate - * threads, you should either use mutexes to protect them, or don't use the - * same PHYSFS_Io from two threads at the same time. - * - * \sa PHYSFS_mountIo - */ -typedef struct PHYSFS_Io -{ - /** - * \brief Binary compatibility information. - * - * This must be set to zero at this time. Future versions of this - * struct will increment this field, so we know what a given - * implementation supports. We'll presumably keep supporting older - * versions as we offer new features, though. - */ - PHYSFS_uint32 version; - - /** - * \brief Instance data for this struct. - * - * Each instance has a pointer associated with it that can be used to - * store anything it likes. This pointer is per-instance of the stream, - * so presumably it will change when calling duplicate(). This can be - * deallocated during the destroy() method. - */ - void *opaque; - - /** - * \brief Read more data. - * - * Read (len) bytes from the interface, at the current i/o position, and - * store them in (buffer). The current i/o position should move ahead - * by the number of bytes successfully read. - * - * You don't have to implement this; set it to NULL if not implemented. - * This will only be used if the file is opened for reading. If set to - * NULL, a default implementation that immediately reports failure will - * be used. - * - * \param io The i/o instance to read from. - * \param buf The buffer to store data into. It must be at least - * (len) bytes long and can't be NULL. - * \param len The number of bytes to read from the interface. - * \return number of bytes read from file, 0 on EOF, -1 if complete - * failure. - */ - PHYSFS_sint64 (*read)(struct PHYSFS_Io *io, void *buf, PHYSFS_uint64 len); - - /** - * \brief Write more data. - * - * Write (len) bytes from (buffer) to the interface at the current i/o - * position. The current i/o position should move ahead by the number of - * bytes successfully written. - * - * You don't have to implement this; set it to NULL if not implemented. - * This will only be used if the file is opened for writing. If set to - * NULL, a default implementation that immediately reports failure will - * be used. - * - * You are allowed to buffer; a write can succeed here and then later - * fail when flushing. Note that PHYSFS_setBuffer() may be operating a - * level above your i/o, so you should usually not implement your - * own buffering routines. - * - * \param io The i/o instance to write to. - * \param buffer The buffer to read data from. It must be at least - * (len) bytes long and can't be NULL. - * \param len The number of bytes to read from (buffer). - * \return number of bytes written to file, -1 if complete failure. - */ - PHYSFS_sint64 (*write)(struct PHYSFS_Io *io, const void *buffer, - PHYSFS_uint64 len); - - /** - * \brief Move i/o position to a given byte offset from start. - * - * This method moves the i/o position, so the next read/write will - * be of the byte at (offset) offset. Seeks past the end of file should - * be treated as an error condition. - * - * \param io The i/o instance to seek. - * \param offset The new byte offset for the i/o position. - * \return non-zero on success, zero on error. - */ - int (*seek)(struct PHYSFS_Io *io, PHYSFS_uint64 offset); - - /** - * \brief Report current i/o position. - * - * Return bytes offset, or -1 if you aren't able to determine. A failure - * will almost certainly be fatal to further use of this stream, so you - * may not leave this unimplemented. - * - * \param io The i/o instance to query. - * \return The current byte offset for the i/o position, -1 if unknown. - */ - PHYSFS_sint64 (*tell)(struct PHYSFS_Io *io); - - /** - * \brief Determine size of the i/o instance's dataset. - * - * Return number of bytes available in the file, or -1 if you - * aren't able to determine. A failure will almost certainly be fatal - * to further use of this stream, so you may not leave this unimplemented. - * - * \param io The i/o instance to query. - * \return Total size, in bytes, of the dataset. - */ - PHYSFS_sint64 (*length)(struct PHYSFS_Io *io); - - /** - * \brief Duplicate this i/o instance. - * - * This needs to result in a full copy of this PHYSFS_Io, that can live - * completely independently. The copy needs to be able to perform all - * its operations without altering the original, including either object - * being destroyed separately (so, for example: they can't share a file - * handle; they each need their own). - * - * If you can't duplicate a handle, it's legal to return NULL, but you - * almost certainly need this functionality if you want to use this to - * PHYSFS_Io to back an archive. - * - * \param io The i/o instance to duplicate. - * \return A new value for a stream's (opaque) field, or NULL on error. - */ - struct PHYSFS_Io *(*duplicate)(struct PHYSFS_Io *io); - - /** - * \brief Flush resources to media, or wherever. - * - * This is the chance to report failure for writes that had claimed - * success earlier, but still had a chance to actually fail. This method - * can be NULL if flushing isn't necessary. - * - * This function may be called before destroy(), as it can report failure - * and destroy() can not. It may be called at other times, too. - * - * \param io The i/o instance to flush. - * \return Zero on error, non-zero on success. - */ - int (*flush)(struct PHYSFS_Io *io); - - /** - * \brief Cleanup and deallocate i/o instance. - * - * Free associated resources, including (opaque) if applicable. - * - * This function must always succeed: as such, it returns void. The - * system may call your flush() method before this. You may report - * failure there if necessary. This method may still be called if - * flush() fails, in which case you'll have to abandon unflushed data - * and other failing conditions and clean up. - * - * Once this method is called for a given instance, the system will assume - * it is unsafe to touch that instance again and will discard any - * references to it. - * - * \param s The i/o instance to destroy. - */ - void (*destroy)(struct PHYSFS_Io *io); -} PHYSFS_Io; - - -/** - * \fn int PHYSFS_mountIo(PHYSFS_Io *io, const char *newDir, const char *mountPoint, int appendToPath) - * \brief Add an archive, built on a PHYSFS_Io, to the search path. - * - * \warning Unless you have some special, low-level need, you should be using - * PHYSFS_mount() instead of this. - * - * This function operates just like PHYSFS_mount(), but takes a PHYSFS_Io - * instead of a pathname. Behind the scenes, PHYSFS_mount() calls this - * function with a physical-filesystem-based PHYSFS_Io. - * - * (newDir) must be a unique string to identify this archive. It is used - * to optimize archiver selection (if you name it XXXXX.zip, we might try - * the ZIP archiver first, for example, or directly choose an archiver that - * can only trust the data is valid by filename extension). It doesn't - * need to refer to a real file at all. If the filename extension isn't - * helpful, the system will try every archiver until one works or none - * of them do. This filename must be unique, as the system won't allow you - * to have two archives with the same name. - * - * (io) must remain until the archive is unmounted. When the archive is - * unmounted, the system will call (io)->destroy(io), which will give you - * a chance to free your resources. - * - * If this function fails, (io)->destroy(io) is not called. - * - * \param io i/o instance for archive to add to the path. - * \param newDir Filename that can represent this stream. - * \param mountPoint Location in the interpolated tree that this archive - * will be "mounted", in platform-independent notation. - * NULL or "" is equivalent to "/". - * \param appendToPath nonzero to append to search path, zero to prepend. - * \return nonzero if added to path, zero on failure (bogus archive, stream - * i/o issue, etc). Use PHYSFS_getLastErrorCode() to obtain - * the specific error. - * - * \sa PHYSFS_unmount - * \sa PHYSFS_getSearchPath - * \sa PHYSFS_getMountPoint - */ -PHYSFS_DECL int PHYSFS_mountIo(PHYSFS_Io *io, const char *newDir, - const char *mountPoint, int appendToPath); - - -/** - * \fn int PHYSFS_mountMemory(const void *buf, PHYSFS_uint64 len, void (*del)(void *), const char *newDir, const char *mountPoint, int appendToPath) - * \brief Add an archive, contained in a memory buffer, to the search path. - * - * \warning Unless you have some special, low-level need, you should be using - * PHYSFS_mount() instead of this. - * - * This function operates just like PHYSFS_mount(), but takes a memory buffer - * instead of a pathname. This buffer contains all the data of the archive, - * and is used instead of a real file in the physical filesystem. - * - * (newDir) must be a unique string to identify this archive. It is used - * to optimize archiver selection (if you name it XXXXX.zip, we might try - * the ZIP archiver first, for example, or directly choose an archiver that - * can only trust the data is valid by filename extension). It doesn't - * need to refer to a real file at all. If the filename extension isn't - * helpful, the system will try every archiver until one works or none - * of them do. This filename must be unique, as the system won't allow you - * to have two archives with the same name. - * - * (ptr) must remain until the archive is unmounted. When the archive is - * unmounted, the system will call (del)(ptr), which will notify you that - * the system is done with the buffer, and give you a chance to free your - * resources. (del) can be NULL, in which case the system will make no - * attempt to free the buffer. - * - * If this function fails, (del) is not called. - * - * \param buf Address of the memory buffer containing the archive data. - * \param len Size of memory buffer, in bytes. - * \param del A callback that triggers upon unmount. Can be NULL. - * \param newDir Filename that can represent this stream. - * \param mountPoint Location in the interpolated tree that this archive - * will be "mounted", in platform-independent notation. - * NULL or "" is equivalent to "/". - * \param appendToPath nonzero to append to search path, zero to prepend. - * \return nonzero if added to path, zero on failure (bogus archive, etc). - * Use PHYSFS_getLastErrorCode() to obtain the specific error. - * - * \sa PHYSFS_unmount - * \sa PHYSFS_getSearchPath - * \sa PHYSFS_getMountPoint - */ -PHYSFS_DECL int PHYSFS_mountMemory(const void *buf, PHYSFS_uint64 len, - void (*del)(void *), const char *newDir, - const char *mountPoint, int appendToPath); - - -/** - * \fn int PHYSFS_mountHandle(PHYSFS_File *file, const char *newDir, const char *mountPoint, int appendToPath) - * \brief Add an archive, contained in a PHYSFS_File handle, to the search path. - * - * \warning Unless you have some special, low-level need, you should be using - * PHYSFS_mount() instead of this. - * - * \warning Archives-in-archives may be very slow! While a PHYSFS_File can - * seek even when the data is compressed, it may do so by rewinding - * to the start and decompressing everything before the seek point. - * Normal archive usage may do a lot of seeking behind the scenes. - * As such, you might find normal archive usage extremely painful - * if mounted this way. Plan accordingly: if you, say, have a - * self-extracting .zip file, and want to mount something in it, - * compress the contents of the inner archive and make sure the outer - * .zip file doesn't compress the inner archive too. - * - * This function operates just like PHYSFS_mount(), but takes a PHYSFS_File - * handle instead of a pathname. This handle contains all the data of the - * archive, and is used instead of a real file in the physical filesystem. - * The PHYSFS_File may be backed by a real file in the physical filesystem, - * but isn't necessarily. The most popular use for this is likely to mount - * archives stored inside other archives. - * - * (newDir) must be a unique string to identify this archive. It is used - * to optimize archiver selection (if you name it XXXXX.zip, we might try - * the ZIP archiver first, for example, or directly choose an archiver that - * can only trust the data is valid by filename extension). It doesn't - * need to refer to a real file at all. If the filename extension isn't - * helpful, the system will try every archiver until one works or none - * of them do. This filename must be unique, as the system won't allow you - * to have two archives with the same name. - * - * (file) must remain until the archive is unmounted. When the archive is - * unmounted, the system will call PHYSFS_close(file). If you need this - * handle to survive, you will have to wrap this in a PHYSFS_Io and use - * PHYSFS_mountIo() instead. - * - * If this function fails, PHYSFS_close(file) is not called. - * - * \param file The PHYSFS_File handle containing archive data. - * \param newDir Filename that can represent this stream. - * \param mountPoint Location in the interpolated tree that this archive - * will be "mounted", in platform-independent notation. - * NULL or "" is equivalent to "/". - * \param appendToPath nonzero to append to search path, zero to prepend. - * \return nonzero if added to path, zero on failure (bogus archive, etc). - * Use PHYSFS_getLastErrorCode() to obtain the specific error. - * - * \sa PHYSFS_unmount - * \sa PHYSFS_getSearchPath - * \sa PHYSFS_getMountPoint - */ -PHYSFS_DECL int PHYSFS_mountHandle(PHYSFS_File *file, const char *newDir, - const char *mountPoint, int appendToPath); - - -/** - * \enum PHYSFS_ErrorCode - * \brief Values that represent specific causes of failure. - * - * Most of the time, you should only concern yourself with whether a given - * operation failed or not, but there may be occasions where you plan to - * handle a specific failure case gracefully, so we provide specific error - * codes. - * - * Most of these errors are a little vague, and most aren't things you can - * fix...if there's a permission error, for example, all you can really do - * is pass that information on to the user and let them figure out how to - * handle it. In most these cases, your program should only care that it - * failed to accomplish its goals, and not care specifically why. - * - * \sa PHYSFS_getLastErrorCode - * \sa PHYSFS_getErrorByCode - */ -typedef enum PHYSFS_ErrorCode -{ - PHYSFS_ERR_OK, /**< Success; no error. */ - PHYSFS_ERR_OTHER_ERROR, /**< Error not otherwise covered here. */ - PHYSFS_ERR_OUT_OF_MEMORY, /**< Memory allocation failed. */ - PHYSFS_ERR_NOT_INITIALIZED, /**< PhysicsFS is not initialized. */ - PHYSFS_ERR_IS_INITIALIZED, /**< PhysicsFS is already initialized. */ - PHYSFS_ERR_ARGV0_IS_NULL, /**< Needed argv[0], but it is NULL. */ - PHYSFS_ERR_UNSUPPORTED, /**< Operation or feature unsupported. */ - PHYSFS_ERR_PAST_EOF, /**< Attempted to access past end of file. */ - PHYSFS_ERR_FILES_STILL_OPEN, /**< Files still open. */ - PHYSFS_ERR_INVALID_ARGUMENT, /**< Bad parameter passed to an function. */ - PHYSFS_ERR_NOT_MOUNTED, /**< Requested archive/dir not mounted. */ - PHYSFS_ERR_NOT_FOUND, /**< File (or whatever) not found. */ - PHYSFS_ERR_SYMLINK_FORBIDDEN,/**< Symlink seen when not permitted. */ - PHYSFS_ERR_NO_WRITE_DIR, /**< No write dir has been specified. */ - PHYSFS_ERR_OPEN_FOR_READING, /**< Wrote to a file opened for reading. */ - PHYSFS_ERR_OPEN_FOR_WRITING, /**< Read from a file opened for writing. */ - PHYSFS_ERR_NOT_A_FILE, /**< Needed a file, got a directory (etc). */ - PHYSFS_ERR_READ_ONLY, /**< Wrote to a read-only filesystem. */ - PHYSFS_ERR_CORRUPT, /**< Corrupted data encountered. */ - PHYSFS_ERR_SYMLINK_LOOP, /**< Infinite symbolic link loop. */ - PHYSFS_ERR_IO, /**< i/o error (hardware failure, etc). */ - PHYSFS_ERR_PERMISSION, /**< Permission denied. */ - PHYSFS_ERR_NO_SPACE, /**< No space (disk full, over quota, etc) */ - PHYSFS_ERR_BAD_FILENAME, /**< Filename is bogus/insecure. */ - PHYSFS_ERR_BUSY, /**< Tried to modify a file the OS needs. */ - PHYSFS_ERR_DIR_NOT_EMPTY, /**< Tried to delete dir with files in it. */ - PHYSFS_ERR_OS_ERROR, /**< Unspecified OS-level error. */ - PHYSFS_ERR_DUPLICATE, /**< Duplicate entry. */ - PHYSFS_ERR_BAD_PASSWORD, /**< Bad password. */ - PHYSFS_ERR_APP_CALLBACK /**< Application callback reported error. */ -} PHYSFS_ErrorCode; - - -/** - * \fn PHYSFS_ErrorCode PHYSFS_getLastErrorCode(void) - * \brief Get machine-readable error information. - * - * Get the last PhysicsFS error message as an integer value. This will return - * PHYSFS_ERR_OK if there's been no error since the last call to this - * function. Each thread has a unique error state associated with it, but - * each time a new error message is set, it will overwrite the previous one - * associated with that thread. It is safe to call this function at anytime, - * even before PHYSFS_init(). - * - * PHYSFS_getLastError() and PHYSFS_getLastErrorCode() both reset the same - * thread-specific error state. Calling one will wipe out the other's - * data. If you need both, call PHYSFS_getLastErrorCode(), then pass that - * value to PHYSFS_getErrorByCode(). - * - * Generally, applications should only concern themselves with whether a - * given function failed; however, if you require more specifics, you can - * try this function to glean information, if there's some specific problem - * you're expecting and plan to handle. But with most things that involve - * file systems, the best course of action is usually to give up, report the - * problem to the user, and let them figure out what should be done about it. - * For that, you might prefer PHYSFS_getErrorByCode() instead. - * - * \return Enumeration value that represents last reported error. - * - * \sa PHYSFS_getErrorByCode - */ -PHYSFS_DECL PHYSFS_ErrorCode PHYSFS_getLastErrorCode(void); - - -/** - * \fn const char *PHYSFS_getErrorByCode(PHYSFS_ErrorCode code) - * \brief Get human-readable description string for a given error code. - * - * Get a static string, in UTF-8 format, that represents an English - * description of a given error code. - * - * This string is guaranteed to never change (although we may add new strings - * for new error codes in later versions of PhysicsFS), so you can use it - * for keying a localization dictionary. - * - * It is safe to call this function at anytime, even before PHYSFS_init(). - * - * These strings are meant to be passed on directly to the user. - * Generally, applications should only concern themselves with whether a - * given function failed, but not care about the specifics much. - * - * Do not attempt to free the returned strings; they are read-only and you - * don't own their memory pages. - * - * \param code Error code to convert to a string. - * \return READ ONLY string of requested error message, NULL if this - * is not a valid PhysicsFS error code. Always check for NULL if - * you might be looking up an error code that didn't exist in an - * earlier version of PhysicsFS. - * - * \sa PHYSFS_getLastErrorCode - */ -PHYSFS_DECL const char *PHYSFS_getErrorByCode(PHYSFS_ErrorCode code); - -/** - * \fn void PHYSFS_setErrorCode(PHYSFS_ErrorCode code) - * \brief Set the current thread's error code. - * - * This lets you set the value that will be returned by the next call to - * PHYSFS_getLastErrorCode(). This will replace any existing error code, - * whether set by your application or internally by PhysicsFS. - * - * Error codes are stored per-thread; what you set here will not be - * accessible to another thread. - * - * Any call into PhysicsFS may change the current error code, so any code you - * set here is somewhat fragile, and thus you shouldn't build any serious - * error reporting framework on this function. The primary goal of this - * function is to allow PHYSFS_Io implementations to set the error state, - * which generally will be passed back to your application when PhysicsFS - * makes a PHYSFS_Io call that fails internally. - * - * This function doesn't care if the error code is a value known to PhysicsFS - * or not (but PHYSFS_getErrorByCode() will return NULL for unknown values). - * The value will be reported unmolested by PHYSFS_getLastErrorCode(). - * - * \param code Error code to become the current thread's new error state. - * - * \sa PHYSFS_getLastErrorCode - * \sa PHYSFS_getErrorByCode - */ -PHYSFS_DECL void PHYSFS_setErrorCode(PHYSFS_ErrorCode code); - - -/** - * \fn const char *PHYSFS_getPrefDir(const char *org, const char *app) - * \brief Get the user-and-app-specific path where files can be written. - * - * Helper function. - * - * Get the "pref dir". This is meant to be where users can write personal - * files (preferences and save games, etc) that are specific to your - * application. This directory is unique per user, per application. - * - * This function will decide the appropriate location in the native filesystem, - * create the directory if necessary, and return a string in - * platform-dependent notation, suitable for passing to PHYSFS_setWriteDir(). - * - * On Windows, this might look like: - * "C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name" - * - * On Linux, this might look like: - * "/home/bob/.local/share/My Program Name" - * - * On Mac OS X, this might look like: - * "/Users/bob/Library/Application Support/My Program Name" - * - * (etc.) - * - * You should probably use the pref dir for your write dir, and also put it - * near the beginning of your search path. Older versions of PhysicsFS - * offered only PHYSFS_getUserDir() and left you to figure out where the - * files should go under that tree. This finds the correct location - * for whatever platform, which not only changes between operating systems, - * but also versions of the same operating system. - * - * You specify the name of your organization (if it's not a real organization, - * your name or an Internet domain you own might do) and the name of your - * application. These should be proper names. - * - * Both the (org) and (app) strings may become part of a directory name, so - * please follow these rules: - * - * - Try to use the same org string (including case-sensitivity) for - * all your applications that use this function. - * - Always use a unique app string for each one, and make sure it never - * changes for an app once you've decided on it. - * - Unicode characters are legal, as long as it's UTF-8 encoded, but... - * - ...only use letters, numbers, and spaces. Avoid punctuation like - * "Game Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient. - * - * The pointer returned by this function remains valid until you call this - * function again, or call PHYSFS_deinit(). This is not necessarily a fast - * call, though, so you should call this once at startup and copy the string - * if you need it. - * - * You should assume the path returned by this function is the only safe - * place to write files (and that PHYSFS_getUserDir() and PHYSFS_getBaseDir(), - * while they might be writable, or even parents of the returned path, aren't - * where you should be writing things). - * - * \param org The name of your organization. - * \param app The name of your application. - * \return READ ONLY string of user dir in platform-dependent notation. NULL - * if there's a problem (creating directory failed, etc). - * - * \sa PHYSFS_getBaseDir - * \sa PHYSFS_getUserDir - */ -PHYSFS_DECL const char *PHYSFS_getPrefDir(const char *org, const char *app); - - -/** - * \struct PHYSFS_Archiver - * \brief Abstract interface to provide support for user-defined archives. - * - * \warning This is advanced, hardcore stuff. You don't need this unless you - * really know what you're doing. Most apps will not need this. - * - * Historically, PhysicsFS provided a means to mount various archive file - * formats, and physical directories in the native filesystem. However, - * applications have been limited to the file formats provided by the - * library. This interface allows an application to provide their own - * archive file types. - * - * Conceptually, a PHYSFS_Archiver provides directory entries, while - * PHYSFS_Io provides data streams for those directory entries. The most - * obvious use of PHYSFS_Archiver is to provide support for an archive - * file type that isn't provided by PhysicsFS directly: perhaps some - * proprietary format that only your application needs to understand. - * - * Internally, all the built-in archive support uses this interface, so the - * best examples for building a PHYSFS_Archiver is the source code to - * PhysicsFS itself. - * - * An archiver is added to the system with PHYSFS_registerArchiver(), and then - * it will be available for use automatically with PHYSFS_mount(); if a - * given archive can be handled with your archiver, it will be given control - * as appropriate. - * - * These methods deal with dir handles. You have one instance of your - * archiver, and it generates a unique, opaque handle for each opened - * archive in its openArchive() method. Since the lifetime of an Archiver - * (not an archive) is generally the entire lifetime of the process, and it's - * assumed to be a singleton, we do not provide any instance data for the - * archiver itself; the app can just use some static variables if necessary. - * - * Symlinks should always be followed (except in stat()); PhysicsFS will - * use the stat() method to check for symlinks and make a judgement on - * whether to continue to call other methods based on that. - * - * Archivers, when necessary, should set the PhysicsFS error state with - * PHYSFS_setErrorCode() before returning. PhysicsFS will pass these errors - * back to the application unmolested in most cases. - * - * Thread safety: PHYSFS_Archiver implementations are not guaranteed to be - * thread safe in themselves. PhysicsFS provides thread safety when it calls - * into a given archiver inside the library, but it does not promise that - * using the same PHYSFS_File from two threads at once is thread-safe; as - * such, your PHYSFS_Archiver can assume that locking is handled for you - * so long as the PHYSFS_Io you return from PHYSFS_open* doesn't change any - * of your Archiver state, as the PHYSFS_Io won't be as aggressively - * protected. - * - * \sa PHYSFS_registerArchiver - * \sa PHYSFS_deregisterArchiver - * \sa PHYSFS_supportedArchiveTypes - */ -typedef struct PHYSFS_Archiver -{ - /** - * \brief Binary compatibility information. - * - * This must be set to zero at this time. Future versions of this - * struct will increment this field, so we know what a given - * implementation supports. We'll presumably keep supporting older - * versions as we offer new features, though. - */ - PHYSFS_uint32 version; - - /** - * \brief Basic info about this archiver. - * - * This is used to identify your archive, and is returned in - * PHYSFS_supportedArchiveTypes(). - */ - PHYSFS_ArchiveInfo info; - - /** - * \brief Open an archive provided by (io). - * - * This is where resources are allocated and data is parsed when mounting - * an archive. - * (name) is a filename associated with (io), but doesn't necessarily - * map to anything, let alone a real filename. This possibly- - * meaningless name is in platform-dependent notation. - * (forWrite) is non-zero if this is to be used for - * the write directory, and zero if this is to be used for an - * element of the search path. - * (claimed) should be set to 1 if this is definitely an archive your - * archiver implementation can handle, even if it fails. We use to - * decide if we should stop trying other archivers if you fail to open - * it. For example: the .zip archiver will set this to 1 for something - * that's got a .zip file signature, even if it failed because the file - * was also truncated. No sense in trying other archivers here, we - * already tried to handle it with the appropriate implementation!. - * Return NULL on failure and set (claimed) appropriately. If no archiver - * opened the archive or set (claimed), PHYSFS_mount() will report - * PHYSFS_ERR_UNSUPPORTED. Otherwise, it will report the error from the - * archiver that claimed the data through (claimed). - * Return non-NULL on success. The pointer returned will be - * passed as the "opaque" parameter for later calls. - */ - void *(*openArchive)(PHYSFS_Io *io, const char *name, - int forWrite, int *claimed); - - /** - * \brief List all files in (dirname). - * - * Each file is passed to (cb), where a copy is made if appropriate, so - * you can dispose of it upon return from the callback. (dirname) is in - * platform-independent notation. - * If you have a failure, call PHYSFS_SetErrorCode() with whatever code - * seem appropriate and return PHYSFS_ENUM_ERROR. - * If the callback returns PHYSFS_ENUM_ERROR, please call - * PHYSFS_SetErrorCode(PHYSFS_ERR_APP_CALLBACK) and then return - * PHYSFS_ENUM_ERROR as well. Don't call the callback again in any - * circumstances. - * If the callback returns PHYSFS_ENUM_STOP, stop enumerating and return - * PHYSFS_ENUM_STOP as well. Don't call the callback again in any - * circumstances. Don't set an error code in this case. - * Callbacks are only supposed to return a value from - * PHYSFS_EnumerateCallbackResult. Any other result has undefined - * behavior. - * As long as the callback returned PHYSFS_ENUM_OK and you haven't - * experienced any errors of your own, keep enumerating until you're done - * and then return PHYSFS_ENUM_OK without setting an error code. - * - * \warning PHYSFS_enumerate returns zero or non-zero (success or failure), - * so be aware this function pointer returns different values! - */ - PHYSFS_EnumerateCallbackResult (*enumerate)(void *opaque, - const char *dirname, PHYSFS_EnumerateCallback cb, - const char *origdir, void *callbackdata); - - /** - * \brief Open a file in this archive for reading. - * - * This filename, (fnm), is in platform-independent notation. - * Fail if the file does not exist. - * Returns NULL on failure, and calls PHYSFS_setErrorCode(). - * Returns non-NULL on success. The pointer returned will be - * passed as the "opaque" parameter for later file calls. - */ - PHYSFS_Io *(*openRead)(void *opaque, const char *fnm); - - /** - * \brief Open a file in this archive for writing. - * - * If the file does not exist, it should be created. If it exists, - * it should be truncated to zero bytes. The writing offset should - * be the start of the file. - * If the archive is read-only, this operation should fail. - * This filename is in platform-independent notation. - * Returns NULL on failure, and calls PHYSFS_setErrorCode(). - * Returns non-NULL on success. The pointer returned will be - * passed as the "opaque" parameter for later file calls. - */ - PHYSFS_Io *(*openWrite)(void *opaque, const char *filename); - - /** - * \brief Open a file in this archive for appending. - * - * If the file does not exist, it should be created. The writing - * offset should be the end of the file. - * If the archive is read-only, this operation should fail. - * This filename is in platform-independent notation. - * Returns NULL on failure, and calls PHYSFS_setErrorCode(). - * Returns non-NULL on success. The pointer returned will be - * passed as the "opaque" parameter for later file calls. - */ - PHYSFS_Io *(*openAppend)(void *opaque, const char *filename); - - /** - * \brief Delete a file or directory in the archive. - * - * This same call is used for both files and directories; there is not a - * separate rmdir() call. Directories are only meant to be removed if - * they are empty. - * If the archive is read-only, this operation should fail. - * - * Return non-zero on success, zero on failure. - * This filename is in platform-independent notation. - * On failure, call PHYSFS_setErrorCode(). - */ - int (*remove)(void *opaque, const char *filename); - - /** - * \brief Create a directory in the archive. - * - * If the application is trying to make multiple dirs, PhysicsFS - * will split them up into multiple calls before passing them to - * your driver. - * If the archive is read-only, this operation should fail. - * Return non-zero on success, zero on failure. - * This filename is in platform-independent notation. - * On failure, call PHYSFS_setErrorCode(). - */ - int (*mkdir)(void *opaque, const char *filename); - - /** - * \brief Obtain basic file metadata. - * - * On success, fill in all the fields in (stat), using - * reasonable defaults for fields that apply to your archive. - * - * Returns non-zero on success, zero on failure. - * This filename is in platform-independent notation. - * On failure, call PHYSFS_setErrorCode(). - */ - int (*stat)(void *opaque, const char *fn, PHYSFS_Stat *stat); - - /** - * \brief Destruct a previously-opened archive. - * - * Close this archive, and free any associated memory, - * including the original PHYSFS_Io and (opaque) itself, if - * applicable. Implementation can assume that it won't be called if - * there are still files open from this archive. - */ - void (*closeArchive)(void *opaque); -} PHYSFS_Archiver; - -/** - * \fn int PHYSFS_registerArchiver(const PHYSFS_Archiver *archiver) - * \brief Add a new archiver to the system. - * - * \warning This is advanced, hardcore stuff. You don't need this unless you - * really know what you're doing. Most apps will not need this. - * - * If you want to provide your own archiver (for example, a custom archive - * file format, or some virtual thing you want to make look like a filesystem - * that you can access through the usual PhysicsFS APIs), this is where you - * start. Once an archiver is successfully registered, then you can use - * PHYSFS_mount() to add archives that your archiver supports to the - * search path, or perhaps use it as the write dir. Internally, PhysicsFS - * uses this function to register its own built-in archivers, like .zip - * support, etc. - * - * You may not have two archivers that handle the same extension. If you are - * going to have a clash, you can deregister the other archiver (including - * built-in ones) with PHYSFS_deregisterArchiver(). - * - * The data in (archiver) is copied; you may free this pointer when this - * function returns. - * - * Once this function returns successfully, PhysicsFS will be able to support - * archives of this type until you deregister the archiver again. - * - * \param archiver The archiver to register. - * \return Zero on error, non-zero on success. - * - * \sa PHYSFS_Archiver - * \sa PHYSFS_deregisterArchiver - */ -PHYSFS_DECL int PHYSFS_registerArchiver(const PHYSFS_Archiver *archiver); - -/** - * \fn int PHYSFS_deregisterArchiver(const char *ext) - * \brief Remove an archiver from the system. - * - * If for some reason, you only need your previously-registered archiver to - * live for a portion of your app's lifetime, you can remove it from the - * system once you're done with it through this function. - * - * This fails if there are any archives still open that use this archiver. - * - * This function can also remove internally-supplied archivers, like .zip - * support or whatnot. This could be useful in some situations, like - * disabling support for them outright or overriding them with your own - * implementation. Once an internal archiver is disabled like this, - * PhysicsFS provides no mechanism to recover them, short of calling - * PHYSFS_deinit() and PHYSFS_init() again. - * - * PHYSFS_deinit() will automatically deregister all archivers, so you don't - * need to explicitly deregister yours if you otherwise shut down cleanly. - * - * \param ext Filename extension that the archiver handles. - * \return Zero on error, non-zero on success. - * - * \sa PHYSFS_Archiver - * \sa PHYSFS_registerArchiver - */ -PHYSFS_DECL int PHYSFS_deregisterArchiver(const char *ext); - - -/* Everything above this line is part of the PhysicsFS 2.1 API. */ - -#ifdef __cplusplus -} -#endif - -#endif /* !defined _INCLUDE_PHYSFS_H_ */ - -/* end of physfs.h ... */ - diff --git a/love/src/jni/love/src/libraries/physfs/physfs_archiver_7z.c b/love/src/jni/love/src/libraries/physfs/physfs_archiver_7z.c deleted file mode 100644 index f35a0b10..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_archiver_7z.c +++ /dev/null @@ -1,428 +0,0 @@ -/* - * 7zip support routines for PhysicsFS. - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file was written by Ryan C. Gordon. - */ - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_internal.h" - -#if PHYSFS_SUPPORTS_7Z - -#include "physfs_lzmasdk.h" - -typedef struct -{ - ISeekInStream seekStream; /* lzma sdk i/o interface (lower level). */ - PHYSFS_Io *io; /* physfs i/o interface for this archive. */ - CLookToRead lookStream; /* lzma sdk i/o interface (higher level). */ -} SZIPLookToRead; - -/* One SZIPentry is kept for each file in an open 7zip archive. */ -typedef struct -{ - __PHYSFS_DirTreeEntry tree; /* manages directory tree */ - PHYSFS_uint32 dbidx; /* index into lzma sdk database */ -} SZIPentry; - -/* One SZIPinfo is kept for each open 7zip archive. */ -typedef struct -{ - __PHYSFS_DirTree tree; /* manages directory tree. */ - PHYSFS_Io *io; /* physfs i/o interface for this archive. */ - CSzArEx db; /* lzma sdk archive database object. */ -} SZIPinfo; - - -static PHYSFS_ErrorCode szipErrorCode(const SRes rc) -{ - switch (rc) - { - case SZ_OK: return PHYSFS_ERR_OK; - case SZ_ERROR_DATA: return PHYSFS_ERR_CORRUPT; - case SZ_ERROR_MEM: return PHYSFS_ERR_OUT_OF_MEMORY; - case SZ_ERROR_CRC: return PHYSFS_ERR_CORRUPT; - case SZ_ERROR_UNSUPPORTED: return PHYSFS_ERR_UNSUPPORTED; - case SZ_ERROR_INPUT_EOF: return PHYSFS_ERR_CORRUPT; - case SZ_ERROR_OUTPUT_EOF: return PHYSFS_ERR_IO; - case SZ_ERROR_READ: return PHYSFS_ERR_IO; - case SZ_ERROR_WRITE: return PHYSFS_ERR_IO; - case SZ_ERROR_ARCHIVE: return PHYSFS_ERR_CORRUPT; - case SZ_ERROR_NO_ARCHIVE: return PHYSFS_ERR_UNSUPPORTED; - default: break; - } /* switch */ - - return PHYSFS_ERR_OTHER_ERROR; -} /* szipErrorCode */ - - -/* LZMA SDK's ISzAlloc interface ... */ - -static void *SZIP_ISzAlloc_Alloc(void *p, size_t size) -{ - return allocator.Malloc(size ? size : 1); -} /* SZIP_ISzAlloc_Alloc */ - -static void SZIP_ISzAlloc_Free(void *p, void *address) -{ - if (address) - allocator.Free(address); -} /* SZIP_ISzAlloc_Free */ - -static ISzAlloc SZIP_SzAlloc = { - SZIP_ISzAlloc_Alloc, SZIP_ISzAlloc_Free -}; - - -/* we implement ISeekInStream, and then wrap that in LZMA SDK's CLookToRead, - which implements the higher-level ILookInStream on top of that, handling - buffering and such for us. */ - -/* LZMA SDK's ISeekInStream interface ... */ - -static SRes SZIP_ISeekInStream_Read(void *p, void *buf, size_t *size) -{ - SZIPLookToRead *stream = (SZIPLookToRead *) p; - PHYSFS_Io *io = stream->io; - const PHYSFS_uint64 len = (PHYSFS_uint64) *size; - const PHYSFS_sint64 rc = (len == 0) ? 0 : io->read(io, buf, len); - - if (rc < 0) - { - *size = 0; - return SZ_ERROR_READ; - } /* if */ - - *size = (size_t) rc; - return SZ_OK; -} /* SZIP_ISeekInStream_Read */ - -static SRes SZIP_ISeekInStream_Seek(void *p, Int64 *pos, ESzSeek origin) -{ - SZIPLookToRead *stream = (SZIPLookToRead *) p; - PHYSFS_Io *io = stream->io; - PHYSFS_sint64 base; - PHYSFS_uint64 newpos; - - switch (origin) - { - case SZ_SEEK_SET: - base = 0; - break; - - case SZ_SEEK_CUR: - base = io->tell(io); - break; - - case SZ_SEEK_END: - base = io->length(io); - break; - - default: - return SZ_ERROR_FAIL; - } /* switch */ - - if (base < 0) - return SZ_ERROR_FAIL; - else if ((*pos < 0) && (((Int64) base) < -*pos)) - return SZ_ERROR_FAIL; - - newpos = (PHYSFS_uint64) (((Int64) base) + *pos); - if (!io->seek(io, newpos)) - return SZ_ERROR_FAIL; - - *pos = (Int64) newpos; - return SZ_OK; -} /* SZIP_ISeekInStream_Seek */ - - -static void szipInitStream(SZIPLookToRead *stream, PHYSFS_Io *io) -{ - stream->seekStream.Read = SZIP_ISeekInStream_Read; - stream->seekStream.Seek = SZIP_ISeekInStream_Seek; - - stream->io = io; - - /* !!! FIXME: can we use lookahead? Is there value to it? */ - LookToRead_Init(&stream->lookStream); - LookToRead_CreateVTable(&stream->lookStream, False); - stream->lookStream.realStream = &stream->seekStream; -} /* szipInitStream */ - - -/* Do this in a separate function so we can smallAlloc without looping. */ -static int szipLoadEntry(SZIPinfo *info, const PHYSFS_uint32 idx) -{ - const size_t utf16len = SzArEx_GetFileNameUtf16(&info->db, idx, NULL); - const size_t utf16buflen = utf16len * 2; - PHYSFS_uint16 *utf16 = (PHYSFS_uint16 *) __PHYSFS_smallAlloc(utf16buflen); - const size_t utf8buflen = utf16len * 4; - char *utf8 = (char *) __PHYSFS_smallAlloc(utf8buflen); - int retval = 0; - - if (utf16 && utf8) - { - const int isdir = SzArEx_IsDir(&info->db, idx) != 0; - SZIPentry *entry; - SzArEx_GetFileNameUtf16(&info->db, idx, (UInt16 *) utf16); - PHYSFS_utf8FromUtf16(utf16, utf8, utf8buflen); - entry = (SZIPentry*) __PHYSFS_DirTreeAdd(&info->tree, utf8, isdir); - retval = (entry != NULL); - if (retval) - entry->dbidx = idx; - } /* if */ - - __PHYSFS_smallFree(utf8); - __PHYSFS_smallFree(utf16); - - return retval; -} /* szipLoadEntry */ - - -static int szipLoadEntries(SZIPinfo *info) -{ - int retval = 0; - - if (__PHYSFS_DirTreeInit(&info->tree, sizeof (SZIPentry))) - { - const PHYSFS_uint32 count = info->db.NumFiles; - PHYSFS_uint32 i; - for (i = 0; i < count; i++) - BAIL_IF_ERRPASS(!szipLoadEntry(info, i), 0); - retval = 1; - } /* if */ - - return retval; -} /* szipLoadEntries */ - - -static void SZIP_closeArchive(void *opaque) -{ - SZIPinfo *info = (SZIPinfo *) opaque; - if (info) - { - SzArEx_Free(&info->db, &SZIP_SzAlloc); - __PHYSFS_DirTreeDeinit(&info->tree); - allocator.Free(info); - } /* if */ -} /* SZIP_closeArchive */ - - -static void *SZIP_openArchive(PHYSFS_Io *io, const char *name, - int forWriting, int *claimed) -{ - static const PHYSFS_uint8 wantedsig[] = { '7','z',0xBC,0xAF,0x27,0x1C }; - SZIPLookToRead stream; - ISzAlloc *alloc = &SZIP_SzAlloc; - SZIPinfo *info = NULL; - SRes rc; - PHYSFS_uint8 sig[6]; - PHYSFS_sint64 pos; - - BAIL_IF(forWriting, PHYSFS_ERR_READ_ONLY, NULL); - pos = io->tell(io); - BAIL_IF_ERRPASS(pos == -1, NULL); - BAIL_IF_ERRPASS(io->read(io, sig, 6) != 6, NULL); - *claimed = (memcmp(sig, wantedsig, 6) == 0); - BAIL_IF_ERRPASS(!io->seek(io, pos), NULL); - - info = (SZIPinfo *) allocator.Malloc(sizeof (SZIPinfo)); - BAIL_IF(!info, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - memset(info, '\0', sizeof (*info)); - - SzArEx_Init(&info->db); - - info->io = io; - - szipInitStream(&stream, io); - rc = SzArEx_Open(&info->db, &stream.lookStream.s, alloc, alloc); - GOTO_IF(rc != SZ_OK, szipErrorCode(rc), failed); - - GOTO_IF_ERRPASS(!szipLoadEntries(info), failed); - - return info; - -failed: - info->io = NULL; /* don't let cleanup destroy the PHYSFS_Io. */ - SZIP_closeArchive(info); - return NULL; -} /* SZIP_openArchive */ - - -static PHYSFS_Io *SZIP_openRead(void *opaque, const char *path) -{ - /* !!! FIXME: the current lzma sdk C API only allows you to decompress - !!! FIXME: the entire file at once, which isn't ideal. Fix this in the - !!! FIXME: SDK and then convert this all to a streaming interface. */ - - SZIPinfo *info = (SZIPinfo *) opaque; - SZIPentry *entry = (SZIPentry *) __PHYSFS_DirTreeFind(&info->tree, path); - ISzAlloc *alloc = &SZIP_SzAlloc; - SZIPLookToRead stream; - PHYSFS_Io *retval = NULL; - PHYSFS_Io *io = NULL; - UInt32 blockIndex = 0xFFFFFFFF; - Byte *outBuffer = NULL; - size_t outBufferSize = 0; - size_t offset = 0; - size_t outSizeProcessed = 0; - void *buf = NULL; - SRes rc; - - BAIL_IF_ERRPASS(!entry, NULL); - BAIL_IF(entry->tree.isdir, PHYSFS_ERR_NOT_A_FILE, NULL); - - io = info->io->duplicate(info->io); - GOTO_IF_ERRPASS(!io, SZIP_openRead_failed); - - szipInitStream(&stream, io); - - rc = SzArEx_Extract(&info->db, &stream.lookStream.s, entry->dbidx, - &blockIndex, &outBuffer, &outBufferSize, &offset, - &outSizeProcessed, alloc, alloc); - GOTO_IF(rc != SZ_OK, szipErrorCode(rc), SZIP_openRead_failed); - - io->destroy(io); - io = NULL; - - buf = allocator.Malloc(outSizeProcessed); - GOTO_IF(rc != SZ_OK, PHYSFS_ERR_OUT_OF_MEMORY, SZIP_openRead_failed); - memcpy(buf, outBuffer + offset, outSizeProcessed); - - alloc->Free(alloc, outBuffer); - outBuffer = NULL; - - retval = __PHYSFS_createMemoryIo(buf, outSizeProcessed, allocator.Free); - GOTO_IF_ERRPASS(!retval, SZIP_openRead_failed); - - return retval; - -SZIP_openRead_failed: - if (io != NULL) - io->destroy(io); - - if (buf) - allocator.Free(buf); - - if (outBuffer) - alloc->Free(alloc, outBuffer); - - return NULL; -} /* SZIP_openRead */ - - -static PHYSFS_Io *SZIP_openWrite(void *opaque, const char *filename) -{ - BAIL(PHYSFS_ERR_READ_ONLY, NULL); -} /* SZIP_openWrite */ - - -static PHYSFS_Io *SZIP_openAppend(void *opaque, const char *filename) -{ - BAIL(PHYSFS_ERR_READ_ONLY, NULL); -} /* SZIP_openAppend */ - - -static int SZIP_remove(void *opaque, const char *name) -{ - BAIL(PHYSFS_ERR_READ_ONLY, 0); -} /* SZIP_remove */ - - -static int SZIP_mkdir(void *opaque, const char *name) -{ - BAIL(PHYSFS_ERR_READ_ONLY, 0); -} /* SZIP_mkdir */ - - -static inline PHYSFS_uint64 lzmasdkTimeToPhysfsTime(const CNtfsFileTime *t) -{ - const PHYSFS_uint64 winEpochToUnixEpoch = __PHYSFS_UI64(0x019DB1DED53E8000); - const PHYSFS_uint64 nanosecToMillisec = __PHYSFS_UI64(10000000); - const PHYSFS_uint64 quad = (((PHYSFS_uint64) t->High) << 32) | t->Low; - return (quad - winEpochToUnixEpoch) / nanosecToMillisec; -} /* lzmasdkTimeToPhysfsTime */ - - -static int SZIP_stat(void *opaque, const char *path, PHYSFS_Stat *stat) -{ - SZIPinfo *info = (SZIPinfo *) opaque; - SZIPentry *entry; - PHYSFS_uint32 idx; - - entry = (SZIPentry *) __PHYSFS_DirTreeFind(&info->tree, path); - BAIL_IF_ERRPASS(!entry, 0); - idx = entry->dbidx; - - if (entry->tree.isdir) - { - stat->filesize = -1; - stat->filetype = PHYSFS_FILETYPE_DIRECTORY; - } /* if */ - else - { - stat->filesize = (PHYSFS_sint64) SzArEx_GetFileSize(&info->db, idx); - stat->filetype = PHYSFS_FILETYPE_REGULAR; - } /* else */ - - if (info->db.MTime.Vals != NULL) - stat->modtime = lzmasdkTimeToPhysfsTime(&info->db.MTime.Vals[idx]); - else if (info->db.CTime.Vals != NULL) - stat->modtime = lzmasdkTimeToPhysfsTime(&info->db.CTime.Vals[idx]); - else - stat->modtime = -1; - - if (info->db.CTime.Vals != NULL) - stat->createtime = lzmasdkTimeToPhysfsTime(&info->db.CTime.Vals[idx]); - else if (info->db.MTime.Vals != NULL) - stat->createtime = lzmasdkTimeToPhysfsTime(&info->db.MTime.Vals[idx]); - else - stat->createtime = -1; - - stat->accesstime = -1; - stat->readonly = 1; - - return 1; -} /* SZIP_stat */ - - -void SZIP_global_init(void) -{ - /* this just needs to calculate some things, so it only ever - has to run once, even after a deinit. */ - static int generatedTable = 0; - if (!generatedTable) - { - generatedTable = 1; - CrcGenerateTable(); - } /* if */ -} /* SZIP_global_init */ - - -const PHYSFS_Archiver __PHYSFS_Archiver_7Z = -{ - CURRENT_PHYSFS_ARCHIVER_API_VERSION, - { - "7Z", - "7zip archives", - "Ryan C. Gordon ", - "https://icculus.org/physfs/", - 0, /* supportsSymlinks */ - }, - SZIP_openArchive, - __PHYSFS_DirTreeEnumerate, - SZIP_openRead, - SZIP_openWrite, - SZIP_openAppend, - SZIP_remove, - SZIP_mkdir, - SZIP_stat, - SZIP_closeArchive -}; - -#endif /* defined PHYSFS_SUPPORTS_7Z */ - -/* end of physfs_archiver_7z.c ... */ - diff --git a/love/src/jni/love/src/libraries/physfs/physfs_archiver_dir.c b/love/src/jni/love/src/libraries/physfs/physfs_archiver_dir.c deleted file mode 100644 index 61c0da3f..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_archiver_dir.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Standard directory I/O support routines for PhysicsFS. - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file written by Ryan C. Gordon. - */ - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_internal.h" - -/* There's no PHYSFS_Io interface here. Use __PHYSFS_createNativeIo(). */ - - - -static char *cvtToDependent(const char *prepend, const char *path, - char *buf, const size_t buflen) -{ - BAIL_IF(buf == NULL, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - snprintf(buf, buflen, "%s%s", prepend ? prepend : "", path); - - #if !__PHYSFS_STANDARD_DIRSEP - assert(__PHYSFS_platformDirSeparator != '/'); - { - char *p; - for (p = strchr(buf, '/'); p != NULL; p = strchr(p + 1, '/')) - *p = __PHYSFS_platformDirSeparator; - } /* if */ - #endif - - return buf; -} /* cvtToDependent */ - - -#define CVT_TO_DEPENDENT(buf, pre, dir) { \ - const size_t len = ((pre) ? strlen((char *) pre) : 0) + strlen(dir) + 1; \ - buf = cvtToDependent((char*)pre,dir,(char*)__PHYSFS_smallAlloc(len),len); \ -} - - - -static void *DIR_openArchive(PHYSFS_Io *io, const char *name, - int forWriting, int *claimed) -{ - PHYSFS_Stat st; - const char dirsep = __PHYSFS_platformDirSeparator; - char *retval = NULL; - const size_t namelen = strlen(name); - const size_t seplen = 1; - - assert(io == NULL); /* shouldn't create an Io for these. */ - BAIL_IF_ERRPASS(!__PHYSFS_platformStat(name, &st, 1), NULL); - - if (st.filetype != PHYSFS_FILETYPE_DIRECTORY) - BAIL(PHYSFS_ERR_UNSUPPORTED, NULL); - - *claimed = 1; - retval = allocator.Malloc(namelen + seplen + 1); - BAIL_IF(retval == NULL, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - - strcpy(retval, name); - - /* make sure there's a dir separator at the end of the string */ - if (retval[namelen - 1] != dirsep) - { - retval[namelen] = dirsep; - retval[namelen + 1] = '\0'; - } /* if */ - - return retval; -} /* DIR_openArchive */ - - -static PHYSFS_EnumerateCallbackResult DIR_enumerate(void *opaque, - const char *dname, PHYSFS_EnumerateCallback cb, - const char *origdir, void *callbackdata) -{ - char *d; - PHYSFS_EnumerateCallbackResult retval; - CVT_TO_DEPENDENT(d, opaque, dname); - BAIL_IF_ERRPASS(!d, PHYSFS_ENUM_ERROR); - retval = __PHYSFS_platformEnumerate(d, cb, origdir, callbackdata); - __PHYSFS_smallFree(d); - return retval; -} /* DIR_enumerate */ - - -static PHYSFS_Io *doOpen(void *opaque, const char *name, const int mode) -{ - PHYSFS_Io *io = NULL; - char *f = NULL; - - CVT_TO_DEPENDENT(f, opaque, name); - BAIL_IF_ERRPASS(!f, NULL); - - io = __PHYSFS_createNativeIo(f, mode); - if (io == NULL) - { - const PHYSFS_ErrorCode err = PHYSFS_getLastErrorCode(); - PHYSFS_Stat statbuf; - __PHYSFS_platformStat(f, &statbuf, 0); /* !!! FIXME: why are we stating here? */ - PHYSFS_setErrorCode(err); - } /* if */ - - __PHYSFS_smallFree(f); - - return io; -} /* doOpen */ - - -static PHYSFS_Io *DIR_openRead(void *opaque, const char *filename) -{ - return doOpen(opaque, filename, 'r'); -} /* DIR_openRead */ - - -static PHYSFS_Io *DIR_openWrite(void *opaque, const char *filename) -{ - return doOpen(opaque, filename, 'w'); -} /* DIR_openWrite */ - - -static PHYSFS_Io *DIR_openAppend(void *opaque, const char *filename) -{ - return doOpen(opaque, filename, 'a'); -} /* DIR_openAppend */ - - -static int DIR_remove(void *opaque, const char *name) -{ - int retval; - char *f; - - CVT_TO_DEPENDENT(f, opaque, name); - BAIL_IF_ERRPASS(!f, 0); - retval = __PHYSFS_platformDelete(f); - __PHYSFS_smallFree(f); - return retval; -} /* DIR_remove */ - - -static int DIR_mkdir(void *opaque, const char *name) -{ - int retval; - char *f; - - CVT_TO_DEPENDENT(f, opaque, name); - BAIL_IF_ERRPASS(!f, 0); - retval = __PHYSFS_platformMkDir(f); - __PHYSFS_smallFree(f); - return retval; -} /* DIR_mkdir */ - - -static void DIR_closeArchive(void *opaque) -{ - allocator.Free(opaque); -} /* DIR_closeArchive */ - - -static int DIR_stat(void *opaque, const char *name, PHYSFS_Stat *stat) -{ - int retval = 0; - char *d; - - CVT_TO_DEPENDENT(d, opaque, name); - BAIL_IF_ERRPASS(!d, 0); - retval = __PHYSFS_platformStat(d, stat, 0); - __PHYSFS_smallFree(d); - return retval; -} /* DIR_stat */ - - -const PHYSFS_Archiver __PHYSFS_Archiver_DIR = -{ - CURRENT_PHYSFS_ARCHIVER_API_VERSION, - { - "", - "Non-archive, direct filesystem I/O", - "Ryan C. Gordon ", - "https://icculus.org/physfs/", - 1, /* supportsSymlinks */ - }, - DIR_openArchive, - DIR_enumerate, - DIR_openRead, - DIR_openWrite, - DIR_openAppend, - DIR_remove, - DIR_mkdir, - DIR_stat, - DIR_closeArchive -}; - -/* end of physfs_archiver_dir.c ... */ - diff --git a/love/src/jni/love/src/libraries/physfs/physfs_archiver_grp.c b/love/src/jni/love/src/libraries/physfs/physfs_archiver_grp.c deleted file mode 100644 index 758475e4..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_archiver_grp.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * GRP support routines for PhysicsFS. - * - * This driver handles BUILD engine archives ("groupfiles"). This format - * (but not this driver) was put together by Ken Silverman. - * - * The format is simple enough. In Ken's words: - * - * What's the .GRP file format? - * - * The ".grp" file format is just a collection of a lot of files stored - * into 1 big one. I tried to make the format as simple as possible: The - * first 12 bytes contains my name, "KenSilverman". The next 4 bytes is - * the number of files that were compacted into the group file. Then for - * each file, there is a 16 byte structure, where the first 12 bytes are - * the filename, and the last 4 bytes are the file's size. The rest of - * the group file is just the raw data packed one after the other in the - * same order as the list of files. - * - * (That info is from http://www.advsys.net/ken/build.htm ...) - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file written by Ryan C. Gordon. - */ - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_internal.h" - -#if PHYSFS_SUPPORTS_GRP - -static int grpLoadEntries(PHYSFS_Io *io, const PHYSFS_uint32 count, void *arc) -{ - PHYSFS_uint32 pos = 16 + (16 * count); /* past sig+metadata. */ - PHYSFS_uint32 i; - - for (i = 0; i < count; i++) - { - char *ptr; - char name[13]; - PHYSFS_uint32 size; - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, name, 12), 0); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &size, 4), 0); - - name[12] = '\0'; /* name isn't null-terminated in file. */ - if ((ptr = strchr(name, ' ')) != NULL) - *ptr = '\0'; /* trim extra spaces. */ - - size = PHYSFS_swapULE32(size); - BAIL_IF_ERRPASS(!UNPK_addEntry(arc, name, 0, -1, -1, pos, size), 0); - - pos += size; - } /* for */ - - return 1; -} /* grpLoadEntries */ - - -static void *GRP_openArchive(PHYSFS_Io *io, const char *name, - int forWriting, int *claimed) -{ - PHYSFS_uint8 buf[12]; - PHYSFS_uint32 count = 0; - void *unpkarc = NULL; - - assert(io != NULL); /* shouldn't ever happen. */ - - BAIL_IF(forWriting, PHYSFS_ERR_READ_ONLY, NULL); - - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, buf, sizeof (buf)), NULL); - if (memcmp(buf, "KenSilverman", sizeof (buf)) != 0) - BAIL(PHYSFS_ERR_UNSUPPORTED, NULL); - - *claimed = 1; - - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &count, sizeof(count)), NULL); - count = PHYSFS_swapULE32(count); - - unpkarc = UNPK_openArchive(io); - BAIL_IF_ERRPASS(!unpkarc, NULL); - - if (!grpLoadEntries(io, count, unpkarc)) - { - UNPK_abandonArchive(unpkarc); - return NULL; - } /* if */ - - return unpkarc; -} /* GRP_openArchive */ - - -const PHYSFS_Archiver __PHYSFS_Archiver_GRP = -{ - CURRENT_PHYSFS_ARCHIVER_API_VERSION, - { - "GRP", - "Build engine Groupfile format", - "Ryan C. Gordon ", - "https://icculus.org/physfs/", - 0, /* supportsSymlinks */ - }, - GRP_openArchive, - UNPK_enumerate, - UNPK_openRead, - UNPK_openWrite, - UNPK_openAppend, - UNPK_remove, - UNPK_mkdir, - UNPK_stat, - UNPK_closeArchive -}; - -#endif /* defined PHYSFS_SUPPORTS_GRP */ - -/* end of physfs_archiver_grp.c ... */ - diff --git a/love/src/jni/love/src/libraries/physfs/physfs_archiver_hog.c b/love/src/jni/love/src/libraries/physfs/physfs_archiver_hog.c deleted file mode 100644 index 832209f8..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_archiver_hog.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * HOG support routines for PhysicsFS. - * - * This driver handles Descent I/II HOG archives. - * - * The format is very simple: - * - * The file always starts with the 3-byte signature "DHF" (Descent - * HOG file). After that the files of a HOG are just attached after - * another, divided by a 17 bytes header, which specifies the name - * and length (in bytes) of the forthcoming file! So you just read - * the header with its information of how big the following file is, - * and then skip exact that number of bytes to get to the next file - * in that HOG. - * - * char sig[3] = {'D', 'H', 'F'}; // "DHF"=Descent HOG File - * - * struct { - * char file_name[13]; // Filename, padded to 13 bytes with 0s - * int file_size; // filesize in bytes - * char data[file_size]; // The file data - * } FILE_STRUCT; // Repeated until the end of the file. - * - * (That info is from http://www.descent2.com/ddn/specs/hog/) - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file written by Bradley Bell. - * Based on grp.c by Ryan C. Gordon. - */ - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_internal.h" - -#if PHYSFS_SUPPORTS_HOG - -static int hogLoadEntries(PHYSFS_Io *io, void *arc) -{ - const PHYSFS_uint64 iolen = io->length(io); - PHYSFS_uint32 pos = 3; - - while (pos < iolen) - { - PHYSFS_uint32 size; - char name[13]; - - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, name, 13), 0); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &size, 4), 0); - name[12] = '\0'; /* just in case. */ - pos += 13 + 4; - - size = PHYSFS_swapULE32(size); - BAIL_IF_ERRPASS(!UNPK_addEntry(arc, name, 0, -1, -1, pos, size), 0); - pos += size; - - /* skip over entry */ - BAIL_IF_ERRPASS(!io->seek(io, pos), 0); - } /* while */ - - return 1; -} /* hogLoadEntries */ - - -static void *HOG_openArchive(PHYSFS_Io *io, const char *name, - int forWriting, int *claimed) -{ - PHYSFS_uint8 buf[3]; - void *unpkarc = NULL; - - assert(io != NULL); /* shouldn't ever happen. */ - BAIL_IF(forWriting, PHYSFS_ERR_READ_ONLY, NULL); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, buf, 3), NULL); - BAIL_IF(memcmp(buf, "DHF", 3) != 0, PHYSFS_ERR_UNSUPPORTED, NULL); - - *claimed = 1; - - unpkarc = UNPK_openArchive(io); - BAIL_IF_ERRPASS(!unpkarc, NULL); - - if (!hogLoadEntries(io, unpkarc)) - { - UNPK_abandonArchive(unpkarc); - return NULL; - } /* if */ - - return unpkarc; -} /* HOG_openArchive */ - - -const PHYSFS_Archiver __PHYSFS_Archiver_HOG = -{ - CURRENT_PHYSFS_ARCHIVER_API_VERSION, - { - "HOG", - "Descent I/II HOG file format", - "Bradley Bell ", - "https://icculus.org/physfs/", - 0, /* supportsSymlinks */ - }, - HOG_openArchive, - UNPK_enumerate, - UNPK_openRead, - UNPK_openWrite, - UNPK_openAppend, - UNPK_remove, - UNPK_mkdir, - UNPK_stat, - UNPK_closeArchive -}; - -#endif /* defined PHYSFS_SUPPORTS_HOG */ - -/* end of physfs_archiver_hog.c ... */ - diff --git a/love/src/jni/love/src/libraries/physfs/physfs_archiver_iso9660.c b/love/src/jni/love/src/libraries/physfs/physfs_archiver_iso9660.c deleted file mode 100644 index 965c83f6..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_archiver_iso9660.c +++ /dev/null @@ -1,386 +0,0 @@ -/* - * ISO9660 support routines for PhysicsFS. - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file originally written by Christoph Nelles, but was largely - * rewritten by Ryan C. Gordon (so please harass Ryan about bugs and not - * Christoph). - */ - -/* - * Handles CD-ROM disk images (and raw CD-ROM devices). - * - * Not supported: - * - Rock Ridge (needed for sparse files, device nodes and symlinks, etc). - * - Non 2048 Sectors - * - TRANS.TBL (maps 8.3 filenames on old discs to long filenames). - * - Multiextents (4gb max file size without it). - * - UDF - * - * Deviations from the standard - * - Ignores mandatory sort order - * - Allows various invalid file names - * - * Problems - * - Ambiguities in the standard - */ - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_internal.h" - -#if PHYSFS_SUPPORTS_ISO9660 - -#include - -/* ISO9660 often stores values in both big and little endian formats: little - first, followed by big. While technically there might be different values - in each, we just always use the littleendian ones and swap ourselves. The - fields aren't aligned anyhow, so you have to serialize them in any case - to avoid crashes on many CPU archs in any case. */ - -static int iso9660LoadEntries(PHYSFS_Io *io, const int joliet, - const char *base, const PHYSFS_uint64 dirstart, - const PHYSFS_uint64 dirend, void *unpkarc); - -static int iso9660AddEntry(PHYSFS_Io *io, const int joliet, const int isdir, - const char *base, PHYSFS_uint8 *fname, - const int fnamelen, const PHYSFS_sint64 ts, - const PHYSFS_uint64 pos, const PHYSFS_uint64 len, - void *unpkarc) -{ - char *fullpath; - char *fnamecpy; - size_t baselen; - size_t fullpathlen; - void *entry; - int i; - - if (fnamelen == 1 && ((fname[0] == 0) || (fname[0] == 1))) - return 1; /* Magic that represents "." and "..", ignore */ - - BAIL_IF(fnamelen == 0, PHYSFS_ERR_CORRUPT, 0); - assert(fnamelen > 0); - assert(fnamelen <= 255); - BAIL_IF(joliet && (fnamelen % 2), PHYSFS_ERR_CORRUPT, 0); - - /* Joliet is UCS-2, so at most UTF-8 will double the byte size */ - baselen = strlen(base); - fullpathlen = baselen + (fnamelen * (joliet ? 2 : 1)) + 2; - fullpath = (char *) __PHYSFS_smallAlloc(fullpathlen); - BAIL_IF(!fullpath, PHYSFS_ERR_OUT_OF_MEMORY, 0); - fnamecpy = fullpath; - if (baselen > 0) - { - snprintf(fullpath, fullpathlen, "%s/", base); - fnamecpy += baselen + 1; - fullpathlen -= baselen - 1; - } /* if */ - - if (joliet) - { - PHYSFS_uint16 *ucs2 = (PHYSFS_uint16 *) fname; - int total = fnamelen / 2; - for (i = 0; i < total; i++) - ucs2[i] = PHYSFS_swapUBE16(ucs2[i]); - ucs2[total] = '\0'; - PHYSFS_utf8FromUcs2(ucs2, fnamecpy, fullpathlen); - } /* if */ - else - { - for (i = 0; i < fnamelen; i++) - { - /* We assume the filenames are low-ASCII; consider the archive - corrupt if we see something above 127, since we don't know the - encoding. (We can change this later if we find out these exist - and are intended to be, say, latin-1 or UTF-8 encoding). */ - BAIL_IF(fname[i] > 127, PHYSFS_ERR_CORRUPT, 0); - fnamecpy[i] = fname[i]; - } /* for */ - fnamecpy[fnamelen] = '\0'; - - if (!isdir) - { - /* find last SEPARATOR2 */ - char *ptr = strrchr(fnamecpy, ';'); - if (ptr && (ptr != fnamecpy)) - *(ptr--) = '\0'; - else - ptr = fnamecpy + (fnamelen - 1); - - /* chop out any trailing '.', as done in all implementations */ - if (*ptr == '.') - *ptr = '\0'; - } /* if */ - } /* else */ - - entry = UNPK_addEntry(unpkarc, fullpath, isdir, ts, ts, pos, len); - if ((entry) && (isdir)) - { - if (!iso9660LoadEntries(io, joliet, fullpath, pos, pos + len, unpkarc)) - entry = NULL; /* so we report a failure later. */ - } /* if */ - - __PHYSFS_smallFree(fullpath); - return entry != NULL; -} /* iso9660AddEntry */ - -static int iso9660LoadEntries(PHYSFS_Io *io, const int joliet, - const char *base, const PHYSFS_uint64 dirstart, - const PHYSFS_uint64 dirend, void *unpkarc) -{ - PHYSFS_uint64 readpos = dirstart; - - while (1) - { - PHYSFS_uint8 recordlen; - PHYSFS_uint8 extattrlen; - PHYSFS_uint32 extent; - PHYSFS_uint32 datalen; - PHYSFS_uint8 ignore[4]; - PHYSFS_uint8 year, month, day, hour, minute, second, offset; - PHYSFS_uint8 flags; - PHYSFS_uint8 fnamelen; - PHYSFS_uint8 fname[256]; - PHYSFS_sint64 timestamp; - struct tm t; - int isdir; - int multiextent; - - BAIL_IF_ERRPASS(!io->seek(io, readpos), 0); - - /* recordlen = 0 -> no more entries or fill entry */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &recordlen, 1), 0); - if (recordlen > 0) - readpos += recordlen; /* ready to seek to next record. */ - else - { - PHYSFS_uint64 nextpos; - - /* if we are in the last sector of the directory & it's 0 -> end */ - if ((dirend - 2048) <= (readpos - 1)) - break; /* finished */ - - /* else skip to the next sector & continue; */ - nextpos = (((readpos - 1) / 2048) + 1) * 2048; - - /* whoops, can't make forward progress! */ - BAIL_IF(nextpos == readpos, PHYSFS_ERR_CORRUPT, 0); - - readpos = nextpos; - continue; /* start back at upper loop. */ - } /* else */ - - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &extattrlen, 1), 0); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &extent, 4), 0); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 4), 0); /* extent be */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &datalen, 4), 0); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 4), 0); /* datalen be */ - - /* record timestamp */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &year, 1), 0); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &month, 1), 0); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &day, 1), 0); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &hour, 1), 0); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &minute, 1), 0); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &second, 1), 0); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &offset, 1), 0); - - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &flags, 1), 0); - isdir = (flags & (1 << 1)) != 0; - multiextent = (flags & (1 << 7)) != 0; - BAIL_IF(multiextent, PHYSFS_ERR_UNSUPPORTED, 0); /* !!! FIXME */ - - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 1), 0); /* unit size */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 1), 0); /* interleave gap */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 2), 0); /* seqnum le */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 2), 0); /* seqnum be */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &fnamelen, 1), 0); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, fname, fnamelen), 0); - - t.tm_sec = second; - t.tm_min = minute; - t.tm_hour = hour; - t.tm_mday = day; - t.tm_mon = month - 1; - t.tm_year = year; - t.tm_wday = 0; - t.tm_yday = 0; - t.tm_isdst = -1; - timestamp = (PHYSFS_sint64) mktime(&t); - - extent += extattrlen; /* skip extended attribute record. */ - - /* infinite loop, corrupt file? */ - BAIL_IF((extent * 2048) == dirstart, PHYSFS_ERR_CORRUPT, 0); - - if (!iso9660AddEntry(io, joliet, isdir, base, fname, fnamelen, - timestamp, extent * 2048, datalen, unpkarc)) - { - return 0; - } /* if */ - } /* while */ - - return 1; -} /* iso9660LoadEntries */ - - -static int parseVolumeDescriptor(PHYSFS_Io *io, PHYSFS_uint64 *_rootpos, - PHYSFS_uint64 *_rootlen, int *_joliet, - int *_claimed) -{ - PHYSFS_uint64 pos = 32768; /* start at the Primary Volume Descriptor */ - int found = 0; - int done = 0; - - *_joliet = 0; - - while (!done) - { - PHYSFS_uint8 type; - PHYSFS_uint8 identifier[5]; - PHYSFS_uint8 version; - PHYSFS_uint8 flags; - PHYSFS_uint8 escapeseqs[32]; - PHYSFS_uint8 ignore[32]; - PHYSFS_uint16 blocksize; - PHYSFS_uint32 extent; - PHYSFS_uint32 datalen; - - BAIL_IF_ERRPASS(!io->seek(io, pos), 0); - pos += 2048; /* each volume descriptor is 2048 bytes */ - - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &type, 1), 0); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &identifier, 5), 0); - - if (memcmp(identifier, "CD001", 5) != 0) /* maybe not an iso? */ - { - BAIL_IF(!*_claimed, PHYSFS_ERR_UNSUPPORTED, 0); - continue; /* just skip this one */ - } /* if */ - - *_claimed = 1; /* okay, this is probably an iso. */ - - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &version, 1), 0); /* version */ - BAIL_IF(version != 1, PHYSFS_ERR_UNSUPPORTED, 0); - - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &flags, 1), 0); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 32), 0); /* system id */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 32), 0); /* volume id */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 8), 0); /* reserved */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 4), 0); /* space le */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 4), 0); /* space be */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, escapeseqs, 32), 0); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 2), 0); /* setsize le */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 2), 0); /* setsize be */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 2), 0); /* seq num le */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 2), 0); /* seq num be */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &blocksize, 2), 0); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 2), 0); /* blocklen be */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 4), 0); /* pthtablen le */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 4), 0); /* pthtablen be */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 4), 0); /* pthtabpos le */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 4), 0); /* optpthtabpos le */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 4), 0); /* pthtabpos be */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 4), 0); /* optpthtabpos be */ - - /* root directory record... */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 1), 0); /* len */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 1), 0); /* attr len */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &extent, 4), 0); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 4), 0); /* extent be */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &datalen, 4), 0); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 4), 0); /* datalen be */ - - /* !!! FIXME: deal with this properly. */ - blocksize = PHYSFS_swapULE32(blocksize); - BAIL_IF(blocksize && (blocksize != 2048), PHYSFS_ERR_UNSUPPORTED, 0); - - switch (type) - { - case 1: /* Primary Volume Descriptor */ - case 2: /* Supplementary Volume Descriptor */ - if (found < type) - { - *_rootpos = PHYSFS_swapULE32(extent) * 2048; - *_rootlen = PHYSFS_swapULE32(datalen); - found = type; - - if (found == 2) /* possible Joliet volume */ - { - const PHYSFS_uint8 *s = escapeseqs; - *_joliet = !(flags & 1) && - (s[0] == 0x25) && (s[1] == 0x2F) && - ((s[2] == 0x40) || (s[2] == 0x43) || (s[2] == 0x45)); - } /* if */ - } /* if */ - break; - - case 255: /* type 255 terminates the volume descriptor list */ - done = 1; - break; - - default: - break; /* skip unknown types. */ - } /* switch */ - } /* while */ - - BAIL_IF(!found, PHYSFS_ERR_CORRUPT, 0); - - return 1; -} /* parseVolumeDescriptor */ - - -static void *ISO9660_openArchive(PHYSFS_Io *io, const char *filename, - int forWriting, int *claimed) -{ - PHYSFS_uint64 rootpos = 0; - PHYSFS_uint64 len = 0; - int joliet = 0; - void *unpkarc = NULL; - - assert(io != NULL); /* shouldn't ever happen. */ - - BAIL_IF(forWriting, PHYSFS_ERR_READ_ONLY, NULL); - - if (!parseVolumeDescriptor(io, &rootpos, &len, &joliet, claimed)) - return NULL; - - unpkarc = UNPK_openArchive(io); - BAIL_IF_ERRPASS(!unpkarc, NULL); - - if (!iso9660LoadEntries(io, joliet, "", rootpos, rootpos + len, unpkarc)) - { - UNPK_abandonArchive(unpkarc); - return NULL; - } /* if */ - - return unpkarc; -} /* ISO9660_openArchive */ - - -const PHYSFS_Archiver __PHYSFS_Archiver_ISO9660 = -{ - CURRENT_PHYSFS_ARCHIVER_API_VERSION, - { - "ISO", - "ISO9660 image file", - "Ryan C. Gordon ", - "https://icculus.org/physfs/", - 0, /* supportsSymlinks */ - }, - ISO9660_openArchive, - UNPK_enumerate, - UNPK_openRead, - UNPK_openWrite, - UNPK_openAppend, - UNPK_remove, - UNPK_mkdir, - UNPK_stat, - UNPK_closeArchive -}; - -#endif /* defined PHYSFS_SUPPORTS_ISO9660 */ - -/* end of physfs_archiver_iso9660.c ... */ - diff --git a/love/src/jni/love/src/libraries/physfs/physfs_archiver_mvl.c b/love/src/jni/love/src/libraries/physfs/physfs_archiver_mvl.c deleted file mode 100644 index 78b59f1a..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_archiver_mvl.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * MVL support routines for PhysicsFS. - * - * This driver handles Descent II Movielib archives. - * - * The file format of MVL is quite easy... - * - * //MVL File format - Written by Heiko Herrmann - * char sig[4] = {'D','M', 'V', 'L'}; // "DMVL"=Descent MoVie Library - * - * int num_files; // the number of files in this MVL - * - * struct { - * char file_name[13]; // Filename, padded to 13 bytes with 0s - * int file_size; // filesize in bytes - * }DIR_STRUCT[num_files]; - * - * struct { - * char data[file_size]; // The file data - * }FILE_STRUCT[num_files]; - * - * (That info is from http://www.descent2.com/ddn/specs/mvl/) - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file written by Bradley Bell. - * Based on grp.c by Ryan C. Gordon. - */ - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_internal.h" - -#if PHYSFS_SUPPORTS_MVL - -static int mvlLoadEntries(PHYSFS_Io *io, const PHYSFS_uint32 count, void *arc) -{ - PHYSFS_uint32 pos = 8 + (17 * count); /* past sig+metadata. */ - PHYSFS_uint32 i; - - for (i = 0; i < count; i++) - { - PHYSFS_uint32 size; - char name[13]; - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, name, 13), 0); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &size, 4), 0); - name[12] = '\0'; /* just in case. */ - size = PHYSFS_swapULE32(size); - BAIL_IF_ERRPASS(!UNPK_addEntry(arc, name, 0, -1, -1, pos, size), 0); - pos += size; - } /* for */ - - return 1; -} /* mvlLoadEntries */ - - -static void *MVL_openArchive(PHYSFS_Io *io, const char *name, - int forWriting, int *claimed) -{ - PHYSFS_uint8 buf[4]; - PHYSFS_uint32 count = 0; - void *unpkarc; - - assert(io != NULL); /* shouldn't ever happen. */ - BAIL_IF(forWriting, PHYSFS_ERR_READ_ONLY, NULL); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, buf, 4), NULL); - BAIL_IF(memcmp(buf, "DMVL", 4) != 0, PHYSFS_ERR_UNSUPPORTED, NULL); - - *claimed = 1; - - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &count, sizeof(count)), NULL); - count = PHYSFS_swapULE32(count); - - unpkarc = UNPK_openArchive(io); - BAIL_IF_ERRPASS(!unpkarc, NULL); - - if (!mvlLoadEntries(io, count, unpkarc)) - { - UNPK_abandonArchive(unpkarc); - return NULL; - } /* if */ - - return unpkarc; -} /* MVL_openArchive */ - - -const PHYSFS_Archiver __PHYSFS_Archiver_MVL = -{ - CURRENT_PHYSFS_ARCHIVER_API_VERSION, - { - "MVL", - "Descent II Movielib format", - "Bradley Bell ", - "https://icculus.org/physfs/", - 0, /* supportsSymlinks */ - }, - MVL_openArchive, - UNPK_enumerate, - UNPK_openRead, - UNPK_openWrite, - UNPK_openAppend, - UNPK_remove, - UNPK_mkdir, - UNPK_stat, - UNPK_closeArchive -}; - -#endif /* defined PHYSFS_SUPPORTS_MVL */ - -/* end of physfs_archiver_mvl.c ... */ - diff --git a/love/src/jni/love/src/libraries/physfs/physfs_archiver_qpak.c b/love/src/jni/love/src/libraries/physfs/physfs_archiver_qpak.c deleted file mode 100644 index 15a5f2df..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_archiver_qpak.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * QPAK support routines for PhysicsFS. - * - * This archiver handles the archive format utilized by Quake 1 and 2. - * Quake3-based games use the PkZip/Info-Zip format (which our - * physfs_archiver_zip.c handles). - * - * ======================================================================== - * - * This format info (in more detail) comes from: - * https://web.archive.org/web/20040209101748/http://debian.fmi.uni-sofia.bg/~sergei/cgsr/docs/pak.txt - * - * Quake PAK Format - * - * Header - * (4 bytes) signature = 'PACK' - * (4 bytes) directory offset - * (4 bytes) directory length - * - * Directory - * (56 bytes) file name - * (4 bytes) file position - * (4 bytes) file length - * - * ======================================================================== - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file written by Ryan C. Gordon. - */ - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_internal.h" - -#if PHYSFS_SUPPORTS_QPAK - -#define QPAK_SIG 0x4B434150 /* "PACK" in ASCII. */ - -static int qpakLoadEntries(PHYSFS_Io *io, const PHYSFS_uint32 count, void *arc) -{ - PHYSFS_uint32 i; - for (i = 0; i < count; i++) - { - PHYSFS_uint32 size; - PHYSFS_uint32 pos; - char name[56]; - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, name, 56), 0); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &pos, 4), 0); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &size, 4), 0); - size = PHYSFS_swapULE32(size); - pos = PHYSFS_swapULE32(pos); - BAIL_IF_ERRPASS(!UNPK_addEntry(arc, name, 0, -1, -1, pos, size), 0); - } /* for */ - - return 1; -} /* qpakLoadEntries */ - - -static void *QPAK_openArchive(PHYSFS_Io *io, const char *name, - int forWriting, int *claimed) -{ - PHYSFS_uint32 val = 0; - PHYSFS_uint32 pos = 0; - PHYSFS_uint32 count = 0; - void *unpkarc; - - assert(io != NULL); /* shouldn't ever happen. */ - - BAIL_IF(forWriting, PHYSFS_ERR_READ_ONLY, NULL); - - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &val, 4), NULL); - if (PHYSFS_swapULE32(val) != QPAK_SIG) - BAIL(PHYSFS_ERR_UNSUPPORTED, NULL); - - *claimed = 1; - - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &val, 4), NULL); - pos = PHYSFS_swapULE32(val); /* directory table offset. */ - - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &val, 4), NULL); - count = PHYSFS_swapULE32(val); - - /* corrupted archive? */ - BAIL_IF((count % 64) != 0, PHYSFS_ERR_CORRUPT, NULL); - count /= 64; - - BAIL_IF_ERRPASS(!io->seek(io, pos), NULL); - - unpkarc = UNPK_openArchive(io); - BAIL_IF_ERRPASS(!unpkarc, NULL); - - if (!qpakLoadEntries(io, count, unpkarc)) - { - UNPK_abandonArchive(unpkarc); - return NULL; - } /* if */ - - return unpkarc; -} /* QPAK_openArchive */ - - -const PHYSFS_Archiver __PHYSFS_Archiver_QPAK = -{ - CURRENT_PHYSFS_ARCHIVER_API_VERSION, - { - "PAK", - "Quake I/II format", - "Ryan C. Gordon ", - "https://icculus.org/physfs/", - 0, /* supportsSymlinks */ - }, - QPAK_openArchive, - UNPK_enumerate, - UNPK_openRead, - UNPK_openWrite, - UNPK_openAppend, - UNPK_remove, - UNPK_mkdir, - UNPK_stat, - UNPK_closeArchive -}; - -#endif /* defined PHYSFS_SUPPORTS_QPAK */ - -/* end of physfs_archiver_qpak.c ... */ - diff --git a/love/src/jni/love/src/libraries/physfs/physfs_archiver_slb.c b/love/src/jni/love/src/libraries/physfs/physfs_archiver_slb.c deleted file mode 100644 index 4fc28d40..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_archiver_slb.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * SLB support routines for PhysicsFS. - * - * This driver handles SLB archives ("slab files"). This uncompressed format - * is used in I-War / Independence War and Independence War: Defiance. - * - * The format begins with four zero bytes (version?), the file count and the - * location of the table of contents. Each ToC entry contains a 64-byte buffer - * containing a zero-terminated filename, the offset of the data, and its size. - * All the filenames begin with the separator character '\'. - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file written by Aleksi Nurmi, based on the GRP archiver by - * Ryan C. Gordon. - */ - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_internal.h" - -#if PHYSFS_SUPPORTS_SLB - -static int slbLoadEntries(PHYSFS_Io *io, const PHYSFS_uint32 count, void *arc) -{ - PHYSFS_uint32 i; - for (i = 0; i < count; i++) - { - PHYSFS_uint32 pos; - PHYSFS_uint32 size; - char name[64]; - char backslash; - char *ptr; - - /* don't include the '\' in the beginning */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &backslash, 1), 0); - BAIL_IF(backslash != '\\', PHYSFS_ERR_CORRUPT, 0); - - /* read the rest of the buffer, 63 bytes */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &name, 63), 0); - name[63] = '\0'; /* in case the name lacks the null terminator */ - - /* convert backslashes */ - for (ptr = name; *ptr; ptr++) - { - if (*ptr == '\\') - *ptr = '/'; - } /* for */ - - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &pos, 4), 0); - pos = PHYSFS_swapULE32(pos); - - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &size, 4), 0); - size = PHYSFS_swapULE32(size); - - BAIL_IF_ERRPASS(!UNPK_addEntry(arc, name, 0, -1, -1, pos, size), 0); - } /* for */ - - return 1; -} /* slbLoadEntries */ - - -static void *SLB_openArchive(PHYSFS_Io *io, const char *name, - int forWriting, int *claimed) -{ - PHYSFS_uint32 version; - PHYSFS_uint32 count; - PHYSFS_uint32 tocPos; - void *unpkarc; - - /* There's no identifier on an SLB file, so we assume it's _not_ if the - file count or tocPos is zero. Beyond that, we'll assume it's - bogus/corrupt if the entries' filenames don't start with '\' or the - tocPos is past the end of the file (seek will fail). This probably - covers all meaningful cases where we would accidentally accept a non-SLB - file with this archiver. */ - - assert(io != NULL); /* shouldn't ever happen. */ - - BAIL_IF(forWriting, PHYSFS_ERR_READ_ONLY, NULL); - - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &version, sizeof (version)), NULL); - version = PHYSFS_swapULE32(version); - BAIL_IF(version != 0, PHYSFS_ERR_UNSUPPORTED, NULL); - - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &count, sizeof (count)), NULL); - count = PHYSFS_swapULE32(count); - BAIL_IF(!count, PHYSFS_ERR_UNSUPPORTED, NULL); - - /* offset of the table of contents */ - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &tocPos, sizeof (tocPos)), NULL); - tocPos = PHYSFS_swapULE32(tocPos); - BAIL_IF(!tocPos, PHYSFS_ERR_UNSUPPORTED, NULL); - - /* seek to the table of contents */ - BAIL_IF_ERRPASS(!io->seek(io, tocPos), NULL); - - unpkarc = UNPK_openArchive(io); - BAIL_IF_ERRPASS(!unpkarc, NULL); - - if (!slbLoadEntries(io, count, unpkarc)) - { - UNPK_abandonArchive(unpkarc); - return NULL; - } /* if */ - - *claimed = 1; /* oh well. */ - - return unpkarc; -} /* SLB_openArchive */ - - -const PHYSFS_Archiver __PHYSFS_Archiver_SLB = -{ - CURRENT_PHYSFS_ARCHIVER_API_VERSION, - { - "SLB", - "I-War / Independence War Slab file", - "Aleksi Nurmi ", - "https://bitbucket.org/ahnurmi/", - 0, /* supportsSymlinks */ - }, - SLB_openArchive, - UNPK_enumerate, - UNPK_openRead, - UNPK_openWrite, - UNPK_openAppend, - UNPK_remove, - UNPK_mkdir, - UNPK_stat, - UNPK_closeArchive -}; - -#endif /* defined PHYSFS_SUPPORTS_SLB */ - -/* end of physfs_archiver_slb.c ... */ diff --git a/love/src/jni/love/src/libraries/physfs/physfs_archiver_unpacked.c b/love/src/jni/love/src/libraries/physfs/physfs_archiver_unpacked.c deleted file mode 100644 index 575efef3..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_archiver_unpacked.c +++ /dev/null @@ -1,305 +0,0 @@ -/* - * High-level PhysicsFS archiver for simple unpacked file formats. - * - * This is a framework that basic archivers build on top of. It's for simple - * formats that can just hand back a list of files and the offsets of their - * uncompressed data. There are an alarming number of formats like this. - * - * RULES: Archive entries must be uncompressed. Dirs and files allowed, but no - * symlinks, etc. We can relax some of these rules as necessary. - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file written by Ryan C. Gordon. - */ - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_internal.h" - -typedef struct -{ - __PHYSFS_DirTree tree; - PHYSFS_Io *io; -} UNPKinfo; - -typedef struct -{ - __PHYSFS_DirTreeEntry tree; - PHYSFS_uint64 startPos; - PHYSFS_uint64 size; - PHYSFS_sint64 ctime; - PHYSFS_sint64 mtime; -} UNPKentry; - -typedef struct -{ - PHYSFS_Io *io; - UNPKentry *entry; - PHYSFS_uint32 curPos; -} UNPKfileinfo; - - -void UNPK_closeArchive(void *opaque) -{ - UNPKinfo *info = ((UNPKinfo *) opaque); - if (info) - { - __PHYSFS_DirTreeDeinit(&info->tree); - - if (info->io) - info->io->destroy(info->io); - - allocator.Free(info); - } /* if */ -} /* UNPK_closeArchive */ - -void UNPK_abandonArchive(void *opaque) -{ - UNPKinfo *info = ((UNPKinfo *) opaque); - if (info) - { - info->io = NULL; - UNPK_closeArchive(info); - } /* if */ -} /* UNPK_abandonArchive */ - -static PHYSFS_sint64 UNPK_read(PHYSFS_Io *io, void *buffer, PHYSFS_uint64 len) -{ - UNPKfileinfo *finfo = (UNPKfileinfo *) io->opaque; - const UNPKentry *entry = finfo->entry; - const PHYSFS_uint64 bytesLeft = (PHYSFS_uint64)(entry->size-finfo->curPos); - PHYSFS_sint64 rc; - - if (bytesLeft < len) - len = bytesLeft; - - rc = finfo->io->read(finfo->io, buffer, len); - if (rc > 0) - finfo->curPos += (PHYSFS_uint32) rc; - - return rc; -} /* UNPK_read */ - - -static PHYSFS_sint64 UNPK_write(PHYSFS_Io *io, const void *b, PHYSFS_uint64 len) -{ - BAIL(PHYSFS_ERR_READ_ONLY, -1); -} /* UNPK_write */ - - -static PHYSFS_sint64 UNPK_tell(PHYSFS_Io *io) -{ - return ((UNPKfileinfo *) io->opaque)->curPos; -} /* UNPK_tell */ - - -static int UNPK_seek(PHYSFS_Io *io, PHYSFS_uint64 offset) -{ - UNPKfileinfo *finfo = (UNPKfileinfo *) io->opaque; - const UNPKentry *entry = finfo->entry; - int rc; - - BAIL_IF(offset >= entry->size, PHYSFS_ERR_PAST_EOF, 0); - rc = finfo->io->seek(finfo->io, entry->startPos + offset); - if (rc) - finfo->curPos = (PHYSFS_uint32) offset; - - return rc; -} /* UNPK_seek */ - - -static PHYSFS_sint64 UNPK_length(PHYSFS_Io *io) -{ - const UNPKfileinfo *finfo = (UNPKfileinfo *) io->opaque; - return ((PHYSFS_sint64) finfo->entry->size); -} /* UNPK_length */ - - -static PHYSFS_Io *UNPK_duplicate(PHYSFS_Io *_io) -{ - UNPKfileinfo *origfinfo = (UNPKfileinfo *) _io->opaque; - PHYSFS_Io *io = NULL; - PHYSFS_Io *retval = (PHYSFS_Io *) allocator.Malloc(sizeof (PHYSFS_Io)); - UNPKfileinfo *finfo = (UNPKfileinfo *) allocator.Malloc(sizeof (UNPKfileinfo)); - GOTO_IF(!retval, PHYSFS_ERR_OUT_OF_MEMORY, UNPK_duplicate_failed); - GOTO_IF(!finfo, PHYSFS_ERR_OUT_OF_MEMORY, UNPK_duplicate_failed); - - io = origfinfo->io->duplicate(origfinfo->io); - if (!io) goto UNPK_duplicate_failed; - finfo->io = io; - finfo->entry = origfinfo->entry; - finfo->curPos = 0; - memcpy(retval, _io, sizeof (PHYSFS_Io)); - retval->opaque = finfo; - return retval; - -UNPK_duplicate_failed: - if (finfo != NULL) allocator.Free(finfo); - if (retval != NULL) allocator.Free(retval); - if (io != NULL) io->destroy(io); - return NULL; -} /* UNPK_duplicate */ - -static int UNPK_flush(PHYSFS_Io *io) { return 1; /* no write support. */ } - -static void UNPK_destroy(PHYSFS_Io *io) -{ - UNPKfileinfo *finfo = (UNPKfileinfo *) io->opaque; - finfo->io->destroy(finfo->io); - allocator.Free(finfo); - allocator.Free(io); -} /* UNPK_destroy */ - - -static const PHYSFS_Io UNPK_Io = -{ - CURRENT_PHYSFS_IO_API_VERSION, NULL, - UNPK_read, - UNPK_write, - UNPK_seek, - UNPK_tell, - UNPK_length, - UNPK_duplicate, - UNPK_flush, - UNPK_destroy -}; - - -static inline UNPKentry *findEntry(UNPKinfo *info, const char *path) -{ - return (UNPKentry *) __PHYSFS_DirTreeFind(&info->tree, path); -} /* findEntry */ - - -PHYSFS_Io *UNPK_openRead(void *opaque, const char *name) -{ - PHYSFS_Io *retval = NULL; - UNPKinfo *info = (UNPKinfo *) opaque; - UNPKfileinfo *finfo = NULL; - UNPKentry *entry = findEntry(info, name); - - BAIL_IF_ERRPASS(!entry, NULL); - BAIL_IF(entry->tree.isdir, PHYSFS_ERR_NOT_A_FILE, NULL); - - retval = (PHYSFS_Io *) allocator.Malloc(sizeof (PHYSFS_Io)); - GOTO_IF(!retval, PHYSFS_ERR_OUT_OF_MEMORY, UNPK_openRead_failed); - - finfo = (UNPKfileinfo *) allocator.Malloc(sizeof (UNPKfileinfo)); - GOTO_IF(!finfo, PHYSFS_ERR_OUT_OF_MEMORY, UNPK_openRead_failed); - - finfo->io = info->io->duplicate(info->io); - GOTO_IF_ERRPASS(!finfo->io, UNPK_openRead_failed); - - if (!finfo->io->seek(finfo->io, entry->startPos)) - goto UNPK_openRead_failed; - - finfo->curPos = 0; - finfo->entry = entry; - - memcpy(retval, &UNPK_Io, sizeof (*retval)); - retval->opaque = finfo; - return retval; - -UNPK_openRead_failed: - if (finfo != NULL) - { - if (finfo->io != NULL) - finfo->io->destroy(finfo->io); - allocator.Free(finfo); - } /* if */ - - if (retval != NULL) - allocator.Free(retval); - - return NULL; -} /* UNPK_openRead */ - - -PHYSFS_Io *UNPK_openWrite(void *opaque, const char *name) -{ - BAIL(PHYSFS_ERR_READ_ONLY, NULL); -} /* UNPK_openWrite */ - - -PHYSFS_Io *UNPK_openAppend(void *opaque, const char *name) -{ - BAIL(PHYSFS_ERR_READ_ONLY, NULL); -} /* UNPK_openAppend */ - - -int UNPK_remove(void *opaque, const char *name) -{ - BAIL(PHYSFS_ERR_READ_ONLY, 0); -} /* UNPK_remove */ - - -int UNPK_mkdir(void *opaque, const char *name) -{ - BAIL(PHYSFS_ERR_READ_ONLY, 0); -} /* UNPK_mkdir */ - - -int UNPK_stat(void *opaque, const char *path, PHYSFS_Stat *stat) -{ - UNPKinfo *info = (UNPKinfo *) opaque; - const UNPKentry *entry = findEntry(info, path); - - BAIL_IF_ERRPASS(!entry, 0); - - if (entry->tree.isdir) - { - stat->filetype = PHYSFS_FILETYPE_DIRECTORY; - stat->filesize = 0; - } /* if */ - else - { - stat->filetype = PHYSFS_FILETYPE_REGULAR; - stat->filesize = entry->size; - } /* else */ - - stat->modtime = entry->mtime; - stat->createtime = entry->ctime; - stat->accesstime = -1; - stat->readonly = 1; - - return 1; -} /* UNPK_stat */ - - -void *UNPK_addEntry(void *opaque, char *name, const int isdir, - const PHYSFS_sint64 ctime, const PHYSFS_sint64 mtime, - const PHYSFS_uint64 pos, const PHYSFS_uint64 len) -{ - UNPKinfo *info = (UNPKinfo *) opaque; - UNPKentry *entry; - - entry = (UNPKentry *) __PHYSFS_DirTreeAdd(&info->tree, name, isdir); - BAIL_IF_ERRPASS(!entry, NULL); - - entry->startPos = isdir ? 0 : pos; - entry->size = isdir ? 0 : len; - entry->ctime = ctime; - entry->mtime = mtime; - - return entry; -} /* UNPK_addEntry */ - - -void *UNPK_openArchive(PHYSFS_Io *io) -{ - UNPKinfo *info = (UNPKinfo *) allocator.Malloc(sizeof (UNPKinfo)); - BAIL_IF(!info, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - - if (!__PHYSFS_DirTreeInit(&info->tree, sizeof (UNPKentry))) - { - allocator.Free(info); - return NULL; - } /* if */ - - info->io = io; - - return info; -} /* UNPK_openArchive */ - -/* end of physfs_archiver_unpacked.c ... */ - diff --git a/love/src/jni/love/src/libraries/physfs/physfs_archiver_vdf.c b/love/src/jni/love/src/libraries/physfs/physfs_archiver_vdf.c deleted file mode 100644 index 99bbb2a6..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_archiver_vdf.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * VDF support routines for PhysicsFS. - * - * This driver handles Gothic I/II VDF archives. - * This format (but not this driver) was designed by Piranha Bytes for - * use wih the ZenGin engine. - * - * This file was written by Francesco Bertolaccini, based on the UNPK archiver - * by Ryan C. Gordon and the works of degenerated1123 and Nico Bendlin. - */ - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_internal.h" - -#if PHYSFS_SUPPORTS_VDF - -#include - -#define VDF_COMMENT_LENGTH 256 -#define VDF_SIGNATURE_LENGTH 16 -#define VDF_ENTRY_NAME_LENGTH 64 -#define VDF_ENTRY_DIR 0x80000000 - -static const char* VDF_SIGNATURE_G1 = "PSVDSC_V2.00\r\n\r\n"; -static const char* VDF_SIGNATURE_G2 = "PSVDSC_V2.00\n\r\n\r"; - - -static inline int readui32(PHYSFS_Io *io, PHYSFS_uint32 *val) -{ - PHYSFS_uint32 v; - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &v, sizeof (v)), 0); - *val = PHYSFS_swapULE32(v); - return 1; -} /* readui32 */ - - -static PHYSFS_sint64 vdfDosTimeToEpoch(const PHYSFS_uint32 dostime) -{ - /* VDF stores timestamps as 32bit DOS dates: the seconds are counted in - 2-seconds intervals and the years are counted since 1 Jan. 1980 */ - struct tm t; - memset(&t, '\0', sizeof (t)); - t.tm_year = ((int) ((dostime >> 25) & 0x7F)) + 80; /* 1980 to 1900 */ - t.tm_mon = ((int) ((dostime >> 21) & 0xF)) - 1; /* 1-12 to 0-11 */ - t.tm_mday = (int) ((dostime >> 16) & 0x1F); - t.tm_hour = (int) ((dostime >> 11) & 0x1F); - t.tm_min = (int) ((dostime >> 5) & 0x3F); - t.tm_sec = ((int) ((dostime >> 0) & 0x1F)) * 2; /* 2 seconds to 1. */ - return (PHYSFS_sint64) mktime(&t); -} /* vdfDosTimeToEpoch */ - - -static int vdfLoadEntries(PHYSFS_Io *io, const PHYSFS_uint32 count, - const PHYSFS_sint64 ts, void *arc) -{ - PHYSFS_uint32 i; - - for (i = 0; i < count; i++) - { - char name[VDF_ENTRY_NAME_LENGTH + 1]; - int namei; - PHYSFS_uint32 jump, size, type, attr; - - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, name, sizeof (name) - 1), 0); - BAIL_IF_ERRPASS(!readui32(io, &jump), 0); - BAIL_IF_ERRPASS(!readui32(io, &size), 0); - BAIL_IF_ERRPASS(!readui32(io, &type), 0); - BAIL_IF_ERRPASS(!readui32(io, &attr), 0); - - /* Trim whitespace off the end of the filename */ - name[VDF_ENTRY_NAME_LENGTH] = '\0'; /* always null-terminated. */ - for (namei = VDF_ENTRY_NAME_LENGTH - 1; namei >= 0; namei--) - { - /* We assume the filenames are low-ASCII; consider the archive - corrupt if we see something above 127, since we don't know the - encoding. (We can change this later if we find out these exist - and are intended to be, say, latin-1 or UTF-8 encoding). */ - BAIL_IF(((PHYSFS_uint8) name[namei]) > 127, PHYSFS_ERR_CORRUPT, 0); - - if (name[namei] == ' ') - name[namei] = '\0'; - else - break; - } /* for */ - - BAIL_IF(!name[0], PHYSFS_ERR_CORRUPT, 0); - if (!(type & VDF_ENTRY_DIR)) { - BAIL_IF_ERRPASS(!UNPK_addEntry(arc, name, 0, ts, ts, jump, size), 0); - } - } /* for */ - - return 1; -} /* vdfLoadEntries */ - - -static void *VDF_openArchive(PHYSFS_Io *io, const char *name, - int forWriting, int *claimed) -{ - PHYSFS_uint8 ignore[16]; - PHYSFS_uint8 sig[VDF_SIGNATURE_LENGTH]; - PHYSFS_uint32 count, timestamp, version, dataSize, rootCatOffset; - void *unpkarc; - - assert(io != NULL); /* shouldn't ever happen. */ - - BAIL_IF(forWriting, PHYSFS_ERR_READ_ONLY, NULL); - - /* skip the 256-byte comment field. */ - BAIL_IF_ERRPASS(!io->seek(io, VDF_COMMENT_LENGTH), NULL); - - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, sig, sizeof (sig)), NULL); - - if ((memcmp(sig, VDF_SIGNATURE_G1, VDF_SIGNATURE_LENGTH) != 0) && - (memcmp(sig, VDF_SIGNATURE_G2, VDF_SIGNATURE_LENGTH) != 0)) - { - BAIL(PHYSFS_ERR_UNSUPPORTED, NULL); - } /* if */ - - *claimed = 1; - - BAIL_IF_ERRPASS(!readui32(io, &count), NULL); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, ignore, 4), NULL); /* numFiles */ - BAIL_IF_ERRPASS(!readui32(io, ×tamp), NULL); - BAIL_IF_ERRPASS(!readui32(io, &dataSize), NULL); /* dataSize */ - BAIL_IF_ERRPASS(!readui32(io, &rootCatOffset), NULL); /* rootCatOff */ - BAIL_IF_ERRPASS(!readui32(io, &version), NULL); - - BAIL_IF(version != 0x50, PHYSFS_ERR_UNSUPPORTED, NULL); - - BAIL_IF_ERRPASS(!io->seek(io, rootCatOffset), NULL); - - unpkarc = UNPK_openArchive(io); - BAIL_IF_ERRPASS(!unpkarc, NULL); - - if (!vdfLoadEntries(io, count, vdfDosTimeToEpoch(timestamp), unpkarc)) - { - UNPK_abandonArchive(unpkarc); - return NULL; - } /* if */ - - return unpkarc; -} /* VDF_openArchive */ - - -const PHYSFS_Archiver __PHYSFS_Archiver_VDF = -{ - CURRENT_PHYSFS_ARCHIVER_API_VERSION, - { - "VDF", - "Gothic I/II engine format", - "Francesco Bertolaccini ", - "https://github.com/frabert", - 0, /* supportsSymlinks */ - }, - VDF_openArchive, - UNPK_enumerate, - UNPK_openRead, - UNPK_openWrite, - UNPK_openAppend, - UNPK_remove, - UNPK_mkdir, - UNPK_stat, - UNPK_closeArchive -}; - -#endif /* defined PHYSFS_SUPPORTS_VDF */ - -/* end of physfs_archiver_vdf.c ... */ diff --git a/love/src/jni/love/src/libraries/physfs/physfs_archiver_wad.c b/love/src/jni/love/src/libraries/physfs/physfs_archiver_wad.c deleted file mode 100644 index b094c5b8..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_archiver_wad.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * WAD support routines for PhysicsFS. - * - * This driver handles DOOM engine archives ("wads"). - * This format (but not this driver) was designed by id Software for use - * with the DOOM engine. - * The specs of the format are from the unofficial doom specs v1.666 - * found here: http://www.gamers.org/dhs/helpdocs/dmsp1666.html - * The format of the archive: (from the specs) - * - * A WAD file has three parts: - * (1) a twelve-byte header - * (2) one or more "lumps" - * (3) a directory or "info table" that contains the names, offsets, and - * sizes of all the lumps in the WAD - * - * The header consists of three four-byte parts: - * (a) an ASCII string which must be either "IWAD" or "PWAD" - * (b) a uint32 which is the number of lumps in the wad - * (c) a uint32 which is the file offset to the start of - * the directory - * - * The directory has one 16-byte entry for every lump. Each entry consists - * of three parts: - * - * (a) a uint32, the file offset to the start of the lump - * (b) a uint32, the size of the lump in bytes - * (c) an 8-byte ASCII string, the name of the lump, padded with zeros. - * For example, the "DEMO1" entry in hexadecimal would be - * (44 45 4D 4F 31 00 00 00) - * - * Note that there is no way to tell if an opened WAD archive is a - * IWAD or PWAD with this archiver. - * I couldn't think of a way to provide that information, without being too - * hacky. - * I don't think it's really that important though. - * - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file written by Travis Wells, based on the GRP archiver by - * Ryan C. Gordon. - */ - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_internal.h" - -#if PHYSFS_SUPPORTS_WAD - -static int wadLoadEntries(PHYSFS_Io *io, const PHYSFS_uint32 count, void *arc) -{ - PHYSFS_uint32 i; - for (i = 0; i < count; i++) - { - PHYSFS_uint32 pos; - PHYSFS_uint32 size; - char name[9]; - - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &pos, 4), 0); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &size, 4), 0); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, name, 8), 0); - - name[8] = '\0'; /* name might not be null-terminated in file. */ - size = PHYSFS_swapULE32(size); - pos = PHYSFS_swapULE32(pos); - BAIL_IF_ERRPASS(!UNPK_addEntry(arc, name, 0, -1, -1, pos, size), 0); - } /* for */ - - return 1; -} /* wadLoadEntries */ - - -static void *WAD_openArchive(PHYSFS_Io *io, const char *name, - int forWriting, int *claimed) -{ - PHYSFS_uint8 buf[4]; - PHYSFS_uint32 count; - PHYSFS_uint32 directoryOffset; - void *unpkarc; - - assert(io != NULL); /* shouldn't ever happen. */ - - BAIL_IF(forWriting, PHYSFS_ERR_READ_ONLY, NULL); - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, buf, sizeof (buf)), NULL); - if ((memcmp(buf, "IWAD", 4) != 0) && (memcmp(buf, "PWAD", 4) != 0)) - BAIL(PHYSFS_ERR_UNSUPPORTED, NULL); - - *claimed = 1; - - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &count, sizeof (count)), NULL); - count = PHYSFS_swapULE32(count); - - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &directoryOffset, 4), 0); - directoryOffset = PHYSFS_swapULE32(directoryOffset); - - BAIL_IF_ERRPASS(!io->seek(io, directoryOffset), 0); - - unpkarc = UNPK_openArchive(io); - BAIL_IF_ERRPASS(!unpkarc, NULL); - - if (!wadLoadEntries(io, count, unpkarc)) - { - UNPK_abandonArchive(unpkarc); - return NULL; - } /* if */ - - return unpkarc; -} /* WAD_openArchive */ - - -const PHYSFS_Archiver __PHYSFS_Archiver_WAD = -{ - CURRENT_PHYSFS_ARCHIVER_API_VERSION, - { - "WAD", - "DOOM engine format", - "Travis Wells ", - "http://www.3dmm2.com/doom/", - 0, /* supportsSymlinks */ - }, - WAD_openArchive, - UNPK_enumerate, - UNPK_openRead, - UNPK_openWrite, - UNPK_openAppend, - UNPK_remove, - UNPK_mkdir, - UNPK_stat, - UNPK_closeArchive -}; - -#endif /* defined PHYSFS_SUPPORTS_WAD */ - -/* end of physfs_archiver_wad.c ... */ - diff --git a/love/src/jni/love/src/libraries/physfs/physfs_archiver_zip.c b/love/src/jni/love/src/libraries/physfs/physfs_archiver_zip.c deleted file mode 100644 index 9972628f..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_archiver_zip.c +++ /dev/null @@ -1,1710 +0,0 @@ -/* - * ZIP support routines for PhysicsFS. - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file written by Ryan C. Gordon, with some peeking at "unzip.c" - * by Gilles Vollant. - */ - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_internal.h" - -#if PHYSFS_SUPPORTS_ZIP - -#include -#include - -#include "physfs_miniz.h" - -/* - * A buffer of ZIP_READBUFSIZE is allocated for each compressed file opened, - * and is freed when you close the file; compressed data is read into - * this buffer, and then is decompressed into the buffer passed to - * PHYSFS_read(). - * - * Uncompressed entries in a zipfile do not allocate this buffer; they just - * read data directly into the buffer passed to PHYSFS_read(). - * - * Depending on your speed and memory requirements, you should tweak this - * value. - */ -#define ZIP_READBUFSIZE (16 * 1024) - - -/* - * Entries are "unresolved" until they are first opened. At that time, - * local file headers parsed/validated, data offsets will be updated to look - * at the actual file data instead of the header, and symlinks will be - * followed and optimized. This means that we don't seek and read around the - * archive until forced to do so, and after the first time, we had to do - * less reading and parsing, which is very CD-ROM friendly. - */ -typedef enum -{ - ZIP_UNRESOLVED_FILE, - ZIP_UNRESOLVED_SYMLINK, - ZIP_RESOLVING, - ZIP_RESOLVED, - ZIP_DIRECTORY, - ZIP_BROKEN_FILE, - ZIP_BROKEN_SYMLINK -} ZipResolveType; - - -/* - * One ZIPentry is kept for each file in an open ZIP archive. - */ -typedef struct _ZIPentry -{ - __PHYSFS_DirTreeEntry tree; /* manages directory tree */ - struct _ZIPentry *symlink; /* NULL or file we symlink to */ - ZipResolveType resolved; /* Have we resolved file/symlink? */ - PHYSFS_uint64 offset; /* offset of data in archive */ - PHYSFS_uint16 version; /* version made by */ - PHYSFS_uint16 version_needed; /* version needed to extract */ - PHYSFS_uint16 general_bits; /* general purpose bits */ - PHYSFS_uint16 compression_method; /* compression method */ - PHYSFS_uint32 crc; /* crc-32 */ - PHYSFS_uint64 compressed_size; /* compressed size */ - PHYSFS_uint64 uncompressed_size; /* uncompressed size */ - PHYSFS_sint64 last_mod_time; /* last file mod time */ - PHYSFS_uint32 dos_mod_time; /* original MS-DOS style mod time */ -} ZIPentry; - -/* - * One ZIPinfo is kept for each open ZIP archive. - */ -typedef struct -{ - __PHYSFS_DirTree tree; /* manages directory tree. */ - PHYSFS_Io *io; /* the i/o interface for this archive. */ - int zip64; /* non-zero if this is a Zip64 archive. */ - int has_crypto; /* non-zero if any entry uses encryption. */ -} ZIPinfo; - -/* - * One ZIPfileinfo is kept for each open file in a ZIP archive. - */ -typedef struct -{ - ZIPentry *entry; /* Info on file. */ - PHYSFS_Io *io; /* physical file handle. */ - PHYSFS_uint32 compressed_position; /* offset in compressed data. */ - PHYSFS_uint32 uncompressed_position; /* tell() position. */ - PHYSFS_uint8 *buffer; /* decompression buffer. */ - PHYSFS_uint32 crypto_keys[3]; /* for "traditional" crypto. */ - PHYSFS_uint32 initial_crypto_keys[3]; /* for "traditional" crypto. */ - z_stream stream; /* zlib stream state. */ -} ZIPfileinfo; - - -/* Magic numbers... */ -#define ZIP_LOCAL_FILE_SIG 0x04034b50 -#define ZIP_CENTRAL_DIR_SIG 0x02014b50 -#define ZIP_END_OF_CENTRAL_DIR_SIG 0x06054b50 -#define ZIP64_END_OF_CENTRAL_DIR_SIG 0x06064b50 -#define ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIG 0x07064b50 -#define ZIP64_EXTENDED_INFO_EXTRA_FIELD_SIG 0x0001 - -/* compression methods... */ -#define COMPMETH_NONE 0 -/* ...and others... */ - - -#define UNIX_FILETYPE_MASK 0170000 -#define UNIX_FILETYPE_SYMLINK 0120000 - -#define ZIP_GENERAL_BITS_TRADITIONAL_CRYPTO (1 << 0) -#define ZIP_GENERAL_BITS_IGNORE_LOCAL_HEADER (1 << 3) - -/* support for "traditional" PKWARE encryption. */ -static int zip_entry_is_tradional_crypto(const ZIPentry *entry) -{ - return (entry->general_bits & ZIP_GENERAL_BITS_TRADITIONAL_CRYPTO) != 0; -} /* zip_entry_is_traditional_crypto */ - -static int zip_entry_ignore_local_header(const ZIPentry *entry) -{ - return (entry->general_bits & ZIP_GENERAL_BITS_IGNORE_LOCAL_HEADER) != 0; -} /* zip_entry_is_traditional_crypto */ - -static PHYSFS_uint32 zip_crypto_crc32(const PHYSFS_uint32 crc, const PHYSFS_uint8 val) -{ - int i; - PHYSFS_uint32 xorval = (crc ^ ((PHYSFS_uint32) val)) & 0xFF; - for (i = 0; i < 8; i++) - xorval = ((xorval & 1) ? (0xEDB88320 ^ (xorval >> 1)) : (xorval >> 1)); - return xorval ^ (crc >> 8); -} /* zip_crc32 */ - -static void zip_update_crypto_keys(PHYSFS_uint32 *keys, const PHYSFS_uint8 val) -{ - keys[0] = zip_crypto_crc32(keys[0], val); - keys[1] = keys[1] + (keys[0] & 0x000000FF); - keys[1] = (keys[1] * 134775813) + 1; - keys[2] = zip_crypto_crc32(keys[2], (PHYSFS_uint8) ((keys[1] >> 24) & 0xFF)); -} /* zip_update_crypto_keys */ - -static PHYSFS_uint8 zip_decrypt_byte(const PHYSFS_uint32 *keys) -{ - const PHYSFS_uint16 tmp = keys[2] | 2; - return (PHYSFS_uint8) ((tmp * (tmp ^ 1)) >> 8); -} /* zip_decrypt_byte */ - -static PHYSFS_sint64 zip_read_decrypt(ZIPfileinfo *finfo, void *buf, PHYSFS_uint64 len) -{ - PHYSFS_Io *io = finfo->io; - const PHYSFS_sint64 br = io->read(io, buf, len); - - /* Decompression the new data if necessary. */ - if (zip_entry_is_tradional_crypto(finfo->entry) && (br > 0)) - { - PHYSFS_uint32 *keys = finfo->crypto_keys; - PHYSFS_uint8 *ptr = (PHYSFS_uint8 *) buf; - PHYSFS_sint64 i; - for (i = 0; i < br; i++, ptr++) - { - const PHYSFS_uint8 ch = *ptr ^ zip_decrypt_byte(keys); - zip_update_crypto_keys(keys, ch); - *ptr = ch; - } /* for */ - } /* if */ - - return br; -} /* zip_read_decrypt */ - -static int zip_prep_crypto_keys(ZIPfileinfo *finfo, const PHYSFS_uint8 *crypto_header, const PHYSFS_uint8 *password) -{ - /* It doesn't appear to be documented in PKWare's APPNOTE.TXT, but you - need to use a different byte in the header to verify the password - if general purpose bit 3 is set. Discovered this from Info-Zip. - That's what the (verifier) value is doing, below. */ - - PHYSFS_uint32 *keys = finfo->crypto_keys; - const ZIPentry *entry = finfo->entry; - const int usedate = zip_entry_ignore_local_header(entry); - const PHYSFS_uint8 verifier = (PHYSFS_uint8) ((usedate ? (entry->dos_mod_time >> 8) : (entry->crc >> 24)) & 0xFF); - PHYSFS_uint8 finalbyte = 0; - int i = 0; - - /* initialize vector with defaults, then password, then header. */ - keys[0] = 305419896; - keys[1] = 591751049; - keys[2] = 878082192; - - while (*password) - zip_update_crypto_keys(keys, *(password++)); - - for (i = 0; i < 12; i++) - { - const PHYSFS_uint8 c = crypto_header[i] ^ zip_decrypt_byte(keys); - zip_update_crypto_keys(keys, c); - finalbyte = c; - } /* for */ - - /* you have a 1/256 chance of passing this test incorrectly. :/ */ - if (finalbyte != verifier) - BAIL(PHYSFS_ERR_BAD_PASSWORD, 0); - - /* save the initial vector for seeking purposes. Not secure!! */ - memcpy(finfo->initial_crypto_keys, finfo->crypto_keys, 12); - return 1; -} /* zip_prep_crypto_keys */ - - -/* - * Bridge physfs allocation functions to zlib's format... - */ -static voidpf zlibPhysfsAlloc(voidpf opaque, uInt items, uInt size) -{ - return ((PHYSFS_Allocator *) opaque)->Malloc(items * size); -} /* zlibPhysfsAlloc */ - -/* - * Bridge physfs allocation functions to zlib's format... - */ -static void zlibPhysfsFree(voidpf opaque, voidpf address) -{ - ((PHYSFS_Allocator *) opaque)->Free(address); -} /* zlibPhysfsFree */ - - -/* - * Construct a new z_stream to a sane state. - */ -static void initializeZStream(z_stream *pstr) -{ - memset(pstr, '\0', sizeof (z_stream)); - pstr->zalloc = zlibPhysfsAlloc; - pstr->zfree = zlibPhysfsFree; - pstr->opaque = &allocator; -} /* initializeZStream */ - - -static PHYSFS_ErrorCode zlib_error_code(int rc) -{ - switch (rc) - { - case Z_OK: return PHYSFS_ERR_OK; /* not an error. */ - case Z_STREAM_END: return PHYSFS_ERR_OK; /* not an error. */ - case Z_ERRNO: return PHYSFS_ERR_IO; - case Z_MEM_ERROR: return PHYSFS_ERR_OUT_OF_MEMORY; - default: return PHYSFS_ERR_CORRUPT; - } /* switch */ -} /* zlib_error_string */ - - -/* - * Wrap all zlib calls in this, so the physfs error state is set appropriately. - */ -static int zlib_err(const int rc) -{ - PHYSFS_setErrorCode(zlib_error_code(rc)); - return rc; -} /* zlib_err */ - -/* - * Read an unsigned 64-bit int and swap to native byte order. - */ -static int readui64(PHYSFS_Io *io, PHYSFS_uint64 *val) -{ - PHYSFS_uint64 v; - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &v, sizeof (v)), 0); - *val = PHYSFS_swapULE64(v); - return 1; -} /* readui64 */ - -/* - * Read an unsigned 32-bit int and swap to native byte order. - */ -static int readui32(PHYSFS_Io *io, PHYSFS_uint32 *val) -{ - PHYSFS_uint32 v; - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &v, sizeof (v)), 0); - *val = PHYSFS_swapULE32(v); - return 1; -} /* readui32 */ - - -/* - * Read an unsigned 16-bit int and swap to native byte order. - */ -static int readui16(PHYSFS_Io *io, PHYSFS_uint16 *val) -{ - PHYSFS_uint16 v; - BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &v, sizeof (v)), 0); - *val = PHYSFS_swapULE16(v); - return 1; -} /* readui16 */ - - -static PHYSFS_sint64 ZIP_read(PHYSFS_Io *_io, void *buf, PHYSFS_uint64 len) -{ - ZIPfileinfo *finfo = (ZIPfileinfo *) _io->opaque; - ZIPentry *entry = finfo->entry; - PHYSFS_sint64 retval = 0; - PHYSFS_sint64 maxread = (PHYSFS_sint64) len; - PHYSFS_sint64 avail = entry->uncompressed_size - - finfo->uncompressed_position; - - if (avail < maxread) - maxread = avail; - - BAIL_IF_ERRPASS(maxread == 0, 0); /* quick rejection. */ - - if (entry->compression_method == COMPMETH_NONE) - retval = zip_read_decrypt(finfo, buf, maxread); - else - { - finfo->stream.next_out = buf; - finfo->stream.avail_out = (uInt) maxread; - - while (retval < maxread) - { - const PHYSFS_uint32 before = (PHYSFS_uint32) finfo->stream.total_out; - int rc; - - if (finfo->stream.avail_in == 0) - { - PHYSFS_sint64 br; - - br = entry->compressed_size - finfo->compressed_position; - if (br > 0) - { - if (br > ZIP_READBUFSIZE) - br = ZIP_READBUFSIZE; - - br = zip_read_decrypt(finfo, finfo->buffer, (PHYSFS_uint64) br); - if (br <= 0) - break; - - finfo->compressed_position += (PHYSFS_uint32) br; - finfo->stream.next_in = finfo->buffer; - finfo->stream.avail_in = (unsigned int) br; - } /* if */ - } /* if */ - - rc = zlib_err(inflate(&finfo->stream, Z_SYNC_FLUSH)); - retval += (finfo->stream.total_out - before); - - if (rc != Z_OK) - break; - } /* while */ - } /* else */ - - if (retval > 0) - finfo->uncompressed_position += (PHYSFS_uint32) retval; - - return retval; -} /* ZIP_read */ - - -static PHYSFS_sint64 ZIP_write(PHYSFS_Io *io, const void *b, PHYSFS_uint64 len) -{ - BAIL(PHYSFS_ERR_READ_ONLY, -1); -} /* ZIP_write */ - - -static PHYSFS_sint64 ZIP_tell(PHYSFS_Io *io) -{ - return ((ZIPfileinfo *) io->opaque)->uncompressed_position; -} /* ZIP_tell */ - - -static int ZIP_seek(PHYSFS_Io *_io, PHYSFS_uint64 offset) -{ - ZIPfileinfo *finfo = (ZIPfileinfo *) _io->opaque; - ZIPentry *entry = finfo->entry; - PHYSFS_Io *io = finfo->io; - const int encrypted = zip_entry_is_tradional_crypto(entry); - - BAIL_IF(offset > entry->uncompressed_size, PHYSFS_ERR_PAST_EOF, 0); - - if (!encrypted && (entry->compression_method == COMPMETH_NONE)) - { - PHYSFS_sint64 newpos = offset + entry->offset; - BAIL_IF_ERRPASS(!io->seek(io, newpos), 0); - finfo->uncompressed_position = (PHYSFS_uint32) offset; - } /* if */ - - else - { - /* - * If seeking backwards, we need to redecode the file - * from the start and throw away the compressed bits until we hit - * the offset we need. If seeking forward, we still need to - * decode, but we don't rewind first. - */ - if (offset < finfo->uncompressed_position) - { - /* we do a copy so state is sane if inflateInit2() fails. */ - z_stream str; - initializeZStream(&str); - if (zlib_err(inflateInit2(&str, -MAX_WBITS)) != Z_OK) - return 0; - - if (!io->seek(io, entry->offset + (encrypted ? 12 : 0))) - return 0; - - inflateEnd(&finfo->stream); - memcpy(&finfo->stream, &str, sizeof (z_stream)); - finfo->uncompressed_position = finfo->compressed_position = 0; - - if (encrypted) - memcpy(finfo->crypto_keys, finfo->initial_crypto_keys, 12); - } /* if */ - - while (finfo->uncompressed_position != offset) - { - PHYSFS_uint8 buf[512]; - PHYSFS_uint32 maxread; - - maxread = (PHYSFS_uint32) (offset - finfo->uncompressed_position); - if (maxread > sizeof (buf)) - maxread = sizeof (buf); - - if (ZIP_read(_io, buf, maxread) != maxread) - return 0; - } /* while */ - } /* else */ - - return 1; -} /* ZIP_seek */ - - -static PHYSFS_sint64 ZIP_length(PHYSFS_Io *io) -{ - const ZIPfileinfo *finfo = (ZIPfileinfo *) io->opaque; - return (PHYSFS_sint64) finfo->entry->uncompressed_size; -} /* ZIP_length */ - - -static PHYSFS_Io *zip_get_io(PHYSFS_Io *io, ZIPinfo *inf, ZIPentry *entry); - -static PHYSFS_Io *ZIP_duplicate(PHYSFS_Io *io) -{ - ZIPfileinfo *origfinfo = (ZIPfileinfo *) io->opaque; - PHYSFS_Io *retval = (PHYSFS_Io *) allocator.Malloc(sizeof (PHYSFS_Io)); - ZIPfileinfo *finfo = (ZIPfileinfo *) allocator.Malloc(sizeof (ZIPfileinfo)); - GOTO_IF(!retval, PHYSFS_ERR_OUT_OF_MEMORY, failed); - GOTO_IF(!finfo, PHYSFS_ERR_OUT_OF_MEMORY, failed); - memset(finfo, '\0', sizeof (*finfo)); - - finfo->entry = origfinfo->entry; - finfo->io = zip_get_io(origfinfo->io, NULL, finfo->entry); - GOTO_IF_ERRPASS(!finfo->io, failed); - - initializeZStream(&finfo->stream); - if (finfo->entry->compression_method != COMPMETH_NONE) - { - finfo->buffer = (PHYSFS_uint8 *) allocator.Malloc(ZIP_READBUFSIZE); - GOTO_IF(!finfo->buffer, PHYSFS_ERR_OUT_OF_MEMORY, failed); - if (zlib_err(inflateInit2(&finfo->stream, -MAX_WBITS)) != Z_OK) - goto failed; - } /* if */ - - memcpy(retval, io, sizeof (PHYSFS_Io)); - retval->opaque = finfo; - return retval; - -failed: - if (finfo != NULL) - { - if (finfo->io != NULL) - finfo->io->destroy(finfo->io); - - if (finfo->buffer != NULL) - { - allocator.Free(finfo->buffer); - inflateEnd(&finfo->stream); - } /* if */ - - allocator.Free(finfo); - } /* if */ - - if (retval != NULL) - allocator.Free(retval); - - return NULL; -} /* ZIP_duplicate */ - -static int ZIP_flush(PHYSFS_Io *io) { return 1; /* no write support. */ } - -static void ZIP_destroy(PHYSFS_Io *io) -{ - ZIPfileinfo *finfo = (ZIPfileinfo *) io->opaque; - finfo->io->destroy(finfo->io); - - if (finfo->entry->compression_method != COMPMETH_NONE) - inflateEnd(&finfo->stream); - - if (finfo->buffer != NULL) - allocator.Free(finfo->buffer); - - allocator.Free(finfo); - allocator.Free(io); -} /* ZIP_destroy */ - - -static const PHYSFS_Io ZIP_Io = -{ - CURRENT_PHYSFS_IO_API_VERSION, NULL, - ZIP_read, - ZIP_write, - ZIP_seek, - ZIP_tell, - ZIP_length, - ZIP_duplicate, - ZIP_flush, - ZIP_destroy -}; - - - -static PHYSFS_sint64 zip_find_end_of_central_dir(PHYSFS_Io *io, PHYSFS_sint64 *len) -{ - PHYSFS_uint8 buf[256]; - PHYSFS_uint8 extra[4] = { 0, 0, 0, 0 }; - PHYSFS_sint32 i = 0; - PHYSFS_sint64 filelen; - PHYSFS_sint64 filepos; - PHYSFS_sint32 maxread; - PHYSFS_sint32 totalread = 0; - int found = 0; - - filelen = io->length(io); - BAIL_IF_ERRPASS(filelen == -1, -1); - - /* - * Jump to the end of the file and start reading backwards. - * The last thing in the file is the zipfile comment, which is variable - * length, and the field that specifies its size is before it in the - * file (argh!)...this means that we need to scan backwards until we - * hit the end-of-central-dir signature. We can then sanity check that - * the comment was as big as it should be to make sure we're in the - * right place. The comment length field is 16 bits, so we can stop - * searching for that signature after a little more than 64k at most, - * and call it a corrupted zipfile. - */ - - if (sizeof (buf) < filelen) - { - filepos = filelen - sizeof (buf); - maxread = sizeof (buf); - } /* if */ - else - { - filepos = 0; - maxread = (PHYSFS_uint32) filelen; - } /* else */ - - while ((totalread < filelen) && (totalread < 65557)) - { - BAIL_IF_ERRPASS(!io->seek(io, filepos), -1); - - /* make sure we catch a signature between buffers. */ - if (totalread != 0) - { - if (!__PHYSFS_readAll(io, buf, maxread - 4)) - return -1; - memcpy(&buf[maxread - 4], &extra, sizeof (extra)); - totalread += maxread - 4; - } /* if */ - else - { - if (!__PHYSFS_readAll(io, buf, maxread)) - return -1; - totalread += maxread; - } /* else */ - - memcpy(&extra, buf, sizeof (extra)); - - for (i = maxread - 4; i > 0; i--) - { - if ((buf[i + 0] == 0x50) && - (buf[i + 1] == 0x4B) && - (buf[i + 2] == 0x05) && - (buf[i + 3] == 0x06) ) - { - found = 1; /* that's the signature! */ - break; - } /* if */ - } /* for */ - - if (found) - break; - - filepos -= (maxread - 4); - if (filepos < 0) - filepos = 0; - } /* while */ - - BAIL_IF(!found, PHYSFS_ERR_UNSUPPORTED, -1); - - if (len != NULL) - *len = filelen; - - return (filepos + i); -} /* zip_find_end_of_central_dir */ - - -static int isZip(PHYSFS_Io *io) -{ - PHYSFS_uint32 sig = 0; - int retval = 0; - - /* - * The first thing in a zip file might be the signature of the - * first local file record, so it makes for a quick determination. - */ - if (readui32(io, &sig)) - { - retval = (sig == ZIP_LOCAL_FILE_SIG); - if (!retval) - { - /* - * No sig...might be a ZIP with data at the start - * (a self-extracting executable, etc), so we'll have to do - * it the hard way... - */ - retval = (zip_find_end_of_central_dir(io, NULL) != -1); - } /* if */ - } /* if */ - - return retval; -} /* isZip */ - - -/* Convert paths from old, buggy DOS zippers... */ -static void zip_convert_dos_path(const PHYSFS_uint16 entryversion, char *path) -{ - const PHYSFS_uint8 hosttype = (PHYSFS_uint8) ((entryversion >> 8) & 0xFF); - if (hosttype == 0) /* FS_FAT_ */ - { - while (*path) - { - if (*path == '\\') - *path = '/'; - path++; - } /* while */ - } /* if */ -} /* zip_convert_dos_path */ - - -static void zip_expand_symlink_path(char *path) -{ - char *ptr = path; - char *prevptr = path; - - while (1) - { - ptr = strchr(ptr, '/'); - if (ptr == NULL) - break; - - if (*(ptr + 1) == '.') - { - if (*(ptr + 2) == '/') - { - /* current dir in middle of string: ditch it. */ - memmove(ptr, ptr + 2, strlen(ptr + 2) + 1); - } /* else if */ - - else if (*(ptr + 2) == '\0') - { - /* current dir at end of string: ditch it. */ - *ptr = '\0'; - } /* else if */ - - else if (*(ptr + 2) == '.') - { - if (*(ptr + 3) == '/') - { - /* parent dir in middle: move back one, if possible. */ - memmove(prevptr, ptr + 4, strlen(ptr + 4) + 1); - ptr = prevptr; - while (prevptr != path) - { - prevptr--; - if (*prevptr == '/') - { - prevptr++; - break; - } /* if */ - } /* while */ - } /* if */ - - if (*(ptr + 3) == '\0') - { - /* parent dir at end: move back one, if possible. */ - *prevptr = '\0'; - } /* if */ - } /* if */ - } /* if */ - else - { - prevptr = ptr; - ptr++; - } /* else */ - } /* while */ -} /* zip_expand_symlink_path */ - - -static inline ZIPentry *zip_find_entry(ZIPinfo *info, const char *path) -{ - return (ZIPentry *) __PHYSFS_DirTreeFind(&info->tree, path); -} /* zip_find_entry */ - -/* (forward reference: zip_follow_symlink and zip_resolve call each other.) */ -static int zip_resolve(PHYSFS_Io *io, ZIPinfo *info, ZIPentry *entry); - -/* - * Look for the entry named by (path). If it exists, resolve it, and return - * a pointer to that entry. If it's another symlink, keep resolving until you - * hit a real file and then return a pointer to the final non-symlink entry. - * If there's a problem, return NULL. - */ -static ZIPentry *zip_follow_symlink(PHYSFS_Io *io, ZIPinfo *info, char *path) -{ - ZIPentry *entry; - - zip_expand_symlink_path(path); - entry = zip_find_entry(info, path); - if (entry != NULL) - { - if (!zip_resolve(io, info, entry)) /* recursive! */ - entry = NULL; - else - { - if (entry->symlink != NULL) - entry = entry->symlink; - } /* else */ - } /* if */ - - return entry; -} /* zip_follow_symlink */ - - -static int zip_resolve_symlink(PHYSFS_Io *io, ZIPinfo *info, ZIPentry *entry) -{ - const size_t size = (size_t) entry->uncompressed_size; - char *path = NULL; - int rc = 0; - - /* - * We've already parsed the local file header of the symlink at this - * point. Now we need to read the actual link from the file data and - * follow it. - */ - - BAIL_IF_ERRPASS(!io->seek(io, entry->offset), 0); - - path = (char *) __PHYSFS_smallAlloc(size + 1); - BAIL_IF(!path, PHYSFS_ERR_OUT_OF_MEMORY, 0); - - if (entry->compression_method == COMPMETH_NONE) - rc = __PHYSFS_readAll(io, path, size); - - else /* symlink target path is compressed... */ - { - z_stream stream; - const size_t complen = (size_t) entry->compressed_size; - PHYSFS_uint8 *compressed = (PHYSFS_uint8*) __PHYSFS_smallAlloc(complen); - if (compressed != NULL) - { - if (__PHYSFS_readAll(io, compressed, complen)) - { - initializeZStream(&stream); - stream.next_in = compressed; - stream.avail_in = (unsigned int) complen; - stream.next_out = (unsigned char *) path; - stream.avail_out = (unsigned int) size; - if (zlib_err(inflateInit2(&stream, -MAX_WBITS)) == Z_OK) - { - rc = zlib_err(inflate(&stream, Z_FINISH)); - inflateEnd(&stream); - - /* both are acceptable outcomes... */ - rc = ((rc == Z_OK) || (rc == Z_STREAM_END)); - } /* if */ - } /* if */ - __PHYSFS_smallFree(compressed); - } /* if */ - } /* else */ - - if (rc) - { - path[entry->uncompressed_size] = '\0'; /* null-terminate it. */ - zip_convert_dos_path(entry->version, path); - entry->symlink = zip_follow_symlink(io, info, path); - } /* else */ - - __PHYSFS_smallFree(path); - - return (entry->symlink != NULL); -} /* zip_resolve_symlink */ - - -/* - * Parse the local file header of an entry, and update entry->offset. - */ -static int zip_parse_local(PHYSFS_Io *io, ZIPentry *entry) -{ - PHYSFS_uint32 ui32; - PHYSFS_uint16 ui16; - PHYSFS_uint16 fnamelen; - PHYSFS_uint16 extralen; - - /* - * crc and (un)compressed_size are always zero if this is a "JAR" - * archive created with Sun's Java tools, apparently. We only - * consider this archive corrupted if those entries don't match and - * aren't zero. That seems to work well. - * We also ignore a mismatch if the value is 0xFFFFFFFF here, since it's - * possible that's a Zip64 thing. - */ - - /* !!! FIXME: apparently these are zero if general purpose bit 3 is set, - !!! FIXME: which is probably true for Jar files, fwiw, but we don't - !!! FIXME: care about these values anyhow. */ - - BAIL_IF_ERRPASS(!io->seek(io, entry->offset), 0); - BAIL_IF_ERRPASS(!readui32(io, &ui32), 0); - BAIL_IF(ui32 != ZIP_LOCAL_FILE_SIG, PHYSFS_ERR_CORRUPT, 0); - BAIL_IF_ERRPASS(!readui16(io, &ui16), 0); - BAIL_IF(ui16 != entry->version_needed, PHYSFS_ERR_CORRUPT, 0); - BAIL_IF_ERRPASS(!readui16(io, &ui16), 0); /* general bits. */ - BAIL_IF_ERRPASS(!readui16(io, &ui16), 0); - BAIL_IF(ui16 != entry->compression_method, PHYSFS_ERR_CORRUPT, 0); - BAIL_IF_ERRPASS(!readui32(io, &ui32), 0); /* date/time */ - BAIL_IF_ERRPASS(!readui32(io, &ui32), 0); - BAIL_IF(ui32 && (ui32 != entry->crc), PHYSFS_ERR_CORRUPT, 0); - - BAIL_IF_ERRPASS(!readui32(io, &ui32), 0); - BAIL_IF(ui32 && (ui32 != 0xFFFFFFFF) && - (ui32 != entry->compressed_size), PHYSFS_ERR_CORRUPT, 0); - - BAIL_IF_ERRPASS(!readui32(io, &ui32), 0); - BAIL_IF(ui32 && (ui32 != 0xFFFFFFFF) && - (ui32 != entry->uncompressed_size), PHYSFS_ERR_CORRUPT, 0); - - BAIL_IF_ERRPASS(!readui16(io, &fnamelen), 0); - BAIL_IF_ERRPASS(!readui16(io, &extralen), 0); - - entry->offset += fnamelen + extralen + 30; - return 1; -} /* zip_parse_local */ - - -static int zip_resolve(PHYSFS_Io *io, ZIPinfo *info, ZIPentry *entry) -{ - int retval = 1; - const ZipResolveType resolve_type = entry->resolved; - - if (resolve_type == ZIP_DIRECTORY) - return 1; /* we're good. */ - - /* Don't bother if we've failed to resolve this entry before. */ - BAIL_IF(resolve_type == ZIP_BROKEN_FILE, PHYSFS_ERR_CORRUPT, 0); - BAIL_IF(resolve_type == ZIP_BROKEN_SYMLINK, PHYSFS_ERR_CORRUPT, 0); - - /* uhoh...infinite symlink loop! */ - BAIL_IF(resolve_type == ZIP_RESOLVING, PHYSFS_ERR_SYMLINK_LOOP, 0); - - /* - * We fix up the offset to point to the actual data on the - * first open, since we don't want to seek across the whole file on - * archive open (can be SLOW on large, CD-stored files), but we - * need to check the local file header...not just for corruption, - * but since it stores offset info the central directory does not. - */ - if (resolve_type != ZIP_RESOLVED) - { - if (entry->tree.isdir) /* an ancestor dir that DirTree filled in? */ - { - entry->resolved = ZIP_DIRECTORY; - return 1; - } /* if */ - - retval = zip_parse_local(io, entry); - if (retval) - { - /* - * If it's a symlink, find the original file. This will cause - * resolution of other entries (other symlinks and, eventually, - * the real file) if all goes well. - */ - if (resolve_type == ZIP_UNRESOLVED_SYMLINK) - retval = zip_resolve_symlink(io, info, entry); - } /* if */ - - if (resolve_type == ZIP_UNRESOLVED_SYMLINK) - entry->resolved = ((retval) ? ZIP_RESOLVED : ZIP_BROKEN_SYMLINK); - else if (resolve_type == ZIP_UNRESOLVED_FILE) - entry->resolved = ((retval) ? ZIP_RESOLVED : ZIP_BROKEN_FILE); - } /* if */ - - return retval; -} /* zip_resolve */ - - -static int zip_entry_is_symlink(const ZIPentry *entry) -{ - return ((entry->resolved == ZIP_UNRESOLVED_SYMLINK) || - (entry->resolved == ZIP_BROKEN_SYMLINK) || - (entry->symlink)); -} /* zip_entry_is_symlink */ - - -static int zip_version_does_symlinks(PHYSFS_uint32 version) -{ - int retval = 0; - PHYSFS_uint8 hosttype = (PHYSFS_uint8) ((version >> 8) & 0xFF); - - switch (hosttype) - { - /* - * These are the platforms that can NOT build an archive with - * symlinks, according to the Info-ZIP project. - */ - case 0: /* FS_FAT_ */ - case 1: /* AMIGA_ */ - case 2: /* VMS_ */ - case 4: /* VM_CSM_ */ - case 6: /* FS_HPFS_ */ - case 11: /* FS_NTFS_ */ - case 14: /* FS_VFAT_ */ - case 13: /* ACORN_ */ - case 15: /* MVS_ */ - case 18: /* THEOS_ */ - break; /* do nothing. */ - - default: /* assume the rest to be unix-like. */ - retval = 1; - break; - } /* switch */ - - return retval; -} /* zip_version_does_symlinks */ - - -static inline int zip_has_symlink_attr(const ZIPentry *entry, - const PHYSFS_uint32 extern_attr) -{ - PHYSFS_uint16 xattr = ((extern_attr >> 16) & 0xFFFF); - return ( (zip_version_does_symlinks(entry->version)) && - (entry->uncompressed_size > 0) && - ((xattr & UNIX_FILETYPE_MASK) == UNIX_FILETYPE_SYMLINK) ); -} /* zip_has_symlink_attr */ - - -static PHYSFS_sint64 zip_dos_time_to_physfs_time(PHYSFS_uint32 dostime) -{ - PHYSFS_uint32 dosdate; - struct tm unixtime; - memset(&unixtime, '\0', sizeof (unixtime)); - - dosdate = (PHYSFS_uint32) ((dostime >> 16) & 0xFFFF); - dostime &= 0xFFFF; - - /* dissect date */ - unixtime.tm_year = ((dosdate >> 9) & 0x7F) + 80; - unixtime.tm_mon = ((dosdate >> 5) & 0x0F) - 1; - unixtime.tm_mday = ((dosdate ) & 0x1F); - - /* dissect time */ - unixtime.tm_hour = ((dostime >> 11) & 0x1F); - unixtime.tm_min = ((dostime >> 5) & 0x3F); - unixtime.tm_sec = ((dostime << 1) & 0x3E); - - /* let mktime calculate daylight savings time. */ - unixtime.tm_isdst = -1; - - return ((PHYSFS_sint64) mktime(&unixtime)); -} /* zip_dos_time_to_physfs_time */ - - -static ZIPentry *zip_load_entry(ZIPinfo *info, const int zip64, - const PHYSFS_uint64 ofs_fixup) -{ - PHYSFS_Io *io = info->io; - ZIPentry entry; - ZIPentry *retval = NULL; - PHYSFS_uint16 fnamelen, extralen, commentlen; - PHYSFS_uint32 external_attr; - PHYSFS_uint32 starting_disk; - PHYSFS_uint64 offset; - PHYSFS_uint16 ui16; - PHYSFS_uint32 ui32; - PHYSFS_sint64 si64; - char *name = NULL; - int isdir = 0; - - /* sanity check with central directory signature... */ - BAIL_IF_ERRPASS(!readui32(io, &ui32), NULL); - BAIL_IF(ui32 != ZIP_CENTRAL_DIR_SIG, PHYSFS_ERR_CORRUPT, NULL); - - memset(&entry, '\0', sizeof (entry)); - - /* Get the pertinent parts of the record... */ - BAIL_IF_ERRPASS(!readui16(io, &entry.version), NULL); - BAIL_IF_ERRPASS(!readui16(io, &entry.version_needed), NULL); - BAIL_IF_ERRPASS(!readui16(io, &entry.general_bits), NULL); /* general bits */ - BAIL_IF_ERRPASS(!readui16(io, &entry.compression_method), NULL); - BAIL_IF_ERRPASS(!readui32(io, &entry.dos_mod_time), NULL); - entry.last_mod_time = zip_dos_time_to_physfs_time(entry.dos_mod_time); - BAIL_IF_ERRPASS(!readui32(io, &entry.crc), NULL); - BAIL_IF_ERRPASS(!readui32(io, &ui32), NULL); - entry.compressed_size = (PHYSFS_uint64) ui32; - BAIL_IF_ERRPASS(!readui32(io, &ui32), NULL); - entry.uncompressed_size = (PHYSFS_uint64) ui32; - BAIL_IF_ERRPASS(!readui16(io, &fnamelen), NULL); - BAIL_IF_ERRPASS(!readui16(io, &extralen), NULL); - BAIL_IF_ERRPASS(!readui16(io, &commentlen), NULL); - BAIL_IF_ERRPASS(!readui16(io, &ui16), NULL); - starting_disk = (PHYSFS_uint32) ui16; - BAIL_IF_ERRPASS(!readui16(io, &ui16), NULL); /* internal file attribs */ - BAIL_IF_ERRPASS(!readui32(io, &external_attr), NULL); - BAIL_IF_ERRPASS(!readui32(io, &ui32), NULL); - offset = (PHYSFS_uint64) ui32; - - name = (char *) __PHYSFS_smallAlloc(fnamelen + 1); - BAIL_IF(!name, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - if (!__PHYSFS_readAll(io, name, fnamelen)) - { - __PHYSFS_smallFree(name); - return NULL; - } /* if */ - - if (name[fnamelen - 1] == '/') - { - name[fnamelen - 1] = '\0'; - isdir = 1; - } /* if */ - name[fnamelen] = '\0'; /* null-terminate the filename. */ - - zip_convert_dos_path(entry.version, name); - - retval = (ZIPentry *) __PHYSFS_DirTreeAdd(&info->tree, name, isdir); - __PHYSFS_smallFree(name); - - BAIL_IF(!retval, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - - /* It's okay to BAIL without freeing retval, because it's stored in the - __PHYSFS_DirTree and will be freed later anyhow. */ - BAIL_IF(retval->last_mod_time != 0, PHYSFS_ERR_CORRUPT, NULL); /* dupe? */ - - /* Move the data we already read into place in the official object. */ - memcpy(((PHYSFS_uint8 *) retval) + sizeof (__PHYSFS_DirTreeEntry), - ((PHYSFS_uint8 *) &entry) + sizeof (__PHYSFS_DirTreeEntry), - sizeof (*retval) - sizeof (__PHYSFS_DirTreeEntry)); - - retval->symlink = NULL; /* will be resolved later, if necessary. */ - - if (isdir) - retval->resolved = ZIP_DIRECTORY; - else - { - retval->resolved = (zip_has_symlink_attr(retval, external_attr)) ? - ZIP_UNRESOLVED_SYMLINK : ZIP_UNRESOLVED_FILE; - } /* else */ - - si64 = io->tell(io); - BAIL_IF_ERRPASS(si64 == -1, NULL); - - /* If the actual sizes didn't fit in 32-bits, look for the Zip64 - extended information extra field... */ - if ( (zip64) && - ((offset == 0xFFFFFFFF) || - (starting_disk == 0xFFFFFFFF) || - (retval->compressed_size == 0xFFFFFFFF) || - (retval->uncompressed_size == 0xFFFFFFFF)) ) - { - int found = 0; - PHYSFS_uint16 sig = 0; - PHYSFS_uint16 len = 0; - while (extralen > 4) - { - BAIL_IF_ERRPASS(!readui16(io, &sig), NULL); - BAIL_IF_ERRPASS(!readui16(io, &len), NULL); - - si64 += 4 + len; - extralen -= 4 + len; - if (sig != ZIP64_EXTENDED_INFO_EXTRA_FIELD_SIG) - { - BAIL_IF_ERRPASS(!io->seek(io, si64), NULL); - continue; - } /* if */ - - found = 1; - break; - } /* while */ - - BAIL_IF(!found, PHYSFS_ERR_CORRUPT, NULL); - - if (retval->uncompressed_size == 0xFFFFFFFF) - { - BAIL_IF(len < 8, PHYSFS_ERR_CORRUPT, NULL); - BAIL_IF_ERRPASS(!readui64(io, &retval->uncompressed_size), NULL); - len -= 8; - } /* if */ - - if (retval->compressed_size == 0xFFFFFFFF) - { - BAIL_IF(len < 8, PHYSFS_ERR_CORRUPT, NULL); - BAIL_IF_ERRPASS(!readui64(io, &retval->compressed_size), NULL); - len -= 8; - } /* if */ - - if (offset == 0xFFFFFFFF) - { - BAIL_IF(len < 8, PHYSFS_ERR_CORRUPT, NULL); - BAIL_IF_ERRPASS(!readui64(io, &offset), NULL); - len -= 8; - } /* if */ - - if (starting_disk == 0xFFFFFFFF) - { - BAIL_IF(len < 8, PHYSFS_ERR_CORRUPT, NULL); - BAIL_IF_ERRPASS(!readui32(io, &starting_disk), NULL); - len -= 4; - } /* if */ - - BAIL_IF(len != 0, PHYSFS_ERR_CORRUPT, NULL); - } /* if */ - - BAIL_IF(starting_disk != 0, PHYSFS_ERR_CORRUPT, NULL); - - retval->offset = offset + ofs_fixup; - - /* seek to the start of the next entry in the central directory... */ - BAIL_IF_ERRPASS(!io->seek(io, si64 + extralen + commentlen), NULL); - - return retval; /* success. */ -} /* zip_load_entry */ - - -/* This leaves things allocated on error; the caller will clean up the mess. */ -static int zip_load_entries(ZIPinfo *info, - const PHYSFS_uint64 data_ofs, - const PHYSFS_uint64 central_ofs, - const PHYSFS_uint64 entry_count) -{ - PHYSFS_Io *io = info->io; - const int zip64 = info->zip64; - PHYSFS_uint64 i; - - BAIL_IF_ERRPASS(!io->seek(io, central_ofs), 0); - - for (i = 0; i < entry_count; i++) - { - ZIPentry *entry = zip_load_entry(info, zip64, data_ofs); - BAIL_IF_ERRPASS(!entry, 0); - if (zip_entry_is_tradional_crypto(entry)) - info->has_crypto = 1; - } /* for */ - - return 1; -} /* zip_load_entries */ - - -static PHYSFS_sint64 zip64_find_end_of_central_dir(PHYSFS_Io *io, - PHYSFS_sint64 _pos, - PHYSFS_uint64 offset) -{ - /* - * Naturally, the offset is useless to us; it is the offset from the - * start of file, which is meaningless if we've appended this .zip to - * a self-extracting .exe. We need to find this on our own. It should - * be directly before the locator record, but the record in question, - * like the original end-of-central-directory record, ends with a - * variable-length field. Unlike the original, which has to store the - * size of that variable-length field in a 16-bit int and thus has to be - * within 64k, the new one gets 64-bits. - * - * Fortunately, the only currently-specified record for that variable - * length block is some weird proprietary thing that deals with EBCDIC - * and tape backups or something. So we don't seek far. - */ - - PHYSFS_uint32 ui32; - const PHYSFS_uint64 pos = (PHYSFS_uint64) _pos; - - assert(_pos > 0); - - /* Try offset specified in the Zip64 end of central directory locator. */ - /* This works if the entire PHYSFS_Io is the zip file. */ - BAIL_IF_ERRPASS(!io->seek(io, offset), -1); - BAIL_IF_ERRPASS(!readui32(io, &ui32), -1); - if (ui32 == ZIP64_END_OF_CENTRAL_DIR_SIG) - return offset; - - /* Try 56 bytes before the Zip64 end of central directory locator. */ - /* This works if the record isn't variable length and is version 1. */ - if (pos > 56) - { - BAIL_IF_ERRPASS(!io->seek(io, pos-56), -1); - BAIL_IF_ERRPASS(!readui32(io, &ui32), -1); - if (ui32 == ZIP64_END_OF_CENTRAL_DIR_SIG) - return pos-56; - } /* if */ - - /* Try 84 bytes before the Zip64 end of central directory locator. */ - /* This works if the record isn't variable length and is version 2. */ - if (pos > 84) - { - BAIL_IF_ERRPASS(!io->seek(io, pos-84), -1); - BAIL_IF_ERRPASS(!readui32(io, &ui32), -1); - if (ui32 == ZIP64_END_OF_CENTRAL_DIR_SIG) - return pos-84; - } /* if */ - - /* Ok, brute force: we know it's between (offset) and (pos) somewhere. */ - /* Just try moving back at most 256k. Oh well. */ - if ((offset < pos) && (pos > 4)) - { - const size_t maxbuflen = 256 * 1024; - size_t len = (size_t) (pos - offset); - PHYSFS_uint8 *buf = NULL; - PHYSFS_sint32 i; - - if (len > maxbuflen) - len = maxbuflen; - - buf = (PHYSFS_uint8 *) __PHYSFS_smallAlloc(len); - BAIL_IF(!buf, PHYSFS_ERR_OUT_OF_MEMORY, -1); - - if (!io->seek(io, pos - len) || !__PHYSFS_readAll(io, buf, len)) - { - __PHYSFS_smallFree(buf); - return -1; /* error was set elsewhere. */ - } /* if */ - - for (i = (PHYSFS_sint32) (len - 4); i >= 0; i--) - { - if ( (buf[i] == 0x50) && (buf[i+1] == 0x4b) && - (buf[i+2] == 0x06) && (buf[i+3] == 0x06) ) - { - __PHYSFS_smallFree(buf); - return pos - ((PHYSFS_sint64) (len - i)); - } /* if */ - } /* for */ - - __PHYSFS_smallFree(buf); - } /* if */ - - BAIL(PHYSFS_ERR_CORRUPT, -1); /* didn't find it. */ -} /* zip64_find_end_of_central_dir */ - - -static int zip64_parse_end_of_central_dir(ZIPinfo *info, - PHYSFS_uint64 *data_start, - PHYSFS_uint64 *dir_ofs, - PHYSFS_uint64 *entry_count, - PHYSFS_sint64 pos) -{ - PHYSFS_Io *io = info->io; - PHYSFS_uint64 ui64; - PHYSFS_uint32 ui32; - PHYSFS_uint16 ui16; - - /* We should be positioned right past the locator signature. */ - - if ((pos < 0) || (!io->seek(io, pos))) - return 0; - - BAIL_IF_ERRPASS(!readui32(io, &ui32), 0); - if (ui32 != ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIG) - return -1; /* it's not a Zip64 archive. Not an error, though! */ - - info->zip64 = 1; - - /* number of the disk with the start of the central directory. */ - BAIL_IF_ERRPASS(!readui32(io, &ui32), 0); - BAIL_IF(ui32 != 0, PHYSFS_ERR_CORRUPT, 0); - - /* offset of Zip64 end of central directory record. */ - BAIL_IF_ERRPASS(!readui64(io, &ui64), 0); - - /* total number of disks */ - BAIL_IF_ERRPASS(!readui32(io, &ui32), 0); - BAIL_IF(ui32 != 1, PHYSFS_ERR_CORRUPT, 0); - - pos = zip64_find_end_of_central_dir(io, pos, ui64); - if (pos < 0) - return 0; /* oh well. */ - - /* - * For self-extracting archives, etc, there's crapola in the file - * before the zipfile records; we calculate how much data there is - * prepended by determining how far the zip64-end-of-central-directory - * offset is from where it is supposed to be...the difference in bytes - * is how much arbitrary data is at the start of the physical file. - */ - assert(((PHYSFS_uint64) pos) >= ui64); - *data_start = ((PHYSFS_uint64) pos) - ui64; - - BAIL_IF_ERRPASS(!io->seek(io, pos), 0); - - /* check signature again, just in case. */ - BAIL_IF_ERRPASS(!readui32(io, &ui32), 0); - BAIL_IF(ui32 != ZIP64_END_OF_CENTRAL_DIR_SIG, PHYSFS_ERR_CORRUPT, 0); - - /* size of Zip64 end of central directory record. */ - BAIL_IF_ERRPASS(!readui64(io, &ui64), 0); - - /* version made by. */ - BAIL_IF_ERRPASS(!readui16(io, &ui16), 0); - - /* version needed to extract. */ - BAIL_IF_ERRPASS(!readui16(io, &ui16), 0); - - /* number of this disk. */ - BAIL_IF_ERRPASS(!readui32(io, &ui32), 0); - BAIL_IF(ui32 != 0, PHYSFS_ERR_CORRUPT, 0); - - /* number of disk with start of central directory record. */ - BAIL_IF_ERRPASS(!readui32(io, &ui32), 0); - BAIL_IF(ui32 != 0, PHYSFS_ERR_CORRUPT, 0); - - /* total number of entries in the central dir on this disk */ - BAIL_IF_ERRPASS(!readui64(io, &ui64), 0); - - /* total number of entries in the central dir */ - BAIL_IF_ERRPASS(!readui64(io, entry_count), 0); - BAIL_IF(ui64 != *entry_count, PHYSFS_ERR_CORRUPT, 0); - - /* size of the central directory */ - BAIL_IF_ERRPASS(!readui64(io, &ui64), 0); - - /* offset of central directory */ - BAIL_IF_ERRPASS(!readui64(io, dir_ofs), 0); - - /* Since we know the difference, fix up the central dir offset... */ - *dir_ofs += *data_start; - - /* - * There are more fields here, for encryption and feature-specific things, - * but we don't care about any of them at the moment. - */ - - return 1; /* made it. */ -} /* zip64_parse_end_of_central_dir */ - - -static int zip_parse_end_of_central_dir(ZIPinfo *info, - PHYSFS_uint64 *data_start, - PHYSFS_uint64 *dir_ofs, - PHYSFS_uint64 *entry_count) -{ - PHYSFS_Io *io = info->io; - PHYSFS_uint16 entryCount16; - PHYSFS_uint32 offset32; - PHYSFS_uint32 ui32; - PHYSFS_uint16 ui16; - PHYSFS_sint64 len; - PHYSFS_sint64 pos; - int rc; - - /* find the end-of-central-dir record, and seek to it. */ - pos = zip_find_end_of_central_dir(io, &len); - BAIL_IF_ERRPASS(pos == -1, 0); - BAIL_IF_ERRPASS(!io->seek(io, pos), 0); - - /* check signature again, just in case. */ - BAIL_IF_ERRPASS(!readui32(io, &ui32), 0); - BAIL_IF(ui32 != ZIP_END_OF_CENTRAL_DIR_SIG, PHYSFS_ERR_CORRUPT, 0); - - /* Seek back to see if "Zip64 end of central directory locator" exists. */ - /* this record is 20 bytes before end-of-central-dir */ - rc = zip64_parse_end_of_central_dir(info, data_start, dir_ofs, - entry_count, pos - 20); - - /* Error or success? Bounce out of here. Keep going if not zip64. */ - if ((rc == 0) || (rc == 1)) - return rc; - - assert(rc == -1); /* no error, just not a Zip64 archive. */ - - /* Not Zip64? Seek back to where we were and keep processing. */ - BAIL_IF_ERRPASS(!io->seek(io, pos + 4), 0); - - /* number of this disk */ - BAIL_IF_ERRPASS(!readui16(io, &ui16), 0); - BAIL_IF(ui16 != 0, PHYSFS_ERR_CORRUPT, 0); - - /* number of the disk with the start of the central directory */ - BAIL_IF_ERRPASS(!readui16(io, &ui16), 0); - BAIL_IF(ui16 != 0, PHYSFS_ERR_CORRUPT, 0); - - /* total number of entries in the central dir on this disk */ - BAIL_IF_ERRPASS(!readui16(io, &ui16), 0); - - /* total number of entries in the central dir */ - BAIL_IF_ERRPASS(!readui16(io, &entryCount16), 0); - BAIL_IF(ui16 != entryCount16, PHYSFS_ERR_CORRUPT, 0); - - *entry_count = entryCount16; - - /* size of the central directory */ - BAIL_IF_ERRPASS(!readui32(io, &ui32), 0); - - /* offset of central directory */ - BAIL_IF_ERRPASS(!readui32(io, &offset32), 0); - *dir_ofs = (PHYSFS_uint64) offset32; - BAIL_IF(((PHYSFS_uint64) pos) < (*dir_ofs + ui32), PHYSFS_ERR_CORRUPT, 0); - - /* - * For self-extracting archives, etc, there's crapola in the file - * before the zipfile records; we calculate how much data there is - * prepended by determining how far the central directory offset is - * from where it is supposed to be (start of end-of-central-dir minus - * sizeof central dir)...the difference in bytes is how much arbitrary - * data is at the start of the physical file. - */ - *data_start = (PHYSFS_uint64) (pos - (*dir_ofs + ui32)); - - /* Now that we know the difference, fix up the central dir offset... */ - *dir_ofs += *data_start; - - /* zipfile comment length */ - BAIL_IF_ERRPASS(!readui16(io, &ui16), 0); - - /* - * Make sure that the comment length matches to the end of file... - * If it doesn't, we're either in the wrong part of the file, or the - * file is corrupted, but we give up either way. - */ - BAIL_IF((pos + 22 + ui16) != len, PHYSFS_ERR_CORRUPT, 0); - - return 1; /* made it. */ -} /* zip_parse_end_of_central_dir */ - - -static void ZIP_closeArchive(void *opaque) -{ - ZIPinfo *info = (ZIPinfo *) (opaque); - - if (!info) - return; - - if (info->io) - info->io->destroy(info->io); - - __PHYSFS_DirTreeDeinit(&info->tree); - - allocator.Free(info); -} /* ZIP_closeArchive */ - - -static void *ZIP_openArchive(PHYSFS_Io *io, const char *name, - int forWriting, int *claimed) -{ - ZIPinfo *info = NULL; - ZIPentry *root = NULL; - PHYSFS_uint64 dstart = 0; /* data start */ - PHYSFS_uint64 cdir_ofs; /* central dir offset */ - PHYSFS_uint64 count; - - assert(io != NULL); /* shouldn't ever happen. */ - - BAIL_IF(forWriting, PHYSFS_ERR_READ_ONLY, NULL); - BAIL_IF_ERRPASS(!isZip(io), NULL); - - *claimed = 1; - - info = (ZIPinfo *) allocator.Malloc(sizeof (ZIPinfo)); - BAIL_IF(!info, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - memset(info, '\0', sizeof (ZIPinfo)); - - info->io = io; - - if (!zip_parse_end_of_central_dir(info, &dstart, &cdir_ofs, &count)) - goto ZIP_openarchive_failed; - else if (!__PHYSFS_DirTreeInit(&info->tree, sizeof (ZIPentry))) - goto ZIP_openarchive_failed; - - root = (ZIPentry *) info->tree.root; - root->resolved = ZIP_DIRECTORY; - - if (!zip_load_entries(info, dstart, cdir_ofs, count)) - goto ZIP_openarchive_failed; - - assert(info->tree.root->sibling == NULL); - return info; - -ZIP_openarchive_failed: - info->io = NULL; /* don't let ZIP_closeArchive destroy (io). */ - ZIP_closeArchive(info); - return NULL; -} /* ZIP_openArchive */ - - -static PHYSFS_Io *zip_get_io(PHYSFS_Io *io, ZIPinfo *inf, ZIPentry *entry) -{ - int success; - PHYSFS_Io *retval = io->duplicate(io); - BAIL_IF_ERRPASS(!retval, NULL); - - assert(!entry->tree.isdir); /* should have been checked before calling. */ - - /* (inf) can be NULL if we already resolved. */ - success = (inf == NULL) || zip_resolve(retval, inf, entry); - if (success) - { - PHYSFS_sint64 offset; - offset = ((entry->symlink) ? entry->symlink->offset : entry->offset); - success = retval->seek(retval, offset); - } /* if */ - - if (!success) - { - retval->destroy(retval); - retval = NULL; - } /* if */ - - return retval; -} /* zip_get_io */ - - -static PHYSFS_Io *ZIP_openRead(void *opaque, const char *filename) -{ - PHYSFS_Io *retval = NULL; - ZIPinfo *info = (ZIPinfo *) opaque; - ZIPentry *entry = zip_find_entry(info, filename); - ZIPfileinfo *finfo = NULL; - PHYSFS_Io *io = NULL; - PHYSFS_uint8 *password = NULL; - - /* if not found, see if maybe "$PASSWORD" is appended. */ - if ((!entry) && (info->has_crypto)) - { - const char *ptr = strrchr(filename, '$'); - if (ptr != NULL) - { - const size_t len = (size_t) (ptr - filename); - char *str = (char *) __PHYSFS_smallAlloc(len + 1); - BAIL_IF(!str, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - memcpy(str, filename, len); - str[len] = '\0'; - entry = zip_find_entry(info, str); - __PHYSFS_smallFree(str); - password = (PHYSFS_uint8 *) (ptr + 1); - } /* if */ - } /* if */ - - BAIL_IF_ERRPASS(!entry, NULL); - - BAIL_IF_ERRPASS(!zip_resolve(info->io, info, entry), NULL); - - BAIL_IF(entry->tree.isdir, PHYSFS_ERR_NOT_A_FILE, NULL); - - retval = (PHYSFS_Io *) allocator.Malloc(sizeof (PHYSFS_Io)); - GOTO_IF(!retval, PHYSFS_ERR_OUT_OF_MEMORY, ZIP_openRead_failed); - - finfo = (ZIPfileinfo *) allocator.Malloc(sizeof (ZIPfileinfo)); - GOTO_IF(!finfo, PHYSFS_ERR_OUT_OF_MEMORY, ZIP_openRead_failed); - memset(finfo, '\0', sizeof (ZIPfileinfo)); - - io = zip_get_io(info->io, info, entry); - GOTO_IF_ERRPASS(!io, ZIP_openRead_failed); - finfo->io = io; - finfo->entry = ((entry->symlink != NULL) ? entry->symlink : entry); - initializeZStream(&finfo->stream); - - if (finfo->entry->compression_method != COMPMETH_NONE) - { - finfo->buffer = (PHYSFS_uint8 *) allocator.Malloc(ZIP_READBUFSIZE); - if (!finfo->buffer) - GOTO(PHYSFS_ERR_OUT_OF_MEMORY, ZIP_openRead_failed); - else if (zlib_err(inflateInit2(&finfo->stream, -MAX_WBITS)) != Z_OK) - goto ZIP_openRead_failed; - } /* if */ - - if (!zip_entry_is_tradional_crypto(entry)) - GOTO_IF(password != NULL, PHYSFS_ERR_BAD_PASSWORD, ZIP_openRead_failed); - else - { - PHYSFS_uint8 crypto_header[12]; - GOTO_IF(password == NULL, PHYSFS_ERR_BAD_PASSWORD, ZIP_openRead_failed); - if (io->read(io, crypto_header, 12) != 12) - goto ZIP_openRead_failed; - else if (!zip_prep_crypto_keys(finfo, crypto_header, password)) - goto ZIP_openRead_failed; - } /* if */ - - memcpy(retval, &ZIP_Io, sizeof (PHYSFS_Io)); - retval->opaque = finfo; - - return retval; - -ZIP_openRead_failed: - if (finfo != NULL) - { - if (finfo->io != NULL) - finfo->io->destroy(finfo->io); - - if (finfo->buffer != NULL) - { - allocator.Free(finfo->buffer); - inflateEnd(&finfo->stream); - } /* if */ - - allocator.Free(finfo); - } /* if */ - - if (retval != NULL) - allocator.Free(retval); - - return NULL; -} /* ZIP_openRead */ - - -static PHYSFS_Io *ZIP_openWrite(void *opaque, const char *filename) -{ - BAIL(PHYSFS_ERR_READ_ONLY, NULL); -} /* ZIP_openWrite */ - - -static PHYSFS_Io *ZIP_openAppend(void *opaque, const char *filename) -{ - BAIL(PHYSFS_ERR_READ_ONLY, NULL); -} /* ZIP_openAppend */ - - -static int ZIP_remove(void *opaque, const char *name) -{ - BAIL(PHYSFS_ERR_READ_ONLY, 0); -} /* ZIP_remove */ - - -static int ZIP_mkdir(void *opaque, const char *name) -{ - BAIL(PHYSFS_ERR_READ_ONLY, 0); -} /* ZIP_mkdir */ - - -static int ZIP_stat(void *opaque, const char *filename, PHYSFS_Stat *stat) -{ - ZIPinfo *info = (ZIPinfo *) opaque; - ZIPentry *entry = zip_find_entry(info, filename); - - if (entry == NULL) - return 0; - - else if (!zip_resolve(info->io, info, entry)) - return 0; - - else if (entry->resolved == ZIP_DIRECTORY) - { - stat->filesize = 0; - stat->filetype = PHYSFS_FILETYPE_DIRECTORY; - } /* if */ - - else if (zip_entry_is_symlink(entry)) - { - stat->filesize = 0; - stat->filetype = PHYSFS_FILETYPE_SYMLINK; - } /* else if */ - - else - { - stat->filesize = (PHYSFS_sint64) entry->uncompressed_size; - stat->filetype = PHYSFS_FILETYPE_REGULAR; - } /* else */ - - stat->modtime = ((entry) ? entry->last_mod_time : 0); - stat->createtime = stat->modtime; - stat->accesstime = -1; - stat->readonly = 1; /* .zip files are always read only */ - - return 1; -} /* ZIP_stat */ - - -const PHYSFS_Archiver __PHYSFS_Archiver_ZIP = -{ - CURRENT_PHYSFS_ARCHIVER_API_VERSION, - { - "ZIP", - "PkZip/WinZip/Info-Zip compatible", - "Ryan C. Gordon ", - "https://icculus.org/physfs/", - 1, /* supportsSymlinks */ - }, - ZIP_openArchive, - __PHYSFS_DirTreeEnumerate, - ZIP_openRead, - ZIP_openWrite, - ZIP_openAppend, - ZIP_remove, - ZIP_mkdir, - ZIP_stat, - ZIP_closeArchive -}; - -#endif /* defined PHYSFS_SUPPORTS_ZIP */ - -/* end of physfs_archiver_zip.c ... */ - diff --git a/love/src/jni/love/src/libraries/physfs/physfs_byteorder.c b/love/src/jni/love/src/libraries/physfs/physfs_byteorder.c deleted file mode 100644 index b2d3a2cf..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_byteorder.c +++ /dev/null @@ -1,137 +0,0 @@ -/** - * PhysicsFS; a portable, flexible file i/o abstraction. - * - * Documentation is in physfs.h. It's verbose, honest. :) - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file written by Ryan C. Gordon. - */ - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_internal.h" - -#ifndef PHYSFS_Swap16 -static inline PHYSFS_uint16 PHYSFS_Swap16(PHYSFS_uint16 D) -{ - return ((D<<8)|(D>>8)); -} -#endif -#ifndef PHYSFS_Swap32 -static inline PHYSFS_uint32 PHYSFS_Swap32(PHYSFS_uint32 D) -{ - return ((D<<24)|((D<<8)&0x00FF0000)|((D>>8)&0x0000FF00)|(D>>24)); -} -#endif -#ifndef PHYSFS_NO_64BIT_SUPPORT -#ifndef PHYSFS_Swap64 -static inline PHYSFS_uint64 PHYSFS_Swap64(PHYSFS_uint64 val) { - PHYSFS_uint32 hi, lo; - - /* Separate into high and low 32-bit values and swap them */ - lo = (PHYSFS_uint32)(val&0xFFFFFFFF); - val >>= 32; - hi = (PHYSFS_uint32)(val&0xFFFFFFFF); - val = PHYSFS_Swap32(lo); - val <<= 32; - val |= PHYSFS_Swap32(hi); - return val; -} -#endif -#else -#ifndef PHYSFS_Swap64 -/* This is mainly to keep compilers from complaining in PHYSFS code. - If there is no real 64-bit datatype, then compilers will complain about - the fake 64-bit datatype that PHYSFS provides when it compiles user code. -*/ -#define PHYSFS_Swap64(X) (X) -#endif -#endif /* PHYSFS_NO_64BIT_SUPPORT */ - - -/* Byteswap item from the specified endianness to the native endianness */ -#if PHYSFS_BYTEORDER == PHYSFS_LIL_ENDIAN -PHYSFS_uint16 PHYSFS_swapULE16(PHYSFS_uint16 x) { return x; } -PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 x) { return x; } -PHYSFS_uint32 PHYSFS_swapULE32(PHYSFS_uint32 x) { return x; } -PHYSFS_sint32 PHYSFS_swapSLE32(PHYSFS_sint32 x) { return x; } -PHYSFS_uint64 PHYSFS_swapULE64(PHYSFS_uint64 x) { return x; } -PHYSFS_sint64 PHYSFS_swapSLE64(PHYSFS_sint64 x) { return x; } - -PHYSFS_uint16 PHYSFS_swapUBE16(PHYSFS_uint16 x) { return PHYSFS_Swap16(x); } -PHYSFS_sint16 PHYSFS_swapSBE16(PHYSFS_sint16 x) { return PHYSFS_Swap16(x); } -PHYSFS_uint32 PHYSFS_swapUBE32(PHYSFS_uint32 x) { return PHYSFS_Swap32(x); } -PHYSFS_sint32 PHYSFS_swapSBE32(PHYSFS_sint32 x) { return PHYSFS_Swap32(x); } -PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 x) { return PHYSFS_Swap64(x); } -PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 x) { return PHYSFS_Swap64(x); } -#else -PHYSFS_uint16 PHYSFS_swapULE16(PHYSFS_uint16 x) { return PHYSFS_Swap16(x); } -PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 x) { return PHYSFS_Swap16(x); } -PHYSFS_uint32 PHYSFS_swapULE32(PHYSFS_uint32 x) { return PHYSFS_Swap32(x); } -PHYSFS_sint32 PHYSFS_swapSLE32(PHYSFS_sint32 x) { return PHYSFS_Swap32(x); } -PHYSFS_uint64 PHYSFS_swapULE64(PHYSFS_uint64 x) { return PHYSFS_Swap64(x); } -PHYSFS_sint64 PHYSFS_swapSLE64(PHYSFS_sint64 x) { return PHYSFS_Swap64(x); } - -PHYSFS_uint16 PHYSFS_swapUBE16(PHYSFS_uint16 x) { return x; } -PHYSFS_sint16 PHYSFS_swapSBE16(PHYSFS_sint16 x) { return x; } -PHYSFS_uint32 PHYSFS_swapUBE32(PHYSFS_uint32 x) { return x; } -PHYSFS_sint32 PHYSFS_swapSBE32(PHYSFS_sint32 x) { return x; } -PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 x) { return x; } -PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 x) { return x; } -#endif - -static inline int readAll(PHYSFS_File *file, void *val, const size_t len) -{ - return (PHYSFS_readBytes(file, val, len) == len); -} /* readAll */ - -#define PHYSFS_BYTEORDER_READ(datatype, swaptype) \ - int PHYSFS_read##swaptype(PHYSFS_File *file, PHYSFS_##datatype *val) { \ - PHYSFS_##datatype in; \ - BAIL_IF(val == NULL, PHYSFS_ERR_INVALID_ARGUMENT, 0); \ - BAIL_IF_ERRPASS(!readAll(file, &in, sizeof (in)), 0); \ - *val = PHYSFS_swap##swaptype(in); \ - return 1; \ - } - -PHYSFS_BYTEORDER_READ(sint16, SLE16) -PHYSFS_BYTEORDER_READ(uint16, ULE16) -PHYSFS_BYTEORDER_READ(sint16, SBE16) -PHYSFS_BYTEORDER_READ(uint16, UBE16) -PHYSFS_BYTEORDER_READ(sint32, SLE32) -PHYSFS_BYTEORDER_READ(uint32, ULE32) -PHYSFS_BYTEORDER_READ(sint32, SBE32) -PHYSFS_BYTEORDER_READ(uint32, UBE32) -PHYSFS_BYTEORDER_READ(sint64, SLE64) -PHYSFS_BYTEORDER_READ(uint64, ULE64) -PHYSFS_BYTEORDER_READ(sint64, SBE64) -PHYSFS_BYTEORDER_READ(uint64, UBE64) - - -static inline int writeAll(PHYSFS_File *f, const void *val, const size_t len) -{ - return (PHYSFS_writeBytes(f, val, len) == len); -} /* writeAll */ - -#define PHYSFS_BYTEORDER_WRITE(datatype, swaptype) \ - int PHYSFS_write##swaptype(PHYSFS_File *file, PHYSFS_##datatype val) { \ - const PHYSFS_##datatype out = PHYSFS_swap##swaptype(val); \ - BAIL_IF_ERRPASS(!writeAll(file, &out, sizeof (out)), 0); \ - return 1; \ - } - -PHYSFS_BYTEORDER_WRITE(sint16, SLE16) -PHYSFS_BYTEORDER_WRITE(uint16, ULE16) -PHYSFS_BYTEORDER_WRITE(sint16, SBE16) -PHYSFS_BYTEORDER_WRITE(uint16, UBE16) -PHYSFS_BYTEORDER_WRITE(sint32, SLE32) -PHYSFS_BYTEORDER_WRITE(uint32, ULE32) -PHYSFS_BYTEORDER_WRITE(sint32, SBE32) -PHYSFS_BYTEORDER_WRITE(uint32, UBE32) -PHYSFS_BYTEORDER_WRITE(sint64, SLE64) -PHYSFS_BYTEORDER_WRITE(uint64, ULE64) -PHYSFS_BYTEORDER_WRITE(sint64, SBE64) -PHYSFS_BYTEORDER_WRITE(uint64, UBE64) - -/* end of physfs_byteorder.c ... */ - diff --git a/love/src/jni/love/src/libraries/physfs/physfs_casefolding.h b/love/src/jni/love/src/libraries/physfs/physfs_casefolding.h deleted file mode 100644 index bb6ac189..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_casefolding.h +++ /dev/null @@ -1,2572 +0,0 @@ -/* - * This file is part of PhysicsFS (https://icculus.org/physfs/) - * - * This data generated by physfs/extras/makecasefoldhashtable.pl ... - * Do not manually edit this file! - * - * Please see the file LICENSE.txt in the source's root directory. - */ - -#ifndef _INCLUDE_PHYSFS_CASEFOLDING_H_ -#define _INCLUDE_PHYSFS_CASEFOLDING_H_ - -#ifndef __PHYSICSFS_INTERNAL__ -#error Do not include this header from your applications. -#endif - -/* We build three simple hashmaps here: one that maps Unicode codepoints to -a one, two, or three lowercase codepoints. To retrieve this info: look at -case_fold_hashX, where X is 1, 2, or 3. Most foldable codepoints fold to one, -a few dozen fold to two, and a handful fold to three. If the codepoint isn't -in any of these hashes, it doesn't fold (no separate upper and lowercase). - -Almost all these codepoints fit into 16 bits, so we hash them as such to save -memory. If a codepoint is > 0xFFFF, we have separate hashes for them, -since there are (currently) only about 120 of them and (currently) all of them -map to a single lowercase codepoint. */ - -typedef struct CaseFoldMapping1_32 -{ - PHYSFS_uint32 from; - PHYSFS_uint32 to0; -} CaseFoldMapping1_32; - -typedef struct CaseFoldMapping1_16 -{ - PHYSFS_uint16 from; - PHYSFS_uint16 to0; -} CaseFoldMapping1_16; - -typedef struct CaseFoldMapping2_16 -{ - PHYSFS_uint16 from; - PHYSFS_uint16 to0; - PHYSFS_uint16 to1; -} CaseFoldMapping2_16; - -typedef struct CaseFoldMapping3_16 -{ - PHYSFS_uint16 from; - PHYSFS_uint16 to0; - PHYSFS_uint16 to1; - PHYSFS_uint16 to2; -} CaseFoldMapping3_16; - -typedef struct CaseFoldHashBucket1_16 -{ - const CaseFoldMapping1_16 *list; - const PHYSFS_uint8 count; -} CaseFoldHashBucket1_16; - -typedef struct CaseFoldHashBucket1_32 -{ - const CaseFoldMapping1_32 *list; - const PHYSFS_uint8 count; -} CaseFoldHashBucket1_32; - -typedef struct CaseFoldHashBucket2_16 -{ - const CaseFoldMapping2_16 *list; - const PHYSFS_uint8 count; -} CaseFoldHashBucket2_16; - -typedef struct CaseFoldHashBucket3_16 -{ - const CaseFoldMapping3_16 *list; - const PHYSFS_uint8 count; -} CaseFoldHashBucket3_16; - -static const CaseFoldMapping1_16 case_fold1_16_000[] = { - { 0x0202, 0x0203 }, - { 0x0404, 0x0454 }, - { 0x1E1E, 0x1E1F }, - { 0x2C2C, 0x2C5C }, - { 0xABAB, 0x13DB } -}; - -static const CaseFoldMapping1_16 case_fold1_16_001[] = { - { 0x0100, 0x0101 }, - { 0x0405, 0x0455 }, - { 0x0504, 0x0505 }, - { 0x2C2D, 0x2C5D }, - { 0xA7A6, 0xA7A7 }, - { 0xABAA, 0x13DA } -}; - -static const CaseFoldMapping1_16 case_fold1_16_002[] = { - { 0x0200, 0x0201 }, - { 0x0406, 0x0456 }, - { 0x1E1C, 0x1E1D }, - { 0x1F1D, 0x1F15 }, - { 0x2C2E, 0x2C5E }, - { 0xABA9, 0x13D9 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_003[] = { - { 0x0102, 0x0103 }, - { 0x0407, 0x0457 }, - { 0x0506, 0x0507 }, - { 0x1F1C, 0x1F14 }, - { 0xA7A4, 0xA7A5 }, - { 0xABA8, 0x13D8 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_004[] = { - { 0x0206, 0x0207 }, - { 0x0400, 0x0450 }, - { 0x1E1A, 0x1E1B }, - { 0x1F1B, 0x1F13 }, - { 0x2C28, 0x2C58 }, - { 0xABAF, 0x13DF } -}; - -static const CaseFoldMapping1_16 case_fold1_16_005[] = { - { 0x0104, 0x0105 }, - { 0x0401, 0x0451 }, - { 0x0500, 0x0501 }, - { 0x1F1A, 0x1F12 }, - { 0x2C29, 0x2C59 }, - { 0xA7A2, 0xA7A3 }, - { 0xABAE, 0x13DE } -}; - -static const CaseFoldMapping1_16 case_fold1_16_006[] = { - { 0x0204, 0x0205 }, - { 0x0402, 0x0452 }, - { 0x1E18, 0x1E19 }, - { 0x1F19, 0x1F11 }, - { 0x2C2A, 0x2C5A }, - { 0xABAD, 0x13DD } -}; - -static const CaseFoldMapping1_16 case_fold1_16_007[] = { - { 0x0106, 0x0107 }, - { 0x0403, 0x0453 }, - { 0x0502, 0x0503 }, - { 0x1F18, 0x1F10 }, - { 0x2126, 0x03C9 }, - { 0x2C2B, 0x2C5B }, - { 0xA7A0, 0xA7A1 }, - { 0xABAC, 0x13DC } -}; - -static const CaseFoldMapping1_16 case_fold1_16_008[] = { - { 0x020A, 0x020B }, - { 0x040C, 0x045C }, - { 0x1E16, 0x1E17 }, - { 0x2C24, 0x2C54 }, - { 0xABA3, 0x13D3 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_009[] = { - { 0x0108, 0x0109 }, - { 0x040D, 0x045D }, - { 0x050C, 0x050D }, - { 0x2C25, 0x2C55 }, - { 0xABA2, 0x13D2 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_010[] = { - { 0x0208, 0x0209 }, - { 0x040E, 0x045E }, - { 0x1E14, 0x1E15 }, - { 0x212B, 0x00E5 }, - { 0x2C26, 0x2C56 }, - { 0xA7AD, 0x026C }, - { 0xABA1, 0x13D1 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_011[] = { - { 0x010A, 0x010B }, - { 0x040F, 0x045F }, - { 0x050E, 0x050F }, - { 0x212A, 0x006B }, - { 0x2C27, 0x2C57 }, - { 0xA7AC, 0x0261 }, - { 0xABA0, 0x13D0 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_012[] = { - { 0x020E, 0x020F }, - { 0x0408, 0x0458 }, - { 0x1E12, 0x1E13 }, - { 0x2C20, 0x2C50 }, - { 0xA7AB, 0x025C }, - { 0xABA7, 0x13D7 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_013[] = { - { 0x010C, 0x010D }, - { 0x0409, 0x0459 }, - { 0x0508, 0x0509 }, - { 0x2C21, 0x2C51 }, - { 0xA7AA, 0x0266 }, - { 0xABA6, 0x13D6 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_014[] = { - { 0x020C, 0x020D }, - { 0x040A, 0x045A }, - { 0x1E10, 0x1E11 }, - { 0x2C22, 0x2C52 }, - { 0xABA5, 0x13D5 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_015[] = { - { 0x010E, 0x010F }, - { 0x040B, 0x045B }, - { 0x050A, 0x050B }, - { 0x2C23, 0x2C53 }, - { 0xA7A8, 0xA7A9 }, - { 0xABA4, 0x13D4 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_016[] = { - { 0x0212, 0x0213 }, - { 0x0414, 0x0434 }, - { 0x1E0E, 0x1E0F }, - { 0x1F0F, 0x1F07 }, - { 0xABBB, 0x13EB } -}; - -static const CaseFoldMapping1_16 case_fold1_16_017[] = { - { 0x0110, 0x0111 }, - { 0x0415, 0x0435 }, - { 0x0514, 0x0515 }, - { 0x1F0E, 0x1F06 }, - { 0xA7B6, 0xA7B7 }, - { 0xABBA, 0x13EA } -}; - -static const CaseFoldMapping1_16 case_fold1_16_018[] = { - { 0x0210, 0x0211 }, - { 0x0416, 0x0436 }, - { 0x1E0C, 0x1E0D }, - { 0x1F0D, 0x1F05 }, - { 0xABB9, 0x13E9 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_019[] = { - { 0x0112, 0x0113 }, - { 0x0417, 0x0437 }, - { 0x0516, 0x0517 }, - { 0x1F0C, 0x1F04 }, - { 0x2132, 0x214E }, - { 0xA7B4, 0xA7B5 }, - { 0xABB8, 0x13E8 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_020[] = { - { 0x0216, 0x0217 }, - { 0x0410, 0x0430 }, - { 0x1E0A, 0x1E0B }, - { 0x1F0B, 0x1F03 }, - { 0xA7B3, 0xAB53 }, - { 0xABBF, 0x13EF } -}; - -static const CaseFoldMapping1_16 case_fold1_16_021[] = { - { 0x0114, 0x0115 }, - { 0x0411, 0x0431 }, - { 0x0510, 0x0511 }, - { 0x1F0A, 0x1F02 }, - { 0xA7B2, 0x029D }, - { 0xABBE, 0x13EE } -}; - -static const CaseFoldMapping1_16 case_fold1_16_022[] = { - { 0x0214, 0x0215 }, - { 0x0412, 0x0432 }, - { 0x1E08, 0x1E09 }, - { 0x1F09, 0x1F01 }, - { 0xA7B1, 0x0287 }, - { 0xABBD, 0x13ED } -}; - -static const CaseFoldMapping1_16 case_fold1_16_023[] = { - { 0x0116, 0x0117 }, - { 0x0413, 0x0433 }, - { 0x0512, 0x0513 }, - { 0x1F08, 0x1F00 }, - { 0xA7B0, 0x029E }, - { 0xABBC, 0x13EC } -}; - -static const CaseFoldMapping1_16 case_fold1_16_024[] = { - { 0x021A, 0x021B }, - { 0x041C, 0x043C }, - { 0x1E06, 0x1E07 }, - { 0xABB3, 0x13E3 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_025[] = { - { 0x0118, 0x0119 }, - { 0x041D, 0x043D }, - { 0x051C, 0x051D }, - { 0xABB2, 0x13E2 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_026[] = { - { 0x0218, 0x0219 }, - { 0x041E, 0x043E }, - { 0x1E04, 0x1E05 }, - { 0xABB1, 0x13E1 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_027[] = { - { 0x011A, 0x011B }, - { 0x041F, 0x043F }, - { 0x051E, 0x051F }, - { 0xABB0, 0x13E0 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_028[] = { - { 0x021E, 0x021F }, - { 0x0418, 0x0438 }, - { 0x1E02, 0x1E03 }, - { 0xABB7, 0x13E7 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_029[] = { - { 0x011C, 0x011D }, - { 0x0419, 0x0439 }, - { 0x0518, 0x0519 }, - { 0xABB6, 0x13E6 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_030[] = { - { 0x021C, 0x021D }, - { 0x041A, 0x043A }, - { 0x1E00, 0x1E01 }, - { 0xABB5, 0x13E5 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_031[] = { - { 0x011E, 0x011F }, - { 0x041B, 0x043B }, - { 0x051A, 0x051B }, - { 0xABB4, 0x13E4 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_032[] = { - { 0x0222, 0x0223 }, - { 0x0424, 0x0444 }, - { 0x1E3E, 0x1E3F }, - { 0x1F3F, 0x1F37 }, - { 0x2C0C, 0x2C3C }, - { 0xA686, 0xA687 }, - { 0xAB8B, 0x13BB } -}; - -static const CaseFoldMapping1_16 case_fold1_16_033[] = { - { 0x0120, 0x0121 }, - { 0x0425, 0x0445 }, - { 0x0524, 0x0525 }, - { 0x1F3E, 0x1F36 }, - { 0x2C0D, 0x2C3D }, - { 0xA786, 0xA787 }, - { 0xAB8A, 0x13BA } -}; - -static const CaseFoldMapping1_16 case_fold1_16_034[] = { - { 0x0220, 0x019E }, - { 0x0426, 0x0446 }, - { 0x1E3C, 0x1E3D }, - { 0x1F3D, 0x1F35 }, - { 0x2C0E, 0x2C3E }, - { 0xA684, 0xA685 }, - { 0xAB89, 0x13B9 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_035[] = { - { 0x0122, 0x0123 }, - { 0x0427, 0x0447 }, - { 0x0526, 0x0527 }, - { 0x1F3C, 0x1F34 }, - { 0x2C0F, 0x2C3F }, - { 0xA784, 0xA785 }, - { 0xAB88, 0x13B8 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_036[] = { - { 0x0226, 0x0227 }, - { 0x0420, 0x0440 }, - { 0x1E3A, 0x1E3B }, - { 0x1F3B, 0x1F33 }, - { 0x2C08, 0x2C38 }, - { 0xA682, 0xA683 }, - { 0xAB8F, 0x13BF } -}; - -static const CaseFoldMapping1_16 case_fold1_16_037[] = { - { 0x0124, 0x0125 }, - { 0x0421, 0x0441 }, - { 0x0520, 0x0521 }, - { 0x1F3A, 0x1F32 }, - { 0x2C09, 0x2C39 }, - { 0xA782, 0xA783 }, - { 0xAB8E, 0x13BE } -}; - -static const CaseFoldMapping1_16 case_fold1_16_038[] = { - { 0x0224, 0x0225 }, - { 0x0422, 0x0442 }, - { 0x1E38, 0x1E39 }, - { 0x1F39, 0x1F31 }, - { 0x2C0A, 0x2C3A }, - { 0xA680, 0xA681 }, - { 0xAB8D, 0x13BD } -}; - -static const CaseFoldMapping1_16 case_fold1_16_039[] = { - { 0x0126, 0x0127 }, - { 0x0423, 0x0443 }, - { 0x0522, 0x0523 }, - { 0x1F38, 0x1F30 }, - { 0x2C0B, 0x2C3B }, - { 0xA780, 0xA781 }, - { 0xAB8C, 0x13BC } -}; - -static const CaseFoldMapping1_16 case_fold1_16_040[] = { - { 0x022A, 0x022B }, - { 0x042C, 0x044C }, - { 0x1E36, 0x1E37 }, - { 0x2C04, 0x2C34 }, - { 0xA68E, 0xA68F }, - { 0xAB83, 0x13B3 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_041[] = { - { 0x0128, 0x0129 }, - { 0x042D, 0x044D }, - { 0x052C, 0x052D }, - { 0x2C05, 0x2C35 }, - { 0xAB82, 0x13B2 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_042[] = { - { 0x0228, 0x0229 }, - { 0x042E, 0x044E }, - { 0x1E34, 0x1E35 }, - { 0x2C06, 0x2C36 }, - { 0xA68C, 0xA68D }, - { 0xA78D, 0x0265 }, - { 0xAB81, 0x13B1 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_043[] = { - { 0x012A, 0x012B }, - { 0x042F, 0x044F }, - { 0x052E, 0x052F }, - { 0x2C07, 0x2C37 }, - { 0xAB80, 0x13B0 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_044[] = { - { 0x022E, 0x022F }, - { 0x0428, 0x0448 }, - { 0x1E32, 0x1E33 }, - { 0x2C00, 0x2C30 }, - { 0xA68A, 0xA68B }, - { 0xA78B, 0xA78C }, - { 0xAB87, 0x13B7 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_045[] = { - { 0x012C, 0x012D }, - { 0x0429, 0x0449 }, - { 0x0528, 0x0529 }, - { 0x2C01, 0x2C31 }, - { 0xAB86, 0x13B6 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_046[] = { - { 0x022C, 0x022D }, - { 0x042A, 0x044A }, - { 0x1E30, 0x1E31 }, - { 0x2C02, 0x2C32 }, - { 0xA688, 0xA689 }, - { 0xAB85, 0x13B5 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_047[] = { - { 0x012E, 0x012F }, - { 0x042B, 0x044B }, - { 0x052A, 0x052B }, - { 0x2C03, 0x2C33 }, - { 0xAB84, 0x13B4 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_048[] = { - { 0x0232, 0x0233 }, - { 0x0535, 0x0565 }, - { 0x1E2E, 0x1E2F }, - { 0x1F2F, 0x1F27 }, - { 0x2C1C, 0x2C4C }, - { 0xA696, 0xA697 }, - { 0xAB9B, 0x13CB } -}; - -static const CaseFoldMapping1_16 case_fold1_16_049[] = { - { 0x0534, 0x0564 }, - { 0x1F2E, 0x1F26 }, - { 0x2C1D, 0x2C4D }, - { 0xA796, 0xA797 }, - { 0xAB9A, 0x13CA } -}; - -static const CaseFoldMapping1_16 case_fold1_16_050[] = { - { 0x0230, 0x0231 }, - { 0x0537, 0x0567 }, - { 0x1E2C, 0x1E2D }, - { 0x1F2D, 0x1F25 }, - { 0x2C1E, 0x2C4E }, - { 0xA694, 0xA695 }, - { 0xAB99, 0x13C9 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_051[] = { - { 0x0132, 0x0133 }, - { 0x0536, 0x0566 }, - { 0x1F2C, 0x1F24 }, - { 0x2C1F, 0x2C4F }, - { 0xAB98, 0x13C8 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_052[] = { - { 0x0531, 0x0561 }, - { 0x1E2A, 0x1E2B }, - { 0x1F2B, 0x1F23 }, - { 0x2C18, 0x2C48 }, - { 0xA692, 0xA693 }, - { 0xAB9F, 0x13CF } -}; - -static const CaseFoldMapping1_16 case_fold1_16_053[] = { - { 0x0134, 0x0135 }, - { 0x1F2A, 0x1F22 }, - { 0x2C19, 0x2C49 }, - { 0xA792, 0xA793 }, - { 0xAB9E, 0x13CE } -}; - -static const CaseFoldMapping1_16 case_fold1_16_054[] = { - { 0x0533, 0x0563 }, - { 0x1E28, 0x1E29 }, - { 0x1F29, 0x1F21 }, - { 0x2C1A, 0x2C4A }, - { 0xA690, 0xA691 }, - { 0xAB9D, 0x13CD } -}; - -static const CaseFoldMapping1_16 case_fold1_16_055[] = { - { 0x0136, 0x0137 }, - { 0x0532, 0x0562 }, - { 0x1F28, 0x1F20 }, - { 0x2C1B, 0x2C4B }, - { 0xA790, 0xA791 }, - { 0xAB9C, 0x13CC } -}; - -static const CaseFoldMapping1_16 case_fold1_16_056[] = { - { 0x0139, 0x013A }, - { 0x023A, 0x2C65 }, - { 0x053D, 0x056D }, - { 0x1E26, 0x1E27 }, - { 0x2C14, 0x2C44 }, - { 0xAB93, 0x13C3 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_057[] = { - { 0x023B, 0x023C }, - { 0x053C, 0x056C }, - { 0x2C15, 0x2C45 }, - { 0xA79E, 0xA79F }, - { 0xAB92, 0x13C2 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_058[] = { - { 0x013B, 0x013C }, - { 0x053F, 0x056F }, - { 0x1E24, 0x1E25 }, - { 0x2C16, 0x2C46 }, - { 0xAB91, 0x13C1 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_059[] = { - { 0x053E, 0x056E }, - { 0x2C17, 0x2C47 }, - { 0xA79C, 0xA79D }, - { 0xAB90, 0x13C0 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_060[] = { - { 0x013D, 0x013E }, - { 0x023E, 0x2C66 }, - { 0x0539, 0x0569 }, - { 0x1E22, 0x1E23 }, - { 0x2C10, 0x2C40 }, - { 0xA69A, 0xA69B }, - { 0xAB97, 0x13C7 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_061[] = { - { 0x0538, 0x0568 }, - { 0x2C11, 0x2C41 }, - { 0xA79A, 0xA79B }, - { 0xAB96, 0x13C6 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_062[] = { - { 0x013F, 0x0140 }, - { 0x053B, 0x056B }, - { 0x1E20, 0x1E21 }, - { 0x2C12, 0x2C42 }, - { 0xA698, 0xA699 }, - { 0xAB95, 0x13C5 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_063[] = { - { 0x023D, 0x019A }, - { 0x053A, 0x056A }, - { 0x2C13, 0x2C43 }, - { 0xA798, 0xA799 }, - { 0xAB94, 0x13C4 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_064[] = { - { 0x0141, 0x0142 }, - { 0x0545, 0x0575 }, - { 0x1E5E, 0x1E5F }, - { 0x1F5F, 0x1F57 }, - { 0x2161, 0x2171 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_065[] = { - { 0x0041, 0x0061 }, - { 0x0243, 0x0180 }, - { 0x0544, 0x0574 }, - { 0x2160, 0x2170 }, - { 0x2C6D, 0x0251 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_066[] = { - { 0x0042, 0x0062 }, - { 0x0143, 0x0144 }, - { 0x0547, 0x0577 }, - { 0x1E5C, 0x1E5D }, - { 0x1F5D, 0x1F55 }, - { 0x2163, 0x2173 }, - { 0x2C6E, 0x0271 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_067[] = { - { 0x0043, 0x0063 }, - { 0x0241, 0x0242 }, - { 0x0546, 0x0576 }, - { 0x2162, 0x2172 }, - { 0x2C6F, 0x0250 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_068[] = { - { 0x0044, 0x0064 }, - { 0x0145, 0x0146 }, - { 0x0246, 0x0247 }, - { 0x0541, 0x0571 }, - { 0x1E5A, 0x1E5B }, - { 0x1F5B, 0x1F53 }, - { 0x2165, 0x2175 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_069[] = { - { 0x0045, 0x0065 }, - { 0x0540, 0x0570 }, - { 0x2164, 0x2174 }, - { 0x2C69, 0x2C6A } -}; - -static const CaseFoldMapping1_16 case_fold1_16_070[] = { - { 0x0046, 0x0066 }, - { 0x0147, 0x0148 }, - { 0x0244, 0x0289 }, - { 0x0345, 0x03B9 }, - { 0x0543, 0x0573 }, - { 0x1E58, 0x1E59 }, - { 0x1F59, 0x1F51 }, - { 0x2167, 0x2177 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_071[] = { - { 0x0047, 0x0067 }, - { 0x0245, 0x028C }, - { 0x0542, 0x0572 }, - { 0x2166, 0x2176 }, - { 0x2C6B, 0x2C6C } -}; - -static const CaseFoldMapping1_16 case_fold1_16_072[] = { - { 0x0048, 0x0068 }, - { 0x024A, 0x024B }, - { 0x054D, 0x057D }, - { 0x1E56, 0x1E57 }, - { 0x2169, 0x2179 }, - { 0x2C64, 0x027D } -}; - -static const CaseFoldMapping1_16 case_fold1_16_073[] = { - { 0x0049, 0x0069 }, - { 0x054C, 0x057C }, - { 0x2168, 0x2178 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_074[] = { - { 0x004A, 0x006A }, - { 0x0248, 0x0249 }, - { 0x054F, 0x057F }, - { 0x1E54, 0x1E55 }, - { 0x216B, 0x217B } -}; - -static const CaseFoldMapping1_16 case_fold1_16_075[] = { - { 0x004B, 0x006B }, - { 0x014A, 0x014B }, - { 0x054E, 0x057E }, - { 0x216A, 0x217A }, - { 0x2C67, 0x2C68 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_076[] = { - { 0x004C, 0x006C }, - { 0x024E, 0x024F }, - { 0x0549, 0x0579 }, - { 0x1E52, 0x1E53 }, - { 0x216D, 0x217D }, - { 0x2C60, 0x2C61 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_077[] = { - { 0x004D, 0x006D }, - { 0x014C, 0x014D }, - { 0x0548, 0x0578 }, - { 0x216C, 0x217C } -}; - -static const CaseFoldMapping1_16 case_fold1_16_078[] = { - { 0x004E, 0x006E }, - { 0x024C, 0x024D }, - { 0x054B, 0x057B }, - { 0x1E50, 0x1E51 }, - { 0x216F, 0x217F }, - { 0x2C62, 0x026B } -}; - -static const CaseFoldMapping1_16 case_fold1_16_079[] = { - { 0x004F, 0x006F }, - { 0x014E, 0x014F }, - { 0x054A, 0x057A }, - { 0x216E, 0x217E }, - { 0x2C63, 0x1D7D } -}; - -static const CaseFoldMapping1_16 case_fold1_16_080[] = { - { 0x0050, 0x0070 }, - { 0x0555, 0x0585 }, - { 0x1E4E, 0x1E4F } -}; - -static const CaseFoldMapping1_16 case_fold1_16_081[] = { - { 0x0051, 0x0071 }, - { 0x0150, 0x0151 }, - { 0x0554, 0x0584 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_082[] = { - { 0x0052, 0x0072 }, - { 0x1E4C, 0x1E4D }, - { 0x1F4D, 0x1F45 }, - { 0x2C7E, 0x023F } -}; - -static const CaseFoldMapping1_16 case_fold1_16_083[] = { - { 0x0053, 0x0073 }, - { 0x0152, 0x0153 }, - { 0x0556, 0x0586 }, - { 0x1F4C, 0x1F44 }, - { 0x2C7F, 0x0240 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_084[] = { - { 0x0054, 0x0074 }, - { 0x0551, 0x0581 }, - { 0x1E4A, 0x1E4B }, - { 0x1F4B, 0x1F43 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_085[] = { - { 0x0055, 0x0075 }, - { 0x0154, 0x0155 }, - { 0x0550, 0x0580 }, - { 0x1F4A, 0x1F42 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_086[] = { - { 0x0056, 0x0076 }, - { 0x0553, 0x0583 }, - { 0x1E48, 0x1E49 }, - { 0x1F49, 0x1F41 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_087[] = { - { 0x0057, 0x0077 }, - { 0x0156, 0x0157 }, - { 0x0552, 0x0582 }, - { 0x1F48, 0x1F40 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_088[] = { - { 0x0058, 0x0078 }, - { 0x1E46, 0x1E47 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_089[] = { - { 0x0059, 0x0079 }, - { 0x0158, 0x0159 }, - { 0x2C75, 0x2C76 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_090[] = { - { 0x005A, 0x007A }, - { 0x1E44, 0x1E45 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_091[] = { - { 0x015A, 0x015B } -}; - -static const CaseFoldMapping1_16 case_fold1_16_092[] = { - { 0x1E42, 0x1E43 }, - { 0x2C70, 0x0252 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_093[] = { - { 0x015C, 0x015D } -}; - -static const CaseFoldMapping1_16 case_fold1_16_094[] = { - { 0x1E40, 0x1E41 }, - { 0x2C72, 0x2C73 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_095[] = { - { 0x015E, 0x015F } -}; - -static const CaseFoldMapping1_16 case_fold1_16_096[] = { - { 0x0464, 0x0465 }, - { 0x1E7E, 0x1E7F } -}; - -static const CaseFoldMapping1_16 case_fold1_16_097[] = { - { 0x0160, 0x0161 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_098[] = { - { 0x0466, 0x0467 }, - { 0x1E7C, 0x1E7D } -}; - -static const CaseFoldMapping1_16 case_fold1_16_099[] = { - { 0x0162, 0x0163 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_100[] = { - { 0x0460, 0x0461 }, - { 0x1E7A, 0x1E7B } -}; - -static const CaseFoldMapping1_16 case_fold1_16_101[] = { - { 0x0164, 0x0165 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_102[] = { - { 0x0462, 0x0463 }, - { 0x1E78, 0x1E79 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_103[] = { - { 0x0166, 0x0167 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_104[] = { - { 0x046C, 0x046D }, - { 0x1E76, 0x1E77 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_105[] = { - { 0x0168, 0x0169 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_106[] = { - { 0x046E, 0x046F }, - { 0x1E74, 0x1E75 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_107[] = { - { 0x016A, 0x016B } -}; - -static const CaseFoldMapping1_16 case_fold1_16_108[] = { - { 0x0468, 0x0469 }, - { 0x1E72, 0x1E73 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_109[] = { - { 0x016C, 0x016D } -}; - -static const CaseFoldMapping1_16 case_fold1_16_110[] = { - { 0x046A, 0x046B }, - { 0x1E70, 0x1E71 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_111[] = { - { 0x016E, 0x016F } -}; - -static const CaseFoldMapping1_16 case_fold1_16_112[] = { - { 0x0474, 0x0475 }, - { 0x1E6E, 0x1E6F }, - { 0x1F6F, 0x1F67 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_113[] = { - { 0x0170, 0x0171 }, - { 0x0372, 0x0373 }, - { 0x1F6E, 0x1F66 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_114[] = { - { 0x0476, 0x0477 }, - { 0x1E6C, 0x1E6D }, - { 0x1F6D, 0x1F65 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_115[] = { - { 0x0172, 0x0173 }, - { 0x0370, 0x0371 }, - { 0x1F6C, 0x1F64 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_116[] = { - { 0x0470, 0x0471 }, - { 0x1E6A, 0x1E6B }, - { 0x1F6B, 0x1F63 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_117[] = { - { 0x0174, 0x0175 }, - { 0x0376, 0x0377 }, - { 0x1F6A, 0x1F62 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_118[] = { - { 0x0472, 0x0473 }, - { 0x1E68, 0x1E69 }, - { 0x1F69, 0x1F61 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_119[] = { - { 0x0176, 0x0177 }, - { 0x1F68, 0x1F60 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_120[] = { - { 0x0179, 0x017A }, - { 0x047C, 0x047D }, - { 0x1E66, 0x1E67 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_121[] = { - { 0x0178, 0x00FF } -}; - -static const CaseFoldMapping1_16 case_fold1_16_122[] = { - { 0x017B, 0x017C }, - { 0x047E, 0x047F }, - { 0x1E64, 0x1E65 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_124[] = { - { 0x017D, 0x017E }, - { 0x037F, 0x03F3 }, - { 0x0478, 0x0479 }, - { 0x1E62, 0x1E63 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_126[] = { - { 0x017F, 0x0073 }, - { 0x047A, 0x047B }, - { 0x1E60, 0x1E61 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_128[] = { - { 0x0181, 0x0253 }, - { 0x2CAC, 0x2CAD } -}; - -static const CaseFoldMapping1_16 case_fold1_16_129[] = { - { 0xA726, 0xA727 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_130[] = { - { 0x2CAE, 0x2CAF } -}; - -static const CaseFoldMapping1_16 case_fold1_16_131[] = { - { 0x0182, 0x0183 }, - { 0xA724, 0xA725 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_132[] = { - { 0x0480, 0x0481 }, - { 0x2CA8, 0x2CA9 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_133[] = { - { 0x0184, 0x0185 }, - { 0x0386, 0x03AC }, - { 0x1E9B, 0x1E61 }, - { 0xA722, 0xA723 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_134[] = { - { 0x0187, 0x0188 }, - { 0x2CAA, 0x2CAB } -}; - -static const CaseFoldMapping1_16 case_fold1_16_135[] = { - { 0x0186, 0x0254 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_136[] = { - { 0x0189, 0x0256 }, - { 0x048C, 0x048D }, - { 0x2CA4, 0x2CA5 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_137[] = { - { 0x038A, 0x03AF }, - { 0xA72E, 0xA72F } -}; - -static const CaseFoldMapping1_16 case_fold1_16_138[] = { - { 0x018B, 0x018C }, - { 0x0389, 0x03AE }, - { 0x048E, 0x048F }, - { 0x1E94, 0x1E95 }, - { 0x2CA6, 0x2CA7 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_139[] = { - { 0x018A, 0x0257 }, - { 0x0388, 0x03AD }, - { 0xA72C, 0xA72D } -}; - -static const CaseFoldMapping1_16 case_fold1_16_140[] = { - { 0x038F, 0x03CE }, - { 0x1E92, 0x1E93 }, - { 0x2CA0, 0x2CA1 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_141[] = { - { 0x038E, 0x03CD }, - { 0xA72A, 0xA72B } -}; - -static const CaseFoldMapping1_16 case_fold1_16_142[] = { - { 0x018F, 0x0259 }, - { 0x048A, 0x048B }, - { 0x1E90, 0x1E91 }, - { 0x2CA2, 0x2CA3 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_143[] = { - { 0x018E, 0x01DD }, - { 0x038C, 0x03CC }, - { 0xA728, 0xA729 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_144[] = { - { 0x0191, 0x0192 }, - { 0x0393, 0x03B3 }, - { 0x0494, 0x0495 }, - { 0x1E8E, 0x1E8F }, - { 0x2CBC, 0x2CBD } -}; - -static const CaseFoldMapping1_16 case_fold1_16_145[] = { - { 0x0190, 0x025B }, - { 0x0392, 0x03B2 }, - { 0xA736, 0xA737 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_146[] = { - { 0x0193, 0x0260 }, - { 0x0391, 0x03B1 }, - { 0x0496, 0x0497 }, - { 0x1E8C, 0x1E8D }, - { 0x24B6, 0x24D0 }, - { 0x2CBE, 0x2CBF } -}; - -static const CaseFoldMapping1_16 case_fold1_16_147[] = { - { 0x24B7, 0x24D1 }, - { 0xA734, 0xA735 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_148[] = { - { 0x0397, 0x03B7 }, - { 0x0490, 0x0491 }, - { 0x1E8A, 0x1E8B }, - { 0x2CB8, 0x2CB9 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_149[] = { - { 0x0194, 0x0263 }, - { 0x0396, 0x03B6 }, - { 0xA732, 0xA733 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_150[] = { - { 0x0197, 0x0268 }, - { 0x0395, 0x03B5 }, - { 0x0492, 0x0493 }, - { 0x1E88, 0x1E89 }, - { 0x2CBA, 0x2CBB } -}; - -static const CaseFoldMapping1_16 case_fold1_16_151[] = { - { 0x0196, 0x0269 }, - { 0x0394, 0x03B4 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_152[] = { - { 0x039B, 0x03BB }, - { 0x049C, 0x049D }, - { 0x1E86, 0x1E87 }, - { 0x24BC, 0x24D6 }, - { 0x2CB4, 0x2CB5 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_153[] = { - { 0x0198, 0x0199 }, - { 0x039A, 0x03BA }, - { 0x24BD, 0x24D7 }, - { 0xA73E, 0xA73F } -}; - -static const CaseFoldMapping1_16 case_fold1_16_154[] = { - { 0x0399, 0x03B9 }, - { 0x049E, 0x049F }, - { 0x1E84, 0x1E85 }, - { 0x24BE, 0x24D8 }, - { 0x2CB6, 0x2CB7 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_155[] = { - { 0x0398, 0x03B8 }, - { 0x24BF, 0x24D9 }, - { 0xA73C, 0xA73D } -}; - -static const CaseFoldMapping1_16 case_fold1_16_156[] = { - { 0x019D, 0x0272 }, - { 0x039F, 0x03BF }, - { 0x0498, 0x0499 }, - { 0x1E82, 0x1E83 }, - { 0x24B8, 0x24D2 }, - { 0x2CB0, 0x2CB1 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_157[] = { - { 0x019C, 0x026F }, - { 0x039E, 0x03BE }, - { 0x24B9, 0x24D3 }, - { 0xA73A, 0xA73B } -}; - -static const CaseFoldMapping1_16 case_fold1_16_158[] = { - { 0x019F, 0x0275 }, - { 0x039D, 0x03BD }, - { 0x049A, 0x049B }, - { 0x1E80, 0x1E81 }, - { 0x24BA, 0x24D4 }, - { 0x2CB2, 0x2CB3 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_159[] = { - { 0x039C, 0x03BC }, - { 0x24BB, 0x24D5 }, - { 0xA738, 0xA739 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_160[] = { - { 0x03A3, 0x03C3 }, - { 0x04A4, 0x04A5 }, - { 0x10B0, 0x2D10 }, - { 0x1EBE, 0x1EBF }, - { 0x2C8C, 0x2C8D } -}; - -static const CaseFoldMapping1_16 case_fold1_16_161[] = { - { 0x01A0, 0x01A1 }, - { 0x10B1, 0x2D11 }, - { 0x1FBE, 0x03B9 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_162[] = { - { 0x03A1, 0x03C1 }, - { 0x04A6, 0x04A7 }, - { 0x10B2, 0x2D12 }, - { 0x1EBC, 0x1EBD }, - { 0x2183, 0x2184 }, - { 0x2C8E, 0x2C8F } -}; - -static const CaseFoldMapping1_16 case_fold1_16_163[] = { - { 0x01A2, 0x01A3 }, - { 0x03A0, 0x03C0 }, - { 0x10B3, 0x2D13 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_164[] = { - { 0x03A7, 0x03C7 }, - { 0x04A0, 0x04A1 }, - { 0x10B4, 0x2D14 }, - { 0x1EBA, 0x1EBB }, - { 0x1FBB, 0x1F71 }, - { 0x2C88, 0x2C89 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_165[] = { - { 0x01A4, 0x01A5 }, - { 0x03A6, 0x03C6 }, - { 0x10B5, 0x2D15 }, - { 0x1FBA, 0x1F70 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_166[] = { - { 0x01A7, 0x01A8 }, - { 0x03A5, 0x03C5 }, - { 0x04A2, 0x04A3 }, - { 0x10B6, 0x2D16 }, - { 0x1EB8, 0x1EB9 }, - { 0x1FB9, 0x1FB1 }, - { 0x2C8A, 0x2C8B } -}; - -static const CaseFoldMapping1_16 case_fold1_16_167[] = { - { 0x01A6, 0x0280 }, - { 0x03A4, 0x03C4 }, - { 0x10B7, 0x2D17 }, - { 0x1FB8, 0x1FB0 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_168[] = { - { 0x01A9, 0x0283 }, - { 0x03AB, 0x03CB }, - { 0x04AC, 0x04AD }, - { 0x10B8, 0x2D18 }, - { 0x1EB6, 0x1EB7 }, - { 0x2C84, 0x2C85 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_169[] = { - { 0x03AA, 0x03CA }, - { 0x10B9, 0x2D19 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_170[] = { - { 0x03A9, 0x03C9 }, - { 0x04AE, 0x04AF }, - { 0x10BA, 0x2D1A }, - { 0x1EB4, 0x1EB5 }, - { 0x2C86, 0x2C87 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_171[] = { - { 0x03A8, 0x03C8 }, - { 0x10BB, 0x2D1B } -}; - -static const CaseFoldMapping1_16 case_fold1_16_172[] = { - { 0x04A8, 0x04A9 }, - { 0x10BC, 0x2D1C }, - { 0x1EB2, 0x1EB3 }, - { 0x2C80, 0x2C81 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_173[] = { - { 0x01AC, 0x01AD }, - { 0x10BD, 0x2D1D } -}; - -static const CaseFoldMapping1_16 case_fold1_16_174[] = { - { 0x01AF, 0x01B0 }, - { 0x04AA, 0x04AB }, - { 0x10BE, 0x2D1E }, - { 0x1EB0, 0x1EB1 }, - { 0x2C82, 0x2C83 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_175[] = { - { 0x01AE, 0x0288 }, - { 0x10BF, 0x2D1F } -}; - -static const CaseFoldMapping1_16 case_fold1_16_176[] = { - { 0x01B1, 0x028A }, - { 0x04B4, 0x04B5 }, - { 0x10A0, 0x2D00 }, - { 0x1EAE, 0x1EAF }, - { 0x2C9C, 0x2C9D } -}; - -static const CaseFoldMapping1_16 case_fold1_16_177[] = { - { 0x10A1, 0x2D01 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_178[] = { - { 0x01B3, 0x01B4 }, - { 0x04B6, 0x04B7 }, - { 0x10A2, 0x2D02 }, - { 0x1EAC, 0x1EAD }, - { 0x2C9E, 0x2C9F } -}; - -static const CaseFoldMapping1_16 case_fold1_16_179[] = { - { 0x01B2, 0x028B }, - { 0x10A3, 0x2D03 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_180[] = { - { 0x01B5, 0x01B6 }, - { 0x04B0, 0x04B1 }, - { 0x10A4, 0x2D04 }, - { 0x1EAA, 0x1EAB }, - { 0x2C98, 0x2C99 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_181[] = { - { 0x00B5, 0x03BC }, - { 0x10A5, 0x2D05 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_182[] = { - { 0x01B7, 0x0292 }, - { 0x04B2, 0x04B3 }, - { 0x10A6, 0x2D06 }, - { 0x1EA8, 0x1EA9 }, - { 0x2C9A, 0x2C9B } -}; - -static const CaseFoldMapping1_16 case_fold1_16_183[] = { - { 0x10A7, 0x2D07 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_184[] = { - { 0x04BC, 0x04BD }, - { 0x10A8, 0x2D08 }, - { 0x1EA6, 0x1EA7 }, - { 0x2C94, 0x2C95 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_185[] = { - { 0x01B8, 0x01B9 }, - { 0x10A9, 0x2D09 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_186[] = { - { 0x04BE, 0x04BF }, - { 0x10AA, 0x2D0A }, - { 0x1EA4, 0x1EA5 }, - { 0x2C96, 0x2C97 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_187[] = { - { 0x10AB, 0x2D0B } -}; - -static const CaseFoldMapping1_16 case_fold1_16_188[] = { - { 0x04B8, 0x04B9 }, - { 0x10AC, 0x2D0C }, - { 0x1EA2, 0x1EA3 }, - { 0x2C90, 0x2C91 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_189[] = { - { 0x01BC, 0x01BD }, - { 0x10AD, 0x2D0D } -}; - -static const CaseFoldMapping1_16 case_fold1_16_190[] = { - { 0x04BA, 0x04BB }, - { 0x10AE, 0x2D0E }, - { 0x1EA0, 0x1EA1 }, - { 0x2C92, 0x2C93 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_191[] = { - { 0x10AF, 0x2D0F } -}; - -static const CaseFoldMapping1_16 case_fold1_16_192[] = { - { 0x00C0, 0x00E0 }, - { 0x1EDE, 0x1EDF }, - { 0xA666, 0xA667 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_193[] = { - { 0x00C1, 0x00E1 }, - { 0x03C2, 0x03C3 }, - { 0x04C5, 0x04C6 }, - { 0x2CED, 0x2CEE }, - { 0xA766, 0xA767 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_194[] = { - { 0x00C2, 0x00E2 }, - { 0x1EDC, 0x1EDD }, - { 0xA664, 0xA665 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_195[] = { - { 0x00C3, 0x00E3 }, - { 0x04C7, 0x04C8 }, - { 0xA764, 0xA765 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_196[] = { - { 0x00C4, 0x00E4 }, - { 0x01C5, 0x01C6 }, - { 0x04C0, 0x04CF }, - { 0x1EDA, 0x1EDB }, - { 0x1FDB, 0x1F77 }, - { 0xA662, 0xA663 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_197[] = { - { 0x00C5, 0x00E5 }, - { 0x01C4, 0x01C6 }, - { 0x04C1, 0x04C2 }, - { 0x1FDA, 0x1F76 }, - { 0xA762, 0xA763 }, - { 0xFF3A, 0xFF5A } -}; - -static const CaseFoldMapping1_16 case_fold1_16_198[] = { - { 0x00C6, 0x00E6 }, - { 0x01C7, 0x01C9 }, - { 0x1ED8, 0x1ED9 }, - { 0x1FD9, 0x1FD1 }, - { 0xA660, 0xA661 }, - { 0xFF39, 0xFF59 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_199[] = { - { 0x00C7, 0x00E7 }, - { 0x04C3, 0x04C4 }, - { 0x1FD8, 0x1FD0 }, - { 0x2CEB, 0x2CEC }, - { 0xA760, 0xA761 }, - { 0xFF38, 0xFF58 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_200[] = { - { 0x00C8, 0x00E8 }, - { 0x1ED6, 0x1ED7 }, - { 0xFF37, 0xFF57 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_201[] = { - { 0x00C9, 0x00E9 }, - { 0x01C8, 0x01C9 }, - { 0x04CD, 0x04CE }, - { 0xA76E, 0xA76F }, - { 0xFF36, 0xFF56 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_202[] = { - { 0x00CA, 0x00EA }, - { 0x01CB, 0x01CC }, - { 0x1ED4, 0x1ED5 }, - { 0xA66C, 0xA66D }, - { 0xFF35, 0xFF55 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_203[] = { - { 0x00CB, 0x00EB }, - { 0x01CA, 0x01CC }, - { 0xA76C, 0xA76D }, - { 0xFF34, 0xFF54 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_204[] = { - { 0x00CC, 0x00EC }, - { 0x01CD, 0x01CE }, - { 0x03CF, 0x03D7 }, - { 0x1ED2, 0x1ED3 }, - { 0x2CE0, 0x2CE1 }, - { 0xA66A, 0xA66B }, - { 0xFF33, 0xFF53 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_205[] = { - { 0x00CD, 0x00ED }, - { 0x04C9, 0x04CA }, - { 0xA76A, 0xA76B }, - { 0xFF32, 0xFF52 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_206[] = { - { 0x00CE, 0x00EE }, - { 0x01CF, 0x01D0 }, - { 0x1ED0, 0x1ED1 }, - { 0x2CE2, 0x2CE3 }, - { 0xA668, 0xA669 }, - { 0xFF31, 0xFF51 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_207[] = { - { 0x00CF, 0x00EF }, - { 0x04CB, 0x04CC }, - { 0xA768, 0xA769 }, - { 0xFF30, 0xFF50 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_208[] = { - { 0x00D0, 0x00F0 }, - { 0x01D1, 0x01D2 }, - { 0x04D4, 0x04D5 }, - { 0x10C0, 0x2D20 }, - { 0x1ECE, 0x1ECF }, - { 0xAB7B, 0x13AB }, - { 0xFF2F, 0xFF4F } -}; - -static const CaseFoldMapping1_16 case_fold1_16_209[] = { - { 0x00D1, 0x00F1 }, - { 0x10C1, 0x2D21 }, - { 0xAB7A, 0x13AA }, - { 0xFF2E, 0xFF4E } -}; - -static const CaseFoldMapping1_16 case_fold1_16_210[] = { - { 0x00D2, 0x00F2 }, - { 0x01D3, 0x01D4 }, - { 0x03D1, 0x03B8 }, - { 0x04D6, 0x04D7 }, - { 0x10C2, 0x2D22 }, - { 0x1ECC, 0x1ECD }, - { 0xAB79, 0x13A9 }, - { 0xFF2D, 0xFF4D } -}; - -static const CaseFoldMapping1_16 case_fold1_16_211[] = { - { 0x00D3, 0x00F3 }, - { 0x03D0, 0x03B2 }, - { 0x10C3, 0x2D23 }, - { 0xAB78, 0x13A8 }, - { 0xFF2C, 0xFF4C } -}; - -static const CaseFoldMapping1_16 case_fold1_16_212[] = { - { 0x00D4, 0x00F4 }, - { 0x01D5, 0x01D6 }, - { 0x04D0, 0x04D1 }, - { 0x10C4, 0x2D24 }, - { 0x1ECA, 0x1ECB }, - { 0x1FCB, 0x1F75 }, - { 0xAB7F, 0x13AF }, - { 0xFF2B, 0xFF4B } -}; - -static const CaseFoldMapping1_16 case_fold1_16_213[] = { - { 0x00D5, 0x00F5 }, - { 0x03D6, 0x03C0 }, - { 0x10C5, 0x2D25 }, - { 0x1FCA, 0x1F74 }, - { 0xAB7E, 0x13AE }, - { 0xFF2A, 0xFF4A } -}; - -static const CaseFoldMapping1_16 case_fold1_16_214[] = { - { 0x00D6, 0x00F6 }, - { 0x01D7, 0x01D8 }, - { 0x03D5, 0x03C6 }, - { 0x04D2, 0x04D3 }, - { 0x1EC8, 0x1EC9 }, - { 0x1FC9, 0x1F73 }, - { 0xAB7D, 0x13AD }, - { 0xFF29, 0xFF49 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_215[] = { - { 0x10C7, 0x2D27 }, - { 0x1FC8, 0x1F72 }, - { 0xAB7C, 0x13AC }, - { 0xFF28, 0xFF48 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_216[] = { - { 0x00D8, 0x00F8 }, - { 0x01D9, 0x01DA }, - { 0x04DC, 0x04DD }, - { 0x1EC6, 0x1EC7 }, - { 0xAB73, 0x13A3 }, - { 0xFF27, 0xFF47 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_217[] = { - { 0x00D9, 0x00F9 }, - { 0x03DA, 0x03DB }, - { 0xA77E, 0xA77F }, - { 0xAB72, 0x13A2 }, - { 0xFF26, 0xFF46 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_218[] = { - { 0x00DA, 0x00FA }, - { 0x01DB, 0x01DC }, - { 0x04DE, 0x04DF }, - { 0x1EC4, 0x1EC5 }, - { 0xA77D, 0x1D79 }, - { 0xAB71, 0x13A1 }, - { 0xFF25, 0xFF45 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_219[] = { - { 0x00DB, 0x00FB }, - { 0x03D8, 0x03D9 }, - { 0xAB70, 0x13A0 }, - { 0xFF24, 0xFF44 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_220[] = { - { 0x00DC, 0x00FC }, - { 0x04D8, 0x04D9 }, - { 0x1EC2, 0x1EC3 }, - { 0xA77B, 0xA77C }, - { 0xAB77, 0x13A7 }, - { 0xFF23, 0xFF43 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_221[] = { - { 0x00DD, 0x00FD }, - { 0x03DE, 0x03DF }, - { 0x10CD, 0x2D2D }, - { 0xAB76, 0x13A6 }, - { 0xFF22, 0xFF42 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_222[] = { - { 0x00DE, 0x00FE }, - { 0x04DA, 0x04DB }, - { 0x1EC0, 0x1EC1 }, - { 0x2CF2, 0x2CF3 }, - { 0xA779, 0xA77A }, - { 0xAB75, 0x13A5 }, - { 0xFF21, 0xFF41 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_223[] = { - { 0x01DE, 0x01DF }, - { 0x03DC, 0x03DD }, - { 0xAB74, 0x13A4 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_224[] = { - { 0x04E4, 0x04E5 }, - { 0x1EFE, 0x1EFF }, - { 0x24C4, 0x24DE }, - { 0x2CCC, 0x2CCD }, - { 0xA646, 0xA647 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_225[] = { - { 0x01E0, 0x01E1 }, - { 0x03E2, 0x03E3 }, - { 0x24C5, 0x24DF }, - { 0xA746, 0xA747 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_226[] = { - { 0x04E6, 0x04E7 }, - { 0x1EFC, 0x1EFD }, - { 0x24C6, 0x24E0 }, - { 0x2CCE, 0x2CCF }, - { 0xA644, 0xA645 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_227[] = { - { 0x01E2, 0x01E3 }, - { 0x03E0, 0x03E1 }, - { 0x24C7, 0x24E1 }, - { 0xA744, 0xA745 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_228[] = { - { 0x04E0, 0x04E1 }, - { 0x1EFA, 0x1EFB }, - { 0x1FFB, 0x1F7D }, - { 0x24C0, 0x24DA }, - { 0x2CC8, 0x2CC9 }, - { 0xA642, 0xA643 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_229[] = { - { 0x01E4, 0x01E5 }, - { 0x03E6, 0x03E7 }, - { 0x1FFA, 0x1F7C }, - { 0x24C1, 0x24DB }, - { 0xA742, 0xA743 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_230[] = { - { 0x04E2, 0x04E3 }, - { 0x1EF8, 0x1EF9 }, - { 0x1FF9, 0x1F79 }, - { 0x24C2, 0x24DC }, - { 0x2CCA, 0x2CCB }, - { 0xA640, 0xA641 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_231[] = { - { 0x01E6, 0x01E7 }, - { 0x03E4, 0x03E5 }, - { 0x1FF8, 0x1F78 }, - { 0x24C3, 0x24DD }, - { 0xA740, 0xA741 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_232[] = { - { 0x04EC, 0x04ED }, - { 0x13FB, 0x13F3 }, - { 0x1EF6, 0x1EF7 }, - { 0x24CC, 0x24E6 }, - { 0x2CC4, 0x2CC5 }, - { 0xA64E, 0xA64F } -}; - -static const CaseFoldMapping1_16 case_fold1_16_233[] = { - { 0x01E8, 0x01E9 }, - { 0x03EA, 0x03EB }, - { 0x13FA, 0x13F2 }, - { 0x24CD, 0x24E7 }, - { 0xA74E, 0xA74F } -}; - -static const CaseFoldMapping1_16 case_fold1_16_234[] = { - { 0x04EE, 0x04EF }, - { 0x13F9, 0x13F1 }, - { 0x1EF4, 0x1EF5 }, - { 0x24CE, 0x24E8 }, - { 0x2CC6, 0x2CC7 }, - { 0xA64C, 0xA64D } -}; - -static const CaseFoldMapping1_16 case_fold1_16_235[] = { - { 0x01EA, 0x01EB }, - { 0x03E8, 0x03E9 }, - { 0x13F8, 0x13F0 }, - { 0x24CF, 0x24E9 }, - { 0xA74C, 0xA74D } -}; - -static const CaseFoldMapping1_16 case_fold1_16_236[] = { - { 0x04E8, 0x04E9 }, - { 0x1EF2, 0x1EF3 }, - { 0x24C8, 0x24E2 }, - { 0x2CC0, 0x2CC1 }, - { 0xA64A, 0xA64B } -}; - -static const CaseFoldMapping1_16 case_fold1_16_237[] = { - { 0x01EC, 0x01ED }, - { 0x03EE, 0x03EF }, - { 0x24C9, 0x24E3 }, - { 0xA74A, 0xA74B } -}; - -static const CaseFoldMapping1_16 case_fold1_16_238[] = { - { 0x04EA, 0x04EB }, - { 0x13FD, 0x13F5 }, - { 0x1EF0, 0x1EF1 }, - { 0x24CA, 0x24E4 }, - { 0x2CC2, 0x2CC3 }, - { 0xA648, 0xA649 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_239[] = { - { 0x01EE, 0x01EF }, - { 0x03EC, 0x03ED }, - { 0x13FC, 0x13F4 }, - { 0x24CB, 0x24E5 }, - { 0xA748, 0xA749 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_240[] = { - { 0x01F1, 0x01F3 }, - { 0x04F4, 0x04F5 }, - { 0x1EEE, 0x1EEF }, - { 0x2CDC, 0x2CDD }, - { 0xA656, 0xA657 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_241[] = { - { 0xA756, 0xA757 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_242[] = { - { 0x03F1, 0x03C1 }, - { 0x04F6, 0x04F7 }, - { 0x1EEC, 0x1EED }, - { 0x2CDE, 0x2CDF }, - { 0xA654, 0xA655 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_243[] = { - { 0x01F2, 0x01F3 }, - { 0x03F0, 0x03BA }, - { 0x1FEC, 0x1FE5 }, - { 0xA754, 0xA755 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_244[] = { - { 0x03F7, 0x03F8 }, - { 0x04F0, 0x04F1 }, - { 0x1EEA, 0x1EEB }, - { 0x1FEB, 0x1F7B }, - { 0x2CD8, 0x2CD9 }, - { 0xA652, 0xA653 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_245[] = { - { 0x01F4, 0x01F5 }, - { 0x1FEA, 0x1F7A }, - { 0xA752, 0xA753 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_246[] = { - { 0x01F7, 0x01BF }, - { 0x03F5, 0x03B5 }, - { 0x04F2, 0x04F3 }, - { 0x1EE8, 0x1EE9 }, - { 0x1FE9, 0x1FE1 }, - { 0x2CDA, 0x2CDB }, - { 0xA650, 0xA651 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_247[] = { - { 0x01F6, 0x0195 }, - { 0x03F4, 0x03B8 }, - { 0x1FE8, 0x1FE0 }, - { 0xA750, 0xA751 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_248[] = { - { 0x04FC, 0x04FD }, - { 0x1EE6, 0x1EE7 }, - { 0x2CD4, 0x2CD5 }, - { 0xA65E, 0xA65F } -}; - -static const CaseFoldMapping1_16 case_fold1_16_249[] = { - { 0x01F8, 0x01F9 }, - { 0x03FA, 0x03FB }, - { 0xA75E, 0xA75F } -}; - -static const CaseFoldMapping1_16 case_fold1_16_250[] = { - { 0x03F9, 0x03F2 }, - { 0x04FE, 0x04FF }, - { 0x1EE4, 0x1EE5 }, - { 0x2CD6, 0x2CD7 }, - { 0xA65C, 0xA65D } -}; - -static const CaseFoldMapping1_16 case_fold1_16_251[] = { - { 0x01FA, 0x01FB }, - { 0xA75C, 0xA75D } -}; - -static const CaseFoldMapping1_16 case_fold1_16_252[] = { - { 0x03FF, 0x037D }, - { 0x04F8, 0x04F9 }, - { 0x1EE2, 0x1EE3 }, - { 0x2CD0, 0x2CD1 }, - { 0xA65A, 0xA65B } -}; - -static const CaseFoldMapping1_16 case_fold1_16_253[] = { - { 0x01FC, 0x01FD }, - { 0x03FE, 0x037C }, - { 0xA75A, 0xA75B } -}; - -static const CaseFoldMapping1_16 case_fold1_16_254[] = { - { 0x03FD, 0x037B }, - { 0x04FA, 0x04FB }, - { 0x1EE0, 0x1EE1 }, - { 0x2CD2, 0x2CD3 }, - { 0xA658, 0xA659 } -}; - -static const CaseFoldMapping1_16 case_fold1_16_255[] = { - { 0x01FE, 0x01FF }, - { 0xA758, 0xA759 } -}; - -static const CaseFoldMapping1_32 case_fold1_32_000[] = { - { 0x10404, 0x1042C }, - { 0x10414, 0x1043C }, - { 0x10424, 0x1044C }, - { 0x10C8C, 0x10CCC }, - { 0x10C9C, 0x10CDC }, - { 0x10CAC, 0x10CEC }, - { 0x118A8, 0x118C8 }, - { 0x118B8, 0x118D8 } -}; - -static const CaseFoldMapping1_32 case_fold1_32_001[] = { - { 0x10405, 0x1042D }, - { 0x10415, 0x1043D }, - { 0x10425, 0x1044D }, - { 0x10C8D, 0x10CCD }, - { 0x10C9D, 0x10CDD }, - { 0x10CAD, 0x10CED }, - { 0x118A9, 0x118C9 }, - { 0x118B9, 0x118D9 } -}; - -static const CaseFoldMapping1_32 case_fold1_32_002[] = { - { 0x10406, 0x1042E }, - { 0x10416, 0x1043E }, - { 0x10426, 0x1044E }, - { 0x10C8E, 0x10CCE }, - { 0x10C9E, 0x10CDE }, - { 0x10CAE, 0x10CEE }, - { 0x118AA, 0x118CA }, - { 0x118BA, 0x118DA } -}; - -static const CaseFoldMapping1_32 case_fold1_32_003[] = { - { 0x10407, 0x1042F }, - { 0x10417, 0x1043F }, - { 0x10427, 0x1044F }, - { 0x10C8F, 0x10CCF }, - { 0x10C9F, 0x10CDF }, - { 0x10CAF, 0x10CEF }, - { 0x118AB, 0x118CB }, - { 0x118BB, 0x118DB } -}; - -static const CaseFoldMapping1_32 case_fold1_32_004[] = { - { 0x10400, 0x10428 }, - { 0x10410, 0x10438 }, - { 0x10420, 0x10448 }, - { 0x10C88, 0x10CC8 }, - { 0x10C98, 0x10CD8 }, - { 0x10CA8, 0x10CE8 }, - { 0x118AC, 0x118CC }, - { 0x118BC, 0x118DC } -}; - -static const CaseFoldMapping1_32 case_fold1_32_005[] = { - { 0x10401, 0x10429 }, - { 0x10411, 0x10439 }, - { 0x10421, 0x10449 }, - { 0x10C89, 0x10CC9 }, - { 0x10C99, 0x10CD9 }, - { 0x10CA9, 0x10CE9 }, - { 0x118AD, 0x118CD }, - { 0x118BD, 0x118DD } -}; - -static const CaseFoldMapping1_32 case_fold1_32_006[] = { - { 0x10402, 0x1042A }, - { 0x10412, 0x1043A }, - { 0x10422, 0x1044A }, - { 0x10C8A, 0x10CCA }, - { 0x10C9A, 0x10CDA }, - { 0x10CAA, 0x10CEA }, - { 0x118AE, 0x118CE }, - { 0x118BE, 0x118DE } -}; - -static const CaseFoldMapping1_32 case_fold1_32_007[] = { - { 0x10403, 0x1042B }, - { 0x10413, 0x1043B }, - { 0x10423, 0x1044B }, - { 0x10C8B, 0x10CCB }, - { 0x10C9B, 0x10CDB }, - { 0x10CAB, 0x10CEB }, - { 0x118AF, 0x118CF }, - { 0x118BF, 0x118DF } -}; - -static const CaseFoldMapping1_32 case_fold1_32_008[] = { - { 0x1040C, 0x10434 }, - { 0x1041C, 0x10444 }, - { 0x10C84, 0x10CC4 }, - { 0x10C94, 0x10CD4 }, - { 0x10CA4, 0x10CE4 }, - { 0x118A0, 0x118C0 }, - { 0x118B0, 0x118D0 } -}; - -static const CaseFoldMapping1_32 case_fold1_32_009[] = { - { 0x1040D, 0x10435 }, - { 0x1041D, 0x10445 }, - { 0x10C85, 0x10CC5 }, - { 0x10C95, 0x10CD5 }, - { 0x10CA5, 0x10CE5 }, - { 0x118A1, 0x118C1 }, - { 0x118B1, 0x118D1 } -}; - -static const CaseFoldMapping1_32 case_fold1_32_010[] = { - { 0x1040E, 0x10436 }, - { 0x1041E, 0x10446 }, - { 0x10C86, 0x10CC6 }, - { 0x10C96, 0x10CD6 }, - { 0x10CA6, 0x10CE6 }, - { 0x118A2, 0x118C2 }, - { 0x118B2, 0x118D2 } -}; - -static const CaseFoldMapping1_32 case_fold1_32_011[] = { - { 0x1040F, 0x10437 }, - { 0x1041F, 0x10447 }, - { 0x10C87, 0x10CC7 }, - { 0x10C97, 0x10CD7 }, - { 0x10CA7, 0x10CE7 }, - { 0x118A3, 0x118C3 }, - { 0x118B3, 0x118D3 } -}; - -static const CaseFoldMapping1_32 case_fold1_32_012[] = { - { 0x10408, 0x10430 }, - { 0x10418, 0x10440 }, - { 0x10C80, 0x10CC0 }, - { 0x10C90, 0x10CD0 }, - { 0x10CA0, 0x10CE0 }, - { 0x10CB0, 0x10CF0 }, - { 0x118A4, 0x118C4 }, - { 0x118B4, 0x118D4 } -}; - -static const CaseFoldMapping1_32 case_fold1_32_013[] = { - { 0x10409, 0x10431 }, - { 0x10419, 0x10441 }, - { 0x10C81, 0x10CC1 }, - { 0x10C91, 0x10CD1 }, - { 0x10CA1, 0x10CE1 }, - { 0x10CB1, 0x10CF1 }, - { 0x118A5, 0x118C5 }, - { 0x118B5, 0x118D5 } -}; - -static const CaseFoldMapping1_32 case_fold1_32_014[] = { - { 0x1040A, 0x10432 }, - { 0x1041A, 0x10442 }, - { 0x10C82, 0x10CC2 }, - { 0x10C92, 0x10CD2 }, - { 0x10CA2, 0x10CE2 }, - { 0x10CB2, 0x10CF2 }, - { 0x118A6, 0x118C6 }, - { 0x118B6, 0x118D6 } -}; - -static const CaseFoldMapping1_32 case_fold1_32_015[] = { - { 0x1040B, 0x10433 }, - { 0x1041B, 0x10443 }, - { 0x10C83, 0x10CC3 }, - { 0x10C93, 0x10CD3 }, - { 0x10CA3, 0x10CE3 }, - { 0x118A7, 0x118C7 }, - { 0x118B7, 0x118D7 } -}; - -static const CaseFoldMapping2_16 case_fold2_16_000[] = { - { 0x1E9E, 0x0073, 0x0073 }, - { 0x1F8F, 0x1F07, 0x03B9 }, - { 0x1F9F, 0x1F27, 0x03B9 }, - { 0x1FAF, 0x1F67, 0x03B9 } -}; - -static const CaseFoldMapping2_16 case_fold2_16_001[] = { - { 0x0130, 0x0069, 0x0307 }, - { 0x01F0, 0x006A, 0x030C }, - { 0x1F8E, 0x1F06, 0x03B9 }, - { 0x1F9E, 0x1F26, 0x03B9 }, - { 0x1FAE, 0x1F66, 0x03B9 } -}; - -static const CaseFoldMapping2_16 case_fold2_16_002[] = { - { 0x0587, 0x0565, 0x0582 }, - { 0x1F8D, 0x1F05, 0x03B9 }, - { 0x1F9D, 0x1F25, 0x03B9 }, - { 0x1FAD, 0x1F65, 0x03B9 } -}; - -static const CaseFoldMapping2_16 case_fold2_16_003[] = { - { 0x1F8C, 0x1F04, 0x03B9 }, - { 0x1F9C, 0x1F24, 0x03B9 }, - { 0x1FAC, 0x1F64, 0x03B9 }, - { 0x1FBC, 0x03B1, 0x03B9 }, - { 0x1FCC, 0x03B7, 0x03B9 }, - { 0x1FFC, 0x03C9, 0x03B9 } -}; - -static const CaseFoldMapping2_16 case_fold2_16_004[] = { - { 0x1E9A, 0x0061, 0x02BE }, - { 0x1F8B, 0x1F03, 0x03B9 }, - { 0x1F9B, 0x1F23, 0x03B9 }, - { 0x1FAB, 0x1F63, 0x03B9 } -}; - -static const CaseFoldMapping2_16 case_fold2_16_005[] = { - { 0x1F8A, 0x1F02, 0x03B9 }, - { 0x1F9A, 0x1F22, 0x03B9 }, - { 0x1FAA, 0x1F62, 0x03B9 } -}; - -static const CaseFoldMapping2_16 case_fold2_16_006[] = { - { 0x1E98, 0x0077, 0x030A }, - { 0x1F89, 0x1F01, 0x03B9 }, - { 0x1F99, 0x1F21, 0x03B9 }, - { 0x1FA9, 0x1F61, 0x03B9 } -}; - -static const CaseFoldMapping2_16 case_fold2_16_007[] = { - { 0x1E99, 0x0079, 0x030A }, - { 0x1F88, 0x1F00, 0x03B9 }, - { 0x1F98, 0x1F20, 0x03B9 }, - { 0x1FA8, 0x1F60, 0x03B9 } -}; - -static const CaseFoldMapping2_16 case_fold2_16_008[] = { - { 0x0149, 0x02BC, 0x006E }, - { 0x1E96, 0x0068, 0x0331 }, - { 0x1F87, 0x1F07, 0x03B9 }, - { 0x1F97, 0x1F27, 0x03B9 }, - { 0x1FA7, 0x1F67, 0x03B9 }, - { 0xFB13, 0x0574, 0x0576 } -}; - -static const CaseFoldMapping2_16 case_fold2_16_009[] = { - { 0x1E97, 0x0074, 0x0308 }, - { 0x1F86, 0x1F06, 0x03B9 }, - { 0x1F96, 0x1F26, 0x03B9 }, - { 0x1FA6, 0x1F66, 0x03B9 }, - { 0x1FB6, 0x03B1, 0x0342 }, - { 0x1FC6, 0x03B7, 0x0342 }, - { 0x1FD6, 0x03B9, 0x0342 }, - { 0x1FE6, 0x03C5, 0x0342 }, - { 0x1FF6, 0x03C9, 0x0342 }, - { 0xFB02, 0x0066, 0x006C } -}; - -static const CaseFoldMapping2_16 case_fold2_16_010[] = { - { 0x1F85, 0x1F05, 0x03B9 }, - { 0x1F95, 0x1F25, 0x03B9 }, - { 0x1FA5, 0x1F65, 0x03B9 }, - { 0xFB01, 0x0066, 0x0069 } -}; - -static const CaseFoldMapping2_16 case_fold2_16_011[] = { - { 0x1F84, 0x1F04, 0x03B9 }, - { 0x1F94, 0x1F24, 0x03B9 }, - { 0x1FA4, 0x1F64, 0x03B9 }, - { 0x1FB4, 0x03AC, 0x03B9 }, - { 0x1FC4, 0x03AE, 0x03B9 }, - { 0x1FE4, 0x03C1, 0x0313 }, - { 0x1FF4, 0x03CE, 0x03B9 }, - { 0xFB00, 0x0066, 0x0066 } -}; - -static const CaseFoldMapping2_16 case_fold2_16_012[] = { - { 0x1F83, 0x1F03, 0x03B9 }, - { 0x1F93, 0x1F23, 0x03B9 }, - { 0x1FA3, 0x1F63, 0x03B9 }, - { 0x1FB3, 0x03B1, 0x03B9 }, - { 0x1FC3, 0x03B7, 0x03B9 }, - { 0x1FF3, 0x03C9, 0x03B9 }, - { 0xFB17, 0x0574, 0x056D } -}; - -static const CaseFoldMapping2_16 case_fold2_16_013[] = { - { 0x1F82, 0x1F02, 0x03B9 }, - { 0x1F92, 0x1F22, 0x03B9 }, - { 0x1FA2, 0x1F62, 0x03B9 }, - { 0x1FB2, 0x1F70, 0x03B9 }, - { 0x1FC2, 0x1F74, 0x03B9 }, - { 0x1FF2, 0x1F7C, 0x03B9 }, - { 0xFB06, 0x0073, 0x0074 }, - { 0xFB16, 0x057E, 0x0576 } -}; - -static const CaseFoldMapping2_16 case_fold2_16_014[] = { - { 0x1F81, 0x1F01, 0x03B9 }, - { 0x1F91, 0x1F21, 0x03B9 }, - { 0x1FA1, 0x1F61, 0x03B9 }, - { 0xFB05, 0x0073, 0x0074 }, - { 0xFB15, 0x0574, 0x056B } -}; - -static const CaseFoldMapping2_16 case_fold2_16_015[] = { - { 0x00DF, 0x0073, 0x0073 }, - { 0x1F50, 0x03C5, 0x0313 }, - { 0x1F80, 0x1F00, 0x03B9 }, - { 0x1F90, 0x1F20, 0x03B9 }, - { 0x1FA0, 0x1F60, 0x03B9 }, - { 0xFB14, 0x0574, 0x0565 } -}; - -static const CaseFoldMapping3_16 case_fold3_16_000[] = { - { 0x1FB7, 0x03B1, 0x0342, 0x03B9 }, - { 0x1FC7, 0x03B7, 0x0342, 0x03B9 }, - { 0x1FD3, 0x03B9, 0x0308, 0x0301 }, - { 0x1FD7, 0x03B9, 0x0308, 0x0342 }, - { 0x1FE3, 0x03C5, 0x0308, 0x0301 }, - { 0x1FE7, 0x03C5, 0x0308, 0x0342 }, - { 0x1FF7, 0x03C9, 0x0342, 0x03B9 }, - { 0xFB03, 0x0066, 0x0066, 0x0069 } -}; - -static const CaseFoldMapping3_16 case_fold3_16_001[] = { - { 0x1F52, 0x03C5, 0x0313, 0x0300 }, - { 0x1F56, 0x03C5, 0x0313, 0x0342 }, - { 0x1FD2, 0x03B9, 0x0308, 0x0300 }, - { 0x1FE2, 0x03C5, 0x0308, 0x0300 } -}; - -static const CaseFoldMapping3_16 case_fold3_16_003[] = { - { 0x0390, 0x03B9, 0x0308, 0x0301 }, - { 0x03B0, 0x03C5, 0x0308, 0x0301 }, - { 0x1F54, 0x03C5, 0x0313, 0x0301 }, - { 0xFB04, 0x0066, 0x0066, 0x006C } -}; - -static const CaseFoldHashBucket1_16 case_fold_hash1_16[] = { - { case_fold1_16_000, __PHYSFS_ARRAYLEN(case_fold1_16_000) }, - { case_fold1_16_001, __PHYSFS_ARRAYLEN(case_fold1_16_001) }, - { case_fold1_16_002, __PHYSFS_ARRAYLEN(case_fold1_16_002) }, - { case_fold1_16_003, __PHYSFS_ARRAYLEN(case_fold1_16_003) }, - { case_fold1_16_004, __PHYSFS_ARRAYLEN(case_fold1_16_004) }, - { case_fold1_16_005, __PHYSFS_ARRAYLEN(case_fold1_16_005) }, - { case_fold1_16_006, __PHYSFS_ARRAYLEN(case_fold1_16_006) }, - { case_fold1_16_007, __PHYSFS_ARRAYLEN(case_fold1_16_007) }, - { case_fold1_16_008, __PHYSFS_ARRAYLEN(case_fold1_16_008) }, - { case_fold1_16_009, __PHYSFS_ARRAYLEN(case_fold1_16_009) }, - { case_fold1_16_010, __PHYSFS_ARRAYLEN(case_fold1_16_010) }, - { case_fold1_16_011, __PHYSFS_ARRAYLEN(case_fold1_16_011) }, - { case_fold1_16_012, __PHYSFS_ARRAYLEN(case_fold1_16_012) }, - { case_fold1_16_013, __PHYSFS_ARRAYLEN(case_fold1_16_013) }, - { case_fold1_16_014, __PHYSFS_ARRAYLEN(case_fold1_16_014) }, - { case_fold1_16_015, __PHYSFS_ARRAYLEN(case_fold1_16_015) }, - { case_fold1_16_016, __PHYSFS_ARRAYLEN(case_fold1_16_016) }, - { case_fold1_16_017, __PHYSFS_ARRAYLEN(case_fold1_16_017) }, - { case_fold1_16_018, __PHYSFS_ARRAYLEN(case_fold1_16_018) }, - { case_fold1_16_019, __PHYSFS_ARRAYLEN(case_fold1_16_019) }, - { case_fold1_16_020, __PHYSFS_ARRAYLEN(case_fold1_16_020) }, - { case_fold1_16_021, __PHYSFS_ARRAYLEN(case_fold1_16_021) }, - { case_fold1_16_022, __PHYSFS_ARRAYLEN(case_fold1_16_022) }, - { case_fold1_16_023, __PHYSFS_ARRAYLEN(case_fold1_16_023) }, - { case_fold1_16_024, __PHYSFS_ARRAYLEN(case_fold1_16_024) }, - { case_fold1_16_025, __PHYSFS_ARRAYLEN(case_fold1_16_025) }, - { case_fold1_16_026, __PHYSFS_ARRAYLEN(case_fold1_16_026) }, - { case_fold1_16_027, __PHYSFS_ARRAYLEN(case_fold1_16_027) }, - { case_fold1_16_028, __PHYSFS_ARRAYLEN(case_fold1_16_028) }, - { case_fold1_16_029, __PHYSFS_ARRAYLEN(case_fold1_16_029) }, - { case_fold1_16_030, __PHYSFS_ARRAYLEN(case_fold1_16_030) }, - { case_fold1_16_031, __PHYSFS_ARRAYLEN(case_fold1_16_031) }, - { case_fold1_16_032, __PHYSFS_ARRAYLEN(case_fold1_16_032) }, - { case_fold1_16_033, __PHYSFS_ARRAYLEN(case_fold1_16_033) }, - { case_fold1_16_034, __PHYSFS_ARRAYLEN(case_fold1_16_034) }, - { case_fold1_16_035, __PHYSFS_ARRAYLEN(case_fold1_16_035) }, - { case_fold1_16_036, __PHYSFS_ARRAYLEN(case_fold1_16_036) }, - { case_fold1_16_037, __PHYSFS_ARRAYLEN(case_fold1_16_037) }, - { case_fold1_16_038, __PHYSFS_ARRAYLEN(case_fold1_16_038) }, - { case_fold1_16_039, __PHYSFS_ARRAYLEN(case_fold1_16_039) }, - { case_fold1_16_040, __PHYSFS_ARRAYLEN(case_fold1_16_040) }, - { case_fold1_16_041, __PHYSFS_ARRAYLEN(case_fold1_16_041) }, - { case_fold1_16_042, __PHYSFS_ARRAYLEN(case_fold1_16_042) }, - { case_fold1_16_043, __PHYSFS_ARRAYLEN(case_fold1_16_043) }, - { case_fold1_16_044, __PHYSFS_ARRAYLEN(case_fold1_16_044) }, - { case_fold1_16_045, __PHYSFS_ARRAYLEN(case_fold1_16_045) }, - { case_fold1_16_046, __PHYSFS_ARRAYLEN(case_fold1_16_046) }, - { case_fold1_16_047, __PHYSFS_ARRAYLEN(case_fold1_16_047) }, - { case_fold1_16_048, __PHYSFS_ARRAYLEN(case_fold1_16_048) }, - { case_fold1_16_049, __PHYSFS_ARRAYLEN(case_fold1_16_049) }, - { case_fold1_16_050, __PHYSFS_ARRAYLEN(case_fold1_16_050) }, - { case_fold1_16_051, __PHYSFS_ARRAYLEN(case_fold1_16_051) }, - { case_fold1_16_052, __PHYSFS_ARRAYLEN(case_fold1_16_052) }, - { case_fold1_16_053, __PHYSFS_ARRAYLEN(case_fold1_16_053) }, - { case_fold1_16_054, __PHYSFS_ARRAYLEN(case_fold1_16_054) }, - { case_fold1_16_055, __PHYSFS_ARRAYLEN(case_fold1_16_055) }, - { case_fold1_16_056, __PHYSFS_ARRAYLEN(case_fold1_16_056) }, - { case_fold1_16_057, __PHYSFS_ARRAYLEN(case_fold1_16_057) }, - { case_fold1_16_058, __PHYSFS_ARRAYLEN(case_fold1_16_058) }, - { case_fold1_16_059, __PHYSFS_ARRAYLEN(case_fold1_16_059) }, - { case_fold1_16_060, __PHYSFS_ARRAYLEN(case_fold1_16_060) }, - { case_fold1_16_061, __PHYSFS_ARRAYLEN(case_fold1_16_061) }, - { case_fold1_16_062, __PHYSFS_ARRAYLEN(case_fold1_16_062) }, - { case_fold1_16_063, __PHYSFS_ARRAYLEN(case_fold1_16_063) }, - { case_fold1_16_064, __PHYSFS_ARRAYLEN(case_fold1_16_064) }, - { case_fold1_16_065, __PHYSFS_ARRAYLEN(case_fold1_16_065) }, - { case_fold1_16_066, __PHYSFS_ARRAYLEN(case_fold1_16_066) }, - { case_fold1_16_067, __PHYSFS_ARRAYLEN(case_fold1_16_067) }, - { case_fold1_16_068, __PHYSFS_ARRAYLEN(case_fold1_16_068) }, - { case_fold1_16_069, __PHYSFS_ARRAYLEN(case_fold1_16_069) }, - { case_fold1_16_070, __PHYSFS_ARRAYLEN(case_fold1_16_070) }, - { case_fold1_16_071, __PHYSFS_ARRAYLEN(case_fold1_16_071) }, - { case_fold1_16_072, __PHYSFS_ARRAYLEN(case_fold1_16_072) }, - { case_fold1_16_073, __PHYSFS_ARRAYLEN(case_fold1_16_073) }, - { case_fold1_16_074, __PHYSFS_ARRAYLEN(case_fold1_16_074) }, - { case_fold1_16_075, __PHYSFS_ARRAYLEN(case_fold1_16_075) }, - { case_fold1_16_076, __PHYSFS_ARRAYLEN(case_fold1_16_076) }, - { case_fold1_16_077, __PHYSFS_ARRAYLEN(case_fold1_16_077) }, - { case_fold1_16_078, __PHYSFS_ARRAYLEN(case_fold1_16_078) }, - { case_fold1_16_079, __PHYSFS_ARRAYLEN(case_fold1_16_079) }, - { case_fold1_16_080, __PHYSFS_ARRAYLEN(case_fold1_16_080) }, - { case_fold1_16_081, __PHYSFS_ARRAYLEN(case_fold1_16_081) }, - { case_fold1_16_082, __PHYSFS_ARRAYLEN(case_fold1_16_082) }, - { case_fold1_16_083, __PHYSFS_ARRAYLEN(case_fold1_16_083) }, - { case_fold1_16_084, __PHYSFS_ARRAYLEN(case_fold1_16_084) }, - { case_fold1_16_085, __PHYSFS_ARRAYLEN(case_fold1_16_085) }, - { case_fold1_16_086, __PHYSFS_ARRAYLEN(case_fold1_16_086) }, - { case_fold1_16_087, __PHYSFS_ARRAYLEN(case_fold1_16_087) }, - { case_fold1_16_088, __PHYSFS_ARRAYLEN(case_fold1_16_088) }, - { case_fold1_16_089, __PHYSFS_ARRAYLEN(case_fold1_16_089) }, - { case_fold1_16_090, __PHYSFS_ARRAYLEN(case_fold1_16_090) }, - { case_fold1_16_091, __PHYSFS_ARRAYLEN(case_fold1_16_091) }, - { case_fold1_16_092, __PHYSFS_ARRAYLEN(case_fold1_16_092) }, - { case_fold1_16_093, __PHYSFS_ARRAYLEN(case_fold1_16_093) }, - { case_fold1_16_094, __PHYSFS_ARRAYLEN(case_fold1_16_094) }, - { case_fold1_16_095, __PHYSFS_ARRAYLEN(case_fold1_16_095) }, - { case_fold1_16_096, __PHYSFS_ARRAYLEN(case_fold1_16_096) }, - { case_fold1_16_097, __PHYSFS_ARRAYLEN(case_fold1_16_097) }, - { case_fold1_16_098, __PHYSFS_ARRAYLEN(case_fold1_16_098) }, - { case_fold1_16_099, __PHYSFS_ARRAYLEN(case_fold1_16_099) }, - { case_fold1_16_100, __PHYSFS_ARRAYLEN(case_fold1_16_100) }, - { case_fold1_16_101, __PHYSFS_ARRAYLEN(case_fold1_16_101) }, - { case_fold1_16_102, __PHYSFS_ARRAYLEN(case_fold1_16_102) }, - { case_fold1_16_103, __PHYSFS_ARRAYLEN(case_fold1_16_103) }, - { case_fold1_16_104, __PHYSFS_ARRAYLEN(case_fold1_16_104) }, - { case_fold1_16_105, __PHYSFS_ARRAYLEN(case_fold1_16_105) }, - { case_fold1_16_106, __PHYSFS_ARRAYLEN(case_fold1_16_106) }, - { case_fold1_16_107, __PHYSFS_ARRAYLEN(case_fold1_16_107) }, - { case_fold1_16_108, __PHYSFS_ARRAYLEN(case_fold1_16_108) }, - { case_fold1_16_109, __PHYSFS_ARRAYLEN(case_fold1_16_109) }, - { case_fold1_16_110, __PHYSFS_ARRAYLEN(case_fold1_16_110) }, - { case_fold1_16_111, __PHYSFS_ARRAYLEN(case_fold1_16_111) }, - { case_fold1_16_112, __PHYSFS_ARRAYLEN(case_fold1_16_112) }, - { case_fold1_16_113, __PHYSFS_ARRAYLEN(case_fold1_16_113) }, - { case_fold1_16_114, __PHYSFS_ARRAYLEN(case_fold1_16_114) }, - { case_fold1_16_115, __PHYSFS_ARRAYLEN(case_fold1_16_115) }, - { case_fold1_16_116, __PHYSFS_ARRAYLEN(case_fold1_16_116) }, - { case_fold1_16_117, __PHYSFS_ARRAYLEN(case_fold1_16_117) }, - { case_fold1_16_118, __PHYSFS_ARRAYLEN(case_fold1_16_118) }, - { case_fold1_16_119, __PHYSFS_ARRAYLEN(case_fold1_16_119) }, - { case_fold1_16_120, __PHYSFS_ARRAYLEN(case_fold1_16_120) }, - { case_fold1_16_121, __PHYSFS_ARRAYLEN(case_fold1_16_121) }, - { case_fold1_16_122, __PHYSFS_ARRAYLEN(case_fold1_16_122) }, - { NULL, 0 }, - { case_fold1_16_124, __PHYSFS_ARRAYLEN(case_fold1_16_124) }, - { NULL, 0 }, - { case_fold1_16_126, __PHYSFS_ARRAYLEN(case_fold1_16_126) }, - { NULL, 0 }, - { case_fold1_16_128, __PHYSFS_ARRAYLEN(case_fold1_16_128) }, - { case_fold1_16_129, __PHYSFS_ARRAYLEN(case_fold1_16_129) }, - { case_fold1_16_130, __PHYSFS_ARRAYLEN(case_fold1_16_130) }, - { case_fold1_16_131, __PHYSFS_ARRAYLEN(case_fold1_16_131) }, - { case_fold1_16_132, __PHYSFS_ARRAYLEN(case_fold1_16_132) }, - { case_fold1_16_133, __PHYSFS_ARRAYLEN(case_fold1_16_133) }, - { case_fold1_16_134, __PHYSFS_ARRAYLEN(case_fold1_16_134) }, - { case_fold1_16_135, __PHYSFS_ARRAYLEN(case_fold1_16_135) }, - { case_fold1_16_136, __PHYSFS_ARRAYLEN(case_fold1_16_136) }, - { case_fold1_16_137, __PHYSFS_ARRAYLEN(case_fold1_16_137) }, - { case_fold1_16_138, __PHYSFS_ARRAYLEN(case_fold1_16_138) }, - { case_fold1_16_139, __PHYSFS_ARRAYLEN(case_fold1_16_139) }, - { case_fold1_16_140, __PHYSFS_ARRAYLEN(case_fold1_16_140) }, - { case_fold1_16_141, __PHYSFS_ARRAYLEN(case_fold1_16_141) }, - { case_fold1_16_142, __PHYSFS_ARRAYLEN(case_fold1_16_142) }, - { case_fold1_16_143, __PHYSFS_ARRAYLEN(case_fold1_16_143) }, - { case_fold1_16_144, __PHYSFS_ARRAYLEN(case_fold1_16_144) }, - { case_fold1_16_145, __PHYSFS_ARRAYLEN(case_fold1_16_145) }, - { case_fold1_16_146, __PHYSFS_ARRAYLEN(case_fold1_16_146) }, - { case_fold1_16_147, __PHYSFS_ARRAYLEN(case_fold1_16_147) }, - { case_fold1_16_148, __PHYSFS_ARRAYLEN(case_fold1_16_148) }, - { case_fold1_16_149, __PHYSFS_ARRAYLEN(case_fold1_16_149) }, - { case_fold1_16_150, __PHYSFS_ARRAYLEN(case_fold1_16_150) }, - { case_fold1_16_151, __PHYSFS_ARRAYLEN(case_fold1_16_151) }, - { case_fold1_16_152, __PHYSFS_ARRAYLEN(case_fold1_16_152) }, - { case_fold1_16_153, __PHYSFS_ARRAYLEN(case_fold1_16_153) }, - { case_fold1_16_154, __PHYSFS_ARRAYLEN(case_fold1_16_154) }, - { case_fold1_16_155, __PHYSFS_ARRAYLEN(case_fold1_16_155) }, - { case_fold1_16_156, __PHYSFS_ARRAYLEN(case_fold1_16_156) }, - { case_fold1_16_157, __PHYSFS_ARRAYLEN(case_fold1_16_157) }, - { case_fold1_16_158, __PHYSFS_ARRAYLEN(case_fold1_16_158) }, - { case_fold1_16_159, __PHYSFS_ARRAYLEN(case_fold1_16_159) }, - { case_fold1_16_160, __PHYSFS_ARRAYLEN(case_fold1_16_160) }, - { case_fold1_16_161, __PHYSFS_ARRAYLEN(case_fold1_16_161) }, - { case_fold1_16_162, __PHYSFS_ARRAYLEN(case_fold1_16_162) }, - { case_fold1_16_163, __PHYSFS_ARRAYLEN(case_fold1_16_163) }, - { case_fold1_16_164, __PHYSFS_ARRAYLEN(case_fold1_16_164) }, - { case_fold1_16_165, __PHYSFS_ARRAYLEN(case_fold1_16_165) }, - { case_fold1_16_166, __PHYSFS_ARRAYLEN(case_fold1_16_166) }, - { case_fold1_16_167, __PHYSFS_ARRAYLEN(case_fold1_16_167) }, - { case_fold1_16_168, __PHYSFS_ARRAYLEN(case_fold1_16_168) }, - { case_fold1_16_169, __PHYSFS_ARRAYLEN(case_fold1_16_169) }, - { case_fold1_16_170, __PHYSFS_ARRAYLEN(case_fold1_16_170) }, - { case_fold1_16_171, __PHYSFS_ARRAYLEN(case_fold1_16_171) }, - { case_fold1_16_172, __PHYSFS_ARRAYLEN(case_fold1_16_172) }, - { case_fold1_16_173, __PHYSFS_ARRAYLEN(case_fold1_16_173) }, - { case_fold1_16_174, __PHYSFS_ARRAYLEN(case_fold1_16_174) }, - { case_fold1_16_175, __PHYSFS_ARRAYLEN(case_fold1_16_175) }, - { case_fold1_16_176, __PHYSFS_ARRAYLEN(case_fold1_16_176) }, - { case_fold1_16_177, __PHYSFS_ARRAYLEN(case_fold1_16_177) }, - { case_fold1_16_178, __PHYSFS_ARRAYLEN(case_fold1_16_178) }, - { case_fold1_16_179, __PHYSFS_ARRAYLEN(case_fold1_16_179) }, - { case_fold1_16_180, __PHYSFS_ARRAYLEN(case_fold1_16_180) }, - { case_fold1_16_181, __PHYSFS_ARRAYLEN(case_fold1_16_181) }, - { case_fold1_16_182, __PHYSFS_ARRAYLEN(case_fold1_16_182) }, - { case_fold1_16_183, __PHYSFS_ARRAYLEN(case_fold1_16_183) }, - { case_fold1_16_184, __PHYSFS_ARRAYLEN(case_fold1_16_184) }, - { case_fold1_16_185, __PHYSFS_ARRAYLEN(case_fold1_16_185) }, - { case_fold1_16_186, __PHYSFS_ARRAYLEN(case_fold1_16_186) }, - { case_fold1_16_187, __PHYSFS_ARRAYLEN(case_fold1_16_187) }, - { case_fold1_16_188, __PHYSFS_ARRAYLEN(case_fold1_16_188) }, - { case_fold1_16_189, __PHYSFS_ARRAYLEN(case_fold1_16_189) }, - { case_fold1_16_190, __PHYSFS_ARRAYLEN(case_fold1_16_190) }, - { case_fold1_16_191, __PHYSFS_ARRAYLEN(case_fold1_16_191) }, - { case_fold1_16_192, __PHYSFS_ARRAYLEN(case_fold1_16_192) }, - { case_fold1_16_193, __PHYSFS_ARRAYLEN(case_fold1_16_193) }, - { case_fold1_16_194, __PHYSFS_ARRAYLEN(case_fold1_16_194) }, - { case_fold1_16_195, __PHYSFS_ARRAYLEN(case_fold1_16_195) }, - { case_fold1_16_196, __PHYSFS_ARRAYLEN(case_fold1_16_196) }, - { case_fold1_16_197, __PHYSFS_ARRAYLEN(case_fold1_16_197) }, - { case_fold1_16_198, __PHYSFS_ARRAYLEN(case_fold1_16_198) }, - { case_fold1_16_199, __PHYSFS_ARRAYLEN(case_fold1_16_199) }, - { case_fold1_16_200, __PHYSFS_ARRAYLEN(case_fold1_16_200) }, - { case_fold1_16_201, __PHYSFS_ARRAYLEN(case_fold1_16_201) }, - { case_fold1_16_202, __PHYSFS_ARRAYLEN(case_fold1_16_202) }, - { case_fold1_16_203, __PHYSFS_ARRAYLEN(case_fold1_16_203) }, - { case_fold1_16_204, __PHYSFS_ARRAYLEN(case_fold1_16_204) }, - { case_fold1_16_205, __PHYSFS_ARRAYLEN(case_fold1_16_205) }, - { case_fold1_16_206, __PHYSFS_ARRAYLEN(case_fold1_16_206) }, - { case_fold1_16_207, __PHYSFS_ARRAYLEN(case_fold1_16_207) }, - { case_fold1_16_208, __PHYSFS_ARRAYLEN(case_fold1_16_208) }, - { case_fold1_16_209, __PHYSFS_ARRAYLEN(case_fold1_16_209) }, - { case_fold1_16_210, __PHYSFS_ARRAYLEN(case_fold1_16_210) }, - { case_fold1_16_211, __PHYSFS_ARRAYLEN(case_fold1_16_211) }, - { case_fold1_16_212, __PHYSFS_ARRAYLEN(case_fold1_16_212) }, - { case_fold1_16_213, __PHYSFS_ARRAYLEN(case_fold1_16_213) }, - { case_fold1_16_214, __PHYSFS_ARRAYLEN(case_fold1_16_214) }, - { case_fold1_16_215, __PHYSFS_ARRAYLEN(case_fold1_16_215) }, - { case_fold1_16_216, __PHYSFS_ARRAYLEN(case_fold1_16_216) }, - { case_fold1_16_217, __PHYSFS_ARRAYLEN(case_fold1_16_217) }, - { case_fold1_16_218, __PHYSFS_ARRAYLEN(case_fold1_16_218) }, - { case_fold1_16_219, __PHYSFS_ARRAYLEN(case_fold1_16_219) }, - { case_fold1_16_220, __PHYSFS_ARRAYLEN(case_fold1_16_220) }, - { case_fold1_16_221, __PHYSFS_ARRAYLEN(case_fold1_16_221) }, - { case_fold1_16_222, __PHYSFS_ARRAYLEN(case_fold1_16_222) }, - { case_fold1_16_223, __PHYSFS_ARRAYLEN(case_fold1_16_223) }, - { case_fold1_16_224, __PHYSFS_ARRAYLEN(case_fold1_16_224) }, - { case_fold1_16_225, __PHYSFS_ARRAYLEN(case_fold1_16_225) }, - { case_fold1_16_226, __PHYSFS_ARRAYLEN(case_fold1_16_226) }, - { case_fold1_16_227, __PHYSFS_ARRAYLEN(case_fold1_16_227) }, - { case_fold1_16_228, __PHYSFS_ARRAYLEN(case_fold1_16_228) }, - { case_fold1_16_229, __PHYSFS_ARRAYLEN(case_fold1_16_229) }, - { case_fold1_16_230, __PHYSFS_ARRAYLEN(case_fold1_16_230) }, - { case_fold1_16_231, __PHYSFS_ARRAYLEN(case_fold1_16_231) }, - { case_fold1_16_232, __PHYSFS_ARRAYLEN(case_fold1_16_232) }, - { case_fold1_16_233, __PHYSFS_ARRAYLEN(case_fold1_16_233) }, - { case_fold1_16_234, __PHYSFS_ARRAYLEN(case_fold1_16_234) }, - { case_fold1_16_235, __PHYSFS_ARRAYLEN(case_fold1_16_235) }, - { case_fold1_16_236, __PHYSFS_ARRAYLEN(case_fold1_16_236) }, - { case_fold1_16_237, __PHYSFS_ARRAYLEN(case_fold1_16_237) }, - { case_fold1_16_238, __PHYSFS_ARRAYLEN(case_fold1_16_238) }, - { case_fold1_16_239, __PHYSFS_ARRAYLEN(case_fold1_16_239) }, - { case_fold1_16_240, __PHYSFS_ARRAYLEN(case_fold1_16_240) }, - { case_fold1_16_241, __PHYSFS_ARRAYLEN(case_fold1_16_241) }, - { case_fold1_16_242, __PHYSFS_ARRAYLEN(case_fold1_16_242) }, - { case_fold1_16_243, __PHYSFS_ARRAYLEN(case_fold1_16_243) }, - { case_fold1_16_244, __PHYSFS_ARRAYLEN(case_fold1_16_244) }, - { case_fold1_16_245, __PHYSFS_ARRAYLEN(case_fold1_16_245) }, - { case_fold1_16_246, __PHYSFS_ARRAYLEN(case_fold1_16_246) }, - { case_fold1_16_247, __PHYSFS_ARRAYLEN(case_fold1_16_247) }, - { case_fold1_16_248, __PHYSFS_ARRAYLEN(case_fold1_16_248) }, - { case_fold1_16_249, __PHYSFS_ARRAYLEN(case_fold1_16_249) }, - { case_fold1_16_250, __PHYSFS_ARRAYLEN(case_fold1_16_250) }, - { case_fold1_16_251, __PHYSFS_ARRAYLEN(case_fold1_16_251) }, - { case_fold1_16_252, __PHYSFS_ARRAYLEN(case_fold1_16_252) }, - { case_fold1_16_253, __PHYSFS_ARRAYLEN(case_fold1_16_253) }, - { case_fold1_16_254, __PHYSFS_ARRAYLEN(case_fold1_16_254) }, - { case_fold1_16_255, __PHYSFS_ARRAYLEN(case_fold1_16_255) }, -}; - -static const CaseFoldHashBucket1_32 case_fold_hash1_32[] = { - { case_fold1_32_000, __PHYSFS_ARRAYLEN(case_fold1_32_000) }, - { case_fold1_32_001, __PHYSFS_ARRAYLEN(case_fold1_32_001) }, - { case_fold1_32_002, __PHYSFS_ARRAYLEN(case_fold1_32_002) }, - { case_fold1_32_003, __PHYSFS_ARRAYLEN(case_fold1_32_003) }, - { case_fold1_32_004, __PHYSFS_ARRAYLEN(case_fold1_32_004) }, - { case_fold1_32_005, __PHYSFS_ARRAYLEN(case_fold1_32_005) }, - { case_fold1_32_006, __PHYSFS_ARRAYLEN(case_fold1_32_006) }, - { case_fold1_32_007, __PHYSFS_ARRAYLEN(case_fold1_32_007) }, - { case_fold1_32_008, __PHYSFS_ARRAYLEN(case_fold1_32_008) }, - { case_fold1_32_009, __PHYSFS_ARRAYLEN(case_fold1_32_009) }, - { case_fold1_32_010, __PHYSFS_ARRAYLEN(case_fold1_32_010) }, - { case_fold1_32_011, __PHYSFS_ARRAYLEN(case_fold1_32_011) }, - { case_fold1_32_012, __PHYSFS_ARRAYLEN(case_fold1_32_012) }, - { case_fold1_32_013, __PHYSFS_ARRAYLEN(case_fold1_32_013) }, - { case_fold1_32_014, __PHYSFS_ARRAYLEN(case_fold1_32_014) }, - { case_fold1_32_015, __PHYSFS_ARRAYLEN(case_fold1_32_015) }, -}; - -static const CaseFoldHashBucket2_16 case_fold_hash2_16[] = { - { case_fold2_16_000, __PHYSFS_ARRAYLEN(case_fold2_16_000) }, - { case_fold2_16_001, __PHYSFS_ARRAYLEN(case_fold2_16_001) }, - { case_fold2_16_002, __PHYSFS_ARRAYLEN(case_fold2_16_002) }, - { case_fold2_16_003, __PHYSFS_ARRAYLEN(case_fold2_16_003) }, - { case_fold2_16_004, __PHYSFS_ARRAYLEN(case_fold2_16_004) }, - { case_fold2_16_005, __PHYSFS_ARRAYLEN(case_fold2_16_005) }, - { case_fold2_16_006, __PHYSFS_ARRAYLEN(case_fold2_16_006) }, - { case_fold2_16_007, __PHYSFS_ARRAYLEN(case_fold2_16_007) }, - { case_fold2_16_008, __PHYSFS_ARRAYLEN(case_fold2_16_008) }, - { case_fold2_16_009, __PHYSFS_ARRAYLEN(case_fold2_16_009) }, - { case_fold2_16_010, __PHYSFS_ARRAYLEN(case_fold2_16_010) }, - { case_fold2_16_011, __PHYSFS_ARRAYLEN(case_fold2_16_011) }, - { case_fold2_16_012, __PHYSFS_ARRAYLEN(case_fold2_16_012) }, - { case_fold2_16_013, __PHYSFS_ARRAYLEN(case_fold2_16_013) }, - { case_fold2_16_014, __PHYSFS_ARRAYLEN(case_fold2_16_014) }, - { case_fold2_16_015, __PHYSFS_ARRAYLEN(case_fold2_16_015) }, -}; - -static const CaseFoldHashBucket3_16 case_fold_hash3_16[] = { - { case_fold3_16_000, __PHYSFS_ARRAYLEN(case_fold3_16_000) }, - { case_fold3_16_001, __PHYSFS_ARRAYLEN(case_fold3_16_001) }, - { NULL, 0 }, - { case_fold3_16_003, __PHYSFS_ARRAYLEN(case_fold3_16_003) }, -}; - - -#endif /* _INCLUDE_PHYSFS_CASEFOLDING_H_ */ - -/* end of physfs_casefolding.h ... */ - diff --git a/love/src/jni/love/src/libraries/physfs/physfs_internal.h b/love/src/jni/love/src/libraries/physfs/physfs_internal.h deleted file mode 100644 index 003ecc58..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_internal.h +++ /dev/null @@ -1,720 +0,0 @@ -/* - * Internal function/structure declaration. Do NOT include in your - * application. - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file written by Ryan C. Gordon. - */ - -#ifndef _INCLUDE_PHYSFS_INTERNAL_H_ -#define _INCLUDE_PHYSFS_INTERNAL_H_ - -#ifndef __PHYSICSFS_INTERNAL__ -#error Do not include this header from your applications. -#endif - -/* Turn off MSVC warnings that are aggressively anti-portability. */ -#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) -#define _CRT_SECURE_NO_WARNINGS 1 -#endif - -#include "physfs.h" - -/* The holy trinity. */ -#include -#include -#include - -#include "physfs_platforms.h" - -#include - -#define __PHYSFS_COMPILE_TIME_ASSERT(name, x) \ - typedef int __PHYSFS_compile_time_assert_##name[(x) * 2 - 1] - -/* !!! FIXME: remove this when revamping stack allocation code... */ -#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__WATCOMC__) -#include -#endif - -#ifdef PHYSFS_PLATFORM_SOLARIS -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __GNUC__ -#define PHYSFS_MINIMUM_GCC_VERSION(major, minor) \ - ( ((__GNUC__ << 16) + __GNUC_MINOR__) >= (((major) << 16) + (minor)) ) -#else -#define PHYSFS_MINIMUM_GCC_VERSION(major, minor) (0) -#endif - -#ifdef __cplusplus - /* C++ always has a real inline keyword. */ -#elif (defined macintosh) && !(defined __MWERKS__) -# define inline -#elif (defined _MSC_VER) -# define inline __inline -#endif - -#if defined(PHYSFS_PLATFORM_LINUX) && !defined(_FILE_OFFSET_BITS) -#define _FILE_OFFSET_BITS 64 -#endif - -/* All public APIs need to be in physfs.h with a PHYSFS_DECL. - All file-private symbols need to be marked "static". - Everything shared between PhysicsFS sources needs to be in this - file between the visibility pragma blocks. */ -#if PHYSFS_MINIMUM_GCC_VERSION(4,0) || defined(__clang__) -#define PHYSFS_HAVE_PRAGMA_VISIBILITY 1 -#endif - -#if PHYSFS_HAVE_PRAGMA_VISIBILITY -#pragma GCC visibility push(hidden) -#endif - -/* These are the build-in archivers. We list them all as "extern" here without - #ifdefs to keep it tidy, but obviously you need to make sure these are - wrapped in PHYSFS_SUPPORTS_* checks before actually referencing them. */ -extern const PHYSFS_Archiver __PHYSFS_Archiver_DIR; -extern const PHYSFS_Archiver __PHYSFS_Archiver_ZIP; -extern const PHYSFS_Archiver __PHYSFS_Archiver_7Z; -extern const PHYSFS_Archiver __PHYSFS_Archiver_GRP; -extern const PHYSFS_Archiver __PHYSFS_Archiver_QPAK; -extern const PHYSFS_Archiver __PHYSFS_Archiver_HOG; -extern const PHYSFS_Archiver __PHYSFS_Archiver_MVL; -extern const PHYSFS_Archiver __PHYSFS_Archiver_WAD; -extern const PHYSFS_Archiver __PHYSFS_Archiver_SLB; -extern const PHYSFS_Archiver __PHYSFS_Archiver_ISO9660; -extern const PHYSFS_Archiver __PHYSFS_Archiver_VDF; - -/* a real C99-compliant snprintf() is in Visual Studio 2015, - but just use this everywhere for binary compatibility. */ -#if defined(_MSC_VER) -int __PHYSFS_msvc_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap); -int __PHYSFS_msvc_snprintf(char *outBuf, size_t size, const char *format, ...); -#define vsnprintf __PHYSFS_msvc_vsnprintf -#define snprintf __PHYSFS_msvc_snprintf -#endif - -/* Some simple wrappers around WinRT C++ interfaces we can call from C. */ -#ifdef PHYSFS_PLATFORM_WINRT -const void *__PHYSFS_winrtCalcBaseDir(void); -const void *__PHYSFS_winrtCalcPrefDir(void); -#endif - -/* atomic operations. */ -#if defined(_MSC_VER) && (_MSC_VER >= 1500) -#include -__PHYSFS_COMPILE_TIME_ASSERT(LongEqualsInt, sizeof (int) == sizeof (long)); -#define __PHYSFS_ATOMIC_INCR(ptrval) _InterlockedIncrement((long*)(ptrval)) -#define __PHYSFS_ATOMIC_DECR(ptrval) _InterlockedDecrement((long*)(ptrval)) -#elif defined(__clang__) || (defined(__GNUC__) && (((__GNUC__ * 10000) + (__GNUC_MINOR__ * 100)) >= 40100)) -#define __PHYSFS_ATOMIC_INCR(ptrval) __sync_fetch_and_add(ptrval, 1) -#define __PHYSFS_ATOMIC_DECR(ptrval) __sync_fetch_and_add(ptrval, -1) -#else -#define PHYSFS_NEED_ATOMIC_OP_FALLBACK 1 -int __PHYSFS_ATOMIC_INCR(int *ptrval); -int __PHYSFS_ATOMIC_DECR(int *ptrval); -#endif - - -/* - * Interface for small allocations. If you need a little scratch space for - * a throwaway buffer or string, use this. It will make small allocations - * on the stack if possible, and use allocator.Malloc() if they are too - * large. This helps reduce malloc pressure. - * There are some rules, though: - * NEVER return a pointer from this, as stack-allocated buffers go away - * when your function returns. - * NEVER allocate in a loop, as stack-allocated pointers will pile up. Call - * a function that uses smallAlloc from your loop, so the allocation can - * free each time. - * NEVER call smallAlloc with any complex expression (it's a macro that WILL - * have side effects...it references the argument multiple times). Use a - * variable or a literal. - * NEVER free a pointer from this with anything but smallFree. It will not - * be a valid pointer to the allocator, regardless of where the memory came - * from. - * NEVER realloc a pointer from this. - * NEVER forget to use smallFree: it may not be a pointer from the stack. - * NEVER forget to check for NULL...allocation can fail here, of course! - */ -#define __PHYSFS_SMALLALLOCTHRESHOLD 256 -void *__PHYSFS_initSmallAlloc(void *ptr, const size_t len); - -#define __PHYSFS_smallAlloc(bytes) ( \ - __PHYSFS_initSmallAlloc( \ - (((bytes) < __PHYSFS_SMALLALLOCTHRESHOLD) ? \ - alloca((size_t)((bytes)+sizeof(void*))) : NULL), (bytes)) \ -) - -void __PHYSFS_smallFree(void *ptr); - - -/* Use the allocation hooks. */ -#define malloc(x) Do not use malloc() directly. -#define realloc(x, y) Do not use realloc() directly. -#define free(x) Do not use free() directly. -/* !!! FIXME: add alloca check here. */ - -#ifndef PHYSFS_SUPPORTS_ZIP -#define PHYSFS_SUPPORTS_ZIP 1 -#endif -#ifndef PHYSFS_SUPPORTS_7Z -#define PHYSFS_SUPPORTS_7Z 1 -#endif -#ifndef PHYSFS_SUPPORTS_GRP -#define PHYSFS_SUPPORTS_GRP 1 -#endif -#ifndef PHYSFS_SUPPORTS_HOG -#define PHYSFS_SUPPORTS_HOG 1 -#endif -#ifndef PHYSFS_SUPPORTS_MVL -#define PHYSFS_SUPPORTS_MVL 1 -#endif -#ifndef PHYSFS_SUPPORTS_WAD -#define PHYSFS_SUPPORTS_WAD 1 -#endif -#ifndef PHYSFS_SUPPORTS_QPAK -#define PHYSFS_SUPPORTS_QPAK 1 -#endif -#ifndef PHYSFS_SUPPORTS_SLB -#define PHYSFS_SUPPORTS_SLB 1 -#endif -#ifndef PHYSFS_SUPPORTS_ISO9660 -#define PHYSFS_SUPPORTS_ISO9660 1 -#endif -#ifndef PHYSFS_SUPPORTS_VDF -#define PHYSFS_SUPPORTS_VDF 1 -#endif - -#if PHYSFS_SUPPORTS_7Z -/* 7zip support needs a global init function called at startup (no deinit). */ -extern void SZIP_global_init(void); -#endif - -/* The latest supported PHYSFS_Io::version value. */ -#define CURRENT_PHYSFS_IO_API_VERSION 0 - -/* The latest supported PHYSFS_Archiver::version value. */ -#define CURRENT_PHYSFS_ARCHIVER_API_VERSION 0 - -/* This byteorder stuff was lifted from SDL. https://www.libsdl.org/ */ -#define PHYSFS_LIL_ENDIAN 1234 -#define PHYSFS_BIG_ENDIAN 4321 - -#ifdef __linux__ -#include -#define PHYSFS_BYTEORDER __BYTE_ORDER -#else /* __linux__ */ -#if defined(__hppa__) || \ - defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \ - (defined(__MIPS__) && defined(__MISPEB__)) || \ - defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \ - defined(__sparc__) -#define PHYSFS_BYTEORDER PHYSFS_BIG_ENDIAN -#else -#define PHYSFS_BYTEORDER PHYSFS_LIL_ENDIAN -#endif -#endif /* __linux__ */ - - -/* - * When sorting the entries in an archive, we use a modified QuickSort. - * When there are less then PHYSFS_QUICKSORT_THRESHOLD entries left to sort, - * we switch over to a BubbleSort for the remainder. Tweak to taste. - * - * You can override this setting by defining PHYSFS_QUICKSORT_THRESHOLD - * before #including "physfs_internal.h". - */ -#ifndef PHYSFS_QUICKSORT_THRESHOLD -#define PHYSFS_QUICKSORT_THRESHOLD 4 -#endif - -/* - * Sort an array (or whatever) of (max) elements. This uses a mixture of - * a QuickSort and BubbleSort internally. - * (cmpfn) is used to determine ordering, and (swapfn) does the actual - * swapping of elements in the list. - */ -void __PHYSFS_sort(void *entries, size_t max, - int (*cmpfn)(void *, size_t, size_t), - void (*swapfn)(void *, size_t, size_t)); - -/* These get used all over for lessening code clutter. */ -/* "ERRPASS" means "something else just set the error state for us" and is - just to make it clear where the responsibility for the error state lays. */ -#define BAIL(e, r) do { if (e) PHYSFS_setErrorCode(e); return r; } while (0) -#define BAIL_ERRPASS(r) do { return r; } while (0) -#define BAIL_IF(c, e, r) do { if (c) { if (e) PHYSFS_setErrorCode(e); return r; } } while (0) -#define BAIL_IF_ERRPASS(c, r) do { if (c) { return r; } } while (0) -#define BAIL_MUTEX(e, m, r) do { if (e) PHYSFS_setErrorCode(e); __PHYSFS_platformReleaseMutex(m); return r; } while (0) -#define BAIL_MUTEX_ERRPASS(m, r) do { __PHYSFS_platformReleaseMutex(m); return r; } while (0) -#define BAIL_IF_MUTEX(c, e, m, r) do { if (c) { if (e) PHYSFS_setErrorCode(e); __PHYSFS_platformReleaseMutex(m); return r; } } while (0) -#define BAIL_IF_MUTEX_ERRPASS(c, m, r) do { if (c) { __PHYSFS_platformReleaseMutex(m); return r; } } while (0) -#define GOTO(e, g) do { if (e) PHYSFS_setErrorCode(e); goto g; } while (0) -#define GOTO_ERRPASS(g) do { goto g; } while (0) -#define GOTO_IF(c, e, g) do { if (c) { if (e) PHYSFS_setErrorCode(e); goto g; } } while (0) -#define GOTO_IF_ERRPASS(c, g) do { if (c) { goto g; } } while (0) -#define GOTO_MUTEX(e, m, g) do { if (e) PHYSFS_setErrorCode(e); __PHYSFS_platformReleaseMutex(m); goto g; } while (0) -#define GOTO_MUTEX_ERRPASS(m, g) do { __PHYSFS_platformReleaseMutex(m); goto g; } while (0) -#define GOTO_IF_MUTEX(c, e, m, g) do { if (c) { if (e) PHYSFS_setErrorCode(e); __PHYSFS_platformReleaseMutex(m); goto g; } } while (0) -#define GOTO_IF_MUTEX_ERRPASS(c, m, g) do { if (c) { __PHYSFS_platformReleaseMutex(m); goto g; } } while (0) - -#define __PHYSFS_ARRAYLEN(x) ( (sizeof (x)) / (sizeof (x[0])) ) - -#ifdef PHYSFS_NO_64BIT_SUPPORT -#define __PHYSFS_SI64(x) ((PHYSFS_sint64) (x)) -#define __PHYSFS_UI64(x) ((PHYSFS_uint64) (x)) -#elif (defined __GNUC__) -#define __PHYSFS_SI64(x) x##LL -#define __PHYSFS_UI64(x) x##ULL -#elif (defined _MSC_VER) -#define __PHYSFS_SI64(x) x##i64 -#define __PHYSFS_UI64(x) x##ui64 -#else -#define __PHYSFS_SI64(x) ((PHYSFS_sint64) (x)) -#define __PHYSFS_UI64(x) ((PHYSFS_uint64) (x)) -#endif - - -/* - * Check if a ui64 will fit in the platform's address space. - * The initial sizeof check will optimize this macro out entirely on - * 64-bit (and larger?!) platforms, and the other condition will - * return zero or non-zero if the variable will fit in the platform's - * size_t, suitable to pass to malloc. This is kinda messy, but effective. - */ -#define __PHYSFS_ui64FitsAddressSpace(s) ( \ - (sizeof (PHYSFS_uint64) <= sizeof (size_t)) || \ - ((s) < (__PHYSFS_UI64(0xFFFFFFFFFFFFFFFF) >> (64-(sizeof(size_t)*8)))) \ -) - -/* - * Like strdup(), but uses the current PhysicsFS allocator. - */ -char *__PHYSFS_strdup(const char *str); - -/* - * Give a hash value for a C string (uses djb's xor hashing algorithm). - */ -PHYSFS_uint32 __PHYSFS_hashString(const char *str, size_t len); - - -/* - * The current allocator. Not valid before PHYSFS_init is called! - */ -extern PHYSFS_Allocator __PHYSFS_AllocatorHooks; - -/* convenience macro to make this less cumbersome internally... */ -#define allocator __PHYSFS_AllocatorHooks - -/* - * Create a PHYSFS_Io for a file in the physical filesystem. - * This path is in platform-dependent notation. (mode) must be 'r', 'w', or - * 'a' for Read, Write, or Append. - */ -PHYSFS_Io *__PHYSFS_createNativeIo(const char *path, const int mode); - -/* - * Create a PHYSFS_Io for a buffer of memory (READ-ONLY). If you already - * have one of these, just use its duplicate() method, and it'll increment - * its refcount without allocating a copy of the buffer. - */ -PHYSFS_Io *__PHYSFS_createMemoryIo(const void *buf, PHYSFS_uint64 len, - void (*destruct)(void *)); - - -/* - * Read (len) bytes from (io) into (buf). Returns non-zero on success, - * zero on i/o error. Literally: "return (io->read(io, buf, len) == len);" - */ -int __PHYSFS_readAll(PHYSFS_Io *io, void *buf, const size_t len); - - -/* These are shared between some archivers. */ - -void UNPK_abandonArchive(void *opaque); -void UNPK_closeArchive(void *opaque); -void *UNPK_openArchive(PHYSFS_Io *io); -void *UNPK_addEntry(void *opaque, char *name, const int isdir, - const PHYSFS_sint64 ctime, const PHYSFS_sint64 mtime, - const PHYSFS_uint64 pos, const PHYSFS_uint64 len); -PHYSFS_Io *UNPK_openRead(void *opaque, const char *name); -PHYSFS_Io *UNPK_openWrite(void *opaque, const char *name); -PHYSFS_Io *UNPK_openAppend(void *opaque, const char *name); -int UNPK_remove(void *opaque, const char *name); -int UNPK_mkdir(void *opaque, const char *name); -int UNPK_stat(void *opaque, const char *fn, PHYSFS_Stat *st); -#define UNPK_enumerate __PHYSFS_DirTreeEnumerate - - - -/* Optional API many archivers use this to manage their directory tree. */ -/* !!! FIXME: document this better. */ - -typedef struct __PHYSFS_DirTreeEntry -{ - char *name; /* Full path in archive. */ - struct __PHYSFS_DirTreeEntry *hashnext; /* next item in hash bucket. */ - struct __PHYSFS_DirTreeEntry *children; /* linked list of kids, if dir. */ - struct __PHYSFS_DirTreeEntry *sibling; /* next item in same dir. */ - int isdir; -} __PHYSFS_DirTreeEntry; - -typedef struct __PHYSFS_DirTree -{ - __PHYSFS_DirTreeEntry *root; /* root of directory tree. */ - __PHYSFS_DirTreeEntry **hash; /* all entries hashed for fast lookup. */ - size_t hashBuckets; /* number of buckets in hash. */ - size_t entrylen; /* size in bytes of entries (including subclass). */ -} __PHYSFS_DirTree; - - -int __PHYSFS_DirTreeInit(__PHYSFS_DirTree *dt, const size_t entrylen); -void *__PHYSFS_DirTreeAdd(__PHYSFS_DirTree *dt, char *name, const int isdir); -void *__PHYSFS_DirTreeFind(__PHYSFS_DirTree *dt, const char *path); -PHYSFS_EnumerateCallbackResult __PHYSFS_DirTreeEnumerate(void *opaque, - const char *dname, PHYSFS_EnumerateCallback cb, - const char *origdir, void *callbackdata); -void __PHYSFS_DirTreeDeinit(__PHYSFS_DirTree *dt); - - - -/*--------------------------------------------------------------------------*/ -/*--------------------------------------------------------------------------*/ -/*------------ ----------------*/ -/*------------ You MUST implement the following functions ----------------*/ -/*------------ if porting to a new platform. ----------------*/ -/*------------ (see platform/unix.c for an example) ----------------*/ -/*------------ ----------------*/ -/*--------------------------------------------------------------------------*/ -/*--------------------------------------------------------------------------*/ - - -/* - * The dir separator; '/' on unix, '\\' on win32, ":" on MacOS, etc... - * Obviously, this isn't a function. If you need more than one char for this, - * you'll need to pull some old pieces of PhysicsFS out of revision control. - */ -#if defined(PHYSFS_PLATFORM_WINDOWS) || defined(PHYSFS_PLATFORM_OS2) -#define __PHYSFS_platformDirSeparator '\\' -#else -#define __PHYSFS_STANDARD_DIRSEP 1 -#define __PHYSFS_platformDirSeparator '/' -#endif - -/* - * Initialize the platform. This is called when PHYSFS_init() is called from - * the application. - * - * Return zero if there was a catastrophic failure (which prevents you from - * functioning at all), and non-zero otherwise. - */ -int __PHYSFS_platformInit(void); - - -/* - * Deinitialize the platform. This is called when PHYSFS_deinit() is called - * from the application. You can use this to clean up anything you've - * allocated in your platform driver. - */ -void __PHYSFS_platformDeinit(void); - - -/* - * Open a file for reading. (filename) is in platform-dependent notation. The - * file pointer should be positioned on the first byte of the file. - * - * The return value will be some platform-specific datatype that is opaque to - * the caller; it could be a (FILE *) under Unix, or a (HANDLE *) under win32. - * - * The same file can be opened for read multiple times, and each should have - * a unique file handle; this is frequently employed to prevent race - * conditions in the archivers. - * - * Call PHYSFS_setErrorCode() and return (NULL) if the file can't be opened. - */ -void *__PHYSFS_platformOpenRead(const char *filename); - - -/* - * Open a file for writing. (filename) is in platform-dependent notation. If - * the file exists, it should be truncated to zero bytes, and if it doesn't - * exist, it should be created as a zero-byte file. The file pointer should - * be positioned on the first byte of the file. - * - * The return value will be some platform-specific datatype that is opaque to - * the caller; it could be a (FILE *) under Unix, or a (HANDLE *) under win32, - * etc. - * - * Opening a file for write multiple times has undefined results. - * - * Call PHYSFS_setErrorCode() and return (NULL) if the file can't be opened. - */ -void *__PHYSFS_platformOpenWrite(const char *filename); - - -/* - * Open a file for appending. (filename) is in platform-dependent notation. If - * the file exists, the file pointer should be place just past the end of the - * file, so that the first write will be one byte after the current end of - * the file. If the file doesn't exist, it should be created as a zero-byte - * file. The file pointer should be positioned on the first byte of the file. - * - * The return value will be some platform-specific datatype that is opaque to - * the caller; it could be a (FILE *) under Unix, or a (HANDLE *) under win32, - * etc. - * - * Opening a file for append multiple times has undefined results. - * - * Call PHYSFS_setErrorCode() and return (NULL) if the file can't be opened. - */ -void *__PHYSFS_platformOpenAppend(const char *filename); - -/* - * Read more data from a platform-specific file handle. (opaque) should be - * cast to whatever data type your platform uses. Read a maximum of (len) - * 8-bit bytes to the area pointed to by (buf). If there isn't enough data - * available, return the number of bytes read, and position the file pointer - * immediately after those bytes. - * On success, return (len) and position the file pointer immediately past - * the end of the last read byte. Return (-1) if there is a catastrophic - * error, and call PHYSFS_setErrorCode() to describe the problem; the file - * pointer should not move in such a case. A partial read is success; only - * return (-1) on total failure; presumably, the next read call after a - * partial read will fail as such. - */ -PHYSFS_sint64 __PHYSFS_platformRead(void *opaque, void *buf, PHYSFS_uint64 len); - -/* - * Write more data to a platform-specific file handle. (opaque) should be - * cast to whatever data type your platform uses. Write a maximum of (len) - * 8-bit bytes from the area pointed to by (buffer). If there is a problem, - * return the number of bytes written, and position the file pointer - * immediately after those bytes. Return (-1) if there is a catastrophic - * error, and call PHYSFS_setErrorCode() to describe the problem; the file - * pointer should not move in such a case. A partial write is success; only - * return (-1) on total failure; presumably, the next write call after a - * partial write will fail as such. - */ -PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, const void *buffer, - PHYSFS_uint64 len); - -/* - * Set the file pointer to a new position. (opaque) should be cast to - * whatever data type your platform uses. (pos) specifies the number - * of 8-bit bytes to seek to from the start of the file. Seeking past the - * end of the file is an error condition, and you should check for it. - * - * Not all file types can seek; this is to be expected by the caller. - * - * On error, call PHYSFS_setErrorCode() and return zero. On success, return - * a non-zero value. - */ -int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos); - - -/* - * Get the file pointer's position, in an 8-bit byte offset from the start of - * the file. (opaque) should be cast to whatever data type your platform - * uses. - * - * Not all file types can "tell"; this is to be expected by the caller. - * - * On error, call PHYSFS_setErrorCode() and return -1. On success, return >= 0. - */ -PHYSFS_sint64 __PHYSFS_platformTell(void *opaque); - - -/* - * Determine the current size of a file, in 8-bit bytes, from an open file. - * - * The caller expects that this information may not be available for all - * file types on all platforms. - * - * Return -1 if you can't do it, and call PHYSFS_setErrorCode(). Otherwise, - * return the file length in 8-bit bytes. - */ -PHYSFS_sint64 __PHYSFS_platformFileLength(void *handle); - - -/* - * Read filesystem metadata for a specific path. - * - * This needs to fill in all the fields of (stat). For fields that might not - * mean anything on a platform (access time, perhaps), choose a reasonable - * default. if (follow), we want to follow symlinks and stat what they - * link to and not the link itself. - * - * Return zero on failure, non-zero on success. - */ -int __PHYSFS_platformStat(const char *fn, PHYSFS_Stat *stat, const int follow); - -/* - * Flush any pending writes to disk. (opaque) should be cast to whatever data - * type your platform uses. Be sure to check for errors; the caller expects - * that this function can fail if there was a flushing error, etc. - * - * Return zero on failure, non-zero on success. - */ -int __PHYSFS_platformFlush(void *opaque); - -/* - * Close file and deallocate resources. (opaque) should be cast to whatever - * data type your platform uses. This should close the file in any scenario: - * flushing is a separate function call, and this function should never fail. - * - * You should clean up all resources associated with (opaque); the pointer - * will be considered invalid after this call. - */ -void __PHYSFS_platformClose(void *opaque); - -/* - * Platform implementation of PHYSFS_getCdRomDirsCallback()... - * CD directories are discovered and reported to the callback one at a time. - * Pointers passed to the callback are assumed to be invalid to the - * application after the callback returns, so you can free them or whatever. - * Callback does not assume results will be sorted in any meaningful way. - */ -void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data); - -/* - * Calculate the base dir, if your platform needs special consideration. - * Just return NULL if the standard routines will suffice. (see - * calculateBaseDir() in physfs.c ...) - * Your string must end with a dir separator if you don't return NULL. - * Caller will allocator.Free() the retval if it's not NULL. - */ -char *__PHYSFS_platformCalcBaseDir(const char *argv0); - -/* - * Get the platform-specific user dir. - * As of PhysicsFS 2.1, returning NULL means fatal error. - * Your string must end with a dir separator if you don't return NULL. - * Caller will allocator.Free() the retval if it's not NULL. - */ -char *__PHYSFS_platformCalcUserDir(void); - - -/* This is the cached version from PHYSFS_init(). This is a fast call. */ -const char *__PHYSFS_getUserDir(void); /* not deprecated internal version. */ - - -/* - * Get the platform-specific pref dir. - * Returning NULL means fatal error. - * Your string must end with a dir separator if you don't return NULL. - * Caller will allocator.Free() the retval if it's not NULL. - * Caller will make missing directories if necessary; this just reports - * the final path. - */ -char *__PHYSFS_platformCalcPrefDir(const char *org, const char *app); - - -/* - * Return a pointer that uniquely identifies the current thread. - * On a platform without threading, (0x1) will suffice. These numbers are - * arbitrary; the only requirement is that no two threads have the same - * pointer. - */ -void *__PHYSFS_platformGetThreadID(void); - - -/* - * Enumerate a directory of files. This follows the rules for the - * PHYSFS_Archiver::enumerate() method, except that the (dirName) that is - * passed to this function is converted to platform-DEPENDENT notation by - * the caller. The PHYSFS_Archiver version uses platform-independent - * notation. Note that ".", "..", and other meta-entries should always - * be ignored. - */ -PHYSFS_EnumerateCallbackResult __PHYSFS_platformEnumerate(const char *dirname, - PHYSFS_EnumerateCallback callback, - const char *origdir, void *callbackdata); - -/* - * Make a directory in the actual filesystem. (path) is specified in - * platform-dependent notation. On error, return zero and set the error - * message. Return non-zero on success. - */ -int __PHYSFS_platformMkDir(const char *path); - - -/* - * Remove a file or directory entry in the actual filesystem. (path) is - * specified in platform-dependent notation. Note that this deletes files - * _and_ directories, so you might need to do some determination. - * Non-empty directories should report an error and not delete themselves - * or their contents. - * - * Deleting a symlink should remove the link, not what it points to. - * - * On error, return zero and set the error message. Return non-zero on success. - */ -int __PHYSFS_platformDelete(const char *path); - - -/* - * Create a platform-specific mutex. This can be whatever datatype your - * platform uses for mutexes, but it is cast to a (void *) for abstractness. - * - * Return (NULL) if you couldn't create one. Systems without threads can - * return any arbitrary non-NULL value. - */ -void *__PHYSFS_platformCreateMutex(void); - -/* - * Destroy a platform-specific mutex, and clean up any resources associated - * with it. (mutex) is a value previously returned by - * __PHYSFS_platformCreateMutex(). This can be a no-op on single-threaded - * platforms. - */ -void __PHYSFS_platformDestroyMutex(void *mutex); - -/* - * Grab possession of a platform-specific mutex. Mutexes should be recursive; - * that is, the same thread should be able to call this function multiple - * times in a row without causing a deadlock. This function should block - * until a thread can gain possession of the mutex. - * - * Return non-zero if the mutex was grabbed, zero if there was an - * unrecoverable problem grabbing it (this should not be a matter of - * timing out! We're talking major system errors; block until the mutex - * is available otherwise.) - * - * _DO NOT_ call PHYSFS_setErrorCode() in here! Since setErrorCode calls this - * function, you'll cause an infinite recursion. This means you can't - * use the BAIL_*MACRO* macros, either. - */ -int __PHYSFS_platformGrabMutex(void *mutex); - -/* - * Relinquish possession of the mutex when this method has been called - * once for each time that platformGrabMutex was called. Once possession has - * been released, the next thread in line to grab the mutex (if any) may - * proceed. - * - * _DO NOT_ call PHYSFS_setErrorCode() in here! Since setErrorCode calls this - * function, you'll cause an infinite recursion. This means you can't - * use the BAIL_*MACRO* macros, either. - */ -void __PHYSFS_platformReleaseMutex(void *mutex); - -#if PHYSFS_HAVE_PRAGMA_VISIBILITY -#pragma GCC visibility pop -#endif - -#ifdef __cplusplus -} -#endif - -#endif - -/* end of physfs_internal.h ... */ - diff --git a/love/src/jni/love/src/libraries/physfs/physfs_lzmasdk.h b/love/src/jni/love/src/libraries/physfs/physfs_lzmasdk.h deleted file mode 100644 index c86972e5..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_lzmasdk.h +++ /dev/null @@ -1,6028 +0,0 @@ -#ifndef _INCLUDE_PHYSFS_LZMASDK_H_ -#define _INCLUDE_PHYSFS_LZMASDK_H_ - -/* This is just a bunch of the LZMA SDK mushed together into one header. -This code is all public domain, and mostly (if not entirely) written by -Igor Pavlov. http://www.7-zip.org/sdk.html ---ryan. */ - - - -/* 7zTypes.h -- Basic types -2013-11-12 : Igor Pavlov : Public domain */ - -#ifndef __7Z_TYPES_H -#define __7Z_TYPES_H - -#ifdef _WIN32 -/* #include */ -#endif - -#include - -#ifndef EXTERN_C_BEGIN -#ifdef __cplusplus -#define EXTERN_C_BEGIN extern "C" { -#define EXTERN_C_END } -#else -#define EXTERN_C_BEGIN -#define EXTERN_C_END -#endif -#endif - -EXTERN_C_BEGIN - -#define SZ_OK 0 - -#define SZ_ERROR_DATA 1 -#define SZ_ERROR_MEM 2 -#define SZ_ERROR_CRC 3 -#define SZ_ERROR_UNSUPPORTED 4 -#define SZ_ERROR_PARAM 5 -#define SZ_ERROR_INPUT_EOF 6 -#define SZ_ERROR_OUTPUT_EOF 7 -#define SZ_ERROR_READ 8 -#define SZ_ERROR_WRITE 9 -#define SZ_ERROR_PROGRESS 10 -#define SZ_ERROR_FAIL 11 -#define SZ_ERROR_THREAD 12 - -#define SZ_ERROR_ARCHIVE 16 -#define SZ_ERROR_NO_ARCHIVE 17 - -typedef int SRes; - -#ifdef _WIN32 -/* typedef DWORD WRes; */ -typedef unsigned WRes; -#else -typedef int WRes; -#endif - -#ifndef RINOK -#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; } -#endif - -typedef unsigned char Byte; -typedef short Int16; -typedef unsigned short UInt16; - -#ifdef _LZMA_UINT32_IS_ULONG -typedef long Int32; -typedef unsigned long UInt32; -#else -typedef int Int32; -typedef unsigned int UInt32; -#endif - -#ifdef _SZ_NO_INT_64 - -/* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers. - NOTES: Some code will work incorrectly in that case! */ - -typedef long Int64; -typedef unsigned long UInt64; - -#else - -#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__) -typedef __int64 Int64; -typedef unsigned __int64 UInt64; -#define UINT64_CONST(n) n ## ui64 -#else -typedef long long int Int64; -typedef unsigned long long int UInt64; -#define UINT64_CONST(n) n ## ULL -#endif - -#endif - -#ifdef _LZMA_NO_SYSTEM_SIZE_T -typedef UInt32 SizeT; -#else -typedef size_t SizeT; -#endif - -typedef int Bool; -#define True 1 -#define False 0 - - -#ifdef _WIN32 -#define MY_STD_CALL __stdcall -#else -#define MY_STD_CALL -#endif - -#ifdef _MSC_VER - -#if _MSC_VER >= 1300 -#define MY_NO_INLINE __declspec(noinline) -#else -#define MY_NO_INLINE -#endif - -#define MY_CDECL __cdecl -#define MY_FAST_CALL __fastcall - -#else - -#define MY_NO_INLINE -#define MY_CDECL -#define MY_FAST_CALL - -#endif - - -/* The following interfaces use first parameter as pointer to structure */ - -typedef struct -{ - Byte (*Read)(void *p); /* reads one byte, returns 0 in case of EOF or error */ -} IByteIn; - -typedef struct -{ - void (*Write)(void *p, Byte b); -} IByteOut; - -typedef struct -{ - SRes (*Read)(void *p, void *buf, size_t *size); - /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream. - (output(*size) < input(*size)) is allowed */ -} ISeqInStream; - -typedef struct -{ - size_t (*Write)(void *p, const void *buf, size_t size); - /* Returns: result - the number of actually written bytes. - (result < size) means error */ -} ISeqOutStream; - -typedef enum -{ - SZ_SEEK_SET = 0, - SZ_SEEK_CUR = 1, - SZ_SEEK_END = 2 -} ESzSeek; - -typedef struct -{ - SRes (*Read)(void *p, void *buf, size_t *size); /* same as ISeqInStream::Read */ - SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin); -} ISeekInStream; - -typedef struct -{ - SRes (*Look)(void *p, const void **buf, size_t *size); - /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream. - (output(*size) > input(*size)) is not allowed - (output(*size) < input(*size)) is allowed */ - SRes (*Skip)(void *p, size_t offset); - /* offset must be <= output(*size) of Look */ - - SRes (*Read)(void *p, void *buf, size_t *size); - /* reads directly (without buffer). It's same as ISeqInStream::Read */ - SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin); -} ILookInStream; - -static SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset); - -/* reads via ILookInStream::Read */ -static SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType); -static SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size); - -#define LookToRead_BUF_SIZE (1 << 14) - -typedef struct -{ - ILookInStream s; - ISeekInStream *realStream; - size_t pos; - size_t size; - Byte buf[LookToRead_BUF_SIZE]; -} CLookToRead; - -static void LookToRead_CreateVTable(CLookToRead *p, int lookahead); -static void LookToRead_Init(CLookToRead *p); - -typedef struct -{ - ISeqInStream s; - ILookInStream *realStream; -} CSecToLook; - -typedef struct -{ - ISeqInStream s; - ILookInStream *realStream; -} CSecToRead; - -typedef struct -{ - SRes (*Progress)(void *p, UInt64 inSize, UInt64 outSize); - /* Returns: result. (result != SZ_OK) means break. - Value (UInt64)(Int64)-1 for size means unknown value. */ -} ICompressProgress; - -typedef struct -{ - void *(*Alloc)(void *p, size_t size); - void (*Free)(void *p, void *address); /* address can be 0 */ -} ISzAlloc; - -#define IAlloc_Alloc(p, size) (p)->Alloc((p), size) -#define IAlloc_Free(p, a) (p)->Free((p), a) - -#ifdef _WIN32 - -#define CHAR_PATH_SEPARATOR '\\' -#define WCHAR_PATH_SEPARATOR L'\\' -#define STRING_PATH_SEPARATOR "\\" -#define WSTRING_PATH_SEPARATOR L"\\" - -#else - -#define CHAR_PATH_SEPARATOR '/' -#define WCHAR_PATH_SEPARATOR L'/' -#define STRING_PATH_SEPARATOR "/" -#define WSTRING_PATH_SEPARATOR L"/" - -#endif - -EXTERN_C_END - -#endif - -/* 7z.h -- 7z interface -2015-11-18 : Igor Pavlov : Public domain */ - -#ifndef __7Z_H -#define __7Z_H - -/*#include "7zTypes.h"*/ - -EXTERN_C_BEGIN - -#define k7zStartHeaderSize 0x20 -#define k7zSignatureSize 6 - -static const Byte k7zSignature[k7zSignatureSize]; - -typedef struct -{ - const Byte *Data; - size_t Size; -} CSzData; - -/* CSzCoderInfo & CSzFolder support only default methods */ - -typedef struct -{ - size_t PropsOffset; - UInt32 MethodID; - Byte NumStreams; - Byte PropsSize; -} CSzCoderInfo; - -typedef struct -{ - UInt32 InIndex; - UInt32 OutIndex; -} CSzBond; - -#define SZ_NUM_CODERS_IN_FOLDER_MAX 4 -#define SZ_NUM_BONDS_IN_FOLDER_MAX 3 -#define SZ_NUM_PACK_STREAMS_IN_FOLDER_MAX 4 - -typedef struct -{ - UInt32 NumCoders; - UInt32 NumBonds; - UInt32 NumPackStreams; - UInt32 UnpackStream; - UInt32 PackStreams[SZ_NUM_PACK_STREAMS_IN_FOLDER_MAX]; - CSzBond Bonds[SZ_NUM_BONDS_IN_FOLDER_MAX]; - CSzCoderInfo Coders[SZ_NUM_CODERS_IN_FOLDER_MAX]; -} CSzFolder; - - -static SRes SzGetNextFolderItem(CSzFolder *f, CSzData *sd); - -typedef struct -{ - UInt32 Low; - UInt32 High; -} CNtfsFileTime; - -typedef struct -{ - Byte *Defs; /* MSB 0 bit numbering */ - UInt32 *Vals; -} CSzBitUi32s; - -typedef struct -{ - Byte *Defs; /* MSB 0 bit numbering */ - /* UInt64 *Vals; */ - CNtfsFileTime *Vals; -} CSzBitUi64s; - -#define SzBitArray_Check(p, i) (((p)[(i) >> 3] & (0x80 >> ((i) & 7))) != 0) - -#define SzBitWithVals_Check(p, i) ((p)->Defs && ((p)->Defs[(i) >> 3] & (0x80 >> ((i) & 7))) != 0) - -typedef struct -{ - UInt32 NumPackStreams; - UInt32 NumFolders; - - UInt64 *PackPositions; /* NumPackStreams + 1 */ - CSzBitUi32s FolderCRCs; /* NumFolders */ - - size_t *FoCodersOffsets; /* NumFolders + 1 */ - UInt32 *FoStartPackStreamIndex; /* NumFolders + 1 */ - UInt32 *FoToCoderUnpackSizes; /* NumFolders + 1 */ - Byte *FoToMainUnpackSizeIndex; /* NumFolders */ - UInt64 *CoderUnpackSizes; /* for all coders in all folders */ - - Byte *CodersData; -} CSzAr; - -static UInt64 SzAr_GetFolderUnpackSize(const CSzAr *p, UInt32 folderIndex); - -static SRes SzAr_DecodeFolder(const CSzAr *p, UInt32 folderIndex, - ILookInStream *stream, UInt64 startPos, - Byte *outBuffer, size_t outSize, - ISzAlloc *allocMain); - -typedef struct -{ - CSzAr db; - - UInt64 startPosAfterHeader; - UInt64 dataPos; - - UInt32 NumFiles; - - UInt64 *UnpackPositions; /* NumFiles + 1 */ - /* Byte *IsEmptyFiles; */ - Byte *IsDirs; - CSzBitUi32s CRCs; - - CSzBitUi32s Attribs; - /* CSzBitUi32s Parents; */ - CSzBitUi64s MTime; - CSzBitUi64s CTime; - - UInt32 *FolderToFile; /* NumFolders + 1 */ - UInt32 *FileToFolder; /* NumFiles */ - - size_t *FileNameOffsets; /* in 2-byte steps */ - Byte *FileNames; /* UTF-16-LE */ -} CSzArEx; - -#define SzArEx_IsDir(p, i) (SzBitArray_Check((p)->IsDirs, i)) - -#define SzArEx_GetFileSize(p, i) ((p)->UnpackPositions[(i) + 1] - (p)->UnpackPositions[i]) - -static void SzArEx_Init(CSzArEx *p); -static void SzArEx_Free(CSzArEx *p, ISzAlloc *alloc); - -/* -if dest == NULL, the return value specifies the required size of the buffer, - in 16-bit characters, including the null-terminating character. -if dest != NULL, the return value specifies the number of 16-bit characters that - are written to the dest, including the null-terminating character. */ - -static size_t SzArEx_GetFileNameUtf16(const CSzArEx *p, size_t fileIndex, UInt16 *dest); - -/* -size_t SzArEx_GetFullNameLen(const CSzArEx *p, size_t fileIndex); -UInt16 *SzArEx_GetFullNameUtf16_Back(const CSzArEx *p, size_t fileIndex, UInt16 *dest); -*/ - - - -/* - SzArEx_Extract extracts file from archive - - *outBuffer must be 0 before first call for each new archive. - - Extracting cache: - If you need to decompress more than one file, you can send - these values from previous call: - *blockIndex, - *outBuffer, - *outBufferSize - You can consider "*outBuffer" as cache of solid block. If your archive is solid, - it will increase decompression speed. - - If you use external function, you can declare these 3 cache variables - (blockIndex, outBuffer, outBufferSize) as static in that external function. - - Free *outBuffer and set *outBuffer to 0, if you want to flush cache. -*/ - -static SRes SzArEx_Extract( - const CSzArEx *db, - ILookInStream *inStream, - UInt32 fileIndex, /* index of file */ - UInt32 *blockIndex, /* index of solid block */ - Byte **outBuffer, /* pointer to pointer to output buffer (allocated with allocMain) */ - size_t *outBufferSize, /* buffer size for output buffer */ - size_t *offset, /* offset of stream for required file in *outBuffer */ - size_t *outSizeProcessed, /* size of file in *outBuffer */ - ISzAlloc *allocMain, - ISzAlloc *allocTemp); - - -/* -SzArEx_Open Errors: -SZ_ERROR_NO_ARCHIVE -SZ_ERROR_ARCHIVE -SZ_ERROR_UNSUPPORTED -SZ_ERROR_MEM -SZ_ERROR_CRC -SZ_ERROR_INPUT_EOF -SZ_ERROR_FAIL -*/ - -static SRes SzArEx_Open(CSzArEx *p, ILookInStream *inStream, - ISzAlloc *allocMain, ISzAlloc *allocTemp); - -EXTERN_C_END - -#endif - -/* 7zCrc.h -- CRC32 calculation -2013-01-18 : Igor Pavlov : Public domain */ - -#ifndef __7Z_CRC_H -#define __7Z_CRC_H - -/*#include "7zTypes.h" */ - -EXTERN_C_BEGIN - -/* Call CrcGenerateTable one time before other CRC functions */ -static void MY_FAST_CALL CrcGenerateTable(void); - -#define CRC_INIT_VAL 0xFFFFFFFF -#define CRC_GET_DIGEST(crc) ((crc) ^ CRC_INIT_VAL) -#define CRC_UPDATE_BYTE(crc, b) (g_CrcTable[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) - -static UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size); - -EXTERN_C_END - -#endif - -/* CpuArch.h -- CPU specific code -2016-06-09: Igor Pavlov : Public domain */ - -#ifndef __CPU_ARCH_H -#define __CPU_ARCH_H - -/*#include "7zTypes.h"*/ - -EXTERN_C_BEGIN - -/* -MY_CPU_LE means that CPU is LITTLE ENDIAN. -MY_CPU_BE means that CPU is BIG ENDIAN. -If MY_CPU_LE and MY_CPU_BE are not defined, we don't know about ENDIANNESS of platform. - -MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned memory accesses. -*/ - -#if defined(_M_X64) \ - || defined(_M_AMD64) \ - || defined(__x86_64__) \ - || defined(__AMD64__) \ - || defined(__amd64__) - #define MY_CPU_AMD64 -#endif - -#if defined(MY_CPU_AMD64) \ - || defined(_M_IA64) \ - || defined(__AARCH64EL__) \ - || defined(__AARCH64EB__) - #define MY_CPU_64BIT -#endif - -#if defined(_M_IX86) || defined(__i386__) -#define MY_CPU_X86 -#endif - -#if defined(MY_CPU_X86) || defined(MY_CPU_AMD64) -#define MY_CPU_X86_OR_AMD64 -#endif - -#if defined(MY_CPU_X86) \ - || defined(_M_ARM) \ - || defined(__ARMEL__) \ - || defined(__THUMBEL__) \ - || defined(__ARMEB__) \ - || defined(__THUMBEB__) - #define MY_CPU_32BIT -#endif - -#if defined(_WIN32) && defined(_M_ARM) -#define MY_CPU_ARM_LE -#endif - -#if defined(_WIN32) && defined(_M_IA64) -#define MY_CPU_IA64_LE -#endif - -#if defined(MY_CPU_X86_OR_AMD64) \ - || defined(MY_CPU_ARM_LE) \ - || defined(MY_CPU_IA64_LE) \ - || defined(__LITTLE_ENDIAN__) \ - || defined(__ARMEL__) \ - || defined(__THUMBEL__) \ - || defined(__AARCH64EL__) \ - || defined(__MIPSEL__) \ - || defined(__MIPSEL) \ - || defined(_MIPSEL) \ - || defined(__BFIN__) \ - || (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) - #define MY_CPU_LE -#endif - -#if defined(__BIG_ENDIAN__) \ - || defined(__ARMEB__) \ - || defined(__THUMBEB__) \ - || defined(__AARCH64EB__) \ - || defined(__MIPSEB__) \ - || defined(__MIPSEB) \ - || defined(_MIPSEB) \ - || defined(__m68k__) \ - || defined(__s390__) \ - || defined(__s390x__) \ - || defined(__zarch__) \ - || (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)) - #define MY_CPU_BE -#endif - -#if defined(MY_CPU_LE) && defined(MY_CPU_BE) -Stop_Compiling_Bad_Endian -#endif - - -#ifdef MY_CPU_LE - #if defined(MY_CPU_X86_OR_AMD64) \ - /* || defined(__AARCH64EL__) */ - /*#define MY_CPU_LE_UNALIGN*/ - #endif -#endif - - -#ifdef MY_CPU_LE_UNALIGN - -#define GetUi16(p) (*(const UInt16 *)(const void *)(p)) -#define GetUi32(p) (*(const UInt32 *)(const void *)(p)) -#define GetUi64(p) (*(const UInt64 *)(const void *)(p)) - -#define SetUi16(p, v) { *(UInt16 *)(p) = (v); } -#define SetUi32(p, v) { *(UInt32 *)(p) = (v); } -#define SetUi64(p, v) { *(UInt64 *)(p) = (v); } - -#else - -#define GetUi16(p) ( (UInt16) ( \ - ((const Byte *)(p))[0] | \ - ((UInt16)((const Byte *)(p))[1] << 8) )) - -#define GetUi32(p) ( \ - ((const Byte *)(p))[0] | \ - ((UInt32)((const Byte *)(p))[1] << 8) | \ - ((UInt32)((const Byte *)(p))[2] << 16) | \ - ((UInt32)((const Byte *)(p))[3] << 24)) - -#define GetUi64(p) (GetUi32(p) | ((UInt64)GetUi32(((const Byte *)(p)) + 4) << 32)) - -#define SetUi16(p, v) { Byte *_ppp_ = (Byte *)(p); UInt32 _vvv_ = (v); \ - _ppp_[0] = (Byte)_vvv_; \ - _ppp_[1] = (Byte)(_vvv_ >> 8); } - -#define SetUi32(p, v) { Byte *_ppp_ = (Byte *)(p); UInt32 _vvv_ = (v); \ - _ppp_[0] = (Byte)_vvv_; \ - _ppp_[1] = (Byte)(_vvv_ >> 8); \ - _ppp_[2] = (Byte)(_vvv_ >> 16); \ - _ppp_[3] = (Byte)(_vvv_ >> 24); } - -#define SetUi64(p, v) { Byte *_ppp2_ = (Byte *)(p); UInt64 _vvv2_ = (v); \ - SetUi32(_ppp2_ , (UInt32)_vvv2_); \ - SetUi32(_ppp2_ + 4, (UInt32)(_vvv2_ >> 32)); } - -#endif - - -#if defined(MY_CPU_LE_UNALIGN) && /* defined(_WIN64) && */ (_MSC_VER >= 1300) - -/* Note: we use bswap instruction, that is unsupported in 386 cpu */ - -#include - -#pragma intrinsic(_byteswap_ulong) -#pragma intrinsic(_byteswap_uint64) -#define GetBe32(p) _byteswap_ulong(*(const UInt32 *)(const Byte *)(p)) -#define GetBe64(p) _byteswap_uint64(*(const UInt64 *)(const Byte *)(p)) - -#define SetBe32(p, v) (*(UInt32 *)(void *)(p)) = _byteswap_ulong(v) - -#elif defined(MY_CPU_LE_UNALIGN) && defined (__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) - -#define GetBe32(p) __builtin_bswap32(*(const UInt32 *)(const Byte *)(p)) -#define GetBe64(p) __builtin_bswap64(*(const UInt64 *)(const Byte *)(p)) - -#define SetBe32(p, v) (*(UInt32 *)(void *)(p)) = __builtin_bswap32(v) - -#else - -#define GetBe32(p) ( \ - ((UInt32)((const Byte *)(p))[0] << 24) | \ - ((UInt32)((const Byte *)(p))[1] << 16) | \ - ((UInt32)((const Byte *)(p))[2] << 8) | \ - ((const Byte *)(p))[3] ) - -#define GetBe64(p) (((UInt64)GetBe32(p) << 32) | GetBe32(((const Byte *)(p)) + 4)) - -#define SetBe32(p, v) { Byte *_ppp_ = (Byte *)(p); UInt32 _vvv_ = (v); \ - _ppp_[0] = (Byte)(_vvv_ >> 24); \ - _ppp_[1] = (Byte)(_vvv_ >> 16); \ - _ppp_[2] = (Byte)(_vvv_ >> 8); \ - _ppp_[3] = (Byte)_vvv_; } - -#endif - - -#define GetBe16(p) ( (UInt16) ( \ - ((UInt16)((const Byte *)(p))[0] << 8) | \ - ((const Byte *)(p))[1] )) - - - -#ifdef MY_CPU_X86_OR_AMD64 - -typedef struct -{ - UInt32 maxFunc; - UInt32 vendor[3]; - UInt32 ver; - UInt32 b; - UInt32 c; - UInt32 d; -} Cx86cpuid; - -enum -{ - CPU_FIRM_INTEL, - CPU_FIRM_AMD, - CPU_FIRM_VIA -}; - -static void MyCPUID(UInt32 function, UInt32 *a, UInt32 *b, UInt32 *c, UInt32 *d); - -static Bool x86cpuid_CheckAndRead(Cx86cpuid *p); -static int x86cpuid_GetFirm(const Cx86cpuid *p); - -#define x86cpuid_GetFamily(ver) (((ver >> 16) & 0xFF0) | ((ver >> 8) & 0xF)) -#define x86cpuid_GetModel(ver) (((ver >> 12) & 0xF0) | ((ver >> 4) & 0xF)) -#define x86cpuid_GetStepping(ver) (ver & 0xF) - -static Bool CPU_Is_InOrder(); - -#endif - -EXTERN_C_END - -#endif - -/* 7zBuf.h -- Byte Buffer -2013-01-18 : Igor Pavlov : Public domain */ - -#ifndef __7Z_BUF_H -#define __7Z_BUF_H - -/*#include "7zTypes.h" */ - -EXTERN_C_BEGIN - -typedef struct -{ - Byte *data; - size_t size; -} CBuf; - -static void Buf_Init(CBuf *p); -static int Buf_Create(CBuf *p, size_t size, ISzAlloc *alloc); -static void Buf_Free(CBuf *p, ISzAlloc *alloc); - -EXTERN_C_END - -#endif - - -/* Bcj2.h -- BCJ2 Converter for x86 code -2014-11-10 : Igor Pavlov : Public domain */ - -#ifndef __BCJ2_H -#define __BCJ2_H - -/*#include "7zTypes.h" */ - -EXTERN_C_BEGIN - -#define BCJ2_NUM_STREAMS 4 - -enum -{ - BCJ2_STREAM_MAIN, - BCJ2_STREAM_CALL, - BCJ2_STREAM_JUMP, - BCJ2_STREAM_RC -}; - -enum -{ - BCJ2_DEC_STATE_ORIG_0 = BCJ2_NUM_STREAMS, - BCJ2_DEC_STATE_ORIG_1, - BCJ2_DEC_STATE_ORIG_2, - BCJ2_DEC_STATE_ORIG_3, - - BCJ2_DEC_STATE_ORIG, - BCJ2_DEC_STATE_OK -}; - -enum -{ - BCJ2_ENC_STATE_ORIG = BCJ2_NUM_STREAMS, - BCJ2_ENC_STATE_OK -}; - - -#define BCJ2_IS_32BIT_STREAM(s) ((s) == BCJ2_STREAM_CALL || (s) == BCJ2_STREAM_JUMP) - -/* -CBcj2Dec / CBcj2Enc -bufs sizes: - BUF_SIZE(n) = lims[n] - bufs[n] -bufs sizes for BCJ2_STREAM_CALL and BCJ2_STREAM_JUMP must be mutliply of 4: - (BUF_SIZE(BCJ2_STREAM_CALL) & 3) == 0 - (BUF_SIZE(BCJ2_STREAM_JUMP) & 3) == 0 -*/ - -/* -CBcj2Dec: -dest is allowed to overlap with bufs[BCJ2_STREAM_MAIN], with the following conditions: - bufs[BCJ2_STREAM_MAIN] >= dest && - bufs[BCJ2_STREAM_MAIN] - dest >= tempReserv + - BUF_SIZE(BCJ2_STREAM_CALL) + - BUF_SIZE(BCJ2_STREAM_JUMP) - tempReserv = 0 : for first call of Bcj2Dec_Decode - tempReserv = 4 : for any other calls of Bcj2Dec_Decode - overlap with offset = 1 is not allowed -*/ - -typedef struct -{ - const Byte *bufs[BCJ2_NUM_STREAMS]; - const Byte *lims[BCJ2_NUM_STREAMS]; - Byte *dest; - const Byte *destLim; - - unsigned state; /* BCJ2_STREAM_MAIN has more priority than BCJ2_STATE_ORIG */ - - UInt32 ip; - Byte temp[4]; - UInt32 range; - UInt32 code; - UInt16 probs[2 + 256]; -} CBcj2Dec; - -static void Bcj2Dec_Init(CBcj2Dec *p); - -/* Returns: SZ_OK or SZ_ERROR_DATA */ -static SRes Bcj2Dec_Decode(CBcj2Dec *p); - -#define Bcj2Dec_IsFinished(_p_) ((_p_)->code == 0) - -#define BCJ2_RELAT_LIMIT_NUM_BITS 26 -#define BCJ2_RELAT_LIMIT ((UInt32)1 << BCJ2_RELAT_LIMIT_NUM_BITS) - -/* limit for CBcj2Enc::fileSize variable */ -#define BCJ2_FileSize_MAX ((UInt32)1 << 31) - -EXTERN_C_END - -#endif - -/* Bra.h -- Branch converters for executables -2013-01-18 : Igor Pavlov : Public domain */ - -#ifndef __BRA_H -#define __BRA_H - -/*#include "7zTypes.h"*/ - -EXTERN_C_BEGIN - -/* -These functions convert relative addresses to absolute addresses -in CALL instructions to increase the compression ratio. - - In: - data - data buffer - size - size of data - ip - current virtual Instruction Pinter (IP) value - state - state variable for x86 converter - encoding - 0 (for decoding), 1 (for encoding) - - Out: - state - state variable for x86 converter - - Returns: - The number of processed bytes. If you call these functions with multiple calls, - you must start next call with first byte after block of processed bytes. - - Type Endian Alignment LookAhead - - x86 little 1 4 - ARMT little 2 2 - ARM little 4 0 - PPC big 4 0 - SPARC big 4 0 - IA64 little 16 0 - - size must be >= Alignment + LookAhead, if it's not last block. - If (size < Alignment + LookAhead), converter returns 0. - - Example: - - UInt32 ip = 0; - for () - { - ; size must be >= Alignment + LookAhead, if it's not last block - SizeT processed = Convert(data, size, ip, 1); - data += processed; - size -= processed; - ip += processed; - } -*/ - -#define x86_Convert_Init(state) { state = 0; } -static SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding); -static SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); -static SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); -static SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); -static SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); -static SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); - -EXTERN_C_END - -#endif - -/* Delta.h -- Delta converter -2013-01-18 : Igor Pavlov : Public domain */ - -#ifndef __DELTA_H -#define __DELTA_H - -/*#include "7zTypes.h" */ - -EXTERN_C_BEGIN - -#define DELTA_STATE_SIZE 256 - -static void Delta_Init(Byte *state); -static void Delta_Decode(Byte *state, unsigned delta, Byte *data, SizeT size); - -EXTERN_C_END - -#endif - -/* LzmaDec.h -- LZMA Decoder -2013-01-18 : Igor Pavlov : Public domain */ - -#ifndef __LZMA_DEC_H -#define __LZMA_DEC_H - -/*#include "7zTypes.h"*/ - -EXTERN_C_BEGIN - -/* #define _LZMA_PROB32 */ -/* _LZMA_PROB32 can increase the speed on some CPUs, - but memory usage for CLzmaDec::probs will be doubled in that case */ - -#ifdef _LZMA_PROB32 -#define CLzmaProb UInt32 -#else -#define CLzmaProb UInt16 -#endif - - -/* ---------- LZMA Properties ---------- */ - -#define LZMA_PROPS_SIZE 5 - -typedef struct _CLzmaProps -{ - unsigned lc, lp, pb; - UInt32 dicSize; -} CLzmaProps; - -/* LzmaProps_Decode - decodes properties -Returns: - SZ_OK - SZ_ERROR_UNSUPPORTED - Unsupported properties -*/ - -static SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size); - - -/* ---------- LZMA Decoder state ---------- */ - -/* LZMA_REQUIRED_INPUT_MAX = number of required input bytes for worst case. - Num bits = log2((2^11 / 31) ^ 22) + 26 < 134 + 26 = 160; */ - -#define LZMA_REQUIRED_INPUT_MAX 20 - -typedef struct -{ - CLzmaProps prop; - CLzmaProb *probs; - Byte *dic; - const Byte *buf; - UInt32 range, code; - SizeT dicPos; - SizeT dicBufSize; - UInt32 processedPos; - UInt32 checkDicSize; - unsigned state; - UInt32 reps[4]; - unsigned remainLen; - int needFlush; - int needInitState; - UInt32 numProbs; - unsigned tempBufSize; - Byte tempBuf[LZMA_REQUIRED_INPUT_MAX]; -} CLzmaDec; - -#define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; } - -static void LzmaDec_Init(CLzmaDec *p); - -/* There are two types of LZMA streams: - 0) Stream with end mark. That end mark adds about 6 bytes to compressed size. - 1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */ - -typedef enum -{ - LZMA_FINISH_ANY, /* finish at any point */ - LZMA_FINISH_END /* block must be finished at the end */ -} ELzmaFinishMode; - -/* ELzmaFinishMode has meaning only if the decoding reaches output limit !!! - - You must use LZMA_FINISH_END, when you know that current output buffer - covers last bytes of block. In other cases you must use LZMA_FINISH_ANY. - - If LZMA decoder sees end marker before reaching output limit, it returns SZ_OK, - and output value of destLen will be less than output buffer size limit. - You can check status result also. - - You can use multiple checks to test data integrity after full decompression: - 1) Check Result and "status" variable. - 2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize. - 3) Check that output(srcLen) = compressedSize, if you know real compressedSize. - You must use correct finish mode in that case. */ - -typedef enum -{ - LZMA_STATUS_NOT_SPECIFIED, /* use main error code instead */ - LZMA_STATUS_FINISHED_WITH_MARK, /* stream was finished with end mark. */ - LZMA_STATUS_NOT_FINISHED, /* stream was not finished */ - LZMA_STATUS_NEEDS_MORE_INPUT, /* you must provide more input bytes */ - LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK /* there is probability that stream was finished without end mark */ -} ELzmaStatus; - -/* ELzmaStatus is used only as output value for function call */ - - -/* ---------- Interfaces ---------- */ - -/* There are 3 levels of interfaces: - 1) Dictionary Interface - 2) Buffer Interface - 3) One Call Interface - You can select any of these interfaces, but don't mix functions from different - groups for same object. */ - - -/* There are two variants to allocate state for Dictionary Interface: - 1) LzmaDec_Allocate / LzmaDec_Free - 2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs - You can use variant 2, if you set dictionary buffer manually. - For Buffer Interface you must always use variant 1. - -LzmaDec_Allocate* can return: - SZ_OK - SZ_ERROR_MEM - Memory allocation error - SZ_ERROR_UNSUPPORTED - Unsupported properties -*/ - -static SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc); -static void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc); - -/* ---------- Dictionary Interface ---------- */ - -/* You can use it, if you want to eliminate the overhead for data copying from - dictionary to some other external buffer. - You must work with CLzmaDec variables directly in this interface. - - STEPS: - LzmaDec_Constr() - LzmaDec_Allocate() - for (each new stream) - { - LzmaDec_Init() - while (it needs more decompression) - { - LzmaDec_DecodeToDic() - use data from CLzmaDec::dic and update CLzmaDec::dicPos - } - } - LzmaDec_Free() -*/ - -/* LzmaDec_DecodeToDic - - The decoding to internal dictionary buffer (CLzmaDec::dic). - You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!! - -finishMode: - It has meaning only if the decoding reaches output limit (dicLimit). - LZMA_FINISH_ANY - Decode just dicLimit bytes. - LZMA_FINISH_END - Stream must be finished after dicLimit. - -Returns: - SZ_OK - status: - LZMA_STATUS_FINISHED_WITH_MARK - LZMA_STATUS_NOT_FINISHED - LZMA_STATUS_NEEDS_MORE_INPUT - LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK - SZ_ERROR_DATA - Data error -*/ - -static SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, - const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); - -EXTERN_C_END - -#endif - -/* Lzma2Dec.h -- LZMA2 Decoder -2015-05-13 : Igor Pavlov : Public domain */ - -#ifndef __LZMA2_DEC_H -#define __LZMA2_DEC_H - -/*#include "LzmaDec.h"*/ - -EXTERN_C_BEGIN - -/* ---------- State Interface ---------- */ - -typedef struct -{ - CLzmaDec decoder; - UInt32 packSize; - UInt32 unpackSize; - unsigned state; - Byte control; - Bool needInitDic; - Bool needInitState; - Bool needInitProp; -} CLzma2Dec; - -#define Lzma2Dec_Construct(p) LzmaDec_Construct(&(p)->decoder) -#define Lzma2Dec_FreeProbs(p, alloc) LzmaDec_FreeProbs(&(p)->decoder, alloc); -#define Lzma2Dec_Free(p, alloc) LzmaDec_Free(&(p)->decoder, alloc); - -static SRes Lzma2Dec_AllocateProbs(CLzma2Dec *p, Byte prop, ISzAlloc *alloc); -static void Lzma2Dec_Init(CLzma2Dec *p); - - -/* -finishMode: - It has meaning only if the decoding reaches output limit (*destLen or dicLimit). - LZMA_FINISH_ANY - use smallest number of input bytes - LZMA_FINISH_END - read EndOfStream marker after decoding - -Returns: - SZ_OK - status: - LZMA_STATUS_FINISHED_WITH_MARK - LZMA_STATUS_NOT_FINISHED - LZMA_STATUS_NEEDS_MORE_INPUT - SZ_ERROR_DATA - Data error -*/ - -static SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, SizeT dicLimit, - const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); - - -EXTERN_C_END - -#endif - - -/* END HEADERS */ - - -/* 7zCrc.c -- CRC32 init -2015-03-10 : Igor Pavlov : Public domain */ - -/* -#include "Precomp.h" - -#include "7zCrc.h" -#include "CpuArch.h" -*/ -#define UNUSED_VAR(x) (void)x; - -#define kCrcPoly 0xEDB88320 - -#ifdef MY_CPU_LE - #define CRC_NUM_TABLES 8 -#else - #define CRC_NUM_TABLES 9 - - #define CRC_UINT32_SWAP(v) ((v >> 24) | ((v >> 8) & 0xFF00) | ((v << 8) & 0xFF0000) | (v << 24)) - - static UInt32 MY_FAST_CALL CrcUpdateT1_BeT4(UInt32 v, const void *data, size_t size, const UInt32 *table); - static UInt32 MY_FAST_CALL CrcUpdateT1_BeT8(UInt32 v, const void *data, size_t size, const UInt32 *table); -#endif - -#ifndef MY_CPU_BE - static UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table); - static UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table); -#endif - -typedef UInt32 (MY_FAST_CALL *CRC_FUNC)(UInt32 v, const void *data, size_t size, const UInt32 *table); - -static CRC_FUNC g_CrcUpdateT4; -static CRC_FUNC g_CrcUpdateT8; -static CRC_FUNC g_CrcUpdate; - -static UInt32 g_CrcTable[256 * CRC_NUM_TABLES]; - -static UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size) -{ - return g_CrcUpdate(CRC_INIT_VAL, data, size, g_CrcTable) ^ CRC_INIT_VAL; -} - -#define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) - -#if CRC_NUM_TABLES < 4 -static UInt32 MY_FAST_CALL CrcUpdateT1(UInt32 v, const void *data, size_t size, const UInt32 *table) -{ - const Byte *p = (const Byte *)data; - const Byte *pEnd = p + size; - for (; p != pEnd; p++) - v = CRC_UPDATE_BYTE_2(v, *p); - return v; -} -#endif - -static void MY_FAST_CALL CrcGenerateTable() -{ - UInt32 i; - for (i = 0; i < 256; i++) - { - UInt32 r = i; - unsigned j; - for (j = 0; j < 8; j++) - r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1)); - g_CrcTable[i] = r; - } - for (; i < 256 * CRC_NUM_TABLES; i++) - { - UInt32 r = g_CrcTable[i - 256]; - g_CrcTable[i] = g_CrcTable[r & 0xFF] ^ (r >> 8); - } - - #if CRC_NUM_TABLES < 4 - - g_CrcUpdate = CrcUpdateT1; - - #else - - #ifdef MY_CPU_LE - - g_CrcUpdateT4 = CrcUpdateT4; - g_CrcUpdate = CrcUpdateT4; - - #if CRC_NUM_TABLES >= 8 - g_CrcUpdateT8 = CrcUpdateT8; - - #ifdef MY_CPU_X86_OR_AMD64 - if (!CPU_Is_InOrder()) - g_CrcUpdate = CrcUpdateT8; - #endif - #endif - - #else - { - #ifndef MY_CPU_BE - UInt32 k = 0x01020304; - const Byte *p = (const Byte *)&k; - if (p[0] == 4 && p[1] == 3) - { - g_CrcUpdateT4 = CrcUpdateT4; - g_CrcUpdate = CrcUpdateT4; - #if CRC_NUM_TABLES >= 8 - g_CrcUpdateT8 = CrcUpdateT8; - /* g_CrcUpdate = CrcUpdateT8; */ - #endif - } - else if (p[0] != 1 || p[1] != 2) - g_CrcUpdate = CrcUpdateT1; - else - #endif - { - for (i = 256 * CRC_NUM_TABLES - 1; i >= 256; i--) - { - UInt32 x = g_CrcTable[i - 256]; - g_CrcTable[i] = CRC_UINT32_SWAP(x); - } - g_CrcUpdateT4 = CrcUpdateT1_BeT4; - g_CrcUpdate = CrcUpdateT1_BeT4; - #if CRC_NUM_TABLES >= 8 - g_CrcUpdateT8 = CrcUpdateT1_BeT8; - /* g_CrcUpdate = CrcUpdateT1_BeT8; */ - #endif - } - } - #endif - - #endif -} - -/* 7zCrcOpt.c -- CRC32 calculation -2015-03-01 : Igor Pavlov : Public domain */ - -/* -#include "Precomp.h" - -#include "CpuArch.h" -*/ - -#ifndef MY_CPU_BE - -#define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) - -static UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table) -{ - const Byte *p = (const Byte *)data; - for (; size > 0 && ((unsigned)(ptrdiff_t)p & 3) != 0; size--, p++) - v = CRC_UPDATE_BYTE_2(v, *p); - for (; size >= 4; size -= 4, p += 4) - { - v ^= *(const UInt32 *)p; - v = - table[0x300 + ((v ) & 0xFF)] - ^ table[0x200 + ((v >> 8) & 0xFF)] - ^ table[0x100 + ((v >> 16) & 0xFF)] - ^ table[0x000 + ((v >> 24))]; - } - for (; size > 0; size--, p++) - v = CRC_UPDATE_BYTE_2(v, *p); - return v; -} - -static UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table) -{ - const Byte *p = (const Byte *)data; - for (; size > 0 && ((unsigned)(ptrdiff_t)p & 7) != 0; size--, p++) - v = CRC_UPDATE_BYTE_2(v, *p); - for (; size >= 8; size -= 8, p += 8) - { - UInt32 d; - v ^= *(const UInt32 *)p; - v = - table[0x700 + ((v ) & 0xFF)] - ^ table[0x600 + ((v >> 8) & 0xFF)] - ^ table[0x500 + ((v >> 16) & 0xFF)] - ^ table[0x400 + ((v >> 24))]; - d = *((const UInt32 *)p + 1); - v ^= - table[0x300 + ((d ) & 0xFF)] - ^ table[0x200 + ((d >> 8) & 0xFF)] - ^ table[0x100 + ((d >> 16) & 0xFF)] - ^ table[0x000 + ((d >> 24))]; - } - for (; size > 0; size--, p++) - v = CRC_UPDATE_BYTE_2(v, *p); - return v; -} - -#endif - - -#ifndef MY_CPU_LE - -#define CRC_UINT32_SWAP(v) ((v >> 24) | ((v >> 8) & 0xFF00) | ((v << 8) & 0xFF0000) | (v << 24)) - -#define CRC_UPDATE_BYTE_2_BE(crc, b) (table[(((crc) >> 24) ^ (b))] ^ ((crc) << 8)) - -static UInt32 MY_FAST_CALL CrcUpdateT1_BeT4(UInt32 v, const void *data, size_t size, const UInt32 *table) -{ - const Byte *p = (const Byte *)data; - table += 0x100; - v = CRC_UINT32_SWAP(v); - for (; size > 0 && ((unsigned)(ptrdiff_t)p & 3) != 0; size--, p++) - v = CRC_UPDATE_BYTE_2_BE(v, *p); - for (; size >= 4; size -= 4, p += 4) - { - v ^= *(const UInt32 *)p; - v = - table[0x000 + ((v ) & 0xFF)] - ^ table[0x100 + ((v >> 8) & 0xFF)] - ^ table[0x200 + ((v >> 16) & 0xFF)] - ^ table[0x300 + ((v >> 24))]; - } - for (; size > 0; size--, p++) - v = CRC_UPDATE_BYTE_2_BE(v, *p); - return CRC_UINT32_SWAP(v); -} - -static UInt32 MY_FAST_CALL CrcUpdateT1_BeT8(UInt32 v, const void *data, size_t size, const UInt32 *table) -{ - const Byte *p = (const Byte *)data; - table += 0x100; - v = CRC_UINT32_SWAP(v); - for (; size > 0 && ((unsigned)(ptrdiff_t)p & 7) != 0; size--, p++) - v = CRC_UPDATE_BYTE_2_BE(v, *p); - for (; size >= 8; size -= 8, p += 8) - { - UInt32 d; - v ^= *(const UInt32 *)p; - v = - table[0x400 + ((v ) & 0xFF)] - ^ table[0x500 + ((v >> 8) & 0xFF)] - ^ table[0x600 + ((v >> 16) & 0xFF)] - ^ table[0x700 + ((v >> 24))]; - d = *((const UInt32 *)p + 1); - v ^= - table[0x000 + ((d ) & 0xFF)] - ^ table[0x100 + ((d >> 8) & 0xFF)] - ^ table[0x200 + ((d >> 16) & 0xFF)] - ^ table[0x300 + ((d >> 24))]; - } - for (; size > 0; size--, p++) - v = CRC_UPDATE_BYTE_2_BE(v, *p); - return CRC_UINT32_SWAP(v); -} - -#endif - -/* CpuArch.c -- CPU specific code -2016-02-25: Igor Pavlov : Public domain */ - -/* -#include "Precomp.h" - -#include "CpuArch.h" -*/ - -#ifdef MY_CPU_X86_OR_AMD64 - -#if (defined(_MSC_VER) && !defined(MY_CPU_AMD64)) || defined(__GNUC__) -#define USE_ASM -#endif - -#if !defined(USE_ASM) && _MSC_VER >= 1500 -#include -#endif - -#if defined(USE_ASM) && !defined(MY_CPU_AMD64) -static UInt32 CheckFlag(UInt32 flag) -{ - #ifdef _MSC_VER - __asm pushfd; - __asm pop EAX; - __asm mov EDX, EAX; - __asm xor EAX, flag; - __asm push EAX; - __asm popfd; - __asm pushfd; - __asm pop EAX; - __asm xor EAX, EDX; - __asm push EDX; - __asm popfd; - __asm and flag, EAX; - #else - __asm__ __volatile__ ( - "pushf\n\t" - "pop %%EAX\n\t" - "movl %%EAX,%%EDX\n\t" - "xorl %0,%%EAX\n\t" - "push %%EAX\n\t" - "popf\n\t" - "pushf\n\t" - "pop %%EAX\n\t" - "xorl %%EDX,%%EAX\n\t" - "push %%EDX\n\t" - "popf\n\t" - "andl %%EAX, %0\n\t": - "=c" (flag) : "c" (flag) : - "%eax", "%edx"); - #endif - return flag; -} -#define CHECK_CPUID_IS_SUPPORTED if (CheckFlag(1 << 18) == 0 || CheckFlag(1 << 21) == 0) return False; -#else -#define CHECK_CPUID_IS_SUPPORTED -#endif - -#if defined(__WATCOMC__) -static void __cpuid(int *cpuinfo, const UInt32 infotype); -#pragma aux __cpuid = \ - ".586" \ - "cpuid" \ - "mov [esi+0],eax" \ - "mov [esi+4],ebx" \ - "mov [esi+8],ecx" \ - "mov [esi+12],edx" \ - parm [esi] [eax] modify [ebx ecx edx]; -#endif - - -static void MyCPUID(UInt32 function, UInt32 *a, UInt32 *b, UInt32 *c, UInt32 *d) -{ - #ifdef USE_ASM - - #ifdef _MSC_VER - - UInt32 a2, b2, c2, d2; - __asm xor EBX, EBX; - __asm xor ECX, ECX; - __asm xor EDX, EDX; - __asm mov EAX, function; - __asm cpuid; - __asm mov a2, EAX; - __asm mov b2, EBX; - __asm mov c2, ECX; - __asm mov d2, EDX; - - *a = a2; - *b = b2; - *c = c2; - *d = d2; - - #else - - __asm__ __volatile__ ( - #if defined(MY_CPU_AMD64) && defined(__PIC__) - "mov %%rbx, %%rdi;" - "cpuid;" - "xchg %%rbx, %%rdi;" - : "=a" (*a) , - "=D" (*b) , - #elif defined(MY_CPU_X86) && defined(__PIC__) - "mov %%ebx, %%edi;" - "cpuid;" - "xchgl %%ebx, %%edi;" - : "=a" (*a) , - "=D" (*b) , - #else - "cpuid" - : "=a" (*a) , - "=b" (*b) , - #endif - "=c" (*c) , - "=d" (*d) - : "0" (function)) ; - - #endif - - #else - - int CPUInfo[4]; - __cpuid(CPUInfo, function); - *a = CPUInfo[0]; - *b = CPUInfo[1]; - *c = CPUInfo[2]; - *d = CPUInfo[3]; - - #endif -} - -static Bool x86cpuid_CheckAndRead(Cx86cpuid *p) -{ - CHECK_CPUID_IS_SUPPORTED - MyCPUID(0, &p->maxFunc, &p->vendor[0], &p->vendor[2], &p->vendor[1]); - MyCPUID(1, &p->ver, &p->b, &p->c, &p->d); - return True; -} - -static const UInt32 kVendors[][3] = -{ - { 0x756E6547, 0x49656E69, 0x6C65746E}, - { 0x68747541, 0x69746E65, 0x444D4163}, - { 0x746E6543, 0x48727561, 0x736C7561} -}; - -static int x86cpuid_GetFirm(const Cx86cpuid *p) -{ - unsigned i; - for (i = 0; i < sizeof(kVendors) / sizeof(kVendors[i]); i++) - { - const UInt32 *v = kVendors[i]; - if (v[0] == p->vendor[0] && - v[1] == p->vendor[1] && - v[2] == p->vendor[2]) - return (int)i; - } - return -1; -} - -static Bool CPU_Is_InOrder() -{ - Cx86cpuid p; - int firm; - UInt32 family, model; - if (!x86cpuid_CheckAndRead(&p)) - return True; - - family = x86cpuid_GetFamily(p.ver); - model = x86cpuid_GetModel(p.ver); - - firm = x86cpuid_GetFirm(&p); - - switch (firm) - { - case CPU_FIRM_INTEL: return (family < 6 || (family == 6 && ( - /* In-Order Atom CPU */ - model == 0x1C /* 45 nm, N4xx, D4xx, N5xx, D5xx, 230, 330 */ - || model == 0x26 /* 45 nm, Z6xx */ - || model == 0x27 /* 32 nm, Z2460 */ - || model == 0x35 /* 32 nm, Z2760 */ - || model == 0x36 /* 32 nm, N2xxx, D2xxx */ - ))); - case CPU_FIRM_AMD: return (family < 5 || (family == 5 && (model < 6 || model == 0xA))); - case CPU_FIRM_VIA: return (family < 6 || (family == 6 && model < 0xF)); - } - return True; -} - -#endif - -/* 7zStream.c -- 7z Stream functions -2013-11-12 : Igor Pavlov : Public domain */ - -/*#include "Precomp.h"*/ - -#include - -/*#include "7zTypes.h"*/ - -static SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset) -{ - Int64 t = offset; - return stream->Seek(stream, &t, SZ_SEEK_SET); -} - -static SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType) -{ - while (size != 0) - { - size_t processed = size; - RINOK(stream->Read(stream, buf, &processed)); - if (processed == 0) - return errorType; - buf = (void *)((Byte *)buf + processed); - size -= processed; - } - return SZ_OK; -} - -static SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size) -{ - return LookInStream_Read2(stream, buf, size, SZ_ERROR_INPUT_EOF); -} - -static SRes LookToRead_Look_Lookahead(void *pp, const void **buf, size_t *size) -{ - SRes res = SZ_OK; - CLookToRead *p = (CLookToRead *)pp; - size_t size2 = p->size - p->pos; - if (size2 == 0 && *size > 0) - { - p->pos = 0; - size2 = LookToRead_BUF_SIZE; - res = p->realStream->Read(p->realStream, p->buf, &size2); - p->size = size2; - } - if (size2 < *size) - *size = size2; - *buf = p->buf + p->pos; - return res; -} - -static SRes LookToRead_Look_Exact(void *pp, const void **buf, size_t *size) -{ - SRes res = SZ_OK; - CLookToRead *p = (CLookToRead *)pp; - size_t size2 = p->size - p->pos; - if (size2 == 0 && *size > 0) - { - p->pos = 0; - if (*size > LookToRead_BUF_SIZE) - *size = LookToRead_BUF_SIZE; - res = p->realStream->Read(p->realStream, p->buf, size); - size2 = p->size = *size; - } - if (size2 < *size) - *size = size2; - *buf = p->buf + p->pos; - return res; -} - -static SRes LookToRead_Skip(void *pp, size_t offset) -{ - CLookToRead *p = (CLookToRead *)pp; - p->pos += offset; - return SZ_OK; -} - -static SRes LookToRead_Read(void *pp, void *buf, size_t *size) -{ - CLookToRead *p = (CLookToRead *)pp; - size_t rem = p->size - p->pos; - if (rem == 0) - return p->realStream->Read(p->realStream, buf, size); - if (rem > *size) - rem = *size; - memcpy(buf, p->buf + p->pos, rem); - p->pos += rem; - *size = rem; - return SZ_OK; -} - -static SRes LookToRead_Seek(void *pp, Int64 *pos, ESzSeek origin) -{ - CLookToRead *p = (CLookToRead *)pp; - p->pos = p->size = 0; - return p->realStream->Seek(p->realStream, pos, origin); -} - -static void LookToRead_CreateVTable(CLookToRead *p, int lookahead) -{ - p->s.Look = lookahead ? - LookToRead_Look_Lookahead : - LookToRead_Look_Exact; - p->s.Skip = LookToRead_Skip; - p->s.Read = LookToRead_Read; - p->s.Seek = LookToRead_Seek; -} - -static void LookToRead_Init(CLookToRead *p) -{ - p->pos = p->size = 0; -} - - -/* 7zArcIn.c -- 7z Input functions -2016-05-16 : Igor Pavlov : Public domain */ - -/* -#include "Precomp.h" - -#include - -#include "7z.h" -#include "7zBuf.h" -#include "7zCrc.h" -#include "CpuArch.h" -*/ - -#define MY_ALLOC(T, p, size, alloc) { \ - if ((p = (T *)IAlloc_Alloc(alloc, (size) * sizeof(T))) == NULL) return SZ_ERROR_MEM; } - -#define MY_ALLOC_ZE(T, p, size, alloc) { if ((size) == 0) p = NULL; else MY_ALLOC(T, p, size, alloc) } - -#define MY_ALLOC_AND_CPY(to, size, from, alloc) \ - { MY_ALLOC(Byte, to, size, alloc); memcpy(to, from, size); } - -#define MY_ALLOC_ZE_AND_CPY(to, size, from, alloc) \ - { if ((size) == 0) p = NULL; else { MY_ALLOC_AND_CPY(to, size, from, alloc) } } - -#define k7zMajorVersion 0 - -enum EIdEnum -{ - k7zIdEnd, - k7zIdHeader, - k7zIdArchiveProperties, - k7zIdAdditionalStreamsInfo, - k7zIdMainStreamsInfo, - k7zIdFilesInfo, - k7zIdPackInfo, - k7zIdUnpackInfo, - k7zIdSubStreamsInfo, - k7zIdSize, - k7zIdCRC, - k7zIdFolder, - k7zIdCodersUnpackSize, - k7zIdNumUnpackStream, - k7zIdEmptyStream, - k7zIdEmptyFile, - k7zIdAnti, - k7zIdName, - k7zIdCTime, - k7zIdATime, - k7zIdMTime, - k7zIdWinAttrib, - k7zIdComment, - k7zIdEncodedHeader, - k7zIdStartPos, - k7zIdDummy - /* k7zNtSecure, */ - /* k7zParent, */ - /* k7zIsReal */ -}; - -static const Byte k7zSignature[k7zSignatureSize] = {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C}; - -#define SzBitUi32s_Init(p) { (p)->Defs = NULL; (p)->Vals = NULL; } - -static SRes SzBitUi32s_Alloc(CSzBitUi32s *p, size_t num, ISzAlloc *alloc) -{ - if (num == 0) - { - p->Defs = NULL; - p->Vals = NULL; - } - else - { - MY_ALLOC(Byte, p->Defs, (num + 7) >> 3, alloc); - MY_ALLOC(UInt32, p->Vals, num, alloc); - } - return SZ_OK; -} - -static void SzBitUi32s_Free(CSzBitUi32s *p, ISzAlloc *alloc) -{ - IAlloc_Free(alloc, p->Defs); p->Defs = NULL; - IAlloc_Free(alloc, p->Vals); p->Vals = NULL; -} - -#define SzBitUi64s_Init(p) { (p)->Defs = NULL; (p)->Vals = NULL; } - -static void SzBitUi64s_Free(CSzBitUi64s *p, ISzAlloc *alloc) -{ - IAlloc_Free(alloc, p->Defs); p->Defs = NULL; - IAlloc_Free(alloc, p->Vals); p->Vals = NULL; -} - - -static void SzAr_Init(CSzAr *p) -{ - p->NumPackStreams = 0; - p->NumFolders = 0; - - p->PackPositions = NULL; - SzBitUi32s_Init(&p->FolderCRCs); - - p->FoCodersOffsets = NULL; - p->FoStartPackStreamIndex = NULL; - p->FoToCoderUnpackSizes = NULL; - p->FoToMainUnpackSizeIndex = NULL; - p->CoderUnpackSizes = NULL; - - p->CodersData = NULL; -} - -static void SzAr_Free(CSzAr *p, ISzAlloc *alloc) -{ - IAlloc_Free(alloc, p->PackPositions); - SzBitUi32s_Free(&p->FolderCRCs, alloc); - - IAlloc_Free(alloc, p->FoCodersOffsets); - IAlloc_Free(alloc, p->FoStartPackStreamIndex); - IAlloc_Free(alloc, p->FoToCoderUnpackSizes); - IAlloc_Free(alloc, p->FoToMainUnpackSizeIndex); - IAlloc_Free(alloc, p->CoderUnpackSizes); - - IAlloc_Free(alloc, p->CodersData); - - SzAr_Init(p); -} - - -static void SzArEx_Init(CSzArEx *p) -{ - SzAr_Init(&p->db); - - p->NumFiles = 0; - p->dataPos = 0; - - p->UnpackPositions = NULL; - p->IsDirs = NULL; - - p->FolderToFile = NULL; - p->FileToFolder = NULL; - - p->FileNameOffsets = NULL; - p->FileNames = NULL; - - SzBitUi32s_Init(&p->CRCs); - SzBitUi32s_Init(&p->Attribs); - /* SzBitUi32s_Init(&p->Parents); */ - SzBitUi64s_Init(&p->MTime); - SzBitUi64s_Init(&p->CTime); -} - -static void SzArEx_Free(CSzArEx *p, ISzAlloc *alloc) -{ - IAlloc_Free(alloc, p->UnpackPositions); - IAlloc_Free(alloc, p->IsDirs); - - IAlloc_Free(alloc, p->FolderToFile); - IAlloc_Free(alloc, p->FileToFolder); - - IAlloc_Free(alloc, p->FileNameOffsets); - IAlloc_Free(alloc, p->FileNames); - - SzBitUi32s_Free(&p->CRCs, alloc); - SzBitUi32s_Free(&p->Attribs, alloc); - /* SzBitUi32s_Free(&p->Parents, alloc); */ - SzBitUi64s_Free(&p->MTime, alloc); - SzBitUi64s_Free(&p->CTime, alloc); - - SzAr_Free(&p->db, alloc); - SzArEx_Init(p); -} - - -static int TestSignatureCandidate(const Byte *testBytes) -{ - unsigned i; - for (i = 0; i < k7zSignatureSize; i++) - if (testBytes[i] != k7zSignature[i]) - return 0; - return 1; -} - -#define SzData_Clear(p) { (p)->Data = NULL; (p)->Size = 0; } - -#define SZ_READ_BYTE_SD(_sd_, dest) if ((_sd_)->Size == 0) return SZ_ERROR_ARCHIVE; (_sd_)->Size--; dest = *(_sd_)->Data++; -#define SZ_READ_BYTE(dest) SZ_READ_BYTE_SD(sd, dest) -#define SZ_READ_BYTE_2(dest) if (sd.Size == 0) return SZ_ERROR_ARCHIVE; sd.Size--; dest = *sd.Data++; - -#define SKIP_DATA(sd, size) { sd->Size -= (size_t)(size); sd->Data += (size_t)(size); } -#define SKIP_DATA2(sd, size) { sd.Size -= (size_t)(size); sd.Data += (size_t)(size); } - -#define SZ_READ_32(dest) if (sd.Size < 4) return SZ_ERROR_ARCHIVE; \ - dest = GetUi32(sd.Data); SKIP_DATA2(sd, 4); - -static MY_NO_INLINE SRes ReadNumber(CSzData *sd, UInt64 *value) -{ - Byte firstByte, mask; - unsigned i; - UInt32 v; - - SZ_READ_BYTE(firstByte); - if ((firstByte & 0x80) == 0) - { - *value = firstByte; - return SZ_OK; - } - SZ_READ_BYTE(v); - if ((firstByte & 0x40) == 0) - { - *value = (((UInt32)firstByte & 0x3F) << 8) | v; - return SZ_OK; - } - SZ_READ_BYTE(mask); - *value = v | ((UInt32)mask << 8); - mask = 0x20; - for (i = 2; i < 8; i++) - { - Byte b; - if ((firstByte & mask) == 0) - { - UInt64 highPart = (unsigned)firstByte & (unsigned)(mask - 1); - *value |= (highPart << (8 * i)); - return SZ_OK; - } - SZ_READ_BYTE(b); - *value |= ((UInt64)b << (8 * i)); - mask >>= 1; - } - return SZ_OK; -} - - -static MY_NO_INLINE SRes SzReadNumber32(CSzData *sd, UInt32 *value) -{ - Byte firstByte; - UInt64 value64; - if (sd->Size == 0) - return SZ_ERROR_ARCHIVE; - firstByte = *sd->Data; - if ((firstByte & 0x80) == 0) - { - *value = firstByte; - sd->Data++; - sd->Size--; - return SZ_OK; - } - RINOK(ReadNumber(sd, &value64)); - if (value64 >= (UInt32)0x80000000 - 1) - return SZ_ERROR_UNSUPPORTED; - if (value64 >= ((UInt64)(1) << ((sizeof(size_t) - 1) * 8 + 4))) - return SZ_ERROR_UNSUPPORTED; - *value = (UInt32)value64; - return SZ_OK; -} - -#define ReadID(sd, value) ReadNumber(sd, value) - -static SRes SkipData(CSzData *sd) -{ - UInt64 size; - RINOK(ReadNumber(sd, &size)); - if (size > sd->Size) - return SZ_ERROR_ARCHIVE; - SKIP_DATA(sd, size); - return SZ_OK; -} - -static SRes WaitId(CSzData *sd, UInt32 id) -{ - for (;;) - { - UInt64 type; - RINOK(ReadID(sd, &type)); - if (type == id) - return SZ_OK; - if (type == k7zIdEnd) - return SZ_ERROR_ARCHIVE; - RINOK(SkipData(sd)); - } -} - -static SRes RememberBitVector(CSzData *sd, UInt32 numItems, const Byte **v) -{ - UInt32 numBytes = (numItems + 7) >> 3; - if (numBytes > sd->Size) - return SZ_ERROR_ARCHIVE; - *v = sd->Data; - SKIP_DATA(sd, numBytes); - return SZ_OK; -} - -static UInt32 CountDefinedBits(const Byte *bits, UInt32 numItems) -{ - Byte b = 0; - unsigned m = 0; - UInt32 sum = 0; - for (; numItems != 0; numItems--) - { - if (m == 0) - { - b = *bits++; - m = 8; - } - m--; - sum += ((b >> m) & 1); - } - return sum; -} - -static MY_NO_INLINE SRes ReadBitVector(CSzData *sd, UInt32 numItems, Byte **v, ISzAlloc *alloc) -{ - Byte allAreDefined; - Byte *v2; - UInt32 numBytes = (numItems + 7) >> 3; - *v = NULL; - SZ_READ_BYTE(allAreDefined); - if (numBytes == 0) - return SZ_OK; - if (allAreDefined == 0) - { - if (numBytes > sd->Size) - return SZ_ERROR_ARCHIVE; - MY_ALLOC_AND_CPY(*v, numBytes, sd->Data, alloc); - SKIP_DATA(sd, numBytes); - return SZ_OK; - } - MY_ALLOC(Byte, *v, numBytes, alloc); - v2 = *v; - memset(v2, 0xFF, (size_t)numBytes); - { - unsigned numBits = (unsigned)numItems & 7; - if (numBits != 0) - v2[numBytes - 1] = (Byte)((((UInt32)1 << numBits) - 1) << (8 - numBits)); - } - return SZ_OK; -} - -static MY_NO_INLINE SRes ReadUi32s(CSzData *sd2, UInt32 numItems, CSzBitUi32s *crcs, ISzAlloc *alloc) -{ - UInt32 i; - CSzData sd; - UInt32 *vals; - const Byte *defs; - MY_ALLOC_ZE(UInt32, crcs->Vals, numItems, alloc); - sd = *sd2; - defs = crcs->Defs; - vals = crcs->Vals; - for (i = 0; i < numItems; i++) - if (SzBitArray_Check(defs, i)) - { - SZ_READ_32(vals[i]); - } - else - vals[i] = 0; - *sd2 = sd; - return SZ_OK; -} - -static SRes ReadBitUi32s(CSzData *sd, UInt32 numItems, CSzBitUi32s *crcs, ISzAlloc *alloc) -{ - SzBitUi32s_Free(crcs, alloc); - RINOK(ReadBitVector(sd, numItems, &crcs->Defs, alloc)); - return ReadUi32s(sd, numItems, crcs, alloc); -} - -static SRes SkipBitUi32s(CSzData *sd, UInt32 numItems) -{ - Byte allAreDefined; - UInt32 numDefined = numItems; - SZ_READ_BYTE(allAreDefined); - if (!allAreDefined) - { - size_t numBytes = (numItems + 7) >> 3; - if (numBytes > sd->Size) - return SZ_ERROR_ARCHIVE; - numDefined = CountDefinedBits(sd->Data, numItems); - SKIP_DATA(sd, numBytes); - } - if (numDefined > (sd->Size >> 2)) - return SZ_ERROR_ARCHIVE; - SKIP_DATA(sd, (size_t)numDefined * 4); - return SZ_OK; -} - -static SRes ReadPackInfo(CSzAr *p, CSzData *sd, ISzAlloc *alloc) -{ - RINOK(SzReadNumber32(sd, &p->NumPackStreams)); - - RINOK(WaitId(sd, k7zIdSize)); - MY_ALLOC(UInt64, p->PackPositions, (size_t)p->NumPackStreams + 1, alloc); - { - UInt64 sum = 0; - UInt32 i; - UInt32 numPackStreams = p->NumPackStreams; - for (i = 0; i < numPackStreams; i++) - { - UInt64 packSize; - p->PackPositions[i] = sum; - RINOK(ReadNumber(sd, &packSize)); - sum += packSize; - if (sum < packSize) - return SZ_ERROR_ARCHIVE; - } - p->PackPositions[i] = sum; - } - - for (;;) - { - UInt64 type; - RINOK(ReadID(sd, &type)); - if (type == k7zIdEnd) - return SZ_OK; - if (type == k7zIdCRC) - { - /* CRC of packed streams is unused now */ - RINOK(SkipBitUi32s(sd, p->NumPackStreams)); - continue; - } - RINOK(SkipData(sd)); - } -} - -/* -static SRes SzReadSwitch(CSzData *sd) -{ - Byte external; - RINOK(SzReadByte(sd, &external)); - return (external == 0) ? SZ_OK: SZ_ERROR_UNSUPPORTED; -} -*/ - -#define k_NumCodersStreams_in_Folder_MAX (SZ_NUM_BONDS_IN_FOLDER_MAX + SZ_NUM_PACK_STREAMS_IN_FOLDER_MAX) - -static SRes SzGetNextFolderItem(CSzFolder *f, CSzData *sd) -{ - UInt32 numCoders, i; - UInt32 numInStreams = 0; - const Byte *dataStart = sd->Data; - - f->NumCoders = 0; - f->NumBonds = 0; - f->NumPackStreams = 0; - f->UnpackStream = 0; - - RINOK(SzReadNumber32(sd, &numCoders)); - if (numCoders == 0 || numCoders > SZ_NUM_CODERS_IN_FOLDER_MAX) - return SZ_ERROR_UNSUPPORTED; - - for (i = 0; i < numCoders; i++) - { - Byte mainByte; - CSzCoderInfo *coder = f->Coders + i; - unsigned idSize, j; - UInt64 id; - - SZ_READ_BYTE(mainByte); - if ((mainByte & 0xC0) != 0) - return SZ_ERROR_UNSUPPORTED; - - idSize = (unsigned)(mainByte & 0xF); - if (idSize > sizeof(id)) - return SZ_ERROR_UNSUPPORTED; - if (idSize > sd->Size) - return SZ_ERROR_ARCHIVE; - id = 0; - for (j = 0; j < idSize; j++) - { - id = ((id << 8) | *sd->Data); - sd->Data++; - sd->Size--; - } - if (id > UINT64_CONST(0xFFFFFFFF)) - return SZ_ERROR_UNSUPPORTED; - coder->MethodID = (UInt32)id; - - coder->NumStreams = 1; - coder->PropsOffset = 0; - coder->PropsSize = 0; - - if ((mainByte & 0x10) != 0) - { - UInt32 numStreams; - - RINOK(SzReadNumber32(sd, &numStreams)); - if (numStreams > k_NumCodersStreams_in_Folder_MAX) - return SZ_ERROR_UNSUPPORTED; - coder->NumStreams = (Byte)numStreams; - - RINOK(SzReadNumber32(sd, &numStreams)); - if (numStreams != 1) - return SZ_ERROR_UNSUPPORTED; - } - - numInStreams += coder->NumStreams; - - if (numInStreams > k_NumCodersStreams_in_Folder_MAX) - return SZ_ERROR_UNSUPPORTED; - - if ((mainByte & 0x20) != 0) - { - UInt32 propsSize = 0; - RINOK(SzReadNumber32(sd, &propsSize)); - if (propsSize > sd->Size) - return SZ_ERROR_ARCHIVE; - if (propsSize >= 0x80) - return SZ_ERROR_UNSUPPORTED; - coder->PropsOffset = sd->Data - dataStart; - coder->PropsSize = (Byte)propsSize; - sd->Data += (size_t)propsSize; - sd->Size -= (size_t)propsSize; - } - } - - /* - if (numInStreams == 1 && numCoders == 1) - { - f->NumPackStreams = 1; - f->PackStreams[0] = 0; - } - else - */ - { - Byte streamUsed[k_NumCodersStreams_in_Folder_MAX]; - UInt32 numBonds, numPackStreams; - - numBonds = numCoders - 1; - if (numInStreams < numBonds) - return SZ_ERROR_ARCHIVE; - if (numBonds > SZ_NUM_BONDS_IN_FOLDER_MAX) - return SZ_ERROR_UNSUPPORTED; - f->NumBonds = numBonds; - - numPackStreams = numInStreams - numBonds; - if (numPackStreams > SZ_NUM_PACK_STREAMS_IN_FOLDER_MAX) - return SZ_ERROR_UNSUPPORTED; - f->NumPackStreams = numPackStreams; - - for (i = 0; i < numInStreams; i++) - streamUsed[i] = False; - - if (numBonds != 0) - { - Byte coderUsed[SZ_NUM_CODERS_IN_FOLDER_MAX]; - - for (i = 0; i < numCoders; i++) - coderUsed[i] = False; - - for (i = 0; i < numBonds; i++) - { - CSzBond *bp = f->Bonds + i; - - RINOK(SzReadNumber32(sd, &bp->InIndex)); - if (bp->InIndex >= numInStreams || streamUsed[bp->InIndex]) - return SZ_ERROR_ARCHIVE; - streamUsed[bp->InIndex] = True; - - RINOK(SzReadNumber32(sd, &bp->OutIndex)); - if (bp->OutIndex >= numCoders || coderUsed[bp->OutIndex]) - return SZ_ERROR_ARCHIVE; - coderUsed[bp->OutIndex] = True; - } - - for (i = 0; i < numCoders; i++) - if (!coderUsed[i]) - { - f->UnpackStream = i; - break; - } - - if (i == numCoders) - return SZ_ERROR_ARCHIVE; - } - - if (numPackStreams == 1) - { - for (i = 0; i < numInStreams; i++) - if (!streamUsed[i]) - break; - if (i == numInStreams) - return SZ_ERROR_ARCHIVE; - f->PackStreams[0] = i; - } - else - for (i = 0; i < numPackStreams; i++) - { - UInt32 index; - RINOK(SzReadNumber32(sd, &index)); - if (index >= numInStreams || streamUsed[index]) - return SZ_ERROR_ARCHIVE; - streamUsed[index] = True; - f->PackStreams[i] = index; - } - } - - f->NumCoders = numCoders; - - return SZ_OK; -} - - -static MY_NO_INLINE SRes SkipNumbers(CSzData *sd2, UInt32 num) -{ - CSzData sd; - sd = *sd2; - for (; num != 0; num--) - { - Byte firstByte, mask; - unsigned i; - SZ_READ_BYTE_2(firstByte); - if ((firstByte & 0x80) == 0) - continue; - if ((firstByte & 0x40) == 0) - { - if (sd.Size == 0) - return SZ_ERROR_ARCHIVE; - sd.Size--; - sd.Data++; - continue; - } - mask = 0x20; - for (i = 2; i < 8 && (firstByte & mask) != 0; i++) - mask >>= 1; - if (i > sd.Size) - return SZ_ERROR_ARCHIVE; - SKIP_DATA2(sd, i); - } - *sd2 = sd; - return SZ_OK; -} - - -#define k_Scan_NumCoders_MAX 64 -#define k_Scan_NumCodersStreams_in_Folder_MAX 64 - - -static SRes ReadUnpackInfo(CSzAr *p, - CSzData *sd2, - UInt32 numFoldersMax, - const CBuf *tempBufs, UInt32 numTempBufs, - ISzAlloc *alloc) -{ - CSzData sd; - - UInt32 fo, numFolders, numCodersOutStreams, packStreamIndex; - const Byte *startBufPtr; - Byte external; - - RINOK(WaitId(sd2, k7zIdFolder)); - - RINOK(SzReadNumber32(sd2, &numFolders)); - if (numFolders > numFoldersMax) - return SZ_ERROR_UNSUPPORTED; - p->NumFolders = numFolders; - - SZ_READ_BYTE_SD(sd2, external); - if (external == 0) - sd = *sd2; - else - { - UInt32 index; - RINOK(SzReadNumber32(sd2, &index)); - if (index >= numTempBufs) - return SZ_ERROR_ARCHIVE; - sd.Data = tempBufs[index].data; - sd.Size = tempBufs[index].size; - } - - MY_ALLOC(size_t, p->FoCodersOffsets, (size_t)numFolders + 1, alloc); - MY_ALLOC(UInt32, p->FoStartPackStreamIndex, (size_t)numFolders + 1, alloc); - MY_ALLOC(UInt32, p->FoToCoderUnpackSizes, (size_t)numFolders + 1, alloc); - MY_ALLOC(Byte, p->FoToMainUnpackSizeIndex, (size_t)numFolders, alloc); - - startBufPtr = sd.Data; - - packStreamIndex = 0; - numCodersOutStreams = 0; - - for (fo = 0; fo < numFolders; fo++) - { - UInt32 numCoders, ci, numInStreams = 0; - - p->FoCodersOffsets[fo] = sd.Data - startBufPtr; - - RINOK(SzReadNumber32(&sd, &numCoders)); - if (numCoders == 0 || numCoders > k_Scan_NumCoders_MAX) - return SZ_ERROR_UNSUPPORTED; - - for (ci = 0; ci < numCoders; ci++) - { - Byte mainByte; - unsigned idSize; - UInt32 coderInStreams; - - SZ_READ_BYTE_2(mainByte); - if ((mainByte & 0xC0) != 0) - return SZ_ERROR_UNSUPPORTED; - idSize = (mainByte & 0xF); - if (idSize > 8) - return SZ_ERROR_UNSUPPORTED; - if (idSize > sd.Size) - return SZ_ERROR_ARCHIVE; - SKIP_DATA2(sd, idSize); - - coderInStreams = 1; - - if ((mainByte & 0x10) != 0) - { - UInt32 coderOutStreams; - RINOK(SzReadNumber32(&sd, &coderInStreams)); - RINOK(SzReadNumber32(&sd, &coderOutStreams)); - if (coderInStreams > k_Scan_NumCodersStreams_in_Folder_MAX || coderOutStreams != 1) - return SZ_ERROR_UNSUPPORTED; - } - - numInStreams += coderInStreams; - - if ((mainByte & 0x20) != 0) - { - UInt32 propsSize; - RINOK(SzReadNumber32(&sd, &propsSize)); - if (propsSize > sd.Size) - return SZ_ERROR_ARCHIVE; - SKIP_DATA2(sd, propsSize); - } - } - - { - UInt32 indexOfMainStream = 0; - UInt32 numPackStreams = 1; - - if (numCoders != 1 || numInStreams != 1) - { - Byte streamUsed[k_Scan_NumCodersStreams_in_Folder_MAX]; - Byte coderUsed[k_Scan_NumCoders_MAX]; - - UInt32 i; - UInt32 numBonds = numCoders - 1; - if (numInStreams < numBonds) - return SZ_ERROR_ARCHIVE; - - if (numInStreams > k_Scan_NumCodersStreams_in_Folder_MAX) - return SZ_ERROR_UNSUPPORTED; - - for (i = 0; i < numInStreams; i++) - streamUsed[i] = False; - for (i = 0; i < numCoders; i++) - coderUsed[i] = False; - - for (i = 0; i < numBonds; i++) - { - UInt32 index; - - RINOK(SzReadNumber32(&sd, &index)); - if (index >= numInStreams || streamUsed[index]) - return SZ_ERROR_ARCHIVE; - streamUsed[index] = True; - - RINOK(SzReadNumber32(&sd, &index)); - if (index >= numCoders || coderUsed[index]) - return SZ_ERROR_ARCHIVE; - coderUsed[index] = True; - } - - numPackStreams = numInStreams - numBonds; - - if (numPackStreams != 1) - for (i = 0; i < numPackStreams; i++) - { - UInt32 index; - RINOK(SzReadNumber32(&sd, &index)); - if (index >= numInStreams || streamUsed[index]) - return SZ_ERROR_ARCHIVE; - streamUsed[index] = True; - } - - for (i = 0; i < numCoders; i++) - if (!coderUsed[i]) - { - indexOfMainStream = i; - break; - } - - if (i == numCoders) - return SZ_ERROR_ARCHIVE; - } - - p->FoStartPackStreamIndex[fo] = packStreamIndex; - p->FoToCoderUnpackSizes[fo] = numCodersOutStreams; - p->FoToMainUnpackSizeIndex[fo] = (Byte)indexOfMainStream; - numCodersOutStreams += numCoders; - if (numCodersOutStreams < numCoders) - return SZ_ERROR_UNSUPPORTED; - if (numPackStreams > p->NumPackStreams - packStreamIndex) - return SZ_ERROR_ARCHIVE; - packStreamIndex += numPackStreams; - } - } - - p->FoToCoderUnpackSizes[fo] = numCodersOutStreams; - - { - size_t dataSize = sd.Data - startBufPtr; - p->FoStartPackStreamIndex[fo] = packStreamIndex; - p->FoCodersOffsets[fo] = dataSize; - MY_ALLOC_ZE_AND_CPY(p->CodersData, dataSize, startBufPtr, alloc); - } - - if (external != 0) - { - if (sd.Size != 0) - return SZ_ERROR_ARCHIVE; - sd = *sd2; - } - - RINOK(WaitId(&sd, k7zIdCodersUnpackSize)); - - MY_ALLOC_ZE(UInt64, p->CoderUnpackSizes, (size_t)numCodersOutStreams, alloc); - { - UInt32 i; - for (i = 0; i < numCodersOutStreams; i++) - { - RINOK(ReadNumber(&sd, p->CoderUnpackSizes + i)); - } - } - - for (;;) - { - UInt64 type; - RINOK(ReadID(&sd, &type)); - if (type == k7zIdEnd) - { - *sd2 = sd; - return SZ_OK; - } - if (type == k7zIdCRC) - { - RINOK(ReadBitUi32s(&sd, numFolders, &p->FolderCRCs, alloc)); - continue; - } - RINOK(SkipData(&sd)); - } -} - - -static UInt64 SzAr_GetFolderUnpackSize(const CSzAr *p, UInt32 folderIndex) -{ - return p->CoderUnpackSizes[p->FoToCoderUnpackSizes[folderIndex] + p->FoToMainUnpackSizeIndex[folderIndex]]; -} - - -typedef struct -{ - UInt32 NumTotalSubStreams; - UInt32 NumSubDigests; - CSzData sdNumSubStreams; - CSzData sdSizes; - CSzData sdCRCs; -} CSubStreamInfo; - - -static SRes ReadSubStreamsInfo(CSzAr *p, CSzData *sd, CSubStreamInfo *ssi) -{ - UInt64 type = 0; - UInt32 numSubDigests = 0; - UInt32 numFolders = p->NumFolders; - UInt32 numUnpackStreams = numFolders; - UInt32 numUnpackSizesInData = 0; - - for (;;) - { - RINOK(ReadID(sd, &type)); - if (type == k7zIdNumUnpackStream) - { - UInt32 i; - ssi->sdNumSubStreams.Data = sd->Data; - numUnpackStreams = 0; - numSubDigests = 0; - for (i = 0; i < numFolders; i++) - { - UInt32 numStreams; - RINOK(SzReadNumber32(sd, &numStreams)); - if (numUnpackStreams > numUnpackStreams + numStreams) - return SZ_ERROR_UNSUPPORTED; - numUnpackStreams += numStreams; - if (numStreams != 0) - numUnpackSizesInData += (numStreams - 1); - if (numStreams != 1 || !SzBitWithVals_Check(&p->FolderCRCs, i)) - numSubDigests += numStreams; - } - ssi->sdNumSubStreams.Size = sd->Data - ssi->sdNumSubStreams.Data; - continue; - } - if (type == k7zIdCRC || type == k7zIdSize || type == k7zIdEnd) - break; - RINOK(SkipData(sd)); - } - - if (!ssi->sdNumSubStreams.Data) - { - numSubDigests = numFolders; - if (p->FolderCRCs.Defs) - numSubDigests = numFolders - CountDefinedBits(p->FolderCRCs.Defs, numFolders); - } - - ssi->NumTotalSubStreams = numUnpackStreams; - ssi->NumSubDigests = numSubDigests; - - if (type == k7zIdSize) - { - ssi->sdSizes.Data = sd->Data; - RINOK(SkipNumbers(sd, numUnpackSizesInData)); - ssi->sdSizes.Size = sd->Data - ssi->sdSizes.Data; - RINOK(ReadID(sd, &type)); - } - - for (;;) - { - if (type == k7zIdEnd) - return SZ_OK; - if (type == k7zIdCRC) - { - ssi->sdCRCs.Data = sd->Data; - RINOK(SkipBitUi32s(sd, numSubDigests)); - ssi->sdCRCs.Size = sd->Data - ssi->sdCRCs.Data; - } - else - { - RINOK(SkipData(sd)); - } - RINOK(ReadID(sd, &type)); - } -} - -static SRes SzReadStreamsInfo(CSzAr *p, - CSzData *sd, - UInt32 numFoldersMax, const CBuf *tempBufs, UInt32 numTempBufs, - UInt64 *dataOffset, - CSubStreamInfo *ssi, - ISzAlloc *alloc) -{ - UInt64 type; - - SzData_Clear(&ssi->sdSizes); - SzData_Clear(&ssi->sdCRCs); - SzData_Clear(&ssi->sdNumSubStreams); - - *dataOffset = 0; - RINOK(ReadID(sd, &type)); - if (type == k7zIdPackInfo) - { - RINOK(ReadNumber(sd, dataOffset)); - RINOK(ReadPackInfo(p, sd, alloc)); - RINOK(ReadID(sd, &type)); - } - if (type == k7zIdUnpackInfo) - { - RINOK(ReadUnpackInfo(p, sd, numFoldersMax, tempBufs, numTempBufs, alloc)); - RINOK(ReadID(sd, &type)); - } - if (type == k7zIdSubStreamsInfo) - { - RINOK(ReadSubStreamsInfo(p, sd, ssi)); - RINOK(ReadID(sd, &type)); - } - else - { - ssi->NumTotalSubStreams = p->NumFolders; - /* ssi->NumSubDigests = 0; */ - } - - return (type == k7zIdEnd ? SZ_OK : SZ_ERROR_UNSUPPORTED); -} - -static SRes SzReadAndDecodePackedStreams( - ILookInStream *inStream, - CSzData *sd, - CBuf *tempBufs, - UInt32 numFoldersMax, - UInt64 baseOffset, - CSzAr *p, - ISzAlloc *allocTemp) -{ - UInt64 dataStartPos = 0; - UInt32 fo; - CSubStreamInfo ssi; - UInt32 numFolders; - - RINOK(SzReadStreamsInfo(p, sd, numFoldersMax, NULL, 0, &dataStartPos, &ssi, allocTemp)); - - numFolders = p->NumFolders; - if (numFolders == 0) - return SZ_ERROR_ARCHIVE; - else if (numFolders > numFoldersMax) - return SZ_ERROR_UNSUPPORTED; - - dataStartPos += baseOffset; - - for (fo = 0; fo < numFolders; fo++) - Buf_Init(tempBufs + fo); - - for (fo = 0; fo < numFolders; fo++) - { - CBuf *tempBuf = tempBufs + fo; - UInt64 unpackSize = SzAr_GetFolderUnpackSize(p, fo); - if ((size_t)unpackSize != unpackSize) - return SZ_ERROR_MEM; - if (!Buf_Create(tempBuf, (size_t)unpackSize, allocTemp)) - return SZ_ERROR_MEM; - } - - for (fo = 0; fo < numFolders; fo++) - { - const CBuf *tempBuf = tempBufs + fo; - RINOK(LookInStream_SeekTo(inStream, dataStartPos)); - RINOK(SzAr_DecodeFolder(p, fo, inStream, dataStartPos, tempBuf->data, tempBuf->size, allocTemp)); - } - - return SZ_OK; -} - -static SRes SzReadFileNames(const Byte *data, size_t size, UInt32 numFiles, size_t *offsets) -{ - size_t pos = 0; - *offsets++ = 0; - if (numFiles == 0) - return (size == 0) ? SZ_OK : SZ_ERROR_ARCHIVE; - if (size < 2) - return SZ_ERROR_ARCHIVE; - if (data[size - 2] != 0 || data[size - 1] != 0) - return SZ_ERROR_ARCHIVE; - do - { - const Byte *p; - if (pos == size) - return SZ_ERROR_ARCHIVE; - for (p = data + pos; - #ifdef _WIN32 - *(const UInt16 *)p != 0 - #else - p[0] != 0 || p[1] != 0 - #endif - ; p += 2); - pos = p - data + 2; - *offsets++ = (pos >> 1); - } - while (--numFiles); - return (pos == size) ? SZ_OK : SZ_ERROR_ARCHIVE; -} - -static MY_NO_INLINE SRes ReadTime(CSzBitUi64s *p, UInt32 num, - CSzData *sd2, - const CBuf *tempBufs, UInt32 numTempBufs, - ISzAlloc *alloc) -{ - CSzData sd; - UInt32 i; - CNtfsFileTime *vals; - Byte *defs; - Byte external; - - RINOK(ReadBitVector(sd2, num, &p->Defs, alloc)); - - SZ_READ_BYTE_SD(sd2, external); - if (external == 0) - sd = *sd2; - else - { - UInt32 index; - RINOK(SzReadNumber32(sd2, &index)); - if (index >= numTempBufs) - return SZ_ERROR_ARCHIVE; - sd.Data = tempBufs[index].data; - sd.Size = tempBufs[index].size; - } - - MY_ALLOC_ZE(CNtfsFileTime, p->Vals, num, alloc); - vals = p->Vals; - defs = p->Defs; - for (i = 0; i < num; i++) - if (SzBitArray_Check(defs, i)) - { - if (sd.Size < 8) - return SZ_ERROR_ARCHIVE; - vals[i].Low = GetUi32(sd.Data); - vals[i].High = GetUi32(sd.Data + 4); - SKIP_DATA2(sd, 8); - } - else - vals[i].High = vals[i].Low = 0; - - if (external == 0) - *sd2 = sd; - - return SZ_OK; -} - - -#define NUM_ADDITIONAL_STREAMS_MAX 8 - - -static SRes SzReadHeader2( - CSzArEx *p, /* allocMain */ - CSzData *sd, - ILookInStream *inStream, - CBuf *tempBufs, UInt32 *numTempBufs, - ISzAlloc *allocMain, - ISzAlloc *allocTemp - ) -{ - CSubStreamInfo ssi; - -{ - UInt64 type; - - SzData_Clear(&ssi.sdSizes); - SzData_Clear(&ssi.sdCRCs); - SzData_Clear(&ssi.sdNumSubStreams); - - ssi.NumSubDigests = 0; - ssi.NumTotalSubStreams = 0; - - RINOK(ReadID(sd, &type)); - - if (type == k7zIdArchiveProperties) - { - for (;;) - { - UInt64 type2; - RINOK(ReadID(sd, &type2)); - if (type2 == k7zIdEnd) - break; - RINOK(SkipData(sd)); - } - RINOK(ReadID(sd, &type)); - } - - if (type == k7zIdAdditionalStreamsInfo) - { - CSzAr tempAr; - SRes res; - - SzAr_Init(&tempAr); - res = SzReadAndDecodePackedStreams(inStream, sd, tempBufs, NUM_ADDITIONAL_STREAMS_MAX, - p->startPosAfterHeader, &tempAr, allocTemp); - *numTempBufs = tempAr.NumFolders; - SzAr_Free(&tempAr, allocTemp); - - if (res != SZ_OK) - return res; - RINOK(ReadID(sd, &type)); - } - - if (type == k7zIdMainStreamsInfo) - { - RINOK(SzReadStreamsInfo(&p->db, sd, (UInt32)1 << 30, tempBufs, *numTempBufs, - &p->dataPos, &ssi, allocMain)); - p->dataPos += p->startPosAfterHeader; - RINOK(ReadID(sd, &type)); - } - - if (type == k7zIdEnd) - { - return SZ_OK; - } - - if (type != k7zIdFilesInfo) - return SZ_ERROR_ARCHIVE; -} - -{ - UInt32 numFiles = 0; - UInt32 numEmptyStreams = 0; - const Byte *emptyStreams = NULL; - const Byte *emptyFiles = NULL; - - RINOK(SzReadNumber32(sd, &numFiles)); - p->NumFiles = numFiles; - - for (;;) - { - UInt64 type; - UInt64 size; - RINOK(ReadID(sd, &type)); - if (type == k7zIdEnd) - break; - RINOK(ReadNumber(sd, &size)); - if (size > sd->Size) - return SZ_ERROR_ARCHIVE; - - if (type >= ((UInt32)1 << 8)) - { - SKIP_DATA(sd, size); - } - else switch ((unsigned)type) - { - case k7zIdName: - { - size_t namesSize; - const Byte *namesData; - Byte external; - - SZ_READ_BYTE(external); - if (external == 0) - { - namesSize = (size_t)size - 1; - namesData = sd->Data; - } - else - { - UInt32 index; - RINOK(SzReadNumber32(sd, &index)); - if (index >= *numTempBufs) - return SZ_ERROR_ARCHIVE; - namesData = (tempBufs)[index].data; - namesSize = (tempBufs)[index].size; - } - - if ((namesSize & 1) != 0) - return SZ_ERROR_ARCHIVE; - MY_ALLOC(size_t, p->FileNameOffsets, numFiles + 1, allocMain); - MY_ALLOC_ZE_AND_CPY(p->FileNames, namesSize, namesData, allocMain); - RINOK(SzReadFileNames(p->FileNames, namesSize, numFiles, p->FileNameOffsets)) - if (external == 0) - { - SKIP_DATA(sd, namesSize); - } - break; - } - case k7zIdEmptyStream: - { - RINOK(RememberBitVector(sd, numFiles, &emptyStreams)); - numEmptyStreams = CountDefinedBits(emptyStreams, numFiles); - emptyFiles = NULL; - break; - } - case k7zIdEmptyFile: - { - RINOK(RememberBitVector(sd, numEmptyStreams, &emptyFiles)); - break; - } - case k7zIdWinAttrib: - { - Byte external; - CSzData sdSwitch; - CSzData *sdPtr; - SzBitUi32s_Free(&p->Attribs, allocMain); - RINOK(ReadBitVector(sd, numFiles, &p->Attribs.Defs, allocMain)); - - SZ_READ_BYTE(external); - if (external == 0) - sdPtr = sd; - else - { - UInt32 index; - RINOK(SzReadNumber32(sd, &index)); - if (index >= *numTempBufs) - return SZ_ERROR_ARCHIVE; - sdSwitch.Data = (tempBufs)[index].data; - sdSwitch.Size = (tempBufs)[index].size; - sdPtr = &sdSwitch; - } - RINOK(ReadUi32s(sdPtr, numFiles, &p->Attribs, allocMain)); - break; - } - /* - case k7zParent: - { - SzBitUi32s_Free(&p->Parents, allocMain); - RINOK(ReadBitVector(sd, numFiles, &p->Parents.Defs, allocMain)); - RINOK(SzReadSwitch(sd)); - RINOK(ReadUi32s(sd, numFiles, &p->Parents, allocMain)); - break; - } - */ - case k7zIdMTime: RINOK(ReadTime(&p->MTime, numFiles, sd, tempBufs, *numTempBufs, allocMain)); break; - case k7zIdCTime: RINOK(ReadTime(&p->CTime, numFiles, sd, tempBufs, *numTempBufs, allocMain)); break; - default: - { - SKIP_DATA(sd, size); - } - } - } - - if (numFiles - numEmptyStreams != ssi.NumTotalSubStreams) - return SZ_ERROR_ARCHIVE; - - for (;;) - { - UInt64 type; - RINOK(ReadID(sd, &type)); - if (type == k7zIdEnd) - break; - RINOK(SkipData(sd)); - } - - { - UInt32 i; - UInt32 emptyFileIndex = 0; - UInt32 folderIndex = 0; - UInt32 remSubStreams = 0; - UInt32 numSubStreams = 0; - UInt64 unpackPos = 0; - const Byte *digestsDefs = NULL; - const Byte *digestsVals = NULL; - UInt32 digestsValsIndex = 0; - UInt32 digestIndex; - Byte allDigestsDefined = 0; - Byte isDirMask = 0; - Byte crcMask = 0; - Byte mask = 0x80; - - MY_ALLOC(UInt32, p->FolderToFile, p->db.NumFolders + 1, allocMain); - MY_ALLOC_ZE(UInt32, p->FileToFolder, p->NumFiles, allocMain); - MY_ALLOC(UInt64, p->UnpackPositions, p->NumFiles + 1, allocMain); - MY_ALLOC_ZE(Byte, p->IsDirs, (p->NumFiles + 7) >> 3, allocMain); - - RINOK(SzBitUi32s_Alloc(&p->CRCs, p->NumFiles, allocMain)); - - if (ssi.sdCRCs.Size != 0) - { - SZ_READ_BYTE_SD(&ssi.sdCRCs, allDigestsDefined); - if (allDigestsDefined) - digestsVals = ssi.sdCRCs.Data; - else - { - size_t numBytes = (ssi.NumSubDigests + 7) >> 3; - digestsDefs = ssi.sdCRCs.Data; - digestsVals = digestsDefs + numBytes; - } - } - - digestIndex = 0; - - for (i = 0; i < numFiles; i++, mask >>= 1) - { - if (mask == 0) - { - UInt32 byteIndex = (i - 1) >> 3; - p->IsDirs[byteIndex] = isDirMask; - p->CRCs.Defs[byteIndex] = crcMask; - isDirMask = 0; - crcMask = 0; - mask = 0x80; - } - - p->UnpackPositions[i] = unpackPos; - p->CRCs.Vals[i] = 0; - - if (emptyStreams && SzBitArray_Check(emptyStreams, i)) - { - if (emptyFiles) - { - if (!SzBitArray_Check(emptyFiles, emptyFileIndex)) - isDirMask |= mask; - emptyFileIndex++; - } - else - isDirMask |= mask; - if (remSubStreams == 0) - { - p->FileToFolder[i] = (UInt32)-1; - continue; - } - } - - if (remSubStreams == 0) - { - for (;;) - { - if (folderIndex >= p->db.NumFolders) - return SZ_ERROR_ARCHIVE; - p->FolderToFile[folderIndex] = i; - numSubStreams = 1; - if (ssi.sdNumSubStreams.Data) - { - RINOK(SzReadNumber32(&ssi.sdNumSubStreams, &numSubStreams)); - } - remSubStreams = numSubStreams; - if (numSubStreams != 0) - break; - { - UInt64 folderUnpackSize = SzAr_GetFolderUnpackSize(&p->db, folderIndex); - unpackPos += folderUnpackSize; - if (unpackPos < folderUnpackSize) - return SZ_ERROR_ARCHIVE; - } - - folderIndex++; - } - } - - p->FileToFolder[i] = folderIndex; - - if (emptyStreams && SzBitArray_Check(emptyStreams, i)) - continue; - - if (--remSubStreams == 0) - { - UInt64 folderUnpackSize = SzAr_GetFolderUnpackSize(&p->db, folderIndex); - UInt64 startFolderUnpackPos = p->UnpackPositions[p->FolderToFile[folderIndex]]; - if (folderUnpackSize < unpackPos - startFolderUnpackPos) - return SZ_ERROR_ARCHIVE; - unpackPos = startFolderUnpackPos + folderUnpackSize; - if (unpackPos < folderUnpackSize) - return SZ_ERROR_ARCHIVE; - - if (numSubStreams == 1 && SzBitWithVals_Check(&p->db.FolderCRCs, i)) - { - p->CRCs.Vals[i] = p->db.FolderCRCs.Vals[folderIndex]; - crcMask |= mask; - } - else if (allDigestsDefined || (digestsDefs && SzBitArray_Check(digestsDefs, digestIndex))) - { - p->CRCs.Vals[i] = GetUi32(digestsVals + (size_t)digestsValsIndex * 4); - digestsValsIndex++; - crcMask |= mask; - } - - folderIndex++; - } - else - { - UInt64 v; - RINOK(ReadNumber(&ssi.sdSizes, &v)); - unpackPos += v; - if (unpackPos < v) - return SZ_ERROR_ARCHIVE; - if (allDigestsDefined || (digestsDefs && SzBitArray_Check(digestsDefs, digestIndex))) - { - p->CRCs.Vals[i] = GetUi32(digestsVals + (size_t)digestsValsIndex * 4); - digestsValsIndex++; - crcMask |= mask; - } - } - } - - if (mask != 0x80) - { - UInt32 byteIndex = (i - 1) >> 3; - p->IsDirs[byteIndex] = isDirMask; - p->CRCs.Defs[byteIndex] = crcMask; - } - - p->UnpackPositions[i] = unpackPos; - - if (remSubStreams != 0) - return SZ_ERROR_ARCHIVE; - - for (;;) - { - p->FolderToFile[folderIndex] = i; - if (folderIndex >= p->db.NumFolders) - break; - if (!ssi.sdNumSubStreams.Data) - return SZ_ERROR_ARCHIVE; - RINOK(SzReadNumber32(&ssi.sdNumSubStreams, &numSubStreams)); - if (numSubStreams != 0) - return SZ_ERROR_ARCHIVE; - /* - { - UInt64 folderUnpackSize = SzAr_GetFolderUnpackSize(&p->db, folderIndex); - unpackPos += folderUnpackSize; - if (unpackPos < folderUnpackSize) - return SZ_ERROR_ARCHIVE; - } - */ - folderIndex++; - } - - if (ssi.sdNumSubStreams.Data && ssi.sdNumSubStreams.Size != 0) - return SZ_ERROR_ARCHIVE; - } -} - return SZ_OK; -} - - -static SRes SzReadHeader( - CSzArEx *p, - CSzData *sd, - ILookInStream *inStream, - ISzAlloc *allocMain, - ISzAlloc *allocTemp) -{ - UInt32 i; - UInt32 numTempBufs = 0; - SRes res; - CBuf tempBufs[NUM_ADDITIONAL_STREAMS_MAX]; - - for (i = 0; i < NUM_ADDITIONAL_STREAMS_MAX; i++) - Buf_Init(tempBufs + i); - - res = SzReadHeader2(p, sd, inStream, - tempBufs, &numTempBufs, - allocMain, allocTemp); - - for (i = 0; i < NUM_ADDITIONAL_STREAMS_MAX; i++) - Buf_Free(tempBufs + i, allocTemp); - - RINOK(res); - - if (sd->Size != 0) - return SZ_ERROR_FAIL; - - return res; -} - -static SRes SzArEx_Open2( - CSzArEx *p, - ILookInStream *inStream, - ISzAlloc *allocMain, - ISzAlloc *allocTemp) -{ - Byte header[k7zStartHeaderSize]; - Int64 startArcPos; - UInt64 nextHeaderOffset, nextHeaderSize; - size_t nextHeaderSizeT; - UInt32 nextHeaderCRC; - CBuf buf; - SRes res; - - startArcPos = 0; - RINOK(inStream->Seek(inStream, &startArcPos, SZ_SEEK_CUR)); - - RINOK(LookInStream_Read2(inStream, header, k7zStartHeaderSize, SZ_ERROR_NO_ARCHIVE)); - - if (!TestSignatureCandidate(header)) - return SZ_ERROR_NO_ARCHIVE; - if (header[6] != k7zMajorVersion) - return SZ_ERROR_UNSUPPORTED; - - nextHeaderOffset = GetUi64(header + 12); - nextHeaderSize = GetUi64(header + 20); - nextHeaderCRC = GetUi32(header + 28); - - p->startPosAfterHeader = startArcPos + k7zStartHeaderSize; - - if (CrcCalc(header + 12, 20) != GetUi32(header + 8)) - return SZ_ERROR_CRC; - - nextHeaderSizeT = (size_t)nextHeaderSize; - if (nextHeaderSizeT != nextHeaderSize) - return SZ_ERROR_MEM; - if (nextHeaderSizeT == 0) - return SZ_OK; - if (nextHeaderOffset > nextHeaderOffset + nextHeaderSize || - nextHeaderOffset > nextHeaderOffset + nextHeaderSize + k7zStartHeaderSize) - return SZ_ERROR_NO_ARCHIVE; - - { - Int64 pos = 0; - RINOK(inStream->Seek(inStream, &pos, SZ_SEEK_END)); - if ((UInt64)pos < startArcPos + nextHeaderOffset || - (UInt64)pos < startArcPos + k7zStartHeaderSize + nextHeaderOffset || - (UInt64)pos < startArcPos + k7zStartHeaderSize + nextHeaderOffset + nextHeaderSize) - return SZ_ERROR_INPUT_EOF; - } - - RINOK(LookInStream_SeekTo(inStream, startArcPos + k7zStartHeaderSize + nextHeaderOffset)); - - if (!Buf_Create(&buf, nextHeaderSizeT, allocTemp)) - return SZ_ERROR_MEM; - - res = LookInStream_Read(inStream, buf.data, nextHeaderSizeT); - - if (res == SZ_OK) - { - res = SZ_ERROR_ARCHIVE; - if (CrcCalc(buf.data, nextHeaderSizeT) == nextHeaderCRC) - { - CSzData sd; - UInt64 type; - sd.Data = buf.data; - sd.Size = buf.size; - - res = ReadID(&sd, &type); - - if (res == SZ_OK && type == k7zIdEncodedHeader) - { - CSzAr tempAr; - CBuf tempBuf; - Buf_Init(&tempBuf); - - SzAr_Init(&tempAr); - res = SzReadAndDecodePackedStreams(inStream, &sd, &tempBuf, 1, p->startPosAfterHeader, &tempAr, allocTemp); - SzAr_Free(&tempAr, allocTemp); - - if (res != SZ_OK) - { - Buf_Free(&tempBuf, allocTemp); - } - else - { - Buf_Free(&buf, allocTemp); - buf.data = tempBuf.data; - buf.size = tempBuf.size; - sd.Data = buf.data; - sd.Size = buf.size; - res = ReadID(&sd, &type); - } - } - - if (res == SZ_OK) - { - if (type == k7zIdHeader) - { - /* - CSzData sd2; - unsigned ttt; - for (ttt = 0; ttt < 40000; ttt++) - { - SzArEx_Free(p, allocMain); - sd2 = sd; - res = SzReadHeader(p, &sd2, inStream, allocMain, allocTemp); - if (res != SZ_OK) - break; - } - */ - res = SzReadHeader(p, &sd, inStream, allocMain, allocTemp); - } - else - res = SZ_ERROR_UNSUPPORTED; - } - } - } - - Buf_Free(&buf, allocTemp); - return res; -} - - -static SRes SzArEx_Open(CSzArEx *p, ILookInStream *inStream, - ISzAlloc *allocMain, ISzAlloc *allocTemp) -{ - SRes res = SzArEx_Open2(p, inStream, allocMain, allocTemp); - if (res != SZ_OK) - SzArEx_Free(p, allocMain); - return res; -} - - -static SRes SzArEx_Extract( - const CSzArEx *p, - ILookInStream *inStream, - UInt32 fileIndex, - UInt32 *blockIndex, - Byte **tempBuf, - size_t *outBufferSize, - size_t *offset, - size_t *outSizeProcessed, - ISzAlloc *allocMain, - ISzAlloc *allocTemp) -{ - UInt32 folderIndex = p->FileToFolder[fileIndex]; - SRes res = SZ_OK; - - *offset = 0; - *outSizeProcessed = 0; - - if (folderIndex == (UInt32)-1) - { - IAlloc_Free(allocMain, *tempBuf); - *blockIndex = folderIndex; - *tempBuf = NULL; - *outBufferSize = 0; - return SZ_OK; - } - - if (*tempBuf == NULL || *blockIndex != folderIndex) - { - UInt64 unpackSizeSpec = SzAr_GetFolderUnpackSize(&p->db, folderIndex); - /* - UInt64 unpackSizeSpec = - p->UnpackPositions[p->FolderToFile[folderIndex + 1]] - - p->UnpackPositions[p->FolderToFile[folderIndex]]; - */ - size_t unpackSize = (size_t)unpackSizeSpec; - - if (unpackSize != unpackSizeSpec) - return SZ_ERROR_MEM; - *blockIndex = folderIndex; - IAlloc_Free(allocMain, *tempBuf); - *tempBuf = NULL; - - if (res == SZ_OK) - { - *outBufferSize = unpackSize; - if (unpackSize != 0) - { - *tempBuf = (Byte *)IAlloc_Alloc(allocMain, unpackSize); - if (*tempBuf == NULL) - res = SZ_ERROR_MEM; - } - - if (res == SZ_OK) - { - res = SzAr_DecodeFolder(&p->db, folderIndex, - inStream, p->dataPos, *tempBuf, unpackSize, allocTemp); - } - } - } - - if (res == SZ_OK) - { - UInt64 unpackPos = p->UnpackPositions[fileIndex]; - *offset = (size_t)(unpackPos - p->UnpackPositions[p->FolderToFile[folderIndex]]); - *outSizeProcessed = (size_t)(p->UnpackPositions[fileIndex + 1] - unpackPos); - if (*offset + *outSizeProcessed > *outBufferSize) - return SZ_ERROR_FAIL; - if (SzBitWithVals_Check(&p->CRCs, fileIndex)) - if (CrcCalc(*tempBuf + *offset, *outSizeProcessed) != p->CRCs.Vals[fileIndex]) - res = SZ_ERROR_CRC; - } - - return res; -} - - -static size_t SzArEx_GetFileNameUtf16(const CSzArEx *p, size_t fileIndex, UInt16 *dest) -{ - size_t offs = p->FileNameOffsets[fileIndex]; - size_t len = p->FileNameOffsets[fileIndex + 1] - offs; - if (dest != 0) - { - size_t i; - const Byte *src = p->FileNames + offs * 2; - for (i = 0; i < len; i++) - dest[i] = GetUi16(src + i * 2); - } - return len; -} - -/* -static size_t SzArEx_GetFullNameLen(const CSzArEx *p, size_t fileIndex) -{ - size_t len; - if (!p->FileNameOffsets) - return 1; - len = 0; - for (;;) - { - UInt32 parent = (UInt32)(Int32)-1; - len += p->FileNameOffsets[fileIndex + 1] - p->FileNameOffsets[fileIndex]; - if SzBitWithVals_Check(&p->Parents, fileIndex) - parent = p->Parents.Vals[fileIndex]; - if (parent == (UInt32)(Int32)-1) - return len; - fileIndex = parent; - } -} - -static UInt16 *SzArEx_GetFullNameUtf16_Back(const CSzArEx *p, size_t fileIndex, UInt16 *dest) -{ - Bool needSlash; - if (!p->FileNameOffsets) - { - *(--dest) = 0; - return dest; - } - needSlash = False; - for (;;) - { - UInt32 parent = (UInt32)(Int32)-1; - size_t curLen = p->FileNameOffsets[fileIndex + 1] - p->FileNameOffsets[fileIndex]; - SzArEx_GetFileNameUtf16(p, fileIndex, dest - curLen); - if (needSlash) - *(dest - 1) = '/'; - needSlash = True; - dest -= curLen; - - if SzBitWithVals_Check(&p->Parents, fileIndex) - parent = p->Parents.Vals[fileIndex]; - if (parent == (UInt32)(Int32)-1) - return dest; - fileIndex = parent; - } -} -*/ - -/* 7zBuf.c -- Byte Buffer -2013-01-21 : Igor Pavlov : Public domain */ - -/* -#include "Precomp.h" - -#include "7zBuf.h" -*/ - -static void Buf_Init(CBuf *p) -{ - p->data = 0; - p->size = 0; -} - -static int Buf_Create(CBuf *p, size_t size, ISzAlloc *alloc) -{ - p->size = 0; - if (size == 0) - { - p->data = 0; - return 1; - } - p->data = (Byte *)alloc->Alloc(alloc, size); - if (p->data != 0) - { - p->size = size; - return 1; - } - return 0; -} - -static void Buf_Free(CBuf *p, ISzAlloc *alloc) -{ - alloc->Free(alloc, p->data); - p->data = 0; - p->size = 0; -} - -/* 7zDec.c -- Decoding from 7z folder -2015-11-18 : Igor Pavlov : Public domain */ - -/* #define _7ZIP_PPMD_SUPPPORT */ - -/* -#include "Precomp.h" - -#include - -#include "7z.h" -#include "7zCrc.h" - -#include "Bcj2.h" -#include "Bra.h" -#include "CpuArch.h" -#include "Delta.h" -#include "LzmaDec.h" -#include "Lzma2Dec.h" -#ifdef _7ZIP_PPMD_SUPPPORT -#include "Ppmd7.h" -#endif -*/ - -#define k_Copy 0 -#define k_Delta 3 -#define k_LZMA2 0x21 -#define k_LZMA 0x30101 -#define k_BCJ 0x3030103 -#define k_BCJ2 0x303011B -#define k_PPC 0x3030205 -#define k_IA64 0x3030401 -#define k_ARM 0x3030501 -#define k_ARMT 0x3030701 -#define k_SPARC 0x3030805 - - -#ifdef _7ZIP_PPMD_SUPPPORT - -#define k_PPMD 0x30401 - -typedef struct -{ - IByteIn p; - const Byte *cur; - const Byte *end; - const Byte *begin; - UInt64 processed; - Bool extra; - SRes res; - ILookInStream *inStream; -} CByteInToLook; - -static Byte ReadByte(void *pp) -{ - CByteInToLook *p = (CByteInToLook *)pp; - if (p->cur != p->end) - return *p->cur++; - if (p->res == SZ_OK) - { - size_t size = p->cur - p->begin; - p->processed += size; - p->res = p->inStream->Skip(p->inStream, size); - size = (1 << 25); - p->res = p->inStream->Look(p->inStream, (const void **)&p->begin, &size); - p->cur = p->begin; - p->end = p->begin + size; - if (size != 0) - return *p->cur++;; - } - p->extra = True; - return 0; -} - -static SRes SzDecodePpmd(const Byte *props, unsigned propsSize, UInt64 inSize, ILookInStream *inStream, - Byte *outBuffer, SizeT outSize, ISzAlloc *allocMain) -{ - CPpmd7 ppmd; - CByteInToLook s; - SRes res = SZ_OK; - - s.p.Read = ReadByte; - s.inStream = inStream; - s.begin = s.end = s.cur = NULL; - s.extra = False; - s.res = SZ_OK; - s.processed = 0; - - if (propsSize != 5) - return SZ_ERROR_UNSUPPORTED; - - { - unsigned order = props[0]; - UInt32 memSize = GetUi32(props + 1); - if (order < PPMD7_MIN_ORDER || - order > PPMD7_MAX_ORDER || - memSize < PPMD7_MIN_MEM_SIZE || - memSize > PPMD7_MAX_MEM_SIZE) - return SZ_ERROR_UNSUPPORTED; - Ppmd7_Construct(&ppmd); - if (!Ppmd7_Alloc(&ppmd, memSize, allocMain)) - return SZ_ERROR_MEM; - Ppmd7_Init(&ppmd, order); - } - { - CPpmd7z_RangeDec rc; - Ppmd7z_RangeDec_CreateVTable(&rc); - rc.Stream = &s.p; - if (!Ppmd7z_RangeDec_Init(&rc)) - res = SZ_ERROR_DATA; - else if (s.extra) - res = (s.res != SZ_OK ? s.res : SZ_ERROR_DATA); - else - { - SizeT i; - for (i = 0; i < outSize; i++) - { - int sym = Ppmd7_DecodeSymbol(&ppmd, &rc.p); - if (s.extra || sym < 0) - break; - outBuffer[i] = (Byte)sym; - } - if (i != outSize) - res = (s.res != SZ_OK ? s.res : SZ_ERROR_DATA); - else if (s.processed + (s.cur - s.begin) != inSize || !Ppmd7z_RangeDec_IsFinishedOK(&rc)) - res = SZ_ERROR_DATA; - } - } - Ppmd7_Free(&ppmd, allocMain); - return res; -} - -#endif - - -static SRes SzDecodeLzma(const Byte *props, unsigned propsSize, UInt64 inSize, ILookInStream *inStream, - Byte *outBuffer, SizeT outSize, ISzAlloc *allocMain) -{ - CLzmaDec state; - SRes res = SZ_OK; - - LzmaDec_Construct(&state); - RINOK(LzmaDec_AllocateProbs(&state, props, propsSize, allocMain)); - state.dic = outBuffer; - state.dicBufSize = outSize; - LzmaDec_Init(&state); - - for (;;) - { - const void *inBuf = NULL; - size_t lookahead = (1 << 18); - if (lookahead > inSize) - lookahead = (size_t)inSize; - res = inStream->Look(inStream, &inBuf, &lookahead); - if (res != SZ_OK) - break; - - { - SizeT inProcessed = (SizeT)lookahead, dicPos = state.dicPos; - ELzmaStatus status; - res = LzmaDec_DecodeToDic(&state, outSize, inBuf, &inProcessed, LZMA_FINISH_END, &status); - lookahead -= inProcessed; - inSize -= inProcessed; - if (res != SZ_OK) - break; - - if (status == LZMA_STATUS_FINISHED_WITH_MARK) - { - if (outSize != state.dicPos || inSize != 0) - res = SZ_ERROR_DATA; - break; - } - - if (outSize == state.dicPos && inSize == 0 && status == LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK) - break; - - if (inProcessed == 0 && dicPos == state.dicPos) - { - res = SZ_ERROR_DATA; - break; - } - - res = inStream->Skip((void *)inStream, inProcessed); - if (res != SZ_OK) - break; - } - } - - LzmaDec_FreeProbs(&state, allocMain); - return res; -} - - -#ifndef _7Z_NO_METHOD_LZMA2 - -static SRes SzDecodeLzma2(const Byte *props, unsigned propsSize, UInt64 inSize, ILookInStream *inStream, - Byte *outBuffer, SizeT outSize, ISzAlloc *allocMain) -{ - CLzma2Dec state; - SRes res = SZ_OK; - - Lzma2Dec_Construct(&state); - if (propsSize != 1) - return SZ_ERROR_DATA; - RINOK(Lzma2Dec_AllocateProbs(&state, props[0], allocMain)); - state.decoder.dic = outBuffer; - state.decoder.dicBufSize = outSize; - Lzma2Dec_Init(&state); - - for (;;) - { - const void *inBuf = NULL; - size_t lookahead = (1 << 18); - if (lookahead > inSize) - lookahead = (size_t)inSize; - res = inStream->Look(inStream, &inBuf, &lookahead); - if (res != SZ_OK) - break; - - { - SizeT inProcessed = (SizeT)lookahead, dicPos = state.decoder.dicPos; - ELzmaStatus status; - res = Lzma2Dec_DecodeToDic(&state, outSize, inBuf, &inProcessed, LZMA_FINISH_END, &status); - lookahead -= inProcessed; - inSize -= inProcessed; - if (res != SZ_OK) - break; - - if (status == LZMA_STATUS_FINISHED_WITH_MARK) - { - if (outSize != state.decoder.dicPos || inSize != 0) - res = SZ_ERROR_DATA; - break; - } - - if (inProcessed == 0 && dicPos == state.decoder.dicPos) - { - res = SZ_ERROR_DATA; - break; - } - - res = inStream->Skip((void *)inStream, inProcessed); - if (res != SZ_OK) - break; - } - } - - Lzma2Dec_FreeProbs(&state, allocMain); - return res; -} - -#endif - - -static SRes SzDecodeCopy(UInt64 inSize, ILookInStream *inStream, Byte *outBuffer) -{ - while (inSize > 0) - { - const void *inBuf; - size_t curSize = (1 << 18); - if (curSize > inSize) - curSize = (size_t)inSize; - RINOK(inStream->Look(inStream, &inBuf, &curSize)); - if (curSize == 0) - return SZ_ERROR_INPUT_EOF; - memcpy(outBuffer, inBuf, curSize); - outBuffer += curSize; - inSize -= curSize; - RINOK(inStream->Skip((void *)inStream, curSize)); - } - return SZ_OK; -} - -static Bool IS_MAIN_METHOD(UInt32 m) -{ - switch (m) - { - case k_Copy: - case k_LZMA: - #ifndef _7Z_NO_METHOD_LZMA2 - case k_LZMA2: - #endif - #ifdef _7ZIP_PPMD_SUPPPORT - case k_PPMD: - #endif - return True; - } - return False; -} - -static Bool IS_SUPPORTED_CODER(const CSzCoderInfo *c) -{ - return - c->NumStreams == 1 - /* && c->MethodID <= (UInt32)0xFFFFFFFF */ - && IS_MAIN_METHOD((UInt32)c->MethodID); -} - -#define IS_BCJ2(c) ((c)->MethodID == k_BCJ2 && (c)->NumStreams == 4) - -static SRes CheckSupportedFolder(const CSzFolder *f) -{ - if (f->NumCoders < 1 || f->NumCoders > 4) - return SZ_ERROR_UNSUPPORTED; - if (!IS_SUPPORTED_CODER(&f->Coders[0])) - return SZ_ERROR_UNSUPPORTED; - if (f->NumCoders == 1) - { - if (f->NumPackStreams != 1 || f->PackStreams[0] != 0 || f->NumBonds != 0) - return SZ_ERROR_UNSUPPORTED; - return SZ_OK; - } - - - #ifndef _7Z_NO_METHODS_FILTERS - - if (f->NumCoders == 2) - { - const CSzCoderInfo *c = &f->Coders[1]; - if ( - /* c->MethodID > (UInt32)0xFFFFFFFF || */ - c->NumStreams != 1 - || f->NumPackStreams != 1 - || f->PackStreams[0] != 0 - || f->NumBonds != 1 - || f->Bonds[0].InIndex != 1 - || f->Bonds[0].OutIndex != 0) - return SZ_ERROR_UNSUPPORTED; - switch ((UInt32)c->MethodID) - { - case k_Delta: - case k_BCJ: - case k_PPC: - case k_IA64: - case k_SPARC: - case k_ARM: - case k_ARMT: - break; - default: - return SZ_ERROR_UNSUPPORTED; - } - return SZ_OK; - } - - #endif - - - if (f->NumCoders == 4) - { - if (!IS_SUPPORTED_CODER(&f->Coders[1]) - || !IS_SUPPORTED_CODER(&f->Coders[2]) - || !IS_BCJ2(&f->Coders[3])) - return SZ_ERROR_UNSUPPORTED; - if (f->NumPackStreams != 4 - || f->PackStreams[0] != 2 - || f->PackStreams[1] != 6 - || f->PackStreams[2] != 1 - || f->PackStreams[3] != 0 - || f->NumBonds != 3 - || f->Bonds[0].InIndex != 5 || f->Bonds[0].OutIndex != 0 - || f->Bonds[1].InIndex != 4 || f->Bonds[1].OutIndex != 1 - || f->Bonds[2].InIndex != 3 || f->Bonds[2].OutIndex != 2) - return SZ_ERROR_UNSUPPORTED; - return SZ_OK; - } - - return SZ_ERROR_UNSUPPORTED; -} - -#define CASE_BRA_CONV(isa) case k_ ## isa: isa ## _Convert(outBuffer, outSize, 0, 0); break; - -static SRes SzFolder_Decode2(const CSzFolder *folder, - const Byte *propsData, - const UInt64 *unpackSizes, - const UInt64 *packPositions, - ILookInStream *inStream, UInt64 startPos, - Byte *outBuffer, SizeT outSize, ISzAlloc *allocMain, - Byte *tempBuf[]) -{ - UInt32 ci; - SizeT tempSizes[3] = { 0, 0, 0}; - SizeT tempSize3 = 0; - Byte *tempBuf3 = 0; - - RINOK(CheckSupportedFolder(folder)); - - for (ci = 0; ci < folder->NumCoders; ci++) - { - const CSzCoderInfo *coder = &folder->Coders[ci]; - - if (IS_MAIN_METHOD((UInt32)coder->MethodID)) - { - UInt32 si = 0; - UInt64 offset; - UInt64 inSize; - Byte *outBufCur = outBuffer; - SizeT outSizeCur = outSize; - if (folder->NumCoders == 4) - { - UInt32 indices[] = { 3, 2, 0 }; - UInt64 unpackSize = unpackSizes[ci]; - si = indices[ci]; - if (ci < 2) - { - Byte *temp; - outSizeCur = (SizeT)unpackSize; - if (outSizeCur != unpackSize) - return SZ_ERROR_MEM; - temp = (Byte *)IAlloc_Alloc(allocMain, outSizeCur); - if (!temp && outSizeCur != 0) - return SZ_ERROR_MEM; - outBufCur = tempBuf[1 - ci] = temp; - tempSizes[1 - ci] = outSizeCur; - } - else if (ci == 2) - { - if (unpackSize > outSize) /* check it */ - return SZ_ERROR_PARAM; - tempBuf3 = outBufCur = outBuffer + (outSize - (size_t)unpackSize); - tempSize3 = outSizeCur = (SizeT)unpackSize; - } - else - return SZ_ERROR_UNSUPPORTED; - } - offset = packPositions[si]; - inSize = packPositions[si + 1] - offset; - RINOK(LookInStream_SeekTo(inStream, startPos + offset)); - - if (coder->MethodID == k_Copy) - { - if (inSize != outSizeCur) /* check it */ - return SZ_ERROR_DATA; - RINOK(SzDecodeCopy(inSize, inStream, outBufCur)); - } - else if (coder->MethodID == k_LZMA) - { - RINOK(SzDecodeLzma(propsData + coder->PropsOffset, coder->PropsSize, inSize, inStream, outBufCur, outSizeCur, allocMain)); - } - #ifndef _7Z_NO_METHOD_LZMA2 - else if (coder->MethodID == k_LZMA2) - { - RINOK(SzDecodeLzma2(propsData + coder->PropsOffset, coder->PropsSize, inSize, inStream, outBufCur, outSizeCur, allocMain)); - } - #endif - #ifdef _7ZIP_PPMD_SUPPPORT - else if (coder->MethodID == k_PPMD) - { - RINOK(SzDecodePpmd(propsData + coder->PropsOffset, coder->PropsSize, inSize, inStream, outBufCur, outSizeCur, allocMain)); - } - #endif - else - return SZ_ERROR_UNSUPPORTED; - } - else if (coder->MethodID == k_BCJ2) - { - UInt64 offset = packPositions[1]; - UInt64 s3Size = packPositions[2] - offset; - - if (ci != 3) - return SZ_ERROR_UNSUPPORTED; - - tempSizes[2] = (SizeT)s3Size; - if (tempSizes[2] != s3Size) - return SZ_ERROR_MEM; - tempBuf[2] = (Byte *)IAlloc_Alloc(allocMain, tempSizes[2]); - if (!tempBuf[2] && tempSizes[2] != 0) - return SZ_ERROR_MEM; - - RINOK(LookInStream_SeekTo(inStream, startPos + offset)); - RINOK(SzDecodeCopy(s3Size, inStream, tempBuf[2])); - - if ((tempSizes[0] & 3) != 0 || - (tempSizes[1] & 3) != 0 || - tempSize3 + tempSizes[0] + tempSizes[1] != outSize) - return SZ_ERROR_DATA; - - { - CBcj2Dec p; - - p.bufs[0] = tempBuf3; p.lims[0] = tempBuf3 + tempSize3; - p.bufs[1] = tempBuf[0]; p.lims[1] = tempBuf[0] + tempSizes[0]; - p.bufs[2] = tempBuf[1]; p.lims[2] = tempBuf[1] + tempSizes[1]; - p.bufs[3] = tempBuf[2]; p.lims[3] = tempBuf[2] + tempSizes[2]; - - p.dest = outBuffer; - p.destLim = outBuffer + outSize; - - Bcj2Dec_Init(&p); - RINOK(Bcj2Dec_Decode(&p)); - - { - unsigned i; - for (i = 0; i < 4; i++) - if (p.bufs[i] != p.lims[i]) - return SZ_ERROR_DATA; - - if (!Bcj2Dec_IsFinished(&p)) - return SZ_ERROR_DATA; - - if (p.dest != p.destLim - || p.state != BCJ2_STREAM_MAIN) - return SZ_ERROR_DATA; - } - } - } - #ifndef _7Z_NO_METHODS_FILTERS - else if (ci == 1) - { - if (coder->MethodID == k_Delta) - { - if (coder->PropsSize != 1) - return SZ_ERROR_UNSUPPORTED; - { - Byte state[DELTA_STATE_SIZE]; - Delta_Init(state); - Delta_Decode(state, (unsigned)(propsData[coder->PropsOffset]) + 1, outBuffer, outSize); - } - } - else - { - if (coder->PropsSize != 0) - return SZ_ERROR_UNSUPPORTED; - switch (coder->MethodID) - { - case k_BCJ: - { - UInt32 state; - x86_Convert_Init(state); - x86_Convert(outBuffer, outSize, 0, &state, 0); - break; - } - CASE_BRA_CONV(PPC) - CASE_BRA_CONV(IA64) - CASE_BRA_CONV(SPARC) - CASE_BRA_CONV(ARM) - CASE_BRA_CONV(ARMT) - default: - return SZ_ERROR_UNSUPPORTED; - } - } - } - #endif - else - return SZ_ERROR_UNSUPPORTED; - } - - return SZ_OK; -} - - -static SRes SzAr_DecodeFolder(const CSzAr *p, UInt32 folderIndex, - ILookInStream *inStream, UInt64 startPos, - Byte *outBuffer, size_t outSize, - ISzAlloc *allocMain) -{ - SRes res; - CSzFolder folder; - CSzData sd; - - const Byte *data = p->CodersData + p->FoCodersOffsets[folderIndex]; - sd.Data = data; - sd.Size = p->FoCodersOffsets[folderIndex + 1] - p->FoCodersOffsets[folderIndex]; - - res = SzGetNextFolderItem(&folder, &sd); - - if (res != SZ_OK) - return res; - - if (sd.Size != 0 - || folder.UnpackStream != p->FoToMainUnpackSizeIndex[folderIndex] - || outSize != SzAr_GetFolderUnpackSize(p, folderIndex)) - return SZ_ERROR_FAIL; - { - unsigned i; - Byte *tempBuf[3] = { 0, 0, 0}; - - res = SzFolder_Decode2(&folder, data, - &p->CoderUnpackSizes[p->FoToCoderUnpackSizes[folderIndex]], - p->PackPositions + p->FoStartPackStreamIndex[folderIndex], - inStream, startPos, - outBuffer, (SizeT)outSize, allocMain, tempBuf); - - for (i = 0; i < 3; i++) - IAlloc_Free(allocMain, tempBuf[i]); - - if (res == SZ_OK) - if (SzBitWithVals_Check(&p->FolderCRCs, folderIndex)) - if (CrcCalc(outBuffer, outSize) != p->FolderCRCs.Vals[folderIndex]) - res = SZ_ERROR_CRC; - - return res; - } -} - -/* Bcj2.c -- BCJ2 Decoder (Converter for x86 code) -2015-08-01 : Igor Pavlov : Public domain */ - -/* -#include "Precomp.h" - -#include "Bcj2.h" -#include "CpuArch.h" -*/ - -#define CProb UInt16 - -#define kTopValue ((UInt32)1 << 24) -#define kNumModelBits 11 -#define kBitModelTotal (1 << kNumModelBits) -#define kNumMoveBits 5 - -#define _IF_BIT_0 ttt = *prob; bound = (p->range >> kNumModelBits) * ttt; if (p->code < bound) -#define _UPDATE_0 p->range = bound; *prob = (CProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits)); -#define _UPDATE_1 p->range -= bound; p->code -= bound; *prob = (CProb)(ttt - (ttt >> kNumMoveBits)); - -static void Bcj2Dec_Init(CBcj2Dec *p) -{ - unsigned i; - - p->state = BCJ2_DEC_STATE_OK; - p->ip = 0; - p->temp[3] = 0; - p->range = 0; - p->code = 0; - for (i = 0; i < sizeof(p->probs) / sizeof(p->probs[0]); i++) - p->probs[i] = kBitModelTotal >> 1; -} - -static SRes Bcj2Dec_Decode(CBcj2Dec *p) -{ - if (p->range <= 5) - { - p->state = BCJ2_DEC_STATE_OK; - for (; p->range != 5; p->range++) - { - if (p->range == 1 && p->code != 0) - return SZ_ERROR_DATA; - - if (p->bufs[BCJ2_STREAM_RC] == p->lims[BCJ2_STREAM_RC]) - { - p->state = BCJ2_STREAM_RC; - return SZ_OK; - } - - p->code = (p->code << 8) | *(p->bufs[BCJ2_STREAM_RC])++; - } - - if (p->code == 0xFFFFFFFF) - return SZ_ERROR_DATA; - - p->range = 0xFFFFFFFF; - } - else if (p->state >= BCJ2_DEC_STATE_ORIG_0) - { - while (p->state <= BCJ2_DEC_STATE_ORIG_3) - { - Byte *dest = p->dest; - if (dest == p->destLim) - return SZ_OK; - *dest = p->temp[p->state++ - BCJ2_DEC_STATE_ORIG_0]; - p->dest = dest + 1; - } - } - - /* - if (BCJ2_IS_32BIT_STREAM(p->state)) - { - const Byte *cur = p->bufs[p->state]; - if (cur == p->lims[p->state]) - return SZ_OK; - p->bufs[p->state] = cur + 4; - - { - UInt32 val; - Byte *dest; - SizeT rem; - - p->ip += 4; - val = GetBe32(cur) - p->ip; - dest = p->dest; - rem = p->destLim - dest; - if (rem < 4) - { - SizeT i; - SetUi32(p->temp, val); - for (i = 0; i < rem; i++) - dest[i] = p->temp[i]; - p->dest = dest + rem; - p->state = BCJ2_DEC_STATE_ORIG_0 + (unsigned)rem; - return SZ_OK; - } - SetUi32(dest, val); - p->temp[3] = (Byte)(val >> 24); - p->dest = dest + 4; - p->state = BCJ2_DEC_STATE_OK; - } - } - */ - - for (;;) - { - if (BCJ2_IS_32BIT_STREAM(p->state)) - p->state = BCJ2_DEC_STATE_OK; - else - { - if (p->range < kTopValue) - { - if (p->bufs[BCJ2_STREAM_RC] == p->lims[BCJ2_STREAM_RC]) - { - p->state = BCJ2_STREAM_RC; - return SZ_OK; - } - p->range <<= 8; - p->code = (p->code << 8) | *(p->bufs[BCJ2_STREAM_RC])++; - } - - { - const Byte *src = p->bufs[BCJ2_STREAM_MAIN]; - const Byte *srcLim; - Byte *dest; - SizeT num = p->lims[BCJ2_STREAM_MAIN] - src; - - if (num == 0) - { - p->state = BCJ2_STREAM_MAIN; - return SZ_OK; - } - - dest = p->dest; - if (num > (SizeT)(p->destLim - dest)) - { - num = p->destLim - dest; - if (num == 0) - { - p->state = BCJ2_DEC_STATE_ORIG; - return SZ_OK; - } - } - - srcLim = src + num; - - if (p->temp[3] == 0x0F && (src[0] & 0xF0) == 0x80) - *dest = src[0]; - else for (;;) - { - Byte b = *src; - *dest = b; - if (b != 0x0F) - { - if ((b & 0xFE) == 0xE8) - break; - dest++; - if (++src != srcLim) - continue; - break; - } - dest++; - if (++src == srcLim) - break; - if ((*src & 0xF0) != 0x80) - continue; - *dest = *src; - break; - } - - num = src - p->bufs[BCJ2_STREAM_MAIN]; - - if (src == srcLim) - { - p->temp[3] = src[-1]; - p->bufs[BCJ2_STREAM_MAIN] = src; - p->ip += (UInt32)num; - p->dest += num; - p->state = - p->bufs[BCJ2_STREAM_MAIN] == - p->lims[BCJ2_STREAM_MAIN] ? - (unsigned)BCJ2_STREAM_MAIN : - (unsigned)BCJ2_DEC_STATE_ORIG; - return SZ_OK; - } - - { - UInt32 bound, ttt; - CProb *prob; - Byte b = src[0]; - Byte prev = (Byte)(num == 0 ? p->temp[3] : src[-1]); - - p->temp[3] = b; - p->bufs[BCJ2_STREAM_MAIN] = src + 1; - num++; - p->ip += (UInt32)num; - p->dest += num; - - prob = p->probs + (unsigned)(b == 0xE8 ? 2 + (unsigned)prev : (b == 0xE9 ? 1 : 0)); - - _IF_BIT_0 - { - _UPDATE_0 - continue; - } - _UPDATE_1 - - } - } - } - - { - UInt32 val; - unsigned cj = (p->temp[3] == 0xE8) ? BCJ2_STREAM_CALL : BCJ2_STREAM_JUMP; - const Byte *cur = p->bufs[cj]; - Byte *dest; - SizeT rem; - - if (cur == p->lims[cj]) - { - p->state = cj; - break; - } - - val = GetBe32(cur); - p->bufs[cj] = cur + 4; - - p->ip += 4; - val -= p->ip; - dest = p->dest; - rem = p->destLim - dest; - - if (rem < 4) - { - SizeT i; - SetUi32(p->temp, val); - for (i = 0; i < rem; i++) - dest[i] = p->temp[i]; - p->dest = dest + rem; - p->state = BCJ2_DEC_STATE_ORIG_0 + (unsigned)rem; - break; - } - - SetUi32(dest, val); - p->temp[3] = (Byte)(val >> 24); - p->dest = dest + 4; - } - } - - if (p->range < kTopValue && p->bufs[BCJ2_STREAM_RC] != p->lims[BCJ2_STREAM_RC]) - { - p->range <<= 8; - p->code = (p->code << 8) | *(p->bufs[BCJ2_STREAM_RC])++; - } - - return SZ_OK; -} - -#undef kTopValue /* reused later. --ryan. */ -#undef kBitModelTotal /* reused later. --ryan. */ - - -/* Bra.c -- Converters for RISC code -2010-04-16 : Igor Pavlov : Public domain */ - -/* -#include "Precomp.h" - -#include "Bra.h" -*/ - -static SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding) -{ - SizeT i; - if (size < 4) - return 0; - size -= 4; - ip += 8; - for (i = 0; i <= size; i += 4) - { - if (data[i + 3] == 0xEB) - { - UInt32 dest; - UInt32 src = ((UInt32)data[i + 2] << 16) | ((UInt32)data[i + 1] << 8) | (data[i + 0]); - src <<= 2; - if (encoding) - dest = ip + (UInt32)i + src; - else - dest = src - (ip + (UInt32)i); - dest >>= 2; - data[i + 2] = (Byte)(dest >> 16); - data[i + 1] = (Byte)(dest >> 8); - data[i + 0] = (Byte)dest; - } - } - return i; -} - -static SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding) -{ - SizeT i; - if (size < 4) - return 0; - size -= 4; - ip += 4; - for (i = 0; i <= size; i += 2) - { - if ((data[i + 1] & 0xF8) == 0xF0 && - (data[i + 3] & 0xF8) == 0xF8) - { - UInt32 dest; - UInt32 src = - (((UInt32)data[i + 1] & 0x7) << 19) | - ((UInt32)data[i + 0] << 11) | - (((UInt32)data[i + 3] & 0x7) << 8) | - (data[i + 2]); - - src <<= 1; - if (encoding) - dest = ip + (UInt32)i + src; - else - dest = src - (ip + (UInt32)i); - dest >>= 1; - - data[i + 1] = (Byte)(0xF0 | ((dest >> 19) & 0x7)); - data[i + 0] = (Byte)(dest >> 11); - data[i + 3] = (Byte)(0xF8 | ((dest >> 8) & 0x7)); - data[i + 2] = (Byte)dest; - i += 2; - } - } - return i; -} - -static SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding) -{ - SizeT i; - if (size < 4) - return 0; - size -= 4; - for (i = 0; i <= size; i += 4) - { - if ((data[i] >> 2) == 0x12 && (data[i + 3] & 3) == 1) - { - UInt32 src = ((UInt32)(data[i + 0] & 3) << 24) | - ((UInt32)data[i + 1] << 16) | - ((UInt32)data[i + 2] << 8) | - ((UInt32)data[i + 3] & (~3)); - - UInt32 dest; - if (encoding) - dest = ip + (UInt32)i + src; - else - dest = src - (ip + (UInt32)i); - data[i + 0] = (Byte)(0x48 | ((dest >> 24) & 0x3)); - data[i + 1] = (Byte)(dest >> 16); - data[i + 2] = (Byte)(dest >> 8); - data[i + 3] &= 0x3; - data[i + 3] |= dest; - } - } - return i; -} - -static SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding) -{ - UInt32 i; - if (size < 4) - return 0; - size -= 4; - for (i = 0; i <= size; i += 4) - { - if ((data[i] == 0x40 && (data[i + 1] & 0xC0) == 0x00) || - (data[i] == 0x7F && (data[i + 1] & 0xC0) == 0xC0)) - { - UInt32 src = - ((UInt32)data[i + 0] << 24) | - ((UInt32)data[i + 1] << 16) | - ((UInt32)data[i + 2] << 8) | - ((UInt32)data[i + 3]); - UInt32 dest; - - src <<= 2; - if (encoding) - dest = ip + i + src; - else - dest = src - (ip + i); - dest >>= 2; - - dest = (((0 - ((dest >> 22) & 1)) << 22) & 0x3FFFFFFF) | (dest & 0x3FFFFF) | 0x40000000; - - data[i + 0] = (Byte)(dest >> 24); - data[i + 1] = (Byte)(dest >> 16); - data[i + 2] = (Byte)(dest >> 8); - data[i + 3] = (Byte)dest; - } - } - return i; -} - -/* Bra86.c -- Converter for x86 code (BCJ) -2013-11-12 : Igor Pavlov : Public domain */ - -/* -#include "Precomp.h" - -#include "Bra.h" -*/ - -#define Test86MSByte(b) ((((b) + 1) & 0xFE) == 0) - -static SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding) -{ - SizeT pos = 0; - UInt32 mask = *state & 7; - if (size < 5) - return 0; - size -= 4; - ip += 5; - - for (;;) - { - Byte *p = data + pos; - const Byte *limit = data + size; - for (; p < limit; p++) - if ((*p & 0xFE) == 0xE8) - break; - - { - SizeT d = (SizeT)(p - data - pos); - pos = (SizeT)(p - data); - if (p >= limit) - { - *state = (d > 2 ? 0 : mask >> (unsigned)d); - return pos; - } - if (d > 2) - mask = 0; - else - { - mask >>= (unsigned)d; - if (mask != 0 && (mask > 4 || mask == 3 || Test86MSByte(p[(mask >> 1) + 1]))) - { - mask = (mask >> 1) | 4; - pos++; - continue; - } - } - } - - if (Test86MSByte(p[4])) - { - UInt32 v = ((UInt32)p[4] << 24) | ((UInt32)p[3] << 16) | ((UInt32)p[2] << 8) | ((UInt32)p[1]); - UInt32 cur = ip + (UInt32)pos; - pos += 5; - if (encoding) - v += cur; - else - v -= cur; - if (mask != 0) - { - unsigned sh = (mask & 6) << 2; - if (Test86MSByte((Byte)(v >> sh))) - { - v ^= (((UInt32)0x100 << sh) - 1); - if (encoding) - v += cur; - else - v -= cur; - } - mask = 0; - } - p[1] = (Byte)v; - p[2] = (Byte)(v >> 8); - p[3] = (Byte)(v >> 16); - p[4] = (Byte)(0 - ((v >> 24) & 1)); - } - else - { - mask = (mask >> 1) | 4; - pos++; - } - } -} - - -/* BraIA64.c -- Converter for IA-64 code -2013-11-12 : Igor Pavlov : Public domain */ - -/* -#include "Precomp.h" - -#include "Bra.h" -*/ -static const Byte kBranchTable[32] = -{ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 4, 4, 6, 6, 0, 0, 7, 7, - 4, 4, 0, 0, 4, 4, 0, 0 -}; - -static SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding) -{ - SizeT i; - if (size < 16) - return 0; - size -= 16; - for (i = 0; i <= size; i += 16) - { - UInt32 instrTemplate = data[i] & 0x1F; - UInt32 mask = kBranchTable[instrTemplate]; - UInt32 bitPos = 5; - int slot; - for (slot = 0; slot < 3; slot++, bitPos += 41) - { - UInt32 bytePos, bitRes; - UInt64 instruction, instNorm; - int j; - if (((mask >> slot) & 1) == 0) - continue; - bytePos = (bitPos >> 3); - bitRes = bitPos & 0x7; - instruction = 0; - for (j = 0; j < 6; j++) - instruction += (UInt64)data[i + j + bytePos] << (8 * j); - - instNorm = instruction >> bitRes; - if (((instNorm >> 37) & 0xF) == 0x5 && ((instNorm >> 9) & 0x7) == 0) - { - UInt32 src = (UInt32)((instNorm >> 13) & 0xFFFFF); - UInt32 dest; - src |= ((UInt32)(instNorm >> 36) & 1) << 20; - - src <<= 4; - - if (encoding) - dest = ip + (UInt32)i + src; - else - dest = src - (ip + (UInt32)i); - - dest >>= 4; - - instNorm &= ~((UInt64)(0x8FFFFF) << 13); - instNorm |= ((UInt64)(dest & 0xFFFFF) << 13); - instNorm |= ((UInt64)(dest & 0x100000) << (36 - 20)); - - instruction &= (1 << bitRes) - 1; - instruction |= (instNorm << bitRes); - for (j = 0; j < 6; j++) - data[i + j + bytePos] = (Byte)(instruction >> (8 * j)); - } - } - } - return i; -} - - -/* Delta.c -- Delta converter -2009-05-26 : Igor Pavlov : Public domain */ - -/* -#include "Precomp.h" - -#include "Delta.h" -*/ - -static void Delta_Init(Byte *state) -{ - unsigned i; - for (i = 0; i < DELTA_STATE_SIZE; i++) - state[i] = 0; -} - -static void MyMemCpy(Byte *dest, const Byte *src, unsigned size) -{ - unsigned i; - for (i = 0; i < size; i++) - dest[i] = src[i]; -} - -static void Delta_Decode(Byte *state, unsigned delta, Byte *data, SizeT size) -{ - Byte buf[DELTA_STATE_SIZE]; - unsigned j = 0; - MyMemCpy(buf, state, delta); - { - SizeT i; - for (i = 0; i < size;) - { - for (j = 0; j < delta && i < size; i++, j++) - { - buf[j] = data[i] = (Byte)(buf[j] + data[i]); - } - } - } - if (j == delta) - j = 0; - MyMemCpy(state, buf + j, delta - j); - MyMemCpy(state + delta - j, buf, j); -} - -/* LzmaDec.c -- LZMA Decoder -2016-05-16 : Igor Pavlov : Public domain */ - -/* -#include "Precomp.h" - -#include "LzmaDec.h" - -#include -*/ - -#define kNumTopBits 24 -#define kTopValue ((UInt32)1 << kNumTopBits) - -#define kNumBitModelTotalBits 11 -#define kBitModelTotal (1 << kNumBitModelTotalBits) -#define kNumMoveBits 5 - -#define RC_INIT_SIZE 5 - -#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); } - -#define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) -#define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits)); -#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits)); -#define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \ - { UPDATE_0(p); i = (i + i); A0; } else \ - { UPDATE_1(p); i = (i + i) + 1; A1; } -#define GET_BIT(p, i) GET_BIT2(p, i, ; , ;) - -#define TREE_GET_BIT(probs, i) { GET_BIT((probs + i), i); } -#define TREE_DECODE(probs, limit, i) \ - { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; } - -/* #define _LZMA_SIZE_OPT */ - -#ifdef _LZMA_SIZE_OPT -#define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i) -#else -#define TREE_6_DECODE(probs, i) \ - { i = 1; \ - TREE_GET_BIT(probs, i); \ - TREE_GET_BIT(probs, i); \ - TREE_GET_BIT(probs, i); \ - TREE_GET_BIT(probs, i); \ - TREE_GET_BIT(probs, i); \ - TREE_GET_BIT(probs, i); \ - i -= 0x40; } -#endif - -#define NORMAL_LITER_DEC GET_BIT(prob + symbol, symbol) -#define MATCHED_LITER_DEC \ - matchByte <<= 1; \ - bit = (matchByte & offs); \ - probLit = prob + offs + bit + symbol; \ - GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit) - -#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); } - -#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) -#define UPDATE_0_CHECK range = bound; -#define UPDATE_1_CHECK range -= bound; code -= bound; -#define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \ - { UPDATE_0_CHECK; i = (i + i); A0; } else \ - { UPDATE_1_CHECK; i = (i + i) + 1; A1; } -#define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;) -#define TREE_DECODE_CHECK(probs, limit, i) \ - { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; } - - -#define kNumPosBitsMax 4 -#define kNumPosStatesMax (1 << kNumPosBitsMax) - -#define kLenNumLowBits 3 -#define kLenNumLowSymbols (1 << kLenNumLowBits) -#define kLenNumMidBits 3 -#define kLenNumMidSymbols (1 << kLenNumMidBits) -#define kLenNumHighBits 8 -#define kLenNumHighSymbols (1 << kLenNumHighBits) - -#define LenChoice 0 -#define LenChoice2 (LenChoice + 1) -#define LenLow (LenChoice2 + 1) -#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) -#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) -#define kNumLenProbs (LenHigh + kLenNumHighSymbols) - - -#define kNumStates 12 -#define kNumLitStates 7 - -#define kStartPosModelIndex 4 -#define kEndPosModelIndex 14 -#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) - -#define kNumPosSlotBits 6 -#define kNumLenToPosStates 4 - -#define kNumAlignBits 4 -#define kAlignTableSize (1 << kNumAlignBits) - -#define kMatchMinLen 2 -#define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) - -#define IsMatch 0 -#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) -#define IsRepG0 (IsRep + kNumStates) -#define IsRepG1 (IsRepG0 + kNumStates) -#define IsRepG2 (IsRepG1 + kNumStates) -#define IsRep0Long (IsRepG2 + kNumStates) -#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) -#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) -#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) -#define LenCoder (Align + kAlignTableSize) -#define RepLenCoder (LenCoder + kNumLenProbs) -#define Literal (RepLenCoder + kNumLenProbs) - -#define LZMA_BASE_SIZE 1846 -#define LZMA_LIT_SIZE 0x300 - -#if Literal != LZMA_BASE_SIZE -StopCompilingDueBUG -#endif - -#define LzmaProps_GetNumProbs(p) (Literal + ((UInt32)LZMA_LIT_SIZE << ((p)->lc + (p)->lp))) - -#define LZMA_DIC_MIN (1 << 12) - -/* First LZMA-symbol is always decoded. -And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is without last normalization -Out: - Result: - SZ_OK - OK - SZ_ERROR_DATA - Error - p->remainLen: - < kMatchSpecLenStart : normal remain - = kMatchSpecLenStart : finished - = kMatchSpecLenStart + 1 : Flush marker (unused now) - = kMatchSpecLenStart + 2 : State Init Marker (unused now) -*/ - -static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte *bufLimit) -{ - CLzmaProb *probs = p->probs; - - unsigned state = p->state; - UInt32 rep0 = p->reps[0], rep1 = p->reps[1], rep2 = p->reps[2], rep3 = p->reps[3]; - unsigned pbMask = ((unsigned)1 << (p->prop.pb)) - 1; - unsigned lpMask = ((unsigned)1 << (p->prop.lp)) - 1; - unsigned lc = p->prop.lc; - - Byte *dic = p->dic; - SizeT dicBufSize = p->dicBufSize; - SizeT dicPos = p->dicPos; - - UInt32 processedPos = p->processedPos; - UInt32 checkDicSize = p->checkDicSize; - unsigned len = 0; - - const Byte *buf = p->buf; - UInt32 range = p->range; - UInt32 code = p->code; - - do - { - CLzmaProb *prob; - UInt32 bound; - unsigned ttt; - unsigned posState = processedPos & pbMask; - - prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; - IF_BIT_0(prob) - { - unsigned symbol; - UPDATE_0(prob); - prob = probs + Literal; - if (processedPos != 0 || checkDicSize != 0) - prob += ((UInt32)LZMA_LIT_SIZE * (((processedPos & lpMask) << lc) + - (dic[(dicPos == 0 ? dicBufSize : dicPos) - 1] >> (8 - lc)))); - processedPos++; - - if (state < kNumLitStates) - { - state -= (state < 4) ? state : 3; - symbol = 1; - #ifdef _LZMA_SIZE_OPT - do { NORMAL_LITER_DEC } while (symbol < 0x100); - #else - NORMAL_LITER_DEC - NORMAL_LITER_DEC - NORMAL_LITER_DEC - NORMAL_LITER_DEC - NORMAL_LITER_DEC - NORMAL_LITER_DEC - NORMAL_LITER_DEC - NORMAL_LITER_DEC - #endif - } - else - { - unsigned matchByte = dic[dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0)]; - unsigned offs = 0x100; - state -= (state < 10) ? 3 : 6; - symbol = 1; - #ifdef _LZMA_SIZE_OPT - do - { - unsigned bit; - CLzmaProb *probLit; - MATCHED_LITER_DEC - } - while (symbol < 0x100); - #else - { - unsigned bit; - CLzmaProb *probLit; - MATCHED_LITER_DEC - MATCHED_LITER_DEC - MATCHED_LITER_DEC - MATCHED_LITER_DEC - MATCHED_LITER_DEC - MATCHED_LITER_DEC - MATCHED_LITER_DEC - MATCHED_LITER_DEC - } - #endif - } - - dic[dicPos++] = (Byte)symbol; - continue; - } - - { - UPDATE_1(prob); - prob = probs + IsRep + state; - IF_BIT_0(prob) - { - UPDATE_0(prob); - state += kNumStates; - prob = probs + LenCoder; - } - else - { - UPDATE_1(prob); - if (checkDicSize == 0 && processedPos == 0) - return SZ_ERROR_DATA; - prob = probs + IsRepG0 + state; - IF_BIT_0(prob) - { - UPDATE_0(prob); - prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; - IF_BIT_0(prob) - { - UPDATE_0(prob); - dic[dicPos] = dic[dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0)]; - dicPos++; - processedPos++; - state = state < kNumLitStates ? 9 : 11; - continue; - } - UPDATE_1(prob); - } - else - { - UInt32 distance; - UPDATE_1(prob); - prob = probs + IsRepG1 + state; - IF_BIT_0(prob) - { - UPDATE_0(prob); - distance = rep1; - } - else - { - UPDATE_1(prob); - prob = probs + IsRepG2 + state; - IF_BIT_0(prob) - { - UPDATE_0(prob); - distance = rep2; - } - else - { - UPDATE_1(prob); - distance = rep3; - rep3 = rep2; - } - rep2 = rep1; - } - rep1 = rep0; - rep0 = distance; - } - state = state < kNumLitStates ? 8 : 11; - prob = probs + RepLenCoder; - } - - #ifdef _LZMA_SIZE_OPT - { - unsigned lim, offset; - CLzmaProb *probLen = prob + LenChoice; - IF_BIT_0(probLen) - { - UPDATE_0(probLen); - probLen = prob + LenLow + (posState << kLenNumLowBits); - offset = 0; - lim = (1 << kLenNumLowBits); - } - else - { - UPDATE_1(probLen); - probLen = prob + LenChoice2; - IF_BIT_0(probLen) - { - UPDATE_0(probLen); - probLen = prob + LenMid + (posState << kLenNumMidBits); - offset = kLenNumLowSymbols; - lim = (1 << kLenNumMidBits); - } - else - { - UPDATE_1(probLen); - probLen = prob + LenHigh; - offset = kLenNumLowSymbols + kLenNumMidSymbols; - lim = (1 << kLenNumHighBits); - } - } - TREE_DECODE(probLen, lim, len); - len += offset; - } - #else - { - CLzmaProb *probLen = prob + LenChoice; - IF_BIT_0(probLen) - { - UPDATE_0(probLen); - probLen = prob + LenLow + (posState << kLenNumLowBits); - len = 1; - TREE_GET_BIT(probLen, len); - TREE_GET_BIT(probLen, len); - TREE_GET_BIT(probLen, len); - len -= 8; - } - else - { - UPDATE_1(probLen); - probLen = prob + LenChoice2; - IF_BIT_0(probLen) - { - UPDATE_0(probLen); - probLen = prob + LenMid + (posState << kLenNumMidBits); - len = 1; - TREE_GET_BIT(probLen, len); - TREE_GET_BIT(probLen, len); - TREE_GET_BIT(probLen, len); - } - else - { - UPDATE_1(probLen); - probLen = prob + LenHigh; - TREE_DECODE(probLen, (1 << kLenNumHighBits), len); - len += kLenNumLowSymbols + kLenNumMidSymbols; - } - } - } - #endif - - if (state >= kNumStates) - { - UInt32 distance; - prob = probs + PosSlot + - ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits); - TREE_6_DECODE(prob, distance); - if (distance >= kStartPosModelIndex) - { - unsigned posSlot = (unsigned)distance; - unsigned numDirectBits = (unsigned)(((distance >> 1) - 1)); - distance = (2 | (distance & 1)); - if (posSlot < kEndPosModelIndex) - { - distance <<= numDirectBits; - prob = probs + SpecPos + distance - posSlot - 1; - { - UInt32 mask = 1; - unsigned i = 1; - do - { - GET_BIT2(prob + i, i, ; , distance |= mask); - mask <<= 1; - } - while (--numDirectBits != 0); - } - } - else - { - numDirectBits -= kNumAlignBits; - do - { - NORMALIZE - range >>= 1; - - { - UInt32 t; - code -= range; - t = (0 - ((UInt32)code >> 31)); /* (UInt32)((Int32)code >> 31) */ - distance = (distance << 1) + (t + 1); - code += range & t; - } - /* - distance <<= 1; - if (code >= range) - { - code -= range; - distance |= 1; - } - */ - } - while (--numDirectBits != 0); - prob = probs + Align; - distance <<= kNumAlignBits; - { - unsigned i = 1; - GET_BIT2(prob + i, i, ; , distance |= 1); - GET_BIT2(prob + i, i, ; , distance |= 2); - GET_BIT2(prob + i, i, ; , distance |= 4); - GET_BIT2(prob + i, i, ; , distance |= 8); - } - if (distance == (UInt32)0xFFFFFFFF) - { - len += kMatchSpecLenStart; - state -= kNumStates; - break; - } - } - } - - rep3 = rep2; - rep2 = rep1; - rep1 = rep0; - rep0 = distance + 1; - if (checkDicSize == 0) - { - if (distance >= processedPos) - { - p->dicPos = dicPos; - return SZ_ERROR_DATA; - } - } - else if (distance >= checkDicSize) - { - p->dicPos = dicPos; - return SZ_ERROR_DATA; - } - state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3; - } - - len += kMatchMinLen; - - { - SizeT rem; - unsigned curLen; - SizeT pos; - - if ((rem = limit - dicPos) == 0) - { - p->dicPos = dicPos; - return SZ_ERROR_DATA; - } - - curLen = ((rem < len) ? (unsigned)rem : len); - pos = dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0); - - processedPos += curLen; - - len -= curLen; - if (curLen <= dicBufSize - pos) - { - Byte *dest = dic + dicPos; - ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos; - const Byte *lim = dest + curLen; - dicPos += curLen; - do - *(dest) = (Byte)*(dest + src); - while (++dest != lim); - } - else - { - do - { - dic[dicPos++] = dic[pos]; - if (++pos == dicBufSize) - pos = 0; - } - while (--curLen != 0); - } - } - } - } - while (dicPos < limit && buf < bufLimit); - - NORMALIZE; - - p->buf = buf; - p->range = range; - p->code = code; - p->remainLen = len; - p->dicPos = dicPos; - p->processedPos = processedPos; - p->reps[0] = rep0; - p->reps[1] = rep1; - p->reps[2] = rep2; - p->reps[3] = rep3; - p->state = state; - - return SZ_OK; -} - -static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit) -{ - if (p->remainLen != 0 && p->remainLen < kMatchSpecLenStart) - { - Byte *dic = p->dic; - SizeT dicPos = p->dicPos; - SizeT dicBufSize = p->dicBufSize; - unsigned len = p->remainLen; - SizeT rep0 = p->reps[0]; /* we use SizeT to avoid the BUG of VC14 for AMD64 */ - SizeT rem = limit - dicPos; - if (rem < len) - len = (unsigned)(rem); - - if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= len) - p->checkDicSize = p->prop.dicSize; - - p->processedPos += len; - p->remainLen -= len; - while (len != 0) - { - len--; - dic[dicPos] = dic[dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0)]; - dicPos++; - } - p->dicPos = dicPos; - } -} - -static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit) -{ - do - { - SizeT limit2 = limit; - if (p->checkDicSize == 0) - { - UInt32 rem = p->prop.dicSize - p->processedPos; - if (limit - p->dicPos > rem) - limit2 = p->dicPos + rem; - } - - RINOK(LzmaDec_DecodeReal(p, limit2, bufLimit)); - - if (p->checkDicSize == 0 && p->processedPos >= p->prop.dicSize) - p->checkDicSize = p->prop.dicSize; - - LzmaDec_WriteRem(p, limit); - } - while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart); - - if (p->remainLen > kMatchSpecLenStart) - p->remainLen = kMatchSpecLenStart; - - return 0; -} - -typedef enum -{ - DUMMY_ERROR, /* unexpected end of input stream */ - DUMMY_LIT, - DUMMY_MATCH, - DUMMY_REP -} ELzmaDummy; - -static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inSize) -{ - UInt32 range = p->range; - UInt32 code = p->code; - const Byte *bufLimit = buf + inSize; - const CLzmaProb *probs = p->probs; - unsigned state = p->state; - ELzmaDummy res; - - { - const CLzmaProb *prob; - UInt32 bound; - unsigned ttt; - unsigned posState = (p->processedPos) & ((1 << p->prop.pb) - 1); - - prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; - IF_BIT_0_CHECK(prob) - { - UPDATE_0_CHECK - - /* if (bufLimit - buf >= 7) return DUMMY_LIT; */ - - prob = probs + Literal; - if (p->checkDicSize != 0 || p->processedPos != 0) - prob += ((UInt32)LZMA_LIT_SIZE * - ((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) + - (p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc)))); - - if (state < kNumLitStates) - { - unsigned symbol = 1; - do { GET_BIT_CHECK(prob + symbol, symbol) } while (symbol < 0x100); - } - else - { - unsigned matchByte = p->dic[p->dicPos - p->reps[0] + - (p->dicPos < p->reps[0] ? p->dicBufSize : 0)]; - unsigned offs = 0x100; - unsigned symbol = 1; - do - { - unsigned bit; - const CLzmaProb *probLit; - matchByte <<= 1; - bit = (matchByte & offs); - probLit = prob + offs + bit + symbol; - GET_BIT2_CHECK(probLit, symbol, offs &= ~bit, offs &= bit) - } - while (symbol < 0x100); - } - res = DUMMY_LIT; - } - else - { - unsigned len; - UPDATE_1_CHECK; - - prob = probs + IsRep + state; - IF_BIT_0_CHECK(prob) - { - UPDATE_0_CHECK; - state = 0; - prob = probs + LenCoder; - res = DUMMY_MATCH; - } - else - { - UPDATE_1_CHECK; - res = DUMMY_REP; - prob = probs + IsRepG0 + state; - IF_BIT_0_CHECK(prob) - { - UPDATE_0_CHECK; - prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; - IF_BIT_0_CHECK(prob) - { - UPDATE_0_CHECK; - NORMALIZE_CHECK; - return DUMMY_REP; - } - else - { - UPDATE_1_CHECK; - } - } - else - { - UPDATE_1_CHECK; - prob = probs + IsRepG1 + state; - IF_BIT_0_CHECK(prob) - { - UPDATE_0_CHECK; - } - else - { - UPDATE_1_CHECK; - prob = probs + IsRepG2 + state; - IF_BIT_0_CHECK(prob) - { - UPDATE_0_CHECK; - } - else - { - UPDATE_1_CHECK; - } - } - } - state = kNumStates; - prob = probs + RepLenCoder; - } - { - unsigned limit, offset; - const CLzmaProb *probLen = prob + LenChoice; - IF_BIT_0_CHECK(probLen) - { - UPDATE_0_CHECK; - probLen = prob + LenLow + (posState << kLenNumLowBits); - offset = 0; - limit = 1 << kLenNumLowBits; - } - else - { - UPDATE_1_CHECK; - probLen = prob + LenChoice2; - IF_BIT_0_CHECK(probLen) - { - UPDATE_0_CHECK; - probLen = prob + LenMid + (posState << kLenNumMidBits); - offset = kLenNumLowSymbols; - limit = 1 << kLenNumMidBits; - } - else - { - UPDATE_1_CHECK; - probLen = prob + LenHigh; - offset = kLenNumLowSymbols + kLenNumMidSymbols; - limit = 1 << kLenNumHighBits; - } - } - TREE_DECODE_CHECK(probLen, limit, len); - len += offset; - } - - if (state < 4) - { - unsigned posSlot; - prob = probs + PosSlot + - ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << - kNumPosSlotBits); - TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot); - if (posSlot >= kStartPosModelIndex) - { - unsigned numDirectBits = ((posSlot >> 1) - 1); - - /* if (bufLimit - buf >= 8) return DUMMY_MATCH; */ - - if (posSlot < kEndPosModelIndex) - { - prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits) - posSlot - 1; - } - else - { - numDirectBits -= kNumAlignBits; - do - { - NORMALIZE_CHECK - range >>= 1; - code -= range & (((code - range) >> 31) - 1); - /* if (code >= range) code -= range; */ - } - while (--numDirectBits != 0); - prob = probs + Align; - numDirectBits = kNumAlignBits; - } - { - unsigned i = 1; - do - { - GET_BIT_CHECK(prob + i, i); - } - while (--numDirectBits != 0); - } - } - } - } - } - NORMALIZE_CHECK; - return res; -} - - -static void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState) -{ - p->needFlush = 1; - p->remainLen = 0; - p->tempBufSize = 0; - - if (initDic) - { - p->processedPos = 0; - p->checkDicSize = 0; - p->needInitState = 1; - } - if (initState) - p->needInitState = 1; -} - -static void LzmaDec_Init(CLzmaDec *p) -{ - p->dicPos = 0; - LzmaDec_InitDicAndState(p, True, True); -} - -static void LzmaDec_InitStateReal(CLzmaDec *p) -{ - SizeT numProbs = LzmaProps_GetNumProbs(&p->prop); - SizeT i; - CLzmaProb *probs = p->probs; - for (i = 0; i < numProbs; i++) - probs[i] = kBitModelTotal >> 1; - p->reps[0] = p->reps[1] = p->reps[2] = p->reps[3] = 1; - p->state = 0; - p->needInitState = 0; -} - -static SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, - ELzmaFinishMode finishMode, ELzmaStatus *status) -{ - SizeT inSize = *srcLen; - (*srcLen) = 0; - LzmaDec_WriteRem(p, dicLimit); - - *status = LZMA_STATUS_NOT_SPECIFIED; - - while (p->remainLen != kMatchSpecLenStart) - { - int checkEndMarkNow; - - if (p->needFlush) - { - for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--) - p->tempBuf[p->tempBufSize++] = *src++; - if (p->tempBufSize < RC_INIT_SIZE) - { - *status = LZMA_STATUS_NEEDS_MORE_INPUT; - return SZ_OK; - } - if (p->tempBuf[0] != 0) - return SZ_ERROR_DATA; - p->code = - ((UInt32)p->tempBuf[1] << 24) - | ((UInt32)p->tempBuf[2] << 16) - | ((UInt32)p->tempBuf[3] << 8) - | ((UInt32)p->tempBuf[4]); - p->range = 0xFFFFFFFF; - p->needFlush = 0; - p->tempBufSize = 0; - } - - checkEndMarkNow = 0; - if (p->dicPos >= dicLimit) - { - if (p->remainLen == 0 && p->code == 0) - { - *status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK; - return SZ_OK; - } - if (finishMode == LZMA_FINISH_ANY) - { - *status = LZMA_STATUS_NOT_FINISHED; - return SZ_OK; - } - if (p->remainLen != 0) - { - *status = LZMA_STATUS_NOT_FINISHED; - return SZ_ERROR_DATA; - } - checkEndMarkNow = 1; - } - - if (p->needInitState) - LzmaDec_InitStateReal(p); - - if (p->tempBufSize == 0) - { - SizeT processed; - const Byte *bufLimit; - if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) - { - int dummyRes = LzmaDec_TryDummy(p, src, inSize); - if (dummyRes == DUMMY_ERROR) - { - memcpy(p->tempBuf, src, inSize); - p->tempBufSize = (unsigned)inSize; - (*srcLen) += inSize; - *status = LZMA_STATUS_NEEDS_MORE_INPUT; - return SZ_OK; - } - if (checkEndMarkNow && dummyRes != DUMMY_MATCH) - { - *status = LZMA_STATUS_NOT_FINISHED; - return SZ_ERROR_DATA; - } - bufLimit = src; - } - else - bufLimit = src + inSize - LZMA_REQUIRED_INPUT_MAX; - p->buf = src; - if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0) - return SZ_ERROR_DATA; - processed = (SizeT)(p->buf - src); - (*srcLen) += processed; - src += processed; - inSize -= processed; - } - else - { - unsigned rem = p->tempBufSize, lookAhead = 0; - while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize) - p->tempBuf[rem++] = src[lookAhead++]; - p->tempBufSize = rem; - if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) - { - int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem); - if (dummyRes == DUMMY_ERROR) - { - (*srcLen) += lookAhead; - *status = LZMA_STATUS_NEEDS_MORE_INPUT; - return SZ_OK; - } - if (checkEndMarkNow && dummyRes != DUMMY_MATCH) - { - *status = LZMA_STATUS_NOT_FINISHED; - return SZ_ERROR_DATA; - } - } - p->buf = p->tempBuf; - if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0) - return SZ_ERROR_DATA; - - { - unsigned kkk = (unsigned)(p->buf - p->tempBuf); - if (rem < kkk) - return SZ_ERROR_FAIL; /* some internal error */ - rem -= kkk; - if (lookAhead < rem) - return SZ_ERROR_FAIL; /* some internal error */ - lookAhead -= rem; - } - (*srcLen) += lookAhead; - src += lookAhead; - inSize -= lookAhead; - p->tempBufSize = 0; - } - } - if (p->code == 0) - *status = LZMA_STATUS_FINISHED_WITH_MARK; - return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA; -} - -static void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc) -{ - alloc->Free(alloc, p->probs); - p->probs = NULL; -} - -static SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size) -{ - UInt32 dicSize; - Byte d; - - if (size < LZMA_PROPS_SIZE) - return SZ_ERROR_UNSUPPORTED; - else - dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24); - - if (dicSize < LZMA_DIC_MIN) - dicSize = LZMA_DIC_MIN; - p->dicSize = dicSize; - - d = data[0]; - if (d >= (9 * 5 * 5)) - return SZ_ERROR_UNSUPPORTED; - - p->lc = d % 9; - d /= 9; - p->pb = d / 5; - p->lp = d % 5; - - return SZ_OK; -} - -static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc) -{ - UInt32 numProbs = LzmaProps_GetNumProbs(propNew); - if (!p->probs || numProbs != p->numProbs) - { - LzmaDec_FreeProbs(p, alloc); - p->probs = (CLzmaProb *)alloc->Alloc(alloc, numProbs * sizeof(CLzmaProb)); - p->numProbs = numProbs; - if (!p->probs) - return SZ_ERROR_MEM; - } - return SZ_OK; -} - -static SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) -{ - CLzmaProps propNew; - RINOK(LzmaProps_Decode(&propNew, props, propsSize)); - RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); - p->prop = propNew; - return SZ_OK; -} - -/* Lzma2Dec.c -- LZMA2 Decoder -2015-11-09 : Igor Pavlov : Public domain */ - -/* #define SHOW_DEBUG_INFO */ - -/* -#include "Precomp.h" - -#ifdef SHOW_DEBUG_INFO -#include -#endif - -#include - -#include "Lzma2Dec.h" -*/ - -/* -00000000 - EOS -00000001 U U - Uncompressed Reset Dic -00000010 U U - Uncompressed No Reset -100uuuuu U U P P - LZMA no reset -101uuuuu U U P P - LZMA reset state -110uuuuu U U P P S - LZMA reset state + new prop -111uuuuu U U P P S - LZMA reset state + new prop + reset dic - - u, U - Unpack Size - P - Pack Size - S - Props -*/ - -#define LZMA2_CONTROL_LZMA (1 << 7) -#define LZMA2_CONTROL_COPY_NO_RESET 2 -#define LZMA2_CONTROL_COPY_RESET_DIC 1 -#define LZMA2_CONTROL_EOF 0 - -#define LZMA2_IS_UNCOMPRESSED_STATE(p) (((p)->control & LZMA2_CONTROL_LZMA) == 0) - -#define LZMA2_GET_LZMA_MODE(p) (((p)->control >> 5) & 3) -#define LZMA2_IS_THERE_PROP(mode) ((mode) >= 2) - -#define LZMA2_LCLP_MAX 4 -#define LZMA2_DIC_SIZE_FROM_PROP(p) (((UInt32)2 | ((p) & 1)) << ((p) / 2 + 11)) - -#ifdef SHOW_DEBUG_INFO -#define PRF(x) x -#else -#define PRF(x) -#endif - -typedef enum -{ - LZMA2_STATE_CONTROL, - LZMA2_STATE_UNPACK0, - LZMA2_STATE_UNPACK1, - LZMA2_STATE_PACK0, - LZMA2_STATE_PACK1, - LZMA2_STATE_PROP, - LZMA2_STATE_DATA, - LZMA2_STATE_DATA_CONT, - LZMA2_STATE_FINISHED, - LZMA2_STATE_ERROR -} ELzma2State; - -static SRes Lzma2Dec_GetOldProps(Byte prop, Byte *props) -{ - UInt32 dicSize; - if (prop > 40) - return SZ_ERROR_UNSUPPORTED; - dicSize = (prop == 40) ? 0xFFFFFFFF : LZMA2_DIC_SIZE_FROM_PROP(prop); - props[0] = (Byte)LZMA2_LCLP_MAX; - props[1] = (Byte)(dicSize); - props[2] = (Byte)(dicSize >> 8); - props[3] = (Byte)(dicSize >> 16); - props[4] = (Byte)(dicSize >> 24); - return SZ_OK; -} - -static SRes Lzma2Dec_AllocateProbs(CLzma2Dec *p, Byte prop, ISzAlloc *alloc) -{ - Byte props[LZMA_PROPS_SIZE]; - RINOK(Lzma2Dec_GetOldProps(prop, props)); - return LzmaDec_AllocateProbs(&p->decoder, props, LZMA_PROPS_SIZE, alloc); -} - -static void Lzma2Dec_Init(CLzma2Dec *p) -{ - p->state = LZMA2_STATE_CONTROL; - p->needInitDic = True; - p->needInitState = True; - p->needInitProp = True; - LzmaDec_Init(&p->decoder); -} - -static ELzma2State Lzma2Dec_UpdateState(CLzma2Dec *p, Byte b) -{ - switch (p->state) - { - case LZMA2_STATE_CONTROL: - p->control = b; - PRF(printf("\n %4X ", (unsigned)p->decoder.dicPos)); - PRF(printf(" %2X", (unsigned)b)); - if (p->control == 0) - return LZMA2_STATE_FINISHED; - if (LZMA2_IS_UNCOMPRESSED_STATE(p)) - { - if ((p->control & 0x7F) > 2) - return LZMA2_STATE_ERROR; - p->unpackSize = 0; - } - else - p->unpackSize = (UInt32)(p->control & 0x1F) << 16; - return LZMA2_STATE_UNPACK0; - - case LZMA2_STATE_UNPACK0: - p->unpackSize |= (UInt32)b << 8; - return LZMA2_STATE_UNPACK1; - - case LZMA2_STATE_UNPACK1: - p->unpackSize |= (UInt32)b; - p->unpackSize++; - PRF(printf(" %8u", (unsigned)p->unpackSize)); - return (LZMA2_IS_UNCOMPRESSED_STATE(p)) ? LZMA2_STATE_DATA : LZMA2_STATE_PACK0; - - case LZMA2_STATE_PACK0: - p->packSize = (UInt32)b << 8; - return LZMA2_STATE_PACK1; - - case LZMA2_STATE_PACK1: - p->packSize |= (UInt32)b; - p->packSize++; - PRF(printf(" %8u", (unsigned)p->packSize)); - return LZMA2_IS_THERE_PROP(LZMA2_GET_LZMA_MODE(p)) ? LZMA2_STATE_PROP: - (p->needInitProp ? LZMA2_STATE_ERROR : LZMA2_STATE_DATA); - - case LZMA2_STATE_PROP: - { - unsigned lc, lp; - if (b >= (9 * 5 * 5)) - return LZMA2_STATE_ERROR; - lc = b % 9; - b /= 9; - p->decoder.prop.pb = b / 5; - lp = b % 5; - if (lc + lp > LZMA2_LCLP_MAX) - return LZMA2_STATE_ERROR; - p->decoder.prop.lc = lc; - p->decoder.prop.lp = lp; - p->needInitProp = False; - return LZMA2_STATE_DATA; - } - } - return LZMA2_STATE_ERROR; -} - -static void LzmaDec_UpdateWithUncompressed(CLzmaDec *p, const Byte *src, SizeT size) -{ - memcpy(p->dic + p->dicPos, src, size); - p->dicPos += size; - if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= size) - p->checkDicSize = p->prop.dicSize; - p->processedPos += (UInt32)size; -} - -static void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState); - -static SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, SizeT dicLimit, - const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) -{ - SizeT inSize = *srcLen; - *srcLen = 0; - *status = LZMA_STATUS_NOT_SPECIFIED; - - while (p->state != LZMA2_STATE_FINISHED) - { - SizeT dicPos = p->decoder.dicPos; - - if (p->state == LZMA2_STATE_ERROR) - return SZ_ERROR_DATA; - - if (dicPos == dicLimit && finishMode == LZMA_FINISH_ANY) - { - *status = LZMA_STATUS_NOT_FINISHED; - return SZ_OK; - } - - if (p->state != LZMA2_STATE_DATA && p->state != LZMA2_STATE_DATA_CONT) - { - if (*srcLen == inSize) - { - *status = LZMA_STATUS_NEEDS_MORE_INPUT; - return SZ_OK; - } - (*srcLen)++; - p->state = Lzma2Dec_UpdateState(p, *src++); - - if (dicPos == dicLimit && p->state != LZMA2_STATE_FINISHED) - { - p->state = LZMA2_STATE_ERROR; - return SZ_ERROR_DATA; - } - continue; - } - - { - SizeT destSizeCur = dicLimit - dicPos; - SizeT srcSizeCur = inSize - *srcLen; - ELzmaFinishMode curFinishMode = LZMA_FINISH_ANY; - - if (p->unpackSize <= destSizeCur) - { - destSizeCur = (SizeT)p->unpackSize; - curFinishMode = LZMA_FINISH_END; - } - - if (LZMA2_IS_UNCOMPRESSED_STATE(p)) - { - if (*srcLen == inSize) - { - *status = LZMA_STATUS_NEEDS_MORE_INPUT; - return SZ_OK; - } - - if (p->state == LZMA2_STATE_DATA) - { - Bool initDic = (p->control == LZMA2_CONTROL_COPY_RESET_DIC); - if (initDic) - p->needInitProp = p->needInitState = True; - else if (p->needInitDic) - { - p->state = LZMA2_STATE_ERROR; - return SZ_ERROR_DATA; - } - p->needInitDic = False; - LzmaDec_InitDicAndState(&p->decoder, initDic, False); - } - - if (srcSizeCur > destSizeCur) - srcSizeCur = destSizeCur; - - if (srcSizeCur == 0) - { - p->state = LZMA2_STATE_ERROR; - return SZ_ERROR_DATA; - } - - LzmaDec_UpdateWithUncompressed(&p->decoder, src, srcSizeCur); - - src += srcSizeCur; - *srcLen += srcSizeCur; - p->unpackSize -= (UInt32)srcSizeCur; - p->state = (p->unpackSize == 0) ? LZMA2_STATE_CONTROL : LZMA2_STATE_DATA_CONT; - } - else - { - SizeT outSizeProcessed; - SRes res; - - if (p->state == LZMA2_STATE_DATA) - { - unsigned mode = LZMA2_GET_LZMA_MODE(p); - Bool initDic = (mode == 3); - Bool initState = (mode != 0); - if ((!initDic && p->needInitDic) || (!initState && p->needInitState)) - { - p->state = LZMA2_STATE_ERROR; - return SZ_ERROR_DATA; - } - - LzmaDec_InitDicAndState(&p->decoder, initDic, initState); - p->needInitDic = False; - p->needInitState = False; - p->state = LZMA2_STATE_DATA_CONT; - } - - if (srcSizeCur > p->packSize) - srcSizeCur = (SizeT)p->packSize; - - res = LzmaDec_DecodeToDic(&p->decoder, dicPos + destSizeCur, src, &srcSizeCur, curFinishMode, status); - - src += srcSizeCur; - *srcLen += srcSizeCur; - p->packSize -= (UInt32)srcSizeCur; - - outSizeProcessed = p->decoder.dicPos - dicPos; - p->unpackSize -= (UInt32)outSizeProcessed; - - RINOK(res); - if (*status == LZMA_STATUS_NEEDS_MORE_INPUT) - return res; - - if (srcSizeCur == 0 && outSizeProcessed == 0) - { - if (*status != LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK - || p->unpackSize != 0 - || p->packSize != 0) - { - p->state = LZMA2_STATE_ERROR; - return SZ_ERROR_DATA; - } - p->state = LZMA2_STATE_CONTROL; - } - - if (*status == LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK) - *status = LZMA_STATUS_NOT_FINISHED; - } - } - } - - *status = LZMA_STATUS_FINISHED_WITH_MARK; - return SZ_OK; -} - -#endif /* _INCLUDE_PHYSFS_LZMASDK_H_ */ - -/* end of physfs_lzmasdk.h ... */ - diff --git a/love/src/jni/love/src/libraries/physfs/physfs_miniz.h b/love/src/jni/love/src/libraries/physfs/physfs_miniz.h deleted file mode 100644 index 30d6f4cc..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_miniz.h +++ /dev/null @@ -1,701 +0,0 @@ -/* tinfl.c v1.11 - public domain inflate with zlib header parsing/adler32 checking (inflate-only subset of miniz.c) - See "unlicense" statement at the end of this file. - Rich Geldreich , last updated May 20, 2011 - Implements RFC 1950: https://www.ietf.org/rfc/rfc1950.txt and RFC 1951: https://www.ietf.org/rfc/rfc1951.txt - - The entire decompressor coroutine is implemented in tinfl_decompress(). The other functions are optional high-level helpers. -*/ -#ifndef TINFL_HEADER_INCLUDED -#define TINFL_HEADER_INCLUDED - -typedef PHYSFS_uint8 mz_uint8; -typedef PHYSFS_sint16 mz_int16; -typedef PHYSFS_uint16 mz_uint16; -typedef PHYSFS_uint32 mz_uint32; -typedef unsigned int mz_uint; -typedef PHYSFS_uint64 mz_uint64; - -/* For more compatibility with zlib, miniz.c uses unsigned long for some parameters/struct members. */ -typedef unsigned long mz_ulong; - -/* Heap allocation callbacks. */ -typedef void *(*mz_alloc_func)(void *opaque, unsigned int items, unsigned int size); -typedef void (*mz_free_func)(void *opaque, void *address); - -#if defined(_M_IX86) || defined(_M_X64) -/* Set MINIZ_USE_UNALIGNED_LOADS_AND_STORES to 1 if integer loads and stores to unaligned addresses are acceptable on the target platform (slightly faster). */ -#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 1 -/* Set MINIZ_LITTLE_ENDIAN to 1 if the processor is little endian. */ -#define MINIZ_LITTLE_ENDIAN 1 -#endif - -#if defined(_WIN64) || defined(__MINGW64__) || defined(_LP64) || defined(__LP64__) -/* Set MINIZ_HAS_64BIT_REGISTERS to 1 if the processor has 64-bit general purpose registers (enables 64-bit bitbuffer in inflator) */ -#define MINIZ_HAS_64BIT_REGISTERS 1 -#endif - -/* Works around MSVC's spammy "warning C4127: conditional expression is constant" message. */ -#ifdef _MSC_VER -#define MZ_MACRO_END while (0, 0) -#else -#define MZ_MACRO_END while (0) -#endif - -/* Decompression flags. */ -enum -{ - TINFL_FLAG_PARSE_ZLIB_HEADER = 1, - TINFL_FLAG_HAS_MORE_INPUT = 2, - TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF = 4, - TINFL_FLAG_COMPUTE_ADLER32 = 8 -}; - -struct tinfl_decompressor_tag; typedef struct tinfl_decompressor_tag tinfl_decompressor; - -/* Max size of LZ dictionary. */ -#define TINFL_LZ_DICT_SIZE 32768 - -/* Return status. */ -typedef enum -{ - TINFL_STATUS_BAD_PARAM = -3, - TINFL_STATUS_ADLER32_MISMATCH = -2, - TINFL_STATUS_FAILED = -1, - TINFL_STATUS_DONE = 0, - TINFL_STATUS_NEEDS_MORE_INPUT = 1, - TINFL_STATUS_HAS_MORE_OUTPUT = 2 -} tinfl_status; - -/* Initializes the decompressor to its initial state. */ -#define tinfl_init(r) do { (r)->m_state = 0; } MZ_MACRO_END -#define tinfl_get_adler32(r) (r)->m_check_adler32 - -/* Main low-level decompressor coroutine function. This is the only function actually needed for decompression. All the other functions are just high-level helpers for improved usability. */ -/* This is a universal API, i.e. it can be used as a building block to build any desired higher level decompression API. In the limit case, it can be called once per every byte input or output. */ -static tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_next, size_t *pIn_buf_size, mz_uint8 *pOut_buf_start, mz_uint8 *pOut_buf_next, size_t *pOut_buf_size, const mz_uint32 decomp_flags); - -/* Internal/private bits follow. */ -enum -{ - TINFL_MAX_HUFF_TABLES = 3, TINFL_MAX_HUFF_SYMBOLS_0 = 288, TINFL_MAX_HUFF_SYMBOLS_1 = 32, TINFL_MAX_HUFF_SYMBOLS_2 = 19, - TINFL_FAST_LOOKUP_BITS = 10, TINFL_FAST_LOOKUP_SIZE = 1 << TINFL_FAST_LOOKUP_BITS -}; - -typedef struct -{ - mz_uint8 m_code_size[TINFL_MAX_HUFF_SYMBOLS_0]; - mz_int16 m_look_up[TINFL_FAST_LOOKUP_SIZE], m_tree[TINFL_MAX_HUFF_SYMBOLS_0 * 2]; -} tinfl_huff_table; - -#if MINIZ_HAS_64BIT_REGISTERS - #define TINFL_USE_64BIT_BITBUF 1 -#endif - -#if TINFL_USE_64BIT_BITBUF - typedef mz_uint64 tinfl_bit_buf_t; - #define TINFL_BITBUF_SIZE (64) -#else - typedef mz_uint32 tinfl_bit_buf_t; - #define TINFL_BITBUF_SIZE (32) -#endif - -struct tinfl_decompressor_tag -{ - mz_uint32 m_state, m_num_bits, m_zhdr0, m_zhdr1, m_z_adler32, m_final, m_type, m_check_adler32, m_dist, m_counter, m_num_extra, m_table_sizes[TINFL_MAX_HUFF_TABLES]; - tinfl_bit_buf_t m_bit_buf; - size_t m_dist_from_out_buf_start; - tinfl_huff_table m_tables[TINFL_MAX_HUFF_TABLES]; - mz_uint8 m_raw_header[4], m_len_codes[TINFL_MAX_HUFF_SYMBOLS_0 + TINFL_MAX_HUFF_SYMBOLS_1 + 137]; -}; - -#endif /* #ifdef TINFL_HEADER_INCLUDED */ - -/* ------------------- End of Header: Implementation follows. (If you only want the header, define MINIZ_HEADER_FILE_ONLY.) */ - -#ifndef TINFL_HEADER_FILE_ONLY - -#define MZ_MAX(a,b) (((a)>(b))?(a):(b)) -#define MZ_MIN(a,b) (((a)<(b))?(a):(b)) -#define MZ_CLEAR_OBJ(obj) memset(&(obj), 0, sizeof(obj)) - -#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN - #define MZ_READ_LE16(p) *((const mz_uint16 *)(p)) - #define MZ_READ_LE32(p) *((const mz_uint32 *)(p)) -#else - #define MZ_READ_LE16(p) ((mz_uint32)(((const mz_uint8 *)(p))[0]) | ((mz_uint32)(((const mz_uint8 *)(p))[1]) << 8U)) - #define MZ_READ_LE32(p) ((mz_uint32)(((const mz_uint8 *)(p))[0]) | ((mz_uint32)(((const mz_uint8 *)(p))[1]) << 8U) | ((mz_uint32)(((const mz_uint8 *)(p))[2]) << 16U) | ((mz_uint32)(((const mz_uint8 *)(p))[3]) << 24U)) -#endif - -#define TINFL_MEMCPY(d, s, l) memcpy(d, s, l) -#define TINFL_MEMSET(p, c, l) memset(p, c, l) - -#define TINFL_CR_BEGIN switch(r->m_state) { case 0: -#define TINFL_CR_RETURN(state_index, result) do { status = result; r->m_state = state_index; goto common_exit; case state_index:; } MZ_MACRO_END -#define TINFL_CR_RETURN_FOREVER(state_index, result) do { for ( ; ; ) { TINFL_CR_RETURN(state_index, result); } } MZ_MACRO_END -#define TINFL_CR_FINISH } - -/* TODO: If the caller has indicated that there's no more input, and we attempt to read beyond the input buf, then something is wrong with the input because the inflator never */ -/* reads ahead more than it needs to. Currently TINFL_GET_BYTE() pads the end of the stream with 0's in this scenario. */ -#define TINFL_GET_BYTE(state_index, c) do { \ - if (pIn_buf_cur >= pIn_buf_end) { \ - for ( ; ; ) { \ - if (decomp_flags & TINFL_FLAG_HAS_MORE_INPUT) { \ - TINFL_CR_RETURN(state_index, TINFL_STATUS_NEEDS_MORE_INPUT); \ - if (pIn_buf_cur < pIn_buf_end) { \ - c = *pIn_buf_cur++; \ - break; \ - } \ - } else { \ - c = 0; \ - break; \ - } \ - } \ - } else c = *pIn_buf_cur++; } MZ_MACRO_END - -#define TINFL_NEED_BITS(state_index, n) do { mz_uint c; TINFL_GET_BYTE(state_index, c); bit_buf |= (((tinfl_bit_buf_t)c) << num_bits); num_bits += 8; } while (num_bits < (mz_uint)(n)) -#define TINFL_SKIP_BITS(state_index, n) do { if (num_bits < (mz_uint)(n)) { TINFL_NEED_BITS(state_index, n); } bit_buf >>= (n); num_bits -= (n); } MZ_MACRO_END -#define TINFL_GET_BITS(state_index, b, n) do { if (num_bits < (mz_uint)(n)) { TINFL_NEED_BITS(state_index, n); } b = bit_buf & ((1 << (n)) - 1); bit_buf >>= (n); num_bits -= (n); } MZ_MACRO_END - -/* TINFL_HUFF_BITBUF_FILL() is only used rarely, when the number of bytes remaining in the input buffer falls below 2. */ -/* It reads just enough bytes from the input stream that are needed to decode the next Huffman code (and absolutely no more). It works by trying to fully decode a */ -/* Huffman code by using whatever bits are currently present in the bit buffer. If this fails, it reads another byte, and tries again until it succeeds or until the */ -/* bit buffer contains >=15 bits (deflate's max. Huffman code size). */ -#define TINFL_HUFF_BITBUF_FILL(state_index, pHuff) \ - do { \ - temp = (pHuff)->m_look_up[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]; \ - if (temp >= 0) { \ - code_len = temp >> 9; \ - if ((code_len) && (num_bits >= code_len)) \ - break; \ - } else if (num_bits > TINFL_FAST_LOOKUP_BITS) { \ - code_len = TINFL_FAST_LOOKUP_BITS; \ - do { \ - temp = (pHuff)->m_tree[~temp + ((bit_buf >> code_len++) & 1)]; \ - } while ((temp < 0) && (num_bits >= (code_len + 1))); if (temp >= 0) break; \ - } TINFL_GET_BYTE(state_index, c); bit_buf |= (((tinfl_bit_buf_t)c) << num_bits); num_bits += 8; \ - } while (num_bits < 15); - -/* TINFL_HUFF_DECODE() decodes the next Huffman coded symbol. It's more complex than you would initially expect because the zlib API expects the decompressor to never read */ -/* beyond the final byte of the deflate stream. (In other words, when this macro wants to read another byte from the input, it REALLY needs another byte in order to fully */ -/* decode the next Huffman code.) Handling this properly is particularly important on raw deflate (non-zlib) streams, which aren't followed by a byte aligned adler-32. */ -/* The slow path is only executed at the very end of the input buffer. */ -#define TINFL_HUFF_DECODE(state_index, sym, pHuff) do { \ - int temp; mz_uint code_len, c; \ - if (num_bits < 15) { \ - if ((pIn_buf_end - pIn_buf_cur) < 2) { \ - TINFL_HUFF_BITBUF_FILL(state_index, pHuff); \ - } else { \ - bit_buf |= (((tinfl_bit_buf_t)pIn_buf_cur[0]) << num_bits) | (((tinfl_bit_buf_t)pIn_buf_cur[1]) << (num_bits + 8)); pIn_buf_cur += 2; num_bits += 16; \ - } \ - } \ - if ((temp = (pHuff)->m_look_up[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]) >= 0) \ - code_len = temp >> 9, temp &= 511; \ - else { \ - code_len = TINFL_FAST_LOOKUP_BITS; do { temp = (pHuff)->m_tree[~temp + ((bit_buf >> code_len++) & 1)]; } while (temp < 0); \ - } sym = temp; bit_buf >>= code_len; num_bits -= code_len; } MZ_MACRO_END - -static tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_next, size_t *pIn_buf_size, mz_uint8 *pOut_buf_start, mz_uint8 *pOut_buf_next, size_t *pOut_buf_size, const mz_uint32 decomp_flags) -{ - static const int s_length_base[31] = { 3,4,5,6,7,8,9,10,11,13, 15,17,19,23,27,31,35,43,51,59, 67,83,99,115,131,163,195,227,258,0,0 }; - static const int s_length_extra[31]= { 0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0 }; - static const int s_dist_base[32] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193, 257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0}; - static const int s_dist_extra[32] = { 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; - static const mz_uint8 s_length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 }; - static const int s_min_table_sizes[3] = { 257, 1, 4 }; - - tinfl_status status = TINFL_STATUS_FAILED; mz_uint32 num_bits, dist, counter, num_extra; tinfl_bit_buf_t bit_buf; - const mz_uint8 *pIn_buf_cur = pIn_buf_next, *const pIn_buf_end = pIn_buf_next + *pIn_buf_size; - mz_uint8 *pOut_buf_cur = pOut_buf_next, *const pOut_buf_end = pOut_buf_next + *pOut_buf_size; - size_t out_buf_size_mask = (decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF) ? (size_t)-1 : ((pOut_buf_next - pOut_buf_start) + *pOut_buf_size) - 1, dist_from_out_buf_start; - - /* Ensure the output buffer's size is a power of 2, unless the output buffer is large enough to hold the entire output file (in which case it doesn't matter). */ - if (((out_buf_size_mask + 1) & out_buf_size_mask) || (pOut_buf_next < pOut_buf_start)) { *pIn_buf_size = *pOut_buf_size = 0; return TINFL_STATUS_BAD_PARAM; } - - num_bits = r->m_num_bits; bit_buf = r->m_bit_buf; dist = r->m_dist; counter = r->m_counter; num_extra = r->m_num_extra; dist_from_out_buf_start = r->m_dist_from_out_buf_start; - TINFL_CR_BEGIN - - bit_buf = num_bits = dist = counter = num_extra = r->m_zhdr0 = r->m_zhdr1 = 0; r->m_z_adler32 = r->m_check_adler32 = 1; - if (decomp_flags & TINFL_FLAG_PARSE_ZLIB_HEADER) - { - TINFL_GET_BYTE(1, r->m_zhdr0); TINFL_GET_BYTE(2, r->m_zhdr1); - counter = (((r->m_zhdr0 * 256 + r->m_zhdr1) % 31 != 0) || (r->m_zhdr1 & 32) || ((r->m_zhdr0 & 15) != 8)); - if (!(decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF)) counter |= (((1U << (8U + (r->m_zhdr0 >> 4))) > 32768U) || ((out_buf_size_mask + 1) < (size_t)(1U << (8U + (r->m_zhdr0 >> 4))))); - if (counter) { TINFL_CR_RETURN_FOREVER(36, TINFL_STATUS_FAILED); } - } - - do - { - TINFL_GET_BITS(3, r->m_final, 3); r->m_type = r->m_final >> 1; - if (r->m_type == 0) - { - TINFL_SKIP_BITS(5, num_bits & 7); - for (counter = 0; counter < 4; ++counter) { if (num_bits) TINFL_GET_BITS(6, r->m_raw_header[counter], 8); else TINFL_GET_BYTE(7, r->m_raw_header[counter]); } - if ((counter = (r->m_raw_header[0] | (r->m_raw_header[1] << 8))) != (mz_uint)(0xFFFF ^ (r->m_raw_header[2] | (r->m_raw_header[3] << 8)))) { TINFL_CR_RETURN_FOREVER(39, TINFL_STATUS_FAILED); } - while ((counter) && (num_bits)) - { - TINFL_GET_BITS(51, dist, 8); - while (pOut_buf_cur >= pOut_buf_end) { TINFL_CR_RETURN(52, TINFL_STATUS_HAS_MORE_OUTPUT); } - *pOut_buf_cur++ = (mz_uint8)dist; - counter--; - } - while (counter) - { - size_t n; while (pOut_buf_cur >= pOut_buf_end) { TINFL_CR_RETURN(9, TINFL_STATUS_HAS_MORE_OUTPUT); } - while (pIn_buf_cur >= pIn_buf_end) - { - if (decomp_flags & TINFL_FLAG_HAS_MORE_INPUT) - { - TINFL_CR_RETURN(38, TINFL_STATUS_NEEDS_MORE_INPUT); - } - else - { - TINFL_CR_RETURN_FOREVER(40, TINFL_STATUS_FAILED); - } - } - n = MZ_MIN(MZ_MIN((size_t)(pOut_buf_end - pOut_buf_cur), (size_t)(pIn_buf_end - pIn_buf_cur)), counter); - TINFL_MEMCPY(pOut_buf_cur, pIn_buf_cur, n); pIn_buf_cur += n; pOut_buf_cur += n; counter -= (mz_uint)n; - } - } - else if (r->m_type == 3) - { - TINFL_CR_RETURN_FOREVER(10, TINFL_STATUS_FAILED); - } - else - { - if (r->m_type == 1) - { - mz_uint8 *p = r->m_tables[0].m_code_size; mz_uint i; - r->m_table_sizes[0] = 288; r->m_table_sizes[1] = 32; TINFL_MEMSET(r->m_tables[1].m_code_size, 5, 32); - for ( i = 0; i <= 143; ++i) *p++ = 8; - for ( ; i <= 255; ++i) *p++ = 9; - for ( ; i <= 279; ++i) *p++ = 7; - for ( ; i <= 287; ++i) *p++ = 8; - } - else - { - for (counter = 0; counter < 3; counter++) { TINFL_GET_BITS(11, r->m_table_sizes[counter], "\05\05\04"[counter]); r->m_table_sizes[counter] += s_min_table_sizes[counter]; } - MZ_CLEAR_OBJ(r->m_tables[2].m_code_size); for (counter = 0; counter < r->m_table_sizes[2]; counter++) { mz_uint s; TINFL_GET_BITS(14, s, 3); r->m_tables[2].m_code_size[s_length_dezigzag[counter]] = (mz_uint8)s; } - r->m_table_sizes[2] = 19; - } - for ( ; (int)r->m_type >= 0; r->m_type--) - { - int tree_next, tree_cur; tinfl_huff_table *pTable; - mz_uint i, j, used_syms, total, sym_index, next_code[17], total_syms[16]; pTable = &r->m_tables[r->m_type]; MZ_CLEAR_OBJ(total_syms); MZ_CLEAR_OBJ(pTable->m_look_up); MZ_CLEAR_OBJ(pTable->m_tree); - for (i = 0; i < r->m_table_sizes[r->m_type]; ++i) total_syms[pTable->m_code_size[i]]++; - used_syms = 0, total = 0; next_code[0] = next_code[1] = 0; - for (i = 1; i <= 15; ++i) { used_syms += total_syms[i]; next_code[i + 1] = (total = ((total + total_syms[i]) << 1)); } - if ((65536 != total) && (used_syms > 1)) - { - TINFL_CR_RETURN_FOREVER(35, TINFL_STATUS_FAILED); - } - for (tree_next = -1, sym_index = 0; sym_index < r->m_table_sizes[r->m_type]; ++sym_index) - { - mz_uint rev_code = 0, l, cur_code, code_size = pTable->m_code_size[sym_index]; if (!code_size) continue; - cur_code = next_code[code_size]++; for (l = code_size; l > 0; l--, cur_code >>= 1) rev_code = (rev_code << 1) | (cur_code & 1); - if (code_size <= TINFL_FAST_LOOKUP_BITS) { mz_int16 k = (mz_int16)((code_size << 9) | sym_index); while (rev_code < TINFL_FAST_LOOKUP_SIZE) { pTable->m_look_up[rev_code] = k; rev_code += (1 << code_size); } continue; } - if (0 == (tree_cur = pTable->m_look_up[rev_code & (TINFL_FAST_LOOKUP_SIZE - 1)])) { pTable->m_look_up[rev_code & (TINFL_FAST_LOOKUP_SIZE - 1)] = (mz_int16)tree_next; tree_cur = tree_next; tree_next -= 2; } - rev_code >>= (TINFL_FAST_LOOKUP_BITS - 1); - for (j = code_size; j > (TINFL_FAST_LOOKUP_BITS + 1); j--) - { - tree_cur -= ((rev_code >>= 1) & 1); - if (!pTable->m_tree[-tree_cur - 1]) { pTable->m_tree[-tree_cur - 1] = (mz_int16)tree_next; tree_cur = tree_next; tree_next -= 2; } else tree_cur = pTable->m_tree[-tree_cur - 1]; - } - tree_cur -= ((rev_code >>= 1) & 1); pTable->m_tree[-tree_cur - 1] = (mz_int16)sym_index; - } - if (r->m_type == 2) - { - for (counter = 0; counter < (r->m_table_sizes[0] + r->m_table_sizes[1]); ) - { - mz_uint s; TINFL_HUFF_DECODE(16, dist, &r->m_tables[2]); if (dist < 16) { r->m_len_codes[counter++] = (mz_uint8)dist; continue; } - if ((dist == 16) && (!counter)) - { - TINFL_CR_RETURN_FOREVER(17, TINFL_STATUS_FAILED); - } - num_extra = "\02\03\07"[dist - 16]; TINFL_GET_BITS(18, s, num_extra); s += "\03\03\013"[dist - 16]; - TINFL_MEMSET(r->m_len_codes + counter, (dist == 16) ? r->m_len_codes[counter - 1] : 0, s); counter += s; - } - if ((r->m_table_sizes[0] + r->m_table_sizes[1]) != counter) - { - TINFL_CR_RETURN_FOREVER(21, TINFL_STATUS_FAILED); - } - TINFL_MEMCPY(r->m_tables[0].m_code_size, r->m_len_codes, r->m_table_sizes[0]); TINFL_MEMCPY(r->m_tables[1].m_code_size, r->m_len_codes + r->m_table_sizes[0], r->m_table_sizes[1]); - } - } - for ( ; ; ) - { - mz_uint8 *pSrc; - for ( ; ; ) - { - if (((pIn_buf_end - pIn_buf_cur) < 4) || ((pOut_buf_end - pOut_buf_cur) < 2)) - { - TINFL_HUFF_DECODE(23, counter, &r->m_tables[0]); - if (counter >= 256) - break; - while (pOut_buf_cur >= pOut_buf_end) { TINFL_CR_RETURN(24, TINFL_STATUS_HAS_MORE_OUTPUT); } - *pOut_buf_cur++ = (mz_uint8)counter; - } - else - { - int sym2; mz_uint code_len; -#if TINFL_USE_64BIT_BITBUF - if (num_bits < 30) { bit_buf |= (((tinfl_bit_buf_t)MZ_READ_LE32(pIn_buf_cur)) << num_bits); pIn_buf_cur += 4; num_bits += 32; } -#else - if (num_bits < 15) { bit_buf |= (((tinfl_bit_buf_t)MZ_READ_LE16(pIn_buf_cur)) << num_bits); pIn_buf_cur += 2; num_bits += 16; } -#endif - if ((sym2 = r->m_tables[0].m_look_up[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]) >= 0) - code_len = sym2 >> 9; - else - { - code_len = TINFL_FAST_LOOKUP_BITS; do { sym2 = r->m_tables[0].m_tree[~sym2 + ((bit_buf >> code_len++) & 1)]; } while (sym2 < 0); - } - counter = sym2; bit_buf >>= code_len; num_bits -= code_len; - if (counter & 256) - break; - -#if !TINFL_USE_64BIT_BITBUF - if (num_bits < 15) { bit_buf |= (((tinfl_bit_buf_t)MZ_READ_LE16(pIn_buf_cur)) << num_bits); pIn_buf_cur += 2; num_bits += 16; } -#endif - if ((sym2 = r->m_tables[0].m_look_up[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]) >= 0) - code_len = sym2 >> 9; - else - { - code_len = TINFL_FAST_LOOKUP_BITS; do { sym2 = r->m_tables[0].m_tree[~sym2 + ((bit_buf >> code_len++) & 1)]; } while (sym2 < 0); - } - bit_buf >>= code_len; num_bits -= code_len; - - pOut_buf_cur[0] = (mz_uint8)counter; - if (sym2 & 256) - { - pOut_buf_cur++; - counter = sym2; - break; - } - pOut_buf_cur[1] = (mz_uint8)sym2; - pOut_buf_cur += 2; - } - } - if ((counter &= 511) == 256) break; - - num_extra = s_length_extra[counter - 257]; counter = s_length_base[counter - 257]; - if (num_extra) { mz_uint extra_bits; TINFL_GET_BITS(25, extra_bits, num_extra); counter += extra_bits; } - - TINFL_HUFF_DECODE(26, dist, &r->m_tables[1]); - num_extra = s_dist_extra[dist]; dist = s_dist_base[dist]; - if (num_extra) { mz_uint extra_bits; TINFL_GET_BITS(27, extra_bits, num_extra); dist += extra_bits; } - - dist_from_out_buf_start = pOut_buf_cur - pOut_buf_start; - if ((dist > dist_from_out_buf_start) && (decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF)) - { - TINFL_CR_RETURN_FOREVER(37, TINFL_STATUS_FAILED); - } - - pSrc = pOut_buf_start + ((dist_from_out_buf_start - dist) & out_buf_size_mask); - - if ((MZ_MAX(pOut_buf_cur, pSrc) + counter) > pOut_buf_end) - { - while (counter--) - { - while (pOut_buf_cur >= pOut_buf_end) { TINFL_CR_RETURN(53, TINFL_STATUS_HAS_MORE_OUTPUT); } - *pOut_buf_cur++ = pOut_buf_start[(dist_from_out_buf_start++ - dist) & out_buf_size_mask]; - } - continue; - } -#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES - else if ((counter >= 9) && (counter <= dist)) - { - const mz_uint8 *pSrc_end = pSrc + (counter & ~7); - do - { - ((mz_uint32 *)pOut_buf_cur)[0] = ((const mz_uint32 *)pSrc)[0]; - ((mz_uint32 *)pOut_buf_cur)[1] = ((const mz_uint32 *)pSrc)[1]; - pOut_buf_cur += 8; - } while ((pSrc += 8) < pSrc_end); - if ((counter &= 7) < 3) - { - if (counter) - { - pOut_buf_cur[0] = pSrc[0]; - if (counter > 1) - pOut_buf_cur[1] = pSrc[1]; - pOut_buf_cur += counter; - } - continue; - } - } -#endif - do - { - pOut_buf_cur[0] = pSrc[0]; - pOut_buf_cur[1] = pSrc[1]; - pOut_buf_cur[2] = pSrc[2]; - pOut_buf_cur += 3; pSrc += 3; - } while ((int)(counter -= 3) > 2); - if ((int)counter > 0) - { - pOut_buf_cur[0] = pSrc[0]; - if ((int)counter > 1) - pOut_buf_cur[1] = pSrc[1]; - pOut_buf_cur += counter; - } - } - } - } while (!(r->m_final & 1)); - if (decomp_flags & TINFL_FLAG_PARSE_ZLIB_HEADER) - { - TINFL_SKIP_BITS(32, num_bits & 7); for (counter = 0; counter < 4; ++counter) { mz_uint s; if (num_bits) TINFL_GET_BITS(41, s, 8); else TINFL_GET_BYTE(42, s); r->m_z_adler32 = (r->m_z_adler32 << 8) | s; } - } - TINFL_CR_RETURN_FOREVER(34, TINFL_STATUS_DONE); - TINFL_CR_FINISH - -common_exit: - r->m_num_bits = num_bits; r->m_bit_buf = bit_buf; r->m_dist = dist; r->m_counter = counter; r->m_num_extra = num_extra; r->m_dist_from_out_buf_start = dist_from_out_buf_start; - *pIn_buf_size = pIn_buf_cur - pIn_buf_next; *pOut_buf_size = pOut_buf_cur - pOut_buf_next; - if ((decomp_flags & (TINFL_FLAG_PARSE_ZLIB_HEADER | TINFL_FLAG_COMPUTE_ADLER32)) && (status >= 0)) - { - const mz_uint8 *ptr = pOut_buf_next; size_t buf_len = *pOut_buf_size; - mz_uint32 i, s1 = r->m_check_adler32 & 0xffff, s2 = r->m_check_adler32 >> 16; size_t block_len = buf_len % 5552; - while (buf_len) - { - for (i = 0; i + 7 < block_len; i += 8, ptr += 8) - { - s1 += ptr[0], s2 += s1; s1 += ptr[1], s2 += s1; s1 += ptr[2], s2 += s1; s1 += ptr[3], s2 += s1; - s1 += ptr[4], s2 += s1; s1 += ptr[5], s2 += s1; s1 += ptr[6], s2 += s1; s1 += ptr[7], s2 += s1; - } - for ( ; i < block_len; ++i) s1 += *ptr++, s2 += s1; - s1 %= 65521U, s2 %= 65521U; buf_len -= block_len; block_len = 5552; - } - r->m_check_adler32 = (s2 << 16) + s1; if ((status == TINFL_STATUS_DONE) && (decomp_flags & TINFL_FLAG_PARSE_ZLIB_HEADER) && (r->m_check_adler32 != r->m_z_adler32)) status = TINFL_STATUS_ADLER32_MISMATCH; - } - return status; -} - -/* Flush values. For typical usage you only need MZ_NO_FLUSH and MZ_FINISH. The other stuff is for advanced use. */ -enum { MZ_NO_FLUSH = 0, MZ_PARTIAL_FLUSH = 1, MZ_SYNC_FLUSH = 2, MZ_FULL_FLUSH = 3, MZ_FINISH = 4, MZ_BLOCK = 5 }; - -/* Return status codes. MZ_PARAM_ERROR is non-standard. */ -enum { MZ_OK = 0, MZ_STREAM_END = 1, MZ_NEED_DICT = 2, MZ_ERRNO = -1, MZ_STREAM_ERROR = -2, MZ_DATA_ERROR = -3, MZ_MEM_ERROR = -4, MZ_BUF_ERROR = -5, MZ_VERSION_ERROR = -6, MZ_PARAM_ERROR = -10000 }; - -/* Compression levels. */ -enum { MZ_NO_COMPRESSION = 0, MZ_BEST_SPEED = 1, MZ_BEST_COMPRESSION = 9, MZ_DEFAULT_COMPRESSION = -1 }; - -/* Window bits */ -#define MZ_DEFAULT_WINDOW_BITS 15 - -struct mz_internal_state; - -/* Compression/decompression stream struct. */ -typedef struct mz_stream_s -{ - const unsigned char *next_in; /* pointer to next byte to read */ - unsigned int avail_in; /* number of bytes available at next_in */ - mz_ulong total_in; /* total number of bytes consumed so far */ - - unsigned char *next_out; /* pointer to next byte to write */ - unsigned int avail_out; /* number of bytes that can be written to next_out */ - mz_ulong total_out; /* total number of bytes produced so far */ - - char *msg; /* error msg (unused) */ - struct mz_internal_state *state; /* internal state, allocated by zalloc/zfree */ - - mz_alloc_func zalloc; /* optional heap allocation function (defaults to malloc) */ - mz_free_func zfree; /* optional heap free function (defaults to free) */ - void *opaque; /* heap alloc function user pointer */ - - int data_type; /* data_type (unused) */ - mz_ulong adler; /* adler32 of the source or uncompressed data */ - mz_ulong reserved; /* not used */ -} mz_stream; - -typedef mz_stream *mz_streamp; - - -typedef struct -{ - tinfl_decompressor m_decomp; - mz_uint m_dict_ofs, m_dict_avail, m_first_call, m_has_flushed; int m_window_bits; - mz_uint8 m_dict[TINFL_LZ_DICT_SIZE]; - tinfl_status m_last_status; -} inflate_state; - -static int mz_inflateInit2(mz_streamp pStream, int window_bits) -{ - inflate_state *pDecomp; - if (!pStream) return MZ_STREAM_ERROR; - if ((window_bits != MZ_DEFAULT_WINDOW_BITS) && (-window_bits != MZ_DEFAULT_WINDOW_BITS)) return MZ_PARAM_ERROR; - - pStream->data_type = 0; - pStream->adler = 0; - pStream->msg = NULL; - pStream->total_in = 0; - pStream->total_out = 0; - pStream->reserved = 0; - /* if (!pStream->zalloc) pStream->zalloc = def_alloc_func; */ - /* if (!pStream->zfree) pStream->zfree = def_free_func; */ - - pDecomp = (inflate_state*)pStream->zalloc(pStream->opaque, 1, sizeof(inflate_state)); - if (!pDecomp) return MZ_MEM_ERROR; - - pStream->state = (struct mz_internal_state *)pDecomp; - - tinfl_init(&pDecomp->m_decomp); - pDecomp->m_dict_ofs = 0; - pDecomp->m_dict_avail = 0; - pDecomp->m_last_status = TINFL_STATUS_NEEDS_MORE_INPUT; - pDecomp->m_first_call = 1; - pDecomp->m_has_flushed = 0; - pDecomp->m_window_bits = window_bits; - - return MZ_OK; -} - -static int mz_inflate(mz_streamp pStream, int flush) -{ - inflate_state* pState; - mz_uint n, first_call, decomp_flags = TINFL_FLAG_COMPUTE_ADLER32; - size_t in_bytes, out_bytes, orig_avail_in; - tinfl_status status; - - if ((!pStream) || (!pStream->state)) return MZ_STREAM_ERROR; - if (flush == MZ_PARTIAL_FLUSH) flush = MZ_SYNC_FLUSH; - if ((flush) && (flush != MZ_SYNC_FLUSH) && (flush != MZ_FINISH)) return MZ_STREAM_ERROR; - - pState = (inflate_state*)pStream->state; - if (pState->m_window_bits > 0) decomp_flags |= TINFL_FLAG_PARSE_ZLIB_HEADER; - orig_avail_in = pStream->avail_in; - - first_call = pState->m_first_call; pState->m_first_call = 0; - if (pState->m_last_status < 0) return MZ_DATA_ERROR; - - if (pState->m_has_flushed && (flush != MZ_FINISH)) return MZ_STREAM_ERROR; - pState->m_has_flushed |= (flush == MZ_FINISH); - - if ((flush == MZ_FINISH) && (first_call)) - { - /* MZ_FINISH on the first call implies that the input and output buffers are large enough to hold the entire compressed/decompressed file. */ - decomp_flags |= TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF; - in_bytes = pStream->avail_in; out_bytes = pStream->avail_out; - status = tinfl_decompress(&pState->m_decomp, pStream->next_in, &in_bytes, pStream->next_out, pStream->next_out, &out_bytes, decomp_flags); - pState->m_last_status = status; - pStream->next_in += (mz_uint)in_bytes; pStream->avail_in -= (mz_uint)in_bytes; pStream->total_in += (mz_uint)in_bytes; - pStream->adler = tinfl_get_adler32(&pState->m_decomp); - pStream->next_out += (mz_uint)out_bytes; pStream->avail_out -= (mz_uint)out_bytes; pStream->total_out += (mz_uint)out_bytes; - - if (status < 0) - return MZ_DATA_ERROR; - else if (status != TINFL_STATUS_DONE) - { - pState->m_last_status = TINFL_STATUS_FAILED; - return MZ_BUF_ERROR; - } - return MZ_STREAM_END; - } - /* flush != MZ_FINISH then we must assume there's more input. */ - if (flush != MZ_FINISH) decomp_flags |= TINFL_FLAG_HAS_MORE_INPUT; - - if (pState->m_dict_avail) - { - n = MZ_MIN(pState->m_dict_avail, pStream->avail_out); - memcpy(pStream->next_out, pState->m_dict + pState->m_dict_ofs, n); - pStream->next_out += n; pStream->avail_out -= n; pStream->total_out += n; - pState->m_dict_avail -= n; pState->m_dict_ofs = (pState->m_dict_ofs + n) & (TINFL_LZ_DICT_SIZE - 1); - return ((pState->m_last_status == TINFL_STATUS_DONE) && (!pState->m_dict_avail)) ? MZ_STREAM_END : MZ_OK; - } - - for ( ; ; ) - { - in_bytes = pStream->avail_in; - out_bytes = TINFL_LZ_DICT_SIZE - pState->m_dict_ofs; - - status = tinfl_decompress(&pState->m_decomp, pStream->next_in, &in_bytes, pState->m_dict, pState->m_dict + pState->m_dict_ofs, &out_bytes, decomp_flags); - pState->m_last_status = status; - - pStream->next_in += (mz_uint)in_bytes; pStream->avail_in -= (mz_uint)in_bytes; - pStream->total_in += (mz_uint)in_bytes; pStream->adler = tinfl_get_adler32(&pState->m_decomp); - - pState->m_dict_avail = (mz_uint)out_bytes; - - n = MZ_MIN(pState->m_dict_avail, pStream->avail_out); - memcpy(pStream->next_out, pState->m_dict + pState->m_dict_ofs, n); - pStream->next_out += n; pStream->avail_out -= n; pStream->total_out += n; - pState->m_dict_avail -= n; pState->m_dict_ofs = (pState->m_dict_ofs + n) & (TINFL_LZ_DICT_SIZE - 1); - - if (status < 0) - return MZ_DATA_ERROR; /* Stream is corrupted (there could be some uncompressed data left in the output dictionary - oh well). */ - else if ((status == TINFL_STATUS_NEEDS_MORE_INPUT) && (!orig_avail_in)) - return MZ_BUF_ERROR; /* Signal caller that we can't make forward progress without supplying more input or by setting flush to MZ_FINISH. */ - else if (flush == MZ_FINISH) - { - /* The output buffer MUST be large to hold the remaining uncompressed data when flush==MZ_FINISH. */ - if (status == TINFL_STATUS_DONE) - return pState->m_dict_avail ? MZ_BUF_ERROR : MZ_STREAM_END; - /* status here must be TINFL_STATUS_HAS_MORE_OUTPUT, which means there's at least 1 more byte on the way. If there's no more room left in the output buffer then something is wrong. */ - else if (!pStream->avail_out) - return MZ_BUF_ERROR; - } - else if ((status == TINFL_STATUS_DONE) || (!pStream->avail_in) || (!pStream->avail_out) || (pState->m_dict_avail)) - break; - } - - return ((status == TINFL_STATUS_DONE) && (!pState->m_dict_avail)) ? MZ_STREAM_END : MZ_OK; -} - -static int mz_inflateEnd(mz_streamp pStream) -{ - if (!pStream) - return MZ_STREAM_ERROR; - if (pStream->state) - { - pStream->zfree(pStream->opaque, pStream->state); - pStream->state = NULL; - } - return MZ_OK; -} - -/* make this a drop-in replacement for zlib... */ - #define voidpf void* - #define uInt unsigned int - #define z_stream mz_stream - #define inflateInit2 mz_inflateInit2 - #define inflate mz_inflate - #define inflateEnd mz_inflateEnd - #define Z_SYNC_FLUSH MZ_SYNC_FLUSH - #define Z_FINISH MZ_FINISH - #define Z_OK MZ_OK - #define Z_STREAM_END MZ_STREAM_END - #define Z_NEED_DICT MZ_NEED_DICT - #define Z_ERRNO MZ_ERRNO - #define Z_STREAM_ERROR MZ_STREAM_ERROR - #define Z_DATA_ERROR MZ_DATA_ERROR - #define Z_MEM_ERROR MZ_MEM_ERROR - #define Z_BUF_ERROR MZ_BUF_ERROR - #define Z_VERSION_ERROR MZ_VERSION_ERROR - #define MAX_WBITS 15 - -#endif /* #ifndef TINFL_HEADER_FILE_ONLY */ - -/* - This is free and unencumbered software released into the public domain. - - Anyone is free to copy, modify, publish, use, compile, sell, or - distribute this software, either in source code form or as a compiled - binary, for any purpose, commercial or non-commercial, and by any - means. - - In jurisdictions that recognize copyright laws, the author or authors - of this software dedicate any and all copyright interest in the - software to the public domain. We make this dedication for the benefit - of the public at large and to the detriment of our heirs and - successors. We intend this dedication to be an overt act of - relinquishment in perpetuity of all present and future rights to this - software under copyright law. - - 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 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. - - For more information, please refer to -*/ diff --git a/love/src/jni/love/src/libraries/physfs/physfs_platform_apple.m b/love/src/jni/love/src/libraries/physfs/physfs_platform_apple.m deleted file mode 100644 index fe50f4b0..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_platform_apple.m +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Apple platform (macOS, iOS, watchOS, etc) support routines for PhysicsFS. - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file written by Ryan C. Gordon. - */ - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_platforms.h" - -#ifdef PHYSFS_PLATFORM_APPLE - -#include - -#include "physfs_internal.h" - -int __PHYSFS_platformInit(void) -{ - return 1; /* success. */ -} /* __PHYSFS_platformInit */ - - -void __PHYSFS_platformDeinit(void) -{ - /* no-op */ -} /* __PHYSFS_platformDeinit */ - - -char *__PHYSFS_platformCalcBaseDir(const char *argv0) -{ - @autoreleasepool - { - NSString *path = [[NSBundle mainBundle] bundlePath]; - BAIL_IF(!path, PHYSFS_ERR_OS_ERROR, NULL); - size_t len = [path lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; - char *retval = (char *) allocator.Malloc(len + 2); - BAIL_IF(!retval, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - [path getCString:retval maxLength:len+1 encoding:NSUTF8StringEncoding]; - retval[len] = '/'; - retval[len+1] = '\0'; - return retval; /* whew. */ - } /* @autoreleasepool */ -} /* __PHYSFS_platformCalcBaseDir */ - - -char *__PHYSFS_platformCalcPrefDir(const char *org, const char *app) -{ - @autoreleasepool - { - NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, TRUE); - BAIL_IF(!paths, PHYSFS_ERR_OS_ERROR, NULL); - NSString *path = (NSString *) paths[0]; - BAIL_IF(!path, PHYSFS_ERR_OS_ERROR, NULL); - size_t len = [path lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; - const size_t applen = strlen(app); - char *retval = (char *) allocator.Malloc(len + applen + 3); - BAIL_IF(!retval, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - [path getCString:retval maxLength:len+1 encoding:NSUTF8StringEncoding]; - snprintf(retval + len, applen + 3, "/%s/", app); - return retval; /* whew. */ - } /* @autoreleasepool */ -} /* __PHYSFS_platformCalcPrefDir */ - - -/* CD-ROM detection code... */ - -/* - * Code based on sample from Apple Developer Connection: - * https://developer.apple.com/samplecode/Sample_Code/Devices_and_Hardware/Disks/VolumeToBSDNode/VolumeToBSDNode.c.htm - */ - -#if !defined(PHYSFS_NO_CDROM_SUPPORT) - -#include -#include -#include -#include -#include - -static int darwinIsWholeMedia(io_service_t service) -{ - int retval = 0; - CFTypeRef wholeMedia; - - if (!IOObjectConformsTo(service, kIOMediaClass)) - return 0; - - wholeMedia = IORegistryEntryCreateCFProperty(service, - CFSTR(kIOMediaWholeKey), - NULL, 0); - if (wholeMedia == NULL) - return 0; - - retval = CFBooleanGetValue(wholeMedia); - CFRelease(wholeMedia); - - return retval; -} /* darwinIsWholeMedia */ - - -static int darwinIsMountedDisc(char *bsdName, mach_port_t masterPort) -{ - int retval = 0; - CFMutableDictionaryRef matchingDict; - kern_return_t rc; - io_iterator_t iter; - io_service_t service; - - if ((matchingDict = IOBSDNameMatching(masterPort, 0, bsdName)) == NULL) - return 0; - - rc = IOServiceGetMatchingServices(masterPort, matchingDict, &iter); - if ((rc != KERN_SUCCESS) || (!iter)) - return 0; - - service = IOIteratorNext(iter); - IOObjectRelease(iter); - if (!service) - return 0; - - rc = IORegistryEntryCreateIterator(service, kIOServicePlane, - kIORegistryIterateRecursively | kIORegistryIterateParents, &iter); - - if (!iter) - return 0; - - if (rc != KERN_SUCCESS) - { - IOObjectRelease(iter); - return 0; - } /* if */ - - IOObjectRetain(service); /* add an extra object reference... */ - - do - { - if (darwinIsWholeMedia(service)) - { - if ( (IOObjectConformsTo(service, kIOCDMediaClass)) || - (IOObjectConformsTo(service, kIODVDMediaClass)) ) - { - retval = 1; - } /* if */ - } /* if */ - IOObjectRelease(service); - } while ((service = IOIteratorNext(iter)) && (!retval)); - - IOObjectRelease(iter); - IOObjectRelease(service); - - return retval; -} /* darwinIsMountedDisc */ - -#endif /* !defined(PHYSFS_NO_CDROM_SUPPORT) */ - - -void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data) -{ -#if !defined(PHYSFS_NO_CDROM_SUPPORT) - const char *devPrefix = "/dev/"; - const int prefixLen = strlen(devPrefix); - mach_port_t masterPort = 0; - struct statfs *mntbufp; - int i, mounts; - - if (IOMasterPort(MACH_PORT_NULL, &masterPort) != KERN_SUCCESS) - BAIL(PHYSFS_ERR_OS_ERROR, ) /*return void*/; - - mounts = getmntinfo(&mntbufp, MNT_WAIT); /* NOT THREAD SAFE! */ - for (i = 0; i < mounts; i++) - { - char *dev = mntbufp[i].f_mntfromname; - char *mnt = mntbufp[i].f_mntonname; - if (strncmp(dev, devPrefix, prefixLen) != 0) /* a virtual device? */ - continue; - - dev += prefixLen; - if (darwinIsMountedDisc(dev, masterPort)) - cb(data, mnt); - } /* for */ -#endif /* !defined(PHYSFS_NO_CDROM_SUPPORT) */ -} /* __PHYSFS_platformDetectAvailableCDs */ - -#endif /* PHYSFS_PLATFORM_APPLE */ - -/* end of physfs_platform_apple.m ... */ - diff --git a/love/src/jni/love/src/libraries/physfs/physfs_platform_haiku.cpp b/love/src/jni/love/src/libraries/physfs/physfs_platform_haiku.cpp deleted file mode 100644 index fcf8ebde..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_platform_haiku.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Haiku platform-dependent support routines for PhysicsFS. - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file written by Ryan C. Gordon. - */ - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_platforms.h" - -#ifdef PHYSFS_PLATFORM_HAIKU - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "physfs_internal.h" - -int __PHYSFS_platformInit(void) -{ - return 1; /* always succeed. */ -} /* __PHYSFS_platformInit */ - - -void __PHYSFS_platformDeinit(void) -{ - /* no-op */ -} /* __PHYSFS_platformDeinit */ - - -static char *getMountPoint(const char *devname, char *buf, size_t bufsize) -{ - BVolumeRoster mounts; - BVolume vol; - - mounts.Rewind(); - while (mounts.GetNextVolume(&vol) == B_NO_ERROR) - { - fs_info fsinfo; - fs_stat_dev(vol.Device(), &fsinfo); - if (strcmp(devname, fsinfo.device_name) == 0) - { - BDirectory directory; - BEntry entry; - BPath path; - const char *str; - - if ( (vol.GetRootDirectory(&directory) < B_OK) || - (directory.GetEntry(&entry) < B_OK) || - (entry.GetPath(&path) < B_OK) || - ( (str = path.Path()) == NULL) ) - return NULL; - - strncpy(buf, str, bufsize-1); - buf[bufsize-1] = '\0'; - return buf; - } /* if */ - } /* while */ - - return NULL; -} /* getMountPoint */ - - - /* - * This function is lifted from Simple Directmedia Layer (SDL): - * https://www.libsdl.org/ ... this is zlib-licensed code, too. - */ -static void tryDir(const char *d, PHYSFS_StringCallback callback, void *data) -{ - BDirectory dir; - dir.SetTo(d); - if (dir.InitCheck() != B_NO_ERROR) - return; - - dir.Rewind(); - BEntry entry; - while (dir.GetNextEntry(&entry) >= 0) - { - BPath path; - const char *name; - entry_ref e; - - if (entry.GetPath(&path) != B_NO_ERROR) - continue; - - name = path.Path(); - - if (entry.GetRef(&e) != B_NO_ERROR) - continue; - - if (entry.IsDirectory()) - { - if (strcmp(e.name, "floppy") != 0) - tryDir(name, callback, data); - continue; - } /* if */ - - const int devfd = open(name, O_RDONLY); - if (devfd < 0) - continue; - - device_geometry g; - const int rc = ioctl(devfd, B_GET_GEOMETRY, &g, sizeof (g)); - close(devfd); - if (rc < 0) - continue; - - if (g.device_type != B_CD) - continue; - - char mntpnt[B_FILE_NAME_LENGTH]; - if (getMountPoint(name, mntpnt, sizeof (mntpnt))) - callback(data, mntpnt); - } /* while */ -} /* tryDir */ - - -void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data) -{ - tryDir("/dev/disk", cb, data); -} /* __PHYSFS_platformDetectAvailableCDs */ - - -static team_id getTeamID(void) -{ - thread_info info; - thread_id tid = find_thread(NULL); - get_thread_info(tid, &info); - return info.team; -} /* getTeamID */ - - -char *__PHYSFS_platformCalcBaseDir(const char *argv0) -{ - image_info info; - int32 cookie = 0; - - while (get_next_image_info(0, &cookie, &info) == B_OK) - { - if (info.type == B_APP_IMAGE) - break; - } /* while */ - - BEntry entry(info.name, true); - BPath path; - status_t rc = entry.GetPath(&path); /* (path) now has binary's path. */ - assert(rc == B_OK); - rc = path.GetParent(&path); /* chop filename, keep directory. */ - assert(rc == B_OK); - const char *str = path.Path(); - assert(str != NULL); - const size_t len = strlen(str); - char *retval = (char *) allocator.Malloc(len + 2); - BAIL_IF(!retval, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - strcpy(retval, str); - retval[len] = '/'; - retval[len+1] = '\0'; - return retval; -} /* __PHYSFS_platformCalcBaseDir */ - - -char *__PHYSFS_platformCalcPrefDir(const char *org, const char *app) -{ - const char *userdir = __PHYSFS_getUserDir(); - const char *append = "config/settings/"; - const size_t len = strlen(userdir) + strlen(append) + strlen(app) + 2; - char *retval = (char *) allocator.Malloc(len); - BAIL_IF(!retval, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - snprintf(retval, len, "%s%s%s/", userdir, append, app); - return retval; -} /* __PHYSFS_platformCalcPrefDir */ - -#endif /* PHYSFS_PLATFORM_HAIKU */ - -/* end of physfs_platform_haiku.cpp ... */ - diff --git a/love/src/jni/love/src/libraries/physfs/physfs_platform_os2.c b/love/src/jni/love/src/libraries/physfs/physfs_platform_os2.c deleted file mode 100644 index 8cc8044c..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_platform_os2.c +++ /dev/null @@ -1,812 +0,0 @@ -/* - * OS/2 support routines for PhysicsFS. - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file written by Ryan C. Gordon. - */ - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_platforms.h" - -#ifdef PHYSFS_PLATFORM_OS2 - -#define INCL_DOSMODULEMGR -#define INCL_DOSSEMAPHORES -#define INCL_DOSDATETIME -#define INCL_DOSFILEMGR -#define INCL_DOSMODULEMGR -#define INCL_DOSERRORS -#define INCL_DOSPROCESS -#define INCL_DOSDEVICES -#define INCL_DOSDEVIOCTL -#define INCL_DOSMISC -#include -#include - -#include -#include -#include - -#include "physfs_internal.h" - -static HMODULE uconvdll = 0; -static UconvObject uconv = 0; -static int (_System *pUniCreateUconvObject)(UniChar *, UconvObject *) = NULL; -static int (_System *pUniFreeUconvObject)(UconvObject *) = NULL; -static int (_System *pUniUconvToUcs)(UconvObject,void **,size_t *, UniChar**, size_t *, size_t *) = NULL; -static int (_System *pUniUconvFromUcs)(UconvObject,UniChar **,size_t *,void **,size_t *,size_t *) = NULL; - -static PHYSFS_ErrorCode errcodeFromAPIRET(const APIRET rc) -{ - switch (rc) - { - case NO_ERROR: return PHYSFS_ERR_OK; /* not an error. */ - case ERROR_INTERRUPT: return PHYSFS_ERR_OK; /* not an error. */ - case ERROR_TIMEOUT: return PHYSFS_ERR_OK; /* not an error. */ - case ERROR_NOT_ENOUGH_MEMORY: return PHYSFS_ERR_OUT_OF_MEMORY; - case ERROR_FILE_NOT_FOUND: return PHYSFS_ERR_NOT_FOUND; - case ERROR_PATH_NOT_FOUND: return PHYSFS_ERR_NOT_FOUND; - case ERROR_ACCESS_DENIED: return PHYSFS_ERR_PERMISSION; - case ERROR_NOT_DOS_DISK: return PHYSFS_ERR_NOT_FOUND; - case ERROR_SHARING_VIOLATION: return PHYSFS_ERR_PERMISSION; - case ERROR_CANNOT_MAKE: return PHYSFS_ERR_IO; /* maybe this is wrong? */ - case ERROR_DEVICE_IN_USE: return PHYSFS_ERR_BUSY; - case ERROR_OPEN_FAILED: return PHYSFS_ERR_IO; /* maybe this is wrong? */ - case ERROR_DISK_FULL: return PHYSFS_ERR_NO_SPACE; - case ERROR_PIPE_BUSY: return PHYSFS_ERR_BUSY; - case ERROR_SHARING_BUFFER_EXCEEDED: return PHYSFS_ERR_IO; - case ERROR_FILENAME_EXCED_RANGE: return PHYSFS_ERR_BAD_FILENAME; - case ERROR_META_EXPANSION_TOO_LONG: return PHYSFS_ERR_BAD_FILENAME; - case ERROR_TOO_MANY_HANDLES: return PHYSFS_ERR_IO; - case ERROR_TOO_MANY_OPEN_FILES: return PHYSFS_ERR_IO; - case ERROR_NO_MORE_SEARCH_HANDLES: return PHYSFS_ERR_IO; - case ERROR_SEEK_ON_DEVICE: return PHYSFS_ERR_IO; - case ERROR_NEGATIVE_SEEK: return PHYSFS_ERR_INVALID_ARGUMENT; - case ERROR_WRITE_PROTECT: return PHYSFS_ERR_PERMISSION; - case ERROR_WRITE_FAULT: return PHYSFS_ERR_IO; - case ERROR_UNCERTAIN_MEDIA: return PHYSFS_ERR_IO; - case ERROR_PROTECTION_VIOLATION: return PHYSFS_ERR_IO; - case ERROR_BROKEN_PIPE: return PHYSFS_ERR_IO; - - /* !!! FIXME: some of these might be PHYSFS_ERR_BAD_FILENAME, etc */ - case ERROR_LOCK_VIOLATION: - case ERROR_GEN_FAILURE: - case ERROR_INVALID_PARAMETER: - case ERROR_INVALID_NAME: - case ERROR_INVALID_DRIVE: - case ERROR_INVALID_HANDLE: - case ERROR_INVALID_FUNCTION: - case ERROR_INVALID_LEVEL: - case ERROR_INVALID_CATEGORY: - case ERROR_DUPLICATE_NAME: - case ERROR_BUFFER_OVERFLOW: - case ERROR_BAD_LENGTH: - case ERROR_BAD_DRIVER_LEVEL: - case ERROR_DIRECT_ACCESS_HANDLE: - case ERROR_NOT_OWNER: - return PHYSFS_ERR_OS_ERROR; - - default: break; - } /* switch */ - - return PHYSFS_ERR_OTHER_ERROR; -} /* errcodeFromAPIRET */ - -static char *cvtUtf8ToCodepage(const char *utf8str) -{ - const size_t len = strlen(utf8str) + 1; - const size_t uc2buflen = len * sizeof (UniChar); - UniChar *uc2ptr = (UniChar *) __PHYSFS_smallAlloc(uc2buflen); - UniChar *uc2str = uc2ptr; - char *cpptr = NULL; - char *cpstr = NULL; - size_t subs = 0; - size_t unilen; - - BAIL_IF(!uc2str, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - PHYSFS_utf8ToUcs2(utf8str, (PHYSFS_uint16 *) uc2str, uc2buflen); - for (unilen = 0; uc2str[unilen]; unilen++) { /* spin */ } - unilen++; /* null terminator. */ - - if (!uconvdll) - { - /* There's really not much we can do on older OS/2s except pray this - is latin1-compatible. */ - size_t i; - cpptr = (char *) allocator.Malloc(unilen); - cpstr = cpptr; - GOTO_IF(!cpptr, PHYSFS_ERR_OUT_OF_MEMORY, failed); - for (i = 0; i < unilen; i++) - { - const UniChar ch = uc2str[i]; - GOTO_IF(ch > 0xFF, PHYSFS_ERR_BAD_FILENAME, failed); - cpptr[i] = (char) ((unsigned char) ch); - } /* for */ - - __PHYSFS_smallFree(uc2ptr); - return cpstr; - } /* if */ - else - { - int rc; - size_t cplen = unilen * 4; /* overallocate, just in case. */ - cpptr = (char *) allocator.Malloc(cplen); - GOTO_IF(!cpptr, PHYSFS_ERR_OUT_OF_MEMORY, failed); - cpstr = cpptr; - - rc = pUniUconvFromUcs(uconv, &uc2str, &unilen, (void **) &cpstr, &cplen, &subs); - GOTO_IF(rc != ULS_SUCCESS, PHYSFS_ERR_BAD_FILENAME, failed); - GOTO_IF(subs > 0, PHYSFS_ERR_BAD_FILENAME, failed); - assert(unilen == 0); - - __PHYSFS_smallFree(uc2ptr); - return cpptr; - } /* else */ - -failed: - __PHYSFS_smallFree(uc2ptr); - allocator.Free(cpptr); - - return NULL; -} /* cvtUtf8ToCodepage */ - -static char *cvtCodepageToUtf8(const char *cpstr) -{ - const size_t len = strlen(cpstr) + 1; - char *retvalbuf = (char *) allocator.Malloc(len * 4); - char *retval = NULL; - - BAIL_IF(!retvalbuf, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - - if (!uconvdll) - { - /* There's really not much we can do on older OS/2s except pray this - is latin1-compatible. */ - retval = retvalbuf; - PHYSFS_utf8FromLatin1(cpstr, retval, len * 4); - } /* if */ - else - { - int rc; - size_t cplen = len; - size_t unilen = len; - size_t subs = 0; - UniChar *uc2ptr = __PHYSFS_smallAlloc(len * sizeof (UniChar)); - UniChar *uc2str = uc2ptr; - - BAIL_IF(!uc2ptr, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - rc = pUniUconvToUcs(uconv, (void **) &cpstr, &cplen, &uc2str, &unilen, &subs); - GOTO_IF(rc != ULS_SUCCESS, PHYSFS_ERR_BAD_FILENAME, done); - GOTO_IF(subs > 0, PHYSFS_ERR_BAD_FILENAME, done); - assert(cplen == 0); - retval = retvalbuf; - PHYSFS_utf8FromUcs2((const PHYSFS_uint16 *) uc2ptr, retval, len * 4); - done: - __PHYSFS_smallFree(uc2ptr); - } /* else */ - - return retval; -} /* cvtCodepageToUtf8 */ - - -/* (be gentle, this function isn't very robust.) */ -static char *cvtPathToCorrectCase(char *buf) -{ - char *retval = buf; - char *fname = buf + 3; /* point to first element. */ - char *ptr = strchr(fname, '\\'); /* find end of first element. */ - - buf[0] = toupper(buf[0]); /* capitalize drive letter. */ - - /* - * Go through each path element, and enumerate its parent dir until - * a case-insensitive match is found. If one is (and it SHOULD be) - * then overwrite the original element with the correct case. - * If there's an error, or the path has vanished for some reason, it - * won't hurt to have the original case, so we just keep going. - */ - while ((fname != NULL) && (*fname != '\0')) - { - char spec[CCHMAXPATH]; - FILEFINDBUF3 fb; - HDIR hdir = HDIR_CREATE; - ULONG count = 1; - APIRET rc; - - *(fname - 1) = '\0'; /* isolate parent dir string. */ - - strcpy(spec, buf); /* copy isolated parent dir... */ - strcat(spec, "\\*.*"); /* ...and add wildcard search spec. */ - - if (ptr != NULL) /* isolate element to find (fname is the start). */ - *ptr = '\0'; - - rc = DosFindFirst((unsigned char *) spec, &hdir, FILE_DIRECTORY, - &fb, sizeof (fb), &count, FIL_STANDARD); - if (rc == NO_ERROR) - { - while (count == 1) /* while still entries to enumerate... */ - { - int cmp; - char *utf8 = cvtCodepageToUtf8(fb.achName); - if (!utf8) /* ugh, maybe we'll get lucky with the C runtime. */ - cmp = stricmp(fb.achName, fname); - else - { - cmp = PHYSFS_utf8stricmp(utf8, fname); - allocator.Free(utf8); - } /* else */ - - if (cmp == 0) - { - strcpy(fname, fb.achName); - break; /* there it is. Overwrite and stop searching. */ - } /* if */ - - DosFindNext(hdir, &fb, sizeof (fb), &count); - } /* while */ - DosFindClose(hdir); - } /* if */ - - *(fname - 1) = '\\'; /* unisolate parent dir. */ - fname = ptr; /* point to next element. */ - if (ptr != NULL) - { - *ptr = '\\'; /* unisolate element. */ - ptr = strchr(++fname, '\\'); /* find next element. */ - } /* if */ - } /* while */ - - return retval; -} /* cvtPathToCorrectCase */ - -static void prepUnicodeSupport(void) -{ - /* really old OS/2 might not have Unicode support _at all_, so load - the system library and do without if it doesn't exist. */ - int ok = 0; - char buf[CCHMAXPATH]; - UniChar defstr[] = { 0 }; - if (DosLoadModule(buf, sizeof (buf) - 1, "uconv", &uconvdll) == NO_ERROR) - { - #define LOAD(x) (DosQueryProcAddr(uconvdll,0,#x,(PFN*)&p##x)==NO_ERROR) - ok = LOAD(UniCreateUconvObject) && - LOAD(UniFreeUconvObject) && - LOAD(UniUconvToUcs) && - LOAD(UniUconvFromUcs); - #undef LOAD - } /* else */ - - if (!ok || (pUniCreateUconvObject(defstr, &uconv) != ULS_SUCCESS)) - { - /* oh well, live without it. */ - if (uconvdll) - { - if (uconv) - pUniFreeUconvObject(uconv); - DosFreeModule(uconvdll); - uconvdll = 0; - } /* if */ - } /* if */ -} /* prepUnicodeSupport */ - - -int __PHYSFS_platformInit(void) -{ - prepUnicodeSupport(); - return 1; /* ready to go! */ -} /* __PHYSFS_platformInit */ - - -void __PHYSFS_platformDeinit(void) -{ - if (uconvdll) - { - pUniFreeUconvObject(uconv); - uconv = 0; - DosFreeModule(uconvdll); - uconvdll = 0; - } /* if */ -} /* __PHYSFS_platformDeinit */ - - -static int discIsInserted(ULONG drive) -{ - int rc; - char buf[20]; - DosError(FERR_DISABLEHARDERR | FERR_DISABLEEXCEPTION); - rc = DosQueryFSInfo(drive + 1, FSIL_VOLSER, buf, sizeof (buf)); - DosError(FERR_ENABLEHARDERR | FERR_ENABLEEXCEPTION); - return (rc == NO_ERROR); -} /* is_cdrom_inserted */ - - -/* looks like "CD01" in ASCII (littleendian)...used for an ioctl. */ -#define CD01 0x31304443 - -static int isCdRomDrive(ULONG drive) -{ - PHYSFS_uint32 param, data; - ULONG ul1, ul2; - APIRET rc; - HFILE hfile = NULLHANDLE; - unsigned char drivename[3] = { 0, ':', '\0' }; - - drivename[0] = 'A' + drive; - - rc = DosOpen(drivename, &hfile, &ul1, 0, 0, - OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW, - OPEN_FLAGS_DASD | OPEN_FLAGS_FAIL_ON_ERROR | - OPEN_FLAGS_NOINHERIT | OPEN_SHARE_DENYNONE, NULL); - if (rc != NO_ERROR) - return 0; - - data = 0; - param = PHYSFS_swapULE32(CD01); - ul1 = ul2 = sizeof (PHYSFS_uint32); - rc = DosDevIOCtl(hfile, IOCTL_CDROMDISK, CDROMDISK_GETDRIVER, - ¶m, sizeof (param), &ul1, &data, sizeof (data), &ul2); - - DosClose(hfile); - return ((rc == NO_ERROR) && (PHYSFS_swapULE32(data) == CD01)); -} /* isCdRomDrive */ - - -void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data) -{ - ULONG dummy = 0; - ULONG drivemap = 0; - ULONG i, bit; - const APIRET rc = DosQueryCurrentDisk(&dummy, &drivemap); - BAIL_IF(rc != NO_ERROR, errcodeFromAPIRET(rc),); - - for (i = 0, bit = 1; i < 26; i++, bit <<= 1) - { - if (drivemap & bit) /* this logical drive exists. */ - { - if ((isCdRomDrive(i)) && (discIsInserted(i))) - { - char drive[4] = "x:\\"; - drive[0] = ('A' + i); - cb(data, drive); - } /* if */ - } /* if */ - } /* for */ -} /* __PHYSFS_platformDetectAvailableCDs */ - - -char *__PHYSFS_platformCalcBaseDir(const char *argv0) -{ - char *retval = NULL; - char buf[CCHMAXPATH]; - APIRET rc; - PTIB ptib; - PPIB ppib; - PHYSFS_sint32 len; - - rc = DosGetInfoBlocks(&ptib, &ppib); - BAIL_IF(rc != NO_ERROR, errcodeFromAPIRET(rc), 0); - rc = DosQueryModuleName(ppib->pib_hmte, sizeof (buf), (PCHAR) buf); - BAIL_IF(rc != NO_ERROR, errcodeFromAPIRET(rc), 0); - retval = cvtCodepageToUtf8(buf); - BAIL_IF_ERRPASS(!retval, NULL); - - /* chop off filename, leave path. */ - for (len = strlen(retval) - 1; len >= 0; len--) - { - if (retval[len] == '\\') - { - retval[len + 1] = '\0'; - break; - } /* if */ - } /* for */ - - assert(len > 0); /* should have been a "x:\\" on the front on string. */ - - /* The string is capitalized! Figure out the REAL case... */ - return cvtPathToCorrectCase(retval); -} /* __PHYSFS_platformCalcBaseDir */ - -char *__PHYSFS_platformCalcUserDir(void) -{ - return __PHYSFS_platformCalcBaseDir(NULL); /* !!! FIXME: ? */ -} /* __PHYSFS_platformCalcUserDir */ - -char *__PHYSFS_platformCalcPrefDir(const char *org, const char *app) -{ - return __PHYSFS_platformCalcBaseDir(NULL); /* !!! FIXME: ? */ -} /* __PHYSFS_platformCalcPrefDir */ - -PHYSFS_EnumerateCallbackResult __PHYSFS_platformEnumerate(const char *dirname, - PHYSFS_EnumerateCallback callback, - const char *origdir, void *callbackdata) -{ - PHYSFS_EnumerateCallbackResult retval = PHYSFS_ENUM_OK; - size_t utf8len = strlen(dirname); - char *utf8 = (char *) __PHYSFS_smallAlloc(utf8len + 5); - char *cpspec = NULL; - FILEFINDBUF3 fb; - HDIR hdir = HDIR_CREATE; - ULONG count = 1; - APIRET rc; - - BAIL_IF(!utf8, PHYSFS_ERR_OUT_OF_MEMORY, PHYSFS_ENUM_ERROR); - - strcpy(utf8, dirname); - if (utf8[utf8len - 1] != '\\') - strcpy(utf8 + utf8len, "\\*.*"); - else - strcpy(utf8 + utf8len, "*.*"); - - cpspec = cvtUtf8ToCodepage(utf8); - __PHYSFS_smallFree(utf8); - BAIL_IF_ERRPASS(!cpspec, PHYSFS_ENUM_ERROR); - - rc = DosFindFirst((unsigned char *) cpspec, &hdir, - FILE_DIRECTORY | FILE_ARCHIVED | - FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM, - &fb, sizeof (fb), &count, FIL_STANDARD); - allocator.Free(cpspec); - - BAIL_IF(rc != NO_ERROR, errcodeFromAPIRET(rc), PHYSFS_ENUM_ERROR); - - while (count == 1) - { - if ((strcmp(fb.achName, ".") != 0) && (strcmp(fb.achName, "..") != 0)) - { - utf8 = cvtCodepageToUtf8(fb.achName); - if (!utf8) - retval = PHYSFS_ENUM_ERROR; - else - { - retval = callback(callbackdata, origdir, utf8); - allocator.Free(utf8); - if (retval == PHYSFS_ENUM_ERROR) - PHYSFS_setErrorCode(PHYSFS_ERR_APP_CALLBACK); - } /* else */ - } /* if */ - - if (retval != PHYSFS_ENUM_OK) - break; - - DosFindNext(hdir, &fb, sizeof (fb), &count); - } /* while */ - - DosFindClose(hdir); - - return retval; -} /* __PHYSFS_platformEnumerate */ - - -char *__PHYSFS_platformCurrentDir(void) -{ - char *retval; - char *cpstr; - char *utf8; - ULONG currentDisk; - ULONG dummy; - ULONG pathSize = 0; - APIRET rc; - BYTE byte; - - rc = DosQueryCurrentDisk(¤tDisk, &dummy); - BAIL_IF(rc != NO_ERROR, errcodeFromAPIRET(rc), NULL); - - /* The first call just tells us how much space we need for the string. */ - rc = DosQueryCurrentDir(currentDisk, &byte, &pathSize); - pathSize++; /* Add space for null terminator. */ - cpstr = (char *) __PHYSFS_smallAlloc(pathSize); - BAIL_IF(cpstr == NULL, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - - /* Actually get the string this time. */ - rc = DosQueryCurrentDir(currentDisk, (PBYTE) cpstr, &pathSize); - if (rc != NO_ERROR) - { - __PHYSFS_smallFree(cpstr); - BAIL(errcodeFromAPIRET(rc), NULL); - } /* if */ - - utf8 = cvtCodepageToUtf8(cpstr); - __PHYSFS_smallFree(cpstr); - BAIL_IF_ERRPASS(utf8 == NULL, NULL); - - /* +4 for "x:\\" drive selector and null terminator. */ - retval = (char *) allocator.Malloc(strlen(utf8) + 4); - if (retval == NULL) - { - allocator.Free(utf8); - BAIL(PHYSFS_ERR_OUT_OF_MEMORY, NULL); - } /* if */ - - retval[0] = ('A' + (currentDisk - 1)); - retval[1] = ':'; - retval[2] = '\\'; - strcpy(retval + 3, utf8); - - allocator.Free(utf8); - - return retval; -} /* __PHYSFS_platformCurrentDir */ - - -int __PHYSFS_platformMkDir(const char *filename) -{ - APIRET rc; - char *cpstr = cvtUtf8ToCodepage(filename); - BAIL_IF_ERRPASS(!cpstr, 0); - rc = DosCreateDir((unsigned char *) cpstr, NULL); - allocator.Free(cpstr); - BAIL_IF(rc != NO_ERROR, errcodeFromAPIRET(rc), 0); - return 1; -} /* __PHYSFS_platformMkDir */ - - -static HFILE openFile(const char *filename, const ULONG flags, const ULONG mode) -{ - char *cpfname = cvtUtf8ToCodepage(filename); - ULONG action = 0; - HFILE hfile = NULLHANDLE; - APIRET rc; - - BAIL_IF_ERRPASS(!cpfname, 0); - - rc = DosOpen(cpfname, &hfile, &action, 0, FILE_NORMAL, flags, mode, NULL); - allocator.Free(cpfname); - BAIL_IF(rc != NO_ERROR, errcodeFromAPIRET(rc), 0); - - return hfile; -} /* openFile */ - -void *__PHYSFS_platformOpenRead(const char *filename) -{ - /* - * File must be opened SHARE_DENYWRITE and ACCESS_READONLY, otherwise - * DosQueryFileInfo() will fail if we try to get a file length, etc. - */ - return (void *) openFile(filename, - OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW, - OPEN_FLAGS_FAIL_ON_ERROR | OPEN_FLAGS_NO_LOCALITY | - OPEN_FLAGS_NOINHERIT | OPEN_SHARE_DENYWRITE | - OPEN_ACCESS_READONLY); -} /* __PHYSFS_platformOpenRead */ - - -void *__PHYSFS_platformOpenWrite(const char *filename) -{ - return (void *) openFile(filename, - OPEN_ACTION_REPLACE_IF_EXISTS | - OPEN_ACTION_CREATE_IF_NEW, - OPEN_FLAGS_FAIL_ON_ERROR | OPEN_FLAGS_NO_LOCALITY | - OPEN_FLAGS_NOINHERIT | OPEN_SHARE_DENYWRITE); -} /* __PHYSFS_platformOpenWrite */ - - -void *__PHYSFS_platformOpenAppend(const char *filename) -{ - APIRET rc; - ULONG dummy = 0; - HFILE hfile; - - /* - * File must be opened SHARE_DENYWRITE and ACCESS_READWRITE, otherwise - * DosQueryFileInfo() will fail if we try to get a file length, etc. - */ - hfile = openFile(filename, - OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW, - OPEN_FLAGS_FAIL_ON_ERROR | OPEN_FLAGS_NO_LOCALITY | - OPEN_FLAGS_NOINHERIT | OPEN_SHARE_DENYWRITE | - OPEN_ACCESS_READWRITE); - BAIL_IF_ERRPASS(!hfile, NULL); - - rc = DosSetFilePtr(hfile, 0, FILE_END, &dummy); - if (rc != NO_ERROR) - { - DosClose(hfile); - BAIL(errcodeFromAPIRET(rc), NULL); - } /* if */ - - return ((void *) hfile); -} /* __PHYSFS_platformOpenAppend */ - - -PHYSFS_sint64 __PHYSFS_platformRead(void *opaque, void *buf, PHYSFS_uint64 len) -{ - ULONG br = 0; - APIRET rc; - BAIL_IF(!__PHYSFS_ui64FitsAddressSpace(len),PHYSFS_ERR_INVALID_ARGUMENT,-1); - rc = DosRead((HFILE) opaque, buf, (ULONG) len, &br); - BAIL_IF(rc != NO_ERROR, errcodeFromAPIRET(rc), (br > 0) ? ((PHYSFS_sint64) br) : -1); - return (PHYSFS_sint64) br; -} /* __PHYSFS_platformRead */ - - -PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, const void *buf, - PHYSFS_uint64 len) -{ - ULONG bw = 0; - APIRET rc; - BAIL_IF(!__PHYSFS_ui64FitsAddressSpace(len),PHYSFS_ERR_INVALID_ARGUMENT,-1); - rc = DosWrite((HFILE) opaque, (void *) buf, (ULONG) len, &bw); - BAIL_IF(rc != NO_ERROR, errcodeFromAPIRET(rc), (bw > 0) ? ((PHYSFS_sint64) bw) : -1); - return (PHYSFS_sint64) bw; -} /* __PHYSFS_platformWrite */ - - -int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos) -{ - ULONG dummy; - HFILE hfile = (HFILE) opaque; - LONG dist = (LONG) pos; - APIRET rc; - - /* hooray for 32-bit filesystem limits! :) */ - BAIL_IF((PHYSFS_uint64) dist != pos, PHYSFS_ERR_INVALID_ARGUMENT, 0); - rc = DosSetFilePtr(hfile, dist, FILE_BEGIN, &dummy); - BAIL_IF(rc != NO_ERROR, errcodeFromAPIRET(rc), 0); - return 1; -} /* __PHYSFS_platformSeek */ - - -PHYSFS_sint64 __PHYSFS_platformTell(void *opaque) -{ - ULONG pos; - HFILE hfile = (HFILE) opaque; - const APIRET rc = DosSetFilePtr(hfile, 0, FILE_CURRENT, &pos); - BAIL_IF(rc != NO_ERROR, errcodeFromAPIRET(rc), -1); - return ((PHYSFS_sint64) pos); -} /* __PHYSFS_platformTell */ - - -PHYSFS_sint64 __PHYSFS_platformFileLength(void *opaque) -{ - FILESTATUS3 fs; - HFILE hfile = (HFILE) opaque; - const APIRET rc = DosQueryFileInfo(hfile, FIL_STANDARD, &fs, sizeof (fs)); - BAIL_IF(rc != NO_ERROR, errcodeFromAPIRET(rc), -1); - return ((PHYSFS_sint64) fs.cbFile); -} /* __PHYSFS_platformFileLength */ - - -int __PHYSFS_platformFlush(void *opaque) -{ - const APIRET rc = DosResetBuffer((HFILE) opaque); - BAIL_IF(rc != NO_ERROR, errcodeFromAPIRET(rc), 0); - return 1; -} /* __PHYSFS_platformFlush */ - - -void __PHYSFS_platformClose(void *opaque) -{ - DosClose((HFILE) opaque); /* ignore errors. You should have flushed! */ -} /* __PHYSFS_platformClose */ - - -int __PHYSFS_platformDelete(const char *path) -{ - char *cppath = cvtUtf8ToCodepage(path); - FILESTATUS3 fs; - APIRET rc; - int retval = 0; - - BAIL_IF_ERRPASS(!cppath, 0); - rc = DosQueryPathInfo(cppath, FIL_STANDARD, &fs, sizeof (fs)); - GOTO_IF(rc != NO_ERROR, errcodeFromAPIRET(rc), done); - rc = (fs.attrFile & FILE_DIRECTORY) ? DosDeleteDir(path) : DosDelete(path); - GOTO_IF(rc != NO_ERROR, errcodeFromAPIRET(rc), done); - retval = 1; /* success */ - -done: - allocator.Free(cppath); - return retval; -} /* __PHYSFS_platformDelete */ - - -/* Convert to a format PhysicsFS can grok... */ -PHYSFS_sint64 os2TimeToUnixTime(const FDATE *date, const FTIME *time) -{ - struct tm tm; - - tm.tm_sec = ((PHYSFS_uint32) time->twosecs) * 2; - tm.tm_min = time->minutes; - tm.tm_hour = time->hours; - tm.tm_mday = date->day; - tm.tm_mon = date->month; - tm.tm_year = ((PHYSFS_uint32) date->year) + 80; - tm.tm_wday = -1 /*st_localtz.wDayOfWeek*/; - tm.tm_yday = -1; - tm.tm_isdst = -1; - - return (PHYSFS_sint64) mktime(&tm); -} /* os2TimeToUnixTime */ - - -int __PHYSFS_platformStat(const char *filename, PHYSFS_Stat *stat, const int follow) -{ - char *cpfname = cvtUtf8ToCodepage(filename); - FILESTATUS3 fs; - int retval = 0; - APIRET rc; - - BAIL_IF_ERRPASS(!cpfname, 0); - - rc = DosQueryPathInfo(cpfname, FIL_STANDARD, &fs, sizeof (fs)); - GOTO_IF(rc != NO_ERROR, errcodeFromAPIRET(rc), done); - - if (fs.attrFile & FILE_DIRECTORY) - { - stat->filetype = PHYSFS_FILETYPE_DIRECTORY; - stat->filesize = 0; - } /* if */ - else - { - stat->filetype = PHYSFS_FILETYPE_REGULAR; - stat->filesize = fs.cbFile; - } /* else */ - - stat->modtime = os2TimeToUnixTime(&fs.fdateLastWrite, &fs.ftimeLastWrite); - if (stat->modtime < 0) - stat->modtime = 0; - - stat->accesstime = os2TimeToUnixTime(&fs.fdateLastAccess, &fs.ftimeLastAccess); - if (stat->accesstime < 0) - stat->accesstime = 0; - - stat->createtime = os2TimeToUnixTime(&fs.fdateCreation, &fs.ftimeCreation); - if (stat->createtime < 0) - stat->createtime = 0; - - stat->readonly = ((fs.attrFile & FILE_READONLY) == FILE_READONLY); - return 1; /* success */ - -done: - allocator.Free(cpfname); - return retval; -} /* __PHYSFS_platformStat */ - - -void *__PHYSFS_platformGetThreadID(void) -{ - PTIB ptib; - PPIB ppib; - - /* - * Allegedly, this API never fails, but we'll punt and return a - * default value (zero might as well do) if it does. - */ - const APIRET rc = DosGetInfoBlocks(&ptib, &ppib); - BAIL_IF(rc != NO_ERROR, errcodeFromAPIRET(rc), 0); - return ((void *) ptib->tib_ordinal); -} /* __PHYSFS_platformGetThreadID */ - - -void *__PHYSFS_platformCreateMutex(void) -{ - HMTX hmtx = NULLHANDLE; - const APIRET rc = DosCreateMutexSem(NULL, &hmtx, 0, 0); - BAIL_IF(rc != NO_ERROR, errcodeFromAPIRET(rc), NULL); - return ((void *) hmtx); -} /* __PHYSFS_platformCreateMutex */ - - -void __PHYSFS_platformDestroyMutex(void *mutex) -{ - DosCloseMutexSem((HMTX) mutex); -} /* __PHYSFS_platformDestroyMutex */ - - -int __PHYSFS_platformGrabMutex(void *mutex) -{ - /* Do _NOT_ set the physfs error message in here! */ - return (DosRequestMutexSem((HMTX) mutex, SEM_INDEFINITE_WAIT) == NO_ERROR); -} /* __PHYSFS_platformGrabMutex */ - - -void __PHYSFS_platformReleaseMutex(void *mutex) -{ - DosReleaseMutexSem((HMTX) mutex); -} /* __PHYSFS_platformReleaseMutex */ - -#endif /* PHYSFS_PLATFORM_OS2 */ - -/* end of physfs_platform_os2.c ... */ diff --git a/love/src/jni/love/src/libraries/physfs/physfs_platform_posix.c b/love/src/jni/love/src/libraries/physfs/physfs_platform_posix.c deleted file mode 100644 index fa2159cd..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_platform_posix.c +++ /dev/null @@ -1,417 +0,0 @@ -/* - * Posix-esque support routines for PhysicsFS. - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file written by Ryan C. Gordon. - */ - -/* !!! FIXME: check for EINTR? */ - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_platforms.h" - -#ifdef PHYSFS_PLATFORM_POSIX - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "physfs_internal.h" - - -static PHYSFS_ErrorCode errcodeFromErrnoError(const int err) -{ - switch (err) - { - case 0: return PHYSFS_ERR_OK; - case EACCES: return PHYSFS_ERR_PERMISSION; - case EPERM: return PHYSFS_ERR_PERMISSION; - case EDQUOT: return PHYSFS_ERR_NO_SPACE; - case EIO: return PHYSFS_ERR_IO; - case ELOOP: return PHYSFS_ERR_SYMLINK_LOOP; - case EMLINK: return PHYSFS_ERR_NO_SPACE; - case ENAMETOOLONG: return PHYSFS_ERR_BAD_FILENAME; - case ENOENT: return PHYSFS_ERR_NOT_FOUND; - case ENOSPC: return PHYSFS_ERR_NO_SPACE; - case ENOTDIR: return PHYSFS_ERR_NOT_FOUND; - case EISDIR: return PHYSFS_ERR_NOT_A_FILE; - case EROFS: return PHYSFS_ERR_READ_ONLY; - case ETXTBSY: return PHYSFS_ERR_BUSY; - case EBUSY: return PHYSFS_ERR_BUSY; - case ENOMEM: return PHYSFS_ERR_OUT_OF_MEMORY; - case ENOTEMPTY: return PHYSFS_ERR_DIR_NOT_EMPTY; - default: return PHYSFS_ERR_OS_ERROR; - } /* switch */ -} /* errcodeFromErrnoError */ - - -static inline PHYSFS_ErrorCode errcodeFromErrno(void) -{ - return errcodeFromErrnoError(errno); -} /* errcodeFromErrno */ - - -static char *getUserDirByUID(void) -{ - uid_t uid = getuid(); - struct passwd *pw; - char *retval = NULL; - - pw = getpwuid(uid); - if ((pw != NULL) && (pw->pw_dir != NULL) && (*pw->pw_dir != '\0')) - { - const size_t dlen = strlen(pw->pw_dir); - const size_t add_dirsep = (pw->pw_dir[dlen-1] != '/') ? 1 : 0; - retval = (char *) allocator.Malloc(dlen + 1 + add_dirsep); - if (retval != NULL) - { - strcpy(retval, pw->pw_dir); - if (add_dirsep) - { - retval[dlen] = '/'; - retval[dlen+1] = '\0'; - } /* if */ - } /* if */ - } /* if */ - - return retval; -} /* getUserDirByUID */ - - -char *__PHYSFS_platformCalcUserDir(void) -{ - char *retval = NULL; - char *envr = getenv("HOME"); - - /* if the environment variable was set, make sure it's really a dir. */ - if (envr != NULL) - { - struct stat statbuf; - if ((stat(envr, &statbuf) != -1) && (S_ISDIR(statbuf.st_mode))) - { - const size_t envrlen = strlen(envr); - const size_t add_dirsep = (envr[envrlen-1] != '/') ? 1 : 0; - retval = allocator.Malloc(envrlen + 1 + add_dirsep); - if (retval) - { - strcpy(retval, envr); - if (add_dirsep) - { - retval[envrlen] = '/'; - retval[envrlen+1] = '\0'; - } /* if */ - } /* if */ - } /* if */ - } /* if */ - - if (retval == NULL) - retval = getUserDirByUID(); - - return retval; -} /* __PHYSFS_platformCalcUserDir */ - - -PHYSFS_EnumerateCallbackResult __PHYSFS_platformEnumerate(const char *dirname, - PHYSFS_EnumerateCallback callback, - const char *origdir, void *callbackdata) -{ - DIR *dir; - struct dirent *ent; - PHYSFS_EnumerateCallbackResult retval = PHYSFS_ENUM_OK; - - dir = opendir(dirname); - BAIL_IF(dir == NULL, errcodeFromErrno(), PHYSFS_ENUM_ERROR); - - while ((retval == PHYSFS_ENUM_OK) && ((ent = readdir(dir)) != NULL)) - { - const char *name = ent->d_name; - if (name[0] == '.') /* ignore "." and ".." */ - { - if ((name[1] == '\0') || ((name[1] == '.') && (name[2] == '\0'))) - continue; - } /* if */ - - retval = callback(callbackdata, origdir, name); - if (retval == PHYSFS_ENUM_ERROR) - PHYSFS_setErrorCode(PHYSFS_ERR_APP_CALLBACK); - } /* while */ - - closedir(dir); - - return retval; -} /* __PHYSFS_platformEnumerate */ - - -int __PHYSFS_platformMkDir(const char *path) -{ - const int rc = mkdir(path, S_IRWXU); - BAIL_IF(rc == -1, errcodeFromErrno(), 0); - return 1; -} /* __PHYSFS_platformMkDir */ - - -static void *doOpen(const char *filename, int mode) -{ - const int appending = (mode & O_APPEND); - int fd; - int *retval; - errno = 0; - - /* O_APPEND doesn't actually behave as we'd like. */ - mode &= ~O_APPEND; - - fd = open(filename, mode, S_IRUSR | S_IWUSR); - BAIL_IF(fd < 0, errcodeFromErrno(), NULL); - - if (appending) - { - if (lseek(fd, 0, SEEK_END) < 0) - { - const int err = errno; - close(fd); - BAIL(errcodeFromErrnoError(err), NULL); - } /* if */ - } /* if */ - - retval = (int *) allocator.Malloc(sizeof (int)); - if (!retval) - { - close(fd); - BAIL(PHYSFS_ERR_OUT_OF_MEMORY, NULL); - } /* if */ - - *retval = fd; - return ((void *) retval); -} /* doOpen */ - - -void *__PHYSFS_platformOpenRead(const char *filename) -{ - return doOpen(filename, O_RDONLY); -} /* __PHYSFS_platformOpenRead */ - - -void *__PHYSFS_platformOpenWrite(const char *filename) -{ - return doOpen(filename, O_WRONLY | O_CREAT | O_TRUNC); -} /* __PHYSFS_platformOpenWrite */ - - -void *__PHYSFS_platformOpenAppend(const char *filename) -{ - return doOpen(filename, O_WRONLY | O_CREAT | O_APPEND); -} /* __PHYSFS_platformOpenAppend */ - - -PHYSFS_sint64 __PHYSFS_platformRead(void *opaque, void *buffer, - PHYSFS_uint64 len) -{ - const int fd = *((int *) opaque); - ssize_t rc = 0; - - if (!__PHYSFS_ui64FitsAddressSpace(len)) - BAIL(PHYSFS_ERR_INVALID_ARGUMENT, -1); - - rc = read(fd, buffer, (size_t) len); - BAIL_IF(rc == -1, errcodeFromErrno(), -1); - assert(rc >= 0); - assert(rc <= len); - return (PHYSFS_sint64) rc; -} /* __PHYSFS_platformRead */ - - -PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, const void *buffer, - PHYSFS_uint64 len) -{ - const int fd = *((int *) opaque); - ssize_t rc = 0; - - if (!__PHYSFS_ui64FitsAddressSpace(len)) - BAIL(PHYSFS_ERR_INVALID_ARGUMENT, -1); - - rc = write(fd, (void *) buffer, (size_t) len); - BAIL_IF(rc == -1, errcodeFromErrno(), rc); - assert(rc >= 0); - assert(rc <= len); - return (PHYSFS_sint64) rc; -} /* __PHYSFS_platformWrite */ - - -int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos) -{ - const int fd = *((int *) opaque); - const off_t rc = lseek(fd, (off_t) pos, SEEK_SET); - BAIL_IF(rc == -1, errcodeFromErrno(), 0); - return 1; -} /* __PHYSFS_platformSeek */ - - -PHYSFS_sint64 __PHYSFS_platformTell(void *opaque) -{ - const int fd = *((int *) opaque); - PHYSFS_sint64 retval; - retval = (PHYSFS_sint64) lseek(fd, 0, SEEK_CUR); - BAIL_IF(retval == -1, errcodeFromErrno(), -1); - return retval; -} /* __PHYSFS_platformTell */ - - -PHYSFS_sint64 __PHYSFS_platformFileLength(void *opaque) -{ - const int fd = *((int *) opaque); - struct stat statbuf; - BAIL_IF(fstat(fd, &statbuf) == -1, errcodeFromErrno(), -1); - return ((PHYSFS_sint64) statbuf.st_size); -} /* __PHYSFS_platformFileLength */ - - -int __PHYSFS_platformFlush(void *opaque) -{ - const int fd = *((int *) opaque); - if ((fcntl(fd, F_GETFL) & O_ACCMODE) != O_RDONLY) - BAIL_IF(fsync(fd) == -1, errcodeFromErrno(), 0); - return 1; -} /* __PHYSFS_platformFlush */ - - -void __PHYSFS_platformClose(void *opaque) -{ - const int fd = *((int *) opaque); - (void) close(fd); /* we don't check this. You should have used flush! */ - allocator.Free(opaque); -} /* __PHYSFS_platformClose */ - - -int __PHYSFS_platformDelete(const char *path) -{ - BAIL_IF(remove(path) == -1, errcodeFromErrno(), 0); - return 1; -} /* __PHYSFS_platformDelete */ - - -int __PHYSFS_platformStat(const char *fname, PHYSFS_Stat *st, const int follow) -{ - struct stat statbuf; - const int rc = follow ? stat(fname, &statbuf) : lstat(fname, &statbuf); - BAIL_IF(rc == -1, errcodeFromErrno(), 0); - - if (S_ISREG(statbuf.st_mode)) - { - st->filetype = PHYSFS_FILETYPE_REGULAR; - st->filesize = statbuf.st_size; - } /* if */ - - else if(S_ISDIR(statbuf.st_mode)) - { - st->filetype = PHYSFS_FILETYPE_DIRECTORY; - st->filesize = 0; - } /* else if */ - - else if(S_ISLNK(statbuf.st_mode)) - { - st->filetype = PHYSFS_FILETYPE_SYMLINK; - st->filesize = 0; - } /* else if */ - - else - { - st->filetype = PHYSFS_FILETYPE_OTHER; - st->filesize = statbuf.st_size; - } /* else */ - - st->modtime = statbuf.st_mtime; - st->createtime = statbuf.st_ctime; - st->accesstime = statbuf.st_atime; - - st->readonly = (access(fname, W_OK) == -1); - return 1; -} /* __PHYSFS_platformStat */ - - -typedef struct -{ - pthread_mutex_t mutex; - pthread_t owner; - PHYSFS_uint32 count; -} PthreadMutex; - - -void *__PHYSFS_platformGetThreadID(void) -{ - return ( (void *) ((size_t) pthread_self()) ); -} /* __PHYSFS_platformGetThreadID */ - - -void *__PHYSFS_platformCreateMutex(void) -{ - int rc; - PthreadMutex *m = (PthreadMutex *) allocator.Malloc(sizeof (PthreadMutex)); - BAIL_IF(!m, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - rc = pthread_mutex_init(&m->mutex, NULL); - if (rc != 0) - { - allocator.Free(m); - BAIL(PHYSFS_ERR_OS_ERROR, NULL); - } /* if */ - - m->count = 0; - m->owner = (pthread_t) 0xDEADBEEF; - return ((void *) m); -} /* __PHYSFS_platformCreateMutex */ - - -void __PHYSFS_platformDestroyMutex(void *mutex) -{ - PthreadMutex *m = (PthreadMutex *) mutex; - - /* Destroying a locked mutex is a bug, but we'll try to be helpful. */ - if ((m->owner == pthread_self()) && (m->count > 0)) - pthread_mutex_unlock(&m->mutex); - - pthread_mutex_destroy(&m->mutex); - allocator.Free(m); -} /* __PHYSFS_platformDestroyMutex */ - - -int __PHYSFS_platformGrabMutex(void *mutex) -{ - PthreadMutex *m = (PthreadMutex *) mutex; - pthread_t tid = pthread_self(); - if (m->owner != tid) - { - if (pthread_mutex_lock(&m->mutex) != 0) - return 0; - m->owner = tid; - } /* if */ - - m->count++; - return 1; -} /* __PHYSFS_platformGrabMutex */ - - -void __PHYSFS_platformReleaseMutex(void *mutex) -{ - PthreadMutex *m = (PthreadMutex *) mutex; - assert(m->owner == pthread_self()); /* catch programming errors. */ - assert(m->count > 0); /* catch programming errors. */ - if (m->owner == pthread_self()) - { - if (--m->count == 0) - { - m->owner = (pthread_t) 0xDEADBEEF; - pthread_mutex_unlock(&m->mutex); - } /* if */ - } /* if */ -} /* __PHYSFS_platformReleaseMutex */ - -#endif /* PHYSFS_PLATFORM_POSIX */ - -/* end of physfs_platform_posix.c ... */ - diff --git a/love/src/jni/love/src/libraries/physfs/physfs_platform_qnx.c b/love/src/jni/love/src/libraries/physfs/physfs_platform_qnx.c deleted file mode 100644 index 46f9aa70..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_platform_qnx.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * QNX support routines for PhysicsFS. - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file written by Ryan C. Gordon. - */ - -/* This is tested against QNX 7 at the moment. */ - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_platforms.h" - -#ifdef PHYSFS_PLATFORM_QNX - -#include -#include -#include -#include - -#include "physfs_internal.h" - -int __PHYSFS_platformInit(void) -{ - return 1; /* always succeed. */ -} /* __PHYSFS_platformInit */ - - -void __PHYSFS_platformDeinit(void) -{ - /* no-op */ -} /* __PHYSFS_platformDeinit */ - - -char *__PHYSFS_platformCalcBaseDir(const char *argv0) -{ - char *retval = (char *) allocator.Malloc(PATH_MAX+1); - if (retval == NULL) - BAIL(PHYSFS_ERR_OUT_OF_MEMORY, NULL); - else - { - const int fd = open("/proc/self/exefile", O_RDONLY); - const ssize_t br = (fd == -1) ? -1 : read(fd, retval, PATH_MAX); - char *ptr; - - if (fd != -1) - close(fd); - - if ((br < 0) || (br > PATH_MAX)) - { - allocator.Free(retval); - BAIL(PHYSFS_ERR_OS_ERROR, NULL); - } /* if */ - - retval[br] = '\0'; - ptr = strrchr(retval, '/'); - if (ptr == NULL) /* uhoh! */ - { - allocator.Free(retval); - BAIL(PHYSFS_ERR_OS_ERROR, NULL); - } /* if */ - - ptr[1] = '\0'; /* chop off filename, leave dirs and '/' */ - - ptr = (char *) allocator.Realloc(retval, (ptr - retval) + 2); - if (ptr != NULL) /* just shrinking buffer; don't care if it failed. */ - retval = ptr; - } /* else */ - - return retval; -} /* __PHYSFS_platformCalcBaseDir */ - - -char *__PHYSFS_platformCalcPrefDir(const char *org, const char *app) -{ - /* !!! FIXME: this might be wrong; I don't know if there's a better method - on QNX, or if it follows XDG specs, etc. */ - char *retval = NULL; - const char *home = __PHYSFS_getUserDir(); - if (home) - { - const size_t len = strlen(home) + strlen(app) + 3; - retval = (char *) allocator.Malloc(len); - BAIL_IF(!retval, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - snprintf(retval, len, "%s.%s/", home, app); - } /* if */ - return retval; -} /* __PHYSFS_platformCalcPrefDir */ - - -#if !PHYSFS_NO_CDROM_SUPPORT -#include -#include -#include -#include -#include - -static void checkPathForCD(const char *path, PHYSFS_StringCallback cb, void *d) -{ - struct stat statbuf; - int fd; - - /* The devctl() thing is QNX-specific. In this case, we query what is - probably the mountpoint for the device. statvfs() on that mountpoint - will tell use its filesystem type. */ - - if ( (stat(path, &statbuf) == 0) && - (S_ISBLK(statbuf.st_mode)) && - ((fd = open(path, O_RDONLY | O_NONBLOCK)) != -1) ) - { - char mnt[256] = { 0 }; - const int rc = devctl(fd, DCMD_FSYS_MOUNTED_BY, mnt, sizeof (mnt), 0); - close(fd); - if ( (rc == EOK) && (mnt[0]) ) - { - struct statvfs statvfsbuf; - if (statvfs(mnt, &statvfsbuf) == 0) - { - /* I don't know if this is a complete or accurate list. */ - const char *fstype = statvfsbuf.f_basetype; - const int iscd = ( (strcmp(fstype, "cd") == 0) || - (strcmp(fstype, "udf") == 0) ); - if (iscd) - cb(d, mnt); - } /* if */ - } /* if */ - } /* if */ -} /* checkPathForCD */ - -static void checkDevForCD(const char *dev, PHYSFS_StringCallback cb, void *d) -{ - size_t len; - char *path; - - if (dev[0] == '.') /* ignore "." and ".." */ - { - if ((dev[1] == '\0') || ((dev[1] == '.') && (dev[2] == '\0'))) - return; - } /* if */ - - len = strlen(dev) + 6; - path = (char *) __PHYSFS_smallAlloc(len); - if (!path) - return; /* oh well. */ - - snprintf(path, len, "/dev/%s", dev); - checkPathForCD(path, cb, d); - __PHYSFS_smallFree(path); -} /* checkDevForCD */ -#endif /* !PHYSFS_NO_CDROM_SUPPORT */ - -void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data) -{ -#if !PHYSFS_NO_CDROM_SUPPORT - DIR *dirp = opendir("/dev"); - if (dirp) - { - struct dirent *dent; - while ((dent = readdir(dirp)) != NULL) - checkDevForCD(dent->d_name, cb, data); - closedir(dirp); - } /* if */ -#endif -} /* __PHYSFS_platformDetectAvailableCDs */ - -#endif /* PHYSFS_PLATFORM_QNX */ - -/* end of physfs_platform_qnx.c ... */ - diff --git a/love/src/jni/love/src/libraries/physfs/physfs_platform_unix.c b/love/src/jni/love/src/libraries/physfs/physfs_platform_unix.c deleted file mode 100644 index 10d93a7e..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_platform_unix.c +++ /dev/null @@ -1,367 +0,0 @@ -/* - * Unix support routines for PhysicsFS. - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file written by Ryan C. Gordon. - */ - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_platforms.h" - -#ifdef PHYSFS_PLATFORM_UNIX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if PHYSFS_NO_CDROM_SUPPORT -#elif PHYSFS_PLATFORM_LINUX -# define PHYSFS_HAVE_MNTENT_H 1 -#elif defined __CYGWIN__ -# define PHYSFS_HAVE_MNTENT_H 1 -#elif PHYSFS_PLATFORM_SOLARIS -# define PHYSFS_HAVE_SYS_MNTTAB_H 1 -#elif PHYSFS_PLATFORM_BSD -# define PHYSFS_HAVE_SYS_UCRED_H 1 -#else -# warning No CD-ROM support included. Either define your platform here, -# warning or define PHYSFS_NO_CDROM_SUPPORT=1 to confirm this is intentional. -#endif - -#ifdef PHYSFS_HAVE_SYS_UCRED_H -# ifdef PHYSFS_HAVE_MNTENT_H -# undef PHYSFS_HAVE_MNTENT_H /* don't do both... */ -# endif -# include -# include -#endif - -#ifdef PHYSFS_HAVE_MNTENT_H -#include -#endif - -#ifdef PHYSFS_HAVE_SYS_MNTTAB_H -#include -#endif - -#ifdef PHYSFS_PLATFORM_FREEBSD -#include -#endif - - -#include "physfs_internal.h" - -int __PHYSFS_platformInit(void) -{ - return 1; /* always succeed. */ -} /* __PHYSFS_platformInit */ - - -void __PHYSFS_platformDeinit(void) -{ - /* no-op */ -} /* __PHYSFS_platformDeinit */ - - -void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data) -{ -#if (defined PHYSFS_NO_CDROM_SUPPORT) - /* no-op. */ - -#elif (defined PHYSFS_HAVE_SYS_UCRED_H) - int i; - struct statfs *mntbufp = NULL; - int mounts = getmntinfo(&mntbufp, MNT_NOWAIT); - - for (i = 0; i < mounts; i++) - { - int add_it = 0; - - if (strcmp(mntbufp[i].f_fstypename, "iso9660") == 0) - add_it = 1; - else if (strcmp( mntbufp[i].f_fstypename, "cd9660") == 0) - add_it = 1; - - /* add other mount types here */ - - if (add_it) - cb(data, mntbufp[i].f_mntonname); - } /* for */ - -#elif (defined PHYSFS_HAVE_MNTENT_H) - FILE *mounts = NULL; - struct mntent *ent = NULL; - - mounts = setmntent("/etc/mtab", "r"); - BAIL_IF(mounts == NULL, PHYSFS_ERR_IO, /*return void*/); - - while ( (ent = getmntent(mounts)) != NULL ) - { - int add_it = 0; - if (strcmp(ent->mnt_type, "iso9660") == 0) - add_it = 1; - else if (strcmp(ent->mnt_type, "udf") == 0) - add_it = 1; - - /* !!! FIXME: these might pick up floppy drives, right? */ - else if (strcmp(ent->mnt_type, "auto") == 0) - add_it = 1; - else if (strcmp(ent->mnt_type, "supermount") == 0) - add_it = 1; - - /* add other mount types here */ - - if (add_it) - cb(data, ent->mnt_dir); - } /* while */ - - endmntent(mounts); - -#elif (defined PHYSFS_HAVE_SYS_MNTTAB_H) - FILE *mounts = fopen(MNTTAB, "r"); - struct mnttab ent; - - BAIL_IF(mounts == NULL, PHYSFS_ERR_IO, /*return void*/); - while (getmntent(mounts, &ent) == 0) - { - int add_it = 0; - if (strcmp(ent.mnt_fstype, "hsfs") == 0) - add_it = 1; - - /* add other mount types here */ - - if (add_it) - cb(data, ent.mnt_mountp); - } /* while */ - - fclose(mounts); -#endif -} /* __PHYSFS_platformDetectAvailableCDs */ - - -/* - * See where program (bin) resides in the $PATH specified by (envr). - * returns a copy of the first element in envr that contains it, or NULL - * if it doesn't exist or there were other problems. PHYSFS_SetError() is - * called if we have a problem. - * - * (envr) will be scribbled over, and you are expected to allocator.Free() the - * return value when you're done with it. - */ -static char *findBinaryInPath(const char *bin, char *envr) -{ - size_t alloc_size = 0; - char *exe = NULL; - char *start = envr; - char *ptr; - - assert(bin != NULL); - assert(envr != NULL); - - do - { - size_t size; - size_t binlen; - - ptr = strchr(start, ':'); /* find next $PATH separator. */ - if (ptr) - *ptr = '\0'; - - binlen = strlen(bin); - size = strlen(start) + binlen + 2; - if (size >= alloc_size) - { - char *x = (char *) allocator.Realloc(exe, size); - if (!x) - { - if (exe != NULL) - allocator.Free(exe); - BAIL(PHYSFS_ERR_OUT_OF_MEMORY, NULL); - } /* if */ - - alloc_size = size; - exe = x; - } /* if */ - - /* build full binary path... */ - strcpy(exe, start); - if ((exe[0] == '\0') || (exe[strlen(exe) - 1] != '/')) - strcat(exe, "/"); - strcat(exe, bin); - - if (access(exe, X_OK) == 0) /* Exists as executable? We're done. */ - { - exe[(size - binlen) - 1] = '\0'; /* chop off filename, leave '/' */ - return exe; - } /* if */ - - start = ptr + 1; /* start points to beginning of next element. */ - } while (ptr != NULL); - - if (exe != NULL) - allocator.Free(exe); - - return NULL; /* doesn't exist in path. */ -} /* findBinaryInPath */ - - -static char *readSymLink(const char *path) -{ - ssize_t len = 64; - ssize_t rc = -1; - char *retval = NULL; - - while (1) - { - char *ptr = (char *) allocator.Realloc(retval, (size_t) len); - if (ptr == NULL) - break; /* out of memory. */ - retval = ptr; - - rc = readlink(path, retval, len); - if (rc == -1) - break; /* not a symlink, i/o error, etc. */ - - else if (rc < len) - { - retval[rc] = '\0'; /* readlink doesn't null-terminate. */ - return retval; /* we're good to go. */ - } /* else if */ - - len *= 2; /* grow buffer, try again. */ - } /* while */ - - if (retval != NULL) - allocator.Free(retval); - return NULL; -} /* readSymLink */ - - -char *__PHYSFS_platformCalcBaseDir(const char *argv0) -{ - char *retval = NULL; - const char *envr = NULL; - - /* Try to avoid using argv0 unless forced to. Try system-specific stuff. */ - - #if defined(PHYSFS_PLATFORM_FREEBSD) - { - char fullpath[PATH_MAX]; - size_t buflen = sizeof (fullpath); - int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 }; - if (sysctl(mib, 4, fullpath, &buflen, NULL, 0) != -1) - retval = __PHYSFS_strdup(fullpath); - } - #elif defined(PHYSFS_PLATFORM_SOLARIS) - { - const char *path = getexecname(); - if ((path != NULL) && (path[0] == '/')) /* must be absolute path... */ - retval = __PHYSFS_strdup(path); - } - #endif - - /* If there's a Linux-like /proc filesystem, you can get the full path to - * the current process from a symlink in there. - */ - - if (!retval && (access("/proc", F_OK) == 0)) - { - retval = readSymLink("/proc/self/exe"); - if (!retval) retval = readSymLink("/proc/curproc/file"); - if (!retval) retval = readSymLink("/proc/curproc/exe"); - if (retval == NULL) - { - /* older kernels don't have /proc/self ... try PID version... */ - const unsigned long long pid = (unsigned long long) getpid(); - char path[64]; - const int rc = (int) snprintf(path,sizeof(path),"/proc/%llu/exe",pid); - if ( (rc > 0) && (rc < sizeof(path)) ) - retval = readSymLink(path); - } /* if */ - } /* if */ - - if (retval != NULL) /* chop off filename. */ - { - char *ptr = strrchr(retval, '/'); - if (ptr != NULL) - *(ptr+1) = '\0'; - else /* shouldn't happen, but just in case... */ - { - allocator.Free(retval); - retval = NULL; - } /* else */ - } /* if */ - - /* No /proc/self/exe, etc, but we have an argv[0] we can parse? */ - if ((retval == NULL) && (argv0 != NULL)) - { - /* fast path: default behaviour can handle this. */ - if (strchr(argv0, '/') != NULL) - return NULL; /* higher level parses out real path from argv0. */ - - /* If there's no dirsep on argv0, then look through $PATH for it. */ - envr = getenv("PATH"); - if (envr != NULL) - { - char *path = (char *) __PHYSFS_smallAlloc(strlen(envr) + 1); - BAIL_IF(!path, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - strcpy(path, envr); - retval = findBinaryInPath(argv0, path); - __PHYSFS_smallFree(path); - } /* if */ - } /* if */ - - if (retval != NULL) - { - /* try to shrink buffer... */ - char *ptr = (char *) allocator.Realloc(retval, strlen(retval) + 1); - if (ptr != NULL) - retval = ptr; /* oh well if it failed. */ - } /* if */ - - return retval; -} /* __PHYSFS_platformCalcBaseDir */ - - -char *__PHYSFS_platformCalcPrefDir(const char *org, const char *app) -{ - /* - * We use XDG's base directory spec, even if you're not on Linux. - * This isn't strictly correct, but the results are relatively sane - * in any case. - * - * https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html - */ - const char *envr = getenv("XDG_DATA_HOME"); - const char *append = "/"; - char *retval = NULL; - size_t len = 0; - - if (!envr) - { - /* You end up with "$HOME/.local/share/Game Name 2" */ - envr = __PHYSFS_getUserDir(); - BAIL_IF_ERRPASS(!envr, NULL); /* oh well. */ - append = ".local/share/"; - } /* if */ - - len = strlen(envr) + strlen(append) + strlen(app) + 2; - retval = (char *) allocator.Malloc(len); - BAIL_IF(!retval, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - snprintf(retval, len, "%s%s%s/", envr, append, app); - return retval; -} /* __PHYSFS_platformCalcPrefDir */ - -#endif /* PHYSFS_PLATFORM_UNIX */ - -/* end of physfs_platform_unix.c ... */ - diff --git a/love/src/jni/love/src/libraries/physfs/physfs_platform_windows.c b/love/src/jni/love/src/libraries/physfs/physfs_platform_windows.c deleted file mode 100644 index 4f8c99a6..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_platform_windows.c +++ /dev/null @@ -1,1026 +0,0 @@ -/* - * Windows support routines for PhysicsFS. - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file written by Ryan C. Gordon, and made sane by Gregory S. Read. - */ - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_platforms.h" - -#ifdef PHYSFS_PLATFORM_WINDOWS - -/* Forcibly disable UNICODE macro, since we manage this ourselves. */ -#ifdef UNICODE -#undef UNICODE -#endif - -#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) -#define _CRT_SECURE_NO_WARNINGS 1 -#endif - -#define WIN32_LEAN_AND_MEAN 1 -#include - -#ifndef PHYSFS_PLATFORM_WINRT -#include -#include -#endif - -#if !defined(PHYSFS_NO_CDROM_SUPPORT) -#include -#endif - -#include -#include -#include - -#ifdef allocator /* apparently Windows 10 SDK conflicts here. */ -#undef allocator -#endif - -#include "physfs_internal.h" - -/* - * Users without the platform SDK don't have this defined. The original docs - * for SetFilePointer() just said to compare with 0xFFFFFFFF, so this should - * work as desired. - */ -#define PHYSFS_INVALID_SET_FILE_POINTER 0xFFFFFFFF - -/* just in case... */ -#define PHYSFS_INVALID_FILE_ATTRIBUTES 0xFFFFFFFF - -/* Not defined before the Vista SDK. */ -#define PHYSFS_FILE_ATTRIBUTE_REPARSE_POINT 0x400 -#define PHYSFS_IO_REPARSE_TAG_SYMLINK 0xA000000C - - -#define UTF8_TO_UNICODE_STACK(w_assignto, str) { \ - if (str == NULL) \ - w_assignto = NULL; \ - else { \ - const size_t len = (PHYSFS_uint64) ((strlen(str) + 1) * 2); \ - w_assignto = (WCHAR *) __PHYSFS_smallAlloc(len); \ - if (w_assignto != NULL) \ - PHYSFS_utf8ToUtf16(str, (PHYSFS_uint16 *) w_assignto, len); \ - } \ -} \ - -/* Note this counts WCHARs, not codepoints! */ -static PHYSFS_uint64 wStrLen(const WCHAR *wstr) -{ - PHYSFS_uint64 len = 0; - while (*(wstr++)) - len++; - return len; -} /* wStrLen */ - -static char *unicodeToUtf8Heap(const WCHAR *w_str) -{ - char *retval = NULL; - if (w_str != NULL) - { - void *ptr = NULL; - const PHYSFS_uint64 len = (wStrLen(w_str) * 4) + 1; - retval = allocator.Malloc(len); - BAIL_IF(!retval, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - PHYSFS_utf8FromUtf16((const PHYSFS_uint16 *) w_str, retval, len); - ptr = allocator.Realloc(retval, strlen(retval) + 1); /* shrink. */ - if (ptr != NULL) - retval = (char *) ptr; - } /* if */ - return retval; -} /* unicodeToUtf8Heap */ - - -/* Some older APIs aren't in WinRT (only the "Ex" version, etc). - Since non-WinRT might not have the "Ex" version, we tapdance to use - the perfectly-fine-and-available-even-on-Win95 API on non-WinRT targets. */ - -static inline HANDLE winFindFirstFileW(const WCHAR *path, LPWIN32_FIND_DATAW d) -{ - #ifdef PHYSFS_PLATFORM_WINRT - return FindFirstFileExW(path, FindExInfoStandard, d, - FindExSearchNameMatch, NULL, 0); - #else - return FindFirstFileW(path, d); - #endif -} /* winFindFirstFileW */ - -static inline BOOL winInitializeCriticalSection(LPCRITICAL_SECTION lpcs) -{ - #ifdef PHYSFS_PLATFORM_WINRT - return InitializeCriticalSectionEx(lpcs, 2000, 0); - #else - InitializeCriticalSection(lpcs); - return TRUE; - #endif -} /* winInitializeCriticalSection */ - -static inline HANDLE winCreateFileW(const WCHAR *wfname, const DWORD mode, - const DWORD creation) -{ - const DWORD share = FILE_SHARE_READ | FILE_SHARE_WRITE; - #ifdef PHYSFS_PLATFORM_WINRT - return CreateFile2(wfname, mode, share, creation, NULL); - #else - return CreateFileW(wfname, mode, share, NULL, creation, - FILE_ATTRIBUTE_NORMAL, NULL); - #endif -} /* winCreateFileW */ - -static BOOL winSetFilePointer(HANDLE h, const PHYSFS_sint64 pos, - PHYSFS_sint64 *_newpos, const DWORD whence) -{ - #ifdef PHYSFS_PLATFORM_WINRT - LARGE_INTEGER lipos; - LARGE_INTEGER linewpos; - BOOL rc; - lipos.QuadPart = (LONGLONG) pos; - rc = SetFilePointerEx(h, lipos, &linewpos, whence); - if (_newpos) - *_newpos = (PHYSFS_sint64) linewpos.QuadPart; - return rc; - #else - const LONG low = (LONG) (pos & 0xFFFFFFFF); - LONG high = (LONG) ((pos >> 32) & 0xFFFFFFFF); - const DWORD rc = SetFilePointer(h, low, &high, whence); - /* 0xFFFFFFFF could be valid, so you have to check GetLastError too! */ - if (_newpos) - *_newpos = ((PHYSFS_sint64) rc) | (((PHYSFS_sint64) high) << 32); - if ((rc == PHYSFS_INVALID_SET_FILE_POINTER) && (GetLastError() != NO_ERROR)) - return FALSE; - return TRUE; - #endif -} /* winSetFilePointer */ - -static PHYSFS_sint64 winGetFileSize(HANDLE h) -{ - #ifdef PHYSFS_PLATFORM_WINRT - FILE_STANDARD_INFO info; - const BOOL rc = GetFileInformationByHandleEx(h, FileStandardInfo, - &info, sizeof (info)); - return rc ? (PHYSFS_sint64) info.EndOfFile.QuadPart : -1; - #else - DWORD high = 0; - const DWORD rc = GetFileSize(h, &high); - if ((rc == PHYSFS_INVALID_SET_FILE_POINTER) && (GetLastError() != NO_ERROR)) - return -1; - return (PHYSFS_sint64) ((((PHYSFS_uint64) high) << 32) | rc); - #endif -} /* winGetFileSize */ - - -static PHYSFS_ErrorCode errcodeFromWinApiError(const DWORD err) -{ - /* - * win32 error codes are sort of a tricky thing; Microsoft intentionally - * doesn't list which ones a given API might trigger, there are several - * with overlapping and unclear meanings...and there's 16 thousand of - * them in Windows 7. It looks like the ones we care about are in the - * first 500, but I can't say this list is perfect; we might miss - * important values or misinterpret others. - * - * Don't treat this list as anything other than a work in progress. - */ - switch (err) - { - case ERROR_SUCCESS: return PHYSFS_ERR_OK; - case ERROR_ACCESS_DENIED: return PHYSFS_ERR_PERMISSION; - case ERROR_NETWORK_ACCESS_DENIED: return PHYSFS_ERR_PERMISSION; - case ERROR_NOT_READY: return PHYSFS_ERR_IO; - case ERROR_CRC: return PHYSFS_ERR_IO; - case ERROR_SEEK: return PHYSFS_ERR_IO; - case ERROR_SECTOR_NOT_FOUND: return PHYSFS_ERR_IO; - case ERROR_NOT_DOS_DISK: return PHYSFS_ERR_IO; - case ERROR_WRITE_FAULT: return PHYSFS_ERR_IO; - case ERROR_READ_FAULT: return PHYSFS_ERR_IO; - case ERROR_DEV_NOT_EXIST: return PHYSFS_ERR_IO; - case ERROR_BUFFER_OVERFLOW: return PHYSFS_ERR_BAD_FILENAME; - case ERROR_INVALID_NAME: return PHYSFS_ERR_BAD_FILENAME; - case ERROR_BAD_PATHNAME: return PHYSFS_ERR_BAD_FILENAME; - case ERROR_DIRECTORY: return PHYSFS_ERR_BAD_FILENAME; - case ERROR_FILE_NOT_FOUND: return PHYSFS_ERR_NOT_FOUND; - case ERROR_PATH_NOT_FOUND: return PHYSFS_ERR_NOT_FOUND; - case ERROR_DELETE_PENDING: return PHYSFS_ERR_NOT_FOUND; - case ERROR_INVALID_DRIVE: return PHYSFS_ERR_NOT_FOUND; - case ERROR_HANDLE_DISK_FULL: return PHYSFS_ERR_NO_SPACE; - case ERROR_DISK_FULL: return PHYSFS_ERR_NO_SPACE; - case ERROR_WRITE_PROTECT: return PHYSFS_ERR_READ_ONLY; - case ERROR_LOCK_VIOLATION: return PHYSFS_ERR_BUSY; - case ERROR_SHARING_VIOLATION: return PHYSFS_ERR_BUSY; - case ERROR_CURRENT_DIRECTORY: return PHYSFS_ERR_BUSY; - case ERROR_DRIVE_LOCKED: return PHYSFS_ERR_BUSY; - case ERROR_PATH_BUSY: return PHYSFS_ERR_BUSY; - case ERROR_BUSY: return PHYSFS_ERR_BUSY; - case ERROR_NOT_ENOUGH_MEMORY: return PHYSFS_ERR_OUT_OF_MEMORY; - case ERROR_OUTOFMEMORY: return PHYSFS_ERR_OUT_OF_MEMORY; - case ERROR_DIR_NOT_EMPTY: return PHYSFS_ERR_DIR_NOT_EMPTY; - default: return PHYSFS_ERR_OS_ERROR; - } /* switch */ -} /* errcodeFromWinApiError */ - -static inline PHYSFS_ErrorCode errcodeFromWinApi(void) -{ - return errcodeFromWinApiError(GetLastError()); -} /* errcodeFromWinApi */ - - -#if defined(PHYSFS_NO_CDROM_SUPPORT) -#define detectAvailableCDs(cb, data) -#define deinitCDThread() -#else -static HANDLE detectCDThreadHandle = NULL; -static HWND detectCDHwnd = NULL; -static volatile DWORD drivesWithMediaBitmap = 0; - -typedef BOOL (WINAPI *fnSTEM)(DWORD, LPDWORD b); - -static DWORD pollDiscDrives(void) -{ - /* Try to use SetThreadErrorMode(), which showed up in Windows 7. */ - HANDLE lib = LoadLibraryA("kernel32.dll"); - fnSTEM stem = NULL; - char drive[4] = { 'x', ':', '\\', '\0' }; - DWORD oldErrorMode = 0; - DWORD drives = 0; - DWORD i; - - if (lib) - stem = (fnSTEM) GetProcAddress(lib, "SetThreadErrorMode"); - - if (stem) - stem(SEM_FAILCRITICALERRORS, &oldErrorMode); - else - oldErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); - - /* Do detection. This may block if a disc is spinning up. */ - for (i = 'A'; i <= 'Z'; i++) - { - DWORD tmp = 0; - drive[0] = (char) i; - if (GetDriveTypeA(drive) != DRIVE_CDROM) - continue; - - /* If this function succeeds, there's media in the drive */ - if (GetVolumeInformationA(drive, NULL, 0, NULL, NULL, &tmp, NULL, 0)) - drives |= (1 << (i - 'A')); - } /* for */ - - if (stem) - stem(oldErrorMode, NULL); - else - SetErrorMode(oldErrorMode); - - if (lib) - FreeLibrary(lib); - - return drives; -} /* pollDiscDrives */ - - -static LRESULT CALLBACK detectCDWndProc(HWND hwnd, UINT msg, - WPARAM wp, LPARAM lparam) -{ - PDEV_BROADCAST_HDR lpdb = (PDEV_BROADCAST_HDR) lparam; - PDEV_BROADCAST_VOLUME lpdbv = (PDEV_BROADCAST_VOLUME) lparam; - const int removed = (wp == DBT_DEVICEREMOVECOMPLETE); - - if (msg == WM_DESTROY) - return 0; - else if ((msg != WM_DEVICECHANGE) || - ((wp != DBT_DEVICEARRIVAL) && (wp != DBT_DEVICEREMOVECOMPLETE)) || - (lpdb->dbch_devicetype != DBT_DEVTYP_VOLUME) || - ((lpdbv->dbcv_flags & DBTF_MEDIA) == 0)) - { - return DefWindowProcW(hwnd, msg, wp, lparam); - } /* else if */ - - if (removed) - drivesWithMediaBitmap &= ~lpdbv->dbcv_unitmask; - else - drivesWithMediaBitmap |= lpdbv->dbcv_unitmask; - - return TRUE; -} /* detectCDWndProc */ - - -static DWORD WINAPI detectCDThread(LPVOID arg) -{ - HANDLE initialDiscDetectionComplete = *((HANDLE *) arg); - const char *classname = "PhysicsFSDetectCDCatcher"; - const char *winname = "PhysicsFSDetectCDMsgWindow"; - HINSTANCE hInstance = GetModuleHandleW(NULL); - ATOM class_atom = 0; - WNDCLASSEXA wce; - MSG msg; - - memset(&wce, '\0', sizeof (wce)); - wce.cbSize = sizeof (wce); - wce.lpfnWndProc = detectCDWndProc; - wce.lpszClassName = classname; - wce.hInstance = hInstance; - class_atom = RegisterClassExA(&wce); - if (class_atom == 0) - { - SetEvent(initialDiscDetectionComplete); /* let main thread go on. */ - return 0; - } /* if */ - - detectCDHwnd = CreateWindowExA(0, classname, winname, WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, HWND_DESKTOP, NULL, hInstance, NULL); - - if (detectCDHwnd == NULL) - { - SetEvent(initialDiscDetectionComplete); /* let main thread go on. */ - UnregisterClassA(classname, hInstance); - return 0; - } /* if */ - - /* We'll get events when discs come and go from now on. */ - - /* Do initial detection, possibly blocking awhile... */ - drivesWithMediaBitmap = pollDiscDrives(); - - SetEvent(initialDiscDetectionComplete); /* let main thread go on. */ - - do - { - const BOOL rc = GetMessageW(&msg, detectCDHwnd, 0, 0); - if ((rc == 0) || (rc == -1)) - break; /* don't care if WM_QUIT or error break this loop. */ - TranslateMessage(&msg); - DispatchMessageW(&msg); - } while (1); - - /* we've been asked to quit. */ - DestroyWindow(detectCDHwnd); - UnregisterClassA(classname, hInstance); - return 0; -} /* detectCDThread */ - -static void detectAvailableCDs(PHYSFS_StringCallback cb, void *data) -{ - char drive_str[4] = { 'x', ':', '\\', '\0' }; - DWORD drives = 0; - DWORD i; - - /* - * If you poll a drive while a user is inserting a disc, the OS will - * block this thread until the drive has spun up. So we swallow the risk - * once for initial detection, and spin a thread that will get device - * events thereafter, for apps that use this interface to poll for - * disc insertion. - */ - if (!detectCDThreadHandle) - { - HANDLE initialDetectDone = CreateEvent(NULL, TRUE, FALSE, NULL); - if (!initialDetectDone) - return; /* oh well. */ - - detectCDThreadHandle = CreateThread(NULL, 0, detectCDThread, - &initialDetectDone, 0, NULL); - if (detectCDThreadHandle) - WaitForSingleObject(initialDetectDone, INFINITE); - CloseHandle(initialDetectDone); - - if (!detectCDThreadHandle) - return; /* oh well. */ - } /* if */ - - drives = drivesWithMediaBitmap; /* whatever the thread has seen, we take. */ - for (i = 'A'; i <= 'Z'; i++) - { - if (drives & (1 << (i - 'A'))) - { - drive_str[0] = (char) i; - cb(data, drive_str); - } /* if */ - } /* for */ -} /* detectAvailableCDs */ - -static void deinitCDThread(void) -{ - if (detectCDThreadHandle) - { - if (detectCDHwnd) - PostMessageW(detectCDHwnd, WM_QUIT, 0, 0); - CloseHandle(detectCDThreadHandle); - detectCDThreadHandle = NULL; - drivesWithMediaBitmap = 0; - } /* if */ -} /* deinitCDThread */ -#endif - - -void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data) -{ - detectAvailableCDs(cb, data); -} /* __PHYSFS_platformDetectAvailableCDs */ - -#ifdef PHYSFS_PLATFORM_WINRT -static char *calcDirAppendSep(const WCHAR *wdir) -{ - size_t len; - void *ptr; - char *retval; - BAIL_IF(!wdir, errcodeFromWinApi(), NULL); - retval = unicodeToUtf8Heap(wdir); - BAIL_IF_ERRPASS(!retval, NULL); - len = strlen(retval); - ptr = allocator.Realloc(retval, len + 2); - if (!ptr) - { - allocator.Free(retval); - BAIL(PHYSFS_ERR_OUT_OF_MEMORY, NULL); - } /* if */ - retval = (char *) ptr; - retval[len] = '\\'; - retval[len+1] = '\0'; - return retval; -} /* calcDirAppendSep */ -#endif - -char *__PHYSFS_platformCalcBaseDir(const char *argv0) -{ -#ifdef PHYSFS_PLATFORM_WINRT - return calcDirAppendSep((const WCHAR *) __PHYSFS_winrtCalcBaseDir()); -#else - char *retval = NULL; - DWORD buflen = 64; - LPWSTR modpath = NULL; - - while (1) - { - DWORD rc; - void *ptr; - - if ( (ptr = allocator.Realloc(modpath, buflen*sizeof(WCHAR))) == NULL ) - { - allocator.Free(modpath); - BAIL(PHYSFS_ERR_OUT_OF_MEMORY, NULL); - } /* if */ - modpath = (LPWSTR) ptr; - - rc = GetModuleFileNameW(NULL, modpath, buflen); - if (rc == 0) - { - allocator.Free(modpath); - BAIL(errcodeFromWinApi(), NULL); - } /* if */ - - if (rc < buflen) - { - buflen = rc; - break; - } /* if */ - - buflen *= 2; - } /* while */ - - if (buflen > 0) /* just in case... */ - { - WCHAR *ptr = (modpath + buflen) - 1; - while (ptr != modpath) - { - if (*ptr == '\\') - break; - ptr--; - } /* while */ - - if ((ptr == modpath) && (*ptr != '\\')) - PHYSFS_setErrorCode(PHYSFS_ERR_OTHER_ERROR); /* oh well. */ - else - { - *(ptr+1) = '\0'; /* chop off filename. */ - retval = unicodeToUtf8Heap(modpath); - } /* else */ - } /* else */ - allocator.Free(modpath); - - return retval; /* w00t. */ -#endif -} /* __PHYSFS_platformCalcBaseDir */ - - -char *__PHYSFS_platformCalcPrefDir(const char *org, const char *app) -{ -#ifdef PHYSFS_PLATFORM_WINRT - return calcDirAppendSep((const WCHAR *) __PHYSFS_winrtCalcPrefDir()); -#else - /* - * Vista and later has a new API for this, but SHGetFolderPath works there, - * and apparently just wraps the new API. This is the new way to do it: - * - * SHGetKnownFolderPath(FOLDERID_RoamingAppData, KF_FLAG_CREATE, - * NULL, &wszPath); - */ - - WCHAR path[MAX_PATH]; - char *utf8 = NULL; - size_t len = 0; - char *retval = NULL; - - if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, - NULL, 0, path))) - BAIL(PHYSFS_ERR_OS_ERROR, NULL); - - utf8 = unicodeToUtf8Heap(path); - BAIL_IF_ERRPASS(!utf8, NULL); - len = strlen(utf8) + strlen(org) + strlen(app) + 4; - retval = allocator.Malloc(len); - if (!retval) - { - allocator.Free(utf8); - BAIL(PHYSFS_ERR_OUT_OF_MEMORY, NULL); - } /* if */ - - snprintf(retval, len, "%s\\%s\\%s\\", utf8, org, app); - allocator.Free(utf8); - return retval; -#endif -} /* __PHYSFS_platformCalcPrefDir */ - - -char *__PHYSFS_platformCalcUserDir(void) -{ -#ifdef PHYSFS_PLATFORM_WINRT - return calcDirAppendSep((const WCHAR *) __PHYSFS_winrtCalcPrefDir()); -#else - typedef BOOL (WINAPI *fnGetUserProfDirW)(HANDLE, LPWSTR, LPDWORD); - fnGetUserProfDirW pGetDir = NULL; - HANDLE lib = NULL; - HANDLE accessToken = NULL; /* Security handle to process */ - char *retval = NULL; - - lib = LoadLibraryA("userenv.dll"); - BAIL_IF(!lib, errcodeFromWinApi(), NULL); - pGetDir=(fnGetUserProfDirW) GetProcAddress(lib,"GetUserProfileDirectoryW"); - GOTO_IF(!pGetDir, errcodeFromWinApi(), done); - - if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &accessToken)) - GOTO(errcodeFromWinApi(), done); - else - { - DWORD psize = 0; - LPWSTR wstr = NULL; - BOOL rc = 0; - - /* - * Should fail. Will write the size of the profile path in - * psize. Also note that the second parameter can't be - * NULL or the function fails. - */ - /* - * EDIT: (03.10.2018) after Windows 10 Update 1809 psize will be zero - * if something other than NULL is passed for the second argument. - * Passing NULL now makes GetUserProfileDirectoryW fail (rc == 0) - * and psize receives the correct user directory length. - * It seems to work fine on Windows 7 and Windows 10 Update 1803 too - */ - rc = pGetDir(accessToken, NULL, &psize); - GOTO_IF(rc, PHYSFS_ERR_OS_ERROR, done); /* should have failed! */ - - /* Allocate memory for the profile directory */ - wstr = (LPWSTR) __PHYSFS_smallAlloc((psize + 1) * sizeof (WCHAR)); - if (wstr != NULL) - { - if (pGetDir(accessToken, wstr, &psize)) - { - /* Make sure it ends in a dirsep. We allocated +1 for this. */ - if (wstr[psize - 2] != '\\') - { - wstr[psize - 1] = '\\'; - wstr[psize - 0] = '\0'; - } /* if */ - retval = unicodeToUtf8Heap(wstr); - } /* if */ - __PHYSFS_smallFree(wstr); - } /* if */ - } /* if */ - -done: - if (accessToken) - CloseHandle(accessToken); - FreeLibrary(lib); - return retval; /* We made it: hit the showers. */ -#endif -} /* __PHYSFS_platformCalcUserDir */ - - -int __PHYSFS_platformInit(void) -{ - return 1; /* It's all good */ -} /* __PHYSFS_platformInit */ - - -void __PHYSFS_platformDeinit(void) -{ - deinitCDThread(); -} /* __PHYSFS_platformDeinit */ - - -void *__PHYSFS_platformGetThreadID(void) -{ - return ( (void *) ((size_t) GetCurrentThreadId()) ); -} /* __PHYSFS_platformGetThreadID */ - - -PHYSFS_EnumerateCallbackResult __PHYSFS_platformEnumerate(const char *dirname, - PHYSFS_EnumerateCallback callback, - const char *origdir, void *callbackdata) -{ - PHYSFS_EnumerateCallbackResult retval = PHYSFS_ENUM_OK; - HANDLE dir = INVALID_HANDLE_VALUE; - WIN32_FIND_DATAW entw; - size_t len = strlen(dirname); - char *searchPath = NULL; - WCHAR *wSearchPath = NULL; - - /* Allocate a new string for path, maybe '\\', "*", and NULL terminator */ - searchPath = (char *) __PHYSFS_smallAlloc(len + 3); - BAIL_IF(!searchPath, PHYSFS_ERR_OUT_OF_MEMORY, PHYSFS_ENUM_ERROR); - - /* Copy current dirname */ - strcpy(searchPath, dirname); - - /* if there's no '\\' at the end of the path, stick one in there. */ - if (searchPath[len - 1] != '\\') - { - searchPath[len++] = '\\'; - searchPath[len] = '\0'; - } /* if */ - - /* Append the "*" to the end of the string */ - strcat(searchPath, "*"); - - UTF8_TO_UNICODE_STACK(wSearchPath, searchPath); - __PHYSFS_smallFree(searchPath); - BAIL_IF_ERRPASS(!wSearchPath, PHYSFS_ENUM_ERROR); - - dir = winFindFirstFileW(wSearchPath, &entw); - __PHYSFS_smallFree(wSearchPath); - BAIL_IF(dir==INVALID_HANDLE_VALUE, errcodeFromWinApi(), PHYSFS_ENUM_ERROR); - - do - { - const WCHAR *fn = entw.cFileName; - char *utf8; - - if (fn[0] == '.') /* ignore "." and ".." */ - { - if ((fn[1] == '\0') || ((fn[1] == '.') && (fn[2] == '\0'))) - continue; - } /* if */ - - utf8 = unicodeToUtf8Heap(fn); - if (utf8 == NULL) - retval = -1; - else - { - retval = callback(callbackdata, origdir, utf8); - allocator.Free(utf8); - if (retval == PHYSFS_ENUM_ERROR) - PHYSFS_setErrorCode(PHYSFS_ERR_APP_CALLBACK); - } /* else */ - } while ((retval == PHYSFS_ENUM_OK) && (FindNextFileW(dir, &entw) != 0)); - - FindClose(dir); - - return retval; -} /* __PHYSFS_platformEnumerate */ - - -int __PHYSFS_platformMkDir(const char *path) -{ - WCHAR *wpath; - DWORD rc; - UTF8_TO_UNICODE_STACK(wpath, path); - rc = CreateDirectoryW(wpath, NULL); - __PHYSFS_smallFree(wpath); - BAIL_IF(rc == 0, errcodeFromWinApi(), 0); - return 1; -} /* __PHYSFS_platformMkDir */ - - -static HANDLE doOpen(const char *fname, DWORD mode, DWORD creation) -{ - HANDLE fileh; - WCHAR *wfname; - - UTF8_TO_UNICODE_STACK(wfname, fname); - BAIL_IF(!wfname, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - - fileh = winCreateFileW(wfname, mode, creation); - __PHYSFS_smallFree(wfname); - - if (fileh == INVALID_HANDLE_VALUE) - BAIL(errcodeFromWinApi(), INVALID_HANDLE_VALUE); - - return fileh; -} /* doOpen */ - - -void *__PHYSFS_platformOpenRead(const char *filename) -{ - HANDLE h = doOpen(filename, GENERIC_READ, OPEN_EXISTING); - return (h == INVALID_HANDLE_VALUE) ? NULL : (void *) h; -} /* __PHYSFS_platformOpenRead */ - - -void *__PHYSFS_platformOpenWrite(const char *filename) -{ - HANDLE h = doOpen(filename, GENERIC_WRITE, CREATE_ALWAYS); - return (h == INVALID_HANDLE_VALUE) ? NULL : (void *) h; -} /* __PHYSFS_platformOpenWrite */ - - -void *__PHYSFS_platformOpenAppend(const char *filename) -{ - HANDLE h = doOpen(filename, GENERIC_WRITE, OPEN_ALWAYS); - BAIL_IF_ERRPASS(h == INVALID_HANDLE_VALUE, NULL); - - if (!winSetFilePointer(h, 0, NULL, FILE_END)) - { - const PHYSFS_ErrorCode err = errcodeFromWinApi(); - CloseHandle(h); - BAIL(err, NULL); - } /* if */ - - return (void *) h; -} /* __PHYSFS_platformOpenAppend */ - - -PHYSFS_sint64 __PHYSFS_platformRead(void *opaque, void *buf, PHYSFS_uint64 len) -{ - HANDLE h = (HANDLE) opaque; - PHYSFS_sint64 totalRead = 0; - - if (!__PHYSFS_ui64FitsAddressSpace(len)) - BAIL(PHYSFS_ERR_INVALID_ARGUMENT, -1); - - while (len > 0) - { - const DWORD thislen = (len > 0xFFFFFFFF) ? 0xFFFFFFFF : (DWORD) len; - DWORD numRead = 0; - if (!ReadFile(h, buf, thislen, &numRead, NULL)) - BAIL(errcodeFromWinApi(), -1); - len -= (PHYSFS_uint64) numRead; - totalRead += (PHYSFS_sint64) numRead; - if (numRead != thislen) - break; - } /* while */ - - return totalRead; -} /* __PHYSFS_platformRead */ - - -PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, const void *buffer, - PHYSFS_uint64 len) -{ - HANDLE h = (HANDLE) opaque; - PHYSFS_sint64 totalWritten = 0; - - if (!__PHYSFS_ui64FitsAddressSpace(len)) - BAIL(PHYSFS_ERR_INVALID_ARGUMENT, -1); - - while (len > 0) - { - const DWORD thislen = (len > 0xFFFFFFFF) ? 0xFFFFFFFF : (DWORD) len; - DWORD numWritten = 0; - if (!WriteFile(h, buffer, thislen, &numWritten, NULL)) - BAIL(errcodeFromWinApi(), -1); - len -= (PHYSFS_uint64) numWritten; - totalWritten += (PHYSFS_sint64) numWritten; - if (numWritten != thislen) - break; - } /* while */ - - return totalWritten; -} /* __PHYSFS_platformWrite */ - - -int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos) -{ - HANDLE h = (HANDLE) opaque; - const PHYSFS_sint64 spos = (PHYSFS_sint64) pos; - BAIL_IF(!winSetFilePointer(h,spos,NULL,FILE_BEGIN), errcodeFromWinApi(), 0); - return 1; /* No error occured */ -} /* __PHYSFS_platformSeek */ - - -PHYSFS_sint64 __PHYSFS_platformTell(void *opaque) -{ - HANDLE h = (HANDLE) opaque; - PHYSFS_sint64 pos = 0; - BAIL_IF(!winSetFilePointer(h,0,&pos,FILE_CURRENT), errcodeFromWinApi(), -1); - return pos; -} /* __PHYSFS_platformTell */ - - -PHYSFS_sint64 __PHYSFS_platformFileLength(void *opaque) -{ - HANDLE h = (HANDLE) opaque; - const PHYSFS_sint64 retval = winGetFileSize(h); - BAIL_IF(retval < 0, errcodeFromWinApi(), -1); - return retval; -} /* __PHYSFS_platformFileLength */ - - -int __PHYSFS_platformFlush(void *opaque) -{ - HANDLE h = (HANDLE) opaque; - BAIL_IF(!FlushFileBuffers(h), errcodeFromWinApi(), 0); - return 1; -} /* __PHYSFS_platformFlush */ - - -void __PHYSFS_platformClose(void *opaque) -{ - HANDLE h = (HANDLE) opaque; - (void) CloseHandle(h); /* ignore errors. You should have flushed! */ -} /* __PHYSFS_platformClose */ - - -static int doPlatformDelete(LPWSTR wpath) -{ - WIN32_FILE_ATTRIBUTE_DATA info; - if (!GetFileAttributesExW(wpath, GetFileExInfoStandard, &info)) - BAIL(errcodeFromWinApi(), 0); - else - { - const int isdir = (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY); - const BOOL rc = isdir ? RemoveDirectoryW(wpath) : DeleteFileW(wpath); - BAIL_IF(!rc, errcodeFromWinApi(), 0); - } /* else */ - return 1; /* if you made it here, it worked. */ -} /* doPlatformDelete */ - - -int __PHYSFS_platformDelete(const char *path) -{ - int retval = 0; - LPWSTR wpath = NULL; - UTF8_TO_UNICODE_STACK(wpath, path); - BAIL_IF(!wpath, PHYSFS_ERR_OUT_OF_MEMORY, 0); - retval = doPlatformDelete(wpath); - __PHYSFS_smallFree(wpath); - return retval; -} /* __PHYSFS_platformDelete */ - - -void *__PHYSFS_platformCreateMutex(void) -{ - LPCRITICAL_SECTION lpcs; - lpcs = (LPCRITICAL_SECTION) allocator.Malloc(sizeof (CRITICAL_SECTION)); - BAIL_IF(!lpcs, PHYSFS_ERR_OUT_OF_MEMORY, NULL); - - if (!winInitializeCriticalSection(lpcs)) - { - allocator.Free(lpcs); - BAIL(errcodeFromWinApi(), NULL); - } /* if */ - - return lpcs; -} /* __PHYSFS_platformCreateMutex */ - - -void __PHYSFS_platformDestroyMutex(void *mutex) -{ - DeleteCriticalSection((LPCRITICAL_SECTION) mutex); - allocator.Free(mutex); -} /* __PHYSFS_platformDestroyMutex */ - - -int __PHYSFS_platformGrabMutex(void *mutex) -{ - EnterCriticalSection((LPCRITICAL_SECTION) mutex); - return 1; -} /* __PHYSFS_platformGrabMutex */ - - -void __PHYSFS_platformReleaseMutex(void *mutex) -{ - LeaveCriticalSection((LPCRITICAL_SECTION) mutex); -} /* __PHYSFS_platformReleaseMutex */ - - -static PHYSFS_sint64 FileTimeToPhysfsTime(const FILETIME *ft) -{ - SYSTEMTIME st_utc; - SYSTEMTIME st_localtz; - TIME_ZONE_INFORMATION tzi; - DWORD tzid; - PHYSFS_sint64 retval; - struct tm tm; - BOOL rc; - - BAIL_IF(!FileTimeToSystemTime(ft, &st_utc), errcodeFromWinApi(), -1); - tzid = GetTimeZoneInformation(&tzi); - BAIL_IF(tzid == TIME_ZONE_ID_INVALID, errcodeFromWinApi(), -1); - rc = SystemTimeToTzSpecificLocalTime(&tzi, &st_utc, &st_localtz); - BAIL_IF(!rc, errcodeFromWinApi(), -1); - - /* Convert to a format that mktime() can grok... */ - tm.tm_sec = st_localtz.wSecond; - tm.tm_min = st_localtz.wMinute; - tm.tm_hour = st_localtz.wHour; - tm.tm_mday = st_localtz.wDay; - tm.tm_mon = st_localtz.wMonth - 1; - tm.tm_year = st_localtz.wYear - 1900; - tm.tm_wday = -1 /*st_localtz.wDayOfWeek*/; - tm.tm_yday = -1; - tm.tm_isdst = -1; - - /* Convert to a format PhysicsFS can grok... */ - retval = (PHYSFS_sint64) mktime(&tm); - BAIL_IF(retval == -1, PHYSFS_ERR_OS_ERROR, -1); - return retval; -} /* FileTimeToPhysfsTime */ - - -/* check for symlinks. These exist in NTFS 3.1 (WinXP), even though - they aren't really available to userspace before Vista. I wonder - what would happen if you put an NTFS disk with a symlink on it - into an XP machine, though; would this flag get set? - NTFS symlinks are a form of "reparse point" (junction, volume mount, - etc), so if the REPARSE_POINT attribute is set, check for the symlink - tag thereafter. This assumes you already read in the file attributes. */ -static int isSymlink(const WCHAR *wpath, const DWORD attr) -{ - WIN32_FIND_DATAW w32dw; - HANDLE h; - - if ((attr & PHYSFS_FILE_ATTRIBUTE_REPARSE_POINT) == 0) - return 0; /* not a reparse point? Definitely not a symlink. */ - - h = winFindFirstFileW(wpath, &w32dw); - if (h == INVALID_HANDLE_VALUE) - return 0; /* ...maybe the file just vanished...? */ - - FindClose(h); - return (w32dw.dwReserved0 == PHYSFS_IO_REPARSE_TAG_SYMLINK); -} /* isSymlink */ - - -int __PHYSFS_platformStat(const char *filename, PHYSFS_Stat *st, const int follow) -{ - WIN32_FILE_ATTRIBUTE_DATA winstat; - WCHAR *wstr = NULL; - DWORD err = 0; - BOOL rc = 0; - int issymlink = 0; - - UTF8_TO_UNICODE_STACK(wstr, filename); - BAIL_IF(!wstr, PHYSFS_ERR_OUT_OF_MEMORY, 0); - rc = GetFileAttributesExW(wstr, GetFileExInfoStandard, &winstat); - - if (!rc) - err = GetLastError(); - else /* check for symlink while wstr is still available */ - issymlink = !follow && isSymlink(wstr, winstat.dwFileAttributes); - - __PHYSFS_smallFree(wstr); - BAIL_IF(!rc, errcodeFromWinApiError(err), 0); - - st->modtime = FileTimeToPhysfsTime(&winstat.ftLastWriteTime); - st->accesstime = FileTimeToPhysfsTime(&winstat.ftLastAccessTime); - st->createtime = FileTimeToPhysfsTime(&winstat.ftCreationTime); - - if (issymlink) - { - st->filetype = PHYSFS_FILETYPE_SYMLINK; - st->filesize = 0; - } /* if */ - - else if (winstat.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - { - st->filetype = PHYSFS_FILETYPE_DIRECTORY; - st->filesize = 0; - } /* else if */ - - else if (winstat.dwFileAttributes & (FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_DEVICE)) - { - st->filetype = PHYSFS_FILETYPE_OTHER; - st->filesize = (((PHYSFS_uint64) winstat.nFileSizeHigh) << 32) | winstat.nFileSizeLow; - } /* else if */ - - else - { - st->filetype = PHYSFS_FILETYPE_REGULAR; - st->filesize = (((PHYSFS_uint64) winstat.nFileSizeHigh) << 32) | winstat.nFileSizeLow; - } /* else */ - - st->readonly = ((winstat.dwFileAttributes & FILE_ATTRIBUTE_READONLY) != 0); - - return 1; -} /* __PHYSFS_platformStat */ - -#endif /* PHYSFS_PLATFORM_WINDOWS */ - -/* end of physfs_platform_windows.c ... */ - - diff --git a/love/src/jni/love/src/libraries/physfs/physfs_platform_winrt.cpp b/love/src/jni/love/src/libraries/physfs/physfs_platform_winrt.cpp deleted file mode 100644 index f50fc9d3..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_platform_winrt.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Windows Runtime (WinRT) support routines for PhysicsFS. - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file originally written by Martin "T-Bone" Ahrnbom, but was mostly - * merged into physfs_platform_windows.c by Ryan C. Gordon (so please harass - * Ryan about bugs and not Martin). - */ - -/* (There used to be instructions on how to make a WinRT project, but at - this point, either CMake will do it for you or you should just drop - PhysicsFS's sources into your existing project. --ryan.) */ - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_platforms.h" - -#ifdef PHYSFS_PLATFORM_WINRT - -#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) -#define _CRT_SECURE_NO_WARNINGS 1 -#endif -#include - -#include "physfs_internal.h" - -const void *__PHYSFS_winrtCalcBaseDir(void) -{ - return Windows::ApplicationModel::Package::Current->InstalledLocation->Path->Data(); -} /* __PHYSFS_winrtCalcBaseDir */ - -const void *__PHYSFS_winrtCalcPrefDir(void) -{ - return Windows::Storage::ApplicationData::Current->LocalFolder->Path->Data(); -} /* __PHYSFS_winrtCalcBaseDir */ - - -#endif /* PHYSFS_PLATFORM_WINRT */ - -/* end of physfs_platform_winrt.cpp ... */ - diff --git a/love/src/jni/love/src/libraries/physfs/physfs_platforms.h b/love/src/jni/love/src/libraries/physfs/physfs_platforms.h deleted file mode 100644 index d4e4bfdc..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_platforms.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef _INCL_PHYSFS_PLATFORMS -#define _INCL_PHYSFS_PLATFORMS - -#ifndef __PHYSICSFS_INTERNAL__ -#error Do not include this header from your applications. -#endif - -/* - * These only define the platforms to determine which files in the platforms - * directory should be compiled. For example, technically BeOS can be called - * a "unix" system, but since it doesn't use unix.c, we don't define - * PHYSFS_PLATFORM_UNIX on that system. - */ - -#if (defined __HAIKU__) -# define PHYSFS_PLATFORM_HAIKU 1 -# define PHYSFS_PLATFORM_POSIX 1 -#elif ((defined __BEOS__) || (defined __beos__)) -# error BeOS support was dropped since PhysicsFS 2.1. Sorry. Try Haiku! -#elif (defined _WIN32_WCE) || (defined _WIN64_WCE) -# error PocketPC support was dropped since PhysicsFS 2.1. Sorry. Try WinRT! -#elif (defined(_MSC_VER) && (_MSC_VER >= 1700) && !_USING_V110_SDK71_) /* _MSC_VER==1700 for MSVC 2012 */ -# include -# define PHYSFS_PLATFORM_WINDOWS 1 -# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) -# define PHYSFS_NO_CDROM_SUPPORT 1 -# define PHYSFS_PLATFORM_WINRT 1 -# endif -#elif (((defined _WIN32) || (defined _WIN64)) && (!defined __CYGWIN__)) -# define PHYSFS_PLATFORM_WINDOWS 1 -#elif defined(__OS2__) || defined(OS2) -# define PHYSFS_PLATFORM_OS2 1 -#elif ((defined __MACH__) && (defined __APPLE__)) -/* To check if iOS or not, we need to include this file */ -# include -# if ((TARGET_IPHONE_SIMULATOR) || (TARGET_OS_IPHONE)) -# define PHYSFS_NO_CDROM_SUPPORT 1 -# endif -# define PHYSFS_PLATFORM_APPLE 1 -# define PHYSFS_PLATFORM_POSIX 1 -#elif defined(macintosh) -# error Classic Mac OS support was dropped from PhysicsFS 2.0. Move to OS X. -#elif defined(ANDROID) -# define PHYSFS_PLATFORM_LINUX 1 -# define PHYSFS_PLATFORM_UNIX 1 -# define PHYSFS_PLATFORM_POSIX 1 -# define PHYSFS_NO_CDROM_SUPPORT 1 -#elif defined(__linux) -# define PHYSFS_PLATFORM_LINUX 1 -# define PHYSFS_PLATFORM_UNIX 1 -# define PHYSFS_PLATFORM_POSIX 1 -#elif defined(__sun) || defined(sun) -# define PHYSFS_PLATFORM_SOLARIS 1 -# define PHYSFS_PLATFORM_UNIX 1 -# define PHYSFS_PLATFORM_POSIX 1 -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) -# define PHYSFS_PLATFORM_FREEBSD 1 -# define PHYSFS_PLATFORM_BSD 1 -# define PHYSFS_PLATFORM_UNIX 1 -# define PHYSFS_PLATFORM_POSIX 1 -#elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) -# define PHYSFS_PLATFORM_BSD 1 -# define PHYSFS_PLATFORM_UNIX 1 -# define PHYSFS_PLATFORM_POSIX 1 -#elif defined(__EMSCRIPTEN__) -# define PHYSFS_NO_CDROM_SUPPORT 1 -# define PHYSFS_PLATFORM_UNIX 1 -# define PHYSFS_PLATFORM_POSIX 1 -#elif defined(__QNX__) -# define PHYSFS_PLATFORM_QNX 1 -# define PHYSFS_PLATFORM_POSIX 1 -#elif defined(unix) || defined(__unix__) -# define PHYSFS_PLATFORM_UNIX 1 -# define PHYSFS_PLATFORM_POSIX 1 -#else -# error Unknown platform. -#endif - -#endif /* include-once blocker. */ - diff --git a/love/src/jni/love/src/libraries/physfs/physfs_unicode.c b/love/src/jni/love/src/libraries/physfs/physfs_unicode.c deleted file mode 100644 index 0e006022..00000000 --- a/love/src/jni/love/src/libraries/physfs/physfs_unicode.c +++ /dev/null @@ -1,567 +0,0 @@ -#define __PHYSICSFS_INTERNAL__ -#include "physfs_internal.h" - -#include "physfs_casefolding.h" - - -/* - * From rfc3629, the UTF-8 spec: - * https://www.ietf.org/rfc/rfc3629.txt - * - * Char. number range | UTF-8 octet sequence - * (hexadecimal) | (binary) - * --------------------+--------------------------------------------- - * 0000 0000-0000 007F | 0xxxxxxx - * 0000 0080-0000 07FF | 110xxxxx 10xxxxxx - * 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx - * 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - */ - - -/* - * This may not be the best value, but it's one that isn't represented - * in Unicode (0x10FFFF is the largest codepoint value). We return this - * value from utf8codepoint() if there's bogus bits in the - * stream. utf8codepoint() will turn this value into something - * reasonable (like a question mark), for text that wants to try to recover, - * whereas utf8valid() will use the value to determine if a string has bad - * bits. - */ -#define UNICODE_BOGUS_CHAR_VALUE 0xFFFFFFFF - -/* - * This is the codepoint we currently return when there was bogus bits in a - * UTF-8 string. May not fly in Asian locales? - */ -#define UNICODE_BOGUS_CHAR_CODEPOINT '?' - -static PHYSFS_uint32 utf8codepoint(const char **_str) -{ - const char *str = *_str; - PHYSFS_uint32 retval = 0; - PHYSFS_uint32 octet = (PHYSFS_uint32) ((PHYSFS_uint8) *str); - PHYSFS_uint32 octet2, octet3, octet4; - - if (octet == 0) /* null terminator, end of string. */ - return 0; - - else if (octet < 128) /* one octet char: 0 to 127 */ - { - (*_str)++; /* skip to next possible start of codepoint. */ - return octet; - } /* else if */ - - else if ((octet > 127) && (octet < 192)) /* bad (starts with 10xxxxxx). */ - { - /* - * Apparently each of these is supposed to be flagged as a bogus - * char, instead of just resyncing to the next valid codepoint. - */ - (*_str)++; /* skip to next possible start of codepoint. */ - return UNICODE_BOGUS_CHAR_VALUE; - } /* else if */ - - else if (octet < 224) /* two octets */ - { - (*_str)++; /* advance at least one byte in case of an error */ - octet -= (128+64); - octet2 = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str)); - if ((octet2 & (128+64)) != 128) /* Format isn't 10xxxxxx? */ - return UNICODE_BOGUS_CHAR_VALUE; - - *_str += 1; /* skip to next possible start of codepoint. */ - retval = ((octet << 6) | (octet2 - 128)); - if ((retval >= 0x80) && (retval <= 0x7FF)) - return retval; - } /* else if */ - - else if (octet < 240) /* three octets */ - { - (*_str)++; /* advance at least one byte in case of an error */ - octet -= (128+64+32); - octet2 = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str)); - if ((octet2 & (128+64)) != 128) /* Format isn't 10xxxxxx? */ - return UNICODE_BOGUS_CHAR_VALUE; - - octet3 = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str)); - if ((octet3 & (128+64)) != 128) /* Format isn't 10xxxxxx? */ - return UNICODE_BOGUS_CHAR_VALUE; - - *_str += 2; /* skip to next possible start of codepoint. */ - retval = ( ((octet << 12)) | ((octet2-128) << 6) | ((octet3-128)) ); - - /* There are seven "UTF-16 surrogates" that are illegal in UTF-8. */ - switch (retval) - { - case 0xD800: - case 0xDB7F: - case 0xDB80: - case 0xDBFF: - case 0xDC00: - case 0xDF80: - case 0xDFFF: - return UNICODE_BOGUS_CHAR_VALUE; - } /* switch */ - - /* 0xFFFE and 0xFFFF are illegal, too, so we check them at the edge. */ - if ((retval >= 0x800) && (retval <= 0xFFFD)) - return retval; - } /* else if */ - - else if (octet < 248) /* four octets */ - { - (*_str)++; /* advance at least one byte in case of an error */ - octet -= (128+64+32+16); - octet2 = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str)); - if ((octet2 & (128+64)) != 128) /* Format isn't 10xxxxxx? */ - return UNICODE_BOGUS_CHAR_VALUE; - - octet3 = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str)); - if ((octet3 & (128+64)) != 128) /* Format isn't 10xxxxxx? */ - return UNICODE_BOGUS_CHAR_VALUE; - - octet4 = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str)); - if ((octet4 & (128+64)) != 128) /* Format isn't 10xxxxxx? */ - return UNICODE_BOGUS_CHAR_VALUE; - - *_str += 3; /* skip to next possible start of codepoint. */ - retval = ( ((octet << 18)) | ((octet2 - 128) << 12) | - ((octet3 - 128) << 6) | ((octet4 - 128)) ); - if ((retval >= 0x10000) && (retval <= 0x10FFFF)) - return retval; - } /* else if */ - - /* - * Five and six octet sequences became illegal in rfc3629. - * We throw the codepoint away, but parse them to make sure we move - * ahead the right number of bytes and don't overflow the buffer. - */ - - else if (octet < 252) /* five octets */ - { - (*_str)++; /* advance at least one byte in case of an error */ - octet = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str)); - if ((octet & (128+64)) != 128) /* Format isn't 10xxxxxx? */ - return UNICODE_BOGUS_CHAR_VALUE; - - octet = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str)); - if ((octet & (128+64)) != 128) /* Format isn't 10xxxxxx? */ - return UNICODE_BOGUS_CHAR_VALUE; - - octet = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str)); - if ((octet & (128+64)) != 128) /* Format isn't 10xxxxxx? */ - return UNICODE_BOGUS_CHAR_VALUE; - - octet = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str)); - if ((octet & (128+64)) != 128) /* Format isn't 10xxxxxx? */ - return UNICODE_BOGUS_CHAR_VALUE; - - *_str += 4; /* skip to next possible start of codepoint. */ - return UNICODE_BOGUS_CHAR_VALUE; - } /* else if */ - - else /* six octets */ - { - (*_str)++; /* advance at least one byte in case of an error */ - octet = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str)); - if ((octet & (128+64)) != 128) /* Format isn't 10xxxxxx? */ - return UNICODE_BOGUS_CHAR_VALUE; - - octet = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str)); - if ((octet & (128+64)) != 128) /* Format isn't 10xxxxxx? */ - return UNICODE_BOGUS_CHAR_VALUE; - - octet = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str)); - if ((octet & (128+64)) != 128) /* Format isn't 10xxxxxx? */ - return UNICODE_BOGUS_CHAR_VALUE; - - octet = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str)); - if ((octet & (128+64)) != 128) /* Format isn't 10xxxxxx? */ - return UNICODE_BOGUS_CHAR_VALUE; - - octet = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str)); - if ((octet & (128+64)) != 128) /* Format isn't 10xxxxxx? */ - return UNICODE_BOGUS_CHAR_VALUE; - - *_str += 6; /* skip to next possible start of codepoint. */ - return UNICODE_BOGUS_CHAR_VALUE; - } /* else if */ - - return UNICODE_BOGUS_CHAR_VALUE; -} /* utf8codepoint */ - -static PHYSFS_uint32 utf16codepoint(const PHYSFS_uint16 **_str) -{ - const PHYSFS_uint16 *src = *_str; - PHYSFS_uint32 cp = (PHYSFS_uint32) *(src++); - - if (cp == 0) /* null terminator, end of string. */ - return 0; - /* Orphaned second half of surrogate pair? */ - else if ((cp >= 0xDC00) && (cp <= 0xDFFF)) - cp = UNICODE_BOGUS_CHAR_CODEPOINT; - else if ((cp >= 0xD800) && (cp <= 0xDBFF)) /* start surrogate pair! */ - { - const PHYSFS_uint32 pair = (PHYSFS_uint32) *src; - if (pair == 0) - cp = UNICODE_BOGUS_CHAR_CODEPOINT; - else if ((pair < 0xDC00) || (pair > 0xDFFF)) - cp = UNICODE_BOGUS_CHAR_CODEPOINT; - else - { - src++; /* eat the other surrogate. */ - cp = (((cp - 0xD800) << 10) | (pair - 0xDC00)); - } /* else */ - } /* else if */ - - *_str = src; - return cp; -} /* utf16codepoint */ - -static PHYSFS_uint32 utf32codepoint(const PHYSFS_uint32 **_str) -{ - const PHYSFS_uint32 *src = *_str; - PHYSFS_uint32 cp = *(src++); - - if (cp == 0) /* null terminator, end of string. */ - return 0; - else if (cp > 0x10FFF) - cp = UNICODE_BOGUS_CHAR_CODEPOINT; - - *_str = src; - return cp; -} /* utf32codepoint */ - - -void PHYSFS_utf8ToUcs4(const char *src, PHYSFS_uint32 *dst, PHYSFS_uint64 len) -{ - len -= sizeof (PHYSFS_uint32); /* save room for null char. */ - while (len >= sizeof (PHYSFS_uint32)) - { - PHYSFS_uint32 cp = utf8codepoint(&src); - if (cp == 0) - break; - else if (cp == UNICODE_BOGUS_CHAR_VALUE) - cp = UNICODE_BOGUS_CHAR_CODEPOINT; - *(dst++) = cp; - len -= sizeof (PHYSFS_uint32); - } /* while */ - - *dst = 0; -} /* PHYSFS_utf8ToUcs4 */ - - -void PHYSFS_utf8ToUcs2(const char *src, PHYSFS_uint16 *dst, PHYSFS_uint64 len) -{ - len -= sizeof (PHYSFS_uint16); /* save room for null char. */ - while (len >= sizeof (PHYSFS_uint16)) - { - PHYSFS_uint32 cp = utf8codepoint(&src); - if (cp == 0) - break; - else if (cp == UNICODE_BOGUS_CHAR_VALUE) - cp = UNICODE_BOGUS_CHAR_CODEPOINT; - - if (cp > 0xFFFF) /* UTF-16 surrogates (bogus chars in UCS-2) */ - cp = UNICODE_BOGUS_CHAR_CODEPOINT; - - *(dst++) = cp; - len -= sizeof (PHYSFS_uint16); - } /* while */ - - *dst = 0; -} /* PHYSFS_utf8ToUcs2 */ - - -void PHYSFS_utf8ToUtf16(const char *src, PHYSFS_uint16 *dst, PHYSFS_uint64 len) -{ - len -= sizeof (PHYSFS_uint16); /* save room for null char. */ - while (len >= sizeof (PHYSFS_uint16)) - { - PHYSFS_uint32 cp = utf8codepoint(&src); - if (cp == 0) - break; - else if (cp == UNICODE_BOGUS_CHAR_VALUE) - cp = UNICODE_BOGUS_CHAR_CODEPOINT; - - if (cp > 0xFFFF) /* encode as surrogate pair */ - { - if (len < (sizeof (PHYSFS_uint16) * 2)) - break; /* not enough room for the pair, stop now. */ - - cp -= 0x10000; /* Make this a 20-bit value */ - - *(dst++) = 0xD800 + ((cp >> 10) & 0x3FF); - len -= sizeof (PHYSFS_uint16); - - cp = 0xDC00 + (cp & 0x3FF); - } /* if */ - - *(dst++) = cp; - len -= sizeof (PHYSFS_uint16); - } /* while */ - - *dst = 0; -} /* PHYSFS_utf8ToUtf16 */ - -static void utf8fromcodepoint(PHYSFS_uint32 cp, char **_dst, PHYSFS_uint64 *_len) -{ - char *dst = *_dst; - PHYSFS_uint64 len = *_len; - - if (len == 0) - return; - - if (cp > 0x10FFFF) - cp = UNICODE_BOGUS_CHAR_CODEPOINT; - else if ((cp == 0xFFFE) || (cp == 0xFFFF)) /* illegal values. */ - cp = UNICODE_BOGUS_CHAR_CODEPOINT; - else - { - /* There are seven "UTF-16 surrogates" that are illegal in UTF-8. */ - switch (cp) - { - case 0xD800: - case 0xDB7F: - case 0xDB80: - case 0xDBFF: - case 0xDC00: - case 0xDF80: - case 0xDFFF: - cp = UNICODE_BOGUS_CHAR_CODEPOINT; - } /* switch */ - } /* else */ - - /* Do the encoding... */ - if (cp < 0x80) - { - *(dst++) = (char) cp; - len--; - } /* if */ - - else if (cp < 0x800) - { - if (len < 2) - len = 0; - else - { - *(dst++) = (char) ((cp >> 6) | 128 | 64); - *(dst++) = (char) (cp & 0x3F) | 128; - len -= 2; - } /* else */ - } /* else if */ - - else if (cp < 0x10000) - { - if (len < 3) - len = 0; - else - { - *(dst++) = (char) ((cp >> 12) | 128 | 64 | 32); - *(dst++) = (char) ((cp >> 6) & 0x3F) | 128; - *(dst++) = (char) (cp & 0x3F) | 128; - len -= 3; - } /* else */ - } /* else if */ - - else - { - if (len < 4) - len = 0; - else - { - *(dst++) = (char) ((cp >> 18) | 128 | 64 | 32 | 16); - *(dst++) = (char) ((cp >> 12) & 0x3F) | 128; - *(dst++) = (char) ((cp >> 6) & 0x3F) | 128; - *(dst++) = (char) (cp & 0x3F) | 128; - len -= 4; - } /* else if */ - } /* else */ - - *_dst = dst; - *_len = len; -} /* utf8fromcodepoint */ - -#define UTF8FROMTYPE(typ, src, dst, len) \ - if (len == 0) return; \ - len--; \ - while (len) \ - { \ - const PHYSFS_uint32 cp = (PHYSFS_uint32) ((typ) (*(src++))); \ - if (cp == 0) break; \ - utf8fromcodepoint(cp, &dst, &len); \ - } \ - *dst = '\0'; \ - -void PHYSFS_utf8FromUcs4(const PHYSFS_uint32 *src, char *dst, PHYSFS_uint64 len) -{ - UTF8FROMTYPE(PHYSFS_uint32, src, dst, len); -} /* PHYSFS_utf8FromUcs4 */ - -void PHYSFS_utf8FromUcs2(const PHYSFS_uint16 *src, char *dst, PHYSFS_uint64 len) -{ - UTF8FROMTYPE(PHYSFS_uint64, src, dst, len); -} /* PHYSFS_utf8FromUcs2 */ - -/* latin1 maps to unicode codepoints directly, we just utf-8 encode it. */ -void PHYSFS_utf8FromLatin1(const char *src, char *dst, PHYSFS_uint64 len) -{ - UTF8FROMTYPE(PHYSFS_uint8, src, dst, len); -} /* PHYSFS_utf8FromLatin1 */ - -#undef UTF8FROMTYPE - - -void PHYSFS_utf8FromUtf16(const PHYSFS_uint16 *src, char *dst, PHYSFS_uint64 len) -{ - if (len == 0) - return; - - len--; - while (len) - { - const PHYSFS_uint32 cp = utf16codepoint(&src); - if (!cp) - break; - utf8fromcodepoint(cp, &dst, &len); - } /* while */ - - *dst = '\0'; -} /* PHYSFS_utf8FromUtf16 */ - - -int PHYSFS_caseFold(const PHYSFS_uint32 from, PHYSFS_uint32 *to) -{ - int i; - - if (from < 128) /* low-ASCII, easy! */ - { - if ((from >= 'A') && (from <= 'Z')) - *to = from - ('A' - 'a'); - else - *to = from; - return 1; - } /* if */ - - else if (from <= 0xFFFF) - { - const PHYSFS_uint8 hash = ((from ^ (from >> 8)) & 0xFF); - const PHYSFS_uint16 from16 = (PHYSFS_uint16) from; - - { - const CaseFoldHashBucket1_16 *bucket = &case_fold_hash1_16[hash]; - const int count = (int) bucket->count; - for (i = 0; i < count; i++) - { - const CaseFoldMapping1_16 *mapping = &bucket->list[i]; - if (mapping->from == from16) - { - *to = mapping->to0; - return 1; - } /* if */ - } /* for */ - } - - { - const CaseFoldHashBucket2_16 *bucket = &case_fold_hash2_16[hash & 15]; - const int count = (int) bucket->count; - for (i = 0; i < count; i++) - { - const CaseFoldMapping2_16 *mapping = &bucket->list[i]; - if (mapping->from == from16) - { - to[0] = mapping->to0; - to[1] = mapping->to1; - return 2; - } /* if */ - } /* for */ - } - - { - const CaseFoldHashBucket3_16 *bucket = &case_fold_hash3_16[hash & 3]; - const int count = (int) bucket->count; - for (i = 0; i < count; i++) - { - const CaseFoldMapping3_16 *mapping = &bucket->list[i]; - if (mapping->from == from16) - { - to[0] = mapping->to0; - to[1] = mapping->to1; - to[2] = mapping->to2; - return 3; - } /* if */ - } /* for */ - } - } /* else if */ - - else /* codepoint that doesn't fit in 16 bits. */ - { - const PHYSFS_uint8 hash = ((from ^ (from >> 8)) & 0xFF); - const CaseFoldHashBucket1_32 *bucket = &case_fold_hash1_32[hash & 15]; - const int count = (int) bucket->count; - for (i = 0; i < count; i++) - { - const CaseFoldMapping1_32 *mapping = &bucket->list[i]; - if (mapping->from == from) - { - *to = mapping->to0; - return 1; - } /* if */ - } /* for */ - } /* else */ - - - /* Not found...there's no remapping for this codepoint. */ - *to = from; - return 1; -} /* PHYSFS_caseFold */ - - -#define UTFSTRICMP(bits) \ - PHYSFS_uint32 folded1[3], folded2[3]; \ - int head1 = 0, tail1 = 0, head2 = 0, tail2 = 0; \ - while (1) { \ - PHYSFS_uint32 cp1, cp2; \ - if (head1 != tail1) { \ - cp1 = folded1[tail1++]; \ - } else { \ - head1 = PHYSFS_caseFold(utf##bits##codepoint(&str1), folded1); \ - cp1 = folded1[0]; \ - tail1 = 1; \ - } \ - if (head2 != tail2) { \ - cp2 = folded2[tail2++]; \ - } else { \ - head2 = PHYSFS_caseFold(utf##bits##codepoint(&str2), folded2); \ - cp2 = folded2[0]; \ - tail2 = 1; \ - } \ - if (cp1 < cp2) { \ - return -1; \ - } else if (cp1 > cp2) { \ - return 1; \ - } else if (cp1 == 0) { \ - break; /* complete match. */ \ - } \ - } \ - return 0 - -int PHYSFS_utf8stricmp(const char *str1, const char *str2) -{ - UTFSTRICMP(8); -} /* PHYSFS_utf8stricmp */ - -int PHYSFS_utf16stricmp(const PHYSFS_uint16 *str1, const PHYSFS_uint16 *str2) -{ - UTFSTRICMP(16); -} /* PHYSFS_utf16stricmp */ - -int PHYSFS_ucs4stricmp(const PHYSFS_uint32 *str1, const PHYSFS_uint32 *str2) -{ - UTFSTRICMP(32); -} /* PHYSFS_ucs4stricmp */ - -#undef UTFSTRICMP - -/* end of physfs_unicode.c ... */ - diff --git a/love/src/jni/love/src/libraries/stb/stb_image.h b/love/src/jni/love/src/libraries/stb/stb_image.h deleted file mode 100644 index a056138d..00000000 --- a/love/src/jni/love/src/libraries/stb/stb_image.h +++ /dev/null @@ -1,7187 +0,0 @@ -/* stb_image - v2.16 - public domain image loader - http://nothings.org/stb_image.h - no warranty implied; use at your own risk - - Do this: - #define STB_IMAGE_IMPLEMENTATION - before you include this file in *one* C or C++ file to create the implementation. - - // i.e. it should look like this: - #include ... - #include ... - #include ... - #define STB_IMAGE_IMPLEMENTATION - #include "stb_image.h" - - You can #define STBI_ASSERT(x) before the #include to avoid using assert.h. - And #define STBI_MALLOC, STBI_REALLOC, and STBI_FREE to avoid using malloc,realloc,free - - - QUICK NOTES: - Primarily of interest to game developers and other people who can - avoid problematic images and only need the trivial interface - - JPEG baseline & progressive (12 bpc/arithmetic not supported, same as stock IJG lib) - PNG 1/2/4/8/16-bit-per-channel - - TGA (not sure what subset, if a subset) - BMP non-1bpp, non-RLE - PSD (composited view only, no extra channels, 8/16 bit-per-channel) - - GIF (*comp always reports as 4-channel) - HDR (radiance rgbE format) - PIC (Softimage PIC) - PNM (PPM and PGM binary only) - - Animated GIF still needs a proper API, but here's one way to do it: - http://gist.github.com/urraka/685d9a6340b26b830d49 - - - decode from memory or through FILE (define STBI_NO_STDIO to remove code) - - decode from arbitrary I/O callbacks - - SIMD acceleration on x86/x64 (SSE2) and ARM (NEON) - - Full documentation under "DOCUMENTATION" below. - - -LICENSE - - See end of file for license information. - -RECENT REVISION HISTORY: - - 2.16 (2017-07-23) all functions have 16-bit variants; optimizations; bugfixes - 2.15 (2017-03-18) fix png-1,2,4; all Imagenet JPGs; no runtime SSE detection on GCC - 2.14 (2017-03-03) remove deprecated STBI_JPEG_OLD; fixes for Imagenet JPGs - 2.13 (2016-12-04) experimental 16-bit API, only for PNG so far; fixes - 2.12 (2016-04-02) fix typo in 2.11 PSD fix that caused crashes - 2.11 (2016-04-02) 16-bit PNGS; enable SSE2 in non-gcc x64 - RGB-format JPEG; remove white matting in PSD; - allocate large structures on the stack; - correct channel count for PNG & BMP - 2.10 (2016-01-22) avoid warning introduced in 2.09 - 2.09 (2016-01-16) 16-bit TGA; comments in PNM files; STBI_REALLOC_SIZED - - See end of file for full revision history. - - - ============================ Contributors ========================= - - Image formats Extensions, features - Sean Barrett (jpeg, png, bmp) Jetro Lauha (stbi_info) - Nicolas Schulz (hdr, psd) Martin "SpartanJ" Golini (stbi_info) - Jonathan Dummer (tga) James "moose2000" Brown (iPhone PNG) - Jean-Marc Lienher (gif) Ben "Disch" Wenger (io callbacks) - Tom Seddon (pic) Omar Cornut (1/2/4-bit PNG) - Thatcher Ulrich (psd) Nicolas Guillemot (vertical flip) - Ken Miller (pgm, ppm) Richard Mitton (16-bit PSD) - github:urraka (animated gif) Junggon Kim (PNM comments) - Daniel Gibson (16-bit TGA) - socks-the-fox (16-bit PNG) - Jeremy Sawicki (handle all ImageNet JPGs) - Optimizations & bugfixes - Fabian "ryg" Giesen - Arseny Kapoulkine - John-Mark Allen - - Bug & warning fixes - Marc LeBlanc David Woo Guillaume George Martins Mozeiko - Christpher Lloyd Jerry Jansson Joseph Thomson Phil Jordan - Dave Moore Roy Eltham Hayaki Saito Nathan Reed - Won Chun Luke Graham Johan Duparc Nick Verigakis - the Horde3D community Thomas Ruf Ronny Chevalier Baldur Karlsson - Janez Zemva John Bartholomew Michal Cichon github:rlyeh - Jonathan Blow Ken Hamada Tero Hanninen github:romigrou - Laurent Gomila Cort Stratton Sergio Gonzalez github:svdijk - Aruelien Pocheville Thibault Reuille Cass Everitt github:snagar - Ryamond Barbiero Paul Du Bois Engin Manap github:Zelex - Michaelangel007@github Philipp Wiesemann Dale Weiler github:grim210 - Oriol Ferrer Mesia Josh Tobin Matthew Gregan github:sammyhw - Blazej Dariusz Roszkowski Gregory Mullen github:phprus - Christian Floisand Kevin Schmidt github:poppolopoppo -*/ - -#ifndef STBI_INCLUDE_STB_IMAGE_H -#define STBI_INCLUDE_STB_IMAGE_H - -// DOCUMENTATION -// -// Limitations: -// - no 16-bit-per-channel PNG -// - no 12-bit-per-channel JPEG -// - no JPEGs with arithmetic coding -// - no 1-bit BMP -// - GIF always returns *comp=4 -// -// Basic usage (see HDR discussion below for HDR usage): -// int x,y,n; -// unsigned char *data = stbi_load(filename, &x, &y, &n, 0); -// // ... process data if not NULL ... -// // ... x = width, y = height, n = # 8-bit components per pixel ... -// // ... replace '0' with '1'..'4' to force that many components per pixel -// // ... but 'n' will always be the number that it would have been if you said 0 -// stbi_image_free(data) -// -// Standard parameters: -// int *x -- outputs image width in pixels -// int *y -- outputs image height in pixels -// int *channels_in_file -- outputs # of image components in image file -// int desired_channels -- if non-zero, # of image components requested in result -// -// The return value from an image loader is an 'unsigned char *' which points -// to the pixel data, or NULL on an allocation failure or if the image is -// corrupt or invalid. The pixel data consists of *y scanlines of *x pixels, -// with each pixel consisting of N interleaved 8-bit components; the first -// pixel pointed to is top-left-most in the image. There is no padding between -// image scanlines or between pixels, regardless of format. The number of -// components N is 'desired_channels' if desired_channels is non-zero, or -// *channels_in_file otherwise. If desired_channels is non-zero, -// *channels_in_file has the number of components that _would_ have been -// output otherwise. E.g. if you set desired_channels to 4, you will always -// get RGBA output, but you can check *channels_in_file to see if it's trivially -// opaque because e.g. there were only 3 channels in the source image. -// -// An output image with N components has the following components interleaved -// in this order in each pixel: -// -// N=#comp components -// 1 grey -// 2 grey, alpha -// 3 red, green, blue -// 4 red, green, blue, alpha -// -// If image loading fails for any reason, the return value will be NULL, -// and *x, *y, *channels_in_file will be unchanged. The function -// stbi_failure_reason() can be queried for an extremely brief, end-user -// unfriendly explanation of why the load failed. Define STBI_NO_FAILURE_STRINGS -// to avoid compiling these strings at all, and STBI_FAILURE_USERMSG to get slightly -// more user-friendly ones. -// -// Paletted PNG, BMP, GIF, and PIC images are automatically depalettized. -// -// =========================================================================== -// -// Philosophy -// -// stb libraries are designed with the following priorities: -// -// 1. easy to use -// 2. easy to maintain -// 3. good performance -// -// Sometimes I let "good performance" creep up in priority over "easy to maintain", -// and for best performance I may provide less-easy-to-use APIs that give higher -// performance, in addition to the easy to use ones. Nevertheless, it's important -// to keep in mind that from the standpoint of you, a client of this library, -// all you care about is #1 and #3, and stb libraries DO NOT emphasize #3 above all. -// -// Some secondary priorities arise directly from the first two, some of which -// make more explicit reasons why performance can't be emphasized. -// -// - Portable ("ease of use") -// - Small source code footprint ("easy to maintain") -// - No dependencies ("ease of use") -// -// =========================================================================== -// -// I/O callbacks -// -// I/O callbacks allow you to read from arbitrary sources, like packaged -// files or some other source. Data read from callbacks are processed -// through a small internal buffer (currently 128 bytes) to try to reduce -// overhead. -// -// The three functions you must define are "read" (reads some bytes of data), -// "skip" (skips some bytes of data), "eof" (reports if the stream is at the end). -// -// =========================================================================== -// -// SIMD support -// -// The JPEG decoder will try to automatically use SIMD kernels on x86 when -// supported by the compiler. For ARM Neon support, you must explicitly -// request it. -// -// (The old do-it-yourself SIMD API is no longer supported in the current -// code.) -// -// On x86, SSE2 will automatically be used when available based on a run-time -// test; if not, the generic C versions are used as a fall-back. On ARM targets, -// the typical path is to have separate builds for NEON and non-NEON devices -// (at least this is true for iOS and Android). Therefore, the NEON support is -// toggled by a build flag: define STBI_NEON to get NEON loops. -// -// If for some reason you do not want to use any of SIMD code, or if -// you have issues compiling it, you can disable it entirely by -// defining STBI_NO_SIMD. -// -// =========================================================================== -// -// HDR image support (disable by defining STBI_NO_HDR) -// -// stb_image now supports loading HDR images in general, and currently -// the Radiance .HDR file format, although the support is provided -// generically. You can still load any file through the existing interface; -// if you attempt to load an HDR file, it will be automatically remapped to -// LDR, assuming gamma 2.2 and an arbitrary scale factor defaulting to 1; -// both of these constants can be reconfigured through this interface: -// -// stbi_hdr_to_ldr_gamma(2.2f); -// stbi_hdr_to_ldr_scale(1.0f); -// -// (note, do not use _inverse_ constants; stbi_image will invert them -// appropriately). -// -// Additionally, there is a new, parallel interface for loading files as -// (linear) floats to preserve the full dynamic range: -// -// float *data = stbi_loadf(filename, &x, &y, &n, 0); -// -// If you load LDR images through this interface, those images will -// be promoted to floating point values, run through the inverse of -// constants corresponding to the above: -// -// stbi_ldr_to_hdr_scale(1.0f); -// stbi_ldr_to_hdr_gamma(2.2f); -// -// Finally, given a filename (or an open file or memory block--see header -// file for details) containing image data, you can query for the "most -// appropriate" interface to use (that is, whether the image is HDR or -// not), using: -// -// stbi_is_hdr(char *filename); -// -// =========================================================================== -// -// iPhone PNG support: -// -// By default we convert iphone-formatted PNGs back to RGB, even though -// they are internally encoded differently. You can disable this conversion -// by by calling stbi_convert_iphone_png_to_rgb(0), in which case -// you will always just get the native iphone "format" through (which -// is BGR stored in RGB). -// -// Call stbi_set_unpremultiply_on_load(1) as well to force a divide per -// pixel to remove any premultiplied alpha *only* if the image file explicitly -// says there's premultiplied data (currently only happens in iPhone images, -// and only if iPhone convert-to-rgb processing is on). -// -// =========================================================================== -// -// ADDITIONAL CONFIGURATION -// -// - You can suppress implementation of any of the decoders to reduce -// your code footprint by #defining one or more of the following -// symbols before creating the implementation. -// -// STBI_NO_JPEG -// STBI_NO_PNG -// STBI_NO_BMP -// STBI_NO_PSD -// STBI_NO_TGA -// STBI_NO_GIF -// STBI_NO_HDR -// STBI_NO_PIC -// STBI_NO_PNM (.ppm and .pgm) -// -// - You can request *only* certain decoders and suppress all other ones -// (this will be more forward-compatible, as addition of new decoders -// doesn't require you to disable them explicitly): -// -// STBI_ONLY_JPEG -// STBI_ONLY_PNG -// STBI_ONLY_BMP -// STBI_ONLY_PSD -// STBI_ONLY_TGA -// STBI_ONLY_GIF -// STBI_ONLY_HDR -// STBI_ONLY_PIC -// STBI_ONLY_PNM (.ppm and .pgm) -// -// - If you use STBI_NO_PNG (or _ONLY_ without PNG), and you still -// want the zlib decoder to be available, #define STBI_SUPPORT_ZLIB -// - - -#ifndef STBI_NO_STDIO -#include -#endif // STBI_NO_STDIO - -#define STBI_VERSION 1 - -enum -{ - STBI_default = 0, // only used for desired_channels - - STBI_grey = 1, - STBI_grey_alpha = 2, - STBI_rgb = 3, - STBI_rgb_alpha = 4 -}; - -typedef unsigned char stbi_uc; -typedef unsigned short stbi_us; - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef STB_IMAGE_STATIC -#define STBIDEF static -#else -#define STBIDEF extern -#endif - -////////////////////////////////////////////////////////////////////////////// -// -// PRIMARY API - works on images of any type -// - -// -// load image by filename, open file, or memory buffer -// - -typedef struct -{ - int (*read) (void *user,char *data,int size); // fill 'data' with 'size' bytes. return number of bytes actually read - void (*skip) (void *user,int n); // skip the next 'n' bytes, or 'unget' the last -n bytes if negative - int (*eof) (void *user); // returns nonzero if we are at end of file/data -} stbi_io_callbacks; - -//////////////////////////////////// -// -// 8-bits-per-channel interface -// - -STBIDEF stbi_uc *stbi_load_from_memory (stbi_uc const *buffer, int len , int *x, int *y, int *channels_in_file, int desired_channels); -STBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk , void *user, int *x, int *y, int *channels_in_file, int desired_channels); - -#ifndef STBI_NO_STDIO -STBIDEF stbi_uc *stbi_load (char const *filename, int *x, int *y, int *channels_in_file, int desired_channels); -STBIDEF stbi_uc *stbi_load_from_file (FILE *f, int *x, int *y, int *channels_in_file, int desired_channels); -// for stbi_load_from_file, file pointer is left pointing immediately after image -#endif - -//////////////////////////////////// -// -// 16-bits-per-channel interface -// - -STBIDEF stbi_us *stbi_load_16_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *channels_in_file, int desired_channels); -STBIDEF stbi_us *stbi_load_16_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *channels_in_file, int desired_channels); - -#ifndef STBI_NO_STDIO -STBIDEF stbi_us *stbi_load_16 (char const *filename, int *x, int *y, int *channels_in_file, int desired_channels); -STBIDEF stbi_us *stbi_load_from_file_16(FILE *f, int *x, int *y, int *channels_in_file, int desired_channels); -#endif - -//////////////////////////////////// -// -// float-per-channel interface -// -#ifndef STBI_NO_LINEAR - STBIDEF float *stbi_loadf_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *channels_in_file, int desired_channels); - STBIDEF float *stbi_loadf_from_callbacks (stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *channels_in_file, int desired_channels); - - #ifndef STBI_NO_STDIO - STBIDEF float *stbi_loadf (char const *filename, int *x, int *y, int *channels_in_file, int desired_channels); - STBIDEF float *stbi_loadf_from_file (FILE *f, int *x, int *y, int *channels_in_file, int desired_channels); - #endif -#endif - -#ifndef STBI_NO_HDR - STBIDEF void stbi_hdr_to_ldr_gamma(float gamma); - STBIDEF void stbi_hdr_to_ldr_scale(float scale); -#endif // STBI_NO_HDR - -#ifndef STBI_NO_LINEAR - STBIDEF void stbi_ldr_to_hdr_gamma(float gamma); - STBIDEF void stbi_ldr_to_hdr_scale(float scale); -#endif // STBI_NO_LINEAR - -// stbi_is_hdr is always defined, but always returns false if STBI_NO_HDR -STBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clbk, void *user); -STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len); -#ifndef STBI_NO_STDIO -STBIDEF int stbi_is_hdr (char const *filename); -STBIDEF int stbi_is_hdr_from_file(FILE *f); -#endif // STBI_NO_STDIO - - -// get a VERY brief reason for failure -// NOT THREADSAFE -STBIDEF const char *stbi_failure_reason (void); - -// free the loaded image -- this is just free() -STBIDEF void stbi_image_free (void *retval_from_stbi_load); - -// get image dimensions & components without fully decoding -STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp); -STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp); - -#ifndef STBI_NO_STDIO -STBIDEF int stbi_info (char const *filename, int *x, int *y, int *comp); -STBIDEF int stbi_info_from_file (FILE *f, int *x, int *y, int *comp); - -#endif - - - -// for image formats that explicitly notate that they have premultiplied alpha, -// we just return the colors as stored in the file. set this flag to force -// unpremultiplication. results are undefined if the unpremultiply overflow. -STBIDEF void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpremultiply); - -// indicate whether we should process iphone images back to canonical format, -// or just pass them through "as-is" -STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert); - -// flip the image vertically, so the first pixel in the output array is the bottom left -STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip); - -// ZLIB client - used by PNG, available for other purposes - -STBIDEF char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen); -STBIDEF char *stbi_zlib_decode_malloc_guesssize_headerflag(const char *buffer, int len, int initial_size, int *outlen, int parse_header); -STBIDEF char *stbi_zlib_decode_malloc(const char *buffer, int len, int *outlen); -STBIDEF int stbi_zlib_decode_buffer(char *obuffer, int olen, const char *ibuffer, int ilen); - -STBIDEF char *stbi_zlib_decode_noheader_malloc(const char *buffer, int len, int *outlen); -STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen); - - -#ifdef __cplusplus -} -#endif - -// -// -//// end header file ///////////////////////////////////////////////////// -#endif // STBI_INCLUDE_STB_IMAGE_H - -#ifdef STB_IMAGE_IMPLEMENTATION - -#if defined(STBI_ONLY_JPEG) || defined(STBI_ONLY_PNG) || defined(STBI_ONLY_BMP) \ - || defined(STBI_ONLY_TGA) || defined(STBI_ONLY_GIF) || defined(STBI_ONLY_PSD) \ - || defined(STBI_ONLY_HDR) || defined(STBI_ONLY_PIC) || defined(STBI_ONLY_PNM) \ - || defined(STBI_ONLY_ZLIB) - #ifndef STBI_ONLY_JPEG - #define STBI_NO_JPEG - #endif - #ifndef STBI_ONLY_PNG - #define STBI_NO_PNG - #endif - #ifndef STBI_ONLY_BMP - #define STBI_NO_BMP - #endif - #ifndef STBI_ONLY_PSD - #define STBI_NO_PSD - #endif - #ifndef STBI_ONLY_TGA - #define STBI_NO_TGA - #endif - #ifndef STBI_ONLY_GIF - #define STBI_NO_GIF - #endif - #ifndef STBI_ONLY_HDR - #define STBI_NO_HDR - #endif - #ifndef STBI_ONLY_PIC - #define STBI_NO_PIC - #endif - #ifndef STBI_ONLY_PNM - #define STBI_NO_PNM - #endif -#endif - -#if defined(STBI_NO_PNG) && !defined(STBI_SUPPORT_ZLIB) && !defined(STBI_NO_ZLIB) -#define STBI_NO_ZLIB -#endif - - -#include -#include // ptrdiff_t on osx -#include -#include -#include - -#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR) -#include // ldexp -#endif - -#ifndef STBI_NO_STDIO -#include -#endif - -#ifndef STBI_ASSERT -#include -#define STBI_ASSERT(x) assert(x) -#endif - - -#ifndef _MSC_VER - #ifdef __cplusplus - #define stbi_inline inline - #else - #define stbi_inline - #endif -#else - #define stbi_inline __forceinline -#endif - - -#ifdef _MSC_VER -typedef unsigned short stbi__uint16; -typedef signed short stbi__int16; -typedef unsigned int stbi__uint32; -typedef signed int stbi__int32; -#else -#include -typedef uint16_t stbi__uint16; -typedef int16_t stbi__int16; -typedef uint32_t stbi__uint32; -typedef int32_t stbi__int32; -#endif - -// should produce compiler error if size is wrong -typedef unsigned char validate_uint32[sizeof(stbi__uint32)==4 ? 1 : -1]; - -#ifdef _MSC_VER -#define STBI_NOTUSED(v) (void)(v) -#else -#define STBI_NOTUSED(v) (void)sizeof(v) -#endif - -#ifdef _MSC_VER -#define STBI_HAS_LROTL -#endif - -#ifdef STBI_HAS_LROTL - #define stbi_lrot(x,y) _lrotl(x,y) -#else - #define stbi_lrot(x,y) (((x) << (y)) | ((x) >> (32 - (y)))) -#endif - -#if defined(STBI_MALLOC) && defined(STBI_FREE) && (defined(STBI_REALLOC) || defined(STBI_REALLOC_SIZED)) -// ok -#elif !defined(STBI_MALLOC) && !defined(STBI_FREE) && !defined(STBI_REALLOC) && !defined(STBI_REALLOC_SIZED) -// ok -#else -#error "Must define all or none of STBI_MALLOC, STBI_FREE, and STBI_REALLOC (or STBI_REALLOC_SIZED)." -#endif - -#ifndef STBI_MALLOC -#define STBI_MALLOC(sz) malloc(sz) -#define STBI_REALLOC(p,newsz) realloc(p,newsz) -#define STBI_FREE(p) free(p) -#endif - -#ifndef STBI_REALLOC_SIZED -#define STBI_REALLOC_SIZED(p,oldsz,newsz) STBI_REALLOC(p,newsz) -#endif - -// x86/x64 detection -#if defined(__x86_64__) || defined(_M_X64) -#define STBI__X64_TARGET -#elif defined(__i386) || defined(_M_IX86) -#define STBI__X86_TARGET -#endif - -#if defined(__GNUC__) && defined(STBI__X86_TARGET) && !defined(__SSE2__) && !defined(STBI_NO_SIMD) -// gcc doesn't support sse2 intrinsics unless you compile with -msse2, -// which in turn means it gets to use SSE2 everywhere. This is unfortunate, -// but previous attempts to provide the SSE2 functions with runtime -// detection caused numerous issues. The way architecture extensions are -// exposed in GCC/Clang is, sadly, not really suited for one-file libs. -// New behavior: if compiled with -msse2, we use SSE2 without any -// detection; if not, we don't use it at all. -#define STBI_NO_SIMD -#endif - -#if defined(__MINGW32__) && defined(STBI__X86_TARGET) && !defined(STBI_MINGW_ENABLE_SSE2) && !defined(STBI_NO_SIMD) -// Note that __MINGW32__ doesn't actually mean 32-bit, so we have to avoid STBI__X64_TARGET -// -// 32-bit MinGW wants ESP to be 16-byte aligned, but this is not in the -// Windows ABI and VC++ as well as Windows DLLs don't maintain that invariant. -// As a result, enabling SSE2 on 32-bit MinGW is dangerous when not -// simultaneously enabling "-mstackrealign". -// -// See https://github.com/nothings/stb/issues/81 for more information. -// -// So default to no SSE2 on 32-bit MinGW. If you've read this far and added -// -mstackrealign to your build settings, feel free to #define STBI_MINGW_ENABLE_SSE2. -#define STBI_NO_SIMD -#endif - -#if !defined(STBI_NO_SIMD) && (defined(STBI__X86_TARGET) || defined(STBI__X64_TARGET)) -#define STBI_SSE2 -#include - -#ifdef _MSC_VER - -#if _MSC_VER >= 1400 // not VC6 -#include // __cpuid -static int stbi__cpuid3(void) -{ - int info[4]; - __cpuid(info,1); - return info[3]; -} -#else -static int stbi__cpuid3(void) -{ - int res; - __asm { - mov eax,1 - cpuid - mov res,edx - } - return res; -} -#endif - -#define STBI_SIMD_ALIGN(type, name) __declspec(align(16)) type name - -static int stbi__sse2_available(void) -{ - int info3 = stbi__cpuid3(); - return ((info3 >> 26) & 1) != 0; -} -#else // assume GCC-style if not VC++ -#define STBI_SIMD_ALIGN(type, name) type name __attribute__((aligned(16))) - -static int stbi__sse2_available(void) -{ - // If we're even attempting to compile this on GCC/Clang, that means - // -msse2 is on, which means the compiler is allowed to use SSE2 - // instructions at will, and so are we. - return 1; -} -#endif -#endif - -// ARM NEON -#if defined(STBI_NO_SIMD) && defined(STBI_NEON) -#undef STBI_NEON -#endif - -#ifdef STBI_NEON -#include -// assume GCC or Clang on ARM targets -#define STBI_SIMD_ALIGN(type, name) type name __attribute__((aligned(16))) -#endif - -#ifndef STBI_SIMD_ALIGN -#define STBI_SIMD_ALIGN(type, name) type name -#endif - -/////////////////////////////////////////////// -// -// stbi__context struct and start_xxx functions - -// stbi__context structure is our basic context used by all images, so it -// contains all the IO context, plus some basic image information -typedef struct -{ - stbi__uint32 img_x, img_y; - int img_n, img_out_n; - - stbi_io_callbacks io; - void *io_user_data; - - int read_from_callbacks; - int buflen; - stbi_uc buffer_start[128]; - - stbi_uc *img_buffer, *img_buffer_end; - stbi_uc *img_buffer_original, *img_buffer_original_end; -} stbi__context; - - -static void stbi__refill_buffer(stbi__context *s); - -// initialize a memory-decode context -static void stbi__start_mem(stbi__context *s, stbi_uc const *buffer, int len) -{ - s->io.read = NULL; - s->read_from_callbacks = 0; - s->img_buffer = s->img_buffer_original = (stbi_uc *) buffer; - s->img_buffer_end = s->img_buffer_original_end = (stbi_uc *) buffer+len; -} - -// initialize a callback-based context -static void stbi__start_callbacks(stbi__context *s, stbi_io_callbacks *c, void *user) -{ - s->io = *c; - s->io_user_data = user; - s->buflen = sizeof(s->buffer_start); - s->read_from_callbacks = 1; - s->img_buffer_original = s->buffer_start; - stbi__refill_buffer(s); - s->img_buffer_original_end = s->img_buffer_end; -} - -#ifndef STBI_NO_STDIO - -static int stbi__stdio_read(void *user, char *data, int size) -{ - return (int) fread(data,1,size,(FILE*) user); -} - -static void stbi__stdio_skip(void *user, int n) -{ - fseek((FILE*) user, n, SEEK_CUR); -} - -static int stbi__stdio_eof(void *user) -{ - return feof((FILE*) user); -} - -static stbi_io_callbacks stbi__stdio_callbacks = -{ - stbi__stdio_read, - stbi__stdio_skip, - stbi__stdio_eof, -}; - -static void stbi__start_file(stbi__context *s, FILE *f) -{ - stbi__start_callbacks(s, &stbi__stdio_callbacks, (void *) f); -} - -//static void stop_file(stbi__context *s) { } - -#endif // !STBI_NO_STDIO - -static void stbi__rewind(stbi__context *s) -{ - // conceptually rewind SHOULD rewind to the beginning of the stream, - // but we just rewind to the beginning of the initial buffer, because - // we only use it after doing 'test', which only ever looks at at most 92 bytes - s->img_buffer = s->img_buffer_original; - s->img_buffer_end = s->img_buffer_original_end; -} - -enum -{ - STBI_ORDER_RGB, - STBI_ORDER_BGR -}; - -typedef struct -{ - int bits_per_channel; - int num_channels; - int channel_order; -} stbi__result_info; - -#ifndef STBI_NO_JPEG -static int stbi__jpeg_test(stbi__context *s); -static void *stbi__jpeg_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); -static int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp); -#endif - -#ifndef STBI_NO_PNG -static int stbi__png_test(stbi__context *s); -static void *stbi__png_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); -static int stbi__png_info(stbi__context *s, int *x, int *y, int *comp); -#endif - -#ifndef STBI_NO_BMP -static int stbi__bmp_test(stbi__context *s); -static void *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); -static int stbi__bmp_info(stbi__context *s, int *x, int *y, int *comp); -#endif - -#ifndef STBI_NO_TGA -static int stbi__tga_test(stbi__context *s); -static void *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); -static int stbi__tga_info(stbi__context *s, int *x, int *y, int *comp); -#endif - -#ifndef STBI_NO_PSD -static int stbi__psd_test(stbi__context *s); -static void *stbi__psd_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri, int bpc); -static int stbi__psd_info(stbi__context *s, int *x, int *y, int *comp); -#endif - -#ifndef STBI_NO_HDR -static int stbi__hdr_test(stbi__context *s); -static float *stbi__hdr_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); -static int stbi__hdr_info(stbi__context *s, int *x, int *y, int *comp); -#endif - -#ifndef STBI_NO_PIC -static int stbi__pic_test(stbi__context *s); -static void *stbi__pic_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); -static int stbi__pic_info(stbi__context *s, int *x, int *y, int *comp); -#endif - -#ifndef STBI_NO_GIF -static int stbi__gif_test(stbi__context *s); -static void *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); -static int stbi__gif_info(stbi__context *s, int *x, int *y, int *comp); -#endif - -#ifndef STBI_NO_PNM -static int stbi__pnm_test(stbi__context *s); -static void *stbi__pnm_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); -static int stbi__pnm_info(stbi__context *s, int *x, int *y, int *comp); -#endif - -// this is not threadsafe -static const char *stbi__g_failure_reason; - -STBIDEF const char *stbi_failure_reason(void) -{ - return stbi__g_failure_reason; -} - -static int stbi__err(const char *str) -{ - stbi__g_failure_reason = str; - return 0; -} - -static void *stbi__malloc(size_t size) -{ - return STBI_MALLOC(size); -} - -// stb_image uses ints pervasively, including for offset calculations. -// therefore the largest decoded image size we can support with the -// current code, even on 64-bit targets, is INT_MAX. this is not a -// significant limitation for the intended use case. -// -// we do, however, need to make sure our size calculations don't -// overflow. hence a few helper functions for size calculations that -// multiply integers together, making sure that they're non-negative -// and no overflow occurs. - -// return 1 if the sum is valid, 0 on overflow. -// negative terms are considered invalid. -static int stbi__addsizes_valid(int a, int b) -{ - if (b < 0) return 0; - // now 0 <= b <= INT_MAX, hence also - // 0 <= INT_MAX - b <= INTMAX. - // And "a + b <= INT_MAX" (which might overflow) is the - // same as a <= INT_MAX - b (no overflow) - return a <= INT_MAX - b; -} - -// returns 1 if the product is valid, 0 on overflow. -// negative factors are considered invalid. -static int stbi__mul2sizes_valid(int a, int b) -{ - if (a < 0 || b < 0) return 0; - if (b == 0) return 1; // mul-by-0 is always safe - // portable way to check for no overflows in a*b - return a <= INT_MAX/b; -} - -// returns 1 if "a*b + add" has no negative terms/factors and doesn't overflow -static int stbi__mad2sizes_valid(int a, int b, int add) -{ - return stbi__mul2sizes_valid(a, b) && stbi__addsizes_valid(a*b, add); -} - -// returns 1 if "a*b*c + add" has no negative terms/factors and doesn't overflow -static int stbi__mad3sizes_valid(int a, int b, int c, int add) -{ - return stbi__mul2sizes_valid(a, b) && stbi__mul2sizes_valid(a*b, c) && - stbi__addsizes_valid(a*b*c, add); -} - -// returns 1 if "a*b*c*d + add" has no negative terms/factors and doesn't overflow -static int stbi__mad4sizes_valid(int a, int b, int c, int d, int add) -{ - return stbi__mul2sizes_valid(a, b) && stbi__mul2sizes_valid(a*b, c) && - stbi__mul2sizes_valid(a*b*c, d) && stbi__addsizes_valid(a*b*c*d, add); -} - -// mallocs with size overflow checking -static void *stbi__malloc_mad2(int a, int b, int add) -{ - if (!stbi__mad2sizes_valid(a, b, add)) return NULL; - return stbi__malloc(a*b + add); -} - -static void *stbi__malloc_mad3(int a, int b, int c, int add) -{ - if (!stbi__mad3sizes_valid(a, b, c, add)) return NULL; - return stbi__malloc(a*b*c + add); -} - -static void *stbi__malloc_mad4(int a, int b, int c, int d, int add) -{ - if (!stbi__mad4sizes_valid(a, b, c, d, add)) return NULL; - return stbi__malloc(a*b*c*d + add); -} - -// stbi__err - error -// stbi__errpf - error returning pointer to float -// stbi__errpuc - error returning pointer to unsigned char - -#ifdef STBI_NO_FAILURE_STRINGS - #define stbi__err(x,y) 0 -#elif defined(STBI_FAILURE_USERMSG) - #define stbi__err(x,y) stbi__err(y) -#else - #define stbi__err(x,y) stbi__err(x) -#endif - -#define stbi__errpf(x,y) ((float *)(size_t) (stbi__err(x,y)?NULL:NULL)) -#define stbi__errpuc(x,y) ((unsigned char *)(size_t) (stbi__err(x,y)?NULL:NULL)) - -STBIDEF void stbi_image_free(void *retval_from_stbi_load) -{ - STBI_FREE(retval_from_stbi_load); -} - -#ifndef STBI_NO_LINEAR -static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp); -#endif - -#ifndef STBI_NO_HDR -static stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp); -#endif - -static int stbi__vertically_flip_on_load = 0; - -STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip) -{ - stbi__vertically_flip_on_load = flag_true_if_should_flip; -} - -static void *stbi__load_main(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri, int bpc) -{ - memset(ri, 0, sizeof(*ri)); // make sure it's initialized if we add new fields - ri->bits_per_channel = 8; // default is 8 so most paths don't have to be changed - ri->channel_order = STBI_ORDER_RGB; // all current input & output are this, but this is here so we can add BGR order - ri->num_channels = 0; - - #ifndef STBI_NO_JPEG - if (stbi__jpeg_test(s)) return stbi__jpeg_load(s,x,y,comp,req_comp, ri); - #endif - #ifndef STBI_NO_PNG - if (stbi__png_test(s)) return stbi__png_load(s,x,y,comp,req_comp, ri); - #endif - #ifndef STBI_NO_BMP - if (stbi__bmp_test(s)) return stbi__bmp_load(s,x,y,comp,req_comp, ri); - #endif - #ifndef STBI_NO_GIF - if (stbi__gif_test(s)) return stbi__gif_load(s,x,y,comp,req_comp, ri); - #endif - #ifndef STBI_NO_PSD - if (stbi__psd_test(s)) return stbi__psd_load(s,x,y,comp,req_comp, ri, bpc); - #endif - #ifndef STBI_NO_PIC - if (stbi__pic_test(s)) return stbi__pic_load(s,x,y,comp,req_comp, ri); - #endif - #ifndef STBI_NO_PNM - if (stbi__pnm_test(s)) return stbi__pnm_load(s,x,y,comp,req_comp, ri); - #endif - - #ifndef STBI_NO_HDR - if (stbi__hdr_test(s)) { - float *hdr = stbi__hdr_load(s, x,y,comp,req_comp, ri); - return stbi__hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp); - } - #endif - - #ifndef STBI_NO_TGA - // test tga last because it's a crappy test! - if (stbi__tga_test(s)) - return stbi__tga_load(s,x,y,comp,req_comp, ri); - #endif - - return stbi__errpuc("unknown image type", "Image not of any known type, or corrupt"); -} - -static stbi_uc *stbi__convert_16_to_8(stbi__uint16 *orig, int w, int h, int channels) -{ - int i; - int img_len = w * h * channels; - stbi_uc *reduced; - - reduced = (stbi_uc *) stbi__malloc(img_len); - if (reduced == NULL) return stbi__errpuc("outofmem", "Out of memory"); - - for (i = 0; i < img_len; ++i) - reduced[i] = (stbi_uc)((orig[i] >> 8) & 0xFF); // top half of each byte is sufficient approx of 16->8 bit scaling - - STBI_FREE(orig); - return reduced; -} - -static stbi__uint16 *stbi__convert_8_to_16(stbi_uc *orig, int w, int h, int channels) -{ - int i; - int img_len = w * h * channels; - stbi__uint16 *enlarged; - - enlarged = (stbi__uint16 *) stbi__malloc(img_len*2); - if (enlarged == NULL) return (stbi__uint16 *) stbi__errpuc("outofmem", "Out of memory"); - - for (i = 0; i < img_len; ++i) - enlarged[i] = (stbi__uint16)((orig[i] << 8) + orig[i]); // replicate to high and low byte, maps 0->0, 255->0xffff - - STBI_FREE(orig); - return enlarged; -} - -static void stbi__vertical_flip(void *image, int w, int h, int bytes_per_pixel) -{ - int row; - size_t bytes_per_row = (size_t)w * bytes_per_pixel; - stbi_uc temp[2048]; - stbi_uc *bytes = (stbi_uc *)image; - - for (row = 0; row < (h>>1); row++) { - stbi_uc *row0 = bytes + row*bytes_per_row; - stbi_uc *row1 = bytes + (h - row - 1)*bytes_per_row; - // swap row0 with row1 - size_t bytes_left = bytes_per_row; - while (bytes_left) { - size_t bytes_copy = (bytes_left < sizeof(temp)) ? bytes_left : sizeof(temp); - memcpy(temp, row0, bytes_copy); - memcpy(row0, row1, bytes_copy); - memcpy(row1, temp, bytes_copy); - row0 += bytes_copy; - row1 += bytes_copy; - bytes_left -= bytes_copy; - } - } -} - -static unsigned char *stbi__load_and_postprocess_8bit(stbi__context *s, int *x, int *y, int *comp, int req_comp) -{ - stbi__result_info ri; - void *result = stbi__load_main(s, x, y, comp, req_comp, &ri, 8); - - if (result == NULL) - return NULL; - - if (ri.bits_per_channel != 8) { - STBI_ASSERT(ri.bits_per_channel == 16); - result = stbi__convert_16_to_8((stbi__uint16 *) result, *x, *y, req_comp == 0 ? *comp : req_comp); - ri.bits_per_channel = 8; - } - - // @TODO: move stbi__convert_format to here - - if (stbi__vertically_flip_on_load) { - int channels = req_comp ? req_comp : *comp; - stbi__vertical_flip(result, *x, *y, channels * sizeof(stbi_uc)); - } - - return (unsigned char *) result; -} - -static stbi__uint16 *stbi__load_and_postprocess_16bit(stbi__context *s, int *x, int *y, int *comp, int req_comp) -{ - stbi__result_info ri; - void *result = stbi__load_main(s, x, y, comp, req_comp, &ri, 16); - - if (result == NULL) - return NULL; - - if (ri.bits_per_channel != 16) { - STBI_ASSERT(ri.bits_per_channel == 8); - result = stbi__convert_8_to_16((stbi_uc *) result, *x, *y, req_comp == 0 ? *comp : req_comp); - ri.bits_per_channel = 16; - } - - // @TODO: move stbi__convert_format16 to here - // @TODO: special case RGB-to-Y (and RGBA-to-YA) for 8-bit-to-16-bit case to keep more precision - - if (stbi__vertically_flip_on_load) { - int channels = req_comp ? req_comp : *comp; - stbi__vertical_flip(result, *x, *y, channels * sizeof(stbi__uint16)); - } - - return (stbi__uint16 *) result; -} - -#ifndef STBI_NO_HDR -static void stbi__float_postprocess(float *result, int *x, int *y, int *comp, int req_comp) -{ - if (stbi__vertically_flip_on_load && result != NULL) { - int channels = req_comp ? req_comp : *comp; - stbi__vertical_flip(result, *x, *y, channels * sizeof(float)); - } -} -#endif - -#ifndef STBI_NO_STDIO - -static FILE *stbi__fopen(char const *filename, char const *mode) -{ - FILE *f; -#if defined(_MSC_VER) && _MSC_VER >= 1400 - if (0 != fopen_s(&f, filename, mode)) - f=0; -#else - f = fopen(filename, mode); -#endif - return f; -} - - -STBIDEF stbi_uc *stbi_load(char const *filename, int *x, int *y, int *comp, int req_comp) -{ - FILE *f = stbi__fopen(filename, "rb"); - unsigned char *result; - if (!f) return stbi__errpuc("can't fopen", "Unable to open file"); - result = stbi_load_from_file(f,x,y,comp,req_comp); - fclose(f); - return result; -} - -STBIDEF stbi_uc *stbi_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) -{ - unsigned char *result; - stbi__context s; - stbi__start_file(&s,f); - result = stbi__load_and_postprocess_8bit(&s,x,y,comp,req_comp); - if (result) { - // need to 'unget' all the characters in the IO buffer - fseek(f, - (int) (s.img_buffer_end - s.img_buffer), SEEK_CUR); - } - return result; -} - -STBIDEF stbi__uint16 *stbi_load_from_file_16(FILE *f, int *x, int *y, int *comp, int req_comp) -{ - stbi__uint16 *result; - stbi__context s; - stbi__start_file(&s,f); - result = stbi__load_and_postprocess_16bit(&s,x,y,comp,req_comp); - if (result) { - // need to 'unget' all the characters in the IO buffer - fseek(f, - (int) (s.img_buffer_end - s.img_buffer), SEEK_CUR); - } - return result; -} - -STBIDEF stbi_us *stbi_load_16(char const *filename, int *x, int *y, int *comp, int req_comp) -{ - FILE *f = stbi__fopen(filename, "rb"); - stbi__uint16 *result; - if (!f) return (stbi_us *) stbi__errpuc("can't fopen", "Unable to open file"); - result = stbi_load_from_file_16(f,x,y,comp,req_comp); - fclose(f); - return result; -} - - -#endif //!STBI_NO_STDIO - -STBIDEF stbi_us *stbi_load_16_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *channels_in_file, int desired_channels) -{ - stbi__context s; - stbi__start_mem(&s,buffer,len); - return stbi__load_and_postprocess_16bit(&s,x,y,channels_in_file,desired_channels); -} - -STBIDEF stbi_us *stbi_load_16_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *channels_in_file, int desired_channels) -{ - stbi__context s; - stbi__start_callbacks(&s, (stbi_io_callbacks *)clbk, user); - return stbi__load_and_postprocess_16bit(&s,x,y,channels_in_file,desired_channels); -} - -STBIDEF stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) -{ - stbi__context s; - stbi__start_mem(&s,buffer,len); - return stbi__load_and_postprocess_8bit(&s,x,y,comp,req_comp); -} - -STBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp, int req_comp) -{ - stbi__context s; - stbi__start_callbacks(&s, (stbi_io_callbacks *) clbk, user); - return stbi__load_and_postprocess_8bit(&s,x,y,comp,req_comp); -} - -#ifndef STBI_NO_LINEAR -static float *stbi__loadf_main(stbi__context *s, int *x, int *y, int *comp, int req_comp) -{ - unsigned char *data; - #ifndef STBI_NO_HDR - if (stbi__hdr_test(s)) { - stbi__result_info ri; - float *hdr_data = stbi__hdr_load(s,x,y,comp,req_comp, &ri); - if (hdr_data) - stbi__float_postprocess(hdr_data,x,y,comp,req_comp); - return hdr_data; - } - #endif - data = stbi__load_and_postprocess_8bit(s, x, y, comp, req_comp); - if (data) - return stbi__ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp); - return stbi__errpf("unknown image type", "Image not of any known type, or corrupt"); -} - -STBIDEF float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) -{ - stbi__context s; - stbi__start_mem(&s,buffer,len); - return stbi__loadf_main(&s,x,y,comp,req_comp); -} - -STBIDEF float *stbi_loadf_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp, int req_comp) -{ - stbi__context s; - stbi__start_callbacks(&s, (stbi_io_callbacks *) clbk, user); - return stbi__loadf_main(&s,x,y,comp,req_comp); -} - -#ifndef STBI_NO_STDIO -STBIDEF float *stbi_loadf(char const *filename, int *x, int *y, int *comp, int req_comp) -{ - float *result; - FILE *f = stbi__fopen(filename, "rb"); - if (!f) return stbi__errpf("can't fopen", "Unable to open file"); - result = stbi_loadf_from_file(f,x,y,comp,req_comp); - fclose(f); - return result; -} - -STBIDEF float *stbi_loadf_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) -{ - stbi__context s; - stbi__start_file(&s,f); - return stbi__loadf_main(&s,x,y,comp,req_comp); -} -#endif // !STBI_NO_STDIO - -#endif // !STBI_NO_LINEAR - -// these is-hdr-or-not is defined independent of whether STBI_NO_LINEAR is -// defined, for API simplicity; if STBI_NO_LINEAR is defined, it always -// reports false! - -STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len) -{ - #ifndef STBI_NO_HDR - stbi__context s; - stbi__start_mem(&s,buffer,len); - return stbi__hdr_test(&s); - #else - STBI_NOTUSED(buffer); - STBI_NOTUSED(len); - return 0; - #endif -} - -#ifndef STBI_NO_STDIO -STBIDEF int stbi_is_hdr (char const *filename) -{ - FILE *f = stbi__fopen(filename, "rb"); - int result=0; - if (f) { - result = stbi_is_hdr_from_file(f); - fclose(f); - } - return result; -} - -STBIDEF int stbi_is_hdr_from_file(FILE *f) -{ - #ifndef STBI_NO_HDR - stbi__context s; - stbi__start_file(&s,f); - return stbi__hdr_test(&s); - #else - STBI_NOTUSED(f); - return 0; - #endif -} -#endif // !STBI_NO_STDIO - -STBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clbk, void *user) -{ - #ifndef STBI_NO_HDR - stbi__context s; - stbi__start_callbacks(&s, (stbi_io_callbacks *) clbk, user); - return stbi__hdr_test(&s); - #else - STBI_NOTUSED(clbk); - STBI_NOTUSED(user); - return 0; - #endif -} - -#ifndef STBI_NO_LINEAR -static float stbi__l2h_gamma=2.2f, stbi__l2h_scale=1.0f; - -STBIDEF void stbi_ldr_to_hdr_gamma(float gamma) { stbi__l2h_gamma = gamma; } -STBIDEF void stbi_ldr_to_hdr_scale(float scale) { stbi__l2h_scale = scale; } -#endif - -static float stbi__h2l_gamma_i=1.0f/2.2f, stbi__h2l_scale_i=1.0f; - -STBIDEF void stbi_hdr_to_ldr_gamma(float gamma) { stbi__h2l_gamma_i = 1/gamma; } -STBIDEF void stbi_hdr_to_ldr_scale(float scale) { stbi__h2l_scale_i = 1/scale; } - - -////////////////////////////////////////////////////////////////////////////// -// -// Common code used by all image loaders -// - -enum -{ - STBI__SCAN_load=0, - STBI__SCAN_type, - STBI__SCAN_header -}; - -static void stbi__refill_buffer(stbi__context *s) -{ - int n = (s->io.read)(s->io_user_data,(char*)s->buffer_start,s->buflen); - if (n == 0) { - // at end of file, treat same as if from memory, but need to handle case - // where s->img_buffer isn't pointing to safe memory, e.g. 0-byte file - s->read_from_callbacks = 0; - s->img_buffer = s->buffer_start; - s->img_buffer_end = s->buffer_start+1; - *s->img_buffer = 0; - } else { - s->img_buffer = s->buffer_start; - s->img_buffer_end = s->buffer_start + n; - } -} - -stbi_inline static stbi_uc stbi__get8(stbi__context *s) -{ - if (s->img_buffer < s->img_buffer_end) - return *s->img_buffer++; - if (s->read_from_callbacks) { - stbi__refill_buffer(s); - return *s->img_buffer++; - } - return 0; -} - -stbi_inline static int stbi__at_eof(stbi__context *s) -{ - if (s->io.read) { - if (!(s->io.eof)(s->io_user_data)) return 0; - // if feof() is true, check if buffer = end - // special case: we've only got the special 0 character at the end - if (s->read_from_callbacks == 0) return 1; - } - - return s->img_buffer >= s->img_buffer_end; -} - -static void stbi__skip(stbi__context *s, int n) -{ - if (n < 0) { - s->img_buffer = s->img_buffer_end; - return; - } - if (s->io.read) { - int blen = (int) (s->img_buffer_end - s->img_buffer); - if (blen < n) { - s->img_buffer = s->img_buffer_end; - (s->io.skip)(s->io_user_data, n - blen); - return; - } - } - s->img_buffer += n; -} - -static int stbi__getn(stbi__context *s, stbi_uc *buffer, int n) -{ - if (s->io.read) { - int blen = (int) (s->img_buffer_end - s->img_buffer); - if (blen < n) { - int res, count; - - memcpy(buffer, s->img_buffer, blen); - - count = (s->io.read)(s->io_user_data, (char*) buffer + blen, n - blen); - res = (count == (n-blen)); - s->img_buffer = s->img_buffer_end; - return res; - } - } - - if (s->img_buffer+n <= s->img_buffer_end) { - memcpy(buffer, s->img_buffer, n); - s->img_buffer += n; - return 1; - } else - return 0; -} - -static int stbi__get16be(stbi__context *s) -{ - int z = stbi__get8(s); - return (z << 8) + stbi__get8(s); -} - -static stbi__uint32 stbi__get32be(stbi__context *s) -{ - stbi__uint32 z = stbi__get16be(s); - return (z << 16) + stbi__get16be(s); -} - -#if defined(STBI_NO_BMP) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF) -// nothing -#else -static int stbi__get16le(stbi__context *s) -{ - int z = stbi__get8(s); - return z + (stbi__get8(s) << 8); -} -#endif - -#ifndef STBI_NO_BMP -static stbi__uint32 stbi__get32le(stbi__context *s) -{ - stbi__uint32 z = stbi__get16le(s); - return z + (stbi__get16le(s) << 16); -} -#endif - -#define STBI__BYTECAST(x) ((stbi_uc) ((x) & 255)) // truncate int to byte without warnings - - -////////////////////////////////////////////////////////////////////////////// -// -// generic converter from built-in img_n to req_comp -// individual types do this automatically as much as possible (e.g. jpeg -// does all cases internally since it needs to colorspace convert anyway, -// and it never has alpha, so very few cases ). png can automatically -// interleave an alpha=255 channel, but falls back to this for other cases -// -// assume data buffer is malloced, so malloc a new one and free that one -// only failure mode is malloc failing - -static stbi_uc stbi__compute_y(int r, int g, int b) -{ - return (stbi_uc) (((r*77) + (g*150) + (29*b)) >> 8); -} - -static unsigned char *stbi__convert_format(unsigned char *data, int img_n, int req_comp, unsigned int x, unsigned int y) -{ - int i,j; - unsigned char *good; - - if (req_comp == img_n) return data; - STBI_ASSERT(req_comp >= 1 && req_comp <= 4); - - good = (unsigned char *) stbi__malloc_mad3(req_comp, x, y, 0); - if (good == NULL) { - STBI_FREE(data); - return stbi__errpuc("outofmem", "Out of memory"); - } - - for (j=0; j < (int) y; ++j) { - unsigned char *src = data + j * x * img_n ; - unsigned char *dest = good + j * x * req_comp; - - #define STBI__COMBO(a,b) ((a)*8+(b)) - #define STBI__CASE(a,b) case STBI__COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b) - // convert source image with img_n components to one with req_comp components; - // avoid switch per pixel, so use switch per scanline and massive macros - switch (STBI__COMBO(img_n, req_comp)) { - STBI__CASE(1,2) { dest[0]=src[0], dest[1]=255; } break; - STBI__CASE(1,3) { dest[0]=dest[1]=dest[2]=src[0]; } break; - STBI__CASE(1,4) { dest[0]=dest[1]=dest[2]=src[0], dest[3]=255; } break; - STBI__CASE(2,1) { dest[0]=src[0]; } break; - STBI__CASE(2,3) { dest[0]=dest[1]=dest[2]=src[0]; } break; - STBI__CASE(2,4) { dest[0]=dest[1]=dest[2]=src[0], dest[3]=src[1]; } break; - STBI__CASE(3,4) { dest[0]=src[0],dest[1]=src[1],dest[2]=src[2],dest[3]=255; } break; - STBI__CASE(3,1) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); } break; - STBI__CASE(3,2) { dest[0]=stbi__compute_y(src[0],src[1],src[2]), dest[1] = 255; } break; - STBI__CASE(4,1) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); } break; - STBI__CASE(4,2) { dest[0]=stbi__compute_y(src[0],src[1],src[2]), dest[1] = src[3]; } break; - STBI__CASE(4,3) { dest[0]=src[0],dest[1]=src[1],dest[2]=src[2]; } break; - default: STBI_ASSERT(0); - } - #undef STBI__CASE - } - - STBI_FREE(data); - return good; -} - -static stbi__uint16 stbi__compute_y_16(int r, int g, int b) -{ - return (stbi__uint16) (((r*77) + (g*150) + (29*b)) >> 8); -} - -static stbi__uint16 *stbi__convert_format16(stbi__uint16 *data, int img_n, int req_comp, unsigned int x, unsigned int y) -{ - int i,j; - stbi__uint16 *good; - - if (req_comp == img_n) return data; - STBI_ASSERT(req_comp >= 1 && req_comp <= 4); - - good = (stbi__uint16 *) stbi__malloc(req_comp * x * y * 2); - if (good == NULL) { - STBI_FREE(data); - return (stbi__uint16 *) stbi__errpuc("outofmem", "Out of memory"); - } - - for (j=0; j < (int) y; ++j) { - stbi__uint16 *src = data + j * x * img_n ; - stbi__uint16 *dest = good + j * x * req_comp; - - #define STBI__COMBO(a,b) ((a)*8+(b)) - #define STBI__CASE(a,b) case STBI__COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b) - // convert source image with img_n components to one with req_comp components; - // avoid switch per pixel, so use switch per scanline and massive macros - switch (STBI__COMBO(img_n, req_comp)) { - STBI__CASE(1,2) { dest[0]=src[0], dest[1]=0xffff; } break; - STBI__CASE(1,3) { dest[0]=dest[1]=dest[2]=src[0]; } break; - STBI__CASE(1,4) { dest[0]=dest[1]=dest[2]=src[0], dest[3]=0xffff; } break; - STBI__CASE(2,1) { dest[0]=src[0]; } break; - STBI__CASE(2,3) { dest[0]=dest[1]=dest[2]=src[0]; } break; - STBI__CASE(2,4) { dest[0]=dest[1]=dest[2]=src[0], dest[3]=src[1]; } break; - STBI__CASE(3,4) { dest[0]=src[0],dest[1]=src[1],dest[2]=src[2],dest[3]=0xffff; } break; - STBI__CASE(3,1) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); } break; - STBI__CASE(3,2) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]), dest[1] = 0xffff; } break; - STBI__CASE(4,1) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); } break; - STBI__CASE(4,2) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]), dest[1] = src[3]; } break; - STBI__CASE(4,3) { dest[0]=src[0],dest[1]=src[1],dest[2]=src[2]; } break; - default: STBI_ASSERT(0); - } - #undef STBI__CASE - } - - STBI_FREE(data); - return good; -} - -#ifndef STBI_NO_LINEAR -static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp) -{ - int i,k,n; - float *output; - if (!data) return NULL; - output = (float *) stbi__malloc_mad4(x, y, comp, sizeof(float), 0); - if (output == NULL) { STBI_FREE(data); return stbi__errpf("outofmem", "Out of memory"); } - // compute number of non-alpha components - if (comp & 1) n = comp; else n = comp-1; - for (i=0; i < x*y; ++i) { - for (k=0; k < n; ++k) { - output[i*comp + k] = (float) (pow(data[i*comp+k]/255.0f, stbi__l2h_gamma) * stbi__l2h_scale); - } - if (k < comp) output[i*comp + k] = data[i*comp+k]/255.0f; - } - STBI_FREE(data); - return output; -} -#endif - -#ifndef STBI_NO_HDR -#define stbi__float2int(x) ((int) (x)) -static stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp) -{ - int i,k,n; - stbi_uc *output; - if (!data) return NULL; - output = (stbi_uc *) stbi__malloc_mad3(x, y, comp, 0); - if (output == NULL) { STBI_FREE(data); return stbi__errpuc("outofmem", "Out of memory"); } - // compute number of non-alpha components - if (comp & 1) n = comp; else n = comp-1; - for (i=0; i < x*y; ++i) { - for (k=0; k < n; ++k) { - float z = (float) pow(data[i*comp+k]*stbi__h2l_scale_i, stbi__h2l_gamma_i) * 255 + 0.5f; - if (z < 0) z = 0; - if (z > 255) z = 255; - output[i*comp + k] = (stbi_uc) stbi__float2int(z); - } - if (k < comp) { - float z = data[i*comp+k] * 255 + 0.5f; - if (z < 0) z = 0; - if (z > 255) z = 255; - output[i*comp + k] = (stbi_uc) stbi__float2int(z); - } - } - STBI_FREE(data); - return output; -} -#endif - -////////////////////////////////////////////////////////////////////////////// -// -// "baseline" JPEG/JFIF decoder -// -// simple implementation -// - doesn't support delayed output of y-dimension -// - simple interface (only one output format: 8-bit interleaved RGB) -// - doesn't try to recover corrupt jpegs -// - doesn't allow partial loading, loading multiple at once -// - still fast on x86 (copying globals into locals doesn't help x86) -// - allocates lots of intermediate memory (full size of all components) -// - non-interleaved case requires this anyway -// - allows good upsampling (see next) -// high-quality -// - upsampled channels are bilinearly interpolated, even across blocks -// - quality integer IDCT derived from IJG's 'slow' -// performance -// - fast huffman; reasonable integer IDCT -// - some SIMD kernels for common paths on targets with SSE2/NEON -// - uses a lot of intermediate memory, could cache poorly - -#ifndef STBI_NO_JPEG - -// huffman decoding acceleration -#define FAST_BITS 9 // larger handles more cases; smaller stomps less cache - -typedef struct -{ - stbi_uc fast[1 << FAST_BITS]; - // weirdly, repacking this into AoS is a 10% speed loss, instead of a win - stbi__uint16 code[256]; - stbi_uc values[256]; - stbi_uc size[257]; - unsigned int maxcode[18]; - int delta[17]; // old 'firstsymbol' - old 'firstcode' -} stbi__huffman; - -typedef struct -{ - stbi__context *s; - stbi__huffman huff_dc[4]; - stbi__huffman huff_ac[4]; - stbi__uint16 dequant[4][64]; - stbi__int16 fast_ac[4][1 << FAST_BITS]; - -// sizes for components, interleaved MCUs - int img_h_max, img_v_max; - int img_mcu_x, img_mcu_y; - int img_mcu_w, img_mcu_h; - -// definition of jpeg image component - struct - { - int id; - int h,v; - int tq; - int hd,ha; - int dc_pred; - - int x,y,w2,h2; - stbi_uc *data; - void *raw_data, *raw_coeff; - stbi_uc *linebuf; - short *coeff; // progressive only - int coeff_w, coeff_h; // number of 8x8 coefficient blocks - } img_comp[4]; - - stbi__uint32 code_buffer; // jpeg entropy-coded buffer - int code_bits; // number of valid bits - unsigned char marker; // marker seen while filling entropy buffer - int nomore; // flag if we saw a marker so must stop - - int progressive; - int spec_start; - int spec_end; - int succ_high; - int succ_low; - int eob_run; - int jfif; - int app14_color_transform; // Adobe APP14 tag - int rgb; - - int scan_n, order[4]; - int restart_interval, todo; - -// kernels - void (*idct_block_kernel)(stbi_uc *out, int out_stride, short data[64]); - void (*YCbCr_to_RGB_kernel)(stbi_uc *out, const stbi_uc *y, const stbi_uc *pcb, const stbi_uc *pcr, int count, int step); - stbi_uc *(*resample_row_hv_2_kernel)(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs); -} stbi__jpeg; - -static int stbi__build_huffman(stbi__huffman *h, int *count) -{ - int i,j,k=0,code; - // build size list for each symbol (from JPEG spec) - for (i=0; i < 16; ++i) - for (j=0; j < count[i]; ++j) - h->size[k++] = (stbi_uc) (i+1); - h->size[k] = 0; - - // compute actual symbols (from jpeg spec) - code = 0; - k = 0; - for(j=1; j <= 16; ++j) { - // compute delta to add to code to compute symbol id - h->delta[j] = k - code; - if (h->size[k] == j) { - while (h->size[k] == j) - h->code[k++] = (stbi__uint16) (code++); - if (code-1 >= (1 << j)) return stbi__err("bad code lengths","Corrupt JPEG"); - } - // compute largest code + 1 for this size, preshifted as needed later - h->maxcode[j] = code << (16-j); - code <<= 1; - } - h->maxcode[j] = 0xffffffff; - - // build non-spec acceleration table; 255 is flag for not-accelerated - memset(h->fast, 255, 1 << FAST_BITS); - for (i=0; i < k; ++i) { - int s = h->size[i]; - if (s <= FAST_BITS) { - int c = h->code[i] << (FAST_BITS-s); - int m = 1 << (FAST_BITS-s); - for (j=0; j < m; ++j) { - h->fast[c+j] = (stbi_uc) i; - } - } - } - return 1; -} - -// build a table that decodes both magnitude and value of small ACs in -// one go. -static void stbi__build_fast_ac(stbi__int16 *fast_ac, stbi__huffman *h) -{ - int i; - for (i=0; i < (1 << FAST_BITS); ++i) { - stbi_uc fast = h->fast[i]; - fast_ac[i] = 0; - if (fast < 255) { - int rs = h->values[fast]; - int run = (rs >> 4) & 15; - int magbits = rs & 15; - int len = h->size[fast]; - - if (magbits && len + magbits <= FAST_BITS) { - // magnitude code followed by receive_extend code - int k = ((i << len) & ((1 << FAST_BITS) - 1)) >> (FAST_BITS - magbits); - int m = 1 << (magbits - 1); - if (k < m) k += (~0U << magbits) + 1; - // if the result is small enough, we can fit it in fast_ac table - if (k >= -128 && k <= 127) - fast_ac[i] = (stbi__int16) ((k << 8) + (run << 4) + (len + magbits)); - } - } - } -} - -static void stbi__grow_buffer_unsafe(stbi__jpeg *j) -{ - do { - int b = j->nomore ? 0 : stbi__get8(j->s); - if (b == 0xff) { - int c = stbi__get8(j->s); - while (c == 0xff) c = stbi__get8(j->s); // consume fill bytes - if (c != 0) { - j->marker = (unsigned char) c; - j->nomore = 1; - return; - } - } - j->code_buffer |= b << (24 - j->code_bits); - j->code_bits += 8; - } while (j->code_bits <= 24); -} - -// (1 << n) - 1 -static stbi__uint32 stbi__bmask[17]={0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535}; - -// decode a jpeg huffman value from the bitstream -stbi_inline static int stbi__jpeg_huff_decode(stbi__jpeg *j, stbi__huffman *h) -{ - unsigned int temp; - int c,k; - - if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); - - // look at the top FAST_BITS and determine what symbol ID it is, - // if the code is <= FAST_BITS - c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS)-1); - k = h->fast[c]; - if (k < 255) { - int s = h->size[k]; - if (s > j->code_bits) - return -1; - j->code_buffer <<= s; - j->code_bits -= s; - return h->values[k]; - } - - // naive test is to shift the code_buffer down so k bits are - // valid, then test against maxcode. To speed this up, we've - // preshifted maxcode left so that it has (16-k) 0s at the - // end; in other words, regardless of the number of bits, it - // wants to be compared against something shifted to have 16; - // that way we don't need to shift inside the loop. - temp = j->code_buffer >> 16; - for (k=FAST_BITS+1 ; ; ++k) - if (temp < h->maxcode[k]) - break; - if (k == 17) { - // error! code not found - j->code_bits -= 16; - return -1; - } - - if (k > j->code_bits) - return -1; - - // convert the huffman code to the symbol id - c = ((j->code_buffer >> (32 - k)) & stbi__bmask[k]) + h->delta[k]; - STBI_ASSERT((((j->code_buffer) >> (32 - h->size[c])) & stbi__bmask[h->size[c]]) == h->code[c]); - - // convert the id to a symbol - j->code_bits -= k; - j->code_buffer <<= k; - return h->values[c]; -} - -// bias[n] = (-1<code_bits < n) stbi__grow_buffer_unsafe(j); - - sgn = (stbi__int32)j->code_buffer >> 31; // sign bit is always in MSB - k = stbi_lrot(j->code_buffer, n); - STBI_ASSERT(n >= 0 && n < (int) (sizeof(stbi__bmask)/sizeof(*stbi__bmask))); - j->code_buffer = k & ~stbi__bmask[n]; - k &= stbi__bmask[n]; - j->code_bits -= n; - return k + (stbi__jbias[n] & ~sgn); -} - -// get some unsigned bits -stbi_inline static int stbi__jpeg_get_bits(stbi__jpeg *j, int n) -{ - unsigned int k; - if (j->code_bits < n) stbi__grow_buffer_unsafe(j); - k = stbi_lrot(j->code_buffer, n); - j->code_buffer = k & ~stbi__bmask[n]; - k &= stbi__bmask[n]; - j->code_bits -= n; - return k; -} - -stbi_inline static int stbi__jpeg_get_bit(stbi__jpeg *j) -{ - unsigned int k; - if (j->code_bits < 1) stbi__grow_buffer_unsafe(j); - k = j->code_buffer; - j->code_buffer <<= 1; - --j->code_bits; - return k & 0x80000000; -} - -// given a value that's at position X in the zigzag stream, -// where does it appear in the 8x8 matrix coded as row-major? -static stbi_uc stbi__jpeg_dezigzag[64+15] = -{ - 0, 1, 8, 16, 9, 2, 3, 10, - 17, 24, 32, 25, 18, 11, 4, 5, - 12, 19, 26, 33, 40, 48, 41, 34, - 27, 20, 13, 6, 7, 14, 21, 28, - 35, 42, 49, 56, 57, 50, 43, 36, - 29, 22, 15, 23, 30, 37, 44, 51, - 58, 59, 52, 45, 38, 31, 39, 46, - 53, 60, 61, 54, 47, 55, 62, 63, - // let corrupt input sample past end - 63, 63, 63, 63, 63, 63, 63, 63, - 63, 63, 63, 63, 63, 63, 63 -}; - -// decode one 64-entry block-- -static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman *hdc, stbi__huffman *hac, stbi__int16 *fac, int b, stbi__uint16 *dequant) -{ - int diff,dc,k; - int t; - - if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); - t = stbi__jpeg_huff_decode(j, hdc); - if (t < 0) return stbi__err("bad huffman code","Corrupt JPEG"); - - // 0 all the ac values now so we can do it 32-bits at a time - memset(data,0,64*sizeof(data[0])); - - diff = t ? stbi__extend_receive(j, t) : 0; - dc = j->img_comp[b].dc_pred + diff; - j->img_comp[b].dc_pred = dc; - data[0] = (short) (dc * dequant[0]); - - // decode AC components, see JPEG spec - k = 1; - do { - unsigned int zig; - int c,r,s; - if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); - c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS)-1); - r = fac[c]; - if (r) { // fast-AC path - k += (r >> 4) & 15; // run - s = r & 15; // combined length - j->code_buffer <<= s; - j->code_bits -= s; - // decode into unzigzag'd location - zig = stbi__jpeg_dezigzag[k++]; - data[zig] = (short) ((r >> 8) * dequant[zig]); - } else { - int rs = stbi__jpeg_huff_decode(j, hac); - if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG"); - s = rs & 15; - r = rs >> 4; - if (s == 0) { - if (rs != 0xf0) break; // end block - k += 16; - } else { - k += r; - // decode into unzigzag'd location - zig = stbi__jpeg_dezigzag[k++]; - data[zig] = (short) (stbi__extend_receive(j,s) * dequant[zig]); - } - } - } while (k < 64); - return 1; -} - -static int stbi__jpeg_decode_block_prog_dc(stbi__jpeg *j, short data[64], stbi__huffman *hdc, int b) -{ - int diff,dc; - int t; - if (j->spec_end != 0) return stbi__err("can't merge dc and ac", "Corrupt JPEG"); - - if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); - - if (j->succ_high == 0) { - // first scan for DC coefficient, must be first - memset(data,0,64*sizeof(data[0])); // 0 all the ac values now - t = stbi__jpeg_huff_decode(j, hdc); - diff = t ? stbi__extend_receive(j, t) : 0; - - dc = j->img_comp[b].dc_pred + diff; - j->img_comp[b].dc_pred = dc; - data[0] = (short) (dc << j->succ_low); - } else { - // refinement scan for DC coefficient - if (stbi__jpeg_get_bit(j)) - data[0] += (short) (1 << j->succ_low); - } - return 1; -} - -// @OPTIMIZE: store non-zigzagged during the decode passes, -// and only de-zigzag when dequantizing -static int stbi__jpeg_decode_block_prog_ac(stbi__jpeg *j, short data[64], stbi__huffman *hac, stbi__int16 *fac) -{ - int k; - if (j->spec_start == 0) return stbi__err("can't merge dc and ac", "Corrupt JPEG"); - - if (j->succ_high == 0) { - int shift = j->succ_low; - - if (j->eob_run) { - --j->eob_run; - return 1; - } - - k = j->spec_start; - do { - unsigned int zig; - int c,r,s; - if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); - c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS)-1); - r = fac[c]; - if (r) { // fast-AC path - k += (r >> 4) & 15; // run - s = r & 15; // combined length - j->code_buffer <<= s; - j->code_bits -= s; - zig = stbi__jpeg_dezigzag[k++]; - data[zig] = (short) ((r >> 8) << shift); - } else { - int rs = stbi__jpeg_huff_decode(j, hac); - if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG"); - s = rs & 15; - r = rs >> 4; - if (s == 0) { - if (r < 15) { - j->eob_run = (1 << r); - if (r) - j->eob_run += stbi__jpeg_get_bits(j, r); - --j->eob_run; - break; - } - k += 16; - } else { - k += r; - zig = stbi__jpeg_dezigzag[k++]; - data[zig] = (short) (stbi__extend_receive(j,s) << shift); - } - } - } while (k <= j->spec_end); - } else { - // refinement scan for these AC coefficients - - short bit = (short) (1 << j->succ_low); - - if (j->eob_run) { - --j->eob_run; - for (k = j->spec_start; k <= j->spec_end; ++k) { - short *p = &data[stbi__jpeg_dezigzag[k]]; - if (*p != 0) - if (stbi__jpeg_get_bit(j)) - if ((*p & bit)==0) { - if (*p > 0) - *p += bit; - else - *p -= bit; - } - } - } else { - k = j->spec_start; - do { - int r,s; - int rs = stbi__jpeg_huff_decode(j, hac); // @OPTIMIZE see if we can use the fast path here, advance-by-r is so slow, eh - if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG"); - s = rs & 15; - r = rs >> 4; - if (s == 0) { - if (r < 15) { - j->eob_run = (1 << r) - 1; - if (r) - j->eob_run += stbi__jpeg_get_bits(j, r); - r = 64; // force end of block - } else { - // r=15 s=0 should write 16 0s, so we just do - // a run of 15 0s and then write s (which is 0), - // so we don't have to do anything special here - } - } else { - if (s != 1) return stbi__err("bad huffman code", "Corrupt JPEG"); - // sign bit - if (stbi__jpeg_get_bit(j)) - s = bit; - else - s = -bit; - } - - // advance by r - while (k <= j->spec_end) { - short *p = &data[stbi__jpeg_dezigzag[k++]]; - if (*p != 0) { - if (stbi__jpeg_get_bit(j)) - if ((*p & bit)==0) { - if (*p > 0) - *p += bit; - else - *p -= bit; - } - } else { - if (r == 0) { - *p = (short) s; - break; - } - --r; - } - } - } while (k <= j->spec_end); - } - } - return 1; -} - -// take a -128..127 value and stbi__clamp it and convert to 0..255 -stbi_inline static stbi_uc stbi__clamp(int x) -{ - // trick to use a single test to catch both cases - if ((unsigned int) x > 255) { - if (x < 0) return 0; - if (x > 255) return 255; - } - return (stbi_uc) x; -} - -#define stbi__f2f(x) ((int) (((x) * 4096 + 0.5))) -#define stbi__fsh(x) ((x) << 12) - -// derived from jidctint -- DCT_ISLOW -#define STBI__IDCT_1D(s0,s1,s2,s3,s4,s5,s6,s7) \ - int t0,t1,t2,t3,p1,p2,p3,p4,p5,x0,x1,x2,x3; \ - p2 = s2; \ - p3 = s6; \ - p1 = (p2+p3) * stbi__f2f(0.5411961f); \ - t2 = p1 + p3*stbi__f2f(-1.847759065f); \ - t3 = p1 + p2*stbi__f2f( 0.765366865f); \ - p2 = s0; \ - p3 = s4; \ - t0 = stbi__fsh(p2+p3); \ - t1 = stbi__fsh(p2-p3); \ - x0 = t0+t3; \ - x3 = t0-t3; \ - x1 = t1+t2; \ - x2 = t1-t2; \ - t0 = s7; \ - t1 = s5; \ - t2 = s3; \ - t3 = s1; \ - p3 = t0+t2; \ - p4 = t1+t3; \ - p1 = t0+t3; \ - p2 = t1+t2; \ - p5 = (p3+p4)*stbi__f2f( 1.175875602f); \ - t0 = t0*stbi__f2f( 0.298631336f); \ - t1 = t1*stbi__f2f( 2.053119869f); \ - t2 = t2*stbi__f2f( 3.072711026f); \ - t3 = t3*stbi__f2f( 1.501321110f); \ - p1 = p5 + p1*stbi__f2f(-0.899976223f); \ - p2 = p5 + p2*stbi__f2f(-2.562915447f); \ - p3 = p3*stbi__f2f(-1.961570560f); \ - p4 = p4*stbi__f2f(-0.390180644f); \ - t3 += p1+p4; \ - t2 += p2+p3; \ - t1 += p2+p4; \ - t0 += p1+p3; - -static void stbi__idct_block(stbi_uc *out, int out_stride, short data[64]) -{ - int i,val[64],*v=val; - stbi_uc *o; - short *d = data; - - // columns - for (i=0; i < 8; ++i,++d, ++v) { - // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing - if (d[ 8]==0 && d[16]==0 && d[24]==0 && d[32]==0 - && d[40]==0 && d[48]==0 && d[56]==0) { - // no shortcut 0 seconds - // (1|2|3|4|5|6|7)==0 0 seconds - // all separate -0.047 seconds - // 1 && 2|3 && 4|5 && 6|7: -0.047 seconds - int dcterm = d[0] << 2; - v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm; - } else { - STBI__IDCT_1D(d[ 0],d[ 8],d[16],d[24],d[32],d[40],d[48],d[56]) - // constants scaled things up by 1<<12; let's bring them back - // down, but keep 2 extra bits of precision - x0 += 512; x1 += 512; x2 += 512; x3 += 512; - v[ 0] = (x0+t3) >> 10; - v[56] = (x0-t3) >> 10; - v[ 8] = (x1+t2) >> 10; - v[48] = (x1-t2) >> 10; - v[16] = (x2+t1) >> 10; - v[40] = (x2-t1) >> 10; - v[24] = (x3+t0) >> 10; - v[32] = (x3-t0) >> 10; - } - } - - for (i=0, v=val, o=out; i < 8; ++i,v+=8,o+=out_stride) { - // no fast case since the first 1D IDCT spread components out - STBI__IDCT_1D(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7]) - // constants scaled things up by 1<<12, plus we had 1<<2 from first - // loop, plus horizontal and vertical each scale by sqrt(8) so together - // we've got an extra 1<<3, so 1<<17 total we need to remove. - // so we want to round that, which means adding 0.5 * 1<<17, - // aka 65536. Also, we'll end up with -128 to 127 that we want - // to encode as 0..255 by adding 128, so we'll add that before the shift - x0 += 65536 + (128<<17); - x1 += 65536 + (128<<17); - x2 += 65536 + (128<<17); - x3 += 65536 + (128<<17); - // tried computing the shifts into temps, or'ing the temps to see - // if any were out of range, but that was slower - o[0] = stbi__clamp((x0+t3) >> 17); - o[7] = stbi__clamp((x0-t3) >> 17); - o[1] = stbi__clamp((x1+t2) >> 17); - o[6] = stbi__clamp((x1-t2) >> 17); - o[2] = stbi__clamp((x2+t1) >> 17); - o[5] = stbi__clamp((x2-t1) >> 17); - o[3] = stbi__clamp((x3+t0) >> 17); - o[4] = stbi__clamp((x3-t0) >> 17); - } -} - -#ifdef STBI_SSE2 -// sse2 integer IDCT. not the fastest possible implementation but it -// produces bit-identical results to the generic C version so it's -// fully "transparent". -static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64]) -{ - // This is constructed to match our regular (generic) integer IDCT exactly. - __m128i row0, row1, row2, row3, row4, row5, row6, row7; - __m128i tmp; - - // dot product constant: even elems=x, odd elems=y - #define dct_const(x,y) _mm_setr_epi16((x),(y),(x),(y),(x),(y),(x),(y)) - - // out(0) = c0[even]*x + c0[odd]*y (c0, x, y 16-bit, out 32-bit) - // out(1) = c1[even]*x + c1[odd]*y - #define dct_rot(out0,out1, x,y,c0,c1) \ - __m128i c0##lo = _mm_unpacklo_epi16((x),(y)); \ - __m128i c0##hi = _mm_unpackhi_epi16((x),(y)); \ - __m128i out0##_l = _mm_madd_epi16(c0##lo, c0); \ - __m128i out0##_h = _mm_madd_epi16(c0##hi, c0); \ - __m128i out1##_l = _mm_madd_epi16(c0##lo, c1); \ - __m128i out1##_h = _mm_madd_epi16(c0##hi, c1) - - // out = in << 12 (in 16-bit, out 32-bit) - #define dct_widen(out, in) \ - __m128i out##_l = _mm_srai_epi32(_mm_unpacklo_epi16(_mm_setzero_si128(), (in)), 4); \ - __m128i out##_h = _mm_srai_epi32(_mm_unpackhi_epi16(_mm_setzero_si128(), (in)), 4) - - // wide add - #define dct_wadd(out, a, b) \ - __m128i out##_l = _mm_add_epi32(a##_l, b##_l); \ - __m128i out##_h = _mm_add_epi32(a##_h, b##_h) - - // wide sub - #define dct_wsub(out, a, b) \ - __m128i out##_l = _mm_sub_epi32(a##_l, b##_l); \ - __m128i out##_h = _mm_sub_epi32(a##_h, b##_h) - - // butterfly a/b, add bias, then shift by "s" and pack - #define dct_bfly32o(out0, out1, a,b,bias,s) \ - { \ - __m128i abiased_l = _mm_add_epi32(a##_l, bias); \ - __m128i abiased_h = _mm_add_epi32(a##_h, bias); \ - dct_wadd(sum, abiased, b); \ - dct_wsub(dif, abiased, b); \ - out0 = _mm_packs_epi32(_mm_srai_epi32(sum_l, s), _mm_srai_epi32(sum_h, s)); \ - out1 = _mm_packs_epi32(_mm_srai_epi32(dif_l, s), _mm_srai_epi32(dif_h, s)); \ - } - - // 8-bit interleave step (for transposes) - #define dct_interleave8(a, b) \ - tmp = a; \ - a = _mm_unpacklo_epi8(a, b); \ - b = _mm_unpackhi_epi8(tmp, b) - - // 16-bit interleave step (for transposes) - #define dct_interleave16(a, b) \ - tmp = a; \ - a = _mm_unpacklo_epi16(a, b); \ - b = _mm_unpackhi_epi16(tmp, b) - - #define dct_pass(bias,shift) \ - { \ - /* even part */ \ - dct_rot(t2e,t3e, row2,row6, rot0_0,rot0_1); \ - __m128i sum04 = _mm_add_epi16(row0, row4); \ - __m128i dif04 = _mm_sub_epi16(row0, row4); \ - dct_widen(t0e, sum04); \ - dct_widen(t1e, dif04); \ - dct_wadd(x0, t0e, t3e); \ - dct_wsub(x3, t0e, t3e); \ - dct_wadd(x1, t1e, t2e); \ - dct_wsub(x2, t1e, t2e); \ - /* odd part */ \ - dct_rot(y0o,y2o, row7,row3, rot2_0,rot2_1); \ - dct_rot(y1o,y3o, row5,row1, rot3_0,rot3_1); \ - __m128i sum17 = _mm_add_epi16(row1, row7); \ - __m128i sum35 = _mm_add_epi16(row3, row5); \ - dct_rot(y4o,y5o, sum17,sum35, rot1_0,rot1_1); \ - dct_wadd(x4, y0o, y4o); \ - dct_wadd(x5, y1o, y5o); \ - dct_wadd(x6, y2o, y5o); \ - dct_wadd(x7, y3o, y4o); \ - dct_bfly32o(row0,row7, x0,x7,bias,shift); \ - dct_bfly32o(row1,row6, x1,x6,bias,shift); \ - dct_bfly32o(row2,row5, x2,x5,bias,shift); \ - dct_bfly32o(row3,row4, x3,x4,bias,shift); \ - } - - __m128i rot0_0 = dct_const(stbi__f2f(0.5411961f), stbi__f2f(0.5411961f) + stbi__f2f(-1.847759065f)); - __m128i rot0_1 = dct_const(stbi__f2f(0.5411961f) + stbi__f2f( 0.765366865f), stbi__f2f(0.5411961f)); - __m128i rot1_0 = dct_const(stbi__f2f(1.175875602f) + stbi__f2f(-0.899976223f), stbi__f2f(1.175875602f)); - __m128i rot1_1 = dct_const(stbi__f2f(1.175875602f), stbi__f2f(1.175875602f) + stbi__f2f(-2.562915447f)); - __m128i rot2_0 = dct_const(stbi__f2f(-1.961570560f) + stbi__f2f( 0.298631336f), stbi__f2f(-1.961570560f)); - __m128i rot2_1 = dct_const(stbi__f2f(-1.961570560f), stbi__f2f(-1.961570560f) + stbi__f2f( 3.072711026f)); - __m128i rot3_0 = dct_const(stbi__f2f(-0.390180644f) + stbi__f2f( 2.053119869f), stbi__f2f(-0.390180644f)); - __m128i rot3_1 = dct_const(stbi__f2f(-0.390180644f), stbi__f2f(-0.390180644f) + stbi__f2f( 1.501321110f)); - - // rounding biases in column/row passes, see stbi__idct_block for explanation. - __m128i bias_0 = _mm_set1_epi32(512); - __m128i bias_1 = _mm_set1_epi32(65536 + (128<<17)); - - // load - row0 = _mm_load_si128((const __m128i *) (data + 0*8)); - row1 = _mm_load_si128((const __m128i *) (data + 1*8)); - row2 = _mm_load_si128((const __m128i *) (data + 2*8)); - row3 = _mm_load_si128((const __m128i *) (data + 3*8)); - row4 = _mm_load_si128((const __m128i *) (data + 4*8)); - row5 = _mm_load_si128((const __m128i *) (data + 5*8)); - row6 = _mm_load_si128((const __m128i *) (data + 6*8)); - row7 = _mm_load_si128((const __m128i *) (data + 7*8)); - - // column pass - dct_pass(bias_0, 10); - - { - // 16bit 8x8 transpose pass 1 - dct_interleave16(row0, row4); - dct_interleave16(row1, row5); - dct_interleave16(row2, row6); - dct_interleave16(row3, row7); - - // transpose pass 2 - dct_interleave16(row0, row2); - dct_interleave16(row1, row3); - dct_interleave16(row4, row6); - dct_interleave16(row5, row7); - - // transpose pass 3 - dct_interleave16(row0, row1); - dct_interleave16(row2, row3); - dct_interleave16(row4, row5); - dct_interleave16(row6, row7); - } - - // row pass - dct_pass(bias_1, 17); - - { - // pack - __m128i p0 = _mm_packus_epi16(row0, row1); // a0a1a2a3...a7b0b1b2b3...b7 - __m128i p1 = _mm_packus_epi16(row2, row3); - __m128i p2 = _mm_packus_epi16(row4, row5); - __m128i p3 = _mm_packus_epi16(row6, row7); - - // 8bit 8x8 transpose pass 1 - dct_interleave8(p0, p2); // a0e0a1e1... - dct_interleave8(p1, p3); // c0g0c1g1... - - // transpose pass 2 - dct_interleave8(p0, p1); // a0c0e0g0... - dct_interleave8(p2, p3); // b0d0f0h0... - - // transpose pass 3 - dct_interleave8(p0, p2); // a0b0c0d0... - dct_interleave8(p1, p3); // a4b4c4d4... - - // store - _mm_storel_epi64((__m128i *) out, p0); out += out_stride; - _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p0, 0x4e)); out += out_stride; - _mm_storel_epi64((__m128i *) out, p2); out += out_stride; - _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p2, 0x4e)); out += out_stride; - _mm_storel_epi64((__m128i *) out, p1); out += out_stride; - _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p1, 0x4e)); out += out_stride; - _mm_storel_epi64((__m128i *) out, p3); out += out_stride; - _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p3, 0x4e)); - } - -#undef dct_const -#undef dct_rot -#undef dct_widen -#undef dct_wadd -#undef dct_wsub -#undef dct_bfly32o -#undef dct_interleave8 -#undef dct_interleave16 -#undef dct_pass -} - -#endif // STBI_SSE2 - -#ifdef STBI_NEON - -// NEON integer IDCT. should produce bit-identical -// results to the generic C version. -static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64]) -{ - int16x8_t row0, row1, row2, row3, row4, row5, row6, row7; - - int16x4_t rot0_0 = vdup_n_s16(stbi__f2f(0.5411961f)); - int16x4_t rot0_1 = vdup_n_s16(stbi__f2f(-1.847759065f)); - int16x4_t rot0_2 = vdup_n_s16(stbi__f2f( 0.765366865f)); - int16x4_t rot1_0 = vdup_n_s16(stbi__f2f( 1.175875602f)); - int16x4_t rot1_1 = vdup_n_s16(stbi__f2f(-0.899976223f)); - int16x4_t rot1_2 = vdup_n_s16(stbi__f2f(-2.562915447f)); - int16x4_t rot2_0 = vdup_n_s16(stbi__f2f(-1.961570560f)); - int16x4_t rot2_1 = vdup_n_s16(stbi__f2f(-0.390180644f)); - int16x4_t rot3_0 = vdup_n_s16(stbi__f2f( 0.298631336f)); - int16x4_t rot3_1 = vdup_n_s16(stbi__f2f( 2.053119869f)); - int16x4_t rot3_2 = vdup_n_s16(stbi__f2f( 3.072711026f)); - int16x4_t rot3_3 = vdup_n_s16(stbi__f2f( 1.501321110f)); - -#define dct_long_mul(out, inq, coeff) \ - int32x4_t out##_l = vmull_s16(vget_low_s16(inq), coeff); \ - int32x4_t out##_h = vmull_s16(vget_high_s16(inq), coeff) - -#define dct_long_mac(out, acc, inq, coeff) \ - int32x4_t out##_l = vmlal_s16(acc##_l, vget_low_s16(inq), coeff); \ - int32x4_t out##_h = vmlal_s16(acc##_h, vget_high_s16(inq), coeff) - -#define dct_widen(out, inq) \ - int32x4_t out##_l = vshll_n_s16(vget_low_s16(inq), 12); \ - int32x4_t out##_h = vshll_n_s16(vget_high_s16(inq), 12) - -// wide add -#define dct_wadd(out, a, b) \ - int32x4_t out##_l = vaddq_s32(a##_l, b##_l); \ - int32x4_t out##_h = vaddq_s32(a##_h, b##_h) - -// wide sub -#define dct_wsub(out, a, b) \ - int32x4_t out##_l = vsubq_s32(a##_l, b##_l); \ - int32x4_t out##_h = vsubq_s32(a##_h, b##_h) - -// butterfly a/b, then shift using "shiftop" by "s" and pack -#define dct_bfly32o(out0,out1, a,b,shiftop,s) \ - { \ - dct_wadd(sum, a, b); \ - dct_wsub(dif, a, b); \ - out0 = vcombine_s16(shiftop(sum_l, s), shiftop(sum_h, s)); \ - out1 = vcombine_s16(shiftop(dif_l, s), shiftop(dif_h, s)); \ - } - -#define dct_pass(shiftop, shift) \ - { \ - /* even part */ \ - int16x8_t sum26 = vaddq_s16(row2, row6); \ - dct_long_mul(p1e, sum26, rot0_0); \ - dct_long_mac(t2e, p1e, row6, rot0_1); \ - dct_long_mac(t3e, p1e, row2, rot0_2); \ - int16x8_t sum04 = vaddq_s16(row0, row4); \ - int16x8_t dif04 = vsubq_s16(row0, row4); \ - dct_widen(t0e, sum04); \ - dct_widen(t1e, dif04); \ - dct_wadd(x0, t0e, t3e); \ - dct_wsub(x3, t0e, t3e); \ - dct_wadd(x1, t1e, t2e); \ - dct_wsub(x2, t1e, t2e); \ - /* odd part */ \ - int16x8_t sum15 = vaddq_s16(row1, row5); \ - int16x8_t sum17 = vaddq_s16(row1, row7); \ - int16x8_t sum35 = vaddq_s16(row3, row5); \ - int16x8_t sum37 = vaddq_s16(row3, row7); \ - int16x8_t sumodd = vaddq_s16(sum17, sum35); \ - dct_long_mul(p5o, sumodd, rot1_0); \ - dct_long_mac(p1o, p5o, sum17, rot1_1); \ - dct_long_mac(p2o, p5o, sum35, rot1_2); \ - dct_long_mul(p3o, sum37, rot2_0); \ - dct_long_mul(p4o, sum15, rot2_1); \ - dct_wadd(sump13o, p1o, p3o); \ - dct_wadd(sump24o, p2o, p4o); \ - dct_wadd(sump23o, p2o, p3o); \ - dct_wadd(sump14o, p1o, p4o); \ - dct_long_mac(x4, sump13o, row7, rot3_0); \ - dct_long_mac(x5, sump24o, row5, rot3_1); \ - dct_long_mac(x6, sump23o, row3, rot3_2); \ - dct_long_mac(x7, sump14o, row1, rot3_3); \ - dct_bfly32o(row0,row7, x0,x7,shiftop,shift); \ - dct_bfly32o(row1,row6, x1,x6,shiftop,shift); \ - dct_bfly32o(row2,row5, x2,x5,shiftop,shift); \ - dct_bfly32o(row3,row4, x3,x4,shiftop,shift); \ - } - - // load - row0 = vld1q_s16(data + 0*8); - row1 = vld1q_s16(data + 1*8); - row2 = vld1q_s16(data + 2*8); - row3 = vld1q_s16(data + 3*8); - row4 = vld1q_s16(data + 4*8); - row5 = vld1q_s16(data + 5*8); - row6 = vld1q_s16(data + 6*8); - row7 = vld1q_s16(data + 7*8); - - // add DC bias - row0 = vaddq_s16(row0, vsetq_lane_s16(1024, vdupq_n_s16(0), 0)); - - // column pass - dct_pass(vrshrn_n_s32, 10); - - // 16bit 8x8 transpose - { -// these three map to a single VTRN.16, VTRN.32, and VSWP, respectively. -// whether compilers actually get this is another story, sadly. -#define dct_trn16(x, y) { int16x8x2_t t = vtrnq_s16(x, y); x = t.val[0]; y = t.val[1]; } -#define dct_trn32(x, y) { int32x4x2_t t = vtrnq_s32(vreinterpretq_s32_s16(x), vreinterpretq_s32_s16(y)); x = vreinterpretq_s16_s32(t.val[0]); y = vreinterpretq_s16_s32(t.val[1]); } -#define dct_trn64(x, y) { int16x8_t x0 = x; int16x8_t y0 = y; x = vcombine_s16(vget_low_s16(x0), vget_low_s16(y0)); y = vcombine_s16(vget_high_s16(x0), vget_high_s16(y0)); } - - // pass 1 - dct_trn16(row0, row1); // a0b0a2b2a4b4a6b6 - dct_trn16(row2, row3); - dct_trn16(row4, row5); - dct_trn16(row6, row7); - - // pass 2 - dct_trn32(row0, row2); // a0b0c0d0a4b4c4d4 - dct_trn32(row1, row3); - dct_trn32(row4, row6); - dct_trn32(row5, row7); - - // pass 3 - dct_trn64(row0, row4); // a0b0c0d0e0f0g0h0 - dct_trn64(row1, row5); - dct_trn64(row2, row6); - dct_trn64(row3, row7); - -#undef dct_trn16 -#undef dct_trn32 -#undef dct_trn64 - } - - // row pass - // vrshrn_n_s32 only supports shifts up to 16, we need - // 17. so do a non-rounding shift of 16 first then follow - // up with a rounding shift by 1. - dct_pass(vshrn_n_s32, 16); - - { - // pack and round - uint8x8_t p0 = vqrshrun_n_s16(row0, 1); - uint8x8_t p1 = vqrshrun_n_s16(row1, 1); - uint8x8_t p2 = vqrshrun_n_s16(row2, 1); - uint8x8_t p3 = vqrshrun_n_s16(row3, 1); - uint8x8_t p4 = vqrshrun_n_s16(row4, 1); - uint8x8_t p5 = vqrshrun_n_s16(row5, 1); - uint8x8_t p6 = vqrshrun_n_s16(row6, 1); - uint8x8_t p7 = vqrshrun_n_s16(row7, 1); - - // again, these can translate into one instruction, but often don't. -#define dct_trn8_8(x, y) { uint8x8x2_t t = vtrn_u8(x, y); x = t.val[0]; y = t.val[1]; } -#define dct_trn8_16(x, y) { uint16x4x2_t t = vtrn_u16(vreinterpret_u16_u8(x), vreinterpret_u16_u8(y)); x = vreinterpret_u8_u16(t.val[0]); y = vreinterpret_u8_u16(t.val[1]); } -#define dct_trn8_32(x, y) { uint32x2x2_t t = vtrn_u32(vreinterpret_u32_u8(x), vreinterpret_u32_u8(y)); x = vreinterpret_u8_u32(t.val[0]); y = vreinterpret_u8_u32(t.val[1]); } - - // sadly can't use interleaved stores here since we only write - // 8 bytes to each scan line! - - // 8x8 8-bit transpose pass 1 - dct_trn8_8(p0, p1); - dct_trn8_8(p2, p3); - dct_trn8_8(p4, p5); - dct_trn8_8(p6, p7); - - // pass 2 - dct_trn8_16(p0, p2); - dct_trn8_16(p1, p3); - dct_trn8_16(p4, p6); - dct_trn8_16(p5, p7); - - // pass 3 - dct_trn8_32(p0, p4); - dct_trn8_32(p1, p5); - dct_trn8_32(p2, p6); - dct_trn8_32(p3, p7); - - // store - vst1_u8(out, p0); out += out_stride; - vst1_u8(out, p1); out += out_stride; - vst1_u8(out, p2); out += out_stride; - vst1_u8(out, p3); out += out_stride; - vst1_u8(out, p4); out += out_stride; - vst1_u8(out, p5); out += out_stride; - vst1_u8(out, p6); out += out_stride; - vst1_u8(out, p7); - -#undef dct_trn8_8 -#undef dct_trn8_16 -#undef dct_trn8_32 - } - -#undef dct_long_mul -#undef dct_long_mac -#undef dct_widen -#undef dct_wadd -#undef dct_wsub -#undef dct_bfly32o -#undef dct_pass -} - -#endif // STBI_NEON - -#define STBI__MARKER_none 0xff -// if there's a pending marker from the entropy stream, return that -// otherwise, fetch from the stream and get a marker. if there's no -// marker, return 0xff, which is never a valid marker value -static stbi_uc stbi__get_marker(stbi__jpeg *j) -{ - stbi_uc x; - if (j->marker != STBI__MARKER_none) { x = j->marker; j->marker = STBI__MARKER_none; return x; } - x = stbi__get8(j->s); - if (x != 0xff) return STBI__MARKER_none; - while (x == 0xff) - x = stbi__get8(j->s); // consume repeated 0xff fill bytes - return x; -} - -// in each scan, we'll have scan_n components, and the order -// of the components is specified by order[] -#define STBI__RESTART(x) ((x) >= 0xd0 && (x) <= 0xd7) - -// after a restart interval, stbi__jpeg_reset the entropy decoder and -// the dc prediction -static void stbi__jpeg_reset(stbi__jpeg *j) -{ - j->code_bits = 0; - j->code_buffer = 0; - j->nomore = 0; - j->img_comp[0].dc_pred = j->img_comp[1].dc_pred = j->img_comp[2].dc_pred = j->img_comp[3].dc_pred = 0; - j->marker = STBI__MARKER_none; - j->todo = j->restart_interval ? j->restart_interval : 0x7fffffff; - j->eob_run = 0; - // no more than 1<<31 MCUs if no restart_interal? that's plenty safe, - // since we don't even allow 1<<30 pixels -} - -static int stbi__parse_entropy_coded_data(stbi__jpeg *z) -{ - stbi__jpeg_reset(z); - if (!z->progressive) { - if (z->scan_n == 1) { - int i,j; - STBI_SIMD_ALIGN(short, data[64]); - int n = z->order[0]; - // non-interleaved data, we just need to process one block at a time, - // in trivial scanline order - // number of blocks to do just depends on how many actual "pixels" this - // component has, independent of interleaved MCU blocking and such - int w = (z->img_comp[n].x+7) >> 3; - int h = (z->img_comp[n].y+7) >> 3; - for (j=0; j < h; ++j) { - for (i=0; i < w; ++i) { - int ha = z->img_comp[n].ha; - if (!stbi__jpeg_decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+ha, z->fast_ac[ha], n, z->dequant[z->img_comp[n].tq])) return 0; - z->idct_block_kernel(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data); - // every data block is an MCU, so countdown the restart interval - if (--z->todo <= 0) { - if (z->code_bits < 24) stbi__grow_buffer_unsafe(z); - // if it's NOT a restart, then just bail, so we get corrupt data - // rather than no data - if (!STBI__RESTART(z->marker)) return 1; - stbi__jpeg_reset(z); - } - } - } - return 1; - } else { // interleaved - int i,j,k,x,y; - STBI_SIMD_ALIGN(short, data[64]); - for (j=0; j < z->img_mcu_y; ++j) { - for (i=0; i < z->img_mcu_x; ++i) { - // scan an interleaved mcu... process scan_n components in order - for (k=0; k < z->scan_n; ++k) { - int n = z->order[k]; - // scan out an mcu's worth of this component; that's just determined - // by the basic H and V specified for the component - for (y=0; y < z->img_comp[n].v; ++y) { - for (x=0; x < z->img_comp[n].h; ++x) { - int x2 = (i*z->img_comp[n].h + x)*8; - int y2 = (j*z->img_comp[n].v + y)*8; - int ha = z->img_comp[n].ha; - if (!stbi__jpeg_decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+ha, z->fast_ac[ha], n, z->dequant[z->img_comp[n].tq])) return 0; - z->idct_block_kernel(z->img_comp[n].data+z->img_comp[n].w2*y2+x2, z->img_comp[n].w2, data); - } - } - } - // after all interleaved components, that's an interleaved MCU, - // so now count down the restart interval - if (--z->todo <= 0) { - if (z->code_bits < 24) stbi__grow_buffer_unsafe(z); - if (!STBI__RESTART(z->marker)) return 1; - stbi__jpeg_reset(z); - } - } - } - return 1; - } - } else { - if (z->scan_n == 1) { - int i,j; - int n = z->order[0]; - // non-interleaved data, we just need to process one block at a time, - // in trivial scanline order - // number of blocks to do just depends on how many actual "pixels" this - // component has, independent of interleaved MCU blocking and such - int w = (z->img_comp[n].x+7) >> 3; - int h = (z->img_comp[n].y+7) >> 3; - for (j=0; j < h; ++j) { - for (i=0; i < w; ++i) { - short *data = z->img_comp[n].coeff + 64 * (i + j * z->img_comp[n].coeff_w); - if (z->spec_start == 0) { - if (!stbi__jpeg_decode_block_prog_dc(z, data, &z->huff_dc[z->img_comp[n].hd], n)) - return 0; - } else { - int ha = z->img_comp[n].ha; - if (!stbi__jpeg_decode_block_prog_ac(z, data, &z->huff_ac[ha], z->fast_ac[ha])) - return 0; - } - // every data block is an MCU, so countdown the restart interval - if (--z->todo <= 0) { - if (z->code_bits < 24) stbi__grow_buffer_unsafe(z); - if (!STBI__RESTART(z->marker)) return 1; - stbi__jpeg_reset(z); - } - } - } - return 1; - } else { // interleaved - int i,j,k,x,y; - for (j=0; j < z->img_mcu_y; ++j) { - for (i=0; i < z->img_mcu_x; ++i) { - // scan an interleaved mcu... process scan_n components in order - for (k=0; k < z->scan_n; ++k) { - int n = z->order[k]; - // scan out an mcu's worth of this component; that's just determined - // by the basic H and V specified for the component - for (y=0; y < z->img_comp[n].v; ++y) { - for (x=0; x < z->img_comp[n].h; ++x) { - int x2 = (i*z->img_comp[n].h + x); - int y2 = (j*z->img_comp[n].v + y); - short *data = z->img_comp[n].coeff + 64 * (x2 + y2 * z->img_comp[n].coeff_w); - if (!stbi__jpeg_decode_block_prog_dc(z, data, &z->huff_dc[z->img_comp[n].hd], n)) - return 0; - } - } - } - // after all interleaved components, that's an interleaved MCU, - // so now count down the restart interval - if (--z->todo <= 0) { - if (z->code_bits < 24) stbi__grow_buffer_unsafe(z); - if (!STBI__RESTART(z->marker)) return 1; - stbi__jpeg_reset(z); - } - } - } - return 1; - } - } -} - -static void stbi__jpeg_dequantize(short *data, stbi__uint16 *dequant) -{ - int i; - for (i=0; i < 64; ++i) - data[i] *= dequant[i]; -} - -static void stbi__jpeg_finish(stbi__jpeg *z) -{ - if (z->progressive) { - // dequantize and idct the data - int i,j,n; - for (n=0; n < z->s->img_n; ++n) { - int w = (z->img_comp[n].x+7) >> 3; - int h = (z->img_comp[n].y+7) >> 3; - for (j=0; j < h; ++j) { - for (i=0; i < w; ++i) { - short *data = z->img_comp[n].coeff + 64 * (i + j * z->img_comp[n].coeff_w); - stbi__jpeg_dequantize(data, z->dequant[z->img_comp[n].tq]); - z->idct_block_kernel(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data); - } - } - } - } -} - -static int stbi__process_marker(stbi__jpeg *z, int m) -{ - int L; - switch (m) { - case STBI__MARKER_none: // no marker found - return stbi__err("expected marker","Corrupt JPEG"); - - case 0xDD: // DRI - specify restart interval - if (stbi__get16be(z->s) != 4) return stbi__err("bad DRI len","Corrupt JPEG"); - z->restart_interval = stbi__get16be(z->s); - return 1; - - case 0xDB: // DQT - define quantization table - L = stbi__get16be(z->s)-2; - while (L > 0) { - int q = stbi__get8(z->s); - int p = q >> 4, sixteen = (p != 0); - int t = q & 15,i; - if (p != 0 && p != 1) return stbi__err("bad DQT type","Corrupt JPEG"); - if (t > 3) return stbi__err("bad DQT table","Corrupt JPEG"); - - for (i=0; i < 64; ++i) - z->dequant[t][stbi__jpeg_dezigzag[i]] = (stbi__uint16)(sixteen ? stbi__get16be(z->s) : stbi__get8(z->s)); - L -= (sixteen ? 129 : 65); - } - return L==0; - - case 0xC4: // DHT - define huffman table - L = stbi__get16be(z->s)-2; - while (L > 0) { - stbi_uc *v; - int sizes[16],i,n=0; - int q = stbi__get8(z->s); - int tc = q >> 4; - int th = q & 15; - if (tc > 1 || th > 3) return stbi__err("bad DHT header","Corrupt JPEG"); - for (i=0; i < 16; ++i) { - sizes[i] = stbi__get8(z->s); - n += sizes[i]; - } - L -= 17; - if (tc == 0) { - if (!stbi__build_huffman(z->huff_dc+th, sizes)) return 0; - v = z->huff_dc[th].values; - } else { - if (!stbi__build_huffman(z->huff_ac+th, sizes)) return 0; - v = z->huff_ac[th].values; - } - for (i=0; i < n; ++i) - v[i] = stbi__get8(z->s); - if (tc != 0) - stbi__build_fast_ac(z->fast_ac[th], z->huff_ac + th); - L -= n; - } - return L==0; - } - - // check for comment block or APP blocks - if ((m >= 0xE0 && m <= 0xEF) || m == 0xFE) { - L = stbi__get16be(z->s); - if (L < 2) { - if (m == 0xFE) - return stbi__err("bad COM len","Corrupt JPEG"); - else - return stbi__err("bad APP len","Corrupt JPEG"); - } - L -= 2; - - if (m == 0xE0 && L >= 5) { // JFIF APP0 segment - static const unsigned char tag[5] = {'J','F','I','F','\0'}; - int ok = 1; - int i; - for (i=0; i < 5; ++i) - if (stbi__get8(z->s) != tag[i]) - ok = 0; - L -= 5; - if (ok) - z->jfif = 1; - } else if (m == 0xEE && L >= 12) { // Adobe APP14 segment - static const unsigned char tag[6] = {'A','d','o','b','e','\0'}; - int ok = 1; - int i; - for (i=0; i < 6; ++i) - if (stbi__get8(z->s) != tag[i]) - ok = 0; - L -= 6; - if (ok) { - stbi__get8(z->s); // version - stbi__get16be(z->s); // flags0 - stbi__get16be(z->s); // flags1 - z->app14_color_transform = stbi__get8(z->s); // color transform - L -= 6; - } - } - - stbi__skip(z->s, L); - return 1; - } - - return stbi__err("unknown marker","Corrupt JPEG"); -} - -// after we see SOS -static int stbi__process_scan_header(stbi__jpeg *z) -{ - int i; - int Ls = stbi__get16be(z->s); - z->scan_n = stbi__get8(z->s); - if (z->scan_n < 1 || z->scan_n > 4 || z->scan_n > (int) z->s->img_n) return stbi__err("bad SOS component count","Corrupt JPEG"); - if (Ls != 6+2*z->scan_n) return stbi__err("bad SOS len","Corrupt JPEG"); - for (i=0; i < z->scan_n; ++i) { - int id = stbi__get8(z->s), which; - int q = stbi__get8(z->s); - for (which = 0; which < z->s->img_n; ++which) - if (z->img_comp[which].id == id) - break; - if (which == z->s->img_n) return 0; // no match - z->img_comp[which].hd = q >> 4; if (z->img_comp[which].hd > 3) return stbi__err("bad DC huff","Corrupt JPEG"); - z->img_comp[which].ha = q & 15; if (z->img_comp[which].ha > 3) return stbi__err("bad AC huff","Corrupt JPEG"); - z->order[i] = which; - } - - { - int aa; - z->spec_start = stbi__get8(z->s); - z->spec_end = stbi__get8(z->s); // should be 63, but might be 0 - aa = stbi__get8(z->s); - z->succ_high = (aa >> 4); - z->succ_low = (aa & 15); - if (z->progressive) { - if (z->spec_start > 63 || z->spec_end > 63 || z->spec_start > z->spec_end || z->succ_high > 13 || z->succ_low > 13) - return stbi__err("bad SOS", "Corrupt JPEG"); - } else { - if (z->spec_start != 0) return stbi__err("bad SOS","Corrupt JPEG"); - if (z->succ_high != 0 || z->succ_low != 0) return stbi__err("bad SOS","Corrupt JPEG"); - z->spec_end = 63; - } - } - - return 1; -} - -static int stbi__free_jpeg_components(stbi__jpeg *z, int ncomp, int why) -{ - int i; - for (i=0; i < ncomp; ++i) { - if (z->img_comp[i].raw_data) { - STBI_FREE(z->img_comp[i].raw_data); - z->img_comp[i].raw_data = NULL; - z->img_comp[i].data = NULL; - } - if (z->img_comp[i].raw_coeff) { - STBI_FREE(z->img_comp[i].raw_coeff); - z->img_comp[i].raw_coeff = 0; - z->img_comp[i].coeff = 0; - } - if (z->img_comp[i].linebuf) { - STBI_FREE(z->img_comp[i].linebuf); - z->img_comp[i].linebuf = NULL; - } - } - return why; -} - -static int stbi__process_frame_header(stbi__jpeg *z, int scan) -{ - stbi__context *s = z->s; - int Lf,p,i,q, h_max=1,v_max=1,c; - Lf = stbi__get16be(s); if (Lf < 11) return stbi__err("bad SOF len","Corrupt JPEG"); // JPEG - p = stbi__get8(s); if (p != 8) return stbi__err("only 8-bit","JPEG format not supported: 8-bit only"); // JPEG baseline - s->img_y = stbi__get16be(s); if (s->img_y == 0) return stbi__err("no header height", "JPEG format not supported: delayed height"); // Legal, but we don't handle it--but neither does IJG - s->img_x = stbi__get16be(s); if (s->img_x == 0) return stbi__err("0 width","Corrupt JPEG"); // JPEG requires - c = stbi__get8(s); - if (c != 3 && c != 1 && c != 4) return stbi__err("bad component count","Corrupt JPEG"); - s->img_n = c; - for (i=0; i < c; ++i) { - z->img_comp[i].data = NULL; - z->img_comp[i].linebuf = NULL; - } - - if (Lf != 8+3*s->img_n) return stbi__err("bad SOF len","Corrupt JPEG"); - - z->rgb = 0; - for (i=0; i < s->img_n; ++i) { - static unsigned char rgb[3] = { 'R', 'G', 'B' }; - z->img_comp[i].id = stbi__get8(s); - if (s->img_n == 3 && z->img_comp[i].id == rgb[i]) - ++z->rgb; - q = stbi__get8(s); - z->img_comp[i].h = (q >> 4); if (!z->img_comp[i].h || z->img_comp[i].h > 4) return stbi__err("bad H","Corrupt JPEG"); - z->img_comp[i].v = q & 15; if (!z->img_comp[i].v || z->img_comp[i].v > 4) return stbi__err("bad V","Corrupt JPEG"); - z->img_comp[i].tq = stbi__get8(s); if (z->img_comp[i].tq > 3) return stbi__err("bad TQ","Corrupt JPEG"); - } - - if (scan != STBI__SCAN_load) return 1; - - if (!stbi__mad3sizes_valid(s->img_x, s->img_y, s->img_n, 0)) return stbi__err("too large", "Image too large to decode"); - - for (i=0; i < s->img_n; ++i) { - if (z->img_comp[i].h > h_max) h_max = z->img_comp[i].h; - if (z->img_comp[i].v > v_max) v_max = z->img_comp[i].v; - } - - // compute interleaved mcu info - z->img_h_max = h_max; - z->img_v_max = v_max; - z->img_mcu_w = h_max * 8; - z->img_mcu_h = v_max * 8; - // these sizes can't be more than 17 bits - z->img_mcu_x = (s->img_x + z->img_mcu_w-1) / z->img_mcu_w; - z->img_mcu_y = (s->img_y + z->img_mcu_h-1) / z->img_mcu_h; - - for (i=0; i < s->img_n; ++i) { - // number of effective pixels (e.g. for non-interleaved MCU) - z->img_comp[i].x = (s->img_x * z->img_comp[i].h + h_max-1) / h_max; - z->img_comp[i].y = (s->img_y * z->img_comp[i].v + v_max-1) / v_max; - // to simplify generation, we'll allocate enough memory to decode - // the bogus oversized data from using interleaved MCUs and their - // big blocks (e.g. a 16x16 iMCU on an image of width 33); we won't - // discard the extra data until colorspace conversion - // - // img_mcu_x, img_mcu_y: <=17 bits; comp[i].h and .v are <=4 (checked earlier) - // so these muls can't overflow with 32-bit ints (which we require) - z->img_comp[i].w2 = z->img_mcu_x * z->img_comp[i].h * 8; - z->img_comp[i].h2 = z->img_mcu_y * z->img_comp[i].v * 8; - z->img_comp[i].coeff = 0; - z->img_comp[i].raw_coeff = 0; - z->img_comp[i].linebuf = NULL; - z->img_comp[i].raw_data = stbi__malloc_mad2(z->img_comp[i].w2, z->img_comp[i].h2, 15); - if (z->img_comp[i].raw_data == NULL) - return stbi__free_jpeg_components(z, i+1, stbi__err("outofmem", "Out of memory")); - // align blocks for idct using mmx/sse - z->img_comp[i].data = (stbi_uc*) (((size_t) z->img_comp[i].raw_data + 15) & ~15); - if (z->progressive) { - // w2, h2 are multiples of 8 (see above) - z->img_comp[i].coeff_w = z->img_comp[i].w2 / 8; - z->img_comp[i].coeff_h = z->img_comp[i].h2 / 8; - z->img_comp[i].raw_coeff = stbi__malloc_mad3(z->img_comp[i].w2, z->img_comp[i].h2, sizeof(short), 15); - if (z->img_comp[i].raw_coeff == NULL) - return stbi__free_jpeg_components(z, i+1, stbi__err("outofmem", "Out of memory")); - z->img_comp[i].coeff = (short*) (((size_t) z->img_comp[i].raw_coeff + 15) & ~15); - } - } - - return 1; -} - -// use comparisons since in some cases we handle more than one case (e.g. SOF) -#define stbi__DNL(x) ((x) == 0xdc) -#define stbi__SOI(x) ((x) == 0xd8) -#define stbi__EOI(x) ((x) == 0xd9) -#define stbi__SOF(x) ((x) == 0xc0 || (x) == 0xc1 || (x) == 0xc2) -#define stbi__SOS(x) ((x) == 0xda) - -#define stbi__SOF_progressive(x) ((x) == 0xc2) - -static int stbi__decode_jpeg_header(stbi__jpeg *z, int scan) -{ - int m; - z->jfif = 0; - z->app14_color_transform = -1; // valid values are 0,1,2 - z->marker = STBI__MARKER_none; // initialize cached marker to empty - m = stbi__get_marker(z); - if (!stbi__SOI(m)) return stbi__err("no SOI","Corrupt JPEG"); - if (scan == STBI__SCAN_type) return 1; - m = stbi__get_marker(z); - while (!stbi__SOF(m)) { - if (!stbi__process_marker(z,m)) return 0; - m = stbi__get_marker(z); - while (m == STBI__MARKER_none) { - // some files have extra padding after their blocks, so ok, we'll scan - if (stbi__at_eof(z->s)) return stbi__err("no SOF", "Corrupt JPEG"); - m = stbi__get_marker(z); - } - } - z->progressive = stbi__SOF_progressive(m); - if (!stbi__process_frame_header(z, scan)) return 0; - return 1; -} - -// decode image to YCbCr format -static int stbi__decode_jpeg_image(stbi__jpeg *j) -{ - int m; - for (m = 0; m < 4; m++) { - j->img_comp[m].raw_data = NULL; - j->img_comp[m].raw_coeff = NULL; - } - j->restart_interval = 0; - if (!stbi__decode_jpeg_header(j, STBI__SCAN_load)) return 0; - m = stbi__get_marker(j); - while (!stbi__EOI(m)) { - if (stbi__SOS(m)) { - if (!stbi__process_scan_header(j)) return 0; - if (!stbi__parse_entropy_coded_data(j)) return 0; - if (j->marker == STBI__MARKER_none ) { - // handle 0s at the end of image data from IP Kamera 9060 - while (!stbi__at_eof(j->s)) { - int x = stbi__get8(j->s); - if (x == 255) { - j->marker = stbi__get8(j->s); - break; - } - } - // if we reach eof without hitting a marker, stbi__get_marker() below will fail and we'll eventually return 0 - } - } else if (stbi__DNL(m)) { - int Ld = stbi__get16be(j->s); - stbi__uint32 NL = stbi__get16be(j->s); - if (Ld != 4) stbi__err("bad DNL len", "Corrupt JPEG"); - if (NL != j->s->img_y) stbi__err("bad DNL height", "Corrupt JPEG"); - } else { - if (!stbi__process_marker(j, m)) return 0; - } - m = stbi__get_marker(j); - } - if (j->progressive) - stbi__jpeg_finish(j); - return 1; -} - -// static jfif-centered resampling (across block boundaries) - -typedef stbi_uc *(*resample_row_func)(stbi_uc *out, stbi_uc *in0, stbi_uc *in1, - int w, int hs); - -#define stbi__div4(x) ((stbi_uc) ((x) >> 2)) - -static stbi_uc *resample_row_1(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) -{ - STBI_NOTUSED(out); - STBI_NOTUSED(in_far); - STBI_NOTUSED(w); - STBI_NOTUSED(hs); - return in_near; -} - -static stbi_uc* stbi__resample_row_v_2(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) -{ - // need to generate two samples vertically for every one in input - int i; - STBI_NOTUSED(hs); - for (i=0; i < w; ++i) - out[i] = stbi__div4(3*in_near[i] + in_far[i] + 2); - return out; -} - -static stbi_uc* stbi__resample_row_h_2(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) -{ - // need to generate two samples horizontally for every one in input - int i; - stbi_uc *input = in_near; - - if (w == 1) { - // if only one sample, can't do any interpolation - out[0] = out[1] = input[0]; - return out; - } - - out[0] = input[0]; - out[1] = stbi__div4(input[0]*3 + input[1] + 2); - for (i=1; i < w-1; ++i) { - int n = 3*input[i]+2; - out[i*2+0] = stbi__div4(n+input[i-1]); - out[i*2+1] = stbi__div4(n+input[i+1]); - } - out[i*2+0] = stbi__div4(input[w-2]*3 + input[w-1] + 2); - out[i*2+1] = input[w-1]; - - STBI_NOTUSED(in_far); - STBI_NOTUSED(hs); - - return out; -} - -#define stbi__div16(x) ((stbi_uc) ((x) >> 4)) - -static stbi_uc *stbi__resample_row_hv_2(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) -{ - // need to generate 2x2 samples for every one in input - int i,t0,t1; - if (w == 1) { - out[0] = out[1] = stbi__div4(3*in_near[0] + in_far[0] + 2); - return out; - } - - t1 = 3*in_near[0] + in_far[0]; - out[0] = stbi__div4(t1+2); - for (i=1; i < w; ++i) { - t0 = t1; - t1 = 3*in_near[i]+in_far[i]; - out[i*2-1] = stbi__div16(3*t0 + t1 + 8); - out[i*2 ] = stbi__div16(3*t1 + t0 + 8); - } - out[w*2-1] = stbi__div4(t1+2); - - STBI_NOTUSED(hs); - - return out; -} - -#if defined(STBI_SSE2) || defined(STBI_NEON) -static stbi_uc *stbi__resample_row_hv_2_simd(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) -{ - // need to generate 2x2 samples for every one in input - int i=0,t0,t1; - - if (w == 1) { - out[0] = out[1] = stbi__div4(3*in_near[0] + in_far[0] + 2); - return out; - } - - t1 = 3*in_near[0] + in_far[0]; - // process groups of 8 pixels for as long as we can. - // note we can't handle the last pixel in a row in this loop - // because we need to handle the filter boundary conditions. - for (; i < ((w-1) & ~7); i += 8) { -#if defined(STBI_SSE2) - // load and perform the vertical filtering pass - // this uses 3*x + y = 4*x + (y - x) - __m128i zero = _mm_setzero_si128(); - __m128i farb = _mm_loadl_epi64((__m128i *) (in_far + i)); - __m128i nearb = _mm_loadl_epi64((__m128i *) (in_near + i)); - __m128i farw = _mm_unpacklo_epi8(farb, zero); - __m128i nearw = _mm_unpacklo_epi8(nearb, zero); - __m128i diff = _mm_sub_epi16(farw, nearw); - __m128i nears = _mm_slli_epi16(nearw, 2); - __m128i curr = _mm_add_epi16(nears, diff); // current row - - // horizontal filter works the same based on shifted vers of current - // row. "prev" is current row shifted right by 1 pixel; we need to - // insert the previous pixel value (from t1). - // "next" is current row shifted left by 1 pixel, with first pixel - // of next block of 8 pixels added in. - __m128i prv0 = _mm_slli_si128(curr, 2); - __m128i nxt0 = _mm_srli_si128(curr, 2); - __m128i prev = _mm_insert_epi16(prv0, t1, 0); - __m128i next = _mm_insert_epi16(nxt0, 3*in_near[i+8] + in_far[i+8], 7); - - // horizontal filter, polyphase implementation since it's convenient: - // even pixels = 3*cur + prev = cur*4 + (prev - cur) - // odd pixels = 3*cur + next = cur*4 + (next - cur) - // note the shared term. - __m128i bias = _mm_set1_epi16(8); - __m128i curs = _mm_slli_epi16(curr, 2); - __m128i prvd = _mm_sub_epi16(prev, curr); - __m128i nxtd = _mm_sub_epi16(next, curr); - __m128i curb = _mm_add_epi16(curs, bias); - __m128i even = _mm_add_epi16(prvd, curb); - __m128i odd = _mm_add_epi16(nxtd, curb); - - // interleave even and odd pixels, then undo scaling. - __m128i int0 = _mm_unpacklo_epi16(even, odd); - __m128i int1 = _mm_unpackhi_epi16(even, odd); - __m128i de0 = _mm_srli_epi16(int0, 4); - __m128i de1 = _mm_srli_epi16(int1, 4); - - // pack and write output - __m128i outv = _mm_packus_epi16(de0, de1); - _mm_storeu_si128((__m128i *) (out + i*2), outv); -#elif defined(STBI_NEON) - // load and perform the vertical filtering pass - // this uses 3*x + y = 4*x + (y - x) - uint8x8_t farb = vld1_u8(in_far + i); - uint8x8_t nearb = vld1_u8(in_near + i); - int16x8_t diff = vreinterpretq_s16_u16(vsubl_u8(farb, nearb)); - int16x8_t nears = vreinterpretq_s16_u16(vshll_n_u8(nearb, 2)); - int16x8_t curr = vaddq_s16(nears, diff); // current row - - // horizontal filter works the same based on shifted vers of current - // row. "prev" is current row shifted right by 1 pixel; we need to - // insert the previous pixel value (from t1). - // "next" is current row shifted left by 1 pixel, with first pixel - // of next block of 8 pixels added in. - int16x8_t prv0 = vextq_s16(curr, curr, 7); - int16x8_t nxt0 = vextq_s16(curr, curr, 1); - int16x8_t prev = vsetq_lane_s16(t1, prv0, 0); - int16x8_t next = vsetq_lane_s16(3*in_near[i+8] + in_far[i+8], nxt0, 7); - - // horizontal filter, polyphase implementation since it's convenient: - // even pixels = 3*cur + prev = cur*4 + (prev - cur) - // odd pixels = 3*cur + next = cur*4 + (next - cur) - // note the shared term. - int16x8_t curs = vshlq_n_s16(curr, 2); - int16x8_t prvd = vsubq_s16(prev, curr); - int16x8_t nxtd = vsubq_s16(next, curr); - int16x8_t even = vaddq_s16(curs, prvd); - int16x8_t odd = vaddq_s16(curs, nxtd); - - // undo scaling and round, then store with even/odd phases interleaved - uint8x8x2_t o; - o.val[0] = vqrshrun_n_s16(even, 4); - o.val[1] = vqrshrun_n_s16(odd, 4); - vst2_u8(out + i*2, o); -#endif - - // "previous" value for next iter - t1 = 3*in_near[i+7] + in_far[i+7]; - } - - t0 = t1; - t1 = 3*in_near[i] + in_far[i]; - out[i*2] = stbi__div16(3*t1 + t0 + 8); - - for (++i; i < w; ++i) { - t0 = t1; - t1 = 3*in_near[i]+in_far[i]; - out[i*2-1] = stbi__div16(3*t0 + t1 + 8); - out[i*2 ] = stbi__div16(3*t1 + t0 + 8); - } - out[w*2-1] = stbi__div4(t1+2); - - STBI_NOTUSED(hs); - - return out; -} -#endif - -static stbi_uc *stbi__resample_row_generic(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) -{ - // resample with nearest-neighbor - int i,j; - STBI_NOTUSED(in_far); - for (i=0; i < w; ++i) - for (j=0; j < hs; ++j) - out[i*hs+j] = in_near[i]; - return out; -} - -// this is a reduced-precision calculation of YCbCr-to-RGB introduced -// to make sure the code produces the same results in both SIMD and scalar -#define stbi__float2fixed(x) (((int) ((x) * 4096.0f + 0.5f)) << 8) -static void stbi__YCbCr_to_RGB_row(stbi_uc *out, const stbi_uc *y, const stbi_uc *pcb, const stbi_uc *pcr, int count, int step) -{ - int i; - for (i=0; i < count; ++i) { - int y_fixed = (y[i] << 20) + (1<<19); // rounding - int r,g,b; - int cr = pcr[i] - 128; - int cb = pcb[i] - 128; - r = y_fixed + cr* stbi__float2fixed(1.40200f); - g = y_fixed + (cr*-stbi__float2fixed(0.71414f)) + ((cb*-stbi__float2fixed(0.34414f)) & 0xffff0000); - b = y_fixed + cb* stbi__float2fixed(1.77200f); - r >>= 20; - g >>= 20; - b >>= 20; - if ((unsigned) r > 255) { if (r < 0) r = 0; else r = 255; } - if ((unsigned) g > 255) { if (g < 0) g = 0; else g = 255; } - if ((unsigned) b > 255) { if (b < 0) b = 0; else b = 255; } - out[0] = (stbi_uc)r; - out[1] = (stbi_uc)g; - out[2] = (stbi_uc)b; - out[3] = 255; - out += step; - } -} - -#if defined(STBI_SSE2) || defined(STBI_NEON) -static void stbi__YCbCr_to_RGB_simd(stbi_uc *out, stbi_uc const *y, stbi_uc const *pcb, stbi_uc const *pcr, int count, int step) -{ - int i = 0; - -#ifdef STBI_SSE2 - // step == 3 is pretty ugly on the final interleave, and i'm not convinced - // it's useful in practice (you wouldn't use it for textures, for example). - // so just accelerate step == 4 case. - if (step == 4) { - // this is a fairly straightforward implementation and not super-optimized. - __m128i signflip = _mm_set1_epi8(-0x80); - __m128i cr_const0 = _mm_set1_epi16( (short) ( 1.40200f*4096.0f+0.5f)); - __m128i cr_const1 = _mm_set1_epi16( - (short) ( 0.71414f*4096.0f+0.5f)); - __m128i cb_const0 = _mm_set1_epi16( - (short) ( 0.34414f*4096.0f+0.5f)); - __m128i cb_const1 = _mm_set1_epi16( (short) ( 1.77200f*4096.0f+0.5f)); - __m128i y_bias = _mm_set1_epi8((char) (unsigned char) 128); - __m128i xw = _mm_set1_epi16(255); // alpha channel - - for (; i+7 < count; i += 8) { - // load - __m128i y_bytes = _mm_loadl_epi64((__m128i *) (y+i)); - __m128i cr_bytes = _mm_loadl_epi64((__m128i *) (pcr+i)); - __m128i cb_bytes = _mm_loadl_epi64((__m128i *) (pcb+i)); - __m128i cr_biased = _mm_xor_si128(cr_bytes, signflip); // -128 - __m128i cb_biased = _mm_xor_si128(cb_bytes, signflip); // -128 - - // unpack to short (and left-shift cr, cb by 8) - __m128i yw = _mm_unpacklo_epi8(y_bias, y_bytes); - __m128i crw = _mm_unpacklo_epi8(_mm_setzero_si128(), cr_biased); - __m128i cbw = _mm_unpacklo_epi8(_mm_setzero_si128(), cb_biased); - - // color transform - __m128i yws = _mm_srli_epi16(yw, 4); - __m128i cr0 = _mm_mulhi_epi16(cr_const0, crw); - __m128i cb0 = _mm_mulhi_epi16(cb_const0, cbw); - __m128i cb1 = _mm_mulhi_epi16(cbw, cb_const1); - __m128i cr1 = _mm_mulhi_epi16(crw, cr_const1); - __m128i rws = _mm_add_epi16(cr0, yws); - __m128i gwt = _mm_add_epi16(cb0, yws); - __m128i bws = _mm_add_epi16(yws, cb1); - __m128i gws = _mm_add_epi16(gwt, cr1); - - // descale - __m128i rw = _mm_srai_epi16(rws, 4); - __m128i bw = _mm_srai_epi16(bws, 4); - __m128i gw = _mm_srai_epi16(gws, 4); - - // back to byte, set up for transpose - __m128i brb = _mm_packus_epi16(rw, bw); - __m128i gxb = _mm_packus_epi16(gw, xw); - - // transpose to interleave channels - __m128i t0 = _mm_unpacklo_epi8(brb, gxb); - __m128i t1 = _mm_unpackhi_epi8(brb, gxb); - __m128i o0 = _mm_unpacklo_epi16(t0, t1); - __m128i o1 = _mm_unpackhi_epi16(t0, t1); - - // store - _mm_storeu_si128((__m128i *) (out + 0), o0); - _mm_storeu_si128((__m128i *) (out + 16), o1); - out += 32; - } - } -#endif - -#ifdef STBI_NEON - // in this version, step=3 support would be easy to add. but is there demand? - if (step == 4) { - // this is a fairly straightforward implementation and not super-optimized. - uint8x8_t signflip = vdup_n_u8(0x80); - int16x8_t cr_const0 = vdupq_n_s16( (short) ( 1.40200f*4096.0f+0.5f)); - int16x8_t cr_const1 = vdupq_n_s16( - (short) ( 0.71414f*4096.0f+0.5f)); - int16x8_t cb_const0 = vdupq_n_s16( - (short) ( 0.34414f*4096.0f+0.5f)); - int16x8_t cb_const1 = vdupq_n_s16( (short) ( 1.77200f*4096.0f+0.5f)); - - for (; i+7 < count; i += 8) { - // load - uint8x8_t y_bytes = vld1_u8(y + i); - uint8x8_t cr_bytes = vld1_u8(pcr + i); - uint8x8_t cb_bytes = vld1_u8(pcb + i); - int8x8_t cr_biased = vreinterpret_s8_u8(vsub_u8(cr_bytes, signflip)); - int8x8_t cb_biased = vreinterpret_s8_u8(vsub_u8(cb_bytes, signflip)); - - // expand to s16 - int16x8_t yws = vreinterpretq_s16_u16(vshll_n_u8(y_bytes, 4)); - int16x8_t crw = vshll_n_s8(cr_biased, 7); - int16x8_t cbw = vshll_n_s8(cb_biased, 7); - - // color transform - int16x8_t cr0 = vqdmulhq_s16(crw, cr_const0); - int16x8_t cb0 = vqdmulhq_s16(cbw, cb_const0); - int16x8_t cr1 = vqdmulhq_s16(crw, cr_const1); - int16x8_t cb1 = vqdmulhq_s16(cbw, cb_const1); - int16x8_t rws = vaddq_s16(yws, cr0); - int16x8_t gws = vaddq_s16(vaddq_s16(yws, cb0), cr1); - int16x8_t bws = vaddq_s16(yws, cb1); - - // undo scaling, round, convert to byte - uint8x8x4_t o; - o.val[0] = vqrshrun_n_s16(rws, 4); - o.val[1] = vqrshrun_n_s16(gws, 4); - o.val[2] = vqrshrun_n_s16(bws, 4); - o.val[3] = vdup_n_u8(255); - - // store, interleaving r/g/b/a - vst4_u8(out, o); - out += 8*4; - } - } -#endif - - for (; i < count; ++i) { - int y_fixed = (y[i] << 20) + (1<<19); // rounding - int r,g,b; - int cr = pcr[i] - 128; - int cb = pcb[i] - 128; - r = y_fixed + cr* stbi__float2fixed(1.40200f); - g = y_fixed + cr*-stbi__float2fixed(0.71414f) + ((cb*-stbi__float2fixed(0.34414f)) & 0xffff0000); - b = y_fixed + cb* stbi__float2fixed(1.77200f); - r >>= 20; - g >>= 20; - b >>= 20; - if ((unsigned) r > 255) { if (r < 0) r = 0; else r = 255; } - if ((unsigned) g > 255) { if (g < 0) g = 0; else g = 255; } - if ((unsigned) b > 255) { if (b < 0) b = 0; else b = 255; } - out[0] = (stbi_uc)r; - out[1] = (stbi_uc)g; - out[2] = (stbi_uc)b; - out[3] = 255; - out += step; - } -} -#endif - -// set up the kernels -static void stbi__setup_jpeg(stbi__jpeg *j) -{ - j->idct_block_kernel = stbi__idct_block; - j->YCbCr_to_RGB_kernel = stbi__YCbCr_to_RGB_row; - j->resample_row_hv_2_kernel = stbi__resample_row_hv_2; - -#ifdef STBI_SSE2 - if (stbi__sse2_available()) { - j->idct_block_kernel = stbi__idct_simd; - j->YCbCr_to_RGB_kernel = stbi__YCbCr_to_RGB_simd; - j->resample_row_hv_2_kernel = stbi__resample_row_hv_2_simd; - } -#endif - -#ifdef STBI_NEON - j->idct_block_kernel = stbi__idct_simd; - j->YCbCr_to_RGB_kernel = stbi__YCbCr_to_RGB_simd; - j->resample_row_hv_2_kernel = stbi__resample_row_hv_2_simd; -#endif -} - -// clean up the temporary component buffers -static void stbi__cleanup_jpeg(stbi__jpeg *j) -{ - stbi__free_jpeg_components(j, j->s->img_n, 0); -} - -typedef struct -{ - resample_row_func resample; - stbi_uc *line0,*line1; - int hs,vs; // expansion factor in each axis - int w_lores; // horizontal pixels pre-expansion - int ystep; // how far through vertical expansion we are - int ypos; // which pre-expansion row we're on -} stbi__resample; - -// fast 0..255 * 0..255 => 0..255 rounded multiplication -static stbi_uc stbi__blinn_8x8(stbi_uc x, stbi_uc y) -{ - unsigned int t = x*y + 128; - return (stbi_uc) ((t + (t >>8)) >> 8); -} - -static stbi_uc *load_jpeg_image(stbi__jpeg *z, int *out_x, int *out_y, int *comp, int req_comp) -{ - int n, decode_n, is_rgb; - z->s->img_n = 0; // make stbi__cleanup_jpeg safe - - // validate req_comp - if (req_comp < 0 || req_comp > 4) return stbi__errpuc("bad req_comp", "Internal error"); - - // load a jpeg image from whichever source, but leave in YCbCr format - if (!stbi__decode_jpeg_image(z)) { stbi__cleanup_jpeg(z); return NULL; } - - // determine actual number of components to generate - n = req_comp ? req_comp : z->s->img_n >= 3 ? 3 : 1; - - is_rgb = z->s->img_n == 3 && (z->rgb == 3 || (z->app14_color_transform == 0 && !z->jfif)); - - if (z->s->img_n == 3 && n < 3 && !is_rgb) - decode_n = 1; - else - decode_n = z->s->img_n; - - // resample and color-convert - { - int k; - unsigned int i,j; - stbi_uc *output; - stbi_uc *coutput[4]; - - stbi__resample res_comp[4]; - - for (k=0; k < decode_n; ++k) { - stbi__resample *r = &res_comp[k]; - - // allocate line buffer big enough for upsampling off the edges - // with upsample factor of 4 - z->img_comp[k].linebuf = (stbi_uc *) stbi__malloc(z->s->img_x + 3); - if (!z->img_comp[k].linebuf) { stbi__cleanup_jpeg(z); return stbi__errpuc("outofmem", "Out of memory"); } - - r->hs = z->img_h_max / z->img_comp[k].h; - r->vs = z->img_v_max / z->img_comp[k].v; - r->ystep = r->vs >> 1; - r->w_lores = (z->s->img_x + r->hs-1) / r->hs; - r->ypos = 0; - r->line0 = r->line1 = z->img_comp[k].data; - - if (r->hs == 1 && r->vs == 1) r->resample = resample_row_1; - else if (r->hs == 1 && r->vs == 2) r->resample = stbi__resample_row_v_2; - else if (r->hs == 2 && r->vs == 1) r->resample = stbi__resample_row_h_2; - else if (r->hs == 2 && r->vs == 2) r->resample = z->resample_row_hv_2_kernel; - else r->resample = stbi__resample_row_generic; - } - - // can't error after this so, this is safe - output = (stbi_uc *) stbi__malloc_mad3(n, z->s->img_x, z->s->img_y, 1); - if (!output) { stbi__cleanup_jpeg(z); return stbi__errpuc("outofmem", "Out of memory"); } - - // now go ahead and resample - for (j=0; j < z->s->img_y; ++j) { - stbi_uc *out = output + n * z->s->img_x * j; - for (k=0; k < decode_n; ++k) { - stbi__resample *r = &res_comp[k]; - int y_bot = r->ystep >= (r->vs >> 1); - coutput[k] = r->resample(z->img_comp[k].linebuf, - y_bot ? r->line1 : r->line0, - y_bot ? r->line0 : r->line1, - r->w_lores, r->hs); - if (++r->ystep >= r->vs) { - r->ystep = 0; - r->line0 = r->line1; - if (++r->ypos < z->img_comp[k].y) - r->line1 += z->img_comp[k].w2; - } - } - if (n >= 3) { - stbi_uc *y = coutput[0]; - if (z->s->img_n == 3) { - if (is_rgb) { - for (i=0; i < z->s->img_x; ++i) { - out[0] = y[i]; - out[1] = coutput[1][i]; - out[2] = coutput[2][i]; - out[3] = 255; - out += n; - } - } else { - z->YCbCr_to_RGB_kernel(out, y, coutput[1], coutput[2], z->s->img_x, n); - } - } else if (z->s->img_n == 4) { - if (z->app14_color_transform == 0) { // CMYK - for (i=0; i < z->s->img_x; ++i) { - stbi_uc m = coutput[3][i]; - out[0] = stbi__blinn_8x8(coutput[0][i], m); - out[1] = stbi__blinn_8x8(coutput[1][i], m); - out[2] = stbi__blinn_8x8(coutput[2][i], m); - out[3] = 255; - out += n; - } - } else if (z->app14_color_transform == 2) { // YCCK - z->YCbCr_to_RGB_kernel(out, y, coutput[1], coutput[2], z->s->img_x, n); - for (i=0; i < z->s->img_x; ++i) { - stbi_uc m = coutput[3][i]; - out[0] = stbi__blinn_8x8(255 - out[0], m); - out[1] = stbi__blinn_8x8(255 - out[1], m); - out[2] = stbi__blinn_8x8(255 - out[2], m); - out += n; - } - } else { // YCbCr + alpha? Ignore the fourth channel for now - z->YCbCr_to_RGB_kernel(out, y, coutput[1], coutput[2], z->s->img_x, n); - } - } else - for (i=0; i < z->s->img_x; ++i) { - out[0] = out[1] = out[2] = y[i]; - out[3] = 255; // not used if n==3 - out += n; - } - } else { - if (is_rgb) { - if (n == 1) - for (i=0; i < z->s->img_x; ++i) - *out++ = stbi__compute_y(coutput[0][i], coutput[1][i], coutput[2][i]); - else { - for (i=0; i < z->s->img_x; ++i, out += 2) { - out[0] = stbi__compute_y(coutput[0][i], coutput[1][i], coutput[2][i]); - out[1] = 255; - } - } - } else if (z->s->img_n == 4 && z->app14_color_transform == 0) { - for (i=0; i < z->s->img_x; ++i) { - stbi_uc m = coutput[3][i]; - stbi_uc r = stbi__blinn_8x8(coutput[0][i], m); - stbi_uc g = stbi__blinn_8x8(coutput[1][i], m); - stbi_uc b = stbi__blinn_8x8(coutput[2][i], m); - out[0] = stbi__compute_y(r, g, b); - out[1] = 255; - out += n; - } - } else if (z->s->img_n == 4 && z->app14_color_transform == 2) { - for (i=0; i < z->s->img_x; ++i) { - out[0] = stbi__blinn_8x8(255 - coutput[0][i], coutput[3][i]); - out[1] = 255; - out += n; - } - } else { - stbi_uc *y = coutput[0]; - if (n == 1) - for (i=0; i < z->s->img_x; ++i) out[i] = y[i]; - else - for (i=0; i < z->s->img_x; ++i) *out++ = y[i], *out++ = 255; - } - } - } - stbi__cleanup_jpeg(z); - *out_x = z->s->img_x; - *out_y = z->s->img_y; - if (comp) *comp = z->s->img_n >= 3 ? 3 : 1; // report original components, not output - return output; - } -} - -static void *stbi__jpeg_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) -{ - unsigned char* result; - stbi__jpeg* j = (stbi__jpeg*) stbi__malloc(sizeof(stbi__jpeg)); - STBI_NOTUSED(ri); - j->s = s; - stbi__setup_jpeg(j); - result = load_jpeg_image(j, x,y,comp,req_comp); - STBI_FREE(j); - return result; -} - -static int stbi__jpeg_test(stbi__context *s) -{ - int r; - stbi__jpeg* j = (stbi__jpeg*)stbi__malloc(sizeof(stbi__jpeg)); - j->s = s; - stbi__setup_jpeg(j); - r = stbi__decode_jpeg_header(j, STBI__SCAN_type); - stbi__rewind(s); - STBI_FREE(j); - return r; -} - -static int stbi__jpeg_info_raw(stbi__jpeg *j, int *x, int *y, int *comp) -{ - if (!stbi__decode_jpeg_header(j, STBI__SCAN_header)) { - stbi__rewind( j->s ); - return 0; - } - if (x) *x = j->s->img_x; - if (y) *y = j->s->img_y; - if (comp) *comp = j->s->img_n >= 3 ? 3 : 1; - return 1; -} - -static int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp) -{ - int result; - stbi__jpeg* j = (stbi__jpeg*) (stbi__malloc(sizeof(stbi__jpeg))); - j->s = s; - result = stbi__jpeg_info_raw(j, x, y, comp); - STBI_FREE(j); - return result; -} -#endif - -// public domain zlib decode v0.2 Sean Barrett 2006-11-18 -// simple implementation -// - all input must be provided in an upfront buffer -// - all output is written to a single output buffer (can malloc/realloc) -// performance -// - fast huffman - -#ifndef STBI_NO_ZLIB - -// fast-way is faster to check than jpeg huffman, but slow way is slower -#define STBI__ZFAST_BITS 9 // accelerate all cases in default tables -#define STBI__ZFAST_MASK ((1 << STBI__ZFAST_BITS) - 1) - -// zlib-style huffman encoding -// (jpegs packs from left, zlib from right, so can't share code) -typedef struct -{ - stbi__uint16 fast[1 << STBI__ZFAST_BITS]; - stbi__uint16 firstcode[16]; - int maxcode[17]; - stbi__uint16 firstsymbol[16]; - stbi_uc size[288]; - stbi__uint16 value[288]; -} stbi__zhuffman; - -stbi_inline static int stbi__bitreverse16(int n) -{ - n = ((n & 0xAAAA) >> 1) | ((n & 0x5555) << 1); - n = ((n & 0xCCCC) >> 2) | ((n & 0x3333) << 2); - n = ((n & 0xF0F0) >> 4) | ((n & 0x0F0F) << 4); - n = ((n & 0xFF00) >> 8) | ((n & 0x00FF) << 8); - return n; -} - -stbi_inline static int stbi__bit_reverse(int v, int bits) -{ - STBI_ASSERT(bits <= 16); - // to bit reverse n bits, reverse 16 and shift - // e.g. 11 bits, bit reverse and shift away 5 - return stbi__bitreverse16(v) >> (16-bits); -} - -static int stbi__zbuild_huffman(stbi__zhuffman *z, const stbi_uc *sizelist, int num) -{ - int i,k=0; - int code, next_code[16], sizes[17]; - - // DEFLATE spec for generating codes - memset(sizes, 0, sizeof(sizes)); - memset(z->fast, 0, sizeof(z->fast)); - for (i=0; i < num; ++i) - ++sizes[sizelist[i]]; - sizes[0] = 0; - for (i=1; i < 16; ++i) - if (sizes[i] > (1 << i)) - return stbi__err("bad sizes", "Corrupt PNG"); - code = 0; - for (i=1; i < 16; ++i) { - next_code[i] = code; - z->firstcode[i] = (stbi__uint16) code; - z->firstsymbol[i] = (stbi__uint16) k; - code = (code + sizes[i]); - if (sizes[i]) - if (code-1 >= (1 << i)) return stbi__err("bad codelengths","Corrupt PNG"); - z->maxcode[i] = code << (16-i); // preshift for inner loop - code <<= 1; - k += sizes[i]; - } - z->maxcode[16] = 0x10000; // sentinel - for (i=0; i < num; ++i) { - int s = sizelist[i]; - if (s) { - int c = next_code[s] - z->firstcode[s] + z->firstsymbol[s]; - stbi__uint16 fastv = (stbi__uint16) ((s << 9) | i); - z->size [c] = (stbi_uc ) s; - z->value[c] = (stbi__uint16) i; - if (s <= STBI__ZFAST_BITS) { - int j = stbi__bit_reverse(next_code[s],s); - while (j < (1 << STBI__ZFAST_BITS)) { - z->fast[j] = fastv; - j += (1 << s); - } - } - ++next_code[s]; - } - } - return 1; -} - -// zlib-from-memory implementation for PNG reading -// because PNG allows splitting the zlib stream arbitrarily, -// and it's annoying structurally to have PNG call ZLIB call PNG, -// we require PNG read all the IDATs and combine them into a single -// memory buffer - -typedef struct -{ - stbi_uc *zbuffer, *zbuffer_end; - int num_bits; - stbi__uint32 code_buffer; - - char *zout; - char *zout_start; - char *zout_end; - int z_expandable; - - stbi__zhuffman z_length, z_distance; -} stbi__zbuf; - -stbi_inline static stbi_uc stbi__zget8(stbi__zbuf *z) -{ - if (z->zbuffer >= z->zbuffer_end) return 0; - return *z->zbuffer++; -} - -static void stbi__fill_bits(stbi__zbuf *z) -{ - do { - STBI_ASSERT(z->code_buffer < (1U << z->num_bits)); - z->code_buffer |= (unsigned int) stbi__zget8(z) << z->num_bits; - z->num_bits += 8; - } while (z->num_bits <= 24); -} - -stbi_inline static unsigned int stbi__zreceive(stbi__zbuf *z, int n) -{ - unsigned int k; - if (z->num_bits < n) stbi__fill_bits(z); - k = z->code_buffer & ((1 << n) - 1); - z->code_buffer >>= n; - z->num_bits -= n; - return k; -} - -static int stbi__zhuffman_decode_slowpath(stbi__zbuf *a, stbi__zhuffman *z) -{ - int b,s,k; - // not resolved by fast table, so compute it the slow way - // use jpeg approach, which requires MSbits at top - k = stbi__bit_reverse(a->code_buffer, 16); - for (s=STBI__ZFAST_BITS+1; ; ++s) - if (k < z->maxcode[s]) - break; - if (s == 16) return -1; // invalid code! - // code size is s, so: - b = (k >> (16-s)) - z->firstcode[s] + z->firstsymbol[s]; - STBI_ASSERT(z->size[b] == s); - a->code_buffer >>= s; - a->num_bits -= s; - return z->value[b]; -} - -stbi_inline static int stbi__zhuffman_decode(stbi__zbuf *a, stbi__zhuffman *z) -{ - int b,s; - if (a->num_bits < 16) stbi__fill_bits(a); - b = z->fast[a->code_buffer & STBI__ZFAST_MASK]; - if (b) { - s = b >> 9; - a->code_buffer >>= s; - a->num_bits -= s; - return b & 511; - } - return stbi__zhuffman_decode_slowpath(a, z); -} - -static int stbi__zexpand(stbi__zbuf *z, char *zout, int n) // need to make room for n bytes -{ - char *q; - int cur, limit, old_limit; - z->zout = zout; - if (!z->z_expandable) return stbi__err("output buffer limit","Corrupt PNG"); - cur = (int) (z->zout - z->zout_start); - limit = old_limit = (int) (z->zout_end - z->zout_start); - while (cur + n > limit) - limit *= 2; - q = (char *) STBI_REALLOC_SIZED(z->zout_start, old_limit, limit); - STBI_NOTUSED(old_limit); - if (q == NULL) return stbi__err("outofmem", "Out of memory"); - z->zout_start = q; - z->zout = q + cur; - z->zout_end = q + limit; - return 1; -} - -static int stbi__zlength_base[31] = { - 3,4,5,6,7,8,9,10,11,13, - 15,17,19,23,27,31,35,43,51,59, - 67,83,99,115,131,163,195,227,258,0,0 }; - -static int stbi__zlength_extra[31]= -{ 0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0 }; - -static int stbi__zdist_base[32] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193, -257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0}; - -static int stbi__zdist_extra[32] = -{ 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; - -static int stbi__parse_huffman_block(stbi__zbuf *a) -{ - char *zout = a->zout; - for(;;) { - int z = stbi__zhuffman_decode(a, &a->z_length); - if (z < 256) { - if (z < 0) return stbi__err("bad huffman code","Corrupt PNG"); // error in huffman codes - if (zout >= a->zout_end) { - if (!stbi__zexpand(a, zout, 1)) return 0; - zout = a->zout; - } - *zout++ = (char) z; - } else { - stbi_uc *p; - int len,dist; - if (z == 256) { - a->zout = zout; - return 1; - } - z -= 257; - len = stbi__zlength_base[z]; - if (stbi__zlength_extra[z]) len += stbi__zreceive(a, stbi__zlength_extra[z]); - z = stbi__zhuffman_decode(a, &a->z_distance); - if (z < 0) return stbi__err("bad huffman code","Corrupt PNG"); - dist = stbi__zdist_base[z]; - if (stbi__zdist_extra[z]) dist += stbi__zreceive(a, stbi__zdist_extra[z]); - if (zout - a->zout_start < dist) return stbi__err("bad dist","Corrupt PNG"); - if (zout + len > a->zout_end) { - if (!stbi__zexpand(a, zout, len)) return 0; - zout = a->zout; - } - p = (stbi_uc *) (zout - dist); - if (dist == 1) { // run of one byte; common in images. - stbi_uc v = *p; - if (len) { do *zout++ = v; while (--len); } - } else { - if (len) { do *zout++ = *p++; while (--len); } - } - } - } -} - -static int stbi__compute_huffman_codes(stbi__zbuf *a) -{ - static stbi_uc length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 }; - stbi__zhuffman z_codelength; - stbi_uc lencodes[286+32+137];//padding for maximum single op - stbi_uc codelength_sizes[19]; - int i,n; - - int hlit = stbi__zreceive(a,5) + 257; - int hdist = stbi__zreceive(a,5) + 1; - int hclen = stbi__zreceive(a,4) + 4; - int ntot = hlit + hdist; - - memset(codelength_sizes, 0, sizeof(codelength_sizes)); - for (i=0; i < hclen; ++i) { - int s = stbi__zreceive(a,3); - codelength_sizes[length_dezigzag[i]] = (stbi_uc) s; - } - if (!stbi__zbuild_huffman(&z_codelength, codelength_sizes, 19)) return 0; - - n = 0; - while (n < ntot) { - int c = stbi__zhuffman_decode(a, &z_codelength); - if (c < 0 || c >= 19) return stbi__err("bad codelengths", "Corrupt PNG"); - if (c < 16) - lencodes[n++] = (stbi_uc) c; - else { - stbi_uc fill = 0; - if (c == 16) { - c = stbi__zreceive(a,2)+3; - if (n == 0) return stbi__err("bad codelengths", "Corrupt PNG"); - fill = lencodes[n-1]; - } else if (c == 17) - c = stbi__zreceive(a,3)+3; - else { - STBI_ASSERT(c == 18); - c = stbi__zreceive(a,7)+11; - } - if (ntot - n < c) return stbi__err("bad codelengths", "Corrupt PNG"); - memset(lencodes+n, fill, c); - n += c; - } - } - if (n != ntot) return stbi__err("bad codelengths","Corrupt PNG"); - if (!stbi__zbuild_huffman(&a->z_length, lencodes, hlit)) return 0; - if (!stbi__zbuild_huffman(&a->z_distance, lencodes+hlit, hdist)) return 0; - return 1; -} - -static int stbi__parse_uncompressed_block(stbi__zbuf *a) -{ - stbi_uc header[4]; - int len,nlen,k; - if (a->num_bits & 7) - stbi__zreceive(a, a->num_bits & 7); // discard - // drain the bit-packed data into header - k = 0; - while (a->num_bits > 0) { - header[k++] = (stbi_uc) (a->code_buffer & 255); // suppress MSVC run-time check - a->code_buffer >>= 8; - a->num_bits -= 8; - } - STBI_ASSERT(a->num_bits == 0); - // now fill header the normal way - while (k < 4) - header[k++] = stbi__zget8(a); - len = header[1] * 256 + header[0]; - nlen = header[3] * 256 + header[2]; - if (nlen != (len ^ 0xffff)) return stbi__err("zlib corrupt","Corrupt PNG"); - if (a->zbuffer + len > a->zbuffer_end) return stbi__err("read past buffer","Corrupt PNG"); - if (a->zout + len > a->zout_end) - if (!stbi__zexpand(a, a->zout, len)) return 0; - memcpy(a->zout, a->zbuffer, len); - a->zbuffer += len; - a->zout += len; - return 1; -} - -static int stbi__parse_zlib_header(stbi__zbuf *a) -{ - int cmf = stbi__zget8(a); - int cm = cmf & 15; - /* int cinfo = cmf >> 4; */ - int flg = stbi__zget8(a); - if ((cmf*256+flg) % 31 != 0) return stbi__err("bad zlib header","Corrupt PNG"); // zlib spec - if (flg & 32) return stbi__err("no preset dict","Corrupt PNG"); // preset dictionary not allowed in png - if (cm != 8) return stbi__err("bad compression","Corrupt PNG"); // DEFLATE required for png - // window = 1 << (8 + cinfo)... but who cares, we fully buffer output - return 1; -} - -static const stbi_uc stbi__zdefault_length[288] = -{ - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, - 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, - 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, - 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8 -}; -static const stbi_uc stbi__zdefault_distance[32] = -{ - 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 -}; -/* -Init algorithm: -{ - int i; // use <= to match clearly with spec - for (i=0; i <= 143; ++i) stbi__zdefault_length[i] = 8; - for ( ; i <= 255; ++i) stbi__zdefault_length[i] = 9; - for ( ; i <= 279; ++i) stbi__zdefault_length[i] = 7; - for ( ; i <= 287; ++i) stbi__zdefault_length[i] = 8; - - for (i=0; i <= 31; ++i) stbi__zdefault_distance[i] = 5; -} -*/ - -static int stbi__parse_zlib(stbi__zbuf *a, int parse_header) -{ - int final, type; - if (parse_header) - if (!stbi__parse_zlib_header(a)) return 0; - a->num_bits = 0; - a->code_buffer = 0; - do { - final = stbi__zreceive(a,1); - type = stbi__zreceive(a,2); - if (type == 0) { - if (!stbi__parse_uncompressed_block(a)) return 0; - } else if (type == 3) { - return 0; - } else { - if (type == 1) { - // use fixed code lengths - if (!stbi__zbuild_huffman(&a->z_length , stbi__zdefault_length , 288)) return 0; - if (!stbi__zbuild_huffman(&a->z_distance, stbi__zdefault_distance, 32)) return 0; - } else { - if (!stbi__compute_huffman_codes(a)) return 0; - } - if (!stbi__parse_huffman_block(a)) return 0; - } - } while (!final); - return 1; -} - -static int stbi__do_zlib(stbi__zbuf *a, char *obuf, int olen, int exp, int parse_header) -{ - a->zout_start = obuf; - a->zout = obuf; - a->zout_end = obuf + olen; - a->z_expandable = exp; - - return stbi__parse_zlib(a, parse_header); -} - -STBIDEF char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen) -{ - stbi__zbuf a; - char *p = (char *) stbi__malloc(initial_size); - if (p == NULL) return NULL; - a.zbuffer = (stbi_uc *) buffer; - a.zbuffer_end = (stbi_uc *) buffer + len; - if (stbi__do_zlib(&a, p, initial_size, 1, 1)) { - if (outlen) *outlen = (int) (a.zout - a.zout_start); - return a.zout_start; - } else { - STBI_FREE(a.zout_start); - return NULL; - } -} - -STBIDEF char *stbi_zlib_decode_malloc(char const *buffer, int len, int *outlen) -{ - return stbi_zlib_decode_malloc_guesssize(buffer, len, 16384, outlen); -} - -STBIDEF char *stbi_zlib_decode_malloc_guesssize_headerflag(const char *buffer, int len, int initial_size, int *outlen, int parse_header) -{ - stbi__zbuf a; - char *p = (char *) stbi__malloc(initial_size); - if (p == NULL) return NULL; - a.zbuffer = (stbi_uc *) buffer; - a.zbuffer_end = (stbi_uc *) buffer + len; - if (stbi__do_zlib(&a, p, initial_size, 1, parse_header)) { - if (outlen) *outlen = (int) (a.zout - a.zout_start); - return a.zout_start; - } else { - STBI_FREE(a.zout_start); - return NULL; - } -} - -STBIDEF int stbi_zlib_decode_buffer(char *obuffer, int olen, char const *ibuffer, int ilen) -{ - stbi__zbuf a; - a.zbuffer = (stbi_uc *) ibuffer; - a.zbuffer_end = (stbi_uc *) ibuffer + ilen; - if (stbi__do_zlib(&a, obuffer, olen, 0, 1)) - return (int) (a.zout - a.zout_start); - else - return -1; -} - -STBIDEF char *stbi_zlib_decode_noheader_malloc(char const *buffer, int len, int *outlen) -{ - stbi__zbuf a; - char *p = (char *) stbi__malloc(16384); - if (p == NULL) return NULL; - a.zbuffer = (stbi_uc *) buffer; - a.zbuffer_end = (stbi_uc *) buffer+len; - if (stbi__do_zlib(&a, p, 16384, 1, 0)) { - if (outlen) *outlen = (int) (a.zout - a.zout_start); - return a.zout_start; - } else { - STBI_FREE(a.zout_start); - return NULL; - } -} - -STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen) -{ - stbi__zbuf a; - a.zbuffer = (stbi_uc *) ibuffer; - a.zbuffer_end = (stbi_uc *) ibuffer + ilen; - if (stbi__do_zlib(&a, obuffer, olen, 0, 0)) - return (int) (a.zout - a.zout_start); - else - return -1; -} -#endif - -// public domain "baseline" PNG decoder v0.10 Sean Barrett 2006-11-18 -// simple implementation -// - only 8-bit samples -// - no CRC checking -// - allocates lots of intermediate memory -// - avoids problem of streaming data between subsystems -// - avoids explicit window management -// performance -// - uses stb_zlib, a PD zlib implementation with fast huffman decoding - -#ifndef STBI_NO_PNG -typedef struct -{ - stbi__uint32 length; - stbi__uint32 type; -} stbi__pngchunk; - -static stbi__pngchunk stbi__get_chunk_header(stbi__context *s) -{ - stbi__pngchunk c; - c.length = stbi__get32be(s); - c.type = stbi__get32be(s); - return c; -} - -static int stbi__check_png_header(stbi__context *s) -{ - static stbi_uc png_sig[8] = { 137,80,78,71,13,10,26,10 }; - int i; - for (i=0; i < 8; ++i) - if (stbi__get8(s) != png_sig[i]) return stbi__err("bad png sig","Not a PNG"); - return 1; -} - -typedef struct -{ - stbi__context *s; - stbi_uc *idata, *expanded, *out; - int depth; -} stbi__png; - - -enum { - STBI__F_none=0, - STBI__F_sub=1, - STBI__F_up=2, - STBI__F_avg=3, - STBI__F_paeth=4, - // synthetic filters used for first scanline to avoid needing a dummy row of 0s - STBI__F_avg_first, - STBI__F_paeth_first -}; - -static stbi_uc first_row_filter[5] = -{ - STBI__F_none, - STBI__F_sub, - STBI__F_none, - STBI__F_avg_first, - STBI__F_paeth_first -}; - -static int stbi__paeth(int a, int b, int c) -{ - int p = a + b - c; - int pa = abs(p-a); - int pb = abs(p-b); - int pc = abs(p-c); - if (pa <= pb && pa <= pc) return a; - if (pb <= pc) return b; - return c; -} - -static stbi_uc stbi__depth_scale_table[9] = { 0, 0xff, 0x55, 0, 0x11, 0,0,0, 0x01 }; - -// create the png data from post-deflated data -static int stbi__create_png_image_raw(stbi__png *a, stbi_uc *raw, stbi__uint32 raw_len, int out_n, stbi__uint32 x, stbi__uint32 y, int depth, int color) -{ - int bytes = (depth == 16? 2 : 1); - stbi__context *s = a->s; - stbi__uint32 i,j,stride = x*out_n*bytes; - stbi__uint32 img_len, img_width_bytes; - int k; - int img_n = s->img_n; // copy it into a local for later - - int output_bytes = out_n*bytes; - int filter_bytes = img_n*bytes; - int width = x; - - STBI_ASSERT(out_n == s->img_n || out_n == s->img_n+1); - a->out = (stbi_uc *) stbi__malloc_mad3(x, y, output_bytes, 0); // extra bytes to write off the end into - if (!a->out) return stbi__err("outofmem", "Out of memory"); - - img_width_bytes = (((img_n * x * depth) + 7) >> 3); - img_len = (img_width_bytes + 1) * y; - // we used to check for exact match between raw_len and img_len on non-interlaced PNGs, - // but issue #276 reported a PNG in the wild that had extra data at the end (all zeros), - // so just check for raw_len < img_len always. - if (raw_len < img_len) return stbi__err("not enough pixels","Corrupt PNG"); - - for (j=0; j < y; ++j) { - stbi_uc *cur = a->out + stride*j; - stbi_uc *prior; - int filter = *raw++; - - if (filter > 4) - return stbi__err("invalid filter","Corrupt PNG"); - - if (depth < 8) { - STBI_ASSERT(img_width_bytes <= x); - cur += x*out_n - img_width_bytes; // store output to the rightmost img_len bytes, so we can decode in place - filter_bytes = 1; - width = img_width_bytes; - } - prior = cur - stride; // bugfix: need to compute this after 'cur +=' computation above - - // if first row, use special filter that doesn't sample previous row - if (j == 0) filter = first_row_filter[filter]; - - // handle first byte explicitly - for (k=0; k < filter_bytes; ++k) { - switch (filter) { - case STBI__F_none : cur[k] = raw[k]; break; - case STBI__F_sub : cur[k] = raw[k]; break; - case STBI__F_up : cur[k] = STBI__BYTECAST(raw[k] + prior[k]); break; - case STBI__F_avg : cur[k] = STBI__BYTECAST(raw[k] + (prior[k]>>1)); break; - case STBI__F_paeth : cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(0,prior[k],0)); break; - case STBI__F_avg_first : cur[k] = raw[k]; break; - case STBI__F_paeth_first: cur[k] = raw[k]; break; - } - } - - if (depth == 8) { - if (img_n != out_n) - cur[img_n] = 255; // first pixel - raw += img_n; - cur += out_n; - prior += out_n; - } else if (depth == 16) { - if (img_n != out_n) { - cur[filter_bytes] = 255; // first pixel top byte - cur[filter_bytes+1] = 255; // first pixel bottom byte - } - raw += filter_bytes; - cur += output_bytes; - prior += output_bytes; - } else { - raw += 1; - cur += 1; - prior += 1; - } - - // this is a little gross, so that we don't switch per-pixel or per-component - if (depth < 8 || img_n == out_n) { - int nk = (width - 1)*filter_bytes; - #define STBI__CASE(f) \ - case f: \ - for (k=0; k < nk; ++k) - switch (filter) { - // "none" filter turns into a memcpy here; make that explicit. - case STBI__F_none: memcpy(cur, raw, nk); break; - STBI__CASE(STBI__F_sub) { cur[k] = STBI__BYTECAST(raw[k] + cur[k-filter_bytes]); } break; - STBI__CASE(STBI__F_up) { cur[k] = STBI__BYTECAST(raw[k] + prior[k]); } break; - STBI__CASE(STBI__F_avg) { cur[k] = STBI__BYTECAST(raw[k] + ((prior[k] + cur[k-filter_bytes])>>1)); } break; - STBI__CASE(STBI__F_paeth) { cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k-filter_bytes],prior[k],prior[k-filter_bytes])); } break; - STBI__CASE(STBI__F_avg_first) { cur[k] = STBI__BYTECAST(raw[k] + (cur[k-filter_bytes] >> 1)); } break; - STBI__CASE(STBI__F_paeth_first) { cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k-filter_bytes],0,0)); } break; - } - #undef STBI__CASE - raw += nk; - } else { - STBI_ASSERT(img_n+1 == out_n); - #define STBI__CASE(f) \ - case f: \ - for (i=x-1; i >= 1; --i, cur[filter_bytes]=255,raw+=filter_bytes,cur+=output_bytes,prior+=output_bytes) \ - for (k=0; k < filter_bytes; ++k) - switch (filter) { - STBI__CASE(STBI__F_none) { cur[k] = raw[k]; } break; - STBI__CASE(STBI__F_sub) { cur[k] = STBI__BYTECAST(raw[k] + cur[k- output_bytes]); } break; - STBI__CASE(STBI__F_up) { cur[k] = STBI__BYTECAST(raw[k] + prior[k]); } break; - STBI__CASE(STBI__F_avg) { cur[k] = STBI__BYTECAST(raw[k] + ((prior[k] + cur[k- output_bytes])>>1)); } break; - STBI__CASE(STBI__F_paeth) { cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k- output_bytes],prior[k],prior[k- output_bytes])); } break; - STBI__CASE(STBI__F_avg_first) { cur[k] = STBI__BYTECAST(raw[k] + (cur[k- output_bytes] >> 1)); } break; - STBI__CASE(STBI__F_paeth_first) { cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k- output_bytes],0,0)); } break; - } - #undef STBI__CASE - - // the loop above sets the high byte of the pixels' alpha, but for - // 16 bit png files we also need the low byte set. we'll do that here. - if (depth == 16) { - cur = a->out + stride*j; // start at the beginning of the row again - for (i=0; i < x; ++i,cur+=output_bytes) { - cur[filter_bytes+1] = 255; - } - } - } - } - - // we make a separate pass to expand bits to pixels; for performance, - // this could run two scanlines behind the above code, so it won't - // intefere with filtering but will still be in the cache. - if (depth < 8) { - for (j=0; j < y; ++j) { - stbi_uc *cur = a->out + stride*j; - stbi_uc *in = a->out + stride*j + x*out_n - img_width_bytes; - // unpack 1/2/4-bit into a 8-bit buffer. allows us to keep the common 8-bit path optimal at minimal cost for 1/2/4-bit - // png guarante byte alignment, if width is not multiple of 8/4/2 we'll decode dummy trailing data that will be skipped in the later loop - stbi_uc scale = (color == 0) ? stbi__depth_scale_table[depth] : 1; // scale grayscale values to 0..255 range - - // note that the final byte might overshoot and write more data than desired. - // we can allocate enough data that this never writes out of memory, but it - // could also overwrite the next scanline. can it overwrite non-empty data - // on the next scanline? yes, consider 1-pixel-wide scanlines with 1-bit-per-pixel. - // so we need to explicitly clamp the final ones - - if (depth == 4) { - for (k=x*img_n; k >= 2; k-=2, ++in) { - *cur++ = scale * ((*in >> 4) ); - *cur++ = scale * ((*in ) & 0x0f); - } - if (k > 0) *cur++ = scale * ((*in >> 4) ); - } else if (depth == 2) { - for (k=x*img_n; k >= 4; k-=4, ++in) { - *cur++ = scale * ((*in >> 6) ); - *cur++ = scale * ((*in >> 4) & 0x03); - *cur++ = scale * ((*in >> 2) & 0x03); - *cur++ = scale * ((*in ) & 0x03); - } - if (k > 0) *cur++ = scale * ((*in >> 6) ); - if (k > 1) *cur++ = scale * ((*in >> 4) & 0x03); - if (k > 2) *cur++ = scale * ((*in >> 2) & 0x03); - } else if (depth == 1) { - for (k=x*img_n; k >= 8; k-=8, ++in) { - *cur++ = scale * ((*in >> 7) ); - *cur++ = scale * ((*in >> 6) & 0x01); - *cur++ = scale * ((*in >> 5) & 0x01); - *cur++ = scale * ((*in >> 4) & 0x01); - *cur++ = scale * ((*in >> 3) & 0x01); - *cur++ = scale * ((*in >> 2) & 0x01); - *cur++ = scale * ((*in >> 1) & 0x01); - *cur++ = scale * ((*in ) & 0x01); - } - if (k > 0) *cur++ = scale * ((*in >> 7) ); - if (k > 1) *cur++ = scale * ((*in >> 6) & 0x01); - if (k > 2) *cur++ = scale * ((*in >> 5) & 0x01); - if (k > 3) *cur++ = scale * ((*in >> 4) & 0x01); - if (k > 4) *cur++ = scale * ((*in >> 3) & 0x01); - if (k > 5) *cur++ = scale * ((*in >> 2) & 0x01); - if (k > 6) *cur++ = scale * ((*in >> 1) & 0x01); - } - if (img_n != out_n) { - int q; - // insert alpha = 255 - cur = a->out + stride*j; - if (img_n == 1) { - for (q=x-1; q >= 0; --q) { - cur[q*2+1] = 255; - cur[q*2+0] = cur[q]; - } - } else { - STBI_ASSERT(img_n == 3); - for (q=x-1; q >= 0; --q) { - cur[q*4+3] = 255; - cur[q*4+2] = cur[q*3+2]; - cur[q*4+1] = cur[q*3+1]; - cur[q*4+0] = cur[q*3+0]; - } - } - } - } - } else if (depth == 16) { - // force the image data from big-endian to platform-native. - // this is done in a separate pass due to the decoding relying - // on the data being untouched, but could probably be done - // per-line during decode if care is taken. - stbi_uc *cur = a->out; - stbi__uint16 *cur16 = (stbi__uint16*)cur; - - for(i=0; i < x*y*out_n; ++i,cur16++,cur+=2) { - *cur16 = (cur[0] << 8) | cur[1]; - } - } - - return 1; -} - -static int stbi__create_png_image(stbi__png *a, stbi_uc *image_data, stbi__uint32 image_data_len, int out_n, int depth, int color, int interlaced) -{ - int bytes = (depth == 16 ? 2 : 1); - int out_bytes = out_n * bytes; - stbi_uc *final; - int p; - if (!interlaced) - return stbi__create_png_image_raw(a, image_data, image_data_len, out_n, a->s->img_x, a->s->img_y, depth, color); - - // de-interlacing - final = (stbi_uc *) stbi__malloc_mad3(a->s->img_x, a->s->img_y, out_bytes, 0); - for (p=0; p < 7; ++p) { - int xorig[] = { 0,4,0,2,0,1,0 }; - int yorig[] = { 0,0,4,0,2,0,1 }; - int xspc[] = { 8,8,4,4,2,2,1 }; - int yspc[] = { 8,8,8,4,4,2,2 }; - int i,j,x,y; - // pass1_x[4] = 0, pass1_x[5] = 1, pass1_x[12] = 1 - x = (a->s->img_x - xorig[p] + xspc[p]-1) / xspc[p]; - y = (a->s->img_y - yorig[p] + yspc[p]-1) / yspc[p]; - if (x && y) { - stbi__uint32 img_len = ((((a->s->img_n * x * depth) + 7) >> 3) + 1) * y; - if (!stbi__create_png_image_raw(a, image_data, image_data_len, out_n, x, y, depth, color)) { - STBI_FREE(final); - return 0; - } - for (j=0; j < y; ++j) { - for (i=0; i < x; ++i) { - int out_y = j*yspc[p]+yorig[p]; - int out_x = i*xspc[p]+xorig[p]; - memcpy(final + out_y*a->s->img_x*out_bytes + out_x*out_bytes, - a->out + (j*x+i)*out_bytes, out_bytes); - } - } - STBI_FREE(a->out); - image_data += img_len; - image_data_len -= img_len; - } - } - a->out = final; - - return 1; -} - -static int stbi__compute_transparency(stbi__png *z, stbi_uc tc[3], int out_n) -{ - stbi__context *s = z->s; - stbi__uint32 i, pixel_count = s->img_x * s->img_y; - stbi_uc *p = z->out; - - // compute color-based transparency, assuming we've - // already got 255 as the alpha value in the output - STBI_ASSERT(out_n == 2 || out_n == 4); - - if (out_n == 2) { - for (i=0; i < pixel_count; ++i) { - p[1] = (p[0] == tc[0] ? 0 : 255); - p += 2; - } - } else { - for (i=0; i < pixel_count; ++i) { - if (p[0] == tc[0] && p[1] == tc[1] && p[2] == tc[2]) - p[3] = 0; - p += 4; - } - } - return 1; -} - -static int stbi__compute_transparency16(stbi__png *z, stbi__uint16 tc[3], int out_n) -{ - stbi__context *s = z->s; - stbi__uint32 i, pixel_count = s->img_x * s->img_y; - stbi__uint16 *p = (stbi__uint16*) z->out; - - // compute color-based transparency, assuming we've - // already got 65535 as the alpha value in the output - STBI_ASSERT(out_n == 2 || out_n == 4); - - if (out_n == 2) { - for (i = 0; i < pixel_count; ++i) { - p[1] = (p[0] == tc[0] ? 0 : 65535); - p += 2; - } - } else { - for (i = 0; i < pixel_count; ++i) { - if (p[0] == tc[0] && p[1] == tc[1] && p[2] == tc[2]) - p[3] = 0; - p += 4; - } - } - return 1; -} - -static int stbi__expand_png_palette(stbi__png *a, stbi_uc *palette, int len, int pal_img_n) -{ - stbi__uint32 i, pixel_count = a->s->img_x * a->s->img_y; - stbi_uc *p, *temp_out, *orig = a->out; - - p = (stbi_uc *) stbi__malloc_mad2(pixel_count, pal_img_n, 0); - if (p == NULL) return stbi__err("outofmem", "Out of memory"); - - // between here and free(out) below, exitting would leak - temp_out = p; - - if (pal_img_n == 3) { - for (i=0; i < pixel_count; ++i) { - int n = orig[i]*4; - p[0] = palette[n ]; - p[1] = palette[n+1]; - p[2] = palette[n+2]; - p += 3; - } - } else { - for (i=0; i < pixel_count; ++i) { - int n = orig[i]*4; - p[0] = palette[n ]; - p[1] = palette[n+1]; - p[2] = palette[n+2]; - p[3] = palette[n+3]; - p += 4; - } - } - STBI_FREE(a->out); - a->out = temp_out; - - STBI_NOTUSED(len); - - return 1; -} - -static int stbi__unpremultiply_on_load = 0; -static int stbi__de_iphone_flag = 0; - -STBIDEF void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpremultiply) -{ - stbi__unpremultiply_on_load = flag_true_if_should_unpremultiply; -} - -STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert) -{ - stbi__de_iphone_flag = flag_true_if_should_convert; -} - -static void stbi__de_iphone(stbi__png *z) -{ - stbi__context *s = z->s; - stbi__uint32 i, pixel_count = s->img_x * s->img_y; - stbi_uc *p = z->out; - - if (s->img_out_n == 3) { // convert bgr to rgb - for (i=0; i < pixel_count; ++i) { - stbi_uc t = p[0]; - p[0] = p[2]; - p[2] = t; - p += 3; - } - } else { - STBI_ASSERT(s->img_out_n == 4); - if (stbi__unpremultiply_on_load) { - // convert bgr to rgb and unpremultiply - for (i=0; i < pixel_count; ++i) { - stbi_uc a = p[3]; - stbi_uc t = p[0]; - if (a) { - stbi_uc half = a / 2; - p[0] = (p[2] * 255 + half) / a; - p[1] = (p[1] * 255 + half) / a; - p[2] = ( t * 255 + half) / a; - } else { - p[0] = p[2]; - p[2] = t; - } - p += 4; - } - } else { - // convert bgr to rgb - for (i=0; i < pixel_count; ++i) { - stbi_uc t = p[0]; - p[0] = p[2]; - p[2] = t; - p += 4; - } - } - } -} - -#define STBI__PNG_TYPE(a,b,c,d) (((a) << 24) + ((b) << 16) + ((c) << 8) + (d)) - -static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp) -{ - stbi_uc palette[1024], pal_img_n=0; - stbi_uc has_trans=0, tc[3]; - stbi__uint16 tc16[3]; - stbi__uint32 ioff=0, idata_limit=0, i, pal_len=0; - int first=1,k,interlace=0, color=0, is_iphone=0; - stbi__context *s = z->s; - - z->expanded = NULL; - z->idata = NULL; - z->out = NULL; - - if (!stbi__check_png_header(s)) return 0; - - if (scan == STBI__SCAN_type) return 1; - - for (;;) { - stbi__pngchunk c = stbi__get_chunk_header(s); - switch (c.type) { - case STBI__PNG_TYPE('C','g','B','I'): - is_iphone = 1; - stbi__skip(s, c.length); - break; - case STBI__PNG_TYPE('I','H','D','R'): { - int comp,filter; - if (!first) return stbi__err("multiple IHDR","Corrupt PNG"); - first = 0; - if (c.length != 13) return stbi__err("bad IHDR len","Corrupt PNG"); - s->img_x = stbi__get32be(s); if (s->img_x > (1 << 24)) return stbi__err("too large","Very large image (corrupt?)"); - s->img_y = stbi__get32be(s); if (s->img_y > (1 << 24)) return stbi__err("too large","Very large image (corrupt?)"); - z->depth = stbi__get8(s); if (z->depth != 1 && z->depth != 2 && z->depth != 4 && z->depth != 8 && z->depth != 16) return stbi__err("1/2/4/8/16-bit only","PNG not supported: 1/2/4/8/16-bit only"); - color = stbi__get8(s); if (color > 6) return stbi__err("bad ctype","Corrupt PNG"); - if (color == 3 && z->depth == 16) return stbi__err("bad ctype","Corrupt PNG"); - if (color == 3) pal_img_n = 3; else if (color & 1) return stbi__err("bad ctype","Corrupt PNG"); - comp = stbi__get8(s); if (comp) return stbi__err("bad comp method","Corrupt PNG"); - filter= stbi__get8(s); if (filter) return stbi__err("bad filter method","Corrupt PNG"); - interlace = stbi__get8(s); if (interlace>1) return stbi__err("bad interlace method","Corrupt PNG"); - if (!s->img_x || !s->img_y) return stbi__err("0-pixel image","Corrupt PNG"); - if (!pal_img_n) { - s->img_n = (color & 2 ? 3 : 1) + (color & 4 ? 1 : 0); - if ((1 << 30) / s->img_x / s->img_n < s->img_y) return stbi__err("too large", "Image too large to decode"); - if (scan == STBI__SCAN_header) return 1; - } else { - // if paletted, then pal_n is our final components, and - // img_n is # components to decompress/filter. - s->img_n = 1; - if ((1 << 30) / s->img_x / 4 < s->img_y) return stbi__err("too large","Corrupt PNG"); - // if SCAN_header, have to scan to see if we have a tRNS - } - break; - } - - case STBI__PNG_TYPE('P','L','T','E'): { - if (first) return stbi__err("first not IHDR", "Corrupt PNG"); - if (c.length > 256*3) return stbi__err("invalid PLTE","Corrupt PNG"); - pal_len = c.length / 3; - if (pal_len * 3 != c.length) return stbi__err("invalid PLTE","Corrupt PNG"); - for (i=0; i < pal_len; ++i) { - palette[i*4+0] = stbi__get8(s); - palette[i*4+1] = stbi__get8(s); - palette[i*4+2] = stbi__get8(s); - palette[i*4+3] = 255; - } - break; - } - - case STBI__PNG_TYPE('t','R','N','S'): { - if (first) return stbi__err("first not IHDR", "Corrupt PNG"); - if (z->idata) return stbi__err("tRNS after IDAT","Corrupt PNG"); - if (pal_img_n) { - if (scan == STBI__SCAN_header) { s->img_n = 4; return 1; } - if (pal_len == 0) return stbi__err("tRNS before PLTE","Corrupt PNG"); - if (c.length > pal_len) return stbi__err("bad tRNS len","Corrupt PNG"); - pal_img_n = 4; - for (i=0; i < c.length; ++i) - palette[i*4+3] = stbi__get8(s); - } else { - if (!(s->img_n & 1)) return stbi__err("tRNS with alpha","Corrupt PNG"); - if (c.length != (stbi__uint32) s->img_n*2) return stbi__err("bad tRNS len","Corrupt PNG"); - has_trans = 1; - if (z->depth == 16) { - for (k = 0; k < s->img_n; ++k) tc16[k] = (stbi__uint16)stbi__get16be(s); // copy the values as-is - } else { - for (k = 0; k < s->img_n; ++k) tc[k] = (stbi_uc)(stbi__get16be(s) & 255) * stbi__depth_scale_table[z->depth]; // non 8-bit images will be larger - } - } - break; - } - - case STBI__PNG_TYPE('I','D','A','T'): { - if (first) return stbi__err("first not IHDR", "Corrupt PNG"); - if (pal_img_n && !pal_len) return stbi__err("no PLTE","Corrupt PNG"); - if (scan == STBI__SCAN_header) { s->img_n = pal_img_n; return 1; } - if ((int)(ioff + c.length) < (int)ioff) return 0; - if (ioff + c.length > idata_limit) { - stbi__uint32 idata_limit_old = idata_limit; - stbi_uc *p; - if (idata_limit == 0) idata_limit = c.length > 4096 ? c.length : 4096; - while (ioff + c.length > idata_limit) - idata_limit *= 2; - STBI_NOTUSED(idata_limit_old); - p = (stbi_uc *) STBI_REALLOC_SIZED(z->idata, idata_limit_old, idata_limit); if (p == NULL) return stbi__err("outofmem", "Out of memory"); - z->idata = p; - } - if (!stbi__getn(s, z->idata+ioff,c.length)) return stbi__err("outofdata","Corrupt PNG"); - ioff += c.length; - break; - } - - case STBI__PNG_TYPE('I','E','N','D'): { - stbi__uint32 raw_len, bpl; - if (first) return stbi__err("first not IHDR", "Corrupt PNG"); - if (scan != STBI__SCAN_load) return 1; - if (z->idata == NULL) return stbi__err("no IDAT","Corrupt PNG"); - // initial guess for decoded data size to avoid unnecessary reallocs - bpl = (s->img_x * z->depth + 7) / 8; // bytes per line, per component - raw_len = bpl * s->img_y * s->img_n /* pixels */ + s->img_y /* filter mode per row */; - z->expanded = (stbi_uc *) stbi_zlib_decode_malloc_guesssize_headerflag((char *) z->idata, ioff, raw_len, (int *) &raw_len, !is_iphone); - if (z->expanded == NULL) return 0; // zlib should set error - STBI_FREE(z->idata); z->idata = NULL; - if ((req_comp == s->img_n+1 && req_comp != 3 && !pal_img_n) || has_trans) - s->img_out_n = s->img_n+1; - else - s->img_out_n = s->img_n; - if (!stbi__create_png_image(z, z->expanded, raw_len, s->img_out_n, z->depth, color, interlace)) return 0; - if (has_trans) { - if (z->depth == 16) { - if (!stbi__compute_transparency16(z, tc16, s->img_out_n)) return 0; - } else { - if (!stbi__compute_transparency(z, tc, s->img_out_n)) return 0; - } - } - if (is_iphone && stbi__de_iphone_flag && s->img_out_n > 2) - stbi__de_iphone(z); - if (pal_img_n) { - // pal_img_n == 3 or 4 - s->img_n = pal_img_n; // record the actual colors we had - s->img_out_n = pal_img_n; - if (req_comp >= 3) s->img_out_n = req_comp; - if (!stbi__expand_png_palette(z, palette, pal_len, s->img_out_n)) - return 0; - } else if (has_trans) { - // non-paletted image with tRNS -> source image has (constant) alpha - ++s->img_n; - } - STBI_FREE(z->expanded); z->expanded = NULL; - return 1; - } - - default: - // if critical, fail - if (first) return stbi__err("first not IHDR", "Corrupt PNG"); - if ((c.type & (1 << 29)) == 0) { - #ifndef STBI_NO_FAILURE_STRINGS - // not threadsafe - static char invalid_chunk[] = "XXXX PNG chunk not known"; - invalid_chunk[0] = STBI__BYTECAST(c.type >> 24); - invalid_chunk[1] = STBI__BYTECAST(c.type >> 16); - invalid_chunk[2] = STBI__BYTECAST(c.type >> 8); - invalid_chunk[3] = STBI__BYTECAST(c.type >> 0); - #endif - return stbi__err(invalid_chunk, "PNG not supported: unknown PNG chunk type"); - } - stbi__skip(s, c.length); - break; - } - // end of PNG chunk, read and skip CRC - stbi__get32be(s); - } -} - -static void *stbi__do_png(stbi__png *p, int *x, int *y, int *n, int req_comp, stbi__result_info *ri) -{ - void *result=NULL; - if (req_comp < 0 || req_comp > 4) return stbi__errpuc("bad req_comp", "Internal error"); - if (stbi__parse_png_file(p, STBI__SCAN_load, req_comp)) { - if (p->depth < 8) - ri->bits_per_channel = 8; - else - ri->bits_per_channel = p->depth; - result = p->out; - p->out = NULL; - if (req_comp && req_comp != p->s->img_out_n) { - if (ri->bits_per_channel == 8) - result = stbi__convert_format((unsigned char *) result, p->s->img_out_n, req_comp, p->s->img_x, p->s->img_y); - else - result = stbi__convert_format16((stbi__uint16 *) result, p->s->img_out_n, req_comp, p->s->img_x, p->s->img_y); - p->s->img_out_n = req_comp; - if (result == NULL) return result; - } - *x = p->s->img_x; - *y = p->s->img_y; - if (n) *n = p->s->img_n; - } - STBI_FREE(p->out); p->out = NULL; - STBI_FREE(p->expanded); p->expanded = NULL; - STBI_FREE(p->idata); p->idata = NULL; - - return result; -} - -static void *stbi__png_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) -{ - stbi__png p; - p.s = s; - return stbi__do_png(&p, x,y,comp,req_comp, ri); -} - -static int stbi__png_test(stbi__context *s) -{ - int r; - r = stbi__check_png_header(s); - stbi__rewind(s); - return r; -} - -static int stbi__png_info_raw(stbi__png *p, int *x, int *y, int *comp) -{ - if (!stbi__parse_png_file(p, STBI__SCAN_header, 0)) { - stbi__rewind( p->s ); - return 0; - } - if (x) *x = p->s->img_x; - if (y) *y = p->s->img_y; - if (comp) *comp = p->s->img_n; - return 1; -} - -static int stbi__png_info(stbi__context *s, int *x, int *y, int *comp) -{ - stbi__png p; - p.s = s; - return stbi__png_info_raw(&p, x, y, comp); -} -#endif - -// Microsoft/Windows BMP image - -#ifndef STBI_NO_BMP -static int stbi__bmp_test_raw(stbi__context *s) -{ - int r; - int sz; - if (stbi__get8(s) != 'B') return 0; - if (stbi__get8(s) != 'M') return 0; - stbi__get32le(s); // discard filesize - stbi__get16le(s); // discard reserved - stbi__get16le(s); // discard reserved - stbi__get32le(s); // discard data offset - sz = stbi__get32le(s); - r = (sz == 12 || sz == 40 || sz == 56 || sz == 108 || sz == 124); - return r; -} - -static int stbi__bmp_test(stbi__context *s) -{ - int r = stbi__bmp_test_raw(s); - stbi__rewind(s); - return r; -} - - -// returns 0..31 for the highest set bit -static int stbi__high_bit(unsigned int z) -{ - int n=0; - if (z == 0) return -1; - if (z >= 0x10000) n += 16, z >>= 16; - if (z >= 0x00100) n += 8, z >>= 8; - if (z >= 0x00010) n += 4, z >>= 4; - if (z >= 0x00004) n += 2, z >>= 2; - if (z >= 0x00002) n += 1, z >>= 1; - return n; -} - -static int stbi__bitcount(unsigned int a) -{ - a = (a & 0x55555555) + ((a >> 1) & 0x55555555); // max 2 - a = (a & 0x33333333) + ((a >> 2) & 0x33333333); // max 4 - a = (a + (a >> 4)) & 0x0f0f0f0f; // max 8 per 4, now 8 bits - a = (a + (a >> 8)); // max 16 per 8 bits - a = (a + (a >> 16)); // max 32 per 8 bits - return a & 0xff; -} - -static int stbi__shiftsigned(int v, int shift, int bits) -{ - int result; - int z=0; - - if (shift < 0) v <<= -shift; - else v >>= shift; - result = v; - - z = bits; - while (z < 8) { - result += v >> z; - z += bits; - } - return result; -} - -typedef struct -{ - int bpp, offset, hsz; - unsigned int mr,mg,mb,ma, all_a; -} stbi__bmp_data; - -static void *stbi__bmp_parse_header(stbi__context *s, stbi__bmp_data *info) -{ - int hsz; - if (stbi__get8(s) != 'B' || stbi__get8(s) != 'M') return stbi__errpuc("not BMP", "Corrupt BMP"); - stbi__get32le(s); // discard filesize - stbi__get16le(s); // discard reserved - stbi__get16le(s); // discard reserved - info->offset = stbi__get32le(s); - info->hsz = hsz = stbi__get32le(s); - info->mr = info->mg = info->mb = info->ma = 0; - - if (hsz != 12 && hsz != 40 && hsz != 56 && hsz != 108 && hsz != 124) return stbi__errpuc("unknown BMP", "BMP type not supported: unknown"); - if (hsz == 12) { - s->img_x = stbi__get16le(s); - s->img_y = stbi__get16le(s); - } else { - s->img_x = stbi__get32le(s); - s->img_y = stbi__get32le(s); - } - if (stbi__get16le(s) != 1) return stbi__errpuc("bad BMP", "bad BMP"); - info->bpp = stbi__get16le(s); - if (info->bpp == 1) return stbi__errpuc("monochrome", "BMP type not supported: 1-bit"); - if (hsz != 12) { - int compress = stbi__get32le(s); - if (compress == 1 || compress == 2) return stbi__errpuc("BMP RLE", "BMP type not supported: RLE"); - stbi__get32le(s); // discard sizeof - stbi__get32le(s); // discard hres - stbi__get32le(s); // discard vres - stbi__get32le(s); // discard colorsused - stbi__get32le(s); // discard max important - if (hsz == 40 || hsz == 56) { - if (hsz == 56) { - stbi__get32le(s); - stbi__get32le(s); - stbi__get32le(s); - stbi__get32le(s); - } - if (info->bpp == 16 || info->bpp == 32) { - if (compress == 0) { - if (info->bpp == 32) { - info->mr = 0xffu << 16; - info->mg = 0xffu << 8; - info->mb = 0xffu << 0; - info->ma = 0xffu << 24; - info->all_a = 0; // if all_a is 0 at end, then we loaded alpha channel but it was all 0 - } else { - info->mr = 31u << 10; - info->mg = 31u << 5; - info->mb = 31u << 0; - } - } else if (compress == 3) { - info->mr = stbi__get32le(s); - info->mg = stbi__get32le(s); - info->mb = stbi__get32le(s); - // not documented, but generated by photoshop and handled by mspaint - if (info->mr == info->mg && info->mg == info->mb) { - // ?!?!? - return stbi__errpuc("bad BMP", "bad BMP"); - } - } else - return stbi__errpuc("bad BMP", "bad BMP"); - } - } else { - int i; - if (hsz != 108 && hsz != 124) - return stbi__errpuc("bad BMP", "bad BMP"); - info->mr = stbi__get32le(s); - info->mg = stbi__get32le(s); - info->mb = stbi__get32le(s); - info->ma = stbi__get32le(s); - stbi__get32le(s); // discard color space - for (i=0; i < 12; ++i) - stbi__get32le(s); // discard color space parameters - if (hsz == 124) { - stbi__get32le(s); // discard rendering intent - stbi__get32le(s); // discard offset of profile data - stbi__get32le(s); // discard size of profile data - stbi__get32le(s); // discard reserved - } - } - } - return (void *) 1; -} - - -static void *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) -{ - stbi_uc *out; - unsigned int mr=0,mg=0,mb=0,ma=0, all_a; - stbi_uc pal[256][4]; - int psize=0,i,j,width; - int flip_vertically, pad, target; - stbi__bmp_data info; - STBI_NOTUSED(ri); - - info.all_a = 255; - if (stbi__bmp_parse_header(s, &info) == NULL) - return NULL; // error code already set - - flip_vertically = ((int) s->img_y) > 0; - s->img_y = abs((int) s->img_y); - - mr = info.mr; - mg = info.mg; - mb = info.mb; - ma = info.ma; - all_a = info.all_a; - - if (info.hsz == 12) { - if (info.bpp < 24) - psize = (info.offset - 14 - 24) / 3; - } else { - if (info.bpp < 16) - psize = (info.offset - 14 - info.hsz) >> 2; - } - - s->img_n = ma ? 4 : 3; - if (req_comp && req_comp >= 3) // we can directly decode 3 or 4 - target = req_comp; - else - target = s->img_n; // if they want monochrome, we'll post-convert - - // sanity-check size - if (!stbi__mad3sizes_valid(target, s->img_x, s->img_y, 0)) - return stbi__errpuc("too large", "Corrupt BMP"); - - out = (stbi_uc *) stbi__malloc_mad3(target, s->img_x, s->img_y, 0); - if (!out) return stbi__errpuc("outofmem", "Out of memory"); - if (info.bpp < 16) { - int z=0; - if (psize == 0 || psize > 256) { STBI_FREE(out); return stbi__errpuc("invalid", "Corrupt BMP"); } - for (i=0; i < psize; ++i) { - pal[i][2] = stbi__get8(s); - pal[i][1] = stbi__get8(s); - pal[i][0] = stbi__get8(s); - if (info.hsz != 12) stbi__get8(s); - pal[i][3] = 255; - } - stbi__skip(s, info.offset - 14 - info.hsz - psize * (info.hsz == 12 ? 3 : 4)); - if (info.bpp == 4) width = (s->img_x + 1) >> 1; - else if (info.bpp == 8) width = s->img_x; - else { STBI_FREE(out); return stbi__errpuc("bad bpp", "Corrupt BMP"); } - pad = (-width)&3; - for (j=0; j < (int) s->img_y; ++j) { - for (i=0; i < (int) s->img_x; i += 2) { - int v=stbi__get8(s),v2=0; - if (info.bpp == 4) { - v2 = v & 15; - v >>= 4; - } - out[z++] = pal[v][0]; - out[z++] = pal[v][1]; - out[z++] = pal[v][2]; - if (target == 4) out[z++] = 255; - if (i+1 == (int) s->img_x) break; - v = (info.bpp == 8) ? stbi__get8(s) : v2; - out[z++] = pal[v][0]; - out[z++] = pal[v][1]; - out[z++] = pal[v][2]; - if (target == 4) out[z++] = 255; - } - stbi__skip(s, pad); - } - } else { - int rshift=0,gshift=0,bshift=0,ashift=0,rcount=0,gcount=0,bcount=0,acount=0; - int z = 0; - int easy=0; - stbi__skip(s, info.offset - 14 - info.hsz); - if (info.bpp == 24) width = 3 * s->img_x; - else if (info.bpp == 16) width = 2*s->img_x; - else /* bpp = 32 and pad = 0 */ width=0; - pad = (-width) & 3; - if (info.bpp == 24) { - easy = 1; - } else if (info.bpp == 32) { - if (mb == 0xff && mg == 0xff00 && mr == 0x00ff0000 && ma == 0xff000000) - easy = 2; - } - if (!easy) { - if (!mr || !mg || !mb) { STBI_FREE(out); return stbi__errpuc("bad masks", "Corrupt BMP"); } - // right shift amt to put high bit in position #7 - rshift = stbi__high_bit(mr)-7; rcount = stbi__bitcount(mr); - gshift = stbi__high_bit(mg)-7; gcount = stbi__bitcount(mg); - bshift = stbi__high_bit(mb)-7; bcount = stbi__bitcount(mb); - ashift = stbi__high_bit(ma)-7; acount = stbi__bitcount(ma); - } - for (j=0; j < (int) s->img_y; ++j) { - if (easy) { - for (i=0; i < (int) s->img_x; ++i) { - unsigned char a; - out[z+2] = stbi__get8(s); - out[z+1] = stbi__get8(s); - out[z+0] = stbi__get8(s); - z += 3; - a = (easy == 2 ? stbi__get8(s) : 255); - all_a |= a; - if (target == 4) out[z++] = a; - } - } else { - int bpp = info.bpp; - for (i=0; i < (int) s->img_x; ++i) { - stbi__uint32 v = (bpp == 16 ? (stbi__uint32) stbi__get16le(s) : stbi__get32le(s)); - int a; - out[z++] = STBI__BYTECAST(stbi__shiftsigned(v & mr, rshift, rcount)); - out[z++] = STBI__BYTECAST(stbi__shiftsigned(v & mg, gshift, gcount)); - out[z++] = STBI__BYTECAST(stbi__shiftsigned(v & mb, bshift, bcount)); - a = (ma ? stbi__shiftsigned(v & ma, ashift, acount) : 255); - all_a |= a; - if (target == 4) out[z++] = STBI__BYTECAST(a); - } - } - stbi__skip(s, pad); - } - } - - // if alpha channel is all 0s, replace with all 255s - if (target == 4 && all_a == 0) - for (i=4*s->img_x*s->img_y-1; i >= 0; i -= 4) - out[i] = 255; - - if (flip_vertically) { - stbi_uc t; - for (j=0; j < (int) s->img_y>>1; ++j) { - stbi_uc *p1 = out + j *s->img_x*target; - stbi_uc *p2 = out + (s->img_y-1-j)*s->img_x*target; - for (i=0; i < (int) s->img_x*target; ++i) { - t = p1[i], p1[i] = p2[i], p2[i] = t; - } - } - } - - if (req_comp && req_comp != target) { - out = stbi__convert_format(out, target, req_comp, s->img_x, s->img_y); - if (out == NULL) return out; // stbi__convert_format frees input on failure - } - - *x = s->img_x; - *y = s->img_y; - if (comp) *comp = s->img_n; - return out; -} -#endif - -// Targa Truevision - TGA -// by Jonathan Dummer -#ifndef STBI_NO_TGA -// returns STBI_rgb or whatever, 0 on error -static int stbi__tga_get_comp(int bits_per_pixel, int is_grey, int* is_rgb16) -{ - // only RGB or RGBA (incl. 16bit) or grey allowed - if(is_rgb16) *is_rgb16 = 0; - switch(bits_per_pixel) { - case 8: return STBI_grey; - case 16: if(is_grey) return STBI_grey_alpha; - // else: fall-through - case 15: if(is_rgb16) *is_rgb16 = 1; - return STBI_rgb; - case 24: // fall-through - case 32: return bits_per_pixel/8; - default: return 0; - } -} - -static int stbi__tga_info(stbi__context *s, int *x, int *y, int *comp) -{ - int tga_w, tga_h, tga_comp, tga_image_type, tga_bits_per_pixel, tga_colormap_bpp; - int sz, tga_colormap_type; - stbi__get8(s); // discard Offset - tga_colormap_type = stbi__get8(s); // colormap type - if( tga_colormap_type > 1 ) { - stbi__rewind(s); - return 0; // only RGB or indexed allowed - } - tga_image_type = stbi__get8(s); // image type - if ( tga_colormap_type == 1 ) { // colormapped (paletted) image - if (tga_image_type != 1 && tga_image_type != 9) { - stbi__rewind(s); - return 0; - } - stbi__skip(s,4); // skip index of first colormap entry and number of entries - sz = stbi__get8(s); // check bits per palette color entry - if ( (sz != 8) && (sz != 15) && (sz != 16) && (sz != 24) && (sz != 32) ) { - stbi__rewind(s); - return 0; - } - stbi__skip(s,4); // skip image x and y origin - tga_colormap_bpp = sz; - } else { // "normal" image w/o colormap - only RGB or grey allowed, +/- RLE - if ( (tga_image_type != 2) && (tga_image_type != 3) && (tga_image_type != 10) && (tga_image_type != 11) ) { - stbi__rewind(s); - return 0; // only RGB or grey allowed, +/- RLE - } - stbi__skip(s,9); // skip colormap specification and image x/y origin - tga_colormap_bpp = 0; - } - tga_w = stbi__get16le(s); - if( tga_w < 1 ) { - stbi__rewind(s); - return 0; // test width - } - tga_h = stbi__get16le(s); - if( tga_h < 1 ) { - stbi__rewind(s); - return 0; // test height - } - tga_bits_per_pixel = stbi__get8(s); // bits per pixel - stbi__get8(s); // ignore alpha bits - if (tga_colormap_bpp != 0) { - if((tga_bits_per_pixel != 8) && (tga_bits_per_pixel != 16)) { - // when using a colormap, tga_bits_per_pixel is the size of the indexes - // I don't think anything but 8 or 16bit indexes makes sense - stbi__rewind(s); - return 0; - } - tga_comp = stbi__tga_get_comp(tga_colormap_bpp, 0, NULL); - } else { - tga_comp = stbi__tga_get_comp(tga_bits_per_pixel, (tga_image_type == 3) || (tga_image_type == 11), NULL); - } - if(!tga_comp) { - stbi__rewind(s); - return 0; - } - if (x) *x = tga_w; - if (y) *y = tga_h; - if (comp) *comp = tga_comp; - return 1; // seems to have passed everything -} - -static int stbi__tga_test(stbi__context *s) -{ - int res = 0; - int sz, tga_color_type; - stbi__get8(s); // discard Offset - tga_color_type = stbi__get8(s); // color type - if ( tga_color_type > 1 ) goto errorEnd; // only RGB or indexed allowed - sz = stbi__get8(s); // image type - if ( tga_color_type == 1 ) { // colormapped (paletted) image - if (sz != 1 && sz != 9) goto errorEnd; // colortype 1 demands image type 1 or 9 - stbi__skip(s,4); // skip index of first colormap entry and number of entries - sz = stbi__get8(s); // check bits per palette color entry - if ( (sz != 8) && (sz != 15) && (sz != 16) && (sz != 24) && (sz != 32) ) goto errorEnd; - stbi__skip(s,4); // skip image x and y origin - } else { // "normal" image w/o colormap - if ( (sz != 2) && (sz != 3) && (sz != 10) && (sz != 11) ) goto errorEnd; // only RGB or grey allowed, +/- RLE - stbi__skip(s,9); // skip colormap specification and image x/y origin - } - if ( stbi__get16le(s) < 1 ) goto errorEnd; // test width - if ( stbi__get16le(s) < 1 ) goto errorEnd; // test height - sz = stbi__get8(s); // bits per pixel - if ( (tga_color_type == 1) && (sz != 8) && (sz != 16) ) goto errorEnd; // for colormapped images, bpp is size of an index - if ( (sz != 8) && (sz != 15) && (sz != 16) && (sz != 24) && (sz != 32) ) goto errorEnd; - - res = 1; // if we got this far, everything's good and we can return 1 instead of 0 - -errorEnd: - stbi__rewind(s); - return res; -} - -// read 16bit value and convert to 24bit RGB -static void stbi__tga_read_rgb16(stbi__context *s, stbi_uc* out) -{ - stbi__uint16 px = (stbi__uint16)stbi__get16le(s); - stbi__uint16 fiveBitMask = 31; - // we have 3 channels with 5bits each - int r = (px >> 10) & fiveBitMask; - int g = (px >> 5) & fiveBitMask; - int b = px & fiveBitMask; - // Note that this saves the data in RGB(A) order, so it doesn't need to be swapped later - out[0] = (stbi_uc)((r * 255)/31); - out[1] = (stbi_uc)((g * 255)/31); - out[2] = (stbi_uc)((b * 255)/31); - - // some people claim that the most significant bit might be used for alpha - // (possibly if an alpha-bit is set in the "image descriptor byte") - // but that only made 16bit test images completely translucent.. - // so let's treat all 15 and 16bit TGAs as RGB with no alpha. -} - -static void *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) -{ - // read in the TGA header stuff - int tga_offset = stbi__get8(s); - int tga_indexed = stbi__get8(s); - int tga_image_type = stbi__get8(s); - int tga_is_RLE = 0; - int tga_palette_start = stbi__get16le(s); - int tga_palette_len = stbi__get16le(s); - int tga_palette_bits = stbi__get8(s); - int tga_x_origin = stbi__get16le(s); - int tga_y_origin = stbi__get16le(s); - int tga_width = stbi__get16le(s); - int tga_height = stbi__get16le(s); - int tga_bits_per_pixel = stbi__get8(s); - int tga_comp, tga_rgb16=0; - int tga_inverted = stbi__get8(s); - // int tga_alpha_bits = tga_inverted & 15; // the 4 lowest bits - unused (useless?) - // image data - unsigned char *tga_data; - unsigned char *tga_palette = NULL; - int i, j; - unsigned char raw_data[4] = {0}; - int RLE_count = 0; - int RLE_repeating = 0; - int read_next_pixel = 1; - STBI_NOTUSED(ri); - - // do a tiny bit of precessing - if ( tga_image_type >= 8 ) - { - tga_image_type -= 8; - tga_is_RLE = 1; - } - tga_inverted = 1 - ((tga_inverted >> 5) & 1); - - // If I'm paletted, then I'll use the number of bits from the palette - if ( tga_indexed ) tga_comp = stbi__tga_get_comp(tga_palette_bits, 0, &tga_rgb16); - else tga_comp = stbi__tga_get_comp(tga_bits_per_pixel, (tga_image_type == 3), &tga_rgb16); - - if(!tga_comp) // shouldn't really happen, stbi__tga_test() should have ensured basic consistency - return stbi__errpuc("bad format", "Can't find out TGA pixelformat"); - - // tga info - *x = tga_width; - *y = tga_height; - if (comp) *comp = tga_comp; - - if (!stbi__mad3sizes_valid(tga_width, tga_height, tga_comp, 0)) - return stbi__errpuc("too large", "Corrupt TGA"); - - tga_data = (unsigned char*)stbi__malloc_mad3(tga_width, tga_height, tga_comp, 0); - if (!tga_data) return stbi__errpuc("outofmem", "Out of memory"); - - // skip to the data's starting position (offset usually = 0) - stbi__skip(s, tga_offset ); - - if ( !tga_indexed && !tga_is_RLE && !tga_rgb16 ) { - for (i=0; i < tga_height; ++i) { - int row = tga_inverted ? tga_height -i - 1 : i; - stbi_uc *tga_row = tga_data + row*tga_width*tga_comp; - stbi__getn(s, tga_row, tga_width * tga_comp); - } - } else { - // do I need to load a palette? - if ( tga_indexed) - { - // any data to skip? (offset usually = 0) - stbi__skip(s, tga_palette_start ); - // load the palette - tga_palette = (unsigned char*)stbi__malloc_mad2(tga_palette_len, tga_comp, 0); - if (!tga_palette) { - STBI_FREE(tga_data); - return stbi__errpuc("outofmem", "Out of memory"); - } - if (tga_rgb16) { - stbi_uc *pal_entry = tga_palette; - STBI_ASSERT(tga_comp == STBI_rgb); - for (i=0; i < tga_palette_len; ++i) { - stbi__tga_read_rgb16(s, pal_entry); - pal_entry += tga_comp; - } - } else if (!stbi__getn(s, tga_palette, tga_palette_len * tga_comp)) { - STBI_FREE(tga_data); - STBI_FREE(tga_palette); - return stbi__errpuc("bad palette", "Corrupt TGA"); - } - } - // load the data - for (i=0; i < tga_width * tga_height; ++i) - { - // if I'm in RLE mode, do I need to get a RLE stbi__pngchunk? - if ( tga_is_RLE ) - { - if ( RLE_count == 0 ) - { - // yep, get the next byte as a RLE command - int RLE_cmd = stbi__get8(s); - RLE_count = 1 + (RLE_cmd & 127); - RLE_repeating = RLE_cmd >> 7; - read_next_pixel = 1; - } else if ( !RLE_repeating ) - { - read_next_pixel = 1; - } - } else - { - read_next_pixel = 1; - } - // OK, if I need to read a pixel, do it now - if ( read_next_pixel ) - { - // load however much data we did have - if ( tga_indexed ) - { - // read in index, then perform the lookup - int pal_idx = (tga_bits_per_pixel == 8) ? stbi__get8(s) : stbi__get16le(s); - if ( pal_idx >= tga_palette_len ) { - // invalid index - pal_idx = 0; - } - pal_idx *= tga_comp; - for (j = 0; j < tga_comp; ++j) { - raw_data[j] = tga_palette[pal_idx+j]; - } - } else if(tga_rgb16) { - STBI_ASSERT(tga_comp == STBI_rgb); - stbi__tga_read_rgb16(s, raw_data); - } else { - // read in the data raw - for (j = 0; j < tga_comp; ++j) { - raw_data[j] = stbi__get8(s); - } - } - // clear the reading flag for the next pixel - read_next_pixel = 0; - } // end of reading a pixel - - // copy data - for (j = 0; j < tga_comp; ++j) - tga_data[i*tga_comp+j] = raw_data[j]; - - // in case we're in RLE mode, keep counting down - --RLE_count; - } - // do I need to invert the image? - if ( tga_inverted ) - { - for (j = 0; j*2 < tga_height; ++j) - { - int index1 = j * tga_width * tga_comp; - int index2 = (tga_height - 1 - j) * tga_width * tga_comp; - for (i = tga_width * tga_comp; i > 0; --i) - { - unsigned char temp = tga_data[index1]; - tga_data[index1] = tga_data[index2]; - tga_data[index2] = temp; - ++index1; - ++index2; - } - } - } - // clear my palette, if I had one - if ( tga_palette != NULL ) - { - STBI_FREE( tga_palette ); - } - } - - // swap RGB - if the source data was RGB16, it already is in the right order - if (tga_comp >= 3 && !tga_rgb16) - { - unsigned char* tga_pixel = tga_data; - for (i=0; i < tga_width * tga_height; ++i) - { - unsigned char temp = tga_pixel[0]; - tga_pixel[0] = tga_pixel[2]; - tga_pixel[2] = temp; - tga_pixel += tga_comp; - } - } - - // convert to target component count - if (req_comp && req_comp != tga_comp) - tga_data = stbi__convert_format(tga_data, tga_comp, req_comp, tga_width, tga_height); - - // the things I do to get rid of an error message, and yet keep - // Microsoft's C compilers happy... [8^( - tga_palette_start = tga_palette_len = tga_palette_bits = - tga_x_origin = tga_y_origin = 0; - // OK, done - return tga_data; -} -#endif - -// ************************************************************************************************* -// Photoshop PSD loader -- PD by Thatcher Ulrich, integration by Nicolas Schulz, tweaked by STB - -#ifndef STBI_NO_PSD -static int stbi__psd_test(stbi__context *s) -{ - int r = (stbi__get32be(s) == 0x38425053); - stbi__rewind(s); - return r; -} - -static int stbi__psd_decode_rle(stbi__context *s, stbi_uc *p, int pixelCount) -{ - int count, nleft, len; - - count = 0; - while ((nleft = pixelCount - count) > 0) { - len = stbi__get8(s); - if (len == 128) { - // No-op. - } else if (len < 128) { - // Copy next len+1 bytes literally. - len++; - if (len > nleft) return 0; // corrupt data - count += len; - while (len) { - *p = stbi__get8(s); - p += 4; - len--; - } - } else if (len > 128) { - stbi_uc val; - // Next -len+1 bytes in the dest are replicated from next source byte. - // (Interpret len as a negative 8-bit int.) - len = 257 - len; - if (len > nleft) return 0; // corrupt data - val = stbi__get8(s); - count += len; - while (len) { - *p = val; - p += 4; - len--; - } - } - } - - return 1; -} - -static void *stbi__psd_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri, int bpc) -{ - int pixelCount; - int channelCount, compression; - int channel, i; - int bitdepth; - int w,h; - stbi_uc *out; - STBI_NOTUSED(ri); - - // Check identifier - if (stbi__get32be(s) != 0x38425053) // "8BPS" - return stbi__errpuc("not PSD", "Corrupt PSD image"); - - // Check file type version. - if (stbi__get16be(s) != 1) - return stbi__errpuc("wrong version", "Unsupported version of PSD image"); - - // Skip 6 reserved bytes. - stbi__skip(s, 6 ); - - // Read the number of channels (R, G, B, A, etc). - channelCount = stbi__get16be(s); - if (channelCount < 0 || channelCount > 16) - return stbi__errpuc("wrong channel count", "Unsupported number of channels in PSD image"); - - // Read the rows and columns of the image. - h = stbi__get32be(s); - w = stbi__get32be(s); - - // Make sure the depth is 8 bits. - bitdepth = stbi__get16be(s); - if (bitdepth != 8 && bitdepth != 16) - return stbi__errpuc("unsupported bit depth", "PSD bit depth is not 8 or 16 bit"); - - // Make sure the color mode is RGB. - // Valid options are: - // 0: Bitmap - // 1: Grayscale - // 2: Indexed color - // 3: RGB color - // 4: CMYK color - // 7: Multichannel - // 8: Duotone - // 9: Lab color - if (stbi__get16be(s) != 3) - return stbi__errpuc("wrong color format", "PSD is not in RGB color format"); - - // Skip the Mode Data. (It's the palette for indexed color; other info for other modes.) - stbi__skip(s,stbi__get32be(s) ); - - // Skip the image resources. (resolution, pen tool paths, etc) - stbi__skip(s, stbi__get32be(s) ); - - // Skip the reserved data. - stbi__skip(s, stbi__get32be(s) ); - - // Find out if the data is compressed. - // Known values: - // 0: no compression - // 1: RLE compressed - compression = stbi__get16be(s); - if (compression > 1) - return stbi__errpuc("bad compression", "PSD has an unknown compression format"); - - // Check size - if (!stbi__mad3sizes_valid(4, w, h, 0)) - return stbi__errpuc("too large", "Corrupt PSD"); - - // Create the destination image. - - if (!compression && bitdepth == 16 && bpc == 16) { - out = (stbi_uc *) stbi__malloc_mad3(8, w, h, 0); - ri->bits_per_channel = 16; - } else - out = (stbi_uc *) stbi__malloc(4 * w*h); - - if (!out) return stbi__errpuc("outofmem", "Out of memory"); - pixelCount = w*h; - - // Initialize the data to zero. - //memset( out, 0, pixelCount * 4 ); - - // Finally, the image data. - if (compression) { - // RLE as used by .PSD and .TIFF - // Loop until you get the number of unpacked bytes you are expecting: - // Read the next source byte into n. - // If n is between 0 and 127 inclusive, copy the next n+1 bytes literally. - // Else if n is between -127 and -1 inclusive, copy the next byte -n+1 times. - // Else if n is 128, noop. - // Endloop - - // The RLE-compressed data is preceeded by a 2-byte data count for each row in the data, - // which we're going to just skip. - stbi__skip(s, h * channelCount * 2 ); - - // Read the RLE data by channel. - for (channel = 0; channel < 4; channel++) { - stbi_uc *p; - - p = out+channel; - if (channel >= channelCount) { - // Fill this channel with default data. - for (i = 0; i < pixelCount; i++, p += 4) - *p = (channel == 3 ? 255 : 0); - } else { - // Read the RLE data. - if (!stbi__psd_decode_rle(s, p, pixelCount)) { - STBI_FREE(out); - return stbi__errpuc("corrupt", "bad RLE data"); - } - } - } - - } else { - // We're at the raw image data. It's each channel in order (Red, Green, Blue, Alpha, ...) - // where each channel consists of an 8-bit (or 16-bit) value for each pixel in the image. - - // Read the data by channel. - for (channel = 0; channel < 4; channel++) { - if (channel >= channelCount) { - // Fill this channel with default data. - if (bitdepth == 16 && bpc == 16) { - stbi__uint16 *q = ((stbi__uint16 *) out) + channel; - stbi__uint16 val = channel == 3 ? 65535 : 0; - for (i = 0; i < pixelCount; i++, q += 4) - *q = val; - } else { - stbi_uc *p = out+channel; - stbi_uc val = channel == 3 ? 255 : 0; - for (i = 0; i < pixelCount; i++, p += 4) - *p = val; - } - } else { - if (ri->bits_per_channel == 16) { // output bpc - stbi__uint16 *q = ((stbi__uint16 *) out) + channel; - for (i = 0; i < pixelCount; i++, q += 4) - *q = (stbi__uint16) stbi__get16be(s); - } else { - stbi_uc *p = out+channel; - if (bitdepth == 16) { // input bpc - for (i = 0; i < pixelCount; i++, p += 4) - *p = (stbi_uc) (stbi__get16be(s) >> 8); - } else { - for (i = 0; i < pixelCount; i++, p += 4) - *p = stbi__get8(s); - } - } - } - } - } - - // remove weird white matte from PSD - if (channelCount >= 4) { - if (ri->bits_per_channel == 16) { - for (i=0; i < w*h; ++i) { - stbi__uint16 *pixel = (stbi__uint16 *) out + 4*i; - if (pixel[3] != 0 && pixel[3] != 65535) { - float a = pixel[3] / 65535.0f; - float ra = 1.0f / a; - float inv_a = 65535.0f * (1 - ra); - pixel[0] = (stbi__uint16) (pixel[0]*ra + inv_a); - pixel[1] = (stbi__uint16) (pixel[1]*ra + inv_a); - pixel[2] = (stbi__uint16) (pixel[2]*ra + inv_a); - } - } - } else { - for (i=0; i < w*h; ++i) { - unsigned char *pixel = out + 4*i; - if (pixel[3] != 0 && pixel[3] != 255) { - float a = pixel[3] / 255.0f; - float ra = 1.0f / a; - float inv_a = 255.0f * (1 - ra); - pixel[0] = (unsigned char) (pixel[0]*ra + inv_a); - pixel[1] = (unsigned char) (pixel[1]*ra + inv_a); - pixel[2] = (unsigned char) (pixel[2]*ra + inv_a); - } - } - } - } - - // convert to desired output format - if (req_comp && req_comp != 4) { - if (ri->bits_per_channel == 16) - out = (stbi_uc *) stbi__convert_format16((stbi__uint16 *) out, 4, req_comp, w, h); - else - out = stbi__convert_format(out, 4, req_comp, w, h); - if (out == NULL) return out; // stbi__convert_format frees input on failure - } - - if (comp) *comp = 4; - *y = h; - *x = w; - - return out; -} -#endif - -// ************************************************************************************************* -// Softimage PIC loader -// by Tom Seddon -// -// See http://softimage.wiki.softimage.com/index.php/INFO:_PIC_file_format -// See http://ozviz.wasp.uwa.edu.au/~pbourke/dataformats/softimagepic/ - -#ifndef STBI_NO_PIC -static int stbi__pic_is4(stbi__context *s,const char *str) -{ - int i; - for (i=0; i<4; ++i) - if (stbi__get8(s) != (stbi_uc)str[i]) - return 0; - - return 1; -} - -static int stbi__pic_test_core(stbi__context *s) -{ - int i; - - if (!stbi__pic_is4(s,"\x53\x80\xF6\x34")) - return 0; - - for(i=0;i<84;++i) - stbi__get8(s); - - if (!stbi__pic_is4(s,"PICT")) - return 0; - - return 1; -} - -typedef struct -{ - stbi_uc size,type,channel; -} stbi__pic_packet; - -static stbi_uc *stbi__readval(stbi__context *s, int channel, stbi_uc *dest) -{ - int mask=0x80, i; - - for (i=0; i<4; ++i, mask>>=1) { - if (channel & mask) { - if (stbi__at_eof(s)) return stbi__errpuc("bad file","PIC file too short"); - dest[i]=stbi__get8(s); - } - } - - return dest; -} - -static void stbi__copyval(int channel,stbi_uc *dest,const stbi_uc *src) -{ - int mask=0x80,i; - - for (i=0;i<4; ++i, mask>>=1) - if (channel&mask) - dest[i]=src[i]; -} - -static stbi_uc *stbi__pic_load_core(stbi__context *s,int width,int height,int *comp, stbi_uc *result) -{ - int act_comp=0,num_packets=0,y,chained; - stbi__pic_packet packets[10]; - - // this will (should...) cater for even some bizarre stuff like having data - // for the same channel in multiple packets. - do { - stbi__pic_packet *packet; - - if (num_packets==sizeof(packets)/sizeof(packets[0])) - return stbi__errpuc("bad format","too many packets"); - - packet = &packets[num_packets++]; - - chained = stbi__get8(s); - packet->size = stbi__get8(s); - packet->type = stbi__get8(s); - packet->channel = stbi__get8(s); - - act_comp |= packet->channel; - - if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (reading packets)"); - if (packet->size != 8) return stbi__errpuc("bad format","packet isn't 8bpp"); - } while (chained); - - *comp = (act_comp & 0x10 ? 4 : 3); // has alpha channel? - - for(y=0; ytype) { - default: - return stbi__errpuc("bad format","packet has bad compression type"); - - case 0: {//uncompressed - int x; - - for(x=0;xchannel,dest)) - return 0; - break; - } - - case 1://Pure RLE - { - int left=width, i; - - while (left>0) { - stbi_uc count,value[4]; - - count=stbi__get8(s); - if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (pure read count)"); - - if (count > left) - count = (stbi_uc) left; - - if (!stbi__readval(s,packet->channel,value)) return 0; - - for(i=0; ichannel,dest,value); - left -= count; - } - } - break; - - case 2: {//Mixed RLE - int left=width; - while (left>0) { - int count = stbi__get8(s), i; - if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (mixed read count)"); - - if (count >= 128) { // Repeated - stbi_uc value[4]; - - if (count==128) - count = stbi__get16be(s); - else - count -= 127; - if (count > left) - return stbi__errpuc("bad file","scanline overrun"); - - if (!stbi__readval(s,packet->channel,value)) - return 0; - - for(i=0;ichannel,dest,value); - } else { // Raw - ++count; - if (count>left) return stbi__errpuc("bad file","scanline overrun"); - - for(i=0;ichannel,dest)) - return 0; - } - left-=count; - } - break; - } - } - } - } - - return result; -} - -static void *stbi__pic_load(stbi__context *s,int *px,int *py,int *comp,int req_comp, stbi__result_info *ri) -{ - stbi_uc *result; - int i, x,y, internal_comp; - STBI_NOTUSED(ri); - - if (!comp) comp = &internal_comp; - - for (i=0; i<92; ++i) - stbi__get8(s); - - x = stbi__get16be(s); - y = stbi__get16be(s); - if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (pic header)"); - if (!stbi__mad3sizes_valid(x, y, 4, 0)) return stbi__errpuc("too large", "PIC image too large to decode"); - - stbi__get32be(s); //skip `ratio' - stbi__get16be(s); //skip `fields' - stbi__get16be(s); //skip `pad' - - // intermediate buffer is RGBA - result = (stbi_uc *) stbi__malloc_mad3(x, y, 4, 0); - memset(result, 0xff, x*y*4); - - if (!stbi__pic_load_core(s,x,y,comp, result)) { - STBI_FREE(result); - result=0; - } - *px = x; - *py = y; - if (req_comp == 0) req_comp = *comp; - result=stbi__convert_format(result,4,req_comp,x,y); - - return result; -} - -static int stbi__pic_test(stbi__context *s) -{ - int r = stbi__pic_test_core(s); - stbi__rewind(s); - return r; -} -#endif - -// ************************************************************************************************* -// GIF loader -- public domain by Jean-Marc Lienher -- simplified/shrunk by stb - -#ifndef STBI_NO_GIF -typedef struct -{ - stbi__int16 prefix; - stbi_uc first; - stbi_uc suffix; -} stbi__gif_lzw; - -typedef struct -{ - int w,h; - stbi_uc *out, *old_out; // output buffer (always 4 components) - int flags, bgindex, ratio, transparent, eflags, delay; - stbi_uc pal[256][4]; - stbi_uc lpal[256][4]; - stbi__gif_lzw codes[4096]; - stbi_uc *color_table; - int parse, step; - int lflags; - int start_x, start_y; - int max_x, max_y; - int cur_x, cur_y; - int line_size; -} stbi__gif; - -static int stbi__gif_test_raw(stbi__context *s) -{ - int sz; - if (stbi__get8(s) != 'G' || stbi__get8(s) != 'I' || stbi__get8(s) != 'F' || stbi__get8(s) != '8') return 0; - sz = stbi__get8(s); - if (sz != '9' && sz != '7') return 0; - if (stbi__get8(s) != 'a') return 0; - return 1; -} - -static int stbi__gif_test(stbi__context *s) -{ - int r = stbi__gif_test_raw(s); - stbi__rewind(s); - return r; -} - -static void stbi__gif_parse_colortable(stbi__context *s, stbi_uc pal[256][4], int num_entries, int transp) -{ - int i; - for (i=0; i < num_entries; ++i) { - pal[i][2] = stbi__get8(s); - pal[i][1] = stbi__get8(s); - pal[i][0] = stbi__get8(s); - pal[i][3] = transp == i ? 0 : 255; - } -} - -static int stbi__gif_header(stbi__context *s, stbi__gif *g, int *comp, int is_info) -{ - stbi_uc version; - if (stbi__get8(s) != 'G' || stbi__get8(s) != 'I' || stbi__get8(s) != 'F' || stbi__get8(s) != '8') - return stbi__err("not GIF", "Corrupt GIF"); - - version = stbi__get8(s); - if (version != '7' && version != '9') return stbi__err("not GIF", "Corrupt GIF"); - if (stbi__get8(s) != 'a') return stbi__err("not GIF", "Corrupt GIF"); - - stbi__g_failure_reason = ""; - g->w = stbi__get16le(s); - g->h = stbi__get16le(s); - g->flags = stbi__get8(s); - g->bgindex = stbi__get8(s); - g->ratio = stbi__get8(s); - g->transparent = -1; - - if (comp != 0) *comp = 4; // can't actually tell whether it's 3 or 4 until we parse the comments - - if (is_info) return 1; - - if (g->flags & 0x80) - stbi__gif_parse_colortable(s,g->pal, 2 << (g->flags & 7), -1); - - return 1; -} - -static int stbi__gif_info_raw(stbi__context *s, int *x, int *y, int *comp) -{ - stbi__gif* g = (stbi__gif*) stbi__malloc(sizeof(stbi__gif)); - if (!stbi__gif_header(s, g, comp, 1)) { - STBI_FREE(g); - stbi__rewind( s ); - return 0; - } - if (x) *x = g->w; - if (y) *y = g->h; - STBI_FREE(g); - return 1; -} - -static void stbi__out_gif_code(stbi__gif *g, stbi__uint16 code) -{ - stbi_uc *p, *c; - - // recurse to decode the prefixes, since the linked-list is backwards, - // and working backwards through an interleaved image would be nasty - if (g->codes[code].prefix >= 0) - stbi__out_gif_code(g, g->codes[code].prefix); - - if (g->cur_y >= g->max_y) return; - - p = &g->out[g->cur_x + g->cur_y]; - c = &g->color_table[g->codes[code].suffix * 4]; - - if (c[3] >= 128) { - p[0] = c[2]; - p[1] = c[1]; - p[2] = c[0]; - p[3] = c[3]; - } - g->cur_x += 4; - - if (g->cur_x >= g->max_x) { - g->cur_x = g->start_x; - g->cur_y += g->step; - - while (g->cur_y >= g->max_y && g->parse > 0) { - g->step = (1 << g->parse) * g->line_size; - g->cur_y = g->start_y + (g->step >> 1); - --g->parse; - } - } -} - -static stbi_uc *stbi__process_gif_raster(stbi__context *s, stbi__gif *g) -{ - stbi_uc lzw_cs; - stbi__int32 len, init_code; - stbi__uint32 first; - stbi__int32 codesize, codemask, avail, oldcode, bits, valid_bits, clear; - stbi__gif_lzw *p; - - lzw_cs = stbi__get8(s); - if (lzw_cs > 12) return NULL; - clear = 1 << lzw_cs; - first = 1; - codesize = lzw_cs + 1; - codemask = (1 << codesize) - 1; - bits = 0; - valid_bits = 0; - for (init_code = 0; init_code < clear; init_code++) { - g->codes[init_code].prefix = -1; - g->codes[init_code].first = (stbi_uc) init_code; - g->codes[init_code].suffix = (stbi_uc) init_code; - } - - // support no starting clear code - avail = clear+2; - oldcode = -1; - - len = 0; - for(;;) { - if (valid_bits < codesize) { - if (len == 0) { - len = stbi__get8(s); // start new block - if (len == 0) - return g->out; - } - --len; - bits |= (stbi__int32) stbi__get8(s) << valid_bits; - valid_bits += 8; - } else { - stbi__int32 code = bits & codemask; - bits >>= codesize; - valid_bits -= codesize; - // @OPTIMIZE: is there some way we can accelerate the non-clear path? - if (code == clear) { // clear code - codesize = lzw_cs + 1; - codemask = (1 << codesize) - 1; - avail = clear + 2; - oldcode = -1; - first = 0; - } else if (code == clear + 1) { // end of stream code - stbi__skip(s, len); - while ((len = stbi__get8(s)) > 0) - stbi__skip(s,len); - return g->out; - } else if (code <= avail) { - if (first) return stbi__errpuc("no clear code", "Corrupt GIF"); - - if (oldcode >= 0) { - p = &g->codes[avail++]; - if (avail > 4096) return stbi__errpuc("too many codes", "Corrupt GIF"); - p->prefix = (stbi__int16) oldcode; - p->first = g->codes[oldcode].first; - p->suffix = (code == avail) ? p->first : g->codes[code].first; - } else if (code == avail) - return stbi__errpuc("illegal code in raster", "Corrupt GIF"); - - stbi__out_gif_code(g, (stbi__uint16) code); - - if ((avail & codemask) == 0 && avail <= 0x0FFF) { - codesize++; - codemask = (1 << codesize) - 1; - } - - oldcode = code; - } else { - return stbi__errpuc("illegal code in raster", "Corrupt GIF"); - } - } - } -} - -static void stbi__fill_gif_background(stbi__gif *g, int x0, int y0, int x1, int y1) -{ - int x, y; - stbi_uc *c = g->pal[g->bgindex]; - for (y = y0; y < y1; y += 4 * g->w) { - for (x = x0; x < x1; x += 4) { - stbi_uc *p = &g->out[y + x]; - p[0] = c[2]; - p[1] = c[1]; - p[2] = c[0]; - p[3] = 0; - } - } -} - -// this function is designed to support animated gifs, although stb_image doesn't support it -static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, int req_comp) -{ - int i; - stbi_uc *prev_out = 0; - - if (g->out == 0 && !stbi__gif_header(s, g, comp,0)) - return 0; // stbi__g_failure_reason set by stbi__gif_header - - if (!stbi__mad3sizes_valid(g->w, g->h, 4, 0)) - return stbi__errpuc("too large", "GIF too large"); - - prev_out = g->out; - g->out = (stbi_uc *) stbi__malloc_mad3(4, g->w, g->h, 0); - if (g->out == 0) return stbi__errpuc("outofmem", "Out of memory"); - - switch ((g->eflags & 0x1C) >> 2) { - case 0: // unspecified (also always used on 1st frame) - stbi__fill_gif_background(g, 0, 0, 4 * g->w, 4 * g->w * g->h); - break; - case 1: // do not dispose - if (prev_out) memcpy(g->out, prev_out, 4 * g->w * g->h); - g->old_out = prev_out; - break; - case 2: // dispose to background - if (prev_out) memcpy(g->out, prev_out, 4 * g->w * g->h); - stbi__fill_gif_background(g, g->start_x, g->start_y, g->max_x, g->max_y); - break; - case 3: // dispose to previous - if (g->old_out) { - for (i = g->start_y; i < g->max_y; i += 4 * g->w) - memcpy(&g->out[i + g->start_x], &g->old_out[i + g->start_x], g->max_x - g->start_x); - } - break; - } - - for (;;) { - switch (stbi__get8(s)) { - case 0x2C: /* Image Descriptor */ - { - int prev_trans = -1; - stbi__int32 x, y, w, h; - stbi_uc *o; - - x = stbi__get16le(s); - y = stbi__get16le(s); - w = stbi__get16le(s); - h = stbi__get16le(s); - if (((x + w) > (g->w)) || ((y + h) > (g->h))) - return stbi__errpuc("bad Image Descriptor", "Corrupt GIF"); - - g->line_size = g->w * 4; - g->start_x = x * 4; - g->start_y = y * g->line_size; - g->max_x = g->start_x + w * 4; - g->max_y = g->start_y + h * g->line_size; - g->cur_x = g->start_x; - g->cur_y = g->start_y; - - g->lflags = stbi__get8(s); - - if (g->lflags & 0x40) { - g->step = 8 * g->line_size; // first interlaced spacing - g->parse = 3; - } else { - g->step = g->line_size; - g->parse = 0; - } - - if (g->lflags & 0x80) { - stbi__gif_parse_colortable(s,g->lpal, 2 << (g->lflags & 7), g->eflags & 0x01 ? g->transparent : -1); - g->color_table = (stbi_uc *) g->lpal; - } else if (g->flags & 0x80) { - if (g->transparent >= 0 && (g->eflags & 0x01)) { - prev_trans = g->pal[g->transparent][3]; - g->pal[g->transparent][3] = 0; - } - g->color_table = (stbi_uc *) g->pal; - } else - return stbi__errpuc("missing color table", "Corrupt GIF"); - - o = stbi__process_gif_raster(s, g); - if (o == NULL) return NULL; - - if (prev_trans != -1) - g->pal[g->transparent][3] = (stbi_uc) prev_trans; - - return o; - } - - case 0x21: // Comment Extension. - { - int len; - if (stbi__get8(s) == 0xF9) { // Graphic Control Extension. - len = stbi__get8(s); - if (len == 4) { - g->eflags = stbi__get8(s); - g->delay = stbi__get16le(s); - g->transparent = stbi__get8(s); - } else { - stbi__skip(s, len); - break; - } - } - while ((len = stbi__get8(s)) != 0) - stbi__skip(s, len); - break; - } - - case 0x3B: // gif stream termination code - return (stbi_uc *) s; // using '1' causes warning on some compilers - - default: - return stbi__errpuc("unknown code", "Corrupt GIF"); - } - } - - STBI_NOTUSED(req_comp); -} - -static void *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) -{ - stbi_uc *u = 0; - stbi__gif* g = (stbi__gif*) stbi__malloc(sizeof(stbi__gif)); - memset(g, 0, sizeof(*g)); - STBI_NOTUSED(ri); - - u = stbi__gif_load_next(s, g, comp, req_comp); - if (u == (stbi_uc *) s) u = 0; // end of animated gif marker - if (u) { - *x = g->w; - *y = g->h; - if (req_comp && req_comp != 4) - u = stbi__convert_format(u, 4, req_comp, g->w, g->h); - } - else if (g->out) - STBI_FREE(g->out); - STBI_FREE(g); - return u; -} - -static int stbi__gif_info(stbi__context *s, int *x, int *y, int *comp) -{ - return stbi__gif_info_raw(s,x,y,comp); -} -#endif - -// ************************************************************************************************* -// Radiance RGBE HDR loader -// originally by Nicolas Schulz -#ifndef STBI_NO_HDR -static int stbi__hdr_test_core(stbi__context *s, const char *signature) -{ - int i; - for (i=0; signature[i]; ++i) - if (stbi__get8(s) != signature[i]) - return 0; - stbi__rewind(s); - return 1; -} - -static int stbi__hdr_test(stbi__context* s) -{ - int r = stbi__hdr_test_core(s, "#?RADIANCE\n"); - stbi__rewind(s); - if(!r) { - r = stbi__hdr_test_core(s, "#?RGBE\n"); - stbi__rewind(s); - } - return r; -} - -#define STBI__HDR_BUFLEN 1024 -static char *stbi__hdr_gettoken(stbi__context *z, char *buffer) -{ - int len=0; - char c = '\0'; - - c = (char) stbi__get8(z); - - while (!stbi__at_eof(z) && c != '\n') { - buffer[len++] = c; - if (len == STBI__HDR_BUFLEN-1) { - // flush to end of line - while (!stbi__at_eof(z) && stbi__get8(z) != '\n') - ; - break; - } - c = (char) stbi__get8(z); - } - - buffer[len] = 0; - return buffer; -} - -static void stbi__hdr_convert(float *output, stbi_uc *input, int req_comp) -{ - if ( input[3] != 0 ) { - float f1; - // Exponent - f1 = (float) ldexp(1.0f, input[3] - (int)(128 + 8)); - if (req_comp <= 2) - output[0] = (input[0] + input[1] + input[2]) * f1 / 3; - else { - output[0] = input[0] * f1; - output[1] = input[1] * f1; - output[2] = input[2] * f1; - } - if (req_comp == 2) output[1] = 1; - if (req_comp == 4) output[3] = 1; - } else { - switch (req_comp) { - case 4: output[3] = 1; /* fallthrough */ - case 3: output[0] = output[1] = output[2] = 0; - break; - case 2: output[1] = 1; /* fallthrough */ - case 1: output[0] = 0; - break; - } - } -} - -static float *stbi__hdr_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) -{ - char buffer[STBI__HDR_BUFLEN]; - char *token; - int valid = 0; - int width, height; - stbi_uc *scanline; - float *hdr_data; - int len; - unsigned char count, value; - int i, j, k, c1,c2, z; - const char *headerToken; - STBI_NOTUSED(ri); - - // Check identifier - headerToken = stbi__hdr_gettoken(s,buffer); - if (strcmp(headerToken, "#?RADIANCE") != 0 && strcmp(headerToken, "#?RGBE") != 0) - return stbi__errpf("not HDR", "Corrupt HDR image"); - - // Parse header - for(;;) { - token = stbi__hdr_gettoken(s,buffer); - if (token[0] == 0) break; - if (strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0) valid = 1; - } - - if (!valid) return stbi__errpf("unsupported format", "Unsupported HDR format"); - - // Parse width and height - // can't use sscanf() if we're not using stdio! - token = stbi__hdr_gettoken(s,buffer); - if (strncmp(token, "-Y ", 3)) return stbi__errpf("unsupported data layout", "Unsupported HDR format"); - token += 3; - height = (int) strtol(token, &token, 10); - while (*token == ' ') ++token; - if (strncmp(token, "+X ", 3)) return stbi__errpf("unsupported data layout", "Unsupported HDR format"); - token += 3; - width = (int) strtol(token, NULL, 10); - - *x = width; - *y = height; - - if (comp) *comp = 3; - if (req_comp == 0) req_comp = 3; - - if (!stbi__mad4sizes_valid(width, height, req_comp, sizeof(float), 0)) - return stbi__errpf("too large", "HDR image is too large"); - - // Read data - hdr_data = (float *) stbi__malloc_mad4(width, height, req_comp, sizeof(float), 0); - if (!hdr_data) - return stbi__errpf("outofmem", "Out of memory"); - - // Load image data - // image data is stored as some number of sca - if ( width < 8 || width >= 32768) { - // Read flat data - for (j=0; j < height; ++j) { - for (i=0; i < width; ++i) { - stbi_uc rgbe[4]; - main_decode_loop: - stbi__getn(s, rgbe, 4); - stbi__hdr_convert(hdr_data + j * width * req_comp + i * req_comp, rgbe, req_comp); - } - } - } else { - // Read RLE-encoded data - scanline = NULL; - - for (j = 0; j < height; ++j) { - c1 = stbi__get8(s); - c2 = stbi__get8(s); - len = stbi__get8(s); - if (c1 != 2 || c2 != 2 || (len & 0x80)) { - // not run-length encoded, so we have to actually use THIS data as a decoded - // pixel (note this can't be a valid pixel--one of RGB must be >= 128) - stbi_uc rgbe[4]; - rgbe[0] = (stbi_uc) c1; - rgbe[1] = (stbi_uc) c2; - rgbe[2] = (stbi_uc) len; - rgbe[3] = (stbi_uc) stbi__get8(s); - stbi__hdr_convert(hdr_data, rgbe, req_comp); - i = 1; - j = 0; - STBI_FREE(scanline); - goto main_decode_loop; // yes, this makes no sense - } - len <<= 8; - len |= stbi__get8(s); - if (len != width) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf("invalid decoded scanline length", "corrupt HDR"); } - if (scanline == NULL) { - scanline = (stbi_uc *) stbi__malloc_mad2(width, 4, 0); - if (!scanline) { - STBI_FREE(hdr_data); - return stbi__errpf("outofmem", "Out of memory"); - } - } - - for (k = 0; k < 4; ++k) { - int nleft; - i = 0; - while ((nleft = width - i) > 0) { - count = stbi__get8(s); - if (count > 128) { - // Run - value = stbi__get8(s); - count -= 128; - if (count > nleft) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf("corrupt", "bad RLE data in HDR"); } - for (z = 0; z < count; ++z) - scanline[i++ * 4 + k] = value; - } else { - // Dump - if (count > nleft) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf("corrupt", "bad RLE data in HDR"); } - for (z = 0; z < count; ++z) - scanline[i++ * 4 + k] = stbi__get8(s); - } - } - } - for (i=0; i < width; ++i) - stbi__hdr_convert(hdr_data+(j*width + i)*req_comp, scanline + i*4, req_comp); - } - if (scanline) - STBI_FREE(scanline); - } - - return hdr_data; -} - -static int stbi__hdr_info(stbi__context *s, int *x, int *y, int *comp) -{ - char buffer[STBI__HDR_BUFLEN]; - char *token; - int valid = 0; - int dummy; - - if (!x) x = &dummy; - if (!y) y = &dummy; - if (!comp) comp = &dummy; - - if (stbi__hdr_test(s) == 0) { - stbi__rewind( s ); - return 0; - } - - for(;;) { - token = stbi__hdr_gettoken(s,buffer); - if (token[0] == 0) break; - if (strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0) valid = 1; - } - - if (!valid) { - stbi__rewind( s ); - return 0; - } - token = stbi__hdr_gettoken(s,buffer); - if (strncmp(token, "-Y ", 3)) { - stbi__rewind( s ); - return 0; - } - token += 3; - *y = (int) strtol(token, &token, 10); - while (*token == ' ') ++token; - if (strncmp(token, "+X ", 3)) { - stbi__rewind( s ); - return 0; - } - token += 3; - *x = (int) strtol(token, NULL, 10); - *comp = 3; - return 1; -} -#endif // STBI_NO_HDR - -#ifndef STBI_NO_BMP -static int stbi__bmp_info(stbi__context *s, int *x, int *y, int *comp) -{ - void *p; - stbi__bmp_data info; - - info.all_a = 255; - p = stbi__bmp_parse_header(s, &info); - stbi__rewind( s ); - if (p == NULL) - return 0; - if (x) *x = s->img_x; - if (y) *y = s->img_y; - if (comp) *comp = info.ma ? 4 : 3; - return 1; -} -#endif - -#ifndef STBI_NO_PSD -static int stbi__psd_info(stbi__context *s, int *x, int *y, int *comp) -{ - int channelCount, dummy; - if (!x) x = &dummy; - if (!y) y = &dummy; - if (!comp) comp = &dummy; - if (stbi__get32be(s) != 0x38425053) { - stbi__rewind( s ); - return 0; - } - if (stbi__get16be(s) != 1) { - stbi__rewind( s ); - return 0; - } - stbi__skip(s, 6); - channelCount = stbi__get16be(s); - if (channelCount < 0 || channelCount > 16) { - stbi__rewind( s ); - return 0; - } - *y = stbi__get32be(s); - *x = stbi__get32be(s); - if (stbi__get16be(s) != 8) { - stbi__rewind( s ); - return 0; - } - if (stbi__get16be(s) != 3) { - stbi__rewind( s ); - return 0; - } - *comp = 4; - return 1; -} -#endif - -#ifndef STBI_NO_PIC -static int stbi__pic_info(stbi__context *s, int *x, int *y, int *comp) -{ - int act_comp=0,num_packets=0,chained,dummy; - stbi__pic_packet packets[10]; - - if (!x) x = &dummy; - if (!y) y = &dummy; - if (!comp) comp = &dummy; - - if (!stbi__pic_is4(s,"\x53\x80\xF6\x34")) { - stbi__rewind(s); - return 0; - } - - stbi__skip(s, 88); - - *x = stbi__get16be(s); - *y = stbi__get16be(s); - if (stbi__at_eof(s)) { - stbi__rewind( s); - return 0; - } - if ( (*x) != 0 && (1 << 28) / (*x) < (*y)) { - stbi__rewind( s ); - return 0; - } - - stbi__skip(s, 8); - - do { - stbi__pic_packet *packet; - - if (num_packets==sizeof(packets)/sizeof(packets[0])) - return 0; - - packet = &packets[num_packets++]; - chained = stbi__get8(s); - packet->size = stbi__get8(s); - packet->type = stbi__get8(s); - packet->channel = stbi__get8(s); - act_comp |= packet->channel; - - if (stbi__at_eof(s)) { - stbi__rewind( s ); - return 0; - } - if (packet->size != 8) { - stbi__rewind( s ); - return 0; - } - } while (chained); - - *comp = (act_comp & 0x10 ? 4 : 3); - - return 1; -} -#endif - -// ************************************************************************************************* -// Portable Gray Map and Portable Pixel Map loader -// by Ken Miller -// -// PGM: http://netpbm.sourceforge.net/doc/pgm.html -// PPM: http://netpbm.sourceforge.net/doc/ppm.html -// -// Known limitations: -// Does not support comments in the header section -// Does not support ASCII image data (formats P2 and P3) -// Does not support 16-bit-per-channel - -#ifndef STBI_NO_PNM - -static int stbi__pnm_test(stbi__context *s) -{ - char p, t; - p = (char) stbi__get8(s); - t = (char) stbi__get8(s); - if (p != 'P' || (t != '5' && t != '6')) { - stbi__rewind( s ); - return 0; - } - return 1; -} - -static void *stbi__pnm_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) -{ - stbi_uc *out; - STBI_NOTUSED(ri); - - if (!stbi__pnm_info(s, (int *)&s->img_x, (int *)&s->img_y, (int *)&s->img_n)) - return 0; - - *x = s->img_x; - *y = s->img_y; - if (comp) *comp = s->img_n; - - if (!stbi__mad3sizes_valid(s->img_n, s->img_x, s->img_y, 0)) - return stbi__errpuc("too large", "PNM too large"); - - out = (stbi_uc *) stbi__malloc_mad3(s->img_n, s->img_x, s->img_y, 0); - if (!out) return stbi__errpuc("outofmem", "Out of memory"); - stbi__getn(s, out, s->img_n * s->img_x * s->img_y); - - if (req_comp && req_comp != s->img_n) { - out = stbi__convert_format(out, s->img_n, req_comp, s->img_x, s->img_y); - if (out == NULL) return out; // stbi__convert_format frees input on failure - } - return out; -} - -static int stbi__pnm_isspace(char c) -{ - return c == ' ' || c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r'; -} - -static void stbi__pnm_skip_whitespace(stbi__context *s, char *c) -{ - for (;;) { - while (!stbi__at_eof(s) && stbi__pnm_isspace(*c)) - *c = (char) stbi__get8(s); - - if (stbi__at_eof(s) || *c != '#') - break; - - while (!stbi__at_eof(s) && *c != '\n' && *c != '\r' ) - *c = (char) stbi__get8(s); - } -} - -static int stbi__pnm_isdigit(char c) -{ - return c >= '0' && c <= '9'; -} - -static int stbi__pnm_getinteger(stbi__context *s, char *c) -{ - int value = 0; - - while (!stbi__at_eof(s) && stbi__pnm_isdigit(*c)) { - value = value*10 + (*c - '0'); - *c = (char) stbi__get8(s); - } - - return value; -} - -static int stbi__pnm_info(stbi__context *s, int *x, int *y, int *comp) -{ - int maxv, dummy; - char c, p, t; - - if (!x) x = &dummy; - if (!y) y = &dummy; - if (!comp) comp = &dummy; - - stbi__rewind(s); - - // Get identifier - p = (char) stbi__get8(s); - t = (char) stbi__get8(s); - if (p != 'P' || (t != '5' && t != '6')) { - stbi__rewind(s); - return 0; - } - - *comp = (t == '6') ? 3 : 1; // '5' is 1-component .pgm; '6' is 3-component .ppm - - c = (char) stbi__get8(s); - stbi__pnm_skip_whitespace(s, &c); - - *x = stbi__pnm_getinteger(s, &c); // read width - stbi__pnm_skip_whitespace(s, &c); - - *y = stbi__pnm_getinteger(s, &c); // read height - stbi__pnm_skip_whitespace(s, &c); - - maxv = stbi__pnm_getinteger(s, &c); // read max value - - if (maxv > 255) - return stbi__err("max value > 255", "PPM image not 8-bit"); - else - return 1; -} -#endif - -static int stbi__info_main(stbi__context *s, int *x, int *y, int *comp) -{ - #ifndef STBI_NO_JPEG - if (stbi__jpeg_info(s, x, y, comp)) return 1; - #endif - - #ifndef STBI_NO_PNG - if (stbi__png_info(s, x, y, comp)) return 1; - #endif - - #ifndef STBI_NO_GIF - if (stbi__gif_info(s, x, y, comp)) return 1; - #endif - - #ifndef STBI_NO_BMP - if (stbi__bmp_info(s, x, y, comp)) return 1; - #endif - - #ifndef STBI_NO_PSD - if (stbi__psd_info(s, x, y, comp)) return 1; - #endif - - #ifndef STBI_NO_PIC - if (stbi__pic_info(s, x, y, comp)) return 1; - #endif - - #ifndef STBI_NO_PNM - if (stbi__pnm_info(s, x, y, comp)) return 1; - #endif - - #ifndef STBI_NO_HDR - if (stbi__hdr_info(s, x, y, comp)) return 1; - #endif - - // test tga last because it's a crappy test! - #ifndef STBI_NO_TGA - if (stbi__tga_info(s, x, y, comp)) - return 1; - #endif - return stbi__err("unknown image type", "Image not of any known type, or corrupt"); -} - -#ifndef STBI_NO_STDIO -STBIDEF int stbi_info(char const *filename, int *x, int *y, int *comp) -{ - FILE *f = stbi__fopen(filename, "rb"); - int result; - if (!f) return stbi__err("can't fopen", "Unable to open file"); - result = stbi_info_from_file(f, x, y, comp); - fclose(f); - return result; -} - -STBIDEF int stbi_info_from_file(FILE *f, int *x, int *y, int *comp) -{ - int r; - stbi__context s; - long pos = ftell(f); - stbi__start_file(&s, f); - r = stbi__info_main(&s,x,y,comp); - fseek(f,pos,SEEK_SET); - return r; -} -#endif // !STBI_NO_STDIO - -STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp) -{ - stbi__context s; - stbi__start_mem(&s,buffer,len); - return stbi__info_main(&s,x,y,comp); -} - -STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *c, void *user, int *x, int *y, int *comp) -{ - stbi__context s; - stbi__start_callbacks(&s, (stbi_io_callbacks *) c, user); - return stbi__info_main(&s,x,y,comp); -} - -#endif // STB_IMAGE_IMPLEMENTATION - -/* - revision history: - 2.16 (2017-07-23) all functions have 16-bit variants; - STBI_NO_STDIO works again; - compilation fixes; - fix rounding in unpremultiply; - optimize vertical flip; - disable raw_len validation; - documentation fixes - 2.15 (2017-03-18) fix png-1,2,4 bug; now all Imagenet JPGs decode; - warning fixes; disable run-time SSE detection on gcc; - uniform handling of optional "return" values; - thread-safe initialization of zlib tables - 2.14 (2017-03-03) remove deprecated STBI_JPEG_OLD; fixes for Imagenet JPGs - 2.13 (2016-11-29) add 16-bit API, only supported for PNG right now - 2.12 (2016-04-02) fix typo in 2.11 PSD fix that caused crashes - 2.11 (2016-04-02) allocate large structures on the stack - remove white matting for transparent PSD - fix reported channel count for PNG & BMP - re-enable SSE2 in non-gcc 64-bit - support RGB-formatted JPEG - read 16-bit PNGs (only as 8-bit) - 2.10 (2016-01-22) avoid warning introduced in 2.09 by STBI_REALLOC_SIZED - 2.09 (2016-01-16) allow comments in PNM files - 16-bit-per-pixel TGA (not bit-per-component) - info() for TGA could break due to .hdr handling - info() for BMP to shares code instead of sloppy parse - can use STBI_REALLOC_SIZED if allocator doesn't support realloc - code cleanup - 2.08 (2015-09-13) fix to 2.07 cleanup, reading RGB PSD as RGBA - 2.07 (2015-09-13) fix compiler warnings - partial animated GIF support - limited 16-bpc PSD support - #ifdef unused functions - bug with < 92 byte PIC,PNM,HDR,TGA - 2.06 (2015-04-19) fix bug where PSD returns wrong '*comp' value - 2.05 (2015-04-19) fix bug in progressive JPEG handling, fix warning - 2.04 (2015-04-15) try to re-enable SIMD on MinGW 64-bit - 2.03 (2015-04-12) extra corruption checking (mmozeiko) - stbi_set_flip_vertically_on_load (nguillemot) - fix NEON support; fix mingw support - 2.02 (2015-01-19) fix incorrect assert, fix warning - 2.01 (2015-01-17) fix various warnings; suppress SIMD on gcc 32-bit without -msse2 - 2.00b (2014-12-25) fix STBI_MALLOC in progressive JPEG - 2.00 (2014-12-25) optimize JPG, including x86 SSE2 & NEON SIMD (ryg) - progressive JPEG (stb) - PGM/PPM support (Ken Miller) - STBI_MALLOC,STBI_REALLOC,STBI_FREE - GIF bugfix -- seemingly never worked - STBI_NO_*, STBI_ONLY_* - 1.48 (2014-12-14) fix incorrectly-named assert() - 1.47 (2014-12-14) 1/2/4-bit PNG support, both direct and paletted (Omar Cornut & stb) - optimize PNG (ryg) - fix bug in interlaced PNG with user-specified channel count (stb) - 1.46 (2014-08-26) - fix broken tRNS chunk (colorkey-style transparency) in non-paletted PNG - 1.45 (2014-08-16) - fix MSVC-ARM internal compiler error by wrapping malloc - 1.44 (2014-08-07) - various warning fixes from Ronny Chevalier - 1.43 (2014-07-15) - fix MSVC-only compiler problem in code changed in 1.42 - 1.42 (2014-07-09) - don't define _CRT_SECURE_NO_WARNINGS (affects user code) - fixes to stbi__cleanup_jpeg path - added STBI_ASSERT to avoid requiring assert.h - 1.41 (2014-06-25) - fix search&replace from 1.36 that messed up comments/error messages - 1.40 (2014-06-22) - fix gcc struct-initialization warning - 1.39 (2014-06-15) - fix to TGA optimization when req_comp != number of components in TGA; - fix to GIF loading because BMP wasn't rewinding (whoops, no GIFs in my test suite) - add support for BMP version 5 (more ignored fields) - 1.38 (2014-06-06) - suppress MSVC warnings on integer casts truncating values - fix accidental rename of 'skip' field of I/O - 1.37 (2014-06-04) - remove duplicate typedef - 1.36 (2014-06-03) - convert to header file single-file library - if de-iphone isn't set, load iphone images color-swapped instead of returning NULL - 1.35 (2014-05-27) - various warnings - fix broken STBI_SIMD path - fix bug where stbi_load_from_file no longer left file pointer in correct place - fix broken non-easy path for 32-bit BMP (possibly never used) - TGA optimization by Arseny Kapoulkine - 1.34 (unknown) - use STBI_NOTUSED in stbi__resample_row_generic(), fix one more leak in tga failure case - 1.33 (2011-07-14) - make stbi_is_hdr work in STBI_NO_HDR (as specified), minor compiler-friendly improvements - 1.32 (2011-07-13) - support for "info" function for all supported filetypes (SpartanJ) - 1.31 (2011-06-20) - a few more leak fixes, bug in PNG handling (SpartanJ) - 1.30 (2011-06-11) - added ability to load files via callbacks to accomidate custom input streams (Ben Wenger) - removed deprecated format-specific test/load functions - removed support for installable file formats (stbi_loader) -- would have been broken for IO callbacks anyway - error cases in bmp and tga give messages and don't leak (Raymond Barbiero, grisha) - fix inefficiency in decoding 32-bit BMP (David Woo) - 1.29 (2010-08-16) - various warning fixes from Aurelien Pocheville - 1.28 (2010-08-01) - fix bug in GIF palette transparency (SpartanJ) - 1.27 (2010-08-01) - cast-to-stbi_uc to fix warnings - 1.26 (2010-07-24) - fix bug in file buffering for PNG reported by SpartanJ - 1.25 (2010-07-17) - refix trans_data warning (Won Chun) - 1.24 (2010-07-12) - perf improvements reading from files on platforms with lock-heavy fgetc() - minor perf improvements for jpeg - deprecated type-specific functions so we'll get feedback if they're needed - attempt to fix trans_data warning (Won Chun) - 1.23 fixed bug in iPhone support - 1.22 (2010-07-10) - removed image *writing* support - stbi_info support from Jetro Lauha - GIF support from Jean-Marc Lienher - iPhone PNG-extensions from James Brown - warning-fixes from Nicolas Schulz and Janez Zemva (i.stbi__err. Janez (U+017D)emva) - 1.21 fix use of 'stbi_uc' in header (reported by jon blow) - 1.20 added support for Softimage PIC, by Tom Seddon - 1.19 bug in interlaced PNG corruption check (found by ryg) - 1.18 (2008-08-02) - fix a threading bug (local mutable static) - 1.17 support interlaced PNG - 1.16 major bugfix - stbi__convert_format converted one too many pixels - 1.15 initialize some fields for thread safety - 1.14 fix threadsafe conversion bug - header-file-only version (#define STBI_HEADER_FILE_ONLY before including) - 1.13 threadsafe - 1.12 const qualifiers in the API - 1.11 Support installable IDCT, colorspace conversion routines - 1.10 Fixes for 64-bit (don't use "unsigned long") - optimized upsampling by Fabian "ryg" Giesen - 1.09 Fix format-conversion for PSD code (bad global variables!) - 1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz - 1.07 attempt to fix C++ warning/errors again - 1.06 attempt to fix C++ warning/errors again - 1.05 fix TGA loading to return correct *comp and use good luminance calc - 1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free - 1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR - 1.02 support for (subset of) HDR files, float interface for preferred access to them - 1.01 fix bug: possible bug in handling right-side up bmps... not sure - fix bug: the stbi__bmp_load() and stbi__tga_load() functions didn't work at all - 1.00 interface to zlib that skips zlib header - 0.99 correct handling of alpha in palette - 0.98 TGA loader by lonesock; dynamically add loaders (untested) - 0.97 jpeg errors on too large a file; also catch another malloc failure - 0.96 fix detection of invalid v value - particleman@mollyrocket forum - 0.95 during header scan, seek to markers in case of padding - 0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same - 0.93 handle jpegtran output; verbose errors - 0.92 read 4,8,16,24,32-bit BMP files of several formats - 0.91 output 24-bit Windows 3.0 BMP files - 0.90 fix a few more warnings; bump version number to approach 1.0 - 0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd - 0.60 fix compiling as c++ - 0.59 fix warnings: merge Dave Moore's -Wall fixes - 0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian - 0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less than 16 available - 0.56 fix bug: zlib uncompressed mode len vs. nlen - 0.55 fix bug: restart_interval not initialized to 0 - 0.54 allow NULL for 'int *comp' - 0.53 fix bug in png 3->4; speedup png decoding - 0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments - 0.51 obey req_comp requests, 1-component jpegs return as 1-component, - on 'test' only check type, not whether we support this variant - 0.50 (2006-11-19) - first released version -*/ - - -/* ------------------------------------------------------------------------------- -This software is available under 2 licenses -- choose whichever you prefer. ------------------------------------------------------------------------------- -ALTERNATIVE A - MIT License -Copyright (c) 2017 Sean Barrett -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. ------------------------------------------------------------------------------- -ALTERNATIVE B - Public Domain (www.unlicense.org) -This is free and unencumbered software released into the public domain. -Anyone is free to copy, modify, publish, use, compile, sell, or distribute this -software, either in source code form or as a compiled binary, for any purpose, -commercial or non-commercial, and by any means. -In jurisdictions that recognize copyright laws, the author or authors of this -software dedicate any and all copyright interest in the software to the public -domain. We make this dedication for the benefit of the public at large and to -the detriment of our heirs and successors. We intend this dedication to be an -overt act of relinquishment in perpetuity of all present and future rights to -this software under copyright law. -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 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/love/src/jni/love/src/libraries/tinyexr/tinyexr.h b/love/src/jni/love/src/libraries/tinyexr/tinyexr.h deleted file mode 100755 index 606c1975..00000000 --- a/love/src/jni/love/src/libraries/tinyexr/tinyexr.h +++ /dev/null @@ -1,12579 +0,0 @@ -/* -Copyright (c) 2014 - 2017, Syoyo Fujita -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 Syoyo Fujita 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 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. -*/ - -// TinyEXR contains some OpenEXR code, which is licensed under ------------ - -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// 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 Industrial Light & Magic 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 THE COPYRIGHT -// OWNER OR CONTRIBUTORS 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. -// -/////////////////////////////////////////////////////////////////////////// - -// End of OpenEXR license ------------------------------------------------- - -#ifndef TINYEXR_H_ -#define TINYEXR_H_ - -// -// -// Do this: -// #define TINYEXR_IMPLEMENTATION -// before you include this file in *one* C or C++ file to create the -// implementation. -// -// // i.e. it should look like this: -// #include ... -// #include ... -// #include ... -// #define TINYEXR_IMPLEMENTATION -// #include "tinyexr.h" -// -// - -#include // for size_t -#include // guess stdint.h is available(C99) - -#ifdef __cplusplus -extern "C" { -#endif - -// Use embedded miniz or not to decode ZIP format pixel. Linking with zlib -// required if this flas is 0. -#ifndef TINYEXR_USE_MINIZ -#define TINYEXR_USE_MINIZ (1) -#endif - -// Disable PIZ comporession when applying cpplint. -#ifndef TINYEXR_USE_PIZ -#define TINYEXR_USE_PIZ (1) -#endif - -#ifndef TINYEXR_USE_ZFP -#define TINYEXR_USE_ZFP (0) // TinyEXR extension. -// http://computation.llnl.gov/projects/floating-point-compression -#endif - -#define TINYEXR_SUCCESS (0) -#define TINYEXR_ERROR_INVALID_MAGIC_NUMBER (-1) -#define TINYEXR_ERROR_INVALID_EXR_VERSION (-2) -#define TINYEXR_ERROR_INVALID_ARGUMENT (-3) -#define TINYEXR_ERROR_INVALID_DATA (-4) -#define TINYEXR_ERROR_INVALID_FILE (-5) -#define TINYEXR_ERROR_INVALID_PARAMETER (-5) -#define TINYEXR_ERROR_CANT_OPEN_FILE (-6) -#define TINYEXR_ERROR_UNSUPPORTED_FORMAT (-7) -#define TINYEXR_ERROR_INVALID_HEADER (-8) - -// @note { OpenEXR file format: http://www.openexr.com/openexrfilelayout.pdf } - -// pixel type: possible values are: UINT = 0 HALF = 1 FLOAT = 2 -#define TINYEXR_PIXELTYPE_UINT (0) -#define TINYEXR_PIXELTYPE_HALF (1) -#define TINYEXR_PIXELTYPE_FLOAT (2) - -#define TINYEXR_MAX_ATTRIBUTES (128) - -#define TINYEXR_COMPRESSIONTYPE_NONE (0) -#define TINYEXR_COMPRESSIONTYPE_RLE (1) -#define TINYEXR_COMPRESSIONTYPE_ZIPS (2) -#define TINYEXR_COMPRESSIONTYPE_ZIP (3) -#define TINYEXR_COMPRESSIONTYPE_PIZ (4) -#define TINYEXR_COMPRESSIONTYPE_ZFP (128) // TinyEXR extension - -#define TINYEXR_ZFP_COMPRESSIONTYPE_RATE (0) -#define TINYEXR_ZFP_COMPRESSIONTYPE_PRECISION (1) -#define TINYEXR_ZFP_COMPRESSIONTYPE_ACCURACY (2) - -#define TINYEXR_TILE_ONE_LEVEL (0) -#define TINYEXR_TILE_MIPMAP_LEVELS (1) -#define TINYEXR_TILE_RIPMAP_LEVELS (2) - -#define TINYEXR_TILE_ROUND_DOWN (0) -#define TINYEXR_TILE_ROUND_UP (1) - -typedef struct _EXRVersion { - int version; // this must be 2 - int tiled; // tile format image - int long_name; // long name attribute - int non_image; // deep image(EXR 2.0) - int multipart; // multi-part(EXR 2.0) -} EXRVersion; - -typedef struct _EXRAttribute { - char name[256]; // name and type are up to 255 chars long. - char type[256]; - unsigned char *value; // uint8_t* - int size; - int pad0; -} EXRAttribute; - -typedef struct _EXRChannelInfo { - char name[256]; // less than 255 bytes long - int pixel_type; - int x_sampling; - int y_sampling; - unsigned char p_linear; - unsigned char pad[3]; -} EXRChannelInfo; - -typedef struct _EXRTile { - int offset_x; - int offset_y; - int level_x; - int level_y; - - int width; // actual width in a tile. - int height; // actual height int a tile. - - unsigned char **images; // image[channels][pixels] -} EXRTile; - -typedef struct _EXRHeader { - float pixel_aspect_ratio; - int line_order; - int data_window[4]; - int display_window[4]; - float screen_window_center[2]; - float screen_window_width; - - int chunk_count; - - // Properties for tiled format(`tiledesc`). - int tiled; - int tile_size_x; - int tile_size_y; - int tile_level_mode; - int tile_rounding_mode; - - int long_name; - int non_image; - int multipart; - unsigned int header_len; - - // Custom attributes(exludes required attributes(e.g. `channels`, - // `compression`, etc) - int num_custom_attributes; - EXRAttribute custom_attributes[TINYEXR_MAX_ATTRIBUTES]; - - EXRChannelInfo *channels; // [num_channels] - - int *pixel_types; // Loaded pixel type(TINYEXR_PIXELTYPE_*) of `images` for - // each channel. This is overwritten with `requested_pixel_types` when - // loading. - int num_channels; - - int compression_type; // compression type(TINYEXR_COMPRESSIONTYPE_*) - int *requested_pixel_types; // Filled initially by - // ParseEXRHeaderFrom(Meomory|File), then users - // can edit it(only valid for HALF pixel type - // channel) - -} EXRHeader; - -typedef struct _EXRMultiPartHeader { - int num_headers; - EXRHeader *headers; - -} EXRMultiPartHeader; - -typedef struct _EXRImage { - EXRTile *tiles; // Tiled pixel data. The application must reconstruct image - // from tiles manually. NULL if scanline format. - unsigned char **images; // image[channels][pixels]. NULL if tiled format. - - int width; - int height; - int num_channels; - - // Properties for tile format. - int num_tiles; - -} EXRImage; - -typedef struct _EXRMultiPartImage { - int num_images; - EXRImage *images; - -} EXRMultiPartImage; - -typedef struct _DeepImage { - const char **channel_names; - float ***image; // image[channels][scanlines][samples] - int **offset_table; // offset_table[scanline][offsets] - int num_channels; - int width; - int height; - int pad0; -} DeepImage; - -// @deprecated { to be removed. } -// Loads single-frame OpenEXR image. Assume EXR image contains A(single channel -// alpha) or RGB(A) channels. -// Application must free image data as returned by `out_rgba` -// Result image format is: float x RGBA x width x hight -// Returns negative value and may set error string in `err` when there's an -// error -extern int LoadEXR(float **out_rgba, int *width, int *height, - const char *filename, const char **err); - -// @deprecated { to be removed. } -// Saves single-frame OpenEXR image. Assume EXR image contains RGB(A) channels. -// components must be 1(Grayscale), 3(RGB) or 4(RGBA). -// Input image format is: `float x width x height`, or `float x RGB(A) x width x -// hight` -// Save image as fp16(HALF) format when `save_as_fp16` is positive non-zero -// value. -// Save image as fp32(FLOAT) format when `save_as_fp16` is 0. -extern int SaveEXR(const float *data, const int width, const int height, - const int components, const int save_as_fp16, - const char *filename); - -// Initialize EXRHeader struct -extern void InitEXRHeader(EXRHeader *exr_header); - -// Initialize EXRImage struct -extern void InitEXRImage(EXRImage *exr_image); - -// Free's internal data of EXRHeader struct -extern int FreeEXRHeader(EXRHeader *exr_header); - -// Free's internal data of EXRImage struct -extern int FreeEXRImage(EXRImage *exr_image); - -// Parse EXR version header of a file. -extern int ParseEXRVersionFromFile(EXRVersion *version, const char *filename); - -// Parse EXR version header from memory-mapped EXR data. -extern int ParseEXRVersionFromMemory(EXRVersion *version, - const unsigned char *memory, size_t size); - -// Parse single-part OpenEXR header from a file and initialize `EXRHeader`. -extern int ParseEXRHeaderFromFile(EXRHeader *header, const EXRVersion *version, - const char *filename, const char **err); - -// Parse single-part OpenEXR header from a memory and initialize `EXRHeader`. -extern int ParseEXRHeaderFromMemory(EXRHeader *header, - const EXRVersion *version, - const unsigned char *memory, size_t size, - const char **err); - -// Parse multi-part OpenEXR headers from a file and initialize `EXRHeader*` -// array. -extern int ParseEXRMultipartHeaderFromFile(EXRHeader ***headers, - int *num_headers, - const EXRVersion *version, - const char *filename, - const char **err); - -// Parse multi-part OpenEXR headers from a memory and initialize `EXRHeader*` -// array -extern int ParseEXRMultipartHeaderFromMemory(EXRHeader ***headers, - int *num_headers, - const EXRVersion *version, - const unsigned char *memory, - size_t size, const char **err); - -// Loads single-part OpenEXR image from a file. -// Application must setup `ParseEXRHeaderFromFile` before calling this function. -// Application can free EXRImage using `FreeEXRImage` -// Returns negative value and may set error string in `err` when there's an -// error -extern int LoadEXRImageFromFile(EXRImage *image, const EXRHeader *header, - const char *filename, const char **err); - -// Loads single-part OpenEXR image from a memory. -// Application must setup `EXRHeader` with -// `ParseEXRHeaderFromMemory` before calling this function. -// Application can free EXRImage using `FreeEXRImage` -// Returns negative value and may set error string in `err` when there's an -// error -extern int LoadEXRImageFromMemory(EXRImage *image, const EXRHeader *header, - const unsigned char *memory, - const size_t size, const char **err); - -// Loads multi-part OpenEXR image from a file. -// Application must setup `ParseEXRMultipartHeaderFromFile` before calling this -// function. -// Application can free EXRImage using `FreeEXRImage` -// Returns negative value and may set error string in `err` when there's an -// error -extern int LoadEXRMultipartImageFromFile(EXRImage *images, - const EXRHeader **headers, - unsigned int num_parts, - const char *filename, - const char **err); - -// Loads multi-part OpenEXR image from a memory. -// Application must setup `EXRHeader*` array with -// `ParseEXRMultipartHeaderFromMemory` before calling this function. -// Application can free EXRImage using `FreeEXRImage` -// Returns negative value and may set error string in `err` when there's an -// error -extern int LoadEXRMultipartImageFromMemory(EXRImage *images, - const EXRHeader **headers, - unsigned int num_parts, - const unsigned char *memory, - const size_t size, const char **err); - -// Saves multi-channel, single-frame OpenEXR image to a file. -// Returns negative value and may set error string in `err` when there's an -// error -extern int SaveEXRImageToFile(const EXRImage *image, - const EXRHeader *exr_header, const char *filename, - const char **err); - -// Saves multi-channel, single-frame OpenEXR image to a memory. -// Image is compressed using EXRImage.compression value. -// Return the number of bytes if succes. -// Returns negative value and may set error string in `err` when there's an -// error -extern size_t SaveEXRImageToMemory(const EXRImage *image, - const EXRHeader *exr_header, - unsigned char **memory, const char **err); - -// Loads single-frame OpenEXR deep image. -// Application must free memory of variables in DeepImage(image, offset_table) -// Returns negative value and may set error string in `err` when there's an -// error -extern int LoadDeepEXR(DeepImage *out_image, const char *filename, - const char **err); - -// NOT YET IMPLEMENTED: -// Saves single-frame OpenEXR deep image. -// Returns negative value and may set error string in `err` when there's an -// error -// extern int SaveDeepEXR(const DeepImage *in_image, const char *filename, -// const char **err); - -// NOT YET IMPLEMENTED: -// Loads multi-part OpenEXR deep image. -// Application must free memory of variables in DeepImage(image, offset_table) -// extern int LoadMultiPartDeepEXR(DeepImage **out_image, int num_parts, const -// char *filename, -// const char **err); - -// For emscripten. -// Loads single-frame OpenEXR image from memory. Assume EXR image contains -// RGB(A) channels. -// Returns negative value and may set error string in `err` when there's an -// error -extern int LoadEXRFromMemory(float **out_rgba, int *width, int *height, - const unsigned char *memory, size_t size, - const char **err); - -#ifdef __cplusplus -} -#endif - -#endif // TINYEXR_H_ - -#ifdef TINYEXR_IMPLEMENTATION -#ifndef TINYEXR_IMPLEMENTATION_DEIFNED -#define TINYEXR_IMPLEMENTATION_DEIFNED - -#include -#include -#include -#include -#include -#include - -#include -#include - -#if __cplusplus > 199711L -// C++11 -#include -#endif // __cplusplus > 199711L - -#ifdef _OPENMP -#include -#endif - -#if TINYEXR_USE_MINIZ -#else -// Issue #46. Please include your own zlib-compatible API header before including `tinyexr.h` -//#include "zlib.h" -#endif - -#if TINYEXR_USE_ZFP -#include "zfp.h" -#endif - -namespace tinyexr { - -#if __cplusplus > 199711L -// C++11 -typedef uint64_t tinyexr_uint64; -typedef int64_t tinyexr_int64; -#else -// Although `long long` is not a standard type pre C++11, assume it is defined -// as a compiler's extension. -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wc++11-long-long" -#endif -typedef unsigned long long tinyexr_uint64; -typedef long long tinyexr_int64; -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#endif - -#if TINYEXR_USE_MINIZ - -namespace miniz { - -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wc++11-long-long" -#pragma clang diagnostic ignored "-Wold-style-cast" -#pragma clang diagnostic ignored "-Wpadded" -#pragma clang diagnostic ignored "-Wsign-conversion" -#pragma clang diagnostic ignored "-Wc++11-extensions" -#pragma clang diagnostic ignored "-Wconversion" -#pragma clang diagnostic ignored "-Wunused-function" -#if __has_warning("-Wcomma") -#pragma clang diagnostic ignored "-Wcomma" -#endif -#endif - -/* miniz.c v1.15 - public domain deflate/inflate, zlib-subset, ZIP - reading/writing/appending, PNG writing - See "unlicense" statement at the end of this file. - Rich Geldreich , last updated Oct. 13, 2013 - Implements RFC 1950: http://www.ietf.org/rfc/rfc1950.txt and RFC 1951: - http://www.ietf.org/rfc/rfc1951.txt - - Most API's defined in miniz.c are optional. For example, to disable the - archive related functions just define - MINIZ_NO_ARCHIVE_APIS, or to get rid of all stdio usage define MINIZ_NO_STDIO - (see the list below for more macros). - - * Change History - 10/13/13 v1.15 r4 - Interim bugfix release while I work on the next major - release with Zip64 support (almost there!): - - Critical fix for the MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY bug - (thanks kahmyong.moon@hp.com) which could cause locate files to not find - files. This bug - would only have occured in earlier versions if you explicitly used this - flag, OR if you used mz_zip_extract_archive_file_to_heap() or - mz_zip_add_mem_to_archive_file_in_place() - (which used this flag). If you can't switch to v1.15 but want to fix - this bug, just remove the uses of this flag from both helper funcs (and of - course don't use the flag). - - Bugfix in mz_zip_reader_extract_to_mem_no_alloc() from kymoon when - pUser_read_buf is not NULL and compressed size is > uncompressed size - - Fixing mz_zip_reader_extract_*() funcs so they don't try to extract - compressed data from directory entries, to account for weird zipfiles which - contain zero-size compressed data on dir entries. - Hopefully this fix won't cause any issues on weird zip archives, - because it assumes the low 16-bits of zip external attributes are DOS - attributes (which I believe they always are in practice). - - Fixing mz_zip_reader_is_file_a_directory() so it doesn't check the - internal attributes, just the filename and external attributes - - mz_zip_reader_init_file() - missing MZ_FCLOSE() call if the seek failed - - Added cmake support for Linux builds which builds all the examples, - tested with clang v3.3 and gcc v4.6. - - Clang fix for tdefl_write_image_to_png_file_in_memory() from toffaletti - - Merged MZ_FORCEINLINE fix from hdeanclark - - Fix include before config #ifdef, thanks emil.brink - - Added tdefl_write_image_to_png_file_in_memory_ex(): supports Y flipping - (super useful for OpenGL apps), and explicit control over the compression - level (so you can - set it to 1 for real-time compression). - - Merged in some compiler fixes from paulharris's github repro. - - Retested this build under Windows (VS 2010, including static analysis), - tcc 0.9.26, gcc v4.6 and clang v3.3. - - Added example6.c, which dumps an image of the mandelbrot set to a PNG - file. - - Modified example2 to help test the - MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY flag more. - - In r3: Bugfix to mz_zip_writer_add_file() found during merge: Fix - possible src file fclose() leak if alignment bytes+local header file write - faiiled - - In r4: Minor bugfix to mz_zip_writer_add_from_zip_reader(): - Was pushing the wrong central dir header offset, appears harmless in this - release, but it became a problem in the zip64 branch - 5/20/12 v1.14 - MinGW32/64 GCC 4.6.1 compiler fixes: added MZ_FORCEINLINE, - #include (thanks fermtect). - 5/19/12 v1.13 - From jason@cornsyrup.org and kelwert@mtu.edu - Fix - mz_crc32() so it doesn't compute the wrong CRC-32's when mz_ulong is 64-bit. - - Temporarily/locally slammed in "typedef unsigned long mz_ulong" and - re-ran a randomized regression test on ~500k files. - - Eliminated a bunch of warnings when compiling with GCC 32-bit/64. - - Ran all examples, miniz.c, and tinfl.c through MSVC 2008's /analyze - (static analysis) option and fixed all warnings (except for the silly - "Use of the comma-operator in a tested expression.." analysis warning, - which I purposely use to work around a MSVC compiler warning). - - Created 32-bit and 64-bit Codeblocks projects/workspace. Built and - tested Linux executables. The codeblocks workspace is compatible with - Linux+Win32/x64. - - Added miniz_tester solution/project, which is a useful little app - derived from LZHAM's tester app that I use as part of the regression test. - - Ran miniz.c and tinfl.c through another series of regression testing on - ~500,000 files and archives. - - Modified example5.c so it purposely disables a bunch of high-level - functionality (MINIZ_NO_STDIO, etc.). (Thanks to corysama for the - MINIZ_NO_STDIO bug report.) - - Fix ftell() usage in examples so they exit with an error on files which - are too large (a limitation of the examples, not miniz itself). - 4/12/12 v1.12 - More comments, added low-level example5.c, fixed a couple - minor level_and_flags issues in the archive API's. - level_and_flags can now be set to MZ_DEFAULT_COMPRESSION. Thanks to Bruce - Dawson for the feedback/bug report. - 5/28/11 v1.11 - Added statement from unlicense.org - 5/27/11 v1.10 - Substantial compressor optimizations: - - Level 1 is now ~4x faster than before. The L1 compressor's throughput - now varies between 70-110MB/sec. on a - - Core i7 (actual throughput varies depending on the type of data, and x64 - vs. x86). - - Improved baseline L2-L9 compression perf. Also, greatly improved - compression perf. issues on some file types. - - Refactored the compression code for better readability and - maintainability. - - Added level 10 compression level (L10 has slightly better ratio than - level 9, but could have a potentially large - drop in throughput on some files). - 5/15/11 v1.09 - Initial stable release. - - * Low-level Deflate/Inflate implementation notes: - - Compression: Use the "tdefl" API's. The compressor supports raw, static, - and dynamic blocks, lazy or - greedy parsing, match length filtering, RLE-only, and Huffman-only streams. - It performs and compresses - approximately as well as zlib. - - Decompression: Use the "tinfl" API's. The entire decompressor is - implemented as a single function - coroutine: see tinfl_decompress(). It supports decompression into a 32KB - (or larger power of 2) wrapping buffer, or into a memory - block large enough to hold the entire file. - - The low-level tdefl/tinfl API's do not make any use of dynamic memory - allocation. - - * zlib-style API notes: - - miniz.c implements a fairly large subset of zlib. There's enough - functionality present for it to be a drop-in - zlib replacement in many apps: - The z_stream struct, optional memory allocation callbacks - deflateInit/deflateInit2/deflate/deflateReset/deflateEnd/deflateBound - inflateInit/inflateInit2/inflate/inflateEnd - compress, compress2, compressBound, uncompress - CRC-32, Adler-32 - Using modern, minimal code size, CPU cache friendly - routines. - Supports raw deflate streams or standard zlib streams with adler-32 - checking. - - Limitations: - The callback API's are not implemented yet. No support for gzip headers or - zlib static dictionaries. - I've tried to closely emulate zlib's various flavors of stream flushing - and return status codes, but - there are no guarantees that miniz.c pulls this off perfectly. - - * PNG writing: See the tdefl_write_image_to_png_file_in_memory() function, - originally written by - Alex Evans. Supports 1-4 bytes/pixel images. - - * ZIP archive API notes: - - The ZIP archive API's where designed with simplicity and efficiency in - mind, with just enough abstraction to - get the job done with minimal fuss. There are simple API's to retrieve file - information, read files from - existing archives, create new archives, append new files to existing - archives, or clone archive data from - one archive to another. It supports archives located in memory or the heap, - on disk (using stdio.h), - or you can specify custom file read/write callbacks. - - - Archive reading: Just call this function to read a single file from a - disk archive: - - void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, const - char *pArchive_name, - size_t *pSize, mz_uint zip_flags); - - For more complex cases, use the "mz_zip_reader" functions. Upon opening an - archive, the entire central - directory is located and read as-is into memory, and subsequent file access - only occurs when reading individual files. - - - Archives file scanning: The simple way is to use this function to scan a - loaded archive for a specific file: - - int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, - const char *pComment, mz_uint flags); - - The locate operation can optionally check file comments too, which (as one - example) can be used to identify - multiple versions of the same file in an archive. This function uses a - simple linear search through the central - directory, so it's not very fast. - - Alternately, you can iterate through all the files in an archive (using - mz_zip_reader_get_num_files()) and - retrieve detailed info on each file by calling mz_zip_reader_file_stat(). - - - Archive creation: Use the "mz_zip_writer" functions. The ZIP writer - immediately writes compressed file data - to disk and builds an exact image of the central directory in memory. The - central directory image is written - all at once at the end of the archive file when the archive is finalized. - - The archive writer can optionally align each file's local header and file - data to any power of 2 alignment, - which can be useful when the archive will be read from optical media. Also, - the writer supports placing - arbitrary data blobs at the very beginning of ZIP archives. Archives - written using either feature are still - readable by any ZIP tool. - - - Archive appending: The simple way to add a single file to an archive is - to call this function: - - mz_bool mz_zip_add_mem_to_archive_file_in_place(const char *pZip_filename, - const char *pArchive_name, - const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 - comment_size, mz_uint level_and_flags); - - The archive will be created if it doesn't already exist, otherwise it'll be - appended to. - Note the appending is done in-place and is not an atomic operation, so if - something goes wrong - during the operation it's possible the archive could be left without a - central directory (although the local - file headers and file data will be fine, so the archive will be - recoverable). - - For more complex archive modification scenarios: - 1. The safest way is to use a mz_zip_reader to read the existing archive, - cloning only those bits you want to - preserve into a new archive using using the - mz_zip_writer_add_from_zip_reader() function (which compiles the - compressed file data as-is). When you're done, delete the old archive and - rename the newly written archive, and - you're done. This is safe but requires a bunch of temporary disk space or - heap memory. - - 2. Or, you can convert an mz_zip_reader in-place to an mz_zip_writer using - mz_zip_writer_init_from_reader(), - append new files as needed, then finalize the archive which will write an - updated central directory to the - original archive. (This is basically what - mz_zip_add_mem_to_archive_file_in_place() does.) There's a - possibility that the archive's central directory could be lost with this - method if anything goes wrong, though. - - - ZIP archive support limitations: - No zip64 or spanning support. Extraction functions can only handle - unencrypted, stored or deflated files. - Requires streams capable of seeking. - - * This is a header file library, like stb_image.c. To get only a header file, - either cut and paste the - below header, or create miniz.h, #define MINIZ_HEADER_FILE_ONLY, and then - include miniz.c from it. - - * Important: For best perf. be sure to customize the below macros for your - target platform: - #define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 1 - #define MINIZ_LITTLE_ENDIAN 1 - #define MINIZ_HAS_64BIT_REGISTERS 1 - - * On platforms using glibc, Be sure to "#define _LARGEFILE64_SOURCE 1" before - including miniz.c to ensure miniz - uses the 64-bit variants: fopen64(), stat64(), etc. Otherwise you won't be - able to process large files - (i.e. 32-bit stat() fails for me on files > 0x7FFFFFFF bytes). -*/ - -#ifndef MINIZ_HEADER_INCLUDED -#define MINIZ_HEADER_INCLUDED - -//#include - -// Defines to completely disable specific portions of miniz.c: -// If all macros here are defined the only functionality remaining will be -// CRC-32, adler-32, tinfl, and tdefl. - -// Define MINIZ_NO_STDIO to disable all usage and any functions which rely on -// stdio for file I/O. -//#define MINIZ_NO_STDIO - -// If MINIZ_NO_TIME is specified then the ZIP archive functions will not be able -// to get the current time, or -// get/set file times, and the C run-time funcs that get/set times won't be -// called. -// The current downside is the times written to your archives will be from 1979. -#define MINIZ_NO_TIME - -// Define MINIZ_NO_ARCHIVE_APIS to disable all ZIP archive API's. -#define MINIZ_NO_ARCHIVE_APIS - -// Define MINIZ_NO_ARCHIVE_APIS to disable all writing related ZIP archive -// API's. -//#define MINIZ_NO_ARCHIVE_WRITING_APIS - -// Define MINIZ_NO_ZLIB_APIS to remove all ZLIB-style compression/decompression -// API's. -//#define MINIZ_NO_ZLIB_APIS - -// Define MINIZ_NO_ZLIB_COMPATIBLE_NAME to disable zlib names, to prevent -// conflicts against stock zlib. -//#define MINIZ_NO_ZLIB_COMPATIBLE_NAMES - -// Define MINIZ_NO_MALLOC to disable all calls to malloc, free, and realloc. -// Note if MINIZ_NO_MALLOC is defined then the user must always provide custom -// user alloc/free/realloc -// callbacks to the zlib and archive API's, and a few stand-alone helper API's -// which don't provide custom user -// functions (such as tdefl_compress_mem_to_heap() and -// tinfl_decompress_mem_to_heap()) won't work. -//#define MINIZ_NO_MALLOC - -#if defined(__TINYC__) && (defined(__linux) || defined(__linux__)) -// TODO: Work around "error: include file 'sys\utime.h' when compiling with tcc -// on Linux -#define MINIZ_NO_TIME -#endif - -#if !defined(MINIZ_NO_TIME) && !defined(MINIZ_NO_ARCHIVE_APIS) -//#include -#endif - -#if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || \ - defined(__i386) || defined(__i486__) || defined(__i486) || \ - defined(i386) || defined(__ia64__) || defined(__x86_64__) -// MINIZ_X86_OR_X64_CPU is only used to help set the below macros. -#define MINIZ_X86_OR_X64_CPU 1 -#endif - -#if defined(__sparcv9) -// Big endian -#else -#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || MINIZ_X86_OR_X64_CPU -// Set MINIZ_LITTLE_ENDIAN to 1 if the processor is little endian. -#define MINIZ_LITTLE_ENDIAN 1 -#endif -#endif - -#if MINIZ_X86_OR_X64_CPU -// Set MINIZ_USE_UNALIGNED_LOADS_AND_STORES to 1 on CPU's that permit efficient -// integer loads and stores from unaligned addresses. -//#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 1 -#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES \ - 0 // disable to suppress compiler warnings -#endif - -#if defined(_M_X64) || defined(_WIN64) || defined(__MINGW64__) || \ - defined(_LP64) || defined(__LP64__) || defined(__ia64__) || \ - defined(__x86_64__) -// Set MINIZ_HAS_64BIT_REGISTERS to 1 if operations on 64-bit integers are -// reasonably fast (and don't involve compiler generated calls to helper -// functions). -#define MINIZ_HAS_64BIT_REGISTERS 1 -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -// ------------------- zlib-style API Definitions. - -// For more compatibility with zlib, miniz.c uses unsigned long for some -// parameters/struct members. Beware: mz_ulong can be either 32 or 64-bits! -typedef unsigned long mz_ulong; - -// mz_free() internally uses the MZ_FREE() macro (which by default calls free() -// unless you've modified the MZ_MALLOC macro) to release a block allocated from -// the heap. -void mz_free(void *p); - -#define MZ_ADLER32_INIT (1) -// mz_adler32() returns the initial adler-32 value to use when called with -// ptr==NULL. -mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len); - -#define MZ_CRC32_INIT (0) -// mz_crc32() returns the initial CRC-32 value to use when called with -// ptr==NULL. -mz_ulong mz_crc32(mz_ulong crc, const unsigned char *ptr, size_t buf_len); - -// Compression strategies. -enum { - MZ_DEFAULT_STRATEGY = 0, - MZ_FILTERED = 1, - MZ_HUFFMAN_ONLY = 2, - MZ_RLE = 3, - MZ_FIXED = 4 -}; - -// Method -#define MZ_DEFLATED 8 - -#ifndef MINIZ_NO_ZLIB_APIS - -// Heap allocation callbacks. -// Note that mz_alloc_func parameter types purpsosely differ from zlib's: -// items/size is size_t, not unsigned long. -typedef void *(*mz_alloc_func)(void *opaque, size_t items, size_t size); -typedef void (*mz_free_func)(void *opaque, void *address); -typedef void *(*mz_realloc_func)(void *opaque, void *address, size_t items, - size_t size); - -#define MZ_VERSION "9.1.15" -#define MZ_VERNUM 0x91F0 -#define MZ_VER_MAJOR 9 -#define MZ_VER_MINOR 1 -#define MZ_VER_REVISION 15 -#define MZ_VER_SUBREVISION 0 - -// Flush values. For typical usage you only need MZ_NO_FLUSH and MZ_FINISH. The -// other values are for advanced use (refer to the zlib docs). -enum { - MZ_NO_FLUSH = 0, - MZ_PARTIAL_FLUSH = 1, - MZ_SYNC_FLUSH = 2, - MZ_FULL_FLUSH = 3, - MZ_FINISH = 4, - MZ_BLOCK = 5 -}; - -// Return status codes. MZ_PARAM_ERROR is non-standard. -enum { - MZ_OK = 0, - MZ_STREAM_END = 1, - MZ_NEED_DICT = 2, - MZ_ERRNO = -1, - MZ_STREAM_ERROR = -2, - MZ_DATA_ERROR = -3, - MZ_MEM_ERROR = -4, - MZ_BUF_ERROR = -5, - MZ_VERSION_ERROR = -6, - MZ_PARAM_ERROR = -10000 -}; - -// Compression levels: 0-9 are the standard zlib-style levels, 10 is best -// possible compression (not zlib compatible, and may be very slow), -// MZ_DEFAULT_COMPRESSION=MZ_DEFAULT_LEVEL. -enum { - MZ_NO_COMPRESSION = 0, - MZ_BEST_SPEED = 1, - MZ_BEST_COMPRESSION = 9, - MZ_UBER_COMPRESSION = 10, - MZ_DEFAULT_LEVEL = 6, - MZ_DEFAULT_COMPRESSION = -1 -}; - -// Window bits -#define MZ_DEFAULT_WINDOW_BITS 15 - -struct mz_internal_state; - -// Compression/decompression stream struct. -typedef struct mz_stream_s { - const unsigned char *next_in; // pointer to next byte to read - unsigned int avail_in; // number of bytes available at next_in - mz_ulong total_in; // total number of bytes consumed so far - - unsigned char *next_out; // pointer to next byte to write - unsigned int avail_out; // number of bytes that can be written to next_out - mz_ulong total_out; // total number of bytes produced so far - - char *msg; // error msg (unused) - struct mz_internal_state *state; // internal state, allocated by zalloc/zfree - - mz_alloc_func - zalloc; // optional heap allocation function (defaults to malloc) - mz_free_func zfree; // optional heap free function (defaults to free) - void *opaque; // heap alloc function user pointer - - int data_type; // data_type (unused) - mz_ulong adler; // adler32 of the source or uncompressed data - mz_ulong reserved; // not used -} mz_stream; - -typedef mz_stream *mz_streamp; - -// Returns the version string of miniz.c. -const char *mz_version(void); - -// mz_deflateInit() initializes a compressor with default options: -// Parameters: -// pStream must point to an initialized mz_stream struct. -// level must be between [MZ_NO_COMPRESSION, MZ_BEST_COMPRESSION]. -// level 1 enables a specially optimized compression function that's been -// optimized purely for performance, not ratio. -// (This special func. is currently only enabled when -// MINIZ_USE_UNALIGNED_LOADS_AND_STORES and MINIZ_LITTLE_ENDIAN are defined.) -// Return values: -// MZ_OK on success. -// MZ_STREAM_ERROR if the stream is bogus. -// MZ_PARAM_ERROR if the input parameters are bogus. -// MZ_MEM_ERROR on out of memory. -int mz_deflateInit(mz_streamp pStream, int level); - -// mz_deflateInit2() is like mz_deflate(), except with more control: -// Additional parameters: -// method must be MZ_DEFLATED -// window_bits must be MZ_DEFAULT_WINDOW_BITS (to wrap the deflate stream with -// zlib header/adler-32 footer) or -MZ_DEFAULT_WINDOW_BITS (raw deflate/no -// header or footer) -// mem_level must be between [1, 9] (it's checked but ignored by miniz.c) -int mz_deflateInit2(mz_streamp pStream, int level, int method, int window_bits, - int mem_level, int strategy); - -// Quickly resets a compressor without having to reallocate anything. Same as -// calling mz_deflateEnd() followed by mz_deflateInit()/mz_deflateInit2(). -int mz_deflateReset(mz_streamp pStream); - -// mz_deflate() compresses the input to output, consuming as much of the input -// and producing as much output as possible. -// Parameters: -// pStream is the stream to read from and write to. You must initialize/update -// the next_in, avail_in, next_out, and avail_out members. -// flush may be MZ_NO_FLUSH, MZ_PARTIAL_FLUSH/MZ_SYNC_FLUSH, MZ_FULL_FLUSH, or -// MZ_FINISH. -// Return values: -// MZ_OK on success (when flushing, or if more input is needed but not -// available, and/or there's more output to be written but the output buffer -// is full). -// MZ_STREAM_END if all input has been consumed and all output bytes have been -// written. Don't call mz_deflate() on the stream anymore. -// MZ_STREAM_ERROR if the stream is bogus. -// MZ_PARAM_ERROR if one of the parameters is invalid. -// MZ_BUF_ERROR if no forward progress is possible because the input and/or -// output buffers are empty. (Fill up the input buffer or free up some output -// space and try again.) -int mz_deflate(mz_streamp pStream, int flush); - -// mz_deflateEnd() deinitializes a compressor: -// Return values: -// MZ_OK on success. -// MZ_STREAM_ERROR if the stream is bogus. -int mz_deflateEnd(mz_streamp pStream); - -// mz_deflateBound() returns a (very) conservative upper bound on the amount of -// data that could be generated by deflate(), assuming flush is set to only -// MZ_NO_FLUSH or MZ_FINISH. -mz_ulong mz_deflateBound(mz_streamp pStream, mz_ulong source_len); - -// Single-call compression functions mz_compress() and mz_compress2(): -// Returns MZ_OK on success, or one of the error codes from mz_deflate() on -// failure. -int mz_compress(unsigned char *pDest, mz_ulong *pDest_len, - const unsigned char *pSource, mz_ulong source_len); -int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, - const unsigned char *pSource, mz_ulong source_len, int level); - -// mz_compressBound() returns a (very) conservative upper bound on the amount of -// data that could be generated by calling mz_compress(). -mz_ulong mz_compressBound(mz_ulong source_len); - -// Initializes a decompressor. -int mz_inflateInit(mz_streamp pStream); - -// mz_inflateInit2() is like mz_inflateInit() with an additional option that -// controls the window size and whether or not the stream has been wrapped with -// a zlib header/footer: -// window_bits must be MZ_DEFAULT_WINDOW_BITS (to parse zlib header/footer) or -// -MZ_DEFAULT_WINDOW_BITS (raw deflate). -int mz_inflateInit2(mz_streamp pStream, int window_bits); - -// Decompresses the input stream to the output, consuming only as much of the -// input as needed, and writing as much to the output as possible. -// Parameters: -// pStream is the stream to read from and write to. You must initialize/update -// the next_in, avail_in, next_out, and avail_out members. -// flush may be MZ_NO_FLUSH, MZ_SYNC_FLUSH, or MZ_FINISH. -// On the first call, if flush is MZ_FINISH it's assumed the input and output -// buffers are both sized large enough to decompress the entire stream in a -// single call (this is slightly faster). -// MZ_FINISH implies that there are no more source bytes available beside -// what's already in the input buffer, and that the output buffer is large -// enough to hold the rest of the decompressed data. -// Return values: -// MZ_OK on success. Either more input is needed but not available, and/or -// there's more output to be written but the output buffer is full. -// MZ_STREAM_END if all needed input has been consumed and all output bytes -// have been written. For zlib streams, the adler-32 of the decompressed data -// has also been verified. -// MZ_STREAM_ERROR if the stream is bogus. -// MZ_DATA_ERROR if the deflate stream is invalid. -// MZ_PARAM_ERROR if one of the parameters is invalid. -// MZ_BUF_ERROR if no forward progress is possible because the input buffer is -// empty but the inflater needs more input to continue, or if the output -// buffer is not large enough. Call mz_inflate() again -// with more input data, or with more room in the output buffer (except when -// using single call decompression, described above). -int mz_inflate(mz_streamp pStream, int flush); - -// Deinitializes a decompressor. -int mz_inflateEnd(mz_streamp pStream); - -// Single-call decompression. -// Returns MZ_OK on success, or one of the error codes from mz_inflate() on -// failure. -int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, - const unsigned char *pSource, mz_ulong source_len); - -// Returns a string description of the specified error code, or NULL if the -// error code is invalid. -const char *mz_error(int err); - -// Redefine zlib-compatible names to miniz equivalents, so miniz.c can be used -// as a drop-in replacement for the subset of zlib that miniz.c supports. -// Define MINIZ_NO_ZLIB_COMPATIBLE_NAMES to disable zlib-compatibility if you -// use zlib in the same project. -#ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES -typedef unsigned char Byte; -typedef unsigned int uInt; -typedef mz_ulong uLong; -typedef Byte Bytef; -typedef uInt uIntf; -typedef char charf; -typedef int intf; -typedef void *voidpf; -typedef uLong uLongf; -typedef void *voidp; -typedef void *const voidpc; -#define Z_NULL 0 -#define Z_NO_FLUSH MZ_NO_FLUSH -#define Z_PARTIAL_FLUSH MZ_PARTIAL_FLUSH -#define Z_SYNC_FLUSH MZ_SYNC_FLUSH -#define Z_FULL_FLUSH MZ_FULL_FLUSH -#define Z_FINISH MZ_FINISH -#define Z_BLOCK MZ_BLOCK -#define Z_OK MZ_OK -#define Z_STREAM_END MZ_STREAM_END -#define Z_NEED_DICT MZ_NEED_DICT -#define Z_ERRNO MZ_ERRNO -#define Z_STREAM_ERROR MZ_STREAM_ERROR -#define Z_DATA_ERROR MZ_DATA_ERROR -#define Z_MEM_ERROR MZ_MEM_ERROR -#define Z_BUF_ERROR MZ_BUF_ERROR -#define Z_VERSION_ERROR MZ_VERSION_ERROR -#define Z_PARAM_ERROR MZ_PARAM_ERROR -#define Z_NO_COMPRESSION MZ_NO_COMPRESSION -#define Z_BEST_SPEED MZ_BEST_SPEED -#define Z_BEST_COMPRESSION MZ_BEST_COMPRESSION -#define Z_DEFAULT_COMPRESSION MZ_DEFAULT_COMPRESSION -#define Z_DEFAULT_STRATEGY MZ_DEFAULT_STRATEGY -#define Z_FILTERED MZ_FILTERED -#define Z_HUFFMAN_ONLY MZ_HUFFMAN_ONLY -#define Z_RLE MZ_RLE -#define Z_FIXED MZ_FIXED -#define Z_DEFLATED MZ_DEFLATED -#define Z_DEFAULT_WINDOW_BITS MZ_DEFAULT_WINDOW_BITS -#define alloc_func mz_alloc_func -#define free_func mz_free_func -#define internal_state mz_internal_state -#define z_stream mz_stream -#define deflateInit mz_deflateInit -#define deflateInit2 mz_deflateInit2 -#define deflateReset mz_deflateReset -#define deflate mz_deflate -#define deflateEnd mz_deflateEnd -#define deflateBound mz_deflateBound -#define compress mz_compress -#define compress2 mz_compress2 -#define compressBound mz_compressBound -#define inflateInit mz_inflateInit -#define inflateInit2 mz_inflateInit2 -#define inflate mz_inflate -#define inflateEnd mz_inflateEnd -#define uncompress mz_uncompress -#define crc32 mz_crc32 -#define adler32 mz_adler32 -#define MAX_WBITS 15 -#define MAX_MEM_LEVEL 9 -#define zError mz_error -#define ZLIB_VERSION MZ_VERSION -#define ZLIB_VERNUM MZ_VERNUM -#define ZLIB_VER_MAJOR MZ_VER_MAJOR -#define ZLIB_VER_MINOR MZ_VER_MINOR -#define ZLIB_VER_REVISION MZ_VER_REVISION -#define ZLIB_VER_SUBREVISION MZ_VER_SUBREVISION -#define zlibVersion mz_version -#define zlib_version mz_version() -#endif // #ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES - -#endif // MINIZ_NO_ZLIB_APIS - -// ------------------- Types and macros - -typedef unsigned char mz_uint8; -typedef signed short mz_int16; -typedef unsigned short mz_uint16; -typedef unsigned int mz_uint32; -typedef unsigned int mz_uint; -typedef long long mz_int64; -typedef unsigned long long mz_uint64; -typedef int mz_bool; - -#define MZ_FALSE (0) -#define MZ_TRUE (1) - -// An attempt to work around MSVC's spammy "warning C4127: conditional -// expression is constant" message. -#ifdef _MSC_VER -#define MZ_MACRO_END while (0, 0) -#else -#define MZ_MACRO_END while (0) -#endif - -// ------------------- ZIP archive reading/writing - -#ifndef MINIZ_NO_ARCHIVE_APIS - -enum { - MZ_ZIP_MAX_IO_BUF_SIZE = 64 * 1024, - MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE = 260, - MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE = 256 -}; - -typedef struct { - mz_uint32 m_file_index; - mz_uint32 m_central_dir_ofs; - mz_uint16 m_version_made_by; - mz_uint16 m_version_needed; - mz_uint16 m_bit_flag; - mz_uint16 m_method; -#ifndef MINIZ_NO_TIME - time_t m_time; -#endif - mz_uint32 m_crc32; - mz_uint64 m_comp_size; - mz_uint64 m_uncomp_size; - mz_uint16 m_internal_attr; - mz_uint32 m_external_attr; - mz_uint64 m_local_header_ofs; - mz_uint32 m_comment_size; - char m_filename[MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE]; - char m_comment[MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE]; -} mz_zip_archive_file_stat; - -typedef size_t (*mz_file_read_func)(void *pOpaque, mz_uint64 file_ofs, - void *pBuf, size_t n); -typedef size_t (*mz_file_write_func)(void *pOpaque, mz_uint64 file_ofs, - const void *pBuf, size_t n); - -struct mz_zip_internal_state_tag; -typedef struct mz_zip_internal_state_tag mz_zip_internal_state; - -typedef enum { - MZ_ZIP_MODE_INVALID = 0, - MZ_ZIP_MODE_READING = 1, - MZ_ZIP_MODE_WRITING = 2, - MZ_ZIP_MODE_WRITING_HAS_BEEN_FINALIZED = 3 -} mz_zip_mode; - -typedef struct mz_zip_archive_tag { - mz_uint64 m_archive_size; - mz_uint64 m_central_directory_file_ofs; - mz_uint m_total_files; - mz_zip_mode m_zip_mode; - - mz_uint m_file_offset_alignment; - - mz_alloc_func m_pAlloc; - mz_free_func m_pFree; - mz_realloc_func m_pRealloc; - void *m_pAlloc_opaque; - - mz_file_read_func m_pRead; - mz_file_write_func m_pWrite; - void *m_pIO_opaque; - - mz_zip_internal_state *m_pState; - -} mz_zip_archive; - -typedef enum { - MZ_ZIP_FLAG_CASE_SENSITIVE = 0x0100, - MZ_ZIP_FLAG_IGNORE_PATH = 0x0200, - MZ_ZIP_FLAG_COMPRESSED_DATA = 0x0400, - MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY = 0x0800 -} mz_zip_flags; - -// ZIP archive reading - -// Inits a ZIP archive reader. -// These functions read and validate the archive's central directory. -mz_bool mz_zip_reader_init(mz_zip_archive *pZip, mz_uint64 size, - mz_uint32 flags); -mz_bool mz_zip_reader_init_mem(mz_zip_archive *pZip, const void *pMem, - size_t size, mz_uint32 flags); - -#ifndef MINIZ_NO_STDIO -mz_bool mz_zip_reader_init_file(mz_zip_archive *pZip, const char *pFilename, - mz_uint32 flags); -#endif - -// Returns the total number of files in the archive. -mz_uint mz_zip_reader_get_num_files(mz_zip_archive *pZip); - -// Returns detailed information about an archive file entry. -mz_bool mz_zip_reader_file_stat(mz_zip_archive *pZip, mz_uint file_index, - mz_zip_archive_file_stat *pStat); - -// Determines if an archive file entry is a directory entry. -mz_bool mz_zip_reader_is_file_a_directory(mz_zip_archive *pZip, - mz_uint file_index); -mz_bool mz_zip_reader_is_file_encrypted(mz_zip_archive *pZip, - mz_uint file_index); - -// Retrieves the filename of an archive file entry. -// Returns the number of bytes written to pFilename, or if filename_buf_size is -// 0 this function returns the number of bytes needed to fully store the -// filename. -mz_uint mz_zip_reader_get_filename(mz_zip_archive *pZip, mz_uint file_index, - char *pFilename, mz_uint filename_buf_size); - -// Attempts to locates a file in the archive's central directory. -// Valid flags: MZ_ZIP_FLAG_CASE_SENSITIVE, MZ_ZIP_FLAG_IGNORE_PATH -// Returns -1 if the file cannot be found. -int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, - const char *pComment, mz_uint flags); - -// Extracts a archive file to a memory buffer using no memory allocation. -mz_bool mz_zip_reader_extract_to_mem_no_alloc(mz_zip_archive *pZip, - mz_uint file_index, void *pBuf, - size_t buf_size, mz_uint flags, - void *pUser_read_buf, - size_t user_read_buf_size); -mz_bool mz_zip_reader_extract_file_to_mem_no_alloc( - mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, - mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size); - -// Extracts a archive file to a memory buffer. -mz_bool mz_zip_reader_extract_to_mem(mz_zip_archive *pZip, mz_uint file_index, - void *pBuf, size_t buf_size, - mz_uint flags); -mz_bool mz_zip_reader_extract_file_to_mem(mz_zip_archive *pZip, - const char *pFilename, void *pBuf, - size_t buf_size, mz_uint flags); - -// Extracts a archive file to a dynamically allocated heap buffer. -void *mz_zip_reader_extract_to_heap(mz_zip_archive *pZip, mz_uint file_index, - size_t *pSize, mz_uint flags); -void *mz_zip_reader_extract_file_to_heap(mz_zip_archive *pZip, - const char *pFilename, size_t *pSize, - mz_uint flags); - -// Extracts a archive file using a callback function to output the file's data. -mz_bool mz_zip_reader_extract_to_callback(mz_zip_archive *pZip, - mz_uint file_index, - mz_file_write_func pCallback, - void *pOpaque, mz_uint flags); -mz_bool mz_zip_reader_extract_file_to_callback(mz_zip_archive *pZip, - const char *pFilename, - mz_file_write_func pCallback, - void *pOpaque, mz_uint flags); - -#ifndef MINIZ_NO_STDIO -// Extracts a archive file to a disk file and sets its last accessed and -// modified times. -// This function only extracts files, not archive directory records. -mz_bool mz_zip_reader_extract_to_file(mz_zip_archive *pZip, mz_uint file_index, - const char *pDst_filename, mz_uint flags); -mz_bool mz_zip_reader_extract_file_to_file(mz_zip_archive *pZip, - const char *pArchive_filename, - const char *pDst_filename, - mz_uint flags); -#endif - -// Ends archive reading, freeing all allocations, and closing the input archive -// file if mz_zip_reader_init_file() was used. -mz_bool mz_zip_reader_end(mz_zip_archive *pZip); - -// ZIP archive writing - -#ifndef MINIZ_NO_ARCHIVE_WRITING_APIS - -// Inits a ZIP archive writer. -mz_bool mz_zip_writer_init(mz_zip_archive *pZip, mz_uint64 existing_size); -mz_bool mz_zip_writer_init_heap(mz_zip_archive *pZip, - size_t size_to_reserve_at_beginning, - size_t initial_allocation_size); - -#ifndef MINIZ_NO_STDIO -mz_bool mz_zip_writer_init_file(mz_zip_archive *pZip, const char *pFilename, - mz_uint64 size_to_reserve_at_beginning); -#endif - -// Converts a ZIP archive reader object into a writer object, to allow efficient -// in-place file appends to occur on an existing archive. -// For archives opened using mz_zip_reader_init_file, pFilename must be the -// archive's filename so it can be reopened for writing. If the file can't be -// reopened, mz_zip_reader_end() will be called. -// For archives opened using mz_zip_reader_init_mem, the memory block must be -// growable using the realloc callback (which defaults to realloc unless you've -// overridden it). -// Finally, for archives opened using mz_zip_reader_init, the mz_zip_archive's -// user provided m_pWrite function cannot be NULL. -// Note: In-place archive modification is not recommended unless you know what -// you're doing, because if execution stops or something goes wrong before -// the archive is finalized the file's central directory will be hosed. -mz_bool mz_zip_writer_init_from_reader(mz_zip_archive *pZip, - const char *pFilename); - -// Adds the contents of a memory buffer to an archive. These functions record -// the current local time into the archive. -// To add a directory entry, call this method with an archive name ending in a -// forwardslash with empty buffer. -// level_and_flags - compression level (0-10, see MZ_BEST_SPEED, -// MZ_BEST_COMPRESSION, etc.) logically OR'd with zero or more mz_zip_flags, or -// just set to MZ_DEFAULT_COMPRESSION. -mz_bool mz_zip_writer_add_mem(mz_zip_archive *pZip, const char *pArchive_name, - const void *pBuf, size_t buf_size, - mz_uint level_and_flags); -mz_bool mz_zip_writer_add_mem_ex(mz_zip_archive *pZip, - const char *pArchive_name, const void *pBuf, - size_t buf_size, const void *pComment, - mz_uint16 comment_size, - mz_uint level_and_flags, mz_uint64 uncomp_size, - mz_uint32 uncomp_crc32); - -#ifndef MINIZ_NO_STDIO -// Adds the contents of a disk file to an archive. This function also records -// the disk file's modified time into the archive. -// level_and_flags - compression level (0-10, see MZ_BEST_SPEED, -// MZ_BEST_COMPRESSION, etc.) logically OR'd with zero or more mz_zip_flags, or -// just set to MZ_DEFAULT_COMPRESSION. -mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchive_name, - const char *pSrc_filename, const void *pComment, - mz_uint16 comment_size, mz_uint level_and_flags); -#endif - -// Adds a file to an archive by fully cloning the data from another archive. -// This function fully clones the source file's compressed data (no -// recompression), along with its full filename, extra data, and comment fields. -mz_bool mz_zip_writer_add_from_zip_reader(mz_zip_archive *pZip, - mz_zip_archive *pSource_zip, - mz_uint file_index); - -// Finalizes the archive by writing the central directory records followed by -// the end of central directory record. -// After an archive is finalized, the only valid call on the mz_zip_archive -// struct is mz_zip_writer_end(). -// An archive must be manually finalized by calling this function for it to be -// valid. -mz_bool mz_zip_writer_finalize_archive(mz_zip_archive *pZip); -mz_bool mz_zip_writer_finalize_heap_archive(mz_zip_archive *pZip, void **pBuf, - size_t *pSize); - -// Ends archive writing, freeing all allocations, and closing the output file if -// mz_zip_writer_init_file() was used. -// Note for the archive to be valid, it must have been finalized before ending. -mz_bool mz_zip_writer_end(mz_zip_archive *pZip); - -// Misc. high-level helper functions: - -// mz_zip_add_mem_to_archive_file_in_place() efficiently (but not atomically) -// appends a memory blob to a ZIP archive. -// level_and_flags - compression level (0-10, see MZ_BEST_SPEED, -// MZ_BEST_COMPRESSION, etc.) logically OR'd with zero or more mz_zip_flags, or -// just set to MZ_DEFAULT_COMPRESSION. -mz_bool mz_zip_add_mem_to_archive_file_in_place( - const char *pZip_filename, const char *pArchive_name, const void *pBuf, - size_t buf_size, const void *pComment, mz_uint16 comment_size, - mz_uint level_and_flags); - -// Reads a single file from an archive into a heap block. -// Returns NULL on failure. -void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, - const char *pArchive_name, - size_t *pSize, mz_uint zip_flags); - -#endif // #ifndef MINIZ_NO_ARCHIVE_WRITING_APIS - -#endif // #ifndef MINIZ_NO_ARCHIVE_APIS - -// ------------------- Low-level Decompression API Definitions - -// Decompression flags used by tinfl_decompress(). -// TINFL_FLAG_PARSE_ZLIB_HEADER: If set, the input has a valid zlib header and -// ends with an adler32 checksum (it's a valid zlib stream). Otherwise, the -// input is a raw deflate stream. -// TINFL_FLAG_HAS_MORE_INPUT: If set, there are more input bytes available -// beyond the end of the supplied input buffer. If clear, the input buffer -// contains all remaining input. -// TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF: If set, the output buffer is large -// enough to hold the entire decompressed stream. If clear, the output buffer is -// at least the size of the dictionary (typically 32KB). -// TINFL_FLAG_COMPUTE_ADLER32: Force adler-32 checksum computation of the -// decompressed bytes. -enum { - TINFL_FLAG_PARSE_ZLIB_HEADER = 1, - TINFL_FLAG_HAS_MORE_INPUT = 2, - TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF = 4, - TINFL_FLAG_COMPUTE_ADLER32 = 8 -}; - -// High level decompression functions: -// tinfl_decompress_mem_to_heap() decompresses a block in memory to a heap block -// allocated via malloc(). -// On entry: -// pSrc_buf, src_buf_len: Pointer and size of the Deflate or zlib source data -// to decompress. -// On return: -// Function returns a pointer to the decompressed data, or NULL on failure. -// *pOut_len will be set to the decompressed data's size, which could be larger -// than src_buf_len on uncompressible data. -// The caller must call mz_free() on the returned block when it's no longer -// needed. -void *tinfl_decompress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, - size_t *pOut_len, int flags); - -// tinfl_decompress_mem_to_mem() decompresses a block in memory to another block -// in memory. -// Returns TINFL_DECOMPRESS_MEM_TO_MEM_FAILED on failure, or the number of bytes -// written on success. -#define TINFL_DECOMPRESS_MEM_TO_MEM_FAILED ((size_t)(-1)) -size_t tinfl_decompress_mem_to_mem(void *pOut_buf, size_t out_buf_len, - const void *pSrc_buf, size_t src_buf_len, - int flags); - -// tinfl_decompress_mem_to_callback() decompresses a block in memory to an -// internal 32KB buffer, and a user provided callback function will be called to -// flush the buffer. -// Returns 1 on success or 0 on failure. -typedef int (*tinfl_put_buf_func_ptr)(const void *pBuf, int len, void *pUser); -int tinfl_decompress_mem_to_callback(const void *pIn_buf, size_t *pIn_buf_size, - tinfl_put_buf_func_ptr pPut_buf_func, - void *pPut_buf_user, int flags); - -struct tinfl_decompressor_tag; -typedef struct tinfl_decompressor_tag tinfl_decompressor; - -// Max size of LZ dictionary. -#define TINFL_LZ_DICT_SIZE 32768 - -// Return status. -typedef enum { - TINFL_STATUS_BAD_PARAM = -3, - TINFL_STATUS_ADLER32_MISMATCH = -2, - TINFL_STATUS_FAILED = -1, - TINFL_STATUS_DONE = 0, - TINFL_STATUS_NEEDS_MORE_INPUT = 1, - TINFL_STATUS_HAS_MORE_OUTPUT = 2 -} tinfl_status; - -// Initializes the decompressor to its initial state. -#define tinfl_init(r) \ - do { \ - (r)->m_state = 0; \ - } \ - MZ_MACRO_END -#define tinfl_get_adler32(r) (r)->m_check_adler32 - -// Main low-level decompressor coroutine function. This is the only function -// actually needed for decompression. All the other functions are just -// high-level helpers for improved usability. -// This is a universal API, i.e. it can be used as a building block to build any -// desired higher level decompression API. In the limit case, it can be called -// once per every byte input or output. -tinfl_status tinfl_decompress(tinfl_decompressor *r, - const mz_uint8 *pIn_buf_next, - size_t *pIn_buf_size, mz_uint8 *pOut_buf_start, - mz_uint8 *pOut_buf_next, size_t *pOut_buf_size, - const mz_uint32 decomp_flags); - -// Internal/private bits follow. -enum { - TINFL_MAX_HUFF_TABLES = 3, - TINFL_MAX_HUFF_SYMBOLS_0 = 288, - TINFL_MAX_HUFF_SYMBOLS_1 = 32, - TINFL_MAX_HUFF_SYMBOLS_2 = 19, - TINFL_FAST_LOOKUP_BITS = 10, - TINFL_FAST_LOOKUP_SIZE = 1 << TINFL_FAST_LOOKUP_BITS -}; - -typedef struct { - mz_uint8 m_code_size[TINFL_MAX_HUFF_SYMBOLS_0]; - mz_int16 m_look_up[TINFL_FAST_LOOKUP_SIZE], - m_tree[TINFL_MAX_HUFF_SYMBOLS_0 * 2]; -} tinfl_huff_table; - -#if MINIZ_HAS_64BIT_REGISTERS -#define TINFL_USE_64BIT_BITBUF 1 -#endif - -#if TINFL_USE_64BIT_BITBUF -typedef mz_uint64 tinfl_bit_buf_t; -#define TINFL_BITBUF_SIZE (64) -#else -typedef mz_uint32 tinfl_bit_buf_t; -#define TINFL_BITBUF_SIZE (32) -#endif - -struct tinfl_decompressor_tag { - mz_uint32 m_state, m_num_bits, m_zhdr0, m_zhdr1, m_z_adler32, m_final, m_type, - m_check_adler32, m_dist, m_counter, m_num_extra, - m_table_sizes[TINFL_MAX_HUFF_TABLES]; - tinfl_bit_buf_t m_bit_buf; - size_t m_dist_from_out_buf_start; - tinfl_huff_table m_tables[TINFL_MAX_HUFF_TABLES]; - mz_uint8 m_raw_header[4], - m_len_codes[TINFL_MAX_HUFF_SYMBOLS_0 + TINFL_MAX_HUFF_SYMBOLS_1 + 137]; -}; - -// ------------------- Low-level Compression API Definitions - -// Set TDEFL_LESS_MEMORY to 1 to use less memory (compression will be slightly -// slower, and raw/dynamic blocks will be output more frequently). -#define TDEFL_LESS_MEMORY 0 - -// tdefl_init() compression flags logically OR'd together (low 12 bits contain -// the max. number of probes per dictionary search): -// TDEFL_DEFAULT_MAX_PROBES: The compressor defaults to 128 dictionary probes -// per dictionary search. 0=Huffman only, 1=Huffman+LZ (fastest/crap -// compression), 4095=Huffman+LZ (slowest/best compression). -enum { - TDEFL_HUFFMAN_ONLY = 0, - TDEFL_DEFAULT_MAX_PROBES = 128, - TDEFL_MAX_PROBES_MASK = 0xFFF -}; - -// TDEFL_WRITE_ZLIB_HEADER: If set, the compressor outputs a zlib header before -// the deflate data, and the Adler-32 of the source data at the end. Otherwise, -// you'll get raw deflate data. -// TDEFL_COMPUTE_ADLER32: Always compute the adler-32 of the input data (even -// when not writing zlib headers). -// TDEFL_GREEDY_PARSING_FLAG: Set to use faster greedy parsing, instead of more -// efficient lazy parsing. -// TDEFL_NONDETERMINISTIC_PARSING_FLAG: Enable to decrease the compressor's -// initialization time to the minimum, but the output may vary from run to run -// given the same input (depending on the contents of memory). -// TDEFL_RLE_MATCHES: Only look for RLE matches (matches with a distance of 1) -// TDEFL_FILTER_MATCHES: Discards matches <= 5 chars if enabled. -// TDEFL_FORCE_ALL_STATIC_BLOCKS: Disable usage of optimized Huffman tables. -// TDEFL_FORCE_ALL_RAW_BLOCKS: Only use raw (uncompressed) deflate blocks. -// The low 12 bits are reserved to control the max # of hash probes per -// dictionary lookup (see TDEFL_MAX_PROBES_MASK). -enum { - TDEFL_WRITE_ZLIB_HEADER = 0x01000, - TDEFL_COMPUTE_ADLER32 = 0x02000, - TDEFL_GREEDY_PARSING_FLAG = 0x04000, - TDEFL_NONDETERMINISTIC_PARSING_FLAG = 0x08000, - TDEFL_RLE_MATCHES = 0x10000, - TDEFL_FILTER_MATCHES = 0x20000, - TDEFL_FORCE_ALL_STATIC_BLOCKS = 0x40000, - TDEFL_FORCE_ALL_RAW_BLOCKS = 0x80000 -}; - -// High level compression functions: -// tdefl_compress_mem_to_heap() compresses a block in memory to a heap block -// allocated via malloc(). -// On entry: -// pSrc_buf, src_buf_len: Pointer and size of source block to compress. -// flags: The max match finder probes (default is 128) logically OR'd against -// the above flags. Higher probes are slower but improve compression. -// On return: -// Function returns a pointer to the compressed data, or NULL on failure. -// *pOut_len will be set to the compressed data's size, which could be larger -// than src_buf_len on uncompressible data. -// The caller must free() the returned block when it's no longer needed. -void *tdefl_compress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, - size_t *pOut_len, int flags); - -// tdefl_compress_mem_to_mem() compresses a block in memory to another block in -// memory. -// Returns 0 on failure. -size_t tdefl_compress_mem_to_mem(void *pOut_buf, size_t out_buf_len, - const void *pSrc_buf, size_t src_buf_len, - int flags); - -// Compresses an image to a compressed PNG file in memory. -// On entry: -// pImage, w, h, and num_chans describe the image to compress. num_chans may be -// 1, 2, 3, or 4. -// The image pitch in bytes per scanline will be w*num_chans. The leftmost -// pixel on the top scanline is stored first in memory. -// level may range from [0,10], use MZ_NO_COMPRESSION, MZ_BEST_SPEED, -// MZ_BEST_COMPRESSION, etc. or a decent default is MZ_DEFAULT_LEVEL -// If flip is true, the image will be flipped on the Y axis (useful for OpenGL -// apps). -// On return: -// Function returns a pointer to the compressed data, or NULL on failure. -// *pLen_out will be set to the size of the PNG image file. -// The caller must mz_free() the returned heap block (which will typically be -// larger than *pLen_out) when it's no longer needed. -void *tdefl_write_image_to_png_file_in_memory_ex(const void *pImage, int w, - int h, int num_chans, - size_t *pLen_out, - mz_uint level, mz_bool flip); -void *tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h, - int num_chans, size_t *pLen_out); - -// Output stream interface. The compressor uses this interface to write -// compressed data. It'll typically be called TDEFL_OUT_BUF_SIZE at a time. -typedef mz_bool (*tdefl_put_buf_func_ptr)(const void *pBuf, int len, - void *pUser); - -// tdefl_compress_mem_to_output() compresses a block to an output stream. The -// above helpers use this function internally. -mz_bool tdefl_compress_mem_to_output(const void *pBuf, size_t buf_len, - tdefl_put_buf_func_ptr pPut_buf_func, - void *pPut_buf_user, int flags); - -enum { - TDEFL_MAX_HUFF_TABLES = 3, - TDEFL_MAX_HUFF_SYMBOLS_0 = 288, - TDEFL_MAX_HUFF_SYMBOLS_1 = 32, - TDEFL_MAX_HUFF_SYMBOLS_2 = 19, - TDEFL_LZ_DICT_SIZE = 32768, - TDEFL_LZ_DICT_SIZE_MASK = TDEFL_LZ_DICT_SIZE - 1, - TDEFL_MIN_MATCH_LEN = 3, - TDEFL_MAX_MATCH_LEN = 258 -}; - -// TDEFL_OUT_BUF_SIZE MUST be large enough to hold a single entire compressed -// output block (using static/fixed Huffman codes). -#if TDEFL_LESS_MEMORY -enum { - TDEFL_LZ_CODE_BUF_SIZE = 24 * 1024, - TDEFL_OUT_BUF_SIZE = (TDEFL_LZ_CODE_BUF_SIZE * 13) / 10, - TDEFL_MAX_HUFF_SYMBOLS = 288, - TDEFL_LZ_HASH_BITS = 12, - TDEFL_LEVEL1_HASH_SIZE_MASK = 4095, - TDEFL_LZ_HASH_SHIFT = (TDEFL_LZ_HASH_BITS + 2) / 3, - TDEFL_LZ_HASH_SIZE = 1 << TDEFL_LZ_HASH_BITS -}; -#else -enum { - TDEFL_LZ_CODE_BUF_SIZE = 64 * 1024, - TDEFL_OUT_BUF_SIZE = (TDEFL_LZ_CODE_BUF_SIZE * 13) / 10, - TDEFL_MAX_HUFF_SYMBOLS = 288, - TDEFL_LZ_HASH_BITS = 15, - TDEFL_LEVEL1_HASH_SIZE_MASK = 4095, - TDEFL_LZ_HASH_SHIFT = (TDEFL_LZ_HASH_BITS + 2) / 3, - TDEFL_LZ_HASH_SIZE = 1 << TDEFL_LZ_HASH_BITS -}; -#endif - -// The low-level tdefl functions below may be used directly if the above helper -// functions aren't flexible enough. The low-level functions don't make any heap -// allocations, unlike the above helper functions. -typedef enum { - TDEFL_STATUS_BAD_PARAM = -2, - TDEFL_STATUS_PUT_BUF_FAILED = -1, - TDEFL_STATUS_OKAY = 0, - TDEFL_STATUS_DONE = 1 -} tdefl_status; - -// Must map to MZ_NO_FLUSH, MZ_SYNC_FLUSH, etc. enums -typedef enum { - TDEFL_NO_FLUSH = 0, - TDEFL_SYNC_FLUSH = 2, - TDEFL_FULL_FLUSH = 3, - TDEFL_FINISH = 4 -} tdefl_flush; - -// tdefl's compression state structure. -typedef struct { - tdefl_put_buf_func_ptr m_pPut_buf_func; - void *m_pPut_buf_user; - mz_uint m_flags, m_max_probes[2]; - int m_greedy_parsing; - mz_uint m_adler32, m_lookahead_pos, m_lookahead_size, m_dict_size; - mz_uint8 *m_pLZ_code_buf, *m_pLZ_flags, *m_pOutput_buf, *m_pOutput_buf_end; - mz_uint m_num_flags_left, m_total_lz_bytes, m_lz_code_buf_dict_pos, m_bits_in, - m_bit_buffer; - mz_uint m_saved_match_dist, m_saved_match_len, m_saved_lit, - m_output_flush_ofs, m_output_flush_remaining, m_finished, m_block_index, - m_wants_to_finish; - tdefl_status m_prev_return_status; - const void *m_pIn_buf; - void *m_pOut_buf; - size_t *m_pIn_buf_size, *m_pOut_buf_size; - tdefl_flush m_flush; - const mz_uint8 *m_pSrc; - size_t m_src_buf_left, m_out_buf_ofs; - mz_uint8 m_dict[TDEFL_LZ_DICT_SIZE + TDEFL_MAX_MATCH_LEN - 1]; - mz_uint16 m_huff_count[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS]; - mz_uint16 m_huff_codes[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS]; - mz_uint8 m_huff_code_sizes[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS]; - mz_uint8 m_lz_code_buf[TDEFL_LZ_CODE_BUF_SIZE]; - mz_uint16 m_next[TDEFL_LZ_DICT_SIZE]; - mz_uint16 m_hash[TDEFL_LZ_HASH_SIZE]; - mz_uint8 m_output_buf[TDEFL_OUT_BUF_SIZE]; -} tdefl_compressor; - -// Initializes the compressor. -// There is no corresponding deinit() function because the tdefl API's do not -// dynamically allocate memory. -// pBut_buf_func: If NULL, output data will be supplied to the specified -// callback. In this case, the user should call the tdefl_compress_buffer() API -// for compression. -// If pBut_buf_func is NULL the user should always call the tdefl_compress() -// API. -// flags: See the above enums (TDEFL_HUFFMAN_ONLY, TDEFL_WRITE_ZLIB_HEADER, -// etc.) -tdefl_status tdefl_init(tdefl_compressor *d, - tdefl_put_buf_func_ptr pPut_buf_func, - void *pPut_buf_user, int flags); - -// Compresses a block of data, consuming as much of the specified input buffer -// as possible, and writing as much compressed data to the specified output -// buffer as possible. -tdefl_status tdefl_compress(tdefl_compressor *d, const void *pIn_buf, - size_t *pIn_buf_size, void *pOut_buf, - size_t *pOut_buf_size, tdefl_flush flush); - -// tdefl_compress_buffer() is only usable when the tdefl_init() is called with a -// non-NULL tdefl_put_buf_func_ptr. -// tdefl_compress_buffer() always consumes the entire input buffer. -tdefl_status tdefl_compress_buffer(tdefl_compressor *d, const void *pIn_buf, - size_t in_buf_size, tdefl_flush flush); - -tdefl_status tdefl_get_prev_return_status(tdefl_compressor *d); -mz_uint32 tdefl_get_adler32(tdefl_compressor *d); - -// Can't use tdefl_create_comp_flags_from_zip_params if MINIZ_NO_ZLIB_APIS isn't -// defined, because it uses some of its macros. -#ifndef MINIZ_NO_ZLIB_APIS -// Create tdefl_compress() flags given zlib-style compression parameters. -// level may range from [0,10] (where 10 is absolute max compression, but may be -// much slower on some files) -// window_bits may be -15 (raw deflate) or 15 (zlib) -// strategy may be either MZ_DEFAULT_STRATEGY, MZ_FILTERED, MZ_HUFFMAN_ONLY, -// MZ_RLE, or MZ_FIXED -mz_uint tdefl_create_comp_flags_from_zip_params(int level, int window_bits, - int strategy); -#endif // #ifndef MINIZ_NO_ZLIB_APIS - -#ifdef __cplusplus -} -#endif - -#endif // MINIZ_HEADER_INCLUDED - -// ------------------- End of Header: Implementation follows. (If you only want -// the header, define MINIZ_HEADER_FILE_ONLY.) - -#ifndef MINIZ_HEADER_FILE_ONLY - -typedef unsigned char mz_validate_uint16[sizeof(mz_uint16) == 2 ? 1 : -1]; -typedef unsigned char mz_validate_uint32[sizeof(mz_uint32) == 4 ? 1 : -1]; -typedef unsigned char mz_validate_uint64[sizeof(mz_uint64) == 8 ? 1 : -1]; - -//#include -//#include - -#define MZ_ASSERT(x) assert(x) - -#ifdef MINIZ_NO_MALLOC -#define MZ_MALLOC(x) NULL -#define MZ_FREE(x) (void)x, ((void)0) -#define MZ_REALLOC(p, x) NULL -#else -#define MZ_MALLOC(x) malloc(x) -#define MZ_FREE(x) free(x) -#define MZ_REALLOC(p, x) realloc(p, x) -#endif - -#define MZ_MAX(a, b) (((a) > (b)) ? (a) : (b)) -#define MZ_MIN(a, b) (((a) < (b)) ? (a) : (b)) -#define MZ_CLEAR_OBJ(obj) memset(&(obj), 0, sizeof(obj)) - -#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN -#define MZ_READ_LE16(p) *((const mz_uint16 *)(p)) -#define MZ_READ_LE32(p) *((const mz_uint32 *)(p)) -#else -#define MZ_READ_LE16(p) \ - ((mz_uint32)(((const mz_uint8 *)(p))[0]) | \ - ((mz_uint32)(((const mz_uint8 *)(p))[1]) << 8U)) -#define MZ_READ_LE32(p) \ - ((mz_uint32)(((const mz_uint8 *)(p))[0]) | \ - ((mz_uint32)(((const mz_uint8 *)(p))[1]) << 8U) | \ - ((mz_uint32)(((const mz_uint8 *)(p))[2]) << 16U) | \ - ((mz_uint32)(((const mz_uint8 *)(p))[3]) << 24U)) -#endif - -#ifdef _MSC_VER -#define MZ_FORCEINLINE __forceinline -#elif defined(__GNUC__) -#define MZ_FORCEINLINE inline __attribute__((__always_inline__)) -#else -#define MZ_FORCEINLINE inline -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -// ------------------- zlib-style API's - -mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len) { - mz_uint32 i, s1 = (mz_uint32)(adler & 0xffff), s2 = (mz_uint32)(adler >> 16); - size_t block_len = buf_len % 5552; - if (!ptr) return MZ_ADLER32_INIT; - while (buf_len) { - for (i = 0; i + 7 < block_len; i += 8, ptr += 8) { - s1 += ptr[0], s2 += s1; - s1 += ptr[1], s2 += s1; - s1 += ptr[2], s2 += s1; - s1 += ptr[3], s2 += s1; - s1 += ptr[4], s2 += s1; - s1 += ptr[5], s2 += s1; - s1 += ptr[6], s2 += s1; - s1 += ptr[7], s2 += s1; - } - for (; i < block_len; ++i) s1 += *ptr++, s2 += s1; - s1 %= 65521U, s2 %= 65521U; - buf_len -= block_len; - block_len = 5552; - } - return (s2 << 16) + s1; -} - -// Karl Malbrain's compact CRC-32. See "A compact CCITT crc16 and crc32 C -// implementation that balances processor cache usage against speed": -// http://www.geocities.com/malbrain/ -mz_ulong mz_crc32(mz_ulong crc, const mz_uint8 *ptr, size_t buf_len) { - static const mz_uint32 s_crc32[16] = { - 0, 0x1db71064, 0x3b6e20c8, 0x26d930ac, 0x76dc4190, 0x6b6b51f4, - 0x4db26158, 0x5005713c, 0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c, - 0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c}; - mz_uint32 crcu32 = (mz_uint32)crc; - if (!ptr) return MZ_CRC32_INIT; - crcu32 = ~crcu32; - while (buf_len--) { - mz_uint8 b = *ptr++; - crcu32 = (crcu32 >> 4) ^ s_crc32[(crcu32 & 0xF) ^ (b & 0xF)]; - crcu32 = (crcu32 >> 4) ^ s_crc32[(crcu32 & 0xF) ^ (b >> 4)]; - } - return ~crcu32; -} - -void mz_free(void *p) { MZ_FREE(p); } - -#ifndef MINIZ_NO_ZLIB_APIS - -static void *def_alloc_func(void *opaque, size_t items, size_t size) { - (void)opaque, (void)items, (void)size; - return MZ_MALLOC(items * size); -} -static void def_free_func(void *opaque, void *address) { - (void)opaque, (void)address; - MZ_FREE(address); -} -// static void *def_realloc_func(void *opaque, void *address, size_t items, -// size_t size) { -// (void)opaque, (void)address, (void)items, (void)size; -// return MZ_REALLOC(address, items * size); -//} - -const char *mz_version(void) { return MZ_VERSION; } - -int mz_deflateInit(mz_streamp pStream, int level) { - return mz_deflateInit2(pStream, level, MZ_DEFLATED, MZ_DEFAULT_WINDOW_BITS, 9, - MZ_DEFAULT_STRATEGY); -} - -int mz_deflateInit2(mz_streamp pStream, int level, int method, int window_bits, - int mem_level, int strategy) { - tdefl_compressor *pComp; - mz_uint comp_flags = - TDEFL_COMPUTE_ADLER32 | - tdefl_create_comp_flags_from_zip_params(level, window_bits, strategy); - - if (!pStream) return MZ_STREAM_ERROR; - if ((method != MZ_DEFLATED) || ((mem_level < 1) || (mem_level > 9)) || - ((window_bits != MZ_DEFAULT_WINDOW_BITS) && - (-window_bits != MZ_DEFAULT_WINDOW_BITS))) - return MZ_PARAM_ERROR; - - pStream->data_type = 0; - pStream->adler = MZ_ADLER32_INIT; - pStream->msg = NULL; - pStream->reserved = 0; - pStream->total_in = 0; - pStream->total_out = 0; - if (!pStream->zalloc) pStream->zalloc = def_alloc_func; - if (!pStream->zfree) pStream->zfree = def_free_func; - - pComp = (tdefl_compressor *)pStream->zalloc(pStream->opaque, 1, - sizeof(tdefl_compressor)); - if (!pComp) return MZ_MEM_ERROR; - - pStream->state = (struct mz_internal_state *)pComp; - - if (tdefl_init(pComp, NULL, NULL, comp_flags) != TDEFL_STATUS_OKAY) { - mz_deflateEnd(pStream); - return MZ_PARAM_ERROR; - } - - return MZ_OK; -} - -int mz_deflateReset(mz_streamp pStream) { - if ((!pStream) || (!pStream->state) || (!pStream->zalloc) || - (!pStream->zfree)) - return MZ_STREAM_ERROR; - pStream->total_in = pStream->total_out = 0; - tdefl_init((tdefl_compressor *)pStream->state, NULL, NULL, - ((tdefl_compressor *)pStream->state)->m_flags); - return MZ_OK; -} - -int mz_deflate(mz_streamp pStream, int flush) { - size_t in_bytes, out_bytes; - mz_ulong orig_total_in, orig_total_out; - int mz_status = MZ_OK; - - if ((!pStream) || (!pStream->state) || (flush < 0) || (flush > MZ_FINISH) || - (!pStream->next_out)) - return MZ_STREAM_ERROR; - if (!pStream->avail_out) return MZ_BUF_ERROR; - - if (flush == MZ_PARTIAL_FLUSH) flush = MZ_SYNC_FLUSH; - - if (((tdefl_compressor *)pStream->state)->m_prev_return_status == - TDEFL_STATUS_DONE) - return (flush == MZ_FINISH) ? MZ_STREAM_END : MZ_BUF_ERROR; - - orig_total_in = pStream->total_in; - orig_total_out = pStream->total_out; - for (;;) { - tdefl_status defl_status; - in_bytes = pStream->avail_in; - out_bytes = pStream->avail_out; - - defl_status = tdefl_compress((tdefl_compressor *)pStream->state, - pStream->next_in, &in_bytes, pStream->next_out, - &out_bytes, (tdefl_flush)flush); - pStream->next_in += (mz_uint)in_bytes; - pStream->avail_in -= (mz_uint)in_bytes; - pStream->total_in += (mz_uint)in_bytes; - pStream->adler = tdefl_get_adler32((tdefl_compressor *)pStream->state); - - pStream->next_out += (mz_uint)out_bytes; - pStream->avail_out -= (mz_uint)out_bytes; - pStream->total_out += (mz_uint)out_bytes; - - if (defl_status < 0) { - mz_status = MZ_STREAM_ERROR; - break; - } else if (defl_status == TDEFL_STATUS_DONE) { - mz_status = MZ_STREAM_END; - break; - } else if (!pStream->avail_out) - break; - else if ((!pStream->avail_in) && (flush != MZ_FINISH)) { - if ((flush) || (pStream->total_in != orig_total_in) || - (pStream->total_out != orig_total_out)) - break; - return MZ_BUF_ERROR; // Can't make forward progress without some input. - } - } - return mz_status; -} - -int mz_deflateEnd(mz_streamp pStream) { - if (!pStream) return MZ_STREAM_ERROR; - if (pStream->state) { - pStream->zfree(pStream->opaque, pStream->state); - pStream->state = NULL; - } - return MZ_OK; -} - -mz_ulong mz_deflateBound(mz_streamp pStream, mz_ulong source_len) { - (void)pStream; - // This is really over conservative. (And lame, but it's actually pretty - // tricky to compute a true upper bound given the way tdefl's blocking works.) - return MZ_MAX(128 + (source_len * 110) / 100, - 128 + source_len + ((source_len / (31 * 1024)) + 1) * 5); -} - -int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, - const unsigned char *pSource, mz_ulong source_len, int level) { - int status; - mz_stream stream; - memset(&stream, 0, sizeof(stream)); - - // In case mz_ulong is 64-bits (argh I hate longs). - if ((source_len | *pDest_len) > 0xFFFFFFFFU) return MZ_PARAM_ERROR; - - stream.next_in = pSource; - stream.avail_in = (mz_uint32)source_len; - stream.next_out = pDest; - stream.avail_out = (mz_uint32)*pDest_len; - - status = mz_deflateInit(&stream, level); - if (status != MZ_OK) return status; - - status = mz_deflate(&stream, MZ_FINISH); - if (status != MZ_STREAM_END) { - mz_deflateEnd(&stream); - return (status == MZ_OK) ? MZ_BUF_ERROR : status; - } - - *pDest_len = stream.total_out; - return mz_deflateEnd(&stream); -} - -int mz_compress(unsigned char *pDest, mz_ulong *pDest_len, - const unsigned char *pSource, mz_ulong source_len) { - return mz_compress2(pDest, pDest_len, pSource, source_len, - MZ_DEFAULT_COMPRESSION); -} - -mz_ulong mz_compressBound(mz_ulong source_len) { - return mz_deflateBound(NULL, source_len); -} - -typedef struct { - tinfl_decompressor m_decomp; - mz_uint m_dict_ofs, m_dict_avail, m_first_call, m_has_flushed; - int m_window_bits; - mz_uint8 m_dict[TINFL_LZ_DICT_SIZE]; - tinfl_status m_last_status; -} inflate_state; - -int mz_inflateInit2(mz_streamp pStream, int window_bits) { - inflate_state *pDecomp; - if (!pStream) return MZ_STREAM_ERROR; - if ((window_bits != MZ_DEFAULT_WINDOW_BITS) && - (-window_bits != MZ_DEFAULT_WINDOW_BITS)) - return MZ_PARAM_ERROR; - - pStream->data_type = 0; - pStream->adler = 0; - pStream->msg = NULL; - pStream->total_in = 0; - pStream->total_out = 0; - pStream->reserved = 0; - if (!pStream->zalloc) pStream->zalloc = def_alloc_func; - if (!pStream->zfree) pStream->zfree = def_free_func; - - pDecomp = (inflate_state *)pStream->zalloc(pStream->opaque, 1, - sizeof(inflate_state)); - if (!pDecomp) return MZ_MEM_ERROR; - - pStream->state = (struct mz_internal_state *)pDecomp; - - tinfl_init(&pDecomp->m_decomp); - pDecomp->m_dict_ofs = 0; - pDecomp->m_dict_avail = 0; - pDecomp->m_last_status = TINFL_STATUS_NEEDS_MORE_INPUT; - pDecomp->m_first_call = 1; - pDecomp->m_has_flushed = 0; - pDecomp->m_window_bits = window_bits; - - return MZ_OK; -} - -int mz_inflateInit(mz_streamp pStream) { - return mz_inflateInit2(pStream, MZ_DEFAULT_WINDOW_BITS); -} - -int mz_inflate(mz_streamp pStream, int flush) { - inflate_state *pState; - mz_uint n, first_call, decomp_flags = TINFL_FLAG_COMPUTE_ADLER32; - size_t in_bytes, out_bytes, orig_avail_in; - tinfl_status status; - - if ((!pStream) || (!pStream->state)) return MZ_STREAM_ERROR; - if (flush == MZ_PARTIAL_FLUSH) flush = MZ_SYNC_FLUSH; - if ((flush) && (flush != MZ_SYNC_FLUSH) && (flush != MZ_FINISH)) - return MZ_STREAM_ERROR; - - pState = (inflate_state *)pStream->state; - if (pState->m_window_bits > 0) decomp_flags |= TINFL_FLAG_PARSE_ZLIB_HEADER; - orig_avail_in = pStream->avail_in; - - first_call = pState->m_first_call; - pState->m_first_call = 0; - if (pState->m_last_status < 0) return MZ_DATA_ERROR; - - if (pState->m_has_flushed && (flush != MZ_FINISH)) return MZ_STREAM_ERROR; - pState->m_has_flushed |= (flush == MZ_FINISH); - - if ((flush == MZ_FINISH) && (first_call)) { - // MZ_FINISH on the first call implies that the input and output buffers are - // large enough to hold the entire compressed/decompressed file. - decomp_flags |= TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF; - in_bytes = pStream->avail_in; - out_bytes = pStream->avail_out; - status = tinfl_decompress(&pState->m_decomp, pStream->next_in, &in_bytes, - pStream->next_out, pStream->next_out, &out_bytes, - decomp_flags); - pState->m_last_status = status; - pStream->next_in += (mz_uint)in_bytes; - pStream->avail_in -= (mz_uint)in_bytes; - pStream->total_in += (mz_uint)in_bytes; - pStream->adler = tinfl_get_adler32(&pState->m_decomp); - pStream->next_out += (mz_uint)out_bytes; - pStream->avail_out -= (mz_uint)out_bytes; - pStream->total_out += (mz_uint)out_bytes; - - if (status < 0) - return MZ_DATA_ERROR; - else if (status != TINFL_STATUS_DONE) { - pState->m_last_status = TINFL_STATUS_FAILED; - return MZ_BUF_ERROR; - } - return MZ_STREAM_END; - } - // flush != MZ_FINISH then we must assume there's more input. - if (flush != MZ_FINISH) decomp_flags |= TINFL_FLAG_HAS_MORE_INPUT; - - if (pState->m_dict_avail) { - n = MZ_MIN(pState->m_dict_avail, pStream->avail_out); - memcpy(pStream->next_out, pState->m_dict + pState->m_dict_ofs, n); - pStream->next_out += n; - pStream->avail_out -= n; - pStream->total_out += n; - pState->m_dict_avail -= n; - pState->m_dict_ofs = (pState->m_dict_ofs + n) & (TINFL_LZ_DICT_SIZE - 1); - return ((pState->m_last_status == TINFL_STATUS_DONE) && - (!pState->m_dict_avail)) - ? MZ_STREAM_END - : MZ_OK; - } - - for (;;) { - in_bytes = pStream->avail_in; - out_bytes = TINFL_LZ_DICT_SIZE - pState->m_dict_ofs; - - status = tinfl_decompress( - &pState->m_decomp, pStream->next_in, &in_bytes, pState->m_dict, - pState->m_dict + pState->m_dict_ofs, &out_bytes, decomp_flags); - pState->m_last_status = status; - - pStream->next_in += (mz_uint)in_bytes; - pStream->avail_in -= (mz_uint)in_bytes; - pStream->total_in += (mz_uint)in_bytes; - pStream->adler = tinfl_get_adler32(&pState->m_decomp); - - pState->m_dict_avail = (mz_uint)out_bytes; - - n = MZ_MIN(pState->m_dict_avail, pStream->avail_out); - memcpy(pStream->next_out, pState->m_dict + pState->m_dict_ofs, n); - pStream->next_out += n; - pStream->avail_out -= n; - pStream->total_out += n; - pState->m_dict_avail -= n; - pState->m_dict_ofs = (pState->m_dict_ofs + n) & (TINFL_LZ_DICT_SIZE - 1); - - if (status < 0) - return MZ_DATA_ERROR; // Stream is corrupted (there could be some - // uncompressed data left in the output dictionary - - // oh well). - else if ((status == TINFL_STATUS_NEEDS_MORE_INPUT) && (!orig_avail_in)) - return MZ_BUF_ERROR; // Signal caller that we can't make forward progress - // without supplying more input or by setting flush - // to MZ_FINISH. - else if (flush == MZ_FINISH) { - // The output buffer MUST be large to hold the remaining uncompressed data - // when flush==MZ_FINISH. - if (status == TINFL_STATUS_DONE) - return pState->m_dict_avail ? MZ_BUF_ERROR : MZ_STREAM_END; - // status here must be TINFL_STATUS_HAS_MORE_OUTPUT, which means there's - // at least 1 more byte on the way. If there's no more room left in the - // output buffer then something is wrong. - else if (!pStream->avail_out) - return MZ_BUF_ERROR; - } else if ((status == TINFL_STATUS_DONE) || (!pStream->avail_in) || - (!pStream->avail_out) || (pState->m_dict_avail)) - break; - } - - return ((status == TINFL_STATUS_DONE) && (!pState->m_dict_avail)) - ? MZ_STREAM_END - : MZ_OK; -} - -int mz_inflateEnd(mz_streamp pStream) { - if (!pStream) return MZ_STREAM_ERROR; - if (pStream->state) { - pStream->zfree(pStream->opaque, pStream->state); - pStream->state = NULL; - } - return MZ_OK; -} - -int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, - const unsigned char *pSource, mz_ulong source_len) { - mz_stream stream; - int status; - memset(&stream, 0, sizeof(stream)); - - // In case mz_ulong is 64-bits (argh I hate longs). - if ((source_len | *pDest_len) > 0xFFFFFFFFU) return MZ_PARAM_ERROR; - - stream.next_in = pSource; - stream.avail_in = (mz_uint32)source_len; - stream.next_out = pDest; - stream.avail_out = (mz_uint32)*pDest_len; - - status = mz_inflateInit(&stream); - if (status != MZ_OK) return status; - - status = mz_inflate(&stream, MZ_FINISH); - if (status != MZ_STREAM_END) { - mz_inflateEnd(&stream); - return ((status == MZ_BUF_ERROR) && (!stream.avail_in)) ? MZ_DATA_ERROR - : status; - } - *pDest_len = stream.total_out; - - return mz_inflateEnd(&stream); -} - -const char *mz_error(int err) { - static struct { - int m_err; - const char *m_pDesc; - } s_error_descs[] = {{MZ_OK, ""}, - {MZ_STREAM_END, "stream end"}, - {MZ_NEED_DICT, "need dictionary"}, - {MZ_ERRNO, "file error"}, - {MZ_STREAM_ERROR, "stream error"}, - {MZ_DATA_ERROR, "data error"}, - {MZ_MEM_ERROR, "out of memory"}, - {MZ_BUF_ERROR, "buf error"}, - {MZ_VERSION_ERROR, "version error"}, - {MZ_PARAM_ERROR, "parameter error"}}; - mz_uint i; - for (i = 0; i < sizeof(s_error_descs) / sizeof(s_error_descs[0]); ++i) - if (s_error_descs[i].m_err == err) return s_error_descs[i].m_pDesc; - return NULL; -} - -#endif // MINIZ_NO_ZLIB_APIS - -// ------------------- Low-level Decompression (completely independent from all -// compression API's) - -#define TINFL_MEMCPY(d, s, l) memcpy(d, s, l) -#define TINFL_MEMSET(p, c, l) memset(p, c, l) - -#define TINFL_CR_BEGIN \ - switch (r->m_state) { \ - case 0: -#define TINFL_CR_RETURN(state_index, result) \ - do { \ - status = result; \ - r->m_state = state_index; \ - goto common_exit; \ - case state_index:; \ - } \ - MZ_MACRO_END -#define TINFL_CR_RETURN_FOREVER(state_index, result) \ - do { \ - for (;;) { \ - TINFL_CR_RETURN(state_index, result); \ - } \ - } \ - MZ_MACRO_END -#define TINFL_CR_FINISH } - -// TODO: If the caller has indicated that there's no more input, and we attempt -// to read beyond the input buf, then something is wrong with the input because -// the inflator never -// reads ahead more than it needs to. Currently TINFL_GET_BYTE() pads the end of -// the stream with 0's in this scenario. -#define TINFL_GET_BYTE(state_index, c) \ - do { \ - if (pIn_buf_cur >= pIn_buf_end) { \ - for (;;) { \ - if (decomp_flags & TINFL_FLAG_HAS_MORE_INPUT) { \ - TINFL_CR_RETURN(state_index, TINFL_STATUS_NEEDS_MORE_INPUT); \ - if (pIn_buf_cur < pIn_buf_end) { \ - c = *pIn_buf_cur++; \ - break; \ - } \ - } else { \ - c = 0; \ - break; \ - } \ - } \ - } else \ - c = *pIn_buf_cur++; \ - } \ - MZ_MACRO_END - -#define TINFL_NEED_BITS(state_index, n) \ - do { \ - mz_uint c; \ - TINFL_GET_BYTE(state_index, c); \ - bit_buf |= (((tinfl_bit_buf_t)c) << num_bits); \ - num_bits += 8; \ - } while (num_bits < (mz_uint)(n)) -#define TINFL_SKIP_BITS(state_index, n) \ - do { \ - if (num_bits < (mz_uint)(n)) { \ - TINFL_NEED_BITS(state_index, n); \ - } \ - bit_buf >>= (n); \ - num_bits -= (n); \ - } \ - MZ_MACRO_END -#define TINFL_GET_BITS(state_index, b, n) \ - do { \ - if (num_bits < (mz_uint)(n)) { \ - TINFL_NEED_BITS(state_index, n); \ - } \ - b = bit_buf & ((1 << (n)) - 1); \ - bit_buf >>= (n); \ - num_bits -= (n); \ - } \ - MZ_MACRO_END - -// TINFL_HUFF_BITBUF_FILL() is only used rarely, when the number of bytes -// remaining in the input buffer falls below 2. -// It reads just enough bytes from the input stream that are needed to decode -// the next Huffman code (and absolutely no more). It works by trying to fully -// decode a -// Huffman code by using whatever bits are currently present in the bit buffer. -// If this fails, it reads another byte, and tries again until it succeeds or -// until the -// bit buffer contains >=15 bits (deflate's max. Huffman code size). -#define TINFL_HUFF_BITBUF_FILL(state_index, pHuff) \ - do { \ - temp = (pHuff)->m_look_up[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]; \ - if (temp >= 0) { \ - code_len = temp >> 9; \ - if ((code_len) && (num_bits >= code_len)) break; \ - } else if (num_bits > TINFL_FAST_LOOKUP_BITS) { \ - code_len = TINFL_FAST_LOOKUP_BITS; \ - do { \ - temp = (pHuff)->m_tree[~temp + ((bit_buf >> code_len++) & 1)]; \ - } while ((temp < 0) && (num_bits >= (code_len + 1))); \ - if (temp >= 0) break; \ - } \ - TINFL_GET_BYTE(state_index, c); \ - bit_buf |= (((tinfl_bit_buf_t)c) << num_bits); \ - num_bits += 8; \ - } while (num_bits < 15); - -// TINFL_HUFF_DECODE() decodes the next Huffman coded symbol. It's more complex -// than you would initially expect because the zlib API expects the decompressor -// to never read -// beyond the final byte of the deflate stream. (In other words, when this macro -// wants to read another byte from the input, it REALLY needs another byte in -// order to fully -// decode the next Huffman code.) Handling this properly is particularly -// important on raw deflate (non-zlib) streams, which aren't followed by a byte -// aligned adler-32. -// The slow path is only executed at the very end of the input buffer. -#define TINFL_HUFF_DECODE(state_index, sym, pHuff) \ - do { \ - int temp; \ - mz_uint code_len, c; \ - if (num_bits < 15) { \ - if ((pIn_buf_end - pIn_buf_cur) < 2) { \ - TINFL_HUFF_BITBUF_FILL(state_index, pHuff); \ - } else { \ - bit_buf |= (((tinfl_bit_buf_t)pIn_buf_cur[0]) << num_bits) | \ - (((tinfl_bit_buf_t)pIn_buf_cur[1]) << (num_bits + 8)); \ - pIn_buf_cur += 2; \ - num_bits += 16; \ - } \ - } \ - if ((temp = (pHuff)->m_look_up[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]) >= \ - 0) \ - code_len = temp >> 9, temp &= 511; \ - else { \ - code_len = TINFL_FAST_LOOKUP_BITS; \ - do { \ - temp = (pHuff)->m_tree[~temp + ((bit_buf >> code_len++) & 1)]; \ - } while (temp < 0); \ - } \ - sym = temp; \ - bit_buf >>= code_len; \ - num_bits -= code_len; \ - } \ - MZ_MACRO_END - -tinfl_status tinfl_decompress(tinfl_decompressor *r, - const mz_uint8 *pIn_buf_next, - size_t *pIn_buf_size, mz_uint8 *pOut_buf_start, - mz_uint8 *pOut_buf_next, size_t *pOut_buf_size, - const mz_uint32 decomp_flags) { - static const int s_length_base[31] = { - 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, - 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; - static const int s_length_extra[31] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, - 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, - 4, 4, 5, 5, 5, 5, 0, 0, 0}; - static const int s_dist_base[32] = { - 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, - 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, - 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0}; - static const int s_dist_extra[32] = {0, 0, 0, 0, 1, 1, 2, 2, 3, 3, - 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, - 9, 9, 10, 10, 11, 11, 12, 12, 13, 13}; - static const mz_uint8 s_length_dezigzag[19] = { - 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - static const int s_min_table_sizes[3] = {257, 1, 4}; - - tinfl_status status = TINFL_STATUS_FAILED; - mz_uint32 num_bits, dist, counter, num_extra; - tinfl_bit_buf_t bit_buf; - const mz_uint8 *pIn_buf_cur = pIn_buf_next, - *const pIn_buf_end = pIn_buf_next + *pIn_buf_size; - mz_uint8 *pOut_buf_cur = pOut_buf_next, - *const pOut_buf_end = pOut_buf_next + *pOut_buf_size; - size_t out_buf_size_mask = - (decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF) - ? (size_t)-1 - : ((pOut_buf_next - pOut_buf_start) + *pOut_buf_size) - 1, - dist_from_out_buf_start; - - // Ensure the output buffer's size is a power of 2, unless the output buffer - // is large enough to hold the entire output file (in which case it doesn't - // matter). - if (((out_buf_size_mask + 1) & out_buf_size_mask) || - (pOut_buf_next < pOut_buf_start)) { - *pIn_buf_size = *pOut_buf_size = 0; - return TINFL_STATUS_BAD_PARAM; - } - - num_bits = r->m_num_bits; - bit_buf = r->m_bit_buf; - dist = r->m_dist; - counter = r->m_counter; - num_extra = r->m_num_extra; - dist_from_out_buf_start = r->m_dist_from_out_buf_start; - TINFL_CR_BEGIN - - bit_buf = num_bits = dist = counter = num_extra = r->m_zhdr0 = r->m_zhdr1 = 0; - r->m_z_adler32 = r->m_check_adler32 = 1; - if (decomp_flags & TINFL_FLAG_PARSE_ZLIB_HEADER) { - TINFL_GET_BYTE(1, r->m_zhdr0); - TINFL_GET_BYTE(2, r->m_zhdr1); - counter = (((r->m_zhdr0 * 256 + r->m_zhdr1) % 31 != 0) || - (r->m_zhdr1 & 32) || ((r->m_zhdr0 & 15) != 8)); - if (!(decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF)) - counter |= (((1U << (8U + (r->m_zhdr0 >> 4))) > 32768U) || - ((out_buf_size_mask + 1) < - (size_t)(1ULL << (8U + (r->m_zhdr0 >> 4))))); - if (counter) { - TINFL_CR_RETURN_FOREVER(36, TINFL_STATUS_FAILED); - } - } - - do { - TINFL_GET_BITS(3, r->m_final, 3); - r->m_type = r->m_final >> 1; - if (r->m_type == 0) { - TINFL_SKIP_BITS(5, num_bits & 7); - for (counter = 0; counter < 4; ++counter) { - if (num_bits) - TINFL_GET_BITS(6, r->m_raw_header[counter], 8); - else - TINFL_GET_BYTE(7, r->m_raw_header[counter]); - } - if ((counter = (r->m_raw_header[0] | (r->m_raw_header[1] << 8))) != - (mz_uint)(0xFFFF ^ - (r->m_raw_header[2] | (r->m_raw_header[3] << 8)))) { - TINFL_CR_RETURN_FOREVER(39, TINFL_STATUS_FAILED); - } - while ((counter) && (num_bits)) { - TINFL_GET_BITS(51, dist, 8); - while (pOut_buf_cur >= pOut_buf_end) { - TINFL_CR_RETURN(52, TINFL_STATUS_HAS_MORE_OUTPUT); - } - *pOut_buf_cur++ = (mz_uint8)dist; - counter--; - } - while (counter) { - size_t n; - while (pOut_buf_cur >= pOut_buf_end) { - TINFL_CR_RETURN(9, TINFL_STATUS_HAS_MORE_OUTPUT); - } - while (pIn_buf_cur >= pIn_buf_end) { - if (decomp_flags & TINFL_FLAG_HAS_MORE_INPUT) { - TINFL_CR_RETURN(38, TINFL_STATUS_NEEDS_MORE_INPUT); - } else { - TINFL_CR_RETURN_FOREVER(40, TINFL_STATUS_FAILED); - } - } - n = MZ_MIN(MZ_MIN((size_t)(pOut_buf_end - pOut_buf_cur), - (size_t)(pIn_buf_end - pIn_buf_cur)), - counter); - TINFL_MEMCPY(pOut_buf_cur, pIn_buf_cur, n); - pIn_buf_cur += n; - pOut_buf_cur += n; - counter -= (mz_uint)n; - } - } else if (r->m_type == 3) { - TINFL_CR_RETURN_FOREVER(10, TINFL_STATUS_FAILED); - } else { - if (r->m_type == 1) { - mz_uint8 *p = r->m_tables[0].m_code_size; - mz_uint i; - r->m_table_sizes[0] = 288; - r->m_table_sizes[1] = 32; - TINFL_MEMSET(r->m_tables[1].m_code_size, 5, 32); - for (i = 0; i <= 143; ++i) *p++ = 8; - for (; i <= 255; ++i) *p++ = 9; - for (; i <= 279; ++i) *p++ = 7; - for (; i <= 287; ++i) *p++ = 8; - } else { - for (counter = 0; counter < 3; counter++) { - TINFL_GET_BITS(11, r->m_table_sizes[counter], "\05\05\04"[counter]); - r->m_table_sizes[counter] += s_min_table_sizes[counter]; - } - MZ_CLEAR_OBJ(r->m_tables[2].m_code_size); - for (counter = 0; counter < r->m_table_sizes[2]; counter++) { - mz_uint s; - TINFL_GET_BITS(14, s, 3); - r->m_tables[2].m_code_size[s_length_dezigzag[counter]] = (mz_uint8)s; - } - r->m_table_sizes[2] = 19; - } - for (; (int)r->m_type >= 0; r->m_type--) { - int tree_next, tree_cur; - tinfl_huff_table *pTable; - mz_uint i, j, used_syms, total, sym_index, next_code[17], - total_syms[16]; - pTable = &r->m_tables[r->m_type]; - MZ_CLEAR_OBJ(total_syms); - MZ_CLEAR_OBJ(pTable->m_look_up); - MZ_CLEAR_OBJ(pTable->m_tree); - for (i = 0; i < r->m_table_sizes[r->m_type]; ++i) - total_syms[pTable->m_code_size[i]]++; - used_syms = 0, total = 0; - next_code[0] = next_code[1] = 0; - for (i = 1; i <= 15; ++i) { - used_syms += total_syms[i]; - next_code[i + 1] = (total = ((total + total_syms[i]) << 1)); - } - if ((65536 != total) && (used_syms > 1)) { - TINFL_CR_RETURN_FOREVER(35, TINFL_STATUS_FAILED); - } - for (tree_next = -1, sym_index = 0; - sym_index < r->m_table_sizes[r->m_type]; ++sym_index) { - mz_uint rev_code = 0, l, cur_code, - code_size = pTable->m_code_size[sym_index]; - if (!code_size) continue; - cur_code = next_code[code_size]++; - for (l = code_size; l > 0; l--, cur_code >>= 1) - rev_code = (rev_code << 1) | (cur_code & 1); - if (code_size <= TINFL_FAST_LOOKUP_BITS) { - mz_int16 k = (mz_int16)((code_size << 9) | sym_index); - while (rev_code < TINFL_FAST_LOOKUP_SIZE) { - pTable->m_look_up[rev_code] = k; - rev_code += (1 << code_size); - } - continue; - } - if (0 == - (tree_cur = pTable->m_look_up[rev_code & - (TINFL_FAST_LOOKUP_SIZE - 1)])) { - pTable->m_look_up[rev_code & (TINFL_FAST_LOOKUP_SIZE - 1)] = - (mz_int16)tree_next; - tree_cur = tree_next; - tree_next -= 2; - } - rev_code >>= (TINFL_FAST_LOOKUP_BITS - 1); - for (j = code_size; j > (TINFL_FAST_LOOKUP_BITS + 1); j--) { - tree_cur -= ((rev_code >>= 1) & 1); - if (!pTable->m_tree[-tree_cur - 1]) { - pTable->m_tree[-tree_cur - 1] = (mz_int16)tree_next; - tree_cur = tree_next; - tree_next -= 2; - } else - tree_cur = pTable->m_tree[-tree_cur - 1]; - } - tree_cur -= ((rev_code >>= 1) & 1); - pTable->m_tree[-tree_cur - 1] = (mz_int16)sym_index; - } - if (r->m_type == 2) { - for (counter = 0; - counter < (r->m_table_sizes[0] + r->m_table_sizes[1]);) { - mz_uint s; - TINFL_HUFF_DECODE(16, dist, &r->m_tables[2]); - if (dist < 16) { - r->m_len_codes[counter++] = (mz_uint8)dist; - continue; - } - if ((dist == 16) && (!counter)) { - TINFL_CR_RETURN_FOREVER(17, TINFL_STATUS_FAILED); - } - num_extra = "\02\03\07"[dist - 16]; - TINFL_GET_BITS(18, s, num_extra); - s += "\03\03\013"[dist - 16]; - TINFL_MEMSET(r->m_len_codes + counter, - (dist == 16) ? r->m_len_codes[counter - 1] : 0, s); - counter += s; - } - if ((r->m_table_sizes[0] + r->m_table_sizes[1]) != counter) { - TINFL_CR_RETURN_FOREVER(21, TINFL_STATUS_FAILED); - } - TINFL_MEMCPY(r->m_tables[0].m_code_size, r->m_len_codes, - r->m_table_sizes[0]); - TINFL_MEMCPY(r->m_tables[1].m_code_size, - r->m_len_codes + r->m_table_sizes[0], - r->m_table_sizes[1]); - } - } - for (;;) { - mz_uint8 *pSrc; - for (;;) { - if (((pIn_buf_end - pIn_buf_cur) < 4) || - ((pOut_buf_end - pOut_buf_cur) < 2)) { - TINFL_HUFF_DECODE(23, counter, &r->m_tables[0]); - if (counter >= 256) break; - while (pOut_buf_cur >= pOut_buf_end) { - TINFL_CR_RETURN(24, TINFL_STATUS_HAS_MORE_OUTPUT); - } - *pOut_buf_cur++ = (mz_uint8)counter; - } else { - int sym2; - mz_uint code_len; -#if TINFL_USE_64BIT_BITBUF - if (num_bits < 30) { - bit_buf |= - (((tinfl_bit_buf_t)MZ_READ_LE32(pIn_buf_cur)) << num_bits); - pIn_buf_cur += 4; - num_bits += 32; - } -#else - if (num_bits < 15) { - bit_buf |= - (((tinfl_bit_buf_t)MZ_READ_LE16(pIn_buf_cur)) << num_bits); - pIn_buf_cur += 2; - num_bits += 16; - } -#endif - if ((sym2 = - r->m_tables[0] - .m_look_up[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]) >= - 0) - code_len = sym2 >> 9; - else { - code_len = TINFL_FAST_LOOKUP_BITS; - do { - sym2 = r->m_tables[0] - .m_tree[~sym2 + ((bit_buf >> code_len++) & 1)]; - } while (sym2 < 0); - } - counter = sym2; - bit_buf >>= code_len; - num_bits -= code_len; - if (counter & 256) break; - -#if !TINFL_USE_64BIT_BITBUF - if (num_bits < 15) { - bit_buf |= - (((tinfl_bit_buf_t)MZ_READ_LE16(pIn_buf_cur)) << num_bits); - pIn_buf_cur += 2; - num_bits += 16; - } -#endif - if ((sym2 = - r->m_tables[0] - .m_look_up[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]) >= - 0) - code_len = sym2 >> 9; - else { - code_len = TINFL_FAST_LOOKUP_BITS; - do { - sym2 = r->m_tables[0] - .m_tree[~sym2 + ((bit_buf >> code_len++) & 1)]; - } while (sym2 < 0); - } - bit_buf >>= code_len; - num_bits -= code_len; - - pOut_buf_cur[0] = (mz_uint8)counter; - if (sym2 & 256) { - pOut_buf_cur++; - counter = sym2; - break; - } - pOut_buf_cur[1] = (mz_uint8)sym2; - pOut_buf_cur += 2; - } - } - if ((counter &= 511) == 256) break; - - num_extra = s_length_extra[counter - 257]; - counter = s_length_base[counter - 257]; - if (num_extra) { - mz_uint extra_bits; - TINFL_GET_BITS(25, extra_bits, num_extra); - counter += extra_bits; - } - - TINFL_HUFF_DECODE(26, dist, &r->m_tables[1]); - num_extra = s_dist_extra[dist]; - dist = s_dist_base[dist]; - if (num_extra) { - mz_uint extra_bits; - TINFL_GET_BITS(27, extra_bits, num_extra); - dist += extra_bits; - } - - dist_from_out_buf_start = pOut_buf_cur - pOut_buf_start; - if ((dist > dist_from_out_buf_start) && - (decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF)) { - TINFL_CR_RETURN_FOREVER(37, TINFL_STATUS_FAILED); - } - - pSrc = pOut_buf_start + - ((dist_from_out_buf_start - dist) & out_buf_size_mask); - - if ((MZ_MAX(pOut_buf_cur, pSrc) + counter) > pOut_buf_end) { - while (counter--) { - while (pOut_buf_cur >= pOut_buf_end) { - TINFL_CR_RETURN(53, TINFL_STATUS_HAS_MORE_OUTPUT); - } - *pOut_buf_cur++ = - pOut_buf_start[(dist_from_out_buf_start++ - dist) & - out_buf_size_mask]; - } - continue; - } -#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES - else if ((counter >= 9) && (counter <= dist)) { - const mz_uint8 *pSrc_end = pSrc + (counter & ~7); - do { - ((mz_uint32 *)pOut_buf_cur)[0] = ((const mz_uint32 *)pSrc)[0]; - ((mz_uint32 *)pOut_buf_cur)[1] = ((const mz_uint32 *)pSrc)[1]; - pOut_buf_cur += 8; - } while ((pSrc += 8) < pSrc_end); - if ((counter &= 7) < 3) { - if (counter) { - pOut_buf_cur[0] = pSrc[0]; - if (counter > 1) pOut_buf_cur[1] = pSrc[1]; - pOut_buf_cur += counter; - } - continue; - } - } -#endif - do { - pOut_buf_cur[0] = pSrc[0]; - pOut_buf_cur[1] = pSrc[1]; - pOut_buf_cur[2] = pSrc[2]; - pOut_buf_cur += 3; - pSrc += 3; - } while ((int)(counter -= 3) > 2); - if ((int)counter > 0) { - pOut_buf_cur[0] = pSrc[0]; - if ((int)counter > 1) pOut_buf_cur[1] = pSrc[1]; - pOut_buf_cur += counter; - } - } - } - } while (!(r->m_final & 1)); - if (decomp_flags & TINFL_FLAG_PARSE_ZLIB_HEADER) { - TINFL_SKIP_BITS(32, num_bits & 7); - for (counter = 0; counter < 4; ++counter) { - mz_uint s; - if (num_bits) - TINFL_GET_BITS(41, s, 8); - else - TINFL_GET_BYTE(42, s); - r->m_z_adler32 = (r->m_z_adler32 << 8) | s; - } - } - TINFL_CR_RETURN_FOREVER(34, TINFL_STATUS_DONE); - TINFL_CR_FINISH - -common_exit: - r->m_num_bits = num_bits; - r->m_bit_buf = bit_buf; - r->m_dist = dist; - r->m_counter = counter; - r->m_num_extra = num_extra; - r->m_dist_from_out_buf_start = dist_from_out_buf_start; - *pIn_buf_size = pIn_buf_cur - pIn_buf_next; - *pOut_buf_size = pOut_buf_cur - pOut_buf_next; - if ((decomp_flags & - (TINFL_FLAG_PARSE_ZLIB_HEADER | TINFL_FLAG_COMPUTE_ADLER32)) && - (status >= 0)) { - const mz_uint8 *ptr = pOut_buf_next; - size_t buf_len = *pOut_buf_size; - mz_uint32 i, s1 = r->m_check_adler32 & 0xffff, - s2 = r->m_check_adler32 >> 16; - size_t block_len = buf_len % 5552; - while (buf_len) { - for (i = 0; i + 7 < block_len; i += 8, ptr += 8) { - s1 += ptr[0], s2 += s1; - s1 += ptr[1], s2 += s1; - s1 += ptr[2], s2 += s1; - s1 += ptr[3], s2 += s1; - s1 += ptr[4], s2 += s1; - s1 += ptr[5], s2 += s1; - s1 += ptr[6], s2 += s1; - s1 += ptr[7], s2 += s1; - } - for (; i < block_len; ++i) s1 += *ptr++, s2 += s1; - s1 %= 65521U, s2 %= 65521U; - buf_len -= block_len; - block_len = 5552; - } - r->m_check_adler32 = (s2 << 16) + s1; - if ((status == TINFL_STATUS_DONE) && - (decomp_flags & TINFL_FLAG_PARSE_ZLIB_HEADER) && - (r->m_check_adler32 != r->m_z_adler32)) - status = TINFL_STATUS_ADLER32_MISMATCH; - } - return status; -} - -// Higher level helper functions. -void *tinfl_decompress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, - size_t *pOut_len, int flags) { - tinfl_decompressor decomp; - void *pBuf = NULL, *pNew_buf; - size_t src_buf_ofs = 0, out_buf_capacity = 0; - *pOut_len = 0; - tinfl_init(&decomp); - for (;;) { - size_t src_buf_size = src_buf_len - src_buf_ofs, - dst_buf_size = out_buf_capacity - *pOut_len, new_out_buf_capacity; - tinfl_status status = tinfl_decompress( - &decomp, (const mz_uint8 *)pSrc_buf + src_buf_ofs, &src_buf_size, - (mz_uint8 *)pBuf, pBuf ? (mz_uint8 *)pBuf + *pOut_len : NULL, - &dst_buf_size, - (flags & ~TINFL_FLAG_HAS_MORE_INPUT) | - TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF); - if ((status < 0) || (status == TINFL_STATUS_NEEDS_MORE_INPUT)) { - MZ_FREE(pBuf); - *pOut_len = 0; - return NULL; - } - src_buf_ofs += src_buf_size; - *pOut_len += dst_buf_size; - if (status == TINFL_STATUS_DONE) break; - new_out_buf_capacity = out_buf_capacity * 2; - if (new_out_buf_capacity < 128) new_out_buf_capacity = 128; - pNew_buf = MZ_REALLOC(pBuf, new_out_buf_capacity); - if (!pNew_buf) { - MZ_FREE(pBuf); - *pOut_len = 0; - return NULL; - } - pBuf = pNew_buf; - out_buf_capacity = new_out_buf_capacity; - } - return pBuf; -} - -size_t tinfl_decompress_mem_to_mem(void *pOut_buf, size_t out_buf_len, - const void *pSrc_buf, size_t src_buf_len, - int flags) { - tinfl_decompressor decomp; - tinfl_status status; - tinfl_init(&decomp); - status = - tinfl_decompress(&decomp, (const mz_uint8 *)pSrc_buf, &src_buf_len, - (mz_uint8 *)pOut_buf, (mz_uint8 *)pOut_buf, &out_buf_len, - (flags & ~TINFL_FLAG_HAS_MORE_INPUT) | - TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF); - return (status != TINFL_STATUS_DONE) ? TINFL_DECOMPRESS_MEM_TO_MEM_FAILED - : out_buf_len; -} - -int tinfl_decompress_mem_to_callback(const void *pIn_buf, size_t *pIn_buf_size, - tinfl_put_buf_func_ptr pPut_buf_func, - void *pPut_buf_user, int flags) { - int result = 0; - tinfl_decompressor decomp; - mz_uint8 *pDict = (mz_uint8 *)MZ_MALLOC(TINFL_LZ_DICT_SIZE); - size_t in_buf_ofs = 0, dict_ofs = 0; - if (!pDict) return TINFL_STATUS_FAILED; - tinfl_init(&decomp); - for (;;) { - size_t in_buf_size = *pIn_buf_size - in_buf_ofs, - dst_buf_size = TINFL_LZ_DICT_SIZE - dict_ofs; - tinfl_status status = - tinfl_decompress(&decomp, (const mz_uint8 *)pIn_buf + in_buf_ofs, - &in_buf_size, pDict, pDict + dict_ofs, &dst_buf_size, - (flags & - ~(TINFL_FLAG_HAS_MORE_INPUT | - TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF))); - in_buf_ofs += in_buf_size; - if ((dst_buf_size) && - (!(*pPut_buf_func)(pDict + dict_ofs, (int)dst_buf_size, pPut_buf_user))) - break; - if (status != TINFL_STATUS_HAS_MORE_OUTPUT) { - result = (status == TINFL_STATUS_DONE); - break; - } - dict_ofs = (dict_ofs + dst_buf_size) & (TINFL_LZ_DICT_SIZE - 1); - } - MZ_FREE(pDict); - *pIn_buf_size = in_buf_ofs; - return result; -} - -// ------------------- Low-level Compression (independent from all decompression -// API's) - -// Purposely making these tables static for faster init and thread safety. -static const mz_uint16 s_tdefl_len_sym[256] = { - 257, 258, 259, 260, 261, 262, 263, 264, 265, 265, 266, 266, 267, 267, 268, - 268, 269, 269, 269, 269, 270, 270, 270, 270, 271, 271, 271, 271, 272, 272, - 272, 272, 273, 273, 273, 273, 273, 273, 273, 273, 274, 274, 274, 274, 274, - 274, 274, 274, 275, 275, 275, 275, 275, 275, 275, 275, 276, 276, 276, 276, - 276, 276, 276, 276, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - 277, 277, 277, 277, 277, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - 278, 278, 278, 278, 278, 278, 279, 279, 279, 279, 279, 279, 279, 279, 279, - 279, 279, 279, 279, 279, 279, 279, 280, 280, 280, 280, 280, 280, 280, 280, - 280, 280, 280, 280, 280, 280, 280, 280, 281, 281, 281, 281, 281, 281, 281, - 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, - 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 282, 282, 282, 282, 282, - 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, - 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 283, 283, 283, - 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, - 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 284, - 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, - 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, - 285}; - -static const mz_uint8 s_tdefl_len_extra[256] = { - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0}; - -static const mz_uint8 s_tdefl_small_dist_sym[512] = { - 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, - 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17}; - -static const mz_uint8 s_tdefl_small_dist_extra[512] = { - 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}; - -static const mz_uint8 s_tdefl_large_dist_sym[128] = { - 0, 0, 18, 19, 20, 20, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, - 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, - 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29}; - -static const mz_uint8 s_tdefl_large_dist_extra[128] = { - 0, 0, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13}; - -// Radix sorts tdefl_sym_freq[] array by 16-bit key m_key. Returns ptr to sorted -// values. -typedef struct { mz_uint16 m_key, m_sym_index; } tdefl_sym_freq; -static tdefl_sym_freq *tdefl_radix_sort_syms(mz_uint num_syms, - tdefl_sym_freq *pSyms0, - tdefl_sym_freq *pSyms1) { - mz_uint32 total_passes = 2, pass_shift, pass, i, hist[256 * 2]; - tdefl_sym_freq *pCur_syms = pSyms0, *pNew_syms = pSyms1; - MZ_CLEAR_OBJ(hist); - for (i = 0; i < num_syms; i++) { - mz_uint freq = pSyms0[i].m_key; - hist[freq & 0xFF]++; - hist[256 + ((freq >> 8) & 0xFF)]++; - } - while ((total_passes > 1) && (num_syms == hist[(total_passes - 1) * 256])) - total_passes--; - for (pass_shift = 0, pass = 0; pass < total_passes; pass++, pass_shift += 8) { - const mz_uint32 *pHist = &hist[pass << 8]; - mz_uint offsets[256], cur_ofs = 0; - for (i = 0; i < 256; i++) { - offsets[i] = cur_ofs; - cur_ofs += pHist[i]; - } - for (i = 0; i < num_syms; i++) - pNew_syms[offsets[(pCur_syms[i].m_key >> pass_shift) & 0xFF]++] = - pCur_syms[i]; - { - tdefl_sym_freq *t = pCur_syms; - pCur_syms = pNew_syms; - pNew_syms = t; - } - } - return pCur_syms; -} - -// tdefl_calculate_minimum_redundancy() originally written by: Alistair Moffat, -// alistair@cs.mu.oz.au, Jyrki Katajainen, jyrki@diku.dk, November 1996. -static void tdefl_calculate_minimum_redundancy(tdefl_sym_freq *A, int n) { - int root, leaf, next, avbl, used, dpth; - if (n == 0) - return; - else if (n == 1) { - A[0].m_key = 1; - return; - } - A[0].m_key += A[1].m_key; - root = 0; - leaf = 2; - for (next = 1; next < n - 1; next++) { - if (leaf >= n || A[root].m_key < A[leaf].m_key) { - A[next].m_key = A[root].m_key; - A[root++].m_key = (mz_uint16)next; - } else - A[next].m_key = A[leaf++].m_key; - if (leaf >= n || (root < next && A[root].m_key < A[leaf].m_key)) { - A[next].m_key = (mz_uint16)(A[next].m_key + A[root].m_key); - A[root++].m_key = (mz_uint16)next; - } else - A[next].m_key = (mz_uint16)(A[next].m_key + A[leaf++].m_key); - } - A[n - 2].m_key = 0; - for (next = n - 3; next >= 0; next--) - A[next].m_key = A[A[next].m_key].m_key + 1; - avbl = 1; - used = dpth = 0; - root = n - 2; - next = n - 1; - while (avbl > 0) { - while (root >= 0 && (int)A[root].m_key == dpth) { - used++; - root--; - } - while (avbl > used) { - A[next--].m_key = (mz_uint16)(dpth); - avbl--; - } - avbl = 2 * used; - dpth++; - used = 0; - } -} - -// Limits canonical Huffman code table's max code size. -enum { TDEFL_MAX_SUPPORTED_HUFF_CODESIZE = 32 }; -static void tdefl_huffman_enforce_max_code_size(int *pNum_codes, - int code_list_len, - int max_code_size) { - int i; - mz_uint32 total = 0; - if (code_list_len <= 1) return; - for (i = max_code_size + 1; i <= TDEFL_MAX_SUPPORTED_HUFF_CODESIZE; i++) - pNum_codes[max_code_size] += pNum_codes[i]; - for (i = max_code_size; i > 0; i--) - total += (((mz_uint32)pNum_codes[i]) << (max_code_size - i)); - while (total != (1UL << max_code_size)) { - pNum_codes[max_code_size]--; - for (i = max_code_size - 1; i > 0; i--) - if (pNum_codes[i]) { - pNum_codes[i]--; - pNum_codes[i + 1] += 2; - break; - } - total--; - } -} - -static void tdefl_optimize_huffman_table(tdefl_compressor *d, int table_num, - int table_len, int code_size_limit, - int static_table) { - int i, j, l, num_codes[1 + TDEFL_MAX_SUPPORTED_HUFF_CODESIZE]; - mz_uint next_code[TDEFL_MAX_SUPPORTED_HUFF_CODESIZE + 1]; - MZ_CLEAR_OBJ(num_codes); - if (static_table) { - for (i = 0; i < table_len; i++) - num_codes[d->m_huff_code_sizes[table_num][i]]++; - } else { - tdefl_sym_freq syms0[TDEFL_MAX_HUFF_SYMBOLS], syms1[TDEFL_MAX_HUFF_SYMBOLS], - *pSyms; - int num_used_syms = 0; - const mz_uint16 *pSym_count = &d->m_huff_count[table_num][0]; - for (i = 0; i < table_len; i++) - if (pSym_count[i]) { - syms0[num_used_syms].m_key = (mz_uint16)pSym_count[i]; - syms0[num_used_syms++].m_sym_index = (mz_uint16)i; - } - - pSyms = tdefl_radix_sort_syms(num_used_syms, syms0, syms1); - tdefl_calculate_minimum_redundancy(pSyms, num_used_syms); - - for (i = 0; i < num_used_syms; i++) num_codes[pSyms[i].m_key]++; - - tdefl_huffman_enforce_max_code_size(num_codes, num_used_syms, - code_size_limit); - - MZ_CLEAR_OBJ(d->m_huff_code_sizes[table_num]); - MZ_CLEAR_OBJ(d->m_huff_codes[table_num]); - for (i = 1, j = num_used_syms; i <= code_size_limit; i++) - for (l = num_codes[i]; l > 0; l--) - d->m_huff_code_sizes[table_num][pSyms[--j].m_sym_index] = (mz_uint8)(i); - } - - next_code[1] = 0; - for (j = 0, i = 2; i <= code_size_limit; i++) - next_code[i] = j = ((j + num_codes[i - 1]) << 1); - - for (i = 0; i < table_len; i++) { - mz_uint rev_code = 0, code, code_size; - if ((code_size = d->m_huff_code_sizes[table_num][i]) == 0) continue; - code = next_code[code_size]++; - for (l = code_size; l > 0; l--, code >>= 1) - rev_code = (rev_code << 1) | (code & 1); - d->m_huff_codes[table_num][i] = (mz_uint16)rev_code; - } -} - -#define TDEFL_PUT_BITS(b, l) \ - do { \ - mz_uint bits = b; \ - mz_uint len = l; \ - MZ_ASSERT(bits <= ((1U << len) - 1U)); \ - d->m_bit_buffer |= (bits << d->m_bits_in); \ - d->m_bits_in += len; \ - while (d->m_bits_in >= 8) { \ - if (d->m_pOutput_buf < d->m_pOutput_buf_end) \ - *d->m_pOutput_buf++ = (mz_uint8)(d->m_bit_buffer); \ - d->m_bit_buffer >>= 8; \ - d->m_bits_in -= 8; \ - } \ - } \ - MZ_MACRO_END - -#define TDEFL_RLE_PREV_CODE_SIZE() \ - { \ - if (rle_repeat_count) { \ - if (rle_repeat_count < 3) { \ - d->m_huff_count[2][prev_code_size] = (mz_uint16)( \ - d->m_huff_count[2][prev_code_size] + rle_repeat_count); \ - while (rle_repeat_count--) \ - packed_code_sizes[num_packed_code_sizes++] = prev_code_size; \ - } else { \ - d->m_huff_count[2][16] = (mz_uint16)(d->m_huff_count[2][16] + 1); \ - packed_code_sizes[num_packed_code_sizes++] = 16; \ - packed_code_sizes[num_packed_code_sizes++] = \ - (mz_uint8)(rle_repeat_count - 3); \ - } \ - rle_repeat_count = 0; \ - } \ - } - -#define TDEFL_RLE_ZERO_CODE_SIZE() \ - { \ - if (rle_z_count) { \ - if (rle_z_count < 3) { \ - d->m_huff_count[2][0] = \ - (mz_uint16)(d->m_huff_count[2][0] + rle_z_count); \ - while (rle_z_count--) packed_code_sizes[num_packed_code_sizes++] = 0; \ - } else if (rle_z_count <= 10) { \ - d->m_huff_count[2][17] = (mz_uint16)(d->m_huff_count[2][17] + 1); \ - packed_code_sizes[num_packed_code_sizes++] = 17; \ - packed_code_sizes[num_packed_code_sizes++] = \ - (mz_uint8)(rle_z_count - 3); \ - } else { \ - d->m_huff_count[2][18] = (mz_uint16)(d->m_huff_count[2][18] + 1); \ - packed_code_sizes[num_packed_code_sizes++] = 18; \ - packed_code_sizes[num_packed_code_sizes++] = \ - (mz_uint8)(rle_z_count - 11); \ - } \ - rle_z_count = 0; \ - } \ - } - -static mz_uint8 s_tdefl_packed_code_size_syms_swizzle[] = { - 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - -static void tdefl_start_dynamic_block(tdefl_compressor *d) { - int num_lit_codes, num_dist_codes, num_bit_lengths; - mz_uint i, total_code_sizes_to_pack, num_packed_code_sizes, rle_z_count, - rle_repeat_count, packed_code_sizes_index; - mz_uint8 - code_sizes_to_pack[TDEFL_MAX_HUFF_SYMBOLS_0 + TDEFL_MAX_HUFF_SYMBOLS_1], - packed_code_sizes[TDEFL_MAX_HUFF_SYMBOLS_0 + TDEFL_MAX_HUFF_SYMBOLS_1], - prev_code_size = 0xFF; - - d->m_huff_count[0][256] = 1; - - tdefl_optimize_huffman_table(d, 0, TDEFL_MAX_HUFF_SYMBOLS_0, 15, MZ_FALSE); - tdefl_optimize_huffman_table(d, 1, TDEFL_MAX_HUFF_SYMBOLS_1, 15, MZ_FALSE); - - for (num_lit_codes = 286; num_lit_codes > 257; num_lit_codes--) - if (d->m_huff_code_sizes[0][num_lit_codes - 1]) break; - for (num_dist_codes = 30; num_dist_codes > 1; num_dist_codes--) - if (d->m_huff_code_sizes[1][num_dist_codes - 1]) break; - - memcpy(code_sizes_to_pack, &d->m_huff_code_sizes[0][0], num_lit_codes); - memcpy(code_sizes_to_pack + num_lit_codes, &d->m_huff_code_sizes[1][0], - num_dist_codes); - total_code_sizes_to_pack = num_lit_codes + num_dist_codes; - num_packed_code_sizes = 0; - rle_z_count = 0; - rle_repeat_count = 0; - - memset(&d->m_huff_count[2][0], 0, - sizeof(d->m_huff_count[2][0]) * TDEFL_MAX_HUFF_SYMBOLS_2); - for (i = 0; i < total_code_sizes_to_pack; i++) { - mz_uint8 code_size = code_sizes_to_pack[i]; - if (!code_size) { - TDEFL_RLE_PREV_CODE_SIZE(); - if (++rle_z_count == 138) { - TDEFL_RLE_ZERO_CODE_SIZE(); - } - } else { - TDEFL_RLE_ZERO_CODE_SIZE(); - if (code_size != prev_code_size) { - TDEFL_RLE_PREV_CODE_SIZE(); - d->m_huff_count[2][code_size] = - (mz_uint16)(d->m_huff_count[2][code_size] + 1); - packed_code_sizes[num_packed_code_sizes++] = code_size; - } else if (++rle_repeat_count == 6) { - TDEFL_RLE_PREV_CODE_SIZE(); - } - } - prev_code_size = code_size; - } - if (rle_repeat_count) { - TDEFL_RLE_PREV_CODE_SIZE(); - } else { - TDEFL_RLE_ZERO_CODE_SIZE(); - } - - tdefl_optimize_huffman_table(d, 2, TDEFL_MAX_HUFF_SYMBOLS_2, 7, MZ_FALSE); - - TDEFL_PUT_BITS(2, 2); - - TDEFL_PUT_BITS(num_lit_codes - 257, 5); - TDEFL_PUT_BITS(num_dist_codes - 1, 5); - - for (num_bit_lengths = 18; num_bit_lengths >= 0; num_bit_lengths--) - if (d->m_huff_code_sizes - [2][s_tdefl_packed_code_size_syms_swizzle[num_bit_lengths]]) - break; - num_bit_lengths = MZ_MAX(4, (num_bit_lengths + 1)); - TDEFL_PUT_BITS(num_bit_lengths - 4, 4); - for (i = 0; (int)i < num_bit_lengths; i++) - TDEFL_PUT_BITS( - d->m_huff_code_sizes[2][s_tdefl_packed_code_size_syms_swizzle[i]], 3); - - for (packed_code_sizes_index = 0; - packed_code_sizes_index < num_packed_code_sizes;) { - mz_uint code = packed_code_sizes[packed_code_sizes_index++]; - MZ_ASSERT(code < TDEFL_MAX_HUFF_SYMBOLS_2); - TDEFL_PUT_BITS(d->m_huff_codes[2][code], d->m_huff_code_sizes[2][code]); - if (code >= 16) - TDEFL_PUT_BITS(packed_code_sizes[packed_code_sizes_index++], - "\02\03\07"[code - 16]); - } -} - -static void tdefl_start_static_block(tdefl_compressor *d) { - mz_uint i; - mz_uint8 *p = &d->m_huff_code_sizes[0][0]; - - for (i = 0; i <= 143; ++i) *p++ = 8; - for (; i <= 255; ++i) *p++ = 9; - for (; i <= 279; ++i) *p++ = 7; - for (; i <= 287; ++i) *p++ = 8; - - memset(d->m_huff_code_sizes[1], 5, 32); - - tdefl_optimize_huffman_table(d, 0, 288, 15, MZ_TRUE); - tdefl_optimize_huffman_table(d, 1, 32, 15, MZ_TRUE); - - TDEFL_PUT_BITS(1, 2); -} - -static const mz_uint mz_bitmasks[17] = { - 0x0000, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F, 0x00FF, - 0x01FF, 0x03FF, 0x07FF, 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF}; - -#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN && \ - MINIZ_HAS_64BIT_REGISTERS -static mz_bool tdefl_compress_lz_codes(tdefl_compressor *d) { - mz_uint flags; - mz_uint8 *pLZ_codes; - mz_uint8 *pOutput_buf = d->m_pOutput_buf; - mz_uint8 *pLZ_code_buf_end = d->m_pLZ_code_buf; - mz_uint64 bit_buffer = d->m_bit_buffer; - mz_uint bits_in = d->m_bits_in; - -#define TDEFL_PUT_BITS_FAST(b, l) \ - { \ - bit_buffer |= (((mz_uint64)(b)) << bits_in); \ - bits_in += (l); \ - } - - flags = 1; - for (pLZ_codes = d->m_lz_code_buf; pLZ_codes < pLZ_code_buf_end; - flags >>= 1) { - if (flags == 1) flags = *pLZ_codes++ | 0x100; - - if (flags & 1) { - mz_uint s0, s1, n0, n1, sym, num_extra_bits; - mz_uint match_len = pLZ_codes[0], - match_dist = *(const mz_uint16 *)(pLZ_codes + 1); - pLZ_codes += 3; - - MZ_ASSERT(d->m_huff_code_sizes[0][s_tdefl_len_sym[match_len]]); - TDEFL_PUT_BITS_FAST(d->m_huff_codes[0][s_tdefl_len_sym[match_len]], - d->m_huff_code_sizes[0][s_tdefl_len_sym[match_len]]); - TDEFL_PUT_BITS_FAST(match_len & mz_bitmasks[s_tdefl_len_extra[match_len]], - s_tdefl_len_extra[match_len]); - - // This sequence coaxes MSVC into using cmov's vs. jmp's. - s0 = s_tdefl_small_dist_sym[match_dist & 511]; - n0 = s_tdefl_small_dist_extra[match_dist & 511]; - s1 = s_tdefl_large_dist_sym[match_dist >> 8]; - n1 = s_tdefl_large_dist_extra[match_dist >> 8]; - sym = (match_dist < 512) ? s0 : s1; - num_extra_bits = (match_dist < 512) ? n0 : n1; - - MZ_ASSERT(d->m_huff_code_sizes[1][sym]); - TDEFL_PUT_BITS_FAST(d->m_huff_codes[1][sym], - d->m_huff_code_sizes[1][sym]); - TDEFL_PUT_BITS_FAST(match_dist & mz_bitmasks[num_extra_bits], - num_extra_bits); - } else { - mz_uint lit = *pLZ_codes++; - MZ_ASSERT(d->m_huff_code_sizes[0][lit]); - TDEFL_PUT_BITS_FAST(d->m_huff_codes[0][lit], - d->m_huff_code_sizes[0][lit]); - - if (((flags & 2) == 0) && (pLZ_codes < pLZ_code_buf_end)) { - flags >>= 1; - lit = *pLZ_codes++; - MZ_ASSERT(d->m_huff_code_sizes[0][lit]); - TDEFL_PUT_BITS_FAST(d->m_huff_codes[0][lit], - d->m_huff_code_sizes[0][lit]); - - if (((flags & 2) == 0) && (pLZ_codes < pLZ_code_buf_end)) { - flags >>= 1; - lit = *pLZ_codes++; - MZ_ASSERT(d->m_huff_code_sizes[0][lit]); - TDEFL_PUT_BITS_FAST(d->m_huff_codes[0][lit], - d->m_huff_code_sizes[0][lit]); - } - } - } - - if (pOutput_buf >= d->m_pOutput_buf_end) return MZ_FALSE; - - *(mz_uint64 *)pOutput_buf = bit_buffer; - pOutput_buf += (bits_in >> 3); - bit_buffer >>= (bits_in & ~7); - bits_in &= 7; - } - -#undef TDEFL_PUT_BITS_FAST - - d->m_pOutput_buf = pOutput_buf; - d->m_bits_in = 0; - d->m_bit_buffer = 0; - - while (bits_in) { - mz_uint32 n = MZ_MIN(bits_in, 16); - TDEFL_PUT_BITS((mz_uint)bit_buffer & mz_bitmasks[n], n); - bit_buffer >>= n; - bits_in -= n; - } - - TDEFL_PUT_BITS(d->m_huff_codes[0][256], d->m_huff_code_sizes[0][256]); - - return (d->m_pOutput_buf < d->m_pOutput_buf_end); -} -#else -static mz_bool tdefl_compress_lz_codes(tdefl_compressor *d) { - mz_uint flags; - mz_uint8 *pLZ_codes; - - flags = 1; - for (pLZ_codes = d->m_lz_code_buf; pLZ_codes < d->m_pLZ_code_buf; - flags >>= 1) { - if (flags == 1) flags = *pLZ_codes++ | 0x100; - if (flags & 1) { - mz_uint sym, num_extra_bits; - mz_uint match_len = pLZ_codes[0], - match_dist = (pLZ_codes[1] | (pLZ_codes[2] << 8)); - pLZ_codes += 3; - - MZ_ASSERT(d->m_huff_code_sizes[0][s_tdefl_len_sym[match_len]]); - TDEFL_PUT_BITS(d->m_huff_codes[0][s_tdefl_len_sym[match_len]], - d->m_huff_code_sizes[0][s_tdefl_len_sym[match_len]]); - TDEFL_PUT_BITS(match_len & mz_bitmasks[s_tdefl_len_extra[match_len]], - s_tdefl_len_extra[match_len]); - - if (match_dist < 512) { - sym = s_tdefl_small_dist_sym[match_dist]; - num_extra_bits = s_tdefl_small_dist_extra[match_dist]; - } else { - sym = s_tdefl_large_dist_sym[match_dist >> 8]; - num_extra_bits = s_tdefl_large_dist_extra[match_dist >> 8]; - } - MZ_ASSERT(d->m_huff_code_sizes[1][sym]); - TDEFL_PUT_BITS(d->m_huff_codes[1][sym], d->m_huff_code_sizes[1][sym]); - TDEFL_PUT_BITS(match_dist & mz_bitmasks[num_extra_bits], num_extra_bits); - } else { - mz_uint lit = *pLZ_codes++; - MZ_ASSERT(d->m_huff_code_sizes[0][lit]); - TDEFL_PUT_BITS(d->m_huff_codes[0][lit], d->m_huff_code_sizes[0][lit]); - } - } - - TDEFL_PUT_BITS(d->m_huff_codes[0][256], d->m_huff_code_sizes[0][256]); - - return (d->m_pOutput_buf < d->m_pOutput_buf_end); -} -#endif // MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN && - // MINIZ_HAS_64BIT_REGISTERS - -static mz_bool tdefl_compress_block(tdefl_compressor *d, mz_bool static_block) { - if (static_block) - tdefl_start_static_block(d); - else - tdefl_start_dynamic_block(d); - return tdefl_compress_lz_codes(d); -} - -static int tdefl_flush_block(tdefl_compressor *d, int flush) { - mz_uint saved_bit_buf, saved_bits_in; - mz_uint8 *pSaved_output_buf; - mz_bool comp_block_succeeded = MZ_FALSE; - int n, - use_raw_block = - ((d->m_flags & TDEFL_FORCE_ALL_RAW_BLOCKS) != 0) && - (d->m_lookahead_pos - d->m_lz_code_buf_dict_pos) <= d->m_dict_size; - mz_uint8 *pOutput_buf_start = - ((d->m_pPut_buf_func == NULL) && - ((*d->m_pOut_buf_size - d->m_out_buf_ofs) >= TDEFL_OUT_BUF_SIZE)) - ? ((mz_uint8 *)d->m_pOut_buf + d->m_out_buf_ofs) - : d->m_output_buf; - - d->m_pOutput_buf = pOutput_buf_start; - d->m_pOutput_buf_end = d->m_pOutput_buf + TDEFL_OUT_BUF_SIZE - 16; - - MZ_ASSERT(!d->m_output_flush_remaining); - d->m_output_flush_ofs = 0; - d->m_output_flush_remaining = 0; - - *d->m_pLZ_flags = (mz_uint8)(*d->m_pLZ_flags >> d->m_num_flags_left); - d->m_pLZ_code_buf -= (d->m_num_flags_left == 8); - - if ((d->m_flags & TDEFL_WRITE_ZLIB_HEADER) && (!d->m_block_index)) { - TDEFL_PUT_BITS(0x78, 8); - TDEFL_PUT_BITS(0x01, 8); - } - - TDEFL_PUT_BITS(flush == TDEFL_FINISH, 1); - - pSaved_output_buf = d->m_pOutput_buf; - saved_bit_buf = d->m_bit_buffer; - saved_bits_in = d->m_bits_in; - - if (!use_raw_block) - comp_block_succeeded = - tdefl_compress_block(d, - (d->m_flags & TDEFL_FORCE_ALL_STATIC_BLOCKS) || - (d->m_total_lz_bytes < 48)); - - // If the block gets expanded, forget the current contents of the output - // buffer and send a raw block instead. - if (((use_raw_block) || - ((d->m_total_lz_bytes) && ((d->m_pOutput_buf - pSaved_output_buf + 1U) >= - d->m_total_lz_bytes))) && - ((d->m_lookahead_pos - d->m_lz_code_buf_dict_pos) <= d->m_dict_size)) { - mz_uint i; - d->m_pOutput_buf = pSaved_output_buf; - d->m_bit_buffer = saved_bit_buf, d->m_bits_in = saved_bits_in; - TDEFL_PUT_BITS(0, 2); - if (d->m_bits_in) { - TDEFL_PUT_BITS(0, 8 - d->m_bits_in); - } - for (i = 2; i; --i, d->m_total_lz_bytes ^= 0xFFFF) { - TDEFL_PUT_BITS(d->m_total_lz_bytes & 0xFFFF, 16); - } - for (i = 0; i < d->m_total_lz_bytes; ++i) { - TDEFL_PUT_BITS( - d->m_dict[(d->m_lz_code_buf_dict_pos + i) & TDEFL_LZ_DICT_SIZE_MASK], - 8); - } - } - // Check for the extremely unlikely (if not impossible) case of the compressed - // block not fitting into the output buffer when using dynamic codes. - else if (!comp_block_succeeded) { - d->m_pOutput_buf = pSaved_output_buf; - d->m_bit_buffer = saved_bit_buf, d->m_bits_in = saved_bits_in; - tdefl_compress_block(d, MZ_TRUE); - } - - if (flush) { - if (flush == TDEFL_FINISH) { - if (d->m_bits_in) { - TDEFL_PUT_BITS(0, 8 - d->m_bits_in); - } - if (d->m_flags & TDEFL_WRITE_ZLIB_HEADER) { - mz_uint i, a = d->m_adler32; - for (i = 0; i < 4; i++) { - TDEFL_PUT_BITS((a >> 24) & 0xFF, 8); - a <<= 8; - } - } - } else { - mz_uint i, z = 0; - TDEFL_PUT_BITS(0, 3); - if (d->m_bits_in) { - TDEFL_PUT_BITS(0, 8 - d->m_bits_in); - } - for (i = 2; i; --i, z ^= 0xFFFF) { - TDEFL_PUT_BITS(z & 0xFFFF, 16); - } - } - } - - MZ_ASSERT(d->m_pOutput_buf < d->m_pOutput_buf_end); - - memset(&d->m_huff_count[0][0], 0, - sizeof(d->m_huff_count[0][0]) * TDEFL_MAX_HUFF_SYMBOLS_0); - memset(&d->m_huff_count[1][0], 0, - sizeof(d->m_huff_count[1][0]) * TDEFL_MAX_HUFF_SYMBOLS_1); - - d->m_pLZ_code_buf = d->m_lz_code_buf + 1; - d->m_pLZ_flags = d->m_lz_code_buf; - d->m_num_flags_left = 8; - d->m_lz_code_buf_dict_pos += d->m_total_lz_bytes; - d->m_total_lz_bytes = 0; - d->m_block_index++; - - if ((n = (int)(d->m_pOutput_buf - pOutput_buf_start)) != 0) { - if (d->m_pPut_buf_func) { - *d->m_pIn_buf_size = d->m_pSrc - (const mz_uint8 *)d->m_pIn_buf; - if (!(*d->m_pPut_buf_func)(d->m_output_buf, n, d->m_pPut_buf_user)) - return (d->m_prev_return_status = TDEFL_STATUS_PUT_BUF_FAILED); - } else if (pOutput_buf_start == d->m_output_buf) { - int bytes_to_copy = (int)MZ_MIN( - (size_t)n, (size_t)(*d->m_pOut_buf_size - d->m_out_buf_ofs)); - memcpy((mz_uint8 *)d->m_pOut_buf + d->m_out_buf_ofs, d->m_output_buf, - bytes_to_copy); - d->m_out_buf_ofs += bytes_to_copy; - if ((n -= bytes_to_copy) != 0) { - d->m_output_flush_ofs = bytes_to_copy; - d->m_output_flush_remaining = n; - } - } else { - d->m_out_buf_ofs += n; - } - } - - return d->m_output_flush_remaining; -} - -#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES -#define TDEFL_READ_UNALIGNED_WORD(p) *(const mz_uint16 *)(p) -static MZ_FORCEINLINE void tdefl_find_match( - tdefl_compressor *d, mz_uint lookahead_pos, mz_uint max_dist, - mz_uint max_match_len, mz_uint *pMatch_dist, mz_uint *pMatch_len) { - mz_uint dist, pos = lookahead_pos & TDEFL_LZ_DICT_SIZE_MASK, - match_len = *pMatch_len, probe_pos = pos, next_probe_pos, - probe_len; - mz_uint num_probes_left = d->m_max_probes[match_len >= 32]; - const mz_uint16 *s = (const mz_uint16 *)(d->m_dict + pos), *p, *q; - mz_uint16 c01 = TDEFL_READ_UNALIGNED_WORD(&d->m_dict[pos + match_len - 1]), - s01 = TDEFL_READ_UNALIGNED_WORD(s); - MZ_ASSERT(max_match_len <= TDEFL_MAX_MATCH_LEN); - if (max_match_len <= match_len) return; - for (;;) { - for (;;) { - if (--num_probes_left == 0) return; -#define TDEFL_PROBE \ - next_probe_pos = d->m_next[probe_pos]; \ - if ((!next_probe_pos) || \ - ((dist = (mz_uint16)(lookahead_pos - next_probe_pos)) > max_dist)) \ - return; \ - probe_pos = next_probe_pos & TDEFL_LZ_DICT_SIZE_MASK; \ - if (TDEFL_READ_UNALIGNED_WORD(&d->m_dict[probe_pos + match_len - 1]) == c01) \ - break; - TDEFL_PROBE; - TDEFL_PROBE; - TDEFL_PROBE; - } - if (!dist) break; - q = (const mz_uint16 *)(d->m_dict + probe_pos); - if (TDEFL_READ_UNALIGNED_WORD(q) != s01) continue; - p = s; - probe_len = 32; - do { - } while ( - (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && - (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && - (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && - (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && - (--probe_len > 0)); - if (!probe_len) { - *pMatch_dist = dist; - *pMatch_len = MZ_MIN(max_match_len, TDEFL_MAX_MATCH_LEN); - break; - } else if ((probe_len = ((mz_uint)(p - s) * 2) + - (mz_uint)(*(const mz_uint8 *)p == - *(const mz_uint8 *)q)) > match_len) { - *pMatch_dist = dist; - if ((*pMatch_len = match_len = MZ_MIN(max_match_len, probe_len)) == - max_match_len) - break; - c01 = TDEFL_READ_UNALIGNED_WORD(&d->m_dict[pos + match_len - 1]); - } - } -} -#else -static MZ_FORCEINLINE void tdefl_find_match( - tdefl_compressor *d, mz_uint lookahead_pos, mz_uint max_dist, - mz_uint max_match_len, mz_uint *pMatch_dist, mz_uint *pMatch_len) { - mz_uint dist, pos = lookahead_pos & TDEFL_LZ_DICT_SIZE_MASK, - match_len = *pMatch_len, probe_pos = pos, next_probe_pos, - probe_len; - mz_uint num_probes_left = d->m_max_probes[match_len >= 32]; - const mz_uint8 *s = d->m_dict + pos, *p, *q; - mz_uint8 c0 = d->m_dict[pos + match_len], c1 = d->m_dict[pos + match_len - 1]; - MZ_ASSERT(max_match_len <= TDEFL_MAX_MATCH_LEN); - if (max_match_len <= match_len) return; - for (;;) { - for (;;) { - if (--num_probes_left == 0) return; -#define TDEFL_PROBE \ - next_probe_pos = d->m_next[probe_pos]; \ - if ((!next_probe_pos) || \ - ((dist = (mz_uint16)(lookahead_pos - next_probe_pos)) > max_dist)) \ - return; \ - probe_pos = next_probe_pos & TDEFL_LZ_DICT_SIZE_MASK; \ - if ((d->m_dict[probe_pos + match_len] == c0) && \ - (d->m_dict[probe_pos + match_len - 1] == c1)) \ - break; - TDEFL_PROBE; - TDEFL_PROBE; - TDEFL_PROBE; - } - if (!dist) break; - p = s; - q = d->m_dict + probe_pos; - for (probe_len = 0; probe_len < max_match_len; probe_len++) - if (*p++ != *q++) break; - if (probe_len > match_len) { - *pMatch_dist = dist; - if ((*pMatch_len = match_len = probe_len) == max_match_len) return; - c0 = d->m_dict[pos + match_len]; - c1 = d->m_dict[pos + match_len - 1]; - } - } -} -#endif // #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES - -#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN -static mz_bool tdefl_compress_fast(tdefl_compressor *d) { - // Faster, minimally featured LZRW1-style match+parse loop with better - // register utilization. Intended for applications where raw throughput is - // valued more highly than ratio. - mz_uint lookahead_pos = d->m_lookahead_pos, - lookahead_size = d->m_lookahead_size, dict_size = d->m_dict_size, - total_lz_bytes = d->m_total_lz_bytes, - num_flags_left = d->m_num_flags_left; - mz_uint8 *pLZ_code_buf = d->m_pLZ_code_buf, *pLZ_flags = d->m_pLZ_flags; - mz_uint cur_pos = lookahead_pos & TDEFL_LZ_DICT_SIZE_MASK; - - while ((d->m_src_buf_left) || ((d->m_flush) && (lookahead_size))) { - const mz_uint TDEFL_COMP_FAST_LOOKAHEAD_SIZE = 4096; - mz_uint dst_pos = - (lookahead_pos + lookahead_size) & TDEFL_LZ_DICT_SIZE_MASK; - mz_uint num_bytes_to_process = (mz_uint)MZ_MIN( - d->m_src_buf_left, TDEFL_COMP_FAST_LOOKAHEAD_SIZE - lookahead_size); - d->m_src_buf_left -= num_bytes_to_process; - lookahead_size += num_bytes_to_process; - - while (num_bytes_to_process) { - mz_uint32 n = MZ_MIN(TDEFL_LZ_DICT_SIZE - dst_pos, num_bytes_to_process); - memcpy(d->m_dict + dst_pos, d->m_pSrc, n); - if (dst_pos < (TDEFL_MAX_MATCH_LEN - 1)) - memcpy(d->m_dict + TDEFL_LZ_DICT_SIZE + dst_pos, d->m_pSrc, - MZ_MIN(n, (TDEFL_MAX_MATCH_LEN - 1) - dst_pos)); - d->m_pSrc += n; - dst_pos = (dst_pos + n) & TDEFL_LZ_DICT_SIZE_MASK; - num_bytes_to_process -= n; - } - - dict_size = MZ_MIN(TDEFL_LZ_DICT_SIZE - lookahead_size, dict_size); - if ((!d->m_flush) && (lookahead_size < TDEFL_COMP_FAST_LOOKAHEAD_SIZE)) - break; - - while (lookahead_size >= 4) { - mz_uint cur_match_dist, cur_match_len = 1; - mz_uint8 *pCur_dict = d->m_dict + cur_pos; - mz_uint first_trigram = (*(const mz_uint32 *)pCur_dict) & 0xFFFFFF; - mz_uint hash = - (first_trigram ^ (first_trigram >> (24 - (TDEFL_LZ_HASH_BITS - 8)))) & - TDEFL_LEVEL1_HASH_SIZE_MASK; - mz_uint probe_pos = d->m_hash[hash]; - d->m_hash[hash] = (mz_uint16)lookahead_pos; - - if (((cur_match_dist = (mz_uint16)(lookahead_pos - probe_pos)) <= - dict_size) && - ((*(const mz_uint32 *)(d->m_dict + - (probe_pos &= TDEFL_LZ_DICT_SIZE_MASK)) & - 0xFFFFFF) == first_trigram)) { - const mz_uint16 *p = (const mz_uint16 *)pCur_dict; - const mz_uint16 *q = (const mz_uint16 *)(d->m_dict + probe_pos); - mz_uint32 probe_len = 32; - do { - } while ((TDEFL_READ_UNALIGNED_WORD(++p) == - TDEFL_READ_UNALIGNED_WORD(++q)) && - (TDEFL_READ_UNALIGNED_WORD(++p) == - TDEFL_READ_UNALIGNED_WORD(++q)) && - (TDEFL_READ_UNALIGNED_WORD(++p) == - TDEFL_READ_UNALIGNED_WORD(++q)) && - (TDEFL_READ_UNALIGNED_WORD(++p) == - TDEFL_READ_UNALIGNED_WORD(++q)) && - (--probe_len > 0)); - cur_match_len = ((mz_uint)(p - (const mz_uint16 *)pCur_dict) * 2) + - (mz_uint)(*(const mz_uint8 *)p == *(const mz_uint8 *)q); - if (!probe_len) - cur_match_len = cur_match_dist ? TDEFL_MAX_MATCH_LEN : 0; - - if ((cur_match_len < TDEFL_MIN_MATCH_LEN) || - ((cur_match_len == TDEFL_MIN_MATCH_LEN) && - (cur_match_dist >= 8U * 1024U))) { - cur_match_len = 1; - *pLZ_code_buf++ = (mz_uint8)first_trigram; - *pLZ_flags = (mz_uint8)(*pLZ_flags >> 1); - d->m_huff_count[0][(mz_uint8)first_trigram]++; - } else { - mz_uint32 s0, s1; - cur_match_len = MZ_MIN(cur_match_len, lookahead_size); - - MZ_ASSERT((cur_match_len >= TDEFL_MIN_MATCH_LEN) && - (cur_match_dist >= 1) && - (cur_match_dist <= TDEFL_LZ_DICT_SIZE)); - - cur_match_dist--; - - pLZ_code_buf[0] = (mz_uint8)(cur_match_len - TDEFL_MIN_MATCH_LEN); - *(mz_uint16 *)(&pLZ_code_buf[1]) = (mz_uint16)cur_match_dist; - pLZ_code_buf += 3; - *pLZ_flags = (mz_uint8)((*pLZ_flags >> 1) | 0x80); - - s0 = s_tdefl_small_dist_sym[cur_match_dist & 511]; - s1 = s_tdefl_large_dist_sym[cur_match_dist >> 8]; - d->m_huff_count[1][(cur_match_dist < 512) ? s0 : s1]++; - - d->m_huff_count[0][s_tdefl_len_sym[cur_match_len - - TDEFL_MIN_MATCH_LEN]]++; - } - } else { - *pLZ_code_buf++ = (mz_uint8)first_trigram; - *pLZ_flags = (mz_uint8)(*pLZ_flags >> 1); - d->m_huff_count[0][(mz_uint8)first_trigram]++; - } - - if (--num_flags_left == 0) { - num_flags_left = 8; - pLZ_flags = pLZ_code_buf++; - } - - total_lz_bytes += cur_match_len; - lookahead_pos += cur_match_len; - dict_size = MZ_MIN(dict_size + cur_match_len, TDEFL_LZ_DICT_SIZE); - cur_pos = (cur_pos + cur_match_len) & TDEFL_LZ_DICT_SIZE_MASK; - MZ_ASSERT(lookahead_size >= cur_match_len); - lookahead_size -= cur_match_len; - - if (pLZ_code_buf > &d->m_lz_code_buf[TDEFL_LZ_CODE_BUF_SIZE - 8]) { - int n; - d->m_lookahead_pos = lookahead_pos; - d->m_lookahead_size = lookahead_size; - d->m_dict_size = dict_size; - d->m_total_lz_bytes = total_lz_bytes; - d->m_pLZ_code_buf = pLZ_code_buf; - d->m_pLZ_flags = pLZ_flags; - d->m_num_flags_left = num_flags_left; - if ((n = tdefl_flush_block(d, 0)) != 0) - return (n < 0) ? MZ_FALSE : MZ_TRUE; - total_lz_bytes = d->m_total_lz_bytes; - pLZ_code_buf = d->m_pLZ_code_buf; - pLZ_flags = d->m_pLZ_flags; - num_flags_left = d->m_num_flags_left; - } - } - - while (lookahead_size) { - mz_uint8 lit = d->m_dict[cur_pos]; - - total_lz_bytes++; - *pLZ_code_buf++ = lit; - *pLZ_flags = (mz_uint8)(*pLZ_flags >> 1); - if (--num_flags_left == 0) { - num_flags_left = 8; - pLZ_flags = pLZ_code_buf++; - } - - d->m_huff_count[0][lit]++; - - lookahead_pos++; - dict_size = MZ_MIN(dict_size + 1, TDEFL_LZ_DICT_SIZE); - cur_pos = (cur_pos + 1) & TDEFL_LZ_DICT_SIZE_MASK; - lookahead_size--; - - if (pLZ_code_buf > &d->m_lz_code_buf[TDEFL_LZ_CODE_BUF_SIZE - 8]) { - int n; - d->m_lookahead_pos = lookahead_pos; - d->m_lookahead_size = lookahead_size; - d->m_dict_size = dict_size; - d->m_total_lz_bytes = total_lz_bytes; - d->m_pLZ_code_buf = pLZ_code_buf; - d->m_pLZ_flags = pLZ_flags; - d->m_num_flags_left = num_flags_left; - if ((n = tdefl_flush_block(d, 0)) != 0) - return (n < 0) ? MZ_FALSE : MZ_TRUE; - total_lz_bytes = d->m_total_lz_bytes; - pLZ_code_buf = d->m_pLZ_code_buf; - pLZ_flags = d->m_pLZ_flags; - num_flags_left = d->m_num_flags_left; - } - } - } - - d->m_lookahead_pos = lookahead_pos; - d->m_lookahead_size = lookahead_size; - d->m_dict_size = dict_size; - d->m_total_lz_bytes = total_lz_bytes; - d->m_pLZ_code_buf = pLZ_code_buf; - d->m_pLZ_flags = pLZ_flags; - d->m_num_flags_left = num_flags_left; - return MZ_TRUE; -} -#endif // MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN - -static MZ_FORCEINLINE void tdefl_record_literal(tdefl_compressor *d, - mz_uint8 lit) { - d->m_total_lz_bytes++; - *d->m_pLZ_code_buf++ = lit; - *d->m_pLZ_flags = (mz_uint8)(*d->m_pLZ_flags >> 1); - if (--d->m_num_flags_left == 0) { - d->m_num_flags_left = 8; - d->m_pLZ_flags = d->m_pLZ_code_buf++; - } - d->m_huff_count[0][lit]++; -} - -static MZ_FORCEINLINE void tdefl_record_match(tdefl_compressor *d, - mz_uint match_len, - mz_uint match_dist) { - mz_uint32 s0, s1; - - MZ_ASSERT((match_len >= TDEFL_MIN_MATCH_LEN) && (match_dist >= 1) && - (match_dist <= TDEFL_LZ_DICT_SIZE)); - - d->m_total_lz_bytes += match_len; - - d->m_pLZ_code_buf[0] = (mz_uint8)(match_len - TDEFL_MIN_MATCH_LEN); - - match_dist -= 1; - d->m_pLZ_code_buf[1] = (mz_uint8)(match_dist & 0xFF); - d->m_pLZ_code_buf[2] = (mz_uint8)(match_dist >> 8); - d->m_pLZ_code_buf += 3; - - *d->m_pLZ_flags = (mz_uint8)((*d->m_pLZ_flags >> 1) | 0x80); - if (--d->m_num_flags_left == 0) { - d->m_num_flags_left = 8; - d->m_pLZ_flags = d->m_pLZ_code_buf++; - } - - s0 = s_tdefl_small_dist_sym[match_dist & 511]; - s1 = s_tdefl_large_dist_sym[(match_dist >> 8) & 127]; - d->m_huff_count[1][(match_dist < 512) ? s0 : s1]++; - - if (match_len >= TDEFL_MIN_MATCH_LEN) - d->m_huff_count[0][s_tdefl_len_sym[match_len - TDEFL_MIN_MATCH_LEN]]++; -} - -static mz_bool tdefl_compress_normal(tdefl_compressor *d) { - const mz_uint8 *pSrc = d->m_pSrc; - size_t src_buf_left = d->m_src_buf_left; - tdefl_flush flush = d->m_flush; - - while ((src_buf_left) || ((flush) && (d->m_lookahead_size))) { - mz_uint len_to_move, cur_match_dist, cur_match_len, cur_pos; - // Update dictionary and hash chains. Keeps the lookahead size equal to - // TDEFL_MAX_MATCH_LEN. - if ((d->m_lookahead_size + d->m_dict_size) >= (TDEFL_MIN_MATCH_LEN - 1)) { - mz_uint dst_pos = (d->m_lookahead_pos + d->m_lookahead_size) & - TDEFL_LZ_DICT_SIZE_MASK, - ins_pos = d->m_lookahead_pos + d->m_lookahead_size - 2; - mz_uint hash = (d->m_dict[ins_pos & TDEFL_LZ_DICT_SIZE_MASK] - << TDEFL_LZ_HASH_SHIFT) ^ - d->m_dict[(ins_pos + 1) & TDEFL_LZ_DICT_SIZE_MASK]; - mz_uint num_bytes_to_process = (mz_uint)MZ_MIN( - src_buf_left, TDEFL_MAX_MATCH_LEN - d->m_lookahead_size); - const mz_uint8 *pSrc_end = pSrc + num_bytes_to_process; - src_buf_left -= num_bytes_to_process; - d->m_lookahead_size += num_bytes_to_process; - while (pSrc != pSrc_end) { - mz_uint8 c = *pSrc++; - d->m_dict[dst_pos] = c; - if (dst_pos < (TDEFL_MAX_MATCH_LEN - 1)) - d->m_dict[TDEFL_LZ_DICT_SIZE + dst_pos] = c; - hash = ((hash << TDEFL_LZ_HASH_SHIFT) ^ c) & (TDEFL_LZ_HASH_SIZE - 1); - d->m_next[ins_pos & TDEFL_LZ_DICT_SIZE_MASK] = d->m_hash[hash]; - d->m_hash[hash] = (mz_uint16)(ins_pos); - dst_pos = (dst_pos + 1) & TDEFL_LZ_DICT_SIZE_MASK; - ins_pos++; - } - } else { - while ((src_buf_left) && (d->m_lookahead_size < TDEFL_MAX_MATCH_LEN)) { - mz_uint8 c = *pSrc++; - mz_uint dst_pos = (d->m_lookahead_pos + d->m_lookahead_size) & - TDEFL_LZ_DICT_SIZE_MASK; - src_buf_left--; - d->m_dict[dst_pos] = c; - if (dst_pos < (TDEFL_MAX_MATCH_LEN - 1)) - d->m_dict[TDEFL_LZ_DICT_SIZE + dst_pos] = c; - if ((++d->m_lookahead_size + d->m_dict_size) >= TDEFL_MIN_MATCH_LEN) { - mz_uint ins_pos = d->m_lookahead_pos + (d->m_lookahead_size - 1) - 2; - mz_uint hash = ((d->m_dict[ins_pos & TDEFL_LZ_DICT_SIZE_MASK] - << (TDEFL_LZ_HASH_SHIFT * 2)) ^ - (d->m_dict[(ins_pos + 1) & TDEFL_LZ_DICT_SIZE_MASK] - << TDEFL_LZ_HASH_SHIFT) ^ - c) & - (TDEFL_LZ_HASH_SIZE - 1); - d->m_next[ins_pos & TDEFL_LZ_DICT_SIZE_MASK] = d->m_hash[hash]; - d->m_hash[hash] = (mz_uint16)(ins_pos); - } - } - } - d->m_dict_size = - MZ_MIN(TDEFL_LZ_DICT_SIZE - d->m_lookahead_size, d->m_dict_size); - if ((!flush) && (d->m_lookahead_size < TDEFL_MAX_MATCH_LEN)) break; - - // Simple lazy/greedy parsing state machine. - len_to_move = 1; - cur_match_dist = 0; - cur_match_len = - d->m_saved_match_len ? d->m_saved_match_len : (TDEFL_MIN_MATCH_LEN - 1); - cur_pos = d->m_lookahead_pos & TDEFL_LZ_DICT_SIZE_MASK; - if (d->m_flags & (TDEFL_RLE_MATCHES | TDEFL_FORCE_ALL_RAW_BLOCKS)) { - if ((d->m_dict_size) && (!(d->m_flags & TDEFL_FORCE_ALL_RAW_BLOCKS))) { - mz_uint8 c = d->m_dict[(cur_pos - 1) & TDEFL_LZ_DICT_SIZE_MASK]; - cur_match_len = 0; - while (cur_match_len < d->m_lookahead_size) { - if (d->m_dict[cur_pos + cur_match_len] != c) break; - cur_match_len++; - } - if (cur_match_len < TDEFL_MIN_MATCH_LEN) - cur_match_len = 0; - else - cur_match_dist = 1; - } - } else { - tdefl_find_match(d, d->m_lookahead_pos, d->m_dict_size, - d->m_lookahead_size, &cur_match_dist, &cur_match_len); - } - if (((cur_match_len == TDEFL_MIN_MATCH_LEN) && - (cur_match_dist >= 8U * 1024U)) || - (cur_pos == cur_match_dist) || - ((d->m_flags & TDEFL_FILTER_MATCHES) && (cur_match_len <= 5))) { - cur_match_dist = cur_match_len = 0; - } - if (d->m_saved_match_len) { - if (cur_match_len > d->m_saved_match_len) { - tdefl_record_literal(d, (mz_uint8)d->m_saved_lit); - if (cur_match_len >= 128) { - tdefl_record_match(d, cur_match_len, cur_match_dist); - d->m_saved_match_len = 0; - len_to_move = cur_match_len; - } else { - d->m_saved_lit = d->m_dict[cur_pos]; - d->m_saved_match_dist = cur_match_dist; - d->m_saved_match_len = cur_match_len; - } - } else { - tdefl_record_match(d, d->m_saved_match_len, d->m_saved_match_dist); - len_to_move = d->m_saved_match_len - 1; - d->m_saved_match_len = 0; - } - } else if (!cur_match_dist) - tdefl_record_literal(d, - d->m_dict[MZ_MIN(cur_pos, sizeof(d->m_dict) - 1)]); - else if ((d->m_greedy_parsing) || (d->m_flags & TDEFL_RLE_MATCHES) || - (cur_match_len >= 128)) { - tdefl_record_match(d, cur_match_len, cur_match_dist); - len_to_move = cur_match_len; - } else { - d->m_saved_lit = d->m_dict[MZ_MIN(cur_pos, sizeof(d->m_dict) - 1)]; - d->m_saved_match_dist = cur_match_dist; - d->m_saved_match_len = cur_match_len; - } - // Move the lookahead forward by len_to_move bytes. - d->m_lookahead_pos += len_to_move; - MZ_ASSERT(d->m_lookahead_size >= len_to_move); - d->m_lookahead_size -= len_to_move; - d->m_dict_size = - MZ_MIN(d->m_dict_size + len_to_move, (mz_uint)TDEFL_LZ_DICT_SIZE); - // Check if it's time to flush the current LZ codes to the internal output - // buffer. - if ((d->m_pLZ_code_buf > &d->m_lz_code_buf[TDEFL_LZ_CODE_BUF_SIZE - 8]) || - ((d->m_total_lz_bytes > 31 * 1024) && - (((((mz_uint)(d->m_pLZ_code_buf - d->m_lz_code_buf) * 115) >> 7) >= - d->m_total_lz_bytes) || - (d->m_flags & TDEFL_FORCE_ALL_RAW_BLOCKS)))) { - int n; - d->m_pSrc = pSrc; - d->m_src_buf_left = src_buf_left; - if ((n = tdefl_flush_block(d, 0)) != 0) - return (n < 0) ? MZ_FALSE : MZ_TRUE; - } - } - - d->m_pSrc = pSrc; - d->m_src_buf_left = src_buf_left; - return MZ_TRUE; -} - -static tdefl_status tdefl_flush_output_buffer(tdefl_compressor *d) { - if (d->m_pIn_buf_size) { - *d->m_pIn_buf_size = d->m_pSrc - (const mz_uint8 *)d->m_pIn_buf; - } - - if (d->m_pOut_buf_size) { - size_t n = MZ_MIN(*d->m_pOut_buf_size - d->m_out_buf_ofs, - d->m_output_flush_remaining); - memcpy((mz_uint8 *)d->m_pOut_buf + d->m_out_buf_ofs, - d->m_output_buf + d->m_output_flush_ofs, n); - d->m_output_flush_ofs += (mz_uint)n; - d->m_output_flush_remaining -= (mz_uint)n; - d->m_out_buf_ofs += n; - - *d->m_pOut_buf_size = d->m_out_buf_ofs; - } - - return (d->m_finished && !d->m_output_flush_remaining) ? TDEFL_STATUS_DONE - : TDEFL_STATUS_OKAY; -} - -tdefl_status tdefl_compress(tdefl_compressor *d, const void *pIn_buf, - size_t *pIn_buf_size, void *pOut_buf, - size_t *pOut_buf_size, tdefl_flush flush) { - if (!d) { - if (pIn_buf_size) *pIn_buf_size = 0; - if (pOut_buf_size) *pOut_buf_size = 0; - return TDEFL_STATUS_BAD_PARAM; - } - - d->m_pIn_buf = pIn_buf; - d->m_pIn_buf_size = pIn_buf_size; - d->m_pOut_buf = pOut_buf; - d->m_pOut_buf_size = pOut_buf_size; - d->m_pSrc = (const mz_uint8 *)(pIn_buf); - d->m_src_buf_left = pIn_buf_size ? *pIn_buf_size : 0; - d->m_out_buf_ofs = 0; - d->m_flush = flush; - - if (((d->m_pPut_buf_func != NULL) == - ((pOut_buf != NULL) || (pOut_buf_size != NULL))) || - (d->m_prev_return_status != TDEFL_STATUS_OKAY) || - (d->m_wants_to_finish && (flush != TDEFL_FINISH)) || - (pIn_buf_size && *pIn_buf_size && !pIn_buf) || - (pOut_buf_size && *pOut_buf_size && !pOut_buf)) { - if (pIn_buf_size) *pIn_buf_size = 0; - if (pOut_buf_size) *pOut_buf_size = 0; - return (d->m_prev_return_status = TDEFL_STATUS_BAD_PARAM); - } - d->m_wants_to_finish |= (flush == TDEFL_FINISH); - - if ((d->m_output_flush_remaining) || (d->m_finished)) - return (d->m_prev_return_status = tdefl_flush_output_buffer(d)); - -#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN - if (((d->m_flags & TDEFL_MAX_PROBES_MASK) == 1) && - ((d->m_flags & TDEFL_GREEDY_PARSING_FLAG) != 0) && - ((d->m_flags & (TDEFL_FILTER_MATCHES | TDEFL_FORCE_ALL_RAW_BLOCKS | - TDEFL_RLE_MATCHES)) == 0)) { - if (!tdefl_compress_fast(d)) return d->m_prev_return_status; - } else -#endif // #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN - { - if (!tdefl_compress_normal(d)) return d->m_prev_return_status; - } - - if ((d->m_flags & (TDEFL_WRITE_ZLIB_HEADER | TDEFL_COMPUTE_ADLER32)) && - (pIn_buf)) - d->m_adler32 = - (mz_uint32)mz_adler32(d->m_adler32, (const mz_uint8 *)pIn_buf, - d->m_pSrc - (const mz_uint8 *)pIn_buf); - - if ((flush) && (!d->m_lookahead_size) && (!d->m_src_buf_left) && - (!d->m_output_flush_remaining)) { - if (tdefl_flush_block(d, flush) < 0) return d->m_prev_return_status; - d->m_finished = (flush == TDEFL_FINISH); - if (flush == TDEFL_FULL_FLUSH) { - MZ_CLEAR_OBJ(d->m_hash); - MZ_CLEAR_OBJ(d->m_next); - d->m_dict_size = 0; - } - } - - return (d->m_prev_return_status = tdefl_flush_output_buffer(d)); -} - -tdefl_status tdefl_compress_buffer(tdefl_compressor *d, const void *pIn_buf, - size_t in_buf_size, tdefl_flush flush) { - MZ_ASSERT(d->m_pPut_buf_func); - return tdefl_compress(d, pIn_buf, &in_buf_size, NULL, NULL, flush); -} - -tdefl_status tdefl_init(tdefl_compressor *d, - tdefl_put_buf_func_ptr pPut_buf_func, - void *pPut_buf_user, int flags) { - d->m_pPut_buf_func = pPut_buf_func; - d->m_pPut_buf_user = pPut_buf_user; - d->m_flags = (mz_uint)(flags); - d->m_max_probes[0] = 1 + ((flags & 0xFFF) + 2) / 3; - d->m_greedy_parsing = (flags & TDEFL_GREEDY_PARSING_FLAG) != 0; - d->m_max_probes[1] = 1 + (((flags & 0xFFF) >> 2) + 2) / 3; - if (!(flags & TDEFL_NONDETERMINISTIC_PARSING_FLAG)) MZ_CLEAR_OBJ(d->m_hash); - d->m_lookahead_pos = d->m_lookahead_size = d->m_dict_size = - d->m_total_lz_bytes = d->m_lz_code_buf_dict_pos = d->m_bits_in = 0; - d->m_output_flush_ofs = d->m_output_flush_remaining = d->m_finished = - d->m_block_index = d->m_bit_buffer = d->m_wants_to_finish = 0; - d->m_pLZ_code_buf = d->m_lz_code_buf + 1; - d->m_pLZ_flags = d->m_lz_code_buf; - d->m_num_flags_left = 8; - d->m_pOutput_buf = d->m_output_buf; - d->m_pOutput_buf_end = d->m_output_buf; - d->m_prev_return_status = TDEFL_STATUS_OKAY; - d->m_saved_match_dist = d->m_saved_match_len = d->m_saved_lit = 0; - d->m_adler32 = 1; - d->m_pIn_buf = NULL; - d->m_pOut_buf = NULL; - d->m_pIn_buf_size = NULL; - d->m_pOut_buf_size = NULL; - d->m_flush = TDEFL_NO_FLUSH; - d->m_pSrc = NULL; - d->m_src_buf_left = 0; - d->m_out_buf_ofs = 0; - memset(&d->m_huff_count[0][0], 0, - sizeof(d->m_huff_count[0][0]) * TDEFL_MAX_HUFF_SYMBOLS_0); - memset(&d->m_huff_count[1][0], 0, - sizeof(d->m_huff_count[1][0]) * TDEFL_MAX_HUFF_SYMBOLS_1); - return TDEFL_STATUS_OKAY; -} - -tdefl_status tdefl_get_prev_return_status(tdefl_compressor *d) { - return d->m_prev_return_status; -} - -mz_uint32 tdefl_get_adler32(tdefl_compressor *d) { return d->m_adler32; } - -mz_bool tdefl_compress_mem_to_output(const void *pBuf, size_t buf_len, - tdefl_put_buf_func_ptr pPut_buf_func, - void *pPut_buf_user, int flags) { - tdefl_compressor *pComp; - mz_bool succeeded; - if (((buf_len) && (!pBuf)) || (!pPut_buf_func)) return MZ_FALSE; - pComp = (tdefl_compressor *)MZ_MALLOC(sizeof(tdefl_compressor)); - if (!pComp) return MZ_FALSE; - succeeded = (tdefl_init(pComp, pPut_buf_func, pPut_buf_user, flags) == - TDEFL_STATUS_OKAY); - succeeded = - succeeded && (tdefl_compress_buffer(pComp, pBuf, buf_len, TDEFL_FINISH) == - TDEFL_STATUS_DONE); - MZ_FREE(pComp); - return succeeded; -} - -typedef struct { - size_t m_size, m_capacity; - mz_uint8 *m_pBuf; - mz_bool m_expandable; -} tdefl_output_buffer; - -static mz_bool tdefl_output_buffer_putter(const void *pBuf, int len, - void *pUser) { - tdefl_output_buffer *p = (tdefl_output_buffer *)pUser; - size_t new_size = p->m_size + len; - if (new_size > p->m_capacity) { - size_t new_capacity = p->m_capacity; - mz_uint8 *pNew_buf; - if (!p->m_expandable) return MZ_FALSE; - do { - new_capacity = MZ_MAX(128U, new_capacity << 1U); - } while (new_size > new_capacity); - pNew_buf = (mz_uint8 *)MZ_REALLOC(p->m_pBuf, new_capacity); - if (!pNew_buf) return MZ_FALSE; - p->m_pBuf = pNew_buf; - p->m_capacity = new_capacity; - } - memcpy((mz_uint8 *)p->m_pBuf + p->m_size, pBuf, len); - p->m_size = new_size; - return MZ_TRUE; -} - -void *tdefl_compress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, - size_t *pOut_len, int flags) { - tdefl_output_buffer out_buf; - MZ_CLEAR_OBJ(out_buf); - if (!pOut_len) - return MZ_FALSE; - else - *pOut_len = 0; - out_buf.m_expandable = MZ_TRUE; - if (!tdefl_compress_mem_to_output( - pSrc_buf, src_buf_len, tdefl_output_buffer_putter, &out_buf, flags)) - return NULL; - *pOut_len = out_buf.m_size; - return out_buf.m_pBuf; -} - -size_t tdefl_compress_mem_to_mem(void *pOut_buf, size_t out_buf_len, - const void *pSrc_buf, size_t src_buf_len, - int flags) { - tdefl_output_buffer out_buf; - MZ_CLEAR_OBJ(out_buf); - if (!pOut_buf) return 0; - out_buf.m_pBuf = (mz_uint8 *)pOut_buf; - out_buf.m_capacity = out_buf_len; - if (!tdefl_compress_mem_to_output( - pSrc_buf, src_buf_len, tdefl_output_buffer_putter, &out_buf, flags)) - return 0; - return out_buf.m_size; -} - -#ifndef MINIZ_NO_ZLIB_APIS -static const mz_uint s_tdefl_num_probes[11] = {0, 1, 6, 32, 16, 32, - 128, 256, 512, 768, 1500}; - -// level may actually range from [0,10] (10 is a "hidden" max level, where we -// want a bit more compression and it's fine if throughput to fall off a cliff -// on some files). -mz_uint tdefl_create_comp_flags_from_zip_params(int level, int window_bits, - int strategy) { - mz_uint comp_flags = - s_tdefl_num_probes[(level >= 0) ? MZ_MIN(10, level) : MZ_DEFAULT_LEVEL] | - ((level <= 3) ? TDEFL_GREEDY_PARSING_FLAG : 0); - if (window_bits > 0) comp_flags |= TDEFL_WRITE_ZLIB_HEADER; - - if (!level) - comp_flags |= TDEFL_FORCE_ALL_RAW_BLOCKS; - else if (strategy == MZ_FILTERED) - comp_flags |= TDEFL_FILTER_MATCHES; - else if (strategy == MZ_HUFFMAN_ONLY) - comp_flags &= ~TDEFL_MAX_PROBES_MASK; - else if (strategy == MZ_FIXED) - comp_flags |= TDEFL_FORCE_ALL_STATIC_BLOCKS; - else if (strategy == MZ_RLE) - comp_flags |= TDEFL_RLE_MATCHES; - - return comp_flags; -} -#endif // MINIZ_NO_ZLIB_APIS - -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4204) // nonstandard extension used : non-constant - // aggregate initializer (also supported by GNU - // C and C99, so no big deal) -#pragma warning(disable : 4244) // 'initializing': conversion from '__int64' to - // 'int', possible loss of data -#pragma warning( \ - disable : 4267) // 'argument': conversion from '__int64' to 'int', - // possible loss of data -#pragma warning(disable : 4996) // 'strdup': The POSIX name for this item is - // deprecated. Instead, use the ISO C and C++ - // conformant name: _strdup. -#endif - -// Simple PNG writer function by Alex Evans, 2011. Released into the public -// domain: https://gist.github.com/908299, more context at -// http://altdevblogaday.org/2011/04/06/a-smaller-jpg-encoder/. -// This is actually a modification of Alex's original code so PNG files -// generated by this function pass pngcheck. -void *tdefl_write_image_to_png_file_in_memory_ex(const void *pImage, int w, - int h, int num_chans, - size_t *pLen_out, - mz_uint level, mz_bool flip) { - // Using a local copy of this array here in case MINIZ_NO_ZLIB_APIS was - // defined. - static const mz_uint s_tdefl_png_num_probes[11] = { - 0, 1, 6, 32, 16, 32, 128, 256, 512, 768, 1500}; - tdefl_compressor *pComp = - (tdefl_compressor *)MZ_MALLOC(sizeof(tdefl_compressor)); - tdefl_output_buffer out_buf; - int i, bpl = w * num_chans, y, z; - mz_uint32 c; - *pLen_out = 0; - if (!pComp) return NULL; - MZ_CLEAR_OBJ(out_buf); - out_buf.m_expandable = MZ_TRUE; - out_buf.m_capacity = 57 + MZ_MAX(64, (1 + bpl) * h); - if (NULL == (out_buf.m_pBuf = (mz_uint8 *)MZ_MALLOC(out_buf.m_capacity))) { - MZ_FREE(pComp); - return NULL; - } - // write dummy header - for (z = 41; z; --z) tdefl_output_buffer_putter(&z, 1, &out_buf); - // compress image data - tdefl_init( - pComp, tdefl_output_buffer_putter, &out_buf, - s_tdefl_png_num_probes[MZ_MIN(10, level)] | TDEFL_WRITE_ZLIB_HEADER); - for (y = 0; y < h; ++y) { - tdefl_compress_buffer(pComp, &z, 1, TDEFL_NO_FLUSH); - tdefl_compress_buffer(pComp, - (mz_uint8 *)pImage + (flip ? (h - 1 - y) : y) * bpl, - bpl, TDEFL_NO_FLUSH); - } - if (tdefl_compress_buffer(pComp, NULL, 0, TDEFL_FINISH) != - TDEFL_STATUS_DONE) { - MZ_FREE(pComp); - MZ_FREE(out_buf.m_pBuf); - return NULL; - } - // write real header - *pLen_out = out_buf.m_size - 41; - { - static const mz_uint8 chans[] = {0x00, 0x00, 0x04, 0x02, 0x06}; - mz_uint8 pnghdr[41] = {0x89, - 0x50, - 0x4e, - 0x47, - 0x0d, - 0x0a, - 0x1a, - 0x0a, - 0x00, - 0x00, - 0x00, - 0x0d, - 0x49, - 0x48, - 0x44, - 0x52, - 0, - 0, - (mz_uint8)(w >> 8), - (mz_uint8)w, - 0, - 0, - (mz_uint8)(h >> 8), - (mz_uint8)h, - 8, - chans[num_chans], - 0, - 0, - 0, - 0, - 0, - 0, - 0, - (mz_uint8)(*pLen_out >> 24), - (mz_uint8)(*pLen_out >> 16), - (mz_uint8)(*pLen_out >> 8), - (mz_uint8)*pLen_out, - 0x49, - 0x44, - 0x41, - 0x54}; - c = (mz_uint32)mz_crc32(MZ_CRC32_INIT, pnghdr + 12, 17); - for (i = 0; i < 4; ++i, c <<= 8) - ((mz_uint8 *)(pnghdr + 29))[i] = (mz_uint8)(c >> 24); - memcpy(out_buf.m_pBuf, pnghdr, 41); - } - // write footer (IDAT CRC-32, followed by IEND chunk) - if (!tdefl_output_buffer_putter( - "\0\0\0\0\0\0\0\0\x49\x45\x4e\x44\xae\x42\x60\x82", 16, &out_buf)) { - *pLen_out = 0; - MZ_FREE(pComp); - MZ_FREE(out_buf.m_pBuf); - return NULL; - } - c = (mz_uint32)mz_crc32(MZ_CRC32_INIT, out_buf.m_pBuf + 41 - 4, - *pLen_out + 4); - for (i = 0; i < 4; ++i, c <<= 8) - (out_buf.m_pBuf + out_buf.m_size - 16)[i] = (mz_uint8)(c >> 24); - // compute final size of file, grab compressed data buffer and return - *pLen_out += 57; - MZ_FREE(pComp); - return out_buf.m_pBuf; -} -void *tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h, - int num_chans, size_t *pLen_out) { - // Level 6 corresponds to TDEFL_DEFAULT_MAX_PROBES or MZ_DEFAULT_LEVEL (but we - // can't depend on MZ_DEFAULT_LEVEL being available in case the zlib API's - // where #defined out) - return tdefl_write_image_to_png_file_in_memory_ex(pImage, w, h, num_chans, - pLen_out, 6, MZ_FALSE); -} - -// ------------------- .ZIP archive reading - -#ifndef MINIZ_NO_ARCHIVE_APIS -#error "No arvhive APIs" - -#ifdef MINIZ_NO_STDIO -#define MZ_FILE void * -#else -#include -#include - -#if defined(_MSC_VER) || defined(__MINGW64__) -static FILE *mz_fopen(const char *pFilename, const char *pMode) { - FILE *pFile = NULL; - fopen_s(&pFile, pFilename, pMode); - return pFile; -} -static FILE *mz_freopen(const char *pPath, const char *pMode, FILE *pStream) { - FILE *pFile = NULL; - if (freopen_s(&pFile, pPath, pMode, pStream)) return NULL; - return pFile; -} -#ifndef MINIZ_NO_TIME -#include -#endif -#define MZ_FILE FILE -#define MZ_FOPEN mz_fopen -#define MZ_FCLOSE fclose -#define MZ_FREAD fread -#define MZ_FWRITE fwrite -#define MZ_FTELL64 _ftelli64 -#define MZ_FSEEK64 _fseeki64 -#define MZ_FILE_STAT_STRUCT _stat -#define MZ_FILE_STAT _stat -#define MZ_FFLUSH fflush -#define MZ_FREOPEN mz_freopen -#define MZ_DELETE_FILE remove -#elif defined(__MINGW32__) -#ifndef MINIZ_NO_TIME -#include -#endif -#define MZ_FILE FILE -#define MZ_FOPEN(f, m) fopen(f, m) -#define MZ_FCLOSE fclose -#define MZ_FREAD fread -#define MZ_FWRITE fwrite -#define MZ_FTELL64 ftello64 -#define MZ_FSEEK64 fseeko64 -#define MZ_FILE_STAT_STRUCT _stat -#define MZ_FILE_STAT _stat -#define MZ_FFLUSH fflush -#define MZ_FREOPEN(f, m, s) freopen(f, m, s) -#define MZ_DELETE_FILE remove -#elif defined(__TINYC__) -#ifndef MINIZ_NO_TIME -#include -#endif -#define MZ_FILE FILE -#define MZ_FOPEN(f, m) fopen(f, m) -#define MZ_FCLOSE fclose -#define MZ_FREAD fread -#define MZ_FWRITE fwrite -#define MZ_FTELL64 ftell -#define MZ_FSEEK64 fseek -#define MZ_FILE_STAT_STRUCT stat -#define MZ_FILE_STAT stat -#define MZ_FFLUSH fflush -#define MZ_FREOPEN(f, m, s) freopen(f, m, s) -#define MZ_DELETE_FILE remove -#elif defined(__GNUC__) && defined(_LARGEFILE64_SOURCE) && _LARGEFILE64_SOURCE -#ifndef MINIZ_NO_TIME -#include -#endif -#define MZ_FILE FILE -#define MZ_FOPEN(f, m) fopen64(f, m) -#define MZ_FCLOSE fclose -#define MZ_FREAD fread -#define MZ_FWRITE fwrite -#define MZ_FTELL64 ftello64 -#define MZ_FSEEK64 fseeko64 -#define MZ_FILE_STAT_STRUCT stat64 -#define MZ_FILE_STAT stat64 -#define MZ_FFLUSH fflush -#define MZ_FREOPEN(p, m, s) freopen64(p, m, s) -#define MZ_DELETE_FILE remove -#else -#ifndef MINIZ_NO_TIME -#include -#endif -#define MZ_FILE FILE -#define MZ_FOPEN(f, m) fopen(f, m) -#define MZ_FCLOSE fclose -#define MZ_FREAD fread -#define MZ_FWRITE fwrite -#define MZ_FTELL64 ftello -#define MZ_FSEEK64 fseeko -#define MZ_FILE_STAT_STRUCT stat -#define MZ_FILE_STAT stat -#define MZ_FFLUSH fflush -#define MZ_FREOPEN(f, m, s) freopen(f, m, s) -#define MZ_DELETE_FILE remove -#endif // #ifdef _MSC_VER -#endif // #ifdef MINIZ_NO_STDIO - -#define MZ_TOLOWER(c) ((((c) >= 'A') && ((c) <= 'Z')) ? ((c) - 'A' + 'a') : (c)) - -// Various ZIP archive enums. To completely avoid cross platform compiler -// alignment and platform endian issues, miniz.c doesn't use structs for any of -// this stuff. -enum { - // ZIP archive identifiers and record sizes - MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIG = 0x06054b50, - MZ_ZIP_CENTRAL_DIR_HEADER_SIG = 0x02014b50, - MZ_ZIP_LOCAL_DIR_HEADER_SIG = 0x04034b50, - MZ_ZIP_LOCAL_DIR_HEADER_SIZE = 30, - MZ_ZIP_CENTRAL_DIR_HEADER_SIZE = 46, - MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE = 22, - // Central directory header record offsets - MZ_ZIP_CDH_SIG_OFS = 0, - MZ_ZIP_CDH_VERSION_MADE_BY_OFS = 4, - MZ_ZIP_CDH_VERSION_NEEDED_OFS = 6, - MZ_ZIP_CDH_BIT_FLAG_OFS = 8, - MZ_ZIP_CDH_METHOD_OFS = 10, - MZ_ZIP_CDH_FILE_TIME_OFS = 12, - MZ_ZIP_CDH_FILE_DATE_OFS = 14, - MZ_ZIP_CDH_CRC32_OFS = 16, - MZ_ZIP_CDH_COMPRESSED_SIZE_OFS = 20, - MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS = 24, - MZ_ZIP_CDH_FILENAME_LEN_OFS = 28, - MZ_ZIP_CDH_EXTRA_LEN_OFS = 30, - MZ_ZIP_CDH_COMMENT_LEN_OFS = 32, - MZ_ZIP_CDH_DISK_START_OFS = 34, - MZ_ZIP_CDH_INTERNAL_ATTR_OFS = 36, - MZ_ZIP_CDH_EXTERNAL_ATTR_OFS = 38, - MZ_ZIP_CDH_LOCAL_HEADER_OFS = 42, - // Local directory header offsets - MZ_ZIP_LDH_SIG_OFS = 0, - MZ_ZIP_LDH_VERSION_NEEDED_OFS = 4, - MZ_ZIP_LDH_BIT_FLAG_OFS = 6, - MZ_ZIP_LDH_METHOD_OFS = 8, - MZ_ZIP_LDH_FILE_TIME_OFS = 10, - MZ_ZIP_LDH_FILE_DATE_OFS = 12, - MZ_ZIP_LDH_CRC32_OFS = 14, - MZ_ZIP_LDH_COMPRESSED_SIZE_OFS = 18, - MZ_ZIP_LDH_DECOMPRESSED_SIZE_OFS = 22, - MZ_ZIP_LDH_FILENAME_LEN_OFS = 26, - MZ_ZIP_LDH_EXTRA_LEN_OFS = 28, - // End of central directory offsets - MZ_ZIP_ECDH_SIG_OFS = 0, - MZ_ZIP_ECDH_NUM_THIS_DISK_OFS = 4, - MZ_ZIP_ECDH_NUM_DISK_CDIR_OFS = 6, - MZ_ZIP_ECDH_CDIR_NUM_ENTRIES_ON_DISK_OFS = 8, - MZ_ZIP_ECDH_CDIR_TOTAL_ENTRIES_OFS = 10, - MZ_ZIP_ECDH_CDIR_SIZE_OFS = 12, - MZ_ZIP_ECDH_CDIR_OFS_OFS = 16, - MZ_ZIP_ECDH_COMMENT_SIZE_OFS = 20, -}; - -typedef struct { - void *m_p; - size_t m_size, m_capacity; - mz_uint m_element_size; -} mz_zip_array; - -struct mz_zip_internal_state_tag { - mz_zip_array m_central_dir; - mz_zip_array m_central_dir_offsets; - mz_zip_array m_sorted_central_dir_offsets; - MZ_FILE *m_pFile; - void *m_pMem; - size_t m_mem_size; - size_t m_mem_capacity; -}; - -#define MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(array_ptr, element_size) \ - (array_ptr)->m_element_size = element_size -#define MZ_ZIP_ARRAY_ELEMENT(array_ptr, element_type, index) \ - ((element_type *)((array_ptr)->m_p))[index] - -static MZ_FORCEINLINE void mz_zip_array_clear(mz_zip_archive *pZip, - mz_zip_array *pArray) { - pZip->m_pFree(pZip->m_pAlloc_opaque, pArray->m_p); - memset(pArray, 0, sizeof(mz_zip_array)); -} - -static mz_bool mz_zip_array_ensure_capacity(mz_zip_archive *pZip, - mz_zip_array *pArray, - size_t min_new_capacity, - mz_uint growing) { - void *pNew_p; - size_t new_capacity = min_new_capacity; - MZ_ASSERT(pArray->m_element_size); - if (pArray->m_capacity >= min_new_capacity) return MZ_TRUE; - if (growing) { - new_capacity = MZ_MAX(1, pArray->m_capacity); - while (new_capacity < min_new_capacity) new_capacity *= 2; - } - if (NULL == (pNew_p = pZip->m_pRealloc(pZip->m_pAlloc_opaque, pArray->m_p, - pArray->m_element_size, new_capacity))) - return MZ_FALSE; - pArray->m_p = pNew_p; - pArray->m_capacity = new_capacity; - return MZ_TRUE; -} - -static MZ_FORCEINLINE mz_bool mz_zip_array_reserve(mz_zip_archive *pZip, - mz_zip_array *pArray, - size_t new_capacity, - mz_uint growing) { - if (new_capacity > pArray->m_capacity) { - if (!mz_zip_array_ensure_capacity(pZip, pArray, new_capacity, growing)) - return MZ_FALSE; - } - return MZ_TRUE; -} - -static MZ_FORCEINLINE mz_bool mz_zip_array_resize(mz_zip_archive *pZip, - mz_zip_array *pArray, - size_t new_size, - mz_uint growing) { - if (new_size > pArray->m_capacity) { - if (!mz_zip_array_ensure_capacity(pZip, pArray, new_size, growing)) - return MZ_FALSE; - } - pArray->m_size = new_size; - return MZ_TRUE; -} - -static MZ_FORCEINLINE mz_bool mz_zip_array_ensure_room(mz_zip_archive *pZip, - mz_zip_array *pArray, - size_t n) { - return mz_zip_array_reserve(pZip, pArray, pArray->m_size + n, MZ_TRUE); -} - -static MZ_FORCEINLINE mz_bool mz_zip_array_push_back(mz_zip_archive *pZip, - mz_zip_array *pArray, - const void *pElements, - size_t n) { - size_t orig_size = pArray->m_size; - if (!mz_zip_array_resize(pZip, pArray, orig_size + n, MZ_TRUE)) - return MZ_FALSE; - memcpy((mz_uint8 *)pArray->m_p + orig_size * pArray->m_element_size, - pElements, n * pArray->m_element_size); - return MZ_TRUE; -} - -#ifndef MINIZ_NO_TIME -static time_t mz_zip_dos_to_time_t(int dos_time, int dos_date) { - struct tm tm; - memset(&tm, 0, sizeof(tm)); - tm.tm_isdst = -1; - tm.tm_year = ((dos_date >> 9) & 127) + 1980 - 1900; - tm.tm_mon = ((dos_date >> 5) & 15) - 1; - tm.tm_mday = dos_date & 31; - tm.tm_hour = (dos_time >> 11) & 31; - tm.tm_min = (dos_time >> 5) & 63; - tm.tm_sec = (dos_time << 1) & 62; - return mktime(&tm); -} - -static void mz_zip_time_to_dos_time(time_t time, mz_uint16 *pDOS_time, - mz_uint16 *pDOS_date) { -#ifdef _MSC_VER - struct tm tm_struct; - struct tm *tm = &tm_struct; - errno_t err = localtime_s(tm, &time); - if (err) { - *pDOS_date = 0; - *pDOS_time = 0; - return; - } -#else - struct tm *tm = localtime(&time); -#endif - *pDOS_time = (mz_uint16)(((tm->tm_hour) << 11) + ((tm->tm_min) << 5) + - ((tm->tm_sec) >> 1)); - *pDOS_date = (mz_uint16)(((tm->tm_year + 1900 - 1980) << 9) + - ((tm->tm_mon + 1) << 5) + tm->tm_mday); -} -#endif - -#ifndef MINIZ_NO_STDIO -static mz_bool mz_zip_get_file_modified_time(const char *pFilename, - mz_uint16 *pDOS_time, - mz_uint16 *pDOS_date) { -#ifdef MINIZ_NO_TIME - (void)pFilename; - *pDOS_date = *pDOS_time = 0; -#else - struct MZ_FILE_STAT_STRUCT file_stat; - // On Linux with x86 glibc, this call will fail on large files (>= 0x80000000 - // bytes) unless you compiled with _LARGEFILE64_SOURCE. Argh. - if (MZ_FILE_STAT(pFilename, &file_stat) != 0) return MZ_FALSE; - mz_zip_time_to_dos_time(file_stat.st_mtime, pDOS_time, pDOS_date); -#endif // #ifdef MINIZ_NO_TIME - return MZ_TRUE; -} - -#ifndef MINIZ_NO_TIME -static mz_bool mz_zip_set_file_times(const char *pFilename, time_t access_time, - time_t modified_time) { - struct utimbuf t; - t.actime = access_time; - t.modtime = modified_time; - return !utime(pFilename, &t); -} -#endif // #ifndef MINIZ_NO_TIME -#endif // #ifndef MINIZ_NO_STDIO - -static mz_bool mz_zip_reader_init_internal(mz_zip_archive *pZip, - mz_uint32 flags) { - (void)flags; - if ((!pZip) || (pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_INVALID)) - return MZ_FALSE; - - if (!pZip->m_pAlloc) pZip->m_pAlloc = def_alloc_func; - if (!pZip->m_pFree) pZip->m_pFree = def_free_func; - if (!pZip->m_pRealloc) pZip->m_pRealloc = def_realloc_func; - - pZip->m_zip_mode = MZ_ZIP_MODE_READING; - pZip->m_archive_size = 0; - pZip->m_central_directory_file_ofs = 0; - pZip->m_total_files = 0; - - if (NULL == (pZip->m_pState = (mz_zip_internal_state *)pZip->m_pAlloc( - pZip->m_pAlloc_opaque, 1, sizeof(mz_zip_internal_state)))) - return MZ_FALSE; - memset(pZip->m_pState, 0, sizeof(mz_zip_internal_state)); - MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_central_dir, - sizeof(mz_uint8)); - MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_central_dir_offsets, - sizeof(mz_uint32)); - MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_sorted_central_dir_offsets, - sizeof(mz_uint32)); - return MZ_TRUE; -} - -static MZ_FORCEINLINE mz_bool -mz_zip_reader_filename_less(const mz_zip_array *pCentral_dir_array, - const mz_zip_array *pCentral_dir_offsets, - mz_uint l_index, mz_uint r_index) { - const mz_uint8 *pL = &MZ_ZIP_ARRAY_ELEMENT( - pCentral_dir_array, mz_uint8, - MZ_ZIP_ARRAY_ELEMENT(pCentral_dir_offsets, mz_uint32, - l_index)), - *pE; - const mz_uint8 *pR = &MZ_ZIP_ARRAY_ELEMENT( - pCentral_dir_array, mz_uint8, - MZ_ZIP_ARRAY_ELEMENT(pCentral_dir_offsets, mz_uint32, r_index)); - mz_uint l_len = MZ_READ_LE16(pL + MZ_ZIP_CDH_FILENAME_LEN_OFS), - r_len = MZ_READ_LE16(pR + MZ_ZIP_CDH_FILENAME_LEN_OFS); - mz_uint8 l = 0, r = 0; - pL += MZ_ZIP_CENTRAL_DIR_HEADER_SIZE; - pR += MZ_ZIP_CENTRAL_DIR_HEADER_SIZE; - pE = pL + MZ_MIN(l_len, r_len); - while (pL < pE) { - if ((l = MZ_TOLOWER(*pL)) != (r = MZ_TOLOWER(*pR))) break; - pL++; - pR++; - } - return (pL == pE) ? (l_len < r_len) : (l < r); -} - -#define MZ_SWAP_UINT32(a, b) \ - do { \ - mz_uint32 t = a; \ - a = b; \ - b = t; \ - } \ - MZ_MACRO_END - -// Heap sort of lowercased filenames, used to help accelerate plain central -// directory searches by mz_zip_reader_locate_file(). (Could also use qsort(), -// but it could allocate memory.) -static void mz_zip_reader_sort_central_dir_offsets_by_filename( - mz_zip_archive *pZip) { - mz_zip_internal_state *pState = pZip->m_pState; - const mz_zip_array *pCentral_dir_offsets = &pState->m_central_dir_offsets; - const mz_zip_array *pCentral_dir = &pState->m_central_dir; - mz_uint32 *pIndices = &MZ_ZIP_ARRAY_ELEMENT( - &pState->m_sorted_central_dir_offsets, mz_uint32, 0); - const int size = pZip->m_total_files; - int start = (size - 2) >> 1, end; - while (start >= 0) { - int child, root = start; - for (;;) { - if ((child = (root << 1) + 1) >= size) break; - child += - (((child + 1) < size) && - (mz_zip_reader_filename_less(pCentral_dir, pCentral_dir_offsets, - pIndices[child], pIndices[child + 1]))); - if (!mz_zip_reader_filename_less(pCentral_dir, pCentral_dir_offsets, - pIndices[root], pIndices[child])) - break; - MZ_SWAP_UINT32(pIndices[root], pIndices[child]); - root = child; - } - start--; - } - - end = size - 1; - while (end > 0) { - int child, root = 0; - MZ_SWAP_UINT32(pIndices[end], pIndices[0]); - for (;;) { - if ((child = (root << 1) + 1) >= end) break; - child += - (((child + 1) < end) && - mz_zip_reader_filename_less(pCentral_dir, pCentral_dir_offsets, - pIndices[child], pIndices[child + 1])); - if (!mz_zip_reader_filename_less(pCentral_dir, pCentral_dir_offsets, - pIndices[root], pIndices[child])) - break; - MZ_SWAP_UINT32(pIndices[root], pIndices[child]); - root = child; - } - end--; - } -} - -static mz_bool mz_zip_reader_read_central_dir(mz_zip_archive *pZip, - mz_uint32 flags) { - mz_uint cdir_size, num_this_disk, cdir_disk_index; - mz_uint64 cdir_ofs; - mz_int64 cur_file_ofs; - const mz_uint8 *p; - mz_uint32 buf_u32[4096 / sizeof(mz_uint32)]; - mz_uint8 *pBuf = (mz_uint8 *)buf_u32; - mz_bool sort_central_dir = - ((flags & MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY) == 0); - // Basic sanity checks - reject files which are too small, and check the first - // 4 bytes of the file to make sure a local header is there. - if (pZip->m_archive_size < MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE) - return MZ_FALSE; - // Find the end of central directory record by scanning the file from the end - // towards the beginning. - cur_file_ofs = - MZ_MAX((mz_int64)pZip->m_archive_size - (mz_int64)sizeof(buf_u32), 0); - for (;;) { - int i, - n = (int)MZ_MIN(sizeof(buf_u32), pZip->m_archive_size - cur_file_ofs); - if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pBuf, n) != (mz_uint)n) - return MZ_FALSE; - for (i = n - 4; i >= 0; --i) - if (MZ_READ_LE32(pBuf + i) == MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIG) break; - if (i >= 0) { - cur_file_ofs += i; - break; - } - if ((!cur_file_ofs) || ((pZip->m_archive_size - cur_file_ofs) >= - (0xFFFF + MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE))) - return MZ_FALSE; - cur_file_ofs = MZ_MAX(cur_file_ofs - (sizeof(buf_u32) - 3), 0); - } - // Read and verify the end of central directory record. - if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pBuf, - MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE) != - MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE) - return MZ_FALSE; - if ((MZ_READ_LE32(pBuf + MZ_ZIP_ECDH_SIG_OFS) != - MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIG) || - ((pZip->m_total_files = - MZ_READ_LE16(pBuf + MZ_ZIP_ECDH_CDIR_TOTAL_ENTRIES_OFS)) != - MZ_READ_LE16(pBuf + MZ_ZIP_ECDH_CDIR_NUM_ENTRIES_ON_DISK_OFS))) - return MZ_FALSE; - - num_this_disk = MZ_READ_LE16(pBuf + MZ_ZIP_ECDH_NUM_THIS_DISK_OFS); - cdir_disk_index = MZ_READ_LE16(pBuf + MZ_ZIP_ECDH_NUM_DISK_CDIR_OFS); - if (((num_this_disk | cdir_disk_index) != 0) && - ((num_this_disk != 1) || (cdir_disk_index != 1))) - return MZ_FALSE; - - if ((cdir_size = MZ_READ_LE32(pBuf + MZ_ZIP_ECDH_CDIR_SIZE_OFS)) < - pZip->m_total_files * MZ_ZIP_CENTRAL_DIR_HEADER_SIZE) - return MZ_FALSE; - - cdir_ofs = MZ_READ_LE32(pBuf + MZ_ZIP_ECDH_CDIR_OFS_OFS); - if ((cdir_ofs + (mz_uint64)cdir_size) > pZip->m_archive_size) return MZ_FALSE; - - pZip->m_central_directory_file_ofs = cdir_ofs; - - if (pZip->m_total_files) { - mz_uint i, n; - - // Read the entire central directory into a heap block, and allocate another - // heap block to hold the unsorted central dir file record offsets, and - // another to hold the sorted indices. - if ((!mz_zip_array_resize(pZip, &pZip->m_pState->m_central_dir, cdir_size, - MZ_FALSE)) || - (!mz_zip_array_resize(pZip, &pZip->m_pState->m_central_dir_offsets, - pZip->m_total_files, MZ_FALSE))) - return MZ_FALSE; - - if (sort_central_dir) { - if (!mz_zip_array_resize(pZip, - &pZip->m_pState->m_sorted_central_dir_offsets, - pZip->m_total_files, MZ_FALSE)) - return MZ_FALSE; - } - - if (pZip->m_pRead(pZip->m_pIO_opaque, cdir_ofs, - pZip->m_pState->m_central_dir.m_p, - cdir_size) != cdir_size) - return MZ_FALSE; - - // Now create an index into the central directory file records, do some - // basic sanity checking on each record, and check for zip64 entries (which - // are not yet supported). - p = (const mz_uint8 *)pZip->m_pState->m_central_dir.m_p; - for (n = cdir_size, i = 0; i < pZip->m_total_files; ++i) { - mz_uint total_header_size, comp_size, decomp_size, disk_index; - if ((n < MZ_ZIP_CENTRAL_DIR_HEADER_SIZE) || - (MZ_READ_LE32(p) != MZ_ZIP_CENTRAL_DIR_HEADER_SIG)) - return MZ_FALSE; - MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir_offsets, mz_uint32, - i) = - (mz_uint32)(p - (const mz_uint8 *)pZip->m_pState->m_central_dir.m_p); - if (sort_central_dir) - MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_sorted_central_dir_offsets, - mz_uint32, i) = i; - comp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS); - decomp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS); - if (((!MZ_READ_LE32(p + MZ_ZIP_CDH_METHOD_OFS)) && - (decomp_size != comp_size)) || - (decomp_size && !comp_size) || (decomp_size == 0xFFFFFFFF) || - (comp_size == 0xFFFFFFFF)) - return MZ_FALSE; - disk_index = MZ_READ_LE16(p + MZ_ZIP_CDH_DISK_START_OFS); - if ((disk_index != num_this_disk) && (disk_index != 1)) return MZ_FALSE; - if (((mz_uint64)MZ_READ_LE32(p + MZ_ZIP_CDH_LOCAL_HEADER_OFS) + - MZ_ZIP_LOCAL_DIR_HEADER_SIZE + comp_size) > pZip->m_archive_size) - return MZ_FALSE; - if ((total_header_size = MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + - MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS) + - MZ_READ_LE16(p + MZ_ZIP_CDH_EXTRA_LEN_OFS) + - MZ_READ_LE16(p + MZ_ZIP_CDH_COMMENT_LEN_OFS)) > - n) - return MZ_FALSE; - n -= total_header_size; - p += total_header_size; - } - } - - if (sort_central_dir) - mz_zip_reader_sort_central_dir_offsets_by_filename(pZip); - - return MZ_TRUE; -} - -mz_bool mz_zip_reader_init(mz_zip_archive *pZip, mz_uint64 size, - mz_uint32 flags) { - if ((!pZip) || (!pZip->m_pRead)) return MZ_FALSE; - if (!mz_zip_reader_init_internal(pZip, flags)) return MZ_FALSE; - pZip->m_archive_size = size; - if (!mz_zip_reader_read_central_dir(pZip, flags)) { - mz_zip_reader_end(pZip); - return MZ_FALSE; - } - return MZ_TRUE; -} - -static size_t mz_zip_mem_read_func(void *pOpaque, mz_uint64 file_ofs, - void *pBuf, size_t n) { - mz_zip_archive *pZip = (mz_zip_archive *)pOpaque; - size_t s = (file_ofs >= pZip->m_archive_size) - ? 0 - : (size_t)MZ_MIN(pZip->m_archive_size - file_ofs, n); - memcpy(pBuf, (const mz_uint8 *)pZip->m_pState->m_pMem + file_ofs, s); - return s; -} - -mz_bool mz_zip_reader_init_mem(mz_zip_archive *pZip, const void *pMem, - size_t size, mz_uint32 flags) { - if (!mz_zip_reader_init_internal(pZip, flags)) return MZ_FALSE; - pZip->m_archive_size = size; - pZip->m_pRead = mz_zip_mem_read_func; - pZip->m_pIO_opaque = pZip; -#ifdef __cplusplus - pZip->m_pState->m_pMem = const_cast(pMem); -#else - pZip->m_pState->m_pMem = (void *)pMem; -#endif - pZip->m_pState->m_mem_size = size; - if (!mz_zip_reader_read_central_dir(pZip, flags)) { - mz_zip_reader_end(pZip); - return MZ_FALSE; - } - return MZ_TRUE; -} - -#ifndef MINIZ_NO_STDIO -static size_t mz_zip_file_read_func(void *pOpaque, mz_uint64 file_ofs, - void *pBuf, size_t n) { - mz_zip_archive *pZip = (mz_zip_archive *)pOpaque; - mz_int64 cur_ofs = MZ_FTELL64(pZip->m_pState->m_pFile); - if (((mz_int64)file_ofs < 0) || - (((cur_ofs != (mz_int64)file_ofs)) && - (MZ_FSEEK64(pZip->m_pState->m_pFile, (mz_int64)file_ofs, SEEK_SET)))) - return 0; - return MZ_FREAD(pBuf, 1, n, pZip->m_pState->m_pFile); -} - -mz_bool mz_zip_reader_init_file(mz_zip_archive *pZip, const char *pFilename, - mz_uint32 flags) { - mz_uint64 file_size; - MZ_FILE *pFile = MZ_FOPEN(pFilename, "rb"); - if (!pFile) return MZ_FALSE; - if (MZ_FSEEK64(pFile, 0, SEEK_END)) { - MZ_FCLOSE(pFile); - return MZ_FALSE; - } - file_size = MZ_FTELL64(pFile); - if (!mz_zip_reader_init_internal(pZip, flags)) { - MZ_FCLOSE(pFile); - return MZ_FALSE; - } - pZip->m_pRead = mz_zip_file_read_func; - pZip->m_pIO_opaque = pZip; - pZip->m_pState->m_pFile = pFile; - pZip->m_archive_size = file_size; - if (!mz_zip_reader_read_central_dir(pZip, flags)) { - mz_zip_reader_end(pZip); - return MZ_FALSE; - } - return MZ_TRUE; -} -#endif // #ifndef MINIZ_NO_STDIO - -mz_uint mz_zip_reader_get_num_files(mz_zip_archive *pZip) { - return pZip ? pZip->m_total_files : 0; -} - -static MZ_FORCEINLINE const mz_uint8 *mz_zip_reader_get_cdh( - mz_zip_archive *pZip, mz_uint file_index) { - if ((!pZip) || (!pZip->m_pState) || (file_index >= pZip->m_total_files) || - (pZip->m_zip_mode != MZ_ZIP_MODE_READING)) - return NULL; - return &MZ_ZIP_ARRAY_ELEMENT( - &pZip->m_pState->m_central_dir, mz_uint8, - MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir_offsets, mz_uint32, - file_index)); -} - -mz_bool mz_zip_reader_is_file_encrypted(mz_zip_archive *pZip, - mz_uint file_index) { - mz_uint m_bit_flag; - const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index); - if (!p) return MZ_FALSE; - m_bit_flag = MZ_READ_LE16(p + MZ_ZIP_CDH_BIT_FLAG_OFS); - return (m_bit_flag & 1); -} - -mz_bool mz_zip_reader_is_file_a_directory(mz_zip_archive *pZip, - mz_uint file_index) { - mz_uint filename_len, external_attr; - const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index); - if (!p) return MZ_FALSE; - - // First see if the filename ends with a '/' character. - filename_len = MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS); - if (filename_len) { - if (*(p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + filename_len - 1) == '/') - return MZ_TRUE; - } - - // Bugfix: This code was also checking if the internal attribute was non-zero, - // which wasn't correct. - // Most/all zip writers (hopefully) set DOS file/directory attributes in the - // low 16-bits, so check for the DOS directory flag and ignore the source OS - // ID in the created by field. - // FIXME: Remove this check? Is it necessary - we already check the filename. - external_attr = MZ_READ_LE32(p + MZ_ZIP_CDH_EXTERNAL_ATTR_OFS); - if ((external_attr & 0x10) != 0) return MZ_TRUE; - - return MZ_FALSE; -} - -mz_bool mz_zip_reader_file_stat(mz_zip_archive *pZip, mz_uint file_index, - mz_zip_archive_file_stat *pStat) { - mz_uint n; - const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index); - if ((!p) || (!pStat)) return MZ_FALSE; - - // Unpack the central directory record. - pStat->m_file_index = file_index; - pStat->m_central_dir_ofs = MZ_ZIP_ARRAY_ELEMENT( - &pZip->m_pState->m_central_dir_offsets, mz_uint32, file_index); - pStat->m_version_made_by = MZ_READ_LE16(p + MZ_ZIP_CDH_VERSION_MADE_BY_OFS); - pStat->m_version_needed = MZ_READ_LE16(p + MZ_ZIP_CDH_VERSION_NEEDED_OFS); - pStat->m_bit_flag = MZ_READ_LE16(p + MZ_ZIP_CDH_BIT_FLAG_OFS); - pStat->m_method = MZ_READ_LE16(p + MZ_ZIP_CDH_METHOD_OFS); -#ifndef MINIZ_NO_TIME - pStat->m_time = - mz_zip_dos_to_time_t(MZ_READ_LE16(p + MZ_ZIP_CDH_FILE_TIME_OFS), - MZ_READ_LE16(p + MZ_ZIP_CDH_FILE_DATE_OFS)); -#endif - pStat->m_crc32 = MZ_READ_LE32(p + MZ_ZIP_CDH_CRC32_OFS); - pStat->m_comp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS); - pStat->m_uncomp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS); - pStat->m_internal_attr = MZ_READ_LE16(p + MZ_ZIP_CDH_INTERNAL_ATTR_OFS); - pStat->m_external_attr = MZ_READ_LE32(p + MZ_ZIP_CDH_EXTERNAL_ATTR_OFS); - pStat->m_local_header_ofs = MZ_READ_LE32(p + MZ_ZIP_CDH_LOCAL_HEADER_OFS); - - // Copy as much of the filename and comment as possible. - n = MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS); - n = MZ_MIN(n, MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE - 1); - memcpy(pStat->m_filename, p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE, n); - pStat->m_filename[n] = '\0'; - - n = MZ_READ_LE16(p + MZ_ZIP_CDH_COMMENT_LEN_OFS); - n = MZ_MIN(n, MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE - 1); - pStat->m_comment_size = n; - memcpy(pStat->m_comment, - p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + - MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS) + - MZ_READ_LE16(p + MZ_ZIP_CDH_EXTRA_LEN_OFS), - n); - pStat->m_comment[n] = '\0'; - - return MZ_TRUE; -} - -mz_uint mz_zip_reader_get_filename(mz_zip_archive *pZip, mz_uint file_index, - char *pFilename, mz_uint filename_buf_size) { - mz_uint n; - const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index); - if (!p) { - if (filename_buf_size) pFilename[0] = '\0'; - return 0; - } - n = MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS); - if (filename_buf_size) { - n = MZ_MIN(n, filename_buf_size - 1); - memcpy(pFilename, p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE, n); - pFilename[n] = '\0'; - } - return n + 1; -} - -static MZ_FORCEINLINE mz_bool mz_zip_reader_string_equal(const char *pA, - const char *pB, - mz_uint len, - mz_uint flags) { - mz_uint i; - if (flags & MZ_ZIP_FLAG_CASE_SENSITIVE) return 0 == memcmp(pA, pB, len); - for (i = 0; i < len; ++i) - if (MZ_TOLOWER(pA[i]) != MZ_TOLOWER(pB[i])) return MZ_FALSE; - return MZ_TRUE; -} - -static MZ_FORCEINLINE int mz_zip_reader_filename_compare( - const mz_zip_array *pCentral_dir_array, - const mz_zip_array *pCentral_dir_offsets, mz_uint l_index, const char *pR, - mz_uint r_len) { - const mz_uint8 *pL = &MZ_ZIP_ARRAY_ELEMENT( - pCentral_dir_array, mz_uint8, - MZ_ZIP_ARRAY_ELEMENT(pCentral_dir_offsets, mz_uint32, - l_index)), - *pE; - mz_uint l_len = MZ_READ_LE16(pL + MZ_ZIP_CDH_FILENAME_LEN_OFS); - mz_uint8 l = 0, r = 0; - pL += MZ_ZIP_CENTRAL_DIR_HEADER_SIZE; - pE = pL + MZ_MIN(l_len, r_len); - while (pL < pE) { - if ((l = MZ_TOLOWER(*pL)) != (r = MZ_TOLOWER(*pR))) break; - pL++; - pR++; - } - return (pL == pE) ? (int)(l_len - r_len) : (l - r); -} - -static int mz_zip_reader_locate_file_binary_search(mz_zip_archive *pZip, - const char *pFilename) { - mz_zip_internal_state *pState = pZip->m_pState; - const mz_zip_array *pCentral_dir_offsets = &pState->m_central_dir_offsets; - const mz_zip_array *pCentral_dir = &pState->m_central_dir; - mz_uint32 *pIndices = &MZ_ZIP_ARRAY_ELEMENT( - &pState->m_sorted_central_dir_offsets, mz_uint32, 0); - const int size = pZip->m_total_files; - const mz_uint filename_len = (mz_uint)strlen(pFilename); - int l = 0, h = size - 1; - while (l <= h) { - int m = (l + h) >> 1, file_index = pIndices[m], - comp = - mz_zip_reader_filename_compare(pCentral_dir, pCentral_dir_offsets, - file_index, pFilename, filename_len); - if (!comp) - return file_index; - else if (comp < 0) - l = m + 1; - else - h = m - 1; - } - return -1; -} - -int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, - const char *pComment, mz_uint flags) { - mz_uint file_index; - size_t name_len, comment_len; - if ((!pZip) || (!pZip->m_pState) || (!pName) || - (pZip->m_zip_mode != MZ_ZIP_MODE_READING)) - return -1; - if (((flags & (MZ_ZIP_FLAG_IGNORE_PATH | MZ_ZIP_FLAG_CASE_SENSITIVE)) == 0) && - (!pComment) && (pZip->m_pState->m_sorted_central_dir_offsets.m_size)) - return mz_zip_reader_locate_file_binary_search(pZip, pName); - name_len = strlen(pName); - if (name_len > 0xFFFF) return -1; - comment_len = pComment ? strlen(pComment) : 0; - if (comment_len > 0xFFFF) return -1; - for (file_index = 0; file_index < pZip->m_total_files; file_index++) { - const mz_uint8 *pHeader = &MZ_ZIP_ARRAY_ELEMENT( - &pZip->m_pState->m_central_dir, mz_uint8, - MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir_offsets, mz_uint32, - file_index)); - mz_uint filename_len = MZ_READ_LE16(pHeader + MZ_ZIP_CDH_FILENAME_LEN_OFS); - const char *pFilename = - (const char *)pHeader + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE; - if (filename_len < name_len) continue; - if (comment_len) { - mz_uint file_extra_len = MZ_READ_LE16(pHeader + MZ_ZIP_CDH_EXTRA_LEN_OFS), - file_comment_len = - MZ_READ_LE16(pHeader + MZ_ZIP_CDH_COMMENT_LEN_OFS); - const char *pFile_comment = pFilename + filename_len + file_extra_len; - if ((file_comment_len != comment_len) || - (!mz_zip_reader_string_equal(pComment, pFile_comment, - file_comment_len, flags))) - continue; - } - if ((flags & MZ_ZIP_FLAG_IGNORE_PATH) && (filename_len)) { - int ofs = filename_len - 1; - do { - if ((pFilename[ofs] == '/') || (pFilename[ofs] == '\\') || - (pFilename[ofs] == ':')) - break; - } while (--ofs >= 0); - ofs++; - pFilename += ofs; - filename_len -= ofs; - } - if ((filename_len == name_len) && - (mz_zip_reader_string_equal(pName, pFilename, filename_len, flags))) - return file_index; - } - return -1; -} - -mz_bool mz_zip_reader_extract_to_mem_no_alloc(mz_zip_archive *pZip, - mz_uint file_index, void *pBuf, - size_t buf_size, mz_uint flags, - void *pUser_read_buf, - size_t user_read_buf_size) { - int status = TINFL_STATUS_DONE; - mz_uint64 needed_size, cur_file_ofs, comp_remaining, - out_buf_ofs = 0, read_buf_size, read_buf_ofs = 0, read_buf_avail; - mz_zip_archive_file_stat file_stat; - void *pRead_buf; - mz_uint32 - local_header_u32[(MZ_ZIP_LOCAL_DIR_HEADER_SIZE + sizeof(mz_uint32) - 1) / - sizeof(mz_uint32)]; - mz_uint8 *pLocal_header = (mz_uint8 *)local_header_u32; - tinfl_decompressor inflator; - - if ((buf_size) && (!pBuf)) return MZ_FALSE; - - if (!mz_zip_reader_file_stat(pZip, file_index, &file_stat)) return MZ_FALSE; - - // Empty file, or a directory (but not always a directory - I've seen odd zips - // with directories that have compressed data which inflates to 0 bytes) - if (!file_stat.m_comp_size) return MZ_TRUE; - - // Entry is a subdirectory (I've seen old zips with dir entries which have - // compressed deflate data which inflates to 0 bytes, but these entries claim - // to uncompress to 512 bytes in the headers). - // I'm torn how to handle this case - should it fail instead? - if (mz_zip_reader_is_file_a_directory(pZip, file_index)) return MZ_TRUE; - - // Encryption and patch files are not supported. - if (file_stat.m_bit_flag & (1 | 32)) return MZ_FALSE; - - // This function only supports stored and deflate. - if ((!(flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) && (file_stat.m_method != 0) && - (file_stat.m_method != MZ_DEFLATED)) - return MZ_FALSE; - - // Ensure supplied output buffer is large enough. - needed_size = (flags & MZ_ZIP_FLAG_COMPRESSED_DATA) ? file_stat.m_comp_size - : file_stat.m_uncomp_size; - if (buf_size < needed_size) return MZ_FALSE; - - // Read and parse the local directory entry. - cur_file_ofs = file_stat.m_local_header_ofs; - if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pLocal_header, - MZ_ZIP_LOCAL_DIR_HEADER_SIZE) != - MZ_ZIP_LOCAL_DIR_HEADER_SIZE) - return MZ_FALSE; - if (MZ_READ_LE32(pLocal_header) != MZ_ZIP_LOCAL_DIR_HEADER_SIG) - return MZ_FALSE; - - cur_file_ofs += MZ_ZIP_LOCAL_DIR_HEADER_SIZE + - MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_FILENAME_LEN_OFS) + - MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_EXTRA_LEN_OFS); - if ((cur_file_ofs + file_stat.m_comp_size) > pZip->m_archive_size) - return MZ_FALSE; - - if ((flags & MZ_ZIP_FLAG_COMPRESSED_DATA) || (!file_stat.m_method)) { - // The file is stored or the caller has requested the compressed data. - if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pBuf, - (size_t)needed_size) != needed_size) - return MZ_FALSE; - return ((flags & MZ_ZIP_FLAG_COMPRESSED_DATA) != 0) || - (mz_crc32(MZ_CRC32_INIT, (const mz_uint8 *)pBuf, - (size_t)file_stat.m_uncomp_size) == file_stat.m_crc32); - } - - // Decompress the file either directly from memory or from a file input - // buffer. - tinfl_init(&inflator); - - if (pZip->m_pState->m_pMem) { - // Read directly from the archive in memory. - pRead_buf = (mz_uint8 *)pZip->m_pState->m_pMem + cur_file_ofs; - read_buf_size = read_buf_avail = file_stat.m_comp_size; - comp_remaining = 0; - } else if (pUser_read_buf) { - // Use a user provided read buffer. - if (!user_read_buf_size) return MZ_FALSE; - pRead_buf = (mz_uint8 *)pUser_read_buf; - read_buf_size = user_read_buf_size; - read_buf_avail = 0; - comp_remaining = file_stat.m_comp_size; - } else { - // Temporarily allocate a read buffer. - read_buf_size = - MZ_MIN(file_stat.m_comp_size, (mz_uint)MZ_ZIP_MAX_IO_BUF_SIZE); -#ifdef _MSC_VER - if (((0, sizeof(size_t) == sizeof(mz_uint32))) && - (read_buf_size > 0x7FFFFFFF)) -#else - if (((sizeof(size_t) == sizeof(mz_uint32))) && (read_buf_size > 0x7FFFFFFF)) -#endif - return MZ_FALSE; - if (NULL == (pRead_buf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, - (size_t)read_buf_size))) - return MZ_FALSE; - read_buf_avail = 0; - comp_remaining = file_stat.m_comp_size; - } - - do { - size_t in_buf_size, - out_buf_size = (size_t)(file_stat.m_uncomp_size - out_buf_ofs); - if ((!read_buf_avail) && (!pZip->m_pState->m_pMem)) { - read_buf_avail = MZ_MIN(read_buf_size, comp_remaining); - if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pRead_buf, - (size_t)read_buf_avail) != read_buf_avail) { - status = TINFL_STATUS_FAILED; - break; - } - cur_file_ofs += read_buf_avail; - comp_remaining -= read_buf_avail; - read_buf_ofs = 0; - } - in_buf_size = (size_t)read_buf_avail; - status = tinfl_decompress( - &inflator, (mz_uint8 *)pRead_buf + read_buf_ofs, &in_buf_size, - (mz_uint8 *)pBuf, (mz_uint8 *)pBuf + out_buf_ofs, &out_buf_size, - TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF | - (comp_remaining ? TINFL_FLAG_HAS_MORE_INPUT : 0)); - read_buf_avail -= in_buf_size; - read_buf_ofs += in_buf_size; - out_buf_ofs += out_buf_size; - } while (status == TINFL_STATUS_NEEDS_MORE_INPUT); - - if (status == TINFL_STATUS_DONE) { - // Make sure the entire file was decompressed, and check its CRC. - if ((out_buf_ofs != file_stat.m_uncomp_size) || - (mz_crc32(MZ_CRC32_INIT, (const mz_uint8 *)pBuf, - (size_t)file_stat.m_uncomp_size) != file_stat.m_crc32)) - status = TINFL_STATUS_FAILED; - } - - if ((!pZip->m_pState->m_pMem) && (!pUser_read_buf)) - pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); - - return status == TINFL_STATUS_DONE; -} - -mz_bool mz_zip_reader_extract_file_to_mem_no_alloc( - mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, - mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size) { - int file_index = mz_zip_reader_locate_file(pZip, pFilename, NULL, flags); - if (file_index < 0) return MZ_FALSE; - return mz_zip_reader_extract_to_mem_no_alloc(pZip, file_index, pBuf, buf_size, - flags, pUser_read_buf, - user_read_buf_size); -} - -mz_bool mz_zip_reader_extract_to_mem(mz_zip_archive *pZip, mz_uint file_index, - void *pBuf, size_t buf_size, - mz_uint flags) { - return mz_zip_reader_extract_to_mem_no_alloc(pZip, file_index, pBuf, buf_size, - flags, NULL, 0); -} - -mz_bool mz_zip_reader_extract_file_to_mem(mz_zip_archive *pZip, - const char *pFilename, void *pBuf, - size_t buf_size, mz_uint flags) { - return mz_zip_reader_extract_file_to_mem_no_alloc(pZip, pFilename, pBuf, - buf_size, flags, NULL, 0); -} - -void *mz_zip_reader_extract_to_heap(mz_zip_archive *pZip, mz_uint file_index, - size_t *pSize, mz_uint flags) { - mz_uint64 comp_size, uncomp_size, alloc_size; - const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index); - void *pBuf; - - if (pSize) *pSize = 0; - if (!p) return NULL; - - comp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS); - uncomp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS); - - alloc_size = (flags & MZ_ZIP_FLAG_COMPRESSED_DATA) ? comp_size : uncomp_size; -#ifdef _MSC_VER - if (((0, sizeof(size_t) == sizeof(mz_uint32))) && (alloc_size > 0x7FFFFFFF)) -#else - if (((sizeof(size_t) == sizeof(mz_uint32))) && (alloc_size > 0x7FFFFFFF)) -#endif - return NULL; - if (NULL == - (pBuf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, (size_t)alloc_size))) - return NULL; - - if (!mz_zip_reader_extract_to_mem(pZip, file_index, pBuf, (size_t)alloc_size, - flags)) { - pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); - return NULL; - } - - if (pSize) *pSize = (size_t)alloc_size; - return pBuf; -} - -void *mz_zip_reader_extract_file_to_heap(mz_zip_archive *pZip, - const char *pFilename, size_t *pSize, - mz_uint flags) { - int file_index = mz_zip_reader_locate_file(pZip, pFilename, NULL, flags); - if (file_index < 0) { - if (pSize) *pSize = 0; - return MZ_FALSE; - } - return mz_zip_reader_extract_to_heap(pZip, file_index, pSize, flags); -} - -mz_bool mz_zip_reader_extract_to_callback(mz_zip_archive *pZip, - mz_uint file_index, - mz_file_write_func pCallback, - void *pOpaque, mz_uint flags) { - int status = TINFL_STATUS_DONE; - mz_uint file_crc32 = MZ_CRC32_INIT; - mz_uint64 read_buf_size, read_buf_ofs = 0, read_buf_avail, comp_remaining, - out_buf_ofs = 0, cur_file_ofs; - mz_zip_archive_file_stat file_stat; - void *pRead_buf = NULL; - void *pWrite_buf = NULL; - mz_uint32 - local_header_u32[(MZ_ZIP_LOCAL_DIR_HEADER_SIZE + sizeof(mz_uint32) - 1) / - sizeof(mz_uint32)]; - mz_uint8 *pLocal_header = (mz_uint8 *)local_header_u32; - - if (!mz_zip_reader_file_stat(pZip, file_index, &file_stat)) return MZ_FALSE; - - // Empty file, or a directory (but not always a directory - I've seen odd zips - // with directories that have compressed data which inflates to 0 bytes) - if (!file_stat.m_comp_size) return MZ_TRUE; - - // Entry is a subdirectory (I've seen old zips with dir entries which have - // compressed deflate data which inflates to 0 bytes, but these entries claim - // to uncompress to 512 bytes in the headers). - // I'm torn how to handle this case - should it fail instead? - if (mz_zip_reader_is_file_a_directory(pZip, file_index)) return MZ_TRUE; - - // Encryption and patch files are not supported. - if (file_stat.m_bit_flag & (1 | 32)) return MZ_FALSE; - - // This function only supports stored and deflate. - if ((!(flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) && (file_stat.m_method != 0) && - (file_stat.m_method != MZ_DEFLATED)) - return MZ_FALSE; - - // Read and parse the local directory entry. - cur_file_ofs = file_stat.m_local_header_ofs; - if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pLocal_header, - MZ_ZIP_LOCAL_DIR_HEADER_SIZE) != - MZ_ZIP_LOCAL_DIR_HEADER_SIZE) - return MZ_FALSE; - if (MZ_READ_LE32(pLocal_header) != MZ_ZIP_LOCAL_DIR_HEADER_SIG) - return MZ_FALSE; - - cur_file_ofs += MZ_ZIP_LOCAL_DIR_HEADER_SIZE + - MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_FILENAME_LEN_OFS) + - MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_EXTRA_LEN_OFS); - if ((cur_file_ofs + file_stat.m_comp_size) > pZip->m_archive_size) - return MZ_FALSE; - - // Decompress the file either directly from memory or from a file input - // buffer. - if (pZip->m_pState->m_pMem) { - pRead_buf = (mz_uint8 *)pZip->m_pState->m_pMem + cur_file_ofs; - read_buf_size = read_buf_avail = file_stat.m_comp_size; - comp_remaining = 0; - } else { - read_buf_size = - MZ_MIN(file_stat.m_comp_size, (mz_uint)MZ_ZIP_MAX_IO_BUF_SIZE); - if (NULL == (pRead_buf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, - (size_t)read_buf_size))) - return MZ_FALSE; - read_buf_avail = 0; - comp_remaining = file_stat.m_comp_size; - } - - if ((flags & MZ_ZIP_FLAG_COMPRESSED_DATA) || (!file_stat.m_method)) { - // The file is stored or the caller has requested the compressed data. - if (pZip->m_pState->m_pMem) { -#ifdef _MSC_VER - if (((0, sizeof(size_t) == sizeof(mz_uint32))) && - (file_stat.m_comp_size > 0xFFFFFFFF)) -#else - if (((sizeof(size_t) == sizeof(mz_uint32))) && - (file_stat.m_comp_size > 0xFFFFFFFF)) -#endif - return MZ_FALSE; - if (pCallback(pOpaque, out_buf_ofs, pRead_buf, - (size_t)file_stat.m_comp_size) != file_stat.m_comp_size) - status = TINFL_STATUS_FAILED; - else if (!(flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) - file_crc32 = - (mz_uint32)mz_crc32(file_crc32, (const mz_uint8 *)pRead_buf, - (size_t)file_stat.m_comp_size); - cur_file_ofs += file_stat.m_comp_size; - out_buf_ofs += file_stat.m_comp_size; - comp_remaining = 0; - } else { - while (comp_remaining) { - read_buf_avail = MZ_MIN(read_buf_size, comp_remaining); - if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pRead_buf, - (size_t)read_buf_avail) != read_buf_avail) { - status = TINFL_STATUS_FAILED; - break; - } - - if (!(flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) - file_crc32 = (mz_uint32)mz_crc32( - file_crc32, (const mz_uint8 *)pRead_buf, (size_t)read_buf_avail); - - if (pCallback(pOpaque, out_buf_ofs, pRead_buf, - (size_t)read_buf_avail) != read_buf_avail) { - status = TINFL_STATUS_FAILED; - break; - } - cur_file_ofs += read_buf_avail; - out_buf_ofs += read_buf_avail; - comp_remaining -= read_buf_avail; - } - } - } else { - tinfl_decompressor inflator; - tinfl_init(&inflator); - - if (NULL == (pWrite_buf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, - TINFL_LZ_DICT_SIZE))) - status = TINFL_STATUS_FAILED; - else { - do { - mz_uint8 *pWrite_buf_cur = - (mz_uint8 *)pWrite_buf + (out_buf_ofs & (TINFL_LZ_DICT_SIZE - 1)); - size_t in_buf_size, - out_buf_size = - TINFL_LZ_DICT_SIZE - (out_buf_ofs & (TINFL_LZ_DICT_SIZE - 1)); - if ((!read_buf_avail) && (!pZip->m_pState->m_pMem)) { - read_buf_avail = MZ_MIN(read_buf_size, comp_remaining); - if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pRead_buf, - (size_t)read_buf_avail) != read_buf_avail) { - status = TINFL_STATUS_FAILED; - break; - } - cur_file_ofs += read_buf_avail; - comp_remaining -= read_buf_avail; - read_buf_ofs = 0; - } - - in_buf_size = (size_t)read_buf_avail; - status = tinfl_decompress( - &inflator, (const mz_uint8 *)pRead_buf + read_buf_ofs, &in_buf_size, - (mz_uint8 *)pWrite_buf, pWrite_buf_cur, &out_buf_size, - comp_remaining ? TINFL_FLAG_HAS_MORE_INPUT : 0); - read_buf_avail -= in_buf_size; - read_buf_ofs += in_buf_size; - - if (out_buf_size) { - if (pCallback(pOpaque, out_buf_ofs, pWrite_buf_cur, out_buf_size) != - out_buf_size) { - status = TINFL_STATUS_FAILED; - break; - } - file_crc32 = - (mz_uint32)mz_crc32(file_crc32, pWrite_buf_cur, out_buf_size); - if ((out_buf_ofs += out_buf_size) > file_stat.m_uncomp_size) { - status = TINFL_STATUS_FAILED; - break; - } - } - } while ((status == TINFL_STATUS_NEEDS_MORE_INPUT) || - (status == TINFL_STATUS_HAS_MORE_OUTPUT)); - } - } - - if ((status == TINFL_STATUS_DONE) && - (!(flags & MZ_ZIP_FLAG_COMPRESSED_DATA))) { - // Make sure the entire file was decompressed, and check its CRC. - if ((out_buf_ofs != file_stat.m_uncomp_size) || - (file_crc32 != file_stat.m_crc32)) - status = TINFL_STATUS_FAILED; - } - - if (!pZip->m_pState->m_pMem) pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); - if (pWrite_buf) pZip->m_pFree(pZip->m_pAlloc_opaque, pWrite_buf); - - return status == TINFL_STATUS_DONE; -} - -mz_bool mz_zip_reader_extract_file_to_callback(mz_zip_archive *pZip, - const char *pFilename, - mz_file_write_func pCallback, - void *pOpaque, mz_uint flags) { - int file_index = mz_zip_reader_locate_file(pZip, pFilename, NULL, flags); - if (file_index < 0) return MZ_FALSE; - return mz_zip_reader_extract_to_callback(pZip, file_index, pCallback, pOpaque, - flags); -} - -#ifndef MINIZ_NO_STDIO -static size_t mz_zip_file_write_callback(void *pOpaque, mz_uint64 ofs, - const void *pBuf, size_t n) { - (void)ofs; - return MZ_FWRITE(pBuf, 1, n, (MZ_FILE *)pOpaque); -} - -mz_bool mz_zip_reader_extract_to_file(mz_zip_archive *pZip, mz_uint file_index, - const char *pDst_filename, - mz_uint flags) { - mz_bool status; - mz_zip_archive_file_stat file_stat; - MZ_FILE *pFile; - if (!mz_zip_reader_file_stat(pZip, file_index, &file_stat)) return MZ_FALSE; - pFile = MZ_FOPEN(pDst_filename, "wb"); - if (!pFile) return MZ_FALSE; - status = mz_zip_reader_extract_to_callback( - pZip, file_index, mz_zip_file_write_callback, pFile, flags); - if (MZ_FCLOSE(pFile) == EOF) return MZ_FALSE; -#ifndef MINIZ_NO_TIME - if (status) - mz_zip_set_file_times(pDst_filename, file_stat.m_time, file_stat.m_time); -#endif - return status; -} -#endif // #ifndef MINIZ_NO_STDIO - -mz_bool mz_zip_reader_end(mz_zip_archive *pZip) { - if ((!pZip) || (!pZip->m_pState) || (!pZip->m_pAlloc) || (!pZip->m_pFree) || - (pZip->m_zip_mode != MZ_ZIP_MODE_READING)) - return MZ_FALSE; - - if (pZip->m_pState) { - mz_zip_internal_state *pState = pZip->m_pState; - pZip->m_pState = NULL; - mz_zip_array_clear(pZip, &pState->m_central_dir); - mz_zip_array_clear(pZip, &pState->m_central_dir_offsets); - mz_zip_array_clear(pZip, &pState->m_sorted_central_dir_offsets); - -#ifndef MINIZ_NO_STDIO - if (pState->m_pFile) { - MZ_FCLOSE(pState->m_pFile); - pState->m_pFile = NULL; - } -#endif // #ifndef MINIZ_NO_STDIO - - pZip->m_pFree(pZip->m_pAlloc_opaque, pState); - } - pZip->m_zip_mode = MZ_ZIP_MODE_INVALID; - - return MZ_TRUE; -} - -#ifndef MINIZ_NO_STDIO -mz_bool mz_zip_reader_extract_file_to_file(mz_zip_archive *pZip, - const char *pArchive_filename, - const char *pDst_filename, - mz_uint flags) { - int file_index = - mz_zip_reader_locate_file(pZip, pArchive_filename, NULL, flags); - if (file_index < 0) return MZ_FALSE; - return mz_zip_reader_extract_to_file(pZip, file_index, pDst_filename, flags); -} -#endif - -// ------------------- .ZIP archive writing - -#ifndef MINIZ_NO_ARCHIVE_WRITING_APIS - -static void mz_write_le16(mz_uint8 *p, mz_uint16 v) { - p[0] = (mz_uint8)v; - p[1] = (mz_uint8)(v >> 8); -} -static void mz_write_le32(mz_uint8 *p, mz_uint32 v) { - p[0] = (mz_uint8)v; - p[1] = (mz_uint8)(v >> 8); - p[2] = (mz_uint8)(v >> 16); - p[3] = (mz_uint8)(v >> 24); -} -#define MZ_WRITE_LE16(p, v) mz_write_le16((mz_uint8 *)(p), (mz_uint16)(v)) -#define MZ_WRITE_LE32(p, v) mz_write_le32((mz_uint8 *)(p), (mz_uint32)(v)) - -mz_bool mz_zip_writer_init(mz_zip_archive *pZip, mz_uint64 existing_size) { - if ((!pZip) || (pZip->m_pState) || (!pZip->m_pWrite) || - (pZip->m_zip_mode != MZ_ZIP_MODE_INVALID)) - return MZ_FALSE; - - if (pZip->m_file_offset_alignment) { - // Ensure user specified file offset alignment is a power of 2. - if (pZip->m_file_offset_alignment & (pZip->m_file_offset_alignment - 1)) - return MZ_FALSE; - } - - if (!pZip->m_pAlloc) pZip->m_pAlloc = def_alloc_func; - if (!pZip->m_pFree) pZip->m_pFree = def_free_func; - if (!pZip->m_pRealloc) pZip->m_pRealloc = def_realloc_func; - - pZip->m_zip_mode = MZ_ZIP_MODE_WRITING; - pZip->m_archive_size = existing_size; - pZip->m_central_directory_file_ofs = 0; - pZip->m_total_files = 0; - - if (NULL == (pZip->m_pState = (mz_zip_internal_state *)pZip->m_pAlloc( - pZip->m_pAlloc_opaque, 1, sizeof(mz_zip_internal_state)))) - return MZ_FALSE; - memset(pZip->m_pState, 0, sizeof(mz_zip_internal_state)); - MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_central_dir, - sizeof(mz_uint8)); - MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_central_dir_offsets, - sizeof(mz_uint32)); - MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_sorted_central_dir_offsets, - sizeof(mz_uint32)); - return MZ_TRUE; -} - -static size_t mz_zip_heap_write_func(void *pOpaque, mz_uint64 file_ofs, - const void *pBuf, size_t n) { - mz_zip_archive *pZip = (mz_zip_archive *)pOpaque; - mz_zip_internal_state *pState = pZip->m_pState; - mz_uint64 new_size = MZ_MAX(file_ofs + n, pState->m_mem_size); -#ifdef _MSC_VER - if ((!n) || - ((0, sizeof(size_t) == sizeof(mz_uint32)) && (new_size > 0x7FFFFFFF))) -#else - if ((!n) || - ((sizeof(size_t) == sizeof(mz_uint32)) && (new_size > 0x7FFFFFFF))) -#endif - return 0; - if (new_size > pState->m_mem_capacity) { - void *pNew_block; - size_t new_capacity = MZ_MAX(64, pState->m_mem_capacity); - while (new_capacity < new_size) new_capacity *= 2; - if (NULL == (pNew_block = pZip->m_pRealloc( - pZip->m_pAlloc_opaque, pState->m_pMem, 1, new_capacity))) - return 0; - pState->m_pMem = pNew_block; - pState->m_mem_capacity = new_capacity; - } - memcpy((mz_uint8 *)pState->m_pMem + file_ofs, pBuf, n); - pState->m_mem_size = (size_t)new_size; - return n; -} - -mz_bool mz_zip_writer_init_heap(mz_zip_archive *pZip, - size_t size_to_reserve_at_beginning, - size_t initial_allocation_size) { - pZip->m_pWrite = mz_zip_heap_write_func; - pZip->m_pIO_opaque = pZip; - if (!mz_zip_writer_init(pZip, size_to_reserve_at_beginning)) return MZ_FALSE; - if (0 != (initial_allocation_size = MZ_MAX(initial_allocation_size, - size_to_reserve_at_beginning))) { - if (NULL == (pZip->m_pState->m_pMem = pZip->m_pAlloc( - pZip->m_pAlloc_opaque, 1, initial_allocation_size))) { - mz_zip_writer_end(pZip); - return MZ_FALSE; - } - pZip->m_pState->m_mem_capacity = initial_allocation_size; - } - return MZ_TRUE; -} - -#ifndef MINIZ_NO_STDIO -static size_t mz_zip_file_write_func(void *pOpaque, mz_uint64 file_ofs, - const void *pBuf, size_t n) { - mz_zip_archive *pZip = (mz_zip_archive *)pOpaque; - mz_int64 cur_ofs = MZ_FTELL64(pZip->m_pState->m_pFile); - if (((mz_int64)file_ofs < 0) || - (((cur_ofs != (mz_int64)file_ofs)) && - (MZ_FSEEK64(pZip->m_pState->m_pFile, (mz_int64)file_ofs, SEEK_SET)))) - return 0; - return MZ_FWRITE(pBuf, 1, n, pZip->m_pState->m_pFile); -} - -mz_bool mz_zip_writer_init_file(mz_zip_archive *pZip, const char *pFilename, - mz_uint64 size_to_reserve_at_beginning) { - MZ_FILE *pFile; - pZip->m_pWrite = mz_zip_file_write_func; - pZip->m_pIO_opaque = pZip; - if (!mz_zip_writer_init(pZip, size_to_reserve_at_beginning)) return MZ_FALSE; - if (NULL == (pFile = MZ_FOPEN(pFilename, "wb"))) { - mz_zip_writer_end(pZip); - return MZ_FALSE; - } - pZip->m_pState->m_pFile = pFile; - if (size_to_reserve_at_beginning) { - mz_uint64 cur_ofs = 0; - char buf[4096]; - MZ_CLEAR_OBJ(buf); - do { - size_t n = (size_t)MZ_MIN(sizeof(buf), size_to_reserve_at_beginning); - if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_ofs, buf, n) != n) { - mz_zip_writer_end(pZip); - return MZ_FALSE; - } - cur_ofs += n; - size_to_reserve_at_beginning -= n; - } while (size_to_reserve_at_beginning); - } - return MZ_TRUE; -} -#endif // #ifndef MINIZ_NO_STDIO - -mz_bool mz_zip_writer_init_from_reader(mz_zip_archive *pZip, - const char *pFilename) { - mz_zip_internal_state *pState; - if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_READING)) - return MZ_FALSE; - // No sense in trying to write to an archive that's already at the support max - // size - if ((pZip->m_total_files == 0xFFFF) || - ((pZip->m_archive_size + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + - MZ_ZIP_LOCAL_DIR_HEADER_SIZE) > 0xFFFFFFFF)) - return MZ_FALSE; - - pState = pZip->m_pState; - - if (pState->m_pFile) { -#ifdef MINIZ_NO_STDIO - pFilename; - return MZ_FALSE; -#else - // Archive is being read from stdio - try to reopen as writable. - if (pZip->m_pIO_opaque != pZip) return MZ_FALSE; - if (!pFilename) return MZ_FALSE; - pZip->m_pWrite = mz_zip_file_write_func; - if (NULL == - (pState->m_pFile = MZ_FREOPEN(pFilename, "r+b", pState->m_pFile))) { - // The mz_zip_archive is now in a bogus state because pState->m_pFile is - // NULL, so just close it. - mz_zip_reader_end(pZip); - return MZ_FALSE; - } -#endif // #ifdef MINIZ_NO_STDIO - } else if (pState->m_pMem) { - // Archive lives in a memory block. Assume it's from the heap that we can - // resize using the realloc callback. - if (pZip->m_pIO_opaque != pZip) return MZ_FALSE; - pState->m_mem_capacity = pState->m_mem_size; - pZip->m_pWrite = mz_zip_heap_write_func; - } - // Archive is being read via a user provided read function - make sure the - // user has specified a write function too. - else if (!pZip->m_pWrite) - return MZ_FALSE; - - // Start writing new files at the archive's current central directory - // location. - pZip->m_archive_size = pZip->m_central_directory_file_ofs; - pZip->m_zip_mode = MZ_ZIP_MODE_WRITING; - pZip->m_central_directory_file_ofs = 0; - - return MZ_TRUE; -} - -mz_bool mz_zip_writer_add_mem(mz_zip_archive *pZip, const char *pArchive_name, - const void *pBuf, size_t buf_size, - mz_uint level_and_flags) { - return mz_zip_writer_add_mem_ex(pZip, pArchive_name, pBuf, buf_size, NULL, 0, - level_and_flags, 0, 0); -} - -typedef struct { - mz_zip_archive *m_pZip; - mz_uint64 m_cur_archive_file_ofs; - mz_uint64 m_comp_size; -} mz_zip_writer_add_state; - -static mz_bool mz_zip_writer_add_put_buf_callback(const void *pBuf, int len, - void *pUser) { - mz_zip_writer_add_state *pState = (mz_zip_writer_add_state *)pUser; - if ((int)pState->m_pZip->m_pWrite(pState->m_pZip->m_pIO_opaque, - pState->m_cur_archive_file_ofs, pBuf, - len) != len) - return MZ_FALSE; - pState->m_cur_archive_file_ofs += len; - pState->m_comp_size += len; - return MZ_TRUE; -} - -static mz_bool mz_zip_writer_create_local_dir_header( - mz_zip_archive *pZip, mz_uint8 *pDst, mz_uint16 filename_size, - mz_uint16 extra_size, mz_uint64 uncomp_size, mz_uint64 comp_size, - mz_uint32 uncomp_crc32, mz_uint16 method, mz_uint16 bit_flags, - mz_uint16 dos_time, mz_uint16 dos_date) { - (void)pZip; - memset(pDst, 0, MZ_ZIP_LOCAL_DIR_HEADER_SIZE); - MZ_WRITE_LE32(pDst + MZ_ZIP_LDH_SIG_OFS, MZ_ZIP_LOCAL_DIR_HEADER_SIG); - MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_VERSION_NEEDED_OFS, method ? 20 : 0); - MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_BIT_FLAG_OFS, bit_flags); - MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_METHOD_OFS, method); - MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_FILE_TIME_OFS, dos_time); - MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_FILE_DATE_OFS, dos_date); - MZ_WRITE_LE32(pDst + MZ_ZIP_LDH_CRC32_OFS, uncomp_crc32); - MZ_WRITE_LE32(pDst + MZ_ZIP_LDH_COMPRESSED_SIZE_OFS, comp_size); - MZ_WRITE_LE32(pDst + MZ_ZIP_LDH_DECOMPRESSED_SIZE_OFS, uncomp_size); - MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_FILENAME_LEN_OFS, filename_size); - MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_EXTRA_LEN_OFS, extra_size); - return MZ_TRUE; -} - -static mz_bool mz_zip_writer_create_central_dir_header( - mz_zip_archive *pZip, mz_uint8 *pDst, mz_uint16 filename_size, - mz_uint16 extra_size, mz_uint16 comment_size, mz_uint64 uncomp_size, - mz_uint64 comp_size, mz_uint32 uncomp_crc32, mz_uint16 method, - mz_uint16 bit_flags, mz_uint16 dos_time, mz_uint16 dos_date, - mz_uint64 local_header_ofs, mz_uint32 ext_attributes) { - (void)pZip; - memset(pDst, 0, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE); - MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_SIG_OFS, MZ_ZIP_CENTRAL_DIR_HEADER_SIG); - MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_VERSION_NEEDED_OFS, method ? 20 : 0); - MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_BIT_FLAG_OFS, bit_flags); - MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_METHOD_OFS, method); - MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_FILE_TIME_OFS, dos_time); - MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_FILE_DATE_OFS, dos_date); - MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_CRC32_OFS, uncomp_crc32); - MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS, comp_size); - MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS, uncomp_size); - MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_FILENAME_LEN_OFS, filename_size); - MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_EXTRA_LEN_OFS, extra_size); - MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_COMMENT_LEN_OFS, comment_size); - MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_EXTERNAL_ATTR_OFS, ext_attributes); - MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_LOCAL_HEADER_OFS, local_header_ofs); - return MZ_TRUE; -} - -static mz_bool mz_zip_writer_add_to_central_dir( - mz_zip_archive *pZip, const char *pFilename, mz_uint16 filename_size, - const void *pExtra, mz_uint16 extra_size, const void *pComment, - mz_uint16 comment_size, mz_uint64 uncomp_size, mz_uint64 comp_size, - mz_uint32 uncomp_crc32, mz_uint16 method, mz_uint16 bit_flags, - mz_uint16 dos_time, mz_uint16 dos_date, mz_uint64 local_header_ofs, - mz_uint32 ext_attributes) { - mz_zip_internal_state *pState = pZip->m_pState; - mz_uint32 central_dir_ofs = (mz_uint32)pState->m_central_dir.m_size; - size_t orig_central_dir_size = pState->m_central_dir.m_size; - mz_uint8 central_dir_header[MZ_ZIP_CENTRAL_DIR_HEADER_SIZE]; - - // No zip64 support yet - if ((local_header_ofs > 0xFFFFFFFF) || - (((mz_uint64)pState->m_central_dir.m_size + - MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + filename_size + extra_size + - comment_size) > 0xFFFFFFFF)) - return MZ_FALSE; - - if (!mz_zip_writer_create_central_dir_header( - pZip, central_dir_header, filename_size, extra_size, comment_size, - uncomp_size, comp_size, uncomp_crc32, method, bit_flags, dos_time, - dos_date, local_header_ofs, ext_attributes)) - return MZ_FALSE; - - if ((!mz_zip_array_push_back(pZip, &pState->m_central_dir, central_dir_header, - MZ_ZIP_CENTRAL_DIR_HEADER_SIZE)) || - (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pFilename, - filename_size)) || - (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pExtra, - extra_size)) || - (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pComment, - comment_size)) || - (!mz_zip_array_push_back(pZip, &pState->m_central_dir_offsets, - ¢ral_dir_ofs, 1))) { - // Try to push the central directory array back into its original state. - mz_zip_array_resize(pZip, &pState->m_central_dir, orig_central_dir_size, - MZ_FALSE); - return MZ_FALSE; - } - - return MZ_TRUE; -} - -static mz_bool mz_zip_writer_validate_archive_name(const char *pArchive_name) { - // Basic ZIP archive filename validity checks: Valid filenames cannot start - // with a forward slash, cannot contain a drive letter, and cannot use - // DOS-style backward slashes. - if (*pArchive_name == '/') return MZ_FALSE; - while (*pArchive_name) { - if ((*pArchive_name == '\\') || (*pArchive_name == ':')) return MZ_FALSE; - pArchive_name++; - } - return MZ_TRUE; -} - -static mz_uint mz_zip_writer_compute_padding_needed_for_file_alignment( - mz_zip_archive *pZip) { - mz_uint32 n; - if (!pZip->m_file_offset_alignment) return 0; - n = (mz_uint32)(pZip->m_archive_size & (pZip->m_file_offset_alignment - 1)); - return (pZip->m_file_offset_alignment - n) & - (pZip->m_file_offset_alignment - 1); -} - -static mz_bool mz_zip_writer_write_zeros(mz_zip_archive *pZip, - mz_uint64 cur_file_ofs, mz_uint32 n) { - char buf[4096]; - memset(buf, 0, MZ_MIN(sizeof(buf), n)); - while (n) { - mz_uint32 s = MZ_MIN(sizeof(buf), n); - if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_file_ofs, buf, s) != s) - return MZ_FALSE; - cur_file_ofs += s; - n -= s; - } - return MZ_TRUE; -} - -mz_bool mz_zip_writer_add_mem_ex(mz_zip_archive *pZip, - const char *pArchive_name, const void *pBuf, - size_t buf_size, const void *pComment, - mz_uint16 comment_size, - mz_uint level_and_flags, mz_uint64 uncomp_size, - mz_uint32 uncomp_crc32) { - mz_uint16 method = 0, dos_time = 0, dos_date = 0; - mz_uint level, ext_attributes = 0, num_alignment_padding_bytes; - mz_uint64 local_dir_header_ofs = pZip->m_archive_size, - cur_archive_file_ofs = pZip->m_archive_size, comp_size = 0; - size_t archive_name_size; - mz_uint8 local_dir_header[MZ_ZIP_LOCAL_DIR_HEADER_SIZE]; - tdefl_compressor *pComp = NULL; - mz_bool store_data_uncompressed; - mz_zip_internal_state *pState; - - if ((int)level_and_flags < 0) level_and_flags = MZ_DEFAULT_LEVEL; - level = level_and_flags & 0xF; - store_data_uncompressed = - ((!level) || (level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA)); - - if ((!pZip) || (!pZip->m_pState) || - (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING) || ((buf_size) && (!pBuf)) || - (!pArchive_name) || ((comment_size) && (!pComment)) || - (pZip->m_total_files == 0xFFFF) || (level > MZ_UBER_COMPRESSION)) - return MZ_FALSE; - - pState = pZip->m_pState; - - if ((!(level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) && (uncomp_size)) - return MZ_FALSE; - // No zip64 support yet - if ((buf_size > 0xFFFFFFFF) || (uncomp_size > 0xFFFFFFFF)) return MZ_FALSE; - if (!mz_zip_writer_validate_archive_name(pArchive_name)) return MZ_FALSE; - -#ifndef MINIZ_NO_TIME - { - time_t cur_time; - time(&cur_time); - mz_zip_time_to_dos_time(cur_time, &dos_time, &dos_date); - } -#endif // #ifndef MINIZ_NO_TIME - - archive_name_size = strlen(pArchive_name); - if (archive_name_size > 0xFFFF) return MZ_FALSE; - - num_alignment_padding_bytes = - mz_zip_writer_compute_padding_needed_for_file_alignment(pZip); - - // no zip64 support yet - if ((pZip->m_total_files == 0xFFFF) || - ((pZip->m_archive_size + num_alignment_padding_bytes + - MZ_ZIP_LOCAL_DIR_HEADER_SIZE + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + - comment_size + archive_name_size) > 0xFFFFFFFF)) - return MZ_FALSE; - - if ((archive_name_size) && (pArchive_name[archive_name_size - 1] == '/')) { - // Set DOS Subdirectory attribute bit. - ext_attributes |= 0x10; - // Subdirectories cannot contain data. - if ((buf_size) || (uncomp_size)) return MZ_FALSE; - } - - // Try to do any allocations before writing to the archive, so if an - // allocation fails the file remains unmodified. (A good idea if we're doing - // an in-place modification.) - if ((!mz_zip_array_ensure_room( - pZip, &pState->m_central_dir, - MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + archive_name_size + comment_size)) || - (!mz_zip_array_ensure_room(pZip, &pState->m_central_dir_offsets, 1))) - return MZ_FALSE; - - if ((!store_data_uncompressed) && (buf_size)) { - if (NULL == (pComp = (tdefl_compressor *)pZip->m_pAlloc( - pZip->m_pAlloc_opaque, 1, sizeof(tdefl_compressor)))) - return MZ_FALSE; - } - - if (!mz_zip_writer_write_zeros( - pZip, cur_archive_file_ofs, - num_alignment_padding_bytes + sizeof(local_dir_header))) { - pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); - return MZ_FALSE; - } - local_dir_header_ofs += num_alignment_padding_bytes; - if (pZip->m_file_offset_alignment) { - MZ_ASSERT((local_dir_header_ofs & (pZip->m_file_offset_alignment - 1)) == - 0); - } - cur_archive_file_ofs += - num_alignment_padding_bytes + sizeof(local_dir_header); - - MZ_CLEAR_OBJ(local_dir_header); - if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, pArchive_name, - archive_name_size) != archive_name_size) { - pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); - return MZ_FALSE; - } - cur_archive_file_ofs += archive_name_size; - - if (!(level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) { - uncomp_crc32 = - (mz_uint32)mz_crc32(MZ_CRC32_INIT, (const mz_uint8 *)pBuf, buf_size); - uncomp_size = buf_size; - if (uncomp_size <= 3) { - level = 0; - store_data_uncompressed = MZ_TRUE; - } - } - - if (store_data_uncompressed) { - if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, pBuf, - buf_size) != buf_size) { - pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); - return MZ_FALSE; - } - - cur_archive_file_ofs += buf_size; - comp_size = buf_size; - - if (level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA) method = MZ_DEFLATED; - } else if (buf_size) { - mz_zip_writer_add_state state; - - state.m_pZip = pZip; - state.m_cur_archive_file_ofs = cur_archive_file_ofs; - state.m_comp_size = 0; - - if ((tdefl_init(pComp, mz_zip_writer_add_put_buf_callback, &state, - tdefl_create_comp_flags_from_zip_params( - level, -15, MZ_DEFAULT_STRATEGY)) != - TDEFL_STATUS_OKAY) || - (tdefl_compress_buffer(pComp, pBuf, buf_size, TDEFL_FINISH) != - TDEFL_STATUS_DONE)) { - pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); - return MZ_FALSE; - } - - comp_size = state.m_comp_size; - cur_archive_file_ofs = state.m_cur_archive_file_ofs; - - method = MZ_DEFLATED; - } - - pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); - pComp = NULL; - - // no zip64 support yet - if ((comp_size > 0xFFFFFFFF) || (cur_archive_file_ofs > 0xFFFFFFFF)) - return MZ_FALSE; - - if (!mz_zip_writer_create_local_dir_header( - pZip, local_dir_header, (mz_uint16)archive_name_size, 0, uncomp_size, - comp_size, uncomp_crc32, method, 0, dos_time, dos_date)) - return MZ_FALSE; - - if (pZip->m_pWrite(pZip->m_pIO_opaque, local_dir_header_ofs, local_dir_header, - sizeof(local_dir_header)) != sizeof(local_dir_header)) - return MZ_FALSE; - - if (!mz_zip_writer_add_to_central_dir( - pZip, pArchive_name, (mz_uint16)archive_name_size, NULL, 0, pComment, - comment_size, uncomp_size, comp_size, uncomp_crc32, method, 0, - dos_time, dos_date, local_dir_header_ofs, ext_attributes)) - return MZ_FALSE; - - pZip->m_total_files++; - pZip->m_archive_size = cur_archive_file_ofs; - - return MZ_TRUE; -} - -#ifndef MINIZ_NO_STDIO -mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchive_name, - const char *pSrc_filename, const void *pComment, - mz_uint16 comment_size, - mz_uint level_and_flags) { - mz_uint uncomp_crc32 = MZ_CRC32_INIT, level, num_alignment_padding_bytes; - mz_uint16 method = 0, dos_time = 0, dos_date = 0, ext_attributes = 0; - mz_uint64 local_dir_header_ofs = pZip->m_archive_size, - cur_archive_file_ofs = pZip->m_archive_size, uncomp_size = 0, - comp_size = 0; - size_t archive_name_size; - mz_uint8 local_dir_header[MZ_ZIP_LOCAL_DIR_HEADER_SIZE]; - MZ_FILE *pSrc_file = NULL; - - if ((int)level_and_flags < 0) level_and_flags = MZ_DEFAULT_LEVEL; - level = level_and_flags & 0xF; - - if ((!pZip) || (!pZip->m_pState) || - (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING) || (!pArchive_name) || - ((comment_size) && (!pComment)) || (level > MZ_UBER_COMPRESSION)) - return MZ_FALSE; - if (level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA) return MZ_FALSE; - if (!mz_zip_writer_validate_archive_name(pArchive_name)) return MZ_FALSE; - - archive_name_size = strlen(pArchive_name); - if (archive_name_size > 0xFFFF) return MZ_FALSE; - - num_alignment_padding_bytes = - mz_zip_writer_compute_padding_needed_for_file_alignment(pZip); - - // no zip64 support yet - if ((pZip->m_total_files == 0xFFFF) || - ((pZip->m_archive_size + num_alignment_padding_bytes + - MZ_ZIP_LOCAL_DIR_HEADER_SIZE + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + - comment_size + archive_name_size) > 0xFFFFFFFF)) - return MZ_FALSE; - - if (!mz_zip_get_file_modified_time(pSrc_filename, &dos_time, &dos_date)) - return MZ_FALSE; - - pSrc_file = MZ_FOPEN(pSrc_filename, "rb"); - if (!pSrc_file) return MZ_FALSE; - MZ_FSEEK64(pSrc_file, 0, SEEK_END); - uncomp_size = MZ_FTELL64(pSrc_file); - MZ_FSEEK64(pSrc_file, 0, SEEK_SET); - - if (uncomp_size > 0xFFFFFFFF) { - // No zip64 support yet - MZ_FCLOSE(pSrc_file); - return MZ_FALSE; - } - if (uncomp_size <= 3) level = 0; - - if (!mz_zip_writer_write_zeros( - pZip, cur_archive_file_ofs, - num_alignment_padding_bytes + sizeof(local_dir_header))) { - MZ_FCLOSE(pSrc_file); - return MZ_FALSE; - } - local_dir_header_ofs += num_alignment_padding_bytes; - if (pZip->m_file_offset_alignment) { - MZ_ASSERT((local_dir_header_ofs & (pZip->m_file_offset_alignment - 1)) == - 0); - } - cur_archive_file_ofs += - num_alignment_padding_bytes + sizeof(local_dir_header); - - MZ_CLEAR_OBJ(local_dir_header); - if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, pArchive_name, - archive_name_size) != archive_name_size) { - MZ_FCLOSE(pSrc_file); - return MZ_FALSE; - } - cur_archive_file_ofs += archive_name_size; - - if (uncomp_size) { - mz_uint64 uncomp_remaining = uncomp_size; - void *pRead_buf = - pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, MZ_ZIP_MAX_IO_BUF_SIZE); - if (!pRead_buf) { - MZ_FCLOSE(pSrc_file); - return MZ_FALSE; - } - - if (!level) { - while (uncomp_remaining) { - mz_uint n = - (mz_uint)MZ_MIN((mz_uint)MZ_ZIP_MAX_IO_BUF_SIZE, uncomp_remaining); - if ((MZ_FREAD(pRead_buf, 1, n, pSrc_file) != n) || - (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, pRead_buf, - n) != n)) { - pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); - MZ_FCLOSE(pSrc_file); - return MZ_FALSE; - } - uncomp_crc32 = - (mz_uint32)mz_crc32(uncomp_crc32, (const mz_uint8 *)pRead_buf, n); - uncomp_remaining -= n; - cur_archive_file_ofs += n; - } - comp_size = uncomp_size; - } else { - mz_bool result = MZ_FALSE; - mz_zip_writer_add_state state; - tdefl_compressor *pComp = (tdefl_compressor *)pZip->m_pAlloc( - pZip->m_pAlloc_opaque, 1, sizeof(tdefl_compressor)); - if (!pComp) { - pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); - MZ_FCLOSE(pSrc_file); - return MZ_FALSE; - } - - state.m_pZip = pZip; - state.m_cur_archive_file_ofs = cur_archive_file_ofs; - state.m_comp_size = 0; - - if (tdefl_init(pComp, mz_zip_writer_add_put_buf_callback, &state, - tdefl_create_comp_flags_from_zip_params( - level, -15, MZ_DEFAULT_STRATEGY)) != - TDEFL_STATUS_OKAY) { - pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); - pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); - MZ_FCLOSE(pSrc_file); - return MZ_FALSE; - } - - for (;;) { - size_t in_buf_size = (mz_uint32)MZ_MIN(uncomp_remaining, - (mz_uint)MZ_ZIP_MAX_IO_BUF_SIZE); - tdefl_status status; - - if (MZ_FREAD(pRead_buf, 1, in_buf_size, pSrc_file) != in_buf_size) - break; - - uncomp_crc32 = (mz_uint32)mz_crc32( - uncomp_crc32, (const mz_uint8 *)pRead_buf, in_buf_size); - uncomp_remaining -= in_buf_size; - - status = tdefl_compress_buffer( - pComp, pRead_buf, in_buf_size, - uncomp_remaining ? TDEFL_NO_FLUSH : TDEFL_FINISH); - if (status == TDEFL_STATUS_DONE) { - result = MZ_TRUE; - break; - } else if (status != TDEFL_STATUS_OKAY) - break; - } - - pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); - - if (!result) { - pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); - MZ_FCLOSE(pSrc_file); - return MZ_FALSE; - } - - comp_size = state.m_comp_size; - cur_archive_file_ofs = state.m_cur_archive_file_ofs; - - method = MZ_DEFLATED; - } - - pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); - } - - MZ_FCLOSE(pSrc_file); - pSrc_file = NULL; - - // no zip64 support yet - if ((comp_size > 0xFFFFFFFF) || (cur_archive_file_ofs > 0xFFFFFFFF)) - return MZ_FALSE; - - if (!mz_zip_writer_create_local_dir_header( - pZip, local_dir_header, (mz_uint16)archive_name_size, 0, uncomp_size, - comp_size, uncomp_crc32, method, 0, dos_time, dos_date)) - return MZ_FALSE; - - if (pZip->m_pWrite(pZip->m_pIO_opaque, local_dir_header_ofs, local_dir_header, - sizeof(local_dir_header)) != sizeof(local_dir_header)) - return MZ_FALSE; - - if (!mz_zip_writer_add_to_central_dir( - pZip, pArchive_name, (mz_uint16)archive_name_size, NULL, 0, pComment, - comment_size, uncomp_size, comp_size, uncomp_crc32, method, 0, - dos_time, dos_date, local_dir_header_ofs, ext_attributes)) - return MZ_FALSE; - - pZip->m_total_files++; - pZip->m_archive_size = cur_archive_file_ofs; - - return MZ_TRUE; -} -#endif // #ifndef MINIZ_NO_STDIO - -mz_bool mz_zip_writer_add_from_zip_reader(mz_zip_archive *pZip, - mz_zip_archive *pSource_zip, - mz_uint file_index) { - mz_uint n, bit_flags, num_alignment_padding_bytes; - mz_uint64 comp_bytes_remaining, local_dir_header_ofs; - mz_uint64 cur_src_file_ofs, cur_dst_file_ofs; - mz_uint32 - local_header_u32[(MZ_ZIP_LOCAL_DIR_HEADER_SIZE + sizeof(mz_uint32) - 1) / - sizeof(mz_uint32)]; - mz_uint8 *pLocal_header = (mz_uint8 *)local_header_u32; - mz_uint8 central_header[MZ_ZIP_CENTRAL_DIR_HEADER_SIZE]; - size_t orig_central_dir_size; - mz_zip_internal_state *pState; - void *pBuf; - const mz_uint8 *pSrc_central_header; - - if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING)) - return MZ_FALSE; - if (NULL == - (pSrc_central_header = mz_zip_reader_get_cdh(pSource_zip, file_index))) - return MZ_FALSE; - pState = pZip->m_pState; - - num_alignment_padding_bytes = - mz_zip_writer_compute_padding_needed_for_file_alignment(pZip); - - // no zip64 support yet - if ((pZip->m_total_files == 0xFFFF) || - ((pZip->m_archive_size + num_alignment_padding_bytes + - MZ_ZIP_LOCAL_DIR_HEADER_SIZE + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE) > - 0xFFFFFFFF)) - return MZ_FALSE; - - cur_src_file_ofs = - MZ_READ_LE32(pSrc_central_header + MZ_ZIP_CDH_LOCAL_HEADER_OFS); - cur_dst_file_ofs = pZip->m_archive_size; - - if (pSource_zip->m_pRead(pSource_zip->m_pIO_opaque, cur_src_file_ofs, - pLocal_header, MZ_ZIP_LOCAL_DIR_HEADER_SIZE) != - MZ_ZIP_LOCAL_DIR_HEADER_SIZE) - return MZ_FALSE; - if (MZ_READ_LE32(pLocal_header) != MZ_ZIP_LOCAL_DIR_HEADER_SIG) - return MZ_FALSE; - cur_src_file_ofs += MZ_ZIP_LOCAL_DIR_HEADER_SIZE; - - if (!mz_zip_writer_write_zeros(pZip, cur_dst_file_ofs, - num_alignment_padding_bytes)) - return MZ_FALSE; - cur_dst_file_ofs += num_alignment_padding_bytes; - local_dir_header_ofs = cur_dst_file_ofs; - if (pZip->m_file_offset_alignment) { - MZ_ASSERT((local_dir_header_ofs & (pZip->m_file_offset_alignment - 1)) == - 0); - } - - if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_dst_file_ofs, pLocal_header, - MZ_ZIP_LOCAL_DIR_HEADER_SIZE) != - MZ_ZIP_LOCAL_DIR_HEADER_SIZE) - return MZ_FALSE; - cur_dst_file_ofs += MZ_ZIP_LOCAL_DIR_HEADER_SIZE; - - n = MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_FILENAME_LEN_OFS) + - MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_EXTRA_LEN_OFS); - comp_bytes_remaining = - n + MZ_READ_LE32(pSrc_central_header + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS); - - if (NULL == (pBuf = pZip->m_pAlloc( - pZip->m_pAlloc_opaque, 1, - (size_t)MZ_MAX(sizeof(mz_uint32) * 4, - MZ_MIN((mz_uint)MZ_ZIP_MAX_IO_BUF_SIZE, - comp_bytes_remaining))))) - return MZ_FALSE; - - while (comp_bytes_remaining) { - n = (mz_uint)MZ_MIN((mz_uint)MZ_ZIP_MAX_IO_BUF_SIZE, comp_bytes_remaining); - if (pSource_zip->m_pRead(pSource_zip->m_pIO_opaque, cur_src_file_ofs, pBuf, - n) != n) { - pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); - return MZ_FALSE; - } - cur_src_file_ofs += n; - - if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_dst_file_ofs, pBuf, n) != n) { - pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); - return MZ_FALSE; - } - cur_dst_file_ofs += n; - - comp_bytes_remaining -= n; - } - - bit_flags = MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_BIT_FLAG_OFS); - if (bit_flags & 8) { - // Copy data descriptor - if (pSource_zip->m_pRead(pSource_zip->m_pIO_opaque, cur_src_file_ofs, pBuf, - sizeof(mz_uint32) * 4) != sizeof(mz_uint32) * 4) { - pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); - return MZ_FALSE; - } - - n = sizeof(mz_uint32) * ((MZ_READ_LE32(pBuf) == 0x08074b50) ? 4 : 3); - if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_dst_file_ofs, pBuf, n) != n) { - pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); - return MZ_FALSE; - } - - cur_src_file_ofs += n; - cur_dst_file_ofs += n; - } - pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); - - // no zip64 support yet - if (cur_dst_file_ofs > 0xFFFFFFFF) return MZ_FALSE; - - orig_central_dir_size = pState->m_central_dir.m_size; - - memcpy(central_header, pSrc_central_header, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE); - MZ_WRITE_LE32(central_header + MZ_ZIP_CDH_LOCAL_HEADER_OFS, - local_dir_header_ofs); - if (!mz_zip_array_push_back(pZip, &pState->m_central_dir, central_header, - MZ_ZIP_CENTRAL_DIR_HEADER_SIZE)) - return MZ_FALSE; - - n = MZ_READ_LE16(pSrc_central_header + MZ_ZIP_CDH_FILENAME_LEN_OFS) + - MZ_READ_LE16(pSrc_central_header + MZ_ZIP_CDH_EXTRA_LEN_OFS) + - MZ_READ_LE16(pSrc_central_header + MZ_ZIP_CDH_COMMENT_LEN_OFS); - if (!mz_zip_array_push_back( - pZip, &pState->m_central_dir, - pSrc_central_header + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE, n)) { - mz_zip_array_resize(pZip, &pState->m_central_dir, orig_central_dir_size, - MZ_FALSE); - return MZ_FALSE; - } - - if (pState->m_central_dir.m_size > 0xFFFFFFFF) return MZ_FALSE; - n = (mz_uint32)orig_central_dir_size; - if (!mz_zip_array_push_back(pZip, &pState->m_central_dir_offsets, &n, 1)) { - mz_zip_array_resize(pZip, &pState->m_central_dir, orig_central_dir_size, - MZ_FALSE); - return MZ_FALSE; - } - - pZip->m_total_files++; - pZip->m_archive_size = cur_dst_file_ofs; - - return MZ_TRUE; -} - -mz_bool mz_zip_writer_finalize_archive(mz_zip_archive *pZip) { - mz_zip_internal_state *pState; - mz_uint64 central_dir_ofs, central_dir_size; - mz_uint8 hdr[MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE]; - - if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING)) - return MZ_FALSE; - - pState = pZip->m_pState; - - // no zip64 support yet - if ((pZip->m_total_files > 0xFFFF) || - ((pZip->m_archive_size + pState->m_central_dir.m_size + - MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE) > 0xFFFFFFFF)) - return MZ_FALSE; - - central_dir_ofs = 0; - central_dir_size = 0; - if (pZip->m_total_files) { - // Write central directory - central_dir_ofs = pZip->m_archive_size; - central_dir_size = pState->m_central_dir.m_size; - pZip->m_central_directory_file_ofs = central_dir_ofs; - if (pZip->m_pWrite(pZip->m_pIO_opaque, central_dir_ofs, - pState->m_central_dir.m_p, - (size_t)central_dir_size) != central_dir_size) - return MZ_FALSE; - pZip->m_archive_size += central_dir_size; - } - - // Write end of central directory record - MZ_CLEAR_OBJ(hdr); - MZ_WRITE_LE32(hdr + MZ_ZIP_ECDH_SIG_OFS, - MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIG); - MZ_WRITE_LE16(hdr + MZ_ZIP_ECDH_CDIR_NUM_ENTRIES_ON_DISK_OFS, - pZip->m_total_files); - MZ_WRITE_LE16(hdr + MZ_ZIP_ECDH_CDIR_TOTAL_ENTRIES_OFS, pZip->m_total_files); - MZ_WRITE_LE32(hdr + MZ_ZIP_ECDH_CDIR_SIZE_OFS, central_dir_size); - MZ_WRITE_LE32(hdr + MZ_ZIP_ECDH_CDIR_OFS_OFS, central_dir_ofs); - - if (pZip->m_pWrite(pZip->m_pIO_opaque, pZip->m_archive_size, hdr, - sizeof(hdr)) != sizeof(hdr)) - return MZ_FALSE; -#ifndef MINIZ_NO_STDIO - if ((pState->m_pFile) && (MZ_FFLUSH(pState->m_pFile) == EOF)) return MZ_FALSE; -#endif // #ifndef MINIZ_NO_STDIO - - pZip->m_archive_size += sizeof(hdr); - - pZip->m_zip_mode = MZ_ZIP_MODE_WRITING_HAS_BEEN_FINALIZED; - return MZ_TRUE; -} - -mz_bool mz_zip_writer_finalize_heap_archive(mz_zip_archive *pZip, void **pBuf, - size_t *pSize) { - if ((!pZip) || (!pZip->m_pState) || (!pBuf) || (!pSize)) return MZ_FALSE; - if (pZip->m_pWrite != mz_zip_heap_write_func) return MZ_FALSE; - if (!mz_zip_writer_finalize_archive(pZip)) return MZ_FALSE; - - *pBuf = pZip->m_pState->m_pMem; - *pSize = pZip->m_pState->m_mem_size; - pZip->m_pState->m_pMem = NULL; - pZip->m_pState->m_mem_size = pZip->m_pState->m_mem_capacity = 0; - return MZ_TRUE; -} - -mz_bool mz_zip_writer_end(mz_zip_archive *pZip) { - mz_zip_internal_state *pState; - mz_bool status = MZ_TRUE; - if ((!pZip) || (!pZip->m_pState) || (!pZip->m_pAlloc) || (!pZip->m_pFree) || - ((pZip->m_zip_mode != MZ_ZIP_MODE_WRITING) && - (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING_HAS_BEEN_FINALIZED))) - return MZ_FALSE; - - pState = pZip->m_pState; - pZip->m_pState = NULL; - mz_zip_array_clear(pZip, &pState->m_central_dir); - mz_zip_array_clear(pZip, &pState->m_central_dir_offsets); - mz_zip_array_clear(pZip, &pState->m_sorted_central_dir_offsets); - -#ifndef MINIZ_NO_STDIO - if (pState->m_pFile) { - MZ_FCLOSE(pState->m_pFile); - pState->m_pFile = NULL; - } -#endif // #ifndef MINIZ_NO_STDIO - - if ((pZip->m_pWrite == mz_zip_heap_write_func) && (pState->m_pMem)) { - pZip->m_pFree(pZip->m_pAlloc_opaque, pState->m_pMem); - pState->m_pMem = NULL; - } - - pZip->m_pFree(pZip->m_pAlloc_opaque, pState); - pZip->m_zip_mode = MZ_ZIP_MODE_INVALID; - return status; -} - -#ifndef MINIZ_NO_STDIO -mz_bool mz_zip_add_mem_to_archive_file_in_place( - const char *pZip_filename, const char *pArchive_name, const void *pBuf, - size_t buf_size, const void *pComment, mz_uint16 comment_size, - mz_uint level_and_flags) { - mz_bool status, created_new_archive = MZ_FALSE; - mz_zip_archive zip_archive; - struct MZ_FILE_STAT_STRUCT file_stat; - MZ_CLEAR_OBJ(zip_archive); - if ((int)level_and_flags < 0) level_and_flags = MZ_DEFAULT_LEVEL; - if ((!pZip_filename) || (!pArchive_name) || ((buf_size) && (!pBuf)) || - ((comment_size) && (!pComment)) || - ((level_and_flags & 0xF) > MZ_UBER_COMPRESSION)) - return MZ_FALSE; - if (!mz_zip_writer_validate_archive_name(pArchive_name)) return MZ_FALSE; - if (MZ_FILE_STAT(pZip_filename, &file_stat) != 0) { - // Create a new archive. - if (!mz_zip_writer_init_file(&zip_archive, pZip_filename, 0)) - return MZ_FALSE; - created_new_archive = MZ_TRUE; - } else { - // Append to an existing archive. - if (!mz_zip_reader_init_file( - &zip_archive, pZip_filename, - level_and_flags | MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY)) - return MZ_FALSE; - if (!mz_zip_writer_init_from_reader(&zip_archive, pZip_filename)) { - mz_zip_reader_end(&zip_archive); - return MZ_FALSE; - } - } - status = - mz_zip_writer_add_mem_ex(&zip_archive, pArchive_name, pBuf, buf_size, - pComment, comment_size, level_and_flags, 0, 0); - // Always finalize, even if adding failed for some reason, so we have a valid - // central directory. (This may not always succeed, but we can try.) - if (!mz_zip_writer_finalize_archive(&zip_archive)) status = MZ_FALSE; - if (!mz_zip_writer_end(&zip_archive)) status = MZ_FALSE; - if ((!status) && (created_new_archive)) { - // It's a new archive and something went wrong, so just delete it. - int ignoredStatus = MZ_DELETE_FILE(pZip_filename); - (void)ignoredStatus; - } - return status; -} - -void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, - const char *pArchive_name, - size_t *pSize, mz_uint flags) { - int file_index; - mz_zip_archive zip_archive; - void *p = NULL; - - if (pSize) *pSize = 0; - - if ((!pZip_filename) || (!pArchive_name)) return NULL; - - MZ_CLEAR_OBJ(zip_archive); - if (!mz_zip_reader_init_file( - &zip_archive, pZip_filename, - flags | MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY)) - return NULL; - - if ((file_index = mz_zip_reader_locate_file(&zip_archive, pArchive_name, NULL, - flags)) >= 0) - p = mz_zip_reader_extract_to_heap(&zip_archive, file_index, pSize, flags); - - mz_zip_reader_end(&zip_archive); - return p; -} - -#endif // #ifndef MINIZ_NO_STDIO - -#endif // #ifndef MINIZ_NO_ARCHIVE_WRITING_APIS - -#endif // #ifndef MINIZ_NO_ARCHIVE_APIS - -#ifdef __cplusplus -} -#endif - -#endif // MINIZ_HEADER_FILE_ONLY - -/* - This is free and unencumbered software released into the public domain. - - Anyone is free to copy, modify, publish, use, compile, sell, or - distribute this software, either in source code form or as a compiled - binary, for any purpose, commercial or non-commercial, and by any - means. - - In jurisdictions that recognize copyright laws, the author or authors - of this software dedicate any and all copyright interest in the - software to the public domain. We make this dedication for the benefit - of the public at large and to the detriment of our heirs and - successors. We intend this dedication to be an overt act of - relinquishment in perpetuity of all present and future rights to this - software under copyright law. - - 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 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. - - For more information, please refer to -*/ - -// ---------------------- end of miniz ---------------------------------------- - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -#ifdef _MSC_VER -#pragma warning(pop) -#endif - - -} -#else - -// Reuse MINIZ_LITTE_ENDIAN macro - -#if defined(__sparcv9) -// Big endian -#else -#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || MINIZ_X86_OR_X64_CPU -// Set MINIZ_LITTLE_ENDIAN to 1 if the processor is little endian. -#define MINIZ_LITTLE_ENDIAN 1 -#endif -#endif - -#endif // TINYEXR_USE_MINIZ - -// static bool IsBigEndian(void) { -// union { -// unsigned int i; -// char c[4]; -// } bint = {0x01020304}; -// -// return bint.c[0] == 1; -//} - -static const int kEXRVersionSize = 8; - -static void swap2(unsigned short *val) { -#ifdef MINIZ_LITTLE_ENDIAN - (void)val; -#else - unsigned short tmp = *val; - unsigned char *dst = reinterpret_cast(val); - unsigned char *src = reinterpret_cast(&tmp); - - dst[0] = src[1]; - dst[1] = src[0]; -#endif -} - -static void swap4(unsigned int *val) { -#ifdef MINIZ_LITTLE_ENDIAN - (void)val; -#else - unsigned int tmp = *val; - unsigned char *dst = reinterpret_cast(val); - unsigned char *src = reinterpret_cast(&tmp); - - dst[0] = src[3]; - dst[1] = src[2]; - dst[2] = src[1]; - dst[3] = src[0]; -#endif -} - -static void swap8(tinyexr::tinyexr_uint64 *val) { -#ifdef MINIZ_LITTLE_ENDIAN - (void)val; -#else - tinyexr::tinyexr_uint64 tmp = (*val); - unsigned char *dst = reinterpret_cast(val); - unsigned char *src = reinterpret_cast(&tmp); - - dst[0] = src[7]; - dst[1] = src[6]; - dst[2] = src[5]; - dst[3] = src[4]; - dst[4] = src[3]; - dst[5] = src[2]; - dst[6] = src[1]; - dst[7] = src[0]; -#endif -} - -// https://gist.github.com/rygorous/2156668 -// Reuse MINIZ_LITTLE_ENDIAN flag from miniz. -union FP32 { - unsigned int u; - float f; - struct { -#if MINIZ_LITTLE_ENDIAN - unsigned int Mantissa : 23; - unsigned int Exponent : 8; - unsigned int Sign : 1; -#else - unsigned int Sign : 1; - unsigned int Exponent : 8; - unsigned int Mantissa : 23; -#endif - } s; -}; - -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpadded" -#endif - -union FP16 { - unsigned short u; - struct { -#if MINIZ_LITTLE_ENDIAN - unsigned int Mantissa : 10; - unsigned int Exponent : 5; - unsigned int Sign : 1; -#else - unsigned int Sign : 1; - unsigned int Exponent : 5; - unsigned int Mantissa : 10; -#endif - } s; -}; - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -static FP32 half_to_float(FP16 h) { - static const FP32 magic = {113 << 23}; - static const unsigned int shifted_exp = 0x7c00 - << 13; // exponent mask after shift - FP32 o; - - o.u = (h.u & 0x7fffU) << 13U; // exponent/mantissa bits - unsigned int exp_ = shifted_exp & o.u; // just the exponent - o.u += (127 - 15) << 23; // exponent adjust - - // handle exponent special cases - if (exp_ == shifted_exp) // Inf/NaN? - o.u += (128 - 16) << 23; // extra exp adjust - else if (exp_ == 0) // Zero/Denormal? - { - o.u += 1 << 23; // extra exp adjust - o.f -= magic.f; // renormalize - } - - o.u |= (h.u & 0x8000U) << 16U; // sign bit - return o; -} - -static FP16 float_to_half_full(FP32 f) { - FP16 o = {0}; - - // Based on ISPC reference code (with minor modifications) - if (f.s.Exponent == 0) // Signed zero/denormal (which will underflow) - o.s.Exponent = 0; - else if (f.s.Exponent == 255) // Inf or NaN (all exponent bits set) - { - o.s.Exponent = 31; - o.s.Mantissa = f.s.Mantissa ? 0x200 : 0; // NaN->qNaN and Inf->Inf - } else // Normalized number - { - // Exponent unbias the single, then bias the halfp - int newexp = f.s.Exponent - 127 + 15; - if (newexp >= 31) // Overflow, return signed infinity - o.s.Exponent = 31; - else if (newexp <= 0) // Underflow - { - if ((14 - newexp) <= 24) // Mantissa might be non-zero - { - unsigned int mant = f.s.Mantissa | 0x800000; // Hidden 1 bit - o.s.Mantissa = mant >> (14 - newexp); - if ((mant >> (13 - newexp)) & 1) // Check for rounding - o.u++; // Round, might overflow into exp bit, but this is OK - } - } else { - o.s.Exponent = static_cast(newexp); - o.s.Mantissa = f.s.Mantissa >> 13; - if (f.s.Mantissa & 0x1000) // Check for rounding - o.u++; // Round, might overflow to inf, this is OK - } - } - - o.s.Sign = f.s.Sign; - return o; -} - -// NOTE: From OpenEXR code -// #define IMF_INCREASING_Y 0 -// #define IMF_DECREASING_Y 1 -// #define IMF_RAMDOM_Y 2 -// -// #define IMF_NO_COMPRESSION 0 -// #define IMF_RLE_COMPRESSION 1 -// #define IMF_ZIPS_COMPRESSION 2 -// #define IMF_ZIP_COMPRESSION 3 -// #define IMF_PIZ_COMPRESSION 4 -// #define IMF_PXR24_COMPRESSION 5 -// #define IMF_B44_COMPRESSION 6 -// #define IMF_B44A_COMPRESSION 7 - -static const char *ReadString(std::string *s, const char *ptr) { - // Read untile NULL(\0). - const char *p = ptr; - const char *q = ptr; - while ((*q) != 0) q++; - - (*s) = std::string(p, q); - - return q + 1; // skip '\0' -} - -static bool ReadAttribute(std::string *name, std::string *type, - std::vector *data, size_t *marker_size, - const char *marker, size_t size) { - size_t name_len = strnlen(marker, size); - if (name_len == size) { - // String does not have a terminating character. - return false; - } - *name = std::string(marker, name_len); - - marker += name_len + 1; - size -= name_len + 1; - - size_t type_len = strnlen(marker, size); - if (type_len == size) { - return false; - } - *type = std::string(marker, type_len); - - marker += type_len + 1; - size -= type_len + 1; - - if (size < sizeof(uint32_t)) { - return false; - } - - uint32_t data_len; - memcpy(&data_len, marker, sizeof(uint32_t)); - tinyexr::swap4(reinterpret_cast(&data_len)); - - marker += sizeof(uint32_t); - size -= sizeof(uint32_t); - - if (size < data_len) { - return false; - } - - data->resize(static_cast(data_len)); - memcpy(&data->at(0), marker, static_cast(data_len)); - - *marker_size = name_len + 1 + type_len + 1 + sizeof(uint32_t) + data_len; - return true; -} - -static void WriteAttributeToMemory(std::vector *out, - const char *name, const char *type, - const unsigned char *data, int len) { - out->insert(out->end(), name, name + strlen(name) + 1); - out->insert(out->end(), type, type + strlen(type) + 1); - - int outLen = len; - tinyexr::swap4(reinterpret_cast(&outLen)); - out->insert(out->end(), reinterpret_cast(&outLen), - reinterpret_cast(&outLen) + sizeof(int)); - out->insert(out->end(), data, data + len); -} - -typedef struct { - std::string name; // less than 255 bytes long - int pixel_type; - int x_sampling; - int y_sampling; - unsigned char p_linear; - unsigned char pad[3]; -} ChannelInfo; - -typedef struct { - std::vector channels; - std::vector attributes; - - int data_window[4]; - int line_order; - int display_window[4]; - float screen_window_center[2]; - float screen_window_width; - float pixel_aspect_ratio; - - int chunk_count; - - // Tiled format - int tile_size_x; - int tile_size_y; - int tile_level_mode; - int tile_rounding_mode; - - unsigned int header_len; - - int compression_type; - - void clear() { - channels.clear(); - attributes.clear(); - - data_window[0] = 0; - data_window[1] = 0; - data_window[2] = 0; - data_window[3] = 0; - line_order = 0; - display_window[0] = 0; - display_window[1] = 0; - display_window[2] = 0; - display_window[3] = 0; - screen_window_center[0] = 0.0f; - screen_window_center[1] = 0.0f; - screen_window_width = 0.0f; - pixel_aspect_ratio = 0.0f; - - chunk_count = 0; - - // Tiled format - tile_size_x = 0; - tile_size_y = 0; - tile_level_mode = 0; - tile_rounding_mode = 0; - - header_len = 0; - compression_type = 0; - } -} HeaderInfo; - -static void ReadChannelInfo(std::vector &channels, - const std::vector &data) { - const char *p = reinterpret_cast(&data.at(0)); - - for (;;) { - if ((*p) == 0) { - break; - } - ChannelInfo info; - p = ReadString(&info.name, p); - - memcpy(&info.pixel_type, p, sizeof(int)); - p += 4; - info.p_linear = static_cast(p[0]); // uchar - p += 1 + 3; // reserved: uchar[3] - memcpy(&info.x_sampling, p, sizeof(int)); // int - p += 4; - memcpy(&info.y_sampling, p, sizeof(int)); // int - p += 4; - - tinyexr::swap4(reinterpret_cast(&info.pixel_type)); - tinyexr::swap4(reinterpret_cast(&info.x_sampling)); - tinyexr::swap4(reinterpret_cast(&info.y_sampling)); - - channels.push_back(info); - } -} - -static void WriteChannelInfo(std::vector &data, - const std::vector &channels) { - size_t sz = 0; - - // Calculate total size. - for (size_t c = 0; c < channels.size(); c++) { - sz += strlen(channels[c].name.c_str()) + 1; // +1 for \0 - sz += 16; // 4 * int - } - data.resize(sz + 1); - - unsigned char *p = &data.at(0); - - for (size_t c = 0; c < channels.size(); c++) { - memcpy(p, channels[c].name.c_str(), strlen(channels[c].name.c_str())); - p += strlen(channels[c].name.c_str()); - (*p) = '\0'; - p++; - - int pixel_type = channels[c].pixel_type; - int x_sampling = channels[c].x_sampling; - int y_sampling = channels[c].y_sampling; - tinyexr::swap4(reinterpret_cast(&pixel_type)); - tinyexr::swap4(reinterpret_cast(&x_sampling)); - tinyexr::swap4(reinterpret_cast(&y_sampling)); - - memcpy(p, &pixel_type, sizeof(int)); - p += sizeof(int); - - (*p) = channels[c].p_linear; - p += 4; - - memcpy(p, &x_sampling, sizeof(int)); - p += sizeof(int); - - memcpy(p, &y_sampling, sizeof(int)); - p += sizeof(int); - } - - (*p) = '\0'; -} - -static void CompressZip(unsigned char *dst, - tinyexr::tinyexr_uint64 &compressedSize, - const unsigned char *src, unsigned long src_size) { - std::vector tmpBuf(src_size); - - // - // Apply EXR-specific? postprocess. Grabbed from OpenEXR's - // ImfZipCompressor.cpp - // - - // - // Reorder the pixel data. - // - - const char *srcPtr = reinterpret_cast(src); - - { - char *t1 = reinterpret_cast(&tmpBuf.at(0)); - char *t2 = reinterpret_cast(&tmpBuf.at(0)) + (src_size + 1) / 2; - const char *stop = srcPtr + src_size; - - for (;;) { - if (srcPtr < stop) - *(t1++) = *(srcPtr++); - else - break; - - if (srcPtr < stop) - *(t2++) = *(srcPtr++); - else - break; - } - } - - // - // Predictor. - // - - { - unsigned char *t = &tmpBuf.at(0) + 1; - unsigned char *stop = &tmpBuf.at(0) + src_size; - int p = t[-1]; - - while (t < stop) { - int d = int(t[0]) - p + (128 + 256); - p = t[0]; - t[0] = static_cast(d); - ++t; - } - } - -#if TINYEXR_USE_MINIZ - // - // Compress the data using miniz - // - - miniz::mz_ulong outSize = miniz::mz_compressBound(src_size); - int ret = miniz::mz_compress( - dst, &outSize, static_cast(&tmpBuf.at(0)), - src_size); - assert(ret == miniz::MZ_OK); - (void)ret; - - compressedSize = outSize; -#else - uLong outSize = compressBound(static_cast(src_size)); - int ret = compress(dst, &outSize, static_cast(&tmpBuf.at(0)), - src_size); - assert(ret == Z_OK); - - compressedSize = outSize; -#endif - - // Use uncompressed data when compressed data is larger than uncompressed. - // (Issue 40) - if (compressedSize >= src_size) { - compressedSize = src_size; - memcpy(dst, src, src_size); - } -} - -static void DecompressZip(unsigned char *dst, - unsigned long *uncompressed_size /* inout */, - const unsigned char *src, unsigned long src_size) { - if ((*uncompressed_size) == src_size) { - // Data is not compressed(Issue 40). - memcpy(dst, src, src_size); - return; - } - std::vector tmpBuf(*uncompressed_size); - -#if TINYEXR_USE_MINIZ - int ret = - miniz::mz_uncompress(&tmpBuf.at(0), uncompressed_size, src, src_size); - assert(ret == miniz::MZ_OK); - (void)ret; -#else - int ret = uncompress(&tmpBuf.at(0), uncompressed_size, src, src_size); - assert(ret == Z_OK); - (void)ret; -#endif - - // - // Apply EXR-specific? postprocess. Grabbed from OpenEXR's - // ImfZipCompressor.cpp - // - - // Predictor. - { - unsigned char *t = &tmpBuf.at(0) + 1; - unsigned char *stop = &tmpBuf.at(0) + (*uncompressed_size); - - while (t < stop) { - int d = int(t[-1]) + int(t[0]) - 128; - t[0] = static_cast(d); - ++t; - } - } - - // Reorder the pixel data. - { - const char *t1 = reinterpret_cast(&tmpBuf.at(0)); - const char *t2 = reinterpret_cast(&tmpBuf.at(0)) + - (*uncompressed_size + 1) / 2; - char *s = reinterpret_cast(dst); - char *stop = s + (*uncompressed_size); - - for (;;) { - if (s < stop) - *(s++) = *(t1++); - else - break; - - if (s < stop) - *(s++) = *(t2++); - else - break; - } - } -} - -// RLE code from OpenEXR -------------------------------------- - -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wsign-conversion" -#endif - -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4204) // nonstandard extension used : non-constant - // aggregate initializer (also supported by GNU - // C and C99, so no big deal) -#pragma warning(disable : 4244) // 'initializing': conversion from '__int64' to - // 'int', possible loss of data -#pragma warning( \ - disable : 4267) // 'argument': conversion from '__int64' to 'int', - // possible loss of data -#pragma warning(disable : 4996) // 'strdup': The POSIX name for this item is - // deprecated. Instead, use the ISO C and C++ - // conformant name: _strdup. -#endif - - -const int MIN_RUN_LENGTH = 3; -const int MAX_RUN_LENGTH = 127; - -// -// Compress an array of bytes, using run-length encoding, -// and return the length of the compressed data. -// - -static int rleCompress(int inLength, const char in[], signed char out[]) { - const char *inEnd = in + inLength; - const char *runStart = in; - const char *runEnd = in + 1; - signed char *outWrite = out; - - while (runStart < inEnd) { - while (runEnd < inEnd && *runStart == *runEnd && - runEnd - runStart - 1 < MAX_RUN_LENGTH) { - ++runEnd; - } - - if (runEnd - runStart >= MIN_RUN_LENGTH) { - // - // Compressable run - // - - *outWrite++ = static_cast(runEnd - runStart) - 1; - *outWrite++ = *(reinterpret_cast(runStart)); - runStart = runEnd; - } else { - // - // Uncompressable run - // - - while (runEnd < inEnd && - ((runEnd + 1 >= inEnd || *runEnd != *(runEnd + 1)) || - (runEnd + 2 >= inEnd || *(runEnd + 1) != *(runEnd + 2))) && - runEnd - runStart < MAX_RUN_LENGTH) { - ++runEnd; - } - - *outWrite++ = static_cast(runStart - runEnd); - - while (runStart < runEnd) { - *outWrite++ = *(reinterpret_cast(runStart++)); - } - } - - ++runEnd; - } - - return static_cast(outWrite - out); -} - -// -// Uncompress an array of bytes compressed with rleCompress(). -// Returns the length of the oncompressed data, or 0 if the -// length of the uncompressed data would be more than maxLength. -// - -static int rleUncompress(int inLength, int maxLength, const signed char in[], - char out[]) { - char *outStart = out; - - while (inLength > 0) { - if (*in < 0) { - int count = -(static_cast(*in++)); - inLength -= count + 1; - - if (0 > (maxLength -= count)) return 0; - - memcpy(out, in, count); - out += count; - in += count; - } else { - int count = *in++; - inLength -= 2; - - if (0 > (maxLength -= count + 1)) return 0; - - memset(out, *reinterpret_cast(in), count + 1); - out += count + 1; - - in++; - } - } - - return static_cast(out - outStart); -} - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -// End of RLE code from OpenEXR ----------------------------------- - -static void CompressRle(unsigned char *dst, - tinyexr::tinyexr_uint64 &compressedSize, - const unsigned char *src, unsigned long src_size) { - std::vector tmpBuf(src_size); - - // - // Apply EXR-specific? postprocess. Grabbed from OpenEXR's - // ImfRleCompressor.cpp - // - - // - // Reorder the pixel data. - // - - const char *srcPtr = reinterpret_cast(src); - - { - char *t1 = reinterpret_cast(&tmpBuf.at(0)); - char *t2 = reinterpret_cast(&tmpBuf.at(0)) + (src_size + 1) / 2; - const char *stop = srcPtr + src_size; - - for (;;) { - if (srcPtr < stop) - *(t1++) = *(srcPtr++); - else - break; - - if (srcPtr < stop) - *(t2++) = *(srcPtr++); - else - break; - } - } - - // - // Predictor. - // - - { - unsigned char *t = &tmpBuf.at(0) + 1; - unsigned char *stop = &tmpBuf.at(0) + src_size; - int p = t[-1]; - - while (t < stop) { - int d = int(t[0]) - p + (128 + 256); - p = t[0]; - t[0] = static_cast(d); - ++t; - } - } - - // outSize will be (srcSiz * 3) / 2 at max. - int outSize = rleCompress(static_cast(src_size), - reinterpret_cast(&tmpBuf.at(0)), - reinterpret_cast(dst)); - assert(outSize > 0); - - compressedSize = static_cast(outSize); - - // Use uncompressed data when compressed data is larger than uncompressed. - // (Issue 40) - if (compressedSize >= src_size) { - compressedSize = src_size; - memcpy(dst, src, src_size); - } -} - -static void DecompressRle(unsigned char *dst, - const unsigned long uncompressed_size, - const unsigned char *src, unsigned long src_size) { - if (uncompressed_size == src_size) { - // Data is not compressed(Issue 40). - memcpy(dst, src, src_size); - return; - } - - std::vector tmpBuf(uncompressed_size); - - int ret = rleUncompress(static_cast(src_size), - static_cast(uncompressed_size), - reinterpret_cast(src), - reinterpret_cast(&tmpBuf.at(0))); - assert(ret == static_cast(uncompressed_size)); - (void)ret; - - // - // Apply EXR-specific? postprocess. Grabbed from OpenEXR's - // ImfRleCompressor.cpp - // - - // Predictor. - { - unsigned char *t = &tmpBuf.at(0) + 1; - unsigned char *stop = &tmpBuf.at(0) + uncompressed_size; - - while (t < stop) { - int d = int(t[-1]) + int(t[0]) - 128; - t[0] = static_cast(d); - ++t; - } - } - - // Reorder the pixel data. - { - const char *t1 = reinterpret_cast(&tmpBuf.at(0)); - const char *t2 = reinterpret_cast(&tmpBuf.at(0)) + - (uncompressed_size + 1) / 2; - char *s = reinterpret_cast(dst); - char *stop = s + uncompressed_size; - - for (;;) { - if (s < stop) - *(s++) = *(t1++); - else - break; - - if (s < stop) - *(s++) = *(t2++); - else - break; - } - } -} - -#if TINYEXR_USE_PIZ - -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wc++11-long-long" -#pragma clang diagnostic ignored "-Wold-style-cast" -#pragma clang diagnostic ignored "-Wpadded" -#pragma clang diagnostic ignored "-Wsign-conversion" -#pragma clang diagnostic ignored "-Wc++11-extensions" -#pragma clang diagnostic ignored "-Wconversion" -#endif - -// -// PIZ compress/uncompress, based on OpenEXR's ImfPizCompressor.cpp -// -// ----------------------------------------------------------------- -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC) -// (3 clause BSD license) -// - -struct PIZChannelData { - unsigned short *start; - unsigned short *end; - int nx; - int ny; - int ys; - int size; -}; - -//----------------------------------------------------------------------------- -// -// 16-bit Haar Wavelet encoding and decoding -// -// The source code in this file is derived from the encoding -// and decoding routines written by Christian Rouet for his -// PIZ image file format. -// -//----------------------------------------------------------------------------- - -// -// Wavelet basis functions without modulo arithmetic; they produce -// the best compression ratios when the wavelet-transformed data are -// Huffman-encoded, but the wavelet transform works only for 14-bit -// data (untransformed data values must be less than (1 << 14)). -// - -inline void wenc14(unsigned short a, unsigned short b, unsigned short &l, - unsigned short &h) { - short as = static_cast(a); - short bs = static_cast(b); - - short ms = (as + bs) >> 1; - short ds = as - bs; - - l = static_cast(ms); - h = static_cast(ds); -} - -inline void wdec14(unsigned short l, unsigned short h, unsigned short &a, - unsigned short &b) { - short ls = static_cast(l); - short hs = static_cast(h); - - int hi = hs; - int ai = ls + (hi & 1) + (hi >> 1); - - short as = static_cast(ai); - short bs = static_cast(ai - hi); - - a = static_cast(as); - b = static_cast(bs); -} - -// -// Wavelet basis functions with modulo arithmetic; they work with full -// 16-bit data, but Huffman-encoding the wavelet-transformed data doesn't -// compress the data quite as well. -// - -const int NBITS = 16; -const int A_OFFSET = 1 << (NBITS - 1); -const int M_OFFSET = 1 << (NBITS - 1); -const int MOD_MASK = (1 << NBITS) - 1; - -inline void wenc16(unsigned short a, unsigned short b, unsigned short &l, - unsigned short &h) { - int ao = (a + A_OFFSET) & MOD_MASK; - int m = ((ao + b) >> 1); - int d = ao - b; - - if (d < 0) m = (m + M_OFFSET) & MOD_MASK; - - d &= MOD_MASK; - - l = static_cast(m); - h = static_cast(d); -} - -inline void wdec16(unsigned short l, unsigned short h, unsigned short &a, - unsigned short &b) { - int m = l; - int d = h; - int bb = (m - (d >> 1)) & MOD_MASK; - int aa = (d + bb - A_OFFSET) & MOD_MASK; - b = static_cast(bb); - a = static_cast(aa); -} - -// -// 2D Wavelet encoding: -// - -static void wav2Encode( - unsigned short *in, // io: values are transformed in place - int nx, // i : x size - int ox, // i : x offset - int ny, // i : y size - int oy, // i : y offset - unsigned short mx) // i : maximum in[x][y] value -{ - bool w14 = (mx < (1 << 14)); - int n = (nx > ny) ? ny : nx; - int p = 1; // == 1 << level - int p2 = 2; // == 1 << (level+1) - - // - // Hierachical loop on smaller dimension n - // - - while (p2 <= n) { - unsigned short *py = in; - unsigned short *ey = in + oy * (ny - p2); - int oy1 = oy * p; - int oy2 = oy * p2; - int ox1 = ox * p; - int ox2 = ox * p2; - unsigned short i00, i01, i10, i11; - - // - // Y loop - // - - for (; py <= ey; py += oy2) { - unsigned short *px = py; - unsigned short *ex = py + ox * (nx - p2); - - // - // X loop - // - - for (; px <= ex; px += ox2) { - unsigned short *p01 = px + ox1; - unsigned short *p10 = px + oy1; - unsigned short *p11 = p10 + ox1; - - // - // 2D wavelet encoding - // - - if (w14) { - wenc14(*px, *p01, i00, i01); - wenc14(*p10, *p11, i10, i11); - wenc14(i00, i10, *px, *p10); - wenc14(i01, i11, *p01, *p11); - } else { - wenc16(*px, *p01, i00, i01); - wenc16(*p10, *p11, i10, i11); - wenc16(i00, i10, *px, *p10); - wenc16(i01, i11, *p01, *p11); - } - } - - // - // Encode (1D) odd column (still in Y loop) - // - - if (nx & p) { - unsigned short *p10 = px + oy1; - - if (w14) - wenc14(*px, *p10, i00, *p10); - else - wenc16(*px, *p10, i00, *p10); - - *px = i00; - } - } - - // - // Encode (1D) odd line (must loop in X) - // - - if (ny & p) { - unsigned short *px = py; - unsigned short *ex = py + ox * (nx - p2); - - for (; px <= ex; px += ox2) { - unsigned short *p01 = px + ox1; - - if (w14) - wenc14(*px, *p01, i00, *p01); - else - wenc16(*px, *p01, i00, *p01); - - *px = i00; - } - } - - // - // Next level - // - - p = p2; - p2 <<= 1; - } -} - -// -// 2D Wavelet decoding: -// - -static void wav2Decode( - unsigned short *in, // io: values are transformed in place - int nx, // i : x size - int ox, // i : x offset - int ny, // i : y size - int oy, // i : y offset - unsigned short mx) // i : maximum in[x][y] value -{ - bool w14 = (mx < (1 << 14)); - int n = (nx > ny) ? ny : nx; - int p = 1; - int p2; - - // - // Search max level - // - - while (p <= n) p <<= 1; - - p >>= 1; - p2 = p; - p >>= 1; - - // - // Hierarchical loop on smaller dimension n - // - - while (p >= 1) { - unsigned short *py = in; - unsigned short *ey = in + oy * (ny - p2); - int oy1 = oy * p; - int oy2 = oy * p2; - int ox1 = ox * p; - int ox2 = ox * p2; - unsigned short i00, i01, i10, i11; - - // - // Y loop - // - - for (; py <= ey; py += oy2) { - unsigned short *px = py; - unsigned short *ex = py + ox * (nx - p2); - - // - // X loop - // - - for (; px <= ex; px += ox2) { - unsigned short *p01 = px + ox1; - unsigned short *p10 = px + oy1; - unsigned short *p11 = p10 + ox1; - - // - // 2D wavelet decoding - // - - if (w14) { - wdec14(*px, *p10, i00, i10); - wdec14(*p01, *p11, i01, i11); - wdec14(i00, i01, *px, *p01); - wdec14(i10, i11, *p10, *p11); - } else { - wdec16(*px, *p10, i00, i10); - wdec16(*p01, *p11, i01, i11); - wdec16(i00, i01, *px, *p01); - wdec16(i10, i11, *p10, *p11); - } - } - - // - // Decode (1D) odd column (still in Y loop) - // - - if (nx & p) { - unsigned short *p10 = px + oy1; - - if (w14) - wdec14(*px, *p10, i00, *p10); - else - wdec16(*px, *p10, i00, *p10); - - *px = i00; - } - } - - // - // Decode (1D) odd line (must loop in X) - // - - if (ny & p) { - unsigned short *px = py; - unsigned short *ex = py + ox * (nx - p2); - - for (; px <= ex; px += ox2) { - unsigned short *p01 = px + ox1; - - if (w14) - wdec14(*px, *p01, i00, *p01); - else - wdec16(*px, *p01, i00, *p01); - - *px = i00; - } - } - - // - // Next level - // - - p2 = p; - p >>= 1; - } -} - -//----------------------------------------------------------------------------- -// -// 16-bit Huffman compression and decompression. -// -// The source code in this file is derived from the 8-bit -// Huffman compression and decompression routines written -// by Christian Rouet for his PIZ image file format. -// -//----------------------------------------------------------------------------- - -// Adds some modification for tinyexr. - -const int HUF_ENCBITS = 16; // literal (value) bit length -const int HUF_DECBITS = 14; // decoding bit size (>= 8) - -const int HUF_ENCSIZE = (1 << HUF_ENCBITS) + 1; // encoding table size -const int HUF_DECSIZE = 1 << HUF_DECBITS; // decoding table size -const int HUF_DECMASK = HUF_DECSIZE - 1; - -struct HufDec { // short code long code - //------------------------------- - int len : 8; // code length 0 - int lit : 24; // lit p size - int *p; // 0 lits -}; - -inline long long hufLength(long long code) { return code & 63; } - -inline long long hufCode(long long code) { return code >> 6; } - -inline void outputBits(int nBits, long long bits, long long &c, int &lc, - char *&out) { - c <<= nBits; - lc += nBits; - - c |= bits; - - while (lc >= 8) *out++ = static_cast((c >> (lc -= 8))); -} - -inline long long getBits(int nBits, long long &c, int &lc, const char *&in) { - while (lc < nBits) { - c = (c << 8) | *(reinterpret_cast(in++)); - lc += 8; - } - - lc -= nBits; - return (c >> lc) & ((1 << nBits) - 1); -} - -// -// ENCODING TABLE BUILDING & (UN)PACKING -// - -// -// Build a "canonical" Huffman code table: -// - for each (uncompressed) symbol, hcode contains the length -// of the corresponding code (in the compressed data) -// - canonical codes are computed and stored in hcode -// - the rules for constructing canonical codes are as follows: -// * shorter codes (if filled with zeroes to the right) -// have a numerically higher value than longer codes -// * for codes with the same length, numerical values -// increase with numerical symbol values -// - because the canonical code table can be constructed from -// symbol lengths alone, the code table can be transmitted -// without sending the actual code values -// - see http://www.compressconsult.com/huffman/ -// - -static void hufCanonicalCodeTable(long long hcode[HUF_ENCSIZE]) { - long long n[59]; - - // - // For each i from 0 through 58, count the - // number of different codes of length i, and - // store the count in n[i]. - // - - for (int i = 0; i <= 58; ++i) n[i] = 0; - - for (int i = 0; i < HUF_ENCSIZE; ++i) n[hcode[i]] += 1; - - // - // For each i from 58 through 1, compute the - // numerically lowest code with length i, and - // store that code in n[i]. - // - - long long c = 0; - - for (int i = 58; i > 0; --i) { - long long nc = ((c + n[i]) >> 1); - n[i] = c; - c = nc; - } - - // - // hcode[i] contains the length, l, of the - // code for symbol i. Assign the next available - // code of length l to the symbol and store both - // l and the code in hcode[i]. - // - - for (int i = 0; i < HUF_ENCSIZE; ++i) { - int l = static_cast(hcode[i]); - - if (l > 0) hcode[i] = l | (n[l]++ << 6); - } -} - -// -// Compute Huffman codes (based on frq input) and store them in frq: -// - code structure is : [63:lsb - 6:msb] | [5-0: bit length]; -// - max code length is 58 bits; -// - codes outside the range [im-iM] have a null length (unused values); -// - original frequencies are destroyed; -// - encoding tables are used by hufEncode() and hufBuildDecTable(); -// - -struct FHeapCompare { - bool operator()(long long *a, long long *b) { return *a > *b; } -}; - -static void hufBuildEncTable( - long long *frq, // io: input frequencies [HUF_ENCSIZE], output table - int *im, // o: min frq index - int *iM) // o: max frq index -{ - // - // This function assumes that when it is called, array frq - // indicates the frequency of all possible symbols in the data - // that are to be Huffman-encoded. (frq[i] contains the number - // of occurrences of symbol i in the data.) - // - // The loop below does three things: - // - // 1) Finds the minimum and maximum indices that point - // to non-zero entries in frq: - // - // frq[im] != 0, and frq[i] == 0 for all i < im - // frq[iM] != 0, and frq[i] == 0 for all i > iM - // - // 2) Fills array fHeap with pointers to all non-zero - // entries in frq. - // - // 3) Initializes array hlink such that hlink[i] == i - // for all array entries. - // - - int hlink[HUF_ENCSIZE]; - long long *fHeap[HUF_ENCSIZE]; - - *im = 0; - - while (!frq[*im]) (*im)++; - - int nf = 0; - - for (int i = *im; i < HUF_ENCSIZE; i++) { - hlink[i] = i; - - if (frq[i]) { - fHeap[nf] = &frq[i]; - nf++; - *iM = i; - } - } - - // - // Add a pseudo-symbol, with a frequency count of 1, to frq; - // adjust the fHeap and hlink array accordingly. Function - // hufEncode() uses the pseudo-symbol for run-length encoding. - // - - (*iM)++; - frq[*iM] = 1; - fHeap[nf] = &frq[*iM]; - nf++; - - // - // Build an array, scode, such that scode[i] contains the number - // of bits assigned to symbol i. Conceptually this is done by - // constructing a tree whose leaves are the symbols with non-zero - // frequency: - // - // Make a heap that contains all symbols with a non-zero frequency, - // with the least frequent symbol on top. - // - // Repeat until only one symbol is left on the heap: - // - // Take the two least frequent symbols off the top of the heap. - // Create a new node that has first two nodes as children, and - // whose frequency is the sum of the frequencies of the first - // two nodes. Put the new node back into the heap. - // - // The last node left on the heap is the root of the tree. For each - // leaf node, the distance between the root and the leaf is the length - // of the code for the corresponding symbol. - // - // The loop below doesn't actually build the tree; instead we compute - // the distances of the leaves from the root on the fly. When a new - // node is added to the heap, then that node's descendants are linked - // into a single linear list that starts at the new node, and the code - // lengths of the descendants (that is, their distance from the root - // of the tree) are incremented by one. - // - - std::make_heap(&fHeap[0], &fHeap[nf], FHeapCompare()); - - long long scode[HUF_ENCSIZE]; - memset(scode, 0, sizeof(long long) * HUF_ENCSIZE); - - while (nf > 1) { - // - // Find the indices, mm and m, of the two smallest non-zero frq - // values in fHeap, add the smallest frq to the second-smallest - // frq, and remove the smallest frq value from fHeap. - // - - int mm = fHeap[0] - frq; - std::pop_heap(&fHeap[0], &fHeap[nf], FHeapCompare()); - --nf; - - int m = fHeap[0] - frq; - std::pop_heap(&fHeap[0], &fHeap[nf], FHeapCompare()); - - frq[m] += frq[mm]; - std::push_heap(&fHeap[0], &fHeap[nf], FHeapCompare()); - - // - // The entries in scode are linked into lists with the - // entries in hlink serving as "next" pointers and with - // the end of a list marked by hlink[j] == j. - // - // Traverse the lists that start at scode[m] and scode[mm]. - // For each element visited, increment the length of the - // corresponding code by one bit. (If we visit scode[j] - // during the traversal, then the code for symbol j becomes - // one bit longer.) - // - // Merge the lists that start at scode[m] and scode[mm] - // into a single list that starts at scode[m]. - // - - // - // Add a bit to all codes in the first list. - // - - for (int j = m;; j = hlink[j]) { - scode[j]++; - - assert(scode[j] <= 58); - - if (hlink[j] == j) { - // - // Merge the two lists. - // - - hlink[j] = mm; - break; - } - } - - // - // Add a bit to all codes in the second list - // - - for (int j = mm;; j = hlink[j]) { - scode[j]++; - - assert(scode[j] <= 58); - - if (hlink[j] == j) break; - } - } - - // - // Build a canonical Huffman code table, replacing the code - // lengths in scode with (code, code length) pairs. Copy the - // code table from scode into frq. - // - - hufCanonicalCodeTable(scode); - memcpy(frq, scode, sizeof(long long) * HUF_ENCSIZE); -} - -// -// Pack an encoding table: -// - only code lengths, not actual codes, are stored -// - runs of zeroes are compressed as follows: -// -// unpacked packed -// -------------------------------- -// 1 zero 0 (6 bits) -// 2 zeroes 59 -// 3 zeroes 60 -// 4 zeroes 61 -// 5 zeroes 62 -// n zeroes (6 or more) 63 n-6 (6 + 8 bits) -// - -const int SHORT_ZEROCODE_RUN = 59; -const int LONG_ZEROCODE_RUN = 63; -const int SHORTEST_LONG_RUN = 2 + LONG_ZEROCODE_RUN - SHORT_ZEROCODE_RUN; -const int LONGEST_LONG_RUN = 255 + SHORTEST_LONG_RUN; - -static void hufPackEncTable( - const long long *hcode, // i : encoding table [HUF_ENCSIZE] - int im, // i : min hcode index - int iM, // i : max hcode index - char **pcode) // o: ptr to packed table (updated) -{ - char *p = *pcode; - long long c = 0; - int lc = 0; - - for (; im <= iM; im++) { - int l = hufLength(hcode[im]); - - if (l == 0) { - int zerun = 1; - - while ((im < iM) && (zerun < LONGEST_LONG_RUN)) { - if (hufLength(hcode[im + 1]) > 0) break; - im++; - zerun++; - } - - if (zerun >= 2) { - if (zerun >= SHORTEST_LONG_RUN) { - outputBits(6, LONG_ZEROCODE_RUN, c, lc, p); - outputBits(8, zerun - SHORTEST_LONG_RUN, c, lc, p); - } else { - outputBits(6, SHORT_ZEROCODE_RUN + zerun - 2, c, lc, p); - } - continue; - } - } - - outputBits(6, l, c, lc, p); - } - - if (lc > 0) *p++ = (unsigned char)(c << (8 - lc)); - - *pcode = p; -} - -// -// Unpack an encoding table packed by hufPackEncTable(): -// - -static bool hufUnpackEncTable( - const char **pcode, // io: ptr to packed table (updated) - int ni, // i : input size (in bytes) - int im, // i : min hcode index - int iM, // i : max hcode index - long long *hcode) // o: encoding table [HUF_ENCSIZE] -{ - memset(hcode, 0, sizeof(long long) * HUF_ENCSIZE); - - const char *p = *pcode; - long long c = 0; - int lc = 0; - - for (; im <= iM; im++) { - if (p - *pcode > ni) { - return false; - } - - long long l = hcode[im] = getBits(6, c, lc, p); // code length - - if (l == (long long)LONG_ZEROCODE_RUN) { - if (p - *pcode > ni) { - return false; - } - - int zerun = getBits(8, c, lc, p) + SHORTEST_LONG_RUN; - - if (im + zerun > iM + 1) { - return false; - } - - while (zerun--) hcode[im++] = 0; - - im--; - } else if (l >= (long long)SHORT_ZEROCODE_RUN) { - int zerun = l - SHORT_ZEROCODE_RUN + 2; - - if (im + zerun > iM + 1) { - return false; - } - - while (zerun--) hcode[im++] = 0; - - im--; - } - } - - *pcode = const_cast(p); - - hufCanonicalCodeTable(hcode); - - return true; -} - -// -// DECODING TABLE BUILDING -// - -// -// Clear a newly allocated decoding table so that it contains only zeroes. -// - -static void hufClearDecTable(HufDec *hdecod) // io: (allocated by caller) -// decoding table [HUF_DECSIZE] -{ - for (int i = 0; i < HUF_DECSIZE; i++) { - hdecod[i].len = 0; - hdecod[i].lit = 0; - hdecod[i].p = NULL; - } - // memset(hdecod, 0, sizeof(HufDec) * HUF_DECSIZE); -} - -// -// Build a decoding hash table based on the encoding table hcode: -// - short codes (<= HUF_DECBITS) are resolved with a single table access; -// - long code entry allocations are not optimized, because long codes are -// unfrequent; -// - decoding tables are used by hufDecode(); -// - -static bool hufBuildDecTable(const long long *hcode, // i : encoding table - int im, // i : min index in hcode - int iM, // i : max index in hcode - HufDec *hdecod) // o: (allocated by caller) -// decoding table [HUF_DECSIZE] -{ - // - // Init hashtable & loop on all codes. - // Assumes that hufClearDecTable(hdecod) has already been called. - // - - for (; im <= iM; im++) { - long long c = hufCode(hcode[im]); - int l = hufLength(hcode[im]); - - if (c >> l) { - // - // Error: c is supposed to be an l-bit code, - // but c contains a value that is greater - // than the largest l-bit number. - // - - // invalidTableEntry(); - return false; - } - - if (l > HUF_DECBITS) { - // - // Long code: add a secondary entry - // - - HufDec *pl = hdecod + (c >> (l - HUF_DECBITS)); - - if (pl->len) { - // - // Error: a short code has already - // been stored in table entry *pl. - // - - // invalidTableEntry(); - return false; - } - - pl->lit++; - - if (pl->p) { - int *p = pl->p; - pl->p = new int[pl->lit]; - - for (int i = 0; i < pl->lit - 1; ++i) pl->p[i] = p[i]; - - delete[] p; - } else { - pl->p = new int[1]; - } - - pl->p[pl->lit - 1] = im; - } else if (l) { - // - // Short code: init all primary entries - // - - HufDec *pl = hdecod + (c << (HUF_DECBITS - l)); - - for (long long i = 1ULL << (HUF_DECBITS - l); i > 0; i--, pl++) { - if (pl->len || pl->p) { - // - // Error: a short code or a long code has - // already been stored in table entry *pl. - // - - // invalidTableEntry(); - return false; - } - - pl->len = l; - pl->lit = im; - } - } - } - - return true; -} - -// -// Free the long code entries of a decoding table built by hufBuildDecTable() -// - -static void hufFreeDecTable(HufDec *hdecod) // io: Decoding table -{ - for (int i = 0; i < HUF_DECSIZE; i++) { - if (hdecod[i].p) { - delete[] hdecod[i].p; - hdecod[i].p = 0; - } - } -} - -// -// ENCODING -// - -inline void outputCode(long long code, long long &c, int &lc, char *&out) { - outputBits(hufLength(code), hufCode(code), c, lc, out); -} - -inline void sendCode(long long sCode, int runCount, long long runCode, - long long &c, int &lc, char *&out) { - // - // Output a run of runCount instances of the symbol sCount. - // Output the symbols explicitly, or if that is shorter, output - // the sCode symbol once followed by a runCode symbol and runCount - // expressed as an 8-bit number. - // - - if (hufLength(sCode) + hufLength(runCode) + 8 < hufLength(sCode) * runCount) { - outputCode(sCode, c, lc, out); - outputCode(runCode, c, lc, out); - outputBits(8, runCount, c, lc, out); - } else { - while (runCount-- >= 0) outputCode(sCode, c, lc, out); - } -} - -// -// Encode (compress) ni values based on the Huffman encoding table hcode: -// - -static int hufEncode // return: output size (in bits) - (const long long *hcode, // i : encoding table - const unsigned short *in, // i : uncompressed input buffer - const int ni, // i : input buffer size (in bytes) - int rlc, // i : rl code - char *out) // o: compressed output buffer -{ - char *outStart = out; - long long c = 0; // bits not yet written to out - int lc = 0; // number of valid bits in c (LSB) - int s = in[0]; - int cs = 0; - - // - // Loop on input values - // - - for (int i = 1; i < ni; i++) { - // - // Count same values or send code - // - - if (s == in[i] && cs < 255) { - cs++; - } else { - sendCode(hcode[s], cs, hcode[rlc], c, lc, out); - cs = 0; - } - - s = in[i]; - } - - // - // Send remaining code - // - - sendCode(hcode[s], cs, hcode[rlc], c, lc, out); - - if (lc) *out = (c << (8 - lc)) & 0xff; - - return (out - outStart) * 8 + lc; -} - -// -// DECODING -// - -// -// In order to force the compiler to inline them, -// getChar() and getCode() are implemented as macros -// instead of "inline" functions. -// - -#define getChar(c, lc, in) \ - { \ - c = (c << 8) | *(unsigned char *)(in++); \ - lc += 8; \ - } - -#define getCode(po, rlc, c, lc, in, out, oe) \ - { \ - if (po == rlc) { \ - if (lc < 8) getChar(c, lc, in); \ - \ - lc -= 8; \ - \ - unsigned char cs = (c >> lc); \ - \ - if (out + cs > oe) return false; \ - \ - unsigned short s = out[-1]; \ - \ - while (cs-- > 0) *out++ = s; \ - } else if (out < oe) { \ - *out++ = po; \ - } else { \ - return false; \ - } \ - } - -// -// Decode (uncompress) ni bits based on encoding & decoding tables: -// - -static bool hufDecode(const long long *hcode, // i : encoding table - const HufDec *hdecod, // i : decoding table - const char *in, // i : compressed input buffer - int ni, // i : input size (in bits) - int rlc, // i : run-length code - int no, // i : expected output size (in bytes) - unsigned short *out) // o: uncompressed output buffer -{ - long long c = 0; - int lc = 0; - unsigned short *outb = out; - unsigned short *oe = out + no; - const char *ie = in + (ni + 7) / 8; // input byte size - - // - // Loop on input bytes - // - - while (in < ie) { - getChar(c, lc, in); - - // - // Access decoding table - // - - while (lc >= HUF_DECBITS) { - const HufDec pl = hdecod[(c >> (lc - HUF_DECBITS)) & HUF_DECMASK]; - - if (pl.len) { - // - // Get short code - // - - lc -= pl.len; - getCode(pl.lit, rlc, c, lc, in, out, oe); - } else { - if (!pl.p) { - return false; - } - // invalidCode(); // wrong code - - // - // Search long code - // - - int j; - - for (j = 0; j < pl.lit; j++) { - int l = hufLength(hcode[pl.p[j]]); - - while (lc < l && in < ie) // get more bits - getChar(c, lc, in); - - if (lc >= l) { - if (hufCode(hcode[pl.p[j]]) == - ((c >> (lc - l)) & (((long long)(1) << l) - 1))) { - // - // Found : get long code - // - - lc -= l; - getCode(pl.p[j], rlc, c, lc, in, out, oe); - break; - } - } - } - - if (j == pl.lit) { - return false; - // invalidCode(); // Not found - } - } - } - } - - // - // Get remaining (short) codes - // - - int i = (8 - ni) & 7; - c >>= i; - lc -= i; - - while (lc > 0) { - const HufDec pl = hdecod[(c << (HUF_DECBITS - lc)) & HUF_DECMASK]; - - if (pl.len) { - lc -= pl.len; - getCode(pl.lit, rlc, c, lc, in, out, oe); - } else { - return false; - // invalidCode(); // wrong (long) code - } - } - - if (out - outb != no) { - return false; - } - // notEnoughData (); - - return true; -} - -static void countFrequencies(long long freq[HUF_ENCSIZE], - const unsigned short data[/*n*/], int n) { - for (int i = 0; i < HUF_ENCSIZE; ++i) freq[i] = 0; - - for (int i = 0; i < n; ++i) ++freq[data[i]]; -} - -static void writeUInt(char buf[4], unsigned int i) { - unsigned char *b = (unsigned char *)buf; - - b[0] = i; - b[1] = i >> 8; - b[2] = i >> 16; - b[3] = i >> 24; -} - -static unsigned int readUInt(const char buf[4]) { - const unsigned char *b = (const unsigned char *)buf; - - return (b[0] & 0x000000ff) | ((b[1] << 8) & 0x0000ff00) | - ((b[2] << 16) & 0x00ff0000) | ((b[3] << 24) & 0xff000000); -} - -// -// EXTERNAL INTERFACE -// - -static int hufCompress(const unsigned short raw[], int nRaw, - char compressed[]) { - if (nRaw == 0) return 0; - - long long freq[HUF_ENCSIZE]; - - countFrequencies(freq, raw, nRaw); - - int im = 0; - int iM = 0; - hufBuildEncTable(freq, &im, &iM); - - char *tableStart = compressed + 20; - char *tableEnd = tableStart; - hufPackEncTable(freq, im, iM, &tableEnd); - int tableLength = tableEnd - tableStart; - - char *dataStart = tableEnd; - int nBits = hufEncode(freq, raw, nRaw, iM, dataStart); - int data_length = (nBits + 7) / 8; - - writeUInt(compressed, im); - writeUInt(compressed + 4, iM); - writeUInt(compressed + 8, tableLength); - writeUInt(compressed + 12, nBits); - writeUInt(compressed + 16, 0); // room for future extensions - - return dataStart + data_length - compressed; -} - -static bool hufUncompress(const char compressed[], int nCompressed, - unsigned short raw[], int nRaw) { - if (nCompressed == 0) { - if (nRaw != 0) return false; - - return false; - } - - int im = readUInt(compressed); - int iM = readUInt(compressed + 4); - // int tableLength = readUInt (compressed + 8); - int nBits = readUInt(compressed + 12); - - if (im < 0 || im >= HUF_ENCSIZE || iM < 0 || iM >= HUF_ENCSIZE) return false; - - const char *ptr = compressed + 20; - - // - // Fast decoder needs at least 2x64-bits of compressed data, and - // needs to be run-able on this platform. Otherwise, fall back - // to the original decoder - // - - // if (FastHufDecoder::enabled() && nBits > 128) - //{ - // FastHufDecoder fhd (ptr, nCompressed - (ptr - compressed), im, iM, iM); - // fhd.decode ((unsigned char*)ptr, nBits, raw, nRaw); - //} - // else - { - std::vector freq(HUF_ENCSIZE); - std::vector hdec(HUF_DECSIZE); - - hufClearDecTable(&hdec.at(0)); - - hufUnpackEncTable(&ptr, nCompressed - (ptr - compressed), im, iM, - &freq.at(0)); - - { - if (nBits > 8 * (nCompressed - (ptr - compressed))) { - return false; - } - - hufBuildDecTable(&freq.at(0), im, iM, &hdec.at(0)); - hufDecode(&freq.at(0), &hdec.at(0), ptr, nBits, iM, nRaw, raw); - } - // catch (...) - //{ - // hufFreeDecTable (hdec); - // throw; - //} - - hufFreeDecTable(&hdec.at(0)); - } - - return true; -} - -// -// Functions to compress the range of values in the pixel data -// - -const int USHORT_RANGE = (1 << 16); -const int BITMAP_SIZE = (USHORT_RANGE >> 3); - -static void bitmapFromData(const unsigned short data[/*nData*/], int nData, - unsigned char bitmap[BITMAP_SIZE], - unsigned short &minNonZero, - unsigned short &maxNonZero) { - for (int i = 0; i < BITMAP_SIZE; ++i) bitmap[i] = 0; - - for (int i = 0; i < nData; ++i) bitmap[data[i] >> 3] |= (1 << (data[i] & 7)); - - bitmap[0] &= ~1; // zero is not explicitly stored in - // the bitmap; we assume that the - // data always contain zeroes - minNonZero = BITMAP_SIZE - 1; - maxNonZero = 0; - - for (int i = 0; i < BITMAP_SIZE; ++i) { - if (bitmap[i]) { - if (minNonZero > i) minNonZero = i; - if (maxNonZero < i) maxNonZero = i; - } - } -} - -static unsigned short forwardLutFromBitmap( - const unsigned char bitmap[BITMAP_SIZE], unsigned short lut[USHORT_RANGE]) { - int k = 0; - - for (int i = 0; i < USHORT_RANGE; ++i) { - if ((i == 0) || (bitmap[i >> 3] & (1 << (i & 7)))) - lut[i] = k++; - else - lut[i] = 0; - } - - return k - 1; // maximum value stored in lut[], -} // i.e. number of ones in bitmap minus 1 - -static unsigned short reverseLutFromBitmap( - const unsigned char bitmap[BITMAP_SIZE], unsigned short lut[USHORT_RANGE]) { - int k = 0; - - for (int i = 0; i < USHORT_RANGE; ++i) { - if ((i == 0) || (bitmap[i >> 3] & (1 << (i & 7)))) lut[k++] = i; - } - - int n = k - 1; - - while (k < USHORT_RANGE) lut[k++] = 0; - - return n; // maximum k where lut[k] is non-zero, -} // i.e. number of ones in bitmap minus 1 - -static void applyLut(const unsigned short lut[USHORT_RANGE], - unsigned short data[/*nData*/], int nData) { - for (int i = 0; i < nData; ++i) data[i] = lut[data[i]]; -} - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif // __clang__ - -#ifdef _MSC_VER -#pragma warning(pop) -#endif - - -static bool CompressPiz(unsigned char *outPtr, unsigned int *outSize, - const unsigned char *inPtr, size_t inSize, - const std::vector &channelInfo, - int data_width, int num_lines) { - unsigned char bitmap[BITMAP_SIZE]; - unsigned short minNonZero; - unsigned short maxNonZero; - -#if !MINIZ_LITTLE_ENDIAN - // @todo { PIZ compression on BigEndian architecture. } - assert(0); - return false; -#endif - - // Assume `inSize` is multiple of 2 or 4. - std::vector tmpBuffer(inSize / sizeof(unsigned short)); - - std::vector channelData(channelInfo.size()); - unsigned short *tmpBufferEnd = &tmpBuffer.at(0); - - for (size_t c = 0; c < channelData.size(); c++) { - PIZChannelData &cd = channelData[c]; - - cd.start = tmpBufferEnd; - cd.end = cd.start; - - cd.nx = data_width; - cd.ny = num_lines; - // cd.ys = c.channel().ySampling; - - size_t pixelSize = sizeof(int); // UINT and FLOAT - if (channelInfo[c].pixel_type == TINYEXR_PIXELTYPE_HALF) { - pixelSize = sizeof(short); - } - - cd.size = static_cast(pixelSize / sizeof(short)); - - tmpBufferEnd += cd.nx * cd.ny * cd.size; - } - - const unsigned char *ptr = inPtr; - for (int y = 0; y < num_lines; ++y) { - for (size_t i = 0; i < channelData.size(); ++i) { - PIZChannelData &cd = channelData[i]; - - // if (modp (y, cd.ys) != 0) - // continue; - - size_t n = static_cast(cd.nx * cd.size); - memcpy(cd.end, ptr, n * sizeof(unsigned short)); - ptr += n * sizeof(unsigned short); - cd.end += n; - } - } - - bitmapFromData(&tmpBuffer.at(0), static_cast(tmpBuffer.size()), bitmap, - minNonZero, maxNonZero); - - unsigned short lut[USHORT_RANGE]; - unsigned short maxValue = forwardLutFromBitmap(bitmap, lut); - applyLut(lut, &tmpBuffer.at(0), static_cast(tmpBuffer.size())); - - // - // Store range compression info in _outBuffer - // - - char *buf = reinterpret_cast(outPtr); - - memcpy(buf, &minNonZero, sizeof(unsigned short)); - buf += sizeof(unsigned short); - memcpy(buf, &maxNonZero, sizeof(unsigned short)); - buf += sizeof(unsigned short); - - if (minNonZero <= maxNonZero) { - memcpy(buf, reinterpret_cast(&bitmap[0] + minNonZero), - maxNonZero - minNonZero + 1); - buf += maxNonZero - minNonZero + 1; - } - - // - // Apply wavelet encoding - // - - for (size_t i = 0; i < channelData.size(); ++i) { - PIZChannelData &cd = channelData[i]; - - for (int j = 0; j < cd.size; ++j) { - wav2Encode(cd.start + j, cd.nx, cd.size, cd.ny, cd.nx * cd.size, - maxValue); - } - } - - // - // Apply Huffman encoding; append the result to _outBuffer - // - - // length header(4byte), then huff data. Initialize length header with zero, - // then later fill it by `length`. - char *lengthPtr = buf; - int zero = 0; - memcpy(buf, &zero, sizeof(int)); - buf += sizeof(int); - - int length = - hufCompress(&tmpBuffer.at(0), static_cast(tmpBuffer.size()), buf); - memcpy(lengthPtr, &length, sizeof(int)); - - (*outSize) = static_cast( - (reinterpret_cast(buf) - outPtr) + - static_cast(length)); - - // Use uncompressed data when compressed data is larger than uncompressed. - // (Issue 40) - if ((*outSize) >= inSize) { - (*outSize) = static_cast(inSize); - memcpy(outPtr, inPtr, inSize); - } - return true; -} - -static bool DecompressPiz(unsigned char *outPtr, const unsigned char *inPtr, - size_t tmpBufSize, size_t inLen, int num_channels, - const EXRChannelInfo *channels, int data_width, - int num_lines) { - if (inLen == tmpBufSize) { - // Data is not compressed(Issue 40). - memcpy(outPtr, inPtr, inLen); - return true; - } - - unsigned char bitmap[BITMAP_SIZE]; - unsigned short minNonZero; - unsigned short maxNonZero; - -#if !MINIZ_LITTLE_ENDIAN - // @todo { PIZ compression on BigEndian architecture. } - assert(0); - return false; -#endif - - memset(bitmap, 0, BITMAP_SIZE); - - const unsigned char *ptr = inPtr; - minNonZero = *(reinterpret_cast(ptr)); - maxNonZero = *(reinterpret_cast(ptr + 2)); - ptr += 4; - - if (maxNonZero >= BITMAP_SIZE) { - return false; - } - - if (minNonZero <= maxNonZero) { - memcpy(reinterpret_cast(&bitmap[0] + minNonZero), ptr, - maxNonZero - minNonZero + 1); - ptr += maxNonZero - minNonZero + 1; - } - - unsigned short lut[USHORT_RANGE]; - memset(lut, 0, sizeof(unsigned short) * USHORT_RANGE); - unsigned short maxValue = reverseLutFromBitmap(bitmap, lut); - - // - // Huffman decoding - // - - int length; - - length = *(reinterpret_cast(ptr)); - ptr += sizeof(int); - - std::vector tmpBuffer(tmpBufSize); - hufUncompress(reinterpret_cast(ptr), length, &tmpBuffer.at(0), - static_cast(tmpBufSize)); - - // - // Wavelet decoding - // - - std::vector channelData(static_cast(num_channels)); - - unsigned short *tmpBufferEnd = &tmpBuffer.at(0); - - for (size_t i = 0; i < static_cast(num_channels); ++i) { - const EXRChannelInfo &chan = channels[i]; - - size_t pixelSize = sizeof(int); // UINT and FLOAT - if (chan.pixel_type == TINYEXR_PIXELTYPE_HALF) { - pixelSize = sizeof(short); - } - - channelData[i].start = tmpBufferEnd; - channelData[i].end = channelData[i].start; - channelData[i].nx = data_width; - channelData[i].ny = num_lines; - // channelData[i].ys = 1; - channelData[i].size = static_cast(pixelSize / sizeof(short)); - - tmpBufferEnd += channelData[i].nx * channelData[i].ny * channelData[i].size; - } - - for (size_t i = 0; i < channelData.size(); ++i) { - PIZChannelData &cd = channelData[i]; - - for (int j = 0; j < cd.size; ++j) { - wav2Decode(cd.start + j, cd.nx, cd.size, cd.ny, cd.nx * cd.size, - maxValue); - } - } - - // - // Expand the pixel data to their original range - // - - applyLut(lut, &tmpBuffer.at(0), static_cast(tmpBufSize)); - - for (int y = 0; y < num_lines; y++) { - for (size_t i = 0; i < channelData.size(); ++i) { - PIZChannelData &cd = channelData[i]; - - // if (modp (y, cd.ys) != 0) - // continue; - - size_t n = static_cast(cd.nx * cd.size); - memcpy(outPtr, cd.end, static_cast(n * sizeof(unsigned short))); - outPtr += n * sizeof(unsigned short); - cd.end += n; - } - } - - return true; -} -#endif // TINYEXR_USE_PIZ - -#if TINYEXR_USE_ZFP -struct ZFPCompressionParam { - double rate; - int precision; - double tolerance; - int type; // TINYEXR_ZFP_COMPRESSIONTYPE_* - - ZFPCompressionParam() { - type = TINYEXR_ZFP_COMPRESSIONTYPE_RATE; - rate = 2.0; - precision = 0; - tolerance = 0.0f; - } -}; - -bool FindZFPCompressionParam(ZFPCompressionParam *param, - const EXRAttribute *attributes, - int num_attributes) { - bool foundType = false; - - for (int i = 0; i < num_attributes; i++) { - if ((strcmp(attributes[i].name, "zfpCompressionType") == 0) && - (attributes[i].size == 1)) { - param->type = static_cast(attributes[i].value[0]); - - foundType = true; - } - } - - if (!foundType) { - return false; - } - - if (param->type == TINYEXR_ZFP_COMPRESSIONTYPE_RATE) { - for (int i = 0; i < num_attributes; i++) { - if ((strcmp(attributes[i].name, "zfpCompressionRate") == 0) && - (attributes[i].size == 8)) { - param->rate = *(reinterpret_cast(attributes[i].value)); - return true; - } - } - } else if (param->type == TINYEXR_ZFP_COMPRESSIONTYPE_PRECISION) { - for (int i = 0; i < num_attributes; i++) { - if ((strcmp(attributes[i].name, "zfpCompressionPrecision") == 0) && - (attributes[i].size == 4)) { - param->rate = *(reinterpret_cast(attributes[i].value)); - return true; - } - } - } else if (param->type == TINYEXR_ZFP_COMPRESSIONTYPE_ACCURACY) { - for (int i = 0; i < num_attributes; i++) { - if ((strcmp(attributes[i].name, "zfpCompressionTolerance") == 0) && - (attributes[i].size == 8)) { - param->tolerance = *(reinterpret_cast(attributes[i].value)); - return true; - } - } - } else { - assert(0); - } - - return false; -} - -// Assume pixel format is FLOAT for all channels. -static bool DecompressZfp(float *dst, int dst_width, int dst_num_lines, - int num_channels, const unsigned char *src, - unsigned long src_size, - const ZFPCompressionParam ¶m) { - size_t uncompressed_size = dst_width * dst_num_lines * num_channels; - - if (uncompressed_size == src_size) { - // Data is not compressed(Issue 40). - memcpy(dst, src, src_size); - } - - zfp_stream *zfp = NULL; - zfp_field *field = NULL; - - assert((dst_width % 4) == 0); - assert((dst_num_lines % 4) == 0); - - if ((dst_width & 3U) || (dst_num_lines & 3U)) { - return false; - } - - field = - zfp_field_2d(reinterpret_cast(const_cast(src)), - zfp_type_float, dst_width, dst_num_lines * num_channels); - zfp = zfp_stream_open(NULL); - - if (param.type == TINYEXR_ZFP_COMPRESSIONTYPE_RATE) { - zfp_stream_set_rate(zfp, param.rate, zfp_type_float, /* dimention */ 2, - /* write random access */ 0); - } else if (param.type == TINYEXR_ZFP_COMPRESSIONTYPE_PRECISION) { - zfp_stream_set_precision(zfp, param.precision, zfp_type_float); - } else if (param.type == TINYEXR_ZFP_COMPRESSIONTYPE_ACCURACY) { - zfp_stream_set_accuracy(zfp, param.tolerance, zfp_type_float); - } else { - assert(0); - } - - size_t buf_size = zfp_stream_maximum_size(zfp, field); - std::vector buf(buf_size); - memcpy(&buf.at(0), src, src_size); - - bitstream *stream = stream_open(&buf.at(0), buf_size); - zfp_stream_set_bit_stream(zfp, stream); - zfp_stream_rewind(zfp); - - size_t image_size = dst_width * dst_num_lines; - - for (int c = 0; c < num_channels; c++) { - // decompress 4x4 pixel block. - for (int y = 0; y < dst_num_lines; y += 4) { - for (int x = 0; x < dst_width; x += 4) { - float fblock[16]; - zfp_decode_block_float_2(zfp, fblock); - for (int j = 0; j < 4; j++) { - for (int i = 0; i < 4; i++) { - dst[c * image_size + ((y + j) * dst_width + (x + i))] = - fblock[j * 4 + i]; - } - } - } - } - } - - zfp_field_free(field); - zfp_stream_close(zfp); - stream_close(stream); - - return true; -} - -// Assume pixel format is FLOAT for all channels. -bool CompressZfp(std::vector *outBuf, unsigned int *outSize, - const float *inPtr, int width, int num_lines, int num_channels, - const ZFPCompressionParam ¶m) { - zfp_stream *zfp = NULL; - zfp_field *field = NULL; - - assert((width % 4) == 0); - assert((num_lines % 4) == 0); - - if ((width & 3U) || (num_lines & 3U)) { - return false; - } - - // create input array. - field = zfp_field_2d(reinterpret_cast(const_cast(inPtr)), - zfp_type_float, width, num_lines * num_channels); - - zfp = zfp_stream_open(NULL); - - if (param.type == TINYEXR_ZFP_COMPRESSIONTYPE_RATE) { - zfp_stream_set_rate(zfp, param.rate, zfp_type_float, 2, 0); - } else if (param.type == TINYEXR_ZFP_COMPRESSIONTYPE_PRECISION) { - zfp_stream_set_precision(zfp, param.precision, zfp_type_float); - } else if (param.type == TINYEXR_ZFP_COMPRESSIONTYPE_ACCURACY) { - zfp_stream_set_accuracy(zfp, param.tolerance, zfp_type_float); - } else { - assert(0); - } - - size_t buf_size = zfp_stream_maximum_size(zfp, field); - - outBuf->resize(buf_size); - - bitstream *stream = stream_open(&outBuf->at(0), buf_size); - zfp_stream_set_bit_stream(zfp, stream); - zfp_field_free(field); - - size_t image_size = width * num_lines; - - for (int c = 0; c < num_channels; c++) { - // compress 4x4 pixel block. - for (int y = 0; y < num_lines; y += 4) { - for (int x = 0; x < width; x += 4) { - float fblock[16]; - for (int j = 0; j < 4; j++) { - for (int i = 0; i < 4; i++) { - fblock[j * 4 + i] = - inPtr[c * image_size + ((y + j) * width + (x + i))]; - } - } - zfp_encode_block_float_2(zfp, fblock); - } - } - } - - zfp_stream_flush(zfp); - (*outSize) = zfp_stream_compressed_size(zfp); - - zfp_stream_close(zfp); - - return true; -} - -#endif - -// -// ----------------------------------------------------------------- -// - -static void DecodePixelData(/* out */ unsigned char **out_images, - const int *requested_pixel_types, - const unsigned char *data_ptr, size_t data_len, - int compression_type, int line_order, int width, - int height, int x_stride, int y, int line_no, - int num_lines, size_t pixel_data_size, - size_t num_attributes, - const EXRAttribute *attributes, size_t num_channels, - const EXRChannelInfo *channels, - const std::vector &channel_offset_list) { - if (compression_type == TINYEXR_COMPRESSIONTYPE_PIZ) { // PIZ -#if TINYEXR_USE_PIZ - // Allocate original data size. - std::vector outBuf(static_cast( - static_cast(width * num_lines) * pixel_data_size)); - size_t tmpBufLen = outBuf.size(); - - bool ret = tinyexr::DecompressPiz( - reinterpret_cast(&outBuf.at(0)), data_ptr, tmpBufLen, - data_len, static_cast(num_channels), channels, width, num_lines); - - assert(ret); - (void)ret; - - // For PIZ_COMPRESSION: - // pixel sample data for channel 0 for scanline 0 - // pixel sample data for channel 1 for scanline 0 - // pixel sample data for channel ... for scanline 0 - // pixel sample data for channel n for scanline 0 - // pixel sample data for channel 0 for scanline 1 - // pixel sample data for channel 1 for scanline 1 - // pixel sample data for channel ... for scanline 1 - // pixel sample data for channel n for scanline 1 - // ... - for (size_t c = 0; c < static_cast(num_channels); c++) { - if (channels[c].pixel_type == TINYEXR_PIXELTYPE_HALF) { - for (size_t v = 0; v < static_cast(num_lines); v++) { - const unsigned short *line_ptr = reinterpret_cast( - &outBuf.at(v * pixel_data_size * static_cast(width) + - channel_offset_list[c] * static_cast(width))); - for (size_t u = 0; u < static_cast(width); u++) { - FP16 hf; - - hf.u = line_ptr[u]; - - tinyexr::swap2(reinterpret_cast(&hf.u)); - - if (requested_pixel_types[c] == TINYEXR_PIXELTYPE_HALF) { - unsigned short *image = - reinterpret_cast(out_images)[c]; - if (line_order == 0) { - image += (static_cast(line_no) + v) * - static_cast(x_stride) + - u; - } else { - image += static_cast( - (height - 1 - (line_no + static_cast(v)))) * - static_cast(x_stride) + - u; - } - *image = hf.u; - } else { // HALF -> FLOAT - FP32 f32 = half_to_float(hf); - float *image = reinterpret_cast(out_images)[c]; - if (line_order == 0) { - image += (static_cast(line_no) + v) * - static_cast(x_stride) + - u; - } else { - image += static_cast( - (height - 1 - (line_no + static_cast(v)))) * - static_cast(x_stride) + - u; - } - *image = f32.f; - } - } - } - } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_UINT) { - assert(requested_pixel_types[c] == TINYEXR_PIXELTYPE_UINT); - - for (size_t v = 0; v < static_cast(num_lines); v++) { - const unsigned int *line_ptr = reinterpret_cast( - &outBuf.at(v * pixel_data_size * static_cast(width) + - channel_offset_list[c] * static_cast(width))); - for (size_t u = 0; u < static_cast(width); u++) { - unsigned int val = line_ptr[u]; - - tinyexr::swap4(&val); - - unsigned int *image = - reinterpret_cast(out_images)[c]; - if (line_order == 0) { - image += (static_cast(line_no) + v) * - static_cast(x_stride) + - u; - } else { - image += static_cast( - (height - 1 - (line_no + static_cast(v)))) * - static_cast(x_stride) + - u; - } - *image = val; - } - } - } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_FLOAT) { - assert(requested_pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT); - for (size_t v = 0; v < static_cast(num_lines); v++) { - const float *line_ptr = reinterpret_cast(&outBuf.at( - v * pixel_data_size * static_cast(x_stride) + - channel_offset_list[c] * static_cast(x_stride))); - for (size_t u = 0; u < static_cast(width); u++) { - float val = line_ptr[u]; - - tinyexr::swap4(reinterpret_cast(&val)); - - float *image = reinterpret_cast(out_images)[c]; - if (line_order == 0) { - image += (static_cast(line_no) + v) * - static_cast(x_stride) + - u; - } else { - image += static_cast( - (height - 1 - (line_no + static_cast(v)))) * - static_cast(x_stride) + - u; - } - *image = val; - } - } - } else { - assert(0); - } - } -#else - assert(0 && "PIZ is enabled in this build"); -#endif - - } else if (compression_type == TINYEXR_COMPRESSIONTYPE_ZIPS || - compression_type == TINYEXR_COMPRESSIONTYPE_ZIP) { - // Allocate original data size. - std::vector outBuf(static_cast(width) * - static_cast(num_lines) * - pixel_data_size); - - unsigned long dstLen = static_cast(outBuf.size()); - assert(dstLen > 0); - tinyexr::DecompressZip(reinterpret_cast(&outBuf.at(0)), - &dstLen, data_ptr, - static_cast(data_len)); - - // For ZIP_COMPRESSION: - // pixel sample data for channel 0 for scanline 0 - // pixel sample data for channel 1 for scanline 0 - // pixel sample data for channel ... for scanline 0 - // pixel sample data for channel n for scanline 0 - // pixel sample data for channel 0 for scanline 1 - // pixel sample data for channel 1 for scanline 1 - // pixel sample data for channel ... for scanline 1 - // pixel sample data for channel n for scanline 1 - // ... - for (size_t c = 0; c < static_cast(num_channels); c++) { - if (channels[c].pixel_type == TINYEXR_PIXELTYPE_HALF) { - for (size_t v = 0; v < static_cast(num_lines); v++) { - const unsigned short *line_ptr = reinterpret_cast( - &outBuf.at(v * static_cast(pixel_data_size) * - static_cast(width) + - channel_offset_list[c] * static_cast(width))); - for (size_t u = 0; u < static_cast(width); u++) { - tinyexr::FP16 hf; - - hf.u = line_ptr[u]; - - tinyexr::swap2(reinterpret_cast(&hf.u)); - - if (requested_pixel_types[c] == TINYEXR_PIXELTYPE_HALF) { - unsigned short *image = - reinterpret_cast(out_images)[c]; - if (line_order == 0) { - image += (static_cast(line_no) + v) * - static_cast(x_stride) + - u; - } else { - image += (static_cast(height) - 1U - - (static_cast(line_no) + v)) * - static_cast(x_stride) + - u; - } - *image = hf.u; - } else { // HALF -> FLOAT - tinyexr::FP32 f32 = half_to_float(hf); - float *image = reinterpret_cast(out_images)[c]; - if (line_order == 0) { - image += (static_cast(line_no) + v) * - static_cast(x_stride) + - u; - } else { - image += (static_cast(height) - 1U - - (static_cast(line_no) + v)) * - static_cast(x_stride) + - u; - } - *image = f32.f; - } - } - } - } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_UINT) { - assert(requested_pixel_types[c] == TINYEXR_PIXELTYPE_UINT); - - for (size_t v = 0; v < static_cast(num_lines); v++) { - const unsigned int *line_ptr = reinterpret_cast( - &outBuf.at(v * pixel_data_size * static_cast(width) + - channel_offset_list[c] * static_cast(width))); - for (size_t u = 0; u < static_cast(width); u++) { - unsigned int val = line_ptr[u]; - - tinyexr::swap4(&val); - - unsigned int *image = - reinterpret_cast(out_images)[c]; - if (line_order == 0) { - image += (static_cast(line_no) + v) * - static_cast(x_stride) + - u; - } else { - image += (static_cast(height) - 1U - - (static_cast(line_no) + v)) * - static_cast(x_stride) + - u; - } - *image = val; - } - } - } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_FLOAT) { - assert(requested_pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT); - for (size_t v = 0; v < static_cast(num_lines); v++) { - const float *line_ptr = reinterpret_cast( - &outBuf.at(v * pixel_data_size * static_cast(width) + - channel_offset_list[c] * static_cast(width))); - for (size_t u = 0; u < static_cast(width); u++) { - float val = line_ptr[u]; - - tinyexr::swap4(reinterpret_cast(&val)); - - float *image = reinterpret_cast(out_images)[c]; - if (line_order == 0) { - image += (static_cast(line_no) + v) * - static_cast(x_stride) + - u; - } else { - image += (static_cast(height) - 1U - - (static_cast(line_no) + v)) * - static_cast(x_stride) + - u; - } - *image = val; - } - } - } else { - assert(0); - } - } - } else if (compression_type == TINYEXR_COMPRESSIONTYPE_RLE) { - // Allocate original data size. - std::vector outBuf(static_cast(width) * - static_cast(num_lines) * - pixel_data_size); - - unsigned long dstLen = static_cast(outBuf.size()); - assert(dstLen > 0); - tinyexr::DecompressRle(reinterpret_cast(&outBuf.at(0)), - dstLen, data_ptr, - static_cast(data_len)); - - // For RLE_COMPRESSION: - // pixel sample data for channel 0 for scanline 0 - // pixel sample data for channel 1 for scanline 0 - // pixel sample data for channel ... for scanline 0 - // pixel sample data for channel n for scanline 0 - // pixel sample data for channel 0 for scanline 1 - // pixel sample data for channel 1 for scanline 1 - // pixel sample data for channel ... for scanline 1 - // pixel sample data for channel n for scanline 1 - // ... - for (size_t c = 0; c < static_cast(num_channels); c++) { - if (channels[c].pixel_type == TINYEXR_PIXELTYPE_HALF) { - for (size_t v = 0; v < static_cast(num_lines); v++) { - const unsigned short *line_ptr = reinterpret_cast( - &outBuf.at(v * static_cast(pixel_data_size) * - static_cast(width) + - channel_offset_list[c] * static_cast(width))); - for (size_t u = 0; u < static_cast(width); u++) { - tinyexr::FP16 hf; - - hf.u = line_ptr[u]; - - tinyexr::swap2(reinterpret_cast(&hf.u)); - - if (requested_pixel_types[c] == TINYEXR_PIXELTYPE_HALF) { - unsigned short *image = - reinterpret_cast(out_images)[c]; - if (line_order == 0) { - image += (static_cast(line_no) + v) * - static_cast(x_stride) + - u; - } else { - image += (static_cast(height) - 1U - - (static_cast(line_no) + v)) * - static_cast(x_stride) + - u; - } - *image = hf.u; - } else { // HALF -> FLOAT - tinyexr::FP32 f32 = half_to_float(hf); - float *image = reinterpret_cast(out_images)[c]; - if (line_order == 0) { - image += (static_cast(line_no) + v) * - static_cast(x_stride) + - u; - } else { - image += (static_cast(height) - 1U - - (static_cast(line_no) + v)) * - static_cast(x_stride) + - u; - } - *image = f32.f; - } - } - } - } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_UINT) { - assert(requested_pixel_types[c] == TINYEXR_PIXELTYPE_UINT); - - for (size_t v = 0; v < static_cast(num_lines); v++) { - const unsigned int *line_ptr = reinterpret_cast( - &outBuf.at(v * pixel_data_size * static_cast(width) + - channel_offset_list[c] * static_cast(width))); - for (size_t u = 0; u < static_cast(width); u++) { - unsigned int val = line_ptr[u]; - - tinyexr::swap4(&val); - - unsigned int *image = - reinterpret_cast(out_images)[c]; - if (line_order == 0) { - image += (static_cast(line_no) + v) * - static_cast(x_stride) + - u; - } else { - image += (static_cast(height) - 1U - - (static_cast(line_no) + v)) * - static_cast(x_stride) + - u; - } - *image = val; - } - } - } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_FLOAT) { - assert(requested_pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT); - for (size_t v = 0; v < static_cast(num_lines); v++) { - const float *line_ptr = reinterpret_cast( - &outBuf.at(v * pixel_data_size * static_cast(width) + - channel_offset_list[c] * static_cast(width))); - for (size_t u = 0; u < static_cast(width); u++) { - float val = line_ptr[u]; - - tinyexr::swap4(reinterpret_cast(&val)); - - float *image = reinterpret_cast(out_images)[c]; - if (line_order == 0) { - image += (static_cast(line_no) + v) * - static_cast(x_stride) + - u; - } else { - image += (static_cast(height) - 1U - - (static_cast(line_no) + v)) * - static_cast(x_stride) + - u; - } - *image = val; - } - } - } else { - assert(0); - } - } - } else if (compression_type == TINYEXR_COMPRESSIONTYPE_ZFP) { -#if TINYEXR_USE_ZFP - tinyexr::ZFPCompressionParam zfp_compression_param; - if (!FindZFPCompressionParam(&zfp_compression_param, attributes, - num_attributes)) { - assert(0); - return; - } - - // Allocate original data size. - std::vector outBuf(static_cast(width) * - static_cast(num_lines) * - pixel_data_size); - - unsigned long dstLen = outBuf.size(); - assert(dstLen > 0); - tinyexr::DecompressZfp(reinterpret_cast(&outBuf.at(0)), width, - num_lines, num_channels, data_ptr, - static_cast(data_len), - zfp_compression_param); - - // For ZFP_COMPRESSION: - // pixel sample data for channel 0 for scanline 0 - // pixel sample data for channel 1 for scanline 0 - // pixel sample data for channel ... for scanline 0 - // pixel sample data for channel n for scanline 0 - // pixel sample data for channel 0 for scanline 1 - // pixel sample data for channel 1 for scanline 1 - // pixel sample data for channel ... for scanline 1 - // pixel sample data for channel n for scanline 1 - // ... - for (size_t c = 0; c < static_cast(num_channels); c++) { - assert(channels[c].pixel_type == TINYEXR_PIXELTYPE_FLOAT); - if (channels[c].pixel_type == TINYEXR_PIXELTYPE_FLOAT) { - assert(requested_pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT); - for (size_t v = 0; v < static_cast(num_lines); v++) { - const float *line_ptr = reinterpret_cast( - &outBuf.at(v * pixel_data_size * static_cast(width) + - channel_offset_list[c] * static_cast(width))); - for (size_t u = 0; u < static_cast(width); u++) { - float val = line_ptr[u]; - - tinyexr::swap4(reinterpret_cast(&val)); - - float *image = reinterpret_cast(out_images)[c]; - if (line_order == 0) { - image += (static_cast(line_no) + v) * - static_cast(x_stride) + - u; - } else { - image += (static_cast(height) - 1U - - (static_cast(line_no) + v)) * - static_cast(x_stride) + - u; - } - *image = val; - } - } - } else { - assert(0); - } - } -#else - (void)attributes; - (void)num_attributes; - (void)num_channels; - assert(0); -#endif - } else if (compression_type == TINYEXR_COMPRESSIONTYPE_NONE) { - for (size_t c = 0; c < num_channels; c++) { - if (channels[c].pixel_type == TINYEXR_PIXELTYPE_HALF) { - const unsigned short *line_ptr = - reinterpret_cast( - data_ptr + - c * static_cast(width) * sizeof(unsigned short)); - - if (requested_pixel_types[c] == TINYEXR_PIXELTYPE_HALF) { - unsigned short *outLine = - reinterpret_cast(out_images[c]); - if (line_order == 0) { - outLine += y * x_stride; - } else { - outLine += (height - 1 - y) * x_stride; - } - - for (int u = 0; u < width; u++) { - tinyexr::FP16 hf; - - hf.u = line_ptr[u]; - - tinyexr::swap2(reinterpret_cast(&hf.u)); - - outLine[u] = hf.u; - } - } else if (requested_pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT) { - float *outLine = reinterpret_cast(out_images[c]); - if (line_order == 0) { - outLine += y * x_stride; - } else { - outLine += (height - 1 - y) * x_stride; - } - - for (int u = 0; u < width; u++) { - tinyexr::FP16 hf; - - hf.u = line_ptr[u]; - - tinyexr::swap2(reinterpret_cast(&hf.u)); - - tinyexr::FP32 f32 = half_to_float(hf); - - outLine[u] = f32.f; - } - } else { - assert(0); - } - } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_FLOAT) { - const float *line_ptr = reinterpret_cast( - data_ptr + c * static_cast(width) * sizeof(float)); - - float *outLine = reinterpret_cast(out_images[c]); - if (line_order == 0) { - outLine += y * x_stride; - } else { - outLine += (height - 1 - y) * x_stride; - } - - for (int u = 0; u < width; u++) { - float val = line_ptr[u]; - - tinyexr::swap4(reinterpret_cast(&val)); - - outLine[u] = val; - } - } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_UINT) { - const unsigned int *line_ptr = reinterpret_cast( - data_ptr + c * static_cast(width) * sizeof(unsigned int)); - - unsigned int *outLine = reinterpret_cast(out_images[c]); - if (line_order == 0) { - outLine += y * x_stride; - } else { - outLine += (height - 1 - y) * x_stride; - } - - for (int u = 0; u < width; u++) { - unsigned int val = line_ptr[u]; - - tinyexr::swap4(reinterpret_cast(&val)); - - outLine[u] = val; - } - } - } - } -} - -static void DecodeTiledPixelData( - unsigned char **out_images, int *width, int *height, - const int *requested_pixel_types, const unsigned char *data_ptr, - size_t data_len, int compression_type, int line_order, int data_width, - int data_height, int tile_offset_x, int tile_offset_y, int tile_size_x, - int tile_size_y, size_t pixel_data_size, size_t num_attributes, - const EXRAttribute *attributes, size_t num_channels, - const EXRChannelInfo *channels, - const std::vector &channel_offset_list) { - assert(tile_offset_x * tile_size_x < data_width); - assert(tile_offset_y * tile_size_y < data_height); - - // Compute actual image size in a tile. - if ((tile_offset_x + 1) * tile_size_x >= data_width) { - (*width) = data_width - (tile_offset_x * tile_size_x); - } else { - (*width) = tile_size_x; - } - - if ((tile_offset_y + 1) * tile_size_y >= data_height) { - (*height) = data_height - (tile_offset_y * tile_size_y); - } else { - (*height) = tile_size_y; - } - - // Image size = tile size. - DecodePixelData(out_images, requested_pixel_types, data_ptr, data_len, - compression_type, line_order, (*width), tile_size_y, - /* stride */ tile_size_x, /* y */ 0, /* line_no */ 0, - (*height), pixel_data_size, num_attributes, attributes, - num_channels, channels, channel_offset_list); -} - -static void ComputeChannelLayout(std::vector *channel_offset_list, - int *pixel_data_size, size_t *channel_offset, - int num_channels, - const EXRChannelInfo *channels) { - channel_offset_list->resize(static_cast(num_channels)); - - (*pixel_data_size) = 0; - (*channel_offset) = 0; - - for (size_t c = 0; c < static_cast(num_channels); c++) { - (*channel_offset_list)[c] = (*channel_offset); - if (channels[c].pixel_type == TINYEXR_PIXELTYPE_HALF) { - (*pixel_data_size) += sizeof(unsigned short); - (*channel_offset) += sizeof(unsigned short); - } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_FLOAT) { - (*pixel_data_size) += sizeof(float); - (*channel_offset) += sizeof(float); - } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_UINT) { - (*pixel_data_size) += sizeof(unsigned int); - (*channel_offset) += sizeof(unsigned int); - } else { - assert(0); - } - } -} - -static unsigned char **AllocateImage(int num_channels, - const EXRChannelInfo *channels, - const int *requested_pixel_types, - int data_width, int data_height) { - unsigned char **images = - reinterpret_cast(static_cast( - malloc(sizeof(float *) * static_cast(num_channels)))); - - for (size_t c = 0; c < static_cast(num_channels); c++) { - size_t data_len = - static_cast(data_width) * static_cast(data_height); - if (channels[c].pixel_type == TINYEXR_PIXELTYPE_HALF) { - // pixel_data_size += sizeof(unsigned short); - // channel_offset += sizeof(unsigned short); - // Alloc internal image for half type. - if (requested_pixel_types[c] == TINYEXR_PIXELTYPE_HALF) { - images[c] = - reinterpret_cast(static_cast( - malloc(sizeof(unsigned short) * data_len))); - } else if (requested_pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT) { - images[c] = reinterpret_cast( - static_cast(malloc(sizeof(float) * data_len))); - } else { - assert(0); - } - } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_FLOAT) { - // pixel_data_size += sizeof(float); - // channel_offset += sizeof(float); - images[c] = reinterpret_cast( - static_cast(malloc(sizeof(float) * data_len))); - } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_UINT) { - // pixel_data_size += sizeof(unsigned int); - // channel_offset += sizeof(unsigned int); - images[c] = reinterpret_cast( - static_cast(malloc(sizeof(unsigned int) * data_len))); - } else { - assert(0); - } - } - - return images; -} - -static int ParseEXRHeader(HeaderInfo *info, bool *empty_header, - const EXRVersion *version, std::string *err, - const unsigned char *buf, size_t size) { - const char *marker = reinterpret_cast(&buf[0]); - - if (empty_header) { - (*empty_header) = false; - } - - if (version->multipart) { - if (size > 0 && marker[0] == '\0') { - // End of header list. - if (empty_header) { - (*empty_header) = true; - } - return TINYEXR_SUCCESS; - } - } - - // According to the spec, the header of every OpenEXR file must contain at - // least the following attributes: - // - // channels chlist - // compression compression - // dataWindow box2i - // displayWindow box2i - // lineOrder lineOrder - // pixelAspectRatio float - // screenWindowCenter v2f - // screenWindowWidth float - bool has_channels = false; - bool has_compression = false; - bool has_data_window = false; - bool has_display_window = false; - bool has_line_order = false; - bool has_pixel_aspect_ratio = false; - bool has_screen_window_center = false; - bool has_screen_window_width = false; - - info->data_window[0] = 0; - info->data_window[1] = 0; - info->data_window[2] = 0; - info->data_window[3] = 0; - info->line_order = 0; // @fixme - info->display_window[0] = 0; - info->display_window[1] = 0; - info->display_window[2] = 0; - info->display_window[3] = 0; - info->screen_window_center[0] = 0.0f; - info->screen_window_center[1] = 0.0f; - info->screen_window_width = -1.0f; - info->pixel_aspect_ratio = -1.0f; - - info->tile_size_x = -1; - info->tile_size_y = -1; - info->tile_level_mode = -1; - info->tile_rounding_mode = -1; - - info->attributes.clear(); - - // Read attributes - size_t orig_size = size; - for (;;) { - if (0 == size) { - return TINYEXR_ERROR_INVALID_DATA; - } else if (marker[0] == '\0') { - size--; - break; - } - - std::string attr_name; - std::string attr_type; - std::vector data; - size_t marker_size; - if (!tinyexr::ReadAttribute(&attr_name, &attr_type, &data, &marker_size, - marker, size)) { - return TINYEXR_ERROR_INVALID_DATA; - } - marker += marker_size; - size -= marker_size; - - if (version->tiled && attr_name.compare("tiles") == 0) { - unsigned int x_size, y_size; - unsigned char tile_mode; - assert(data.size() == 9); - memcpy(&x_size, &data.at(0), sizeof(int)); - memcpy(&y_size, &data.at(4), sizeof(int)); - tile_mode = data[8]; - tinyexr::swap4(&x_size); - tinyexr::swap4(&y_size); - - info->tile_size_x = static_cast(x_size); - info->tile_size_y = static_cast(y_size); - - // mode = levelMode + roundingMode * 16 - info->tile_level_mode = tile_mode & 0x3; - info->tile_rounding_mode = (tile_mode >> 4) & 0x1; - - } else if (attr_name.compare("compression") == 0) { - bool ok = false; - if (data[0] < TINYEXR_COMPRESSIONTYPE_PIZ) { - ok = true; - } - - if (data[0] == TINYEXR_COMPRESSIONTYPE_PIZ) { -#if TINYEXR_USE_PIZ - ok = true; -#else - if (err) { - (*err) = "PIZ compression is not supported."; - } - return TINYEXR_ERROR_UNSUPPORTED_FORMAT; -#endif - } - - if (data[0] == TINYEXR_COMPRESSIONTYPE_ZFP) { -#if TINYEXR_USE_ZFP - ok = true; -#else - if (err) { - (*err) = "ZFP compression is not supported."; - } - return TINYEXR_ERROR_UNSUPPORTED_FORMAT; -#endif - } - - if (!ok) { - if (err) { - (*err) = "Unknown compression type."; - } - return TINYEXR_ERROR_UNSUPPORTED_FORMAT; - } - - info->compression_type = static_cast(data[0]); - has_compression = true; - - } else if (attr_name.compare("channels") == 0) { - // name: zero-terminated string, from 1 to 255 bytes long - // pixel type: int, possible values are: UINT = 0 HALF = 1 FLOAT = 2 - // pLinear: unsigned char, possible values are 0 and 1 - // reserved: three chars, should be zero - // xSampling: int - // ySampling: int - - ReadChannelInfo(info->channels, data); - - if (info->channels.size() < 1) { - if (err) { - (*err) = "# of channels is zero."; - } - return TINYEXR_ERROR_INVALID_DATA; - } - - has_channels = true; - - } else if (attr_name.compare("dataWindow") == 0) { - memcpy(&info->data_window[0], &data.at(0), sizeof(int)); - memcpy(&info->data_window[1], &data.at(4), sizeof(int)); - memcpy(&info->data_window[2], &data.at(8), sizeof(int)); - memcpy(&info->data_window[3], &data.at(12), sizeof(int)); - tinyexr::swap4(reinterpret_cast(&info->data_window[0])); - tinyexr::swap4(reinterpret_cast(&info->data_window[1])); - tinyexr::swap4(reinterpret_cast(&info->data_window[2])); - tinyexr::swap4(reinterpret_cast(&info->data_window[3])); - - has_data_window = true; - } else if (attr_name.compare("displayWindow") == 0) { - memcpy(&info->display_window[0], &data.at(0), sizeof(int)); - memcpy(&info->display_window[1], &data.at(4), sizeof(int)); - memcpy(&info->display_window[2], &data.at(8), sizeof(int)); - memcpy(&info->display_window[3], &data.at(12), sizeof(int)); - tinyexr::swap4( - reinterpret_cast(&info->display_window[0])); - tinyexr::swap4( - reinterpret_cast(&info->display_window[1])); - tinyexr::swap4( - reinterpret_cast(&info->display_window[2])); - tinyexr::swap4( - reinterpret_cast(&info->display_window[3])); - - has_display_window = true; - } else if (attr_name.compare("lineOrder") == 0) { - info->line_order = static_cast(data[0]); - has_line_order = true; - } else if (attr_name.compare("pixelAspectRatio") == 0) { - memcpy(&info->pixel_aspect_ratio, &data.at(0), sizeof(float)); - tinyexr::swap4( - reinterpret_cast(&info->pixel_aspect_ratio)); - has_pixel_aspect_ratio = true; - } else if (attr_name.compare("screenWindowCenter") == 0) { - memcpy(&info->screen_window_center[0], &data.at(0), sizeof(float)); - memcpy(&info->screen_window_center[1], &data.at(4), sizeof(float)); - tinyexr::swap4( - reinterpret_cast(&info->screen_window_center[0])); - tinyexr::swap4( - reinterpret_cast(&info->screen_window_center[1])); - has_screen_window_center = true; - } else if (attr_name.compare("screenWindowWidth") == 0) { - memcpy(&info->screen_window_width, &data.at(0), sizeof(float)); - tinyexr::swap4( - reinterpret_cast(&info->screen_window_width)); - - has_screen_window_width = true; - } else if (attr_name.compare("chunkCount") == 0) { - memcpy(&info->chunk_count, &data.at(0), sizeof(int)); - tinyexr::swap4(reinterpret_cast(&info->chunk_count)); - } else { - // Custom attribute(up to TINYEXR_MAX_ATTRIBUTES) - if (info->attributes.size() < TINYEXR_MAX_ATTRIBUTES) { - EXRAttribute attrib; -#ifdef _MSC_VER - strncpy_s(attrib.name, attr_name.c_str(), 255); - strncpy_s(attrib.type, attr_type.c_str(), 255); -#else - strncpy(attrib.name, attr_name.c_str(), 255); - strncpy(attrib.type, attr_type.c_str(), 255); -#endif - attrib.name[255] = '\0'; - attrib.type[255] = '\0'; - attrib.size = static_cast(data.size()); - attrib.value = static_cast(malloc(data.size())); - memcpy(reinterpret_cast(attrib.value), &data.at(0), - data.size()); - info->attributes.push_back(attrib); - } - } - } - - // Check if required attributes exist - { - std::stringstream ss_err; - - if (!has_compression) { - ss_err << "\"compression\" attribute not found in the header." - << std::endl; - } - - if (!has_channels) { - ss_err << "\"channels\" attribute not found in the header." << std::endl; - } - - if (!has_line_order) { - ss_err << "\"lineOrder\" attribute not found in the header." << std::endl; - } - - if (!has_display_window) { - ss_err << "\"displayWindow\" attribute not found in the header." - << std::endl; - } - - if (!has_data_window) { - ss_err << "\"dataWindow\" attribute not found in the header." - << std::endl; - } - - if (!has_pixel_aspect_ratio) { - ss_err << "\"pixelAspectRatio\" attribute not found in the header." - << std::endl; - } - - if (!has_screen_window_width) { - ss_err << "\"screenWindowWidth\" attribute not found in the header." - << std::endl; - } - - if (!has_screen_window_center) { - ss_err << "\"screenWindowCenter\" attribute not found in the header." - << std::endl; - } - - if (!(ss_err.str().empty())) { - if (err) { - (*err) += ss_err.str(); - } - return TINYEXR_ERROR_INVALID_HEADER; - } - } - - info->header_len = static_cast(orig_size - size); - - return TINYEXR_SUCCESS; -} - -// C++ HeaderInfo to C EXRHeader conversion. -static void ConvertHeader(EXRHeader *exr_header, const HeaderInfo &info) { - exr_header->pixel_aspect_ratio = info.pixel_aspect_ratio; - exr_header->screen_window_center[0] = info.screen_window_center[0]; - exr_header->screen_window_center[1] = info.screen_window_center[1]; - exr_header->screen_window_width = info.screen_window_width; - exr_header->chunk_count = info.chunk_count; - exr_header->display_window[0] = info.display_window[0]; - exr_header->display_window[1] = info.display_window[1]; - exr_header->display_window[2] = info.display_window[2]; - exr_header->display_window[3] = info.display_window[3]; - exr_header->data_window[0] = info.data_window[0]; - exr_header->data_window[1] = info.data_window[1]; - exr_header->data_window[2] = info.data_window[2]; - exr_header->data_window[3] = info.data_window[3]; - exr_header->line_order = info.line_order; - exr_header->compression_type = info.compression_type; - - exr_header->tile_size_x = info.tile_size_x; - exr_header->tile_size_y = info.tile_size_y; - exr_header->tile_level_mode = info.tile_level_mode; - exr_header->tile_rounding_mode = info.tile_rounding_mode; - - exr_header->num_channels = static_cast(info.channels.size()); - - exr_header->channels = static_cast(malloc( - sizeof(EXRChannelInfo) * static_cast(exr_header->num_channels))); - for (size_t c = 0; c < static_cast(exr_header->num_channels); c++) { -#ifdef _MSC_VER - strncpy_s(exr_header->channels[c].name, info.channels[c].name.c_str(), 255); -#else - strncpy(exr_header->channels[c].name, info.channels[c].name.c_str(), 255); -#endif - // manually add '\0' for safety. - exr_header->channels[c].name[255] = '\0'; - - exr_header->channels[c].pixel_type = info.channels[c].pixel_type; - exr_header->channels[c].p_linear = info.channels[c].p_linear; - exr_header->channels[c].x_sampling = info.channels[c].x_sampling; - exr_header->channels[c].y_sampling = info.channels[c].y_sampling; - } - - exr_header->pixel_types = static_cast( - malloc(sizeof(int) * static_cast(exr_header->num_channels))); - for (size_t c = 0; c < static_cast(exr_header->num_channels); c++) { - exr_header->pixel_types[c] = info.channels[c].pixel_type; - } - - // Initially fill with values of `pixel_types` - exr_header->requested_pixel_types = static_cast( - malloc(sizeof(int) * static_cast(exr_header->num_channels))); - for (size_t c = 0; c < static_cast(exr_header->num_channels); c++) { - exr_header->requested_pixel_types[c] = info.channels[c].pixel_type; - } - - assert(info.attributes.size() < TINYEXR_MAX_ATTRIBUTES); - exr_header->num_custom_attributes = static_cast(info.attributes.size()); - - for (size_t i = 0; i < info.attributes.size(); i++) { - memcpy(exr_header->custom_attributes[i].name, info.attributes[i].name, 256); - memcpy(exr_header->custom_attributes[i].type, info.attributes[i].type, 256); - exr_header->custom_attributes[i].size = info.attributes[i].size; - // Just copy poiner - exr_header->custom_attributes[i].value = info.attributes[i].value; - } - - exr_header->header_len = info.header_len; -} - -static int DecodeChunk(EXRImage *exr_image, const EXRHeader *exr_header, - const std::vector &offsets, - const unsigned char *head) { - int num_channels = exr_header->num_channels; - - int num_scanline_blocks = 1; - if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_ZIP) { - num_scanline_blocks = 16; - } else if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_PIZ) { - num_scanline_blocks = 32; - } else if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_ZFP) { - num_scanline_blocks = 16; - } - - int data_width = exr_header->data_window[2] - exr_header->data_window[0] + 1; - int data_height = exr_header->data_window[3] - exr_header->data_window[1] + 1; - - size_t num_blocks = offsets.size(); - - std::vector channel_offset_list; - int pixel_data_size = 0; - size_t channel_offset = 0; - tinyexr::ComputeChannelLayout(&channel_offset_list, &pixel_data_size, - &channel_offset, num_channels, - exr_header->channels); - - bool invalid_data = false; - - if (exr_header->tiled) { - size_t num_tiles = offsets.size(); // = # of blocks - - exr_image->tiles = static_cast( - malloc(sizeof(EXRTile) * static_cast(num_tiles))); - - for (size_t tile_idx = 0; tile_idx < num_tiles; tile_idx++) { - // Allocate memory for each tile. - exr_image->tiles[tile_idx].images = tinyexr::AllocateImage( - num_channels, exr_header->channels, exr_header->requested_pixel_types, - data_width, data_height); - - // 16 byte: tile coordinates - // 4 byte : data size - // ~ : data(uncompressed or compressed) - const unsigned char *data_ptr = - reinterpret_cast(head + offsets[tile_idx]); - - int tile_coordinates[4]; - memcpy(tile_coordinates, data_ptr, sizeof(int) * 4); - tinyexr::swap4(reinterpret_cast(&tile_coordinates[0])); - tinyexr::swap4(reinterpret_cast(&tile_coordinates[1])); - tinyexr::swap4(reinterpret_cast(&tile_coordinates[2])); - tinyexr::swap4(reinterpret_cast(&tile_coordinates[3])); - - // @todo{ LoD } - assert(tile_coordinates[2] == 0); - assert(tile_coordinates[3] == 0); - - int data_len; - memcpy(&data_len, data_ptr + 16, - sizeof(int)); // 16 = sizeof(tile_coordinates) - tinyexr::swap4(reinterpret_cast(&data_len)); - assert(data_len >= 4); - - // Move to data addr: 20 = 16 + 4; - data_ptr += 20; - - tinyexr::DecodeTiledPixelData( - exr_image->tiles[tile_idx].images, - &(exr_image->tiles[tile_idx].width), - &(exr_image->tiles[tile_idx].height), - exr_header->requested_pixel_types, data_ptr, - static_cast(data_len), exr_header->compression_type, - exr_header->line_order, data_width, data_height, tile_coordinates[0], - tile_coordinates[1], exr_header->tile_size_x, exr_header->tile_size_y, - static_cast(pixel_data_size), - static_cast(exr_header->num_custom_attributes), - exr_header->custom_attributes, - static_cast(exr_header->num_channels), exr_header->channels, - channel_offset_list); - - exr_image->tiles[tile_idx].offset_x = tile_coordinates[0]; - exr_image->tiles[tile_idx].offset_y = tile_coordinates[1]; - exr_image->tiles[tile_idx].level_x = tile_coordinates[2]; - exr_image->tiles[tile_idx].level_y = tile_coordinates[3]; - - exr_image->num_tiles = static_cast(num_tiles); - } - } else { // scanline format - - exr_image->images = tinyexr::AllocateImage( - num_channels, exr_header->channels, exr_header->requested_pixel_types, - data_width, data_height); - -#ifdef _OPENMP -#pragma omp parallel for -#endif - for (int y = 0; y < static_cast(num_blocks); y++) { - size_t y_idx = static_cast(y); - const unsigned char *data_ptr = - reinterpret_cast(head + offsets[y_idx]); - // 4 byte: scan line - // 4 byte: data size - // ~ : pixel data(uncompressed or compressed) - int line_no; - memcpy(&line_no, data_ptr, sizeof(int)); - int data_len; - memcpy(&data_len, data_ptr + 4, sizeof(int)); - tinyexr::swap4(reinterpret_cast(&line_no)); - tinyexr::swap4(reinterpret_cast(&data_len)); - - int end_line_no = (std::min)(line_no + num_scanline_blocks, - (exr_header->data_window[3] + 1)); - - int num_lines = end_line_no - line_no; - assert(num_lines > 0); - - // Move to data addr: 8 = 4 + 4; - data_ptr += 8; - - // Adjust line_no with data_window.bmin.y - line_no -= exr_header->data_window[1]; - - if (line_no < 0) { - invalid_data = true; - } else { - tinyexr::DecodePixelData( - exr_image->images, exr_header->requested_pixel_types, data_ptr, - static_cast(data_len), exr_header->compression_type, - exr_header->line_order, data_width, data_height, data_width, y, - line_no, num_lines, static_cast(pixel_data_size), - static_cast(exr_header->num_custom_attributes), - exr_header->custom_attributes, - static_cast(exr_header->num_channels), exr_header->channels, - channel_offset_list); - } - } // omp parallel - } - - if (invalid_data) { - return TINYEXR_ERROR_INVALID_DATA; - } - - // Overwrite `pixel_type` with `requested_pixel_type`. - { - for (int c = 0; c < exr_header->num_channels; c++) { - exr_header->pixel_types[c] = exr_header->requested_pixel_types[c]; - } - } - - { - exr_image->num_channels = num_channels; - - exr_image->width = data_width; - exr_image->height = data_height; - } - - return TINYEXR_SUCCESS; -} - -static bool ReconstructLineOffsets( - std::vector *offsets, size_t n, - const unsigned char *head, const unsigned char *marker, const size_t size) { - assert(head < marker); - assert(offsets->size() == n); - - for (size_t i = 0; i < n; i++) { - size_t offset = static_cast(marker - head); - // Offset should not exceed whole EXR file/data size. - if (offset >= size) { - return false; - } - - int y; - unsigned int data_len; - - memcpy(&y, marker, sizeof(int)); - memcpy(&data_len, marker + 4, sizeof(unsigned int)); - - if (data_len >= size) { - return false; - } - - tinyexr::swap4(reinterpret_cast(&y)); - tinyexr::swap4(reinterpret_cast(&data_len)); - - (*offsets)[i] = offset; - - marker += data_len + 8; // 8 = 4 bytes(y) + 4 bytes(data_len) - } - - return true; -} - -static int DecodeEXRImage(EXRImage *exr_image, const EXRHeader *exr_header, - const unsigned char *head, - const unsigned char *marker, const size_t size, - const char **err) { - if (exr_image == NULL || exr_header == NULL || head == NULL || - marker == NULL || (size <= tinyexr::kEXRVersionSize)) { - if (err) { - (*err) = "Invalid argument."; - } - return TINYEXR_ERROR_INVALID_ARGUMENT; - } - - int num_scanline_blocks = 1; - if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_ZIP) { - num_scanline_blocks = 16; - } else if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_PIZ) { - num_scanline_blocks = 32; - } else if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_ZFP) { - num_scanline_blocks = 16; - } - - int data_width = exr_header->data_window[2] - exr_header->data_window[0] + 1; - int data_height = exr_header->data_window[3] - exr_header->data_window[1] + 1; - - // Read offset tables. - size_t num_blocks; - - if (exr_header->chunk_count > 0) { - // Use `chunkCount` attribute. - num_blocks = static_cast(exr_header->chunk_count); - } else if (exr_header->tiled) { - // @todo { LoD } - size_t num_x_tiles = static_cast(data_width) / - static_cast(exr_header->tile_size_x); - if (num_x_tiles * static_cast(exr_header->tile_size_x) < - static_cast(data_width)) { - num_x_tiles++; - } - size_t num_y_tiles = static_cast(data_height) / - static_cast(exr_header->tile_size_y); - if (num_y_tiles * static_cast(exr_header->tile_size_y) < - static_cast(data_height)) { - num_y_tiles++; - } - - num_blocks = num_x_tiles * num_y_tiles; - } else { - num_blocks = static_cast(data_height) / - static_cast(num_scanline_blocks); - if (num_blocks * static_cast(num_scanline_blocks) < - static_cast(data_height)) { - num_blocks++; - } - } - - std::vector offsets(num_blocks); - - for (size_t y = 0; y < num_blocks; y++) { - tinyexr::tinyexr_uint64 offset; - memcpy(&offset, marker, sizeof(tinyexr::tinyexr_uint64)); - tinyexr::swap8(&offset); - if (offset >= size) { - if (err) { - (*err) = "Invalid offset value."; - } - return TINYEXR_ERROR_INVALID_DATA; - } - marker += sizeof(tinyexr::tinyexr_uint64); // = 8 - offsets[y] = offset; - } - - // If line offsets are invalid, we try to reconstruct it. - // See OpenEXR/IlmImf/ImfScanLineInputFile.cpp::readLineOffsets() for details. - for (size_t y = 0; y < num_blocks; y++) { - if (offsets[y] <= 0) { - // TODO(syoyo) Report as warning? - // if (err) { - // stringstream ss; - // ss << "Incomplete lineOffsets." << std::endl; - // (*err) += ss.str(); - //} - bool ret = - ReconstructLineOffsets(&offsets, num_blocks, head, marker, size); - if (ret) { - // OK - break; - } else { - if (err) { - (*err) = "Cannot reconstruct lineOffset table."; - } - return TINYEXR_ERROR_INVALID_DATA; - } - } - } - - return DecodeChunk(exr_image, exr_header, offsets, head); -} - -} // namespace tinyexr - -int LoadEXR(float **out_rgba, int *width, int *height, const char *filename, - const char **err) { - if (out_rgba == NULL) { - if (err) { - (*err) = "Invalid argument.\n"; - } - return TINYEXR_ERROR_INVALID_ARGUMENT; - } - - EXRVersion exr_version; - EXRImage exr_image; - EXRHeader exr_header; - InitEXRHeader(&exr_header); - InitEXRImage(&exr_image); - - { - int ret = ParseEXRVersionFromFile(&exr_version, filename); - if (ret != TINYEXR_SUCCESS) { - return ret; - } - - if (exr_version.multipart || exr_version.non_image) { - if (err) { - (*err) = "Loading multipart or DeepImage is not supported yet.\n"; - } - return TINYEXR_ERROR_INVALID_DATA; // @fixme. - } - } - - { - int ret = ParseEXRHeaderFromFile(&exr_header, &exr_version, filename, err); - if (ret != TINYEXR_SUCCESS) { - return ret; - } - } - - // Read HALF channel as FLOAT. - for (int i = 0; i < exr_header.num_channels; i++) { - if (exr_header.pixel_types[i] == TINYEXR_PIXELTYPE_HALF) { - exr_header.requested_pixel_types[i] = TINYEXR_PIXELTYPE_FLOAT; - } - } - - { - int ret = LoadEXRImageFromFile(&exr_image, &exr_header, filename, err); - if (ret != TINYEXR_SUCCESS) { - return ret; - } - } - - // RGBA - int idxR = -1; - int idxG = -1; - int idxB = -1; - int idxA = -1; - for (int c = 0; c < exr_header.num_channels; c++) { - if (strcmp(exr_header.channels[c].name, "R") == 0) { - idxR = c; - } else if (strcmp(exr_header.channels[c].name, "G") == 0) { - idxG = c; - } else if (strcmp(exr_header.channels[c].name, "B") == 0) { - idxB = c; - } else if (strcmp(exr_header.channels[c].name, "A") == 0) { - idxA = c; - } - } - - if ((idxA == 0) && (idxR == -1) && (idxG == -1) && (idxB == -1)) { - // Alpha channel only. - - (*out_rgba) = reinterpret_cast( - malloc(4 * sizeof(float) * static_cast(exr_image.width) * - static_cast(exr_image.height))); - for (int i = 0; i < exr_image.width * exr_image.height; i++) { - const float val = reinterpret_cast(exr_image.images)[0][i]; - (*out_rgba)[4 * i + 0] = val; - (*out_rgba)[4 * i + 1] = val; - (*out_rgba)[4 * i + 2] = val; - (*out_rgba)[4 * i + 3] = val; - } - } else { - // Assume RGB(A) - - if (idxR == -1) { - if (err) { - (*err) = "R channel not found\n"; - } - - // @todo { free exr_image } - return TINYEXR_ERROR_INVALID_DATA; - } - - if (idxG == -1) { - if (err) { - (*err) = "G channel not found\n"; - } - // @todo { free exr_image } - return TINYEXR_ERROR_INVALID_DATA; - } - - if (idxB == -1) { - if (err) { - (*err) = "B channel not found\n"; - } - // @todo { free exr_image } - return TINYEXR_ERROR_INVALID_DATA; - } - - (*out_rgba) = reinterpret_cast( - malloc(4 * sizeof(float) * static_cast(exr_image.width) * - static_cast(exr_image.height))); - for (int i = 0; i < exr_image.width * exr_image.height; i++) { - (*out_rgba)[4 * i + 0] = - reinterpret_cast(exr_image.images)[idxR][i]; - (*out_rgba)[4 * i + 1] = - reinterpret_cast(exr_image.images)[idxG][i]; - (*out_rgba)[4 * i + 2] = - reinterpret_cast(exr_image.images)[idxB][i]; - if (idxA != -1) { - (*out_rgba)[4 * i + 3] = - reinterpret_cast(exr_image.images)[idxA][i]; - } else { - (*out_rgba)[4 * i + 3] = 1.0; - } - } - } - - (*width) = exr_image.width; - (*height) = exr_image.height; - - FreeEXRHeader(&exr_header); - FreeEXRImage(&exr_image); - - return TINYEXR_SUCCESS; -} - -int ParseEXRHeaderFromMemory(EXRHeader *exr_header, const EXRVersion *version, - const unsigned char *memory, size_t size, - const char **err) { - if (memory == NULL || exr_header == NULL) { - if (err) { - (*err) = "Invalid argument.\n"; - } - - // Invalid argument - return TINYEXR_ERROR_INVALID_ARGUMENT; - } - - if (size < tinyexr::kEXRVersionSize) { - return TINYEXR_ERROR_INVALID_DATA; - } - - const unsigned char *marker = memory + tinyexr::kEXRVersionSize; - size_t marker_size = size - tinyexr::kEXRVersionSize; - - tinyexr::HeaderInfo info; - info.clear(); - - std::string err_str; - int ret = ParseEXRHeader(&info, NULL, version, &err_str, marker, marker_size); - - if (ret != TINYEXR_SUCCESS) { - if (err && !err_str.empty()) { -#ifdef _WIN32 - (*err) = _strdup(err_str.c_str()); // May leak -#else - (*err) = strdup(err_str.c_str()); // May leak -#endif - } - } - - ConvertHeader(exr_header, info); - - // transfoer `tiled` from version. - exr_header->tiled = version->tiled; - - return ret; -} - -int LoadEXRFromMemory(float **out_rgba, int *width, int *height, - const unsigned char *memory, size_t size, - const char **err) { - if (out_rgba == NULL || memory == NULL) { - if (err) { - (*err) = "Invalid argument.\n"; - } - return TINYEXR_ERROR_INVALID_ARGUMENT; - } - - EXRVersion exr_version; - EXRImage exr_image; - EXRHeader exr_header; - - InitEXRHeader(&exr_header); - - int ret = ParseEXRVersionFromMemory(&exr_version, memory, size); - if (ret != TINYEXR_SUCCESS) { - return ret; - } - - ret = ParseEXRHeaderFromMemory(&exr_header, &exr_version, memory, size, err); - if (ret != TINYEXR_SUCCESS) { - return ret; - } - - // Read HALF channel as FLOAT. - for (int i = 0; i < exr_header.num_channels; i++) { - if (exr_header.pixel_types[i] == TINYEXR_PIXELTYPE_HALF) { - exr_header.requested_pixel_types[i] = TINYEXR_PIXELTYPE_FLOAT; - } - } - - InitEXRImage(&exr_image); - ret = LoadEXRImageFromMemory(&exr_image, &exr_header, memory, size, err); - if (ret != TINYEXR_SUCCESS) { - return ret; - } - - // RGBA - int idxR = -1; - int idxG = -1; - int idxB = -1; - int idxA = -1; - for (int c = 0; c < exr_header.num_channels; c++) { - if (strcmp(exr_header.channels[c].name, "R") == 0) { - idxR = c; - } else if (strcmp(exr_header.channels[c].name, "G") == 0) { - idxG = c; - } else if (strcmp(exr_header.channels[c].name, "B") == 0) { - idxB = c; - } else if (strcmp(exr_header.channels[c].name, "A") == 0) { - idxA = c; - } - } - - if (idxR == -1) { - if (err) { - (*err) = "R channel not found\n"; - } - - // @todo { free exr_image } - return TINYEXR_ERROR_INVALID_DATA; - } - - if (idxG == -1) { - if (err) { - (*err) = "G channel not found\n"; - } - // @todo { free exr_image } - return TINYEXR_ERROR_INVALID_DATA; - } - - if (idxB == -1) { - if (err) { - (*err) = "B channel not found\n"; - } - // @todo { free exr_image } - return TINYEXR_ERROR_INVALID_DATA; - } - - (*out_rgba) = reinterpret_cast( - malloc(4 * sizeof(float) * static_cast(exr_image.width) * - static_cast(exr_image.height))); - - for (int i = 0; i < exr_image.width * exr_image.height; i++) { - (*out_rgba)[4 * i + 0] = - reinterpret_cast(exr_image.images)[idxR][i]; - (*out_rgba)[4 * i + 1] = - reinterpret_cast(exr_image.images)[idxG][i]; - (*out_rgba)[4 * i + 2] = - reinterpret_cast(exr_image.images)[idxB][i]; - if (idxA != -1) { - (*out_rgba)[4 * i + 3] = - reinterpret_cast(exr_image.images)[idxA][i]; - } - else { - (*out_rgba)[4 * i + 3] = 1.0; - } - } - - (*width) = exr_image.width; - (*height) = exr_image.height; - - FreeEXRHeader(&exr_header); - FreeEXRImage(&exr_image); - - return TINYEXR_SUCCESS; -} - -int LoadEXRImageFromFile(EXRImage *exr_image, const EXRHeader *exr_header, - const char *filename, const char **err) { - if (exr_image == NULL) { - if (err) { - (*err) = "Invalid argument."; - } - return TINYEXR_ERROR_INVALID_ARGUMENT; - } - -#ifdef _WIN32 - FILE *fp = NULL; - fopen_s(&fp, filename, "rb"); -#else - FILE *fp = fopen(filename, "rb"); -#endif - if (!fp) { - if (err) { - (*err) = "Cannot read file."; - } - return TINYEXR_ERROR_CANT_OPEN_FILE; - } - - size_t filesize; - // Compute size - fseek(fp, 0, SEEK_END); - filesize = static_cast(ftell(fp)); - fseek(fp, 0, SEEK_SET); - - std::vector buf(filesize); // @todo { use mmap } - { - size_t ret; - ret = fread(&buf[0], 1, filesize, fp); - assert(ret == filesize); - fclose(fp); - (void)ret; - } - - return LoadEXRImageFromMemory(exr_image, exr_header, &buf.at(0), filesize, - err); -} - -int LoadEXRImageFromMemory(EXRImage *exr_image, const EXRHeader *exr_header, - const unsigned char *memory, const size_t size, - const char **err) { - if (exr_image == NULL || memory == NULL || - (size < tinyexr::kEXRVersionSize)) { - if (err) { - (*err) = "Invalid argument."; - } - return TINYEXR_ERROR_INVALID_ARGUMENT; - } - - if (exr_header->header_len == 0) { - if (err) { - (*err) = "EXRHeader is not initialized."; - } - return TINYEXR_ERROR_INVALID_ARGUMENT; - } - - const unsigned char *head = memory; - const unsigned char *marker = reinterpret_cast( - memory + exr_header->header_len + - 8); // +8 for magic number + version header. - return tinyexr::DecodeEXRImage(exr_image, exr_header, head, marker, size, - err); -} - -size_t SaveEXRImageToMemory(const EXRImage *exr_image, - const EXRHeader *exr_header, - unsigned char **memory_out, const char **err) { - if (exr_image == NULL || memory_out == NULL || - exr_header->compression_type < 0) { - if (err) { - (*err) = "Invalid argument."; - } - return 0; // @fixme - } - -#if !TINYEXR_USE_PIZ - if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_PIZ) { - if (err) { - (*err) = "PIZ compression is not supported in this build."; - } - return 0; - } -#endif - -#if !TINYEXR_USE_ZFP - if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_ZFP) { - if (err) { - (*err) = "ZFP compression is not supported in this build."; - } - return 0; - } -#endif - -#if TINYEXR_USE_ZFP - for (size_t i = 0; i < static_cast(exr_header->num_channels); i++) { - if (exr_header->requested_pixel_types[i] != TINYEXR_PIXELTYPE_FLOAT) { - if (err) { - (*err) = "Pixel type must be FLOAT for ZFP compression."; - } - return 0; - } - } -#endif - - std::vector memory; - - // Header - { - const char header[] = {0x76, 0x2f, 0x31, 0x01}; - memory.insert(memory.end(), header, header + 4); - } - - // Version, scanline. - { - char marker[] = {2, 0, 0, 0}; - /* @todo - if (exr_header->tiled) { - marker[1] |= 0x2; - } - if (exr_header->long_name) { - marker[1] |= 0x4; - } - if (exr_header->non_image) { - marker[1] |= 0x8; - } - if (exr_header->multipart) { - marker[1] |= 0x10; - } - */ - memory.insert(memory.end(), marker, marker + 4); - } - - int num_scanlines = 1; - if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_ZIP) { - num_scanlines = 16; - } else if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_PIZ) { - num_scanlines = 32; - } else if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_ZFP) { - num_scanlines = 16; - } - - // Write attributes. - std::vector channels; - { - std::vector data; - - for (int c = 0; c < exr_header->num_channels; c++) { - tinyexr::ChannelInfo info; - info.p_linear = 0; - info.pixel_type = exr_header->requested_pixel_types[c]; - info.x_sampling = 1; - info.y_sampling = 1; - info.name = std::string(exr_header->channels[c].name); - channels.push_back(info); - } - - tinyexr::WriteChannelInfo(data, channels); - - tinyexr::WriteAttributeToMemory(&memory, "channels", "chlist", &data.at(0), - static_cast(data.size())); - } - - { - int comp = exr_header->compression_type; - tinyexr::swap4(reinterpret_cast(&comp)); - tinyexr::WriteAttributeToMemory( - &memory, "compression", "compression", - reinterpret_cast(&comp), 1); - } - - { - int data[4] = {0, 0, exr_image->width - 1, exr_image->height - 1}; - tinyexr::swap4(reinterpret_cast(&data[0])); - tinyexr::swap4(reinterpret_cast(&data[1])); - tinyexr::swap4(reinterpret_cast(&data[2])); - tinyexr::swap4(reinterpret_cast(&data[3])); - tinyexr::WriteAttributeToMemory( - &memory, "dataWindow", "box2i", - reinterpret_cast(data), sizeof(int) * 4); - tinyexr::WriteAttributeToMemory( - &memory, "displayWindow", "box2i", - reinterpret_cast(data), sizeof(int) * 4); - } - - { - unsigned char line_order = 0; // @fixme { read line_order from EXRHeader } - tinyexr::WriteAttributeToMemory(&memory, "lineOrder", "lineOrder", - &line_order, 1); - } - - { - float aspectRatio = 1.0f; - tinyexr::swap4(reinterpret_cast(&aspectRatio)); - tinyexr::WriteAttributeToMemory( - &memory, "pixelAspectRatio", "float", - reinterpret_cast(&aspectRatio), sizeof(float)); - } - - { - float center[2] = {0.0f, 0.0f}; - tinyexr::swap4(reinterpret_cast(¢er[0])); - tinyexr::swap4(reinterpret_cast(¢er[1])); - tinyexr::WriteAttributeToMemory( - &memory, "screenWindowCenter", "v2f", - reinterpret_cast(center), 2 * sizeof(float)); - } - - { - float w = static_cast(exr_image->width); - tinyexr::swap4(reinterpret_cast(&w)); - tinyexr::WriteAttributeToMemory(&memory, "screenWindowWidth", "float", - reinterpret_cast(&w), - sizeof(float)); - } - - // Custom attributes - if (exr_header->num_custom_attributes > 0) { - for (int i = 0; i < exr_header->num_custom_attributes; i++) { - tinyexr::WriteAttributeToMemory( - &memory, exr_header->custom_attributes[i].name, - exr_header->custom_attributes[i].type, - reinterpret_cast( - exr_header->custom_attributes[i].value), - exr_header->custom_attributes[i].size); - } - } - - { // end of header - unsigned char e = 0; - memory.push_back(e); - } - - int num_blocks = exr_image->height / num_scanlines; - if (num_blocks * num_scanlines < exr_image->height) { - num_blocks++; - } - - std::vector offsets(static_cast(num_blocks)); - - size_t headerSize = memory.size(); - tinyexr::tinyexr_uint64 offset = - headerSize + - static_cast(num_blocks) * - sizeof( - tinyexr::tinyexr_int64); // sizeof(header) + sizeof(offsetTable) - - std::vector data; - - std::vector > data_list( - static_cast(num_blocks)); - std::vector channel_offset_list( - static_cast(exr_header->num_channels)); - - int pixel_data_size = 0; - size_t channel_offset = 0; - for (size_t c = 0; c < static_cast(exr_header->num_channels); c++) { - channel_offset_list[c] = channel_offset; - if (exr_header->requested_pixel_types[c] == TINYEXR_PIXELTYPE_HALF) { - pixel_data_size += sizeof(unsigned short); - channel_offset += sizeof(unsigned short); - } else if (exr_header->requested_pixel_types[c] == - TINYEXR_PIXELTYPE_FLOAT) { - pixel_data_size += sizeof(float); - channel_offset += sizeof(float); - } else if (exr_header->requested_pixel_types[c] == TINYEXR_PIXELTYPE_UINT) { - pixel_data_size += sizeof(unsigned int); - channel_offset += sizeof(unsigned int); - } else { - assert(0); - } - } - -#if TINYEXR_USE_ZFP - tinyexr::ZFPCompressionParam zfp_compression_param; - - // Use ZFP compression parameter from custom attributes(if such a parameter - // exists) - { - bool ret = tinyexr::FindZFPCompressionParam( - &zfp_compression_param, exr_header->custom_attributes, - exr_header->num_custom_attributes); - - if (!ret) { - // Use predefined compression parameter. - zfp_compression_param.type = 0; - zfp_compression_param.rate = 2; - } - } -#endif - -// Use signed int since some OpenMP compiler doesn't allow unsigned type for -// `parallel for` -#ifdef _OPENMP -#pragma omp parallel for -#endif - for (int i = 0; i < num_blocks; i++) { - size_t ii = static_cast(i); - int start_y = num_scanlines * i; - int endY = (std::min)(num_scanlines * (i + 1), exr_image->height); - int h = endY - start_y; - - std::vector buf( - static_cast(exr_image->width * h * pixel_data_size)); - - for (size_t c = 0; c < static_cast(exr_header->num_channels); c++) { - if (exr_header->pixel_types[c] == TINYEXR_PIXELTYPE_HALF) { - if (exr_header->requested_pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT) { - for (int y = 0; y < h; y++) { - for (int x = 0; x < exr_image->width; x++) { - tinyexr::FP16 h16; - h16.u = reinterpret_cast( - exr_image->images)[c][(y + start_y) * exr_image->width + x]; - - tinyexr::FP32 f32 = half_to_float(h16); - - tinyexr::swap4(reinterpret_cast(&f32.f)); - - // Assume increasing Y - float *line_ptr = reinterpret_cast(&buf.at( - static_cast(pixel_data_size * y * exr_image->width) + - channel_offset_list[c] * - static_cast(exr_image->width))); - line_ptr[x] = f32.f; - } - } - } else if (exr_header->requested_pixel_types[c] == - TINYEXR_PIXELTYPE_HALF) { - for (int y = 0; y < h; y++) { - for (int x = 0; x < exr_image->width; x++) { - unsigned short val = reinterpret_cast( - exr_image->images)[c][(y + start_y) * exr_image->width + x]; - - tinyexr::swap2(&val); - - // Assume increasing Y - unsigned short *line_ptr = reinterpret_cast( - &buf.at(static_cast(pixel_data_size * y * - exr_image->width) + - channel_offset_list[c] * - static_cast(exr_image->width))); - line_ptr[x] = val; - } - } - } else { - assert(0); - } - - } else if (exr_header->pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT) { - if (exr_header->requested_pixel_types[c] == TINYEXR_PIXELTYPE_HALF) { - for (int y = 0; y < h; y++) { - for (int x = 0; x < exr_image->width; x++) { - tinyexr::FP32 f32; - f32.f = reinterpret_cast( - exr_image->images)[c][(y + start_y) * exr_image->width + x]; - - tinyexr::FP16 h16; - h16 = float_to_half_full(f32); - - tinyexr::swap2(reinterpret_cast(&h16.u)); - - // Assume increasing Y - unsigned short *line_ptr = reinterpret_cast( - &buf.at(static_cast(pixel_data_size * y * - exr_image->width) + - channel_offset_list[c] * - static_cast(exr_image->width))); - line_ptr[x] = h16.u; - } - } - } else if (exr_header->requested_pixel_types[c] == - TINYEXR_PIXELTYPE_FLOAT) { - for (int y = 0; y < h; y++) { - for (int x = 0; x < exr_image->width; x++) { - float val = reinterpret_cast( - exr_image->images)[c][(y + start_y) * exr_image->width + x]; - - tinyexr::swap4(reinterpret_cast(&val)); - - // Assume increasing Y - float *line_ptr = reinterpret_cast(&buf.at( - static_cast(pixel_data_size * y * exr_image->width) + - channel_offset_list[c] * - static_cast(exr_image->width))); - line_ptr[x] = val; - } - } - } else { - assert(0); - } - } else if (exr_header->pixel_types[c] == TINYEXR_PIXELTYPE_UINT) { - for (int y = 0; y < h; y++) { - for (int x = 0; x < exr_image->width; x++) { - unsigned int val = reinterpret_cast( - exr_image->images)[c][(y + start_y) * exr_image->width + x]; - - tinyexr::swap4(&val); - - // Assume increasing Y - unsigned int *line_ptr = reinterpret_cast(&buf.at( - static_cast(pixel_data_size * y * exr_image->width) + - channel_offset_list[c] * - static_cast(exr_image->width))); - line_ptr[x] = val; - } - } - } - } - - if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_NONE) { - // 4 byte: scan line - // 4 byte: data size - // ~ : pixel data(uncompressed) - std::vector header(8); - unsigned int data_len = static_cast(buf.size()); - memcpy(&header.at(0), &start_y, sizeof(int)); - memcpy(&header.at(4), &data_len, sizeof(unsigned int)); - - tinyexr::swap4(reinterpret_cast(&header.at(0))); - tinyexr::swap4(reinterpret_cast(&header.at(4))); - - data_list[ii].insert(data_list[ii].end(), header.begin(), header.end()); - data_list[ii].insert(data_list[ii].end(), buf.begin(), - buf.begin() + data_len); - - } else if ((exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_ZIPS) || - (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_ZIP)) { -#if TINYEXR_USE_MINIZ - std::vector block(tinyexr::miniz::mz_compressBound( - static_cast(buf.size()))); -#else - std::vector block( - compressBound(static_cast(buf.size()))); -#endif - tinyexr::tinyexr_uint64 outSize = block.size(); - - tinyexr::CompressZip(&block.at(0), outSize, - reinterpret_cast(&buf.at(0)), - static_cast(buf.size())); - - // 4 byte: scan line - // 4 byte: data size - // ~ : pixel data(compressed) - std::vector header(8); - unsigned int data_len = static_cast(outSize); // truncate - memcpy(&header.at(0), &start_y, sizeof(int)); - memcpy(&header.at(4), &data_len, sizeof(unsigned int)); - - tinyexr::swap4(reinterpret_cast(&header.at(0))); - tinyexr::swap4(reinterpret_cast(&header.at(4))); - - data_list[ii].insert(data_list[ii].end(), header.begin(), header.end()); - data_list[ii].insert(data_list[ii].end(), block.begin(), - block.begin() + data_len); - - } else if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_RLE) { - // (buf.size() * 3) / 2 would be enough. - std::vector block((buf.size() * 3) / 2); - - tinyexr::tinyexr_uint64 outSize = block.size(); - - tinyexr::CompressRle(&block.at(0), outSize, - reinterpret_cast(&buf.at(0)), - static_cast(buf.size())); - - // 4 byte: scan line - // 4 byte: data size - // ~ : pixel data(compressed) - std::vector header(8); - unsigned int data_len = static_cast(outSize); // truncate - memcpy(&header.at(0), &start_y, sizeof(int)); - memcpy(&header.at(4), &data_len, sizeof(unsigned int)); - - tinyexr::swap4(reinterpret_cast(&header.at(0))); - tinyexr::swap4(reinterpret_cast(&header.at(4))); - - data_list[ii].insert(data_list[ii].end(), header.begin(), header.end()); - data_list[ii].insert(data_list[ii].end(), block.begin(), - block.begin() + data_len); - - } else if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_PIZ) { -#if TINYEXR_USE_PIZ - unsigned int bufLen = - 1024 + static_cast( - 1.2 * static_cast( - buf.size())); // @fixme { compute good bound. } - std::vector block(bufLen); - unsigned int outSize = static_cast(block.size()); - - CompressPiz(&block.at(0), &outSize, - reinterpret_cast(&buf.at(0)), - buf.size(), channels, exr_image->width, h); - - // 4 byte: scan line - // 4 byte: data size - // ~ : pixel data(compressed) - std::vector header(8); - unsigned int data_len = outSize; - memcpy(&header.at(0), &start_y, sizeof(int)); - memcpy(&header.at(4), &data_len, sizeof(unsigned int)); - - tinyexr::swap4(reinterpret_cast(&header.at(0))); - tinyexr::swap4(reinterpret_cast(&header.at(4))); - - data_list[ii].insert(data_list[ii].end(), header.begin(), header.end()); - data_list[ii].insert(data_list[ii].end(), block.begin(), - block.begin() + data_len); - -#else - assert(0); -#endif - } else if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_ZFP) { -#if TINYEXR_USE_ZFP - std::vector block; - unsigned int outSize; - - tinyexr::CompressZfp( - &block, &outSize, reinterpret_cast(&buf.at(0)), - exr_image->width, h, exr_header->num_channels, zfp_compression_param); - - // 4 byte: scan line - // 4 byte: data size - // ~ : pixel data(compressed) - std::vector header(8); - unsigned int data_len = outSize; - memcpy(&header.at(0), &start_y, sizeof(int)); - memcpy(&header.at(4), &data_len, sizeof(unsigned int)); - - tinyexr::swap4(reinterpret_cast(&header.at(0))); - tinyexr::swap4(reinterpret_cast(&header.at(4))); - - data_list[ii].insert(data_list[ii].end(), header.begin(), header.end()); - data_list[ii].insert(data_list[ii].end(), block.begin(), - block.begin() + data_len); - -#else - assert(0); -#endif - } else { - assert(0); - } - } // omp parallel - - for (size_t i = 0; i < static_cast(num_blocks); i++) { - data.insert(data.end(), data_list[i].begin(), data_list[i].end()); - - offsets[i] = offset; - tinyexr::swap8(reinterpret_cast(&offsets[i])); - offset += data_list[i].size(); - } - - { - memory.insert( - memory.end(), reinterpret_cast(&offsets.at(0)), - reinterpret_cast(&offsets.at(0)) + - sizeof(tinyexr::tinyexr_uint64) * static_cast(num_blocks)); - } - - { memory.insert(memory.end(), data.begin(), data.end()); } - - assert(memory.size() > 0); - - (*memory_out) = static_cast(malloc(memory.size())); - memcpy((*memory_out), &memory.at(0), memory.size()); - - return memory.size(); // OK -} - -int SaveEXRImageToFile(const EXRImage *exr_image, const EXRHeader *exr_header, - const char *filename, const char **err) { - if (exr_image == NULL || filename == NULL || - exr_header->compression_type < 0) { - if (err) { - (*err) = "Invalid argument."; - } - return TINYEXR_ERROR_INVALID_ARGUMENT; - } - -#if !TINYEXR_USE_PIZ - if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_PIZ) { - if (err) { - (*err) = "PIZ compression is not supported in this build."; - } - return 0; - } -#endif - -#if !TINYEXR_USE_ZFP - if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_ZFP) { - if (err) { - (*err) = "ZFP compression is not supported in this build."; - } - return 0; - } -#endif - -#ifdef _WIN32 - FILE *fp = NULL; - fopen_s(&fp, filename, "wb"); -#else - FILE *fp = fopen(filename, "wb"); -#endif - if (!fp) { - if (err) { - (*err) = "Cannot write a file."; - } - return TINYEXR_ERROR_CANT_OPEN_FILE; - } - - unsigned char *mem = NULL; - size_t mem_size = SaveEXRImageToMemory(exr_image, exr_header, &mem, err); - - if ((mem_size > 0) && mem) { - fwrite(mem, 1, mem_size, fp); - } - free(mem); - - fclose(fp); - - return TINYEXR_SUCCESS; -} - -int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) { - if (deep_image == NULL) { - if (err) { - (*err) = "Invalid argument."; - } - return TINYEXR_ERROR_INVALID_ARGUMENT; - } - -#ifdef _MSC_VER - FILE *fp = NULL; - errno_t errcode = fopen_s(&fp, filename, "rb"); - if ((!errcode) || (!fp)) { - if (err) { - (*err) = "Cannot read file."; - } - return TINYEXR_ERROR_CANT_OPEN_FILE; - } -#else - FILE *fp = fopen(filename, "rb"); - if (!fp) { - if (err) { - (*err) = "Cannot read file."; - } - return TINYEXR_ERROR_CANT_OPEN_FILE; - } -#endif - - size_t filesize; - // Compute size - fseek(fp, 0, SEEK_END); - filesize = static_cast(ftell(fp)); - fseek(fp, 0, SEEK_SET); - - if (filesize == 0) { - fclose(fp); - if (err) { - (*err) = "File size is zero."; - } - return TINYEXR_ERROR_INVALID_FILE; - } - - std::vector buf(filesize); // @todo { use mmap } - { - size_t ret; - ret = fread(&buf[0], 1, filesize, fp); - assert(ret == filesize); - (void)ret; - } - fclose(fp); - - const char *head = &buf[0]; - const char *marker = &buf[0]; - - // Header check. - { - const char header[] = {0x76, 0x2f, 0x31, 0x01}; - - if (memcmp(marker, header, 4) != 0) { - if (err) { - (*err) = "Invalid magic number."; - } - return TINYEXR_ERROR_INVALID_MAGIC_NUMBER; - } - marker += 4; - } - - // Version, scanline. - { - // ver 2.0, scanline, deep bit on(0x800) - // must be [2, 0, 0, 0] - if (marker[0] != 2 || marker[1] != 8 || marker[2] != 0 || marker[3] != 0) { - if (err) { - (*err) = "Unsupported version or scanline."; - } - return TINYEXR_ERROR_UNSUPPORTED_FORMAT; - } - - marker += 4; - } - - int dx = -1; - int dy = -1; - int dw = -1; - int dh = -1; - int num_scanline_blocks = 1; // 16 for ZIP compression. - int compression_type = -1; - int num_channels = -1; - std::vector channels; - - // Read attributes - size_t size = filesize - tinyexr::kEXRVersionSize; - for (;;) { - if (0 == size) { - return TINYEXR_ERROR_INVALID_DATA; - } else if (marker[0] == '\0') { - marker++; - size--; - break; - } - - std::string attr_name; - std::string attr_type; - std::vector data; - size_t marker_size; - if (!tinyexr::ReadAttribute(&attr_name, &attr_type, &data, &marker_size, - marker, size)) { - return TINYEXR_ERROR_INVALID_DATA; - } - marker += marker_size; - size -= marker_size; - - if (attr_name.compare("compression") == 0) { - compression_type = data[0]; - if (compression_type > TINYEXR_COMPRESSIONTYPE_PIZ) { - if (err) { - (*err) = "Unsupported compression type."; - } - return TINYEXR_ERROR_UNSUPPORTED_FORMAT; - } - - if (compression_type == TINYEXR_COMPRESSIONTYPE_ZIP) { - num_scanline_blocks = 16; - } - - } else if (attr_name.compare("channels") == 0) { - // name: zero-terminated string, from 1 to 255 bytes long - // pixel type: int, possible values are: UINT = 0 HALF = 1 FLOAT = 2 - // pLinear: unsigned char, possible values are 0 and 1 - // reserved: three chars, should be zero - // xSampling: int - // ySampling: int - - tinyexr::ReadChannelInfo(channels, data); - - num_channels = static_cast(channels.size()); - - if (num_channels < 1) { - if (err) { - (*err) = "Invalid channels format."; - } - return TINYEXR_ERROR_INVALID_DATA; - } - - } else if (attr_name.compare("dataWindow") == 0) { - memcpy(&dx, &data.at(0), sizeof(int)); - memcpy(&dy, &data.at(4), sizeof(int)); - memcpy(&dw, &data.at(8), sizeof(int)); - memcpy(&dh, &data.at(12), sizeof(int)); - tinyexr::swap4(reinterpret_cast(&dx)); - tinyexr::swap4(reinterpret_cast(&dy)); - tinyexr::swap4(reinterpret_cast(&dw)); - tinyexr::swap4(reinterpret_cast(&dh)); - - } else if (attr_name.compare("displayWindow") == 0) { - int x; - int y; - int w; - int h; - memcpy(&x, &data.at(0), sizeof(int)); - memcpy(&y, &data.at(4), sizeof(int)); - memcpy(&w, &data.at(8), sizeof(int)); - memcpy(&h, &data.at(12), sizeof(int)); - tinyexr::swap4(reinterpret_cast(&x)); - tinyexr::swap4(reinterpret_cast(&y)); - tinyexr::swap4(reinterpret_cast(&w)); - tinyexr::swap4(reinterpret_cast(&h)); - } - } - - assert(dx >= 0); - assert(dy >= 0); - assert(dw >= 0); - assert(dh >= 0); - assert(num_channels >= 1); - - int data_width = dw - dx + 1; - int data_height = dh - dy + 1; - - std::vector image( - static_cast(data_width * data_height * 4)); // 4 = RGBA - - // Read offset tables. - int num_blocks = data_height / num_scanline_blocks; - if (num_blocks * num_scanline_blocks < data_height) { - num_blocks++; - } - - std::vector offsets(static_cast(num_blocks)); - - for (size_t y = 0; y < static_cast(num_blocks); y++) { - tinyexr::tinyexr_int64 offset; - memcpy(&offset, marker, sizeof(tinyexr::tinyexr_int64)); - tinyexr::swap8(reinterpret_cast(&offset)); - marker += sizeof(tinyexr::tinyexr_int64); // = 8 - offsets[y] = offset; - } - -#if TINYEXR_USE_PIZ - if ((compression_type == TINYEXR_COMPRESSIONTYPE_NONE) || - (compression_type == TINYEXR_COMPRESSIONTYPE_RLE) || - (compression_type == TINYEXR_COMPRESSIONTYPE_ZIPS) || - (compression_type == TINYEXR_COMPRESSIONTYPE_ZIP) || - (compression_type == TINYEXR_COMPRESSIONTYPE_PIZ)) { -#else - if ((compression_type == TINYEXR_COMPRESSIONTYPE_NONE) || - (compression_type == TINYEXR_COMPRESSIONTYPE_RLE) || - (compression_type == TINYEXR_COMPRESSIONTYPE_ZIPS) || - (compression_type == TINYEXR_COMPRESSIONTYPE_ZIP)) { -#endif - // OK - } else { - if (err) { - (*err) = "Unsupported format."; - } - return TINYEXR_ERROR_UNSUPPORTED_FORMAT; - } - - deep_image->image = static_cast( - malloc(sizeof(float **) * static_cast(num_channels))); - for (int c = 0; c < num_channels; c++) { - deep_image->image[c] = static_cast( - malloc(sizeof(float *) * static_cast(data_height))); - for (int y = 0; y < data_height; y++) { - } - } - - deep_image->offset_table = static_cast( - malloc(sizeof(int *) * static_cast(data_height))); - for (int y = 0; y < data_height; y++) { - deep_image->offset_table[y] = static_cast( - malloc(sizeof(int) * static_cast(data_width))); - } - - for (size_t y = 0; y < static_cast(num_blocks); y++) { - const unsigned char *data_ptr = - reinterpret_cast(head + offsets[y]); - - // int: y coordinate - // int64: packed size of pixel offset table - // int64: packed size of sample data - // int64: unpacked size of sample data - // compressed pixel offset table - // compressed sample data - int line_no; - tinyexr::tinyexr_int64 packedOffsetTableSize; - tinyexr::tinyexr_int64 packedSampleDataSize; - tinyexr::tinyexr_int64 unpackedSampleDataSize; - memcpy(&line_no, data_ptr, sizeof(int)); - memcpy(&packedOffsetTableSize, data_ptr + 4, - sizeof(tinyexr::tinyexr_int64)); - memcpy(&packedSampleDataSize, data_ptr + 12, - sizeof(tinyexr::tinyexr_int64)); - memcpy(&unpackedSampleDataSize, data_ptr + 20, - sizeof(tinyexr::tinyexr_int64)); - - tinyexr::swap4(reinterpret_cast(&line_no)); - tinyexr::swap8( - reinterpret_cast(&packedOffsetTableSize)); - tinyexr::swap8( - reinterpret_cast(&packedSampleDataSize)); - tinyexr::swap8( - reinterpret_cast(&unpackedSampleDataSize)); - - std::vector pixelOffsetTable(static_cast(data_width)); - - // decode pixel offset table. - { - unsigned long dstLen = - static_cast(pixelOffsetTable.size() * sizeof(int)); - tinyexr::DecompressZip( - reinterpret_cast(&pixelOffsetTable.at(0)), &dstLen, - data_ptr + 28, static_cast(packedOffsetTableSize)); - - assert(dstLen == pixelOffsetTable.size() * sizeof(int)); - for (size_t i = 0; i < static_cast(data_width); i++) { - deep_image->offset_table[y][i] = pixelOffsetTable[i]; - } - } - - std::vector sample_data( - static_cast(unpackedSampleDataSize)); - - // decode sample data. - { - unsigned long dstLen = static_cast(unpackedSampleDataSize); - if (dstLen) { - tinyexr::DecompressZip( - reinterpret_cast(&sample_data.at(0)), &dstLen, - data_ptr + 28 + packedOffsetTableSize, - static_cast(packedSampleDataSize)); - assert(dstLen == static_cast(unpackedSampleDataSize)); - } - } - - // decode sample - int sampleSize = -1; - std::vector channel_offset_list(static_cast(num_channels)); - { - int channel_offset = 0; - for (size_t i = 0; i < static_cast(num_channels); i++) { - channel_offset_list[i] = channel_offset; - if (channels[i].pixel_type == TINYEXR_PIXELTYPE_UINT) { // UINT - channel_offset += 4; - } else if (channels[i].pixel_type == TINYEXR_PIXELTYPE_HALF) { // half - channel_offset += 2; - } else if (channels[i].pixel_type == - TINYEXR_PIXELTYPE_FLOAT) { // float - channel_offset += 4; - } else { - assert(0); - } - } - sampleSize = channel_offset; - } - assert(sampleSize >= 2); - - assert(static_cast( - pixelOffsetTable[static_cast(data_width - 1)] * - sampleSize) == sample_data.size()); - int samples_per_line = static_cast(sample_data.size()) / sampleSize; - - // - // Alloc memory - // - - // - // pixel data is stored as image[channels][pixel_samples] - // - { - tinyexr::tinyexr_uint64 data_offset = 0; - for (size_t c = 0; c < static_cast(num_channels); c++) { - deep_image->image[c][y] = static_cast( - malloc(sizeof(float) * static_cast(samples_per_line))); - - if (channels[c].pixel_type == 0) { // UINT - for (size_t x = 0; x < static_cast(samples_per_line); x++) { - unsigned int ui = *reinterpret_cast( - &sample_data.at(size_t(data_offset) + x * sizeof(int))); - deep_image->image[c][y][x] = static_cast(ui); // @fixme - } - data_offset += - sizeof(unsigned int) * static_cast(samples_per_line); - } else if (channels[c].pixel_type == 1) { // half - for (size_t x = 0; x < static_cast(samples_per_line); x++) { - tinyexr::FP16 f16; - f16.u = *reinterpret_cast( - &sample_data.at(size_t(data_offset) + x * sizeof(short))); - tinyexr::FP32 f32 = half_to_float(f16); - deep_image->image[c][y][x] = f32.f; - } - data_offset += sizeof(short) * static_cast(samples_per_line); - } else { // float - for (size_t x = 0; x < static_cast(samples_per_line); x++) { - float f = *reinterpret_cast( - &sample_data.at(size_t(data_offset) + x * sizeof(float))); - deep_image->image[c][y][x] = f; - } - data_offset += sizeof(float) * static_cast(samples_per_line); - } - } - } - } // y - - deep_image->width = data_width; - deep_image->height = data_height; - - deep_image->channel_names = static_cast( - malloc(sizeof(const char *) * static_cast(num_channels))); - for (size_t c = 0; c < static_cast(num_channels); c++) { -#ifdef _WIN32 - deep_image->channel_names[c] = _strdup(channels[c].name.c_str()); -#else - deep_image->channel_names[c] = strdup(channels[c].name.c_str()); -#endif - } - deep_image->num_channels = num_channels; - - return TINYEXR_SUCCESS; -} - -void InitEXRImage(EXRImage *exr_image) { - if (exr_image == NULL) { - return; - } - - exr_image->width = 0; - exr_image->height = 0; - exr_image->num_channels = 0; - - exr_image->images = NULL; - exr_image->tiles = NULL; - - exr_image->num_tiles = 0; -} - -void InitEXRHeader(EXRHeader *exr_header) { - if (exr_header == NULL) { - return; - } - - memset(exr_header, 0, sizeof(EXRHeader)); -} - -int FreeEXRHeader(EXRHeader *exr_header) { - if (exr_header == NULL) { - return TINYEXR_ERROR_INVALID_ARGUMENT; - } - - if (exr_header->channels) { - free(exr_header->channels); - } - - if (exr_header->pixel_types) { - free(exr_header->pixel_types); - } - - if (exr_header->requested_pixel_types) { - free(exr_header->requested_pixel_types); - } - - for (int i = 0; i < exr_header->num_custom_attributes; i++) { - if (exr_header->custom_attributes[i].value) { - free(exr_header->custom_attributes[i].value); - } - } - - return TINYEXR_SUCCESS; -} - -int FreeEXRImage(EXRImage *exr_image) { - if (exr_image == NULL) { - return TINYEXR_ERROR_INVALID_ARGUMENT; - } - - for (int i = 0; i < exr_image->num_channels; i++) { - if (exr_image->images && exr_image->images[i]) { - free(exr_image->images[i]); - } - } - - if (exr_image->images) { - free(exr_image->images); - } - - if (exr_image->tiles) { - for (int tid = 0; tid < exr_image->num_tiles; tid++) { - for (int i = 0; i < exr_image->num_channels; i++) { - if (exr_image->tiles[tid].images && exr_image->tiles[tid].images[i]) { - free(exr_image->tiles[tid].images[i]); - } - } - if (exr_image->tiles[tid].images) { - free(exr_image->tiles[tid].images); - } - } - } - - return TINYEXR_SUCCESS; -} - -int ParseEXRHeaderFromFile(EXRHeader *exr_header, const EXRVersion *exr_version, - const char *filename, const char **err) { - if (exr_header == NULL || exr_version == NULL || filename == NULL) { - if (err) { - (*err) = "Invalid argument."; - } - return TINYEXR_ERROR_INVALID_ARGUMENT; - } - -#ifdef _WIN32 - FILE *fp = NULL; - fopen_s(&fp, filename, "rb"); -#else - FILE *fp = fopen(filename, "rb"); -#endif - if (!fp) { - if (err) { - (*err) = "Cannot read file."; - } - return TINYEXR_ERROR_CANT_OPEN_FILE; - } - - size_t filesize; - // Compute size - fseek(fp, 0, SEEK_END); - filesize = static_cast(ftell(fp)); - fseek(fp, 0, SEEK_SET); - - std::vector buf(filesize); // @todo { use mmap } - { - size_t ret; - ret = fread(&buf[0], 1, filesize, fp); - assert(ret == filesize); - fclose(fp); - - if (ret != filesize) { - if (err) { - (*err) = "fread error."; - } - return TINYEXR_ERROR_INVALID_FILE; - } - } - - return ParseEXRHeaderFromMemory(exr_header, exr_version, &buf.at(0), filesize, - err); -} - -int ParseEXRMultipartHeaderFromMemory(EXRHeader ***exr_headers, - int *num_headers, - const EXRVersion *exr_version, - const unsigned char *memory, size_t size, - const char **err) { - if (memory == NULL || exr_headers == NULL || num_headers == NULL || - exr_version == NULL) { - // Invalid argument - return TINYEXR_ERROR_INVALID_ARGUMENT; - } - - if (size < tinyexr::kEXRVersionSize) { - return TINYEXR_ERROR_INVALID_DATA; - } - - const unsigned char *marker = memory + tinyexr::kEXRVersionSize; - size_t marker_size = size - tinyexr::kEXRVersionSize; - - std::vector infos; - - for (;;) { - tinyexr::HeaderInfo info; - info.clear(); - - std::string err_str; - bool empty_header = false; - int ret = ParseEXRHeader(&info, &empty_header, exr_version, &err_str, - marker, marker_size); - - if (ret != TINYEXR_SUCCESS) { - if (err) { -#ifdef _WIN32 - (*err) = _strdup(err_str.c_str()); // may leak -#else - (*err) = strdup(err_str.c_str()); // may leak -#endif - } - return ret; - } - - if (empty_header) { - marker += 1; // skip '\0' - break; - } - - // `chunkCount` must exist in the header. - if (info.chunk_count == 0) { - if (err) { - (*err) = "`chunkCount' attribute is not found in the header."; - } - return TINYEXR_ERROR_INVALID_DATA; - } - - infos.push_back(info); - - // move to next header. - marker += info.header_len; - size -= info.header_len; - } - - // allocate memory for EXRHeader and create array of EXRHeader pointers. - (*exr_headers) = - static_cast(malloc(sizeof(EXRHeader *) * infos.size())); - for (size_t i = 0; i < infos.size(); i++) { - EXRHeader *exr_header = static_cast(malloc(sizeof(EXRHeader))); - - ConvertHeader(exr_header, infos[i]); - - // transfoer `tiled` from version. - exr_header->tiled = exr_version->tiled; - - (*exr_headers)[i] = exr_header; - } - - (*num_headers) = static_cast(infos.size()); - - return TINYEXR_SUCCESS; -} - -int ParseEXRMultipartHeaderFromFile(EXRHeader ***exr_headers, int *num_headers, - const EXRVersion *exr_version, - const char *filename, const char **err) { - if (exr_headers == NULL || num_headers == NULL || exr_version == NULL || - filename == NULL) { - if (err) { - (*err) = "Invalid argument."; - } - return TINYEXR_ERROR_INVALID_ARGUMENT; - } - -#ifdef _WIN32 - FILE *fp = NULL; - fopen_s(&fp, filename, "rb"); -#else - FILE *fp = fopen(filename, "rb"); -#endif - if (!fp) { - if (err) { - (*err) = "Cannot read file."; - } - return TINYEXR_ERROR_CANT_OPEN_FILE; - } - - size_t filesize; - // Compute size - fseek(fp, 0, SEEK_END); - filesize = static_cast(ftell(fp)); - fseek(fp, 0, SEEK_SET); - - std::vector buf(filesize); // @todo { use mmap } - { - size_t ret; - ret = fread(&buf[0], 1, filesize, fp); - assert(ret == filesize); - fclose(fp); - - if (ret != filesize) { - if (err) { - (*err) = "fread error."; - } - return TINYEXR_ERROR_INVALID_FILE; - } - } - - return ParseEXRMultipartHeaderFromMemory( - exr_headers, num_headers, exr_version, &buf.at(0), filesize, err); -} - -int ParseEXRVersionFromMemory(EXRVersion *version, const unsigned char *memory, - size_t size) { - if (version == NULL || memory == NULL) { - return TINYEXR_ERROR_INVALID_ARGUMENT; - } - - if (size < tinyexr::kEXRVersionSize) { - return TINYEXR_ERROR_INVALID_DATA; - } - - const unsigned char *marker = memory; - - // Header check. - { - const char header[] = {0x76, 0x2f, 0x31, 0x01}; - - if (memcmp(marker, header, 4) != 0) { - return TINYEXR_ERROR_INVALID_MAGIC_NUMBER; - } - marker += 4; - } - - version->tiled = false; - version->long_name = false; - version->non_image = false; - version->multipart = false; - - // Parse version header. - { - // must be 2 - if (marker[0] != 2) { - return TINYEXR_ERROR_INVALID_EXR_VERSION; - } - - if (version == NULL) { - return TINYEXR_SUCCESS; // May OK - } - - version->version = 2; - - if (marker[1] & 0x2) { // 9th bit - version->tiled = true; - } - if (marker[1] & 0x4) { // 10th bit - version->long_name = true; - } - if (marker[1] & 0x8) { // 11th bit - version->non_image = true; // (deep image) - } - if (marker[1] & 0x10) { // 12th bit - version->multipart = true; - } - } - - return TINYEXR_SUCCESS; -} - -int ParseEXRVersionFromFile(EXRVersion *version, const char *filename) { - if (filename == NULL) { - return TINYEXR_ERROR_INVALID_ARGUMENT; - } - -#ifdef _WIN32 - FILE *fp = NULL; - fopen_s(&fp, filename, "rb"); -#else - FILE *fp = fopen(filename, "rb"); -#endif - if (!fp) { - return TINYEXR_ERROR_CANT_OPEN_FILE; - } - - size_t file_size; - // Compute size - fseek(fp, 0, SEEK_END); - file_size = static_cast(ftell(fp)); - fseek(fp, 0, SEEK_SET); - - if (file_size < tinyexr::kEXRVersionSize) { - return TINYEXR_ERROR_INVALID_FILE; - } - - unsigned char buf[tinyexr::kEXRVersionSize]; - size_t ret = fread(&buf[0], 1, tinyexr::kEXRVersionSize, fp); - fclose(fp); - - if (ret != tinyexr::kEXRVersionSize) { - return TINYEXR_ERROR_INVALID_FILE; - } - - return ParseEXRVersionFromMemory(version, buf, tinyexr::kEXRVersionSize); -} - -int LoadEXRMultipartImageFromMemory(EXRImage *exr_images, - const EXRHeader **exr_headers, - unsigned int num_parts, - const unsigned char *memory, - const size_t size, const char **err) { - if (exr_images == NULL || exr_headers == NULL || num_parts == 0 || - memory == NULL || (size <= tinyexr::kEXRVersionSize)) { - if (err) { - (*err) = "Invalid argument."; - } - return TINYEXR_ERROR_INVALID_ARGUMENT; - } - - // compute total header size. - size_t total_header_size = 0; - for (unsigned int i = 0; i < num_parts; i++) { - if (exr_headers[i]->header_len == 0) { - if (err) { - (*err) = "EXRHeader is not initialized."; - } - return TINYEXR_ERROR_INVALID_ARGUMENT; - } - - total_header_size += exr_headers[i]->header_len; - } - - const char *marker = reinterpret_cast( - memory + total_header_size + 4 + - 4); // +8 for magic number and version header. - - marker += 1; // Skip empty header. - - // NOTE 1: - // In multipart image, There is 'part number' before chunk data. - // 4 byte : part number - // 4+ : chunk - // - // NOTE 2: - // EXR spec says 'part number' is 'unsigned long' but actually this is - // 'unsigned int(4 bytes)' in OpenEXR implementation... - // http://www.openexr.com/openexrfilelayout.pdf - - // Load chunk offset table. - std::vector > chunk_offset_table_list; - for (size_t i = 0; i < static_cast(num_parts); i++) { - std::vector offset_table( - static_cast(exr_headers[i]->chunk_count)); - - for (size_t c = 0; c < offset_table.size(); c++) { - tinyexr::tinyexr_uint64 offset; - memcpy(&offset, marker, 8); - tinyexr::swap8(&offset); - - if (offset >= size) { - if (err) { - (*err) = "Invalid offset size."; - } - return TINYEXR_ERROR_INVALID_DATA; - } - - offset_table[c] = offset + 4; // +4 to skip 'part number' - marker += 8; - } - - chunk_offset_table_list.push_back(offset_table); - } - - // Decode image. - for (size_t i = 0; i < static_cast(num_parts); i++) { - std::vector &offset_table = - chunk_offset_table_list[i]; - - // First check 'part number' is identitical to 'i' - for (size_t c = 0; c < offset_table.size(); c++) { - const unsigned char *part_number_addr = - memory + offset_table[c] - 4; // -4 to move to 'part number' field. - unsigned int part_no; - memcpy(&part_no, part_number_addr, sizeof(unsigned int)); // 4 - tinyexr::swap4(&part_no); - - if (part_no != i) { - assert(0); - return TINYEXR_ERROR_INVALID_DATA; - } - } - - int ret = tinyexr::DecodeChunk(&exr_images[i], exr_headers[i], offset_table, - memory); - if (ret != TINYEXR_SUCCESS) { - return ret; - } - } - - return TINYEXR_SUCCESS; -} - -int LoadEXRMultipartImageFromFile(EXRImage *exr_images, - const EXRHeader **exr_headers, - unsigned int num_parts, const char *filename, - const char **err) { - if (exr_images == NULL || exr_headers == NULL || num_parts == 0) { - if (err) { - (*err) = "Invalid argument."; - } - return TINYEXR_ERROR_INVALID_ARGUMENT; - } - -#ifdef _WIN32 - FILE *fp = NULL; - fopen_s(&fp, filename, "rb"); -#else - FILE *fp = fopen(filename, "rb"); -#endif - if (!fp) { - if (err) { - (*err) = "Cannot read file."; - } - return TINYEXR_ERROR_CANT_OPEN_FILE; - } - - size_t filesize; - // Compute size - fseek(fp, 0, SEEK_END); - filesize = static_cast(ftell(fp)); - fseek(fp, 0, SEEK_SET); - - std::vector buf(filesize); // @todo { use mmap } - { - size_t ret; - ret = fread(&buf[0], 1, filesize, fp); - assert(ret == filesize); - fclose(fp); - (void)ret; - } - - return LoadEXRMultipartImageFromMemory(exr_images, exr_headers, num_parts, - &buf.at(0), filesize, err); -} - -int SaveEXR(const float *data, int width, int height, int components, - const int save_as_fp16, const char *outfilename) { - if ((components == 1) || components == 3 || components == 4) { - // OK - } else { - return TINYEXR_ERROR_INVALID_ARGUMENT; - } - - // Assume at least 16x16 pixels. - if (width < 16) return TINYEXR_ERROR_INVALID_ARGUMENT; - if (height < 16) return TINYEXR_ERROR_INVALID_ARGUMENT; - - EXRHeader header; - InitEXRHeader(&header); - - EXRImage image; - InitEXRImage(&image); - - image.num_channels = components; - - std::vector images[4]; - - if (components == 1) { - images[0].resize(static_cast(width * height)); - memcpy(images[0].data(), data, sizeof(float) * size_t(width * height)); - } else { - images[0].resize(static_cast(width * height)); - images[1].resize(static_cast(width * height)); - images[2].resize(static_cast(width * height)); - images[3].resize(static_cast(width * height)); - - // Split RGB(A)RGB(A)RGB(A)... into R, G and B(and A) layers - for (size_t i = 0; i < static_cast(width * height); i++) { - images[0][i] = data[static_cast(components) * i + 0]; - images[1][i] = data[static_cast(components) * i + 1]; - images[2][i] = data[static_cast(components) * i + 2]; - if (components == 4) { - images[3][i] = data[static_cast(components) * i + 3]; - } - } - } - - float *image_ptr[4] = {0, 0, 0, 0}; - if (components == 4) { - image_ptr[0] = &(images[3].at(0)); // A - image_ptr[1] = &(images[2].at(0)); // B - image_ptr[2] = &(images[1].at(0)); // G - image_ptr[3] = &(images[0].at(0)); // R - } else if (components == 3) { - image_ptr[0] = &(images[2].at(0)); // B - image_ptr[1] = &(images[1].at(0)); // G - image_ptr[2] = &(images[0].at(0)); // R - } else if (components == 1) { - image_ptr[0] = &(images[0].at(0)); // A - } - - image.images = reinterpret_cast(image_ptr); - image.width = width; - image.height = height; - - header.num_channels = components; - header.channels = static_cast(malloc( - sizeof(EXRChannelInfo) * static_cast(header.num_channels))); - // Must be (A)BGR order, since most of EXR viewers expect this channel order. - if (components == 4) { -#ifdef _MSC_VER - strncpy_s(header.channels[0].name, "A", 255); - strncpy_s(header.channels[1].name, "B", 255); - strncpy_s(header.channels[2].name, "G", 255); - strncpy_s(header.channels[3].name, "R", 255); -#else - strncpy(header.channels[0].name, "A", 255); - strncpy(header.channels[1].name, "B", 255); - strncpy(header.channels[2].name, "G", 255); - strncpy(header.channels[3].name, "R", 255); -#endif - header.channels[0].name[strlen("A")] = '\0'; - header.channels[1].name[strlen("B")] = '\0'; - header.channels[2].name[strlen("G")] = '\0'; - header.channels[3].name[strlen("R")] = '\0'; - } else if (components == 3) { -#ifdef _MSC_VER - strncpy_s(header.channels[0].name, "B", 255); - strncpy_s(header.channels[1].name, "G", 255); - strncpy_s(header.channels[2].name, "R", 255); -#else - strncpy(header.channels[0].name, "B", 255); - strncpy(header.channels[1].name, "G", 255); - strncpy(header.channels[2].name, "R", 255); -#endif - header.channels[0].name[strlen("B")] = '\0'; - header.channels[1].name[strlen("G")] = '\0'; - header.channels[2].name[strlen("R")] = '\0'; - } else { -#ifdef _MSC_VER - strncpy_s(header.channels[0].name, "A", 255); -#else - strncpy(header.channels[0].name, "A", 255); -#endif - header.channels[0].name[strlen("A")] = '\0'; - } - - header.pixel_types = static_cast( - malloc(sizeof(int) * static_cast(header.num_channels))); - header.requested_pixel_types = static_cast( - malloc(sizeof(int) * static_cast(header.num_channels))); - for (int i = 0; i < header.num_channels; i++) { - header.pixel_types[i] = - TINYEXR_PIXELTYPE_FLOAT; // pixel type of input image - - if (save_as_fp16 > 0) { - header.requested_pixel_types[i] = - TINYEXR_PIXELTYPE_HALF; // save with half(fp16) pixel format - } else { - header.requested_pixel_types[i] = - TINYEXR_PIXELTYPE_FLOAT; // save with float(fp32) pixel format(i.e. - // no precision reduction) - } - } - - const char *err; - int ret = SaveEXRImageToFile(&image, &header, outfilename, &err); - if (ret != TINYEXR_SUCCESS) { - return ret; - } - - free(header.channels); - free(header.pixel_types); - free(header.requested_pixel_types); - - return ret; -} - -#endif // TINYEXR_IMPLEMENTATION_DEIFNED -#endif // TINYEXR_IMPLEMENTATION diff --git a/love/src/jni/love/src/libraries/utf8/utf8.h b/love/src/jni/love/src/libraries/utf8/utf8.h deleted file mode 100644 index 4e445140..00000000 --- a/love/src/jni/love/src/libraries/utf8/utf8.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2006 Nemanja Trifunovic - -/* -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -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, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. -*/ - - -#ifndef UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731 -#define UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731 - -#include "utf8/checked.h" -#include "utf8/unchecked.h" - -#endif // header guard diff --git a/love/src/jni/love/src/libraries/utf8/utf8/checked.h b/love/src/jni/love/src/libraries/utf8/utf8/checked.h deleted file mode 100644 index 13311551..00000000 --- a/love/src/jni/love/src/libraries/utf8/utf8/checked.h +++ /dev/null @@ -1,327 +0,0 @@ -// Copyright 2006 Nemanja Trifunovic - -/* -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -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, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. -*/ - - -#ifndef UTF8_FOR_CPP_CHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731 -#define UTF8_FOR_CPP_CHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731 - -#include "core.h" -#include - -namespace utf8 -{ - // Base for the exceptions that may be thrown from the library - class exception : public ::std::exception { - }; - - // Exceptions that may be thrown from the library functions. - class invalid_code_point : public exception { - uint32_t cp; - public: - invalid_code_point(uint32_t cp) : cp(cp) {} - virtual const char* what() const throw() { return "Invalid code point"; } - uint32_t code_point() const {return cp;} - }; - - class invalid_utf8 : public exception { - uint8_t u8; - public: - invalid_utf8 (uint8_t u) : u8(u) {} - virtual const char* what() const throw() { return "Invalid UTF-8"; } - uint8_t utf8_octet() const {return u8;} - }; - - class invalid_utf16 : public exception { - uint16_t u16; - public: - invalid_utf16 (uint16_t u) : u16(u) {} - virtual const char* what() const throw() { return "Invalid UTF-16"; } - uint16_t utf16_word() const {return u16;} - }; - - class not_enough_room : public exception { - public: - virtual const char* what() const throw() { return "Not enough space"; } - }; - - /// The library API - functions intended to be called by the users - - template - octet_iterator append(uint32_t cp, octet_iterator result) - { - if (!utf8::internal::is_code_point_valid(cp)) - throw invalid_code_point(cp); - - if (cp < 0x80) // one octet - *(result++) = static_cast(cp); - else if (cp < 0x800) { // two octets - *(result++) = static_cast((cp >> 6) | 0xc0); - *(result++) = static_cast((cp & 0x3f) | 0x80); - } - else if (cp < 0x10000) { // three octets - *(result++) = static_cast((cp >> 12) | 0xe0); - *(result++) = static_cast(((cp >> 6) & 0x3f) | 0x80); - *(result++) = static_cast((cp & 0x3f) | 0x80); - } - else { // four octets - *(result++) = static_cast((cp >> 18) | 0xf0); - *(result++) = static_cast(((cp >> 12) & 0x3f) | 0x80); - *(result++) = static_cast(((cp >> 6) & 0x3f) | 0x80); - *(result++) = static_cast((cp & 0x3f) | 0x80); - } - return result; - } - - template - output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out, uint32_t replacement) - { - while (start != end) { - octet_iterator sequence_start = start; - internal::utf_error err_code = utf8::internal::validate_next(start, end); - switch (err_code) { - case internal::UTF8_OK : - for (octet_iterator it = sequence_start; it != start; ++it) - *out++ = *it; - break; - case internal::NOT_ENOUGH_ROOM: - throw not_enough_room(); - case internal::INVALID_LEAD: - out = utf8::append (replacement, out); - ++start; - break; - case internal::INCOMPLETE_SEQUENCE: - case internal::OVERLONG_SEQUENCE: - case internal::INVALID_CODE_POINT: - out = utf8::append (replacement, out); - ++start; - // just one replacement mark for the sequence - while (start != end && utf8::internal::is_trail(*start)) - ++start; - break; - } - } - return out; - } - - template - inline output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out) - { - static const uint32_t replacement_marker = utf8::internal::mask16(0xfffd); - return utf8::replace_invalid(start, end, out, replacement_marker); - } - - template - uint32_t next(octet_iterator& it, octet_iterator end) - { - uint32_t cp = 0; - internal::utf_error err_code = utf8::internal::validate_next(it, end, cp); - switch (err_code) { - case internal::UTF8_OK : - break; - case internal::NOT_ENOUGH_ROOM : - throw not_enough_room(); - case internal::INVALID_LEAD : - case internal::INCOMPLETE_SEQUENCE : - case internal::OVERLONG_SEQUENCE : - throw invalid_utf8(*it); - case internal::INVALID_CODE_POINT : - throw invalid_code_point(cp); - } - return cp; - } - - template - uint32_t peek_next(octet_iterator it, octet_iterator end) - { - return utf8::next(it, end); - } - - template - uint32_t prior(octet_iterator& it, octet_iterator start) - { - // can't do much if it == start - if (it == start) - throw not_enough_room(); - - octet_iterator end = it; - // Go back until we hit either a lead octet or start - while (utf8::internal::is_trail(*(--it))) - if (it == start) - throw invalid_utf8(*it); // error - no lead byte in the sequence - return utf8::peek_next(it, end); - } - - /// Deprecated in versions that include "prior" - template - uint32_t previous(octet_iterator& it, octet_iterator pass_start) - { - octet_iterator end = it; - while (utf8::internal::is_trail(*(--it))) - if (it == pass_start) - throw invalid_utf8(*it); // error - no lead byte in the sequence - octet_iterator temp = it; - return utf8::next(temp, end); - } - - template - void advance (octet_iterator& it, distance_type n, octet_iterator end) - { - for (distance_type i = 0; i < n; ++i) - utf8::next(it, end); - } - - template - typename std::iterator_traits::difference_type - distance (octet_iterator first, octet_iterator last) - { - typename std::iterator_traits::difference_type dist; - for (dist = 0; first < last; ++dist) - utf8::next(first, last); - return dist; - } - - template - octet_iterator utf16to8 (u16bit_iterator start, u16bit_iterator end, octet_iterator result) - { - while (start != end) { - uint32_t cp = utf8::internal::mask16(*start++); - // Take care of surrogate pairs first - if (utf8::internal::is_lead_surrogate(cp)) { - if (start != end) { - uint32_t trail_surrogate = utf8::internal::mask16(*start++); - if (utf8::internal::is_trail_surrogate(trail_surrogate)) - cp = (cp << 10) + trail_surrogate + internal::SURROGATE_OFFSET; - else - throw invalid_utf16(static_cast(trail_surrogate)); - } - else - throw invalid_utf16(static_cast(cp)); - - } - // Lone trail surrogate - else if (utf8::internal::is_trail_surrogate(cp)) - throw invalid_utf16(static_cast(cp)); - - result = utf8::append(cp, result); - } - return result; - } - - template - u16bit_iterator utf8to16 (octet_iterator start, octet_iterator end, u16bit_iterator result) - { - while (start != end) { - uint32_t cp = utf8::next(start, end); - if (cp > 0xffff) { //make a surrogate pair - *result++ = static_cast((cp >> 10) + internal::LEAD_OFFSET); - *result++ = static_cast((cp & 0x3ff) + internal::TRAIL_SURROGATE_MIN); - } - else - *result++ = static_cast(cp); - } - return result; - } - - template - octet_iterator utf32to8 (u32bit_iterator start, u32bit_iterator end, octet_iterator result) - { - while (start != end) - result = utf8::append(*(start++), result); - - return result; - } - - template - u32bit_iterator utf8to32 (octet_iterator start, octet_iterator end, u32bit_iterator result) - { - while (start != end) - (*result++) = utf8::next(start, end); - - return result; - } - - // The iterator class - template - class iterator : public std::iterator { - octet_iterator it; - octet_iterator range_start; - octet_iterator range_end; - public: - iterator () {} - explicit iterator (const octet_iterator& octet_it, - const octet_iterator& range_start, - const octet_iterator& range_end) : - it(octet_it), range_start(range_start), range_end(range_end) - { - if (it < range_start || it > range_end) - throw std::out_of_range("Invalid utf-8 iterator position"); - } - // the default "big three" are OK - octet_iterator base () const { return it; } - uint32_t operator * () const - { - octet_iterator temp = it; - return utf8::next(temp, range_end); - } - bool operator == (const iterator& rhs) const - { - if (range_start != rhs.range_start || range_end != rhs.range_end) - throw std::logic_error("Comparing utf-8 iterators defined with different ranges"); - return (it == rhs.it); - } - bool operator != (const iterator& rhs) const - { - return !(operator == (rhs)); - } - iterator& operator ++ () - { - utf8::next(it, range_end); - return *this; - } - iterator operator ++ (int) - { - iterator temp = *this; - utf8::next(it, range_end); - return temp; - } - iterator& operator -- () - { - utf8::prior(it, range_start); - return *this; - } - iterator operator -- (int) - { - iterator temp = *this; - utf8::prior(it, range_start); - return temp; - } - }; // class iterator - -} // namespace utf8 - -#endif //header guard - - diff --git a/love/src/jni/love/src/libraries/utf8/utf8/core.h b/love/src/jni/love/src/libraries/utf8/utf8/core.h deleted file mode 100644 index 693d388c..00000000 --- a/love/src/jni/love/src/libraries/utf8/utf8/core.h +++ /dev/null @@ -1,329 +0,0 @@ -// Copyright 2006 Nemanja Trifunovic - -/* -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -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, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. -*/ - - -#ifndef UTF8_FOR_CPP_CORE_H_2675DCD0_9480_4c0c_B92A_CC14C027B731 -#define UTF8_FOR_CPP_CORE_H_2675DCD0_9480_4c0c_B92A_CC14C027B731 - -#include - -namespace utf8 -{ - // The typedefs for 8-bit, 16-bit and 32-bit unsigned integers - // You may need to change them to match your system. - // These typedefs have the same names as ones from cstdint, or boost/cstdint - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; - -// Helper code - not intended to be directly called by the library users. May be changed at any time -namespace internal -{ - // Unicode constants - // Leading (high) surrogates: 0xd800 - 0xdbff - // Trailing (low) surrogates: 0xdc00 - 0xdfff - const uint16_t LEAD_SURROGATE_MIN = 0xd800u; - const uint16_t LEAD_SURROGATE_MAX = 0xdbffu; - const uint16_t TRAIL_SURROGATE_MIN = 0xdc00u; - const uint16_t TRAIL_SURROGATE_MAX = 0xdfffu; - const uint16_t LEAD_OFFSET = LEAD_SURROGATE_MIN - (0x10000 >> 10); - const uint32_t SURROGATE_OFFSET = 0x10000u - (LEAD_SURROGATE_MIN << 10) - TRAIL_SURROGATE_MIN; - - // Maximum valid value for a Unicode code point - const uint32_t CODE_POINT_MAX = 0x0010ffffu; - - template - inline uint8_t mask8(octet_type oc) - { - return static_cast(0xff & oc); - } - template - inline uint16_t mask16(u16_type oc) - { - return static_cast(0xffff & oc); - } - template - inline bool is_trail(octet_type oc) - { - return ((utf8::internal::mask8(oc) >> 6) == 0x2); - } - - template - inline bool is_lead_surrogate(u16 cp) - { - return (cp >= LEAD_SURROGATE_MIN && cp <= LEAD_SURROGATE_MAX); - } - - template - inline bool is_trail_surrogate(u16 cp) - { - return (cp >= TRAIL_SURROGATE_MIN && cp <= TRAIL_SURROGATE_MAX); - } - - template - inline bool is_surrogate(u16 cp) - { - return (cp >= LEAD_SURROGATE_MIN && cp <= TRAIL_SURROGATE_MAX); - } - - template - inline bool is_code_point_valid(u32 cp) - { - return (cp <= CODE_POINT_MAX && !utf8::internal::is_surrogate(cp)); - } - - template - inline typename std::iterator_traits::difference_type - sequence_length(octet_iterator lead_it) - { - uint8_t lead = utf8::internal::mask8(*lead_it); - if (lead < 0x80) - return 1; - else if ((lead >> 5) == 0x6) - return 2; - else if ((lead >> 4) == 0xe) - return 3; - else if ((lead >> 3) == 0x1e) - return 4; - else - return 0; - } - - template - inline bool is_overlong_sequence(uint32_t cp, octet_difference_type length) - { - if (cp < 0x80) { - if (length != 1) - return true; - } - else if (cp < 0x800) { - if (length != 2) - return true; - } - else if (cp < 0x10000) { - if (length != 3) - return true; - } - - return false; - } - - enum utf_error {UTF8_OK, NOT_ENOUGH_ROOM, INVALID_LEAD, INCOMPLETE_SEQUENCE, OVERLONG_SEQUENCE, INVALID_CODE_POINT}; - - /// Helper for get_sequence_x - template - utf_error increase_safely(octet_iterator& it, octet_iterator end) - { - if (++it == end) - return NOT_ENOUGH_ROOM; - - if (!utf8::internal::is_trail(*it)) - return INCOMPLETE_SEQUENCE; - - return UTF8_OK; - } - - #define UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(IT, END) {utf_error ret = increase_safely(IT, END); if (ret != UTF8_OK) return ret;} - - /// get_sequence_x functions decode utf-8 sequences of the length x - template - utf_error get_sequence_1(octet_iterator& it, octet_iterator end, uint32_t& code_point) - { - if (it == end) - return NOT_ENOUGH_ROOM; - - code_point = utf8::internal::mask8(*it); - - return UTF8_OK; - } - - template - utf_error get_sequence_2(octet_iterator& it, octet_iterator end, uint32_t& code_point) - { - if (it == end) - return NOT_ENOUGH_ROOM; - - code_point = utf8::internal::mask8(*it); - - UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end) - - code_point = ((code_point << 6) & 0x7ff) + ((*it) & 0x3f); - - return UTF8_OK; - } - - template - utf_error get_sequence_3(octet_iterator& it, octet_iterator end, uint32_t& code_point) - { - if (it == end) - return NOT_ENOUGH_ROOM; - - code_point = utf8::internal::mask8(*it); - - UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end) - - code_point = ((code_point << 12) & 0xffff) + ((utf8::internal::mask8(*it) << 6) & 0xfff); - - UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end) - - code_point += (*it) & 0x3f; - - return UTF8_OK; - } - - template - utf_error get_sequence_4(octet_iterator& it, octet_iterator end, uint32_t& code_point) - { - if (it == end) - return NOT_ENOUGH_ROOM; - - code_point = utf8::internal::mask8(*it); - - UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end) - - code_point = ((code_point << 18) & 0x1fffff) + ((utf8::internal::mask8(*it) << 12) & 0x3ffff); - - UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end) - - code_point += (utf8::internal::mask8(*it) << 6) & 0xfff; - - UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end) - - code_point += (*it) & 0x3f; - - return UTF8_OK; - } - - #undef UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR - - template - utf_error validate_next(octet_iterator& it, octet_iterator end, uint32_t& code_point) - { - // Save the original value of it so we can go back in case of failure - // Of course, it does not make much sense with i.e. stream iterators - octet_iterator original_it = it; - - uint32_t cp = 0; - // Determine the sequence length based on the lead octet - typedef typename std::iterator_traits::difference_type octet_difference_type; - const octet_difference_type length = utf8::internal::sequence_length(it); - - // Get trail octets and calculate the code point - utf_error err = UTF8_OK; - switch (length) { - case 0: - return INVALID_LEAD; - case 1: - err = utf8::internal::get_sequence_1(it, end, cp); - break; - case 2: - err = utf8::internal::get_sequence_2(it, end, cp); - break; - case 3: - err = utf8::internal::get_sequence_3(it, end, cp); - break; - case 4: - err = utf8::internal::get_sequence_4(it, end, cp); - break; - } - - if (err == UTF8_OK) { - // Decoding succeeded. Now, security checks... - if (utf8::internal::is_code_point_valid(cp)) { - if (!utf8::internal::is_overlong_sequence(cp, length)){ - // Passed! Return here. - code_point = cp; - ++it; - return UTF8_OK; - } - else - err = OVERLONG_SEQUENCE; - } - else - err = INVALID_CODE_POINT; - } - - // Failure branch - restore the original value of the iterator - it = original_it; - return err; - } - - template - inline utf_error validate_next(octet_iterator& it, octet_iterator end) { - uint32_t ignored; - return utf8::internal::validate_next(it, end, ignored); - } - -} // namespace internal - - /// The library API - functions intended to be called by the users - - // Byte order mark - const uint8_t bom[] = {0xef, 0xbb, 0xbf}; - - template - octet_iterator find_invalid(octet_iterator start, octet_iterator end) - { - octet_iterator result = start; - while (result != end) { - utf8::internal::utf_error err_code = utf8::internal::validate_next(result, end); - if (err_code != internal::UTF8_OK) - return result; - } - return result; - } - - template - inline bool is_valid(octet_iterator start, octet_iterator end) - { - return (utf8::find_invalid(start, end) == end); - } - - template - inline bool starts_with_bom (octet_iterator it, octet_iterator end) - { - return ( - ((it != end) && (utf8::internal::mask8(*it++)) == bom[0]) && - ((it != end) && (utf8::internal::mask8(*it++)) == bom[1]) && - ((it != end) && (utf8::internal::mask8(*it)) == bom[2]) - ); - } - - //Deprecated in release 2.3 - template - inline bool is_bom (octet_iterator it) - { - return ( - (utf8::internal::mask8(*it++)) == bom[0] && - (utf8::internal::mask8(*it++)) == bom[1] && - (utf8::internal::mask8(*it)) == bom[2] - ); - } -} // namespace utf8 - -#endif // header guard - - diff --git a/love/src/jni/love/src/libraries/utf8/utf8/unchecked.h b/love/src/jni/love/src/libraries/utf8/utf8/unchecked.h deleted file mode 100644 index cb242716..00000000 --- a/love/src/jni/love/src/libraries/utf8/utf8/unchecked.h +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright 2006 Nemanja Trifunovic - -/* -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -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, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. -*/ - - -#ifndef UTF8_FOR_CPP_UNCHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731 -#define UTF8_FOR_CPP_UNCHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731 - -#include "core.h" - -namespace utf8 -{ - namespace unchecked - { - template - octet_iterator append(uint32_t cp, octet_iterator result) - { - if (cp < 0x80) // one octet - *(result++) = static_cast(cp); - else if (cp < 0x800) { // two octets - *(result++) = static_cast((cp >> 6) | 0xc0); - *(result++) = static_cast((cp & 0x3f) | 0x80); - } - else if (cp < 0x10000) { // three octets - *(result++) = static_cast((cp >> 12) | 0xe0); - *(result++) = static_cast(((cp >> 6) & 0x3f) | 0x80); - *(result++) = static_cast((cp & 0x3f) | 0x80); - } - else { // four octets - *(result++) = static_cast((cp >> 18) | 0xf0); - *(result++) = static_cast(((cp >> 12) & 0x3f)| 0x80); - *(result++) = static_cast(((cp >> 6) & 0x3f) | 0x80); - *(result++) = static_cast((cp & 0x3f) | 0x80); - } - return result; - } - - template - uint32_t next(octet_iterator& it) - { - uint32_t cp = utf8::internal::mask8(*it); - typename std::iterator_traits::difference_type length = utf8::internal::sequence_length(it); - switch (length) { - case 1: - break; - case 2: - it++; - cp = ((cp << 6) & 0x7ff) + ((*it) & 0x3f); - break; - case 3: - ++it; - cp = ((cp << 12) & 0xffff) + ((utf8::internal::mask8(*it) << 6) & 0xfff); - ++it; - cp += (*it) & 0x3f; - break; - case 4: - ++it; - cp = ((cp << 18) & 0x1fffff) + ((utf8::internal::mask8(*it) << 12) & 0x3ffff); - ++it; - cp += (utf8::internal::mask8(*it) << 6) & 0xfff; - ++it; - cp += (*it) & 0x3f; - break; - } - ++it; - return cp; - } - - template - uint32_t peek_next(octet_iterator it) - { - return utf8::unchecked::next(it); - } - - template - uint32_t prior(octet_iterator& it) - { - while (utf8::internal::is_trail(*(--it))) ; - octet_iterator temp = it; - return utf8::unchecked::next(temp); - } - - // Deprecated in versions that include prior, but only for the sake of consistency (see utf8::previous) - template - inline uint32_t previous(octet_iterator& it) - { - return utf8::unchecked::prior(it); - } - - template - void advance (octet_iterator& it, distance_type n) - { - for (distance_type i = 0; i < n; ++i) - utf8::unchecked::next(it); - } - - template - typename std::iterator_traits::difference_type - distance (octet_iterator first, octet_iterator last) - { - typename std::iterator_traits::difference_type dist; - for (dist = 0; first < last; ++dist) - utf8::unchecked::next(first); - return dist; - } - - template - octet_iterator utf16to8 (u16bit_iterator start, u16bit_iterator end, octet_iterator result) - { - while (start != end) { - uint32_t cp = utf8::internal::mask16(*start++); - // Take care of surrogate pairs first - if (utf8::internal::is_lead_surrogate(cp)) { - uint32_t trail_surrogate = utf8::internal::mask16(*start++); - cp = (cp << 10) + trail_surrogate + internal::SURROGATE_OFFSET; - } - result = utf8::unchecked::append(cp, result); - } - return result; - } - - template - u16bit_iterator utf8to16 (octet_iterator start, octet_iterator end, u16bit_iterator result) - { - while (start < end) { - uint32_t cp = utf8::unchecked::next(start); - if (cp > 0xffff) { //make a surrogate pair - *result++ = static_cast((cp >> 10) + internal::LEAD_OFFSET); - *result++ = static_cast((cp & 0x3ff) + internal::TRAIL_SURROGATE_MIN); - } - else - *result++ = static_cast(cp); - } - return result; - } - - template - octet_iterator utf32to8 (u32bit_iterator start, u32bit_iterator end, octet_iterator result) - { - while (start != end) - result = utf8::unchecked::append(*(start++), result); - - return result; - } - - template - u32bit_iterator utf8to32 (octet_iterator start, octet_iterator end, u32bit_iterator result) - { - while (start < end) - (*result++) = utf8::unchecked::next(start); - - return result; - } - - // The iterator class - template - class iterator : public std::iterator { - octet_iterator it; - public: - iterator () {} - explicit iterator (const octet_iterator& octet_it): it(octet_it) {} - // the default "big three" are OK - octet_iterator base () const { return it; } - uint32_t operator * () const - { - octet_iterator temp = it; - return utf8::unchecked::next(temp); - } - bool operator == (const iterator& rhs) const - { - return (it == rhs.it); - } - bool operator != (const iterator& rhs) const - { - return !(operator == (rhs)); - } - iterator& operator ++ () - { - ::std::advance(it, utf8::internal::sequence_length(it)); - return *this; - } - iterator operator ++ (int) - { - iterator temp = *this; - ::std::advance(it, utf8::internal::sequence_length(it)); - return temp; - } - iterator& operator -- () - { - utf8::unchecked::prior(it); - return *this; - } - iterator operator -- (int) - { - iterator temp = *this; - utf8::unchecked::prior(it); - return temp; - } - }; // class iterator - - } // namespace utf8::unchecked -} // namespace utf8 - - -#endif // header guard - diff --git a/love/src/jni/love/src/libraries/xxHash/xxhash.c b/love/src/jni/love/src/libraries/xxHash/xxhash.c deleted file mode 100755 index f74880b0..00000000 --- a/love/src/jni/love/src/libraries/xxHash/xxhash.c +++ /dev/null @@ -1,889 +0,0 @@ -/* -* xxHash - Fast Hash algorithm -* Copyright (C) 2012-2016, Yann Collet -* -* BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) -* -* 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. -* -* 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 THE COPYRIGHT -* OWNER OR CONTRIBUTORS 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. -* -* You can contact the author at : -* - xxHash homepage: http://www.xxhash.com -* - xxHash source repository : https://github.com/Cyan4973/xxHash -*/ - - -/* ************************************* -* Tuning parameters -***************************************/ -/*!XXH_FORCE_MEMORY_ACCESS : - * By default, access to unaligned memory is controlled by `memcpy()`, which is safe and portable. - * Unfortunately, on some target/compiler combinations, the generated assembly is sub-optimal. - * The below switch allow to select different access method for improved performance. - * Method 0 (default) : use `memcpy()`. Safe and portable. - * Method 1 : `__packed` statement. It depends on compiler extension (ie, not portable). - * This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`. - * Method 2 : direct access. This method doesn't depend on compiler but violate C standard. - * It can generate buggy code on targets which do not support unaligned memory accesses. - * But in some circumstances, it's the only known way to get the most performance (ie GCC + ARMv6) - * See http://stackoverflow.com/a/32095106/646947 for details. - * Prefer these methods in priority order (0 > 1 > 2) - */ -#ifndef XXH_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ -# if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) ) -# define XXH_FORCE_MEMORY_ACCESS 2 -# elif defined(__INTEL_COMPILER) || \ - (defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) )) -# define XXH_FORCE_MEMORY_ACCESS 1 -# endif -#endif - -/*!XXH_ACCEPT_NULL_INPUT_POINTER : - * If the input pointer is a null pointer, xxHash default behavior is to trigger a memory access error, since it is a bad pointer. - * When this option is enabled, xxHash output for null input pointers will be the same as a null-length input. - * By default, this option is disabled. To enable it, uncomment below define : - */ -/* #define XXH_ACCEPT_NULL_INPUT_POINTER 1 */ - -/*!XXH_FORCE_NATIVE_FORMAT : - * By default, xxHash library provides endian-independent Hash values, based on little-endian convention. - * Results are therefore identical for little-endian and big-endian CPU. - * This comes at a performance cost for big-endian CPU, since some swapping is required to emulate little-endian format. - * Should endian-independence be of no importance for your application, you may set the #define below to 1, - * to improve speed for Big-endian CPU. - * This option has no impact on Little_Endian CPU. - */ -#ifndef XXH_FORCE_NATIVE_FORMAT /* can be defined externally */ -# define XXH_FORCE_NATIVE_FORMAT 0 -#endif - -/*!XXH_FORCE_ALIGN_CHECK : - * This is a minor performance trick, only useful with lots of very small keys. - * It means : check for aligned/unaligned input. - * The check costs one initial branch per hash; set to 0 when the input data - * is guaranteed to be aligned. - */ -#ifndef XXH_FORCE_ALIGN_CHECK /* can be defined externally */ -# if defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) -# define XXH_FORCE_ALIGN_CHECK 0 -# else -# define XXH_FORCE_ALIGN_CHECK 1 -# endif -#endif - - -/* ************************************* -* Includes & Memory related functions -***************************************/ -/*! Modify the local functions below should you wish to use some other memory routines -* for malloc(), free() */ -#include -static void* XXH_malloc(size_t s) { return malloc(s); } -static void XXH_free (void* p) { free(p); } -/*! and for memcpy() */ -#include -static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcpy(dest,src,size); } - -#define XXH_STATIC_LINKING_ONLY -#include "xxhash.h" - - -/* ************************************* -* Compiler Specific Options -***************************************/ -#ifdef _MSC_VER /* Visual Studio */ -# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ -# define FORCE_INLINE static __forceinline -#else -# if defined (__cplusplus) || defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ -# ifdef __GNUC__ -# define FORCE_INLINE static inline __attribute__((always_inline)) -# else -# define FORCE_INLINE static inline -# endif -# else -# define FORCE_INLINE static -# endif /* __STDC_VERSION__ */ -#endif - - -/* ************************************* -* Basic Types -***************************************/ -#ifndef MEM_MODULE -# if !defined (__VMS) && (defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) -# include - typedef uint8_t BYTE; - typedef uint16_t U16; - typedef uint32_t U32; - typedef int32_t S32; -# else - typedef unsigned char BYTE; - typedef unsigned short U16; - typedef unsigned int U32; - typedef signed int S32; -# endif -#endif - -#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==2)) - -/* Force direct memory access. Only works on CPU which support unaligned memory access in hardware */ -static U32 XXH_read32(const void* memPtr) { return *(const U32*) memPtr; } - -#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==1)) - -/* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */ -/* currently only defined for gcc and icc */ -typedef union { U32 u32; } __attribute__((packed)) unalign; -static U32 XXH_read32(const void* ptr) { return ((const unalign*)ptr)->u32; } - -#else - -/* portable and safe solution. Generally efficient. - * see : http://stackoverflow.com/a/32095106/646947 - */ -static U32 XXH_read32(const void* memPtr) -{ - U32 val; - memcpy(&val, memPtr, sizeof(val)); - return val; -} - -#endif /* XXH_FORCE_DIRECT_MEMORY_ACCESS */ - - -/* **************************************** -* Compiler-specific Functions and Macros -******************************************/ -#define XXH_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) - -/* Note : although _rotl exists for minGW (GCC under windows), performance seems poor */ -#if defined(_MSC_VER) -# define XXH_rotl32(x,r) _rotl(x,r) -# define XXH_rotl64(x,r) _rotl64(x,r) -#else -# define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r))) -# define XXH_rotl64(x,r) ((x << r) | (x >> (64 - r))) -#endif - -#if defined(_MSC_VER) /* Visual Studio */ -# define XXH_swap32 _byteswap_ulong -#elif XXH_GCC_VERSION >= 403 -# define XXH_swap32 __builtin_bswap32 -#else -static U32 XXH_swap32 (U32 x) -{ - return ((x << 24) & 0xff000000 ) | - ((x << 8) & 0x00ff0000 ) | - ((x >> 8) & 0x0000ff00 ) | - ((x >> 24) & 0x000000ff ); -} -#endif - - -/* ************************************* -* Architecture Macros -***************************************/ -typedef enum { XXH_bigEndian=0, XXH_littleEndian=1 } XXH_endianess; - -/* XXH_CPU_LITTLE_ENDIAN can be defined externally, for example on the compiler command line */ -#ifndef XXH_CPU_LITTLE_ENDIAN - static const int g_one = 1; -# define XXH_CPU_LITTLE_ENDIAN (*(const char*)(&g_one)) -#endif - - -/* *************************** -* Memory reads -*****************************/ -typedef enum { XXH_aligned, XXH_unaligned } XXH_alignment; - -FORCE_INLINE U32 XXH_readLE32_align(const void* ptr, XXH_endianess endian, XXH_alignment align) -{ - if (align==XXH_unaligned) - return endian==XXH_littleEndian ? XXH_read32(ptr) : XXH_swap32(XXH_read32(ptr)); - else - return endian==XXH_littleEndian ? *(const U32*)ptr : XXH_swap32(*(const U32*)ptr); -} - -FORCE_INLINE U32 XXH_readLE32(const void* ptr, XXH_endianess endian) -{ - return XXH_readLE32_align(ptr, endian, XXH_unaligned); -} - -static U32 XXH_readBE32(const void* ptr) -{ - return XXH_CPU_LITTLE_ENDIAN ? XXH_swap32(XXH_read32(ptr)) : XXH_read32(ptr); -} - - -/* ************************************* -* Macros -***************************************/ -#define XXH_STATIC_ASSERT(c) { enum { XXH_static_assert = 1/(int)(!!(c)) }; } /* use only *after* variable declarations */ -XXH_PUBLIC_API unsigned XXH_versionNumber (void) { return XXH_VERSION_NUMBER; } - - -/* ******************************************************************* -* 32-bits hash functions -*********************************************************************/ -static const U32 PRIME32_1 = 2654435761U; -static const U32 PRIME32_2 = 2246822519U; -static const U32 PRIME32_3 = 3266489917U; -static const U32 PRIME32_4 = 668265263U; -static const U32 PRIME32_5 = 374761393U; - -static U32 XXH32_round(U32 seed, U32 input) -{ - seed += input * PRIME32_2; - seed = XXH_rotl32(seed, 13); - seed *= PRIME32_1; - return seed; -} - -FORCE_INLINE U32 XXH32_endian_align(const void* input, size_t len, U32 seed, XXH_endianess endian, XXH_alignment align) -{ - const BYTE* p = (const BYTE*)input; - const BYTE* bEnd = p + len; - U32 h32; -#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align) - -#ifdef XXH_ACCEPT_NULL_INPUT_POINTER - if (p==NULL) { - len=0; - bEnd=p=(const BYTE*)(size_t)16; - } -#endif - - if (len>=16) { - const BYTE* const limit = bEnd - 16; - U32 v1 = seed + PRIME32_1 + PRIME32_2; - U32 v2 = seed + PRIME32_2; - U32 v3 = seed + 0; - U32 v4 = seed - PRIME32_1; - - do { - v1 = XXH32_round(v1, XXH_get32bits(p)); p+=4; - v2 = XXH32_round(v2, XXH_get32bits(p)); p+=4; - v3 = XXH32_round(v3, XXH_get32bits(p)); p+=4; - v4 = XXH32_round(v4, XXH_get32bits(p)); p+=4; - } while (p<=limit); - - h32 = XXH_rotl32(v1, 1) + XXH_rotl32(v2, 7) + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18); - } else { - h32 = seed + PRIME32_5; - } - - h32 += (U32) len; - - while (p+4<=bEnd) { - h32 += XXH_get32bits(p) * PRIME32_3; - h32 = XXH_rotl32(h32, 17) * PRIME32_4 ; - p+=4; - } - - while (p> 15; - h32 *= PRIME32_2; - h32 ^= h32 >> 13; - h32 *= PRIME32_3; - h32 ^= h32 >> 16; - - return h32; -} - - -XXH_PUBLIC_API unsigned int XXH32 (const void* input, size_t len, unsigned int seed) -{ -#if 0 - /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ - XXH32_state_t state; - XXH32_reset(&state, seed); - XXH32_update(&state, input, len); - return XXH32_digest(&state); -#else - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - - if (XXH_FORCE_ALIGN_CHECK) { - if ((((size_t)input) & 3) == 0) { /* Input is 4-bytes aligned, leverage the speed benefit */ - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH32_endian_align(input, len, seed, XXH_littleEndian, XXH_aligned); - else - return XXH32_endian_align(input, len, seed, XXH_bigEndian, XXH_aligned); - } } - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH32_endian_align(input, len, seed, XXH_littleEndian, XXH_unaligned); - else - return XXH32_endian_align(input, len, seed, XXH_bigEndian, XXH_unaligned); -#endif -} - - - -/*====== Hash streaming ======*/ - -XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void) -{ - return (XXH32_state_t*)XXH_malloc(sizeof(XXH32_state_t)); -} -XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr) -{ - XXH_free(statePtr); - return XXH_OK; -} - -XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* dstState, const XXH32_state_t* srcState) -{ - memcpy(dstState, srcState, sizeof(*dstState)); -} - -XXH_PUBLIC_API XXH_errorcode XXH32_reset(XXH32_state_t* statePtr, unsigned int seed) -{ - XXH32_state_t state; /* using a local state to memcpy() in order to avoid strict-aliasing warnings */ - memset(&state, 0, sizeof(state)-4); /* do not write into reserved, for future removal */ - state.v1 = seed + PRIME32_1 + PRIME32_2; - state.v2 = seed + PRIME32_2; - state.v3 = seed + 0; - state.v4 = seed - PRIME32_1; - memcpy(statePtr, &state, sizeof(state)); - return XXH_OK; -} - - -FORCE_INLINE XXH_errorcode XXH32_update_endian (XXH32_state_t* state, const void* input, size_t len, XXH_endianess endian) -{ - const BYTE* p = (const BYTE*)input; - const BYTE* const bEnd = p + len; - -#ifdef XXH_ACCEPT_NULL_INPUT_POINTER - if (input==NULL) return XXH_ERROR; -#endif - - state->total_len_32 += (unsigned)len; - state->large_len |= (len>=16) | (state->total_len_32>=16); - - if (state->memsize + len < 16) { /* fill in tmp buffer */ - XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, len); - state->memsize += (unsigned)len; - return XXH_OK; - } - - if (state->memsize) { /* some data left from previous update */ - XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, 16-state->memsize); - { const U32* p32 = state->mem32; - state->v1 = XXH32_round(state->v1, XXH_readLE32(p32, endian)); p32++; - state->v2 = XXH32_round(state->v2, XXH_readLE32(p32, endian)); p32++; - state->v3 = XXH32_round(state->v3, XXH_readLE32(p32, endian)); p32++; - state->v4 = XXH32_round(state->v4, XXH_readLE32(p32, endian)); p32++; - } - p += 16-state->memsize; - state->memsize = 0; - } - - if (p <= bEnd-16) { - const BYTE* const limit = bEnd - 16; - U32 v1 = state->v1; - U32 v2 = state->v2; - U32 v3 = state->v3; - U32 v4 = state->v4; - - do { - v1 = XXH32_round(v1, XXH_readLE32(p, endian)); p+=4; - v2 = XXH32_round(v2, XXH_readLE32(p, endian)); p+=4; - v3 = XXH32_round(v3, XXH_readLE32(p, endian)); p+=4; - v4 = XXH32_round(v4, XXH_readLE32(p, endian)); p+=4; - } while (p<=limit); - - state->v1 = v1; - state->v2 = v2; - state->v3 = v3; - state->v4 = v4; - } - - if (p < bEnd) { - XXH_memcpy(state->mem32, p, (size_t)(bEnd-p)); - state->memsize = (unsigned)(bEnd-p); - } - - return XXH_OK; -} - -XXH_PUBLIC_API XXH_errorcode XXH32_update (XXH32_state_t* state_in, const void* input, size_t len) -{ - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH32_update_endian(state_in, input, len, XXH_littleEndian); - else - return XXH32_update_endian(state_in, input, len, XXH_bigEndian); -} - - - -FORCE_INLINE U32 XXH32_digest_endian (const XXH32_state_t* state, XXH_endianess endian) -{ - const BYTE * p = (const BYTE*)state->mem32; - const BYTE* const bEnd = (const BYTE*)(state->mem32) + state->memsize; - U32 h32; - - if (state->large_len) { - h32 = XXH_rotl32(state->v1, 1) + XXH_rotl32(state->v2, 7) + XXH_rotl32(state->v3, 12) + XXH_rotl32(state->v4, 18); - } else { - h32 = state->v3 /* == seed */ + PRIME32_5; - } - - h32 += state->total_len_32; - - while (p+4<=bEnd) { - h32 += XXH_readLE32(p, endian) * PRIME32_3; - h32 = XXH_rotl32(h32, 17) * PRIME32_4; - p+=4; - } - - while (p> 15; - h32 *= PRIME32_2; - h32 ^= h32 >> 13; - h32 *= PRIME32_3; - h32 ^= h32 >> 16; - - return h32; -} - - -XXH_PUBLIC_API unsigned int XXH32_digest (const XXH32_state_t* state_in) -{ - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH32_digest_endian(state_in, XXH_littleEndian); - else - return XXH32_digest_endian(state_in, XXH_bigEndian); -} - - -/*====== Canonical representation ======*/ - -/*! Default XXH result types are basic unsigned 32 and 64 bits. -* The canonical representation follows human-readable write convention, aka big-endian (large digits first). -* These functions allow transformation of hash result into and from its canonical format. -* This way, hash values can be written into a file or buffer, and remain comparable across different systems and programs. -*/ - -XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash) -{ - XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) == sizeof(XXH32_hash_t)); - if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap32(hash); - memcpy(dst, &hash, sizeof(*dst)); -} - -XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src) -{ - return XXH_readBE32(src); -} - - -#ifndef XXH_NO_LONG_LONG - -/* ******************************************************************* -* 64-bits hash functions -*********************************************************************/ - -/*====== Memory access ======*/ - -#ifndef MEM_MODULE -# define MEM_MODULE -# if !defined (__VMS) && (defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) -# include - typedef uint64_t U64; -# else - typedef unsigned long long U64; /* if your compiler doesn't support unsigned long long, replace by another 64-bit type here. Note that xxhash.h will also need to be updated. */ -# endif -#endif - - -#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==2)) - -/* Force direct memory access. Only works on CPU which support unaligned memory access in hardware */ -static U64 XXH_read64(const void* memPtr) { return *(const U64*) memPtr; } - -#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==1)) - -/* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */ -/* currently only defined for gcc and icc */ -typedef union { U32 u32; U64 u64; } __attribute__((packed)) unalign64; -static U64 XXH_read64(const void* ptr) { return ((const unalign64*)ptr)->u64; } - -#else - -/* portable and safe solution. Generally efficient. - * see : http://stackoverflow.com/a/32095106/646947 - */ - -static U64 XXH_read64(const void* memPtr) -{ - U64 val; - memcpy(&val, memPtr, sizeof(val)); - return val; -} - -#endif /* XXH_FORCE_DIRECT_MEMORY_ACCESS */ - -#if defined(_MSC_VER) /* Visual Studio */ -# define XXH_swap64 _byteswap_uint64 -#elif XXH_GCC_VERSION >= 403 -# define XXH_swap64 __builtin_bswap64 -#else -static U64 XXH_swap64 (U64 x) -{ - return ((x << 56) & 0xff00000000000000ULL) | - ((x << 40) & 0x00ff000000000000ULL) | - ((x << 24) & 0x0000ff0000000000ULL) | - ((x << 8) & 0x000000ff00000000ULL) | - ((x >> 8) & 0x00000000ff000000ULL) | - ((x >> 24) & 0x0000000000ff0000ULL) | - ((x >> 40) & 0x000000000000ff00ULL) | - ((x >> 56) & 0x00000000000000ffULL); -} -#endif - -FORCE_INLINE U64 XXH_readLE64_align(const void* ptr, XXH_endianess endian, XXH_alignment align) -{ - if (align==XXH_unaligned) - return endian==XXH_littleEndian ? XXH_read64(ptr) : XXH_swap64(XXH_read64(ptr)); - else - return endian==XXH_littleEndian ? *(const U64*)ptr : XXH_swap64(*(const U64*)ptr); -} - -FORCE_INLINE U64 XXH_readLE64(const void* ptr, XXH_endianess endian) -{ - return XXH_readLE64_align(ptr, endian, XXH_unaligned); -} - -static U64 XXH_readBE64(const void* ptr) -{ - return XXH_CPU_LITTLE_ENDIAN ? XXH_swap64(XXH_read64(ptr)) : XXH_read64(ptr); -} - - -/*====== xxh64 ======*/ - -static const U64 PRIME64_1 = 11400714785074694791ULL; -static const U64 PRIME64_2 = 14029467366897019727ULL; -static const U64 PRIME64_3 = 1609587929392839161ULL; -static const U64 PRIME64_4 = 9650029242287828579ULL; -static const U64 PRIME64_5 = 2870177450012600261ULL; - -static U64 XXH64_round(U64 acc, U64 input) -{ - acc += input * PRIME64_2; - acc = XXH_rotl64(acc, 31); - acc *= PRIME64_1; - return acc; -} - -static U64 XXH64_mergeRound(U64 acc, U64 val) -{ - val = XXH64_round(0, val); - acc ^= val; - acc = acc * PRIME64_1 + PRIME64_4; - return acc; -} - -FORCE_INLINE U64 XXH64_endian_align(const void* input, size_t len, U64 seed, XXH_endianess endian, XXH_alignment align) -{ - const BYTE* p = (const BYTE*)input; - const BYTE* bEnd = p + len; - U64 h64; -#define XXH_get64bits(p) XXH_readLE64_align(p, endian, align) - -#ifdef XXH_ACCEPT_NULL_INPUT_POINTER - if (p==NULL) { - len=0; - bEnd=p=(const BYTE*)(size_t)32; - } -#endif - - if (len>=32) { - const BYTE* const limit = bEnd - 32; - U64 v1 = seed + PRIME64_1 + PRIME64_2; - U64 v2 = seed + PRIME64_2; - U64 v3 = seed + 0; - U64 v4 = seed - PRIME64_1; - - do { - v1 = XXH64_round(v1, XXH_get64bits(p)); p+=8; - v2 = XXH64_round(v2, XXH_get64bits(p)); p+=8; - v3 = XXH64_round(v3, XXH_get64bits(p)); p+=8; - v4 = XXH64_round(v4, XXH_get64bits(p)); p+=8; - } while (p<=limit); - - h64 = XXH_rotl64(v1, 1) + XXH_rotl64(v2, 7) + XXH_rotl64(v3, 12) + XXH_rotl64(v4, 18); - h64 = XXH64_mergeRound(h64, v1); - h64 = XXH64_mergeRound(h64, v2); - h64 = XXH64_mergeRound(h64, v3); - h64 = XXH64_mergeRound(h64, v4); - - } else { - h64 = seed + PRIME64_5; - } - - h64 += (U64) len; - - while (p+8<=bEnd) { - U64 const k1 = XXH64_round(0, XXH_get64bits(p)); - h64 ^= k1; - h64 = XXH_rotl64(h64,27) * PRIME64_1 + PRIME64_4; - p+=8; - } - - if (p+4<=bEnd) { - h64 ^= (U64)(XXH_get32bits(p)) * PRIME64_1; - h64 = XXH_rotl64(h64, 23) * PRIME64_2 + PRIME64_3; - p+=4; - } - - while (p> 33; - h64 *= PRIME64_2; - h64 ^= h64 >> 29; - h64 *= PRIME64_3; - h64 ^= h64 >> 32; - - return h64; -} - - -XXH_PUBLIC_API unsigned long long XXH64 (const void* input, size_t len, unsigned long long seed) -{ -#if 0 - /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ - XXH64_state_t state; - XXH64_reset(&state, seed); - XXH64_update(&state, input, len); - return XXH64_digest(&state); -#else - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - - if (XXH_FORCE_ALIGN_CHECK) { - if ((((size_t)input) & 7)==0) { /* Input is aligned, let's leverage the speed advantage */ - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH64_endian_align(input, len, seed, XXH_littleEndian, XXH_aligned); - else - return XXH64_endian_align(input, len, seed, XXH_bigEndian, XXH_aligned); - } } - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH64_endian_align(input, len, seed, XXH_littleEndian, XXH_unaligned); - else - return XXH64_endian_align(input, len, seed, XXH_bigEndian, XXH_unaligned); -#endif -} - -/*====== Hash Streaming ======*/ - -XXH_PUBLIC_API XXH64_state_t* XXH64_createState(void) -{ - return (XXH64_state_t*)XXH_malloc(sizeof(XXH64_state_t)); -} -XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr) -{ - XXH_free(statePtr); - return XXH_OK; -} - -XXH_PUBLIC_API void XXH64_copyState(XXH64_state_t* dstState, const XXH64_state_t* srcState) -{ - memcpy(dstState, srcState, sizeof(*dstState)); -} - -XXH_PUBLIC_API XXH_errorcode XXH64_reset(XXH64_state_t* statePtr, unsigned long long seed) -{ - XXH64_state_t state; /* using a local state to memcpy() in order to avoid strict-aliasing warnings */ - memset(&state, 0, sizeof(state)-8); /* do not write into reserved, for future removal */ - state.v1 = seed + PRIME64_1 + PRIME64_2; - state.v2 = seed + PRIME64_2; - state.v3 = seed + 0; - state.v4 = seed - PRIME64_1; - memcpy(statePtr, &state, sizeof(state)); - return XXH_OK; -} - -FORCE_INLINE XXH_errorcode XXH64_update_endian (XXH64_state_t* state, const void* input, size_t len, XXH_endianess endian) -{ - const BYTE* p = (const BYTE*)input; - const BYTE* const bEnd = p + len; - -#ifdef XXH_ACCEPT_NULL_INPUT_POINTER - if (input==NULL) return XXH_ERROR; -#endif - - state->total_len += len; - - if (state->memsize + len < 32) { /* fill in tmp buffer */ - XXH_memcpy(((BYTE*)state->mem64) + state->memsize, input, len); - state->memsize += (U32)len; - return XXH_OK; - } - - if (state->memsize) { /* tmp buffer is full */ - XXH_memcpy(((BYTE*)state->mem64) + state->memsize, input, 32-state->memsize); - state->v1 = XXH64_round(state->v1, XXH_readLE64(state->mem64+0, endian)); - state->v2 = XXH64_round(state->v2, XXH_readLE64(state->mem64+1, endian)); - state->v3 = XXH64_round(state->v3, XXH_readLE64(state->mem64+2, endian)); - state->v4 = XXH64_round(state->v4, XXH_readLE64(state->mem64+3, endian)); - p += 32-state->memsize; - state->memsize = 0; - } - - if (p+32 <= bEnd) { - const BYTE* const limit = bEnd - 32; - U64 v1 = state->v1; - U64 v2 = state->v2; - U64 v3 = state->v3; - U64 v4 = state->v4; - - do { - v1 = XXH64_round(v1, XXH_readLE64(p, endian)); p+=8; - v2 = XXH64_round(v2, XXH_readLE64(p, endian)); p+=8; - v3 = XXH64_round(v3, XXH_readLE64(p, endian)); p+=8; - v4 = XXH64_round(v4, XXH_readLE64(p, endian)); p+=8; - } while (p<=limit); - - state->v1 = v1; - state->v2 = v2; - state->v3 = v3; - state->v4 = v4; - } - - if (p < bEnd) { - XXH_memcpy(state->mem64, p, (size_t)(bEnd-p)); - state->memsize = (unsigned)(bEnd-p); - } - - return XXH_OK; -} - -XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH64_state_t* state_in, const void* input, size_t len) -{ - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH64_update_endian(state_in, input, len, XXH_littleEndian); - else - return XXH64_update_endian(state_in, input, len, XXH_bigEndian); -} - -FORCE_INLINE U64 XXH64_digest_endian (const XXH64_state_t* state, XXH_endianess endian) -{ - const BYTE * p = (const BYTE*)state->mem64; - const BYTE* const bEnd = (const BYTE*)state->mem64 + state->memsize; - U64 h64; - - if (state->total_len >= 32) { - U64 const v1 = state->v1; - U64 const v2 = state->v2; - U64 const v3 = state->v3; - U64 const v4 = state->v4; - - h64 = XXH_rotl64(v1, 1) + XXH_rotl64(v2, 7) + XXH_rotl64(v3, 12) + XXH_rotl64(v4, 18); - h64 = XXH64_mergeRound(h64, v1); - h64 = XXH64_mergeRound(h64, v2); - h64 = XXH64_mergeRound(h64, v3); - h64 = XXH64_mergeRound(h64, v4); - } else { - h64 = state->v3 + PRIME64_5; - } - - h64 += (U64) state->total_len; - - while (p+8<=bEnd) { - U64 const k1 = XXH64_round(0, XXH_readLE64(p, endian)); - h64 ^= k1; - h64 = XXH_rotl64(h64,27) * PRIME64_1 + PRIME64_4; - p+=8; - } - - if (p+4<=bEnd) { - h64 ^= (U64)(XXH_readLE32(p, endian)) * PRIME64_1; - h64 = XXH_rotl64(h64, 23) * PRIME64_2 + PRIME64_3; - p+=4; - } - - while (p> 33; - h64 *= PRIME64_2; - h64 ^= h64 >> 29; - h64 *= PRIME64_3; - h64 ^= h64 >> 32; - - return h64; -} - -XXH_PUBLIC_API unsigned long long XXH64_digest (const XXH64_state_t* state_in) -{ - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH64_digest_endian(state_in, XXH_littleEndian); - else - return XXH64_digest_endian(state_in, XXH_bigEndian); -} - - -/*====== Canonical representation ======*/ - -XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash) -{ - XXH_STATIC_ASSERT(sizeof(XXH64_canonical_t) == sizeof(XXH64_hash_t)); - if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap64(hash); - memcpy(dst, &hash, sizeof(*dst)); -} - -XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src) -{ - return XXH_readBE64(src); -} - -#endif /* XXH_NO_LONG_LONG */ diff --git a/love/src/jni/love/src/libraries/xxHash/xxhash.h b/love/src/jni/love/src/libraries/xxHash/xxhash.h deleted file mode 100755 index 9d831e03..00000000 --- a/love/src/jni/love/src/libraries/xxHash/xxhash.h +++ /dev/null @@ -1,293 +0,0 @@ -/* - xxHash - Extremely Fast Hash algorithm - Header File - Copyright (C) 2012-2016, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - 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. - - 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 THE COPYRIGHT - OWNER OR CONTRIBUTORS 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. - - You can contact the author at : - - xxHash source repository : https://github.com/Cyan4973/xxHash -*/ - -/* Notice extracted from xxHash homepage : - -xxHash is an extremely fast Hash algorithm, running at RAM speed limits. -It also successfully passes all tests from the SMHasher suite. - -Comparison (single thread, Windows Seven 32 bits, using SMHasher on a Core 2 Duo @3GHz) - -Name Speed Q.Score Author -xxHash 5.4 GB/s 10 -CrapWow 3.2 GB/s 2 Andrew -MumurHash 3a 2.7 GB/s 10 Austin Appleby -SpookyHash 2.0 GB/s 10 Bob Jenkins -SBox 1.4 GB/s 9 Bret Mulvey -Lookup3 1.2 GB/s 9 Bob Jenkins -SuperFastHash 1.2 GB/s 1 Paul Hsieh -CityHash64 1.05 GB/s 10 Pike & Alakuijala -FNV 0.55 GB/s 5 Fowler, Noll, Vo -CRC32 0.43 GB/s 9 -MD5-32 0.33 GB/s 10 Ronald L. Rivest -SHA1-32 0.28 GB/s 10 - -Q.Score is a measure of quality of the hash function. -It depends on successfully passing SMHasher test set. -10 is a perfect score. - -A 64-bits version, named XXH64, is available since r35. -It offers much better speed, but for 64-bits applications only. -Name Speed on 64 bits Speed on 32 bits -XXH64 13.8 GB/s 1.9 GB/s -XXH32 6.8 GB/s 6.0 GB/s -*/ - -#ifndef XXHASH_H_5627135585666179 -#define XXHASH_H_5627135585666179 1 - -#if defined (__cplusplus) -extern "C" { -#endif - - -/* **************************** -* Definitions -******************************/ -#include /* size_t */ -typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode; - - -/* **************************** -* API modifier -******************************/ -/** XXH_PRIVATE_API -* This is useful to include xxhash functions in `static` mode -* in order to inline them, and remove their symbol from the public list. -* Methodology : -* #define XXH_PRIVATE_API -* #include "xxhash.h" -* `xxhash.c` is automatically included. -* It's not useful to compile and link it as a separate module. -*/ -#ifdef XXH_PRIVATE_API -# ifndef XXH_STATIC_LINKING_ONLY -# define XXH_STATIC_LINKING_ONLY -# endif -# if defined(__GNUC__) -# define XXH_PUBLIC_API static __inline __attribute__((unused)) -# elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) -# define XXH_PUBLIC_API static inline -# elif defined(_MSC_VER) -# define XXH_PUBLIC_API static __inline -# else -# define XXH_PUBLIC_API static /* this version may generate warnings for unused static functions; disable the relevant warning */ -# endif -#else -# define XXH_PUBLIC_API /* do nothing */ -#endif /* XXH_PRIVATE_API */ - -/*!XXH_NAMESPACE, aka Namespace Emulation : - -If you want to include _and expose_ xxHash functions from within your own library, -but also want to avoid symbol collisions with other libraries which may also include xxHash, - -you can use XXH_NAMESPACE, to automatically prefix any public symbol from xxhash library -with the value of XXH_NAMESPACE (therefore, avoid NULL and numeric values). - -Note that no change is required within the calling program as long as it includes `xxhash.h` : -regular symbol name will be automatically translated by this header. -*/ -#ifdef XXH_NAMESPACE -# define XXH_CAT(A,B) A##B -# define XXH_NAME2(A,B) XXH_CAT(A,B) -# define XXH_versionNumber XXH_NAME2(XXH_NAMESPACE, XXH_versionNumber) -# define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32) -# define XXH32_createState XXH_NAME2(XXH_NAMESPACE, XXH32_createState) -# define XXH32_freeState XXH_NAME2(XXH_NAMESPACE, XXH32_freeState) -# define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset) -# define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update) -# define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest) -# define XXH32_copyState XXH_NAME2(XXH_NAMESPACE, XXH32_copyState) -# define XXH32_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH32_canonicalFromHash) -# define XXH32_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH32_hashFromCanonical) -# define XXH64 XXH_NAME2(XXH_NAMESPACE, XXH64) -# define XXH64_createState XXH_NAME2(XXH_NAMESPACE, XXH64_createState) -# define XXH64_freeState XXH_NAME2(XXH_NAMESPACE, XXH64_freeState) -# define XXH64_reset XXH_NAME2(XXH_NAMESPACE, XXH64_reset) -# define XXH64_update XXH_NAME2(XXH_NAMESPACE, XXH64_update) -# define XXH64_digest XXH_NAME2(XXH_NAMESPACE, XXH64_digest) -# define XXH64_copyState XXH_NAME2(XXH_NAMESPACE, XXH64_copyState) -# define XXH64_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH64_canonicalFromHash) -# define XXH64_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH64_hashFromCanonical) -#endif - - -/* ************************************* -* Version -***************************************/ -#define XXH_VERSION_MAJOR 0 -#define XXH_VERSION_MINOR 6 -#define XXH_VERSION_RELEASE 2 -#define XXH_VERSION_NUMBER (XXH_VERSION_MAJOR *100*100 + XXH_VERSION_MINOR *100 + XXH_VERSION_RELEASE) -XXH_PUBLIC_API unsigned XXH_versionNumber (void); - - -/*-********************************************************************** -* 32-bits hash -************************************************************************/ -typedef unsigned int XXH32_hash_t; - -/*! XXH32() : - Calculate the 32-bits hash of sequence "length" bytes stored at memory address "input". - The memory between input & input+length must be valid (allocated and read-accessible). - "seed" can be used to alter the result predictably. - Speed on Core 2 Duo @ 3 GHz (single thread, SMHasher benchmark) : 5.4 GB/s */ -XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t length, unsigned int seed); - -/*====== Streaming ======*/ -typedef struct XXH32_state_s XXH32_state_t; /* incomplete type */ -XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void); -XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr); -XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* dst_state, const XXH32_state_t* src_state); - -XXH_PUBLIC_API XXH_errorcode XXH32_reset (XXH32_state_t* statePtr, unsigned int seed); -XXH_PUBLIC_API XXH_errorcode XXH32_update (XXH32_state_t* statePtr, const void* input, size_t length); -XXH_PUBLIC_API XXH32_hash_t XXH32_digest (const XXH32_state_t* statePtr); - -/* -These functions generate the xxHash of an input provided in multiple segments. -Note that, for small input, they are slower than single-call functions, due to state management. -For small input, prefer `XXH32()` and `XXH64()` . - -XXH state must first be allocated, using XXH*_createState() . - -Start a new hash by initializing state with a seed, using XXH*_reset(). - -Then, feed the hash state by calling XXH*_update() as many times as necessary. -Obviously, input must be allocated and read accessible. -The function returns an error code, with 0 meaning OK, and any other value meaning there is an error. - -Finally, a hash value can be produced anytime, by using XXH*_digest(). -This function returns the nn-bits hash as an int or long long. - -It's still possible to continue inserting input into the hash state after a digest, -and generate some new hashes later on, by calling again XXH*_digest(). - -When done, free XXH state space if it was allocated dynamically. -*/ - -/*====== Canonical representation ======*/ - -typedef struct { unsigned char digest[4]; } XXH32_canonical_t; -XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash); -XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src); - -/* Default result type for XXH functions are primitive unsigned 32 and 64 bits. -* The canonical representation uses human-readable write convention, aka big-endian (large digits first). -* These functions allow transformation of hash result into and from its canonical format. -* This way, hash values can be written into a file / memory, and remain comparable on different systems and programs. -*/ - - -#ifndef XXH_NO_LONG_LONG -/*-********************************************************************** -* 64-bits hash -************************************************************************/ -typedef unsigned long long XXH64_hash_t; - -/*! XXH64() : - Calculate the 64-bits hash of sequence of length "len" stored at memory address "input". - "seed" can be used to alter the result predictably. - This function runs faster on 64-bits systems, but slower on 32-bits systems (see benchmark). -*/ -XXH_PUBLIC_API XXH64_hash_t XXH64 (const void* input, size_t length, unsigned long long seed); - -/*====== Streaming ======*/ -typedef struct XXH64_state_s XXH64_state_t; /* incomplete type */ -XXH_PUBLIC_API XXH64_state_t* XXH64_createState(void); -XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr); -XXH_PUBLIC_API void XXH64_copyState(XXH64_state_t* dst_state, const XXH64_state_t* src_state); - -XXH_PUBLIC_API XXH_errorcode XXH64_reset (XXH64_state_t* statePtr, unsigned long long seed); -XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH64_state_t* statePtr, const void* input, size_t length); -XXH_PUBLIC_API XXH64_hash_t XXH64_digest (const XXH64_state_t* statePtr); - -/*====== Canonical representation ======*/ -typedef struct { unsigned char digest[8]; } XXH64_canonical_t; -XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash); -XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src); -#endif /* XXH_NO_LONG_LONG */ - - -#ifdef XXH_STATIC_LINKING_ONLY - -/* ================================================================================================ - This section contains definitions which are not guaranteed to remain stable. - They may change in future versions, becoming incompatible with a different version of the library. - They shall only be used with static linking. - Never use these definitions in association with dynamic linking ! -=================================================================================================== */ - -/* These definitions are only meant to make possible - static allocation of XXH state, on stack or in a struct for example. - Never use members directly. */ - -struct XXH32_state_s { - unsigned total_len_32; - unsigned large_len; - unsigned v1; - unsigned v2; - unsigned v3; - unsigned v4; - unsigned mem32[4]; /* buffer defined as U32 for alignment */ - unsigned memsize; - unsigned reserved; /* never read nor write, will be removed in a future version */ -}; /* typedef'd to XXH32_state_t */ - -#ifndef XXH_NO_LONG_LONG /* remove 64-bits support */ -struct XXH64_state_s { - unsigned long long total_len; - unsigned long long v1; - unsigned long long v2; - unsigned long long v3; - unsigned long long v4; - unsigned long long mem64[4]; /* buffer defined as U64 for alignment */ - unsigned memsize; - unsigned reserved[2]; /* never read nor write, will be removed in a future version */ -}; /* typedef'd to XXH64_state_t */ -#endif - -#ifdef XXH_PRIVATE_API -# include "xxhash.c" /* include xxhash function bodies as `static`, for inlining */ -#endif - -#endif /* XXH_STATIC_LINKING_ONLY */ - - -#if defined (__cplusplus) -} -#endif - -#endif /* XXHASH_H_5627135585666179 */ diff --git a/love/src/jni/love/src/love.cpp b/love/src/jni/love/src/love.cpp deleted file mode 100644 index 913d8b13..00000000 --- a/love/src/jni/love/src/love.cpp +++ /dev/null @@ -1,276 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "common/version.h" -#include "common/runtime.h" -#include "modules/love/love.h" -#include - -#ifdef LOVE_BUILD_EXE - -// Lua -extern "C" { - #include - #include - #include -} - -#ifdef LOVE_WINDOWS -#include -#endif // LOVE_WINDOWS - -#ifdef LOVE_MACOSX -#include "common/macosx.h" -#include -#endif // LOVE_MACOSX - -#ifdef LOVE_IOS -#include "common/ios.h" -#endif - -#ifdef LOVE_WINDOWS -extern "C" -{ - -// Prefer the higher performance GPU on Windows systems that use nvidia Optimus. -// http://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/OptimusRenderingPolicies.pdf -// TODO: Re-evaluate in the future when the average integrated GPU in Optimus -// systems is less mediocre? -LOVE_EXPORT DWORD NvOptimusEnablement = 1; - -// Same with AMD GPUs. -// https://community.amd.com/thread/169965 -LOVE_EXPORT DWORD AmdPowerXpressRequestHighPerformance = 1; -} -#endif // LOVE_WINDOWS - -#ifdef LOVE_LEGENDARY_APP_ARGV_HACK - -#include - -static void get_app_arguments(int argc, char **argv, int &new_argc, char **&new_argv) -{ - std::vector temp_argv; - for (int i = 0; i < argc; i++) - { - // Don't copy -psn_xxx argument from argv. - if (i == 0 || strncmp(argv[i], "-psn_", 5) != 0) - temp_argv.push_back(std::string(argv[i])); - } - -#ifdef LOVE_MACOSX - // Check for a drop file string, if the app wasn't launched in a terminal. - // Checking for the terminal is a pretty big hack, but works around an issue - // where OS X will switch Spaces if the terminal launching love is in its - // own full-screen Space. - std::string dropfilestr; - if (!isatty(STDIN_FILENO)) - dropfilestr = love::macosx::checkDropEvents(); - - if (!dropfilestr.empty()) - temp_argv.insert(temp_argv.begin() + 1, dropfilestr); - else -#endif - { - // If it exists, add the love file in love.app/Contents/Resources/ to argv. - std::string loveResourcesPath; - bool fused = true; -#if defined(LOVE_MACOSX) - loveResourcesPath = love::macosx::getLoveInResources(); -#elif defined(LOVE_IOS) - loveResourcesPath = love::ios::getLoveInResources(fused); -#endif - if (!loveResourcesPath.empty()) - { - std::vector::iterator it = temp_argv.begin(); - it = temp_argv.insert(it + 1, loveResourcesPath); - - // Run in pseudo-fused mode. - if (fused) - temp_argv.insert(it + 1, std::string("--fused")); - } - } - - // Copy temp argv vector to new argv array. - new_argc = (int) temp_argv.size(); - new_argv = new char *[new_argc+1]; - - for (int i = 0; i < new_argc; i++) - { - new_argv[i] = new char[temp_argv[i].length() + 1]; - strcpy(new_argv[i], temp_argv[i].c_str()); - } - - new_argv[new_argc] = NULL; -} - -#endif // LOVE_LEGENDARY_APP_ARGV_HACK - -static int love_preload(lua_State *L, lua_CFunction f, const char *name) -{ - lua_getglobal(L, "package"); - lua_getfield(L, -1, "preload"); - lua_pushcfunction(L, f); - lua_setfield(L, -2, name); - lua_pop(L, 2); - return 0; -} - -enum DoneAction -{ - DONE_QUIT, - DONE_RESTART, -}; - -static DoneAction runlove(int argc, char **argv, int &retval) -{ -#ifdef LOVE_LEGENDARY_APP_ARGV_HACK - int hack_argc = 0; - char **hack_argv = 0; - get_app_arguments(argc, argv, hack_argc, hack_argv); - argc = hack_argc; - argv = hack_argv; -#endif // LOVE_LEGENDARY_APP_ARGV_HACK - - // Oh, you just want the version? Okay! - if (argc > 1 && strcmp(argv[1], "--version") == 0) - { -#ifdef LOVE_LEGENDARY_CONSOLE_IO_HACK - const char *err = nullptr; - love_openConsole(err); -#endif - printf("LOVE %s (%s)\n", love_version(), love_codename()); - retval = 0; - return DONE_QUIT; - } - - // Create the virtual machine. - lua_State *L = luaL_newstate(); - luaL_openlibs(L); - - // Add love to package.preload for easy requiring. - love_preload(L, luaopen_love, "love"); - - // Add command line arguments to global arg (like stand-alone Lua). - { - lua_newtable(L); - - if (argc > 0) - { - lua_pushstring(L, argv[0]); - lua_rawseti(L, -2, -2); - } - - lua_pushstring(L, "embedded boot.lua"); - lua_rawseti(L, -2, -1); - - for (int i = 1; i < argc; i++) - { - lua_pushstring(L, argv[i]); - lua_rawseti(L, -2, i); - } - - lua_setglobal(L, "arg"); - } - - // require "love" - lua_getglobal(L, "require"); - lua_pushstring(L, "love"); - lua_call(L, 1, 1); // leave the returned table on the stack. - - // Add love._exe = true. - // This indicates that we're running the standalone version of love, and not - // the library version. - { - lua_pushboolean(L, 1); - lua_setfield(L, -2, "_exe"); - } - - // Pop the love table returned by require "love". - lua_pop(L, 1); - - // require "love.boot" (preloaded when love was required.) - lua_getglobal(L, "require"); - lua_pushstring(L, "love.boot"); - lua_call(L, 1, 1); - - // Turn the returned boot function into a coroutine and call it until done. - lua_newthread(L); - lua_pushvalue(L, -2); - int stackpos = lua_gettop(L); - while (love::luax_resume(L, 0) == LUA_YIELD) - lua_pop(L, lua_gettop(L) - stackpos); - - retval = 0; - DoneAction done = DONE_QUIT; - - // if love.boot() returns "restart", we'll start up again after closing this - // Lua state. - if (lua_type(L, -1) == LUA_TSTRING && strcmp(lua_tostring(L, -1), "restart") == 0) - done = DONE_RESTART; - if (lua_isnumber(L, -1)) - retval = (int) lua_tonumber(L, -1); - - lua_close(L); - -#if defined(LOVE_LEGENDARY_APP_ARGV_HACK) && !defined(LOVE_IOS) - if (hack_argv) - { - for (int i = 0; i::Entry Audio::distanceModelEntries[] = -{ - {"none", Audio::DISTANCE_NONE}, - {"inverse", Audio::DISTANCE_INVERSE}, - {"inverseclamped", Audio::DISTANCE_INVERSE_CLAMPED}, - {"linear", Audio::DISTANCE_LINEAR}, - {"linearclamped", Audio::DISTANCE_LINEAR_CLAMPED}, - {"exponent", Audio::DISTANCE_EXPONENT}, - {"exponentclamped", Audio::DISTANCE_EXPONENT_CLAMPED} -}; - -StringMap Audio::distanceModels(Audio::distanceModelEntries, sizeof(Audio::distanceModelEntries)); - -bool Audio::getConstant(const char *in, DistanceModel &out) -{ - return distanceModels.find(in, out); -} - -bool Audio::getConstant(DistanceModel in, const char *&out) -{ - return distanceModels.find(in, out); -} - -std::vector Audio::getConstants(DistanceModel) -{ - return distanceModels.getNames(); -} - -} // audio -} // love diff --git a/love/src/jni/love/src/modules/audio/Audio.h b/love/src/jni/love/src/modules/audio/Audio.h deleted file mode 100644 index 2f3fe6e1..00000000 --- a/love/src/jni/love/src/modules/audio/Audio.h +++ /dev/null @@ -1,275 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_AUDIO_AUDIO_H -#define LOVE_AUDIO_AUDIO_H - -// STL -#include - -// LOVE -#include "common/Module.h" -#include "common/StringMap.h" -#include "Source.h" -#include "Effect.h" -#include "RecordingDevice.h" - -namespace love -{ - -namespace sound -{ - -class Decoder; -class SoundData; - -} // sound - -namespace audio -{ - -/** - * The Audio module is responsible for playing back raw sound samples. - **/ -class Audio : public Module -{ -public: - - /** - * Attenuation by distance. - */ - enum DistanceModel - { - DISTANCE_NONE, - DISTANCE_INVERSE, - DISTANCE_INVERSE_CLAMPED, - DISTANCE_LINEAR, - DISTANCE_LINEAR_CLAMPED, - DISTANCE_EXPONENT, - DISTANCE_EXPONENT_CLAMPED, - DISTANCE_MAX_ENUM - }; - - static bool getConstant(const char *in, DistanceModel &out); - static bool getConstant(DistanceModel in, const char *&out); - static std::vector getConstants(DistanceModel); - - virtual ~Audio() {} - - // Implements Module. - virtual ModuleType getModuleType() const { return M_AUDIO; } - - virtual Source *newSource(love::sound::Decoder *decoder) = 0; - virtual Source *newSource(love::sound::SoundData *soundData) = 0; - virtual Source *newSource(int sampleRate, int bitDepth, int channels, int buffers) = 0; - - /** - * Gets the current number of simultaneous playing sources. - * @return The current number of simultaneous playing sources. - **/ - virtual int getActiveSourceCount() const = 0; - - /** - * Gets the maximum supported number of simultaneous playing sources. - * @return The maximum supported number of simultaneous playing sources. - **/ - virtual int getMaxSources() const = 0; - - /** - * Play the specified Source. - * @param source The Source to play. - **/ - virtual bool play(Source *source) = 0; - - /** - * Play the specified Sources. - * @param sources The Sources to play. - **/ - virtual bool play(const std::vector &sources) = 0; - - /** - * Stops playback on the specified source. - * @param source The source on which to stop the playback. - **/ - virtual void stop(Source *source) = 0; - - /** - * Stops playback on the specified sources. - * @param sources The sources on which to stop the playback. - **/ - virtual void stop(const std::vector &sources) = 0; - - /** - * Stops all playing audio. - **/ - virtual void stop() = 0; - - /** - * Pauses playback on the specified source. - * @param source The source on which to pause the playback. - **/ - virtual void pause(Source *source) = 0; - - /** - * Pauses playback on the specified sources. - * @param sources The sources on which to pause the playback. - **/ - virtual void pause(const std::vector &sources) = 0; - - /** - * Pauses all audio. - **/ - virtual std::vector pause() = 0; - - /** - * Sets the master volume, where 0.0f is min (off) and 1.0f is max. - * @param volume The new master volume. - **/ - virtual void setVolume(float volume) = 0; - - /** - * Gets the master volume. - * @return The current master volume. - **/ - virtual float getVolume() const = 0; - - /** - * Gets the position of the listener. - * @param v A float array of size 3 containing (x,y,z) in that order. - **/ - virtual void getPosition(float *v) const = 0; - - /** - * Sets the position of the listener. - * @param v A float array of size 3 containing [x,y,z] in that order. - **/ - virtual void setPosition(float *v) = 0; - - /** - * Gets the orientation of the listener. - * @param v A float array of size 6 containing [x,y,z] for the forward - * vector, followed by [x,y,z] for the up vector. - **/ - virtual void getOrientation(float *v) const = 0; - - /** - * Sets the orientation of the listener. - * @param v A float array of size 6 containing [x,y,z] for the forward - * vector, followed by [x,y,z] for the up vector. - **/ - virtual void setOrientation(float *v) = 0; - - /** - * Gets the velocity of the listener. - * @param v A float array of size 3 containing [x,y,z] in that order. - **/ - virtual void getVelocity(float *v) const = 0; - - /** - * Sets the velocity of the listener. - * @param v A float array of size 3 containing [x,y,z] in that order. - **/ - virtual void setVelocity(float *v) = 0; - - virtual void setDopplerScale(float scale) = 0; - virtual float getDopplerScale() const = 0; - //virtual void setMeter(float scale) = 0; - //virtual float getMeter() const = 0; - /** - * @return Reference to a vector of pointers to recording devices. May be empty. - **/ - virtual const std::vector &getRecordingDevices() = 0; - - /** - * Gets the distance model used for attenuation. - * @return Distance model. - */ - virtual DistanceModel getDistanceModel() const = 0; - - /** - * Sets the distance model used for attenuation. - * @param distanceModel Distance model. - */ - virtual void setDistanceModel(DistanceModel distanceModel) = 0; - - /** - * Sets scene EFX effect. - * @param name Effect name to use. - * @param fxparams Effect description table. - * @return true if successful, false otherwise. - */ - virtual bool setEffect(const char *name, std::map ¶ms) = 0; - - /** - * Removes scene EFX effect. - * @param name Effect name to clear. - * @return true if successful, false otherwise. - */ - virtual bool unsetEffect(const char *name) = 0; - - /** - * Gets scene EFX effect. - * @param name Effect name to get data from. - * @param fxparams Effect description table. - * @return true if effect was present, false otherwise. - */ - virtual bool getEffect(const char *name, std::map ¶ms) = 0; - - /** - * Gets list of EFX effect names. - * @param list List of EFX names to fill. - * @return true if effect was present, false otherwise. - */ - virtual bool getActiveEffects(std::vector &list) const = 0; - - /** - * Gets maximum number of scene EFX effects. - * @return number of effects. - */ - virtual int getMaxSceneEffects() const = 0; - - /** - * Gets maximum number of source EFX effects. - * @return number of effects. - */ - virtual int getMaxSourceEffects() const = 0; - - /** - * Gets EFX (or analog) availability. - * @return true if supported. - */ - virtual bool isEFXsupported() const = 0; - - /** - * Sets whether audio from other apps mixes with love.audio or is muted, - * on supported platforms. - **/ - bool setMixWithSystem(bool mix); - -private: - - static StringMap::Entry distanceModelEntries[]; - static StringMap distanceModels; -}; // Audio - -} // audio -} // love - -#endif // LOVE_AUDIO_AUDIO_H diff --git a/love/src/jni/love/src/modules/audio/Effect.cpp b/love/src/jni/love/src/modules/audio/Effect.cpp deleted file mode 100644 index 30c2b176..00000000 --- a/love/src/jni/love/src/modules/audio/Effect.cpp +++ /dev/null @@ -1,396 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "Effect.h" - -namespace love -{ -namespace audio -{ - -Effect::Effect() -{ -} - -Effect::~Effect() -{ -} - -Effect::Type Effect::getType() const -{ - return type; -} - -bool Effect::getConstant(const char *in, Type &out) -{ - return types.find(in, out); -} - -bool Effect::getConstant(Type in, const char *&out) -{ - return types.find(in, out); -} - -std::vector Effect::getConstants(Type) -{ - return types.getNames(); -} - -/* -bool Effect::getConstant(const char *in, Phoneme &out) -{ - return phonemes.find(in, out); -} - -bool Effect::getConstant(Phoneme in, const char *&out) -{ - return phonemes.find(in, out); -} -*/ -bool Effect::getConstant(const char *in, Waveform &out) -{ - return waveforms.find(in, out); -} - -bool Effect::getConstant(Waveform in, const char *&out) -{ - return waveforms.find(in, out); -} -/* -bool Effect::getConstant(const char *in, Direction &out) -{ - return directions.find(in, out); -} - -bool Effect::getConstant(Direction in, const char *&out) -{ - return directions.find(in, out); -} -*/ -bool Effect::getConstant(const char *in, Parameter &out, Type t) -{ - return parameterNames[t].find(in, out); -} - -bool Effect::getConstant(Parameter in, const char *&out, Type t) -{ - return parameterNames[t].find(in, out); -} - -Effect::ParameterType Effect::getParameterType(Effect::Parameter in) -{ - return parameterTypes[in]; -} - -StringMap::Entry Effect::typeEntries[] = -{ - {"reverb", Effect::TYPE_REVERB}, - {"chorus", Effect::TYPE_CHORUS}, - {"distortion", Effect::TYPE_DISTORTION}, - {"echo", Effect::TYPE_ECHO}, - {"flanger", Effect::TYPE_FLANGER}, - //{"frequencyshifter", Effect::TYPE_FREQSHIFTER}, - //{"vocalmorpher", Effect::TYPE_MORPHER}, - //{"pitchshifter", Effect::TYPE_PITCHSHIFTER}, - {"ringmodulator", Effect::TYPE_MODULATOR}, - //{"autowah", Effect::TYPE_AUTOWAH}, - {"compressor", Effect::TYPE_COMPRESSOR}, - {"equalizer", Effect::TYPE_EQUALIZER}, -}; - -StringMap Effect::types(Effect::typeEntries, sizeof(Effect::typeEntries)); - -StringMap::Entry Effect::waveformEntries[] = -{ - {"sine", Effect::WAVE_SINE}, - {"triangle", Effect::WAVE_TRIANGLE}, - {"sawtooth", Effect::WAVE_SAWTOOTH}, - {"square", Effect::WAVE_SQUARE}, -}; - -StringMap Effect::waveforms(Effect::waveformEntries, sizeof(Effect::waveformEntries)); - -/* -StringMap::Entry Effect::directionEntries[] = -{ - {"up", Effect::DIR_UP}, - {"down", Effect::DIR_DOWN}, - {"none", Effect::DIR_NONE}, -}; - -StringMap Effect::directions(Effect::directionEntries, sizeof(Effect::directionEntries)); - -StringMap::Entry Effect::phonemeEntries[] = -{ - {"a", Effect::PHONEME_A}, - {"e", Effect::PHONEME_E}, - {"i", Effect::PHONEME_I}, - {"o", Effect::PHONEME_O}, - {"u", Effect::PHONEME_U}, - {"aa", Effect::PHONEME_AA}, - {"ae", Effect::PHONEME_AE}, - {"ah", Effect::PHONEME_AH}, - {"ao", Effect::PHONEME_AO}, - {"eh", Effect::PHONEME_EH}, - {"er", Effect::PHONEME_ER}, - {"ih", Effect::PHONEME_IH}, - {"iy", Effect::PHONEME_IY}, - {"uh", Effect::PHONEME_UH}, - {"uw", Effect::PHONEME_UW}, - {"b", Effect::PHONEME_B}, - {"d", Effect::PHONEME_D}, - {"f", Effect::PHONEME_F}, - {"g", Effect::PHONEME_G}, - {"j", Effect::PHONEME_J}, - {"k", Effect::PHONEME_K}, - {"l", Effect::PHONEME_L}, - {"m", Effect::PHONEME_M}, - {"n", Effect::PHONEME_N}, - {"p", Effect::PHONEME_P}, - {"r", Effect::PHONEME_R}, - {"s", Effect::PHONEME_S}, - {"t", Effect::PHONEME_T}, - {"v", Effect::PHONEME_V}, - {"z", Effect::PHONEME_Z}, -}; - -StringMap Effect::phonemes(Effect::phonemeEntries, sizeof(Effect::phonemeEntries)); -*/ - -#define StringMap LazierAndSlowerButEasilyArrayableStringMap - -std::vector::Entry> Effect::basicParameters = -{ - {"type", Effect::EFFECT_TYPE}, - {"volume", Effect::EFFECT_VOLUME} -}; - -std::vector::Entry> Effect::reverbParameters = -{ - {"gain", Effect::REVERB_GAIN}, - {"highgain", Effect::REVERB_HFGAIN}, - {"density", Effect::REVERB_DENSITY}, - {"diffusion", Effect::REVERB_DIFFUSION}, - {"decaytime", Effect::REVERB_DECAY}, - {"decayhighratio", Effect::REVERB_HFDECAY}, - {"earlygain", Effect::REVERB_EARLYGAIN}, - {"earlydelay", Effect::REVERB_EARLYDELAY}, - {"lategain", Effect::REVERB_LATEGAIN}, - {"latedelay", Effect::REVERB_LATEDELAY}, - {"roomrolloff", Effect::REVERB_ROLLOFF}, - {"airabsorption", Effect::REVERB_AIRHFGAIN}, - {"highlimit", Effect::REVERB_HFLIMITER} -}; - -std::vector::Entry> Effect::chorusParameters = -{ - {"waveform", Effect::CHORUS_WAVEFORM}, - {"phase", Effect::CHORUS_PHASE}, - {"rate", Effect::CHORUS_RATE}, - {"depth", Effect::CHORUS_DEPTH}, - {"feedback", Effect::CHORUS_FEEDBACK}, - {"delay", Effect::CHORUS_DELAY} -}; - -std::vector::Entry> Effect::distortionParameters = -{ - {"gain", Effect::DISTORTION_GAIN}, - {"edge", Effect::DISTORTION_EDGE}, - {"lowcut", Effect::DISTORTION_LOWCUT}, - {"center", Effect::DISTORTION_EQCENTER}, - {"bandwidth", Effect::DISTORTION_EQBAND} -}; - -std::vector::Entry> Effect::echoParameters = -{ - {"delay", Effect::ECHO_DELAY}, - {"tapdelay", Effect::ECHO_LRDELAY}, - {"damping", Effect::ECHO_DAMPING}, - {"feedback", Effect::ECHO_FEEDBACK}, - {"spread", Effect::ECHO_SPREAD} -}; - -std::vector::Entry> Effect::flangerParameters = -{ - {"waveform", Effect::FLANGER_WAVEFORM}, - {"phase", Effect::FLANGER_PHASE}, - {"rate", Effect::FLANGER_RATE}, - {"depth", Effect::FLANGER_DEPTH}, - {"feedback", Effect::FLANGER_FEEDBACK}, - {"delay", Effect::FLANGER_DELAY} -}; -/* -std::vector::Entry> Effect::freqshifterParameters = -{ - {"frequency", Effect::FREQSHIFTER_FREQ}, - {"leftdirection", Effect::FREQSHIFTER_LEFTDIR}, - {"rightdirection", Effect::FREQSHIFTER_RIGHTDIR} -}; - -std::vector::Entry> Effect::morpherParameters = -{ - {"waveform", Effect::MORPHER_WAVEFORM}, - {"rate", Effect::MORPHER_RATE}, - {"phonemea", Effect::MORPHER_PHONEMEA}, - {"phonemeb", Effect::MORPHER_PHONEMEB}, - {"tunea", Effect::MORPHER_COARSEA}, - {"tuneb", Effect::MORPHER_COARSEB} -} -; -std::vector::Entry> Effect::pitchshifterParameters = -{ - {"pitch", Effect::PITCHSHIFTER_PITCH} -}; -*/ -std::vector::Entry> Effect::modulatorParameters = -{ - {"waveform", Effect::MODULATOR_WAVEFORM}, - {"frequency", Effect::MODULATOR_FREQ}, - {"highcut", Effect::MODULATOR_HIGHCUT} -}; -/* -std::vector::Entry> Effect::autowahParameters = -{ - {"attack", Effect::AUTOWAH_ATTACK}, - {"release", Effect::AUTOWAH_RELEASE}, - {"resonance", Effect::AUTOWAH_RESONANCE}, - {"peakgain", Effect::AUTOWAH_PEAKGAIN} -}; -*/ -std::vector::Entry> Effect::compressorParameters = -{ - {"enable", Effect::COMPRESSOR_ENABLE} -}; - -std::vector::Entry> Effect::equalizerParameters = -{ - {"lowgain", Effect::EQUALIZER_LOWGAIN}, - {"lowcut", Effect::EQUALIZER_LOWCUT}, - {"lowmidgain", Effect::EQUALIZER_MID1GAIN}, - {"lowmidfrequency", Effect::EQUALIZER_MID1FREQ}, - {"lowmidbandwidth", Effect::EQUALIZER_MID1BAND}, - {"highmidgain", Effect::EQUALIZER_MID2GAIN}, - {"highmidfrequency", Effect::EQUALIZER_MID2FREQ}, - {"highmidbandwidth", Effect::EQUALIZER_MID2BAND}, - {"highgain", Effect::EQUALIZER_HIGHGAIN}, - {"highcut", Effect::EQUALIZER_HIGHCUT} -}; - -std::map> Effect::parameterNames = -{ - {Effect::TYPE_BASIC, Effect::basicParameters}, - {Effect::TYPE_REVERB, Effect::reverbParameters}, - {Effect::TYPE_CHORUS, Effect::chorusParameters}, - {Effect::TYPE_DISTORTION, Effect::distortionParameters}, - {Effect::TYPE_ECHO, Effect::echoParameters}, - {Effect::TYPE_FLANGER, Effect::flangerParameters}, - //{Effect::TYPE_FREQSHIFTER, Effect::freqshifterParameters}, - //{Effect::TYPE_MORPHER, Effect::morpherbParameters}, - //{Effect::TYPE_PITCHSHIFTER, Effect::pitchshifterParameters}, - {Effect::TYPE_MODULATOR, Effect::modulatorParameters}, - //{Effect::TYPE_AUTOWAH, Effect::autowahParameters}, - {Effect::TYPE_COMPRESSOR, Effect::compressorParameters}, - {Effect::TYPE_EQUALIZER, Effect::equalizerParameters} -}; -#undef StringMap - -std::map Effect::parameterTypes = -{ - {Effect::EFFECT_TYPE, Effect::PARAM_TYPE}, - {Effect::EFFECT_VOLUME, Effect::PARAM_FLOAT}, - - {Effect::REVERB_GAIN, Effect::PARAM_FLOAT}, - {Effect::REVERB_HFGAIN, Effect::PARAM_FLOAT}, - {Effect::REVERB_DENSITY, Effect::PARAM_FLOAT}, - {Effect::REVERB_DIFFUSION, Effect::PARAM_FLOAT}, - {Effect::REVERB_DECAY, Effect::PARAM_FLOAT}, - {Effect::REVERB_HFDECAY, Effect::PARAM_FLOAT}, - {Effect::REVERB_EARLYGAIN, Effect::PARAM_FLOAT}, - {Effect::REVERB_EARLYDELAY, Effect::PARAM_FLOAT}, - {Effect::REVERB_LATEGAIN, Effect::PARAM_FLOAT}, - {Effect::REVERB_LATEDELAY, Effect::PARAM_FLOAT}, - {Effect::REVERB_ROLLOFF, Effect::PARAM_FLOAT}, - {Effect::REVERB_AIRHFGAIN, Effect::PARAM_FLOAT}, - {Effect::REVERB_HFLIMITER, Effect::PARAM_BOOL}, - - {Effect::CHORUS_WAVEFORM, Effect::PARAM_WAVEFORM}, - {Effect::CHORUS_PHASE, Effect::PARAM_FLOAT}, - {Effect::CHORUS_RATE, Effect::PARAM_FLOAT}, - {Effect::CHORUS_DEPTH, Effect::PARAM_FLOAT}, - {Effect::CHORUS_FEEDBACK, Effect::PARAM_FLOAT}, - {Effect::CHORUS_DELAY, Effect::PARAM_FLOAT}, - - {Effect::DISTORTION_GAIN, Effect::PARAM_FLOAT}, - {Effect::DISTORTION_EDGE, Effect::PARAM_FLOAT}, - {Effect::DISTORTION_LOWCUT, Effect::PARAM_FLOAT}, - {Effect::DISTORTION_EQCENTER, Effect::PARAM_FLOAT}, - {Effect::DISTORTION_EQBAND, Effect::PARAM_FLOAT}, - - {Effect::ECHO_DELAY, Effect::PARAM_FLOAT}, - {Effect::ECHO_LRDELAY, Effect::PARAM_FLOAT}, - {Effect::ECHO_DAMPING, Effect::PARAM_FLOAT}, - {Effect::ECHO_FEEDBACK, Effect::PARAM_FLOAT}, - {Effect::ECHO_SPREAD, Effect::PARAM_FLOAT}, - - {Effect::FLANGER_WAVEFORM, Effect::PARAM_WAVEFORM}, - {Effect::FLANGER_PHASE, Effect::PARAM_FLOAT}, - {Effect::FLANGER_RATE, Effect::PARAM_FLOAT}, - {Effect::FLANGER_DEPTH, Effect::PARAM_FLOAT}, - {Effect::FLANGER_FEEDBACK, Effect::PARAM_FLOAT}, - {Effect::FLANGER_DELAY, Effect::PARAM_FLOAT}, -/* - {Effect::FREQSHIFTER_FREQ, Effect::PARAM_FLOAT}, - {Effect::FREQSHIFTER_LEFTDIR, Effect::PARAM_DIRECTION}, - {Effect::FREQSHIFTER_RIGHTDIR, Effect::PARAM_DIRECTION}, - - {Effect::MORPHER_WAVEFORM, Effect::PARAM_WAVEFORM}, - {Effect::MORPHER_RATE, Effect::PARAM_FLOAT}, - {Effect::MORPHER_PHONEMEA, Effect::PARAM_PHONEME}, - {Effect::MORPHER_PHONEMEB, Effect::PARAM_PHONEME}, - {Effect::MORPHER_TUNEA, Effect::PARAM_FLOAT}, - {Effect::MORPHER_TUNEB, Effect::PARAM_FLOAT}, - - {Effect::PITCHSHIFTER_PITCH, Effect::PARAM_FLOAT}, -*/ - {Effect::MODULATOR_WAVEFORM, Effect::PARAM_WAVEFORM}, - {Effect::MODULATOR_FREQ, Effect::PARAM_FLOAT}, - {Effect::MODULATOR_HIGHCUT, Effect::PARAM_FLOAT}, -/* - {Effect::AUTOWAH_ATTACK, Effect::PARAM_FLOAT}, - {Effect::AUTOWAH_RELEASE, Effect::PARAM_FLOAT}, - {Effect::AUTOWAH_RESONANCE, Effect::PARAM_FLOAT}, - {Effect::AUTOWAH_PEAKGAIN, Effect::PARAM_FLOAT}, -*/ - {Effect::COMPRESSOR_ENABLE, Effect::PARAM_BOOL}, - - {Effect::EQUALIZER_LOWGAIN, Effect::PARAM_FLOAT}, - {Effect::EQUALIZER_LOWCUT, Effect::PARAM_FLOAT}, - {Effect::EQUALIZER_MID1GAIN, Effect::PARAM_FLOAT}, - {Effect::EQUALIZER_MID1FREQ, Effect::PARAM_FLOAT}, - {Effect::EQUALIZER_MID1BAND, Effect::PARAM_FLOAT}, - {Effect::EQUALIZER_MID2GAIN, Effect::PARAM_FLOAT}, - {Effect::EQUALIZER_MID2FREQ, Effect::PARAM_FLOAT}, - {Effect::EQUALIZER_MID2BAND, Effect::PARAM_FLOAT}, - {Effect::EQUALIZER_HIGHGAIN, Effect::PARAM_FLOAT}, - {Effect::EQUALIZER_HIGHCUT, Effect::PARAM_FLOAT} -}; - -} //audio -} //love diff --git a/love/src/jni/love/src/modules/audio/Effect.h b/love/src/jni/love/src/modules/audio/Effect.h deleted file mode 100644 index 2336a9d0..00000000 --- a/love/src/jni/love/src/modules/audio/Effect.h +++ /dev/null @@ -1,297 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_AUDIO_EFFECTS_H -#define LOVE_AUDIO_EFFECTS_H - -#include "common/Object.h" -#include "common/StringMap.h" -#include -#include - -template -class LazierAndSlowerButEasilyArrayableStringMap -{ -public: - struct Entry - { - const char *key; - T value; - }; - LazierAndSlowerButEasilyArrayableStringMap() - { - } - - LazierAndSlowerButEasilyArrayableStringMap(const std::vector &entries) - { - for (auto entry : entries) - { - forward[entry.key] = entry.value; - reverse[entry.value] = entry.key; - } - } - - bool find(const char *key, T &t) - { - if (forward.find(key) == forward.end()) - return false; - t = forward[key]; - return true; - } - - bool find(T key, const char *&str) - { - if (reverse.find(key) == reverse.end()) - return false; - str = reverse[key]; - return true; - } - -private: - std::map forward; - std::map reverse; -}; - -namespace love -{ -namespace audio -{ - -class Effect -{ -public: - enum Type - { - TYPE_BASIC, //not a real type - TYPE_REVERB, - TYPE_CHORUS, - TYPE_DISTORTION, - TYPE_ECHO, - TYPE_FLANGER, - //TYPE_FREQSHIFTER, - //TYPE_MORPHER, - //TYPE_PITCHSHIFTER, - TYPE_MODULATOR, - //TYPE_AUTOWAH, - TYPE_COMPRESSOR, - TYPE_EQUALIZER, - TYPE_MAX_ENUM - }; - - enum Parameter - { - EFFECT_TYPE, - EFFECT_VOLUME, - - REVERB_GAIN, - REVERB_HFGAIN, - REVERB_DENSITY, - REVERB_DIFFUSION, - REVERB_DECAY, - REVERB_HFDECAY, - REVERB_EARLYGAIN, - REVERB_EARLYDELAY, - REVERB_LATEGAIN, - REVERB_LATEDELAY, - REVERB_ROLLOFF, - REVERB_AIRHFGAIN, - REVERB_HFLIMITER, - - CHORUS_WAVEFORM, - CHORUS_PHASE, - CHORUS_RATE, - CHORUS_DEPTH, - CHORUS_FEEDBACK, - CHORUS_DELAY, - - DISTORTION_GAIN, - DISTORTION_EDGE, - DISTORTION_LOWCUT, - DISTORTION_EQCENTER, - DISTORTION_EQBAND, - - ECHO_DELAY, - ECHO_LRDELAY, - ECHO_DAMPING, - ECHO_FEEDBACK, - ECHO_SPREAD, - - FLANGER_WAVEFORM, - FLANGER_PHASE, - FLANGER_RATE, - FLANGER_DEPTH, - FLANGER_FEEDBACK, - FLANGER_DELAY, -/* - FREQSHIFTER_FREQ, - FREQSHIFTER_LEFTDIR, - FREQSHIFTER_RIGHTDIR, - - MORPHER_WAVEFORM, - MORPHER_RATE, - MORPHER_PHONEMEA, - MORPHER_PHONEMEB, - MORPHER_TUNEA, - MORPHER_TUNEB, - - PITCHSHIFTER_PITCH, -*/ - MODULATOR_WAVEFORM, - MODULATOR_FREQ, - MODULATOR_HIGHCUT, -/* - AUTOWAH_ATTACK, - AUTOWAH_RELEASE, - AUTOWAH_RESONANCE, - AUTOWAH_PEAKGAIN, -*/ - COMPRESSOR_ENABLE, - - EQUALIZER_LOWGAIN, - EQUALIZER_LOWCUT, - EQUALIZER_MID1GAIN, - EQUALIZER_MID1FREQ, - EQUALIZER_MID1BAND, - EQUALIZER_MID2GAIN, - EQUALIZER_MID2FREQ, - EQUALIZER_MID2BAND, - EQUALIZER_HIGHGAIN, - EQUALIZER_HIGHCUT, - - EFFECT_MAX_ENUM - }; - - enum ParameterType - { - PARAM_TYPE, - PARAM_FLOAT, - PARAM_BOOL, - PARAM_WAVEFORM, - //PARAM_DIRECTION, - //PARAM_PHONEME, - PARAM_MAX_ENUM - }; - - enum Waveform - { - WAVE_SINE, - WAVE_TRIANGLE, - WAVE_SAWTOOTH, - WAVE_SQUARE, - WAVE_MAX_ENUM - }; - /* - enum Direction - { - DIR_NONE, - DIR_UP, - DIR_DOWN, - DIR_MAX_ENUM - }; - - enum Phoneme - { - PHONEME_A, - PHONEME_E, - PHONEME_I, - PHONEME_O, - PHONEME_U, - PHONEME_AA, - PHONEME_AE, - PHONEME_AH, - PHONEME_AO, - PHONEME_EH, - PHONEME_ER, - PHONEME_IH, - PHONEME_IY, - PHONEME_UH, - PHONEME_UW, - PHONEME_B, - PHONEME_D, - PHONEME_F, - PHONEME_G, - PHONEME_J, - PHONEME_K, - PHONEME_L, - PHONEME_M, - PHONEME_N, - PHONEME_P, - PHONEME_R, - PHONEME_S, - PHONEME_T, - PHONEME_V, - PHONEME_Z, - PHONEME_MAX_ENUM - }; - */ - - Effect(); - virtual ~Effect(); - Type getType() const; - - static bool getConstant(const char *in, Type &out); - static bool getConstant(Type in, const char *&out); - static std::vector getConstants(Type); - static bool getConstant(const char *in, Waveform &out); - static bool getConstant(Waveform in, const char *&out); - //static bool getConstant(const char *in, Direction &out); - //static bool getConstant(Direction in, const char *&out); - //static bool getConstant(const char *in, Phoneme &out); - //static bool getConstant(Phoneme in, const char *&out); - static bool getConstant(const char *in, Parameter &out, Type t); - static bool getConstant(Parameter in, const char *&out, Type t); - static ParameterType getParameterType(Parameter in); - -protected: - Type type; - -private: - static StringMap::Entry typeEntries[]; - static StringMap types; - static StringMap::Entry waveformEntries[]; - static StringMap waveforms; - //static StringMap::Entry directionEntries[]; - //static StringMap directions; - //static StringMap::Entry phonemeEntries[]; - //static StringMap phonemes; -#define StringMap LazierAndSlowerButEasilyArrayableStringMap - static std::vector::Entry> basicParameters; - static std::vector::Entry> reverbParameters; - static std::vector::Entry> chorusParameters; - static std::vector::Entry> distortionParameters; - static std::vector::Entry> echoParameters; - static std::vector::Entry> flangerParameters; - //static std::vector::Entry> freqshifterParameters; - //static std::vector::Entry> morpherParameters; - //static std::vector::Entry> pitchshifterParameters; - static std::vector::Entry> modulatorParameters; - //static std::vector::Entry> autowahParameters; - static std::vector::Entry> compressorParameters; - static std::vector::Entry> equalizerParameters; - static std::map> parameterNames; -#undef StringMap - static std::map parameterTypes; - -}; - -} //audio -} //love - -#endif //LOVE_AUDIO_EFFECTS_H diff --git a/love/src/jni/love/src/modules/audio/Filter.cpp b/love/src/jni/love/src/modules/audio/Filter.cpp deleted file mode 100644 index 13608692..00000000 --- a/love/src/jni/love/src/modules/audio/Filter.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "Filter.h" - -namespace love -{ -namespace audio -{ - -Filter::Filter() -{ -} - -Filter::~Filter() -{ -} - -Filter::Type Filter::getType() const -{ - return type; -} - -bool Filter::getConstant(const char *in, Type &out) -{ - return types.find(in, out); -} - -bool Filter::getConstant(Type in, const char *&out) -{ - return types.find(in, out); -} - -std::vector Filter::getConstants(Type) -{ - return types.getNames(); -} - -bool Filter::getConstant(const char *in, Parameter &out, Type t) -{ - return parameterNames[t].find(in, out); -} - -bool Filter::getConstant(Parameter in, const char *&out, Type t) -{ - return parameterNames[t].find(in, out); -} - -Filter::ParameterType Filter::getParameterType(Parameter in) -{ - return parameterTypes[in]; -} - -StringMap::Entry Filter::typeEntries[] = -{ - {"lowpass", Filter::TYPE_LOWPASS}, - {"highpass", Filter::TYPE_HIGHPASS}, - {"bandpass", Filter::TYPE_BANDPASS}, -}; - -StringMap Filter::types(Filter::typeEntries, sizeof(Filter::typeEntries)); - -#define StringMap LazierAndSlowerButEasilyArrayableStringMap2 -std::vector::Entry> Filter::basicParameters = -{ - {"type", Filter::FILTER_TYPE}, - {"volume", Filter::FILTER_VOLUME} -}; - -std::vector::Entry> Filter::lowpassParameters = -{ - {"highgain", Filter::FILTER_HIGHGAIN} -}; - -std::vector::Entry> Filter::highpassParameters = -{ - {"lowgain", Filter::FILTER_LOWGAIN} -}; - -std::vector::Entry> Filter::bandpassParameters = -{ - {"lowgain", Filter::FILTER_LOWGAIN}, - {"highgain", Filter::FILTER_HIGHGAIN} -}; - -std::map> Filter::parameterNames = -{ - {Filter::TYPE_BASIC, Filter::basicParameters}, - {Filter::TYPE_LOWPASS, Filter::lowpassParameters}, - {Filter::TYPE_HIGHPASS, Filter::highpassParameters}, - {Filter::TYPE_BANDPASS, Filter::bandpassParameters}, -}; -#undef StringMap - -std::map Filter::parameterTypes = -{ - {Filter::FILTER_TYPE, Filter::PARAM_TYPE}, - {Filter::FILTER_VOLUME, Filter::PARAM_FLOAT}, - {Filter::FILTER_LOWGAIN, Filter::PARAM_FLOAT}, - {Filter::FILTER_HIGHGAIN, Filter::PARAM_FLOAT} -}; - -} //audio -} //love diff --git a/love/src/jni/love/src/modules/audio/Filter.h b/love/src/jni/love/src/modules/audio/Filter.h deleted file mode 100644 index d4de4356..00000000 --- a/love/src/jni/love/src/modules/audio/Filter.h +++ /dev/null @@ -1,136 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_AUDIO_FILTERS_H -#define LOVE_AUDIO_FILTERS_H - -#include "common/Object.h" -#include "common/StringMap.h" -#include - -template -class LazierAndSlowerButEasilyArrayableStringMap2 -{ -public: - struct Entry - { - const char *key; - T value; - }; - LazierAndSlowerButEasilyArrayableStringMap2() - { - } - - LazierAndSlowerButEasilyArrayableStringMap2(const std::vector &entries) - { - for (auto entry : entries) - { - forward[entry.key] = entry.value; - reverse[entry.value] = entry.key; - } - } - - bool find(const char *key, T &t) - { - if (forward.find(key) == forward.end()) - return false; - t = forward[key]; - return true; - } - - bool find(T key, const char *&str) - { - if (reverse.find(key) == reverse.end()) - return false; - str = reverse[key]; - return true; - } - -private: - std::map forward; - std::map reverse; -}; - -namespace love -{ -namespace audio -{ - -class Filter -{ -public: - enum Type - { - TYPE_BASIC, - TYPE_LOWPASS, - TYPE_HIGHPASS, - TYPE_BANDPASS, - TYPE_MAX_ENUM - }; - - enum Parameter - { - FILTER_TYPE, - FILTER_VOLUME, - - FILTER_LOWGAIN, - FILTER_HIGHGAIN, - - FILTER_MAX_ENUM - }; - - enum ParameterType - { - PARAM_TYPE, - PARAM_FLOAT, - PARAM_MAX_ENUM - }; - - Filter(); - virtual ~Filter(); - Type getType() const; - - static bool getConstant(const char *in, Type &out); - static bool getConstant(Type in, const char *&out); - static std::vector getConstants(Type); - static bool getConstant(const char *in, Parameter &out, Type t); - static bool getConstant(Parameter in, const char *&out, Type t); - static ParameterType getParameterType(Parameter in); - -protected: - Type type; - -private: - static StringMap::Entry typeEntries[]; - static StringMap types; -#define StringMap LazierAndSlowerButEasilyArrayableStringMap2 - static std::vector::Entry> basicParameters; - static std::vector::Entry> lowpassParameters; - static std::vector::Entry> highpassParameters; - static std::vector::Entry> bandpassParameters; - static std::map> parameterNames; -#undef StringMap - static std::map parameterTypes; -}; - -} //audio -} //love - -#endif //LOVE_AUDIO_FILTERS_H diff --git a/love/src/jni/love/src/modules/audio/RecordingDevice.cpp b/love/src/jni/love/src/modules/audio/RecordingDevice.cpp deleted file mode 100644 index 3317692f..00000000 --- a/love/src/jni/love/src/modules/audio/RecordingDevice.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "RecordingDevice.h" - -namespace love -{ -namespace audio -{ - -love::Type RecordingDevice::type("RecordingDevice", &Object::type); - -RecordingDevice::RecordingDevice() -{ -} - -RecordingDevice::~RecordingDevice() -{ -} - -} //audio -} //love diff --git a/love/src/jni/love/src/modules/audio/RecordingDevice.h b/love/src/jni/love/src/modules/audio/RecordingDevice.h deleted file mode 100644 index 0a3ba2d9..00000000 --- a/love/src/jni/love/src/modules/audio/RecordingDevice.h +++ /dev/null @@ -1,109 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_AUDIO_RECORDING_DEVICE_H -#define LOVE_AUDIO_RECORDING_DEVICE_H - -#include "common/Object.h" -#include "sound/SoundData.h" - -#include - -namespace love -{ -namespace audio -{ - -class RecordingDevice : public love::Object -{ -public: - - static love::Type type; - - static const int DEFAULT_SAMPLES = 8192; - static const int DEFAULT_SAMPLE_RATE = 8000; - static const int DEFAULT_BIT_DEPTH = 16; - static const int DEFAULT_CHANNELS = 1; - - RecordingDevice(); - virtual ~RecordingDevice(); - - /** - * Begins audio input recording process. - * @param samples Number of samples to buffer. - * @param sampleRate Desired sample rate. - * @param bitDepth Desired bit depth (8 or 16). - * @param channels Desired number of channels. - * @return True if recording started successfully. - **/ - virtual bool start(int samples, int sampleRate, int bitDepth, int channels) = 0; - - /** - * Stops audio input recording. - **/ - virtual void stop() = 0; - - /** - * Retreives recorded data. - * @return SoundData containing data obtained from recording device. - **/ - virtual love::sound::SoundData *getData() = 0; - - /** - * @return C string device name. - **/ - virtual const char *getName() const = 0; - - /** - * @return Number of samples currently recorded. - **/ - virtual int getSampleCount() const = 0; - - /** - * Gets the maximum number of samples that will be buffered, as set by start(). - **/ - virtual int getMaxSamples() const = 0; - - /** - * @return Sample rate for recording. - **/ - virtual int getSampleRate() const = 0; - - /** - * @return Bit depth for recording. - **/ - virtual int getBitDepth() const = 0; - - /** - * @return Number of channels for recording. - **/ - virtual int getChannelCount() const = 0; - - /** - * @return True if currently recording. - **/ - virtual bool isRecording() const = 0; - -}; //RecordingDevice - -} //audio -} //love - -#endif //LOVE_AUDIO_RECORDING_DEVICE_H diff --git a/love/src/jni/love/src/modules/audio/Source.cpp b/love/src/jni/love/src/modules/audio/Source.cpp deleted file mode 100644 index 47f6c787..00000000 --- a/love/src/jni/love/src/modules/audio/Source.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "Source.h" - -namespace love -{ -namespace audio -{ - -love::Type Source::type("Source", &Object::type); - -Source::Source(Type sourceType) - : sourceType(sourceType) -{ -} - -Source::~Source() -{ -} - -Source::Type Source::getType() const -{ - return sourceType; -} - -bool Source::getConstant(const char *in, Type &out) -{ - return types.find(in, out); -} - -bool Source::getConstant(Type in, const char *&out) -{ - return types.find(in, out); -} - -std::vector Source::getConstants(Type) -{ - return types.getNames(); -} - -bool Source::getConstant(const char *in, Unit &out) -{ - return units.find(in, out); -} - -bool Source::getConstant(Unit in, const char *&out) -{ - return units.find(in, out); -} - -std::vector Source::getConstants(Unit) -{ - return units.getNames(); -} - -StringMap::Entry Source::typeEntries[] = -{ - {"static", Source::TYPE_STATIC}, - {"stream", Source::TYPE_STREAM}, - {"queue", Source::TYPE_QUEUE}, -}; - -StringMap Source::types(Source::typeEntries, sizeof(Source::typeEntries)); - -StringMap::Entry Source::unitEntries[] = -{ - {"seconds", Source::UNIT_SECONDS}, - {"samples", Source::UNIT_SAMPLES}, -}; - -StringMap Source::units(Source::unitEntries, sizeof(Source::unitEntries)); - -} // audio -} // love diff --git a/love/src/jni/love/src/modules/audio/Source.h b/love/src/jni/love/src/modules/audio/Source.h deleted file mode 100644 index d234d59e..00000000 --- a/love/src/jni/love/src/modules/audio/Source.h +++ /dev/null @@ -1,150 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_AUDIO_SOURCE_H -#define LOVE_AUDIO_SOURCE_H - -// LOVE -#include "common/Object.h" -#include "common/StringMap.h" -#include "Filter.h" - -#include - -namespace love -{ -namespace audio -{ - -class Source : public Object -{ -public: - - static love::Type type; - - enum Type - { - TYPE_STATIC, - TYPE_STREAM, - TYPE_QUEUE, - TYPE_MAX_ENUM - }; - - enum Unit - { - UNIT_SECONDS, - UNIT_SAMPLES, - UNIT_MAX_ENUM - }; - - Source(Type type); - virtual ~Source(); - - virtual Source *clone() = 0; - - virtual bool play() = 0; - virtual void stop() = 0; - virtual void pause() = 0; - virtual bool isPlaying() const = 0; - virtual bool isFinished() const = 0; - virtual bool update() = 0; - - virtual void setPitch(float pitch) = 0; - virtual float getPitch() const = 0; - - virtual void setVolume(float volume) = 0; - virtual float getVolume() const = 0; - - virtual void seek(float offset, Unit unit) = 0; - virtual float tell(Unit unit) = 0; - virtual double getDuration(Unit unit) = 0; - - // all float * v must be of size 3 - virtual void setPosition(float *v) = 0; - virtual void getPosition(float *v) const = 0; - virtual void setVelocity(float *v) = 0; - virtual void getVelocity(float *v) const = 0; - virtual void setDirection(float *v) = 0; - virtual void getDirection(float *v) const = 0; - - virtual void setCone(float innerAngle, float outerAngle, float outerVolume, float outerHighGain) = 0; - virtual void getCone(float &innerAngle, float &outerAngle, float &outerVolume, float &outerHighGain) const = 0; - - virtual void setRelative(bool enable) = 0; - virtual bool isRelative() const = 0; - - virtual void setLooping(bool looping) = 0; - virtual bool isLooping() const = 0; - - virtual void setMinVolume(float volume) = 0; - virtual float getMinVolume() const = 0; - virtual void setMaxVolume(float volume) = 0; - virtual float getMaxVolume() const = 0; - - virtual void setReferenceDistance(float distance) = 0; - virtual float getReferenceDistance() const = 0; - virtual void setRolloffFactor(float factor) = 0; - virtual float getRolloffFactor() const = 0; - virtual void setMaxDistance(float distance) = 0; - virtual float getMaxDistance() const = 0; - virtual void setAirAbsorptionFactor(float factor) = 0; - virtual float getAirAbsorptionFactor() const = 0; - - virtual int getChannelCount() const = 0; - - virtual bool setFilter(const std::map ¶ms) = 0; - virtual bool setFilter() = 0; - virtual bool getFilter(std::map ¶ms) = 0; - - virtual bool setEffect(const char *effect) = 0; - virtual bool setEffect(const char *effect, const std::map ¶ms) = 0; - virtual bool unsetEffect(const char *effect) = 0; - virtual bool getEffect(const char *effect, std::map ¶ms) = 0; - virtual bool getActiveEffects(std::vector &list) const = 0; - - virtual int getFreeBufferCount() const = 0; - virtual bool queue(void *data, size_t length, int dataSampleRate, int dataBitDepth, int dataChannels) = 0; - - virtual Type getType() const; - - static bool getConstant(const char *in, Type &out); - static bool getConstant(Type in, const char *&out); - static std::vector getConstants(Type); - static bool getConstant(const char *in, Unit &out); - static bool getConstant(Unit in, const char *&out); - static std::vector getConstants(Unit); - -protected: - - Type sourceType; - -private: - - static StringMap::Entry typeEntries[]; - static StringMap types; - static StringMap::Entry unitEntries[]; - static StringMap units; - -}; // Source - -} // audio -} // love - -#endif // LOVE_AUDIO_SOURCE_H diff --git a/love/src/jni/love/src/modules/audio/null/Audio.cpp b/love/src/jni/love/src/modules/audio/null/Audio.cpp deleted file mode 100644 index 4093ace0..00000000 --- a/love/src/jni/love/src/modules/audio/null/Audio.cpp +++ /dev/null @@ -1,208 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "Audio.h" - -namespace love -{ -namespace audio -{ -namespace null -{ - -Audio::Audio() - : distanceModel(DISTANCE_NONE) -{ -} - -Audio::~Audio() -{ -} - -const char *Audio::getName() const -{ - return "love.audio.null"; -} - -love::audio::Source *Audio::newSource(love::sound::Decoder *) -{ - return new Source(); -} - -love::audio::Source *Audio::newSource(love::sound::SoundData *) -{ - return new Source(); -} - -love::audio::Source *Audio::newSource(int, int, int, int) -{ - return new Source(); -} - -int Audio::getActiveSourceCount() const -{ - return 0; -} - -int Audio::getMaxSources() const -{ - return 0; -} - -bool Audio::play(love::audio::Source *) -{ - return false; -} - -bool Audio::play(const std::vector&) -{ - return false; -} - -void Audio::stop(love::audio::Source *) -{ -} - -void Audio::stop(const std::vector&) -{ -} - -void Audio::stop() -{ -} - -void Audio::pause(love::audio::Source *) -{ -} - -void Audio::pause(const std::vector&) -{ -} - -std::vector Audio::pause() -{ - return {}; -} - -void Audio::setVolume(float volume) -{ - this->volume = volume; -} - -float Audio::getVolume() const -{ - return volume; -} - -void Audio::getPosition(float *) const -{ -} - -void Audio::setPosition(float *) -{ -} - -void Audio::getOrientation(float *) const -{ -} - -void Audio::setOrientation(float *) -{ -} - -void Audio::getVelocity(float *) const -{ -} - -void Audio::setVelocity(float *) -{ -} - -void Audio::setDopplerScale(float) -{ -} - -float Audio::getDopplerScale() const -{ - return 1.0f; -} -/* -void setMeter(float) -{ -} - -float getMeter() const -{ - return 1.0f; -} -*/ -const std::vector &Audio::getRecordingDevices() -{ - return capture; -} - -Audio::DistanceModel Audio::getDistanceModel() const -{ - return this->distanceModel; -} - -void Audio::setDistanceModel(DistanceModel distanceModel) -{ - this->distanceModel = distanceModel; -} - -bool Audio::setEffect(const char *, std::map &) -{ - return false; -} - -bool Audio::unsetEffect(const char *) -{ - return false; -} - -bool Audio::getEffect(const char *, std::map &) -{ - return false; -} - -bool Audio::getActiveEffects(std::vector &) const -{ - return false; -} - -int Audio::getMaxSceneEffects() const -{ - return 0; -} - -int Audio::getMaxSourceEffects() const -{ - return 0; -} - -bool Audio::isEFXsupported() const -{ - return false; -} - -} // null -} // audio -} // love diff --git a/love/src/jni/love/src/modules/audio/null/Audio.h b/love/src/jni/love/src/modules/audio/null/Audio.h deleted file mode 100644 index 690cc79c..00000000 --- a/love/src/jni/love/src/modules/audio/null/Audio.h +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_AUDIO_NULL_AUDIO_H -#define LOVE_AUDIO_NULL_AUDIO_H - -// LOVE -#include "audio/Audio.h" - -#include "RecordingDevice.h" -#include "Source.h" - -namespace love -{ -namespace audio -{ -namespace null -{ - -class Audio : public love::audio::Audio -{ -public: - - Audio(); - virtual ~Audio(); - - // Implements Module. - const char *getName() const; - - // Implements Audio. - love::audio::Source *newSource(love::sound::Decoder *decoder); - love::audio::Source *newSource(love::sound::SoundData *soundData); - love::audio::Source *newSource(int sampleRate, int bitDepth, int channels, int buffers); - int getActiveSourceCount() const; - int getMaxSources() const; - bool play(love::audio::Source *source); - bool play(const std::vector &sources); - void stop(love::audio::Source *source); - void stop(const std::vector &sources); - void stop(); - void pause(love::audio::Source *source); - void pause(const std::vector &sources); - std::vector pause(); - void setVolume(float volume); - float getVolume() const; - - void getPosition(float *v) const; - void setPosition(float *v); - void getOrientation(float *v) const; - void setOrientation(float *v); - void getVelocity(float *v) const; - void setVelocity(float *v); - - void setDopplerScale(float scale); - float getDopplerScale() const; - //void setMeter(float scale); - //float getMeter() const; - - const std::vector &getRecordingDevices(); - - DistanceModel getDistanceModel() const; - void setDistanceModel(DistanceModel distanceModel); - - bool setEffect(const char *, std::map ¶ms); - bool unsetEffect(const char *); - bool getEffect(const char *, std::map ¶ms); - bool getActiveEffects(std::vector &list) const; - int getMaxSceneEffects() const; - int getMaxSourceEffects() const; - bool isEFXsupported() const; - -private: - float volume; - DistanceModel distanceModel; - std::vector capture; - -}; // Audio - -} // null -} // audio -} // love - -#endif // LOVE_AUDIO_NULL_AUDIO_H diff --git a/love/src/jni/love/src/modules/audio/null/RecordingDevice.cpp b/love/src/jni/love/src/modules/audio/null/RecordingDevice.cpp deleted file mode 100644 index c423d2e2..00000000 --- a/love/src/jni/love/src/modules/audio/null/RecordingDevice.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "RecordingDevice.h" -#include "Audio.h" - -namespace love -{ -namespace audio -{ -namespace null -{ - -const char *RecordingDevice::name = "null"; - -RecordingDevice::RecordingDevice(const char *) -{ -} - -RecordingDevice::~RecordingDevice() -{ -} - -bool RecordingDevice::start(int, int, int, int) -{ - return false; -} - -void RecordingDevice::stop() -{ -} - -love::sound::SoundData *RecordingDevice::getData() -{ - return nullptr; -} - -int RecordingDevice::getSampleCount() const -{ - return 0; -} - -int RecordingDevice::getMaxSamples() const -{ - return 0; -} - -int RecordingDevice::getSampleRate() const -{ - return 0; -} - -int RecordingDevice::getBitDepth() const -{ - return 0; -} - -int RecordingDevice::getChannelCount() const -{ - return 0; -} - -const char *RecordingDevice::getName() const -{ - return name; -} - -bool RecordingDevice::isRecording() const -{ - return false; -} - -} //null -} //audio -} //love diff --git a/love/src/jni/love/src/modules/audio/null/RecordingDevice.h b/love/src/jni/love/src/modules/audio/null/RecordingDevice.h deleted file mode 100644 index 03b69e20..00000000 --- a/love/src/jni/love/src/modules/audio/null/RecordingDevice.h +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_AUDIO_NULL_RECORDING_DEVICE_H -#define LOVE_AUDIO_NULL_RECORDING_DEVICE_H - -#include "audio/RecordingDevice.h" -#include "sound/SoundData.h" - -namespace love -{ -namespace audio -{ -namespace null -{ - -class RecordingDevice : public love::audio::RecordingDevice -{ -public: - RecordingDevice(const char *name); - virtual ~RecordingDevice(); - virtual bool start(int samples, int sampleRate, int bitDepth, int channels); - virtual void stop(); - virtual love::sound::SoundData *getData(); - virtual const char *getName() const; - virtual int getMaxSamples() const; - virtual int getSampleCount() const; - virtual int getSampleRate() const; - virtual int getBitDepth() const; - virtual int getChannelCount() const; - virtual bool isRecording() const; - -private: - static const char *name; -}; //RecordingDevice - -} //null -} //audio -} //love - -#endif //LOVE_AUDIO_NULL_RECORDING_DEVICE_H diff --git a/love/src/jni/love/src/modules/audio/null/Source.cpp b/love/src/jni/love/src/modules/audio/null/Source.cpp deleted file mode 100644 index 21922394..00000000 --- a/love/src/jni/love/src/modules/audio/null/Source.cpp +++ /dev/null @@ -1,284 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "Source.h" - -namespace love -{ -namespace audio -{ -namespace null -{ - -Source::Source() - : love::audio::Source(Source::TYPE_STATIC) -{ -} - -Source::~Source() -{ -} - -love::audio::Source *Source::clone() -{ - this->retain(); - return this; -} - -bool Source::play() -{ - return false; -} - -void Source::stop() -{ -} - -void Source::pause() -{ -} - -bool Source::isPlaying() const -{ - return false; -} - -bool Source::isFinished() const -{ - return true; -} - -bool Source::update() -{ - return false; -} - -void Source::setPitch(float pitch) -{ - this->pitch = pitch; -} - -float Source::getPitch() const -{ - return pitch; -} - -void Source::setVolume(float volume) -{ - this->volume = volume; -} - -float Source::getVolume() const -{ - return volume; -} - -void Source::seek(float, Source::Unit) -{ -} - -float Source::tell(Source::Unit) -{ - return 0.0f; -} - -double Source::getDuration(Unit) -{ - return -1.0f; -} - -void Source::setPosition(float *) -{ -} - -void Source::getPosition(float *) const -{ -} - -void Source::setVelocity(float *) -{ -} - -void Source::getVelocity(float *) const -{ -} - -void Source::setDirection(float *) -{ -} - -void Source::getDirection(float *) const -{ -} - -void Source::setCone(float innerAngle, float outerAngle, float outerVolume, float outerHighGain) -{ - coneInnerAngle = innerAngle; - coneOuterAngle = outerAngle; - coneOuterVolume = outerVolume; - coneOuterHighGain = outerHighGain; -} - -void Source::getCone(float &innerAngle, float &outerAngle, float &outerVolume, float &outerHighGain) const -{ - innerAngle = coneInnerAngle; - outerAngle = coneOuterAngle; - outerVolume = coneOuterVolume; - outerHighGain = coneOuterHighGain; -} - -void Source::setRelative(bool enable) -{ - relative = enable; -} - -bool Source::isRelative() const -{ - return relative; -} - -void Source::setLooping(bool looping) -{ - this->looping = looping; -} - -bool Source::isLooping() const -{ - return looping; -} - -void Source::setMinVolume(float volume) -{ - this->minVolume = volume; -} - -float Source::getMinVolume() const -{ - return this->minVolume; -} - -void Source::setMaxVolume(float volume) -{ - this->maxVolume = volume; -} - -float Source::getMaxVolume() const -{ - return this->maxVolume; -} - -void Source::setReferenceDistance(float distance) -{ - this->referenceDistance = distance; -} - -float Source::getReferenceDistance() const -{ - return this->referenceDistance; -} - -void Source::setRolloffFactor(float factor) -{ - this->rolloffFactor = factor; -} - -float Source::getRolloffFactor() const -{ - return this->rolloffFactor; -} - -void Source::setMaxDistance(float distance) -{ - this->maxDistance = distance; -} - -float Source::getMaxDistance() const -{ - return this->maxDistance; -} - -void Source::setAirAbsorptionFactor(float factor) -{ - absorptionFactor = factor; -} - -float Source::getAirAbsorptionFactor() const -{ - return absorptionFactor; -} - -int Source::getChannelCount() const -{ - return 2; -} - -int Source::getFreeBufferCount() const -{ - return 0; -} - -bool Source::queue(void *, size_t, int, int, int) -{ - return false; -} - -bool Source::setFilter(const std::map &) -{ - return false; -} - -bool Source::setFilter() -{ - return false; -} - -bool Source::getFilter(std::map &) -{ - return false; -} - -bool Source::setEffect(const char *) -{ - return false; -} - -bool Source::setEffect(const char *, const std::map &) -{ - return false; -} - -bool Source::unsetEffect(const char *) -{ - return false; -} - -bool Source::getEffect(const char *, std::map &) -{ - return false; -} - -bool Source::getActiveEffects(std::vector &) const -{ - return false; -} - -} // null -} // audio -} // love diff --git a/love/src/jni/love/src/modules/audio/null/Source.h b/love/src/jni/love/src/modules/audio/null/Source.h deleted file mode 100644 index 002f2648..00000000 --- a/love/src/jni/love/src/modules/audio/null/Source.h +++ /dev/null @@ -1,118 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_AUDIO_NULL_SOURCE_H -#define LOVE_AUDIO_NULL_SOURCE_H - -// LOVE -#include "common/Object.h" -#include "audio/Source.h" -#include "audio/Filter.h" - -namespace love -{ -namespace audio -{ -namespace null -{ - -class Source : public love::audio::Source -{ -public: - Source(); - virtual ~Source(); - - virtual love::audio::Source *clone(); - virtual bool play(); - virtual void stop(); - virtual void pause(); - virtual bool isPlaying() const; - virtual bool isFinished() const; - virtual bool update(); - virtual void setPitch(float pitch); - virtual float getPitch() const; - virtual void setVolume(float volume); - virtual float getVolume() const; - virtual void seek(float offset, Unit unit); - virtual float tell(Unit unit); - virtual double getDuration(Unit unit); - virtual void setPosition(float *v); - virtual void getPosition(float *v) const; - virtual void setVelocity(float *v); - virtual void getVelocity(float *v) const; - virtual void setDirection(float *v); - virtual void getDirection(float *v) const; - virtual void setCone(float innerAngle, float outerAngle, float outerVolume, float outerHighGain); - virtual void getCone(float &innerAngle, float &outerAngle, float &outerVolume, float &outerHighGain) const; - virtual void setRelative(bool enable); - virtual bool isRelative() const; - void setLooping(bool looping); - bool isLooping() const; - virtual void setMinVolume(float volume); - virtual float getMinVolume() const; - virtual void setMaxVolume(float volume); - virtual float getMaxVolume() const; - virtual void setReferenceDistance(float distance); - virtual float getReferenceDistance() const; - virtual void setRolloffFactor(float factor); - virtual float getRolloffFactor() const; - virtual void setMaxDistance(float distance); - virtual float getMaxDistance() const; - virtual void setAirAbsorptionFactor(float factor); - virtual float getAirAbsorptionFactor() const; - virtual int getChannelCount() const; - - virtual int getFreeBufferCount() const; - virtual bool queue(void *data, size_t length, int dataSampleRate, int dataBitDepth, int dataChannels); - - virtual bool setFilter(const std::map ¶ms); - virtual bool setFilter(); - virtual bool getFilter(std::map ¶ms); - - virtual bool setEffect(const char *effect); - virtual bool setEffect(const char *effect, const std::map ¶ms); - virtual bool unsetEffect(const char *effect); - virtual bool getEffect(const char *effect, std::map ¶ms); - virtual bool getActiveEffects(std::vector &list) const; - -private: - - float pitch; - float volume; - float coneInnerAngle; - float coneOuterAngle; - float coneOuterVolume; - float coneOuterHighGain; - bool relative; - bool looping; - float minVolume; - float maxVolume; - float referenceDistance; - float rolloffFactor; - float maxDistance; - float absorptionFactor; - -}; // Source - -} // null -} // audio -} // love - -#endif // LOVE_AUDIO_NULL_SOURCE_H diff --git a/love/src/jni/love/src/modules/audio/openal/Audio.cpp b/love/src/jni/love/src/modules/audio/openal/Audio.cpp deleted file mode 100644 index 13d0afa9..00000000 --- a/love/src/jni/love/src/modules/audio/openal/Audio.cpp +++ /dev/null @@ -1,692 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "Audio.h" -#include "common/delay.h" -#include "RecordingDevice.h" -#include "sound/Decoder.h" - -#include -#include - -namespace love -{ -namespace audio -{ -namespace openal -{ - -Audio::PoolThread::PoolThread(Pool *pool) - : pool(pool) - , finish(false) -{ - threadName = "AudioPool"; -} - -Audio::PoolThread::~PoolThread() -{ -} - - -void Audio::PoolThread::threadFunction() -{ - while (true) - { - { - thread::Lock lock(mutex); - if (finish) - { - return; - } - } - - pool->update(); - sleep(5); - } -} - -void Audio::PoolThread::setFinish() -{ - thread::Lock lock(mutex); - finish = true; -} - -ALenum Audio::getFormat(int bitDepth, int channels) -{ - if (bitDepth != 8 && bitDepth != 16) - return AL_NONE; - - if (channels == 1) - return bitDepth == 8 ? AL_FORMAT_MONO8 : AL_FORMAT_MONO16; - else if (channels == 2) - return bitDepth == 8 ? AL_FORMAT_STEREO8 : AL_FORMAT_STEREO16; -#ifdef AL_EXT_MCFORMATS - else if (alIsExtensionPresent("AL_EXT_MCFORMATS")) - { - if (channels == 6) - return bitDepth == 8 ? AL_FORMAT_51CHN8 : AL_FORMAT_51CHN16; - else if (channels == 8) - return bitDepth == 8 ? AL_FORMAT_71CHN8 : AL_FORMAT_71CHN16; - } -#endif - return AL_NONE; -} - -Audio::Audio() - : device(nullptr) - , context(nullptr) - , pool(nullptr) - , poolThread(nullptr) - , distanceModel(DISTANCE_INVERSE_CLAMPED) -{ -#if defined(LOVE_LINUX) - // Temporarly block signals, as the thread inherits this mask - love::thread::disableSignals(); -#endif - - // Passing null for default device. - device = alcOpenDevice(nullptr); - - if (device == nullptr) - throw love::Exception("Could not open device."); - -#ifdef ALC_EXT_EFX - ALint attribs[4] = { ALC_MAX_AUXILIARY_SENDS, MAX_SOURCE_EFFECTS, 0, 0 }; -#else - ALint *attribs = nullptr; -#endif - - context = alcCreateContext(device, attribs); - - if (context == nullptr) - throw love::Exception("Could not create context."); - - if (!alcMakeContextCurrent(context) || alcGetError(device) != ALC_NO_ERROR) - throw love::Exception("Could not make context current."); - -#if defined(LOVE_LINUX) - love::thread::reenableSignals(); -#endif - -#ifdef ALC_EXT_EFX - initializeEFX(); - - alcGetIntegerv(device, ALC_MAX_AUXILIARY_SENDS, 1, &MAX_SOURCE_EFFECTS); - - alGetError(); - if (alGenAuxiliaryEffectSlots) - { - for (int i = 0; i < MAX_SCENE_EFFECTS; i++) - { - ALuint slot; - alGenAuxiliaryEffectSlots(1, &slot); - if (alGetError() == AL_NO_ERROR) - slotlist.push(slot); - else - { - MAX_SCENE_EFFECTS = i; - break; - } - } - } - else - MAX_SCENE_EFFECTS = MAX_SOURCE_EFFECTS = 0; -#else - MAX_SCENE_EFFECTS = MAX_SOURCE_EFFECTS = 0; -#endif - - try - { - pool = new Pool(); - } - catch (love::Exception &) - { - for (auto c : capture) - delete c; - -#ifdef ALC_EXT_EFX - if (alDeleteAuxiliaryEffectSlots) - { - while (!slotlist.empty()) - { - alDeleteAuxiliaryEffectSlots(1, &slotlist.top()); - slotlist.pop(); - } - } -#endif - - alcMakeContextCurrent(nullptr); - alcDestroyContext(context); - alcCloseDevice(device); - throw; - } - - poolThread = new PoolThread(pool); - poolThread->start(); -} - -Audio::~Audio() -{ - poolThread->setFinish(); - poolThread->wait(); - - delete poolThread; - delete pool; - - for (auto c : capture) - delete c; - -#ifdef ALC_EXT_EFX - for (auto e : effectmap) - { - delete e.second.effect; - slotlist.push(e.second.slot); - } - - if (alDeleteAuxiliaryEffectSlots) - { - while (!slotlist.empty()) - { - alDeleteAuxiliaryEffectSlots(1, &slotlist.top()); - slotlist.pop(); - } - } -#endif - alcMakeContextCurrent(nullptr); - alcDestroyContext(context); - alcCloseDevice(device); -} - -const char *Audio::getName() const -{ - return "love.audio.openal"; -} - -love::audio::Source *Audio::newSource(love::sound::Decoder *decoder) -{ - return new Source(pool, decoder); -} - -love::audio::Source *Audio::newSource(love::sound::SoundData *soundData) -{ - return new Source(pool, soundData); -} - -love::audio::Source *Audio::newSource(int sampleRate, int bitDepth, int channels, int buffers) -{ - return new Source(pool, sampleRate, bitDepth, channels, buffers); -} - -int Audio::getActiveSourceCount() const -{ - return pool->getActiveSourceCount(); -} - -int Audio::getMaxSources() const -{ - return pool->getMaxSources(); -} - -bool Audio::play(love::audio::Source *source) -{ - return source->play(); -} - -bool Audio::play(const std::vector &sources) -{ - return Source::play(sources); -} - -void Audio::stop(love::audio::Source *source) -{ - source->stop(); -} - -void Audio::stop(const std::vector &sources) -{ - return Source::stop(sources); -} - -void Audio::stop() -{ - return Source::stop(pool); -} - -void Audio::pause(love::audio::Source *source) -{ - source->pause(); -} - -void Audio::pause(const std::vector &sources) -{ - return Source::pause(sources); -} - -std::vector Audio::pause() -{ - return Source::pause(pool); -} - -void Audio::setVolume(float volume) -{ - alListenerf(AL_GAIN, volume); -} - -float Audio::getVolume() const -{ - ALfloat volume; - alGetListenerf(AL_GAIN, &volume); - return volume; -} - -void Audio::getPosition(float *v) const -{ - alGetListenerfv(AL_POSITION, v); -} - -void Audio::setPosition(float *v) -{ - alListenerfv(AL_POSITION, v); -} - -void Audio::getOrientation(float *v) const -{ - alGetListenerfv(AL_ORIENTATION, v); -} - -void Audio::setOrientation(float *v) -{ - alListenerfv(AL_ORIENTATION, v); -} - -void Audio::getVelocity(float *v) const -{ - alGetListenerfv(AL_VELOCITY, v); -} - -void Audio::setVelocity(float *v) -{ - alListenerfv(AL_VELOCITY, v); -} - -void Audio::setDopplerScale(float scale) -{ - if (scale >= 0.0f) - alDopplerFactor(scale); -} - -float Audio::getDopplerScale() const -{ - return alGetFloat(AL_DOPPLER_FACTOR); -} -/* -void Audio::setMeter(float scale) -{ - if (scale >= 0.0f) - { - metersPerUnit = scale; -#ifdef ALC_EXT_EFX - alListenerf(AL_METERS_PER_UNIT, scale); -#endif - } -} - -float Audio::getMeter() const -{ - return metersPerUnit; -} -*/ -Audio::DistanceModel Audio::getDistanceModel() const -{ - return distanceModel; -} - -void Audio::setDistanceModel(DistanceModel distanceModel) -{ - this->distanceModel = distanceModel; - - switch (distanceModel) - { - case DISTANCE_NONE: - alDistanceModel(AL_NONE); - break; - - case DISTANCE_INVERSE: - alDistanceModel(AL_INVERSE_DISTANCE); - break; - - case DISTANCE_INVERSE_CLAMPED: - alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED); - break; - - case DISTANCE_LINEAR: - alDistanceModel(AL_LINEAR_DISTANCE); - break; - - case DISTANCE_LINEAR_CLAMPED: - alDistanceModel(AL_LINEAR_DISTANCE_CLAMPED); - break; - - case DISTANCE_EXPONENT: - alDistanceModel(AL_EXPONENT_DISTANCE); - break; - - case DISTANCE_EXPONENT_CLAMPED: - alDistanceModel(AL_EXPONENT_DISTANCE_CLAMPED); - break; - - default: - break; - } -} - -const std::vector &Audio::getRecordingDevices() -{ - std::vector devnames; - std::vector devices; - - std::string defaultname(alcGetString(NULL, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER)); - - //no device name obtained from AL, fallback to reading from device - if (defaultname.length() == 0) - { - //use some safe basic parameters - 8 kHz, 8 bits, 1 channel - ALCdevice *defaultdevice = alcCaptureOpenDevice(NULL, 8000, AL_FORMAT_MONO8, 1024); - if (alGetError() == AL_NO_ERROR) - { - defaultname = alcGetString(defaultdevice, ALC_CAPTURE_DEVICE_SPECIFIER); - alcCaptureCloseDevice(defaultdevice); - } - else - { - //failed to open default recording device - bail, return empty list - capture.clear(); - return capture; - } - } - - devnames.reserve(capture.size()); - devnames.push_back(defaultname); - - //find devices name list - const ALCchar *devstr = alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER); - size_t offset = 0; - while (true) - { - if (devstr[offset] == '\0') - break; - std::string str((ALCchar*)&devstr[offset]); - if (str != defaultname) - devnames.push_back(str); - offset += str.length() + 1; - } - - devices.reserve(devnames.size()); - //build ordered list of devices - for (int i = 0; i < (int) devnames.size(); i++) - { - devices.push_back(nullptr); - auto d = devices.end() - 1; - - for (auto c : capture) - if (devnames[i] == c->getName()) - *d = c; - - if (*d == nullptr) - *d = new RecordingDevice(devnames[i].c_str()); - else - (*d)->retain(); - } - - for (auto c : capture) - c->release(); - capture.clear(); - capture.reserve(devices.size()); - - //this needs to be executed in specific order - for (unsigned int i = 0; i < devnames.size(); i++) - capture.push_back(devices[i]); - - return capture; -} - -bool Audio::setEffect(const char *name, std::map ¶ms) -{ - Effect *effect; - ALuint slot; - - auto iter = effectmap.find(name); - if (iter == effectmap.end()) - { - //new effect needed but no more slots - if (effectmap.size() >= (unsigned int)MAX_SCENE_EFFECTS) - return false; - - effect = new Effect(); - slot = slotlist.top(); - slotlist.pop(); - - effectmap[name] = {effect, slot}; - } - else - { - effect = iter->second.effect; - slot = iter->second.slot; - } - - bool result = effect->setParams(params); - -#ifdef ALC_EXT_EFX - if (alAuxiliaryEffectSloti) - { - if (result) - { - auto iter = params.find(Effect::EFFECT_VOLUME); - if (iter != params.end()) - alAuxiliaryEffectSlotf(slot, AL_EFFECTSLOT_GAIN, iter->second); - alAuxiliaryEffectSloti(slot, AL_EFFECTSLOT_EFFECT, effect->getEffect()); - } - else - alAuxiliaryEffectSloti(slot, AL_EFFECTSLOT_EFFECT, AL_EFFECT_NULL); - alGetError(); - } -#endif - - return result; -} - -bool Audio::unsetEffect(const char *name) -{ - auto iter = effectmap.find(name); - if (iter == effectmap.end()) - return false; - - Effect *effect = iter->second.effect; - ALuint slot = iter->second.slot; - -#ifdef ALC_EXT_EFX - if (alAuxiliaryEffectSloti) - alAuxiliaryEffectSloti(slot, AL_EFFECTSLOT_EFFECT, AL_EFFECT_NULL); -#endif - - delete effect; - effectmap.erase(iter); - slotlist.push(slot); - return true; -} - -bool Audio::getEffect(const char *name, std::map ¶ms) -{ - auto iter = effectmap.find(name); - if (iter == effectmap.end()) - return false; - - params = iter->second.effect->getParams(); - - return true; -} - -bool Audio::getActiveEffects(std::vector &list) const -{ - if (effectmap.empty()) - return false; - - list.reserve(effectmap.size()); - for (auto i : effectmap) - list.push_back(i.first); - - return true; -} - -int Audio::getMaxSceneEffects() const -{ - return MAX_SCENE_EFFECTS; -} - -int Audio::getMaxSourceEffects() const -{ - return MAX_SOURCE_EFFECTS; -} - -bool Audio::isEFXsupported() const -{ -#ifdef ALC_EXT_EFX - return (alGenEffects != nullptr); -#else - return false; -#endif -} - -bool Audio::getEffectID(const char *name, ALuint &id) -{ - auto iter = effectmap.find(name); - if (iter == effectmap.end()) - return false; - - id = iter->second.slot; - return true; -} - -#ifdef ALC_EXT_EFX -LPALGENEFFECTS alGenEffects = nullptr; -LPALDELETEEFFECTS alDeleteEffects = nullptr; -LPALISEFFECT alIsEffect = nullptr; -LPALEFFECTI alEffecti = nullptr; -LPALEFFECTIV alEffectiv = nullptr; -LPALEFFECTF alEffectf = nullptr; -LPALEFFECTFV alEffectfv = nullptr; -LPALGETEFFECTI alGetEffecti = nullptr; -LPALGETEFFECTIV alGetEffectiv = nullptr; -LPALGETEFFECTF alGetEffectf = nullptr; -LPALGETEFFECTFV alGetEffectfv = nullptr; -LPALGENFILTERS alGenFilters = nullptr; -LPALDELETEFILTERS alDeleteFilters = nullptr; -LPALISFILTER alIsFilter = nullptr; -LPALFILTERI alFilteri = nullptr; -LPALFILTERIV alFilteriv = nullptr; -LPALFILTERF alFilterf = nullptr; -LPALFILTERFV alFilterfv = nullptr; -LPALGETFILTERI alGetFilteri = nullptr; -LPALGETFILTERIV alGetFilteriv = nullptr; -LPALGETFILTERF alGetFilterf = nullptr; -LPALGETFILTERFV alGetFilterfv = nullptr; -LPALGENAUXILIARYEFFECTSLOTS alGenAuxiliaryEffectSlots = nullptr; -LPALDELETEAUXILIARYEFFECTSLOTS alDeleteAuxiliaryEffectSlots = nullptr; -LPALISAUXILIARYEFFECTSLOT alIsAuxiliaryEffectSlot = nullptr; -LPALAUXILIARYEFFECTSLOTI alAuxiliaryEffectSloti = nullptr; -LPALAUXILIARYEFFECTSLOTIV alAuxiliaryEffectSlotiv = nullptr; -LPALAUXILIARYEFFECTSLOTF alAuxiliaryEffectSlotf = nullptr; -LPALAUXILIARYEFFECTSLOTFV alAuxiliaryEffectSlotfv = nullptr; -LPALGETAUXILIARYEFFECTSLOTI alGetAuxiliaryEffectSloti = nullptr; -LPALGETAUXILIARYEFFECTSLOTIV alGetAuxiliaryEffectSlotiv = nullptr; -LPALGETAUXILIARYEFFECTSLOTF alGetAuxiliaryEffectSlotf = nullptr; -LPALGETAUXILIARYEFFECTSLOTFV alGetAuxiliaryEffectSlotfv = nullptr; -#endif - -void Audio::initializeEFX() -{ -#ifdef ALC_EXT_EFX - if (alcIsExtensionPresent(device, "ALC_EXT_EFX") == AL_FALSE) - return; - - alGenEffects = (LPALGENEFFECTS)alGetProcAddress("alGenEffects"); - alDeleteEffects = (LPALDELETEEFFECTS)alGetProcAddress("alDeleteEffects"); - alIsEffect = (LPALISEFFECT)alGetProcAddress("alIsEffect"); - alEffecti = (LPALEFFECTI)alGetProcAddress("alEffecti"); - alEffectiv = (LPALEFFECTIV)alGetProcAddress("alEffectiv"); - alEffectf = (LPALEFFECTF)alGetProcAddress("alEffectf"); - alEffectfv = (LPALEFFECTFV)alGetProcAddress("alEffectfv"); - alGetEffecti = (LPALGETEFFECTI)alGetProcAddress("alGetEffecti"); - alGetEffectiv = (LPALGETEFFECTIV)alGetProcAddress("alGetEffectiv"); - alGetEffectf = (LPALGETEFFECTF)alGetProcAddress("alGetEffectf"); - alGetEffectfv = (LPALGETEFFECTFV)alGetProcAddress("alGetEffectfv"); - alGenFilters = (LPALGENFILTERS)alGetProcAddress("alGenFilters"); - alDeleteFilters = (LPALDELETEFILTERS)alGetProcAddress("alDeleteFilters"); - alIsFilter = (LPALISFILTER)alGetProcAddress("alIsFilter"); - alFilteri = (LPALFILTERI)alGetProcAddress("alFilteri"); - alFilteriv = (LPALFILTERIV)alGetProcAddress("alFilteriv"); - alFilterf = (LPALFILTERF)alGetProcAddress("alFilterf"); - alFilterfv = (LPALFILTERFV)alGetProcAddress("alFilterfv"); - alGetFilteri = (LPALGETFILTERI)alGetProcAddress("alGetFilteri"); - alGetFilteriv = (LPALGETFILTERIV)alGetProcAddress("alGetFilteriv"); - alGetFilterf = (LPALGETFILTERF)alGetProcAddress("alGetFilterf"); - alGetFilterfv = (LPALGETFILTERFV)alGetProcAddress("alGetFilterfv"); - alGenAuxiliaryEffectSlots = (LPALGENAUXILIARYEFFECTSLOTS)alGetProcAddress("alGenAuxiliaryEffectSlots"); - alDeleteAuxiliaryEffectSlots = (LPALDELETEAUXILIARYEFFECTSLOTS)alGetProcAddress("alDeleteAuxiliaryEffectSlots"); - alIsAuxiliaryEffectSlot = (LPALISAUXILIARYEFFECTSLOT)alGetProcAddress("alIsAuxiliaryEffectSlot"); - alAuxiliaryEffectSloti = (LPALAUXILIARYEFFECTSLOTI)alGetProcAddress("alAuxiliaryEffectSloti"); - alAuxiliaryEffectSlotiv = (LPALAUXILIARYEFFECTSLOTIV)alGetProcAddress("alAuxiliaryEffectSlotiv"); - alAuxiliaryEffectSlotf = (LPALAUXILIARYEFFECTSLOTF)alGetProcAddress("alAuxiliaryEffectSlotf"); - alAuxiliaryEffectSlotfv = (LPALAUXILIARYEFFECTSLOTFV)alGetProcAddress("alAuxiliaryEffectSlotfv"); - alGetAuxiliaryEffectSloti = (LPALGETAUXILIARYEFFECTSLOTI)alGetProcAddress("alGetAuxiliaryEffectSloti"); - alGetAuxiliaryEffectSlotiv = (LPALGETAUXILIARYEFFECTSLOTIV)alGetProcAddress("alGetAuxiliaryEffectSlotiv"); - alGetAuxiliaryEffectSlotf = (LPALGETAUXILIARYEFFECTSLOTF)alGetProcAddress("alGetAuxiliaryEffectSlotf"); - alGetAuxiliaryEffectSlotfv = (LPALGETAUXILIARYEFFECTSLOTFV)alGetProcAddress("alGetAuxiliaryEffectSlotfv"); - - //failed to initialize functions, revert to nullptr - if (!alGenEffects || !alDeleteEffects || !alIsEffect || - !alGenFilters || !alDeleteFilters || !alIsFilter || - !alGenAuxiliaryEffectSlots || !alDeleteAuxiliaryEffectSlots || !alIsAuxiliaryEffectSlot || - !alEffecti || !alEffectiv || !alEffectf || !alEffectfv || - !alGetEffecti || !alGetEffectiv || !alGetEffectf || !alGetEffectfv || - !alFilteri || !alFilteriv || !alFilterf || !alFilterfv || - !alGetFilteri || !alGetFilteriv || !alGetFilterf || !alGetFilterfv || - !alAuxiliaryEffectSloti || !alAuxiliaryEffectSlotiv || !alAuxiliaryEffectSlotf || !alAuxiliaryEffectSlotfv || - !alGetAuxiliaryEffectSloti || !alGetAuxiliaryEffectSlotiv || !alGetAuxiliaryEffectSlotf || !alGetAuxiliaryEffectSlotfv) - { - alGenEffects = nullptr; alDeleteEffects = nullptr; alIsEffect = nullptr; - alEffecti = nullptr; alEffectiv = nullptr; alEffectf = nullptr; alEffectfv = nullptr; - alGetEffecti = nullptr; alGetEffectiv = nullptr; alGetEffectf = nullptr; alGetEffectfv = nullptr; - alGenFilters = nullptr; alDeleteFilters = nullptr; alIsFilter = nullptr; - alFilteri = nullptr; alFilteriv = nullptr; alFilterf = nullptr; alFilterfv = nullptr; - alGetFilteri = nullptr; alGetFilteriv = nullptr; alGetFilterf = nullptr; alGetFilterfv = nullptr; - alGenAuxiliaryEffectSlots = nullptr; alDeleteAuxiliaryEffectSlots = nullptr; alIsAuxiliaryEffectSlot = nullptr; - alAuxiliaryEffectSloti = nullptr; alAuxiliaryEffectSlotiv = nullptr; - alAuxiliaryEffectSlotf = nullptr; alAuxiliaryEffectSlotfv = nullptr; - alGetAuxiliaryEffectSloti = nullptr; alGetAuxiliaryEffectSlotiv = nullptr; - alGetAuxiliaryEffectSlotf = nullptr; alGetAuxiliaryEffectSlotfv = nullptr; - } - -#endif -} - -} // openal -} // audio -} // love diff --git a/love/src/jni/love/src/modules/audio/openal/Audio.h b/love/src/jni/love/src/modules/audio/openal/Audio.h deleted file mode 100644 index aa3918b0..00000000 --- a/love/src/jni/love/src/modules/audio/openal/Audio.h +++ /dev/null @@ -1,224 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_AUDIO_OPENAL_AUDIO_H -#define LOVE_AUDIO_OPENAL_AUDIO_H - -// STD -#include -#include -#include -#include -#include - -// LOVE -#include "audio/Audio.h" -#include "audio/RecordingDevice.h" -#include "audio/Filter.h" -#include "common/config.h" -#include "sound/SoundData.h" - -#include "Source.h" -#include "Effect.h" -#include "Pool.h" -#include "thread/threads.h" - -// OpenAL -#ifdef LOVE_APPLE_USE_FRAMEWORKS // Frameworks have different include paths. -#ifdef LOVE_IOS -#include -#include -#else -#include -#include -#endif -#else -#include -#include -#include -#endif - -namespace love -{ -namespace audio -{ -namespace openal -{ - -class Audio : public love::audio::Audio -{ -public: - - Audio(); - ~Audio(); - - /** - * Gets the OpenAL format identifier based on number of - * channels and bits. - * @param channels. - * @param bitDepth Either 8-bit samples, or 16-bit samples. - * @return One of AL_FORMAT_*, or AL_NONE if unsupported format. - **/ - static ALenum getFormat(int bitDepth, int channels); - - // Implements Module. - const char *getName() const; - - // Implements Audio. - love::audio::Source *newSource(love::sound::Decoder *decoder); - love::audio::Source *newSource(love::sound::SoundData *soundData); - love::audio::Source *newSource(int sampleRate, int bitDepth, int channels, int buffers); - int getActiveSourceCount() const; - int getMaxSources() const; - bool play(love::audio::Source *source); - bool play(const std::vector &sources); - void stop(love::audio::Source *source); - void stop(const std::vector &sources); - void stop(); - void pause(love::audio::Source *source); - void pause(const std::vector &sources); - std::vector pause(); - void setVolume(float volume); - float getVolume() const; - - void getPosition(float *v) const; - void setPosition(float *v); - void getOrientation(float *v) const; - void setOrientation(float *v); - void getVelocity(float *v) const; - void setVelocity(float *v); - - void setDopplerScale(float scale); - float getDopplerScale() const; - //void setMeter(float scale); - //float getMeter() const; - - const std::vector &getRecordingDevices(); - - DistanceModel getDistanceModel() const; - void setDistanceModel(DistanceModel distanceModel); - - bool setEffect(const char *name, std::map ¶ms); - bool unsetEffect(const char *name); - bool getEffect(const char *name, std::map ¶ms); - bool getActiveEffects(std::vector &list) const; - int getMaxSceneEffects() const; - int getMaxSourceEffects() const; - bool isEFXsupported() const; - - bool getEffectID(const char *name, ALuint &id); - -private: - void initializeEFX(); - // The OpenAL device. - ALCdevice *device; - - // The OpenAL capture devices. - std::vector capture; - - // The OpenAL context. - ALCcontext *context; - - // The OpenAL effects - struct EffectMapStorage - { - Effect *effect; - ALuint slot; - }; - std::map effectmap; - std::stack slotlist; - int MAX_SCENE_EFFECTS = 64; - int MAX_SOURCE_EFFECTS = 64; - - // The Pool. - Pool *pool; - - class PoolThread: public thread::Threadable - { - protected: - Pool *pool; - - // Set this to true when the thread should finish. - // Main thread will write to this value, and PoolThread - // will read from it. - volatile bool finish; - - // finish lock - love::thread::MutexRef mutex; - - public: - PoolThread(Pool *pool); - virtual ~PoolThread(); - void setFinish(); - void threadFunction(); - }; - - PoolThread *poolThread; - - DistanceModel distanceModel; - //float metersPerUnit = 1.0; -}; // Audio - -#ifdef ALC_EXT_EFX - // Effect objects -extern LPALGENEFFECTS alGenEffects; -extern LPALDELETEEFFECTS alDeleteEffects; -extern LPALISEFFECT alIsEffect; -extern LPALEFFECTI alEffecti; -extern LPALEFFECTIV alEffectiv; -extern LPALEFFECTF alEffectf; -extern LPALEFFECTFV alEffectfv; -extern LPALGETEFFECTI alGetEffecti; -extern LPALGETEFFECTIV alGetEffectiv; -extern LPALGETEFFECTF alGetEffectf; -extern LPALGETEFFECTFV alGetEffectfv; - -//Filter objects -extern LPALGENFILTERS alGenFilters; -extern LPALDELETEFILTERS alDeleteFilters; -extern LPALISFILTER alIsFilter; -extern LPALFILTERI alFilteri; -extern LPALFILTERIV alFilteriv; -extern LPALFILTERF alFilterf; -extern LPALFILTERFV alFilterfv; -extern LPALGETFILTERI alGetFilteri; -extern LPALGETFILTERIV alGetFilteriv; -extern LPALGETFILTERF alGetFilterf; -extern LPALGETFILTERFV alGetFilterfv; - -// Auxiliary slot object -extern LPALGENAUXILIARYEFFECTSLOTS alGenAuxiliaryEffectSlots; -extern LPALDELETEAUXILIARYEFFECTSLOTS alDeleteAuxiliaryEffectSlots; -extern LPALISAUXILIARYEFFECTSLOT alIsAuxiliaryEffectSlot; -extern LPALAUXILIARYEFFECTSLOTI alAuxiliaryEffectSloti; -extern LPALAUXILIARYEFFECTSLOTIV alAuxiliaryEffectSlotiv; -extern LPALAUXILIARYEFFECTSLOTF alAuxiliaryEffectSlotf; -extern LPALAUXILIARYEFFECTSLOTFV alAuxiliaryEffectSlotfv; -extern LPALGETAUXILIARYEFFECTSLOTI alGetAuxiliaryEffectSloti; -extern LPALGETAUXILIARYEFFECTSLOTIV alGetAuxiliaryEffectSlotiv; -extern LPALGETAUXILIARYEFFECTSLOTF alGetAuxiliaryEffectSlotf; -extern LPALGETAUXILIARYEFFECTSLOTFV alGetAuxiliaryEffectSlotfv; -#endif - -} // openal -} // audio -} // love - -#endif // LOVE_AUDIO_OPENAL_AUDIO_H diff --git a/love/src/jni/love/src/modules/audio/openal/Effect.cpp b/love/src/jni/love/src/modules/audio/openal/Effect.cpp deleted file mode 100644 index 2a8bccb3..00000000 --- a/love/src/jni/love/src/modules/audio/openal/Effect.cpp +++ /dev/null @@ -1,417 +0,0 @@ -/** - * Copyright (c) 2006-2016 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "Effect.h" -#include "common/Exception.h" - -#include -#include - -namespace love -{ -namespace audio -{ -namespace openal -{ - -//base class -Effect::Effect() -{ - generateEffect(); -} - -Effect::Effect(const Effect &s) - : Effect() -{ - setParams(s.getParams()); -} - -Effect::~Effect() -{ - deleteEffect(); -} - -Effect *Effect::clone() -{ - return new Effect(*this); -} - -bool Effect::generateEffect() -{ -#ifdef ALC_EXT_EFX - if (!alGenEffects) - return false; - - if (effect != AL_EFFECT_NULL) - return true; - - alGenEffects(1, &effect); - if (alGetError() != AL_NO_ERROR) - throw love::Exception("Failed to create sound Effect."); - - return true; -#else - return false; -#endif -} - -void Effect::deleteEffect() -{ -#ifdef ALC_EXT_EFX - if (effect != AL_EFFECT_NULL) - alDeleteEffects(1, &effect); -#endif - effect = AL_EFFECT_NULL; -} - -ALuint Effect::getEffect() const -{ - return effect; -} - -bool Effect::setParams(const std::map ¶ms) -{ - this->params = params; - type = (Type)(int) this->params[EFFECT_TYPE]; - - if (!generateEffect()) - return false; - -#ifdef ALC_EXT_EFX - //parameter table without EFFECT_TYPE entry is illegal - switch (type) - { - case TYPE_REVERB: - alEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_REVERB); - break; - case TYPE_CHORUS: - alEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_CHORUS); - break; - case TYPE_DISTORTION: - alEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_DISTORTION); - break; - case TYPE_ECHO: - alEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_ECHO); - break; - case TYPE_FLANGER: - alEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_FLANGER); - break; -/* - case TYPE_FREQSHIFTER: - alEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_FREQUENCY_SHIFTER); - break; - case TYPE_MORPHER: - alEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_VOCAL_MORPHER); - break; - case TYPE_PITCHSHIFTER: - alEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_PITCH_SHIFTER); - break; -*/ - case TYPE_MODULATOR: - alEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_RING_MODULATOR); - break; -/* - case TYPE_AUTOWAH: - alEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_AUTOWAH); - break; -*/ - case TYPE_COMPRESSOR: - alEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_COMPRESSOR); - break; - case TYPE_EQUALIZER: - alEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_EQUALIZER); - break; - case TYPE_BASIC: - case TYPE_MAX_ENUM: - break; - } - - //failed to make effect specific type - not supported etc. - if (alGetError() != AL_NO_ERROR) - { - deleteEffect(); - return false; - } - -#define clampf(v,l,h) fmax(fmin((v),(h)),(l)) -#define PARAMSTR(i,e,v) effect,AL_##e##_##v,clampf(getValue(i,AL_##e##_DEFAULT_##v),AL_##e##_MIN_##v,AL_##e##_MAX_##v) - switch (type) - { - case TYPE_REVERB: - { - alEffectf(PARAMSTR(REVERB_GAIN,REVERB,GAIN)); - alEffectf(PARAMSTR(REVERB_HFGAIN,REVERB,GAINHF)); - alEffectf(PARAMSTR(REVERB_DENSITY,REVERB,DENSITY)); - alEffectf(PARAMSTR(REVERB_DIFFUSION,REVERB,DIFFUSION)); - alEffectf(PARAMSTR(REVERB_DECAY,REVERB,DECAY_TIME)); - alEffectf(PARAMSTR(REVERB_HFDECAY,REVERB,DECAY_HFRATIO)); - alEffectf(PARAMSTR(REVERB_EARLYGAIN,REVERB,REFLECTIONS_GAIN)); - alEffectf(PARAMSTR(REVERB_EARLYDELAY,REVERB,REFLECTIONS_DELAY)); - alEffectf(PARAMSTR(REVERB_LATEGAIN,REVERB,LATE_REVERB_GAIN)); - alEffectf(PARAMSTR(REVERB_LATEDELAY,REVERB,LATE_REVERB_DELAY));; - alEffectf(PARAMSTR(REVERB_ROLLOFF,REVERB,ROOM_ROLLOFF_FACTOR)); - alEffectf(PARAMSTR(REVERB_AIRHFGAIN,REVERB,AIR_ABSORPTION_GAINHF)); - alEffecti(effect, AL_REVERB_DECAY_HFLIMIT, getValue(REVERB_HFLIMITER, 0)); - break; - } - case TYPE_CHORUS: - { - Waveform wave = static_cast(getValue(CHORUS_WAVEFORM, static_cast(WAVE_MAX_ENUM))); - if (wave == WAVE_SINE) - alEffecti(effect, AL_CHORUS_WAVEFORM, AL_CHORUS_WAVEFORM_SINUSOID); - else if (wave == WAVE_TRIANGLE) - alEffecti(effect, AL_CHORUS_WAVEFORM, AL_CHORUS_WAVEFORM_TRIANGLE); - else - alEffecti(effect, AL_CHORUS_WAVEFORM, AL_CHORUS_DEFAULT_WAVEFORM); - - alEffecti(PARAMSTR(CHORUS_PHASE,CHORUS,PHASE)); - alEffectf(PARAMSTR(CHORUS_RATE,CHORUS,RATE)); - alEffectf(PARAMSTR(CHORUS_DEPTH,CHORUS,DEPTH)); - alEffectf(PARAMSTR(CHORUS_FEEDBACK,CHORUS,FEEDBACK)); - alEffectf(PARAMSTR(CHORUS_DELAY,CHORUS,DELAY)); - break; - } - case TYPE_DISTORTION: - alEffectf(PARAMSTR(DISTORTION_GAIN,DISTORTION,GAIN)); - alEffectf(PARAMSTR(DISTORTION_EDGE,DISTORTION,EDGE)); - alEffectf(PARAMSTR(DISTORTION_LOWCUT,DISTORTION,LOWPASS_CUTOFF)); - alEffectf(PARAMSTR(DISTORTION_EQCENTER,DISTORTION,EQCENTER)); - alEffectf(PARAMSTR(DISTORTION_EQBAND,DISTORTION,EQBANDWIDTH)); - break; - - case TYPE_ECHO: - alEffectf(PARAMSTR(ECHO_DELAY,ECHO,DELAY)); - alEffectf(PARAMSTR(ECHO_LRDELAY,ECHO,LRDELAY)); - alEffectf(PARAMSTR(ECHO_DAMPING,ECHO,DAMPING)); - alEffectf(PARAMSTR(ECHO_FEEDBACK,ECHO,FEEDBACK)); - alEffectf(PARAMSTR(ECHO_SPREAD,ECHO,SPREAD)); - break; - - case TYPE_FLANGER: - { - Waveform wave = static_cast(getValue(FLANGER_WAVEFORM, static_cast(WAVE_MAX_ENUM))); - if (wave == WAVE_SINE) - alEffecti(effect, AL_FLANGER_WAVEFORM, AL_FLANGER_WAVEFORM_SINUSOID); - else if (wave == WAVE_TRIANGLE) - alEffecti(effect, AL_FLANGER_WAVEFORM, AL_FLANGER_WAVEFORM_TRIANGLE); - else - alEffecti(effect, AL_FLANGER_WAVEFORM, AL_FLANGER_DEFAULT_WAVEFORM); - - alEffecti(PARAMSTR(FLANGER_PHASE,FLANGER,PHASE)); - alEffectf(PARAMSTR(FLANGER_RATE,FLANGER,RATE)); - alEffectf(PARAMSTR(FLANGER_DEPTH,FLANGER,DEPTH)); - alEffectf(PARAMSTR(FLANGER_FEEDBACK,FLANGER,FEEDBACK)); - alEffectf(PARAMSTR(FLANGER_DELAY,FLANGER,DELAY)); - break; - } -/* - case TYPE_FREQSHIFTER: - { - alEffectf(PARAMSTR(FREQSHIFTER_FREQ,FREQUENCY_SHIFTER,FREQUENCY)); - - Direction dir = static_cast(getValue(FREQSHIFTER_LEFTDIR, static_cast(DIR_MAX_ENUM))); - if (dir == DIR_NONE) - alEffecti(effect, AL_FREQUENCY_SHIFTER_LEFT_DIRECTION, AL_FREQUENCY_SHIFTER_DIRECTION_OFF); - else if(dir == DIR_UP) - alEffecti(effect, AL_FREQUENCY_SHIFTER_LEFT_DIRECTION, AL_FREQUENCY_SHIFTER_DIRECTION_UP); - else if(dir == DIR_DOWN) - alEffecti(effect, AL_FREQUENCY_SHIFTER_LEFT_DIRECTION, AL_FREQUENCY_SHIFTER_DIRECTION_DOWN); - else - alEffecti(effect, AL_FREQUENCY_SHIFTER_LEFT_DIRECTION, AL_FREQUENCY_SHIFTER_DEFAULT_LEFT_DIRECTION); - - dir = static_cast(getValue(FREQSHIFTER_RIGHTDIR, static_cast(DIR_MAX_ENUM))); - if (dir == DIR_NONE) - alEffecti(effect, AL_FREQUENCY_SHIFTER_RIGHT_DIRECTION, AL_FREQUENCY_SHIFTER_DIRECTION_OFF); - else if(dir == DIR_UP) - alEffecti(effect, AL_FREQUENCY_SHIFTER_RIGHT_DIRECTION, AL_FREQUENCY_SHIFTER_DIRECTION_UP); - else if(dir == DIR_DOWN) - alEffecti(effect, AL_FREQUENCY_SHIFTER_RIGHT_DIRECTION, AL_FREQUENCY_SHIFTER_DIRECTION_DOWN); - else - alEffecti(effect, AL_FREQUENCY_SHIFTER_RIGHT_DIRECTION, AL_FREQUENCY_SHIFTER_DEFAULT_RIGHT_DIRECTION); - break; - } - case TYPE_MORPHER: - { - Waveform wave = static_cast(getValue(MORPHER_WAVEFORM, static_cast(WAVE_MAX_ENUM))); - if (wave == WAVE_SINE) - alEffecti(effect, AL_VOCAL_MORPHER_WAVEFORM, AL_VOCAL_MORPHER_WAVEFORM_SINUSOID); - else if (wave == WAVE_TRIANGLE) - alEffecti(effect, AL_VOCAL_MORPHER_WAVEFORM, AL_VOCAL_MORPHER_WAVEFORM_TRIANGLE); - else if (wave == WAVE_SAWTOOTH) - alEffecti(effect, AL_VOCAL_MORPHER_WAVEFORM, AL_VOCAL_MORPHER_WAVEFORM_SAWTOOTH); - else - alEffecti(effect, AL_VOCAL_MORPHER_WAVEFORM, AL_VOCAL_MORPHER_DEFAULT_WAVEFORM); - - Phoneme phoneme = static_cast(getValue(MORPHER_PHONEMEA, static_cast(PHONEME_MAX_ENUM))); - if (phoneme == PHONEME_MAX_ENUM) - alEffecti(effect, AL_VOCAL_MORPHER_PHONEMEA, AL_VOCAL_MORPHER_DEFAULT_PHONEMEA); - else - alEffecti(effect, AL_VOCAL_MORPHER_PHONEMEA, phonemeMap[phoneme]); - - phoneme = static_cast(getValue(MORPHER_PHONEMEB, static_cast(PHONEME_MAX_ENUM))); - if (phoneme == PHONEME_MAX_ENUM) - alEffecti(effect, AL_VOCAL_MORPHER_PHONEMEB, AL_VOCAL_MORPHER_DEFAULT_PHONEMEB); - else - alEffecti(effect, AL_VOCAL_MORPHER_PHONEMEB, phonemeMap[phoneme]); - - alEffectf(PARAMSTR(MORPHER_RATE,VOCAL_MORPHER,RATE)); - alEffecti(PARAMSTR(MORPHER_TUNEA,VOCAL_MORPHER,PHONEMEA_COARSE_TUNING)); - alEffecti(PARAMSTR(MORPHER_TUNEB,VOCAL_MORPHER,PHONEMEB_COARSE_TUNING)); - break; - } - case TYPE_PITCHSHIFTER: - { - float tune = getValue(PITCHSHIFTER_PITCH, (float)AL_PITCH_SHIFTER_DEFAULT_COARSE_TUNE + (float)(AL_PITCH_SHIFTER_DEFAULT_FINE_TUNE - 50) / 100.0 ); - - int coarse = (int)floor(tune); - int fine = (int)(fmod(tune, 1.0)*100.0); - if (fine > 50) - { - fine -= 100; - coarse += 1; - } - else if (fine < -50) - { - fine += 100; - coarse -= 1; - } - if (coarse > AL_PITCH_SHIFTER_MAX_COARSE_TUNE) - { - coarse = AL_PITCH_SHIFTER_MAX_COARSE_TUNE; - fine = AL_PITCH_SHIFTER_MAX_FINE_TUNE; - } - else if (coarse < AL_PITCH_SHIFTER_MIN_COARSE_TUNE) - { - coarse = AL_PITCH_SHIFTER_MIN_COARSE_TUNE; - fine = AL_PITCH_SHIFTER_MIN_FINE_TUNE; - } - alEffecti(effect, AL_PITCH_SHIFTER_COARSE_TUNE, coarse); - alEffecti(effect, AL_PITCH_SHIFTER_FINE_TUNE, fine); - break; - } -*/ - case TYPE_MODULATOR: - { - Waveform wave = static_cast(getValue(MODULATOR_WAVEFORM,static_cast(WAVE_MAX_ENUM))); - if (wave == WAVE_SINE) - alEffecti(effect, AL_RING_MODULATOR_WAVEFORM, AL_RING_MODULATOR_SINUSOID); - else if (wave == WAVE_SAWTOOTH) - alEffecti(effect, AL_RING_MODULATOR_WAVEFORM, AL_RING_MODULATOR_SAWTOOTH); - else if (wave == WAVE_SQUARE) - alEffecti(effect, AL_RING_MODULATOR_WAVEFORM, AL_RING_MODULATOR_SQUARE); - else - alEffecti(effect, AL_RING_MODULATOR_WAVEFORM, AL_RING_MODULATOR_DEFAULT_WAVEFORM); - - alEffectf(PARAMSTR(MODULATOR_FREQ,RING_MODULATOR,FREQUENCY)); - alEffectf(PARAMSTR(MODULATOR_HIGHCUT,RING_MODULATOR,HIGHPASS_CUTOFF)); - break; - } -/* - case TYPE_AUTOWAH: - alEffectf(PARAMSTR(AUTOWAH_ATTACK,AUTOWAH,ATTACK_TIME)); - alEffectf(PARAMSTR(AUTOWAH_RELEASE,AUTOWAH,RELEASE_TIME)); - alEffectf(PARAMSTR(AUTOWAH_RESONANCE,AUTOWAH,RESONANCE)); - alEffectf(PARAMSTR(AUTOWAH_PEAKGAIN,AUTOWAH,PEAK_GAIN)); - break; -*/ - case TYPE_COMPRESSOR: - alEffecti(effect, AL_COMPRESSOR_ONOFF, getValue(COMPRESSOR_ENABLE,static_cast(AL_COMPRESSOR_DEFAULT_ONOFF))); - break; - - case TYPE_EQUALIZER: - alEffectf(PARAMSTR(EQUALIZER_LOWGAIN,EQUALIZER,LOW_GAIN)); - alEffectf(PARAMSTR(EQUALIZER_LOWCUT,EQUALIZER,LOW_CUTOFF)); - alEffectf(PARAMSTR(EQUALIZER_MID1GAIN,EQUALIZER,MID1_GAIN)); - alEffectf(PARAMSTR(EQUALIZER_MID1FREQ,EQUALIZER,MID1_CENTER)); - alEffectf(PARAMSTR(EQUALIZER_MID1BAND,EQUALIZER,MID1_WIDTH)); - alEffectf(PARAMSTR(EQUALIZER_MID2GAIN,EQUALIZER,MID2_GAIN)); - alEffectf(PARAMSTR(EQUALIZER_MID2FREQ,EQUALIZER,MID2_CENTER)); - alEffectf(PARAMSTR(EQUALIZER_MID2BAND,EQUALIZER,MID2_WIDTH)); - alEffectf(PARAMSTR(EQUALIZER_HIGHGAIN,EQUALIZER,HIGH_GAIN)); - alEffectf(PARAMSTR(EQUALIZER_HIGHCUT,EQUALIZER,HIGH_CUTOFF)); - break; - case TYPE_BASIC: - case TYPE_MAX_ENUM: - break; - } -#undef PARAMSTR -#undef clampf - //alGetError(); - - return true; -#else - return false; -#endif //ALC_EXT_EFX -} - -const std::map &Effect::getParams() const -{ - return params; -} - -float Effect::getValue(Parameter in, float def) const -{ - return params.find(in) == params.end() ? def : params.at(in); -} - -int Effect::getValue(Parameter in, int def) const -{ - return params.find(in) == params.end() ? def : static_cast(params.at(in)); -} - -/* -std::map Effect::phonemeMap = -{ - {Effect::PHONEME_A, AL_VOCAL_MORPHER_PHONEME_A}, - {Effect::PHONEME_E, AL_VOCAL_MORPHER_PHONEME_E}, - {Effect::PHONEME_I, AL_VOCAL_MORPHER_PHONEME_I}, - {Effect::PHONEME_O, AL_VOCAL_MORPHER_PHONEME_O}, - {Effect::PHONEME_U, AL_VOCAL_MORPHER_PHONEME_U}, - {Effect::PHONEME_AA, AL_VOCAL_MORPHER_PHONEME_AA}, - {Effect::PHONEME_AE, AL_VOCAL_MORPHER_PHONEME_AE}, - {Effect::PHONEME_AH, AL_VOCAL_MORPHER_PHONEME_AH}, - {Effect::PHONEME_AO, AL_VOCAL_MORPHER_PHONEME_AO}, - {Effect::PHONEME_EH, AL_VOCAL_MORPHER_PHONEME_EH}, - {Effect::PHONEME_ER, AL_VOCAL_MORPHER_PHONEME_ER}, - {Effect::PHONEME_IH, AL_VOCAL_MORPHER_PHONEME_IH}, - {Effect::PHONEME_IY, AL_VOCAL_MORPHER_PHONEME_IY}, - {Effect::PHONEME_UH, AL_VOCAL_MORPHER_PHONEME_UH}, - {Effect::PHONEME_UW, AL_VOCAL_MORPHER_PHONEME_UW}, - {Effect::PHONEME_B, AL_VOCAL_MORPHER_PHONEME_B}, - {Effect::PHONEME_D, AL_VOCAL_MORPHER_PHONEME_D}, - {Effect::PHONEME_F, AL_VOCAL_MORPHER_PHONEME_F}, - {Effect::PHONEME_G, AL_VOCAL_MORPHER_PHONEME_G}, - {Effect::PHONEME_J, AL_VOCAL_MORPHER_PHONEME_J}, - {Effect::PHONEME_K, AL_VOCAL_MORPHER_PHONEME_K}, - {Effect::PHONEME_L, AL_VOCAL_MORPHER_PHONEME_L}, - {Effect::PHONEME_M, AL_VOCAL_MORPHER_PHONEME_M}, - {Effect::PHONEME_N, AL_VOCAL_MORPHER_PHONEME_N}, - {Effect::PHONEME_P, AL_VOCAL_MORPHER_PHONEME_P}, - {Effect::PHONEME_R, AL_VOCAL_MORPHER_PHONEME_R}, - {Effect::PHONEME_S, AL_VOCAL_MORPHER_PHONEME_S}, - {Effect::PHONEME_T, AL_VOCAL_MORPHER_PHONEME_T}, - {Effect::PHONEME_V, AL_VOCAL_MORPHER_PHONEME_V}, - {Effect::PHONEME_Z, AL_VOCAL_MORPHER_PHONEME_Z} -}; -*/ - -} //openal -} //audio -} //love diff --git a/love/src/jni/love/src/modules/audio/openal/Effect.h b/love/src/jni/love/src/modules/audio/openal/Effect.h deleted file mode 100644 index 547db2e6..00000000 --- a/love/src/jni/love/src/modules/audio/openal/Effect.h +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Copyright (c) 2006-2016 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_AUDIO_OPENAL_EFFECTS_H -#define LOVE_AUDIO_OPENAL_EFFECTS_H - -#include "common/config.h" - -// OpenAL -#ifdef LOVE_APPLE_USE_FRAMEWORKS // Frameworks have different include paths. -#ifdef LOVE_IOS -#include -#include -#else -#include -#include -#include -#endif -#else -#include -#include -#include -#endif - -#include -#include - -#include "audio/Effect.h" -#include "Audio.h" - -#ifndef AL_EFFECT_NULL -#define AL_EFFECT_NULL (0) -#endif - -#ifndef AL_EFFECTSLOT_NULL -#define AL_EFFECTSLOT_NULL (0) -#endif - -namespace love -{ -namespace audio -{ -namespace openal -{ - -class Effect : public love::audio::Effect -{ -public: - Effect(); - Effect(const Effect &s); - virtual ~Effect(); - virtual Effect *clone(); - ALuint getEffect() const; - virtual bool setParams(const std::map ¶ms); - virtual const std::map &getParams() const; - -private: - bool generateEffect(); - void deleteEffect(); - float getValue(Parameter in, float def) const; - int getValue(Parameter in, int def) const; - - ALuint effect = AL_EFFECT_NULL; - std::map params; - //static std::map phonemeMap; -}; - -} //openal -} //audio -} //love - -#endif //LOVE_AUDIO_OPENAL_EFFECTS_H diff --git a/love/src/jni/love/src/modules/audio/openal/Filter.cpp b/love/src/jni/love/src/modules/audio/openal/Filter.cpp deleted file mode 100644 index ec2fb9b7..00000000 --- a/love/src/jni/love/src/modules/audio/openal/Filter.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "Filter.h" -#include "common/Exception.h" - -#include - -namespace love -{ -namespace audio -{ -namespace openal -{ - -//base class -Filter::Filter() -{ - generateFilter(); -} - -Filter::Filter(const Filter &s) - : Filter() -{ - setParams(s.getParams()); -} - -Filter::~Filter() -{ - deleteFilter(); -} - -Filter *Filter::clone() -{ - return new Filter(*this); -} - -bool Filter::generateFilter() -{ -#ifdef ALC_EXT_EFX - if (!alGenFilters) - return false; - - if (filter != AL_FILTER_NULL) - return true; - - alGenFilters(1, &filter); - if (alGetError() != AL_NO_ERROR) - throw love::Exception("Failed to create sound Filter."); - - return true; -#else - return false; -#endif -} - -void Filter::deleteFilter() -{ -#ifdef ALC_EXT_EFX - if (filter != AL_FILTER_NULL) - alDeleteFilters(1, &filter); -#endif - filter = AL_FILTER_NULL; -} - -ALuint Filter::getFilter() const -{ - return filter; -} - -bool Filter::setParams(const std::map ¶ms) -{ - this->params = params; - type = (Type)(int) this->params[FILTER_TYPE]; - - if (!generateFilter()) - return false; - -#ifdef ALC_EXT_EFX - switch (type) - { - case TYPE_LOWPASS: - alFilteri(filter, AL_FILTER_TYPE, AL_FILTER_LOWPASS); - break; - case TYPE_HIGHPASS: - alFilteri(filter, AL_FILTER_TYPE, AL_FILTER_HIGHPASS); - break; - case TYPE_BANDPASS: - alFilteri(filter, AL_FILTER_TYPE, AL_FILTER_BANDPASS); - break; - case TYPE_BASIC: - case TYPE_MAX_ENUM: - break; - } - - //failed to make filter specific type - not supported etc. - if (alGetError() != AL_NO_ERROR) - { - deleteFilter(); - return false; - } - -#define clampf(v,l,h) fmax(fmin((v),(h)),(l)) -#define PARAMSTR(i,e,v) filter,AL_##e##_##v,clampf(getValue(i,AL_##e##_DEFAULT_##v),AL_##e##_MIN_##v,AL_##e##_MAX_##v) - switch (type) - { - case TYPE_LOWPASS: - alFilterf(PARAMSTR(FILTER_VOLUME,LOWPASS,GAIN)); - alFilterf(PARAMSTR(FILTER_HIGHGAIN,LOWPASS,GAINHF)); - break; - case TYPE_HIGHPASS: - alFilterf(PARAMSTR(FILTER_VOLUME,HIGHPASS,GAIN)); - alFilterf(PARAMSTR(FILTER_LOWGAIN,HIGHPASS,GAINLF)); - break; - case TYPE_BANDPASS: - alFilterf(PARAMSTR(FILTER_VOLUME,BANDPASS,GAIN)); - alFilterf(PARAMSTR(FILTER_LOWGAIN,BANDPASS,GAINLF)); - alFilterf(PARAMSTR(FILTER_HIGHGAIN,BANDPASS,GAINHF)); - break; - case TYPE_BASIC: - case TYPE_MAX_ENUM: - break; - } -#undef clampf -#undef PARAMSTR - //alGetError(); - - return true; -#else - return false; -#endif -} - -const std::map &Filter::getParams() const -{ - return params; -} - -float Filter::getValue(Parameter in, float def) const -{ - return params.find(in) == params.end() ? def : params.at(in); -} - -int Filter::getValue(Parameter in, int def) const -{ - return params.find(in) == params.end() ? def : static_cast(params.at(in)); -} - -} //openal -} //audio -} //love diff --git a/love/src/jni/love/src/modules/audio/openal/Filter.h b/love/src/jni/love/src/modules/audio/openal/Filter.h deleted file mode 100644 index 6e3c6239..00000000 --- a/love/src/jni/love/src/modules/audio/openal/Filter.h +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_AUDIO_OPENAL_FILTERS_H -#define LOVE_AUDIO_OPENAL_FILTERS_H - -#include "common/config.h" - -// OpenAL -#ifdef LOVE_APPLE_USE_FRAMEWORKS // Frameworks have different include paths. -#ifdef LOVE_IOS -#include -#include -#else -#include -#include -#include -#endif -#else -#include -#include -#include -#endif - -#include - -#include "audio/Filter.h" -#include "Audio.h" - -#ifndef AL_FILTER_NULL -#define AL_FILTER_NULL (0) -#endif - -namespace love -{ -namespace audio -{ -namespace openal -{ - -class Filter : public love::audio::Filter -{ -public: - Filter(); - Filter(const Filter &s); - virtual ~Filter(); - virtual Filter *clone(); - ALuint getFilter() const; - virtual bool setParams(const std::map ¶ms); - virtual const std::map &getParams() const; - -private: - bool generateFilter(); - void deleteFilter(); - float getValue(Parameter in, float def) const; - int getValue(Parameter in, int def) const; - ALuint filter = AL_FILTER_NULL; - std::map params; -}; - -} //openal -} //audio -} //love - -#endif //LOVE_AUDIO_OPENAL_FILTERS_H diff --git a/love/src/jni/love/src/modules/audio/openal/Pool.cpp b/love/src/jni/love/src/modules/audio/openal/Pool.cpp deleted file mode 100644 index 565041bb..00000000 --- a/love/src/jni/love/src/modules/audio/openal/Pool.cpp +++ /dev/null @@ -1,192 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "Pool.h" - -#include "Source.h" - -namespace love -{ -namespace audio -{ -namespace openal -{ - -Pool::Pool() - : sources() - , totalSources(0) -{ - // Clear errors. - alGetError(); - - // Generate sources. - for (int i = 0; i < MAX_SOURCES; i++) - { - alGenSources(1, &sources[i]); - - // We might hit an implementation-dependent limit on the total number - // of sources before reaching MAX_SOURCES. - if (alGetError() != AL_NO_ERROR) - break; - - totalSources++; - } - - if (totalSources < 4) - throw love::Exception("Could not generate sources."); - -#ifdef AL_SOFT_direct_channels - ALboolean hasext = alIsExtensionPresent("AL_SOFT_direct_channels"); -#endif - - // Make all sources available initially. - for (int i = 0; i < totalSources; i++) - { -#ifdef AL_SOFT_direct_channels - if (hasext) - { - // Bypass virtualization of speakers for multi-channel sources in OpenAL Soft. - alSourcei(sources[i], AL_DIRECT_CHANNELS_SOFT, AL_TRUE); - } -#endif - - available.push(sources[i]); - } -} - -Pool::~Pool() -{ - Source::stop(this); - - // Free all sources. - alDeleteSources(totalSources, sources); -} - -bool Pool::isAvailable() const -{ - bool has = false; - { - thread::Lock lock(mutex); - has = !available.empty(); - } - return has; -} - -bool Pool::isPlaying(Source *s) -{ - bool p = false; - { - thread::Lock lock(mutex); - p = (playing.find(s) != playing.end()); - } - return p; -} - -void Pool::update() -{ - thread::Lock lock(mutex); - - std::vector torelease; - - for (const auto &i : playing) - { - if (!i.first->update()) - torelease.push_back(i.first); - } - - for (Source *s : torelease) - releaseSource(s); -} - -int Pool::getActiveSourceCount() const -{ - return (int) playing.size(); -} - -int Pool::getMaxSources() const -{ - return totalSources; -} - -bool Pool::assignSource(Source *source, ALuint &out, char &wasPlaying) -{ - out = 0; - - if (findSource(source, out)) - return wasPlaying = true; - - wasPlaying = false; - - if (available.empty()) - return false; - - out = available.front(); - available.pop(); - - playing.insert(std::make_pair(source, out)); - source->retain(); - return true; -} - -bool Pool::releaseSource(Source *source, bool stop) -{ - ALuint s; - - if (findSource(source, s)) - { - if (stop) - source->stopAtomic(); - source->release(); - available.push(s); - playing.erase(source); - return true; - } - - return false; -} - -bool Pool::findSource(Source *source, ALuint &out) -{ - std::map::const_iterator i = playing.find(source); - - if (i == playing.end()) - return false; - - out = i->second; - return true; -} - -thread::Lock Pool::lock() -{ - return thread::Lock(mutex); -} - -std::vector Pool::getPlayingSources() -{ - std::vector sources; - sources.reserve(playing.size()); - for (auto &i : playing) - sources.push_back(i.first); - return sources; -} - -} // openal -} // audio -} // love diff --git a/love/src/jni/love/src/modules/audio/openal/Pool.h b/love/src/jni/love/src/modules/audio/openal/Pool.h deleted file mode 100644 index fe57382e..00000000 --- a/love/src/jni/love/src/modules/audio/openal/Pool.h +++ /dev/null @@ -1,126 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_AUDIO_OPENAL_POOL_H -#define LOVE_AUDIO_OPENAL_POOL_H - -// STD -#include -#include -#include -#include - -// LOVE -#include "common/config.h" -#include "common/Exception.h" -#include "thread/threads.h" -#include "audio/Source.h" - -// OpenAL -#ifdef LOVE_APPLE_USE_FRAMEWORKS -#ifdef LOVE_IOS -#include -#include -#include -#include -#else -#include -#include -#include -#endif -#else -#include -#include -#include -#endif - -namespace love -{ -namespace audio -{ -namespace openal -{ - -class Source; - -class Pool -{ -public: - - Pool(); - ~Pool(); - - /** - * Checks whether an OpenAL source is available. - * @return True if at least one is available, false otherwise. - **/ - bool isAvailable() const; - - /** - * Checks whether a Source is currently in the playing list. - **/ - bool isPlaying(Source *s); - - void update(); - - int getActiveSourceCount() const; - int getMaxSources() const; - -private: - - friend class Source; - LOVE_WARN_UNUSED thread::Lock lock(); - std::vector getPlayingSources(); - - /** - * Makes the specified OpenAL source available for use. - * @param source The OpenAL source. - **/ - bool releaseSource(Source *source, bool stop = true); - - bool assignSource(Source *source, ALuint &out, char &wasPlaying); - bool findSource(Source *source, ALuint &out); - - // Maximum possible number of OpenAL sources the pool attempts to generate. - static const int MAX_SOURCES = 64; - - // OpenAL sources - ALuint sources[MAX_SOURCES]; - - // Total number of created sources in the pool. - int totalSources; - - // A queue of available sources. - std::queue available; - - // A map of playing sources. - std::map playing; - - // Only one thread can access this object at the same time. This mutex will - // make sure of that. - love::thread::MutexRef mutex; - -}; // Pool - -} // openal -} // audio -} // love - -#endif // LOVE_AUDIO_OPENAL_POOL_H diff --git a/love/src/jni/love/src/modules/audio/openal/RecordingDevice.cpp b/love/src/jni/love/src/modules/audio/openal/RecordingDevice.cpp deleted file mode 100644 index 26a2fb29..00000000 --- a/love/src/jni/love/src/modules/audio/openal/RecordingDevice.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "RecordingDevice.h" -#include "Audio.h" -#include "sound/Sound.h" - -namespace love -{ -namespace audio -{ -namespace openal -{ - -#define soundInstance() (Module::getInstance(Module::M_SOUND)) - -class InvalidFormatException : public love::Exception -{ -public: - - InvalidFormatException(int channels, int bitdepth) - : Exception("Recording %d channels with %d bits per sample is not supported.", channels, bitdepth) - { - } - -}; - -RecordingDevice::RecordingDevice(const char *name) - : name(name) -{ -} - -RecordingDevice::~RecordingDevice() -{ - stop(); -} - -bool RecordingDevice::start(int samples, int sampleRate, int bitDepth, int channels) -{ - ALenum format = Audio::getFormat(bitDepth, channels); - if (format == AL_NONE) - throw InvalidFormatException(channels, bitDepth); - - if (samples <= 0) - throw love::Exception("Invalid number of samples."); - - if (sampleRate <= 0) - throw love::Exception("Invalid sample rate."); - - if (isRecording()) - stop(); - - device = alcCaptureOpenDevice(name.c_str(), sampleRate, format, samples); - if (device == nullptr) - return false; - - alcCaptureStart(device); - - this->samples = samples; - this->sampleRate = sampleRate; - this->bitDepth = bitDepth; - this->channels = channels; - - return true; -} - -void RecordingDevice::stop() -{ - if (!isRecording()) - return; - - alcCaptureStop(device); - alcCaptureCloseDevice(device); - device = nullptr; -} - -love::sound::SoundData *RecordingDevice::getData() -{ - if (!isRecording()) - return nullptr; - - int samples = getSampleCount(); - if (samples == 0) - return nullptr; - - love::sound::SoundData *soundData = soundInstance()->newSoundData(samples, sampleRate, bitDepth, channels); - - alcCaptureSamples(device, soundData->getData(), samples); - - return soundData; -} - -int RecordingDevice::getSampleCount() const -{ - if (!isRecording()) - return 0; - - ALCint samples; - alcGetIntegerv(device, ALC_CAPTURE_SAMPLES, sizeof(ALCint), &samples); - return (int)samples; -} - -int RecordingDevice::getMaxSamples() const -{ - return samples; -} - -int RecordingDevice::getSampleRate() const -{ - return sampleRate; -} - -int RecordingDevice::getBitDepth() const -{ - return bitDepth; -} - -int RecordingDevice::getChannelCount() const -{ - return channels; -} - -const char *RecordingDevice::getName() const -{ - return name.c_str(); -} - -bool RecordingDevice::isRecording() const -{ - return device != nullptr; -} - -} //openal -} //audio -} //love diff --git a/love/src/jni/love/src/modules/audio/openal/RecordingDevice.h b/love/src/jni/love/src/modules/audio/openal/RecordingDevice.h deleted file mode 100644 index 19ed6a2c..00000000 --- a/love/src/jni/love/src/modules/audio/openal/RecordingDevice.h +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_AUDIO_OPENAL_RECORDING_DEVICE_H -#define LOVE_AUDIO_OPENAL_RECORDING_DEVICE_H - -#include "common/config.h" - -#ifdef LOVE_APPLE_USE_FRAMEWORKS -#ifdef LOVE_IOS -#include -#include -#else -#include -#include -#endif -#else -#include -#include -#endif - -#include "audio/RecordingDevice.h" -#include "sound/SoundData.h" - -namespace love -{ -namespace audio -{ -namespace openal -{ - -class RecordingDevice : public love::audio::RecordingDevice -{ -public: - - RecordingDevice(const char *name); - virtual ~RecordingDevice(); - virtual bool start(int samples, int sampleRate, int bitDepth, int channels); - virtual void stop(); - virtual love::sound::SoundData *getData(); - virtual const char *getName() const; - virtual int getSampleCount() const; - virtual int getMaxSamples() const; - virtual int getSampleRate() const; - virtual int getBitDepth() const; - virtual int getChannelCount() const; - virtual bool isRecording() const; - -private: - - int samples = DEFAULT_SAMPLES; - int sampleRate = DEFAULT_SAMPLE_RATE; - int bitDepth = DEFAULT_BIT_DEPTH; - int channels = DEFAULT_CHANNELS; - - std::string name; - ALCdevice *device = nullptr; - -}; //RecordingDevice - -} //openal -} //audio -} //love - -#endif //LOVE_AUDIO_OPENAL_RECORDING_DEVICE_H diff --git a/love/src/jni/love/src/modules/audio/openal/Source.cpp b/love/src/jni/love/src/modules/audio/openal/Source.cpp deleted file mode 100644 index 8c6e90a1..00000000 --- a/love/src/jni/love/src/modules/audio/openal/Source.cpp +++ /dev/null @@ -1,1514 +0,0 @@ -/** - * Copyright (c) 2006-2018 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "Source.h" -#include "Filter.h" -#include "Pool.h" -#include "Audio.h" -#include "common/math.h" - -// STD -#include -#include - -#define audiomodule() (Module::getInstance